@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/identity/index.d.ts
CHANGED
|
@@ -75,6 +75,16 @@ export declare class IdentityModule {
|
|
|
75
75
|
* Close the identity dialog/inline UI if open.
|
|
76
76
|
*/
|
|
77
77
|
close(): void;
|
|
78
|
+
/**
|
|
79
|
+
* Whether the preloaded config has already settled as a *permanent* failure
|
|
80
|
+
* the hosted widget can't surface (origin not allowed, or product not
|
|
81
|
+
* configured). Used to skip the iframe and show the error dialog in-page
|
|
82
|
+
* immediately. Returns false — proceed to embed — when config is not
|
|
83
|
+
* preloaded, still in flight (raced against a short timeout so the common
|
|
84
|
+
* path is never delayed), resolved, or failed only transiently (so one-tap
|
|
85
|
+
* passkey login via the frame is preserved).
|
|
86
|
+
*/
|
|
87
|
+
private preloadedConfigPermanentlyFailed;
|
|
78
88
|
/**
|
|
79
89
|
* Resolve target to an HTMLElement.
|
|
80
90
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -294,6 +294,16 @@ declare class IdentityModule {
|
|
|
294
294
|
* Close the identity dialog/inline UI if open.
|
|
295
295
|
*/
|
|
296
296
|
close(): void;
|
|
297
|
+
/**
|
|
298
|
+
* Whether the preloaded config has already settled as a *permanent* failure
|
|
299
|
+
* the hosted widget can't surface (origin not allowed, or product not
|
|
300
|
+
* configured). Used to skip the iframe and show the error dialog in-page
|
|
301
|
+
* immediately. Returns false — proceed to embed — when config is not
|
|
302
|
+
* preloaded, still in flight (raced against a short timeout so the common
|
|
303
|
+
* path is never delayed), resolved, or failed only transiently (so one-tap
|
|
304
|
+
* passkey login via the frame is preserved).
|
|
305
|
+
*/
|
|
306
|
+
private preloadedConfigPermanentlyFailed;
|
|
297
307
|
/**
|
|
298
308
|
* Resolve target to an HTMLElement.
|
|
299
309
|
*/
|
package/dist/sparkvault.cjs.js
CHANGED
|
@@ -7473,6 +7473,16 @@ class IdentityModule {
|
|
|
7473
7473
|
});
|
|
7474
7474
|
};
|
|
7475
7475
|
if (!useLocal) {
|
|
7476
|
+
// When the preloaded config has already failed *permanently* — this origin
|
|
7477
|
+
// is not a verified domain, or the account hasn't configured Identity —
|
|
7478
|
+
// the hosted widget cannot help: it never frames an unverified origin, so
|
|
7479
|
+
// embedding it would only hang until the readiness timeout. Render the
|
|
7480
|
+
// error dialog in-page right away instead. Transient failures fall through
|
|
7481
|
+
// to the iframe so one-tap passkey login is preserved.
|
|
7482
|
+
if (await this.preloadedConfigPermanentlyFailed()) {
|
|
7483
|
+
startLocalRender(new ModalContainer());
|
|
7484
|
+
return settledPromise;
|
|
7485
|
+
}
|
|
7476
7486
|
this.embedder = new WidgetEmbedder(this.config, mergedOptions, {
|
|
7477
7487
|
...hostCallbacks,
|
|
7478
7488
|
onFrameUnavailable: () => {
|
|
@@ -7656,6 +7666,33 @@ class IdentityModule {
|
|
|
7656
7666
|
this.renderer = null;
|
|
7657
7667
|
}
|
|
7658
7668
|
}
|
|
7669
|
+
/**
|
|
7670
|
+
* Whether the preloaded config has already settled as a *permanent* failure
|
|
7671
|
+
* the hosted widget can't surface (origin not allowed, or product not
|
|
7672
|
+
* configured). Used to skip the iframe and show the error dialog in-page
|
|
7673
|
+
* immediately. Returns false — proceed to embed — when config is not
|
|
7674
|
+
* preloaded, still in flight (raced against a short timeout so the common
|
|
7675
|
+
* path is never delayed), resolved, or failed only transiently (so one-tap
|
|
7676
|
+
* passkey login via the frame is preserved).
|
|
7677
|
+
*/
|
|
7678
|
+
async preloadedConfigPermanentlyFailed() {
|
|
7679
|
+
if (!this.api.isConfigPreloaded())
|
|
7680
|
+
return false;
|
|
7681
|
+
const PENDING = Symbol('pending');
|
|
7682
|
+
try {
|
|
7683
|
+
await Promise.race([
|
|
7684
|
+
this.api.getConfig(),
|
|
7685
|
+
new Promise((resolve) => setTimeout(() => resolve(PENDING), 50)),
|
|
7686
|
+
]);
|
|
7687
|
+
// Resolved with config, or still pending after the timeout — either way,
|
|
7688
|
+
// don't block the iframe path.
|
|
7689
|
+
return false;
|
|
7690
|
+
}
|
|
7691
|
+
catch (error) {
|
|
7692
|
+
return (error instanceof IdentityApiError &&
|
|
7693
|
+
(error.code === 'ORIGIN_NOT_ALLOWED' || error.code === 'product_not_configured'));
|
|
7694
|
+
}
|
|
7695
|
+
}
|
|
7659
7696
|
/**
|
|
7660
7697
|
* Resolve target to an HTMLElement.
|
|
7661
7698
|
*/
|