@stytch/vanilla-js 4.8.0 → 4.9.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/CHANGELOG.md +21 -0
- package/dist/b2b/index.d.ts +16 -1
- package/dist/b2b/index.esm.d.ts +16 -1
- package/dist/b2b/index.esm.js +2973 -2957
- package/dist/b2b/index.headless.d.ts +16 -1
- package/dist/b2b/index.headless.esm.d.ts +16 -1
- package/dist/b2b/index.headless.esm.js +354 -346
- package/dist/b2b/index.headless.js +371 -363
- package/dist/b2b/index.js +2925 -2909
- package/dist/index.d.ts +16 -1
- package/dist/index.esm.d.ts +16 -1
- package/dist/index.esm.js +3963 -3916
- package/dist/index.headless.d.ts +16 -1
- package/dist/index.headless.esm.d.ts +16 -1
- package/dist/index.headless.esm.js +701 -666
- package/dist/index.headless.js +708 -673
- package/dist/index.js +3863 -3816
- package/package.json +3 -2
|
@@ -159,14 +159,14 @@ var g,
|
|
|
159
159
|
}
|
|
160
160
|
return a(t, c(Error)), r(t);
|
|
161
161
|
}(),
|
|
162
|
-
|
|
162
|
+
C = function (e) {
|
|
163
163
|
function t(e, r) {
|
|
164
164
|
var n;
|
|
165
165
|
return i(this, t), (n = o(this, t)).name = "StytchSDKUsageError", n.message = "Invalid call to ".concat(e, "\n") + r, n;
|
|
166
166
|
}
|
|
167
167
|
return a(t, c(Error)), r(t);
|
|
168
168
|
}(),
|
|
169
|
-
|
|
169
|
+
P = function (e) {
|
|
170
170
|
function t(e) {
|
|
171
171
|
var r, n;
|
|
172
172
|
i(this, t), (r = o(this, t)).name = "StytchSDKSchemaError";
|
|
@@ -242,13 +242,13 @@ var g,
|
|
|
242
242
|
}
|
|
243
243
|
return a(t, I), r(t);
|
|
244
244
|
}(),
|
|
245
|
-
|
|
245
|
+
F = function (e) {
|
|
246
246
|
function t(e) {
|
|
247
247
|
return i(this, t), o(this, t, ["InternalError", e || "An internal error has occurred. Please contact Stytch if this occurs."]);
|
|
248
248
|
}
|
|
249
249
|
return a(t, I), r(t);
|
|
250
250
|
}(),
|
|
251
|
-
|
|
251
|
+
j = function (e) {
|
|
252
252
|
function t() {
|
|
253
253
|
return i(this, t), o(this, t, ["NoBiometricsRegistrationError", "There is no biometric registration available. Authenticate with another method and add a new biometric registration first."]);
|
|
254
254
|
}
|
|
@@ -322,114 +322,120 @@ var g,
|
|
|
322
322
|
}(),
|
|
323
323
|
V = function (e) {
|
|
324
324
|
function t() {
|
|
325
|
-
return i(this, t), o(this, t, ["
|
|
325
|
+
return i(this, t), o(this, t, ["NoCredentialsPresentError", "The user did not provide credentials for a Google OneTap attempt"]);
|
|
326
326
|
}
|
|
327
327
|
return a(t, I), r(t);
|
|
328
328
|
}(),
|
|
329
329
|
Y = function (e) {
|
|
330
330
|
function t() {
|
|
331
|
-
return i(this, t), o(this, t, ["
|
|
331
|
+
return i(this, t), o(this, t, ["MissingPublicKeyError", "Failed to retrieve the public key. Add a new biometric registration."]);
|
|
332
332
|
}
|
|
333
333
|
return a(t, I), r(t);
|
|
334
334
|
}(),
|
|
335
335
|
J = function (e) {
|
|
336
336
|
function t() {
|
|
337
|
-
return i(this, t), o(this, t, ["
|
|
337
|
+
return i(this, t), o(this, t, ["ChallengeSigningFailedError", "Failed to sign the challenge with the key."]);
|
|
338
338
|
}
|
|
339
339
|
return a(t, I), r(t);
|
|
340
340
|
}(),
|
|
341
341
|
$ = function (e) {
|
|
342
342
|
function t() {
|
|
343
|
-
return i(this, t), o(this, t, ["
|
|
343
|
+
return i(this, t), o(this, t, ["SDKNotConfiguredError", "Stytch client is not confiured. You must call the configure method before using the SDK"]);
|
|
344
344
|
}
|
|
345
345
|
return a(t, I), r(t);
|
|
346
346
|
}(),
|
|
347
347
|
X = function (e) {
|
|
348
348
|
function t() {
|
|
349
|
-
return i(this, t), o(this, t, ["
|
|
349
|
+
return i(this, t), o(this, t, ["FailedCodeChallengeError", "Failed to create a code challenge"]);
|
|
350
350
|
}
|
|
351
351
|
return a(t, I), r(t);
|
|
352
352
|
}(),
|
|
353
353
|
Z = function (e) {
|
|
354
354
|
function t() {
|
|
355
|
-
return i(this, t), o(this, t, ["
|
|
355
|
+
return i(this, t), o(this, t, ["PasskeysUnsupportedError", "Passkeys are not supported on this device"]);
|
|
356
356
|
}
|
|
357
357
|
return a(t, I), r(t);
|
|
358
358
|
}(),
|
|
359
359
|
Q = function (e) {
|
|
360
360
|
function t() {
|
|
361
|
-
return i(this, t), o(this, t, ["
|
|
361
|
+
return i(this, t), o(this, t, ["FailedToDecryptDataError", "Failed to decrypt user data"]);
|
|
362
362
|
}
|
|
363
363
|
return a(t, I), r(t);
|
|
364
364
|
}(),
|
|
365
365
|
ee = function (e) {
|
|
366
366
|
function t() {
|
|
367
|
-
return i(this, t), o(this, t, ["
|
|
367
|
+
return i(this, t), o(this, t, ["BiometricsFailedError", "Biometric authentication failed"]);
|
|
368
368
|
}
|
|
369
369
|
return a(t, I), r(t);
|
|
370
370
|
}(),
|
|
371
371
|
te = function (e) {
|
|
372
372
|
function t() {
|
|
373
|
-
return i(this, t), o(this, t, ["
|
|
373
|
+
return i(this, t), o(this, t, ["InvalidStartUrlError", "The start URL was invalid or improperly formatted."]);
|
|
374
374
|
}
|
|
375
375
|
return a(t, I), r(t);
|
|
376
376
|
}(),
|
|
377
377
|
re = function (e) {
|
|
378
378
|
function t() {
|
|
379
|
-
return i(this, t), o(this, t, ["
|
|
379
|
+
return i(this, t), o(this, t, ["InvalidRedirectSchemeError", "The scheme from the given redirect urls was invalid. Possible reasons include: nil scheme, non-custom scheme (using http or https), or differing schemes for login/signup urls."]);
|
|
380
380
|
}
|
|
381
381
|
return a(t, I), r(t);
|
|
382
382
|
}(),
|
|
383
383
|
ne = function (e) {
|
|
384
384
|
function t() {
|
|
385
|
-
return i(this, t), o(this, t, ["
|
|
385
|
+
return i(this, t), o(this, t, ["MissingUrlError", "The underlying web authentication service failed to return a URL."]);
|
|
386
386
|
}
|
|
387
387
|
return a(t, I), r(t);
|
|
388
388
|
}(),
|
|
389
389
|
ie = function (e) {
|
|
390
390
|
function t() {
|
|
391
|
-
return i(this, t), o(this, t, ["
|
|
391
|
+
return i(this, t), o(this, t, ["InvalidCredentialTypeError", "The public key credential type was not of the expected type."]);
|
|
392
392
|
}
|
|
393
393
|
return a(t, I), r(t);
|
|
394
394
|
}(),
|
|
395
395
|
oe = function (e) {
|
|
396
396
|
function t() {
|
|
397
|
-
return i(this, t), o(this, t, ["
|
|
397
|
+
return i(this, t), o(this, t, ["MissingAttestationObjectError", "The public key credential is missing the attestation object."]);
|
|
398
398
|
}
|
|
399
399
|
return a(t, I), r(t);
|
|
400
400
|
}(),
|
|
401
401
|
se = function (e) {
|
|
402
402
|
function t() {
|
|
403
|
-
return i(this, t), o(this, t, ["
|
|
403
|
+
return i(this, t), o(this, t, ["JSONDataNotConvertibleToStringError", "JSON data unable to be converted to String type."]);
|
|
404
404
|
}
|
|
405
405
|
return a(t, I), r(t);
|
|
406
406
|
}(),
|
|
407
407
|
ae = function (e) {
|
|
408
408
|
function t() {
|
|
409
|
-
return i(this, t), o(this, t, ["
|
|
409
|
+
return i(this, t), o(this, t, ["RandomNumberGenerationFailed", "Random number generation failed"]);
|
|
410
410
|
}
|
|
411
411
|
return a(t, I), r(t);
|
|
412
412
|
}(),
|
|
413
413
|
ce = function (e) {
|
|
414
414
|
function t() {
|
|
415
|
-
return i(this, t), o(this, t, ["
|
|
415
|
+
return i(this, t), o(this, t, ["PasskeysInvalidEncoding", "Invalid passkey encoding"]);
|
|
416
416
|
}
|
|
417
417
|
return a(t, I), r(t);
|
|
418
418
|
}(),
|
|
419
419
|
ue = function (e) {
|
|
420
|
+
function t() {
|
|
421
|
+
return i(this, t), o(this, t, ["PasskeysMisconfigured", "Passkeys are misconfigured. Verify that you have added the correct associated domain for your application, and that the signing information is correct."]);
|
|
422
|
+
}
|
|
423
|
+
return a(t, I), r(t);
|
|
424
|
+
}(),
|
|
425
|
+
le = function (e) {
|
|
420
426
|
function t() {
|
|
421
427
|
return i(this, t), o(this, t, ["SignInWithAppleMisconfigured", "Sign In With Apple is misconfigured. Verify that you have correctly configured Apple OAuth in the Stytch Dashboard and added the Sign In With Apple capability to your project."]);
|
|
422
428
|
}
|
|
423
429
|
return a(t, I), r(t);
|
|
424
430
|
}();
|
|
425
|
-
function
|
|
431
|
+
function de(e) {
|
|
426
432
|
switch (e.message) {
|
|
427
433
|
case "internal_error":
|
|
428
|
-
return new
|
|
434
|
+
return new F(e.message);
|
|
429
435
|
case "no_current_session":
|
|
430
436
|
return new R();
|
|
431
437
|
case "no_biometrics_registration":
|
|
432
|
-
return new
|
|
438
|
+
return new j();
|
|
433
439
|
case "biometrics_unavailable":
|
|
434
440
|
case "device_hardware_error":
|
|
435
441
|
case "biometrics_not_available":
|
|
@@ -456,82 +462,99 @@ function le(e) {
|
|
|
456
462
|
case "invalid_authorization_credential":
|
|
457
463
|
return new G();
|
|
458
464
|
case "missing_public_key":
|
|
459
|
-
return new V();
|
|
460
|
-
case "challenge_signing_failed":
|
|
461
465
|
return new Y();
|
|
462
|
-
case "
|
|
466
|
+
case "challenge_signing_failed":
|
|
463
467
|
return new J();
|
|
464
|
-
case "
|
|
468
|
+
case "no_credentials_present":
|
|
469
|
+
return new V();
|
|
470
|
+
case "sdk_not_configured":
|
|
465
471
|
return new $();
|
|
466
|
-
case "
|
|
472
|
+
case "failed_code_challenge":
|
|
467
473
|
return new X();
|
|
468
|
-
case "
|
|
474
|
+
case "passkeys_unsupported":
|
|
469
475
|
return new Z();
|
|
470
|
-
case "
|
|
476
|
+
case "failed_to_decrypt_data":
|
|
471
477
|
return new Q();
|
|
472
|
-
case "
|
|
478
|
+
case "biometrics_failed":
|
|
473
479
|
return new ee();
|
|
474
|
-
case "
|
|
480
|
+
case "invalid_start_url":
|
|
475
481
|
return new te();
|
|
476
|
-
case "
|
|
482
|
+
case "invalid_redirect_scheme":
|
|
477
483
|
return new re();
|
|
478
|
-
case "
|
|
484
|
+
case "missing_url":
|
|
479
485
|
return new ne();
|
|
480
|
-
case "
|
|
486
|
+
case "invalid_credential_type":
|
|
481
487
|
return new ie();
|
|
482
|
-
case "
|
|
488
|
+
case "missing_attestation_object":
|
|
483
489
|
return new oe();
|
|
484
|
-
case "
|
|
490
|
+
case "json_data_not_convertible_to_string":
|
|
485
491
|
return new se();
|
|
486
|
-
case "
|
|
492
|
+
case "random_number_generation_failed":
|
|
487
493
|
return new ae();
|
|
488
|
-
case "
|
|
494
|
+
case "passkeys_invalid_encoding":
|
|
489
495
|
return new ce();
|
|
490
|
-
case "
|
|
496
|
+
case "passkeys_misconfigured":
|
|
491
497
|
return new ue();
|
|
498
|
+
case "signinwithapple_misconfigured":
|
|
499
|
+
return new le();
|
|
492
500
|
default:
|
|
493
501
|
return new I(e.name, e.message);
|
|
494
502
|
}
|
|
495
503
|
}
|
|
496
|
-
function
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
var
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
504
|
+
function he(e, t) {
|
|
505
|
+
var r = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
506
|
+
if (!r) {
|
|
507
|
+
if (Array.isArray(e) || (r = function (e, t) {
|
|
508
|
+
if (!e) return;
|
|
509
|
+
if ("string" == typeof e) return pe(e, t);
|
|
510
|
+
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
511
|
+
"Object" === r && e.constructor && (r = e.constructor.name);
|
|
512
|
+
if ("Map" === r || "Set" === r) return Array.from(e);
|
|
513
|
+
if ("Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return pe(e, t);
|
|
514
|
+
}(e)) || t && e && "number" == typeof e.length) {
|
|
515
|
+
r && (e = r);
|
|
516
|
+
var _n = 0,
|
|
517
|
+
i = function i() {};
|
|
518
|
+
return {
|
|
519
|
+
s: i,
|
|
520
|
+
n: function n() {
|
|
521
|
+
return _n >= e.length ? {
|
|
522
|
+
done: !0
|
|
523
|
+
} : {
|
|
524
|
+
done: !1,
|
|
525
|
+
value: e[_n++]
|
|
526
|
+
};
|
|
527
|
+
},
|
|
528
|
+
e: function e(_e2) {
|
|
529
|
+
throw _e2;
|
|
530
|
+
},
|
|
531
|
+
f: i
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
535
|
+
}
|
|
536
|
+
var o,
|
|
537
|
+
s = !0,
|
|
538
|
+
a = !1;
|
|
539
|
+
return {
|
|
540
|
+
s: function s() {
|
|
541
|
+
r = r.call(e);
|
|
542
|
+
},
|
|
543
|
+
n: function n() {
|
|
544
|
+
var e = r.next();
|
|
545
|
+
return s = e.done, e;
|
|
546
|
+
},
|
|
547
|
+
e: function e(_e3) {
|
|
548
|
+
a = !0, o = _e3;
|
|
549
|
+
},
|
|
550
|
+
f: function f() {
|
|
509
551
|
try {
|
|
510
|
-
|
|
511
|
-
if (Object(r) !== r) return;
|
|
512
|
-
c = !1;
|
|
513
|
-
} else for (; !(c = (n = o.call(r)).done) && (a.push(n.value), a.length !== t); c = !0);
|
|
514
|
-
} catch (e) {
|
|
515
|
-
u = !0, i = e;
|
|
552
|
+
s || null == r["return"] || r["return"]();
|
|
516
553
|
} finally {
|
|
517
|
-
|
|
518
|
-
if (!c && null != r["return"] && (s = r["return"](), Object(s) !== s)) return;
|
|
519
|
-
} finally {
|
|
520
|
-
if (u) throw i;
|
|
521
|
-
}
|
|
554
|
+
if (a) throw o;
|
|
522
555
|
}
|
|
523
|
-
return a;
|
|
524
556
|
}
|
|
525
|
-
}
|
|
526
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
527
|
-
}();
|
|
528
|
-
}
|
|
529
|
-
function he(e, t) {
|
|
530
|
-
if (e) {
|
|
531
|
-
if ("string" == typeof e) return pe(e, t);
|
|
532
|
-
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
533
|
-
return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? pe(e, t) : void 0;
|
|
534
|
-
}
|
|
557
|
+
};
|
|
535
558
|
}
|
|
536
559
|
function pe(e, t) {
|
|
537
560
|
(null == t || t > e.length) && (t = e.length);
|
|
@@ -614,14 +637,14 @@ function _e() {
|
|
|
614
637
|
w = y && y(y(D([])));
|
|
615
638
|
w && w !== r && n.call(w, s) && (k = w);
|
|
616
639
|
var S = g.prototype = v.prototype = Object.create(k);
|
|
617
|
-
function
|
|
640
|
+
function C(e) {
|
|
618
641
|
["next", "throw", "return"].forEach(function (t) {
|
|
619
642
|
u(e, t, function (e) {
|
|
620
643
|
return this._invoke(t, e);
|
|
621
644
|
});
|
|
622
645
|
});
|
|
623
646
|
}
|
|
624
|
-
function
|
|
647
|
+
function P(e, t) {
|
|
625
648
|
function r(i, o, s, a) {
|
|
626
649
|
var c = d(e[i], e, o);
|
|
627
650
|
if ("throw" !== c.type) {
|
|
@@ -743,15 +766,15 @@ function _e() {
|
|
|
743
766
|
return {
|
|
744
767
|
__await: e
|
|
745
768
|
};
|
|
746
|
-
}, P
|
|
769
|
+
}, C(P.prototype), u(P.prototype, a, function () {
|
|
747
770
|
return this;
|
|
748
|
-
}), t.AsyncIterator =
|
|
771
|
+
}), t.AsyncIterator = P, t.async = function (e, r, n, i, o) {
|
|
749
772
|
void 0 === o && (o = Promise);
|
|
750
|
-
var s = new
|
|
773
|
+
var s = new P(l(e, r, n, i), o);
|
|
751
774
|
return t.isGeneratorFunction(r) ? s : s.next().then(function (e) {
|
|
752
775
|
return e.done ? e.value : s.next();
|
|
753
776
|
});
|
|
754
|
-
},
|
|
777
|
+
}, C(S), u(S, c, "Generator"), u(S, s, function () {
|
|
755
778
|
return this;
|
|
756
779
|
}), u(S, "toString", function () {
|
|
757
780
|
return "[object Generator]";
|
|
@@ -875,14 +898,14 @@ function ge(e, t) {
|
|
|
875
898
|
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
|
|
876
899
|
}
|
|
877
900
|
function ke(e, t, r) {
|
|
878
|
-
return t =
|
|
901
|
+
return t = Ce(t), function (e, t) {
|
|
879
902
|
if (t && ("object" === fe(t) || "function" == typeof t)) return t;
|
|
880
903
|
if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
|
|
881
904
|
return function (e) {
|
|
882
905
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
883
906
|
return e;
|
|
884
907
|
}(e);
|
|
885
|
-
}(e, we() ? Reflect.construct(t, r || [],
|
|
908
|
+
}(e, we() ? Reflect.construct(t, r || [], Ce(e).constructor) : t.apply(e, r));
|
|
886
909
|
}
|
|
887
910
|
function ye(e) {
|
|
888
911
|
var t = "function" == typeof Map ? new Map() : void 0;
|
|
@@ -906,7 +929,7 @@ function ye(e) {
|
|
|
906
929
|
n.push.apply(n, t);
|
|
907
930
|
var i = new (e.bind.apply(e, n))();
|
|
908
931
|
return r && Se(i, r.prototype), i;
|
|
909
|
-
}(e, arguments,
|
|
932
|
+
}(e, arguments, Ce(this).constructor);
|
|
910
933
|
}
|
|
911
934
|
return r.prototype = Object.create(e.prototype, {
|
|
912
935
|
constructor: {
|
|
@@ -931,10 +954,10 @@ function Se(e, t) {
|
|
|
931
954
|
return e.__proto__ = t, e;
|
|
932
955
|
}, Se(e, t);
|
|
933
956
|
}
|
|
934
|
-
function
|
|
935
|
-
return
|
|
957
|
+
function Ce(e) {
|
|
958
|
+
return Ce = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) {
|
|
936
959
|
return e.__proto__ || Object.getPrototypeOf(e);
|
|
937
|
-
},
|
|
960
|
+
}, Ce(e);
|
|
938
961
|
}
|
|
939
962
|
!function (e) {
|
|
940
963
|
e.emailMagicLinks = "emailMagicLinks", e.sso = "sso", e.passwords = "passwords", e.oauth = "oauth";
|
|
@@ -945,7 +968,7 @@ function Pe(e) {
|
|
|
945
968
|
}(y || (y = {})), function (e) {
|
|
946
969
|
e.Google = "google", e.Microsoft = "microsoft";
|
|
947
970
|
}(w || (w = {}));
|
|
948
|
-
var
|
|
971
|
+
var Pe;
|
|
949
972
|
function Te(e, t, r, n) {
|
|
950
973
|
return new (r || (r = Promise))(function (i, o) {
|
|
951
974
|
function s(e) {
|
|
@@ -973,7 +996,7 @@ function Te(e, t, r, n) {
|
|
|
973
996
|
}
|
|
974
997
|
"function" == typeof SuppressedError && SuppressedError, function (e) {
|
|
975
998
|
e.RequiredCatcha = "Catcha Required";
|
|
976
|
-
}(
|
|
999
|
+
}(Pe || (Pe = {}));
|
|
977
1000
|
var Oe,
|
|
978
1001
|
xe = function (e) {
|
|
979
1002
|
function t(e) {
|
|
@@ -1067,7 +1090,7 @@ function Ae(e) {
|
|
|
1067
1090
|
e.next = 49;
|
|
1068
1091
|
break;
|
|
1069
1092
|
}
|
|
1070
|
-
throw new xe(
|
|
1093
|
+
throw new xe(Pe.RequiredCatcha);
|
|
1071
1094
|
case 49:
|
|
1072
1095
|
throw new A("Invalid response from the Stytch servers.");
|
|
1073
1096
|
case 50:
|
|
@@ -1083,8 +1106,8 @@ function De() {
|
|
|
1083
1106
|
return Oe(Ee);
|
|
1084
1107
|
}
|
|
1085
1108
|
var Ie = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
1086
|
-
for (var Re = [],
|
|
1087
|
-
function
|
|
1109
|
+
for (var Re = [], Fe = 0; Fe < 256; ++Fe) Re.push((Fe + 256).toString(16).substr(1));
|
|
1110
|
+
function je(e) {
|
|
1088
1111
|
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
|
|
1089
1112
|
r = (Re[e[t + 0]] + Re[e[t + 1]] + Re[e[t + 2]] + Re[e[t + 3]] + "-" + Re[e[t + 4]] + Re[e[t + 5]] + "-" + Re[e[t + 6]] + Re[e[t + 7]] + "-" + Re[e[t + 8]] + Re[e[t + 9]] + "-" + Re[e[t + 10]] + Re[e[t + 11]] + Re[e[t + 12]] + Re[e[t + 13]] + Re[e[t + 14]] + Re[e[t + 15]]).toLowerCase();
|
|
1090
1113
|
if (!function (e) {
|
|
@@ -1099,7 +1122,7 @@ function Le(e, t, r) {
|
|
|
1099
1122
|
for (var i = 0; i < 16; ++i) t[r + i] = n[i];
|
|
1100
1123
|
return t;
|
|
1101
1124
|
}
|
|
1102
|
-
return
|
|
1125
|
+
return je(n);
|
|
1103
1126
|
}
|
|
1104
1127
|
var Me = {};
|
|
1105
1128
|
function Be(e, t) {
|
|
@@ -1169,73 +1192,26 @@ var Ne,
|
|
|
1169
1192
|
var t = {
|
|
1170
1193
|
isObject: function isObject(r, n) {
|
|
1171
1194
|
var i = "object" === fe(n) && !Array.isArray(n) && null !== n;
|
|
1172
|
-
if (!i) throw new
|
|
1195
|
+
if (!i) throw new C(e, r + " must be an object.");
|
|
1173
1196
|
return t;
|
|
1174
1197
|
},
|
|
1175
1198
|
isOptionalObject: function isOptionalObject(e, r) {
|
|
1176
1199
|
return void 0 === r ? t : t.isObject(e, r);
|
|
1177
1200
|
},
|
|
1178
1201
|
isString: function isString(r, n) {
|
|
1179
|
-
if ("string" != typeof n) throw new
|
|
1202
|
+
if ("string" != typeof n) throw new C(e, r + " must be a string.");
|
|
1180
1203
|
return t;
|
|
1181
1204
|
},
|
|
1182
1205
|
isOptionalString: function isOptionalString(e, r) {
|
|
1183
1206
|
return void 0 === r ? t : t.isString(e, r);
|
|
1184
1207
|
},
|
|
1185
1208
|
isStringArray: function isStringArray(r, n) {
|
|
1186
|
-
if (!Array.isArray(n)) throw new
|
|
1209
|
+
if (!Array.isArray(n)) throw new C(e, r + " must be an array of strings.");
|
|
1187
1210
|
var i,
|
|
1188
|
-
o =
|
|
1189
|
-
var r = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
1190
|
-
if (!r) {
|
|
1191
|
-
if (Array.isArray(e) || (r = he(e)) || t && e && "number" == typeof e.length) {
|
|
1192
|
-
r && (e = r);
|
|
1193
|
-
var _n = 0,
|
|
1194
|
-
i = function i() {};
|
|
1195
|
-
return {
|
|
1196
|
-
s: i,
|
|
1197
|
-
n: function n() {
|
|
1198
|
-
return _n >= e.length ? {
|
|
1199
|
-
done: !0
|
|
1200
|
-
} : {
|
|
1201
|
-
done: !1,
|
|
1202
|
-
value: e[_n++]
|
|
1203
|
-
};
|
|
1204
|
-
},
|
|
1205
|
-
e: function e(_e2) {
|
|
1206
|
-
throw _e2;
|
|
1207
|
-
},
|
|
1208
|
-
f: i
|
|
1209
|
-
};
|
|
1210
|
-
}
|
|
1211
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1212
|
-
}
|
|
1213
|
-
var o,
|
|
1214
|
-
s = !0,
|
|
1215
|
-
a = !1;
|
|
1216
|
-
return {
|
|
1217
|
-
s: function s() {
|
|
1218
|
-
r = r.call(e);
|
|
1219
|
-
},
|
|
1220
|
-
n: function n() {
|
|
1221
|
-
var e = r.next();
|
|
1222
|
-
return s = e.done, e;
|
|
1223
|
-
},
|
|
1224
|
-
e: function e(_e3) {
|
|
1225
|
-
a = !0, o = _e3;
|
|
1226
|
-
},
|
|
1227
|
-
f: function f() {
|
|
1228
|
-
try {
|
|
1229
|
-
s || null == r["return"] || r["return"]();
|
|
1230
|
-
} finally {
|
|
1231
|
-
if (a) throw o;
|
|
1232
|
-
}
|
|
1233
|
-
}
|
|
1234
|
-
};
|
|
1235
|
-
}(n);
|
|
1211
|
+
o = he(n);
|
|
1236
1212
|
try {
|
|
1237
1213
|
for (o.s(); !(i = o.n()).done;) {
|
|
1238
|
-
if ("string" != typeof i.value) throw new
|
|
1214
|
+
if ("string" != typeof i.value) throw new C(e, r + " must be an array of strings.");
|
|
1239
1215
|
}
|
|
1240
1216
|
} catch (e) {
|
|
1241
1217
|
o.e(e);
|
|
@@ -1248,14 +1224,14 @@ var Ne,
|
|
|
1248
1224
|
return void 0 === r ? t : t.isStringArray(e, r);
|
|
1249
1225
|
},
|
|
1250
1226
|
isNumber: function isNumber(r, n) {
|
|
1251
|
-
if ("number" != typeof n) throw new
|
|
1227
|
+
if ("number" != typeof n) throw new C(e, r + " must be a number.");
|
|
1252
1228
|
return t;
|
|
1253
1229
|
},
|
|
1254
1230
|
isOptionalNumber: function isOptionalNumber(e, r) {
|
|
1255
1231
|
return void 0 === r ? t : t.isNumber(e, r);
|
|
1256
1232
|
},
|
|
1257
1233
|
isBoolean: function isBoolean(r, n) {
|
|
1258
|
-
if ("boolean" != typeof n) throw new
|
|
1234
|
+
if ("boolean" != typeof n) throw new C(e, r + " must be a boolean.");
|
|
1259
1235
|
return t;
|
|
1260
1236
|
},
|
|
1261
1237
|
isOptionalBoolean: function isOptionalBoolean(e, r) {
|
|
@@ -1359,7 +1335,7 @@ var Ne,
|
|
|
1359
1335
|
case 0:
|
|
1360
1336
|
return r.next = 2, this.state;
|
|
1361
1337
|
case 2:
|
|
1362
|
-
if (n = r.sent, i = n.enabled, o = n.executeRecaptcha, e.type !==
|
|
1338
|
+
if (n = r.sent, i = n.enabled, o = n.executeRecaptcha, e.type !== Pe.RequiredCatcha || !i) {
|
|
1363
1339
|
r.next = 14;
|
|
1364
1340
|
break;
|
|
1365
1341
|
}
|
|
@@ -1504,7 +1480,7 @@ var Ne,
|
|
|
1504
1480
|
case "SDKAPIUnreachableError":
|
|
1505
1481
|
return e.inflate(S, t);
|
|
1506
1482
|
case "StytchSDKSchemaError":
|
|
1507
|
-
return e.inflate(
|
|
1483
|
+
return e.inflate(P, t);
|
|
1508
1484
|
case "StytchAPIUnreachableError":
|
|
1509
1485
|
return e.inflate(A, t);
|
|
1510
1486
|
case "StytchAPISchemaError":
|
|
@@ -1852,6 +1828,11 @@ var Ze = Promise.resolve({
|
|
|
1852
1828
|
}));
|
|
1853
1829
|
}, this.getSync = function () {
|
|
1854
1830
|
return n._subscriptionService.getMember();
|
|
1831
|
+
}, this.getInfo = function () {
|
|
1832
|
+
return {
|
|
1833
|
+
member: n.getSync(),
|
|
1834
|
+
fromCache: n._subscriptionService.getFromCache()
|
|
1835
|
+
};
|
|
1855
1836
|
}, this.onChange = function (e) {
|
|
1856
1837
|
return n._subscriptionService.subscribeToState(function (t) {
|
|
1857
1838
|
var r;
|
|
@@ -2239,6 +2220,11 @@ var Ze = Promise.resolve({
|
|
|
2239
2220
|
}));
|
|
2240
2221
|
}, this.getSync = function () {
|
|
2241
2222
|
return n._subscriptionService.getOrganization();
|
|
2223
|
+
}, this.getInfo = function () {
|
|
2224
|
+
return {
|
|
2225
|
+
organization: n.getSync(),
|
|
2226
|
+
fromCache: n._subscriptionService.getFromCache()
|
|
2227
|
+
};
|
|
2242
2228
|
}, this.onChange = function (e) {
|
|
2243
2229
|
return n._subscriptionService.subscribeToState(function (t) {
|
|
2244
2230
|
var r;
|
|
@@ -2648,6 +2634,11 @@ var Ze = Promise.resolve({
|
|
|
2648
2634
|
var n = this;
|
|
2649
2635
|
ge(this, e), this._networkClient = t, this._subscriptionService = r, this.getSync = function () {
|
|
2650
2636
|
return n._subscriptionService.getSession();
|
|
2637
|
+
}, this.getInfo = function () {
|
|
2638
|
+
return {
|
|
2639
|
+
session: n.getSync(),
|
|
2640
|
+
fromCache: n._subscriptionService.getFromCache()
|
|
2641
|
+
};
|
|
2651
2642
|
}, this.onChange = function (e) {
|
|
2652
2643
|
return n._subscriptionService.subscribeToState(function (t) {
|
|
2653
2644
|
var r;
|
|
@@ -3496,8 +3487,8 @@ var Ze = Promise.resolve({
|
|
|
3496
3487
|
return i.policyPromise.then(function (r) {
|
|
3497
3488
|
return r.callerIsAuthorized(i.roleIds(), e, t);
|
|
3498
3489
|
});
|
|
3499
|
-
}, this.cachedPolicy = t.rbacPolicy ?
|
|
3500
|
-
return e.rbacPolicy ? (i.cachedPolicy =
|
|
3490
|
+
}, this.cachedPolicy = t.rbacPolicy ? mt.fromJSON(t.rbacPolicy) : null, this.policyPromise = r.then(function (e) {
|
|
3491
|
+
return e.rbacPolicy ? (i.cachedPolicy = mt.fromJSON(e.rbacPolicy), i.cachedPolicy) : (We("Unable to retrieve RBAC policy from servers. Assuming caller has no permissions."), new mt([], []));
|
|
3501
3492
|
});
|
|
3502
3493
|
}
|
|
3503
3494
|
return ve(e, [{
|
|
@@ -3620,7 +3611,9 @@ var Ze = Promise.resolve({
|
|
|
3620
3611
|
function e(t, r) {
|
|
3621
3612
|
var n = this;
|
|
3622
3613
|
ge(this, e), this._subscriptionService = t, this._headlessSessionClient = r, this._onDataChange = function (e) {
|
|
3623
|
-
(
|
|
3614
|
+
!function (e) {
|
|
3615
|
+
return !!(null == e ? void 0 : e.session);
|
|
3616
|
+
}(e) ? n.cancelBackgroundRefresh() : n.scheduleBackgroundRefresh();
|
|
3624
3617
|
}, this._reauthenticateWithBackoff = function () {
|
|
3625
3618
|
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
3626
3619
|
var r;
|
|
@@ -3691,58 +3684,66 @@ var Ze = Promise.resolve({
|
|
|
3691
3684
|
}]), e;
|
|
3692
3685
|
}();
|
|
3693
3686
|
ft.REFRESH_INTERVAL_MS = 18e4;
|
|
3694
|
-
var _t = function () {
|
|
3695
|
-
function e(t, r) {
|
|
3687
|
+
var _t = ve(function e(t, r) {
|
|
3696
3688
|
var n = this;
|
|
3697
|
-
ge(this, e), this.
|
|
3698
|
-
return n.
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3689
|
+
ge(this, e), this._subscriptionService = t, this.emptyState = r, this.onStateChange = function (e) {
|
|
3690
|
+
return n._subscriptionService.subscribeToState(function (t) {
|
|
3691
|
+
e(null != t ? t : n.emptyState);
|
|
3692
|
+
});
|
|
3693
|
+
};
|
|
3694
|
+
}),
|
|
3695
|
+
mt = function () {
|
|
3696
|
+
function e(t, r) {
|
|
3704
3697
|
var n = this;
|
|
3705
|
-
|
|
3706
|
-
return n.rolesByID[e];
|
|
3707
|
-
}).filter(function (e) {
|
|
3708
|
-
return e;
|
|
3709
|
-
}).flatMap(function (e) {
|
|
3710
|
-
return e.permissions;
|
|
3711
|
-
}).filter(function (e) {
|
|
3712
|
-
return e.resource_id === t;
|
|
3713
|
-
}).find(function (e) {
|
|
3714
|
-
return e.actions.includes(r) || e.actions.includes("*");
|
|
3698
|
+
ge(this, e), this.roles = t, this.resources = r, this.rolesByID = {}, t.forEach(function (e) {
|
|
3699
|
+
return n.rolesByID[e.role_id] = e;
|
|
3715
3700
|
});
|
|
3716
3701
|
}
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3702
|
+
return ve(e, [{
|
|
3703
|
+
key: "callerIsAuthorized",
|
|
3704
|
+
value: function value(e, t, r) {
|
|
3705
|
+
var n = this;
|
|
3706
|
+
return !!e.map(function (e) {
|
|
3707
|
+
return n.rolesByID[e];
|
|
3708
|
+
}).filter(function (e) {
|
|
3709
|
+
return e;
|
|
3710
|
+
}).flatMap(function (e) {
|
|
3711
|
+
return e.permissions;
|
|
3712
|
+
}).filter(function (e) {
|
|
3713
|
+
return e.resource_id === t;
|
|
3714
|
+
}).find(function (e) {
|
|
3715
|
+
return e.actions.includes(r) || e.actions.includes("*");
|
|
3725
3716
|
});
|
|
3726
|
-
}
|
|
3727
|
-
}
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3717
|
+
}
|
|
3718
|
+
}, {
|
|
3719
|
+
key: "allPermissionsForCaller",
|
|
3720
|
+
value: function value(e) {
|
|
3721
|
+
var t = this,
|
|
3722
|
+
r = {};
|
|
3723
|
+
return this.resources.forEach(function (n) {
|
|
3724
|
+
r[n.resource_id] = {}, n.actions.forEach(function (i) {
|
|
3725
|
+
r[n.resource_id][i] = t.callerIsAuthorized(e, n.resource_id, i);
|
|
3726
|
+
});
|
|
3727
|
+
}), r;
|
|
3728
|
+
}
|
|
3729
|
+
}], [{
|
|
3730
|
+
key: "fromJSON",
|
|
3731
|
+
value: function value(t) {
|
|
3732
|
+
return new e(t.roles, t.resources);
|
|
3733
|
+
}
|
|
3734
|
+
}]), e;
|
|
3735
|
+
}();
|
|
3736
|
+
var vt = "bootstrap";
|
|
3737
|
+
var bt = /*#__PURE__*/function () {
|
|
3738
|
+
function bt(e, t, r) {
|
|
3738
3739
|
var _this = this;
|
|
3739
|
-
_classCallCheck(this,
|
|
3740
|
+
_classCallCheck(this, bt);
|
|
3740
3741
|
this._publicToken = e, this._networkClient = t, this._dataLayer = r, this._bootstrapDataPromise = this._networkClient.fetchSDK({
|
|
3741
3742
|
url: "/projects/bootstrap/".concat(this._publicToken),
|
|
3742
3743
|
method: "GET",
|
|
3743
3744
|
errorMessage: "Error fetching bootstrap data for SDK for ".concat(this._publicToken)
|
|
3744
|
-
}).then(
|
|
3745
|
-
return _this._dataLayer.setItem(
|
|
3745
|
+
}).then(bt.mapBootstrapData).then(function (e) {
|
|
3746
|
+
return _this._dataLayer.setItem(vt, JSON.stringify(e)), e;
|
|
3746
3747
|
})["catch"](function (e) {
|
|
3747
3748
|
return We(e), {
|
|
3748
3749
|
displayWatermark: !1,
|
|
@@ -3763,10 +3764,10 @@ var vt = /*#__PURE__*/function () {
|
|
|
3763
3764
|
};
|
|
3764
3765
|
});
|
|
3765
3766
|
}
|
|
3766
|
-
_createClass(
|
|
3767
|
+
_createClass(bt, [{
|
|
3767
3768
|
key: "getSync",
|
|
3768
3769
|
value: function getSync() {
|
|
3769
|
-
var e = this._dataLayer.getItem(
|
|
3770
|
+
var e = this._dataLayer.getItem(vt);
|
|
3770
3771
|
if (null === e) return {
|
|
3771
3772
|
displayWatermark: !1,
|
|
3772
3773
|
cnameDomain: null,
|
|
@@ -3837,9 +3838,9 @@ var vt = /*#__PURE__*/function () {
|
|
|
3837
3838
|
};
|
|
3838
3839
|
}
|
|
3839
3840
|
}]);
|
|
3840
|
-
return
|
|
3841
|
+
return bt;
|
|
3841
3842
|
}();
|
|
3842
|
-
function
|
|
3843
|
+
function gt(e, t, r, n) {
|
|
3843
3844
|
return new (r || (r = Promise))(function (i, o) {
|
|
3844
3845
|
function s(e) {
|
|
3845
3846
|
try {
|
|
@@ -3865,11 +3866,11 @@ function bt(e, t, r, n) {
|
|
|
3865
3866
|
});
|
|
3866
3867
|
}
|
|
3867
3868
|
"function" == typeof SuppressedError && SuppressedError;
|
|
3868
|
-
var
|
|
3869
|
+
var kt = /*#__PURE__*/_createClass(function kt(e) {
|
|
3869
3870
|
var _this2 = this;
|
|
3870
|
-
_classCallCheck(this,
|
|
3871
|
+
_classCallCheck(this, kt);
|
|
3871
3872
|
this.bootstrapPromise = e, this.executeRecaptcha = function () {
|
|
3872
|
-
return
|
|
3873
|
+
return gt(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
3873
3874
|
var _yield$this$state, e, t, r;
|
|
3874
3875
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3875
3876
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -3900,7 +3901,7 @@ var gt = /*#__PURE__*/_createClass(function gt(e) {
|
|
|
3900
3901
|
}, _callee, this);
|
|
3901
3902
|
}));
|
|
3902
3903
|
}, this.state = e.then(function (e) {
|
|
3903
|
-
return
|
|
3904
|
+
return gt(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
3904
3905
|
var t;
|
|
3905
3906
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3906
3907
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -3938,10 +3939,10 @@ var gt = /*#__PURE__*/_createClass(function gt(e) {
|
|
|
3938
3939
|
}));
|
|
3939
3940
|
});
|
|
3940
3941
|
});
|
|
3941
|
-
var
|
|
3942
|
-
function
|
|
3942
|
+
var yt = /*#__PURE__*/function () {
|
|
3943
|
+
function yt(e) {
|
|
3943
3944
|
var _this3 = this;
|
|
3944
|
-
_classCallCheck(this,
|
|
3945
|
+
_classCallCheck(this, yt);
|
|
3945
3946
|
this.iframeURL = e, this.oneTapStart = function (e) {
|
|
3946
3947
|
return _this3.call("oneTapStart", e);
|
|
3947
3948
|
}, this.oneTapSubmit = function (e) {
|
|
@@ -3950,7 +3951,7 @@ var kt = /*#__PURE__*/function () {
|
|
|
3950
3951
|
return _this3.call("parsedPhoneNumber", e);
|
|
3951
3952
|
};
|
|
3952
3953
|
}
|
|
3953
|
-
_createClass(
|
|
3954
|
+
_createClass(yt, [{
|
|
3954
3955
|
key: "frameClient",
|
|
3955
3956
|
get: function get() {
|
|
3956
3957
|
var e;
|
|
@@ -3962,11 +3963,11 @@ var kt = /*#__PURE__*/function () {
|
|
|
3962
3963
|
return this.frameClient.call(e, [t]);
|
|
3963
3964
|
}
|
|
3964
3965
|
}]);
|
|
3965
|
-
return
|
|
3966
|
+
return yt;
|
|
3966
3967
|
}();
|
|
3967
|
-
var
|
|
3968
|
-
function
|
|
3969
|
-
_classCallCheck(this,
|
|
3968
|
+
var wt = /*#__PURE__*/function () {
|
|
3969
|
+
function wt(e, t, r, n) {
|
|
3970
|
+
_classCallCheck(this, wt);
|
|
3970
3971
|
this._publicToken = e, this._subscriptionDataLayer = t, this.baseURL = r, this.additionalTelemetryDataFn = n, this.updateSessionToken = function () {
|
|
3971
3972
|
return null;
|
|
3972
3973
|
}, this.eventLogger = new Xe({
|
|
@@ -3975,7 +3976,7 @@ var yt = /*#__PURE__*/function () {
|
|
|
3975
3976
|
logEventURL: this.buildSDKUrl("/events")
|
|
3976
3977
|
});
|
|
3977
3978
|
}
|
|
3978
|
-
_createClass(
|
|
3979
|
+
_createClass(wt, [{
|
|
3979
3980
|
key: "logEvent",
|
|
3980
3981
|
value: function logEvent(_ref) {
|
|
3981
3982
|
var e = _ref.name,
|
|
@@ -4006,7 +4007,7 @@ var yt = /*#__PURE__*/function () {
|
|
|
4006
4007
|
},
|
|
4007
4008
|
sdk: {
|
|
4008
4009
|
identifier: "Stytch.js Javascript SDK",
|
|
4009
|
-
version: "4.
|
|
4010
|
+
version: "4.9.1"
|
|
4010
4011
|
}
|
|
4011
4012
|
});
|
|
4012
4013
|
}
|
|
@@ -4017,7 +4018,7 @@ var yt = /*#__PURE__*/function () {
|
|
|
4017
4018
|
t = _ref2.body,
|
|
4018
4019
|
r = _ref2.errorMessage,
|
|
4019
4020
|
n = _ref2.method;
|
|
4020
|
-
return
|
|
4021
|
+
return gt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
4021
4022
|
var i, o, s, a;
|
|
4022
4023
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
4023
4024
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -4047,7 +4048,7 @@ var yt = /*#__PURE__*/function () {
|
|
|
4047
4048
|
r = _ref3.errorMessage,
|
|
4048
4049
|
n = _ref3.method,
|
|
4049
4050
|
i = _ref3.retryCallback;
|
|
4050
|
-
return
|
|
4051
|
+
return gt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
4051
4052
|
var o, s, a, c;
|
|
4052
4053
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
4053
4054
|
while (1) switch (_context4.prev = _context4.next) {
|
|
@@ -4118,18 +4119,18 @@ var yt = /*#__PURE__*/function () {
|
|
|
4118
4119
|
return "".concat(this.baseURL, "/sdk/v1").concat(e);
|
|
4119
4120
|
}
|
|
4120
4121
|
}]);
|
|
4121
|
-
return
|
|
4122
|
+
return wt;
|
|
4122
4123
|
}();
|
|
4123
|
-
function
|
|
4124
|
+
function St(e) {
|
|
4124
4125
|
var t = e.toString(16);
|
|
4125
4126
|
return 1 === t.length && (t = "0" + t), t;
|
|
4126
4127
|
}
|
|
4127
|
-
var
|
|
4128
|
-
function
|
|
4129
|
-
_classCallCheck(this,
|
|
4128
|
+
var Ct = /*#__PURE__*/function () {
|
|
4129
|
+
function Ct(e, t) {
|
|
4130
|
+
_classCallCheck(this, Ct);
|
|
4130
4131
|
this._dataLayer = e, this.namespace = t;
|
|
4131
4132
|
}
|
|
4132
|
-
_createClass(
|
|
4133
|
+
_createClass(Ct, [{
|
|
4133
4134
|
key: "key",
|
|
4134
4135
|
value: function key() {
|
|
4135
4136
|
return "PKCE_VERIFIER:" + this.namespace;
|
|
@@ -4137,13 +4138,13 @@ var St = /*#__PURE__*/function () {
|
|
|
4137
4138
|
}, {
|
|
4138
4139
|
key: "startPKCETransaction",
|
|
4139
4140
|
value: function startPKCETransaction() {
|
|
4140
|
-
return
|
|
4141
|
+
return gt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
4141
4142
|
var e;
|
|
4142
4143
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
4143
4144
|
while (1) switch (_context5.prev = _context5.next) {
|
|
4144
4145
|
case 0:
|
|
4145
4146
|
_context5.next = 2;
|
|
4146
|
-
return
|
|
4147
|
+
return Ct.createProofkeyPair();
|
|
4147
4148
|
case 2:
|
|
4148
4149
|
e = _context5.sent;
|
|
4149
4150
|
return _context5.abrupt("return", (this._dataLayer.setItem(this.key(), JSON.stringify(e)), e));
|
|
@@ -4172,7 +4173,7 @@ var St = /*#__PURE__*/function () {
|
|
|
4172
4173
|
}], [{
|
|
4173
4174
|
key: "createProofkeyPair",
|
|
4174
4175
|
value: function createProofkeyPair() {
|
|
4175
|
-
return
|
|
4176
|
+
return gt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
4176
4177
|
var _String$fromCharCode;
|
|
4177
4178
|
var e, t, r, n;
|
|
4178
4179
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
@@ -4180,7 +4181,7 @@ var St = /*#__PURE__*/function () {
|
|
|
4180
4181
|
case 0:
|
|
4181
4182
|
e = new Uint32Array(16);
|
|
4182
4183
|
window.crypto.getRandomValues(e);
|
|
4183
|
-
t = Array.from(e).map(
|
|
4184
|
+
t = Array.from(e).map(St).join("");
|
|
4184
4185
|
_context6.next = 5;
|
|
4185
4186
|
return window.crypto.subtle.digest("SHA-256", new TextEncoder().encode(t));
|
|
4186
4187
|
case 5:
|
|
@@ -4197,7 +4198,7 @@ var St = /*#__PURE__*/function () {
|
|
|
4197
4198
|
}));
|
|
4198
4199
|
}
|
|
4199
4200
|
}]);
|
|
4200
|
-
return
|
|
4201
|
+
return Ct;
|
|
4201
4202
|
}();
|
|
4202
4203
|
var Pt = function Pt(e) {
|
|
4203
4204
|
return (document.cookie ? document.cookie.split("; ") : []).filter(function (t) {
|
|
@@ -4208,17 +4209,17 @@ var Pt = function Pt(e) {
|
|
|
4208
4209
|
}).length > 1;
|
|
4209
4210
|
};
|
|
4210
4211
|
/*! js-cookie v3.0.1 | MIT */
|
|
4211
|
-
function
|
|
4212
|
+
function Tt(e) {
|
|
4212
4213
|
for (var t = 1; t < arguments.length; t++) {
|
|
4213
4214
|
var r = arguments[t];
|
|
4214
4215
|
for (var n in r) e[n] = r[n];
|
|
4215
4216
|
}
|
|
4216
4217
|
return e;
|
|
4217
4218
|
}
|
|
4218
|
-
var
|
|
4219
|
+
var Ot = function e(t, r) {
|
|
4219
4220
|
function n(e, n, i) {
|
|
4220
4221
|
if ("undefined" != typeof document) {
|
|
4221
|
-
"number" == typeof (i =
|
|
4222
|
+
"number" == typeof (i = Tt({}, r, i)).expires && (i.expires = new Date(Date.now() + 864e5 * i.expires)), i.expires && (i.expires = i.expires.toUTCString()), e = encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
|
|
4222
4223
|
var o = "";
|
|
4223
4224
|
for (var s in i) i[s] && (o += "; " + s, !0 !== i[s] && (o += "=" + i[s].split(";")[0]));
|
|
4224
4225
|
return document.cookie = e + "=" + t.write(n, e) + o;
|
|
@@ -4240,15 +4241,15 @@ var Tt = function e(t, r) {
|
|
|
4240
4241
|
}
|
|
4241
4242
|
},
|
|
4242
4243
|
remove: function remove(e, t) {
|
|
4243
|
-
n(e, "",
|
|
4244
|
+
n(e, "", Tt({}, t, {
|
|
4244
4245
|
expires: -1
|
|
4245
4246
|
}));
|
|
4246
4247
|
},
|
|
4247
4248
|
withAttributes: function withAttributes(t) {
|
|
4248
|
-
return e(this.converter,
|
|
4249
|
+
return e(this.converter, Tt({}, this.attributes, t));
|
|
4249
4250
|
},
|
|
4250
4251
|
withConverter: function withConverter(t) {
|
|
4251
|
-
return e(
|
|
4252
|
+
return e(Tt({}, this.converter, t), this.attributes);
|
|
4252
4253
|
}
|
|
4253
4254
|
}, {
|
|
4254
4255
|
attributes: {
|
|
@@ -4268,37 +4269,37 @@ var Tt = function e(t, r) {
|
|
|
4268
4269
|
}, {
|
|
4269
4270
|
path: "/"
|
|
4270
4271
|
});
|
|
4271
|
-
var
|
|
4272
|
+
var xt = function xt(e) {
|
|
4272
4273
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
4273
4274
|
return "stytch_sdk_state_".concat(e).concat(t ? "::".concat(t) : "");
|
|
4274
4275
|
},
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
clearTimeout(
|
|
4276
|
+
At = new Map(),
|
|
4277
|
+
Et = function Et(e) {
|
|
4278
|
+
clearTimeout(At.get(e));
|
|
4278
4279
|
},
|
|
4279
|
-
|
|
4280
|
-
|
|
4280
|
+
Dt = function Dt(e, t, r) {
|
|
4281
|
+
Et(e);
|
|
4281
4282
|
var n = setTimeout(function () {
|
|
4282
|
-
void 0 ===
|
|
4283
|
+
void 0 === Ot.get(e) && Ot.set(e, t, r);
|
|
4283
4284
|
}, 10);
|
|
4284
|
-
return
|
|
4285
|
+
return At.set(e, n), Ot.set(e, t, r);
|
|
4285
4286
|
};
|
|
4286
|
-
var
|
|
4287
|
-
function
|
|
4287
|
+
var It = /*#__PURE__*/function () {
|
|
4288
|
+
function It(e, t) {
|
|
4288
4289
|
var _this4 = this;
|
|
4289
|
-
_classCallCheck(this,
|
|
4290
|
+
_classCallCheck(this, It);
|
|
4290
4291
|
this.browserSessionStorage = {
|
|
4291
4292
|
getItem: function getItem(e) {
|
|
4292
|
-
return sessionStorage.getItem(
|
|
4293
|
+
return sessionStorage.getItem(xt(_this4.publicToken, e));
|
|
4293
4294
|
},
|
|
4294
4295
|
setItem: function setItem(e, t) {
|
|
4295
|
-
return sessionStorage.setItem(
|
|
4296
|
+
return sessionStorage.setItem(xt(_this4.publicToken, e), t);
|
|
4296
4297
|
},
|
|
4297
4298
|
removeItem: function removeItem(e) {
|
|
4298
|
-
return sessionStorage.removeItem(
|
|
4299
|
+
return sessionStorage.removeItem(xt(_this4.publicToken, e));
|
|
4299
4300
|
}
|
|
4300
4301
|
}, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (Ve("SubscriptionDataLayer").isOptionalString("cookieOptions.opaqueTokenCookieName", t.cookieOptions.opaqueTokenCookieName).isOptionalString("cookieOptions.jwtCookieName", t.cookieOptions.jwtCookieName).isOptionalString("cookieOptions.istCookieName", t.cookieOptions.istCookieName).isOptionalString("cookieOptions.path", t.cookieOptions.path).isOptionalString("cookieOptions.domain", t.cookieOptions.domain), this._jwtCookieName = t.cookieOptions.jwtCookieName || null, this._opaqueTokenCookieName = t.cookieOptions.opaqueTokenCookieName || null, this._cookiePath = t.cookieOptions.path || null, this._domain = t.cookieOptions.domain || null, this._cookieAvailableToSubdomains = t.cookieOptions.availableToSubdomains || !1, this._istCookieName = t.cookieOptions.istCookieName || null) : (this._opaqueTokenCookieName = null, this._jwtCookieName = null, this._cookiePath = null, this._domain = null, this._cookieAvailableToSubdomains = !1, this._istCookieName = null);
|
|
4301
|
-
var r = localStorage.getItem(
|
|
4302
|
+
var r = localStorage.getItem(xt(this.publicToken));
|
|
4302
4303
|
if (!r) return;
|
|
4303
4304
|
var n;
|
|
4304
4305
|
try {
|
|
@@ -4308,7 +4309,7 @@ var Dt = /*#__PURE__*/function () {
|
|
|
4308
4309
|
}
|
|
4309
4310
|
this.state = n;
|
|
4310
4311
|
}
|
|
4311
|
-
_createClass(
|
|
4312
|
+
_createClass(It, [{
|
|
4312
4313
|
key: "opaqueTokenCookieName",
|
|
4313
4314
|
get: function get() {
|
|
4314
4315
|
var e;
|
|
@@ -4330,14 +4331,14 @@ var Dt = /*#__PURE__*/function () {
|
|
|
4330
4331
|
key: "readSessionCookie",
|
|
4331
4332
|
value: function readSessionCookie() {
|
|
4332
4333
|
return {
|
|
4333
|
-
session_token:
|
|
4334
|
-
session_jwt:
|
|
4334
|
+
session_token: Ot.get(this.opaqueTokenCookieName),
|
|
4335
|
+
session_jwt: Ot.get(this.jwtCookieName)
|
|
4335
4336
|
};
|
|
4336
4337
|
}
|
|
4337
4338
|
}, {
|
|
4338
4339
|
key: "readIntermediateSessionTokenCookie",
|
|
4339
4340
|
value: function readIntermediateSessionTokenCookie() {
|
|
4340
|
-
return
|
|
4341
|
+
return Ot.get(this.istCookieName);
|
|
4341
4342
|
}
|
|
4342
4343
|
}, {
|
|
4343
4344
|
key: "writeSessionCookie",
|
|
@@ -4346,32 +4347,32 @@ var Dt = /*#__PURE__*/function () {
|
|
|
4346
4347
|
var o = e.state,
|
|
4347
4348
|
s = e.session_token,
|
|
4348
4349
|
a = e.session_jwt,
|
|
4349
|
-
c =
|
|
4350
|
+
c = It.generateCookieOpts({
|
|
4350
4351
|
expiresAt: null !== (r = null === (t = null == o ? void 0 : o.session) || void 0 === t ? void 0 : t.expires_at) && void 0 !== r ? r : "",
|
|
4351
4352
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4352
4353
|
path: this._cookiePath,
|
|
4353
4354
|
domain: this._domain
|
|
4354
4355
|
});
|
|
4355
|
-
|
|
4356
|
-
var u =
|
|
4356
|
+
Dt(this.opaqueTokenCookieName, s, c), Dt(this.jwtCookieName, a, c);
|
|
4357
|
+
var u = It.generateCookieOpts({
|
|
4357
4358
|
expiresAt: null !== (i = null === (n = null == o ? void 0 : o.session) || void 0 === n ? void 0 : n.expires_at) && void 0 !== i ? i : "",
|
|
4358
4359
|
availableToSubdomains: !this._cookieAvailableToSubdomains,
|
|
4359
4360
|
path: this._cookiePath,
|
|
4360
4361
|
domain: this._domain
|
|
4361
4362
|
});
|
|
4362
|
-
Pt(this.jwtCookieName) &&
|
|
4363
|
+
Pt(this.jwtCookieName) && Ot.remove(this.jwtCookieName, u), Pt(this.opaqueTokenCookieName) && Ot.remove(this.opaqueTokenCookieName, u), Pt(this.jwtCookieName) && qe("Could not remove extraneous JWT cookie. This might happen if the cookie has been set using multiple `path` settings, and may produce unwanted behavior."), Pt(this.opaqueTokenCookieName) && qe("Could not remove extraneous opaque token cookie.");
|
|
4363
4364
|
}
|
|
4364
4365
|
}, {
|
|
4365
4366
|
key: "writeIntermediateSessionTokenCookie",
|
|
4366
4367
|
value: function writeIntermediateSessionTokenCookie(e) {
|
|
4367
4368
|
var t = new Date(Date.now() + 6e5),
|
|
4368
|
-
r =
|
|
4369
|
+
r = It.generateCookieOpts({
|
|
4369
4370
|
expiresAt: t.toString(),
|
|
4370
4371
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4371
4372
|
path: this._cookiePath,
|
|
4372
4373
|
domain: this._domain
|
|
4373
4374
|
});
|
|
4374
|
-
|
|
4375
|
+
Dt(this.istCookieName, e, r);
|
|
4375
4376
|
}
|
|
4376
4377
|
}, {
|
|
4377
4378
|
key: "removeSessionCookie",
|
|
@@ -4390,47 +4391,38 @@ var Dt = /*#__PURE__*/function () {
|
|
|
4390
4391
|
[!0, !1].forEach(function (t) {
|
|
4391
4392
|
[_this5._cookiePath, null].forEach(function (r) {
|
|
4392
4393
|
[_this5._domain, null].forEach(function (n) {
|
|
4393
|
-
var i =
|
|
4394
|
+
var i = It.generateCookieOpts({
|
|
4394
4395
|
expiresAt: new Date(0).toString(),
|
|
4395
4396
|
availableToSubdomains: t,
|
|
4396
4397
|
path: r,
|
|
4397
4398
|
domain: n
|
|
4398
4399
|
});
|
|
4399
4400
|
e.forEach(function (e) {
|
|
4400
|
-
|
|
4401
|
+
Ot.remove(e, i);
|
|
4401
4402
|
});
|
|
4402
4403
|
});
|
|
4403
4404
|
});
|
|
4404
|
-
}), e.forEach(
|
|
4405
|
+
}), e.forEach(Et);
|
|
4405
4406
|
}
|
|
4406
4407
|
}, {
|
|
4407
4408
|
key: "syncToLocalStorage",
|
|
4408
4409
|
value: function syncToLocalStorage() {
|
|
4409
|
-
localStorage.setItem(
|
|
4410
|
+
localStorage.setItem(xt(this.publicToken), JSON.stringify(this.state));
|
|
4410
4411
|
}
|
|
4411
4412
|
}, {
|
|
4412
4413
|
key: "getItem",
|
|
4413
4414
|
value: function getItem(e) {
|
|
4414
|
-
return localStorage.getItem(
|
|
4415
|
+
return localStorage.getItem(xt(this.publicToken, e));
|
|
4415
4416
|
}
|
|
4416
4417
|
}, {
|
|
4417
4418
|
key: "setItem",
|
|
4418
4419
|
value: function setItem(e, t) {
|
|
4419
|
-
return localStorage.setItem(
|
|
4420
|
+
return localStorage.setItem(xt(this.publicToken, e), t);
|
|
4420
4421
|
}
|
|
4421
4422
|
}, {
|
|
4422
4423
|
key: "removeItem",
|
|
4423
4424
|
value: function removeItem(e) {
|
|
4424
|
-
return localStorage.removeItem(
|
|
4425
|
-
}
|
|
4426
|
-
}, {
|
|
4427
|
-
key: "markStateKeysUpdated",
|
|
4428
|
-
value: function markStateKeysUpdated(e) {
|
|
4429
|
-
var _this6 = this;
|
|
4430
|
-
var t = this.stateKeysUpdated.size;
|
|
4431
|
-
return e.forEach(function (e) {
|
|
4432
|
-
return _this6.stateKeysUpdated.add(e);
|
|
4433
|
-
}), t !== this.stateKeysUpdated.size;
|
|
4425
|
+
return localStorage.removeItem(xt(this.publicToken, e));
|
|
4434
4426
|
}
|
|
4435
4427
|
}], [{
|
|
4436
4428
|
key: "generateCookieOpts",
|
|
@@ -4446,62 +4438,65 @@ var Dt = /*#__PURE__*/function () {
|
|
|
4446
4438
|
return e && (i.path = e), Boolean("localhost" === window.location.hostname || "[::1]" === window.location.hostname || window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)) ? i.secure = !1 : (r && (i.domain = t || window.location.host), i.secure = !0), i;
|
|
4447
4439
|
}
|
|
4448
4440
|
}]);
|
|
4449
|
-
return
|
|
4441
|
+
return It;
|
|
4450
4442
|
}();
|
|
4451
|
-
var
|
|
4452
|
-
_inherits(
|
|
4453
|
-
function
|
|
4454
|
-
_classCallCheck(this,
|
|
4455
|
-
return _callSuper(this,
|
|
4443
|
+
var Rt = /*#__PURE__*/function (_It) {
|
|
4444
|
+
_inherits(Rt, _It);
|
|
4445
|
+
function Rt() {
|
|
4446
|
+
_classCallCheck(this, Rt);
|
|
4447
|
+
return _callSuper(this, Rt, arguments);
|
|
4456
4448
|
}
|
|
4457
|
-
return _createClass(
|
|
4458
|
-
}(
|
|
4459
|
-
var
|
|
4449
|
+
return _createClass(Rt);
|
|
4450
|
+
}(It);
|
|
4451
|
+
var Ft = Symbol["for"]("__stytch_b2b_DataLayer"),
|
|
4460
4452
|
jt = function jt(e, t) {
|
|
4461
4453
|
var r = function () {
|
|
4462
4454
|
var e = window;
|
|
4463
|
-
return e[
|
|
4455
|
+
return e[Ft] || (e[Ft] = {}), e[Ft];
|
|
4464
4456
|
}();
|
|
4465
|
-
return r[e] || (r[e] = new
|
|
4457
|
+
return r[e] || (r[e] = new Rt(e, t)), r[e];
|
|
4466
4458
|
},
|
|
4467
|
-
|
|
4459
|
+
Lt = function Lt(e, t) {
|
|
4468
4460
|
Object.values(e).forEach(function (e) {
|
|
4469
4461
|
return e(t);
|
|
4470
4462
|
});
|
|
4471
4463
|
},
|
|
4472
|
-
|
|
4473
|
-
var
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4464
|
+
Mt = function () {
|
|
4465
|
+
var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
4466
|
+
_ref5$KEYS_TO_EXCLUDE = _ref5.KEYS_TO_EXCLUDE,
|
|
4467
|
+
e = _ref5$KEYS_TO_EXCLUDE === void 0 ? [] : _ref5$KEYS_TO_EXCLUDE;
|
|
4468
|
+
var t = function t(r, n) {
|
|
4469
|
+
return _typeof(r) == _typeof(n) && (null === r || null === n ? r === n : "object" == _typeof(r) ? Object.keys(r).length === Object.keys(n).length && !Object.keys(r).some(function (e) {
|
|
4477
4470
|
return !(e in n);
|
|
4478
|
-
}) && Object.entries(r).filter(function (
|
|
4479
|
-
var
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4471
|
+
}) && Object.entries(r).filter(function (_ref6) {
|
|
4472
|
+
var _ref7 = _slicedToArray(_ref6, 1),
|
|
4473
|
+
t = _ref7[0];
|
|
4474
|
+
return !e.includes(t);
|
|
4475
|
+
}).every(function (_ref8) {
|
|
4476
|
+
var _ref9 = _slicedToArray(_ref8, 2),
|
|
4477
|
+
e = _ref9[0],
|
|
4478
|
+
r = _ref9[1];
|
|
4479
|
+
return t(r, n[e]);
|
|
4486
4480
|
}) : r === n);
|
|
4487
4481
|
};
|
|
4482
|
+
return t;
|
|
4488
4483
|
}({
|
|
4489
4484
|
KEYS_TO_EXCLUDE: ["last_accessed_at"]
|
|
4490
4485
|
});
|
|
4491
|
-
var
|
|
4492
|
-
function
|
|
4493
|
-
var
|
|
4494
|
-
_classCallCheck(this,
|
|
4495
|
-
this._publicToken = e, this._datalayer = t, this._listen = function (e) {
|
|
4496
|
-
if (e.key !==
|
|
4486
|
+
var Bt = /*#__PURE__*/function () {
|
|
4487
|
+
function Bt(e, t) {
|
|
4488
|
+
var _this6 = this;
|
|
4489
|
+
_classCallCheck(this, Bt);
|
|
4490
|
+
this._publicToken = e, this._datalayer = t, this.fromCache = !0, this._listen = function (e) {
|
|
4491
|
+
if (e.key !== xt(_this6._publicToken)) return;
|
|
4497
4492
|
var t = null === e.newValue || "null" === e.newValue ? null : JSON.parse(e.newValue);
|
|
4498
|
-
|
|
4493
|
+
_this6.updateState(t, !0);
|
|
4499
4494
|
}, window.addEventListener("storage", this._listen);
|
|
4500
4495
|
var _this$_datalayer$read = this._datalayer.readSessionCookie(),
|
|
4501
4496
|
r = _this$_datalayer$read.session_token;
|
|
4502
4497
|
r || this.destroySession();
|
|
4503
4498
|
}
|
|
4504
|
-
_createClass(
|
|
4499
|
+
_createClass(Bt, [{
|
|
4505
4500
|
key: "getTokens",
|
|
4506
4501
|
value: function getTokens() {
|
|
4507
4502
|
var _this$_datalayer$read2 = this._datalayer.readSessionCookie(),
|
|
@@ -4538,8 +4533,8 @@ var Mt = /*#__PURE__*/function () {
|
|
|
4538
4533
|
var t = this._datalayer.state,
|
|
4539
4534
|
r = null === e.state ? null : Object.assign(Object.assign({}, this._datalayer.state), e.state);
|
|
4540
4535
|
this._datalayer.state = r;
|
|
4541
|
-
var n =
|
|
4542
|
-
|
|
4536
|
+
var n = this.getFromCache();
|
|
4537
|
+
this.setCacheRefreshed(), !n && Mt(t, r) || Lt(this._datalayer.subscriptions, r);
|
|
4543
4538
|
}
|
|
4544
4539
|
}, {
|
|
4545
4540
|
key: "updateStateAndTokens",
|
|
@@ -4553,10 +4548,10 @@ var Mt = /*#__PURE__*/function () {
|
|
|
4553
4548
|
var r = this._datalayer.state,
|
|
4554
4549
|
n = null === e ? null : Object.assign(Object.assign({}, this._datalayer.state), e);
|
|
4555
4550
|
this._datalayer.state = n;
|
|
4556
|
-
var i =
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
(
|
|
4551
|
+
var i = this.getFromCache();
|
|
4552
|
+
this.setCacheRefreshed();
|
|
4553
|
+
var o = !Mt(r, n);
|
|
4554
|
+
(i || o) && (Lt(this._datalayer.subscriptions, n), o && !t && this._datalayer.syncToLocalStorage());
|
|
4560
4555
|
}
|
|
4561
4556
|
}, {
|
|
4562
4557
|
key: "updateTokens",
|
|
@@ -4595,40 +4590,50 @@ var Mt = /*#__PURE__*/function () {
|
|
|
4595
4590
|
value: function syncFromDeviceStorage() {
|
|
4596
4591
|
return null;
|
|
4597
4592
|
}
|
|
4593
|
+
}, {
|
|
4594
|
+
key: "getFromCache",
|
|
4595
|
+
value: function getFromCache() {
|
|
4596
|
+
return this.fromCache;
|
|
4597
|
+
}
|
|
4598
|
+
}, {
|
|
4599
|
+
key: "setCacheRefreshed",
|
|
4600
|
+
value: function setCacheRefreshed() {
|
|
4601
|
+
this.fromCache = !1;
|
|
4602
|
+
}
|
|
4598
4603
|
}]);
|
|
4599
|
-
return
|
|
4604
|
+
return Bt;
|
|
4600
4605
|
}();
|
|
4601
|
-
var
|
|
4602
|
-
_inherits(
|
|
4603
|
-
function
|
|
4604
|
-
var
|
|
4605
|
-
_classCallCheck(this,
|
|
4606
|
-
|
|
4607
|
-
return
|
|
4606
|
+
var Kt = /*#__PURE__*/function (_Bt) {
|
|
4607
|
+
_inherits(Kt, _Bt);
|
|
4608
|
+
function Kt() {
|
|
4609
|
+
var _this7;
|
|
4610
|
+
_classCallCheck(this, Kt);
|
|
4611
|
+
_this7 = _callSuper(this, Kt, arguments), _this7.updateMember = function (e) {
|
|
4612
|
+
return _this7.updateState({
|
|
4608
4613
|
member: e
|
|
4609
4614
|
});
|
|
4610
|
-
},
|
|
4615
|
+
}, _this7.getMember = function () {
|
|
4611
4616
|
var e, t;
|
|
4612
|
-
return null !== (t = null === (e =
|
|
4613
|
-
},
|
|
4614
|
-
return
|
|
4617
|
+
return null !== (t = null === (e = _this7.getState()) || void 0 === e ? void 0 : e.member) && void 0 !== t ? t : null;
|
|
4618
|
+
}, _this7.updateOrganization = function (e) {
|
|
4619
|
+
return _this7.updateState({
|
|
4615
4620
|
organization: e
|
|
4616
4621
|
});
|
|
4617
|
-
},
|
|
4622
|
+
}, _this7.getOrganization = function () {
|
|
4618
4623
|
var e, t;
|
|
4619
|
-
return null !== (t = null === (e =
|
|
4620
|
-
},
|
|
4624
|
+
return null !== (t = null === (e = _this7.getState()) || void 0 === e ? void 0 : e.organization) && void 0 !== t ? t : null;
|
|
4625
|
+
}, _this7.getSession = function () {
|
|
4621
4626
|
var e, t;
|
|
4622
|
-
return null !== (t = null === (e =
|
|
4627
|
+
return null !== (t = null === (e = _this7.getState()) || void 0 === e ? void 0 : e.session) && void 0 !== t ? t : null;
|
|
4623
4628
|
};
|
|
4624
|
-
return
|
|
4629
|
+
return _this7;
|
|
4625
4630
|
}
|
|
4626
|
-
return _createClass(
|
|
4627
|
-
}(
|
|
4628
|
-
var
|
|
4629
|
-
var
|
|
4630
|
-
var
|
|
4631
|
-
_classCallCheck(this,
|
|
4631
|
+
return _createClass(Kt);
|
|
4632
|
+
}(Bt);
|
|
4633
|
+
var zt = Symbol["for"]("stytch__internal_b2b");
|
|
4634
|
+
var Nt = /*#__PURE__*/_createClass(function Nt(e, t) {
|
|
4635
|
+
var _this8 = this;
|
|
4636
|
+
_classCallCheck(this, Nt);
|
|
4632
4637
|
var r;
|
|
4633
4638
|
!function (e) {
|
|
4634
4639
|
if ("undefined" == typeof window) throw new Error("The ".concat(e, " is not compatible with server-side environments.\nIf using nextjs, use the create").concat(e, " method instead.\n```\n").concat("import { createStytchB2BHeadlessClient } from '@stytch/nextjs/b2b';\n \n const stytch = createStytchB2BHeadlessClient('public-token-...');\n ", "\n```\n"));
|
|
@@ -4645,24 +4650,27 @@ var zt = /*#__PURE__*/_createClass(function zt(e, t) {
|
|
|
4645
4650
|
}
|
|
4646
4651
|
};
|
|
4647
4652
|
var o, s, a, c, u, l, d, h, p, f, _;
|
|
4648
|
-
this._dataLayer = jt(e, n), this._subscriptionService = new
|
|
4649
|
-
|
|
4650
|
-
|
|
4653
|
+
this._dataLayer = jt(e, n), this._subscriptionService = new Kt(e, this._dataLayer), this._stateChangeClient = new _t(this._subscriptionService, {}), this.onStateChange = function () {
|
|
4654
|
+
var _this8$_stateChangeCl;
|
|
4655
|
+
return (_this8$_stateChangeCl = _this8._stateChangeClient).onStateChange.apply(_this8$_stateChangeCl, arguments);
|
|
4656
|
+
};
|
|
4657
|
+
var m = new Ct(this._dataLayer, "passwords");
|
|
4658
|
+
this._networkClient = new wt(e, this._dataLayer, i.endpoints.sdkBackendURL, function () {
|
|
4651
4659
|
var e, t, r, n;
|
|
4652
4660
|
return {
|
|
4653
|
-
stytch_member_id: null === (t = null === (e =
|
|
4654
|
-
stytch_member_session_id: null === (n = null === (r =
|
|
4661
|
+
stytch_member_id: null === (t = null === (e = _this8._dataLayer.state) || void 0 === e ? void 0 : e.member) || void 0 === t ? void 0 : t.member_id,
|
|
4662
|
+
stytch_member_session_id: null === (n = null === (r = _this8._dataLayer.state) || void 0 === r ? void 0 : r.session) || void 0 === n ? void 0 : n.member_session_id
|
|
4655
4663
|
};
|
|
4656
4664
|
});
|
|
4657
|
-
var v = new
|
|
4658
|
-
b = new
|
|
4665
|
+
var v = new bt(e, this._networkClient, this._dataLayer),
|
|
4666
|
+
b = new kt(v.getAsync()),
|
|
4659
4667
|
g = new Ye(e, i.endpoints.dfpBackendURL, v.getAsync(), b.executeRecaptcha),
|
|
4660
|
-
k = new
|
|
4661
|
-
this.organization = new rt(this._networkClient, this._subscriptionService), this.member = new et(this._networkClient, this._subscriptionService), this.self = new et(this._networkClient, this._subscriptionService), this.session = new it(this._networkClient, this._subscriptionService), this.magicLinks = new Qe(this._networkClient, this._subscriptionService, new
|
|
4668
|
+
k = new yt(i.endpoints.clientsideServicesIframeURL);
|
|
4669
|
+
this.organization = new rt(this._networkClient, this._subscriptionService), this.member = new et(this._networkClient, this._subscriptionService), this.self = new et(this._networkClient, this._subscriptionService), this.session = new it(this._networkClient, this._subscriptionService), this.magicLinks = new Qe(this._networkClient, this._subscriptionService, new Ct(this._dataLayer, "magic_links"), m, v.getAsync(), g), this.oauth = new nt(this._networkClient, this._subscriptionService, new Ct(this._dataLayer, "oauth"), v.getAsync(), {
|
|
4662
4670
|
publicToken: e,
|
|
4663
4671
|
testAPIURL: i.endpoints.testAPIURL,
|
|
4664
4672
|
liveAPIURL: i.endpoints.liveAPIURL
|
|
4665
|
-
}, g), this.sso = new tt(this._networkClient, this._subscriptionService, new
|
|
4673
|
+
}, g), this.sso = new tt(this._networkClient, this._subscriptionService, new Ct(this._dataLayer, "sso"), v.getAsync(), {
|
|
4666
4674
|
publicToken: e,
|
|
4667
4675
|
testAPIURL: i.endpoints.testAPIURL,
|
|
4668
4676
|
liveAPIURL: i.endpoints.liveAPIURL
|
|
@@ -4677,7 +4685,7 @@ var zt = /*#__PURE__*/_createClass(function zt(e, t) {
|
|
|
4677
4685
|
}
|
|
4678
4686
|
});
|
|
4679
4687
|
(function (e, t) {
|
|
4680
|
-
Object.assign(e, _defineProperty({},
|
|
4688
|
+
Object.assign(e, _defineProperty({}, zt, t));
|
|
4681
4689
|
})(this, {
|
|
4682
4690
|
bootstrap: v,
|
|
4683
4691
|
clientsideServices: k,
|
|
@@ -4687,4 +4695,4 @@ var zt = /*#__PURE__*/_createClass(function zt(e, t) {
|
|
|
4687
4695
|
networkClient: this._networkClient
|
|
4688
4696
|
});
|
|
4689
4697
|
});
|
|
4690
|
-
export { k as AuthFlowType, y as B2BMFAProducts, w as B2BOAuthProviders, g as B2BProducts,
|
|
4698
|
+
export { k as AuthFlowType, y as B2BMFAProducts, w as B2BOAuthProviders, g as B2BProducts, ee as BiometricsFailedError, L as BiometricsUnavailableError, J as ChallengeSigningFailedError, U as DeviceCredentialsNotAllowedError, X as FailedCodeChallengeError, Q as FailedToDecryptDataError, F as InternalError, G as InvalidAuthorizationCredentialError, ie as InvalidCredentialTypeError, re as InvalidRedirectSchemeError, te as InvalidStartUrlError, se as JSONDataNotConvertibleToStringError, M as KeyInvalidatedError, B as KeystoreUnavailableError, oe as MissingAttestationObjectError, H as MissingAuthorizationCredentialIDTokenError, q as MissingGoogleClientIDError, W as MissingPKCEError, Y as MissingPublicKeyError, ne as MissingUrlError, K as NoBiometricsEnrolledError, j as NoBiometricsRegistrationError, V as NoCredentialsPresentError, R as NoCurrentSessionError, p as OAuthProviders, m as OTPMethods, _ as OneTapPositions, ce as PasskeysInvalidEncoding, ue as PasskeysMisconfigured, Z as PasskeysUnsupportedError, h as Products, b as RNUIProducts, ae as RandomNumberGenerationFailed, S as SDKAPIUnreachableError, $ as SDKNotConfiguredError, le as SignInWithAppleMisconfigured, D as StytchAPIError, E as StytchAPISchemaError, A as StytchAPIUnreachableError, Nt as StytchB2BHeadlessClient, x as StytchError, v as StytchEventType, T as StytchSDKAPIError, I as StytchSDKError, P as StytchSDKSchemaError, C as StytchSDKUsageError, O as UNRECOVERABLE_ERROR_TYPES, z as UserCancellationError, N as UserLockedOutError, f as Wallets, de as errorToStytchError };
|