From 8e25755e4f84fb3a06bf715b9adda28253754774 Mon Sep 17 00:00:00 2001 From: gllm-dev Date: Fri, 15 Mar 2024 16:21:30 +0100 Subject: [PATCH 1/2] fix: remove dispose on logout --- src/clients/iframe-client.ts | 31 +++++++++++++------------------ src/signer/embedded.signer.ts | 1 - 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/clients/iframe-client.ts b/src/clients/iframe-client.ts index b88176e..0dbdfa6 100644 --- a/src/clients/iframe-client.ts +++ b/src/clients/iframe-client.ts @@ -6,10 +6,10 @@ export class IframeClient { throw new Error("must be run in a browser"); } - const actualIframeURL = document.getElementById("openfort-iframe"); + const actualIframeURL = document.getElementById("openfort-iframe") as HTMLIFrameElement; if (actualIframeURL) { - actualIframeURL.setAttribute("src", "https://iframe.openfort.xyz/iframe?accessToken=" + accessToken + "&publishableKey=" + publishableKey); - this._iframe = actualIframeURL as HTMLIFrameElement; + actualIframeURL.src = "https://iframe.openfort.xyz/iframe?accessToken=" + accessToken + "&publishableKey=" + publishableKey; + this._iframe = actualIframeURL; return; } @@ -21,13 +21,6 @@ export class IframeClient { document.body.appendChild(this._iframe); } - public dispose(): void { - const iframe = document.getElementById("openfort-iframe"); - if (iframe) { - iframe.remove(); - } - } - public isLoaded(): boolean { return this._iframe.contentWindow !== null; } @@ -57,14 +50,16 @@ export class IframeClient { window.addEventListener("message", handleMessage); - this._iframe.contentWindow?.postMessage( - { - action: "generateKey", - password: password, - chainId: chainId, - }, - "*", - ); + setTimeout(() => { + this._iframe.contentWindow?.postMessage( + { + action: "generateKey", + password: password, + chainId: chainId, + }, + "*", + ); + }, 1000); }); } diff --git a/src/signer/embedded.signer.ts b/src/signer/embedded.signer.ts index ffef3c4..9b76cbe 100644 --- a/src/signer/embedded.signer.ts +++ b/src/signer/embedded.signer.ts @@ -19,7 +19,6 @@ export class EmbeddedSigner implements ISigner { async logout(): Promise { await this._iframeClient.logout(); this._instanceManager.removeDeviceID(); - this._iframeClient.dispose(); } useCredentials(): boolean { return true; From 6aea688dca712567441caf847feb817b886407ce Mon Sep 17 00:00:00 2001 From: gllm-dev Date: Fri, 15 Mar 2024 16:21:58 +0100 Subject: [PATCH 2/2] fix: remove dispose on logout --- package.json | 2 +- src/version.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 6a9ee2f..ad6d20d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@openfort/openfort-js", - "version": "0.5.16", + "version": "0.5.17", "description": "", "author": "Openfort", "repository": { diff --git a/src/version.ts b/src/version.ts index c2312bb..b8ee9bb 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1,2 +1,2 @@ -export const VERSION = "0.5.16"; +export const VERSION = "0.5.17"; export const PACKAGE = "@openfort/openfort-js";