@stytch/vanilla-js 4.9.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 +8 -0
- package/dist/b2b/index.esm.js +2882 -2866
- package/dist/b2b/index.headless.esm.js +510 -502
- package/dist/b2b/index.headless.js +522 -514
- package/dist/b2b/index.js +2902 -2886
- package/dist/index.esm.js +3500 -3480
- package/dist/index.headless.esm.js +608 -600
- package/dist/index.headless.js +605 -597
- package/dist/index.js +3513 -3493
- package/package.json +2 -2
|
@@ -322,107 +322,113 @@ var g,
|
|
|
322
322
|
}(),
|
|
323
323
|
V = function (e) {
|
|
324
324
|
function t() {
|
|
325
|
-
return i(this, t), s(this, t, ["
|
|
325
|
+
return i(this, t), s(this, t, ["NoCredentialsPresentError", "The user did not provide credentials for a Google OneTap attempt"]);
|
|
326
326
|
}
|
|
327
327
|
return a(t, R), r(t);
|
|
328
328
|
}(),
|
|
329
329
|
Y = function (e) {
|
|
330
330
|
function t() {
|
|
331
|
-
return i(this, t), s(this, t, ["
|
|
331
|
+
return i(this, t), s(this, t, ["MissingPublicKeyError", "Failed to retrieve the public key. Add a new biometric registration."]);
|
|
332
332
|
}
|
|
333
333
|
return a(t, R), r(t);
|
|
334
334
|
}(),
|
|
335
335
|
J = function (e) {
|
|
336
336
|
function t() {
|
|
337
|
-
return i(this, t), s(this, t, ["
|
|
337
|
+
return i(this, t), s(this, t, ["ChallengeSigningFailedError", "Failed to sign the challenge with the key."]);
|
|
338
338
|
}
|
|
339
339
|
return a(t, R), r(t);
|
|
340
340
|
}(),
|
|
341
341
|
$ = function (e) {
|
|
342
342
|
function t() {
|
|
343
|
-
return i(this, t), s(this, t, ["
|
|
343
|
+
return i(this, t), s(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, R), r(t);
|
|
346
346
|
}(),
|
|
347
347
|
X = function (e) {
|
|
348
348
|
function t() {
|
|
349
|
-
return i(this, t), s(this, t, ["
|
|
349
|
+
return i(this, t), s(this, t, ["FailedCodeChallengeError", "Failed to create a code challenge"]);
|
|
350
350
|
}
|
|
351
351
|
return a(t, R), r(t);
|
|
352
352
|
}(),
|
|
353
353
|
Z = function (e) {
|
|
354
354
|
function t() {
|
|
355
|
-
return i(this, t), s(this, t, ["
|
|
355
|
+
return i(this, t), s(this, t, ["PasskeysUnsupportedError", "Passkeys are not supported on this device"]);
|
|
356
356
|
}
|
|
357
357
|
return a(t, R), r(t);
|
|
358
358
|
}(),
|
|
359
359
|
Q = function (e) {
|
|
360
360
|
function t() {
|
|
361
|
-
return i(this, t), s(this, t, ["
|
|
361
|
+
return i(this, t), s(this, t, ["FailedToDecryptDataError", "Failed to decrypt user data"]);
|
|
362
362
|
}
|
|
363
363
|
return a(t, R), r(t);
|
|
364
364
|
}(),
|
|
365
365
|
ee = function (e) {
|
|
366
366
|
function t() {
|
|
367
|
-
return i(this, t), s(this, t, ["
|
|
367
|
+
return i(this, t), s(this, t, ["BiometricsFailedError", "Biometric authentication failed"]);
|
|
368
368
|
}
|
|
369
369
|
return a(t, R), r(t);
|
|
370
370
|
}(),
|
|
371
371
|
te = function (e) {
|
|
372
372
|
function t() {
|
|
373
|
-
return i(this, t), s(this, t, ["
|
|
373
|
+
return i(this, t), s(this, t, ["InvalidStartUrlError", "The start URL was invalid or improperly formatted."]);
|
|
374
374
|
}
|
|
375
375
|
return a(t, R), r(t);
|
|
376
376
|
}(),
|
|
377
377
|
re = function (e) {
|
|
378
378
|
function t() {
|
|
379
|
-
return i(this, t), s(this, t, ["
|
|
379
|
+
return i(this, t), s(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, R), r(t);
|
|
382
382
|
}(),
|
|
383
383
|
ne = function (e) {
|
|
384
384
|
function t() {
|
|
385
|
-
return i(this, t), s(this, t, ["
|
|
385
|
+
return i(this, t), s(this, t, ["MissingUrlError", "The underlying web authentication service failed to return a URL."]);
|
|
386
386
|
}
|
|
387
387
|
return a(t, R), r(t);
|
|
388
388
|
}(),
|
|
389
389
|
ie = function (e) {
|
|
390
390
|
function t() {
|
|
391
|
-
return i(this, t), s(this, t, ["
|
|
391
|
+
return i(this, t), s(this, t, ["InvalidCredentialTypeError", "The public key credential type was not of the expected type."]);
|
|
392
392
|
}
|
|
393
393
|
return a(t, R), r(t);
|
|
394
394
|
}(),
|
|
395
395
|
se = function (e) {
|
|
396
396
|
function t() {
|
|
397
|
-
return i(this, t), s(this, t, ["
|
|
397
|
+
return i(this, t), s(this, t, ["MissingAttestationObjectError", "The public key credential is missing the attestation object."]);
|
|
398
398
|
}
|
|
399
399
|
return a(t, R), r(t);
|
|
400
400
|
}(),
|
|
401
401
|
oe = function (e) {
|
|
402
402
|
function t() {
|
|
403
|
-
return i(this, t), s(this, t, ["
|
|
403
|
+
return i(this, t), s(this, t, ["JSONDataNotConvertibleToStringError", "JSON data unable to be converted to String type."]);
|
|
404
404
|
}
|
|
405
405
|
return a(t, R), r(t);
|
|
406
406
|
}(),
|
|
407
407
|
ae = function (e) {
|
|
408
408
|
function t() {
|
|
409
|
-
return i(this, t), s(this, t, ["
|
|
409
|
+
return i(this, t), s(this, t, ["RandomNumberGenerationFailed", "Random number generation failed"]);
|
|
410
410
|
}
|
|
411
411
|
return a(t, R), r(t);
|
|
412
412
|
}(),
|
|
413
413
|
ce = function (e) {
|
|
414
414
|
function t() {
|
|
415
|
-
return i(this, t), s(this, t, ["
|
|
415
|
+
return i(this, t), s(this, t, ["PasskeysInvalidEncoding", "Invalid passkey encoding"]);
|
|
416
416
|
}
|
|
417
417
|
return a(t, R), r(t);
|
|
418
418
|
}(),
|
|
419
419
|
ue = function (e) {
|
|
420
|
+
function t() {
|
|
421
|
+
return i(this, t), s(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, R), r(t);
|
|
424
|
+
}(),
|
|
425
|
+
le = function (e) {
|
|
420
426
|
function t() {
|
|
421
427
|
return i(this, t), s(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, R), r(t);
|
|
424
430
|
}();
|
|
425
|
-
function
|
|
431
|
+
function de(e) {
|
|
426
432
|
switch (e.message) {
|
|
427
433
|
case "internal_error":
|
|
428
434
|
return new F(e.message);
|
|
@@ -456,44 +462,46 @@ function le(e) {
|
|
|
456
462
|
case "invalid_authorization_credential":
|
|
457
463
|
return new z();
|
|
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 se();
|
|
484
|
-
case "
|
|
490
|
+
case "json_data_not_convertible_to_string":
|
|
485
491
|
return new oe();
|
|
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 R(e.name, e.message);
|
|
494
502
|
}
|
|
495
503
|
}
|
|
496
|
-
function
|
|
504
|
+
function he(e, t) {
|
|
497
505
|
return function (e) {
|
|
498
506
|
if (Array.isArray(e)) return e;
|
|
499
507
|
}(e) || function (e, t) {
|
|
@@ -522,14 +530,14 @@ function de(e, t) {
|
|
|
522
530
|
}
|
|
523
531
|
return a;
|
|
524
532
|
}
|
|
525
|
-
}(e, t) ||
|
|
533
|
+
}(e, t) || fe(e, t) || function () {
|
|
526
534
|
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
535
|
}();
|
|
528
536
|
}
|
|
529
|
-
function
|
|
537
|
+
function pe(e, t) {
|
|
530
538
|
var r = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
531
539
|
if (!r) {
|
|
532
|
-
if (Array.isArray(e) || (r =
|
|
540
|
+
if (Array.isArray(e) || (r = fe(e)) || t && e && "number" == typeof e.length) {
|
|
533
541
|
r && (e = r);
|
|
534
542
|
var _n = 0,
|
|
535
543
|
i = function i() {};
|
|
@@ -574,28 +582,28 @@ function he(e, t) {
|
|
|
574
582
|
}
|
|
575
583
|
};
|
|
576
584
|
}
|
|
577
|
-
function
|
|
585
|
+
function fe(e, t) {
|
|
578
586
|
if (e) {
|
|
579
|
-
if ("string" == typeof e) return
|
|
587
|
+
if ("string" == typeof e) return _e(e, t);
|
|
580
588
|
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
581
|
-
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) ?
|
|
589
|
+
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) ? _e(e, t) : void 0;
|
|
582
590
|
}
|
|
583
591
|
}
|
|
584
|
-
function
|
|
592
|
+
function _e(e, t) {
|
|
585
593
|
(null == t || t > e.length) && (t = e.length);
|
|
586
594
|
for (var r = 0, n = new Array(t); r < t; r++) n[r] = e[r];
|
|
587
595
|
return n;
|
|
588
596
|
}
|
|
589
|
-
function
|
|
590
|
-
return
|
|
597
|
+
function me(e) {
|
|
598
|
+
return me = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
|
|
591
599
|
return _typeof(e);
|
|
592
600
|
} : function (e) {
|
|
593
601
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
|
|
594
|
-
},
|
|
602
|
+
}, me(e);
|
|
595
603
|
}
|
|
596
|
-
function
|
|
604
|
+
function ve() {
|
|
597
605
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
598
|
-
|
|
606
|
+
ve = function ve() {
|
|
599
607
|
return t;
|
|
600
608
|
};
|
|
601
609
|
var e,
|
|
@@ -675,7 +683,7 @@ function me() {
|
|
|
675
683
|
if ("throw" !== c.type) {
|
|
676
684
|
var u = c.arg,
|
|
677
685
|
l = u.value;
|
|
678
|
-
return l && "object" ==
|
|
686
|
+
return l && "object" == me(l) && n.call(l, "__await") ? t.resolve(l.__await).then(function (e) {
|
|
679
687
|
r("next", e, o, a);
|
|
680
688
|
}, function (e) {
|
|
681
689
|
r("throw", e, o, a);
|
|
@@ -774,7 +782,7 @@ function me() {
|
|
|
774
782
|
return s.next = s;
|
|
775
783
|
}
|
|
776
784
|
}
|
|
777
|
-
throw new TypeError(
|
|
785
|
+
throw new TypeError(me(t) + " is not iterable");
|
|
778
786
|
}
|
|
779
787
|
return y.prototype = g, i(S, "constructor", {
|
|
780
788
|
value: g,
|
|
@@ -895,46 +903,46 @@ function me() {
|
|
|
895
903
|
}
|
|
896
904
|
}, t;
|
|
897
905
|
}
|
|
898
|
-
function
|
|
906
|
+
function ye(e, t) {
|
|
899
907
|
for (var r = 0; r < t.length; r++) {
|
|
900
908
|
var n = t[r];
|
|
901
|
-
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e,
|
|
909
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, be(n.key), n);
|
|
902
910
|
}
|
|
903
911
|
}
|
|
904
|
-
function
|
|
905
|
-
return t &&
|
|
912
|
+
function ge(e, t, r) {
|
|
913
|
+
return t && ye(e.prototype, t), r && ye(e, r), Object.defineProperty(e, "prototype", {
|
|
906
914
|
writable: !1
|
|
907
915
|
}), e;
|
|
908
916
|
}
|
|
909
|
-
function
|
|
917
|
+
function be(e) {
|
|
910
918
|
var t = function (e, t) {
|
|
911
|
-
if ("object" !=
|
|
919
|
+
if ("object" != me(e) || !e) return e;
|
|
912
920
|
var r = e[Symbol.toPrimitive];
|
|
913
921
|
if (void 0 !== r) {
|
|
914
922
|
var n = r.call(e, t || "default");
|
|
915
|
-
if ("object" !=
|
|
923
|
+
if ("object" != me(n)) return n;
|
|
916
924
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
917
925
|
}
|
|
918
926
|
return ("string" === t ? String : Number)(e);
|
|
919
927
|
}(e, "string");
|
|
920
|
-
return "symbol" ==
|
|
928
|
+
return "symbol" == me(t) ? t : String(t);
|
|
921
929
|
}
|
|
922
|
-
function
|
|
930
|
+
function ke(e, t) {
|
|
923
931
|
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
|
|
924
932
|
}
|
|
925
|
-
function
|
|
926
|
-
return t =
|
|
927
|
-
if (t && ("object" ===
|
|
933
|
+
function we(e, t, r) {
|
|
934
|
+
return t = Oe(t), function (e, t) {
|
|
935
|
+
if (t && ("object" === me(t) || "function" == typeof t)) return t;
|
|
928
936
|
if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
|
|
929
937
|
return function (e) {
|
|
930
938
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
931
939
|
return e;
|
|
932
940
|
}(e);
|
|
933
|
-
}(e,
|
|
941
|
+
}(e, Ce() ? Reflect.construct(t, r || [], Oe(e).constructor) : t.apply(e, r));
|
|
934
942
|
}
|
|
935
|
-
function
|
|
943
|
+
function Se(e) {
|
|
936
944
|
var t = "function" == typeof Map ? new Map() : void 0;
|
|
937
|
-
return
|
|
945
|
+
return Se = function Se(e) {
|
|
938
946
|
if (null === e || !function (e) {
|
|
939
947
|
try {
|
|
940
948
|
return -1 !== Function.toString.call(e).indexOf("[native code]");
|
|
@@ -949,12 +957,12 @@ function we(e) {
|
|
|
949
957
|
}
|
|
950
958
|
function r() {
|
|
951
959
|
return function (e, t, r) {
|
|
952
|
-
if (
|
|
960
|
+
if (Ce()) return Reflect.construct.apply(null, arguments);
|
|
953
961
|
var n = [null];
|
|
954
962
|
n.push.apply(n, t);
|
|
955
963
|
var i = new (e.bind.apply(e, n))();
|
|
956
|
-
return r &&
|
|
957
|
-
}(e, arguments,
|
|
964
|
+
return r && Te(i, r.prototype), i;
|
|
965
|
+
}(e, arguments, Oe(this).constructor);
|
|
958
966
|
}
|
|
959
967
|
return r.prototype = Object.create(e.prototype, {
|
|
960
968
|
constructor: {
|
|
@@ -963,26 +971,26 @@ function we(e) {
|
|
|
963
971
|
writable: !0,
|
|
964
972
|
configurable: !0
|
|
965
973
|
}
|
|
966
|
-
}),
|
|
967
|
-
},
|
|
974
|
+
}), Te(r, e);
|
|
975
|
+
}, Se(e);
|
|
968
976
|
}
|
|
969
|
-
function
|
|
977
|
+
function Ce() {
|
|
970
978
|
try {
|
|
971
979
|
var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
972
980
|
} catch (e) {}
|
|
973
|
-
return (
|
|
981
|
+
return (Ce = function Ce() {
|
|
974
982
|
return !!e;
|
|
975
983
|
})();
|
|
976
984
|
}
|
|
977
|
-
function
|
|
978
|
-
return
|
|
985
|
+
function Te(e, t) {
|
|
986
|
+
return Te = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) {
|
|
979
987
|
return e.__proto__ = t, e;
|
|
980
|
-
},
|
|
988
|
+
}, Te(e, t);
|
|
981
989
|
}
|
|
982
|
-
function
|
|
983
|
-
return
|
|
990
|
+
function Oe(e) {
|
|
991
|
+
return Oe = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) {
|
|
984
992
|
return e.__proto__ || Object.getPrototypeOf(e);
|
|
985
|
-
},
|
|
993
|
+
}, Oe(e);
|
|
986
994
|
}
|
|
987
995
|
!function (e) {
|
|
988
996
|
e.emailMagicLinks = "emailMagicLinks", e.sso = "sso", e.passwords = "passwords", e.oauth = "oauth";
|
|
@@ -993,10 +1001,10 @@ function Te(e) {
|
|
|
993
1001
|
}(k || (k = {})), function (e) {
|
|
994
1002
|
e.Google = "google", e.Microsoft = "microsoft";
|
|
995
1003
|
}(w || (w = {}));
|
|
996
|
-
var
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
function
|
|
1004
|
+
var Pe,
|
|
1005
|
+
Ae = "https://accounts.google.com/gsi",
|
|
1006
|
+
Ee = "".concat(Ae, "/client");
|
|
1007
|
+
function xe(e, t) {
|
|
1000
1008
|
var r = {};
|
|
1001
1009
|
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
|
|
1002
1010
|
if (null != e && "function" == typeof Object.getOwnPropertySymbols) {
|
|
@@ -1005,7 +1013,7 @@ function Ee(e, t) {
|
|
|
1005
1013
|
}
|
|
1006
1014
|
return r;
|
|
1007
1015
|
}
|
|
1008
|
-
function
|
|
1016
|
+
function De(e, t, r, n) {
|
|
1009
1017
|
return new (r || (r = Promise))(function (i, s) {
|
|
1010
1018
|
function o(e) {
|
|
1011
1019
|
try {
|
|
@@ -1032,12 +1040,12 @@ function xe(e, t, r, n) {
|
|
|
1032
1040
|
}
|
|
1033
1041
|
"function" == typeof SuppressedError && SuppressedError, function (e) {
|
|
1034
1042
|
e.RequiredCatcha = "Catcha Required";
|
|
1035
|
-
}(
|
|
1036
|
-
var
|
|
1037
|
-
|
|
1043
|
+
}(Pe || (Pe = {}));
|
|
1044
|
+
var Re,
|
|
1045
|
+
Ie = function (e) {
|
|
1038
1046
|
function t(e) {
|
|
1039
1047
|
var r;
|
|
1040
|
-
return
|
|
1048
|
+
return ke(this, t), (r = we(this, t, [e])).type = e, r;
|
|
1041
1049
|
}
|
|
1042
1050
|
return function (e, t) {
|
|
1043
1051
|
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
|
|
@@ -1049,10 +1057,10 @@ var De,
|
|
|
1049
1057
|
}
|
|
1050
1058
|
}), Object.defineProperty(e, "prototype", {
|
|
1051
1059
|
writable: !1
|
|
1052
|
-
}), t &&
|
|
1053
|
-
}(t,
|
|
1060
|
+
}), t && Te(e, t);
|
|
1061
|
+
}(t, Se(Error)), ge(t);
|
|
1054
1062
|
}();
|
|
1055
|
-
function
|
|
1063
|
+
function Fe(e) {
|
|
1056
1064
|
var t,
|
|
1057
1065
|
r = e.method,
|
|
1058
1066
|
n = e.finalURL,
|
|
@@ -1060,9 +1068,9 @@ function Ie(e) {
|
|
|
1060
1068
|
s = e.xSDKClientHeader,
|
|
1061
1069
|
o = e.xSDKParentHostHeader,
|
|
1062
1070
|
a = e.body;
|
|
1063
|
-
return
|
|
1071
|
+
return De(this, void 0, void 0, ve().mark(function e() {
|
|
1064
1072
|
var c, u, l, d, h, p;
|
|
1065
|
-
return
|
|
1073
|
+
return ve().wrap(function (e) {
|
|
1066
1074
|
for (;;) switch (e.prev = e.next) {
|
|
1067
1075
|
case 0:
|
|
1068
1076
|
return c = {
|
|
@@ -1126,7 +1134,7 @@ function Ie(e) {
|
|
|
1126
1134
|
e.next = 49;
|
|
1127
1135
|
break;
|
|
1128
1136
|
}
|
|
1129
|
-
throw new
|
|
1137
|
+
throw new Ie(Pe.RequiredCatcha);
|
|
1130
1138
|
case 49:
|
|
1131
1139
|
throw new E("Invalid response from the Stytch servers.");
|
|
1132
1140
|
case 50:
|
|
@@ -1136,43 +1144,43 @@ function Ie(e) {
|
|
|
1136
1144
|
}, e, null, [[3, 9], [15, 22], [26, 32], [38, 44]]);
|
|
1137
1145
|
}));
|
|
1138
1146
|
}
|
|
1139
|
-
var
|
|
1140
|
-
function
|
|
1141
|
-
if (!
|
|
1142
|
-
return
|
|
1147
|
+
var je = new Uint8Array(16);
|
|
1148
|
+
function Le() {
|
|
1149
|
+
if (!Re && !(Re = "undefined" != typeof crypto && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || "undefined" != typeof msCrypto && "function" == typeof msCrypto.getRandomValues && msCrypto.getRandomValues.bind(msCrypto))) throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1150
|
+
return Re(je);
|
|
1143
1151
|
}
|
|
1144
|
-
var
|
|
1145
|
-
for (var
|
|
1146
|
-
function
|
|
1152
|
+
var Be = /^(?:[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;
|
|
1153
|
+
for (var Me = [], Ne = 0; Ne < 256; ++Ne) Me.push((Ne + 256).toString(16).substr(1));
|
|
1154
|
+
function Ue(e) {
|
|
1147
1155
|
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
|
|
1148
|
-
r = (
|
|
1156
|
+
r = (Me[e[t + 0]] + Me[e[t + 1]] + Me[e[t + 2]] + Me[e[t + 3]] + "-" + Me[e[t + 4]] + Me[e[t + 5]] + "-" + Me[e[t + 6]] + Me[e[t + 7]] + "-" + Me[e[t + 8]] + Me[e[t + 9]] + "-" + Me[e[t + 10]] + Me[e[t + 11]] + Me[e[t + 12]] + Me[e[t + 13]] + Me[e[t + 14]] + Me[e[t + 15]]).toLowerCase();
|
|
1149
1157
|
if (!function (e) {
|
|
1150
|
-
return "string" == typeof e &&
|
|
1158
|
+
return "string" == typeof e && Be.test(e);
|
|
1151
1159
|
}(r)) throw TypeError("Stringified UUID is invalid");
|
|
1152
1160
|
return r;
|
|
1153
1161
|
}
|
|
1154
|
-
function
|
|
1155
|
-
var n = (e = e || {}).random || (e.rng ||
|
|
1162
|
+
function Ke(e, t, r) {
|
|
1163
|
+
var n = (e = e || {}).random || (e.rng || Le)();
|
|
1156
1164
|
if (n[6] = 15 & n[6] | 64, n[8] = 63 & n[8] | 128, t) {
|
|
1157
1165
|
r = r || 0;
|
|
1158
1166
|
for (var i = 0; i < 16; ++i) t[r + i] = n[i];
|
|
1159
1167
|
return t;
|
|
1160
1168
|
}
|
|
1161
|
-
return
|
|
1169
|
+
return Ue(n);
|
|
1162
1170
|
}
|
|
1163
|
-
var
|
|
1164
|
-
function
|
|
1165
|
-
return
|
|
1166
|
-
return
|
|
1171
|
+
var qe = {};
|
|
1172
|
+
function We(e, t) {
|
|
1173
|
+
return De(this, void 0, void 0, ve().mark(function r() {
|
|
1174
|
+
return ve().wrap(function (r) {
|
|
1167
1175
|
for (;;) switch (r.prev = r.next) {
|
|
1168
1176
|
case 0:
|
|
1169
|
-
if (void 0 ===
|
|
1177
|
+
if (void 0 === qe[e]) {
|
|
1170
1178
|
r.next = 2;
|
|
1171
1179
|
break;
|
|
1172
1180
|
}
|
|
1173
|
-
return r.abrupt("return",
|
|
1181
|
+
return r.abrupt("return", qe[e]);
|
|
1174
1182
|
case 2:
|
|
1175
|
-
return
|
|
1183
|
+
return qe[e] = Ge(e, t), r.abrupt("return", qe[e]);
|
|
1176
1184
|
case 4:
|
|
1177
1185
|
case "end":
|
|
1178
1186
|
return r.stop();
|
|
@@ -1180,10 +1188,10 @@ function qe(e, t) {
|
|
|
1180
1188
|
}, r);
|
|
1181
1189
|
}));
|
|
1182
1190
|
}
|
|
1183
|
-
function
|
|
1191
|
+
function Ge(e, t) {
|
|
1184
1192
|
return new Promise(function (r, n) {
|
|
1185
1193
|
var i = function (e) {
|
|
1186
|
-
var t =
|
|
1194
|
+
var t = He(e);
|
|
1187
1195
|
if (t[0]) return t[0];
|
|
1188
1196
|
}(e);
|
|
1189
1197
|
if (i && "true" === i.dataset.loaded) try {
|
|
@@ -1207,24 +1215,24 @@ function We(e, t) {
|
|
|
1207
1215
|
});
|
|
1208
1216
|
});
|
|
1209
1217
|
}
|
|
1210
|
-
var
|
|
1218
|
+
var He = function He(e) {
|
|
1211
1219
|
return document.querySelectorAll('script[src="'.concat(e, '"]'));
|
|
1212
1220
|
};
|
|
1213
|
-
var
|
|
1214
|
-
|
|
1215
|
-
|
|
1221
|
+
var ze,
|
|
1222
|
+
Ve = ["[Stytch]"],
|
|
1223
|
+
Ye = function Ye() {
|
|
1216
1224
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
1217
|
-
return (e = console).warn.apply(e,
|
|
1225
|
+
return (e = console).warn.apply(e, Ve.concat(r));
|
|
1218
1226
|
},
|
|
1219
|
-
|
|
1227
|
+
Je = function Je() {
|
|
1220
1228
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
1221
|
-
return (e = console).error.apply(e,
|
|
1229
|
+
return (e = console).error.apply(e, Ve.concat(r));
|
|
1222
1230
|
},
|
|
1223
|
-
|
|
1224
|
-
|
|
1231
|
+
$e = "\nYou can find your public token at https://stytch.com/dashboard/api-keys.",
|
|
1232
|
+
Xe = function Xe(e) {
|
|
1225
1233
|
var t = {
|
|
1226
1234
|
isObject: function isObject(r, n) {
|
|
1227
|
-
var i = "object" ===
|
|
1235
|
+
var i = "object" === me(n) && !Array.isArray(n) && null !== n;
|
|
1228
1236
|
if (!i) throw new C(e, r + " must be an object.");
|
|
1229
1237
|
return t;
|
|
1230
1238
|
},
|
|
@@ -1241,7 +1249,7 @@ var He,
|
|
|
1241
1249
|
isStringArray: function isStringArray(r, n) {
|
|
1242
1250
|
if (!Array.isArray(n)) throw new C(e, r + " must be an array of strings.");
|
|
1243
1251
|
var i,
|
|
1244
|
-
s =
|
|
1252
|
+
s = pe(n);
|
|
1245
1253
|
try {
|
|
1246
1254
|
for (s.s(); !(i = s.n()).done;) {
|
|
1247
1255
|
if ("string" != typeof i.value) throw new C(e, r + " must be an array of strings.");
|
|
@@ -1273,20 +1281,20 @@ var He,
|
|
|
1273
1281
|
};
|
|
1274
1282
|
return t;
|
|
1275
1283
|
},
|
|
1276
|
-
Xe = function Xe(e) {
|
|
1277
|
-
return Ee(e, ["request_id", "status_code"]);
|
|
1278
|
-
},
|
|
1279
1284
|
Ze = function Ze(e) {
|
|
1280
|
-
return
|
|
1285
|
+
return xe(e, ["request_id", "status_code"]);
|
|
1286
|
+
},
|
|
1287
|
+
Qe = function Qe(e) {
|
|
1288
|
+
return xe(e, ["__user"]);
|
|
1281
1289
|
},
|
|
1282
|
-
|
|
1290
|
+
et = ge(function e(t, r, n) {
|
|
1283
1291
|
var i = this,
|
|
1284
1292
|
s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : function () {
|
|
1285
1293
|
return Promise.resolve(void 0);
|
|
1286
1294
|
};
|
|
1287
|
-
|
|
1288
|
-
return
|
|
1289
|
-
return
|
|
1295
|
+
ke(this, e), this.bootstrapPromise = n, this.isEnabled = function () {
|
|
1296
|
+
return De(i, void 0, void 0, ve().mark(function e() {
|
|
1297
|
+
return ve().wrap(function (e) {
|
|
1290
1298
|
for (;;) switch (e.prev = e.next) {
|
|
1291
1299
|
case 0:
|
|
1292
1300
|
return e.abrupt("return", this.state.then(function (e) {
|
|
@@ -1299,9 +1307,9 @@ var He,
|
|
|
1299
1307
|
}, e, this);
|
|
1300
1308
|
}));
|
|
1301
1309
|
}, this.getTelemetryID = function () {
|
|
1302
|
-
return
|
|
1310
|
+
return De(i, void 0, void 0, ve().mark(function e() {
|
|
1303
1311
|
var t, r, n, i;
|
|
1304
|
-
return
|
|
1312
|
+
return ve().wrap(function (e) {
|
|
1305
1313
|
for (;;) switch (e.prev = e.next) {
|
|
1306
1314
|
case 0:
|
|
1307
1315
|
return e.next = 2, this.state;
|
|
@@ -1322,9 +1330,9 @@ var He,
|
|
|
1322
1330
|
}, e, this);
|
|
1323
1331
|
}));
|
|
1324
1332
|
}, this.getDFPTelemetryIDAndCaptcha = function () {
|
|
1325
|
-
return
|
|
1333
|
+
return De(i, void 0, void 0, ve().mark(function e() {
|
|
1326
1334
|
var t, r, n, i, s, o;
|
|
1327
|
-
return
|
|
1335
|
+
return ve().wrap(function (e) {
|
|
1328
1336
|
for (;;) switch (e.prev = e.next) {
|
|
1329
1337
|
case 0:
|
|
1330
1338
|
return e.next = 2, this.state;
|
|
@@ -1367,14 +1375,14 @@ var He,
|
|
|
1367
1375
|
}, e, this);
|
|
1368
1376
|
}));
|
|
1369
1377
|
}, this.retryWithCaptchaAndDFP = function (e, t) {
|
|
1370
|
-
return
|
|
1378
|
+
return De(i, void 0, void 0, ve().mark(function r() {
|
|
1371
1379
|
var n, i, s;
|
|
1372
|
-
return
|
|
1380
|
+
return ve().wrap(function (r) {
|
|
1373
1381
|
for (;;) switch (r.prev = r.next) {
|
|
1374
1382
|
case 0:
|
|
1375
1383
|
return r.next = 2, this.state;
|
|
1376
1384
|
case 2:
|
|
1377
|
-
if (n = r.sent, i = n.enabled, s = n.executeRecaptcha, e.type !==
|
|
1385
|
+
if (n = r.sent, i = n.enabled, s = n.executeRecaptcha, e.type !== Pe.RequiredCatcha || !i) {
|
|
1378
1386
|
r.next = 14;
|
|
1379
1387
|
break;
|
|
1380
1388
|
}
|
|
@@ -1398,8 +1406,8 @@ var He,
|
|
|
1398
1406
|
}, r, this);
|
|
1399
1407
|
}));
|
|
1400
1408
|
}, this.state = n.then(function (e) {
|
|
1401
|
-
return
|
|
1402
|
-
return
|
|
1409
|
+
return De(i, void 0, void 0, ve().mark(function n() {
|
|
1410
|
+
return ve().wrap(function (n) {
|
|
1403
1411
|
for (;;) switch (n.prev = n.next) {
|
|
1404
1412
|
case 0:
|
|
1405
1413
|
if (e.runDFPProtectedAuth) {
|
|
@@ -1414,7 +1422,7 @@ var He,
|
|
|
1414
1422
|
executeRecaptcha: s
|
|
1415
1423
|
});
|
|
1416
1424
|
case 2:
|
|
1417
|
-
return n.next = 4,
|
|
1425
|
+
return n.next = 4, We("".concat("https://elements.stytch.com", "/telemetry.js"), function () {
|
|
1418
1426
|
return window.GetTelemetryID;
|
|
1419
1427
|
});
|
|
1420
1428
|
case 4:
|
|
@@ -1434,11 +1442,11 @@ var He,
|
|
|
1434
1442
|
}));
|
|
1435
1443
|
});
|
|
1436
1444
|
}),
|
|
1437
|
-
|
|
1445
|
+
tt = function tt() {
|
|
1438
1446
|
return {
|
|
1439
1447
|
isEnabled: function isEnabled() {
|
|
1440
|
-
return
|
|
1441
|
-
return
|
|
1448
|
+
return De(void 0, void 0, void 0, ve().mark(function e() {
|
|
1449
|
+
return ve().wrap(function (e) {
|
|
1442
1450
|
for (;;) switch (e.prev = e.next) {
|
|
1443
1451
|
case 0:
|
|
1444
1452
|
return e.abrupt("return", !1);
|
|
@@ -1450,8 +1458,8 @@ var He,
|
|
|
1450
1458
|
}));
|
|
1451
1459
|
},
|
|
1452
1460
|
getTelemetryID: function getTelemetryID() {
|
|
1453
|
-
return
|
|
1454
|
-
return
|
|
1461
|
+
return De(void 0, void 0, void 0, ve().mark(function e() {
|
|
1462
|
+
return ve().wrap(function (e) {
|
|
1455
1463
|
for (;;) switch (e.prev = e.next) {
|
|
1456
1464
|
case 0:
|
|
1457
1465
|
return e.abrupt("return", void 0);
|
|
@@ -1463,8 +1471,8 @@ var He,
|
|
|
1463
1471
|
}));
|
|
1464
1472
|
},
|
|
1465
1473
|
getDFPTelemetryIDAndCaptcha: function getDFPTelemetryIDAndCaptcha() {
|
|
1466
|
-
return
|
|
1467
|
-
return
|
|
1474
|
+
return De(void 0, void 0, void 0, ve().mark(function e() {
|
|
1475
|
+
return ve().wrap(function (e) {
|
|
1468
1476
|
for (;;) switch (e.prev = e.next) {
|
|
1469
1477
|
case 0:
|
|
1470
1478
|
return e.abrupt("return", {
|
|
@@ -1479,8 +1487,8 @@ var He,
|
|
|
1479
1487
|
}));
|
|
1480
1488
|
},
|
|
1481
1489
|
retryWithCaptchaAndDFP: function retryWithCaptchaAndDFP() {
|
|
1482
|
-
return
|
|
1483
|
-
return
|
|
1490
|
+
return De(void 0, void 0, void 0, ve().mark(function e() {
|
|
1491
|
+
return ve().wrap(function (e) {
|
|
1484
1492
|
for (;;) switch (e.prev = e.next) {
|
|
1485
1493
|
case 0:
|
|
1486
1494
|
throw new Error("DFP protected auth is disabled");
|
|
@@ -1493,11 +1501,11 @@ var He,
|
|
|
1493
1501
|
}
|
|
1494
1502
|
};
|
|
1495
1503
|
},
|
|
1496
|
-
|
|
1504
|
+
rt = function () {
|
|
1497
1505
|
function e() {
|
|
1498
|
-
|
|
1506
|
+
ke(this, e);
|
|
1499
1507
|
}
|
|
1500
|
-
return
|
|
1508
|
+
return ge(e, null, [{
|
|
1501
1509
|
key: "marshall",
|
|
1502
1510
|
value: function value(e) {
|
|
1503
1511
|
return Object.assign(Object.assign({}, e), {
|
|
@@ -1545,11 +1553,11 @@ var He,
|
|
|
1545
1553
|
}
|
|
1546
1554
|
}]), e;
|
|
1547
1555
|
}(),
|
|
1548
|
-
|
|
1556
|
+
nt = function () {
|
|
1549
1557
|
function e(t) {
|
|
1550
|
-
|
|
1558
|
+
ke(this, e), this.maxBatchSize = t.maxBatchSize, this.logEventURL = t.logEventURL, setInterval(this.flush.bind(this), t.intervalDurationMs), this.batch = [];
|
|
1551
1559
|
}
|
|
1552
|
-
return
|
|
1560
|
+
return ge(e, [{
|
|
1553
1561
|
key: "logEvent",
|
|
1554
1562
|
value: function value(e, t) {
|
|
1555
1563
|
this.batch.push({
|
|
@@ -1560,9 +1568,9 @@ var He,
|
|
|
1560
1568
|
}, {
|
|
1561
1569
|
key: "flush",
|
|
1562
1570
|
value: function value() {
|
|
1563
|
-
return
|
|
1571
|
+
return De(this, void 0, void 0, ve().mark(function e() {
|
|
1564
1572
|
var t;
|
|
1565
|
-
return
|
|
1573
|
+
return ve().wrap(function (e) {
|
|
1566
1574
|
for (;;) switch (e.prev = e.next) {
|
|
1567
1575
|
case 0:
|
|
1568
1576
|
if (this.batch.length) {
|
|
@@ -1594,13 +1602,13 @@ var He,
|
|
|
1594
1602
|
}();
|
|
1595
1603
|
!function (e) {
|
|
1596
1604
|
e.LoginOrCreateEML = "login_or_create_eml", e.LoginOrCreateOTP = "login_or_create_otp", e.ResetPassword = "reset_password";
|
|
1597
|
-
}(
|
|
1598
|
-
var
|
|
1605
|
+
}(ze || (ze = {}));
|
|
1606
|
+
var it = ge(function e(t, r) {
|
|
1599
1607
|
var n = this;
|
|
1600
|
-
|
|
1601
|
-
return
|
|
1608
|
+
ke(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
|
|
1609
|
+
return De(n, void 0, void 0, ve().mark(function e() {
|
|
1602
1610
|
var t, r;
|
|
1603
|
-
return
|
|
1611
|
+
return ve().wrap(function (e) {
|
|
1604
1612
|
for (;;) switch (e.prev = e.next) {
|
|
1605
1613
|
case 0:
|
|
1606
1614
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1609,7 +1617,7 @@ var nt = ye(function e(t, r) {
|
|
|
1609
1617
|
method: "GET"
|
|
1610
1618
|
});
|
|
1611
1619
|
case 2:
|
|
1612
|
-
return t = e.sent, r =
|
|
1620
|
+
return t = e.sent, r = Ze(t), this._subscriptionService.updateUser(r), e.abrupt("return", r);
|
|
1613
1621
|
case 6:
|
|
1614
1622
|
case "end":
|
|
1615
1623
|
return e.stop();
|
|
@@ -1624,19 +1632,19 @@ var nt = ye(function e(t, r) {
|
|
|
1624
1632
|
fromCache: n._subscriptionService.getFromCache()
|
|
1625
1633
|
};
|
|
1626
1634
|
}, this.update = function (e) {
|
|
1627
|
-
return
|
|
1635
|
+
return De(n, void 0, void 0, ve().mark(function t() {
|
|
1628
1636
|
var r, n;
|
|
1629
|
-
return
|
|
1637
|
+
return ve().wrap(function (t) {
|
|
1630
1638
|
for (;;) switch (t.prev = t.next) {
|
|
1631
1639
|
case 0:
|
|
1632
|
-
return
|
|
1640
|
+
return Xe("stytch.user.update").isOptionalObject("untrusted_metadata", e.untrusted_metadata), t.next = 3, this._networkClient.fetchSDK({
|
|
1633
1641
|
url: "/users/me",
|
|
1634
1642
|
body: e,
|
|
1635
1643
|
errorMessage: "Failed to update user.",
|
|
1636
1644
|
method: "PUT"
|
|
1637
1645
|
});
|
|
1638
1646
|
case 3:
|
|
1639
|
-
return r = t.sent, n =
|
|
1647
|
+
return r = t.sent, n = Ze(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Qe(r));
|
|
1640
1648
|
case 7:
|
|
1641
1649
|
case "end":
|
|
1642
1650
|
return t.stop();
|
|
@@ -1644,9 +1652,9 @@ var nt = ye(function e(t, r) {
|
|
|
1644
1652
|
}, t, this);
|
|
1645
1653
|
}));
|
|
1646
1654
|
}, this.deleteEmail = function (e) {
|
|
1647
|
-
return
|
|
1655
|
+
return De(n, void 0, void 0, ve().mark(function t() {
|
|
1648
1656
|
var r, n;
|
|
1649
|
-
return
|
|
1657
|
+
return ve().wrap(function (t) {
|
|
1650
1658
|
for (;;) switch (t.prev = t.next) {
|
|
1651
1659
|
case 0:
|
|
1652
1660
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1655,7 +1663,7 @@ var nt = ye(function e(t, r) {
|
|
|
1655
1663
|
method: "DELETE"
|
|
1656
1664
|
});
|
|
1657
1665
|
case 2:
|
|
1658
|
-
return r = t.sent, n =
|
|
1666
|
+
return r = t.sent, n = Ze(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Qe(r));
|
|
1659
1667
|
case 6:
|
|
1660
1668
|
case "end":
|
|
1661
1669
|
return t.stop();
|
|
@@ -1663,9 +1671,9 @@ var nt = ye(function e(t, r) {
|
|
|
1663
1671
|
}, t, this);
|
|
1664
1672
|
}));
|
|
1665
1673
|
}, this.deletePhoneNumber = function (e) {
|
|
1666
|
-
return
|
|
1674
|
+
return De(n, void 0, void 0, ve().mark(function t() {
|
|
1667
1675
|
var r, n;
|
|
1668
|
-
return
|
|
1676
|
+
return ve().wrap(function (t) {
|
|
1669
1677
|
for (;;) switch (t.prev = t.next) {
|
|
1670
1678
|
case 0:
|
|
1671
1679
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1674,7 +1682,7 @@ var nt = ye(function e(t, r) {
|
|
|
1674
1682
|
method: "DELETE"
|
|
1675
1683
|
});
|
|
1676
1684
|
case 2:
|
|
1677
|
-
return r = t.sent, n =
|
|
1685
|
+
return r = t.sent, n = Ze(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Qe(r));
|
|
1678
1686
|
case 6:
|
|
1679
1687
|
case "end":
|
|
1680
1688
|
return t.stop();
|
|
@@ -1682,9 +1690,9 @@ var nt = ye(function e(t, r) {
|
|
|
1682
1690
|
}, t, this);
|
|
1683
1691
|
}));
|
|
1684
1692
|
}, this.deleteTOTP = function (e) {
|
|
1685
|
-
return
|
|
1693
|
+
return De(n, void 0, void 0, ve().mark(function t() {
|
|
1686
1694
|
var r, n;
|
|
1687
|
-
return
|
|
1695
|
+
return ve().wrap(function (t) {
|
|
1688
1696
|
for (;;) switch (t.prev = t.next) {
|
|
1689
1697
|
case 0:
|
|
1690
1698
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1693,7 +1701,7 @@ var nt = ye(function e(t, r) {
|
|
|
1693
1701
|
method: "DELETE"
|
|
1694
1702
|
});
|
|
1695
1703
|
case 2:
|
|
1696
|
-
return r = t.sent, n =
|
|
1704
|
+
return r = t.sent, n = Ze(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Qe(r));
|
|
1697
1705
|
case 6:
|
|
1698
1706
|
case "end":
|
|
1699
1707
|
return t.stop();
|
|
@@ -1701,9 +1709,9 @@ var nt = ye(function e(t, r) {
|
|
|
1701
1709
|
}, t, this);
|
|
1702
1710
|
}));
|
|
1703
1711
|
}, this.deleteOAuthRegistration = function (e) {
|
|
1704
|
-
return
|
|
1712
|
+
return De(n, void 0, void 0, ve().mark(function t() {
|
|
1705
1713
|
var r, n;
|
|
1706
|
-
return
|
|
1714
|
+
return ve().wrap(function (t) {
|
|
1707
1715
|
for (;;) switch (t.prev = t.next) {
|
|
1708
1716
|
case 0:
|
|
1709
1717
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1712,7 +1720,7 @@ var nt = ye(function e(t, r) {
|
|
|
1712
1720
|
method: "DELETE"
|
|
1713
1721
|
});
|
|
1714
1722
|
case 2:
|
|
1715
|
-
return r = t.sent, n =
|
|
1723
|
+
return r = t.sent, n = Ze(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Qe(r));
|
|
1716
1724
|
case 6:
|
|
1717
1725
|
case "end":
|
|
1718
1726
|
return t.stop();
|
|
@@ -1720,9 +1728,9 @@ var nt = ye(function e(t, r) {
|
|
|
1720
1728
|
}, t, this);
|
|
1721
1729
|
}));
|
|
1722
1730
|
}, this.deleteWebauthnRegistration = function (e) {
|
|
1723
|
-
return
|
|
1731
|
+
return De(n, void 0, void 0, ve().mark(function t() {
|
|
1724
1732
|
var r, n;
|
|
1725
|
-
return
|
|
1733
|
+
return ve().wrap(function (t) {
|
|
1726
1734
|
for (;;) switch (t.prev = t.next) {
|
|
1727
1735
|
case 0:
|
|
1728
1736
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1731,7 +1739,7 @@ var nt = ye(function e(t, r) {
|
|
|
1731
1739
|
method: "DELETE"
|
|
1732
1740
|
});
|
|
1733
1741
|
case 2:
|
|
1734
|
-
return r = t.sent, n =
|
|
1742
|
+
return r = t.sent, n = Ze(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Qe(r));
|
|
1735
1743
|
case 6:
|
|
1736
1744
|
case "end":
|
|
1737
1745
|
return t.stop();
|
|
@@ -1739,9 +1747,9 @@ var nt = ye(function e(t, r) {
|
|
|
1739
1747
|
}, t, this);
|
|
1740
1748
|
}));
|
|
1741
1749
|
}, this.deleteBiometricRegistration = function (e) {
|
|
1742
|
-
return
|
|
1750
|
+
return De(n, void 0, void 0, ve().mark(function t() {
|
|
1743
1751
|
var r, n;
|
|
1744
|
-
return
|
|
1752
|
+
return ve().wrap(function (t) {
|
|
1745
1753
|
for (;;) switch (t.prev = t.next) {
|
|
1746
1754
|
case 0:
|
|
1747
1755
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1750,7 +1758,7 @@ var nt = ye(function e(t, r) {
|
|
|
1750
1758
|
method: "DELETE"
|
|
1751
1759
|
});
|
|
1752
1760
|
case 2:
|
|
1753
|
-
return r = t.sent, n =
|
|
1761
|
+
return r = t.sent, n = Ze(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Qe(r));
|
|
1754
1762
|
case 6:
|
|
1755
1763
|
case "end":
|
|
1756
1764
|
return t.stop();
|
|
@@ -1765,10 +1773,10 @@ var nt = ye(function e(t, r) {
|
|
|
1765
1773
|
});
|
|
1766
1774
|
};
|
|
1767
1775
|
}),
|
|
1768
|
-
|
|
1776
|
+
st = function () {
|
|
1769
1777
|
function e(t, r) {
|
|
1770
1778
|
var n = this;
|
|
1771
|
-
|
|
1779
|
+
ke(this, e), this._networkClient = t, this._subscriptionService = r, this.getSync = function () {
|
|
1772
1780
|
return n._subscriptionService.getSession();
|
|
1773
1781
|
}, this.getInfo = function () {
|
|
1774
1782
|
return {
|
|
@@ -1782,9 +1790,9 @@ var nt = ye(function e(t, r) {
|
|
|
1782
1790
|
(null == r ? void 0 : r.session) !== t && (t = null !== (n = null == r ? void 0 : r.session) && void 0 !== n ? n : null, e(t));
|
|
1783
1791
|
});
|
|
1784
1792
|
}, this.revoke = function (e) {
|
|
1785
|
-
return
|
|
1793
|
+
return De(n, void 0, void 0, ve().mark(function t() {
|
|
1786
1794
|
var r;
|
|
1787
|
-
return
|
|
1795
|
+
return ve().wrap(function (t) {
|
|
1788
1796
|
for (;;) switch (t.prev = t.next) {
|
|
1789
1797
|
case 0:
|
|
1790
1798
|
return t.prev = 0, t.next = 3, this._networkClient.fetchSDK({
|
|
@@ -1803,13 +1811,13 @@ var nt = ye(function e(t, r) {
|
|
|
1803
1811
|
}, t, this, [[0, 8]]);
|
|
1804
1812
|
}));
|
|
1805
1813
|
}, this.authenticate = function (e) {
|
|
1806
|
-
return
|
|
1814
|
+
return De(n, void 0, void 0, ve().mark(function t() {
|
|
1807
1815
|
var r,
|
|
1808
1816
|
n,
|
|
1809
1817
|
i,
|
|
1810
1818
|
s,
|
|
1811
1819
|
o = this;
|
|
1812
|
-
return
|
|
1820
|
+
return ve().wrap(function (t) {
|
|
1813
1821
|
for (;;) switch (t.prev = t.next) {
|
|
1814
1822
|
case 0:
|
|
1815
1823
|
return r = this._subscriptionService.getSession(), n = function n() {
|
|
@@ -1838,7 +1846,7 @@ var nt = ye(function e(t, r) {
|
|
|
1838
1846
|
session_token: s.session_token,
|
|
1839
1847
|
session_jwt: s.session_jwt,
|
|
1840
1848
|
intermediate_session_token: null
|
|
1841
|
-
}), t.abrupt("return",
|
|
1849
|
+
}), t.abrupt("return", Qe(s));
|
|
1842
1850
|
case 13:
|
|
1843
1851
|
if (t.prev = 13, t.t0 = t["catch"](2), !n()) {
|
|
1844
1852
|
t.next = 17;
|
|
@@ -1855,7 +1863,7 @@ var nt = ye(function e(t, r) {
|
|
|
1855
1863
|
}));
|
|
1856
1864
|
};
|
|
1857
1865
|
}
|
|
1858
|
-
return
|
|
1866
|
+
return ge(e, [{
|
|
1859
1867
|
key: "getTokens",
|
|
1860
1868
|
value: function value() {
|
|
1861
1869
|
return this._subscriptionService.getTokens();
|
|
@@ -1867,20 +1875,20 @@ var nt = ye(function e(t, r) {
|
|
|
1867
1875
|
}
|
|
1868
1876
|
}]), e;
|
|
1869
1877
|
}(),
|
|
1870
|
-
|
|
1878
|
+
ot = Promise.resolve({
|
|
1871
1879
|
pkceRequiredForEmailMagicLinks: !1
|
|
1872
1880
|
}),
|
|
1873
|
-
|
|
1881
|
+
at = function () {
|
|
1874
1882
|
function e(t, r, n, i) {
|
|
1875
1883
|
var s = this,
|
|
1876
|
-
o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] :
|
|
1877
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
1878
|
-
|
|
1884
|
+
o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : ot,
|
|
1885
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : tt();
|
|
1886
|
+
ke(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._passwordResetPKCEManager = i, this._config = o, this.dfpProtectedAuth = a, this.email = {
|
|
1879
1887
|
loginOrCreate: function loginOrCreate(e) {
|
|
1880
1888
|
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
1881
|
-
return
|
|
1889
|
+
return De(s, void 0, void 0, ve().mark(function r() {
|
|
1882
1890
|
var n, i, s, o, a, c, u;
|
|
1883
|
-
return
|
|
1891
|
+
return ve().wrap(function (r) {
|
|
1884
1892
|
for (;;) switch (r.prev = r.next) {
|
|
1885
1893
|
case 0:
|
|
1886
1894
|
return r.next = 2, this._config;
|
|
@@ -1916,9 +1924,9 @@ var nt = ye(function e(t, r) {
|
|
|
1916
1924
|
},
|
|
1917
1925
|
send: function send(e) {
|
|
1918
1926
|
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
1919
|
-
return
|
|
1927
|
+
return De(s, void 0, void 0, ve().mark(function r() {
|
|
1920
1928
|
var n, i, s, o, a, c, u, l, d;
|
|
1921
|
-
return
|
|
1929
|
+
return ve().wrap(function (r) {
|
|
1922
1930
|
for (;;) switch (r.prev = r.next) {
|
|
1923
1931
|
case 0:
|
|
1924
1932
|
return r.next = 2, this._config;
|
|
@@ -1953,12 +1961,12 @@ var nt = ye(function e(t, r) {
|
|
|
1953
1961
|
}));
|
|
1954
1962
|
}
|
|
1955
1963
|
}, this.authenticate = function (e, t) {
|
|
1956
|
-
return
|
|
1964
|
+
return De(s, void 0, void 0, ve().mark(function r() {
|
|
1957
1965
|
var n, i;
|
|
1958
|
-
return
|
|
1966
|
+
return ve().wrap(function (r) {
|
|
1959
1967
|
for (;;) switch (r.prev = r.next) {
|
|
1960
1968
|
case 0:
|
|
1961
|
-
return
|
|
1969
|
+
return Xe("stytch.magicLinks.authenticate").isString("Token", e).isNumber("session_duration_minutes", t.session_duration_minutes), r.next = 3, this._passwordResetPKCEManager.getPKPair();
|
|
1962
1970
|
case 3:
|
|
1963
1971
|
if (n = r.sent, i = null, !(null == n ? void 0 : n.code_verifier)) {
|
|
1964
1972
|
r.next = 19;
|
|
@@ -1998,7 +2006,7 @@ var nt = ye(function e(t, r) {
|
|
|
1998
2006
|
session_token: i.session_token,
|
|
1999
2007
|
session_jwt: i.session_jwt,
|
|
2000
2008
|
intermediate_session_token: null
|
|
2001
|
-
}), r.abrupt("return",
|
|
2009
|
+
}), r.abrupt("return", Qe(i));
|
|
2002
2010
|
case 25:
|
|
2003
2011
|
case "end":
|
|
2004
2012
|
return r.stop();
|
|
@@ -2007,12 +2015,12 @@ var nt = ye(function e(t, r) {
|
|
|
2007
2015
|
}));
|
|
2008
2016
|
};
|
|
2009
2017
|
}
|
|
2010
|
-
return
|
|
2018
|
+
return ge(e, [{
|
|
2011
2019
|
key: "getCodeChallenge",
|
|
2012
2020
|
value: function value() {
|
|
2013
|
-
return
|
|
2021
|
+
return De(this, void 0, void 0, ve().mark(function e() {
|
|
2014
2022
|
var t;
|
|
2015
|
-
return
|
|
2023
|
+
return ve().wrap(function (e) {
|
|
2016
2024
|
for (;;) switch (e.prev = e.next) {
|
|
2017
2025
|
case 0:
|
|
2018
2026
|
return e.next = 2, this._pkceManager.getPKPair();
|
|
@@ -2036,9 +2044,9 @@ var nt = ye(function e(t, r) {
|
|
|
2036
2044
|
}, {
|
|
2037
2045
|
key: "handlePKCEForAuthenticate",
|
|
2038
2046
|
value: function value(e, t) {
|
|
2039
|
-
return
|
|
2047
|
+
return De(this, void 0, void 0, ve().mark(function r() {
|
|
2040
2048
|
var n, i, s;
|
|
2041
|
-
return
|
|
2049
|
+
return ve().wrap(function (r) {
|
|
2042
2050
|
for (;;) switch (r.prev = r.next) {
|
|
2043
2051
|
case 0:
|
|
2044
2052
|
return r.next = 2, e.getPKPair();
|
|
@@ -2062,17 +2070,17 @@ var nt = ye(function e(t, r) {
|
|
|
2062
2070
|
}
|
|
2063
2071
|
}]), e;
|
|
2064
2072
|
}(),
|
|
2065
|
-
|
|
2073
|
+
ct = ge(function e(t, r) {
|
|
2066
2074
|
var n = this,
|
|
2067
2075
|
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : function () {
|
|
2068
2076
|
return Promise.resolve(void 0);
|
|
2069
2077
|
},
|
|
2070
|
-
s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] :
|
|
2071
|
-
|
|
2078
|
+
s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : tt();
|
|
2079
|
+
ke(this, e), this._networkClient = t, this._subscriptionService = r, this.executeRecaptcha = i, this.dfpProtectedAuth = s, this.sms = {
|
|
2072
2080
|
loginOrCreate: function loginOrCreate(e, t) {
|
|
2073
|
-
return
|
|
2081
|
+
return De(n, void 0, void 0, ve().mark(function r() {
|
|
2074
2082
|
var n, i, s, o;
|
|
2075
|
-
return
|
|
2083
|
+
return ve().wrap(function (r) {
|
|
2076
2084
|
for (;;) switch (r.prev = r.next) {
|
|
2077
2085
|
case 0:
|
|
2078
2086
|
return r.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
@@ -2096,9 +2104,9 @@ var nt = ye(function e(t, r) {
|
|
|
2096
2104
|
}));
|
|
2097
2105
|
},
|
|
2098
2106
|
send: function send(e, t) {
|
|
2099
|
-
return
|
|
2107
|
+
return De(n, void 0, void 0, ve().mark(function r() {
|
|
2100
2108
|
var n, i, s, o, a, c;
|
|
2101
|
-
return
|
|
2109
|
+
return ve().wrap(function (r) {
|
|
2102
2110
|
for (;;) switch (r.prev = r.next) {
|
|
2103
2111
|
case 0:
|
|
2104
2112
|
return r.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
@@ -2123,9 +2131,9 @@ var nt = ye(function e(t, r) {
|
|
|
2123
2131
|
}
|
|
2124
2132
|
}, this.whatsapp = {
|
|
2125
2133
|
loginOrCreate: function loginOrCreate(e, t) {
|
|
2126
|
-
return
|
|
2134
|
+
return De(n, void 0, void 0, ve().mark(function r() {
|
|
2127
2135
|
var n, i, s, o;
|
|
2128
|
-
return
|
|
2136
|
+
return ve().wrap(function (r) {
|
|
2129
2137
|
for (;;) switch (r.prev = r.next) {
|
|
2130
2138
|
case 0:
|
|
2131
2139
|
return r.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
@@ -2149,9 +2157,9 @@ var nt = ye(function e(t, r) {
|
|
|
2149
2157
|
}));
|
|
2150
2158
|
},
|
|
2151
2159
|
send: function send(e, t) {
|
|
2152
|
-
return
|
|
2160
|
+
return De(n, void 0, void 0, ve().mark(function r() {
|
|
2153
2161
|
var n, i, s, o, a, c;
|
|
2154
|
-
return
|
|
2162
|
+
return ve().wrap(function (r) {
|
|
2155
2163
|
for (;;) switch (r.prev = r.next) {
|
|
2156
2164
|
case 0:
|
|
2157
2165
|
return r.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
@@ -2176,9 +2184,9 @@ var nt = ye(function e(t, r) {
|
|
|
2176
2184
|
}
|
|
2177
2185
|
}, this.email = {
|
|
2178
2186
|
loginOrCreate: function loginOrCreate(e, t) {
|
|
2179
|
-
return
|
|
2187
|
+
return De(n, void 0, void 0, ve().mark(function r() {
|
|
2180
2188
|
var n, i;
|
|
2181
|
-
return
|
|
2189
|
+
return ve().wrap(function (r) {
|
|
2182
2190
|
for (;;) switch (r.prev = r.next) {
|
|
2183
2191
|
case 0:
|
|
2184
2192
|
return r.next = 2, this.executeRecaptcha();
|
|
@@ -2200,9 +2208,9 @@ var nt = ye(function e(t, r) {
|
|
|
2200
2208
|
}));
|
|
2201
2209
|
},
|
|
2202
2210
|
send: function send(e, t) {
|
|
2203
|
-
return
|
|
2211
|
+
return De(n, void 0, void 0, ve().mark(function r() {
|
|
2204
2212
|
var n, i, s, o;
|
|
2205
|
-
return
|
|
2213
|
+
return ve().wrap(function (r) {
|
|
2206
2214
|
for (;;) switch (r.prev = r.next) {
|
|
2207
2215
|
case 0:
|
|
2208
2216
|
return r.next = 2, this.executeRecaptcha();
|
|
@@ -2224,12 +2232,12 @@ var nt = ye(function e(t, r) {
|
|
|
2224
2232
|
}));
|
|
2225
2233
|
}
|
|
2226
2234
|
}, this.authenticate = function (e, t, r) {
|
|
2227
|
-
return
|
|
2235
|
+
return De(n, void 0, void 0, ve().mark(function n() {
|
|
2228
2236
|
var i, s, o, a, c;
|
|
2229
|
-
return
|
|
2237
|
+
return ve().wrap(function (n) {
|
|
2230
2238
|
for (;;) switch (n.prev = n.next) {
|
|
2231
2239
|
case 0:
|
|
2232
|
-
return
|
|
2240
|
+
return Xe("stytch.otps.authenticate").isString("Code", e).isNumber("session_duration_minutes", r.session_duration_minutes), n.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2233
2241
|
case 3:
|
|
2234
2242
|
return i = n.sent, s = i.dfp_telemetry_id, o = i.captcha_token, a = Object.assign({
|
|
2235
2243
|
token: e,
|
|
@@ -2252,7 +2260,7 @@ var nt = ye(function e(t, r) {
|
|
|
2252
2260
|
session_token: c.session_token,
|
|
2253
2261
|
session_jwt: c.session_jwt,
|
|
2254
2262
|
intermediate_session_token: null
|
|
2255
|
-
}), n.abrupt("return",
|
|
2263
|
+
}), n.abrupt("return", Qe(c));
|
|
2256
2264
|
case 12:
|
|
2257
2265
|
case "end":
|
|
2258
2266
|
return n.stop();
|
|
@@ -2261,9 +2269,9 @@ var nt = ye(function e(t, r) {
|
|
|
2261
2269
|
}));
|
|
2262
2270
|
};
|
|
2263
2271
|
}),
|
|
2264
|
-
|
|
2272
|
+
ut = function () {
|
|
2265
2273
|
function e(t, r, n, i, s) {
|
|
2266
|
-
|
|
2274
|
+
ke(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = s, this.google = {
|
|
2267
2275
|
start: this.startOAuthFlow(p.Google)
|
|
2268
2276
|
}, this.apple = {
|
|
2269
2277
|
start: this.startOAuthFlow(p.Apple)
|
|
@@ -2303,17 +2311,17 @@ var nt = ye(function e(t, r) {
|
|
|
2303
2311
|
start: this.startOAuthFlow(p.Yahoo)
|
|
2304
2312
|
};
|
|
2305
2313
|
}
|
|
2306
|
-
return
|
|
2314
|
+
return ge(e, [{
|
|
2307
2315
|
key: "authenticate",
|
|
2308
2316
|
value: function value(e, t) {
|
|
2309
|
-
return
|
|
2317
|
+
return De(this, void 0, void 0, ve().mark(function r() {
|
|
2310
2318
|
var n, i;
|
|
2311
|
-
return
|
|
2319
|
+
return ve().wrap(function (r) {
|
|
2312
2320
|
for (;;) switch (r.prev = r.next) {
|
|
2313
2321
|
case 0:
|
|
2314
|
-
return
|
|
2322
|
+
return Xe("stytch.oauth.authenticate").isString("Token", e).isNumber("session_duration_minutes", t.session_duration_minutes), r.next = 3, this._pkceManager.getPKPair();
|
|
2315
2323
|
case 3:
|
|
2316
|
-
return (n = r.sent) ||
|
|
2324
|
+
return (n = r.sent) || Ye("No code verifier found in local storage for OAuth flow.\nConsider using stytch.oauth.$provider.start() to add PKCE to your OAuth flows for added security.\nSee https://stytch.com/docs/oauth#guides_pkce for more information."), r.next = 7, this._networkClient.fetchSDK({
|
|
2317
2325
|
url: "/oauth/authenticate",
|
|
2318
2326
|
method: "POST",
|
|
2319
2327
|
body: Object.assign({
|
|
@@ -2326,12 +2334,12 @@ var nt = ye(function e(t, r) {
|
|
|
2326
2334
|
return i = r.sent, this._pkceManager.clearPKPair(), this._subscriptionService.updateStateAndTokens({
|
|
2327
2335
|
state: {
|
|
2328
2336
|
session: i.session,
|
|
2329
|
-
user:
|
|
2337
|
+
user: Ze(i.__user)
|
|
2330
2338
|
},
|
|
2331
2339
|
session_token: i.session_token,
|
|
2332
2340
|
session_jwt: i.session_jwt,
|
|
2333
2341
|
intermediate_session_token: null
|
|
2334
|
-
}), r.abrupt("return",
|
|
2342
|
+
}), r.abrupt("return", Qe(i));
|
|
2335
2343
|
case 11:
|
|
2336
2344
|
case "end":
|
|
2337
2345
|
return r.stop();
|
|
@@ -2342,9 +2350,9 @@ var nt = ye(function e(t, r) {
|
|
|
2342
2350
|
}, {
|
|
2343
2351
|
key: "getBaseApiUrl",
|
|
2344
2352
|
value: function value() {
|
|
2345
|
-
return
|
|
2353
|
+
return De(this, void 0, void 0, ve().mark(function e() {
|
|
2346
2354
|
var t, r;
|
|
2347
|
-
return
|
|
2355
|
+
return ve().wrap(function (e) {
|
|
2348
2356
|
for (;;) switch (e.prev = e.next) {
|
|
2349
2357
|
case 0:
|
|
2350
2358
|
return e.next = 2, this._dynamicConfig;
|
|
@@ -2379,9 +2387,9 @@ var nt = ye(function e(t, r) {
|
|
|
2379
2387
|
i = r.signup_redirect_url,
|
|
2380
2388
|
s = r.custom_scopes,
|
|
2381
2389
|
o = r.provider_params;
|
|
2382
|
-
return
|
|
2390
|
+
return De(t, void 0, void 0, ve().mark(function t() {
|
|
2383
2391
|
var r, a, c, u, l, d, h;
|
|
2384
|
-
return
|
|
2392
|
+
return ve().wrap(function (t) {
|
|
2385
2393
|
for (;;) switch (t.prev = t.next) {
|
|
2386
2394
|
case 0:
|
|
2387
2395
|
return t.next = 2, this._dynamicConfig;
|
|
@@ -2408,7 +2416,7 @@ var nt = ye(function e(t, r) {
|
|
|
2408
2416
|
case 18:
|
|
2409
2417
|
this._pkceManager.clearPKPair();
|
|
2410
2418
|
case 19:
|
|
2411
|
-
if (s && (
|
|
2419
|
+
if (s && (Xe("startOAuthFlow").isStringArray("custom_scopes", s), l.searchParams.set("custom_scopes", s.join(" "))), o) for (h in Xe("startOAuthFlow").isOptionalObject("provider_params", o), o) l.searchParams.set("provider_" + h, o[h]);
|
|
2412
2420
|
n && l.searchParams.set("login_redirect_url", n), i && l.searchParams.set("signup_redirect_url", i), window.location.href = l.toString();
|
|
2413
2421
|
case 24:
|
|
2414
2422
|
case "end":
|
|
@@ -2420,23 +2428,23 @@ var nt = ye(function e(t, r) {
|
|
|
2420
2428
|
}
|
|
2421
2429
|
}]), e;
|
|
2422
2430
|
}(),
|
|
2423
|
-
|
|
2431
|
+
lt = function () {
|
|
2424
2432
|
function e(t, r) {
|
|
2425
2433
|
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : function () {
|
|
2426
2434
|
return Promise.resolve(void 0);
|
|
2427
2435
|
},
|
|
2428
|
-
i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] :
|
|
2429
|
-
|
|
2436
|
+
i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : tt();
|
|
2437
|
+
ke(this, e), this._networkClient = t, this._subscriptionService = r, this.executeRecaptcha = n, this.dfpProtectedAuth = i;
|
|
2430
2438
|
}
|
|
2431
|
-
return
|
|
2439
|
+
return ge(e, [{
|
|
2432
2440
|
key: "authenticateStart",
|
|
2433
2441
|
value: function value(e) {
|
|
2434
|
-
return
|
|
2442
|
+
return De(this, void 0, void 0, ve().mark(function t() {
|
|
2435
2443
|
var r, n, i;
|
|
2436
|
-
return
|
|
2444
|
+
return ve().wrap(function (t) {
|
|
2437
2445
|
for (;;) switch (t.prev = t.next) {
|
|
2438
2446
|
case 0:
|
|
2439
|
-
return
|
|
2447
|
+
return Xe("stytch.cryptoWallets.authenticateStart").isString("crypto_wallet_address", e.crypto_wallet_address).isString("crypto_wallet_type", e.crypto_wallet_type), r = !!this._subscriptionService.getSession(), t.next = 4, this.executeRecaptcha();
|
|
2440
2448
|
case 4:
|
|
2441
2449
|
return n = t.sent, i = r ? "/crypto_wallets/authenticate/start/secondary" : "/crypto_wallets/authenticate/start/primary", t.abrupt("return", this._networkClient.fetchSDK({
|
|
2442
2450
|
url: i,
|
|
@@ -2458,12 +2466,12 @@ var nt = ye(function e(t, r) {
|
|
|
2458
2466
|
}, {
|
|
2459
2467
|
key: "authenticate",
|
|
2460
2468
|
value: function value(e) {
|
|
2461
|
-
return
|
|
2469
|
+
return De(this, void 0, void 0, ve().mark(function t() {
|
|
2462
2470
|
var r, n, i, s;
|
|
2463
|
-
return
|
|
2471
|
+
return ve().wrap(function (t) {
|
|
2464
2472
|
for (;;) switch (t.prev = t.next) {
|
|
2465
2473
|
case 0:
|
|
2466
|
-
return
|
|
2474
|
+
return Xe("stytch.cryptoWallets.authenticate").isString("signature", e.signature).isString("crypto_wallet_address", e.crypto_wallet_address).isString("crypto_wallet_type", e.crypto_wallet_type).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2467
2475
|
case 3:
|
|
2468
2476
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2469
2477
|
url: "/crypto_wallets/authenticate",
|
|
@@ -2483,12 +2491,12 @@ var nt = ye(function e(t, r) {
|
|
|
2483
2491
|
return s = t.sent, this._subscriptionService.updateStateAndTokens({
|
|
2484
2492
|
state: {
|
|
2485
2493
|
session: s.session,
|
|
2486
|
-
user:
|
|
2494
|
+
user: Ze(s.__user)
|
|
2487
2495
|
},
|
|
2488
2496
|
session_token: s.session_token,
|
|
2489
2497
|
session_jwt: s.session_jwt,
|
|
2490
2498
|
intermediate_session_token: null
|
|
2491
|
-
}), t.abrupt("return",
|
|
2499
|
+
}), t.abrupt("return", Qe(s));
|
|
2492
2500
|
case 11:
|
|
2493
2501
|
case "end":
|
|
2494
2502
|
return t.stop();
|
|
@@ -2498,19 +2506,19 @@ var nt = ye(function e(t, r) {
|
|
|
2498
2506
|
}
|
|
2499
2507
|
}]), e;
|
|
2500
2508
|
}(),
|
|
2501
|
-
|
|
2509
|
+
dt = function () {
|
|
2502
2510
|
function e(t, r, n) {
|
|
2503
|
-
|
|
2511
|
+
ke(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n;
|
|
2504
2512
|
}
|
|
2505
|
-
return
|
|
2513
|
+
return ge(e, [{
|
|
2506
2514
|
key: "create",
|
|
2507
2515
|
value: function value(e) {
|
|
2508
|
-
return
|
|
2516
|
+
return De(this, void 0, void 0, ve().mark(function t() {
|
|
2509
2517
|
var r;
|
|
2510
|
-
return
|
|
2518
|
+
return ve().wrap(function (t) {
|
|
2511
2519
|
for (;;) switch (t.prev = t.next) {
|
|
2512
2520
|
case 0:
|
|
2513
|
-
return
|
|
2521
|
+
return Xe("stytch.totps.create").isNumber("expiration_minutes", e.expiration_minutes), t.next = 3, this._networkClient.fetchSDK({
|
|
2514
2522
|
url: "/totps",
|
|
2515
2523
|
method: "POST",
|
|
2516
2524
|
errorMessage: "Failed to create TOTP",
|
|
@@ -2519,7 +2527,7 @@ var nt = ye(function e(t, r) {
|
|
|
2519
2527
|
}
|
|
2520
2528
|
});
|
|
2521
2529
|
case 3:
|
|
2522
|
-
return r = t.sent, this._subscriptionService.updateUser(r.__user), t.abrupt("return",
|
|
2530
|
+
return r = t.sent, this._subscriptionService.updateUser(r.__user), t.abrupt("return", Qe(r));
|
|
2523
2531
|
case 6:
|
|
2524
2532
|
case "end":
|
|
2525
2533
|
return t.stop();
|
|
@@ -2530,12 +2538,12 @@ var nt = ye(function e(t, r) {
|
|
|
2530
2538
|
}, {
|
|
2531
2539
|
key: "authenticate",
|
|
2532
2540
|
value: function value(e) {
|
|
2533
|
-
return
|
|
2541
|
+
return De(this, void 0, void 0, ve().mark(function t() {
|
|
2534
2542
|
var r, n, i, s;
|
|
2535
|
-
return
|
|
2543
|
+
return ve().wrap(function (t) {
|
|
2536
2544
|
for (;;) switch (t.prev = t.next) {
|
|
2537
2545
|
case 0:
|
|
2538
|
-
return
|
|
2546
|
+
return Xe("stytch.totps.authenticate").isNumber("session_duration_minutes", e.session_duration_minutes).isString("totp_code", e.totp_code), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2539
2547
|
case 3:
|
|
2540
2548
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2541
2549
|
url: "/totps/authenticate",
|
|
@@ -2558,7 +2566,7 @@ var nt = ye(function e(t, r) {
|
|
|
2558
2566
|
session_token: s.session_token,
|
|
2559
2567
|
session_jwt: s.session_jwt,
|
|
2560
2568
|
intermediate_session_token: null
|
|
2561
|
-
}), t.abrupt("return",
|
|
2569
|
+
}), t.abrupt("return", Qe(s));
|
|
2562
2570
|
case 11:
|
|
2563
2571
|
case "end":
|
|
2564
2572
|
return t.stop();
|
|
@@ -2569,8 +2577,8 @@ var nt = ye(function e(t, r) {
|
|
|
2569
2577
|
}, {
|
|
2570
2578
|
key: "recoveryCodes",
|
|
2571
2579
|
value: function value() {
|
|
2572
|
-
return
|
|
2573
|
-
return
|
|
2580
|
+
return De(this, void 0, void 0, ve().mark(function e() {
|
|
2581
|
+
return ve().wrap(function (e) {
|
|
2574
2582
|
for (;;) switch (e.prev = e.next) {
|
|
2575
2583
|
case 0:
|
|
2576
2584
|
return e.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2588,12 +2596,12 @@ var nt = ye(function e(t, r) {
|
|
|
2588
2596
|
}, {
|
|
2589
2597
|
key: "recover",
|
|
2590
2598
|
value: function value(e) {
|
|
2591
|
-
return
|
|
2599
|
+
return De(this, void 0, void 0, ve().mark(function t() {
|
|
2592
2600
|
var r, n, i, s;
|
|
2593
|
-
return
|
|
2601
|
+
return ve().wrap(function (t) {
|
|
2594
2602
|
for (;;) switch (t.prev = t.next) {
|
|
2595
2603
|
case 0:
|
|
2596
|
-
return
|
|
2604
|
+
return Xe("stytch.totps.recover").isNumber("session_duration_minutes", e.session_duration_minutes).isString("recovery_code", e.recovery_code), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2597
2605
|
case 3:
|
|
2598
2606
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2599
2607
|
url: "/totps/recover",
|
|
@@ -2616,7 +2624,7 @@ var nt = ye(function e(t, r) {
|
|
|
2616
2624
|
session_token: s.session_token,
|
|
2617
2625
|
session_jwt: s.session_jwt,
|
|
2618
2626
|
intermediate_session_token: null
|
|
2619
|
-
}), t.abrupt("return",
|
|
2627
|
+
}), t.abrupt("return", Qe(s));
|
|
2620
2628
|
case 11:
|
|
2621
2629
|
case "end":
|
|
2622
2630
|
return t.stop();
|
|
@@ -2626,14 +2634,14 @@ var nt = ye(function e(t, r) {
|
|
|
2626
2634
|
}
|
|
2627
2635
|
}]), e;
|
|
2628
2636
|
}();
|
|
2629
|
-
function
|
|
2637
|
+
function ht(e) {
|
|
2630
2638
|
for (var t = "==".slice(0, (4 - e.length % 4) % 4), r = e.replace(/-/g, "+").replace(/_/g, "/") + t, n = atob(r), i = new ArrayBuffer(n.length), s = new Uint8Array(i), o = 0; o < n.length; o++) s[o] = n.charCodeAt(o);
|
|
2631
2639
|
return i;
|
|
2632
2640
|
}
|
|
2633
|
-
function
|
|
2641
|
+
function pt(e) {
|
|
2634
2642
|
var t,
|
|
2635
2643
|
r = "",
|
|
2636
|
-
n =
|
|
2644
|
+
n = pe(new Uint8Array(e));
|
|
2637
2645
|
try {
|
|
2638
2646
|
for (n.s(); !(t = n.n()).done;) {
|
|
2639
2647
|
var i = t.value;
|
|
@@ -2646,139 +2654,139 @@ function ht(e) {
|
|
|
2646
2654
|
}
|
|
2647
2655
|
return btoa(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
2648
2656
|
}
|
|
2649
|
-
var
|
|
2650
|
-
|
|
2651
|
-
function
|
|
2652
|
-
if (t ===
|
|
2653
|
-
if (t ===
|
|
2657
|
+
var ft = "copy",
|
|
2658
|
+
_t = "convert";
|
|
2659
|
+
function mt(e, t, r) {
|
|
2660
|
+
if (t === ft) return r;
|
|
2661
|
+
if (t === _t) return e(r);
|
|
2654
2662
|
if (t instanceof Array) return r.map(function (r) {
|
|
2655
|
-
return
|
|
2663
|
+
return mt(e, t[0], r);
|
|
2656
2664
|
});
|
|
2657
2665
|
if (t instanceof Object) {
|
|
2658
2666
|
for (var n = {}, i = 0, s = Object.entries(t); i < s.length; i++) {
|
|
2659
|
-
var o =
|
|
2667
|
+
var o = he(s[i], 2),
|
|
2660
2668
|
a = o[0],
|
|
2661
2669
|
c = o[1];
|
|
2662
2670
|
if (c.derive) {
|
|
2663
2671
|
var u = c.derive(r);
|
|
2664
2672
|
void 0 !== u && (r[a] = u);
|
|
2665
2673
|
}
|
|
2666
|
-
if (a in r) null != r[a] ? n[a] =
|
|
2674
|
+
if (a in r) null != r[a] ? n[a] = mt(e, c.schema, r[a]) : n[a] = null;else if (c.required) throw new Error("Missing key: ".concat(a));
|
|
2667
2675
|
}
|
|
2668
2676
|
return n;
|
|
2669
2677
|
}
|
|
2670
2678
|
}
|
|
2671
|
-
function
|
|
2679
|
+
function vt(e, t) {
|
|
2672
2680
|
return {
|
|
2673
2681
|
required: !0,
|
|
2674
2682
|
schema: e,
|
|
2675
2683
|
derive: t
|
|
2676
2684
|
};
|
|
2677
2685
|
}
|
|
2678
|
-
function
|
|
2686
|
+
function yt(e) {
|
|
2679
2687
|
return {
|
|
2680
2688
|
required: !0,
|
|
2681
2689
|
schema: e
|
|
2682
2690
|
};
|
|
2683
2691
|
}
|
|
2684
|
-
function
|
|
2692
|
+
function gt(e) {
|
|
2685
2693
|
return {
|
|
2686
2694
|
required: !1,
|
|
2687
2695
|
schema: e
|
|
2688
2696
|
};
|
|
2689
2697
|
}
|
|
2690
|
-
var
|
|
2691
|
-
type:
|
|
2692
|
-
id:
|
|
2693
|
-
transports:
|
|
2694
|
-
},
|
|
2695
|
-
bt = {
|
|
2696
|
-
appid: yt(pt),
|
|
2697
|
-
appidExclude: yt(pt),
|
|
2698
|
-
credProps: yt(pt)
|
|
2698
|
+
var bt = {
|
|
2699
|
+
type: yt(ft),
|
|
2700
|
+
id: yt(_t),
|
|
2701
|
+
transports: gt(ft)
|
|
2699
2702
|
},
|
|
2700
2703
|
kt = {
|
|
2701
|
-
appid:
|
|
2702
|
-
appidExclude:
|
|
2703
|
-
credProps:
|
|
2704
|
+
appid: gt(ft),
|
|
2705
|
+
appidExclude: gt(ft),
|
|
2706
|
+
credProps: gt(ft)
|
|
2704
2707
|
},
|
|
2705
2708
|
wt = {
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2709
|
+
appid: gt(ft),
|
|
2710
|
+
appidExclude: gt(ft),
|
|
2711
|
+
credProps: gt(ft)
|
|
2712
|
+
},
|
|
2713
|
+
St = {
|
|
2714
|
+
publicKey: yt({
|
|
2715
|
+
rp: yt(ft),
|
|
2716
|
+
user: yt({
|
|
2717
|
+
id: yt(_t),
|
|
2718
|
+
name: yt(ft),
|
|
2719
|
+
displayName: yt(ft)
|
|
2712
2720
|
}),
|
|
2713
|
-
challenge:
|
|
2714
|
-
pubKeyCredParams:
|
|
2715
|
-
timeout:
|
|
2716
|
-
excludeCredentials:
|
|
2717
|
-
authenticatorSelection:
|
|
2718
|
-
attestation:
|
|
2719
|
-
extensions:
|
|
2721
|
+
challenge: yt(_t),
|
|
2722
|
+
pubKeyCredParams: yt(ft),
|
|
2723
|
+
timeout: gt(ft),
|
|
2724
|
+
excludeCredentials: gt([bt]),
|
|
2725
|
+
authenticatorSelection: gt(ft),
|
|
2726
|
+
attestation: gt(ft),
|
|
2727
|
+
extensions: gt(kt)
|
|
2720
2728
|
}),
|
|
2721
|
-
signal:
|
|
2729
|
+
signal: gt(ft)
|
|
2722
2730
|
},
|
|
2723
|
-
|
|
2724
|
-
type:
|
|
2725
|
-
id:
|
|
2726
|
-
rawId:
|
|
2727
|
-
authenticatorAttachment:
|
|
2728
|
-
response:
|
|
2729
|
-
clientDataJSON:
|
|
2730
|
-
attestationObject:
|
|
2731
|
-
transports:
|
|
2731
|
+
Ct = {
|
|
2732
|
+
type: yt(ft),
|
|
2733
|
+
id: yt(ft),
|
|
2734
|
+
rawId: yt(_t),
|
|
2735
|
+
authenticatorAttachment: gt(ft),
|
|
2736
|
+
response: yt({
|
|
2737
|
+
clientDataJSON: yt(_t),
|
|
2738
|
+
attestationObject: yt(_t),
|
|
2739
|
+
transports: vt(ft, function (e) {
|
|
2732
2740
|
var t;
|
|
2733
2741
|
return (null == (t = e.getTransports) ? void 0 : t.call(e)) || [];
|
|
2734
2742
|
})
|
|
2735
2743
|
}),
|
|
2736
|
-
clientExtensionResults:
|
|
2744
|
+
clientExtensionResults: vt(wt, function (e) {
|
|
2737
2745
|
return e.getClientExtensionResults();
|
|
2738
2746
|
})
|
|
2739
2747
|
},
|
|
2740
|
-
|
|
2741
|
-
mediation:
|
|
2742
|
-
publicKey:
|
|
2743
|
-
challenge:
|
|
2744
|
-
timeout:
|
|
2745
|
-
rpId:
|
|
2746
|
-
allowCredentials:
|
|
2747
|
-
userVerification:
|
|
2748
|
-
extensions:
|
|
2748
|
+
Tt = {
|
|
2749
|
+
mediation: gt(ft),
|
|
2750
|
+
publicKey: yt({
|
|
2751
|
+
challenge: yt(_t),
|
|
2752
|
+
timeout: gt(ft),
|
|
2753
|
+
rpId: gt(ft),
|
|
2754
|
+
allowCredentials: gt([bt]),
|
|
2755
|
+
userVerification: gt(ft),
|
|
2756
|
+
extensions: gt(kt)
|
|
2749
2757
|
}),
|
|
2750
|
-
signal:
|
|
2758
|
+
signal: gt(ft)
|
|
2751
2759
|
},
|
|
2752
|
-
|
|
2753
|
-
type:
|
|
2754
|
-
id:
|
|
2755
|
-
rawId:
|
|
2756
|
-
authenticatorAttachment:
|
|
2757
|
-
response:
|
|
2758
|
-
clientDataJSON:
|
|
2759
|
-
authenticatorData:
|
|
2760
|
-
signature:
|
|
2761
|
-
userHandle:
|
|
2760
|
+
Ot = {
|
|
2761
|
+
type: yt(ft),
|
|
2762
|
+
id: yt(ft),
|
|
2763
|
+
rawId: yt(_t),
|
|
2764
|
+
authenticatorAttachment: gt(ft),
|
|
2765
|
+
response: yt({
|
|
2766
|
+
clientDataJSON: yt(_t),
|
|
2767
|
+
authenticatorData: yt(_t),
|
|
2768
|
+
signature: yt(_t),
|
|
2769
|
+
userHandle: yt(_t)
|
|
2762
2770
|
}),
|
|
2763
|
-
clientExtensionResults:
|
|
2771
|
+
clientExtensionResults: vt(wt, function (e) {
|
|
2764
2772
|
return e.getClientExtensionResults();
|
|
2765
2773
|
})
|
|
2766
2774
|
};
|
|
2767
|
-
function Ot(e) {
|
|
2768
|
-
return _t(dt, wt, e);
|
|
2769
|
-
}
|
|
2770
2775
|
function Pt(e) {
|
|
2771
|
-
return
|
|
2776
|
+
return mt(ht, St, e);
|
|
2772
2777
|
}
|
|
2773
2778
|
function At(e) {
|
|
2774
|
-
return
|
|
2779
|
+
return mt(pt, Ct, e);
|
|
2780
|
+
}
|
|
2781
|
+
function Et(e) {
|
|
2782
|
+
return De(this, void 0, void 0, ve().mark(function t() {
|
|
2775
2783
|
var r;
|
|
2776
|
-
return
|
|
2784
|
+
return ve().wrap(function (t) {
|
|
2777
2785
|
for (;;) switch (t.prev = t.next) {
|
|
2778
2786
|
case 0:
|
|
2779
|
-
return t.next = 2, navigator.credentials.create(
|
|
2787
|
+
return t.next = 2, navigator.credentials.create(Pt(e));
|
|
2780
2788
|
case 2:
|
|
2781
|
-
return r = t.sent, t.abrupt("return",
|
|
2789
|
+
return r = t.sent, t.abrupt("return", At(r));
|
|
2782
2790
|
case 4:
|
|
2783
2791
|
case "end":
|
|
2784
2792
|
return t.stop();
|
|
@@ -2786,21 +2794,21 @@ function At(e) {
|
|
|
2786
2794
|
}, t);
|
|
2787
2795
|
}));
|
|
2788
2796
|
}
|
|
2789
|
-
function Et(e) {
|
|
2790
|
-
return _t(dt, Ct, e);
|
|
2791
|
-
}
|
|
2792
2797
|
function xt(e) {
|
|
2793
|
-
return
|
|
2798
|
+
return mt(ht, Tt, e);
|
|
2794
2799
|
}
|
|
2795
2800
|
function Dt(e) {
|
|
2796
|
-
return
|
|
2801
|
+
return mt(pt, Ot, e);
|
|
2802
|
+
}
|
|
2803
|
+
function Rt(e) {
|
|
2804
|
+
return De(this, void 0, void 0, ve().mark(function t() {
|
|
2797
2805
|
var r;
|
|
2798
|
-
return
|
|
2806
|
+
return ve().wrap(function (t) {
|
|
2799
2807
|
for (;;) switch (t.prev = t.next) {
|
|
2800
2808
|
case 0:
|
|
2801
|
-
return t.next = 2, navigator.credentials.get(
|
|
2809
|
+
return t.next = 2, navigator.credentials.get(xt(e));
|
|
2802
2810
|
case 2:
|
|
2803
|
-
return r = t.sent, t.abrupt("return",
|
|
2811
|
+
return r = t.sent, t.abrupt("return", Dt(r));
|
|
2804
2812
|
case 4:
|
|
2805
2813
|
case "end":
|
|
2806
2814
|
return t.stop();
|
|
@@ -2808,22 +2816,22 @@ function Dt(e) {
|
|
|
2808
2816
|
}, t);
|
|
2809
2817
|
}));
|
|
2810
2818
|
}
|
|
2811
|
-
var
|
|
2819
|
+
var It = function () {
|
|
2812
2820
|
function e(t, r, n) {
|
|
2813
|
-
|
|
2821
|
+
ke(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n, this.checkEligibleInputs = function () {
|
|
2814
2822
|
return !(document.querySelectorAll("input[autocomplete*='webauthn']").length < 1) || (console.error('No <input> with `"webauthn"` in its `autocomplete` attribute was detected'), !1);
|
|
2815
2823
|
};
|
|
2816
2824
|
}
|
|
2817
|
-
return
|
|
2825
|
+
return ge(e, [{
|
|
2818
2826
|
key: "register",
|
|
2819
2827
|
value: function value(e) {
|
|
2820
2828
|
var t, r;
|
|
2821
|
-
return
|
|
2829
|
+
return De(this, void 0, void 0, ve().mark(function n() {
|
|
2822
2830
|
var i, s, o, a, c;
|
|
2823
|
-
return
|
|
2831
|
+
return ve().wrap(function (n) {
|
|
2824
2832
|
for (;;) switch (n.prev = n.next) {
|
|
2825
2833
|
case 0:
|
|
2826
|
-
return
|
|
2834
|
+
return Xe("stytch.webauthn.register").isOptionalString("domain", null == e ? void 0 : e.domain).isOptionalString("authenticator_type", null == e ? void 0 : e.authenticator_type).isOptionalBoolean("is_passkey", null == e ? void 0 : e.is_passkey).isOptionalNumber("session_duration_minutes", null == e ? void 0 : e.session_duration_minutes), n.next = 3, this._networkClient.fetchSDK({
|
|
2827
2835
|
url: "/webauthn/register/start",
|
|
2828
2836
|
method: "POST",
|
|
2829
2837
|
errorMessage: "Failed to start WebAuthn registration",
|
|
@@ -2835,7 +2843,7 @@ var Rt = function () {
|
|
|
2835
2843
|
}
|
|
2836
2844
|
});
|
|
2837
2845
|
case 3:
|
|
2838
|
-
return i = n.sent, s = i.public_key_credential_creation_options, o = JSON.parse(s), n.next = 8,
|
|
2846
|
+
return i = n.sent, s = i.public_key_credential_creation_options, o = JSON.parse(s), n.next = 8, Et({
|
|
2839
2847
|
publicKey: o
|
|
2840
2848
|
});
|
|
2841
2849
|
case 8:
|
|
@@ -2857,7 +2865,7 @@ var Rt = function () {
|
|
|
2857
2865
|
session_token: c.session_token,
|
|
2858
2866
|
session_jwt: c.session_jwt,
|
|
2859
2867
|
intermediate_session_token: null
|
|
2860
|
-
}), n.abrupt("return",
|
|
2868
|
+
}), n.abrupt("return", Qe(c));
|
|
2861
2869
|
case 14:
|
|
2862
2870
|
case "end":
|
|
2863
2871
|
return n.stop();
|
|
@@ -2869,12 +2877,12 @@ var Rt = function () {
|
|
|
2869
2877
|
key: "authenticate",
|
|
2870
2878
|
value: function value(e) {
|
|
2871
2879
|
var t, r;
|
|
2872
|
-
return
|
|
2880
|
+
return De(this, void 0, void 0, ve().mark(function n() {
|
|
2873
2881
|
var i, s, o, a, c, u, l, d, h, p, f, _;
|
|
2874
|
-
return
|
|
2882
|
+
return ve().wrap(function (n) {
|
|
2875
2883
|
for (;;) switch (n.prev = n.next) {
|
|
2876
2884
|
case 0:
|
|
2877
|
-
return
|
|
2885
|
+
return Xe("stytch.webauthn.authenticate").isOptionalString("domain", e.domain).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalBoolean("is_passkey", e.is_passkey).isOptionalObject("signal", e.signal), n.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2878
2886
|
case 3:
|
|
2879
2887
|
if (i = n.sent, s = i.dfp_telemetry_id, o = i.captcha_token, !e.conditional_mediation) {
|
|
2880
2888
|
n.next = 14;
|
|
@@ -2909,7 +2917,7 @@ var Rt = function () {
|
|
|
2909
2917
|
signal: null !== (r = e.signal) && void 0 !== r ? r : d.signal
|
|
2910
2918
|
}, p = Object.assign(Object.assign({}, h), {
|
|
2911
2919
|
mediation: "conditional"
|
|
2912
|
-
}), n.next = 25,
|
|
2920
|
+
}), n.next = 25, Rt(e.conditional_mediation ? p : h);
|
|
2913
2921
|
case 25:
|
|
2914
2922
|
return f = n.sent, n.next = 28, this._networkClient.retriableFetchSDK({
|
|
2915
2923
|
url: "/webauthn/authenticate",
|
|
@@ -2932,7 +2940,7 @@ var Rt = function () {
|
|
|
2932
2940
|
session_token: _.session_token,
|
|
2933
2941
|
session_jwt: _.session_jwt,
|
|
2934
2942
|
intermediate_session_token: null
|
|
2935
|
-
}), n.abrupt("return",
|
|
2943
|
+
}), n.abrupt("return", Qe(_));
|
|
2936
2944
|
case 31:
|
|
2937
2945
|
case "end":
|
|
2938
2946
|
return n.stop();
|
|
@@ -2943,9 +2951,9 @@ var Rt = function () {
|
|
|
2943
2951
|
}, {
|
|
2944
2952
|
key: "update",
|
|
2945
2953
|
value: function value(e) {
|
|
2946
|
-
return
|
|
2954
|
+
return De(this, void 0, void 0, ve().mark(function t() {
|
|
2947
2955
|
var r;
|
|
2948
|
-
return
|
|
2956
|
+
return ve().wrap(function (t) {
|
|
2949
2957
|
for (;;) switch (t.prev = t.next) {
|
|
2950
2958
|
case 0:
|
|
2951
2959
|
return r = "/webauthn/update/" + e.webauthn_registration_id, t.next = 3, this._networkClient.fetchSDK({
|
|
@@ -2968,9 +2976,9 @@ var Rt = function () {
|
|
|
2968
2976
|
}, {
|
|
2969
2977
|
key: "browserSupportsAutofill",
|
|
2970
2978
|
value: function value() {
|
|
2971
|
-
return
|
|
2979
|
+
return De(this, void 0, void 0, ve().mark(function e() {
|
|
2972
2980
|
var t;
|
|
2973
|
-
return
|
|
2981
|
+
return ve().wrap(function (e) {
|
|
2974
2982
|
for (;;) switch (e.prev = e.next) {
|
|
2975
2983
|
case 0:
|
|
2976
2984
|
if (void 0 !== (t = window.PublicKeyCredential) && void 0 !== t.isConditionalMediationAvailable) {
|
|
@@ -2991,21 +2999,21 @@ var Rt = function () {
|
|
|
2991
2999
|
}
|
|
2992
3000
|
}]), e;
|
|
2993
3001
|
}(),
|
|
2994
|
-
|
|
3002
|
+
Ft = Promise.resolve({
|
|
2995
3003
|
pkceRequiredForPasswordResets: !1
|
|
2996
3004
|
}),
|
|
2997
|
-
|
|
3005
|
+
jt = function () {
|
|
2998
3006
|
function e(t, r, n) {
|
|
2999
|
-
var i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] :
|
|
3000
|
-
s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] :
|
|
3001
|
-
|
|
3007
|
+
var i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : Ft,
|
|
3008
|
+
s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : tt();
|
|
3009
|
+
ke(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._config = i, this.dfpProtectedAuth = s;
|
|
3002
3010
|
}
|
|
3003
|
-
return
|
|
3011
|
+
return ge(e, [{
|
|
3004
3012
|
key: "getCodeChallenge",
|
|
3005
3013
|
value: function value() {
|
|
3006
|
-
return
|
|
3014
|
+
return De(this, void 0, void 0, ve().mark(function e() {
|
|
3007
3015
|
var t, r;
|
|
3008
|
-
return
|
|
3016
|
+
return ve().wrap(function (e) {
|
|
3009
3017
|
for (;;) switch (e.prev = e.next) {
|
|
3010
3018
|
case 0:
|
|
3011
3019
|
return e.next = 2, this._config;
|
|
@@ -3037,12 +3045,12 @@ var Rt = function () {
|
|
|
3037
3045
|
}, {
|
|
3038
3046
|
key: "create",
|
|
3039
3047
|
value: function value(e) {
|
|
3040
|
-
return
|
|
3048
|
+
return De(this, void 0, void 0, ve().mark(function t() {
|
|
3041
3049
|
var r, n, i, s;
|
|
3042
|
-
return
|
|
3050
|
+
return ve().wrap(function (t) {
|
|
3043
3051
|
for (;;) switch (t.prev = t.next) {
|
|
3044
3052
|
case 0:
|
|
3045
|
-
return
|
|
3053
|
+
return Xe("stytch.passwords.create").isString("password", e.password).isString("email", e.email).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3046
3054
|
case 3:
|
|
3047
3055
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
3048
3056
|
url: "/passwords",
|
|
@@ -3066,7 +3074,7 @@ var Rt = function () {
|
|
|
3066
3074
|
session_token: s.session_token,
|
|
3067
3075
|
session_jwt: s.session_jwt,
|
|
3068
3076
|
intermediate_session_token: null
|
|
3069
|
-
}), t.abrupt("return",
|
|
3077
|
+
}), t.abrupt("return", Qe(s));
|
|
3070
3078
|
case 11:
|
|
3071
3079
|
case "end":
|
|
3072
3080
|
return t.stop();
|
|
@@ -3077,12 +3085,12 @@ var Rt = function () {
|
|
|
3077
3085
|
}, {
|
|
3078
3086
|
key: "authenticate",
|
|
3079
3087
|
value: function value(e) {
|
|
3080
|
-
return
|
|
3088
|
+
return De(this, void 0, void 0, ve().mark(function t() {
|
|
3081
3089
|
var r, n, i, s;
|
|
3082
|
-
return
|
|
3090
|
+
return ve().wrap(function (t) {
|
|
3083
3091
|
for (;;) switch (t.prev = t.next) {
|
|
3084
3092
|
case 0:
|
|
3085
|
-
return
|
|
3093
|
+
return Xe("stytch.passwords.authenticate").isString("password", e.password).isString("email", e.email).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3086
3094
|
case 3:
|
|
3087
3095
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
3088
3096
|
url: "/passwords/authenticate",
|
|
@@ -3106,7 +3114,7 @@ var Rt = function () {
|
|
|
3106
3114
|
session_token: s.session_token,
|
|
3107
3115
|
session_jwt: s.session_jwt,
|
|
3108
3116
|
intermediate_session_token: null
|
|
3109
|
-
}), t.abrupt("return",
|
|
3117
|
+
}), t.abrupt("return", Qe(s));
|
|
3110
3118
|
case 11:
|
|
3111
3119
|
case "end":
|
|
3112
3120
|
return t.stop();
|
|
@@ -3117,12 +3125,12 @@ var Rt = function () {
|
|
|
3117
3125
|
}, {
|
|
3118
3126
|
key: "resetByEmailStart",
|
|
3119
3127
|
value: function value(e) {
|
|
3120
|
-
return
|
|
3128
|
+
return De(this, void 0, void 0, ve().mark(function t() {
|
|
3121
3129
|
var r, n, i, s;
|
|
3122
|
-
return
|
|
3130
|
+
return ve().wrap(function (t) {
|
|
3123
3131
|
for (;;) switch (t.prev = t.next) {
|
|
3124
3132
|
case 0:
|
|
3125
|
-
return
|
|
3133
|
+
return Xe("stytch.passwords.resetByEmailStart").isString("email", e.email).isOptionalString("login_redirect_url", e.login_redirect_url).isOptionalString("reset_password_redirect_url", e.reset_password_redirect_url).isOptionalString("reset_password_template_id", e.reset_password_template_id).isOptionalNumber("reset_password_expiration_minutes", e.reset_password_expiration_minutes), t.next = 3, this.getCodeChallenge();
|
|
3126
3134
|
case 3:
|
|
3127
3135
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3128
3136
|
case 6:
|
|
@@ -3152,12 +3160,12 @@ var Rt = function () {
|
|
|
3152
3160
|
}, {
|
|
3153
3161
|
key: "resetByEmail",
|
|
3154
3162
|
value: function value(e) {
|
|
3155
|
-
return
|
|
3163
|
+
return De(this, void 0, void 0, ve().mark(function t() {
|
|
3156
3164
|
var r, n, i, s, o, a;
|
|
3157
|
-
return
|
|
3165
|
+
return ve().wrap(function (t) {
|
|
3158
3166
|
for (;;) switch (t.prev = t.next) {
|
|
3159
3167
|
case 0:
|
|
3160
|
-
return
|
|
3168
|
+
return Xe("stytch.passwords.resetByEmail").isString("token", e.token).isString("password", e.password).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3161
3169
|
case 3:
|
|
3162
3170
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._pkceManager.getPKPair();
|
|
3163
3171
|
case 8:
|
|
@@ -3184,7 +3192,7 @@ var Rt = function () {
|
|
|
3184
3192
|
session_token: a.session_token,
|
|
3185
3193
|
session_jwt: a.session_jwt,
|
|
3186
3194
|
intermediate_session_token: null
|
|
3187
|
-
}), t.abrupt("return",
|
|
3195
|
+
}), t.abrupt("return", Qe(a));
|
|
3188
3196
|
case 16:
|
|
3189
3197
|
case "end":
|
|
3190
3198
|
return t.stop();
|
|
@@ -3195,12 +3203,12 @@ var Rt = function () {
|
|
|
3195
3203
|
}, {
|
|
3196
3204
|
key: "resetByExistingPassword",
|
|
3197
3205
|
value: function value(e) {
|
|
3198
|
-
return
|
|
3206
|
+
return De(this, void 0, void 0, ve().mark(function t() {
|
|
3199
3207
|
var r, n, i, s;
|
|
3200
|
-
return
|
|
3208
|
+
return ve().wrap(function (t) {
|
|
3201
3209
|
for (;;) switch (t.prev = t.next) {
|
|
3202
3210
|
case 0:
|
|
3203
|
-
return
|
|
3211
|
+
return Xe("stytch.passwords.resetByExistingPassword").isString("email", e.email).isString("existing_password", e.existing_password).isString("new_password", e.new_password).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3204
3212
|
case 3:
|
|
3205
3213
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
3206
3214
|
url: "/passwords/existing_password/reset",
|
|
@@ -3225,7 +3233,7 @@ var Rt = function () {
|
|
|
3225
3233
|
session_token: s.session_token,
|
|
3226
3234
|
session_jwt: s.session_jwt,
|
|
3227
3235
|
intermediate_session_token: null
|
|
3228
|
-
}), t.abrupt("return",
|
|
3236
|
+
}), t.abrupt("return", Qe(s));
|
|
3229
3237
|
case 11:
|
|
3230
3238
|
case "end":
|
|
3231
3239
|
return t.stop();
|
|
@@ -3236,12 +3244,12 @@ var Rt = function () {
|
|
|
3236
3244
|
}, {
|
|
3237
3245
|
key: "resetBySession",
|
|
3238
3246
|
value: function value(e) {
|
|
3239
|
-
return
|
|
3247
|
+
return De(this, void 0, void 0, ve().mark(function t() {
|
|
3240
3248
|
var r, n, i, s;
|
|
3241
|
-
return
|
|
3249
|
+
return ve().wrap(function (t) {
|
|
3242
3250
|
for (;;) switch (t.prev = t.next) {
|
|
3243
3251
|
case 0:
|
|
3244
|
-
return
|
|
3252
|
+
return Xe("stytch.passwords.resetBySession").isString("password", e.password), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3245
3253
|
case 3:
|
|
3246
3254
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
3247
3255
|
url: "/passwords/session/reset",
|
|
@@ -3275,11 +3283,11 @@ var Rt = function () {
|
|
|
3275
3283
|
}, {
|
|
3276
3284
|
key: "strengthCheck",
|
|
3277
3285
|
value: function value(e) {
|
|
3278
|
-
return
|
|
3279
|
-
return
|
|
3286
|
+
return De(this, void 0, void 0, ve().mark(function t() {
|
|
3287
|
+
return ve().wrap(function (t) {
|
|
3280
3288
|
for (;;) switch (t.prev = t.next) {
|
|
3281
3289
|
case 0:
|
|
3282
|
-
return
|
|
3290
|
+
return Xe("stytch.passwords.strengthCheck").isOptionalString("email", e.email).isString("password", e.password), t.abrupt("return", this._networkClient.fetchSDK({
|
|
3283
3291
|
url: "/passwords/strength_check",
|
|
3284
3292
|
method: "POST",
|
|
3285
3293
|
errorMessage: "Failed to check password strength.",
|
|
@@ -3302,15 +3310,15 @@ Promise.resolve({
|
|
|
3302
3310
|
}), Promise.resolve({
|
|
3303
3311
|
pkceRequiredForPasswordResets: !1
|
|
3304
3312
|
});
|
|
3305
|
-
var
|
|
3313
|
+
var Lt = function () {
|
|
3306
3314
|
function e(t) {
|
|
3307
|
-
|
|
3315
|
+
ke(this, e), this.iframeURL = t, this.createIframe();
|
|
3308
3316
|
}
|
|
3309
|
-
return
|
|
3317
|
+
return ge(e, [{
|
|
3310
3318
|
key: "createIframe",
|
|
3311
3319
|
value: function value() {
|
|
3312
3320
|
var e = document.querySelector('[src~="'.concat(this.iframeURL, '"]'));
|
|
3313
|
-
e ?
|
|
3321
|
+
e ? Ye("It looks like you're creating multiple copies of the Stytch client. This behavior is unsupported, and unintended side effects may occur. Make sure you are creating the Stytch client at the global level, and not inside a component's render function.") : ((e = document.createElement("iframe")).src = this.iframeURL, e.style.position = "absolute", e.style.width = "0", e.style.height = "0", e.style.border = "0", document.body.appendChild(e)), "true" !== e.dataset.loaded ? this.frame = new Promise(function (t) {
|
|
3314
3322
|
e.addEventListener("load", function () {
|
|
3315
3323
|
e.dataset.loaded = "true", t(e);
|
|
3316
3324
|
}, {
|
|
@@ -3321,11 +3329,11 @@ var jt = function () {
|
|
|
3321
3329
|
}, {
|
|
3322
3330
|
key: "call",
|
|
3323
3331
|
value: function value(e, t) {
|
|
3324
|
-
return
|
|
3332
|
+
return De(this, void 0, void 0, ve().mark(function r() {
|
|
3325
3333
|
var n,
|
|
3326
3334
|
i,
|
|
3327
3335
|
s = this;
|
|
3328
|
-
return
|
|
3336
|
+
return ve().wrap(function (r) {
|
|
3329
3337
|
for (;;) switch (r.prev = r.next) {
|
|
3330
3338
|
case 0:
|
|
3331
3339
|
return r.next = 2, this.frame;
|
|
@@ -3334,7 +3342,7 @@ var jt = function () {
|
|
|
3334
3342
|
var a;
|
|
3335
3343
|
i.port1.onmessage = function (e) {
|
|
3336
3344
|
var t = e.data;
|
|
3337
|
-
i.port1.close(), t.success ? r(t.payload) : o(
|
|
3345
|
+
i.port1.close(), t.success ? r(t.payload) : o(rt.unmarshall(t.error));
|
|
3338
3346
|
};
|
|
3339
3347
|
var c = {
|
|
3340
3348
|
method: e,
|
|
@@ -3351,11 +3359,11 @@ var jt = function () {
|
|
|
3351
3359
|
}
|
|
3352
3360
|
}]), e;
|
|
3353
3361
|
}(),
|
|
3354
|
-
|
|
3362
|
+
Bt = function () {
|
|
3355
3363
|
function e(t, r) {
|
|
3356
|
-
|
|
3364
|
+
ke(this, e), this._networkClient = t, this.dfpProtectedAuth = r;
|
|
3357
3365
|
}
|
|
3358
|
-
return
|
|
3366
|
+
return ge(e, [{
|
|
3359
3367
|
key: "searchUser",
|
|
3360
3368
|
value: function value(e) {
|
|
3361
3369
|
var t = this;
|
|
@@ -3401,17 +3409,17 @@ var jt = function () {
|
|
|
3401
3409
|
}
|
|
3402
3410
|
}]), e;
|
|
3403
3411
|
}(),
|
|
3404
|
-
|
|
3412
|
+
Mt = function () {
|
|
3405
3413
|
function e(t, r) {
|
|
3406
3414
|
var n = this;
|
|
3407
|
-
|
|
3415
|
+
ke(this, e), this._subscriptionService = t, this._headlessSessionClient = r, this._onDataChange = function (e) {
|
|
3408
3416
|
!function (e) {
|
|
3409
3417
|
return !!(null == e ? void 0 : e.session);
|
|
3410
3418
|
}(e) ? n.cancelBackgroundRefresh() : n.scheduleBackgroundRefresh();
|
|
3411
3419
|
}, this._reauthenticateWithBackoff = function () {
|
|
3412
|
-
return
|
|
3420
|
+
return De(n, void 0, void 0, ve().mark(function t() {
|
|
3413
3421
|
var r;
|
|
3414
|
-
return
|
|
3422
|
+
return ve().wrap(function (t) {
|
|
3415
3423
|
for (;;) switch (t.prev = t.next) {
|
|
3416
3424
|
case 0:
|
|
3417
3425
|
r = 0;
|
|
@@ -3440,14 +3448,14 @@ var jt = function () {
|
|
|
3440
3448
|
}));
|
|
3441
3449
|
}, this.timeout = null, this._subscriptionService.subscribeToState(this._onDataChange);
|
|
3442
3450
|
}
|
|
3443
|
-
return
|
|
3451
|
+
return ge(e, [{
|
|
3444
3452
|
key: "performBackgroundRefresh",
|
|
3445
3453
|
value: function value() {
|
|
3446
3454
|
var e = this;
|
|
3447
3455
|
this._reauthenticateWithBackoff().then(function () {
|
|
3448
3456
|
e.scheduleBackgroundRefresh();
|
|
3449
3457
|
})["catch"](function (t) {
|
|
3450
|
-
|
|
3458
|
+
Ye("Session background refresh failed. Signalling to app that user is logged out.", {
|
|
3451
3459
|
error: t
|
|
3452
3460
|
}), e._subscriptionService.destroySession();
|
|
3453
3461
|
});
|
|
@@ -3477,28 +3485,28 @@ var jt = function () {
|
|
|
3477
3485
|
}
|
|
3478
3486
|
}]), e;
|
|
3479
3487
|
}();
|
|
3480
|
-
|
|
3481
|
-
var
|
|
3488
|
+
Mt.REFRESH_INTERVAL_MS = 18e4;
|
|
3489
|
+
var Nt = ge(function e(t, r) {
|
|
3482
3490
|
var n = this;
|
|
3483
|
-
|
|
3491
|
+
ke(this, e), this._subscriptionService = t, this.emptyState = r, this.onStateChange = function (e) {
|
|
3484
3492
|
return n._subscriptionService.subscribeToState(function (t) {
|
|
3485
3493
|
e(null != t ? t : n.emptyState);
|
|
3486
3494
|
});
|
|
3487
3495
|
};
|
|
3488
3496
|
});
|
|
3489
|
-
var
|
|
3490
|
-
var
|
|
3491
|
-
function
|
|
3497
|
+
var Ut = "bootstrap";
|
|
3498
|
+
var Kt = /*#__PURE__*/function () {
|
|
3499
|
+
function Kt(e, t, r) {
|
|
3492
3500
|
var _this = this;
|
|
3493
|
-
_classCallCheck(this,
|
|
3501
|
+
_classCallCheck(this, Kt);
|
|
3494
3502
|
this._publicToken = e, this._networkClient = t, this._dataLayer = r, this._bootstrapDataPromise = this._networkClient.fetchSDK({
|
|
3495
3503
|
url: "/projects/bootstrap/".concat(this._publicToken),
|
|
3496
3504
|
method: "GET",
|
|
3497
3505
|
errorMessage: "Error fetching bootstrap data for SDK for ".concat(this._publicToken)
|
|
3498
|
-
}).then(
|
|
3499
|
-
return _this._dataLayer.setItem(
|
|
3506
|
+
}).then(Kt.mapBootstrapData).then(function (e) {
|
|
3507
|
+
return _this._dataLayer.setItem(Ut, JSON.stringify(e)), e;
|
|
3500
3508
|
})["catch"](function (e) {
|
|
3501
|
-
return
|
|
3509
|
+
return Je(e), {
|
|
3502
3510
|
displayWatermark: !1,
|
|
3503
3511
|
cnameDomain: null,
|
|
3504
3512
|
emailDomains: ["stytch.com"],
|
|
@@ -3517,10 +3525,10 @@ var Ut = /*#__PURE__*/function () {
|
|
|
3517
3525
|
};
|
|
3518
3526
|
});
|
|
3519
3527
|
}
|
|
3520
|
-
_createClass(
|
|
3528
|
+
_createClass(Kt, [{
|
|
3521
3529
|
key: "getSync",
|
|
3522
3530
|
value: function getSync() {
|
|
3523
|
-
var e = this._dataLayer.getItem(
|
|
3531
|
+
var e = this._dataLayer.getItem(Ut);
|
|
3524
3532
|
if (null === e) return {
|
|
3525
3533
|
displayWatermark: !1,
|
|
3526
3534
|
cnameDomain: null,
|
|
@@ -3591,9 +3599,9 @@ var Ut = /*#__PURE__*/function () {
|
|
|
3591
3599
|
};
|
|
3592
3600
|
}
|
|
3593
3601
|
}]);
|
|
3594
|
-
return
|
|
3602
|
+
return Kt;
|
|
3595
3603
|
}();
|
|
3596
|
-
function
|
|
3604
|
+
function qt(e, t, r, n) {
|
|
3597
3605
|
return new (r || (r = Promise))(function (i, s) {
|
|
3598
3606
|
function o(e) {
|
|
3599
3607
|
try {
|
|
@@ -3619,11 +3627,11 @@ function Kt(e, t, r, n) {
|
|
|
3619
3627
|
});
|
|
3620
3628
|
}
|
|
3621
3629
|
"function" == typeof SuppressedError && SuppressedError;
|
|
3622
|
-
var
|
|
3630
|
+
var Wt = /*#__PURE__*/_createClass(function Wt(e) {
|
|
3623
3631
|
var _this2 = this;
|
|
3624
|
-
_classCallCheck(this,
|
|
3632
|
+
_classCallCheck(this, Wt);
|
|
3625
3633
|
this.bootstrapPromise = e, this.executeRecaptcha = function () {
|
|
3626
|
-
return
|
|
3634
|
+
return qt(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
3627
3635
|
var _yield$this$state, e, t, r;
|
|
3628
3636
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3629
3637
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -3654,7 +3662,7 @@ var qt = /*#__PURE__*/_createClass(function qt(e) {
|
|
|
3654
3662
|
}, _callee, this);
|
|
3655
3663
|
}));
|
|
3656
3664
|
}, this.state = e.then(function (e) {
|
|
3657
|
-
return
|
|
3665
|
+
return qt(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
3658
3666
|
var t;
|
|
3659
3667
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3660
3668
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -3665,7 +3673,7 @@ var qt = /*#__PURE__*/_createClass(function qt(e) {
|
|
|
3665
3673
|
}
|
|
3666
3674
|
_context2.t1 = !0;
|
|
3667
3675
|
_context2.next = 4;
|
|
3668
|
-
return t = e.captchaSettings.siteKey,
|
|
3676
|
+
return t = e.captchaSettings.siteKey, We("https://www.google.com/recaptcha/enterprise.js?render=".concat(t), function () {
|
|
3669
3677
|
return window.grecaptcha.enterprise;
|
|
3670
3678
|
});
|
|
3671
3679
|
case 4:
|
|
@@ -3692,10 +3700,10 @@ var qt = /*#__PURE__*/_createClass(function qt(e) {
|
|
|
3692
3700
|
}));
|
|
3693
3701
|
});
|
|
3694
3702
|
});
|
|
3695
|
-
var
|
|
3696
|
-
function
|
|
3703
|
+
var Gt = /*#__PURE__*/function () {
|
|
3704
|
+
function Gt(e) {
|
|
3697
3705
|
var _this3 = this;
|
|
3698
|
-
_classCallCheck(this,
|
|
3706
|
+
_classCallCheck(this, Gt);
|
|
3699
3707
|
this.iframeURL = e, this.oneTapStart = function (e) {
|
|
3700
3708
|
return _this3.call("oneTapStart", e);
|
|
3701
3709
|
}, this.oneTapSubmit = function (e) {
|
|
@@ -3704,11 +3712,11 @@ var Wt = /*#__PURE__*/function () {
|
|
|
3704
3712
|
return _this3.call("parsedPhoneNumber", e);
|
|
3705
3713
|
};
|
|
3706
3714
|
}
|
|
3707
|
-
_createClass(
|
|
3715
|
+
_createClass(Gt, [{
|
|
3708
3716
|
key: "frameClient",
|
|
3709
3717
|
get: function get() {
|
|
3710
3718
|
var e;
|
|
3711
|
-
return this._frameClient = null !== (e = this._frameClient) && void 0 !== e ? e : new
|
|
3719
|
+
return this._frameClient = null !== (e = this._frameClient) && void 0 !== e ? e : new Lt(this.iframeURL), this._frameClient;
|
|
3712
3720
|
}
|
|
3713
3721
|
}, {
|
|
3714
3722
|
key: "call",
|
|
@@ -3716,15 +3724,15 @@ var Wt = /*#__PURE__*/function () {
|
|
|
3716
3724
|
return this.frameClient.call(e, [t]);
|
|
3717
3725
|
}
|
|
3718
3726
|
}]);
|
|
3719
|
-
return
|
|
3727
|
+
return Gt;
|
|
3720
3728
|
}();
|
|
3721
|
-
var
|
|
3722
|
-
_inherits(
|
|
3723
|
-
function
|
|
3729
|
+
var Ht = /*#__PURE__*/function (_ut) {
|
|
3730
|
+
_inherits(Ht, _ut);
|
|
3731
|
+
function Ht(e, t, r, n, i, s) {
|
|
3724
3732
|
var _this4;
|
|
3725
|
-
_classCallCheck(this,
|
|
3726
|
-
_this4 = _callSuper(this,
|
|
3727
|
-
return
|
|
3733
|
+
_classCallCheck(this, Ht);
|
|
3734
|
+
_this4 = _callSuper(this, Ht, [e, t, r, n, i]), _this4._oneTap = s, _this4.startOneTap = function (e) {
|
|
3735
|
+
return qt(_assertThisInitialized(_this4), void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
3728
3736
|
var t, r, n;
|
|
3729
3737
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3730
3738
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -3762,20 +3770,20 @@ var Gt = /*#__PURE__*/function (_ct) {
|
|
|
3762
3770
|
};
|
|
3763
3771
|
return _this4;
|
|
3764
3772
|
}
|
|
3765
|
-
return _createClass(
|
|
3766
|
-
}(
|
|
3767
|
-
var
|
|
3768
|
-
function
|
|
3769
|
-
_classCallCheck(this,
|
|
3773
|
+
return _createClass(Ht);
|
|
3774
|
+
}(ut);
|
|
3775
|
+
var zt = /*#__PURE__*/function () {
|
|
3776
|
+
function zt(e, t, r, n) {
|
|
3777
|
+
_classCallCheck(this, zt);
|
|
3770
3778
|
this._publicToken = e, this._subscriptionDataLayer = t, this.baseURL = r, this.additionalTelemetryDataFn = n, this.updateSessionToken = function () {
|
|
3771
3779
|
return null;
|
|
3772
|
-
}, this.eventLogger = new
|
|
3780
|
+
}, this.eventLogger = new nt({
|
|
3773
3781
|
maxBatchSize: 15,
|
|
3774
3782
|
intervalDurationMs: 800,
|
|
3775
3783
|
logEventURL: this.buildSDKUrl("/events")
|
|
3776
3784
|
});
|
|
3777
3785
|
}
|
|
3778
|
-
_createClass(
|
|
3786
|
+
_createClass(zt, [{
|
|
3779
3787
|
key: "logEvent",
|
|
3780
3788
|
value: function logEvent(_ref) {
|
|
3781
3789
|
var e = _ref.name,
|
|
@@ -3795,9 +3803,9 @@ var Ht = /*#__PURE__*/function () {
|
|
|
3795
3803
|
key: "createTelemetryBlob",
|
|
3796
3804
|
value: function createTelemetryBlob() {
|
|
3797
3805
|
return Object.assign(Object.assign({
|
|
3798
|
-
event_id: "event-id-".concat(
|
|
3799
|
-
app_session_id: "app-session-id-".concat(
|
|
3800
|
-
persistent_id: "persistent-id-".concat(
|
|
3806
|
+
event_id: "event-id-".concat(Ke()),
|
|
3807
|
+
app_session_id: "app-session-id-".concat(Ke()),
|
|
3808
|
+
persistent_id: "persistent-id-".concat(Ke()),
|
|
3801
3809
|
client_sent_at: new Date().toISOString(),
|
|
3802
3810
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
3803
3811
|
}, this.additionalTelemetryDataFn()), {
|
|
@@ -3806,7 +3814,7 @@ var Ht = /*#__PURE__*/function () {
|
|
|
3806
3814
|
},
|
|
3807
3815
|
sdk: {
|
|
3808
3816
|
identifier: "Stytch.js Javascript SDK",
|
|
3809
|
-
version: "4.9.
|
|
3817
|
+
version: "4.9.1"
|
|
3810
3818
|
}
|
|
3811
3819
|
});
|
|
3812
3820
|
}
|
|
@@ -3817,13 +3825,13 @@ var Ht = /*#__PURE__*/function () {
|
|
|
3817
3825
|
t = _ref2.body,
|
|
3818
3826
|
r = _ref2.errorMessage,
|
|
3819
3827
|
n = _ref2.method;
|
|
3820
|
-
return
|
|
3828
|
+
return qt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
3821
3829
|
var i, s, o, a;
|
|
3822
3830
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
3823
3831
|
while (1) switch (_context4.prev = _context4.next) {
|
|
3824
3832
|
case 0:
|
|
3825
3833
|
i = this._subscriptionDataLayer.readSessionCookie().session_token, s = "Basic " + window.btoa(this._publicToken + ":" + (i || this._publicToken)), o = window.btoa(JSON.stringify(this.createTelemetryBlob())), a = window.location.origin;
|
|
3826
|
-
return _context4.abrupt("return",
|
|
3834
|
+
return _context4.abrupt("return", Fe({
|
|
3827
3835
|
basicAuthHeader: s,
|
|
3828
3836
|
body: t,
|
|
3829
3837
|
errorMessage: r,
|
|
@@ -3847,7 +3855,7 @@ var Ht = /*#__PURE__*/function () {
|
|
|
3847
3855
|
r = _ref3.errorMessage,
|
|
3848
3856
|
n = _ref3.method,
|
|
3849
3857
|
i = _ref3.retryCallback;
|
|
3850
|
-
return
|
|
3858
|
+
return qt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
3851
3859
|
var s, o, a, c;
|
|
3852
3860
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
3853
3861
|
while (1) switch (_context5.prev = _context5.next) {
|
|
@@ -3862,9 +3870,9 @@ var Ht = /*#__PURE__*/function () {
|
|
|
3862
3870
|
o = e.xSDKParentHostHeader,
|
|
3863
3871
|
a = e.body,
|
|
3864
3872
|
c = e.retryCallback;
|
|
3865
|
-
return
|
|
3873
|
+
return De(this, void 0, void 0, ve().mark(function e() {
|
|
3866
3874
|
var u;
|
|
3867
|
-
return
|
|
3875
|
+
return ve().wrap(function (e) {
|
|
3868
3876
|
for (;;) switch (e.prev = e.next) {
|
|
3869
3877
|
case 0:
|
|
3870
3878
|
return u = {
|
|
@@ -3875,18 +3883,18 @@ var Ht = /*#__PURE__*/function () {
|
|
|
3875
3883
|
xSDKClientHeader: s,
|
|
3876
3884
|
xSDKParentHostHeader: o,
|
|
3877
3885
|
body: a
|
|
3878
|
-
}, e.prev = 1, e.next = 4,
|
|
3886
|
+
}, e.prev = 1, e.next = 4, Fe(u);
|
|
3879
3887
|
case 4:
|
|
3880
3888
|
case 15:
|
|
3881
3889
|
return e.abrupt("return", e.sent);
|
|
3882
3890
|
case 7:
|
|
3883
|
-
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof
|
|
3891
|
+
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof Ie)) {
|
|
3884
3892
|
e.next = 16;
|
|
3885
3893
|
break;
|
|
3886
3894
|
}
|
|
3887
3895
|
return e.next = 12, c(e.t0, u);
|
|
3888
3896
|
case 12:
|
|
3889
|
-
return u = e.sent, e.next = 15,
|
|
3897
|
+
return u = e.sent, e.next = 15, Fe(u);
|
|
3890
3898
|
case 16:
|
|
3891
3899
|
throw e.t0;
|
|
3892
3900
|
case 17:
|
|
@@ -3918,18 +3926,18 @@ var Ht = /*#__PURE__*/function () {
|
|
|
3918
3926
|
return "".concat(this.baseURL, "/sdk/v1").concat(e);
|
|
3919
3927
|
}
|
|
3920
3928
|
}]);
|
|
3921
|
-
return
|
|
3929
|
+
return zt;
|
|
3922
3930
|
}();
|
|
3923
|
-
var
|
|
3924
|
-
|
|
3931
|
+
var Vt = "undefined" != typeof window && "IdentityCredential" in window,
|
|
3932
|
+
Yt = function Yt(e) {
|
|
3925
3933
|
return e === _.forceLegacyEmbedded ? "force" : e === _.embeddedOnly || e === _.embedded || e === _.floatingOrEmbedded;
|
|
3926
3934
|
};
|
|
3927
|
-
var
|
|
3928
|
-
function
|
|
3929
|
-
_classCallCheck(this,
|
|
3935
|
+
var Jt = /*#__PURE__*/function () {
|
|
3936
|
+
function Jt(e, t, r) {
|
|
3937
|
+
_classCallCheck(this, Jt);
|
|
3930
3938
|
this._googleClient = e, this._publicToken = t, this._clientId = r;
|
|
3931
3939
|
}
|
|
3932
|
-
_createClass(
|
|
3940
|
+
_createClass(Jt, [{
|
|
3933
3941
|
key: "cancel",
|
|
3934
3942
|
value: function cancel() {
|
|
3935
3943
|
this._googleClient.cancel();
|
|
@@ -3940,15 +3948,15 @@ var Yt = /*#__PURE__*/function () {
|
|
|
3940
3948
|
var e = _ref4.callback,
|
|
3941
3949
|
t = _ref4.onOneTapCancelled,
|
|
3942
3950
|
r = _ref4.style;
|
|
3943
|
-
return
|
|
3951
|
+
return qt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
3944
3952
|
var _this5 = this;
|
|
3945
3953
|
var n, i, s;
|
|
3946
3954
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
3947
3955
|
while (1) switch (_context6.prev = _context6.next) {
|
|
3948
3956
|
case 0:
|
|
3949
|
-
n =
|
|
3950
|
-
var t =
|
|
3951
|
-
return "force" === t || t && !
|
|
3957
|
+
n = Yt(r.position), i = function (e) {
|
|
3958
|
+
var t = Yt(e);
|
|
3959
|
+
return "force" === t || t && !Vt;
|
|
3952
3960
|
}(r.position), s = {
|
|
3953
3961
|
client_id: this._clientId,
|
|
3954
3962
|
callback: e,
|
|
@@ -3986,22 +3994,22 @@ var Yt = /*#__PURE__*/function () {
|
|
|
3986
3994
|
key: "styleFrame",
|
|
3987
3995
|
value: function styleFrame(e) {
|
|
3988
3996
|
e && Array.from(document.getElementsByTagName("iframe")).forEach(function (e) {
|
|
3989
|
-
e.src.includes(
|
|
3997
|
+
e.src.includes(Ae) && (e.style.width = "100%");
|
|
3990
3998
|
});
|
|
3991
3999
|
}
|
|
3992
4000
|
}]);
|
|
3993
|
-
return
|
|
4001
|
+
return Jt;
|
|
3994
4002
|
}();
|
|
3995
|
-
var
|
|
3996
|
-
function
|
|
4003
|
+
var $t = /*#__PURE__*/function () {
|
|
4004
|
+
function $t(e, t) {
|
|
3997
4005
|
var _this6 = this;
|
|
3998
|
-
_classCallCheck(this,
|
|
4006
|
+
_classCallCheck(this, $t);
|
|
3999
4007
|
this._publicToken = e, this.clientsideServices = t, this.createOnSuccessHandler = function (_ref5) {
|
|
4000
4008
|
var e = _ref5.loginRedirectUrl,
|
|
4001
4009
|
t = _ref5.signupRedirectUrl,
|
|
4002
4010
|
r = _ref5.onSuccess;
|
|
4003
4011
|
return function (n) {
|
|
4004
|
-
return
|
|
4012
|
+
return qt(_this6, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
4005
4013
|
var i, _yield$this$submitGoo, s;
|
|
4006
4014
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
4007
4015
|
while (1) switch (_context7.prev = _context7.next) {
|
|
@@ -4028,10 +4036,10 @@ var Jt = /*#__PURE__*/function () {
|
|
|
4028
4036
|
window.location.href = e;
|
|
4029
4037
|
};
|
|
4030
4038
|
}
|
|
4031
|
-
_createClass(
|
|
4039
|
+
_createClass($t, [{
|
|
4032
4040
|
key: "createOneTapClient",
|
|
4033
4041
|
value: function createOneTapClient() {
|
|
4034
|
-
return
|
|
4042
|
+
return qt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
4035
4043
|
var e, _yield$this$fetchGoog;
|
|
4036
4044
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
4037
4045
|
while (1) switch (_context8.prev = _context8.next) {
|
|
@@ -4062,9 +4070,9 @@ var Jt = /*#__PURE__*/function () {
|
|
|
4062
4070
|
});
|
|
4063
4071
|
case 12:
|
|
4064
4072
|
_context8.t1 = !0;
|
|
4065
|
-
_context8.t2 =
|
|
4073
|
+
_context8.t2 = Jt;
|
|
4066
4074
|
_context8.next = 16;
|
|
4067
|
-
return
|
|
4075
|
+
return We(Ee, function () {
|
|
4068
4076
|
return window.google.accounts.id;
|
|
4069
4077
|
});
|
|
4070
4078
|
case 16:
|
|
@@ -4096,7 +4104,7 @@ var Jt = /*#__PURE__*/function () {
|
|
|
4096
4104
|
var e = _ref6.credential,
|
|
4097
4105
|
t = _ref6.loginRedirectUrl,
|
|
4098
4106
|
r = _ref6.signupRedirectUrl;
|
|
4099
|
-
return
|
|
4107
|
+
return qt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
4100
4108
|
var _yield$this$fetchGoog2, n;
|
|
4101
4109
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
4102
4110
|
while (1) switch (_context9.prev = _context9.next) {
|
|
@@ -4133,21 +4141,21 @@ var Jt = /*#__PURE__*/function () {
|
|
|
4133
4141
|
}, {
|
|
4134
4142
|
key: "WillGoogleOneTapShowEmbedded",
|
|
4135
4143
|
value: function WillGoogleOneTapShowEmbedded() {
|
|
4136
|
-
return
|
|
4144
|
+
return !$t.WillGoogleOneTapShowBannerForUA(navigator.userAgent);
|
|
4137
4145
|
}
|
|
4138
4146
|
}]);
|
|
4139
|
-
return
|
|
4147
|
+
return $t;
|
|
4140
4148
|
}();
|
|
4141
|
-
function
|
|
4149
|
+
function Xt(e) {
|
|
4142
4150
|
var t = e.toString(16);
|
|
4143
4151
|
return 1 === t.length && (t = "0" + t), t;
|
|
4144
4152
|
}
|
|
4145
|
-
var
|
|
4146
|
-
function
|
|
4147
|
-
_classCallCheck(this,
|
|
4153
|
+
var Zt = /*#__PURE__*/function () {
|
|
4154
|
+
function Zt(e, t) {
|
|
4155
|
+
_classCallCheck(this, Zt);
|
|
4148
4156
|
this._dataLayer = e, this.namespace = t;
|
|
4149
4157
|
}
|
|
4150
|
-
_createClass(
|
|
4158
|
+
_createClass(Zt, [{
|
|
4151
4159
|
key: "key",
|
|
4152
4160
|
value: function key() {
|
|
4153
4161
|
return "PKCE_VERIFIER:" + this.namespace;
|
|
@@ -4155,13 +4163,13 @@ var Xt = /*#__PURE__*/function () {
|
|
|
4155
4163
|
}, {
|
|
4156
4164
|
key: "startPKCETransaction",
|
|
4157
4165
|
value: function startPKCETransaction() {
|
|
4158
|
-
return
|
|
4166
|
+
return qt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
4159
4167
|
var e;
|
|
4160
4168
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
4161
4169
|
while (1) switch (_context10.prev = _context10.next) {
|
|
4162
4170
|
case 0:
|
|
4163
4171
|
_context10.next = 2;
|
|
4164
|
-
return
|
|
4172
|
+
return Zt.createProofkeyPair();
|
|
4165
4173
|
case 2:
|
|
4166
4174
|
e = _context10.sent;
|
|
4167
4175
|
return _context10.abrupt("return", (this._dataLayer.setItem(this.key(), JSON.stringify(e)), e));
|
|
@@ -4179,7 +4187,7 @@ var Xt = /*#__PURE__*/function () {
|
|
|
4179
4187
|
if (null !== e) try {
|
|
4180
4188
|
return JSON.parse(e);
|
|
4181
4189
|
} catch (e) {
|
|
4182
|
-
return void
|
|
4190
|
+
return void Ye("Found malformed Proof Key pair in localstorage.");
|
|
4183
4191
|
}
|
|
4184
4192
|
}
|
|
4185
4193
|
}, {
|
|
@@ -4190,7 +4198,7 @@ var Xt = /*#__PURE__*/function () {
|
|
|
4190
4198
|
}], [{
|
|
4191
4199
|
key: "createProofkeyPair",
|
|
4192
4200
|
value: function createProofkeyPair() {
|
|
4193
|
-
return
|
|
4201
|
+
return qt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
4194
4202
|
var _String$fromCharCode;
|
|
4195
4203
|
var e, t, r, n;
|
|
4196
4204
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
@@ -4198,7 +4206,7 @@ var Xt = /*#__PURE__*/function () {
|
|
|
4198
4206
|
case 0:
|
|
4199
4207
|
e = new Uint32Array(16);
|
|
4200
4208
|
window.crypto.getRandomValues(e);
|
|
4201
|
-
t = Array.from(e).map(
|
|
4209
|
+
t = Array.from(e).map(Xt).join("");
|
|
4202
4210
|
_context11.next = 5;
|
|
4203
4211
|
return window.crypto.subtle.digest("SHA-256", new TextEncoder().encode(t));
|
|
4204
4212
|
case 5:
|
|
@@ -4215,9 +4223,9 @@ var Xt = /*#__PURE__*/function () {
|
|
|
4215
4223
|
}));
|
|
4216
4224
|
}
|
|
4217
4225
|
}]);
|
|
4218
|
-
return
|
|
4226
|
+
return Zt;
|
|
4219
4227
|
}();
|
|
4220
|
-
var
|
|
4228
|
+
var Qt = function Qt(e) {
|
|
4221
4229
|
return (document.cookie ? document.cookie.split("; ") : []).filter(function (t) {
|
|
4222
4230
|
var _t$split = t.split("="),
|
|
4223
4231
|
_t$split2 = _slicedToArray(_t$split, 1),
|
|
@@ -4226,17 +4234,17 @@ var Zt = function Zt(e) {
|
|
|
4226
4234
|
}).length > 1;
|
|
4227
4235
|
};
|
|
4228
4236
|
/*! js-cookie v3.0.1 | MIT */
|
|
4229
|
-
function
|
|
4237
|
+
function er(e) {
|
|
4230
4238
|
for (var t = 1; t < arguments.length; t++) {
|
|
4231
4239
|
var r = arguments[t];
|
|
4232
4240
|
for (var n in r) e[n] = r[n];
|
|
4233
4241
|
}
|
|
4234
4242
|
return e;
|
|
4235
4243
|
}
|
|
4236
|
-
var
|
|
4244
|
+
var tr = function e(t, r) {
|
|
4237
4245
|
function n(e, n, i) {
|
|
4238
4246
|
if ("undefined" != typeof document) {
|
|
4239
|
-
"number" == typeof (i =
|
|
4247
|
+
"number" == typeof (i = er({}, 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);
|
|
4240
4248
|
var s = "";
|
|
4241
4249
|
for (var o in i) i[o] && (s += "; " + o, !0 !== i[o] && (s += "=" + i[o].split(";")[0]));
|
|
4242
4250
|
return document.cookie = e + "=" + t.write(n, e) + s;
|
|
@@ -4258,15 +4266,15 @@ var er = function e(t, r) {
|
|
|
4258
4266
|
}
|
|
4259
4267
|
},
|
|
4260
4268
|
remove: function remove(e, t) {
|
|
4261
|
-
n(e, "",
|
|
4269
|
+
n(e, "", er({}, t, {
|
|
4262
4270
|
expires: -1
|
|
4263
4271
|
}));
|
|
4264
4272
|
},
|
|
4265
4273
|
withAttributes: function withAttributes(t) {
|
|
4266
|
-
return e(this.converter,
|
|
4274
|
+
return e(this.converter, er({}, this.attributes, t));
|
|
4267
4275
|
},
|
|
4268
4276
|
withConverter: function withConverter(t) {
|
|
4269
|
-
return e(
|
|
4277
|
+
return e(er({}, this.converter, t), this.attributes);
|
|
4270
4278
|
}
|
|
4271
4279
|
}, {
|
|
4272
4280
|
attributes: {
|
|
@@ -4286,37 +4294,37 @@ var er = function e(t, r) {
|
|
|
4286
4294
|
}, {
|
|
4287
4295
|
path: "/"
|
|
4288
4296
|
});
|
|
4289
|
-
var
|
|
4297
|
+
var rr = function rr(e) {
|
|
4290
4298
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
4291
4299
|
return "stytch_sdk_state_".concat(e).concat(t ? "::".concat(t) : "");
|
|
4292
4300
|
},
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
clearTimeout(
|
|
4301
|
+
nr = new Map(),
|
|
4302
|
+
ir = function ir(e) {
|
|
4303
|
+
clearTimeout(nr.get(e));
|
|
4296
4304
|
},
|
|
4297
|
-
|
|
4298
|
-
|
|
4305
|
+
sr = function sr(e, t, r) {
|
|
4306
|
+
ir(e);
|
|
4299
4307
|
var n = setTimeout(function () {
|
|
4300
|
-
void 0 ===
|
|
4308
|
+
void 0 === tr.get(e) && tr.set(e, t, r);
|
|
4301
4309
|
}, 10);
|
|
4302
|
-
return
|
|
4310
|
+
return nr.set(e, n), tr.set(e, t, r);
|
|
4303
4311
|
};
|
|
4304
|
-
var
|
|
4305
|
-
function
|
|
4312
|
+
var or = /*#__PURE__*/function () {
|
|
4313
|
+
function or(e, t) {
|
|
4306
4314
|
var _this7 = this;
|
|
4307
|
-
_classCallCheck(this,
|
|
4315
|
+
_classCallCheck(this, or);
|
|
4308
4316
|
this.browserSessionStorage = {
|
|
4309
4317
|
getItem: function getItem(e) {
|
|
4310
|
-
return sessionStorage.getItem(
|
|
4318
|
+
return sessionStorage.getItem(rr(_this7.publicToken, e));
|
|
4311
4319
|
},
|
|
4312
4320
|
setItem: function setItem(e, t) {
|
|
4313
|
-
return sessionStorage.setItem(
|
|
4321
|
+
return sessionStorage.setItem(rr(_this7.publicToken, e), t);
|
|
4314
4322
|
},
|
|
4315
4323
|
removeItem: function removeItem(e) {
|
|
4316
|
-
return sessionStorage.removeItem(
|
|
4324
|
+
return sessionStorage.removeItem(rr(_this7.publicToken, e));
|
|
4317
4325
|
}
|
|
4318
|
-
}, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (
|
|
4319
|
-
var r = localStorage.getItem(
|
|
4326
|
+
}, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (Xe("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);
|
|
4327
|
+
var r = localStorage.getItem(rr(this.publicToken));
|
|
4320
4328
|
if (!r) return;
|
|
4321
4329
|
var n;
|
|
4322
4330
|
try {
|
|
@@ -4326,7 +4334,7 @@ var sr = /*#__PURE__*/function () {
|
|
|
4326
4334
|
}
|
|
4327
4335
|
this.state = n;
|
|
4328
4336
|
}
|
|
4329
|
-
_createClass(
|
|
4337
|
+
_createClass(or, [{
|
|
4330
4338
|
key: "opaqueTokenCookieName",
|
|
4331
4339
|
get: function get() {
|
|
4332
4340
|
var e;
|
|
@@ -4348,14 +4356,14 @@ var sr = /*#__PURE__*/function () {
|
|
|
4348
4356
|
key: "readSessionCookie",
|
|
4349
4357
|
value: function readSessionCookie() {
|
|
4350
4358
|
return {
|
|
4351
|
-
session_token:
|
|
4352
|
-
session_jwt:
|
|
4359
|
+
session_token: tr.get(this.opaqueTokenCookieName),
|
|
4360
|
+
session_jwt: tr.get(this.jwtCookieName)
|
|
4353
4361
|
};
|
|
4354
4362
|
}
|
|
4355
4363
|
}, {
|
|
4356
4364
|
key: "readIntermediateSessionTokenCookie",
|
|
4357
4365
|
value: function readIntermediateSessionTokenCookie() {
|
|
4358
|
-
return
|
|
4366
|
+
return tr.get(this.istCookieName);
|
|
4359
4367
|
}
|
|
4360
4368
|
}, {
|
|
4361
4369
|
key: "writeSessionCookie",
|
|
@@ -4364,32 +4372,32 @@ var sr = /*#__PURE__*/function () {
|
|
|
4364
4372
|
var s = e.state,
|
|
4365
4373
|
o = e.session_token,
|
|
4366
4374
|
a = e.session_jwt,
|
|
4367
|
-
c =
|
|
4375
|
+
c = or.generateCookieOpts({
|
|
4368
4376
|
expiresAt: null !== (r = null === (t = null == s ? void 0 : s.session) || void 0 === t ? void 0 : t.expires_at) && void 0 !== r ? r : "",
|
|
4369
4377
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4370
4378
|
path: this._cookiePath,
|
|
4371
4379
|
domain: this._domain
|
|
4372
4380
|
});
|
|
4373
|
-
|
|
4374
|
-
var u =
|
|
4381
|
+
sr(this.opaqueTokenCookieName, o, c), sr(this.jwtCookieName, a, c);
|
|
4382
|
+
var u = or.generateCookieOpts({
|
|
4375
4383
|
expiresAt: null !== (i = null === (n = null == s ? void 0 : s.session) || void 0 === n ? void 0 : n.expires_at) && void 0 !== i ? i : "",
|
|
4376
4384
|
availableToSubdomains: !this._cookieAvailableToSubdomains,
|
|
4377
4385
|
path: this._cookiePath,
|
|
4378
4386
|
domain: this._domain
|
|
4379
4387
|
});
|
|
4380
|
-
|
|
4388
|
+
Qt(this.jwtCookieName) && tr.remove(this.jwtCookieName, u), Qt(this.opaqueTokenCookieName) && tr.remove(this.opaqueTokenCookieName, u), Qt(this.jwtCookieName) && Ye("Could not remove extraneous JWT cookie. This might happen if the cookie has been set using multiple `path` settings, and may produce unwanted behavior."), Qt(this.opaqueTokenCookieName) && Ye("Could not remove extraneous opaque token cookie.");
|
|
4381
4389
|
}
|
|
4382
4390
|
}, {
|
|
4383
4391
|
key: "writeIntermediateSessionTokenCookie",
|
|
4384
4392
|
value: function writeIntermediateSessionTokenCookie(e) {
|
|
4385
4393
|
var t = new Date(Date.now() + 6e5),
|
|
4386
|
-
r =
|
|
4394
|
+
r = or.generateCookieOpts({
|
|
4387
4395
|
expiresAt: t.toString(),
|
|
4388
4396
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4389
4397
|
path: this._cookiePath,
|
|
4390
4398
|
domain: this._domain
|
|
4391
4399
|
});
|
|
4392
|
-
|
|
4400
|
+
sr(this.istCookieName, e, r);
|
|
4393
4401
|
}
|
|
4394
4402
|
}, {
|
|
4395
4403
|
key: "removeSessionCookie",
|
|
@@ -4408,38 +4416,38 @@ var sr = /*#__PURE__*/function () {
|
|
|
4408
4416
|
[!0, !1].forEach(function (t) {
|
|
4409
4417
|
[_this8._cookiePath, null].forEach(function (r) {
|
|
4410
4418
|
[_this8._domain, null].forEach(function (n) {
|
|
4411
|
-
var i =
|
|
4419
|
+
var i = or.generateCookieOpts({
|
|
4412
4420
|
expiresAt: new Date(0).toString(),
|
|
4413
4421
|
availableToSubdomains: t,
|
|
4414
4422
|
path: r,
|
|
4415
4423
|
domain: n
|
|
4416
4424
|
});
|
|
4417
4425
|
e.forEach(function (e) {
|
|
4418
|
-
|
|
4426
|
+
tr.remove(e, i);
|
|
4419
4427
|
});
|
|
4420
4428
|
});
|
|
4421
4429
|
});
|
|
4422
|
-
}), e.forEach(
|
|
4430
|
+
}), e.forEach(ir);
|
|
4423
4431
|
}
|
|
4424
4432
|
}, {
|
|
4425
4433
|
key: "syncToLocalStorage",
|
|
4426
4434
|
value: function syncToLocalStorage() {
|
|
4427
|
-
localStorage.setItem(
|
|
4435
|
+
localStorage.setItem(rr(this.publicToken), JSON.stringify(this.state));
|
|
4428
4436
|
}
|
|
4429
4437
|
}, {
|
|
4430
4438
|
key: "getItem",
|
|
4431
4439
|
value: function getItem(e) {
|
|
4432
|
-
return localStorage.getItem(
|
|
4440
|
+
return localStorage.getItem(rr(this.publicToken, e));
|
|
4433
4441
|
}
|
|
4434
4442
|
}, {
|
|
4435
4443
|
key: "setItem",
|
|
4436
4444
|
value: function setItem(e, t) {
|
|
4437
|
-
return localStorage.setItem(
|
|
4445
|
+
return localStorage.setItem(rr(this.publicToken, e), t);
|
|
4438
4446
|
}
|
|
4439
4447
|
}, {
|
|
4440
4448
|
key: "removeItem",
|
|
4441
4449
|
value: function removeItem(e) {
|
|
4442
|
-
return localStorage.removeItem(
|
|
4450
|
+
return localStorage.removeItem(rr(this.publicToken, e));
|
|
4443
4451
|
}
|
|
4444
4452
|
}], [{
|
|
4445
4453
|
key: "generateCookieOpts",
|
|
@@ -4455,30 +4463,30 @@ var sr = /*#__PURE__*/function () {
|
|
|
4455
4463
|
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;
|
|
4456
4464
|
}
|
|
4457
4465
|
}]);
|
|
4458
|
-
return
|
|
4466
|
+
return or;
|
|
4459
4467
|
}();
|
|
4460
|
-
var
|
|
4461
|
-
_inherits(
|
|
4462
|
-
function
|
|
4463
|
-
_classCallCheck(this,
|
|
4464
|
-
return _callSuper(this,
|
|
4468
|
+
var ar = /*#__PURE__*/function (_or) {
|
|
4469
|
+
_inherits(ar, _or);
|
|
4470
|
+
function ar() {
|
|
4471
|
+
_classCallCheck(this, ar);
|
|
4472
|
+
return _callSuper(this, ar, arguments);
|
|
4465
4473
|
}
|
|
4466
|
-
return _createClass(
|
|
4467
|
-
}(
|
|
4468
|
-
var
|
|
4469
|
-
|
|
4474
|
+
return _createClass(ar);
|
|
4475
|
+
}(or);
|
|
4476
|
+
var cr = Symbol["for"]("__stytch_DataLayer"),
|
|
4477
|
+
ur = function ur(e, t) {
|
|
4470
4478
|
var r = function () {
|
|
4471
4479
|
var e = window;
|
|
4472
|
-
return e[
|
|
4480
|
+
return e[cr] || (e[cr] = {}), e[cr];
|
|
4473
4481
|
}();
|
|
4474
|
-
return r[e] || (r[e] = new
|
|
4482
|
+
return r[e] || (r[e] = new ar(e, t)), r[e];
|
|
4475
4483
|
},
|
|
4476
|
-
|
|
4484
|
+
lr = function lr(e, t) {
|
|
4477
4485
|
Object.values(e).forEach(function (e) {
|
|
4478
4486
|
return e(t);
|
|
4479
4487
|
});
|
|
4480
4488
|
},
|
|
4481
|
-
|
|
4489
|
+
dr = function () {
|
|
4482
4490
|
var _ref8 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
4483
4491
|
_ref8$KEYS_TO_EXCLUDE = _ref8.KEYS_TO_EXCLUDE,
|
|
4484
4492
|
e = _ref8$KEYS_TO_EXCLUDE === void 0 ? [] : _ref8$KEYS_TO_EXCLUDE;
|
|
@@ -4500,12 +4508,12 @@ var ar = Symbol["for"]("__stytch_DataLayer"),
|
|
|
4500
4508
|
}({
|
|
4501
4509
|
KEYS_TO_EXCLUDE: ["last_accessed_at"]
|
|
4502
4510
|
});
|
|
4503
|
-
var
|
|
4504
|
-
function
|
|
4511
|
+
var hr = /*#__PURE__*/function () {
|
|
4512
|
+
function hr(e, t) {
|
|
4505
4513
|
var _this9 = this;
|
|
4506
|
-
_classCallCheck(this,
|
|
4514
|
+
_classCallCheck(this, hr);
|
|
4507
4515
|
this._publicToken = e, this._datalayer = t, this.fromCache = !0, this._listen = function (e) {
|
|
4508
|
-
if (e.key !==
|
|
4516
|
+
if (e.key !== rr(_this9._publicToken)) return;
|
|
4509
4517
|
var t = null === e.newValue || "null" === e.newValue ? null : JSON.parse(e.newValue);
|
|
4510
4518
|
_this9.updateState(t, !0);
|
|
4511
4519
|
}, window.addEventListener("storage", this._listen);
|
|
@@ -4513,7 +4521,7 @@ var dr = /*#__PURE__*/function () {
|
|
|
4513
4521
|
r = _this$_datalayer$read.session_token;
|
|
4514
4522
|
r || this.destroySession();
|
|
4515
4523
|
}
|
|
4516
|
-
_createClass(
|
|
4524
|
+
_createClass(hr, [{
|
|
4517
4525
|
key: "getTokens",
|
|
4518
4526
|
value: function getTokens() {
|
|
4519
4527
|
var _this$_datalayer$read2 = this._datalayer.readSessionCookie(),
|
|
@@ -4551,7 +4559,7 @@ var dr = /*#__PURE__*/function () {
|
|
|
4551
4559
|
r = null === e.state ? null : Object.assign(Object.assign({}, this._datalayer.state), e.state);
|
|
4552
4560
|
this._datalayer.state = r;
|
|
4553
4561
|
var n = this.getFromCache();
|
|
4554
|
-
this.setCacheRefreshed(), !n &&
|
|
4562
|
+
this.setCacheRefreshed(), !n && dr(t, r) || lr(this._datalayer.subscriptions, r);
|
|
4555
4563
|
}
|
|
4556
4564
|
}, {
|
|
4557
4565
|
key: "updateStateAndTokens",
|
|
@@ -4567,8 +4575,8 @@ var dr = /*#__PURE__*/function () {
|
|
|
4567
4575
|
this._datalayer.state = n;
|
|
4568
4576
|
var i = this.getFromCache();
|
|
4569
4577
|
this.setCacheRefreshed();
|
|
4570
|
-
var s = !
|
|
4571
|
-
(i || s) && (
|
|
4578
|
+
var s = !dr(r, n);
|
|
4579
|
+
(i || s) && (lr(this._datalayer.subscriptions, n), s && !t && this._datalayer.syncToLocalStorage());
|
|
4572
4580
|
}
|
|
4573
4581
|
}, {
|
|
4574
4582
|
key: "updateTokens",
|
|
@@ -4618,14 +4626,14 @@ var dr = /*#__PURE__*/function () {
|
|
|
4618
4626
|
this.fromCache = !1;
|
|
4619
4627
|
}
|
|
4620
4628
|
}]);
|
|
4621
|
-
return
|
|
4629
|
+
return hr;
|
|
4622
4630
|
}();
|
|
4623
|
-
var
|
|
4624
|
-
_inherits(
|
|
4625
|
-
function
|
|
4631
|
+
var pr = /*#__PURE__*/function (_hr) {
|
|
4632
|
+
_inherits(pr, _hr);
|
|
4633
|
+
function pr() {
|
|
4626
4634
|
var _this10;
|
|
4627
|
-
_classCallCheck(this,
|
|
4628
|
-
_this10 = _callSuper(this,
|
|
4635
|
+
_classCallCheck(this, pr);
|
|
4636
|
+
_this10 = _callSuper(this, pr, arguments), _this10.updateUser = function (e) {
|
|
4629
4637
|
return _this10.updateState({
|
|
4630
4638
|
user: e
|
|
4631
4639
|
});
|
|
@@ -4638,17 +4646,17 @@ var hr = /*#__PURE__*/function (_dr) {
|
|
|
4638
4646
|
};
|
|
4639
4647
|
return _this10;
|
|
4640
4648
|
}
|
|
4641
|
-
return _createClass(
|
|
4642
|
-
}(
|
|
4643
|
-
var
|
|
4644
|
-
var
|
|
4649
|
+
return _createClass(pr);
|
|
4650
|
+
}(hr);
|
|
4651
|
+
var fr = Symbol["for"]("stytch__internal_b2c");
|
|
4652
|
+
var _r = /*#__PURE__*/_createClass(function _r(e, t) {
|
|
4645
4653
|
var _this11 = this;
|
|
4646
|
-
_classCallCheck(this,
|
|
4654
|
+
_classCallCheck(this, _r);
|
|
4647
4655
|
var r;
|
|
4648
4656
|
!function (e) {
|
|
4649
4657
|
var t = "StytchUIClient" === e ? "import { createStytchUIClient } from '@stytch/nextjs/ui';\n \nconst stytch = createStytchUIClient('public-token-...');\n" : "import { createStytchHeadlessClient } from '@stytch/nextjs/ui';\n \nconst stytch = createStytchHeadlessClient('public-token-...');\n";
|
|
4650
4658
|
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(t, "\n```\n"));
|
|
4651
|
-
}("StytchHeadlessClient"), "string" != typeof (r = e) ?
|
|
4659
|
+
}("StytchHeadlessClient"), "string" != typeof (r = e) ? Ye("Public token is malformed. Expected a string, got ".concat(me(r), ".").concat($e)) : "" === r ? Ye('Public token is malformed. Expected "public-token-...", got an empty string.'.concat($e)) : r.startsWith("public-token-") || Ye('Public token is malformed. Expected "public-token-...", got '.concat(r, ".").concat($e));
|
|
4652
4660
|
var n = t,
|
|
4653
4661
|
i = {
|
|
4654
4662
|
cookieOptions: null == (s = n) ? void 0 : s.cookieOptions,
|
|
@@ -4661,30 +4669,30 @@ var fr = /*#__PURE__*/_createClass(function fr(e, t) {
|
|
|
4661
4669
|
}
|
|
4662
4670
|
};
|
|
4663
4671
|
var s, o, a, c, u, l, d, h, p, f, _;
|
|
4664
|
-
this._dataLayer =
|
|
4672
|
+
this._dataLayer = ur(e, n), this._subscriptionService = new pr(e, this._dataLayer), this._stateChangeClient = new Nt(this._subscriptionService, {}), this.onStateChange = function () {
|
|
4665
4673
|
var _this11$_stateChangeC;
|
|
4666
4674
|
return (_this11$_stateChangeC = _this11._stateChangeClient).onStateChange.apply(_this11$_stateChangeC, arguments);
|
|
4667
4675
|
};
|
|
4668
|
-
var m = new
|
|
4669
|
-
this._networkClient = new
|
|
4676
|
+
var m = new Zt(this._dataLayer, "passwords");
|
|
4677
|
+
this._networkClient = new zt(e, this._dataLayer, i.endpoints.sdkBackendURL, function () {
|
|
4670
4678
|
var e, t, r, n;
|
|
4671
4679
|
return {
|
|
4672
4680
|
stytch_user_id: null === (t = null === (e = _this11._dataLayer.state) || void 0 === e ? void 0 : e.user) || void 0 === t ? void 0 : t.user_id,
|
|
4673
4681
|
stytch_session_id: null === (n = null === (r = _this11._dataLayer.state) || void 0 === r ? void 0 : r.session) || void 0 === n ? void 0 : n.session_id
|
|
4674
4682
|
};
|
|
4675
4683
|
});
|
|
4676
|
-
var v = new
|
|
4677
|
-
y = new
|
|
4678
|
-
g = new
|
|
4679
|
-
b = new
|
|
4680
|
-
k = new
|
|
4681
|
-
w = new
|
|
4684
|
+
var v = new Kt(e, this._networkClient, this._dataLayer),
|
|
4685
|
+
y = new Wt(v.getAsync()),
|
|
4686
|
+
g = new et(e, i.endpoints.dfpBackendURL, v.getAsync(), y.executeRecaptcha),
|
|
4687
|
+
b = new Gt(i.endpoints.clientsideServicesIframeURL),
|
|
4688
|
+
k = new $t(e, b),
|
|
4689
|
+
w = new Bt(this._networkClient, g);
|
|
4682
4690
|
var S, C;
|
|
4683
|
-
this.user = new
|
|
4691
|
+
this.user = new it(this._networkClient, this._subscriptionService), this.session = new st(this._networkClient, this._subscriptionService), this.magicLinks = new at(this._networkClient, this._subscriptionService, new Zt(this._dataLayer, "magic_links"), m, v.getAsync(), g), this.otps = new ct(this._networkClient, this._subscriptionService, y.executeRecaptcha, g), this.oauth = new Ht(this._networkClient, this._subscriptionService, new Zt(this._dataLayer, "oauth"), v.getAsync(), {
|
|
4684
4692
|
publicToken: e,
|
|
4685
4693
|
testAPIURL: i.endpoints.testAPIURL,
|
|
4686
4694
|
liveAPIURL: i.endpoints.liveAPIURL
|
|
4687
|
-
}, k), this.cryptoWallets = new
|
|
4695
|
+
}, k), this.cryptoWallets = new lt(this._networkClient, this._subscriptionService, y.executeRecaptcha, g), this.totps = new dt(this._networkClient, this._subscriptionService, g), this.webauthn = new It(this._networkClient, this._subscriptionService, g), this.passwords = new jt(this._networkClient, this._subscriptionService, m, v.getAsync(), g), this._sessionManager = new Mt(this._subscriptionService, this.session), this._dataLayer.readSessionCookie().session_token && this._sessionManager.performBackgroundRefresh(), this._networkClient.logEvent({
|
|
4688
4696
|
name: "sdk_instance_instantiated",
|
|
4689
4697
|
details: {
|
|
4690
4698
|
event_callback_registered: !1,
|
|
@@ -4700,6 +4708,6 @@ var fr = /*#__PURE__*/_createClass(function fr(e, t) {
|
|
|
4700
4708
|
publicToken: e,
|
|
4701
4709
|
dataLayer: this._dataLayer,
|
|
4702
4710
|
networkClient: this._networkClient
|
|
4703
|
-
}, Object.assign(S, _defineProperty({},
|
|
4711
|
+
}, Object.assign(S, _defineProperty({}, fr, C));
|
|
4704
4712
|
});
|
|
4705
|
-
export { b as AuthFlowType, k as B2BMFAProducts, w as B2BOAuthProviders, g as B2BProducts,
|
|
4713
|
+
export { b as AuthFlowType, k as B2BMFAProducts, w as B2BOAuthProviders, g as B2BProducts, ee as BiometricsFailedError, L as BiometricsUnavailableError, J as ChallengeSigningFailedError, q as DeviceCredentialsNotAllowedError, X as FailedCodeChallengeError, Q as FailedToDecryptDataError, F as InternalError, z as InvalidAuthorizationCredentialError, ie as InvalidCredentialTypeError, re as InvalidRedirectSchemeError, te as InvalidStartUrlError, oe as JSONDataNotConvertibleToStringError, B as KeyInvalidatedError, M as KeystoreUnavailableError, se as MissingAttestationObjectError, H as MissingAuthorizationCredentialIDTokenError, W as MissingGoogleClientIDError, G as MissingPKCEError, Y as MissingPublicKeyError, ne as MissingUrlError, N as NoBiometricsEnrolledError, j as NoBiometricsRegistrationError, V as NoCredentialsPresentError, I as NoCurrentSessionError, p as OAuthProviders, m as OTPMethods, _ as OneTapPositions, ce as PasskeysInvalidEncoding, ue as PasskeysMisconfigured, Z as PasskeysUnsupportedError, h as Products, y as RNUIProducts, ae as RandomNumberGenerationFailed, S as SDKAPIUnreachableError, $ as SDKNotConfiguredError, le as SignInWithAppleMisconfigured, D as StytchAPIError, x as StytchAPISchemaError, E as StytchAPIUnreachableError, A as StytchError, v as StytchEventType, _r as StytchHeadlessClient, O as StytchSDKAPIError, R as StytchSDKError, T as StytchSDKSchemaError, C as StytchSDKUsageError, P as UNRECOVERABLE_ERROR_TYPES, U as UserCancellationError, K as UserLockedOutError, f as Wallets, de as errorToStytchError };
|