@sparkvault/sdk-js 2.1.3 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/identity/index.d.ts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/sparkvault.cjs.js +37 -0
- package/dist/sparkvault.cjs.js.map +1 -1
- package/dist/sparkvault.esm.js +37 -0
- package/dist/sparkvault.esm.js.map +1 -1
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/package.json +1 -1
package/dist/sparkvault.esm.js
CHANGED
|
@@ -7469,6 +7469,16 @@ class IdentityModule {
|
|
|
7469
7469
|
});
|
|
7470
7470
|
};
|
|
7471
7471
|
if (!useLocal) {
|
|
7472
|
+
// When the preloaded config has already failed *permanently* — this origin
|
|
7473
|
+
// is not a verified domain, or the account hasn't configured Identity —
|
|
7474
|
+
// the hosted widget cannot help: it never frames an unverified origin, so
|
|
7475
|
+
// embedding it would only hang until the readiness timeout. Render the
|
|
7476
|
+
// error dialog in-page right away instead. Transient failures fall through
|
|
7477
|
+
// to the iframe so one-tap passkey login is preserved.
|
|
7478
|
+
if (await this.preloadedConfigPermanentlyFailed()) {
|
|
7479
|
+
startLocalRender(new ModalContainer());
|
|
7480
|
+
return settledPromise;
|
|
7481
|
+
}
|
|
7472
7482
|
this.embedder = new WidgetEmbedder(this.config, mergedOptions, {
|
|
7473
7483
|
...hostCallbacks,
|
|
7474
7484
|
onFrameUnavailable: () => {
|
|
@@ -7652,6 +7662,33 @@ class IdentityModule {
|
|
|
7652
7662
|
this.renderer = null;
|
|
7653
7663
|
}
|
|
7654
7664
|
}
|
|
7665
|
+
/**
|
|
7666
|
+
* Whether the preloaded config has already settled as a *permanent* failure
|
|
7667
|
+
* the hosted widget can't surface (origin not allowed, or product not
|
|
7668
|
+
* configured). Used to skip the iframe and show the error dialog in-page
|
|
7669
|
+
* immediately. Returns false — proceed to embed — when config is not
|
|
7670
|
+
* preloaded, still in flight (raced against a short timeout so the common
|
|
7671
|
+
* path is never delayed), resolved, or failed only transiently (so one-tap
|
|
7672
|
+
* passkey login via the frame is preserved).
|
|
7673
|
+
*/
|
|
7674
|
+
async preloadedConfigPermanentlyFailed() {
|
|
7675
|
+
if (!this.api.isConfigPreloaded())
|
|
7676
|
+
return false;
|
|
7677
|
+
const PENDING = Symbol('pending');
|
|
7678
|
+
try {
|
|
7679
|
+
await Promise.race([
|
|
7680
|
+
this.api.getConfig(),
|
|
7681
|
+
new Promise((resolve) => setTimeout(() => resolve(PENDING), 50)),
|
|
7682
|
+
]);
|
|
7683
|
+
// Resolved with config, or still pending after the timeout — either way,
|
|
7684
|
+
// don't block the iframe path.
|
|
7685
|
+
return false;
|
|
7686
|
+
}
|
|
7687
|
+
catch (error) {
|
|
7688
|
+
return (error instanceof IdentityApiError &&
|
|
7689
|
+
(error.code === 'ORIGIN_NOT_ALLOWED' || error.code === 'product_not_configured'));
|
|
7690
|
+
}
|
|
7691
|
+
}
|
|
7655
7692
|
/**
|
|
7656
7693
|
* Resolve target to an HTMLElement.
|
|
7657
7694
|
*/
|