@titan-os/sdk 1.10.1 → 1.10.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/dist/cjs/sdk.js +1 -1
- package/dist/esm/sdk.js +17 -5
- package/dist/umd/sdk.js +1 -1
- package/package.json +1 -1
package/dist/esm/sdk.js
CHANGED
|
@@ -416,7 +416,8 @@ const createGuid = () => {
|
|
|
416
416
|
const DEFAULT_DOM_READY_TIMEOUT_MS = 1e4;
|
|
417
417
|
const DOM_READY_TIMEOUT_SECONDS = DEFAULT_DOM_READY_TIMEOUT_MS / 1e3;
|
|
418
418
|
const MESSAGE_TIMEOUT_MS = 1e4;
|
|
419
|
-
const IFRAME_TIMEOUT_MS =
|
|
419
|
+
const IFRAME_TIMEOUT_MS = 1e4;
|
|
420
|
+
const CSP_WAIT_TIMEOUT_MS = 5e3;
|
|
420
421
|
const MUTATION_OBSERVER_TIMEOUT_MS = 3e4;
|
|
421
422
|
const POLLING_INTERVAL_MS = 50;
|
|
422
423
|
const DOM_READY_WARNING_INTERVALS = [
|
|
@@ -640,7 +641,7 @@ const matchBrandFromUserAgent = (userAgent, regex) => {
|
|
|
640
641
|
const match = userAgent.match(regex);
|
|
641
642
|
return match ? match[1] : null;
|
|
642
643
|
};
|
|
643
|
-
const VERSION = "1.10.
|
|
644
|
+
const VERSION = "1.10.2";
|
|
644
645
|
var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
|
|
645
646
|
ErrorCode2["NOT_INITIALIZED"] = "NOT_INITIALIZED";
|
|
646
647
|
ErrorCode2["NOT_SUPPORTED"] = "NOT_SUPPORTED";
|
|
@@ -4140,6 +4141,7 @@ class BaseBridge {
|
|
|
4140
4141
|
}
|
|
4141
4142
|
if (data && (data.type === "BRIDGE_READY" || data.type === "LAUNCHER_READY") && this.iframe?.contentWindow === event.source) {
|
|
4142
4143
|
this.connected = true;
|
|
4144
|
+
this.isInitialized = true;
|
|
4143
4145
|
return;
|
|
4144
4146
|
}
|
|
4145
4147
|
if (data && data.type && Object.values(NOTIFICATION_MESSAGE_TYPES).includes(
|
|
@@ -4278,6 +4280,7 @@ class BaseBridge {
|
|
|
4278
4280
|
const readyTimeout = setTimeout(() => {
|
|
4279
4281
|
if (this.aborted) return;
|
|
4280
4282
|
log$n.warn("Bridge iframe ready timeout - continuing anyway");
|
|
4283
|
+
window.removeEventListener("message", transferData);
|
|
4281
4284
|
resolve();
|
|
4282
4285
|
}, this.iframeTimeout);
|
|
4283
4286
|
const checkReady = (event) => {
|
|
@@ -4285,8 +4288,10 @@ class BaseBridge {
|
|
|
4285
4288
|
if (event.data && event.data.type === MESSAGE_TYPES.LAUNCHER_READY && this.iframe?.contentWindow === event.source) {
|
|
4286
4289
|
log$n.debug("bridge iframe ready:", event.data);
|
|
4287
4290
|
window.removeEventListener("message", checkReady);
|
|
4291
|
+
window.removeEventListener("message", transferData);
|
|
4288
4292
|
clearTimeout(readyTimeout);
|
|
4289
4293
|
this.connected = true;
|
|
4294
|
+
this.isInitialized = true;
|
|
4290
4295
|
if (onLoad) {
|
|
4291
4296
|
onLoad();
|
|
4292
4297
|
}
|
|
@@ -4579,10 +4584,17 @@ class EnhancedBaseBridge extends BaseBridge {
|
|
|
4579
4584
|
log$m.debug(
|
|
4580
4585
|
"Iframe created but connection not established, waiting for CSP violation detection..."
|
|
4581
4586
|
);
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
"CSP violation detection completed (or connection established)"
|
|
4587
|
+
const cspTimeout = new Promise(
|
|
4588
|
+
(resolve) => setTimeout(resolve, CSP_WAIT_TIMEOUT_MS)
|
|
4585
4589
|
);
|
|
4590
|
+
await Promise.race([this.cspViolationPromise, cspTimeout]);
|
|
4591
|
+
if (this.cspViolationDetected) {
|
|
4592
|
+
log$m.debug("CSP violation detected during wait");
|
|
4593
|
+
} else {
|
|
4594
|
+
log$m.warn(
|
|
4595
|
+
"CSP violation wait timed out - no CSP violation detected, connection may have been slow"
|
|
4596
|
+
);
|
|
4597
|
+
}
|
|
4586
4598
|
}
|
|
4587
4599
|
}
|
|
4588
4600
|
}
|