From 536d8033c4f96a3592aa4f23113dcf0fdf0c3fbb Mon Sep 17 00:00:00 2001 From: Tudor Morar Date: Thu, 25 Apr 2024 11:21:47 +0300 Subject: [PATCH 1/4] Prevent double mounting --- src/CrossWindowProvider/CrossWindowProvider.ts | 3 ++- src/CrossWindowProvider/PopupConsent/PopupConsent.ts | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/CrossWindowProvider/CrossWindowProvider.ts b/src/CrossWindowProvider/CrossWindowProvider.ts index a03e93f..a2835b5 100644 --- a/src/CrossWindowProvider/CrossWindowProvider.ts +++ b/src/CrossWindowProvider/CrossWindowProvider.ts @@ -5,6 +5,7 @@ import { CrossWindowProviderResponseEnums, SignMessageStatusEnum } from '@multiversx/sdk-dapp-utils/out/enums/crossWindowProviderEnums'; +import { WindowManager } from '../WindowManager'; import { ErrAccountNotConnected, ErrCannotSignSingleTransaction, @@ -16,7 +17,6 @@ import { ErrProviderNotInitialized, ErrTransactionCancelled } from '../errors'; -import { WindowManager } from '../WindowManager'; import { PopupConsent, confirmationDialogTag } from './PopupConsent'; interface ICrossWindowWalletAccount { @@ -25,6 +25,7 @@ interface ICrossWindowWalletAccount { multisig?: string; impersonate?: string; } +console.log('\x1b[42m%s\x1b[0m', 'csw2'); export class CrossWindowProvider { public account: ICrossWindowWalletAccount = { address: '' }; diff --git a/src/CrossWindowProvider/PopupConsent/PopupConsent.ts b/src/CrossWindowProvider/PopupConsent/PopupConsent.ts index f3ae1e5..5062ea8 100644 --- a/src/CrossWindowProvider/PopupConsent/PopupConsent.ts +++ b/src/CrossWindowProvider/PopupConsent/PopupConsent.ts @@ -1,10 +1,10 @@ +import { safeWindow } from '@multiversx/sdk-dapp-utils/out/constants/crossWindowProviderConstants'; import { LitElement, html } from 'lit'; -import { customElement, property } from 'lit/decorators.js'; +import { property } from 'lit/decorators.js'; import { getStyles } from './getStyles'; export const confirmationDialogTag = 'mxcwp-confirmation-dialog'; -@customElement(confirmationDialogTag) export class PopupConsent extends LitElement { @property({ type: String }) id = confirmationDialogTag; @@ -108,3 +108,8 @@ export class PopupConsent extends LitElement { this.toggleEvents('removeEventListener'); } } + +const customElements = safeWindow?.customElements; +if (customElements && !customElements.get(confirmationDialogTag)) { + customElements.define(confirmationDialogTag, PopupConsent); +} From 1acaf5a0c0c09159693aa46d99d444ad100b2a6f Mon Sep 17 00:00:00 2001 From: Tudor Morar Date: Thu, 25 Apr 2024 11:35:33 +0300 Subject: [PATCH 2/4] Updated changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c525435..02239e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] + +## [[0.1.2](https://github.com/multiversx/mx-wallet-dapp/pull/40)] - 2024-04-25 +- [Fixed double mounting of web component](https://github.com/multiversx/mx-wallet-dapp/pull/39) + ## [[0.1.1](https://github.com/multiversx/mx-wallet-dapp/pull/38)] - 2024-04-23 - [Removed old `out` folder and recreated it with compile](https://github.com/multiversx/mx-wallet-dapp/pull/38) From 09253c3374776750cc99e3010264c1fbaf1b60c8 Mon Sep 17 00:00:00 2001 From: Tudor Morar Date: Thu, 25 Apr 2024 11:35:55 +0300 Subject: [PATCH 3/4] 0.1.2 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3e48d3e..bcb44f7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@multiversx/sdk-web-wallet-cross-window-provider", - "version": "0.1.1", + "version": "0.1.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@multiversx/sdk-web-wallet-cross-window-provider", - "version": "0.1.1", + "version": "0.1.2", "license": "GPL-3.0-or-later", "dependencies": { "@types/jest": "^29.5.11", diff --git a/package.json b/package.json index 646c76d..28aba4c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@multiversx/sdk-web-wallet-cross-window-provider", - "version": "0.1.1", + "version": "0.1.2", "description": "Signing provider for dApps: Cross Window", "main": "out/index.js", "types": "out/index.d.js", From 7284871114f3cfdf4dd567c9629e364dec9ac8cc Mon Sep 17 00:00:00 2001 From: Tudor Morar Date: Thu, 25 Apr 2024 11:40:12 +0300 Subject: [PATCH 4/4] Removed console --- src/CrossWindowProvider/CrossWindowProvider.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/CrossWindowProvider/CrossWindowProvider.ts b/src/CrossWindowProvider/CrossWindowProvider.ts index a2835b5..a03e93f 100644 --- a/src/CrossWindowProvider/CrossWindowProvider.ts +++ b/src/CrossWindowProvider/CrossWindowProvider.ts @@ -5,7 +5,6 @@ import { CrossWindowProviderResponseEnums, SignMessageStatusEnum } from '@multiversx/sdk-dapp-utils/out/enums/crossWindowProviderEnums'; -import { WindowManager } from '../WindowManager'; import { ErrAccountNotConnected, ErrCannotSignSingleTransaction, @@ -17,6 +16,7 @@ import { ErrProviderNotInitialized, ErrTransactionCancelled } from '../errors'; +import { WindowManager } from '../WindowManager'; import { PopupConsent, confirmationDialogTag } from './PopupConsent'; interface ICrossWindowWalletAccount { @@ -25,7 +25,6 @@ interface ICrossWindowWalletAccount { multisig?: string; impersonate?: string; } -console.log('\x1b[42m%s\x1b[0m', 'csw2'); export class CrossWindowProvider { public account: ICrossWindowWalletAccount = { address: '' };