@sparkvault/sdk-js 16.2.0 → 16.2.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/dist/index.cjs +37 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +11 -6
- package/dist/index.mjs +37 -23
- package/dist/index.mjs.map +1 -1
- package/dist/products/identity/dialog-launcher.d.ts +4 -1
- package/dist/products/identity/index.d.ts +11 -6
- package/dist/products/identity/pending-signin.d.ts +3 -1
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -11612,7 +11612,7 @@ class PendingSignIn {
|
|
|
11612
11612
|
constructor(hint) {
|
|
11613
11613
|
this.hint = hint;
|
|
11614
11614
|
this.at = 0;
|
|
11615
|
-
this.
|
|
11615
|
+
this.ended = false;
|
|
11616
11616
|
// Counts the opens and the ends of their popups, so a draw that lands after
|
|
11617
11617
|
// its popup ended or was replaced is recognised and dropped.
|
|
11618
11618
|
this.opens = 0;
|
|
@@ -11628,6 +11628,10 @@ class PendingSignIn {
|
|
|
11628
11628
|
get reference() {
|
|
11629
11629
|
return this.current;
|
|
11630
11630
|
}
|
|
11631
|
+
/** False once the sign-in ended: it settled, was closed, or another replaced it. */
|
|
11632
|
+
get live() {
|
|
11633
|
+
return !this.ended;
|
|
11634
|
+
}
|
|
11631
11635
|
/**
|
|
11632
11636
|
* A popup opened, or the current one asked again for the reference it
|
|
11633
11637
|
* lacks: arm the marker holding no reference, and draw this open's own.
|
|
@@ -11637,7 +11641,7 @@ class PendingSignIn {
|
|
|
11637
11641
|
* rejects.
|
|
11638
11642
|
*/
|
|
11639
11643
|
open(draw) {
|
|
11640
|
-
if (
|
|
11644
|
+
if (this.ended)
|
|
11641
11645
|
return Promise.resolve(false);
|
|
11642
11646
|
const open = ++this.opens;
|
|
11643
11647
|
this.at = Date.now();
|
|
@@ -11646,7 +11650,7 @@ class PendingSignIn {
|
|
|
11646
11650
|
if (!this.write(null))
|
|
11647
11651
|
removePendingMarker();
|
|
11648
11652
|
const decided = signinReferenceInTime(draw()).then((reference) => {
|
|
11649
|
-
if (
|
|
11653
|
+
if (this.ended || open !== this.opens)
|
|
11650
11654
|
return false;
|
|
11651
11655
|
this.current = reference !== null && this.write(reference) ? reference : null;
|
|
11652
11656
|
return true;
|
|
@@ -11661,7 +11665,7 @@ class PendingSignIn {
|
|
|
11661
11665
|
* should it land, is dropped.
|
|
11662
11666
|
*/
|
|
11663
11667
|
retire() {
|
|
11664
|
-
if (
|
|
11668
|
+
if (this.ended)
|
|
11665
11669
|
return;
|
|
11666
11670
|
this.opens += 1;
|
|
11667
11671
|
this.current = null;
|
|
@@ -11670,7 +11674,7 @@ class PendingSignIn {
|
|
|
11670
11674
|
/** The sign-in settled, or another replaced it: retire the marker, and nothing this sign-in does later touches it. */
|
|
11671
11675
|
end() {
|
|
11672
11676
|
this.retire();
|
|
11673
|
-
this.
|
|
11677
|
+
this.ended = true;
|
|
11674
11678
|
}
|
|
11675
11679
|
/**
|
|
11676
11680
|
* The current popup's reference, waiting at most `waitMs` for an open still
|
|
@@ -12065,7 +12069,7 @@ class IdentityModule {
|
|
|
12065
12069
|
const signinRef = await pending.referenceWithin(SIGNIN_REFERENCE.redirectWaitMs);
|
|
12066
12070
|
if (signinRef === null)
|
|
12067
12071
|
pending.retire();
|
|
12068
|
-
return this.startRedirectFlow(mergedOptions, signinRef);
|
|
12072
|
+
return this.startRedirectFlow(mergedOptions, { signIn: pending, signinRef });
|
|
12069
12073
|
},
|
|
12070
12074
|
signinReference: () => pending.reference,
|
|
12071
12075
|
});
|
|
@@ -12323,31 +12327,41 @@ class IdentityModule {
|
|
|
12323
12327
|
* 'redirect'`, or a popup whose handle COOP severed. Plain sign-in carries
|
|
12324
12328
|
* redirect_uri + state + PKCE challenge and returns via the fragment code;
|
|
12325
12329
|
* OIDC/simple modes navigate without them (their server-rendered pages drive
|
|
12326
|
-
* the server-validated redirect back). Either carries
|
|
12327
|
-
*
|
|
12330
|
+
* the server-validated redirect back). Either carries the severed popup's
|
|
12331
|
+
* reference; a redirect draws none of its own.
|
|
12332
|
+
*
|
|
12333
|
+
* The return leg is armed first: the check that the sign-in still runs and
|
|
12334
|
+
* the pending marker's removal then share one turn with the navigation, so
|
|
12335
|
+
* no sign-in can start or end between them.
|
|
12328
12336
|
*
|
|
12329
|
-
* @param
|
|
12330
|
-
*
|
|
12337
|
+
* @param severed - The popup sign-in whose severed popup this continues,
|
|
12338
|
+
* with the reference its marker holds for that popup (null for none), or
|
|
12339
|
+
* null for an explicit redirect, which carries none
|
|
12331
12340
|
* @returns false when the return leg cannot be armed (no session storage or
|
|
12332
|
-
* WebCrypto)
|
|
12333
|
-
* silent dead-end.
|
|
12341
|
+
* WebCrypto), so the caller surfaces an actionable error instead of a
|
|
12342
|
+
* silent dead-end, or when the severed popup's sign-in ended meanwhile.
|
|
12334
12343
|
*/
|
|
12335
|
-
async startRedirectFlow(options,
|
|
12344
|
+
async startRedirectFlow(options, severed) {
|
|
12345
|
+
const signinRef = severed?.signinRef ?? null;
|
|
12346
|
+
const authContext = options.authContext;
|
|
12347
|
+
const handoff = authContext?.authRequestId || authContext?.simpleMode?.sessionId
|
|
12348
|
+
? undefined
|
|
12349
|
+
: await this.armHandoffReturn();
|
|
12350
|
+
if (handoff === null) {
|
|
12351
|
+
return false;
|
|
12352
|
+
}
|
|
12353
|
+
// A popup sign-in that ended meanwhile (the bridge's ✕, close(), or a
|
|
12354
|
+
// signIn() that replaced it) leaves this tab where it is, and leaves
|
|
12355
|
+
// alone the marker of any sign-in that now runs here.
|
|
12356
|
+
if (severed && !severed.signIn.live) {
|
|
12357
|
+
return false;
|
|
12358
|
+
}
|
|
12336
12359
|
if (signinRef === null) {
|
|
12337
12360
|
// With no marker, no recovery can stand in for this page's result, so
|
|
12338
12361
|
// the page needs no reference. A marker left from an earlier sign-in
|
|
12339
12362
|
// would otherwise bounce on the next load in place of this one.
|
|
12340
12363
|
removePendingMarker();
|
|
12341
12364
|
}
|
|
12342
|
-
const authContext = options.authContext;
|
|
12343
|
-
if (authContext?.authRequestId || authContext?.simpleMode?.sessionId) {
|
|
12344
|
-
window.location.assign(buildSigninUrl(this.config, options, { kind: 'redirect', signinRef }));
|
|
12345
|
-
return true;
|
|
12346
|
-
}
|
|
12347
|
-
const handoff = await this.armHandoffReturn();
|
|
12348
|
-
if (!handoff) {
|
|
12349
|
-
return false;
|
|
12350
|
-
}
|
|
12351
12365
|
window.location.assign(buildSigninUrl(this.config, options, { kind: 'redirect', signinRef, handoff }));
|
|
12352
12366
|
return true;
|
|
12353
12367
|
}
|
|
@@ -29533,7 +29547,7 @@ class SparkVault {
|
|
|
29533
29547
|
}
|
|
29534
29548
|
/** Get the SDK version */
|
|
29535
29549
|
static get version() {
|
|
29536
|
-
return '16.2.
|
|
29550
|
+
return '16.2.1';
|
|
29537
29551
|
}
|
|
29538
29552
|
}
|
|
29539
29553
|
if (typeof window !== 'undefined') {
|