@metamask/connect-multichain 0.4.0 → 0.5.1
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/CHANGELOG.md +33 -1
- package/dist/browser/es/connect-multichain.d.mts +26 -9
- package/dist/browser/es/connect-multichain.mjs +370 -100
- package/dist/browser/es/connect-multichain.mjs.map +1 -1
- package/dist/browser/es/metafile-esm.json +1 -1
- package/dist/browser/iife/connect-multichain.d.ts +26 -9
- package/dist/browser/iife/connect-multichain.js +2829 -224
- package/dist/browser/iife/connect-multichain.js.map +1 -1
- package/dist/browser/iife/metafile-iife.json +1 -1
- package/dist/browser/umd/connect-multichain.d.ts +26 -9
- package/dist/browser/umd/connect-multichain.js +370 -100
- package/dist/browser/umd/connect-multichain.js.map +1 -1
- package/dist/browser/umd/metafile-cjs.json +1 -1
- package/dist/node/cjs/connect-multichain.d.ts +26 -9
- package/dist/node/cjs/connect-multichain.js +364 -101
- package/dist/node/cjs/connect-multichain.js.map +1 -1
- package/dist/node/cjs/metafile-cjs.json +1 -1
- package/dist/node/es/connect-multichain.d.mts +26 -9
- package/dist/node/es/connect-multichain.mjs +363 -100
- package/dist/node/es/connect-multichain.mjs.map +1 -1
- package/dist/node/es/metafile-esm.json +1 -1
- package/dist/react-native/es/connect-multichain.d.mts +26 -9
- package/dist/react-native/es/connect-multichain.mjs +357 -91
- package/dist/react-native/es/connect-multichain.mjs.map +1 -1
- package/dist/react-native/es/metafile-esm.json +1 -1
- package/dist/src/domain/multichain/index.d.ts +4 -4
- package/dist/src/domain/multichain/index.d.ts.map +1 -1
- package/dist/src/domain/multichain/index.js.map +1 -1
- package/dist/src/domain/multichain/types.d.ts +4 -3
- package/dist/src/domain/multichain/types.d.ts.map +1 -1
- package/dist/src/domain/ui/types.d.ts +7 -0
- package/dist/src/domain/ui/types.d.ts.map +1 -1
- package/dist/src/domain/ui/types.js.map +1 -1
- package/dist/src/index.browser.d.ts +2 -1
- package/dist/src/index.browser.d.ts.map +1 -1
- package/dist/src/index.browser.js +5 -3
- package/dist/src/index.browser.js.map +1 -1
- package/dist/src/index.native.d.ts +2 -1
- package/dist/src/index.native.d.ts.map +1 -1
- package/dist/src/index.native.js +6 -4
- package/dist/src/index.native.js.map +1 -1
- package/dist/src/index.node.d.ts +1 -1
- package/dist/src/index.node.d.ts.map +1 -1
- package/dist/src/index.node.js +3 -3
- package/dist/src/index.node.js.map +1 -1
- package/dist/src/multichain/index.d.ts +8 -8
- package/dist/src/multichain/index.d.ts.map +1 -1
- package/dist/src/multichain/index.js +161 -101
- package/dist/src/multichain/index.js.map +1 -1
- package/dist/src/multichain/transports/default/index.d.ts +2 -1
- package/dist/src/multichain/transports/default/index.d.ts.map +1 -1
- package/dist/src/multichain/transports/default/index.js +1 -0
- package/dist/src/multichain/transports/default/index.js.map +1 -1
- package/dist/src/multichain/transports/multichainApiClientWrapper/index.d.ts +21 -0
- package/dist/src/multichain/transports/multichainApiClientWrapper/index.d.ts.map +1 -0
- package/dist/src/multichain/transports/multichainApiClientWrapper/index.js +159 -0
- package/dist/src/multichain/transports/multichainApiClientWrapper/index.js.map +1 -0
- package/dist/src/multichain/transports/mwp/index.d.ts +4 -1
- package/dist/src/multichain/transports/mwp/index.d.ts.map +1 -1
- package/dist/src/multichain/transports/mwp/index.js +54 -2
- package/dist/src/multichain/transports/mwp/index.js.map +1 -1
- package/dist/src/polyfills/buffer-shim.d.ts +2 -0
- package/dist/src/polyfills/buffer-shim.d.ts.map +1 -0
- package/dist/src/polyfills/buffer-shim.js +22 -0
- package/dist/src/polyfills/buffer-shim.js.map +1 -0
- package/dist/src/ui/ModalFactory.d.ts +54 -0
- package/dist/src/ui/ModalFactory.d.ts.map +1 -0
- package/dist/src/ui/ModalFactory.js +171 -0
- package/dist/src/ui/ModalFactory.js.map +1 -0
- package/dist/src/ui/index.d.ts +14 -38
- package/dist/src/ui/index.d.ts.map +1 -1
- package/dist/src/ui/index.js +24 -142
- package/dist/src/ui/index.js.map +1 -1
- package/dist/src/ui/index.native.d.ts +13 -0
- package/dist/src/ui/index.native.d.ts.map +1 -0
- package/dist/src/ui/{preload.native.js → index.native.js} +12 -6
- package/dist/src/ui/index.native.js.map +1 -0
- package/dist/src/ui/modals/base/AbstractInstallModal.d.ts.map +1 -1
- package/dist/src/ui/modals/base/AbstractInstallModal.js +0 -4
- package/dist/src/ui/modals/base/AbstractInstallModal.js.map +1 -1
- package/dist/types/connect-multichain.d.ts +26 -9
- package/package.json +9 -3
- package/dist/src/ui/preload.native.d.ts +0 -5
- package/dist/src/ui/preload.native.d.ts.map +0 -1
- package/dist/src/ui/preload.native.js.map +0 -1
- package/dist/src/ui/preload.web.d.ts +0 -5
- package/dist/src/ui/preload.web.d.ts.map +0 -1
- package/dist/src/ui/preload.web.js +0 -27
- package/dist/src/ui/preload.web.js.map +0 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Buffer polyfill for browser and React Native environments.
|
|
3
|
+
*
|
|
4
|
+
* This shim sets up the global Buffer object before any code that depends on it runs.
|
|
5
|
+
* It's imported at the top of platform-specific entry points (index.browser.ts, index.native.ts).
|
|
6
|
+
*
|
|
7
|
+
* Node.js environments already have Buffer globally available, so this is a no-op there.
|
|
8
|
+
*/
|
|
9
|
+
import { Buffer } from 'buffer';
|
|
10
|
+
// Get the appropriate global object for the current environment
|
|
11
|
+
const g = typeof globalThis !== 'undefined'
|
|
12
|
+
? globalThis
|
|
13
|
+
: typeof global !== 'undefined'
|
|
14
|
+
? global
|
|
15
|
+
: typeof window !== 'undefined'
|
|
16
|
+
? window
|
|
17
|
+
: {};
|
|
18
|
+
// Only set Buffer if it's not already defined (avoid overwriting Node.js native Buffer)
|
|
19
|
+
if (!g.Buffer) {
|
|
20
|
+
g.Buffer = Buffer;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=buffer-shim.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buffer-shim.js","sourceRoot":"","sources":["../../../src/polyfills/buffer-shim.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,gEAAgE;AAChE,MAAM,CAAC,GACL,OAAO,UAAU,KAAK,WAAW;IAC/B,CAAC,CAAC,UAAU;IACZ,CAAC,CAAC,OAAO,MAAM,KAAK,WAAW;QAC7B,CAAC,CAAC,MAAM;QACR,CAAC,CAAC,OAAO,MAAM,KAAK,WAAW;YAC7B,CAAC,CAAC,MAAM;YACR,CAAC,CAAE,EAAwB,CAAC;AAEpC,wFAAwF;AACxF,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACd,CAAC,CAAC,MAAM,GAAG,MAAM,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type ConnectionRequest, type Modal, type OTPCode } from '../domain';
|
|
2
|
+
import type { AbstractOTPCodeModal } from './modals/base/AbstractOTPModal';
|
|
3
|
+
import type { FactoryModals } from './modals/types';
|
|
4
|
+
/**
|
|
5
|
+
* Preload function type for loading UI dependencies
|
|
6
|
+
*/
|
|
7
|
+
export type PreloadFn = () => Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Base ModalFactory class that accepts a preload function.
|
|
10
|
+
* Platform-specific implementations should extend this class.
|
|
11
|
+
*/
|
|
12
|
+
export declare abstract class BaseModalFactory<T extends FactoryModals = FactoryModals> {
|
|
13
|
+
protected readonly options: T;
|
|
14
|
+
modal: Modal<any>;
|
|
15
|
+
private readonly platform;
|
|
16
|
+
private successCallback;
|
|
17
|
+
private displayUriCallback?;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a new modal factory instance.
|
|
20
|
+
*
|
|
21
|
+
* @param options - The modals configuration object
|
|
22
|
+
*/
|
|
23
|
+
constructor(options: T);
|
|
24
|
+
/**
|
|
25
|
+
* Platform-specific preload function to be implemented by subclasses.
|
|
26
|
+
*/
|
|
27
|
+
protected abstract preload(): Promise<void>;
|
|
28
|
+
private validateModals;
|
|
29
|
+
unload(error?: Error): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Determines if the current platform is a mobile native environment.
|
|
32
|
+
* Currently only includes React Native.
|
|
33
|
+
*/
|
|
34
|
+
get isMobile(): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Determines if the current platform is a Node.js environment.
|
|
37
|
+
* Used for server-side or non-browser environments.
|
|
38
|
+
*/
|
|
39
|
+
get isNode(): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Determines if the current platform is a web environment.
|
|
42
|
+
* Includes desktop web, MetaMask mobile webview, and mobile web.
|
|
43
|
+
*/
|
|
44
|
+
get isWeb(): boolean;
|
|
45
|
+
private getContainer;
|
|
46
|
+
private getMountedContainer;
|
|
47
|
+
createConnectionDeeplink(connectionRequest?: ConnectionRequest): string;
|
|
48
|
+
createConnectionUniversalLink(connectionRequest?: ConnectionRequest): string;
|
|
49
|
+
private onCloseModal;
|
|
50
|
+
private onStartDesktopOnboarding;
|
|
51
|
+
renderInstallModal(showInstallModal: boolean, createConnectionRequest: () => Promise<ConnectionRequest>, successCallback: (error?: Error) => Promise<void>, onDisplayUri?: (uri: string) => void): Promise<void>;
|
|
52
|
+
renderOTPCodeModal(createOTPCode: () => Promise<OTPCode>, successCallback: (error?: Error) => Promise<void>, updateOTPCode: (otpCode: OTPCode, modal: AbstractOTPCodeModal) => void): Promise<void>;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=ModalFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModalFactory.d.ts","sourceRoot":"","sources":["../../../src/ui/ModalFactory.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,KAAK,iBAAiB,EAGtB,KAAK,KAAK,EACV,KAAK,OAAO,EAEb,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,KAAK,EAAE,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C,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,EACjD,aAAa,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,oBAAoB,KAAK,IAAI;CAqBzE"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
/* eslint-disable @typescript-eslint/no-shadow */
|
|
11
|
+
/* eslint-disable @typescript-eslint/no-misused-promises */
|
|
12
|
+
/* eslint-disable no-restricted-globals */
|
|
13
|
+
/* eslint-disable jsdoc/require-returns */
|
|
14
|
+
/* eslint-disable @typescript-eslint/parameter-properties */
|
|
15
|
+
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
16
|
+
/* eslint-disable no-restricted-syntax */
|
|
17
|
+
/* eslint-disable promise/no-return-wrap */
|
|
18
|
+
/* eslint-disable require-atomic-updates */
|
|
19
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
20
|
+
import MetaMaskOnboarding from '@metamask/onboarding';
|
|
21
|
+
import { METAMASK_CONNECT_BASE_URL, METAMASK_DEEPLINK_BASE } from '../config';
|
|
22
|
+
import { getPlatformType, getVersion, PlatformType, } from '../domain';
|
|
23
|
+
import { compressString } from '../multichain/utils';
|
|
24
|
+
/**
|
|
25
|
+
* Base ModalFactory class that accepts a preload function.
|
|
26
|
+
* Platform-specific implementations should extend this class.
|
|
27
|
+
*/
|
|
28
|
+
export class BaseModalFactory {
|
|
29
|
+
/**
|
|
30
|
+
* Creates a new modal factory instance.
|
|
31
|
+
*
|
|
32
|
+
* @param options - The modals configuration object
|
|
33
|
+
*/
|
|
34
|
+
constructor(options) {
|
|
35
|
+
this.options = options;
|
|
36
|
+
this.platform = getPlatformType();
|
|
37
|
+
this.validateModals();
|
|
38
|
+
}
|
|
39
|
+
validateModals() {
|
|
40
|
+
const requiredModals = ['InstallModal', 'OTPCodeModal'];
|
|
41
|
+
const missingModals = requiredModals.filter((modal) => !this.options[modal]);
|
|
42
|
+
if (missingModals.length > 0) {
|
|
43
|
+
throw new Error(`Missing required modals: ${missingModals.join(', ')}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
unload(error) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
(_a = this.modal) === null || _a === void 0 ? void 0 : _a.unmount();
|
|
50
|
+
yield ((_b = this.successCallback) === null || _b === void 0 ? void 0 : _b.call(this, error));
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Determines if the current platform is a mobile native environment.
|
|
55
|
+
* Currently only includes React Native.
|
|
56
|
+
*/
|
|
57
|
+
get isMobile() {
|
|
58
|
+
return this.platform === PlatformType.ReactNative;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Determines if the current platform is a Node.js environment.
|
|
62
|
+
* Used for server-side or non-browser environments.
|
|
63
|
+
*/
|
|
64
|
+
get isNode() {
|
|
65
|
+
return this.platform === PlatformType.NonBrowser;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Determines if the current platform is a web environment.
|
|
69
|
+
* Includes desktop web, MetaMask mobile webview, and mobile web.
|
|
70
|
+
*/
|
|
71
|
+
get isWeb() {
|
|
72
|
+
return (this.platform === PlatformType.DesktopWeb ||
|
|
73
|
+
this.platform === PlatformType.MetaMaskMobileWebview ||
|
|
74
|
+
this.platform === PlatformType.MobileWeb);
|
|
75
|
+
}
|
|
76
|
+
getContainer() {
|
|
77
|
+
return typeof document === 'undefined'
|
|
78
|
+
? undefined
|
|
79
|
+
: document.createElement('div');
|
|
80
|
+
}
|
|
81
|
+
getMountedContainer() {
|
|
82
|
+
if (typeof document === 'undefined') {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
const container = this.getContainer();
|
|
86
|
+
if (container) {
|
|
87
|
+
document.body.appendChild(container);
|
|
88
|
+
}
|
|
89
|
+
return container;
|
|
90
|
+
}
|
|
91
|
+
createConnectionDeeplink(connectionRequest) {
|
|
92
|
+
if (!connectionRequest) {
|
|
93
|
+
throw new Error('createConnectionDeeplink can only be called with a connection request');
|
|
94
|
+
}
|
|
95
|
+
const json = JSON.stringify(connectionRequest);
|
|
96
|
+
const compressed = compressString(json);
|
|
97
|
+
const urlEncoded = encodeURIComponent(compressed);
|
|
98
|
+
return `${METAMASK_DEEPLINK_BASE}/mwp?p=${urlEncoded}&c=1`;
|
|
99
|
+
}
|
|
100
|
+
createConnectionUniversalLink(connectionRequest) {
|
|
101
|
+
if (!connectionRequest) {
|
|
102
|
+
return `${METAMASK_CONNECT_BASE_URL}`;
|
|
103
|
+
}
|
|
104
|
+
const json = JSON.stringify(connectionRequest);
|
|
105
|
+
const compressed = compressString(json);
|
|
106
|
+
const urlEncoded = encodeURIComponent(compressed);
|
|
107
|
+
return `${METAMASK_CONNECT_BASE_URL}/mwp?p=${urlEncoded}&c=1`;
|
|
108
|
+
}
|
|
109
|
+
onCloseModal() {
|
|
110
|
+
return __awaiter(this, arguments, void 0, function* (shouldTerminate = true) {
|
|
111
|
+
return this.unload(shouldTerminate ? new Error('User closed modal') : undefined);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
onStartDesktopOnboarding() {
|
|
115
|
+
new MetaMaskOnboarding().startOnboarding();
|
|
116
|
+
}
|
|
117
|
+
renderInstallModal(showInstallModal, createConnectionRequest, successCallback, onDisplayUri) {
|
|
118
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
+
var _a, _b;
|
|
120
|
+
(_a = this.modal) === null || _a === void 0 ? void 0 : _a.unmount();
|
|
121
|
+
yield this.preload();
|
|
122
|
+
this.successCallback = successCallback;
|
|
123
|
+
this.displayUriCallback = onDisplayUri;
|
|
124
|
+
const parentElement = this.getMountedContainer();
|
|
125
|
+
const connectionRequest = yield createConnectionRequest();
|
|
126
|
+
const qrCodeLink = this.createConnectionDeeplink(connectionRequest);
|
|
127
|
+
(_b = this.displayUriCallback) === null || _b === void 0 ? void 0 : _b.call(this, qrCodeLink);
|
|
128
|
+
const modal = new this.options.InstallModal({
|
|
129
|
+
expiresIn: (connectionRequest.sessionRequest.expiresAt - Date.now()) / 1000,
|
|
130
|
+
connectionRequest,
|
|
131
|
+
parentElement,
|
|
132
|
+
showInstallModal,
|
|
133
|
+
link: qrCodeLink,
|
|
134
|
+
sdkVersion: getVersion(),
|
|
135
|
+
generateQRCode: (request) => __awaiter(this, void 0, void 0, function* () {
|
|
136
|
+
var _a;
|
|
137
|
+
const newLink = this.createConnectionDeeplink(request);
|
|
138
|
+
(_a = this.displayUriCallback) === null || _a === void 0 ? void 0 : _a.call(this, newLink);
|
|
139
|
+
return newLink;
|
|
140
|
+
}),
|
|
141
|
+
onClose: this.onCloseModal.bind(this),
|
|
142
|
+
startDesktopOnboarding: this.onStartDesktopOnboarding.bind(this),
|
|
143
|
+
createConnectionRequest,
|
|
144
|
+
onDisplayUri: this.displayUriCallback,
|
|
145
|
+
});
|
|
146
|
+
this.modal = modal;
|
|
147
|
+
modal.mount();
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
renderOTPCodeModal(createOTPCode, successCallback, updateOTPCode) {
|
|
151
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
152
|
+
var _a;
|
|
153
|
+
(_a = this.modal) === null || _a === void 0 ? void 0 : _a.unmount();
|
|
154
|
+
yield this.preload();
|
|
155
|
+
this.successCallback = successCallback;
|
|
156
|
+
const container = this.getMountedContainer();
|
|
157
|
+
const otpCode = yield createOTPCode();
|
|
158
|
+
const modal = new this.options.OTPCodeModal({
|
|
159
|
+
parentElement: container,
|
|
160
|
+
sdkVersion: getVersion(),
|
|
161
|
+
otpCode,
|
|
162
|
+
onClose: this.onCloseModal.bind(this),
|
|
163
|
+
createOTPCode,
|
|
164
|
+
updateOTPCode: (otpCode) => updateOTPCode(otpCode, modal),
|
|
165
|
+
});
|
|
166
|
+
this.modal = modal;
|
|
167
|
+
modal.mount();
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=ModalFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModalFactory.js","sourceRoot":"","sources":["../../../src/ui/ModalFactory.ts"],"names":[],"mappings":";;;;;;;;;AAAA,iDAAiD;AACjD,2DAA2D;AAC3D,0CAA0C;AAC1C,0CAA0C;AAC1C,4DAA4D;AAC5D,qEAAqE;AACrE,yCAAyC;AACzC,2CAA2C;AAC3C,2CAA2C;AAC3C,yDAAyD;AACzD,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAC9E,OAAO,EAEL,eAAe,EACf,UAAU,EAGV,YAAY,GACb,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAOrD;;;GAGG;AACH,MAAM,OAAgB,gBAAgB;IASpC;;;;OAIG;IACH,YAA+B,OAAU;QAAV,YAAO,GAAP,OAAO,CAAG;QAXxB,aAAQ,GAAiB,eAAe,EAAE,CAAC;QAY1D,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IAOO,cAAc;QACpB,MAAM,cAAc,GAAG,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;QACxD,MAAM,aAAa,GAAG,cAAc,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E,OAAO,EAAE,CAAC;YACtB,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;YACrB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;YAEvC,MAAM,SAAS,GAAG,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC7C,MAAM,OAAO,GAAG,MAAM,aAAa,EAAE,CAAC;YAEtC,MAAM,KAAK,GAAyB,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;gBAChE,aAAa,EAAE,SAAS;gBACxB,UAAU,EAAE,UAAU,EAAE;gBACxB,OAAO;gBACP,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC;gBACrC,aAAa;gBACb,aAAa,EAAE,CAAC,OAAgB,EAAE,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC;aACnE,CAAC,CAAC;YAEH,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;YACnB,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,CAAC;KAAA;CACF"}
|
package/dist/src/ui/index.d.ts
CHANGED
|
@@ -1,41 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Browser/Web UI module entry point
|
|
3
|
+
*/
|
|
4
|
+
import { BaseModalFactory } from './ModalFactory';
|
|
3
5
|
import type { FactoryModals } from './modals/types';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
constructor(options: T);
|
|
15
|
-
private validateModals;
|
|
16
|
-
unload(error?: Error): Promise<void>;
|
|
17
|
-
/**
|
|
18
|
-
* Determines if the current platform is a mobile native environment.
|
|
19
|
-
* Currently only includes React Native.
|
|
20
|
-
*/
|
|
21
|
-
get isMobile(): boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Determines if the current platform is a Node.js environment.
|
|
24
|
-
* Used for server-side or non-browser environments.
|
|
25
|
-
*/
|
|
26
|
-
get isNode(): boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Determines if the current platform is a web environment.
|
|
29
|
-
* Includes desktop web, MetaMask mobile webview, and mobile web.
|
|
30
|
-
*/
|
|
31
|
-
get isWeb(): boolean;
|
|
32
|
-
private getContainer;
|
|
33
|
-
private getMountedContainer;
|
|
34
|
-
createConnectionDeeplink(connectionRequest?: ConnectionRequest): string;
|
|
35
|
-
createConnectionUniversalLink(connectionRequest?: ConnectionRequest): string;
|
|
36
|
-
private onCloseModal;
|
|
37
|
-
private onStartDesktopOnboarding;
|
|
38
|
-
renderInstallModal(showInstallModal: boolean, createConnectionRequest: () => Promise<ConnectionRequest>, successCallback: (error?: Error) => Promise<void>): Promise<void>;
|
|
39
|
-
renderOTPCodeModal(createOTPCode: () => Promise<OTPCode>, successCallback: (error?: Error) => Promise<void>, updateOTPCode: (otpCode: OTPCode, modal: AbstractOTPCodeModal) => void): Promise<void>;
|
|
6
|
+
/**
|
|
7
|
+
* Web-specific preload that loads Stencil custom elements
|
|
8
|
+
*/
|
|
9
|
+
export declare function preload(): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* ModalFactory for browser/web environments.
|
|
12
|
+
* Loads Stencil web components via dynamic import.
|
|
13
|
+
*/
|
|
14
|
+
export declare class ModalFactory<T extends FactoryModals = FactoryModals> extends BaseModalFactory<T> {
|
|
15
|
+
protected preload(): Promise<void>;
|
|
40
16
|
}
|
|
41
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD;;GAEG;AACH,wBAAsB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAY7C;AAED;;;GAGG;AACH,qBAAa,YAAY,CACvB,CAAC,SAAS,aAAa,GAAG,aAAa,CACvC,SAAQ,gBAAgB,CAAC,CAAC,CAAC;cACX,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAGzC"}
|
package/dist/src/ui/index.js
CHANGED
|
@@ -7,153 +7,35 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
20
|
-
import MetaMaskOnboarding from '@metamask/onboarding';
|
|
21
|
-
import { METAMASK_CONNECT_BASE_URL, METAMASK_DEEPLINK_BASE } from '../config';
|
|
22
|
-
import { getPlatformType, getVersion, PlatformType, } from '../domain';
|
|
23
|
-
import { compressString } from '../multichain/utils';
|
|
24
|
-
import { preload } from './preload.web';
|
|
25
|
-
export class ModalFactory {
|
|
26
|
-
/**
|
|
27
|
-
* Creates a new modal factory instance.
|
|
28
|
-
*
|
|
29
|
-
* @param options - The modals configuration object
|
|
30
|
-
*/
|
|
31
|
-
constructor(options) {
|
|
32
|
-
this.options = options;
|
|
33
|
-
this.platform = getPlatformType();
|
|
34
|
-
this.validateModals();
|
|
35
|
-
}
|
|
36
|
-
validateModals() {
|
|
37
|
-
const requiredModals = ['InstallModal', 'OTPCodeModal'];
|
|
38
|
-
const missingModals = requiredModals.filter((modal) => !this.options[modal]);
|
|
39
|
-
if (missingModals.length > 0) {
|
|
40
|
-
throw new Error(`Missing required modals: ${missingModals.join(', ')}`);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
unload(error) {
|
|
44
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
var _a, _b;
|
|
46
|
-
(_a = this.modal) === null || _a === void 0 ? void 0 : _a.unmount();
|
|
47
|
-
yield ((_b = this.successCallback) === null || _b === void 0 ? void 0 : _b.call(this, error));
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Determines if the current platform is a mobile native environment.
|
|
52
|
-
* Currently only includes React Native.
|
|
53
|
-
*/
|
|
54
|
-
get isMobile() {
|
|
55
|
-
return this.platform === PlatformType.ReactNative;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Determines if the current platform is a Node.js environment.
|
|
59
|
-
* Used for server-side or non-browser environments.
|
|
60
|
-
*/
|
|
61
|
-
get isNode() {
|
|
62
|
-
return this.platform === PlatformType.NonBrowser;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Determines if the current platform is a web environment.
|
|
66
|
-
* Includes desktop web, MetaMask mobile webview, and mobile web.
|
|
67
|
-
*/
|
|
68
|
-
get isWeb() {
|
|
69
|
-
return (this.platform === PlatformType.DesktopWeb ||
|
|
70
|
-
this.platform === PlatformType.MetaMaskMobileWebview ||
|
|
71
|
-
this.platform === PlatformType.MobileWeb);
|
|
72
|
-
}
|
|
73
|
-
getContainer() {
|
|
74
|
-
return typeof document === 'undefined'
|
|
75
|
-
? undefined
|
|
76
|
-
: document.createElement('div');
|
|
77
|
-
}
|
|
78
|
-
getMountedContainer() {
|
|
10
|
+
/**
|
|
11
|
+
* Browser/Web UI module entry point
|
|
12
|
+
*/
|
|
13
|
+
import { BaseModalFactory } from './ModalFactory';
|
|
14
|
+
/**
|
|
15
|
+
* Web-specific preload that loads Stencil custom elements
|
|
16
|
+
*/
|
|
17
|
+
export function preload() {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
19
|
if (typeof document === 'undefined') {
|
|
80
|
-
return
|
|
81
|
-
}
|
|
82
|
-
const container = this.getContainer();
|
|
83
|
-
if (container) {
|
|
84
|
-
document.body.appendChild(container);
|
|
20
|
+
return;
|
|
85
21
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (!connectionRequest) {
|
|
90
|
-
throw new Error('createConnectionDeeplink can only be called with a connection request');
|
|
22
|
+
try {
|
|
23
|
+
const { defineCustomElements } = yield import('@metamask/multichain-ui/loader');
|
|
24
|
+
yield defineCustomElements();
|
|
91
25
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const urlEncoded = encodeURIComponent(compressed);
|
|
95
|
-
return `${METAMASK_DEEPLINK_BASE}/mwp?p=${urlEncoded}&c=1`;
|
|
96
|
-
}
|
|
97
|
-
createConnectionUniversalLink(connectionRequest) {
|
|
98
|
-
if (!connectionRequest) {
|
|
99
|
-
return `${METAMASK_CONNECT_BASE_URL}`;
|
|
26
|
+
catch (error) {
|
|
27
|
+
console.error('Failed to load customElements:', error);
|
|
100
28
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
onStartDesktopOnboarding() {
|
|
112
|
-
new MetaMaskOnboarding().startOnboarding();
|
|
113
|
-
}
|
|
114
|
-
renderInstallModal(showInstallModal, createConnectionRequest, successCallback) {
|
|
115
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
-
var _a;
|
|
117
|
-
(_a = this.modal) === null || _a === void 0 ? void 0 : _a.unmount();
|
|
118
|
-
yield preload();
|
|
119
|
-
this.successCallback = successCallback;
|
|
120
|
-
const parentElement = this.getMountedContainer();
|
|
121
|
-
const connectionRequest = yield createConnectionRequest();
|
|
122
|
-
const qrCodeLink = this.createConnectionDeeplink(connectionRequest);
|
|
123
|
-
const modal = new this.options.InstallModal({
|
|
124
|
-
expiresIn: (connectionRequest.sessionRequest.expiresAt - Date.now()) / 1000,
|
|
125
|
-
connectionRequest,
|
|
126
|
-
parentElement,
|
|
127
|
-
showInstallModal,
|
|
128
|
-
link: qrCodeLink,
|
|
129
|
-
sdkVersion: getVersion(),
|
|
130
|
-
generateQRCode: (request) => __awaiter(this, void 0, void 0, function* () { return this.createConnectionDeeplink(request); }),
|
|
131
|
-
onClose: this.onCloseModal.bind(this),
|
|
132
|
-
startDesktopOnboarding: this.onStartDesktopOnboarding.bind(this),
|
|
133
|
-
createConnectionRequest,
|
|
134
|
-
});
|
|
135
|
-
this.modal = modal;
|
|
136
|
-
modal.mount();
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
renderOTPCodeModal(createOTPCode, successCallback, updateOTPCode) {
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* ModalFactory for browser/web environments.
|
|
33
|
+
* Loads Stencil web components via dynamic import.
|
|
34
|
+
*/
|
|
35
|
+
export class ModalFactory extends BaseModalFactory {
|
|
36
|
+
preload() {
|
|
140
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
141
|
-
|
|
142
|
-
(_a = this.modal) === null || _a === void 0 ? void 0 : _a.unmount();
|
|
143
|
-
yield preload();
|
|
144
|
-
this.successCallback = successCallback;
|
|
145
|
-
const container = this.getMountedContainer();
|
|
146
|
-
const otpCode = yield createOTPCode();
|
|
147
|
-
const modal = new this.options.OTPCodeModal({
|
|
148
|
-
parentElement: container,
|
|
149
|
-
sdkVersion: getVersion(),
|
|
150
|
-
otpCode,
|
|
151
|
-
onClose: this.onCloseModal.bind(this),
|
|
152
|
-
createOTPCode,
|
|
153
|
-
updateOTPCode: (otpCode) => updateOTPCode(otpCode, modal),
|
|
154
|
-
});
|
|
155
|
-
this.modal = modal;
|
|
156
|
-
modal.mount();
|
|
38
|
+
return preload();
|
|
157
39
|
});
|
|
158
40
|
}
|
|
159
41
|
}
|
package/dist/src/ui/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGlD;;GAEG;AACH,MAAM,UAAgB,OAAO;;QAC3B,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;YACpC,OAAO;QACT,CAAC;QACD,IAAI,CAAC;YACH,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,MAAM,CAC3C,gCAAgC,CACjC,CAAC;YACF,MAAM,oBAAoB,EAAE,CAAC;QAC/B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;CAAA;AAED;;;GAGG;AACH,MAAM,OAAO,YAEX,SAAQ,gBAAmB;IACX,OAAO;;YACrB,OAAO,OAAO,EAAE,CAAC;QACnB,CAAC;KAAA;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Native UI module entry point
|
|
3
|
+
*/
|
|
4
|
+
import { BaseModalFactory } from './ModalFactory';
|
|
5
|
+
import type { FactoryModals } from './modals/types';
|
|
6
|
+
/**
|
|
7
|
+
* ModalFactory for React Native environments.
|
|
8
|
+
* No-op preload since Stencil web components are not used.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ModalFactory<T extends FactoryModals = FactoryModals> extends BaseModalFactory<T> {
|
|
11
|
+
protected preload(): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=index.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/ui/index.native.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD;;;GAGG;AACH,qBAAa,YAAY,CACvB,CAAC,SAAS,aAAa,GAAG,aAAa,CACvC,SAAQ,gBAAgB,CAAC,CAAC,CAAC;cAEX,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CACzC"}
|
|
@@ -8,11 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
|
-
* React Native
|
|
11
|
+
* React Native UI module entry point
|
|
12
12
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
import { BaseModalFactory } from './ModalFactory';
|
|
14
|
+
/**
|
|
15
|
+
* ModalFactory for React Native environments.
|
|
16
|
+
* No-op preload since Stencil web components are not used.
|
|
17
|
+
*/
|
|
18
|
+
export class ModalFactory extends BaseModalFactory {
|
|
19
|
+
// No-op for React Native - web components are not applicable
|
|
20
|
+
preload() {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
22
|
+
}
|
|
17
23
|
}
|
|
18
|
-
//# sourceMappingURL=
|
|
24
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.native.js","sourceRoot":"","sources":["../../../src/ui/index.native.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGlD;;;GAGG;AACH,MAAM,OAAO,YAEX,SAAQ,gBAAmB;IAC3B,6DAA6D;IAC7C,OAAO;8DAAmB,CAAC;KAAA;CAC5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractInstallModal.d.ts","sourceRoot":"","sources":["../../../../../src/ui/modals/base/AbstractInstallModal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EAEtB,KAAK,kBAAkB,EACvB,KAAK,EACL,KAAK,MAAM,EACZ,MAAM,iBAAiB,CAAC;AAKzB,8BAAsB,oBAAqB,SAAQ,KAAK,CACtD,kBAAkB,EAClB,MAAM,CACP;IACC,SAAS,CAAC,QAAQ,CAAC,EAAE,yBAAyB,GAAG,SAAS,CAAC;IAC3D,OAAO,CAAC,kBAAkB,CAA+B;IACzD,OAAO,CAAC,mBAAmB,CAAc;IAEzC,QAAQ,CAAC,YAAY,CACnB,IAAI,EAAE,MAAM,EACZ,iBAAiB,EAAE,iBAAiB,GACnC,IAAI;IAEP,IAAI,IAAI,IAIO,MAAM,CAFpB;IAED,IAAI,IAAI,CAAC,IAAI,EAAE,MAAM,EAEpB;IAED,IAAI,iBAAiB,IAIoB,iBAAiB,CAFzD;IAED,IAAI,iBAAiB,CAAC,iBAAiB,EAAE,iBAAiB,EAEzD;IAED,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM;IAOjC,SAAS,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM;IAM3C,SAAS,CAAC,oBAAoB,CAAC,iBAAiB,EAAE,iBAAiB;
|
|
1
|
+
{"version":3,"file":"AbstractInstallModal.d.ts","sourceRoot":"","sources":["../../../../../src/ui/modals/base/AbstractInstallModal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EAEtB,KAAK,kBAAkB,EACvB,KAAK,EACL,KAAK,MAAM,EACZ,MAAM,iBAAiB,CAAC;AAKzB,8BAAsB,oBAAqB,SAAQ,KAAK,CACtD,kBAAkB,EAClB,MAAM,CACP;IACC,SAAS,CAAC,QAAQ,CAAC,EAAE,yBAAyB,GAAG,SAAS,CAAC;IAC3D,OAAO,CAAC,kBAAkB,CAA+B;IACzD,OAAO,CAAC,mBAAmB,CAAc;IAEzC,QAAQ,CAAC,YAAY,CACnB,IAAI,EAAE,MAAM,EACZ,iBAAiB,EAAE,iBAAiB,GACnC,IAAI;IAEP,IAAI,IAAI,IAIO,MAAM,CAFpB;IAED,IAAI,IAAI,CAAC,IAAI,EAAE,MAAM,EAEpB;IAED,IAAI,iBAAiB,IAIoB,iBAAiB,CAFzD;IAED,IAAI,iBAAiB,CAAC,iBAAiB,EAAE,iBAAiB,EAEzD;IAED,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM;IAOjC,SAAS,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM;IAM3C,SAAS,CAAC,oBAAoB,CAAC,iBAAiB,EAAE,iBAAiB;IAqDnE,SAAS,CAAC,mBAAmB;CAS9B"}
|
|
@@ -73,10 +73,6 @@ export class AbstractInstallModal extends Modal {
|
|
|
73
73
|
logger(`[UI: InstallModal-nodejs()] ❌ Error generating new QR code: ${error}`);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
else {
|
|
77
|
-
const generateQRCode = yield this.options.generateQRCode(currentConnectionRequest);
|
|
78
|
-
this.renderQRCode(generateQRCode, currentConnectionRequest);
|
|
79
|
-
}
|
|
80
76
|
}), 1000);
|
|
81
77
|
}
|
|
82
78
|
stopExpirationCheck() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractInstallModal.js","sourceRoot":"","sources":["../../../../../src/ui/modals/base/AbstractInstallModal.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAEL,YAAY,EAEZ,KAAK,GAEN,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElE,MAAM,MAAM,GAAG,YAAY,CAAC,iBAAiB,CAAC,CAAC;AAE/C,MAAM,OAAgB,oBAAqB,SAAQ,KAGlD;IAHD;;QAKU,uBAAkB,GAA0B,IAAI,CAAC;QACjD,wBAAmB,GAAW,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"AbstractInstallModal.js","sourceRoot":"","sources":["../../../../../src/ui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