@multiversx/sdk-web-wallet-cross-window-provider 0.0.28-alpha.13 → 0.0.28-alpha.14
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/out/CrossWindowProvider/CrossWindowProvider.d.ts +9 -17
- package/out/CrossWindowProvider/CrossWindowProvider.js +61 -87
- package/out/CrossWindowProvider/CrossWindowProvider.js.map +1 -1
- package/out/CrossWindowProvider/popupConsent.d.ts +4 -0
- package/out/CrossWindowProvider/popupConsent.js +121 -0
- package/out/CrossWindowProvider/popupConsent.js.map +1 -0
- package/out/CrossWindowProvider/tests/Cancel.test.js +1 -1
- package/out/CrossWindowProvider/tests/Cancel.test.js.map +1 -1
- package/out/CrossWindowProvider/tests/Login.test.js +1 -1
- package/out/CrossWindowProvider/tests/Login.test.js.map +1 -1
- package/out/CrossWindowProvider/tests/Logout.test.js +1 -1
- package/out/CrossWindowProvider/tests/Logout.test.js.map +1 -1
- package/out/CrossWindowProvider/tests/SignMessage.test.js +1 -1
- package/out/CrossWindowProvider/tests/SignMessage.test.js.map +1 -1
- package/out/CrossWindowProvider/tests/SignTransaction.test.js +1 -1
- package/out/CrossWindowProvider/tests/SignTransaction.test.js.map +1 -1
- package/out/{CrossWindowProvider → WindowManager}/WindowManager.d.ts +4 -8
- package/out/{CrossWindowProvider → WindowManager}/WindowManager.js +32 -54
- package/out/WindowManager/WindowManager.js.map +1 -0
- package/out/WindowManager/index.d.ts +1 -0
- package/out/{IframeProvider → WindowManager}/index.js +1 -1
- package/out/WindowManager/index.js.map +1 -0
- package/out/{CrossWindowProvider → WindowManager}/tests/windowManager.test.js +1 -1
- package/out/WindowManager/tests/windowManager.test.js.map +1 -0
- package/out/index.d.ts +0 -3
- package/out/index.js +0 -3
- package/out/index.js.map +1 -1
- package/out/test-utils/mockWindowManager.js +1 -1
- package/out/test-utils/mockWindowManager.js.map +1 -1
- package/package.json +5 -10
- package/out/CrossWindowProvider/WindowManager.js.map +0 -1
- package/out/CrossWindowProvider/tests/windowManager.test.js.map +0 -1
- package/out/IframeProvider/IframeManager.d.ts +0 -4
- package/out/IframeProvider/IframeManager.js +0 -12
- package/out/IframeProvider/IframeManager.js.map +0 -1
- package/out/IframeProvider/IframeProvider.d.ts +0 -8
- package/out/IframeProvider/IframeProvider.js +0 -47
- package/out/IframeProvider/IframeProvider.js.map +0 -1
- package/out/IframeProvider/index.d.ts +0 -1
- package/out/IframeProvider/index.js.map +0 -1
- /package/out/{CrossWindowProvider → WindowManager}/tests/windowManager.test.d.ts +0 -0
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { SignableMessage, Transaction } from
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { WindowManager } from "./WindowManager";
|
|
5
|
-
export interface ICrossWindowWalletAccount {
|
|
1
|
+
import { SignableMessage, Transaction } from '@multiversx/sdk-core';
|
|
2
|
+
import { CrossWindowProviderRequestEnums } from '../types';
|
|
3
|
+
interface ICrossWindowWalletAccount {
|
|
6
4
|
address: string;
|
|
7
5
|
signature?: string;
|
|
8
6
|
multisig?: string;
|
|
@@ -10,13 +8,13 @@ export interface ICrossWindowWalletAccount {
|
|
|
10
8
|
}
|
|
11
9
|
export declare class CrossWindowProvider {
|
|
12
10
|
account: ICrossWindowWalletAccount;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
private initialized;
|
|
12
|
+
private windowManager;
|
|
13
|
+
private static _instance;
|
|
16
14
|
private accessToken;
|
|
17
15
|
protected _shouldShowConsentPopup: boolean;
|
|
16
|
+
private constructor();
|
|
18
17
|
setShouldShowConsentPopup(shouldShow: boolean): void;
|
|
19
|
-
constructor();
|
|
20
18
|
private ensureConnected;
|
|
21
19
|
private disconnect;
|
|
22
20
|
static getInstance(): CrossWindowProvider;
|
|
@@ -32,15 +30,9 @@ export declare class CrossWindowProvider {
|
|
|
32
30
|
isConnected(): Promise<boolean>;
|
|
33
31
|
signTransaction(transaction: Transaction): Promise<Transaction>;
|
|
34
32
|
signTransactions(transactions: Transaction[]): Promise<Transaction[]>;
|
|
35
|
-
protected openPopupConsent(action: string): Promise<{
|
|
36
|
-
popupConsentResponse: boolean;
|
|
37
|
-
popup?: undefined;
|
|
38
|
-
} | {
|
|
39
|
-
popup: HTMLOpenPopupNotificationElement;
|
|
40
|
-
popupConsentResponse: unknown;
|
|
41
|
-
}>;
|
|
42
33
|
guardTransactions(transactions: Transaction[]): Promise<Transaction[]>;
|
|
43
34
|
signMessage(message: SignableMessage): Promise<SignableMessage>;
|
|
44
35
|
cancelAction(): Promise<import("../types").PostMessageReturnType<CrossWindowProviderRequestEnums.cancelAction>> | undefined;
|
|
45
|
-
|
|
36
|
+
protected openPopupConsent(): Promise<boolean>;
|
|
46
37
|
}
|
|
38
|
+
export {};
|
|
@@ -11,57 +11,47 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.CrossWindowProvider = void 0;
|
|
13
13
|
const sdk_core_1 = require("@multiversx/sdk-core");
|
|
14
|
+
const constants_1 = require("../constants");
|
|
14
15
|
const errors_1 = require("../errors");
|
|
15
16
|
const types_1 = require("../types");
|
|
16
|
-
const WindowManager_1 = require("
|
|
17
|
-
const
|
|
17
|
+
const WindowManager_1 = require("../WindowManager");
|
|
18
|
+
const popupConsent_1 = require("./popupConsent");
|
|
18
19
|
class CrossWindowProvider {
|
|
19
|
-
setShouldShowConsentPopup(shouldShow) {
|
|
20
|
-
this._shouldShowConsentPopup = shouldShow;
|
|
21
|
-
}
|
|
22
20
|
constructor() {
|
|
23
|
-
this.account = { address:
|
|
21
|
+
this.account = { address: '' };
|
|
24
22
|
this.initialized = false;
|
|
25
|
-
this.windowManager = null;
|
|
26
23
|
this.accessToken = undefined;
|
|
27
24
|
this._shouldShowConsentPopup = false;
|
|
28
25
|
if (CrossWindowProvider._instance) {
|
|
29
26
|
throw new errors_1.ErrInstantiationFailed();
|
|
30
27
|
}
|
|
31
|
-
|
|
28
|
+
this.windowManager = WindowManager_1.WindowManager.getInstance();
|
|
32
29
|
CrossWindowProvider._instance = this;
|
|
33
30
|
}
|
|
31
|
+
setShouldShowConsentPopup(shouldShow) {
|
|
32
|
+
this._shouldShowConsentPopup = shouldShow;
|
|
33
|
+
}
|
|
34
34
|
ensureConnected() {
|
|
35
35
|
if (!this.account.address) {
|
|
36
36
|
throw new errors_1.ErrAccountNotConnected();
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
disconnect() {
|
|
40
|
-
this.account = { address:
|
|
40
|
+
this.account = { address: '' };
|
|
41
41
|
}
|
|
42
42
|
static getInstance() {
|
|
43
|
-
if (!CrossWindowProvider._instance) {
|
|
44
|
-
return new CrossWindowProvider();
|
|
45
|
-
}
|
|
46
43
|
return CrossWindowProvider._instance;
|
|
47
44
|
}
|
|
48
45
|
setAddress(address) {
|
|
49
|
-
if (!CrossWindowProvider._instance) {
|
|
50
|
-
throw new errors_1.ErrInstantiationFailed();
|
|
51
|
-
}
|
|
52
46
|
this.account.address = address;
|
|
53
47
|
return CrossWindowProvider._instance;
|
|
54
48
|
}
|
|
55
49
|
setWalletUrl(url) {
|
|
56
|
-
if (!CrossWindowProvider._instance || !this.windowManager) {
|
|
57
|
-
throw new errors_1.ErrInstantiationFailed();
|
|
58
|
-
}
|
|
59
50
|
this.windowManager.setWalletUrl(url);
|
|
60
51
|
return CrossWindowProvider._instance;
|
|
61
52
|
}
|
|
62
53
|
init() {
|
|
63
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
this.windowManager = WindowManager_1.WindowManager.getInstance();
|
|
65
55
|
this.initialized = yield this.windowManager.init();
|
|
66
56
|
return this.initialized;
|
|
67
57
|
});
|
|
@@ -78,24 +68,19 @@ class CrossWindowProvider {
|
|
|
78
68
|
address,
|
|
79
69
|
signature,
|
|
80
70
|
multisig,
|
|
81
|
-
impersonate
|
|
71
|
+
impersonate
|
|
82
72
|
};
|
|
83
73
|
}
|
|
84
74
|
this.accessToken = options.token;
|
|
85
|
-
|
|
86
|
-
throw new errors_1.ErrInstantiationFailed();
|
|
87
|
-
}
|
|
88
|
-
const { popup, popupConsentResponse } = yield this.openPopupConsent("login");
|
|
75
|
+
const popupConsentResponse = yield this.openPopupConsent();
|
|
89
76
|
if (!popupConsentResponse) {
|
|
90
|
-
popup === null || popup === void 0 ? void 0 : popup.remove();
|
|
91
77
|
throw new errors_1.ErrCouldNotLogin();
|
|
92
78
|
}
|
|
93
|
-
|
|
94
|
-
const { payload: { data, error }, } = yield this.windowManager.postMessage({
|
|
79
|
+
const { payload: { data, error } } = yield this.windowManager.postMessage({
|
|
95
80
|
type: types_1.CrossWindowProviderRequestEnums.loginRequest,
|
|
96
81
|
payload: {
|
|
97
|
-
token: this.accessToken
|
|
98
|
-
}
|
|
82
|
+
token: this.accessToken
|
|
83
|
+
}
|
|
99
84
|
});
|
|
100
85
|
if (error || !data) {
|
|
101
86
|
throw new errors_1.ErrCouldNotLogin();
|
|
@@ -108,18 +93,14 @@ class CrossWindowProvider {
|
|
|
108
93
|
address: this.account.address,
|
|
109
94
|
signature: this.account.signature,
|
|
110
95
|
multisig: this.account.multisig,
|
|
111
|
-
impersonate: this.account.impersonate
|
|
96
|
+
impersonate: this.account.impersonate
|
|
112
97
|
};
|
|
113
98
|
});
|
|
114
99
|
}
|
|
115
100
|
logout() {
|
|
116
101
|
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
-
const
|
|
118
|
-
if (!popupConsentResponse) {
|
|
119
|
-
popup === null || popup === void 0 ? void 0 : popup.remove();
|
|
120
|
-
}
|
|
121
|
-
popup === null || popup === void 0 ? void 0 : popup.remove();
|
|
122
|
-
if (!this.initialized || !this.windowManager) {
|
|
102
|
+
const popupConsentResponse = yield this.openPopupConsent();
|
|
103
|
+
if (!this.initialized || !popupConsentResponse) {
|
|
123
104
|
throw new errors_1.ErrProviderNotInitialized();
|
|
124
105
|
}
|
|
125
106
|
this.ensureConnected();
|
|
@@ -135,7 +116,7 @@ class CrossWindowProvider {
|
|
|
135
116
|
if (!this.initialized) {
|
|
136
117
|
throw new errors_1.ErrProviderNotInitialized();
|
|
137
118
|
}
|
|
138
|
-
return (_b = (_a = this.account) === null || _a === void 0 ? void 0 : _a.address) !== null && _b !== void 0 ? _b :
|
|
119
|
+
return (_b = (_a = this.account) === null || _a === void 0 ? void 0 : _a.address) !== null && _b !== void 0 ? _b : '';
|
|
139
120
|
});
|
|
140
121
|
}
|
|
141
122
|
isInitialized() {
|
|
@@ -159,18 +140,13 @@ class CrossWindowProvider {
|
|
|
159
140
|
signTransactions(transactions) {
|
|
160
141
|
return __awaiter(this, void 0, void 0, function* () {
|
|
161
142
|
this.ensureConnected();
|
|
162
|
-
const
|
|
143
|
+
const popupConsentResponse = yield this.openPopupConsent();
|
|
163
144
|
if (!popupConsentResponse) {
|
|
164
|
-
popup === null || popup === void 0 ? void 0 : popup.remove();
|
|
165
145
|
throw new errors_1.ErrTransactionCancelled();
|
|
166
146
|
}
|
|
167
|
-
|
|
168
|
-
if (!this.windowManager) {
|
|
169
|
-
throw new errors_1.ErrInstantiationFailed();
|
|
170
|
-
}
|
|
171
|
-
const { type, payload: { data: signedPlainTransactions, error }, } = yield this.windowManager.postMessage({
|
|
147
|
+
const { type, payload: { data: signedPlainTransactions, error } } = yield this.windowManager.postMessage({
|
|
172
148
|
type: types_1.CrossWindowProviderRequestEnums.signTransactionsRequest,
|
|
173
|
-
payload: transactions.map((tx) => tx.toPlainObject())
|
|
149
|
+
payload: transactions.map((tx) => tx.toPlainObject())
|
|
174
150
|
});
|
|
175
151
|
if (error || !signedPlainTransactions) {
|
|
176
152
|
throw new errors_1.ErrCouldNotSignTransactions();
|
|
@@ -185,40 +161,16 @@ class CrossWindowProvider {
|
|
|
185
161
|
return signedPlainTransactions.map((tx) => sdk_core_1.Transaction.fromPlainObject(tx));
|
|
186
162
|
});
|
|
187
163
|
}
|
|
188
|
-
openPopupConsent(action) {
|
|
189
|
-
var _a;
|
|
190
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
191
|
-
if (!this._shouldShowConsentPopup) {
|
|
192
|
-
return { popupConsentResponse: true };
|
|
193
|
-
}
|
|
194
|
-
const popup = document.createElement("open-popup-notification");
|
|
195
|
-
popup.action = action;
|
|
196
|
-
popup.walletAddress = ((_a = this.windowManager) === null || _a === void 0 ? void 0 : _a.walletUrl) || "";
|
|
197
|
-
document.body.appendChild(popup);
|
|
198
|
-
const popupConsentResponse = yield new Promise((resolve) => {
|
|
199
|
-
popup.addEventListener("popupConsent", (event) => {
|
|
200
|
-
resolve(event.detail);
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
this._shouldShowConsentPopup = false;
|
|
204
|
-
return { popup, popupConsentResponse };
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
164
|
guardTransactions(transactions) {
|
|
208
165
|
return __awaiter(this, void 0, void 0, function* () {
|
|
209
166
|
this.ensureConnected();
|
|
210
|
-
const
|
|
167
|
+
const popupConsentResponse = yield this.openPopupConsent();
|
|
211
168
|
if (!popupConsentResponse) {
|
|
212
|
-
popup === null || popup === void 0 ? void 0 : popup.remove();
|
|
213
169
|
throw new errors_1.ErrTransactionCancelled();
|
|
214
170
|
}
|
|
215
|
-
|
|
216
|
-
if (!this.windowManager) {
|
|
217
|
-
throw new errors_1.ErrInstantiationFailed();
|
|
218
|
-
}
|
|
219
|
-
const { type, payload: { data: signedPlainTransactions, error }, } = yield this.windowManager.postMessage({
|
|
171
|
+
const { type, payload: { data: signedPlainTransactions, error } } = yield this.windowManager.postMessage({
|
|
220
172
|
type: types_1.CrossWindowProviderRequestEnums.guardTransactionsRequest,
|
|
221
|
-
payload: transactions.map((tx) => tx.toPlainObject())
|
|
173
|
+
payload: transactions.map((tx) => tx.toPlainObject())
|
|
222
174
|
});
|
|
223
175
|
if (error || !signedPlainTransactions) {
|
|
224
176
|
throw new errors_1.ErrCouldNotSignTransactions();
|
|
@@ -236,20 +188,15 @@ class CrossWindowProvider {
|
|
|
236
188
|
signMessage(message) {
|
|
237
189
|
return __awaiter(this, void 0, void 0, function* () {
|
|
238
190
|
this.ensureConnected();
|
|
239
|
-
const
|
|
191
|
+
const popupConsentResponse = yield this.openPopupConsent();
|
|
240
192
|
if (!popupConsentResponse) {
|
|
241
|
-
popup === null || popup === void 0 ? void 0 : popup.remove();
|
|
242
193
|
throw new errors_1.ErrCouldNotSignMessage();
|
|
243
194
|
}
|
|
244
|
-
|
|
245
|
-
if (!this.windowManager) {
|
|
246
|
-
throw new errors_1.ErrInstantiationFailed();
|
|
247
|
-
}
|
|
248
|
-
const { payload: { data, error }, } = yield this.windowManager.postMessage({
|
|
195
|
+
const { payload: { data, error } } = yield this.windowManager.postMessage({
|
|
249
196
|
type: types_1.CrossWindowProviderRequestEnums.signMessageRequest,
|
|
250
197
|
payload: {
|
|
251
|
-
message: message.message.toString()
|
|
252
|
-
}
|
|
198
|
+
message: message.message.toString()
|
|
199
|
+
}
|
|
253
200
|
});
|
|
254
201
|
if (error || !data) {
|
|
255
202
|
throw new errors_1.ErrCouldNotSignMessage();
|
|
@@ -258,7 +205,7 @@ class CrossWindowProvider {
|
|
|
258
205
|
if (status !== types_1.SignMessageStatusEnum.signed) {
|
|
259
206
|
throw new errors_1.ErrCouldNotSignMessage();
|
|
260
207
|
}
|
|
261
|
-
message.applySignature(Buffer.from(String(signature),
|
|
208
|
+
message.applySignature(Buffer.from(String(signature), 'hex'));
|
|
262
209
|
return message;
|
|
263
210
|
});
|
|
264
211
|
}
|
|
@@ -270,15 +217,42 @@ class CrossWindowProvider {
|
|
|
270
217
|
}
|
|
271
218
|
return (_b = this.windowManager) === null || _b === void 0 ? void 0 : _b.postMessage({
|
|
272
219
|
type: types_1.CrossWindowProviderRequestEnums.cancelAction,
|
|
273
|
-
payload: undefined
|
|
220
|
+
payload: undefined
|
|
274
221
|
});
|
|
275
222
|
}
|
|
276
|
-
|
|
223
|
+
openPopupConsent() {
|
|
277
224
|
var _a;
|
|
278
|
-
|
|
279
|
-
|
|
225
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
226
|
+
const dialog = (_a = constants_1.safeWindow.document) === null || _a === void 0 ? void 0 : _a.createElement('div');
|
|
227
|
+
const document = constants_1.safeWindow.document;
|
|
228
|
+
if (!this._shouldShowConsentPopup || !document || !dialog) {
|
|
229
|
+
return true;
|
|
230
|
+
}
|
|
231
|
+
dialog.setAttribute('id', popupConsent_1.dialogId);
|
|
232
|
+
dialog.innerHTML = (0, popupConsent_1.getMarkup)(this.windowManager.walletUrl);
|
|
233
|
+
document.body.appendChild(dialog);
|
|
234
|
+
const popupConsentResponse = yield new Promise((resolve) => {
|
|
235
|
+
const confirmButton = document.getElementById(popupConsent_1.confirmId);
|
|
236
|
+
const cancelButton = document.getElementById(popupConsent_1.cancelId);
|
|
237
|
+
if (!confirmButton || !cancelButton) {
|
|
238
|
+
resolve(true);
|
|
239
|
+
document.body.removeChild(dialog);
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
confirmButton.addEventListener('click', function () {
|
|
243
|
+
resolve(true);
|
|
244
|
+
document.body.removeChild(dialog);
|
|
245
|
+
});
|
|
246
|
+
cancelButton.addEventListener('click', function () {
|
|
247
|
+
resolve(false);
|
|
248
|
+
document.body.removeChild(dialog);
|
|
249
|
+
});
|
|
250
|
+
});
|
|
251
|
+
this._shouldShowConsentPopup = false;
|
|
252
|
+
return popupConsentResponse;
|
|
253
|
+
});
|
|
280
254
|
}
|
|
281
255
|
}
|
|
282
|
-
CrossWindowProvider._instance =
|
|
256
|
+
CrossWindowProvider._instance = new CrossWindowProvider();
|
|
283
257
|
exports.CrossWindowProvider = CrossWindowProvider;
|
|
284
258
|
//# sourceMappingURL=CrossWindowProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CrossWindowProvider.js","sourceRoot":"","sources":["../../src/CrossWindowProvider/CrossWindowProvider.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,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AC,CAAC;YACpC,MAAM,CAAC,SAAS,GAAG,IAAA,wBAAS,EAAC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;YAE3D,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YAClC,MAAM,oBAAoB,GAAY,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBAClE,MAAM,aAAa,GAAG,QAAQ,CAAC,cAAc,CAAC,wBAAS,CAAC,CAAC;gBACzD,MAAM,YAAY,GAAG,QAAQ,CAAC,cAAc,CAAC,uBAAQ,CAAC,CAAC;gBAEvD,IAAI,CAAC,aAAa,IAAI,CAAC,YAAY,EAAE;oBACnC,OAAO,CAAC,IAAI,CAAC,CAAC;oBACd,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;oBAClC,OAAO;iBACR;gBACD,aAAa,CAAC,gBAAgB,CAAC,OAAO,EAAE;oBACtC,OAAO,CAAC,IAAI,CAAC,CAAC;oBACd,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;gBACpC,CAAC,CAAC,CAAC;gBACH,YAAY,CAAC,gBAAgB,CAAC,OAAO,EAAE;oBACrC,OAAO,CAAC,KAAK,CAAC,CAAC;oBACf,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;gBACpC,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,uBAAuB,GAAG,KAAK,CAAC;YACrC,OAAO,oBAAoB,CAAC;;KAC7B;;AAjSc,6BAAS,GAAwB,IAAI,mBAAmB,EAAE,AAAjD,CAAkD;AAJ/D,kDAAmB"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMarkup = exports.cancelId = exports.confirmId = exports.dialogId = void 0;
|
|
4
|
+
exports.dialogId = 'mxcwp_confirmation-dialog';
|
|
5
|
+
exports.confirmId = 'mxcwp_confirm-button';
|
|
6
|
+
exports.cancelId = 'mxcwp_cancel-button';
|
|
7
|
+
const getStyle = () => `
|
|
8
|
+
<style>
|
|
9
|
+
#${exports.dialogId} {
|
|
10
|
+
position: fixed;
|
|
11
|
+
z-index: 999;
|
|
12
|
+
padding-top: 100px;
|
|
13
|
+
left: 50%;
|
|
14
|
+
top: 50%;
|
|
15
|
+
transform: translate(-50%, -50%);
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100%;
|
|
18
|
+
overflow: auto;
|
|
19
|
+
background-color: rgba(0, 0, 0, 0.4);
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
#${exports.dialogId}:modal {
|
|
25
|
+
max-width: 100vw;
|
|
26
|
+
width: 100vw;
|
|
27
|
+
max-height: 100vh;
|
|
28
|
+
height: 100vh;
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
#${exports.dialogId} .content {
|
|
33
|
+
background: #fff;
|
|
34
|
+
border-radius: 20px;
|
|
35
|
+
z-index: 999;
|
|
36
|
+
max-width: 500px;
|
|
37
|
+
margin: auto;
|
|
38
|
+
padding: 0;
|
|
39
|
+
position: relative;
|
|
40
|
+
width: 100%;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
#${exports.dialogId} .body {
|
|
44
|
+
padding: 50px 0;
|
|
45
|
+
color: #262525;
|
|
46
|
+
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
#${exports.dialogId} .title {
|
|
50
|
+
text-align: center;
|
|
51
|
+
font-size: 1.5rem;
|
|
52
|
+
}
|
|
53
|
+
#${exports.dialogId} .subtitle {
|
|
54
|
+
margin-top: 10px;
|
|
55
|
+
text-align: center;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#${exports.dialogId} .actions-container {
|
|
59
|
+
margin-top: 40px;
|
|
60
|
+
margin-bottom: 10px;
|
|
61
|
+
display: flex;
|
|
62
|
+
justify-content: center;
|
|
63
|
+
gap: 20px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
#${exports.dialogId} .button {
|
|
67
|
+
max-width: 200px;
|
|
68
|
+
margin-top: 10px;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
#${exports.dialogId} button {
|
|
73
|
+
border-radius: 8px;
|
|
74
|
+
border: 1px solid transparent;
|
|
75
|
+
padding: 0.6em 1.2em;
|
|
76
|
+
font-size: 1em;
|
|
77
|
+
font-weight: 500;
|
|
78
|
+
font-family: inherit;
|
|
79
|
+
background-color: #efeeee;
|
|
80
|
+
cursor: pointer;
|
|
81
|
+
transition: border-color 0.25s;
|
|
82
|
+
}
|
|
83
|
+
#${exports.dialogId} button:hover {
|
|
84
|
+
border-color: #cacaca;
|
|
85
|
+
}
|
|
86
|
+
#${exports.dialogId} button:focus,
|
|
87
|
+
#${exports.dialogId} button:focus-visible {
|
|
88
|
+
outline: 4px auto -webkit-focus-ring-color;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
#${exports.dialogId} .btn-proceed {
|
|
92
|
+
background-color: #262626;
|
|
93
|
+
color: #fff;
|
|
94
|
+
padding-left: 40px;
|
|
95
|
+
padding-right: 40px;
|
|
96
|
+
}
|
|
97
|
+
</style>`;
|
|
98
|
+
const getMarkup = (walletUrl) => {
|
|
99
|
+
return `
|
|
100
|
+
${getStyle()}
|
|
101
|
+
<div class="content">
|
|
102
|
+
<div class="body">
|
|
103
|
+
<div class="title">Confirm on MultiversX Wallet</div>
|
|
104
|
+
<div class="subtitle">
|
|
105
|
+
Continue to ${walletUrl}
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
<div class="actions-container">
|
|
109
|
+
<button id="${exports.cancelId}" class="button">
|
|
110
|
+
Cancel
|
|
111
|
+
</button>
|
|
112
|
+
<button id="${exports.confirmId}" class="button btn-proceed">
|
|
113
|
+
Continue →
|
|
114
|
+
</button>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
`;
|
|
119
|
+
};
|
|
120
|
+
exports.getMarkup = getMarkup;
|
|
121
|
+
//# sourceMappingURL=popupConsent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popupConsent.js","sourceRoot":"","sources":["../../src/CrossWindowProvider/popupConsent.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG,2BAA2B,CAAC;AACvC,QAAA,SAAS,GAAG,sBAAsB,CAAC;AACnC,QAAA,QAAQ,GAAG,qBAAqB,CAAC;AAE9C,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC;;GAEpB,gBAAQ;;;;;;;;;;;;;;;GAeR,gBAAQ;;;;;;;;KAQN,gBAAQ;;;;;;;;;;;KAWR,gBAAQ;;;;;;KAMR,gBAAQ;;;;KAIR,gBAAQ;;;;;KAKR,gBAAQ;;;;;;;;KAQR,gBAAQ;;;;;;KAMR,gBAAQ;;;;;;;;;;;KAWR,gBAAQ;;;KAGR,gBAAQ;KACR,gBAAQ;;;;KAIR,gBAAQ;;;;;;SAMJ,CAAC;AAEH,MAAM,SAAS,GAAG,CAAC,SAAiB,EAAE,EAAE;IAC7C,OAAO;IACL,QAAQ,EAAE;;;;;wBAKU,SAAS;;;;0BAIP,gBAAQ;;;0BAGR,iBAAS;;;;;;CAMlC,CAAC;AACF,CAAC,CAAC;AArBW,QAAA,SAAS,aAqBpB"}
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const test_utils_1 = require("../../test-utils");
|
|
13
|
-
const WindowManager_1 = require("
|
|
13
|
+
const WindowManager_1 = require("../../WindowManager/WindowManager");
|
|
14
14
|
const CrossWindowProvider_1 = require("../CrossWindowProvider");
|
|
15
15
|
describe('CrossWindowProvider Login', () => {
|
|
16
16
|
let crossWindowProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cancel.test.js","sourceRoot":"","sources":["../../../src/CrossWindowProvider/tests/Cancel.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iDAI0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"Cancel.test.js","sourceRoot":"","sources":["../../../src/CrossWindowProvider/tests/Cancel.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iDAI0B;AAC1B,qEAAkE;AAClE,gEAA6D;AAE7D,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,IAAI,mBAAwC,CAAC;IAC7C,IAAI,gBAAsC,CAAC;IAC3C,IAAI,aAA+B,CAAC;IAEpC,UAAU,CAAC,GAAG,EAAE;QACd,gBAAgB,GAAG,IAAA,gCAAmB,GAAE,CAAC;QACzC,6BAAa,CAAC,WAAW,EAAE,CAAC,WAAW,GAAG,IAAI;aAC3C,EAAE,EAAE;aACJ,kBAAkB,CAAC,GAAG,EAAE,CAAC,CAAC;YACzB,OAAO,EAAE,EAAE;SACZ,CAAC,CAAC,CAAC;QAEN,mBAAmB,GAAG,yCAAmB,CAAC,WAAW,EAAE,CAAC;QACxD,IAAA,6BAAgB,GAAE,CAAC;QACnB,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC3C,aAAa,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mCAAmC,EAAE,GAAS,EAAE;QACjD,MAAM,mBAAmB,CAAC,IAAI,EAAE,CAAC;QACjC,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,YAAY,EAAE,CAAC;QACxD,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;IAC1C,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const test_utils_1 = require("../../test-utils");
|
|
13
|
-
const WindowManager_1 = require("
|
|
13
|
+
const WindowManager_1 = require("../../WindowManager/WindowManager");
|
|
14
14
|
const CrossWindowProvider_1 = require("../CrossWindowProvider");
|
|
15
15
|
describe('CrossWindowProvider Login', () => {
|
|
16
16
|
let crossWindowProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Login.test.js","sourceRoot":"","sources":["../../../src/CrossWindowProvider/tests/Login.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iDAI0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"Login.test.js","sourceRoot":"","sources":["../../../src/CrossWindowProvider/tests/Login.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iDAI0B;AAC1B,qEAAkE;AAClE,gEAA6D;AAE7D,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,IAAI,mBAAwC,CAAC;IAC7C,IAAI,gBAAsC,CAAC;IAC3C,IAAI,aAA+B,CAAC;IAEpC,UAAU,CAAC,GAAG,EAAE;QACd,gBAAgB,GAAG,IAAA,gCAAmB,GAAE,CAAC;QACzC,6BAAa,CAAC,WAAW,EAAE,CAAC,WAAW,GAAG,IAAI;aAC3C,EAAE,EAAE;aACJ,kBAAkB,CAAC,GAAG,EAAE,CAAC,CAAC;YACzB,OAAO,EAAE;gBACP,IAAI,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,eAAe,EAAE;aAC7D;SACF,CAAC,CAAC,CAAC;QAEN,mBAAmB,GAAG,yCAAmB,CAAC,WAAW,EAAE,CAAC;QACxD,IAAA,6BAAgB,GAAE,CAAC;QACnB,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC3C,aAAa,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+BAA+B,EAAE,GAAS,EAAE;QAC7C,MAAM,mBAAmB,CAAC,IAAI,EAAE,CAAC;QACjC,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;QACvE,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;YACrB,OAAO,EAAE,aAAa;YACtB,SAAS,EAAE,eAAe;SAC3B,CAAC,CAAC;IACL,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const test_utils_1 = require("../../test-utils");
|
|
13
|
-
const WindowManager_1 = require("
|
|
13
|
+
const WindowManager_1 = require("../../WindowManager/WindowManager");
|
|
14
14
|
const CrossWindowProvider_1 = require("../CrossWindowProvider");
|
|
15
15
|
describe('CrossWindowProvider', () => {
|
|
16
16
|
let crossWindowProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Logout.test.js","sourceRoot":"","sources":["../../../src/CrossWindowProvider/tests/Logout.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iDAI0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"Logout.test.js","sourceRoot":"","sources":["../../../src/CrossWindowProvider/tests/Logout.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iDAI0B;AAC1B,qEAAkE;AAClE,gEAA6D;AAE7D,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,IAAI,mBAAwC,CAAC;IAC7C,IAAI,gBAAsC,CAAC;IAC3C,IAAI,aAA+B,CAAC;IAEpC,UAAU,CAAC,GAAG,EAAE;QACd,gBAAgB,GAAG,IAAA,gCAAmB,GAAE,CAAC;QACzC,6BAAa,CAAC,WAAW,EAAE,CAAC,WAAW,GAAG,IAAI;aAC3C,EAAE,EAAE;aACJ,kBAAkB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;QAElC,6BAAa,CAAC,WAAW,EAAE,CAAC,eAAe,GAAG,IAAI;aAC/C,EAAE,EAAE;aACJ,kBAAkB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;QAElC,mBAAmB,GAAG,yCAAmB,CAAC,WAAW,EAAE,CAAC;QACxD,IAAA,6BAAgB,GAAE,CAAC;QACnB,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC3C,aAAa,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gCAAgC,EAAE,GAAS,EAAE;QAC9C,MAAM,mBAAmB,CAAC,IAAI,EAAE,CAAC;QACjC,mBAAmB,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;QAC9C,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,MAAM,EAAE,CAAC;QAClD,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const out_1 = require("@multiversx/sdk-core/out");
|
|
13
13
|
const test_utils_1 = require("../../test-utils");
|
|
14
|
-
const WindowManager_1 = require("
|
|
14
|
+
const WindowManager_1 = require("../../WindowManager/WindowManager");
|
|
15
15
|
const CrossWindowProvider_1 = require("../CrossWindowProvider");
|
|
16
16
|
describe('CrossWindowProvider Login', () => {
|
|
17
17
|
let crossWindowProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignMessage.test.js","sourceRoot":"","sources":["../../../src/CrossWindowProvider/tests/SignMessage.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,kDAA2D;AAC3D,iDAI0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"SignMessage.test.js","sourceRoot":"","sources":["../../../src/CrossWindowProvider/tests/SignMessage.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,kDAA2D;AAC3D,iDAI0B;AAC1B,qEAAkE;AAClE,gEAA6D;AAE7D,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,IAAI,mBAAwC,CAAC;IAC7C,IAAI,gBAAsC,CAAC;IAC3C,IAAI,aAA+B,CAAC;IAEpC,UAAU,CAAC,GAAG,EAAE;QACd,gBAAgB,GAAG,IAAA,gCAAmB,GAAE,CAAC;QACzC,6BAAa,CAAC,WAAW,EAAE,CAAC,WAAW,GAAG,IAAI;aAC3C,EAAE,EAAE;aACJ,kBAAkB,CAAC,GAAG,EAAE,CAAC,CAAC;YACzB,OAAO,EAAE;gBACP,IAAI,EAAE;oBACJ,MAAM,EAAE,QAAQ;oBAChB,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;iBACxD;aACF;SACF,CAAC,CAAC,CAAC;QAEN,mBAAmB,GAAG,yCAAmB,CAAC,WAAW,EAAE,CAAC;QACxD,IAAA,6BAAgB,GAAE,CAAC;QACnB,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC3C,aAAa,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iCAAiC,EAAE,GAAS,EAAE;QAC/C,MAAM,WAAW,GAAG,IAAI,qBAAe,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC1E,mBAAmB,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;QAC9C,MAAM,mBAAmB,CAAC,IAAI,EAAE,CAAC;QACjC,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QAElE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC5D,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const test_utils_1 = require("../../test-utils");
|
|
13
|
-
const WindowManager_1 = require("
|
|
13
|
+
const WindowManager_1 = require("../../WindowManager/WindowManager");
|
|
14
14
|
const CrossWindowProvider_1 = require("../CrossWindowProvider");
|
|
15
15
|
describe('CrossWindowProvider Login', () => {
|
|
16
16
|
let crossWindowProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignTransaction.test.js","sourceRoot":"","sources":["../../../src/CrossWindowProvider/tests/SignTransaction.test.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,iDAK0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"SignTransaction.test.js","sourceRoot":"","sources":["../../../src/CrossWindowProvider/tests/SignTransaction.test.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,iDAK0B;AAC1B,qEAAkE;AAClE,gEAA6D;AAE7D,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,IAAI,mBAAwC,CAAC;IAC7C,IAAI,gBAAsC,CAAC;IAC3C,IAAI,aAA+B,CAAC;IAEpC,IAAI,eAA4B,CAAC;IAEjC,UAAU,CAAC,GAAG,EAAE;QACd,gBAAgB,GAAG,IAAA,gCAAmB,GAAE,CAAC;QACzC,eAAe,GAAG,IAAA,kCAAqB,EAAC;YACtC,IAAI,EAAE,MAAM;YACZ,gBAAgB,EAAE,UAAU;YAC5B,cAAc,EAAE,QAAQ;SACzB,CAAC,CAAC;QAEH,6BAAa,CAAC,WAAW,EAAE,CAAC,WAAW,GAAG,IAAI;aAC3C,EAAE,EAAE;aACJ,kBAAkB,CAAC,GAAG,EAAE,CAAC,CAAC;YACzB,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,eAAe,CAAC,aAAa,EAAE,CAAC,EAAE;SACrD,CAAC,CAAC,CAAC;QAEN,mBAAmB,GAAG,yCAAmB,CAAC,WAAW,EAAE,CAAC;QACxD,IAAA,6BAAgB,GAAE,CAAC;QACnB,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC3C,aAAa,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qCAAqC,EAAE,GAAS,EAAE;QACnD,mBAAmB,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;QAC9C,MAAM,mBAAmB,CAAC,IAAI,EAAE,CAAC;QAEjC,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC;QAC1E,MAAM,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;IAChD,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import { CrossWindowProviderRequestEnums, CrossWindowProviderResponseEnums, PostMessageParamsType, PostMessageReturnType, ReplyWithPostMessagePayloadType } from
|
|
1
|
+
import { CrossWindowProviderRequestEnums, CrossWindowProviderResponseEnums, PostMessageParamsType, PostMessageReturnType, ReplyWithPostMessagePayloadType } from '../types';
|
|
2
2
|
export declare class WindowManager {
|
|
3
|
-
|
|
3
|
+
private _walletUrl;
|
|
4
4
|
private initialized;
|
|
5
|
-
|
|
5
|
+
private static _instance;
|
|
6
6
|
walletWindow: Window | null;
|
|
7
7
|
constructor();
|
|
8
8
|
get walletUrl(): string;
|
|
9
9
|
static getInstance(): WindowManager;
|
|
10
10
|
setWalletUrl(url: string): WindowManager;
|
|
11
11
|
init(): Promise<boolean>;
|
|
12
|
-
setWalletWindow(): Promise<void>;
|
|
13
|
-
closeWalletWindow(): void;
|
|
14
|
-
onDisconnect(): void;
|
|
15
12
|
isWalletOpened(type?: CrossWindowProviderRequestEnums): boolean;
|
|
16
13
|
handshake(type: CrossWindowProviderRequestEnums): Promise<boolean>;
|
|
17
14
|
private addHandshakeChangeListener;
|
|
@@ -21,6 +18,5 @@ export declare class WindowManager {
|
|
|
21
18
|
}>;
|
|
22
19
|
closeConnection(): Promise<boolean>;
|
|
23
20
|
isInitialized(): boolean;
|
|
24
|
-
postMessage<T extends CrossWindowProviderRequestEnums>({ type, payload
|
|
25
|
-
clearInstance(): void;
|
|
21
|
+
postMessage<T extends CrossWindowProviderRequestEnums>({ type, payload }: PostMessageParamsType<T>): Promise<PostMessageReturnType<T>>;
|
|
26
22
|
}
|
|
@@ -16,11 +16,12 @@ const types_1 = require("../types");
|
|
|
16
16
|
class WindowManager {
|
|
17
17
|
constructor() {
|
|
18
18
|
var _a, _b;
|
|
19
|
-
this._walletUrl =
|
|
19
|
+
this._walletUrl = '';
|
|
20
20
|
this.initialized = false;
|
|
21
21
|
this.walletWindow = null;
|
|
22
|
-
(_a = constants_1.safeWindow.addEventListener) === null || _a === void 0 ? void 0 : _a.call(constants_1.safeWindow,
|
|
23
|
-
|
|
22
|
+
(_a = constants_1.safeWindow.addEventListener) === null || _a === void 0 ? void 0 : _a.call(constants_1.safeWindow, 'beforeunload', () => {
|
|
23
|
+
var _a;
|
|
24
|
+
(_a = this.walletWindow) === null || _a === void 0 ? void 0 : _a.close();
|
|
24
25
|
});
|
|
25
26
|
constants_1.safeWindow.name = (_b = constants_1.safeWindow.location) === null || _b === void 0 ? void 0 : _b.origin;
|
|
26
27
|
WindowManager._instance = this; // TODO: remove singleton
|
|
@@ -29,14 +30,11 @@ class WindowManager {
|
|
|
29
30
|
return this._walletUrl;
|
|
30
31
|
}
|
|
31
32
|
static getInstance() {
|
|
32
|
-
if (!WindowManager._instance) {
|
|
33
|
-
return new WindowManager();
|
|
34
|
-
}
|
|
35
33
|
return WindowManager._instance;
|
|
36
34
|
}
|
|
37
35
|
setWalletUrl(url) {
|
|
38
36
|
this._walletUrl = url;
|
|
39
|
-
return
|
|
37
|
+
return WindowManager._instance;
|
|
40
38
|
}
|
|
41
39
|
init() {
|
|
42
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -44,39 +42,27 @@ class WindowManager {
|
|
|
44
42
|
return this.initialized;
|
|
45
43
|
});
|
|
46
44
|
}
|
|
47
|
-
setWalletWindow() {
|
|
48
|
-
var _a, _b;
|
|
49
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
-
this.walletWindow =
|
|
51
|
-
(_b = (_a = constants_1.safeWindow.open) === null || _a === void 0 ? void 0 : _a.call(constants_1.safeWindow, this._walletUrl, this._walletUrl)) !== null && _b !== void 0 ? _b : null;
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
closeWalletWindow() {
|
|
55
|
-
var _a;
|
|
56
|
-
(_a = this.walletWindow) === null || _a === void 0 ? void 0 : _a.close();
|
|
57
|
-
}
|
|
58
|
-
onDisconnect() {
|
|
59
|
-
this.walletWindow = null;
|
|
60
|
-
}
|
|
61
45
|
isWalletOpened(type) {
|
|
62
46
|
return (type === types_1.CrossWindowProviderRequestEnums.cancelAction &&
|
|
63
47
|
Boolean(this.walletWindow));
|
|
64
48
|
}
|
|
65
49
|
handshake(type) {
|
|
66
|
-
var _a;
|
|
50
|
+
var _a, _b, _c, _d;
|
|
67
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
-
|
|
52
|
+
const isOpened = this.isWalletOpened(type);
|
|
53
|
+
if (isOpened) {
|
|
69
54
|
return true;
|
|
70
55
|
}
|
|
71
|
-
this.
|
|
72
|
-
|
|
56
|
+
(_a = this.walletWindow) === null || _a === void 0 ? void 0 : _a.close();
|
|
57
|
+
this.walletWindow =
|
|
58
|
+
(_c = (_b = constants_1.safeWindow.open) === null || _b === void 0 ? void 0 : _b.call(constants_1.safeWindow, this.walletUrl, this.walletUrl)) !== null && _c !== void 0 ? _c : null;
|
|
73
59
|
const { payload: isWalletReady } = yield this.listenOnce(types_1.CrossWindowProviderResponseEnums.handshakeResponse);
|
|
74
60
|
if (!isWalletReady) {
|
|
75
61
|
throw new errors_1.ErrCannotEstablishHandshake();
|
|
76
62
|
}
|
|
77
|
-
(
|
|
78
|
-
type: types_1.CrossWindowProviderRequestEnums.finalizeHandshakeRequest
|
|
79
|
-
}, this.
|
|
63
|
+
(_d = this.walletWindow) === null || _d === void 0 ? void 0 : _d.postMessage({
|
|
64
|
+
type: types_1.CrossWindowProviderRequestEnums.finalizeHandshakeRequest
|
|
65
|
+
}, this.walletUrl);
|
|
80
66
|
this.addHandshakeChangeListener();
|
|
81
67
|
return true;
|
|
82
68
|
});
|
|
@@ -84,9 +70,9 @@ class WindowManager {
|
|
|
84
70
|
addHandshakeChangeListener() {
|
|
85
71
|
var _a;
|
|
86
72
|
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
-
const walletUrl = this.
|
|
73
|
+
const walletUrl = this.walletUrl;
|
|
88
74
|
const eventHandler = (event) => {
|
|
89
|
-
var _a;
|
|
75
|
+
var _a, _b;
|
|
90
76
|
try {
|
|
91
77
|
const { type, payload } = event.data;
|
|
92
78
|
const isWalletEvent = event.origin === new URL(walletUrl).origin;
|
|
@@ -94,23 +80,18 @@ class WindowManager {
|
|
|
94
80
|
return;
|
|
95
81
|
}
|
|
96
82
|
switch (type) {
|
|
97
|
-
case types_1.CrossWindowProviderResponseEnums.disconnectResponse:
|
|
98
83
|
case types_1.CrossWindowProviderResponseEnums.handshakeResponse:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
(
|
|
103
|
-
type === types_1.CrossWindowProviderResponseEnums.handshakeResponse)) {
|
|
104
|
-
this.closeWalletWindow();
|
|
105
|
-
this.onDisconnect();
|
|
106
|
-
(_a = constants_1.safeWindow.removeEventListener) === null || _a === void 0 ? void 0 : _a.call(constants_1.safeWindow, "message", eventHandler);
|
|
84
|
+
if (payload === false) {
|
|
85
|
+
(_a = this.walletWindow) === null || _a === void 0 ? void 0 : _a.close();
|
|
86
|
+
this.walletWindow = null;
|
|
87
|
+
(_b = constants_1.safeWindow.removeEventListener) === null || _b === void 0 ? void 0 : _b.call(constants_1.safeWindow, 'message', eventHandler);
|
|
107
88
|
}
|
|
108
89
|
break;
|
|
109
90
|
}
|
|
110
91
|
}
|
|
111
|
-
catch (
|
|
92
|
+
catch (_c) { }
|
|
112
93
|
};
|
|
113
|
-
(_a = constants_1.safeWindow.addEventListener) === null || _a === void 0 ? void 0 : _a.call(constants_1.safeWindow,
|
|
94
|
+
(_a = constants_1.safeWindow.addEventListener) === null || _a === void 0 ? void 0 : _a.call(constants_1.safeWindow, 'message', eventHandler);
|
|
114
95
|
});
|
|
115
96
|
}
|
|
116
97
|
listenOnce(action) {
|
|
@@ -120,8 +101,8 @@ class WindowManager {
|
|
|
120
101
|
}
|
|
121
102
|
return yield new Promise((resolve) => {
|
|
122
103
|
var _a;
|
|
123
|
-
const walletUrl = this.
|
|
124
|
-
(_a = constants_1.safeWindow.addEventListener) === null || _a === void 0 ? void 0 : _a.call(constants_1.safeWindow,
|
|
104
|
+
const walletUrl = this.walletUrl;
|
|
105
|
+
(_a = constants_1.safeWindow.addEventListener) === null || _a === void 0 ? void 0 : _a.call(constants_1.safeWindow, 'message', function eventHandler(event) {
|
|
125
106
|
var _a;
|
|
126
107
|
return __awaiter(this, void 0, void 0, function* () {
|
|
127
108
|
const { type, payload } = event.data;
|
|
@@ -131,7 +112,7 @@ class WindowManager {
|
|
|
131
112
|
if (!isCurrentAction || !isWalletEvent) {
|
|
132
113
|
return;
|
|
133
114
|
}
|
|
134
|
-
(_a = constants_1.safeWindow.removeEventListener) === null || _a === void 0 ? void 0 : _a.call(constants_1.safeWindow,
|
|
115
|
+
(_a = constants_1.safeWindow.removeEventListener) === null || _a === void 0 ? void 0 : _a.call(constants_1.safeWindow, 'message', eventHandler);
|
|
135
116
|
resolve({ type, payload });
|
|
136
117
|
});
|
|
137
118
|
});
|
|
@@ -145,7 +126,7 @@ class WindowManager {
|
|
|
145
126
|
}
|
|
146
127
|
yield this.postMessage({
|
|
147
128
|
type: types_1.CrossWindowProviderRequestEnums.logoutRequest,
|
|
148
|
-
payload: undefined
|
|
129
|
+
payload: undefined
|
|
149
130
|
});
|
|
150
131
|
return true;
|
|
151
132
|
});
|
|
@@ -153,23 +134,20 @@ class WindowManager {
|
|
|
153
134
|
isInitialized() {
|
|
154
135
|
return this.initialized;
|
|
155
136
|
}
|
|
156
|
-
postMessage({ type, payload
|
|
157
|
-
var _a;
|
|
137
|
+
postMessage({ type, payload }) {
|
|
138
|
+
var _a, _b;
|
|
158
139
|
return __awaiter(this, void 0, void 0, function* () {
|
|
159
140
|
yield this.handshake(type);
|
|
160
141
|
(_a = this.walletWindow) === null || _a === void 0 ? void 0 : _a.postMessage({
|
|
161
142
|
type,
|
|
162
|
-
payload
|
|
163
|
-
}, this.
|
|
143
|
+
payload
|
|
144
|
+
}, this.walletUrl);
|
|
164
145
|
const data = yield this.listenOnce(constants_1.responseTypeMap[type]);
|
|
165
|
-
this.
|
|
146
|
+
(_b = this.walletWindow) === null || _b === void 0 ? void 0 : _b.close();
|
|
166
147
|
return data;
|
|
167
148
|
});
|
|
168
149
|
}
|
|
169
|
-
clearInstance() {
|
|
170
|
-
WindowManager._instance = null;
|
|
171
|
-
}
|
|
172
150
|
}
|
|
173
|
-
WindowManager._instance =
|
|
151
|
+
WindowManager._instance = new WindowManager();
|
|
174
152
|
exports.WindowManager = WindowManager;
|
|
175
153
|
//# sourceMappingURL=WindowManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WindowManager.js","sourceRoot":"","sources":["../../src/WindowManager/WindowManager.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA2D;AAC3D,sCAImB;AAEnB,oCAOkB;AAElB,MAAa,aAAa;IAMxB;;QALQ,eAAU,GAAG,EAAE,CAAC;QAChB,gBAAW,GAAG,KAAK,CAAC;QAE5B,iBAAY,GAAkB,IAAI,CAAC;QAGjC,MAAA,sBAAU,CAAC,gBAAgB,uEAAG,cAAc,EAAE,GAAG,EAAE;;YACjD,MAAA,IAAI,CAAC,YAAY,0CAAE,KAAK,EAAE,CAAC;QAC7B,CAAC,CAAC,CAAC;QAEH,sBAAU,CAAC,IAAI,GAAG,MAAA,sBAAU,CAAC,QAAQ,0CAAE,MAAM,CAAC;QAC9C,aAAa,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,yBAAyB;IAC3D,CAAC;IAED,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAEM,MAAM,CAAC,WAAW;QACvB,OAAO,aAAa,CAAC,SAAS,CAAC;IACjC,CAAC;IAEM,YAAY,CAAC,GAAW;QAC7B,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;QACtB,OAAO,aAAa,CAAC,SAAS,CAAC;IACjC,CAAC;IAEK,IAAI;;YACR,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;YACxB,OAAO,IAAI,CAAC,WAAW,CAAC;QAC1B,CAAC;KAAA;IAEM,cAAc,CAAC,IAAsC;QAC1D,OAAO,CACL,IAAI,KAAK,uCAA+B,CAAC,YAAY;YACrD,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAC3B,CAAC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AC,WAAW,CAAC;gBACrB,IAAI,EAAE,uCAA+B,CAAC,aAAa;gBACnD,OAAO,EAAE,SAAS;aACnB,CAAC,CAAC;YAEH,OAAO,IAAI,CAAC;QACd,CAAC;KAAA;IAED,aAAa;QACX,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAEK,WAAW,CAA4C,EAC3D,IAAI,EACJ,OAAO,EACkB;;;YACzB,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAE3B,MAAA,IAAI,CAAC,YAAY,0CAAE,WAAW,CAC5B;gBACE,IAAI;gBACJ,OAAO;aACR,EACD,IAAI,CAAC,SAAS,CACf,CAAC;YAEF,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,2BAAe,CAAC,IAAI,CAAC,CAAC,CAAC;YAE1D,MAAA,IAAI,CAAC,YAAY,0CAAE,KAAK,EAAE,CAAC;YAE3B,OAAO,IAAI,CAAC;;KACb;;AA1Kc,uBAAS,GAAkB,IAAI,aAAa,EAAE,AAArC,CAAsC;AAHnD,sCAAa"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './WindowManager';
|
|
@@ -14,5 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./WindowManager"), exports);
|
|
18
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/WindowManager/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC"}
|
|
@@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const test_utils_1 = require("../../test-utils");
|
|
13
13
|
const types_1 = require("../../types");
|
|
14
|
-
const WindowManager_1 = require("
|
|
14
|
+
const WindowManager_1 = require("../WindowManager");
|
|
15
15
|
describe('WindowManager', () => {
|
|
16
16
|
let windowOpenSpy;
|
|
17
17
|
let windowCloseSpy;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"windowManager.test.js","sourceRoot":"","sources":["../../../src/WindowManager/tests/windowManager.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iDAAuD;AACvD,uCAGqB;AACrB,oDAAiD;AAEjD,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,IAAI,aAA+B,CAAC;IACpC,IAAI,cAAgC,CAAC;IACrC,IAAI,oBAAsC,CAAC;IAC3C,IAAI,uBAAyC,CAAC;IAC9C,IAAI,gBAA8D,CAAC;IAEnE,UAAU,CAAC,GAAG,EAAE;QACd,gBAAgB,GAAG,IAAA,gCAAmB,GAAE,CAAC;QAEzC,oBAAoB,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;QAC9D,oBAAoB,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QAEnD,uBAAuB,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;QACpE,uBAAuB,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QAEtD,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7C,cAAc,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QAE7C,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC3C,aAAa,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,gBAAgB,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.d.ts
CHANGED
package/out/index.js
CHANGED
|
@@ -15,7 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./CrossWindowProvider"), exports);
|
|
18
|
-
__exportStar(require("./constants"), exports);
|
|
19
|
-
__exportStar(require("./errors"), exports);
|
|
20
|
-
__exportStar(require("./types"), exports);
|
|
21
18
|
//# sourceMappingURL=index.js.map
|
package/out/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mockWindoManager = void 0;
|
|
4
|
-
const WindowManager_1 = require("../
|
|
4
|
+
const WindowManager_1 = require("../WindowManager/WindowManager");
|
|
5
5
|
const mockWindoManager = () => (WindowManager_1.WindowManager.getInstance = jest.fn().mockReturnValue({
|
|
6
6
|
init: jest.fn().mockResolvedValue(true),
|
|
7
7
|
postMessage: jest.fn().mockResolvedValue({ payload: {} }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockWindowManager.js","sourceRoot":"","sources":["../../src/test-utils/mockWindowManager.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"mockWindowManager.js","sourceRoot":"","sources":["../../src/test-utils/mockWindowManager.ts"],"names":[],"mappings":";;;AAAA,kEAA+D;AAExD,MAAM,gBAAgB,GAAG,GAAG,EAAE,CACnC,CAAC,6BAAa,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC;IACrD,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC;IACvC,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzD,eAAe,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC;CACnD,CAAC,CAAC,CAAC;AALO,QAAA,gBAAgB,oBAKvB"}
|
package/package.json
CHANGED
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiversx/sdk-web-wallet-cross-window-provider",
|
|
3
|
-
"version": "0.0.28-alpha.
|
|
3
|
+
"version": "0.0.28-alpha.14",
|
|
4
4
|
"description": "Signing provider for dApps: Cross Window",
|
|
5
5
|
"main": "out/index.js",
|
|
6
6
|
"types": "out/index.d.js",
|
|
7
7
|
"files": [
|
|
8
8
|
"out/**/*"
|
|
9
9
|
],
|
|
10
|
-
"directories": {
|
|
11
|
-
"lib": "src"
|
|
12
|
-
},
|
|
13
10
|
"engines": {
|
|
14
11
|
"node": ">=18"
|
|
15
12
|
},
|
|
16
13
|
"scripts": {
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"prepare": "npm run build:package",
|
|
14
|
+
"compile": "tsc -p tsconfig.json",
|
|
15
|
+
"pretest": "npm run compile",
|
|
16
|
+
"prepare": "npm run compile",
|
|
21
17
|
"lint": "eslint --fix --ext js,ts src",
|
|
22
18
|
"test": "jest"
|
|
23
19
|
},
|
|
@@ -49,7 +45,6 @@
|
|
|
49
45
|
"@multiversx/sdk-core": "12.18.0",
|
|
50
46
|
"@types/jest": "^29.5.11",
|
|
51
47
|
"@types/qs": "6.9.10",
|
|
52
|
-
"qs": "6.11.2"
|
|
53
|
-
"@multiversx/sdk-dapp-ui": "0.0.3"
|
|
48
|
+
"qs": "6.11.2"
|
|
54
49
|
}
|
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B,uEAAG,SAAS,EAAE,YAAY,CAAC,CAAC;wBAC1D,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;;iBAC5B,CACF,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;KAAA;IAEK,eAAe;;YACnB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;gBACrB,MAAM,IAAI,kCAAyB,EAAE,CAAC;aACvC;YAED,MAAM,IAAI,CAAC,WAAW,CAAC;gBACrB,IAAI,EAAE,uCAA+B,CAAC,aAAa;gBACnD,OAAO,EAAE,SAAS;aACnB,CAAC,CAAC;YAEH,OAAO,IAAI,CAAC;QACd,CAAC;KAAA;IAED,aAAa;QACX,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAEK,WAAW,CAA4C,EAC3D,IAAI,EACJ,OAAO,GACkB;;;YACzB,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAC3B,MAAA,IAAI,CAAC,YAAY,0CAAE,WAAW,CAC5B;gBACE,IAAI;gBACJ,OAAO;aACR,EACD,IAAI,CAAC,UAAU,CAChB,CAAC;YAEF,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,2BAAe,CAAC,IAAI,CAAC,CAAC,CAAC;YAE1D,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAEzB,OAAO,IAAI,CAAC;;KACb;IAEM,aAAa;QAClB,aAAa,CAAC,SAAS,GAAG,IAAI,CAAC;IACjC,CAAC;;AApMgB,uBAAS,GAAyB,IAAI,AAA7B,CAA8B;AAH7C,sCAAa"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"windowManager.test.js","sourceRoot":"","sources":["../../../src/CrossWindowProvider/tests/windowManager.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iDAAuD;AACvD,uCAGqB;AACrB,2EAAwE;AAExE,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,IAAI,aA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IAEH,EAAE,CAAC,6CAA6C,EAAE,GAAS,EAAE;QAC3D,MAAM,aAAa,GAAG,6BAAa,CAAC,WAAW,EAAE,CAAC;QAClD,aAAa,CAAC,UAAU,CAAC,wCAAgC,CAAC,aAAa,CAAC,CAAC;QAEzE,MAAM,CAAC,oBAAoB,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IACxD,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,sCAAsC,EAAE,GAAS,EAAE;QACpD,MAAM,aAAa,GAAG,6BAAa,CAAC,WAAW,EAAE,CAAC;QAClD,aAAa,CAAC,WAAW,CAAC;YACxB,IAAI,EAAE,uCAA+B,CAAC,YAAY;YAClD,OAAO,EAAE;gBACP,KAAK,EAAE,OAAO;aACf;SACF,CAAC,CAAC;QAEH,MAAM,CAAC,oBAAoB,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QACtD,MAAM,CAAC,aAAa,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC/C,MAAM,CAAC,cAAc,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAClD,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IframeManager = void 0;
|
|
4
|
-
const WindowManager_1 = require("../CrossWindowProvider/WindowManager");
|
|
5
|
-
class IframeManager extends WindowManager_1.WindowManager {
|
|
6
|
-
// private floatingWalletComponent?: HTMLFloatingWalletElement = undefined;
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.IframeManager = IframeManager;
|
|
12
|
-
//# sourceMappingURL=IframeManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IframeManager.js","sourceRoot":"","sources":["../../src/IframeProvider/IframeManager.ts"],"names":[],"mappings":";;;AAAA,wEAAqE;AAErE,MAAa,aAAc,SAAQ,6BAAa;IAC9C,2EAA2E;IAE3E;QACE,KAAK,EAAE,CAAC;IACV,CAAC;CAyDF;AA9DD,sCA8DC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { CrossWindowProvider } from "../CrossWindowProvider";
|
|
2
|
-
import { IframeManager } from "./IframeManager";
|
|
3
|
-
export declare class IframeProvider extends CrossWindowProvider {
|
|
4
|
-
protected windowManager: IframeManager | null;
|
|
5
|
-
init(): Promise<boolean>;
|
|
6
|
-
static getInstance(): IframeProvider;
|
|
7
|
-
openPopupConsent(_action: string): any;
|
|
8
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.IframeProvider = void 0;
|
|
13
|
-
const CrossWindowProvider_1 = require("../CrossWindowProvider");
|
|
14
|
-
const IframeManager_1 = require("./IframeManager");
|
|
15
|
-
class IframeProvider extends CrossWindowProvider_1.CrossWindowProvider {
|
|
16
|
-
constructor() {
|
|
17
|
-
super(...arguments);
|
|
18
|
-
this.windowManager = null;
|
|
19
|
-
// public override async signTransactions(
|
|
20
|
-
// transactions: Transaction[]
|
|
21
|
-
// ): Promise<Transaction[]> {
|
|
22
|
-
// this.windowManager?.floatingWallet?.setWalletVisible(true);
|
|
23
|
-
// const result = await super.signTransactions(transactions);
|
|
24
|
-
// this.windowManager?.floatingWallet?.setWalletVisible(false);
|
|
25
|
-
// return result;
|
|
26
|
-
// }
|
|
27
|
-
}
|
|
28
|
-
init() {
|
|
29
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
this.windowManager = IframeManager_1.IframeManager.getInstance();
|
|
31
|
-
this.initialized = yield this.windowManager.init();
|
|
32
|
-
return this.initialized;
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
static getInstance() {
|
|
36
|
-
if (!IframeProvider._instance) {
|
|
37
|
-
return new IframeProvider();
|
|
38
|
-
}
|
|
39
|
-
//@ts-ignore
|
|
40
|
-
return IframeProvider._instance;
|
|
41
|
-
}
|
|
42
|
-
openPopupConsent(_action) {
|
|
43
|
-
return { popupConsentResponse: true };
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
exports.IframeProvider = IframeProvider;
|
|
47
|
-
//# sourceMappingURL=IframeProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IframeProvider.js","sourceRoot":"","sources":["../../src/IframeProvider/IframeProvider.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,gEAA6D;AAC7D,mDAAgD;AAEhD,MAAa,cAAe,SAAQ,yCAAmB;IAAvD;;QACY,kBAAa,GAAyB,IAAI,CAAC;QAmBrD,0CAA0C;QAC1C,gCAAgC;QAChC,8BAA8B;QAC9B,gEAAgE;QAChE,+DAA+D;QAC/D,iEAAiE;QACjE,mBAAmB;QACnB,IAAI;IACN,CAAC;IA1BgB,IAAI;;YACjB,IAAI,CAAC,aAAa,GAAG,6BAAa,CAAC,WAAW,EAAE,CAAC;YACjD,IAAI,CAAC,WAAW,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;YACnD,OAAO,IAAI,CAAC,WAAW,CAAC;QAC1B,CAAC;KAAA;IAEM,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE;YAC7B,OAAO,IAAI,cAAc,EAAE,CAAC;SAC7B;QACD,YAAY;QACZ,OAAO,cAAc,CAAC,SAAS,CAAC;IAClC,CAAC;IAEe,gBAAgB,CAAC,OAAe;QAC9C,OAAO,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;IACxC,CAAC;CAUF;AA5BD,wCA4BC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './IframeProvider';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/IframeProvider/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC"}
|
|
File without changes
|