@dynamic-labs-wallet/browser-wallet-client 0.0.0-beta.271.1 → 0.0.0-beta.271.2
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/index.cjs.js
CHANGED
|
@@ -226,7 +226,12 @@ class IframeManager {
|
|
|
226
226
|
const context = _extends({}, this.getIframeContext(), {
|
|
227
227
|
attempt: IframeManager.iframeLoadAttempts
|
|
228
228
|
});
|
|
229
|
-
|
|
229
|
+
// Set up timeout that will trigger iframe error, a retry will be triggered on this iframe error
|
|
230
|
+
const iframeTimeoutId = setTimeout(()=>{
|
|
231
|
+
if (iframe.onerror) {
|
|
232
|
+
iframe.onerror('Iframe load timeout');
|
|
233
|
+
}
|
|
234
|
+
}, IframeManager.iframeLoadTimeout);
|
|
230
235
|
messageListener = this.createMessageListener(iframe, iframeTimeoutId, resolve);
|
|
231
236
|
window.addEventListener('message', messageListener);
|
|
232
237
|
this.configureIframe(iframe);
|
|
@@ -269,30 +274,6 @@ class IframeManager {
|
|
|
269
274
|
}
|
|
270
275
|
};
|
|
271
276
|
}
|
|
272
|
-
setupIframeTimeoutWithRetry(messageListener, reject, iframe, attemptLoad, context) {
|
|
273
|
-
return setTimeout(()=>{
|
|
274
|
-
if (messageListener) {
|
|
275
|
-
window.removeEventListener('message', messageListener);
|
|
276
|
-
}
|
|
277
|
-
// Check if we should retry
|
|
278
|
-
if (IframeManager.iframeLoadAttempts <= IframeManager.maxRetryAttempts) {
|
|
279
|
-
this.logger.warn(`(loadIframe) Iframe load timeout on attempt ${IframeManager.iframeLoadAttempts}, retrying... Context: ${JSON.stringify(context)}`);
|
|
280
|
-
// Clean up current attempt
|
|
281
|
-
if (iframe.parentNode) {
|
|
282
|
-
iframe.parentNode.removeChild(iframe);
|
|
283
|
-
}
|
|
284
|
-
// retry if timeout
|
|
285
|
-
this.resetSharedIframe().then(()=>{
|
|
286
|
-
attemptLoad();
|
|
287
|
-
});
|
|
288
|
-
} else {
|
|
289
|
-
// Max retries reached, give up
|
|
290
|
-
this.resetSharedIframe();
|
|
291
|
-
this.logger.error(`(loadIframe) Iframe load timeout after ${IframeManager.maxRetryAttempts + 1} attempts, giving up. Context: ${JSON.stringify(context)}`);
|
|
292
|
-
reject(new Error(`(loadIframe) Iframe load timeout after ${IframeManager.maxRetryAttempts + 1} attempts, this could be network issues, incorrect iframe domain, or CORS errors that prevents iframe from being loaded or sending handshake message, context: ${JSON.stringify(context)}`));
|
|
293
|
-
}
|
|
294
|
-
}, IframeManager.iframeLoadTimeout);
|
|
295
|
-
}
|
|
296
277
|
getIframeContext() {
|
|
297
278
|
var _this_sdkVersion;
|
|
298
279
|
return {
|
package/index.esm.js
CHANGED
|
@@ -225,7 +225,12 @@ class IframeManager {
|
|
|
225
225
|
const context = _extends({}, this.getIframeContext(), {
|
|
226
226
|
attempt: IframeManager.iframeLoadAttempts
|
|
227
227
|
});
|
|
228
|
-
|
|
228
|
+
// Set up timeout that will trigger iframe error, a retry will be triggered on this iframe error
|
|
229
|
+
const iframeTimeoutId = setTimeout(()=>{
|
|
230
|
+
if (iframe.onerror) {
|
|
231
|
+
iframe.onerror('Iframe load timeout');
|
|
232
|
+
}
|
|
233
|
+
}, IframeManager.iframeLoadTimeout);
|
|
229
234
|
messageListener = this.createMessageListener(iframe, iframeTimeoutId, resolve);
|
|
230
235
|
window.addEventListener('message', messageListener);
|
|
231
236
|
this.configureIframe(iframe);
|
|
@@ -268,30 +273,6 @@ class IframeManager {
|
|
|
268
273
|
}
|
|
269
274
|
};
|
|
270
275
|
}
|
|
271
|
-
setupIframeTimeoutWithRetry(messageListener, reject, iframe, attemptLoad, context) {
|
|
272
|
-
return setTimeout(()=>{
|
|
273
|
-
if (messageListener) {
|
|
274
|
-
window.removeEventListener('message', messageListener);
|
|
275
|
-
}
|
|
276
|
-
// Check if we should retry
|
|
277
|
-
if (IframeManager.iframeLoadAttempts <= IframeManager.maxRetryAttempts) {
|
|
278
|
-
this.logger.warn(`(loadIframe) Iframe load timeout on attempt ${IframeManager.iframeLoadAttempts}, retrying... Context: ${JSON.stringify(context)}`);
|
|
279
|
-
// Clean up current attempt
|
|
280
|
-
if (iframe.parentNode) {
|
|
281
|
-
iframe.parentNode.removeChild(iframe);
|
|
282
|
-
}
|
|
283
|
-
// retry if timeout
|
|
284
|
-
this.resetSharedIframe().then(()=>{
|
|
285
|
-
attemptLoad();
|
|
286
|
-
});
|
|
287
|
-
} else {
|
|
288
|
-
// Max retries reached, give up
|
|
289
|
-
this.resetSharedIframe();
|
|
290
|
-
this.logger.error(`(loadIframe) Iframe load timeout after ${IframeManager.maxRetryAttempts + 1} attempts, giving up. Context: ${JSON.stringify(context)}`);
|
|
291
|
-
reject(new Error(`(loadIframe) Iframe load timeout after ${IframeManager.maxRetryAttempts + 1} attempts, this could be network issues, incorrect iframe domain, or CORS errors that prevents iframe from being loaded or sending handshake message, context: ${JSON.stringify(context)}`));
|
|
292
|
-
}
|
|
293
|
-
}, IframeManager.iframeLoadTimeout);
|
|
294
|
-
}
|
|
295
276
|
getIframeContext() {
|
|
296
277
|
var _this_sdkVersion;
|
|
297
278
|
return {
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/browser-wallet-client",
|
|
3
|
-
"version": "0.0.0-beta.271.
|
|
3
|
+
"version": "0.0.0-beta.271.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@dynamic-labs-wallet/core": "0.0.0-beta.271.
|
|
7
|
+
"@dynamic-labs-wallet/core": "0.0.0-beta.271.2",
|
|
8
8
|
"@dynamic-labs/logger": "^4.9.9",
|
|
9
9
|
"@dynamic-labs/message-transport": "^4.9.9",
|
|
10
10
|
"uuid": "11.1.0"
|
|
@@ -56,7 +56,6 @@ export declare class IframeManager {
|
|
|
56
56
|
private assignExistingIframe;
|
|
57
57
|
private createIframeLoadPromise;
|
|
58
58
|
private setupIframeEventHandlersWithRetry;
|
|
59
|
-
private setupIframeTimeoutWithRetry;
|
|
60
59
|
private getIframeContext;
|
|
61
60
|
private createMessageListener;
|
|
62
61
|
private configureIframe;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IframeManager.d.ts","sourceRoot":"","sources":["../../../src/client/iframeManager/IframeManager.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,iCAAiC,EACvC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAI3E,qBAAa,aAAa;IACxB,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC;IAC5B,SAAS,CAAC,MAAM,wCAAU;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAQ;IACjC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAQ;IACnC,aAAa,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,MAAM,CAAC;IAClC,SAAS,CAAC,gBAAgB,EAAE,iCAAiC,GAAG,IAAI,CAAQ;IAC5E,SAAS,CAAC,oBAAoB,EAAE,oBAAoB,GAAG,IAAI,CAAQ;IACnE,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAA8B;IAC9D,SAAS,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAQ;IAClD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAU;IAChC,OAAc,iBAAiB,SAAS;IACxC,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAK;IACtC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAK;IAE7C,OAAO,CAAC,MAAM,CAAC,YAAY,CAAkC;IAC7D,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAK;IAChC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;gBAE1B,EACV,aAAa,EAC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