@multiversx/sdk-web-wallet-cross-window-provider 2.28.0-alpha.6 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -2
- package/out/CrossWindowProvider/CrossWindowProvider.d.ts +22 -16
- package/out/CrossWindowProvider/CrossWindowProvider.js +104 -62
- package/out/CrossWindowProvider/CrossWindowProvider.js.map +1 -1
- package/out/CrossWindowProvider/PopupConsent/PopupConsent.d.ts +20 -0
- package/out/CrossWindowProvider/PopupConsent/PopupConsent.js +93 -0
- package/out/CrossWindowProvider/PopupConsent/PopupConsent.js.map +1 -0
- package/out/CrossWindowProvider/PopupConsent/PopupConsent.model.d.ts +16 -0
- package/out/CrossWindowProvider/PopupConsent/PopupConsent.model.js +3 -0
- package/out/CrossWindowProvider/PopupConsent/PopupConsent.model.js.map +1 -0
- package/out/CrossWindowProvider/PopupConsent/constants.d.ts +1 -0
- package/out/CrossWindowProvider/PopupConsent/constants.js +5 -0
- package/out/CrossWindowProvider/PopupConsent/constants.js.map +1 -0
- package/out/CrossWindowProvider/PopupConsent/getStyles.d.ts +1 -0
- package/out/CrossWindowProvider/PopupConsent/getStyles.js +90 -0
- package/out/CrossWindowProvider/PopupConsent/getStyles.js.map +1 -0
- package/out/CrossWindowProvider/PopupConsent/index.d.ts +1 -0
- package/out/CrossWindowProvider/PopupConsent/index.js +18 -0
- package/out/CrossWindowProvider/PopupConsent/index.js.map +1 -0
- package/out/CrossWindowProvider/index.d.ts +1 -0
- package/out/CrossWindowProvider/index.js +1 -0
- package/out/CrossWindowProvider/index.js.map +1 -1
- package/out/CrossWindowProvider/tests/Cancel.test.js +6 -7
- package/out/CrossWindowProvider/tests/Cancel.test.js.map +1 -1
- package/out/CrossWindowProvider/tests/Init.test.js +0 -2
- package/out/CrossWindowProvider/tests/Init.test.js.map +1 -1
- package/out/CrossWindowProvider/tests/Login.test.js +1 -3
- package/out/CrossWindowProvider/tests/Login.test.js.map +1 -1
- package/out/CrossWindowProvider/tests/Logout.test.js +2 -4
- package/out/CrossWindowProvider/tests/Logout.test.js.map +1 -1
- package/out/CrossWindowProvider/tests/SignMessage.test.js +6 -7
- package/out/CrossWindowProvider/tests/SignMessage.test.js.map +1 -1
- package/out/CrossWindowProvider/tests/SignTransaction.test.js +1 -3
- package/out/CrossWindowProvider/tests/SignTransaction.test.js.map +1 -1
- package/out/WindowManager/WindowManager.d.ts +12 -7
- package/out/WindowManager/WindowManager.js +74 -43
- package/out/WindowManager/WindowManager.js.map +1 -1
- package/out/WindowManager/tests/windowManager.test.js +15 -16
- package/out/WindowManager/tests/windowManager.test.js.map +1 -1
- package/out/constants/index.d.ts +3 -0
- package/out/constants/index.js +21 -0
- package/out/constants/index.js.map +1 -0
- package/out/constants/windowProviderConstants.d.ts +2 -0
- package/out/constants/windowProviderConstants.js +16 -0
- package/out/constants/windowProviderConstants.js.map +1 -0
- package/out/enums/index.d.ts +2 -0
- package/out/enums/index.js +19 -0
- package/out/enums/index.js.map +1 -0
- package/out/enums/signMessageStatusEnum.d.ts +6 -0
- package/out/enums/signMessageStatusEnum.js +11 -0
- package/out/enums/signMessageStatusEnum.js.map +1 -0
- package/out/enums/windowProviderEnums.d.ts +24 -0
- package/out/enums/windowProviderEnums.js +30 -0
- package/out/enums/windowProviderEnums.js.map +1 -0
- package/out/errors.d.ts +1 -1
- package/out/errors.js +6 -6
- package/out/errors.js.map +1 -1
- package/out/test-utils/createMockTransaction.d.ts +1 -1
- package/out/test-utils/createMockTransaction.js +7 -8
- package/out/test-utils/createMockTransaction.js.map +1 -1
- package/out/test-utils/index.d.ts +0 -1
- package/out/test-utils/index.js +0 -1
- package/out/test-utils/index.js.map +1 -1
- package/out/types/index.d.ts +2 -0
- package/out/types/index.js +19 -0
- package/out/types/index.js.map +1 -0
- package/out/types/nullable.d.ts +1 -0
- package/out/types/nullable.js +3 -0
- package/out/types/nullable.js.map +1 -0
- package/out/types/windowProviderTypes.d.ts +92 -0
- package/out/types/windowProviderTypes.js +4 -0
- package/out/types/windowProviderTypes.js.map +1 -0
- package/package.json +7 -8
- package/out/constants.d.ts +0 -7
- package/out/constants.js +0 -16
- package/out/constants.js.map +0 -1
- package/out/test-utils/mockWindowManager.d.ts +0 -2
- package/out/test-utils/mockWindowManager.js +0 -11
- package/out/test-utils/mockWindowManager.js.map +0 -1
- package/out/types.d.ts +0 -114
- package/out/types.js +0 -34
- package/out/types.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
# mx-sdk-js-web-wallet-cross-window-provider
|
|
2
2
|
|
|
3
|
-
Signing provider for dApps: Cross Window.
|
|
3
|
+
Signing provider for dApps: Web Wallet Cross Window Provider.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This package is part of the MultiversX SDK, which is a set of tools and libraries that allow developers to build decentralized applications (dApps) on the MultiversX blockchain.
|
|
6
|
+
By using this package, developers can integrate the MultiversX Web Wallet into their dApps, allowing users to sign transactions and messages with their MultiversX account.
|
|
7
|
+
The connection between the dApp and the Web Wallet is established through a cross-window communication channel, which is managed by the Web Wallet Cross Window Provider.
|
|
8
|
+
|
|
9
|
+
Documentation is available on [docs.multiversx.com](https://docs.multiversx.com/sdk-and-tools/sdk-js/sdk-js-signing-providers/#the-web-wallet-cross-window-provider), while an integration example can be found [here](https://github.com/multiversx/mx-sdk-js-examples/tree/main/signing-providers).
|
|
6
10
|
|
|
7
11
|
Note that **we recommend using [sdk-dapp](https://github.com/multiversx/mx-sdk-dapp)** instead of integrating the signing provider on your own.
|
|
8
12
|
|
|
@@ -1,38 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { Message, Transaction } from '@multiversx/sdk-core';
|
|
2
|
+
import { WindowProviderRequestEnums } from '../enums';
|
|
3
|
+
import { WindowManager } from '../WindowManager';
|
|
4
|
+
export interface IProviderAccount {
|
|
4
5
|
address: string;
|
|
5
6
|
signature?: string;
|
|
6
7
|
multisig?: string;
|
|
7
8
|
impersonate?: string;
|
|
8
9
|
}
|
|
9
10
|
export declare class CrossWindowProvider {
|
|
10
|
-
account
|
|
11
|
-
private initialized;
|
|
12
|
-
private windowManager;
|
|
13
|
-
private static _instance;
|
|
11
|
+
private account;
|
|
14
12
|
private accessToken;
|
|
13
|
+
protected initialized: boolean;
|
|
14
|
+
protected windowManager: WindowManager;
|
|
15
15
|
protected _shouldShowConsentPopup: boolean;
|
|
16
|
-
|
|
16
|
+
protected static _instance: CrossWindowProvider | null;
|
|
17
|
+
constructor();
|
|
17
18
|
setShouldShowConsentPopup(shouldShow: boolean): void;
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
protected ensureConnected(): void;
|
|
20
|
+
protected disconnect(): void;
|
|
20
21
|
static getInstance(): CrossWindowProvider;
|
|
22
|
+
getWindowManager(): WindowManager;
|
|
21
23
|
setAddress(address: string): CrossWindowProvider;
|
|
22
24
|
setWalletUrl(url: string): CrossWindowProvider;
|
|
25
|
+
setWalletWindow(): Promise<void>;
|
|
23
26
|
init(): Promise<boolean>;
|
|
27
|
+
onDestroy(): boolean;
|
|
24
28
|
login(options?: {
|
|
25
29
|
token?: string;
|
|
26
|
-
}): Promise<
|
|
30
|
+
}): Promise<IProviderAccount>;
|
|
31
|
+
dispose(): Promise<boolean>;
|
|
27
32
|
logout(): Promise<boolean>;
|
|
28
33
|
getAddress(): Promise<string>;
|
|
29
34
|
isInitialized(): boolean;
|
|
30
|
-
isConnected():
|
|
35
|
+
isConnected(): boolean;
|
|
36
|
+
getAccount(): IProviderAccount | null;
|
|
37
|
+
setAccount(account: IProviderAccount): void;
|
|
31
38
|
signTransaction(transaction: Transaction): Promise<Transaction>;
|
|
32
39
|
signTransactions(transactions: Transaction[]): Promise<Transaction[]>;
|
|
33
40
|
guardTransactions(transactions: Transaction[]): Promise<Transaction[]>;
|
|
34
|
-
signMessage(
|
|
35
|
-
cancelAction(): Promise<import("../types").PostMessageReturnType<
|
|
36
|
-
|
|
41
|
+
signMessage(messageToSign: Message): Promise<Message>;
|
|
42
|
+
cancelAction(): Promise<import("../types").PostMessageReturnType<WindowProviderRequestEnums.cancelAction>> | undefined;
|
|
43
|
+
openPopupConsent(): Promise<boolean>;
|
|
37
44
|
}
|
|
38
|
-
export {};
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
27
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -12,20 +35,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
35
|
exports.CrossWindowProvider = void 0;
|
|
13
36
|
const sdk_core_1 = require("@multiversx/sdk-core");
|
|
14
37
|
const constants_1 = require("../constants");
|
|
38
|
+
const enums_1 = require("../enums");
|
|
15
39
|
const errors_1 = require("../errors");
|
|
16
|
-
const types_1 = require("../types");
|
|
17
40
|
const WindowManager_1 = require("../WindowManager");
|
|
41
|
+
const constants_2 = require("./PopupConsent/constants");
|
|
18
42
|
class CrossWindowProvider {
|
|
19
43
|
constructor() {
|
|
20
44
|
this.account = { address: '' };
|
|
21
|
-
this.initialized = false;
|
|
22
45
|
this.accessToken = undefined;
|
|
46
|
+
this.initialized = false;
|
|
23
47
|
this._shouldShowConsentPopup = false;
|
|
24
|
-
|
|
25
|
-
throw new errors_1.ErrInstantiationFailed();
|
|
26
|
-
}
|
|
27
|
-
this.windowManager = WindowManager_1.WindowManager.getInstance();
|
|
28
|
-
CrossWindowProvider._instance = this;
|
|
48
|
+
this.windowManager = new WindowManager_1.WindowManager();
|
|
29
49
|
}
|
|
30
50
|
setShouldShowConsentPopup(shouldShow) {
|
|
31
51
|
this._shouldShowConsentPopup = shouldShow;
|
|
@@ -39,15 +59,25 @@ class CrossWindowProvider {
|
|
|
39
59
|
this.account = { address: '' };
|
|
40
60
|
}
|
|
41
61
|
static getInstance() {
|
|
62
|
+
if (!CrossWindowProvider._instance) {
|
|
63
|
+
CrossWindowProvider._instance = new CrossWindowProvider();
|
|
64
|
+
return CrossWindowProvider._instance;
|
|
65
|
+
}
|
|
42
66
|
return CrossWindowProvider._instance;
|
|
43
67
|
}
|
|
68
|
+
getWindowManager() {
|
|
69
|
+
return this.windowManager;
|
|
70
|
+
}
|
|
44
71
|
setAddress(address) {
|
|
45
72
|
this.account.address = address;
|
|
46
|
-
return
|
|
73
|
+
return this;
|
|
47
74
|
}
|
|
48
75
|
setWalletUrl(url) {
|
|
49
76
|
this.windowManager.setWalletUrl(url);
|
|
50
|
-
return
|
|
77
|
+
return this;
|
|
78
|
+
}
|
|
79
|
+
setWalletWindow() {
|
|
80
|
+
return this.windowManager.setWalletWindow();
|
|
51
81
|
}
|
|
52
82
|
init() {
|
|
53
83
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -55,12 +85,17 @@ class CrossWindowProvider {
|
|
|
55
85
|
return this.initialized;
|
|
56
86
|
});
|
|
57
87
|
}
|
|
88
|
+
onDestroy() {
|
|
89
|
+
CrossWindowProvider._instance = null;
|
|
90
|
+
this.initialized = this.windowManager.onDestroy();
|
|
91
|
+
return this.initialized;
|
|
92
|
+
}
|
|
58
93
|
login(options = {}) {
|
|
59
94
|
return __awaiter(this, void 0, void 0, function* () {
|
|
60
95
|
if (!this.initialized) {
|
|
61
96
|
throw new errors_1.ErrProviderNotInitialized();
|
|
62
97
|
}
|
|
63
|
-
const isRelogin =
|
|
98
|
+
const isRelogin = this.isConnected();
|
|
64
99
|
if (isRelogin) {
|
|
65
100
|
const { address, signature, multisig, impersonate } = this.account;
|
|
66
101
|
return {
|
|
@@ -76,7 +111,7 @@ class CrossWindowProvider {
|
|
|
76
111
|
throw new errors_1.ErrCouldNotLogin();
|
|
77
112
|
}
|
|
78
113
|
const { payload: { data, error } } = yield this.windowManager.postMessage({
|
|
79
|
-
type:
|
|
114
|
+
type: enums_1.WindowProviderRequestEnums.loginRequest,
|
|
80
115
|
payload: {
|
|
81
116
|
token: this.accessToken
|
|
82
117
|
}
|
|
@@ -96,6 +131,14 @@ class CrossWindowProvider {
|
|
|
96
131
|
};
|
|
97
132
|
});
|
|
98
133
|
}
|
|
134
|
+
dispose() {
|
|
135
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
136
|
+
const connectionClosed = yield this.windowManager.closeConnection();
|
|
137
|
+
this.initialized = !connectionClosed;
|
|
138
|
+
CrossWindowProvider._instance = null;
|
|
139
|
+
return connectionClosed;
|
|
140
|
+
});
|
|
141
|
+
}
|
|
99
142
|
logout() {
|
|
100
143
|
return __awaiter(this, void 0, void 0, function* () {
|
|
101
144
|
const popupConsentResponse = yield this.openPopupConsent();
|
|
@@ -103,8 +146,7 @@ class CrossWindowProvider {
|
|
|
103
146
|
throw new errors_1.ErrProviderNotInitialized();
|
|
104
147
|
}
|
|
105
148
|
this.ensureConnected();
|
|
106
|
-
const connectionClosed = yield this.
|
|
107
|
-
this.initialized = false;
|
|
149
|
+
const connectionClosed = yield this.dispose();
|
|
108
150
|
this.disconnect();
|
|
109
151
|
return connectionClosed;
|
|
110
152
|
});
|
|
@@ -122,9 +164,13 @@ class CrossWindowProvider {
|
|
|
122
164
|
return this.initialized;
|
|
123
165
|
}
|
|
124
166
|
isConnected() {
|
|
125
|
-
return
|
|
126
|
-
|
|
127
|
-
|
|
167
|
+
return Boolean(this.account.address);
|
|
168
|
+
}
|
|
169
|
+
getAccount() {
|
|
170
|
+
return this.account;
|
|
171
|
+
}
|
|
172
|
+
setAccount(account) {
|
|
173
|
+
this.account = account;
|
|
128
174
|
}
|
|
129
175
|
signTransaction(transaction) {
|
|
130
176
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -144,13 +190,13 @@ class CrossWindowProvider {
|
|
|
144
190
|
throw new errors_1.ErrTransactionCancelled();
|
|
145
191
|
}
|
|
146
192
|
const { type, payload: { data: signedPlainTransactions, error } } = yield this.windowManager.postMessage({
|
|
147
|
-
type:
|
|
193
|
+
type: enums_1.WindowProviderRequestEnums.signTransactionsRequest,
|
|
148
194
|
payload: transactions.map((tx) => tx.toPlainObject())
|
|
149
195
|
});
|
|
150
196
|
if (error || !signedPlainTransactions) {
|
|
151
197
|
throw new errors_1.ErrCouldNotSignTransactions();
|
|
152
198
|
}
|
|
153
|
-
if (type ===
|
|
199
|
+
if (type === enums_1.WindowProviderResponseEnums.cancelResponse) {
|
|
154
200
|
throw new errors_1.ErrTransactionCancelled();
|
|
155
201
|
}
|
|
156
202
|
const hasTransactions = (signedPlainTransactions === null || signedPlainTransactions === void 0 ? void 0 : signedPlainTransactions.length) > 0;
|
|
@@ -168,13 +214,13 @@ class CrossWindowProvider {
|
|
|
168
214
|
throw new errors_1.ErrTransactionCancelled();
|
|
169
215
|
}
|
|
170
216
|
const { type, payload: { data: signedPlainTransactions, error } } = yield this.windowManager.postMessage({
|
|
171
|
-
type:
|
|
217
|
+
type: enums_1.WindowProviderRequestEnums.guardTransactionsRequest,
|
|
172
218
|
payload: transactions.map((tx) => tx.toPlainObject())
|
|
173
219
|
});
|
|
174
220
|
if (error || !signedPlainTransactions) {
|
|
175
221
|
throw new errors_1.ErrCouldNotSignTransactions();
|
|
176
222
|
}
|
|
177
|
-
if (type ===
|
|
223
|
+
if (type === enums_1.WindowProviderResponseEnums.cancelResponse) {
|
|
178
224
|
throw new errors_1.ErrTransactionCancelled();
|
|
179
225
|
}
|
|
180
226
|
const hasTransactions = (signedPlainTransactions === null || signedPlainTransactions === void 0 ? void 0 : signedPlainTransactions.length) > 0;
|
|
@@ -184,7 +230,8 @@ class CrossWindowProvider {
|
|
|
184
230
|
return signedPlainTransactions.map((tx) => sdk_core_1.Transaction.fromPlainObject(tx));
|
|
185
231
|
});
|
|
186
232
|
}
|
|
187
|
-
signMessage(
|
|
233
|
+
signMessage(messageToSign) {
|
|
234
|
+
var _a;
|
|
188
235
|
return __awaiter(this, void 0, void 0, function* () {
|
|
189
236
|
this.ensureConnected();
|
|
190
237
|
const popupConsentResponse = yield this.openPopupConsent();
|
|
@@ -192,74 +239,69 @@ class CrossWindowProvider {
|
|
|
192
239
|
throw new errors_1.ErrCouldNotSignMessage();
|
|
193
240
|
}
|
|
194
241
|
const { payload: { data, error } } = yield this.windowManager.postMessage({
|
|
195
|
-
type:
|
|
242
|
+
type: enums_1.WindowProviderRequestEnums.signMessageRequest,
|
|
196
243
|
payload: {
|
|
197
|
-
message:
|
|
244
|
+
message: Buffer.from(messageToSign.data).toString()
|
|
198
245
|
}
|
|
199
246
|
});
|
|
200
247
|
if (error || !data) {
|
|
201
248
|
throw new errors_1.ErrCouldNotSignMessage();
|
|
202
249
|
}
|
|
203
250
|
const { status, signature } = data;
|
|
204
|
-
if (status !==
|
|
251
|
+
if (status !== enums_1.SignMessageStatusEnum.signed) {
|
|
205
252
|
throw new errors_1.ErrCouldNotSignMessage();
|
|
206
253
|
}
|
|
207
|
-
|
|
208
|
-
|
|
254
|
+
return new sdk_core_1.Message({
|
|
255
|
+
data: Buffer.from(messageToSign.data),
|
|
256
|
+
address: (_a = messageToSign.address) !== null && _a !== void 0 ? _a : sdk_core_1.Address.fromBech32(this.account.address),
|
|
257
|
+
signer: messageToSign.signer || 'wallet-cross-window',
|
|
258
|
+
version: messageToSign.version,
|
|
259
|
+
signature: Buffer.from(String(signature), 'hex')
|
|
260
|
+
});
|
|
209
261
|
});
|
|
210
262
|
}
|
|
211
263
|
cancelAction() {
|
|
212
|
-
var _a;
|
|
213
|
-
|
|
214
|
-
|
|
264
|
+
var _a, _b;
|
|
265
|
+
const isWalletOpened = (_a = this.windowManager) === null || _a === void 0 ? void 0 : _a.isWalletOpened(enums_1.WindowProviderRequestEnums.cancelAction);
|
|
266
|
+
if (!isWalletOpened) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
return (_b = this.windowManager) === null || _b === void 0 ? void 0 : _b.postMessage({
|
|
270
|
+
type: enums_1.WindowProviderRequestEnums.cancelAction,
|
|
215
271
|
payload: undefined
|
|
216
272
|
});
|
|
217
273
|
}
|
|
218
274
|
openPopupConsent() {
|
|
219
|
-
var _a;
|
|
220
275
|
return __awaiter(this, void 0, void 0, function* () {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
276
|
+
if (!this._shouldShowConsentPopup ||
|
|
277
|
+
typeof document === 'undefined' ||
|
|
278
|
+
typeof window === 'undefined') {
|
|
224
279
|
return true;
|
|
225
280
|
}
|
|
226
|
-
const
|
|
227
|
-
const
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
`;
|
|
236
|
-
document.body.appendChild(dialog);
|
|
237
|
-
dialog.showModal();
|
|
281
|
+
const module = yield Promise.resolve().then(() => __importStar(require('./PopupConsent/PopupConsent')));
|
|
282
|
+
const PopupConsent = module.PopupConsent;
|
|
283
|
+
const customElements = constants_1.safeWindow.customElements;
|
|
284
|
+
if (customElements && !customElements.get(constants_2.confirmationDialogTag)) {
|
|
285
|
+
customElements.define(constants_2.confirmationDialogTag, PopupConsent);
|
|
286
|
+
}
|
|
287
|
+
const popup = document.createElement(constants_2.confirmationDialogTag);
|
|
288
|
+
popup.walletUrl = this.windowManager.walletUrl;
|
|
289
|
+
document.body.appendChild(popup);
|
|
238
290
|
const popupConsentResponse = yield new Promise((resolve) => {
|
|
239
|
-
|
|
240
|
-
const cancelButton = document.getElementById(cancelId);
|
|
241
|
-
if (!confirmButton || !cancelButton) {
|
|
291
|
+
popup.onConfirm = () => {
|
|
242
292
|
resolve(true);
|
|
243
|
-
document.body.removeChild(
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
confirmButton.addEventListener('click', function () {
|
|
248
|
-
resolve(true);
|
|
249
|
-
document.body.removeChild(dialog);
|
|
250
|
-
dialog.close();
|
|
251
|
-
});
|
|
252
|
-
cancelButton.addEventListener('click', function () {
|
|
293
|
+
document.body.removeChild(popup);
|
|
294
|
+
};
|
|
295
|
+
popup.onCancel = () => {
|
|
253
296
|
resolve(false);
|
|
254
|
-
document.body.removeChild(
|
|
255
|
-
|
|
256
|
-
});
|
|
297
|
+
document.body.removeChild(popup);
|
|
298
|
+
};
|
|
257
299
|
});
|
|
258
300
|
this._shouldShowConsentPopup = false;
|
|
259
301
|
return popupConsentResponse;
|
|
260
302
|
});
|
|
261
303
|
}
|
|
262
304
|
}
|
|
263
|
-
CrossWindowProvider._instance =
|
|
305
|
+
CrossWindowProvider._instance = null;
|
|
264
306
|
exports.CrossWindowProvider = CrossWindowProvider;
|
|
265
307
|
//# sourceMappingURL=CrossWindowProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CrossWindowProvider.js","sourceRoot":"","sources":["../../src/CrossWindowProvider/CrossWindowProvider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CrossWindowProvider.js","sourceRoot":"","sources":["../../src/CrossWindowProvider/CrossWindowProvider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAqE;AACrE,4CAA0C;AAC1C,oCAIkB;AAClB,sCASmB;AACnB,oDAAiD;AACjD,wDAAiE;AAUjE,MAAa,mBAAmB;IAS9B;QARQ,YAAO,GAAqB,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;QAC5C,gBAAW,GAAuB,SAAS,CAAC;QAE1C,gBAAW,GAAG,KAAK,CAAC;QAEpB,4BAAuB,GAAG,KAAK,CAAC;QAIxC,IAAI,CAAC,aAAa,GAAG,IAAI,6BAAa,EAAE,CAAC;IAC3C,CAAC;IAEM,yBAAyB,CAAC,UAAmB;QAClD,IAAI,CAAC,uBAAuB,GAAG,UAAU,CAAC;IAC5C,CAAC;IAES,eAAe;QACvB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACzB,MAAM,IAAI,+BAAsB,EAAE,CAAC;SACpC;IACH,CAAC;IAES,UAAU;QAClB,IAAI,CAAC,OAAO,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACjC,CAAC;IAEM,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAAE;YAClC,mBAAmB,CAAC,SAAS,GAAG,IAAI,mBAAmB,EAAE,CAAC;YAC1D,OAAO,mBAAmB,CAAC,SAAS,CAAC;SACtC;QAED,OAAO,mBAAmB,CAAC,SAAS,CAAC;IACvC,CAAC;IAEM,gBAAgB;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAEM,UAAU,CAAC,OAAe;QAC/B,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,OA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CAAC,SAAS,CAAC;YAE/C,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YAEjC,MAAM,oBAAoB,GAAY,MAAM,IAAI,OAAO,CACrD,CAAC,OAAO,EAAE,EAAE;gBACV,KAAK,CAAC,SAAS,GAAG,GAAG,EAAE;oBACrB,OAAO,CAAC,IAAI,CAAC,CAAC;oBACd,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;gBACnC,CAAC,CAAC;gBACF,KAAK,CAAC,QAAQ,GAAG,GAAG,EAAE;oBACpB,OAAO,CAAC,KAAK,CAAC,CAAC;oBACf,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;gBACnC,CAAC,CAAC;YACJ,CAAC,CACF,CAAC;YAEF,IAAI,CAAC,uBAAuB,GAAG,KAAK,CAAC;YACrC,OAAO,oBAAoB,CAAC;QAC9B,CAAC;KAAA;;AA3UgB,6BAAS,GAA+B,IAAI,AAAnC,CAAoC;AAPnD,kDAAmB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PopupConsentModel } from './PopupConsent.model';
|
|
2
|
+
export declare class PopupConsent extends HTMLElement implements PopupConsentModel {
|
|
3
|
+
walletUrl: string;
|
|
4
|
+
identifier: string;
|
|
5
|
+
onCancel: () => void;
|
|
6
|
+
onConfirm: () => void;
|
|
7
|
+
constructor();
|
|
8
|
+
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
9
|
+
events: {
|
|
10
|
+
confirm: string;
|
|
11
|
+
cancel: string;
|
|
12
|
+
mounted: string;
|
|
13
|
+
};
|
|
14
|
+
private handleConfirmEvent;
|
|
15
|
+
private dispatchAction;
|
|
16
|
+
render(): void;
|
|
17
|
+
toggleEvents(action: 'removeEventListener' | 'addEventListener'): void;
|
|
18
|
+
connectedCallback(): void;
|
|
19
|
+
disconnectedCallback(): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PopupConsent = void 0;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
const getStyles_1 = require("./getStyles");
|
|
6
|
+
class PopupConsent extends HTMLElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.walletUrl = '';
|
|
10
|
+
this.identifier = constants_1.confirmationDialogTag;
|
|
11
|
+
this.onCancel = () => {
|
|
12
|
+
console.log('onCancel');
|
|
13
|
+
};
|
|
14
|
+
this.onConfirm = () => {
|
|
15
|
+
console.log('onConfirm');
|
|
16
|
+
};
|
|
17
|
+
this.events = {
|
|
18
|
+
confirm: `${this.identifier}-confirm`,
|
|
19
|
+
cancel: `${this.identifier}-cancel`,
|
|
20
|
+
mounted: `${this.identifier}-mounted`
|
|
21
|
+
};
|
|
22
|
+
this.dispatchAction = (type) => {
|
|
23
|
+
const event = new CustomEvent(type, {
|
|
24
|
+
bubbles: true,
|
|
25
|
+
composed: true // Allow the event to cross the shadow DOM boundary
|
|
26
|
+
});
|
|
27
|
+
this.dispatchEvent(event);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
31
|
+
if (oldValue !== newValue) {
|
|
32
|
+
this[name.replace(/-./g, (x) => x[1].toUpperCase())] = newValue;
|
|
33
|
+
this.render();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
handleConfirmEvent({ type }) {
|
|
37
|
+
switch (type) {
|
|
38
|
+
case this.events.cancel:
|
|
39
|
+
return this.onCancel();
|
|
40
|
+
case this.events.confirm:
|
|
41
|
+
return this.onConfirm();
|
|
42
|
+
default:
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
render() {
|
|
47
|
+
this.innerHTML = `
|
|
48
|
+
<style>
|
|
49
|
+
${(0, getStyles_1.getStyles)(constants_1.confirmationDialogTag)}
|
|
50
|
+
</style>
|
|
51
|
+
<div id="${constants_1.confirmationDialogTag}">
|
|
52
|
+
<div class="content">
|
|
53
|
+
<div class="body">
|
|
54
|
+
<div class="title">Confirm on MultiversX Wallet</div>
|
|
55
|
+
<div class="subtitle">Continue to ${this.walletUrl}</div>
|
|
56
|
+
<div class="actions-container">
|
|
57
|
+
<button
|
|
58
|
+
class="button"
|
|
59
|
+
data-testid="${this.events.cancel}-btn"
|
|
60
|
+
id="${this.events.cancel}-btn"
|
|
61
|
+
>
|
|
62
|
+
Cancel
|
|
63
|
+
</button>
|
|
64
|
+
<button
|
|
65
|
+
class="button btn-proceed"
|
|
66
|
+
data-testid="${this.events.confirm}-btn"
|
|
67
|
+
id="${this.events.confirm}-btn"
|
|
68
|
+
>
|
|
69
|
+
Continue →
|
|
70
|
+
</button>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
`;
|
|
76
|
+
}
|
|
77
|
+
toggleEvents(action) {
|
|
78
|
+
[this.events.cancel, this.events.confirm].forEach((event) => {
|
|
79
|
+
var _a;
|
|
80
|
+
(_a = this.querySelector(`#${event}-btn`)) === null || _a === void 0 ? void 0 : _a[action]('click', () => this.dispatchAction(event));
|
|
81
|
+
this[action](event, this.handleConfirmEvent);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
connectedCallback() {
|
|
85
|
+
this.render();
|
|
86
|
+
this.toggleEvents('addEventListener');
|
|
87
|
+
}
|
|
88
|
+
disconnectedCallback() {
|
|
89
|
+
this.toggleEvents('removeEventListener');
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.PopupConsent = PopupConsent;
|
|
93
|
+
//# sourceMappingURL=PopupConsent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PopupConsent.js","sourceRoot":"","sources":["../../../src/CrossWindowProvider/PopupConsent/PopupConsent.ts"],"names":[],"mappings":";;;AAAA,2CAAoD;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
|
+
mounted: string;
|
|
8
|
+
};
|
|
9
|
+
onCancel: () => void;
|
|
10
|
+
onConfirm: () => void;
|
|
11
|
+
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
12
|
+
render(): void;
|
|
13
|
+
toggleEvents(action: 'removeEventListener' | 'addEventListener'): void;
|
|
14
|
+
connectedCallback(): void;
|
|
15
|
+
disconnectedCallback(): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PopupConsent.model.js","sourceRoot":"","sources":["../../../src/CrossWindowProvider/PopupConsent/PopupConsent.model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const confirmationDialogTag = "mxcwp-confirmation-dialog";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/CrossWindowProvider/PopupConsent/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,qBAAqB,GAAG,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getStyles: (dialogId: string) => string;
|