From 6457371538de38f739a5d8d9b5b84c9829662262 Mon Sep 17 00:00:00 2001 From: Aleksandar Cakalic Date: Wed, 6 Nov 2024 12:16:56 +0100 Subject: [PATCH] fix: add missing `closeModalOld` for the old way of usage --- .../argent/argentMobile/modal/argentModal.ts | 14 +++++++++++++- .../argent/argentMobile/modal/starknet/adapter.ts | 4 ++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/connectors/argent/argentMobile/modal/argentModal.ts b/src/connectors/argent/argentMobile/modal/argentModal.ts index 8f32dd2..b073052 100644 --- a/src/connectors/argent/argentMobile/modal/argentModal.ts +++ b/src/connectors/argent/argentMobile/modal/argentModal.ts @@ -172,7 +172,6 @@ class ArgentModal { }) } - // TODO - SK-47 - remove this public closeModal(success?: boolean) { const modal = this.standaloneConnectorModal if (success) { @@ -183,6 +182,19 @@ class ArgentModal { } } + // TODO - SK-47 - remove this + public closeModalOld(success?: boolean) { + if (success) { + this.overlay + ?.querySelector("iframe") + ?.contentWindow?.postMessage("argent-login.success", "*") + this.popupWindow?.postMessage("argent-login.success", "*") + this.closingTimeout = setTimeout(this.close, 3400) + } else { + this.close() + } + } + private showModal(urls: Urls, modalWallet: ModalWalletExtended) { this.standaloneConnectorModal = new Modal({ target: getModalTarget(), diff --git a/src/connectors/argent/argentMobile/modal/starknet/adapter.ts b/src/connectors/argent/argentMobile/modal/starknet/adapter.ts index 387a2ae..06dcedb 100644 --- a/src/connectors/argent/argentMobile/modal/starknet/adapter.ts +++ b/src/connectors/argent/argentMobile/modal/starknet/adapter.ts @@ -186,10 +186,10 @@ export class StarknetAdapter const chainId = this.formatChainId(this.chainId) argentModal.showApprovalModal(request) const response = await this.client.request({ topic, chainId, request }) - argentModal.closeModal(true) + argentModal.closeModalOld(true) return response } catch (error) { - argentModal.closeModal() + argentModal.closeModalOld() if (error instanceof Error) { throw new Error(error.message) }