diff --git a/lib/connector-extension/connector-extension-client.ts b/lib/connector-extension/connector-extension-client.ts index e7d6c8a..18bc98c 100644 --- a/lib/connector-extension/connector-extension-client.ts +++ b/lib/connector-extension/connector-extension-client.ts @@ -213,32 +213,33 @@ export const ConnectorExtensionClient = ( removeEventListener(eventType.incomingMessage, handleIncomingMessage) }, openPopup: () => { - window.dispatchEvent( - new CustomEvent(eventType.outgoingMessage, { - detail: { discriminator: 'openPopup' }, - }) - ) + subjects.outgoingMessageSubject.next({ + interactionId: crypto.randomUUID(), + discriminator: 'openPopup', + }) }, extensionStatus$: of(true).pipe( - tap(() => { + map(() => { + const interactionId = crypto.randomUUID() subjects.outgoingMessageSubject.next({ - interactionId: crypto.randomUUID(), + interactionId, discriminator: 'extensionStatus', }) + return interactionId }), - switchMap(() => + switchMap((interactionId) => race( extensionStatusEvent$, merge( extensionStatusEvent$, timer(config.extensionDetectionTime).pipe( map( - () => - ({ - eventType: 'extensionStatus', - isWalletLinked: false, - isExtensionAvailable: false, - } as MessageLifeCycleExtensionStatusEvent) + (): MessageLifeCycleExtensionStatusEvent => ({ + interactionId, + eventType: 'extensionStatus', + isWalletLinked: false, + isExtensionAvailable: false, + }) ) ) ) diff --git a/package-lock.json b/package-lock.json index cc6ebb3..bb5a3f4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.0.0", "license": "Apache-2.0", "dependencies": { - "@radixdlt/radix-connect-schemas": "^1.0.0", + "@radixdlt/radix-connect-schemas": "^1.1.0", "neverthrow": "^6.0.0", "rxjs": "^7.8.1", "tslog": "4.8.0", @@ -3883,9 +3883,9 @@ } }, "node_modules/@radixdlt/radix-connect-schemas": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@radixdlt/radix-connect-schemas/-/radix-connect-schemas-1.0.0.tgz", - "integrity": "sha512-8XKAEEaHNr9nfvT1P9o1JlX/adhNb5Rf1jwpbLBuRt3qxgSHzqlMrmfENYeRsBpHcN5LoDw2XX6p0H2IMtNIRA==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radixdlt/radix-connect-schemas/-/radix-connect-schemas-1.1.0.tgz", + "integrity": "sha512-s3F6cxWmKMbZ2fUQ9czP/+Lw6aPonA9MulzFWtsgaywKlXWc0pP/GgW5d+x6rfWmxQ0eg4GjEDStmghMKaDC1A==", "dependencies": { "neverthrow": "^6.0.0", "zod": "^3.22.2" diff --git a/package.json b/package.json index 6ecb0b7..0379316 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ "vite-tsconfig-paths": "^4.2.0" }, "dependencies": { - "@radixdlt/radix-connect-schemas": "^1.0.0", + "@radixdlt/radix-connect-schemas": "^1.1.0", "neverthrow": "^6.0.0", "rxjs": "^7.8.1", "tslog": "4.8.0",