@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
package/dist/index.headless.js
CHANGED
|
@@ -312,107 +312,113 @@ var g,
|
|
|
312
312
|
}(),
|
|
313
313
|
V = function (e) {
|
|
314
314
|
function t() {
|
|
315
|
-
return i(this, t), s(this, t, ["
|
|
315
|
+
return i(this, t), s(this, t, ["NoCredentialsPresentError", "The user did not provide credentials for a Google OneTap attempt"]);
|
|
316
316
|
}
|
|
317
317
|
return a(t, R), r(t);
|
|
318
318
|
}(),
|
|
319
319
|
Y = function (e) {
|
|
320
320
|
function t() {
|
|
321
|
-
return i(this, t), s(this, t, ["
|
|
321
|
+
return i(this, t), s(this, t, ["MissingPublicKeyError", "Failed to retrieve the public key. Add a new biometric registration."]);
|
|
322
322
|
}
|
|
323
323
|
return a(t, R), r(t);
|
|
324
324
|
}(),
|
|
325
325
|
J = function (e) {
|
|
326
326
|
function t() {
|
|
327
|
-
return i(this, t), s(this, t, ["
|
|
327
|
+
return i(this, t), s(this, t, ["ChallengeSigningFailedError", "Failed to sign the challenge with the key."]);
|
|
328
328
|
}
|
|
329
329
|
return a(t, R), r(t);
|
|
330
330
|
}(),
|
|
331
331
|
$ = function (e) {
|
|
332
332
|
function t() {
|
|
333
|
-
return i(this, t), s(this, t, ["
|
|
333
|
+
return i(this, t), s(this, t, ["SDKNotConfiguredError", "Stytch client is not confiured. You must call the configure method before using the SDK"]);
|
|
334
334
|
}
|
|
335
335
|
return a(t, R), r(t);
|
|
336
336
|
}(),
|
|
337
337
|
X = function (e) {
|
|
338
338
|
function t() {
|
|
339
|
-
return i(this, t), s(this, t, ["
|
|
339
|
+
return i(this, t), s(this, t, ["FailedCodeChallengeError", "Failed to create a code challenge"]);
|
|
340
340
|
}
|
|
341
341
|
return a(t, R), r(t);
|
|
342
342
|
}(),
|
|
343
343
|
Z = function (e) {
|
|
344
344
|
function t() {
|
|
345
|
-
return i(this, t), s(this, t, ["
|
|
345
|
+
return i(this, t), s(this, t, ["PasskeysUnsupportedError", "Passkeys are not supported on this device"]);
|
|
346
346
|
}
|
|
347
347
|
return a(t, R), r(t);
|
|
348
348
|
}(),
|
|
349
349
|
Q = function (e) {
|
|
350
350
|
function t() {
|
|
351
|
-
return i(this, t), s(this, t, ["
|
|
351
|
+
return i(this, t), s(this, t, ["FailedToDecryptDataError", "Failed to decrypt user data"]);
|
|
352
352
|
}
|
|
353
353
|
return a(t, R), r(t);
|
|
354
354
|
}(),
|
|
355
355
|
ee = function (e) {
|
|
356
356
|
function t() {
|
|
357
|
-
return i(this, t), s(this, t, ["
|
|
357
|
+
return i(this, t), s(this, t, ["BiometricsFailedError", "Biometric authentication failed"]);
|
|
358
358
|
}
|
|
359
359
|
return a(t, R), r(t);
|
|
360
360
|
}(),
|
|
361
361
|
te = function (e) {
|
|
362
362
|
function t() {
|
|
363
|
-
return i(this, t), s(this, t, ["
|
|
363
|
+
return i(this, t), s(this, t, ["InvalidStartUrlError", "The start URL was invalid or improperly formatted."]);
|
|
364
364
|
}
|
|
365
365
|
return a(t, R), r(t);
|
|
366
366
|
}(),
|
|
367
367
|
re = function (e) {
|
|
368
368
|
function t() {
|
|
369
|
-
return i(this, t), s(this, t, ["
|
|
369
|
+
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."]);
|
|
370
370
|
}
|
|
371
371
|
return a(t, R), r(t);
|
|
372
372
|
}(),
|
|
373
373
|
ne = function (e) {
|
|
374
374
|
function t() {
|
|
375
|
-
return i(this, t), s(this, t, ["
|
|
375
|
+
return i(this, t), s(this, t, ["MissingUrlError", "The underlying web authentication service failed to return a URL."]);
|
|
376
376
|
}
|
|
377
377
|
return a(t, R), r(t);
|
|
378
378
|
}(),
|
|
379
379
|
ie = function (e) {
|
|
380
380
|
function t() {
|
|
381
|
-
return i(this, t), s(this, t, ["
|
|
381
|
+
return i(this, t), s(this, t, ["InvalidCredentialTypeError", "The public key credential type was not of the expected type."]);
|
|
382
382
|
}
|
|
383
383
|
return a(t, R), r(t);
|
|
384
384
|
}(),
|
|
385
385
|
se = function (e) {
|
|
386
386
|
function t() {
|
|
387
|
-
return i(this, t), s(this, t, ["
|
|
387
|
+
return i(this, t), s(this, t, ["MissingAttestationObjectError", "The public key credential is missing the attestation object."]);
|
|
388
388
|
}
|
|
389
389
|
return a(t, R), r(t);
|
|
390
390
|
}(),
|
|
391
391
|
oe = function (e) {
|
|
392
392
|
function t() {
|
|
393
|
-
return i(this, t), s(this, t, ["
|
|
393
|
+
return i(this, t), s(this, t, ["JSONDataNotConvertibleToStringError", "JSON data unable to be converted to String type."]);
|
|
394
394
|
}
|
|
395
395
|
return a(t, R), r(t);
|
|
396
396
|
}(),
|
|
397
397
|
ae = function (e) {
|
|
398
398
|
function t() {
|
|
399
|
-
return i(this, t), s(this, t, ["
|
|
399
|
+
return i(this, t), s(this, t, ["RandomNumberGenerationFailed", "Random number generation failed"]);
|
|
400
400
|
}
|
|
401
401
|
return a(t, R), r(t);
|
|
402
402
|
}(),
|
|
403
403
|
ce = function (e) {
|
|
404
404
|
function t() {
|
|
405
|
-
return i(this, t), s(this, t, ["
|
|
405
|
+
return i(this, t), s(this, t, ["PasskeysInvalidEncoding", "Invalid passkey encoding"]);
|
|
406
406
|
}
|
|
407
407
|
return a(t, R), r(t);
|
|
408
408
|
}(),
|
|
409
409
|
ue = function (e) {
|
|
410
|
+
function t() {
|
|
411
|
+
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."]);
|
|
412
|
+
}
|
|
413
|
+
return a(t, R), r(t);
|
|
414
|
+
}(),
|
|
415
|
+
le = function (e) {
|
|
410
416
|
function t() {
|
|
411
417
|
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."]);
|
|
412
418
|
}
|
|
413
419
|
return a(t, R), r(t);
|
|
414
420
|
}();
|
|
415
|
-
function
|
|
421
|
+
function de(e, t) {
|
|
416
422
|
return function (e) {
|
|
417
423
|
if (Array.isArray(e)) return e;
|
|
418
424
|
}(e) || function (e, t) {
|
|
@@ -441,14 +447,14 @@ function le(e, t) {
|
|
|
441
447
|
}
|
|
442
448
|
return a;
|
|
443
449
|
}
|
|
444
|
-
}(e, t) ||
|
|
450
|
+
}(e, t) || pe(e, t) || function () {
|
|
445
451
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
446
452
|
}();
|
|
447
453
|
}
|
|
448
|
-
function
|
|
454
|
+
function he(e, t) {
|
|
449
455
|
var r = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
450
456
|
if (!r) {
|
|
451
|
-
if (Array.isArray(e) || (r =
|
|
457
|
+
if (Array.isArray(e) || (r = pe(e)) || t && e && "number" == typeof e.length) {
|
|
452
458
|
r && (e = r);
|
|
453
459
|
var _n = 0,
|
|
454
460
|
i = function i() {};
|
|
@@ -493,28 +499,28 @@ function de(e, t) {
|
|
|
493
499
|
}
|
|
494
500
|
};
|
|
495
501
|
}
|
|
496
|
-
function
|
|
502
|
+
function pe(e, t) {
|
|
497
503
|
if (e) {
|
|
498
|
-
if ("string" == typeof e) return
|
|
504
|
+
if ("string" == typeof e) return fe(e, t);
|
|
499
505
|
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
500
|
-
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) ?
|
|
506
|
+
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) ? fe(e, t) : void 0;
|
|
501
507
|
}
|
|
502
508
|
}
|
|
503
|
-
function
|
|
509
|
+
function fe(e, t) {
|
|
504
510
|
(null == t || t > e.length) && (t = e.length);
|
|
505
511
|
for (var r = 0, n = new Array(t); r < t; r++) n[r] = e[r];
|
|
506
512
|
return n;
|
|
507
513
|
}
|
|
508
|
-
function
|
|
509
|
-
return
|
|
514
|
+
function _e(e) {
|
|
515
|
+
return _e = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
|
|
510
516
|
return _typeof(e);
|
|
511
517
|
} : function (e) {
|
|
512
518
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
|
|
513
|
-
},
|
|
519
|
+
}, _e(e);
|
|
514
520
|
}
|
|
515
|
-
function
|
|
521
|
+
function me() {
|
|
516
522
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
517
|
-
|
|
523
|
+
me = function me() {
|
|
518
524
|
return t;
|
|
519
525
|
};
|
|
520
526
|
var e,
|
|
@@ -594,7 +600,7 @@ function _e() {
|
|
|
594
600
|
if ("throw" !== c.type) {
|
|
595
601
|
var u = c.arg,
|
|
596
602
|
l = u.value;
|
|
597
|
-
return l && "object" ==
|
|
603
|
+
return l && "object" == _e(l) && n.call(l, "__await") ? t.resolve(l.__await).then(function (e) {
|
|
598
604
|
r("next", e, o, a);
|
|
599
605
|
}, function (e) {
|
|
600
606
|
r("throw", e, o, a);
|
|
@@ -693,7 +699,7 @@ function _e() {
|
|
|
693
699
|
return s.next = s;
|
|
694
700
|
}
|
|
695
701
|
}
|
|
696
|
-
throw new TypeError(
|
|
702
|
+
throw new TypeError(_e(t) + " is not iterable");
|
|
697
703
|
}
|
|
698
704
|
return y.prototype = g, i(S, "constructor", {
|
|
699
705
|
value: g,
|
|
@@ -814,46 +820,46 @@ function _e() {
|
|
|
814
820
|
}
|
|
815
821
|
}, t;
|
|
816
822
|
}
|
|
817
|
-
function
|
|
823
|
+
function ve(e, t) {
|
|
818
824
|
for (var r = 0; r < t.length; r++) {
|
|
819
825
|
var n = t[r];
|
|
820
|
-
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e,
|
|
826
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, ge(n.key), n);
|
|
821
827
|
}
|
|
822
828
|
}
|
|
823
|
-
function
|
|
824
|
-
return t &&
|
|
829
|
+
function ye(e, t, r) {
|
|
830
|
+
return t && ve(e.prototype, t), r && ve(e, r), Object.defineProperty(e, "prototype", {
|
|
825
831
|
writable: !1
|
|
826
832
|
}), e;
|
|
827
833
|
}
|
|
828
|
-
function
|
|
834
|
+
function ge(e) {
|
|
829
835
|
var t = function (e, t) {
|
|
830
|
-
if ("object" !=
|
|
836
|
+
if ("object" != _e(e) || !e) return e;
|
|
831
837
|
var r = e[Symbol.toPrimitive];
|
|
832
838
|
if (void 0 !== r) {
|
|
833
839
|
var n = r.call(e, t || "default");
|
|
834
|
-
if ("object" !=
|
|
840
|
+
if ("object" != _e(n)) return n;
|
|
835
841
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
836
842
|
}
|
|
837
843
|
return ("string" === t ? String : Number)(e);
|
|
838
844
|
}(e, "string");
|
|
839
|
-
return "symbol" ==
|
|
845
|
+
return "symbol" == _e(t) ? t : String(t);
|
|
840
846
|
}
|
|
841
|
-
function
|
|
847
|
+
function be(e, t) {
|
|
842
848
|
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
|
|
843
849
|
}
|
|
844
|
-
function
|
|
845
|
-
return t =
|
|
846
|
-
if (t && ("object" ===
|
|
850
|
+
function ke(e, t, r) {
|
|
851
|
+
return t = Ce(t), function (e, t) {
|
|
852
|
+
if (t && ("object" === _e(t) || "function" == typeof t)) return t;
|
|
847
853
|
if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
|
|
848
854
|
return function (e) {
|
|
849
855
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
850
856
|
return e;
|
|
851
857
|
}(e);
|
|
852
|
-
}(e,
|
|
858
|
+
}(e, Se() ? Reflect.construct(t, r || [], Ce(e).constructor) : t.apply(e, r));
|
|
853
859
|
}
|
|
854
|
-
function
|
|
860
|
+
function we(e) {
|
|
855
861
|
var t = "function" == typeof Map ? new Map() : void 0;
|
|
856
|
-
return
|
|
862
|
+
return we = function we(e) {
|
|
857
863
|
if (null === e || !function (e) {
|
|
858
864
|
try {
|
|
859
865
|
return -1 !== Function.toString.call(e).indexOf("[native code]");
|
|
@@ -868,12 +874,12 @@ function ke(e) {
|
|
|
868
874
|
}
|
|
869
875
|
function r() {
|
|
870
876
|
return function (e, t, r) {
|
|
871
|
-
if (
|
|
877
|
+
if (Se()) return Reflect.construct.apply(null, arguments);
|
|
872
878
|
var n = [null];
|
|
873
879
|
n.push.apply(n, t);
|
|
874
880
|
var i = new (e.bind.apply(e, n))();
|
|
875
|
-
return r &&
|
|
876
|
-
}(e, arguments,
|
|
881
|
+
return r && xe(i, r.prototype), i;
|
|
882
|
+
}(e, arguments, Ce(this).constructor);
|
|
877
883
|
}
|
|
878
884
|
return r.prototype = Object.create(e.prototype, {
|
|
879
885
|
constructor: {
|
|
@@ -882,32 +888,32 @@ function ke(e) {
|
|
|
882
888
|
writable: !0,
|
|
883
889
|
configurable: !0
|
|
884
890
|
}
|
|
885
|
-
}),
|
|
886
|
-
},
|
|
891
|
+
}), xe(r, e);
|
|
892
|
+
}, we(e);
|
|
887
893
|
}
|
|
888
|
-
function
|
|
894
|
+
function Se() {
|
|
889
895
|
try {
|
|
890
896
|
var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
891
897
|
} catch (e) {}
|
|
892
|
-
return (
|
|
898
|
+
return (Se = function Se() {
|
|
893
899
|
return !!e;
|
|
894
900
|
})();
|
|
895
901
|
}
|
|
896
|
-
function
|
|
897
|
-
return
|
|
902
|
+
function xe(e, t) {
|
|
903
|
+
return xe = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) {
|
|
898
904
|
return e.__proto__ = t, e;
|
|
899
|
-
},
|
|
905
|
+
}, xe(e, t);
|
|
900
906
|
}
|
|
901
|
-
function
|
|
902
|
-
return
|
|
907
|
+
function Ce(e) {
|
|
908
|
+
return Ce = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) {
|
|
903
909
|
return e.__proto__ || Object.getPrototypeOf(e);
|
|
904
|
-
},
|
|
910
|
+
}, Ce(e);
|
|
905
911
|
}
|
|
906
912
|
exports.B2BProducts = void 0, (g = exports.B2BProducts || (exports.B2BProducts = {})).emailMagicLinks = "emailMagicLinks", g.sso = "sso", g.passwords = "passwords", g.oauth = "oauth", exports.AuthFlowType = void 0, (b = exports.AuthFlowType || (exports.AuthFlowType = {})).Discovery = "Discovery", b.Organization = "Organization", b.PasswordReset = "PasswordReset", exports.B2BMFAProducts = void 0, (k = exports.B2BMFAProducts || (exports.B2BMFAProducts = {})).smsOtp = "smsOtp", k.totp = "totp", exports.B2BOAuthProviders = void 0, (w = exports.B2BOAuthProviders || (exports.B2BOAuthProviders = {})).Google = "google", w.Microsoft = "microsoft";
|
|
907
|
-
var
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
function
|
|
913
|
+
var Pe,
|
|
914
|
+
Oe = "https://accounts.google.com/gsi",
|
|
915
|
+
Te = "".concat(Oe, "/client");
|
|
916
|
+
function Ae(e, t) {
|
|
911
917
|
var r = {};
|
|
912
918
|
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
|
|
913
919
|
if (null != e && "function" == typeof Object.getOwnPropertySymbols) {
|
|
@@ -916,7 +922,7 @@ function Te(e, t) {
|
|
|
916
922
|
}
|
|
917
923
|
return r;
|
|
918
924
|
}
|
|
919
|
-
function
|
|
925
|
+
function Ee(e, t, r, n) {
|
|
920
926
|
return new (r || (r = Promise))(function (i, s) {
|
|
921
927
|
function o(e) {
|
|
922
928
|
try {
|
|
@@ -943,12 +949,12 @@ function Ae(e, t, r, n) {
|
|
|
943
949
|
}
|
|
944
950
|
"function" == typeof SuppressedError && SuppressedError, function (e) {
|
|
945
951
|
e.RequiredCatcha = "Catcha Required";
|
|
946
|
-
}(
|
|
947
|
-
var
|
|
948
|
-
|
|
952
|
+
}(Pe || (Pe = {}));
|
|
953
|
+
var De,
|
|
954
|
+
Re = function (e) {
|
|
949
955
|
function t(e) {
|
|
950
956
|
var r;
|
|
951
|
-
return
|
|
957
|
+
return be(this, t), (r = ke(this, t, [e])).type = e, r;
|
|
952
958
|
}
|
|
953
959
|
return function (e, t) {
|
|
954
960
|
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
|
|
@@ -960,10 +966,10 @@ var Ee,
|
|
|
960
966
|
}
|
|
961
967
|
}), Object.defineProperty(e, "prototype", {
|
|
962
968
|
writable: !1
|
|
963
|
-
}), t &&
|
|
964
|
-
}(t,
|
|
969
|
+
}), t && xe(e, t);
|
|
970
|
+
}(t, we(Error)), ye(t);
|
|
965
971
|
}();
|
|
966
|
-
function
|
|
972
|
+
function Ie(e) {
|
|
967
973
|
var t,
|
|
968
974
|
r = e.method,
|
|
969
975
|
n = e.finalURL,
|
|
@@ -971,9 +977,9 @@ function Re(e) {
|
|
|
971
977
|
s = e.xSDKClientHeader,
|
|
972
978
|
o = e.xSDKParentHostHeader,
|
|
973
979
|
a = e.body;
|
|
974
|
-
return
|
|
980
|
+
return Ee(this, void 0, void 0, me().mark(function e() {
|
|
975
981
|
var c, u, l, d, h, p;
|
|
976
|
-
return
|
|
982
|
+
return me().wrap(function (e) {
|
|
977
983
|
for (;;) switch (e.prev = e.next) {
|
|
978
984
|
case 0:
|
|
979
985
|
return c = {
|
|
@@ -1037,7 +1043,7 @@ function Re(e) {
|
|
|
1037
1043
|
e.next = 49;
|
|
1038
1044
|
break;
|
|
1039
1045
|
}
|
|
1040
|
-
throw new
|
|
1046
|
+
throw new Re(Pe.RequiredCatcha);
|
|
1041
1047
|
case 49:
|
|
1042
1048
|
throw new A("Invalid response from the Stytch servers.");
|
|
1043
1049
|
case 50:
|
|
@@ -1047,43 +1053,43 @@ function Re(e) {
|
|
|
1047
1053
|
}, e, null, [[3, 9], [15, 22], [26, 32], [38, 44]]);
|
|
1048
1054
|
}));
|
|
1049
1055
|
}
|
|
1050
|
-
var
|
|
1051
|
-
function
|
|
1052
|
-
if (!
|
|
1053
|
-
return
|
|
1056
|
+
var Fe = new Uint8Array(16);
|
|
1057
|
+
function je() {
|
|
1058
|
+
if (!De && !(De = "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");
|
|
1059
|
+
return De(Fe);
|
|
1054
1060
|
}
|
|
1055
|
-
var
|
|
1056
|
-
for (var
|
|
1057
|
-
function
|
|
1061
|
+
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;
|
|
1062
|
+
for (var Le = [], Me = 0; Me < 256; ++Me) Le.push((Me + 256).toString(16).substr(1));
|
|
1063
|
+
function Ne(e) {
|
|
1058
1064
|
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
|
|
1059
|
-
r = (
|
|
1065
|
+
r = (Le[e[t + 0]] + Le[e[t + 1]] + Le[e[t + 2]] + Le[e[t + 3]] + "-" + Le[e[t + 4]] + Le[e[t + 5]] + "-" + Le[e[t + 6]] + Le[e[t + 7]] + "-" + Le[e[t + 8]] + Le[e[t + 9]] + "-" + Le[e[t + 10]] + Le[e[t + 11]] + Le[e[t + 12]] + Le[e[t + 13]] + Le[e[t + 14]] + Le[e[t + 15]]).toLowerCase();
|
|
1060
1066
|
if (!function (e) {
|
|
1061
|
-
return "string" == typeof e &&
|
|
1067
|
+
return "string" == typeof e && Be.test(e);
|
|
1062
1068
|
}(r)) throw TypeError("Stringified UUID is invalid");
|
|
1063
1069
|
return r;
|
|
1064
1070
|
}
|
|
1065
|
-
function
|
|
1066
|
-
var n = (e = e || {}).random || (e.rng ||
|
|
1071
|
+
function Ue(e, t, r) {
|
|
1072
|
+
var n = (e = e || {}).random || (e.rng || je)();
|
|
1067
1073
|
if (n[6] = 15 & n[6] | 64, n[8] = 63 & n[8] | 128, t) {
|
|
1068
1074
|
r = r || 0;
|
|
1069
1075
|
for (var i = 0; i < 16; ++i) t[r + i] = n[i];
|
|
1070
1076
|
return t;
|
|
1071
1077
|
}
|
|
1072
|
-
return
|
|
1078
|
+
return Ne(n);
|
|
1073
1079
|
}
|
|
1074
|
-
var
|
|
1075
|
-
function
|
|
1076
|
-
return
|
|
1077
|
-
return
|
|
1080
|
+
var Ke = {};
|
|
1081
|
+
function qe(e, t) {
|
|
1082
|
+
return Ee(this, void 0, void 0, me().mark(function r() {
|
|
1083
|
+
return me().wrap(function (r) {
|
|
1078
1084
|
for (;;) switch (r.prev = r.next) {
|
|
1079
1085
|
case 0:
|
|
1080
|
-
if (void 0 ===
|
|
1086
|
+
if (void 0 === Ke[e]) {
|
|
1081
1087
|
r.next = 2;
|
|
1082
1088
|
break;
|
|
1083
1089
|
}
|
|
1084
|
-
return r.abrupt("return",
|
|
1090
|
+
return r.abrupt("return", Ke[e]);
|
|
1085
1091
|
case 2:
|
|
1086
|
-
return
|
|
1092
|
+
return Ke[e] = We(e, t), r.abrupt("return", Ke[e]);
|
|
1087
1093
|
case 4:
|
|
1088
1094
|
case "end":
|
|
1089
1095
|
return r.stop();
|
|
@@ -1091,10 +1097,10 @@ function Ke(e, t) {
|
|
|
1091
1097
|
}, r);
|
|
1092
1098
|
}));
|
|
1093
1099
|
}
|
|
1094
|
-
function
|
|
1100
|
+
function We(e, t) {
|
|
1095
1101
|
return new Promise(function (r, n) {
|
|
1096
1102
|
var i = function (e) {
|
|
1097
|
-
var t =
|
|
1103
|
+
var t = Ge(e);
|
|
1098
1104
|
if (t[0]) return t[0];
|
|
1099
1105
|
}(e);
|
|
1100
1106
|
if (i && "true" === i.dataset.loaded) try {
|
|
@@ -1118,24 +1124,24 @@ function qe(e, t) {
|
|
|
1118
1124
|
});
|
|
1119
1125
|
});
|
|
1120
1126
|
}
|
|
1121
|
-
var
|
|
1127
|
+
var Ge = function Ge(e) {
|
|
1122
1128
|
return document.querySelectorAll('script[src="'.concat(e, '"]'));
|
|
1123
1129
|
};
|
|
1124
|
-
var
|
|
1125
|
-
|
|
1126
|
-
|
|
1130
|
+
var He,
|
|
1131
|
+
ze = ["[Stytch]"],
|
|
1132
|
+
Ve = function Ve() {
|
|
1127
1133
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
1128
|
-
return (e = console).warn.apply(e,
|
|
1134
|
+
return (e = console).warn.apply(e, ze.concat(r));
|
|
1129
1135
|
},
|
|
1130
|
-
|
|
1136
|
+
Ye = function Ye() {
|
|
1131
1137
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
1132
|
-
return (e = console).error.apply(e,
|
|
1138
|
+
return (e = console).error.apply(e, ze.concat(r));
|
|
1133
1139
|
},
|
|
1134
|
-
|
|
1135
|
-
|
|
1140
|
+
Je = "\nYou can find your public token at https://stytch.com/dashboard/api-keys.",
|
|
1141
|
+
$e = function $e(e) {
|
|
1136
1142
|
var t = {
|
|
1137
1143
|
isObject: function isObject(r, n) {
|
|
1138
|
-
var i = "object" ===
|
|
1144
|
+
var i = "object" === _e(n) && !Array.isArray(n) && null !== n;
|
|
1139
1145
|
if (!i) throw new x(e, r + " must be an object.");
|
|
1140
1146
|
return t;
|
|
1141
1147
|
},
|
|
@@ -1152,7 +1158,7 @@ var Ge,
|
|
|
1152
1158
|
isStringArray: function isStringArray(r, n) {
|
|
1153
1159
|
if (!Array.isArray(n)) throw new x(e, r + " must be an array of strings.");
|
|
1154
1160
|
var i,
|
|
1155
|
-
s =
|
|
1161
|
+
s = he(n);
|
|
1156
1162
|
try {
|
|
1157
1163
|
for (s.s(); !(i = s.n()).done;) {
|
|
1158
1164
|
if ("string" != typeof i.value) throw new x(e, r + " must be an array of strings.");
|
|
@@ -1184,20 +1190,20 @@ var Ge,
|
|
|
1184
1190
|
};
|
|
1185
1191
|
return t;
|
|
1186
1192
|
},
|
|
1187
|
-
$e = function $e(e) {
|
|
1188
|
-
return Te(e, ["request_id", "status_code"]);
|
|
1189
|
-
},
|
|
1190
1193
|
Xe = function Xe(e) {
|
|
1191
|
-
return
|
|
1194
|
+
return Ae(e, ["request_id", "status_code"]);
|
|
1195
|
+
},
|
|
1196
|
+
Ze = function Ze(e) {
|
|
1197
|
+
return Ae(e, ["__user"]);
|
|
1192
1198
|
},
|
|
1193
|
-
|
|
1199
|
+
Qe = ye(function e(t, r, n) {
|
|
1194
1200
|
var i = this,
|
|
1195
1201
|
s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : function () {
|
|
1196
1202
|
return Promise.resolve(void 0);
|
|
1197
1203
|
};
|
|
1198
|
-
|
|
1199
|
-
return
|
|
1200
|
-
return
|
|
1204
|
+
be(this, e), this.bootstrapPromise = n, this.isEnabled = function () {
|
|
1205
|
+
return Ee(i, void 0, void 0, me().mark(function e() {
|
|
1206
|
+
return me().wrap(function (e) {
|
|
1201
1207
|
for (;;) switch (e.prev = e.next) {
|
|
1202
1208
|
case 0:
|
|
1203
1209
|
return e.abrupt("return", this.state.then(function (e) {
|
|
@@ -1210,9 +1216,9 @@ var Ge,
|
|
|
1210
1216
|
}, e, this);
|
|
1211
1217
|
}));
|
|
1212
1218
|
}, this.getTelemetryID = function () {
|
|
1213
|
-
return
|
|
1219
|
+
return Ee(i, void 0, void 0, me().mark(function e() {
|
|
1214
1220
|
var t, r, n, i;
|
|
1215
|
-
return
|
|
1221
|
+
return me().wrap(function (e) {
|
|
1216
1222
|
for (;;) switch (e.prev = e.next) {
|
|
1217
1223
|
case 0:
|
|
1218
1224
|
return e.next = 2, this.state;
|
|
@@ -1233,9 +1239,9 @@ var Ge,
|
|
|
1233
1239
|
}, e, this);
|
|
1234
1240
|
}));
|
|
1235
1241
|
}, this.getDFPTelemetryIDAndCaptcha = function () {
|
|
1236
|
-
return
|
|
1242
|
+
return Ee(i, void 0, void 0, me().mark(function e() {
|
|
1237
1243
|
var t, r, n, i, s, o;
|
|
1238
|
-
return
|
|
1244
|
+
return me().wrap(function (e) {
|
|
1239
1245
|
for (;;) switch (e.prev = e.next) {
|
|
1240
1246
|
case 0:
|
|
1241
1247
|
return e.next = 2, this.state;
|
|
@@ -1278,14 +1284,14 @@ var Ge,
|
|
|
1278
1284
|
}, e, this);
|
|
1279
1285
|
}));
|
|
1280
1286
|
}, this.retryWithCaptchaAndDFP = function (e, t) {
|
|
1281
|
-
return
|
|
1287
|
+
return Ee(i, void 0, void 0, me().mark(function r() {
|
|
1282
1288
|
var n, i, s;
|
|
1283
|
-
return
|
|
1289
|
+
return me().wrap(function (r) {
|
|
1284
1290
|
for (;;) switch (r.prev = r.next) {
|
|
1285
1291
|
case 0:
|
|
1286
1292
|
return r.next = 2, this.state;
|
|
1287
1293
|
case 2:
|
|
1288
|
-
if (n = r.sent, i = n.enabled, s = n.executeRecaptcha, e.type !==
|
|
1294
|
+
if (n = r.sent, i = n.enabled, s = n.executeRecaptcha, e.type !== Pe.RequiredCatcha || !i) {
|
|
1289
1295
|
r.next = 14;
|
|
1290
1296
|
break;
|
|
1291
1297
|
}
|
|
@@ -1309,8 +1315,8 @@ var Ge,
|
|
|
1309
1315
|
}, r, this);
|
|
1310
1316
|
}));
|
|
1311
1317
|
}, this.state = n.then(function (e) {
|
|
1312
|
-
return
|
|
1313
|
-
return
|
|
1318
|
+
return Ee(i, void 0, void 0, me().mark(function n() {
|
|
1319
|
+
return me().wrap(function (n) {
|
|
1314
1320
|
for (;;) switch (n.prev = n.next) {
|
|
1315
1321
|
case 0:
|
|
1316
1322
|
if (e.runDFPProtectedAuth) {
|
|
@@ -1325,7 +1331,7 @@ var Ge,
|
|
|
1325
1331
|
executeRecaptcha: s
|
|
1326
1332
|
});
|
|
1327
1333
|
case 2:
|
|
1328
|
-
return n.next = 4,
|
|
1334
|
+
return n.next = 4, qe("".concat("https://elements.stytch.com", "/telemetry.js"), function () {
|
|
1329
1335
|
return window.GetTelemetryID;
|
|
1330
1336
|
});
|
|
1331
1337
|
case 4:
|
|
@@ -1345,11 +1351,11 @@ var Ge,
|
|
|
1345
1351
|
}));
|
|
1346
1352
|
});
|
|
1347
1353
|
}),
|
|
1348
|
-
|
|
1354
|
+
et = function et() {
|
|
1349
1355
|
return {
|
|
1350
1356
|
isEnabled: function isEnabled() {
|
|
1351
|
-
return
|
|
1352
|
-
return
|
|
1357
|
+
return Ee(void 0, void 0, void 0, me().mark(function e() {
|
|
1358
|
+
return me().wrap(function (e) {
|
|
1353
1359
|
for (;;) switch (e.prev = e.next) {
|
|
1354
1360
|
case 0:
|
|
1355
1361
|
return e.abrupt("return", !1);
|
|
@@ -1361,8 +1367,8 @@ var Ge,
|
|
|
1361
1367
|
}));
|
|
1362
1368
|
},
|
|
1363
1369
|
getTelemetryID: function getTelemetryID() {
|
|
1364
|
-
return
|
|
1365
|
-
return
|
|
1370
|
+
return Ee(void 0, void 0, void 0, me().mark(function e() {
|
|
1371
|
+
return me().wrap(function (e) {
|
|
1366
1372
|
for (;;) switch (e.prev = e.next) {
|
|
1367
1373
|
case 0:
|
|
1368
1374
|
return e.abrupt("return", void 0);
|
|
@@ -1374,8 +1380,8 @@ var Ge,
|
|
|
1374
1380
|
}));
|
|
1375
1381
|
},
|
|
1376
1382
|
getDFPTelemetryIDAndCaptcha: function getDFPTelemetryIDAndCaptcha() {
|
|
1377
|
-
return
|
|
1378
|
-
return
|
|
1383
|
+
return Ee(void 0, void 0, void 0, me().mark(function e() {
|
|
1384
|
+
return me().wrap(function (e) {
|
|
1379
1385
|
for (;;) switch (e.prev = e.next) {
|
|
1380
1386
|
case 0:
|
|
1381
1387
|
return e.abrupt("return", {
|
|
@@ -1390,8 +1396,8 @@ var Ge,
|
|
|
1390
1396
|
}));
|
|
1391
1397
|
},
|
|
1392
1398
|
retryWithCaptchaAndDFP: function retryWithCaptchaAndDFP() {
|
|
1393
|
-
return
|
|
1394
|
-
return
|
|
1399
|
+
return Ee(void 0, void 0, void 0, me().mark(function e() {
|
|
1400
|
+
return me().wrap(function (e) {
|
|
1395
1401
|
for (;;) switch (e.prev = e.next) {
|
|
1396
1402
|
case 0:
|
|
1397
1403
|
throw new Error("DFP protected auth is disabled");
|
|
@@ -1404,11 +1410,11 @@ var Ge,
|
|
|
1404
1410
|
}
|
|
1405
1411
|
};
|
|
1406
1412
|
},
|
|
1407
|
-
|
|
1413
|
+
tt = function () {
|
|
1408
1414
|
function e() {
|
|
1409
|
-
|
|
1415
|
+
be(this, e);
|
|
1410
1416
|
}
|
|
1411
|
-
return
|
|
1417
|
+
return ye(e, null, [{
|
|
1412
1418
|
key: "marshall",
|
|
1413
1419
|
value: function value(e) {
|
|
1414
1420
|
return Object.assign(Object.assign({}, e), {
|
|
@@ -1456,11 +1462,11 @@ var Ge,
|
|
|
1456
1462
|
}
|
|
1457
1463
|
}]), e;
|
|
1458
1464
|
}(),
|
|
1459
|
-
|
|
1465
|
+
rt = function () {
|
|
1460
1466
|
function e(t) {
|
|
1461
|
-
|
|
1467
|
+
be(this, e), this.maxBatchSize = t.maxBatchSize, this.logEventURL = t.logEventURL, setInterval(this.flush.bind(this), t.intervalDurationMs), this.batch = [];
|
|
1462
1468
|
}
|
|
1463
|
-
return
|
|
1469
|
+
return ye(e, [{
|
|
1464
1470
|
key: "logEvent",
|
|
1465
1471
|
value: function value(e, t) {
|
|
1466
1472
|
this.batch.push({
|
|
@@ -1471,9 +1477,9 @@ var Ge,
|
|
|
1471
1477
|
}, {
|
|
1472
1478
|
key: "flush",
|
|
1473
1479
|
value: function value() {
|
|
1474
|
-
return
|
|
1480
|
+
return Ee(this, void 0, void 0, me().mark(function e() {
|
|
1475
1481
|
var t;
|
|
1476
|
-
return
|
|
1482
|
+
return me().wrap(function (e) {
|
|
1477
1483
|
for (;;) switch (e.prev = e.next) {
|
|
1478
1484
|
case 0:
|
|
1479
1485
|
if (this.batch.length) {
|
|
@@ -1505,13 +1511,13 @@ var Ge,
|
|
|
1505
1511
|
}();
|
|
1506
1512
|
!function (e) {
|
|
1507
1513
|
e.LoginOrCreateEML = "login_or_create_eml", e.LoginOrCreateOTP = "login_or_create_otp", e.ResetPassword = "reset_password";
|
|
1508
|
-
}(
|
|
1509
|
-
var
|
|
1514
|
+
}(He || (He = {}));
|
|
1515
|
+
var nt = ye(function e(t, r) {
|
|
1510
1516
|
var n = this;
|
|
1511
|
-
|
|
1512
|
-
return
|
|
1517
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
|
|
1518
|
+
return Ee(n, void 0, void 0, me().mark(function e() {
|
|
1513
1519
|
var t, r;
|
|
1514
|
-
return
|
|
1520
|
+
return me().wrap(function (e) {
|
|
1515
1521
|
for (;;) switch (e.prev = e.next) {
|
|
1516
1522
|
case 0:
|
|
1517
1523
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1520,7 +1526,7 @@ var rt = ve(function e(t, r) {
|
|
|
1520
1526
|
method: "GET"
|
|
1521
1527
|
});
|
|
1522
1528
|
case 2:
|
|
1523
|
-
return t = e.sent, r =
|
|
1529
|
+
return t = e.sent, r = Xe(t), this._subscriptionService.updateUser(r), e.abrupt("return", r);
|
|
1524
1530
|
case 6:
|
|
1525
1531
|
case "end":
|
|
1526
1532
|
return e.stop();
|
|
@@ -1535,19 +1541,19 @@ var rt = ve(function e(t, r) {
|
|
|
1535
1541
|
fromCache: n._subscriptionService.getFromCache()
|
|
1536
1542
|
};
|
|
1537
1543
|
}, this.update = function (e) {
|
|
1538
|
-
return
|
|
1544
|
+
return Ee(n, void 0, void 0, me().mark(function t() {
|
|
1539
1545
|
var r, n;
|
|
1540
|
-
return
|
|
1546
|
+
return me().wrap(function (t) {
|
|
1541
1547
|
for (;;) switch (t.prev = t.next) {
|
|
1542
1548
|
case 0:
|
|
1543
|
-
return
|
|
1549
|
+
return $e("stytch.user.update").isOptionalObject("untrusted_metadata", e.untrusted_metadata), t.next = 3, this._networkClient.fetchSDK({
|
|
1544
1550
|
url: "/users/me",
|
|
1545
1551
|
body: e,
|
|
1546
1552
|
errorMessage: "Failed to update user.",
|
|
1547
1553
|
method: "PUT"
|
|
1548
1554
|
});
|
|
1549
1555
|
case 3:
|
|
1550
|
-
return r = t.sent, n =
|
|
1556
|
+
return r = t.sent, n = Xe(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Ze(r));
|
|
1551
1557
|
case 7:
|
|
1552
1558
|
case "end":
|
|
1553
1559
|
return t.stop();
|
|
@@ -1555,9 +1561,9 @@ var rt = ve(function e(t, r) {
|
|
|
1555
1561
|
}, t, this);
|
|
1556
1562
|
}));
|
|
1557
1563
|
}, this.deleteEmail = function (e) {
|
|
1558
|
-
return
|
|
1564
|
+
return Ee(n, void 0, void 0, me().mark(function t() {
|
|
1559
1565
|
var r, n;
|
|
1560
|
-
return
|
|
1566
|
+
return me().wrap(function (t) {
|
|
1561
1567
|
for (;;) switch (t.prev = t.next) {
|
|
1562
1568
|
case 0:
|
|
1563
1569
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1566,7 +1572,7 @@ var rt = ve(function e(t, r) {
|
|
|
1566
1572
|
method: "DELETE"
|
|
1567
1573
|
});
|
|
1568
1574
|
case 2:
|
|
1569
|
-
return r = t.sent, n =
|
|
1575
|
+
return r = t.sent, n = Xe(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Ze(r));
|
|
1570
1576
|
case 6:
|
|
1571
1577
|
case "end":
|
|
1572
1578
|
return t.stop();
|
|
@@ -1574,9 +1580,9 @@ var rt = ve(function e(t, r) {
|
|
|
1574
1580
|
}, t, this);
|
|
1575
1581
|
}));
|
|
1576
1582
|
}, this.deletePhoneNumber = function (e) {
|
|
1577
|
-
return
|
|
1583
|
+
return Ee(n, void 0, void 0, me().mark(function t() {
|
|
1578
1584
|
var r, n;
|
|
1579
|
-
return
|
|
1585
|
+
return me().wrap(function (t) {
|
|
1580
1586
|
for (;;) switch (t.prev = t.next) {
|
|
1581
1587
|
case 0:
|
|
1582
1588
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1585,7 +1591,7 @@ var rt = ve(function e(t, r) {
|
|
|
1585
1591
|
method: "DELETE"
|
|
1586
1592
|
});
|
|
1587
1593
|
case 2:
|
|
1588
|
-
return r = t.sent, n =
|
|
1594
|
+
return r = t.sent, n = Xe(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Ze(r));
|
|
1589
1595
|
case 6:
|
|
1590
1596
|
case "end":
|
|
1591
1597
|
return t.stop();
|
|
@@ -1593,9 +1599,9 @@ var rt = ve(function e(t, r) {
|
|
|
1593
1599
|
}, t, this);
|
|
1594
1600
|
}));
|
|
1595
1601
|
}, this.deleteTOTP = function (e) {
|
|
1596
|
-
return
|
|
1602
|
+
return Ee(n, void 0, void 0, me().mark(function t() {
|
|
1597
1603
|
var r, n;
|
|
1598
|
-
return
|
|
1604
|
+
return me().wrap(function (t) {
|
|
1599
1605
|
for (;;) switch (t.prev = t.next) {
|
|
1600
1606
|
case 0:
|
|
1601
1607
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1604,7 +1610,7 @@ var rt = ve(function e(t, r) {
|
|
|
1604
1610
|
method: "DELETE"
|
|
1605
1611
|
});
|
|
1606
1612
|
case 2:
|
|
1607
|
-
return r = t.sent, n =
|
|
1613
|
+
return r = t.sent, n = Xe(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Ze(r));
|
|
1608
1614
|
case 6:
|
|
1609
1615
|
case "end":
|
|
1610
1616
|
return t.stop();
|
|
@@ -1612,9 +1618,9 @@ var rt = ve(function e(t, r) {
|
|
|
1612
1618
|
}, t, this);
|
|
1613
1619
|
}));
|
|
1614
1620
|
}, this.deleteOAuthRegistration = function (e) {
|
|
1615
|
-
return
|
|
1621
|
+
return Ee(n, void 0, void 0, me().mark(function t() {
|
|
1616
1622
|
var r, n;
|
|
1617
|
-
return
|
|
1623
|
+
return me().wrap(function (t) {
|
|
1618
1624
|
for (;;) switch (t.prev = t.next) {
|
|
1619
1625
|
case 0:
|
|
1620
1626
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1623,7 +1629,7 @@ var rt = ve(function e(t, r) {
|
|
|
1623
1629
|
method: "DELETE"
|
|
1624
1630
|
});
|
|
1625
1631
|
case 2:
|
|
1626
|
-
return r = t.sent, n =
|
|
1632
|
+
return r = t.sent, n = Xe(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Ze(r));
|
|
1627
1633
|
case 6:
|
|
1628
1634
|
case "end":
|
|
1629
1635
|
return t.stop();
|
|
@@ -1631,9 +1637,9 @@ var rt = ve(function e(t, r) {
|
|
|
1631
1637
|
}, t, this);
|
|
1632
1638
|
}));
|
|
1633
1639
|
}, this.deleteWebauthnRegistration = function (e) {
|
|
1634
|
-
return
|
|
1640
|
+
return Ee(n, void 0, void 0, me().mark(function t() {
|
|
1635
1641
|
var r, n;
|
|
1636
|
-
return
|
|
1642
|
+
return me().wrap(function (t) {
|
|
1637
1643
|
for (;;) switch (t.prev = t.next) {
|
|
1638
1644
|
case 0:
|
|
1639
1645
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1642,7 +1648,7 @@ var rt = ve(function e(t, r) {
|
|
|
1642
1648
|
method: "DELETE"
|
|
1643
1649
|
});
|
|
1644
1650
|
case 2:
|
|
1645
|
-
return r = t.sent, n =
|
|
1651
|
+
return r = t.sent, n = Xe(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Ze(r));
|
|
1646
1652
|
case 6:
|
|
1647
1653
|
case "end":
|
|
1648
1654
|
return t.stop();
|
|
@@ -1650,9 +1656,9 @@ var rt = ve(function e(t, r) {
|
|
|
1650
1656
|
}, t, this);
|
|
1651
1657
|
}));
|
|
1652
1658
|
}, this.deleteBiometricRegistration = function (e) {
|
|
1653
|
-
return
|
|
1659
|
+
return Ee(n, void 0, void 0, me().mark(function t() {
|
|
1654
1660
|
var r, n;
|
|
1655
|
-
return
|
|
1661
|
+
return me().wrap(function (t) {
|
|
1656
1662
|
for (;;) switch (t.prev = t.next) {
|
|
1657
1663
|
case 0:
|
|
1658
1664
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1661,7 +1667,7 @@ var rt = ve(function e(t, r) {
|
|
|
1661
1667
|
method: "DELETE"
|
|
1662
1668
|
});
|
|
1663
1669
|
case 2:
|
|
1664
|
-
return r = t.sent, n =
|
|
1670
|
+
return r = t.sent, n = Xe(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Ze(r));
|
|
1665
1671
|
case 6:
|
|
1666
1672
|
case "end":
|
|
1667
1673
|
return t.stop();
|
|
@@ -1676,10 +1682,10 @@ var rt = ve(function e(t, r) {
|
|
|
1676
1682
|
});
|
|
1677
1683
|
};
|
|
1678
1684
|
}),
|
|
1679
|
-
|
|
1685
|
+
it = function () {
|
|
1680
1686
|
function e(t, r) {
|
|
1681
1687
|
var n = this;
|
|
1682
|
-
|
|
1688
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this.getSync = function () {
|
|
1683
1689
|
return n._subscriptionService.getSession();
|
|
1684
1690
|
}, this.getInfo = function () {
|
|
1685
1691
|
return {
|
|
@@ -1693,9 +1699,9 @@ var rt = ve(function e(t, r) {
|
|
|
1693
1699
|
(null == r ? void 0 : r.session) !== t && (t = null !== (n = null == r ? void 0 : r.session) && void 0 !== n ? n : null, e(t));
|
|
1694
1700
|
});
|
|
1695
1701
|
}, this.revoke = function (e) {
|
|
1696
|
-
return
|
|
1702
|
+
return Ee(n, void 0, void 0, me().mark(function t() {
|
|
1697
1703
|
var r;
|
|
1698
|
-
return
|
|
1704
|
+
return me().wrap(function (t) {
|
|
1699
1705
|
for (;;) switch (t.prev = t.next) {
|
|
1700
1706
|
case 0:
|
|
1701
1707
|
return t.prev = 0, t.next = 3, this._networkClient.fetchSDK({
|
|
@@ -1714,13 +1720,13 @@ var rt = ve(function e(t, r) {
|
|
|
1714
1720
|
}, t, this, [[0, 8]]);
|
|
1715
1721
|
}));
|
|
1716
1722
|
}, this.authenticate = function (e) {
|
|
1717
|
-
return
|
|
1723
|
+
return Ee(n, void 0, void 0, me().mark(function t() {
|
|
1718
1724
|
var r,
|
|
1719
1725
|
n,
|
|
1720
1726
|
i,
|
|
1721
1727
|
s,
|
|
1722
1728
|
o = this;
|
|
1723
|
-
return
|
|
1729
|
+
return me().wrap(function (t) {
|
|
1724
1730
|
for (;;) switch (t.prev = t.next) {
|
|
1725
1731
|
case 0:
|
|
1726
1732
|
return r = this._subscriptionService.getSession(), n = function n() {
|
|
@@ -1749,7 +1755,7 @@ var rt = ve(function e(t, r) {
|
|
|
1749
1755
|
session_token: s.session_token,
|
|
1750
1756
|
session_jwt: s.session_jwt,
|
|
1751
1757
|
intermediate_session_token: null
|
|
1752
|
-
}), t.abrupt("return",
|
|
1758
|
+
}), t.abrupt("return", Ze(s));
|
|
1753
1759
|
case 13:
|
|
1754
1760
|
if (t.prev = 13, t.t0 = t["catch"](2), !n()) {
|
|
1755
1761
|
t.next = 17;
|
|
@@ -1766,7 +1772,7 @@ var rt = ve(function e(t, r) {
|
|
|
1766
1772
|
}));
|
|
1767
1773
|
};
|
|
1768
1774
|
}
|
|
1769
|
-
return
|
|
1775
|
+
return ye(e, [{
|
|
1770
1776
|
key: "getTokens",
|
|
1771
1777
|
value: function value() {
|
|
1772
1778
|
return this._subscriptionService.getTokens();
|
|
@@ -1778,20 +1784,20 @@ var rt = ve(function e(t, r) {
|
|
|
1778
1784
|
}
|
|
1779
1785
|
}]), e;
|
|
1780
1786
|
}(),
|
|
1781
|
-
|
|
1787
|
+
st = Promise.resolve({
|
|
1782
1788
|
pkceRequiredForEmailMagicLinks: !1
|
|
1783
1789
|
}),
|
|
1784
|
-
|
|
1790
|
+
ot = function () {
|
|
1785
1791
|
function e(t, r, n, i) {
|
|
1786
1792
|
var s = this,
|
|
1787
|
-
o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] :
|
|
1788
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
1789
|
-
|
|
1793
|
+
o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : st,
|
|
1794
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : et();
|
|
1795
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._passwordResetPKCEManager = i, this._config = o, this.dfpProtectedAuth = a, this.email = {
|
|
1790
1796
|
loginOrCreate: function loginOrCreate(e) {
|
|
1791
1797
|
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
1792
|
-
return
|
|
1798
|
+
return Ee(s, void 0, void 0, me().mark(function r() {
|
|
1793
1799
|
var n, i, s, o, a, c, u;
|
|
1794
|
-
return
|
|
1800
|
+
return me().wrap(function (r) {
|
|
1795
1801
|
for (;;) switch (r.prev = r.next) {
|
|
1796
1802
|
case 0:
|
|
1797
1803
|
return r.next = 2, this._config;
|
|
@@ -1827,9 +1833,9 @@ var rt = ve(function e(t, r) {
|
|
|
1827
1833
|
},
|
|
1828
1834
|
send: function send(e) {
|
|
1829
1835
|
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
1830
|
-
return
|
|
1836
|
+
return Ee(s, void 0, void 0, me().mark(function r() {
|
|
1831
1837
|
var n, i, s, o, a, c, u, l, d;
|
|
1832
|
-
return
|
|
1838
|
+
return me().wrap(function (r) {
|
|
1833
1839
|
for (;;) switch (r.prev = r.next) {
|
|
1834
1840
|
case 0:
|
|
1835
1841
|
return r.next = 2, this._config;
|
|
@@ -1864,12 +1870,12 @@ var rt = ve(function e(t, r) {
|
|
|
1864
1870
|
}));
|
|
1865
1871
|
}
|
|
1866
1872
|
}, this.authenticate = function (e, t) {
|
|
1867
|
-
return
|
|
1873
|
+
return Ee(s, void 0, void 0, me().mark(function r() {
|
|
1868
1874
|
var n, i;
|
|
1869
|
-
return
|
|
1875
|
+
return me().wrap(function (r) {
|
|
1870
1876
|
for (;;) switch (r.prev = r.next) {
|
|
1871
1877
|
case 0:
|
|
1872
|
-
return
|
|
1878
|
+
return $e("stytch.magicLinks.authenticate").isString("Token", e).isNumber("session_duration_minutes", t.session_duration_minutes), r.next = 3, this._passwordResetPKCEManager.getPKPair();
|
|
1873
1879
|
case 3:
|
|
1874
1880
|
if (n = r.sent, i = null, !(null == n ? void 0 : n.code_verifier)) {
|
|
1875
1881
|
r.next = 19;
|
|
@@ -1909,7 +1915,7 @@ var rt = ve(function e(t, r) {
|
|
|
1909
1915
|
session_token: i.session_token,
|
|
1910
1916
|
session_jwt: i.session_jwt,
|
|
1911
1917
|
intermediate_session_token: null
|
|
1912
|
-
}), r.abrupt("return",
|
|
1918
|
+
}), r.abrupt("return", Ze(i));
|
|
1913
1919
|
case 25:
|
|
1914
1920
|
case "end":
|
|
1915
1921
|
return r.stop();
|
|
@@ -1918,12 +1924,12 @@ var rt = ve(function e(t, r) {
|
|
|
1918
1924
|
}));
|
|
1919
1925
|
};
|
|
1920
1926
|
}
|
|
1921
|
-
return
|
|
1927
|
+
return ye(e, [{
|
|
1922
1928
|
key: "getCodeChallenge",
|
|
1923
1929
|
value: function value() {
|
|
1924
|
-
return
|
|
1930
|
+
return Ee(this, void 0, void 0, me().mark(function e() {
|
|
1925
1931
|
var t;
|
|
1926
|
-
return
|
|
1932
|
+
return me().wrap(function (e) {
|
|
1927
1933
|
for (;;) switch (e.prev = e.next) {
|
|
1928
1934
|
case 0:
|
|
1929
1935
|
return e.next = 2, this._pkceManager.getPKPair();
|
|
@@ -1947,9 +1953,9 @@ var rt = ve(function e(t, r) {
|
|
|
1947
1953
|
}, {
|
|
1948
1954
|
key: "handlePKCEForAuthenticate",
|
|
1949
1955
|
value: function value(e, t) {
|
|
1950
|
-
return
|
|
1956
|
+
return Ee(this, void 0, void 0, me().mark(function r() {
|
|
1951
1957
|
var n, i, s;
|
|
1952
|
-
return
|
|
1958
|
+
return me().wrap(function (r) {
|
|
1953
1959
|
for (;;) switch (r.prev = r.next) {
|
|
1954
1960
|
case 0:
|
|
1955
1961
|
return r.next = 2, e.getPKPair();
|
|
@@ -1973,17 +1979,17 @@ var rt = ve(function e(t, r) {
|
|
|
1973
1979
|
}
|
|
1974
1980
|
}]), e;
|
|
1975
1981
|
}(),
|
|
1976
|
-
|
|
1982
|
+
at = ye(function e(t, r) {
|
|
1977
1983
|
var n = this,
|
|
1978
1984
|
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : function () {
|
|
1979
1985
|
return Promise.resolve(void 0);
|
|
1980
1986
|
},
|
|
1981
|
-
s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] :
|
|
1982
|
-
|
|
1987
|
+
s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : et();
|
|
1988
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this.executeRecaptcha = i, this.dfpProtectedAuth = s, this.sms = {
|
|
1983
1989
|
loginOrCreate: function loginOrCreate(e, t) {
|
|
1984
|
-
return
|
|
1990
|
+
return Ee(n, void 0, void 0, me().mark(function r() {
|
|
1985
1991
|
var n, i, s, o;
|
|
1986
|
-
return
|
|
1992
|
+
return me().wrap(function (r) {
|
|
1987
1993
|
for (;;) switch (r.prev = r.next) {
|
|
1988
1994
|
case 0:
|
|
1989
1995
|
return r.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
@@ -2007,9 +2013,9 @@ var rt = ve(function e(t, r) {
|
|
|
2007
2013
|
}));
|
|
2008
2014
|
},
|
|
2009
2015
|
send: function send(e, t) {
|
|
2010
|
-
return
|
|
2016
|
+
return Ee(n, void 0, void 0, me().mark(function r() {
|
|
2011
2017
|
var n, i, s, o, a, c;
|
|
2012
|
-
return
|
|
2018
|
+
return me().wrap(function (r) {
|
|
2013
2019
|
for (;;) switch (r.prev = r.next) {
|
|
2014
2020
|
case 0:
|
|
2015
2021
|
return r.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
@@ -2034,9 +2040,9 @@ var rt = ve(function e(t, r) {
|
|
|
2034
2040
|
}
|
|
2035
2041
|
}, this.whatsapp = {
|
|
2036
2042
|
loginOrCreate: function loginOrCreate(e, t) {
|
|
2037
|
-
return
|
|
2043
|
+
return Ee(n, void 0, void 0, me().mark(function r() {
|
|
2038
2044
|
var n, i, s, o;
|
|
2039
|
-
return
|
|
2045
|
+
return me().wrap(function (r) {
|
|
2040
2046
|
for (;;) switch (r.prev = r.next) {
|
|
2041
2047
|
case 0:
|
|
2042
2048
|
return r.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
@@ -2060,9 +2066,9 @@ var rt = ve(function e(t, r) {
|
|
|
2060
2066
|
}));
|
|
2061
2067
|
},
|
|
2062
2068
|
send: function send(e, t) {
|
|
2063
|
-
return
|
|
2069
|
+
return Ee(n, void 0, void 0, me().mark(function r() {
|
|
2064
2070
|
var n, i, s, o, a, c;
|
|
2065
|
-
return
|
|
2071
|
+
return me().wrap(function (r) {
|
|
2066
2072
|
for (;;) switch (r.prev = r.next) {
|
|
2067
2073
|
case 0:
|
|
2068
2074
|
return r.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
@@ -2087,9 +2093,9 @@ var rt = ve(function e(t, r) {
|
|
|
2087
2093
|
}
|
|
2088
2094
|
}, this.email = {
|
|
2089
2095
|
loginOrCreate: function loginOrCreate(e, t) {
|
|
2090
|
-
return
|
|
2096
|
+
return Ee(n, void 0, void 0, me().mark(function r() {
|
|
2091
2097
|
var n, i;
|
|
2092
|
-
return
|
|
2098
|
+
return me().wrap(function (r) {
|
|
2093
2099
|
for (;;) switch (r.prev = r.next) {
|
|
2094
2100
|
case 0:
|
|
2095
2101
|
return r.next = 2, this.executeRecaptcha();
|
|
@@ -2111,9 +2117,9 @@ var rt = ve(function e(t, r) {
|
|
|
2111
2117
|
}));
|
|
2112
2118
|
},
|
|
2113
2119
|
send: function send(e, t) {
|
|
2114
|
-
return
|
|
2120
|
+
return Ee(n, void 0, void 0, me().mark(function r() {
|
|
2115
2121
|
var n, i, s, o;
|
|
2116
|
-
return
|
|
2122
|
+
return me().wrap(function (r) {
|
|
2117
2123
|
for (;;) switch (r.prev = r.next) {
|
|
2118
2124
|
case 0:
|
|
2119
2125
|
return r.next = 2, this.executeRecaptcha();
|
|
@@ -2135,12 +2141,12 @@ var rt = ve(function e(t, r) {
|
|
|
2135
2141
|
}));
|
|
2136
2142
|
}
|
|
2137
2143
|
}, this.authenticate = function (e, t, r) {
|
|
2138
|
-
return
|
|
2144
|
+
return Ee(n, void 0, void 0, me().mark(function n() {
|
|
2139
2145
|
var i, s, o, a, c;
|
|
2140
|
-
return
|
|
2146
|
+
return me().wrap(function (n) {
|
|
2141
2147
|
for (;;) switch (n.prev = n.next) {
|
|
2142
2148
|
case 0:
|
|
2143
|
-
return
|
|
2149
|
+
return $e("stytch.otps.authenticate").isString("Code", e).isNumber("session_duration_minutes", r.session_duration_minutes), n.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2144
2150
|
case 3:
|
|
2145
2151
|
return i = n.sent, s = i.dfp_telemetry_id, o = i.captcha_token, a = Object.assign({
|
|
2146
2152
|
token: e,
|
|
@@ -2163,7 +2169,7 @@ var rt = ve(function e(t, r) {
|
|
|
2163
2169
|
session_token: c.session_token,
|
|
2164
2170
|
session_jwt: c.session_jwt,
|
|
2165
2171
|
intermediate_session_token: null
|
|
2166
|
-
}), n.abrupt("return",
|
|
2172
|
+
}), n.abrupt("return", Ze(c));
|
|
2167
2173
|
case 12:
|
|
2168
2174
|
case "end":
|
|
2169
2175
|
return n.stop();
|
|
@@ -2172,9 +2178,9 @@ var rt = ve(function e(t, r) {
|
|
|
2172
2178
|
}));
|
|
2173
2179
|
};
|
|
2174
2180
|
}),
|
|
2175
|
-
|
|
2181
|
+
ct = function () {
|
|
2176
2182
|
function e(t, r, n, i, s) {
|
|
2177
|
-
|
|
2183
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = s, this.google = {
|
|
2178
2184
|
start: this.startOAuthFlow(exports.OAuthProviders.Google)
|
|
2179
2185
|
}, this.apple = {
|
|
2180
2186
|
start: this.startOAuthFlow(exports.OAuthProviders.Apple)
|
|
@@ -2214,17 +2220,17 @@ var rt = ve(function e(t, r) {
|
|
|
2214
2220
|
start: this.startOAuthFlow(exports.OAuthProviders.Yahoo)
|
|
2215
2221
|
};
|
|
2216
2222
|
}
|
|
2217
|
-
return
|
|
2223
|
+
return ye(e, [{
|
|
2218
2224
|
key: "authenticate",
|
|
2219
2225
|
value: function value(e, t) {
|
|
2220
|
-
return
|
|
2226
|
+
return Ee(this, void 0, void 0, me().mark(function r() {
|
|
2221
2227
|
var n, i;
|
|
2222
|
-
return
|
|
2228
|
+
return me().wrap(function (r) {
|
|
2223
2229
|
for (;;) switch (r.prev = r.next) {
|
|
2224
2230
|
case 0:
|
|
2225
|
-
return
|
|
2231
|
+
return $e("stytch.oauth.authenticate").isString("Token", e).isNumber("session_duration_minutes", t.session_duration_minutes), r.next = 3, this._pkceManager.getPKPair();
|
|
2226
2232
|
case 3:
|
|
2227
|
-
return (n = r.sent) ||
|
|
2233
|
+
return (n = r.sent) || Ve("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({
|
|
2228
2234
|
url: "/oauth/authenticate",
|
|
2229
2235
|
method: "POST",
|
|
2230
2236
|
body: Object.assign({
|
|
@@ -2237,12 +2243,12 @@ var rt = ve(function e(t, r) {
|
|
|
2237
2243
|
return i = r.sent, this._pkceManager.clearPKPair(), this._subscriptionService.updateStateAndTokens({
|
|
2238
2244
|
state: {
|
|
2239
2245
|
session: i.session,
|
|
2240
|
-
user:
|
|
2246
|
+
user: Xe(i.__user)
|
|
2241
2247
|
},
|
|
2242
2248
|
session_token: i.session_token,
|
|
2243
2249
|
session_jwt: i.session_jwt,
|
|
2244
2250
|
intermediate_session_token: null
|
|
2245
|
-
}), r.abrupt("return",
|
|
2251
|
+
}), r.abrupt("return", Ze(i));
|
|
2246
2252
|
case 11:
|
|
2247
2253
|
case "end":
|
|
2248
2254
|
return r.stop();
|
|
@@ -2253,9 +2259,9 @@ var rt = ve(function e(t, r) {
|
|
|
2253
2259
|
}, {
|
|
2254
2260
|
key: "getBaseApiUrl",
|
|
2255
2261
|
value: function value() {
|
|
2256
|
-
return
|
|
2262
|
+
return Ee(this, void 0, void 0, me().mark(function e() {
|
|
2257
2263
|
var t, r;
|
|
2258
|
-
return
|
|
2264
|
+
return me().wrap(function (e) {
|
|
2259
2265
|
for (;;) switch (e.prev = e.next) {
|
|
2260
2266
|
case 0:
|
|
2261
2267
|
return e.next = 2, this._dynamicConfig;
|
|
@@ -2290,9 +2296,9 @@ var rt = ve(function e(t, r) {
|
|
|
2290
2296
|
i = r.signup_redirect_url,
|
|
2291
2297
|
s = r.custom_scopes,
|
|
2292
2298
|
o = r.provider_params;
|
|
2293
|
-
return
|
|
2299
|
+
return Ee(t, void 0, void 0, me().mark(function t() {
|
|
2294
2300
|
var r, a, c, u, l, d, h;
|
|
2295
|
-
return
|
|
2301
|
+
return me().wrap(function (t) {
|
|
2296
2302
|
for (;;) switch (t.prev = t.next) {
|
|
2297
2303
|
case 0:
|
|
2298
2304
|
return t.next = 2, this._dynamicConfig;
|
|
@@ -2319,7 +2325,7 @@ var rt = ve(function e(t, r) {
|
|
|
2319
2325
|
case 18:
|
|
2320
2326
|
this._pkceManager.clearPKPair();
|
|
2321
2327
|
case 19:
|
|
2322
|
-
if (s && (
|
|
2328
|
+
if (s && ($e("startOAuthFlow").isStringArray("custom_scopes", s), l.searchParams.set("custom_scopes", s.join(" "))), o) for (h in $e("startOAuthFlow").isOptionalObject("provider_params", o), o) l.searchParams.set("provider_" + h, o[h]);
|
|
2323
2329
|
n && l.searchParams.set("login_redirect_url", n), i && l.searchParams.set("signup_redirect_url", i), window.location.href = l.toString();
|
|
2324
2330
|
case 24:
|
|
2325
2331
|
case "end":
|
|
@@ -2331,23 +2337,23 @@ var rt = ve(function e(t, r) {
|
|
|
2331
2337
|
}
|
|
2332
2338
|
}]), e;
|
|
2333
2339
|
}(),
|
|
2334
|
-
|
|
2340
|
+
ut = function () {
|
|
2335
2341
|
function e(t, r) {
|
|
2336
2342
|
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : function () {
|
|
2337
2343
|
return Promise.resolve(void 0);
|
|
2338
2344
|
},
|
|
2339
|
-
i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] :
|
|
2340
|
-
|
|
2345
|
+
i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : et();
|
|
2346
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this.executeRecaptcha = n, this.dfpProtectedAuth = i;
|
|
2341
2347
|
}
|
|
2342
|
-
return
|
|
2348
|
+
return ye(e, [{
|
|
2343
2349
|
key: "authenticateStart",
|
|
2344
2350
|
value: function value(e) {
|
|
2345
|
-
return
|
|
2351
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
2346
2352
|
var r, n, i;
|
|
2347
|
-
return
|
|
2353
|
+
return me().wrap(function (t) {
|
|
2348
2354
|
for (;;) switch (t.prev = t.next) {
|
|
2349
2355
|
case 0:
|
|
2350
|
-
return
|
|
2356
|
+
return $e("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();
|
|
2351
2357
|
case 4:
|
|
2352
2358
|
return n = t.sent, i = r ? "/crypto_wallets/authenticate/start/secondary" : "/crypto_wallets/authenticate/start/primary", t.abrupt("return", this._networkClient.fetchSDK({
|
|
2353
2359
|
url: i,
|
|
@@ -2369,12 +2375,12 @@ var rt = ve(function e(t, r) {
|
|
|
2369
2375
|
}, {
|
|
2370
2376
|
key: "authenticate",
|
|
2371
2377
|
value: function value(e) {
|
|
2372
|
-
return
|
|
2378
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
2373
2379
|
var r, n, i, s;
|
|
2374
|
-
return
|
|
2380
|
+
return me().wrap(function (t) {
|
|
2375
2381
|
for (;;) switch (t.prev = t.next) {
|
|
2376
2382
|
case 0:
|
|
2377
|
-
return
|
|
2383
|
+
return $e("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();
|
|
2378
2384
|
case 3:
|
|
2379
2385
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2380
2386
|
url: "/crypto_wallets/authenticate",
|
|
@@ -2394,12 +2400,12 @@ var rt = ve(function e(t, r) {
|
|
|
2394
2400
|
return s = t.sent, this._subscriptionService.updateStateAndTokens({
|
|
2395
2401
|
state: {
|
|
2396
2402
|
session: s.session,
|
|
2397
|
-
user:
|
|
2403
|
+
user: Xe(s.__user)
|
|
2398
2404
|
},
|
|
2399
2405
|
session_token: s.session_token,
|
|
2400
2406
|
session_jwt: s.session_jwt,
|
|
2401
2407
|
intermediate_session_token: null
|
|
2402
|
-
}), t.abrupt("return",
|
|
2408
|
+
}), t.abrupt("return", Ze(s));
|
|
2403
2409
|
case 11:
|
|
2404
2410
|
case "end":
|
|
2405
2411
|
return t.stop();
|
|
@@ -2409,19 +2415,19 @@ var rt = ve(function e(t, r) {
|
|
|
2409
2415
|
}
|
|
2410
2416
|
}]), e;
|
|
2411
2417
|
}(),
|
|
2412
|
-
|
|
2418
|
+
lt = function () {
|
|
2413
2419
|
function e(t, r, n) {
|
|
2414
|
-
|
|
2420
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n;
|
|
2415
2421
|
}
|
|
2416
|
-
return
|
|
2422
|
+
return ye(e, [{
|
|
2417
2423
|
key: "create",
|
|
2418
2424
|
value: function value(e) {
|
|
2419
|
-
return
|
|
2425
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
2420
2426
|
var r;
|
|
2421
|
-
return
|
|
2427
|
+
return me().wrap(function (t) {
|
|
2422
2428
|
for (;;) switch (t.prev = t.next) {
|
|
2423
2429
|
case 0:
|
|
2424
|
-
return
|
|
2430
|
+
return $e("stytch.totps.create").isNumber("expiration_minutes", e.expiration_minutes), t.next = 3, this._networkClient.fetchSDK({
|
|
2425
2431
|
url: "/totps",
|
|
2426
2432
|
method: "POST",
|
|
2427
2433
|
errorMessage: "Failed to create TOTP",
|
|
@@ -2430,7 +2436,7 @@ var rt = ve(function e(t, r) {
|
|
|
2430
2436
|
}
|
|
2431
2437
|
});
|
|
2432
2438
|
case 3:
|
|
2433
|
-
return r = t.sent, this._subscriptionService.updateUser(r.__user), t.abrupt("return",
|
|
2439
|
+
return r = t.sent, this._subscriptionService.updateUser(r.__user), t.abrupt("return", Ze(r));
|
|
2434
2440
|
case 6:
|
|
2435
2441
|
case "end":
|
|
2436
2442
|
return t.stop();
|
|
@@ -2441,12 +2447,12 @@ var rt = ve(function e(t, r) {
|
|
|
2441
2447
|
}, {
|
|
2442
2448
|
key: "authenticate",
|
|
2443
2449
|
value: function value(e) {
|
|
2444
|
-
return
|
|
2450
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
2445
2451
|
var r, n, i, s;
|
|
2446
|
-
return
|
|
2452
|
+
return me().wrap(function (t) {
|
|
2447
2453
|
for (;;) switch (t.prev = t.next) {
|
|
2448
2454
|
case 0:
|
|
2449
|
-
return
|
|
2455
|
+
return $e("stytch.totps.authenticate").isNumber("session_duration_minutes", e.session_duration_minutes).isString("totp_code", e.totp_code), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2450
2456
|
case 3:
|
|
2451
2457
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2452
2458
|
url: "/totps/authenticate",
|
|
@@ -2469,7 +2475,7 @@ var rt = ve(function e(t, r) {
|
|
|
2469
2475
|
session_token: s.session_token,
|
|
2470
2476
|
session_jwt: s.session_jwt,
|
|
2471
2477
|
intermediate_session_token: null
|
|
2472
|
-
}), t.abrupt("return",
|
|
2478
|
+
}), t.abrupt("return", Ze(s));
|
|
2473
2479
|
case 11:
|
|
2474
2480
|
case "end":
|
|
2475
2481
|
return t.stop();
|
|
@@ -2480,8 +2486,8 @@ var rt = ve(function e(t, r) {
|
|
|
2480
2486
|
}, {
|
|
2481
2487
|
key: "recoveryCodes",
|
|
2482
2488
|
value: function value() {
|
|
2483
|
-
return
|
|
2484
|
-
return
|
|
2489
|
+
return Ee(this, void 0, void 0, me().mark(function e() {
|
|
2490
|
+
return me().wrap(function (e) {
|
|
2485
2491
|
for (;;) switch (e.prev = e.next) {
|
|
2486
2492
|
case 0:
|
|
2487
2493
|
return e.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2499,12 +2505,12 @@ var rt = ve(function e(t, r) {
|
|
|
2499
2505
|
}, {
|
|
2500
2506
|
key: "recover",
|
|
2501
2507
|
value: function value(e) {
|
|
2502
|
-
return
|
|
2508
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
2503
2509
|
var r, n, i, s;
|
|
2504
|
-
return
|
|
2510
|
+
return me().wrap(function (t) {
|
|
2505
2511
|
for (;;) switch (t.prev = t.next) {
|
|
2506
2512
|
case 0:
|
|
2507
|
-
return
|
|
2513
|
+
return $e("stytch.totps.recover").isNumber("session_duration_minutes", e.session_duration_minutes).isString("recovery_code", e.recovery_code), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2508
2514
|
case 3:
|
|
2509
2515
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2510
2516
|
url: "/totps/recover",
|
|
@@ -2527,7 +2533,7 @@ var rt = ve(function e(t, r) {
|
|
|
2527
2533
|
session_token: s.session_token,
|
|
2528
2534
|
session_jwt: s.session_jwt,
|
|
2529
2535
|
intermediate_session_token: null
|
|
2530
|
-
}), t.abrupt("return",
|
|
2536
|
+
}), t.abrupt("return", Ze(s));
|
|
2531
2537
|
case 11:
|
|
2532
2538
|
case "end":
|
|
2533
2539
|
return t.stop();
|
|
@@ -2537,14 +2543,14 @@ var rt = ve(function e(t, r) {
|
|
|
2537
2543
|
}
|
|
2538
2544
|
}]), e;
|
|
2539
2545
|
}();
|
|
2540
|
-
function
|
|
2546
|
+
function dt(e) {
|
|
2541
2547
|
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);
|
|
2542
2548
|
return i;
|
|
2543
2549
|
}
|
|
2544
|
-
function
|
|
2550
|
+
function ht(e) {
|
|
2545
2551
|
var t,
|
|
2546
2552
|
r = "",
|
|
2547
|
-
n =
|
|
2553
|
+
n = he(new Uint8Array(e));
|
|
2548
2554
|
try {
|
|
2549
2555
|
for (n.s(); !(t = n.n()).done;) {
|
|
2550
2556
|
var i = t.value;
|
|
@@ -2557,139 +2563,139 @@ function dt(e) {
|
|
|
2557
2563
|
}
|
|
2558
2564
|
return btoa(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
2559
2565
|
}
|
|
2560
|
-
var
|
|
2561
|
-
|
|
2562
|
-
function
|
|
2563
|
-
if (t ===
|
|
2564
|
-
if (t ===
|
|
2566
|
+
var pt = "copy",
|
|
2567
|
+
ft = "convert";
|
|
2568
|
+
function _t(e, t, r) {
|
|
2569
|
+
if (t === pt) return r;
|
|
2570
|
+
if (t === ft) return e(r);
|
|
2565
2571
|
if (t instanceof Array) return r.map(function (r) {
|
|
2566
|
-
return
|
|
2572
|
+
return _t(e, t[0], r);
|
|
2567
2573
|
});
|
|
2568
2574
|
if (t instanceof Object) {
|
|
2569
2575
|
for (var n = {}, i = 0, s = Object.entries(t); i < s.length; i++) {
|
|
2570
|
-
var o =
|
|
2576
|
+
var o = de(s[i], 2),
|
|
2571
2577
|
a = o[0],
|
|
2572
2578
|
c = o[1];
|
|
2573
2579
|
if (c.derive) {
|
|
2574
2580
|
var u = c.derive(r);
|
|
2575
2581
|
void 0 !== u && (r[a] = u);
|
|
2576
2582
|
}
|
|
2577
|
-
if (a in r) null != r[a] ? n[a] =
|
|
2583
|
+
if (a in r) null != r[a] ? n[a] = _t(e, c.schema, r[a]) : n[a] = null;else if (c.required) throw new Error("Missing key: ".concat(a));
|
|
2578
2584
|
}
|
|
2579
2585
|
return n;
|
|
2580
2586
|
}
|
|
2581
2587
|
}
|
|
2582
|
-
function
|
|
2588
|
+
function mt(e, t) {
|
|
2583
2589
|
return {
|
|
2584
2590
|
required: !0,
|
|
2585
2591
|
schema: e,
|
|
2586
2592
|
derive: t
|
|
2587
2593
|
};
|
|
2588
2594
|
}
|
|
2589
|
-
function
|
|
2595
|
+
function vt(e) {
|
|
2590
2596
|
return {
|
|
2591
2597
|
required: !0,
|
|
2592
2598
|
schema: e
|
|
2593
2599
|
};
|
|
2594
2600
|
}
|
|
2595
|
-
function
|
|
2601
|
+
function yt(e) {
|
|
2596
2602
|
return {
|
|
2597
2603
|
required: !1,
|
|
2598
2604
|
schema: e
|
|
2599
2605
|
};
|
|
2600
2606
|
}
|
|
2601
|
-
var
|
|
2602
|
-
type:
|
|
2603
|
-
id:
|
|
2604
|
-
transports:
|
|
2605
|
-
},
|
|
2606
|
-
gt = {
|
|
2607
|
-
appid: vt(ht),
|
|
2608
|
-
appidExclude: vt(ht),
|
|
2609
|
-
credProps: vt(ht)
|
|
2607
|
+
var gt = {
|
|
2608
|
+
type: vt(pt),
|
|
2609
|
+
id: vt(ft),
|
|
2610
|
+
transports: yt(pt)
|
|
2610
2611
|
},
|
|
2611
2612
|
bt = {
|
|
2612
|
-
appid:
|
|
2613
|
-
appidExclude:
|
|
2614
|
-
credProps:
|
|
2613
|
+
appid: yt(pt),
|
|
2614
|
+
appidExclude: yt(pt),
|
|
2615
|
+
credProps: yt(pt)
|
|
2615
2616
|
},
|
|
2616
2617
|
kt = {
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2618
|
+
appid: yt(pt),
|
|
2619
|
+
appidExclude: yt(pt),
|
|
2620
|
+
credProps: yt(pt)
|
|
2621
|
+
},
|
|
2622
|
+
wt = {
|
|
2623
|
+
publicKey: vt({
|
|
2624
|
+
rp: vt(pt),
|
|
2625
|
+
user: vt({
|
|
2626
|
+
id: vt(ft),
|
|
2627
|
+
name: vt(pt),
|
|
2628
|
+
displayName: vt(pt)
|
|
2623
2629
|
}),
|
|
2624
|
-
challenge:
|
|
2625
|
-
pubKeyCredParams:
|
|
2626
|
-
timeout:
|
|
2627
|
-
excludeCredentials:
|
|
2628
|
-
authenticatorSelection:
|
|
2629
|
-
attestation:
|
|
2630
|
-
extensions:
|
|
2630
|
+
challenge: vt(ft),
|
|
2631
|
+
pubKeyCredParams: vt(pt),
|
|
2632
|
+
timeout: yt(pt),
|
|
2633
|
+
excludeCredentials: yt([gt]),
|
|
2634
|
+
authenticatorSelection: yt(pt),
|
|
2635
|
+
attestation: yt(pt),
|
|
2636
|
+
extensions: yt(bt)
|
|
2631
2637
|
}),
|
|
2632
|
-
signal:
|
|
2638
|
+
signal: yt(pt)
|
|
2633
2639
|
},
|
|
2634
|
-
|
|
2635
|
-
type:
|
|
2636
|
-
id:
|
|
2637
|
-
rawId:
|
|
2638
|
-
authenticatorAttachment:
|
|
2639
|
-
response:
|
|
2640
|
-
clientDataJSON:
|
|
2641
|
-
attestationObject:
|
|
2642
|
-
transports:
|
|
2640
|
+
St = {
|
|
2641
|
+
type: vt(pt),
|
|
2642
|
+
id: vt(pt),
|
|
2643
|
+
rawId: vt(ft),
|
|
2644
|
+
authenticatorAttachment: yt(pt),
|
|
2645
|
+
response: vt({
|
|
2646
|
+
clientDataJSON: vt(ft),
|
|
2647
|
+
attestationObject: vt(ft),
|
|
2648
|
+
transports: mt(pt, function (e) {
|
|
2643
2649
|
var t;
|
|
2644
2650
|
return (null == (t = e.getTransports) ? void 0 : t.call(e)) || [];
|
|
2645
2651
|
})
|
|
2646
2652
|
}),
|
|
2647
|
-
clientExtensionResults:
|
|
2653
|
+
clientExtensionResults: mt(kt, function (e) {
|
|
2648
2654
|
return e.getClientExtensionResults();
|
|
2649
2655
|
})
|
|
2650
2656
|
},
|
|
2651
|
-
|
|
2652
|
-
mediation:
|
|
2653
|
-
publicKey:
|
|
2654
|
-
challenge:
|
|
2655
|
-
timeout:
|
|
2656
|
-
rpId:
|
|
2657
|
-
allowCredentials:
|
|
2658
|
-
userVerification:
|
|
2659
|
-
extensions:
|
|
2657
|
+
xt = {
|
|
2658
|
+
mediation: yt(pt),
|
|
2659
|
+
publicKey: vt({
|
|
2660
|
+
challenge: vt(ft),
|
|
2661
|
+
timeout: yt(pt),
|
|
2662
|
+
rpId: yt(pt),
|
|
2663
|
+
allowCredentials: yt([gt]),
|
|
2664
|
+
userVerification: yt(pt),
|
|
2665
|
+
extensions: yt(bt)
|
|
2660
2666
|
}),
|
|
2661
|
-
signal:
|
|
2667
|
+
signal: yt(pt)
|
|
2662
2668
|
},
|
|
2663
|
-
|
|
2664
|
-
type:
|
|
2665
|
-
id:
|
|
2666
|
-
rawId:
|
|
2667
|
-
authenticatorAttachment:
|
|
2668
|
-
response:
|
|
2669
|
-
clientDataJSON:
|
|
2670
|
-
authenticatorData:
|
|
2671
|
-
signature:
|
|
2672
|
-
userHandle:
|
|
2669
|
+
Ct = {
|
|
2670
|
+
type: vt(pt),
|
|
2671
|
+
id: vt(pt),
|
|
2672
|
+
rawId: vt(ft),
|
|
2673
|
+
authenticatorAttachment: yt(pt),
|
|
2674
|
+
response: vt({
|
|
2675
|
+
clientDataJSON: vt(ft),
|
|
2676
|
+
authenticatorData: vt(ft),
|
|
2677
|
+
signature: vt(ft),
|
|
2678
|
+
userHandle: vt(ft)
|
|
2673
2679
|
}),
|
|
2674
|
-
clientExtensionResults:
|
|
2680
|
+
clientExtensionResults: mt(kt, function (e) {
|
|
2675
2681
|
return e.getClientExtensionResults();
|
|
2676
2682
|
})
|
|
2677
2683
|
};
|
|
2678
|
-
function Ct(e) {
|
|
2679
|
-
return ft(lt, kt, e);
|
|
2680
|
-
}
|
|
2681
2684
|
function Pt(e) {
|
|
2682
|
-
return
|
|
2685
|
+
return _t(dt, wt, e);
|
|
2683
2686
|
}
|
|
2684
2687
|
function Ot(e) {
|
|
2685
|
-
return
|
|
2688
|
+
return _t(ht, St, e);
|
|
2689
|
+
}
|
|
2690
|
+
function Tt(e) {
|
|
2691
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
2686
2692
|
var r;
|
|
2687
|
-
return
|
|
2693
|
+
return me().wrap(function (t) {
|
|
2688
2694
|
for (;;) switch (t.prev = t.next) {
|
|
2689
2695
|
case 0:
|
|
2690
|
-
return t.next = 2, navigator.credentials.create(
|
|
2696
|
+
return t.next = 2, navigator.credentials.create(Pt(e));
|
|
2691
2697
|
case 2:
|
|
2692
|
-
return r = t.sent, t.abrupt("return",
|
|
2698
|
+
return r = t.sent, t.abrupt("return", Ot(r));
|
|
2693
2699
|
case 4:
|
|
2694
2700
|
case "end":
|
|
2695
2701
|
return t.stop();
|
|
@@ -2697,21 +2703,21 @@ function Ot(e) {
|
|
|
2697
2703
|
}, t);
|
|
2698
2704
|
}));
|
|
2699
2705
|
}
|
|
2700
|
-
function Tt(e) {
|
|
2701
|
-
return ft(lt, St, e);
|
|
2702
|
-
}
|
|
2703
2706
|
function At(e) {
|
|
2704
|
-
return
|
|
2707
|
+
return _t(dt, xt, e);
|
|
2705
2708
|
}
|
|
2706
2709
|
function Et(e) {
|
|
2707
|
-
return
|
|
2710
|
+
return _t(ht, Ct, e);
|
|
2711
|
+
}
|
|
2712
|
+
function Dt(e) {
|
|
2713
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
2708
2714
|
var r;
|
|
2709
|
-
return
|
|
2715
|
+
return me().wrap(function (t) {
|
|
2710
2716
|
for (;;) switch (t.prev = t.next) {
|
|
2711
2717
|
case 0:
|
|
2712
|
-
return t.next = 2, navigator.credentials.get(
|
|
2718
|
+
return t.next = 2, navigator.credentials.get(At(e));
|
|
2713
2719
|
case 2:
|
|
2714
|
-
return r = t.sent, t.abrupt("return",
|
|
2720
|
+
return r = t.sent, t.abrupt("return", Et(r));
|
|
2715
2721
|
case 4:
|
|
2716
2722
|
case "end":
|
|
2717
2723
|
return t.stop();
|
|
@@ -2719,22 +2725,22 @@ function Et(e) {
|
|
|
2719
2725
|
}, t);
|
|
2720
2726
|
}));
|
|
2721
2727
|
}
|
|
2722
|
-
var
|
|
2728
|
+
var Rt = function () {
|
|
2723
2729
|
function e(t, r, n) {
|
|
2724
|
-
|
|
2730
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n, this.checkEligibleInputs = function () {
|
|
2725
2731
|
return !(document.querySelectorAll("input[autocomplete*='webauthn']").length < 1) || (console.error('No <input> with `"webauthn"` in its `autocomplete` attribute was detected'), !1);
|
|
2726
2732
|
};
|
|
2727
2733
|
}
|
|
2728
|
-
return
|
|
2734
|
+
return ye(e, [{
|
|
2729
2735
|
key: "register",
|
|
2730
2736
|
value: function value(e) {
|
|
2731
2737
|
var t, r;
|
|
2732
|
-
return
|
|
2738
|
+
return Ee(this, void 0, void 0, me().mark(function n() {
|
|
2733
2739
|
var i, s, o, a, c;
|
|
2734
|
-
return
|
|
2740
|
+
return me().wrap(function (n) {
|
|
2735
2741
|
for (;;) switch (n.prev = n.next) {
|
|
2736
2742
|
case 0:
|
|
2737
|
-
return
|
|
2743
|
+
return $e("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({
|
|
2738
2744
|
url: "/webauthn/register/start",
|
|
2739
2745
|
method: "POST",
|
|
2740
2746
|
errorMessage: "Failed to start WebAuthn registration",
|
|
@@ -2746,7 +2752,7 @@ var Dt = function () {
|
|
|
2746
2752
|
}
|
|
2747
2753
|
});
|
|
2748
2754
|
case 3:
|
|
2749
|
-
return i = n.sent, s = i.public_key_credential_creation_options, o = JSON.parse(s), n.next = 8,
|
|
2755
|
+
return i = n.sent, s = i.public_key_credential_creation_options, o = JSON.parse(s), n.next = 8, Tt({
|
|
2750
2756
|
publicKey: o
|
|
2751
2757
|
});
|
|
2752
2758
|
case 8:
|
|
@@ -2768,7 +2774,7 @@ var Dt = function () {
|
|
|
2768
2774
|
session_token: c.session_token,
|
|
2769
2775
|
session_jwt: c.session_jwt,
|
|
2770
2776
|
intermediate_session_token: null
|
|
2771
|
-
}), n.abrupt("return",
|
|
2777
|
+
}), n.abrupt("return", Ze(c));
|
|
2772
2778
|
case 14:
|
|
2773
2779
|
case "end":
|
|
2774
2780
|
return n.stop();
|
|
@@ -2780,12 +2786,12 @@ var Dt = function () {
|
|
|
2780
2786
|
key: "authenticate",
|
|
2781
2787
|
value: function value(e) {
|
|
2782
2788
|
var t, r;
|
|
2783
|
-
return
|
|
2789
|
+
return Ee(this, void 0, void 0, me().mark(function n() {
|
|
2784
2790
|
var i, s, o, a, c, u, l, d, h, p, f, _;
|
|
2785
|
-
return
|
|
2791
|
+
return me().wrap(function (n) {
|
|
2786
2792
|
for (;;) switch (n.prev = n.next) {
|
|
2787
2793
|
case 0:
|
|
2788
|
-
return
|
|
2794
|
+
return $e("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();
|
|
2789
2795
|
case 3:
|
|
2790
2796
|
if (i = n.sent, s = i.dfp_telemetry_id, o = i.captcha_token, !e.conditional_mediation) {
|
|
2791
2797
|
n.next = 14;
|
|
@@ -2820,7 +2826,7 @@ var Dt = function () {
|
|
|
2820
2826
|
signal: null !== (r = e.signal) && void 0 !== r ? r : d.signal
|
|
2821
2827
|
}, p = Object.assign(Object.assign({}, h), {
|
|
2822
2828
|
mediation: "conditional"
|
|
2823
|
-
}), n.next = 25,
|
|
2829
|
+
}), n.next = 25, Dt(e.conditional_mediation ? p : h);
|
|
2824
2830
|
case 25:
|
|
2825
2831
|
return f = n.sent, n.next = 28, this._networkClient.retriableFetchSDK({
|
|
2826
2832
|
url: "/webauthn/authenticate",
|
|
@@ -2843,7 +2849,7 @@ var Dt = function () {
|
|
|
2843
2849
|
session_token: _.session_token,
|
|
2844
2850
|
session_jwt: _.session_jwt,
|
|
2845
2851
|
intermediate_session_token: null
|
|
2846
|
-
}), n.abrupt("return",
|
|
2852
|
+
}), n.abrupt("return", Ze(_));
|
|
2847
2853
|
case 31:
|
|
2848
2854
|
case "end":
|
|
2849
2855
|
return n.stop();
|
|
@@ -2854,9 +2860,9 @@ var Dt = function () {
|
|
|
2854
2860
|
}, {
|
|
2855
2861
|
key: "update",
|
|
2856
2862
|
value: function value(e) {
|
|
2857
|
-
return
|
|
2863
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
2858
2864
|
var r;
|
|
2859
|
-
return
|
|
2865
|
+
return me().wrap(function (t) {
|
|
2860
2866
|
for (;;) switch (t.prev = t.next) {
|
|
2861
2867
|
case 0:
|
|
2862
2868
|
return r = "/webauthn/update/" + e.webauthn_registration_id, t.next = 3, this._networkClient.fetchSDK({
|
|
@@ -2879,9 +2885,9 @@ var Dt = function () {
|
|
|
2879
2885
|
}, {
|
|
2880
2886
|
key: "browserSupportsAutofill",
|
|
2881
2887
|
value: function value() {
|
|
2882
|
-
return
|
|
2888
|
+
return Ee(this, void 0, void 0, me().mark(function e() {
|
|
2883
2889
|
var t;
|
|
2884
|
-
return
|
|
2890
|
+
return me().wrap(function (e) {
|
|
2885
2891
|
for (;;) switch (e.prev = e.next) {
|
|
2886
2892
|
case 0:
|
|
2887
2893
|
if (void 0 !== (t = window.PublicKeyCredential) && void 0 !== t.isConditionalMediationAvailable) {
|
|
@@ -2902,21 +2908,21 @@ var Dt = function () {
|
|
|
2902
2908
|
}
|
|
2903
2909
|
}]), e;
|
|
2904
2910
|
}(),
|
|
2905
|
-
|
|
2911
|
+
It = Promise.resolve({
|
|
2906
2912
|
pkceRequiredForPasswordResets: !1
|
|
2907
2913
|
}),
|
|
2908
|
-
|
|
2914
|
+
Ft = function () {
|
|
2909
2915
|
function e(t, r, n) {
|
|
2910
|
-
var i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] :
|
|
2911
|
-
s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] :
|
|
2912
|
-
|
|
2916
|
+
var i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : It,
|
|
2917
|
+
s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : et();
|
|
2918
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._config = i, this.dfpProtectedAuth = s;
|
|
2913
2919
|
}
|
|
2914
|
-
return
|
|
2920
|
+
return ye(e, [{
|
|
2915
2921
|
key: "getCodeChallenge",
|
|
2916
2922
|
value: function value() {
|
|
2917
|
-
return
|
|
2923
|
+
return Ee(this, void 0, void 0, me().mark(function e() {
|
|
2918
2924
|
var t, r;
|
|
2919
|
-
return
|
|
2925
|
+
return me().wrap(function (e) {
|
|
2920
2926
|
for (;;) switch (e.prev = e.next) {
|
|
2921
2927
|
case 0:
|
|
2922
2928
|
return e.next = 2, this._config;
|
|
@@ -2948,12 +2954,12 @@ var Dt = function () {
|
|
|
2948
2954
|
}, {
|
|
2949
2955
|
key: "create",
|
|
2950
2956
|
value: function value(e) {
|
|
2951
|
-
return
|
|
2957
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
2952
2958
|
var r, n, i, s;
|
|
2953
|
-
return
|
|
2959
|
+
return me().wrap(function (t) {
|
|
2954
2960
|
for (;;) switch (t.prev = t.next) {
|
|
2955
2961
|
case 0:
|
|
2956
|
-
return
|
|
2962
|
+
return $e("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();
|
|
2957
2963
|
case 3:
|
|
2958
2964
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2959
2965
|
url: "/passwords",
|
|
@@ -2977,7 +2983,7 @@ var Dt = function () {
|
|
|
2977
2983
|
session_token: s.session_token,
|
|
2978
2984
|
session_jwt: s.session_jwt,
|
|
2979
2985
|
intermediate_session_token: null
|
|
2980
|
-
}), t.abrupt("return",
|
|
2986
|
+
}), t.abrupt("return", Ze(s));
|
|
2981
2987
|
case 11:
|
|
2982
2988
|
case "end":
|
|
2983
2989
|
return t.stop();
|
|
@@ -2988,12 +2994,12 @@ var Dt = function () {
|
|
|
2988
2994
|
}, {
|
|
2989
2995
|
key: "authenticate",
|
|
2990
2996
|
value: function value(e) {
|
|
2991
|
-
return
|
|
2997
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
2992
2998
|
var r, n, i, s;
|
|
2993
|
-
return
|
|
2999
|
+
return me().wrap(function (t) {
|
|
2994
3000
|
for (;;) switch (t.prev = t.next) {
|
|
2995
3001
|
case 0:
|
|
2996
|
-
return
|
|
3002
|
+
return $e("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();
|
|
2997
3003
|
case 3:
|
|
2998
3004
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2999
3005
|
url: "/passwords/authenticate",
|
|
@@ -3017,7 +3023,7 @@ var Dt = function () {
|
|
|
3017
3023
|
session_token: s.session_token,
|
|
3018
3024
|
session_jwt: s.session_jwt,
|
|
3019
3025
|
intermediate_session_token: null
|
|
3020
|
-
}), t.abrupt("return",
|
|
3026
|
+
}), t.abrupt("return", Ze(s));
|
|
3021
3027
|
case 11:
|
|
3022
3028
|
case "end":
|
|
3023
3029
|
return t.stop();
|
|
@@ -3028,12 +3034,12 @@ var Dt = function () {
|
|
|
3028
3034
|
}, {
|
|
3029
3035
|
key: "resetByEmailStart",
|
|
3030
3036
|
value: function value(e) {
|
|
3031
|
-
return
|
|
3037
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
3032
3038
|
var r, n, i, s;
|
|
3033
|
-
return
|
|
3039
|
+
return me().wrap(function (t) {
|
|
3034
3040
|
for (;;) switch (t.prev = t.next) {
|
|
3035
3041
|
case 0:
|
|
3036
|
-
return
|
|
3042
|
+
return $e("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();
|
|
3037
3043
|
case 3:
|
|
3038
3044
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3039
3045
|
case 6:
|
|
@@ -3063,12 +3069,12 @@ var Dt = function () {
|
|
|
3063
3069
|
}, {
|
|
3064
3070
|
key: "resetByEmail",
|
|
3065
3071
|
value: function value(e) {
|
|
3066
|
-
return
|
|
3072
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
3067
3073
|
var r, n, i, s, o, a;
|
|
3068
|
-
return
|
|
3074
|
+
return me().wrap(function (t) {
|
|
3069
3075
|
for (;;) switch (t.prev = t.next) {
|
|
3070
3076
|
case 0:
|
|
3071
|
-
return
|
|
3077
|
+
return $e("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();
|
|
3072
3078
|
case 3:
|
|
3073
3079
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._pkceManager.getPKPair();
|
|
3074
3080
|
case 8:
|
|
@@ -3095,7 +3101,7 @@ var Dt = function () {
|
|
|
3095
3101
|
session_token: a.session_token,
|
|
3096
3102
|
session_jwt: a.session_jwt,
|
|
3097
3103
|
intermediate_session_token: null
|
|
3098
|
-
}), t.abrupt("return",
|
|
3104
|
+
}), t.abrupt("return", Ze(a));
|
|
3099
3105
|
case 16:
|
|
3100
3106
|
case "end":
|
|
3101
3107
|
return t.stop();
|
|
@@ -3106,12 +3112,12 @@ var Dt = function () {
|
|
|
3106
3112
|
}, {
|
|
3107
3113
|
key: "resetByExistingPassword",
|
|
3108
3114
|
value: function value(e) {
|
|
3109
|
-
return
|
|
3115
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
3110
3116
|
var r, n, i, s;
|
|
3111
|
-
return
|
|
3117
|
+
return me().wrap(function (t) {
|
|
3112
3118
|
for (;;) switch (t.prev = t.next) {
|
|
3113
3119
|
case 0:
|
|
3114
|
-
return
|
|
3120
|
+
return $e("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();
|
|
3115
3121
|
case 3:
|
|
3116
3122
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
3117
3123
|
url: "/passwords/existing_password/reset",
|
|
@@ -3136,7 +3142,7 @@ var Dt = function () {
|
|
|
3136
3142
|
session_token: s.session_token,
|
|
3137
3143
|
session_jwt: s.session_jwt,
|
|
3138
3144
|
intermediate_session_token: null
|
|
3139
|
-
}), t.abrupt("return",
|
|
3145
|
+
}), t.abrupt("return", Ze(s));
|
|
3140
3146
|
case 11:
|
|
3141
3147
|
case "end":
|
|
3142
3148
|
return t.stop();
|
|
@@ -3147,12 +3153,12 @@ var Dt = function () {
|
|
|
3147
3153
|
}, {
|
|
3148
3154
|
key: "resetBySession",
|
|
3149
3155
|
value: function value(e) {
|
|
3150
|
-
return
|
|
3156
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
3151
3157
|
var r, n, i, s;
|
|
3152
|
-
return
|
|
3158
|
+
return me().wrap(function (t) {
|
|
3153
3159
|
for (;;) switch (t.prev = t.next) {
|
|
3154
3160
|
case 0:
|
|
3155
|
-
return
|
|
3161
|
+
return $e("stytch.passwords.resetBySession").isString("password", e.password), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3156
3162
|
case 3:
|
|
3157
3163
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
3158
3164
|
url: "/passwords/session/reset",
|
|
@@ -3186,11 +3192,11 @@ var Dt = function () {
|
|
|
3186
3192
|
}, {
|
|
3187
3193
|
key: "strengthCheck",
|
|
3188
3194
|
value: function value(e) {
|
|
3189
|
-
return
|
|
3190
|
-
return
|
|
3195
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
3196
|
+
return me().wrap(function (t) {
|
|
3191
3197
|
for (;;) switch (t.prev = t.next) {
|
|
3192
3198
|
case 0:
|
|
3193
|
-
return
|
|
3199
|
+
return $e("stytch.passwords.strengthCheck").isOptionalString("email", e.email).isString("password", e.password), t.abrupt("return", this._networkClient.fetchSDK({
|
|
3194
3200
|
url: "/passwords/strength_check",
|
|
3195
3201
|
method: "POST",
|
|
3196
3202
|
errorMessage: "Failed to check password strength.",
|
|
@@ -3213,15 +3219,15 @@ Promise.resolve({
|
|
|
3213
3219
|
}), Promise.resolve({
|
|
3214
3220
|
pkceRequiredForPasswordResets: !1
|
|
3215
3221
|
});
|
|
3216
|
-
var
|
|
3222
|
+
var jt = function () {
|
|
3217
3223
|
function e(t) {
|
|
3218
|
-
|
|
3224
|
+
be(this, e), this.iframeURL = t, this.createIframe();
|
|
3219
3225
|
}
|
|
3220
|
-
return
|
|
3226
|
+
return ye(e, [{
|
|
3221
3227
|
key: "createIframe",
|
|
3222
3228
|
value: function value() {
|
|
3223
3229
|
var e = document.querySelector('[src~="'.concat(this.iframeURL, '"]'));
|
|
3224
|
-
e ?
|
|
3230
|
+
e ? Ve("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) {
|
|
3225
3231
|
e.addEventListener("load", function () {
|
|
3226
3232
|
e.dataset.loaded = "true", t(e);
|
|
3227
3233
|
}, {
|
|
@@ -3232,11 +3238,11 @@ var Ft = function () {
|
|
|
3232
3238
|
}, {
|
|
3233
3239
|
key: "call",
|
|
3234
3240
|
value: function value(e, t) {
|
|
3235
|
-
return
|
|
3241
|
+
return Ee(this, void 0, void 0, me().mark(function r() {
|
|
3236
3242
|
var n,
|
|
3237
3243
|
i,
|
|
3238
3244
|
s = this;
|
|
3239
|
-
return
|
|
3245
|
+
return me().wrap(function (r) {
|
|
3240
3246
|
for (;;) switch (r.prev = r.next) {
|
|
3241
3247
|
case 0:
|
|
3242
3248
|
return r.next = 2, this.frame;
|
|
@@ -3245,7 +3251,7 @@ var Ft = function () {
|
|
|
3245
3251
|
var a;
|
|
3246
3252
|
i.port1.onmessage = function (e) {
|
|
3247
3253
|
var t = e.data;
|
|
3248
|
-
i.port1.close(), t.success ? r(t.payload) : o(
|
|
3254
|
+
i.port1.close(), t.success ? r(t.payload) : o(tt.unmarshall(t.error));
|
|
3249
3255
|
};
|
|
3250
3256
|
var c = {
|
|
3251
3257
|
method: e,
|
|
@@ -3262,11 +3268,11 @@ var Ft = function () {
|
|
|
3262
3268
|
}
|
|
3263
3269
|
}]), e;
|
|
3264
3270
|
}(),
|
|
3265
|
-
|
|
3271
|
+
Bt = function () {
|
|
3266
3272
|
function e(t, r) {
|
|
3267
|
-
|
|
3273
|
+
be(this, e), this._networkClient = t, this.dfpProtectedAuth = r;
|
|
3268
3274
|
}
|
|
3269
|
-
return
|
|
3275
|
+
return ye(e, [{
|
|
3270
3276
|
key: "searchUser",
|
|
3271
3277
|
value: function value(e) {
|
|
3272
3278
|
var t = this;
|
|
@@ -3312,17 +3318,17 @@ var Ft = function () {
|
|
|
3312
3318
|
}
|
|
3313
3319
|
}]), e;
|
|
3314
3320
|
}(),
|
|
3315
|
-
|
|
3321
|
+
Lt = function () {
|
|
3316
3322
|
function e(t, r) {
|
|
3317
3323
|
var n = this;
|
|
3318
|
-
|
|
3324
|
+
be(this, e), this._subscriptionService = t, this._headlessSessionClient = r, this._onDataChange = function (e) {
|
|
3319
3325
|
!function (e) {
|
|
3320
3326
|
return !!(null == e ? void 0 : e.session);
|
|
3321
3327
|
}(e) ? n.cancelBackgroundRefresh() : n.scheduleBackgroundRefresh();
|
|
3322
3328
|
}, this._reauthenticateWithBackoff = function () {
|
|
3323
|
-
return
|
|
3329
|
+
return Ee(n, void 0, void 0, me().mark(function t() {
|
|
3324
3330
|
var r;
|
|
3325
|
-
return
|
|
3331
|
+
return me().wrap(function (t) {
|
|
3326
3332
|
for (;;) switch (t.prev = t.next) {
|
|
3327
3333
|
case 0:
|
|
3328
3334
|
r = 0;
|
|
@@ -3351,14 +3357,14 @@ var Ft = function () {
|
|
|
3351
3357
|
}));
|
|
3352
3358
|
}, this.timeout = null, this._subscriptionService.subscribeToState(this._onDataChange);
|
|
3353
3359
|
}
|
|
3354
|
-
return
|
|
3360
|
+
return ye(e, [{
|
|
3355
3361
|
key: "performBackgroundRefresh",
|
|
3356
3362
|
value: function value() {
|
|
3357
3363
|
var e = this;
|
|
3358
3364
|
this._reauthenticateWithBackoff().then(function () {
|
|
3359
3365
|
e.scheduleBackgroundRefresh();
|
|
3360
3366
|
})["catch"](function (t) {
|
|
3361
|
-
|
|
3367
|
+
Ve("Session background refresh failed. Signalling to app that user is logged out.", {
|
|
3362
3368
|
error: t
|
|
3363
3369
|
}), e._subscriptionService.destroySession();
|
|
3364
3370
|
});
|
|
@@ -3388,28 +3394,28 @@ var Ft = function () {
|
|
|
3388
3394
|
}
|
|
3389
3395
|
}]), e;
|
|
3390
3396
|
}();
|
|
3391
|
-
|
|
3392
|
-
var
|
|
3397
|
+
Lt.REFRESH_INTERVAL_MS = 18e4;
|
|
3398
|
+
var Mt = ye(function e(t, r) {
|
|
3393
3399
|
var n = this;
|
|
3394
|
-
|
|
3400
|
+
be(this, e), this._subscriptionService = t, this.emptyState = r, this.onStateChange = function (e) {
|
|
3395
3401
|
return n._subscriptionService.subscribeToState(function (t) {
|
|
3396
3402
|
e(null != t ? t : n.emptyState);
|
|
3397
3403
|
});
|
|
3398
3404
|
};
|
|
3399
3405
|
});
|
|
3400
|
-
var
|
|
3401
|
-
var
|
|
3402
|
-
function
|
|
3406
|
+
var Nt = "bootstrap";
|
|
3407
|
+
var Ut = /*#__PURE__*/function () {
|
|
3408
|
+
function Ut(e, t, r) {
|
|
3403
3409
|
var _this = this;
|
|
3404
|
-
_classCallCheck(this,
|
|
3410
|
+
_classCallCheck(this, Ut);
|
|
3405
3411
|
this._publicToken = e, this._networkClient = t, this._dataLayer = r, this._bootstrapDataPromise = this._networkClient.fetchSDK({
|
|
3406
3412
|
url: "/projects/bootstrap/".concat(this._publicToken),
|
|
3407
3413
|
method: "GET",
|
|
3408
3414
|
errorMessage: "Error fetching bootstrap data for SDK for ".concat(this._publicToken)
|
|
3409
|
-
}).then(
|
|
3410
|
-
return _this._dataLayer.setItem(
|
|
3415
|
+
}).then(Ut.mapBootstrapData).then(function (e) {
|
|
3416
|
+
return _this._dataLayer.setItem(Nt, JSON.stringify(e)), e;
|
|
3411
3417
|
})["catch"](function (e) {
|
|
3412
|
-
return
|
|
3418
|
+
return Ye(e), {
|
|
3413
3419
|
displayWatermark: !1,
|
|
3414
3420
|
cnameDomain: null,
|
|
3415
3421
|
emailDomains: ["stytch.com"],
|
|
@@ -3428,10 +3434,10 @@ var Nt = /*#__PURE__*/function () {
|
|
|
3428
3434
|
};
|
|
3429
3435
|
});
|
|
3430
3436
|
}
|
|
3431
|
-
_createClass(
|
|
3437
|
+
_createClass(Ut, [{
|
|
3432
3438
|
key: "getSync",
|
|
3433
3439
|
value: function getSync() {
|
|
3434
|
-
var e = this._dataLayer.getItem(
|
|
3440
|
+
var e = this._dataLayer.getItem(Nt);
|
|
3435
3441
|
if (null === e) return {
|
|
3436
3442
|
displayWatermark: !1,
|
|
3437
3443
|
cnameDomain: null,
|
|
@@ -3502,9 +3508,9 @@ var Nt = /*#__PURE__*/function () {
|
|
|
3502
3508
|
};
|
|
3503
3509
|
}
|
|
3504
3510
|
}]);
|
|
3505
|
-
return
|
|
3511
|
+
return Ut;
|
|
3506
3512
|
}();
|
|
3507
|
-
function
|
|
3513
|
+
function Kt(e, t, r, n) {
|
|
3508
3514
|
return new (r || (r = Promise))(function (i, s) {
|
|
3509
3515
|
function o(e) {
|
|
3510
3516
|
try {
|
|
@@ -3530,11 +3536,11 @@ function Ut(e, t, r, n) {
|
|
|
3530
3536
|
});
|
|
3531
3537
|
}
|
|
3532
3538
|
"function" == typeof SuppressedError && SuppressedError;
|
|
3533
|
-
var
|
|
3539
|
+
var qt = /*#__PURE__*/_createClass(function qt(e) {
|
|
3534
3540
|
var _this2 = this;
|
|
3535
|
-
_classCallCheck(this,
|
|
3541
|
+
_classCallCheck(this, qt);
|
|
3536
3542
|
this.bootstrapPromise = e, this.executeRecaptcha = function () {
|
|
3537
|
-
return
|
|
3543
|
+
return Kt(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
3538
3544
|
var _yield$this$state, e, t, r;
|
|
3539
3545
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3540
3546
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -3565,7 +3571,7 @@ var Kt = /*#__PURE__*/_createClass(function Kt(e) {
|
|
|
3565
3571
|
}, _callee, this);
|
|
3566
3572
|
}));
|
|
3567
3573
|
}, this.state = e.then(function (e) {
|
|
3568
|
-
return
|
|
3574
|
+
return Kt(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
3569
3575
|
var t;
|
|
3570
3576
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3571
3577
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -3576,7 +3582,7 @@ var Kt = /*#__PURE__*/_createClass(function Kt(e) {
|
|
|
3576
3582
|
}
|
|
3577
3583
|
_context2.t1 = !0;
|
|
3578
3584
|
_context2.next = 4;
|
|
3579
|
-
return t = e.captchaSettings.siteKey,
|
|
3585
|
+
return t = e.captchaSettings.siteKey, qe("https://www.google.com/recaptcha/enterprise.js?render=".concat(t), function () {
|
|
3580
3586
|
return window.grecaptcha.enterprise;
|
|
3581
3587
|
});
|
|
3582
3588
|
case 4:
|
|
@@ -3603,10 +3609,10 @@ var Kt = /*#__PURE__*/_createClass(function Kt(e) {
|
|
|
3603
3609
|
}));
|
|
3604
3610
|
});
|
|
3605
3611
|
});
|
|
3606
|
-
var
|
|
3607
|
-
function
|
|
3612
|
+
var Wt = /*#__PURE__*/function () {
|
|
3613
|
+
function Wt(e) {
|
|
3608
3614
|
var _this3 = this;
|
|
3609
|
-
_classCallCheck(this,
|
|
3615
|
+
_classCallCheck(this, Wt);
|
|
3610
3616
|
this.iframeURL = e, this.oneTapStart = function (e) {
|
|
3611
3617
|
return _this3.call("oneTapStart", e);
|
|
3612
3618
|
}, this.oneTapSubmit = function (e) {
|
|
@@ -3615,11 +3621,11 @@ var qt = /*#__PURE__*/function () {
|
|
|
3615
3621
|
return _this3.call("parsedPhoneNumber", e);
|
|
3616
3622
|
};
|
|
3617
3623
|
}
|
|
3618
|
-
_createClass(
|
|
3624
|
+
_createClass(Wt, [{
|
|
3619
3625
|
key: "frameClient",
|
|
3620
3626
|
get: function get() {
|
|
3621
3627
|
var e;
|
|
3622
|
-
return this._frameClient = null !== (e = this._frameClient) && void 0 !== e ? e : new
|
|
3628
|
+
return this._frameClient = null !== (e = this._frameClient) && void 0 !== e ? e : new jt(this.iframeURL), this._frameClient;
|
|
3623
3629
|
}
|
|
3624
3630
|
}, {
|
|
3625
3631
|
key: "call",
|
|
@@ -3627,15 +3633,15 @@ var qt = /*#__PURE__*/function () {
|
|
|
3627
3633
|
return this.frameClient.call(e, [t]);
|
|
3628
3634
|
}
|
|
3629
3635
|
}]);
|
|
3630
|
-
return
|
|
3636
|
+
return Wt;
|
|
3631
3637
|
}();
|
|
3632
|
-
var
|
|
3633
|
-
_inherits(
|
|
3634
|
-
function
|
|
3638
|
+
var Gt = /*#__PURE__*/function (_ct) {
|
|
3639
|
+
_inherits(Gt, _ct);
|
|
3640
|
+
function Gt(e, t, r, n, i, s) {
|
|
3635
3641
|
var _this4;
|
|
3636
|
-
_classCallCheck(this,
|
|
3637
|
-
_this4 = _callSuper(this,
|
|
3638
|
-
return
|
|
3642
|
+
_classCallCheck(this, Gt);
|
|
3643
|
+
_this4 = _callSuper(this, Gt, [e, t, r, n, i]), _this4._oneTap = s, _this4.startOneTap = function (e) {
|
|
3644
|
+
return Kt(_assertThisInitialized(_this4), void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
3639
3645
|
var t, r, n;
|
|
3640
3646
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3641
3647
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -3673,20 +3679,20 @@ var Wt = /*#__PURE__*/function (_at) {
|
|
|
3673
3679
|
};
|
|
3674
3680
|
return _this4;
|
|
3675
3681
|
}
|
|
3676
|
-
return _createClass(
|
|
3677
|
-
}(
|
|
3678
|
-
var
|
|
3679
|
-
function
|
|
3680
|
-
_classCallCheck(this,
|
|
3682
|
+
return _createClass(Gt);
|
|
3683
|
+
}(ct);
|
|
3684
|
+
var Ht = /*#__PURE__*/function () {
|
|
3685
|
+
function Ht(e, t, r, n) {
|
|
3686
|
+
_classCallCheck(this, Ht);
|
|
3681
3687
|
this._publicToken = e, this._subscriptionDataLayer = t, this.baseURL = r, this.additionalTelemetryDataFn = n, this.updateSessionToken = function () {
|
|
3682
3688
|
return null;
|
|
3683
|
-
}, this.eventLogger = new
|
|
3689
|
+
}, this.eventLogger = new rt({
|
|
3684
3690
|
maxBatchSize: 15,
|
|
3685
3691
|
intervalDurationMs: 800,
|
|
3686
3692
|
logEventURL: this.buildSDKUrl("/events")
|
|
3687
3693
|
});
|
|
3688
3694
|
}
|
|
3689
|
-
_createClass(
|
|
3695
|
+
_createClass(Ht, [{
|
|
3690
3696
|
key: "logEvent",
|
|
3691
3697
|
value: function logEvent(_ref) {
|
|
3692
3698
|
var e = _ref.name,
|
|
@@ -3706,9 +3712,9 @@ var Gt = /*#__PURE__*/function () {
|
|
|
3706
3712
|
key: "createTelemetryBlob",
|
|
3707
3713
|
value: function createTelemetryBlob() {
|
|
3708
3714
|
return Object.assign(Object.assign({
|
|
3709
|
-
event_id: "event-id-".concat(
|
|
3710
|
-
app_session_id: "app-session-id-".concat(
|
|
3711
|
-
persistent_id: "persistent-id-".concat(
|
|
3715
|
+
event_id: "event-id-".concat(Ue()),
|
|
3716
|
+
app_session_id: "app-session-id-".concat(Ue()),
|
|
3717
|
+
persistent_id: "persistent-id-".concat(Ue()),
|
|
3712
3718
|
client_sent_at: new Date().toISOString(),
|
|
3713
3719
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
3714
3720
|
}, this.additionalTelemetryDataFn()), {
|
|
@@ -3717,7 +3723,7 @@ var Gt = /*#__PURE__*/function () {
|
|
|
3717
3723
|
},
|
|
3718
3724
|
sdk: {
|
|
3719
3725
|
identifier: "Stytch.js Javascript SDK",
|
|
3720
|
-
version: "4.9.
|
|
3726
|
+
version: "4.9.1"
|
|
3721
3727
|
}
|
|
3722
3728
|
});
|
|
3723
3729
|
}
|
|
@@ -3728,13 +3734,13 @@ var Gt = /*#__PURE__*/function () {
|
|
|
3728
3734
|
t = _ref2.body,
|
|
3729
3735
|
r = _ref2.errorMessage,
|
|
3730
3736
|
n = _ref2.method;
|
|
3731
|
-
return
|
|
3737
|
+
return Kt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
3732
3738
|
var i, s, o, a;
|
|
3733
3739
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
3734
3740
|
while (1) switch (_context4.prev = _context4.next) {
|
|
3735
3741
|
case 0:
|
|
3736
3742
|
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;
|
|
3737
|
-
return _context4.abrupt("return",
|
|
3743
|
+
return _context4.abrupt("return", Ie({
|
|
3738
3744
|
basicAuthHeader: s,
|
|
3739
3745
|
body: t,
|
|
3740
3746
|
errorMessage: r,
|
|
@@ -3758,7 +3764,7 @@ var Gt = /*#__PURE__*/function () {
|
|
|
3758
3764
|
r = _ref3.errorMessage,
|
|
3759
3765
|
n = _ref3.method,
|
|
3760
3766
|
i = _ref3.retryCallback;
|
|
3761
|
-
return
|
|
3767
|
+
return Kt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
3762
3768
|
var s, o, a, c;
|
|
3763
3769
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
3764
3770
|
while (1) switch (_context5.prev = _context5.next) {
|
|
@@ -3773,9 +3779,9 @@ var Gt = /*#__PURE__*/function () {
|
|
|
3773
3779
|
o = e.xSDKParentHostHeader,
|
|
3774
3780
|
a = e.body,
|
|
3775
3781
|
c = e.retryCallback;
|
|
3776
|
-
return
|
|
3782
|
+
return Ee(this, void 0, void 0, me().mark(function e() {
|
|
3777
3783
|
var u;
|
|
3778
|
-
return
|
|
3784
|
+
return me().wrap(function (e) {
|
|
3779
3785
|
for (;;) switch (e.prev = e.next) {
|
|
3780
3786
|
case 0:
|
|
3781
3787
|
return u = {
|
|
@@ -3786,18 +3792,18 @@ var Gt = /*#__PURE__*/function () {
|
|
|
3786
3792
|
xSDKClientHeader: s,
|
|
3787
3793
|
xSDKParentHostHeader: o,
|
|
3788
3794
|
body: a
|
|
3789
|
-
}, e.prev = 1, e.next = 4,
|
|
3795
|
+
}, e.prev = 1, e.next = 4, Ie(u);
|
|
3790
3796
|
case 4:
|
|
3791
3797
|
case 15:
|
|
3792
3798
|
return e.abrupt("return", e.sent);
|
|
3793
3799
|
case 7:
|
|
3794
|
-
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof
|
|
3800
|
+
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof Re)) {
|
|
3795
3801
|
e.next = 16;
|
|
3796
3802
|
break;
|
|
3797
3803
|
}
|
|
3798
3804
|
return e.next = 12, c(e.t0, u);
|
|
3799
3805
|
case 12:
|
|
3800
|
-
return u = e.sent, e.next = 15,
|
|
3806
|
+
return u = e.sent, e.next = 15, Ie(u);
|
|
3801
3807
|
case 16:
|
|
3802
3808
|
throw e.t0;
|
|
3803
3809
|
case 17:
|
|
@@ -3829,18 +3835,18 @@ var Gt = /*#__PURE__*/function () {
|
|
|
3829
3835
|
return "".concat(this.baseURL, "/sdk/v1").concat(e);
|
|
3830
3836
|
}
|
|
3831
3837
|
}]);
|
|
3832
|
-
return
|
|
3838
|
+
return Ht;
|
|
3833
3839
|
}();
|
|
3834
|
-
var
|
|
3835
|
-
|
|
3840
|
+
var zt = "undefined" != typeof window && "IdentityCredential" in window,
|
|
3841
|
+
Vt = function Vt(e) {
|
|
3836
3842
|
return e === exports.OneTapPositions.forceLegacyEmbedded ? "force" : e === exports.OneTapPositions.embeddedOnly || e === exports.OneTapPositions.embedded || e === exports.OneTapPositions.floatingOrEmbedded;
|
|
3837
3843
|
};
|
|
3838
|
-
var
|
|
3839
|
-
function
|
|
3840
|
-
_classCallCheck(this,
|
|
3844
|
+
var Yt = /*#__PURE__*/function () {
|
|
3845
|
+
function Yt(e, t, r) {
|
|
3846
|
+
_classCallCheck(this, Yt);
|
|
3841
3847
|
this._googleClient = e, this._publicToken = t, this._clientId = r;
|
|
3842
3848
|
}
|
|
3843
|
-
_createClass(
|
|
3849
|
+
_createClass(Yt, [{
|
|
3844
3850
|
key: "cancel",
|
|
3845
3851
|
value: function cancel() {
|
|
3846
3852
|
this._googleClient.cancel();
|
|
@@ -3851,15 +3857,15 @@ var Vt = /*#__PURE__*/function () {
|
|
|
3851
3857
|
var e = _ref4.callback,
|
|
3852
3858
|
t = _ref4.onOneTapCancelled,
|
|
3853
3859
|
r = _ref4.style;
|
|
3854
|
-
return
|
|
3860
|
+
return Kt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
3855
3861
|
var _this5 = this;
|
|
3856
3862
|
var n, i, s;
|
|
3857
3863
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
3858
3864
|
while (1) switch (_context6.prev = _context6.next) {
|
|
3859
3865
|
case 0:
|
|
3860
|
-
n =
|
|
3861
|
-
var t =
|
|
3862
|
-
return "force" === t || t && !
|
|
3866
|
+
n = Vt(r.position), i = function (e) {
|
|
3867
|
+
var t = Vt(e);
|
|
3868
|
+
return "force" === t || t && !zt;
|
|
3863
3869
|
}(r.position), s = {
|
|
3864
3870
|
client_id: this._clientId,
|
|
3865
3871
|
callback: e,
|
|
@@ -3897,22 +3903,22 @@ var Vt = /*#__PURE__*/function () {
|
|
|
3897
3903
|
key: "styleFrame",
|
|
3898
3904
|
value: function styleFrame(e) {
|
|
3899
3905
|
e && Array.from(document.getElementsByTagName("iframe")).forEach(function (e) {
|
|
3900
|
-
e.src.includes(
|
|
3906
|
+
e.src.includes(Oe) && (e.style.width = "100%");
|
|
3901
3907
|
});
|
|
3902
3908
|
}
|
|
3903
3909
|
}]);
|
|
3904
|
-
return
|
|
3910
|
+
return Yt;
|
|
3905
3911
|
}();
|
|
3906
|
-
var
|
|
3907
|
-
function
|
|
3912
|
+
var Jt = /*#__PURE__*/function () {
|
|
3913
|
+
function Jt(e, t) {
|
|
3908
3914
|
var _this6 = this;
|
|
3909
|
-
_classCallCheck(this,
|
|
3915
|
+
_classCallCheck(this, Jt);
|
|
3910
3916
|
this._publicToken = e, this.clientsideServices = t, this.createOnSuccessHandler = function (_ref5) {
|
|
3911
3917
|
var e = _ref5.loginRedirectUrl,
|
|
3912
3918
|
t = _ref5.signupRedirectUrl,
|
|
3913
3919
|
r = _ref5.onSuccess;
|
|
3914
3920
|
return function (n) {
|
|
3915
|
-
return
|
|
3921
|
+
return Kt(_this6, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
3916
3922
|
var i, _yield$this$submitGoo, s;
|
|
3917
3923
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
3918
3924
|
while (1) switch (_context7.prev = _context7.next) {
|
|
@@ -3939,10 +3945,10 @@ var Yt = /*#__PURE__*/function () {
|
|
|
3939
3945
|
window.location.href = e;
|
|
3940
3946
|
};
|
|
3941
3947
|
}
|
|
3942
|
-
_createClass(
|
|
3948
|
+
_createClass(Jt, [{
|
|
3943
3949
|
key: "createOneTapClient",
|
|
3944
3950
|
value: function createOneTapClient() {
|
|
3945
|
-
return
|
|
3951
|
+
return Kt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
3946
3952
|
var e, _yield$this$fetchGoog;
|
|
3947
3953
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
3948
3954
|
while (1) switch (_context8.prev = _context8.next) {
|
|
@@ -3973,9 +3979,9 @@ var Yt = /*#__PURE__*/function () {
|
|
|
3973
3979
|
});
|
|
3974
3980
|
case 12:
|
|
3975
3981
|
_context8.t1 = !0;
|
|
3976
|
-
_context8.t2 =
|
|
3982
|
+
_context8.t2 = Yt;
|
|
3977
3983
|
_context8.next = 16;
|
|
3978
|
-
return
|
|
3984
|
+
return qe(Te, function () {
|
|
3979
3985
|
return window.google.accounts.id;
|
|
3980
3986
|
});
|
|
3981
3987
|
case 16:
|
|
@@ -4007,7 +4013,7 @@ var Yt = /*#__PURE__*/function () {
|
|
|
4007
4013
|
var e = _ref6.credential,
|
|
4008
4014
|
t = _ref6.loginRedirectUrl,
|
|
4009
4015
|
r = _ref6.signupRedirectUrl;
|
|
4010
|
-
return
|
|
4016
|
+
return Kt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
4011
4017
|
var _yield$this$fetchGoog2, n;
|
|
4012
4018
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
4013
4019
|
while (1) switch (_context9.prev = _context9.next) {
|
|
@@ -4044,21 +4050,21 @@ var Yt = /*#__PURE__*/function () {
|
|
|
4044
4050
|
}, {
|
|
4045
4051
|
key: "WillGoogleOneTapShowEmbedded",
|
|
4046
4052
|
value: function WillGoogleOneTapShowEmbedded() {
|
|
4047
|
-
return !
|
|
4053
|
+
return !Jt.WillGoogleOneTapShowBannerForUA(navigator.userAgent);
|
|
4048
4054
|
}
|
|
4049
4055
|
}]);
|
|
4050
|
-
return
|
|
4056
|
+
return Jt;
|
|
4051
4057
|
}();
|
|
4052
|
-
function
|
|
4058
|
+
function $t(e) {
|
|
4053
4059
|
var t = e.toString(16);
|
|
4054
4060
|
return 1 === t.length && (t = "0" + t), t;
|
|
4055
4061
|
}
|
|
4056
|
-
var
|
|
4057
|
-
function
|
|
4058
|
-
_classCallCheck(this,
|
|
4062
|
+
var Xt = /*#__PURE__*/function () {
|
|
4063
|
+
function Xt(e, t) {
|
|
4064
|
+
_classCallCheck(this, Xt);
|
|
4059
4065
|
this._dataLayer = e, this.namespace = t;
|
|
4060
4066
|
}
|
|
4061
|
-
_createClass(
|
|
4067
|
+
_createClass(Xt, [{
|
|
4062
4068
|
key: "key",
|
|
4063
4069
|
value: function key() {
|
|
4064
4070
|
return "PKCE_VERIFIER:" + this.namespace;
|
|
@@ -4066,13 +4072,13 @@ var $t = /*#__PURE__*/function () {
|
|
|
4066
4072
|
}, {
|
|
4067
4073
|
key: "startPKCETransaction",
|
|
4068
4074
|
value: function startPKCETransaction() {
|
|
4069
|
-
return
|
|
4075
|
+
return Kt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
4070
4076
|
var e;
|
|
4071
4077
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
4072
4078
|
while (1) switch (_context10.prev = _context10.next) {
|
|
4073
4079
|
case 0:
|
|
4074
4080
|
_context10.next = 2;
|
|
4075
|
-
return
|
|
4081
|
+
return Xt.createProofkeyPair();
|
|
4076
4082
|
case 2:
|
|
4077
4083
|
e = _context10.sent;
|
|
4078
4084
|
return _context10.abrupt("return", (this._dataLayer.setItem(this.key(), JSON.stringify(e)), e));
|
|
@@ -4090,7 +4096,7 @@ var $t = /*#__PURE__*/function () {
|
|
|
4090
4096
|
if (null !== e) try {
|
|
4091
4097
|
return JSON.parse(e);
|
|
4092
4098
|
} catch (e) {
|
|
4093
|
-
return void
|
|
4099
|
+
return void Ve("Found malformed Proof Key pair in localstorage.");
|
|
4094
4100
|
}
|
|
4095
4101
|
}
|
|
4096
4102
|
}, {
|
|
@@ -4101,7 +4107,7 @@ var $t = /*#__PURE__*/function () {
|
|
|
4101
4107
|
}], [{
|
|
4102
4108
|
key: "createProofkeyPair",
|
|
4103
4109
|
value: function createProofkeyPair() {
|
|
4104
|
-
return
|
|
4110
|
+
return Kt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
4105
4111
|
var _String$fromCharCode;
|
|
4106
4112
|
var e, t, r, n;
|
|
4107
4113
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
@@ -4109,7 +4115,7 @@ var $t = /*#__PURE__*/function () {
|
|
|
4109
4115
|
case 0:
|
|
4110
4116
|
e = new Uint32Array(16);
|
|
4111
4117
|
window.crypto.getRandomValues(e);
|
|
4112
|
-
t = Array.from(e).map(
|
|
4118
|
+
t = Array.from(e).map($t).join("");
|
|
4113
4119
|
_context11.next = 5;
|
|
4114
4120
|
return window.crypto.subtle.digest("SHA-256", new TextEncoder().encode(t));
|
|
4115
4121
|
case 5:
|
|
@@ -4126,9 +4132,9 @@ var $t = /*#__PURE__*/function () {
|
|
|
4126
4132
|
}));
|
|
4127
4133
|
}
|
|
4128
4134
|
}]);
|
|
4129
|
-
return
|
|
4135
|
+
return Xt;
|
|
4130
4136
|
}();
|
|
4131
|
-
var
|
|
4137
|
+
var Zt = function Zt(e) {
|
|
4132
4138
|
return (document.cookie ? document.cookie.split("; ") : []).filter(function (t) {
|
|
4133
4139
|
var _t$split = t.split("="),
|
|
4134
4140
|
_t$split2 = _slicedToArray(_t$split, 1),
|
|
@@ -4137,17 +4143,17 @@ var Xt = function Xt(e) {
|
|
|
4137
4143
|
}).length > 1;
|
|
4138
4144
|
};
|
|
4139
4145
|
/*! js-cookie v3.0.1 | MIT */
|
|
4140
|
-
function
|
|
4146
|
+
function Qt(e) {
|
|
4141
4147
|
for (var t = 1; t < arguments.length; t++) {
|
|
4142
4148
|
var r = arguments[t];
|
|
4143
4149
|
for (var n in r) e[n] = r[n];
|
|
4144
4150
|
}
|
|
4145
4151
|
return e;
|
|
4146
4152
|
}
|
|
4147
|
-
var
|
|
4153
|
+
var er = function e(t, r) {
|
|
4148
4154
|
function n(e, n, i) {
|
|
4149
4155
|
if ("undefined" != typeof document) {
|
|
4150
|
-
"number" == typeof (i =
|
|
4156
|
+
"number" == typeof (i = Qt({}, 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);
|
|
4151
4157
|
var s = "";
|
|
4152
4158
|
for (var o in i) i[o] && (s += "; " + o, !0 !== i[o] && (s += "=" + i[o].split(";")[0]));
|
|
4153
4159
|
return document.cookie = e + "=" + t.write(n, e) + s;
|
|
@@ -4169,15 +4175,15 @@ var Qt = function e(t, r) {
|
|
|
4169
4175
|
}
|
|
4170
4176
|
},
|
|
4171
4177
|
remove: function remove(e, t) {
|
|
4172
|
-
n(e, "",
|
|
4178
|
+
n(e, "", Qt({}, t, {
|
|
4173
4179
|
expires: -1
|
|
4174
4180
|
}));
|
|
4175
4181
|
},
|
|
4176
4182
|
withAttributes: function withAttributes(t) {
|
|
4177
|
-
return e(this.converter,
|
|
4183
|
+
return e(this.converter, Qt({}, this.attributes, t));
|
|
4178
4184
|
},
|
|
4179
4185
|
withConverter: function withConverter(t) {
|
|
4180
|
-
return e(
|
|
4186
|
+
return e(Qt({}, this.converter, t), this.attributes);
|
|
4181
4187
|
}
|
|
4182
4188
|
}, {
|
|
4183
4189
|
attributes: {
|
|
@@ -4197,37 +4203,37 @@ var Qt = function e(t, r) {
|
|
|
4197
4203
|
}, {
|
|
4198
4204
|
path: "/"
|
|
4199
4205
|
});
|
|
4200
|
-
var
|
|
4206
|
+
var tr = function tr(e) {
|
|
4201
4207
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
4202
4208
|
return "stytch_sdk_state_".concat(e).concat(t ? "::".concat(t) : "");
|
|
4203
4209
|
},
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
clearTimeout(
|
|
4210
|
+
rr = new Map(),
|
|
4211
|
+
nr = function nr(e) {
|
|
4212
|
+
clearTimeout(rr.get(e));
|
|
4207
4213
|
},
|
|
4208
|
-
|
|
4209
|
-
|
|
4214
|
+
ir = function ir(e, t, r) {
|
|
4215
|
+
nr(e);
|
|
4210
4216
|
var n = setTimeout(function () {
|
|
4211
|
-
void 0 ===
|
|
4217
|
+
void 0 === er.get(e) && er.set(e, t, r);
|
|
4212
4218
|
}, 10);
|
|
4213
|
-
return
|
|
4219
|
+
return rr.set(e, n), er.set(e, t, r);
|
|
4214
4220
|
};
|
|
4215
|
-
var
|
|
4216
|
-
function
|
|
4221
|
+
var sr = /*#__PURE__*/function () {
|
|
4222
|
+
function sr(e, t) {
|
|
4217
4223
|
var _this7 = this;
|
|
4218
|
-
_classCallCheck(this,
|
|
4224
|
+
_classCallCheck(this, sr);
|
|
4219
4225
|
this.browserSessionStorage = {
|
|
4220
4226
|
getItem: function getItem(e) {
|
|
4221
|
-
return sessionStorage.getItem(
|
|
4227
|
+
return sessionStorage.getItem(tr(_this7.publicToken, e));
|
|
4222
4228
|
},
|
|
4223
4229
|
setItem: function setItem(e, t) {
|
|
4224
|
-
return sessionStorage.setItem(
|
|
4230
|
+
return sessionStorage.setItem(tr(_this7.publicToken, e), t);
|
|
4225
4231
|
},
|
|
4226
4232
|
removeItem: function removeItem(e) {
|
|
4227
|
-
return sessionStorage.removeItem(
|
|
4233
|
+
return sessionStorage.removeItem(tr(_this7.publicToken, e));
|
|
4228
4234
|
}
|
|
4229
|
-
}, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (
|
|
4230
|
-
var r = localStorage.getItem(
|
|
4235
|
+
}, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? ($e("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);
|
|
4236
|
+
var r = localStorage.getItem(tr(this.publicToken));
|
|
4231
4237
|
if (!r) return;
|
|
4232
4238
|
var n;
|
|
4233
4239
|
try {
|
|
@@ -4237,7 +4243,7 @@ var ir = /*#__PURE__*/function () {
|
|
|
4237
4243
|
}
|
|
4238
4244
|
this.state = n;
|
|
4239
4245
|
}
|
|
4240
|
-
_createClass(
|
|
4246
|
+
_createClass(sr, [{
|
|
4241
4247
|
key: "opaqueTokenCookieName",
|
|
4242
4248
|
get: function get() {
|
|
4243
4249
|
var e;
|
|
@@ -4259,14 +4265,14 @@ var ir = /*#__PURE__*/function () {
|
|
|
4259
4265
|
key: "readSessionCookie",
|
|
4260
4266
|
value: function readSessionCookie() {
|
|
4261
4267
|
return {
|
|
4262
|
-
session_token:
|
|
4263
|
-
session_jwt:
|
|
4268
|
+
session_token: er.get(this.opaqueTokenCookieName),
|
|
4269
|
+
session_jwt: er.get(this.jwtCookieName)
|
|
4264
4270
|
};
|
|
4265
4271
|
}
|
|
4266
4272
|
}, {
|
|
4267
4273
|
key: "readIntermediateSessionTokenCookie",
|
|
4268
4274
|
value: function readIntermediateSessionTokenCookie() {
|
|
4269
|
-
return
|
|
4275
|
+
return er.get(this.istCookieName);
|
|
4270
4276
|
}
|
|
4271
4277
|
}, {
|
|
4272
4278
|
key: "writeSessionCookie",
|
|
@@ -4275,32 +4281,32 @@ var ir = /*#__PURE__*/function () {
|
|
|
4275
4281
|
var s = e.state,
|
|
4276
4282
|
o = e.session_token,
|
|
4277
4283
|
a = e.session_jwt,
|
|
4278
|
-
c =
|
|
4284
|
+
c = sr.generateCookieOpts({
|
|
4279
4285
|
expiresAt: null !== (r = null === (t = null == s ? void 0 : s.session) || void 0 === t ? void 0 : t.expires_at) && void 0 !== r ? r : "",
|
|
4280
4286
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4281
4287
|
path: this._cookiePath,
|
|
4282
4288
|
domain: this._domain
|
|
4283
4289
|
});
|
|
4284
|
-
|
|
4285
|
-
var u =
|
|
4290
|
+
ir(this.opaqueTokenCookieName, o, c), ir(this.jwtCookieName, a, c);
|
|
4291
|
+
var u = sr.generateCookieOpts({
|
|
4286
4292
|
expiresAt: null !== (i = null === (n = null == s ? void 0 : s.session) || void 0 === n ? void 0 : n.expires_at) && void 0 !== i ? i : "",
|
|
4287
4293
|
availableToSubdomains: !this._cookieAvailableToSubdomains,
|
|
4288
4294
|
path: this._cookiePath,
|
|
4289
4295
|
domain: this._domain
|
|
4290
4296
|
});
|
|
4291
|
-
|
|
4297
|
+
Zt(this.jwtCookieName) && er.remove(this.jwtCookieName, u), Zt(this.opaqueTokenCookieName) && er.remove(this.opaqueTokenCookieName, u), Zt(this.jwtCookieName) && Ve("Could not remove extraneous JWT cookie. This might happen if the cookie has been set using multiple `path` settings, and may produce unwanted behavior."), Zt(this.opaqueTokenCookieName) && Ve("Could not remove extraneous opaque token cookie.");
|
|
4292
4298
|
}
|
|
4293
4299
|
}, {
|
|
4294
4300
|
key: "writeIntermediateSessionTokenCookie",
|
|
4295
4301
|
value: function writeIntermediateSessionTokenCookie(e) {
|
|
4296
4302
|
var t = new Date(Date.now() + 6e5),
|
|
4297
|
-
r =
|
|
4303
|
+
r = sr.generateCookieOpts({
|
|
4298
4304
|
expiresAt: t.toString(),
|
|
4299
4305
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4300
4306
|
path: this._cookiePath,
|
|
4301
4307
|
domain: this._domain
|
|
4302
4308
|
});
|
|
4303
|
-
|
|
4309
|
+
ir(this.istCookieName, e, r);
|
|
4304
4310
|
}
|
|
4305
4311
|
}, {
|
|
4306
4312
|
key: "removeSessionCookie",
|
|
@@ -4319,38 +4325,38 @@ var ir = /*#__PURE__*/function () {
|
|
|
4319
4325
|
[!0, !1].forEach(function (t) {
|
|
4320
4326
|
[_this8._cookiePath, null].forEach(function (r) {
|
|
4321
4327
|
[_this8._domain, null].forEach(function (n) {
|
|
4322
|
-
var i =
|
|
4328
|
+
var i = sr.generateCookieOpts({
|
|
4323
4329
|
expiresAt: new Date(0).toString(),
|
|
4324
4330
|
availableToSubdomains: t,
|
|
4325
4331
|
path: r,
|
|
4326
4332
|
domain: n
|
|
4327
4333
|
});
|
|
4328
4334
|
e.forEach(function (e) {
|
|
4329
|
-
|
|
4335
|
+
er.remove(e, i);
|
|
4330
4336
|
});
|
|
4331
4337
|
});
|
|
4332
4338
|
});
|
|
4333
|
-
}), e.forEach(
|
|
4339
|
+
}), e.forEach(nr);
|
|
4334
4340
|
}
|
|
4335
4341
|
}, {
|
|
4336
4342
|
key: "syncToLocalStorage",
|
|
4337
4343
|
value: function syncToLocalStorage() {
|
|
4338
|
-
localStorage.setItem(
|
|
4344
|
+
localStorage.setItem(tr(this.publicToken), JSON.stringify(this.state));
|
|
4339
4345
|
}
|
|
4340
4346
|
}, {
|
|
4341
4347
|
key: "getItem",
|
|
4342
4348
|
value: function getItem(e) {
|
|
4343
|
-
return localStorage.getItem(
|
|
4349
|
+
return localStorage.getItem(tr(this.publicToken, e));
|
|
4344
4350
|
}
|
|
4345
4351
|
}, {
|
|
4346
4352
|
key: "setItem",
|
|
4347
4353
|
value: function setItem(e, t) {
|
|
4348
|
-
return localStorage.setItem(
|
|
4354
|
+
return localStorage.setItem(tr(this.publicToken, e), t);
|
|
4349
4355
|
}
|
|
4350
4356
|
}, {
|
|
4351
4357
|
key: "removeItem",
|
|
4352
4358
|
value: function removeItem(e) {
|
|
4353
|
-
return localStorage.removeItem(
|
|
4359
|
+
return localStorage.removeItem(tr(this.publicToken, e));
|
|
4354
4360
|
}
|
|
4355
4361
|
}], [{
|
|
4356
4362
|
key: "generateCookieOpts",
|
|
@@ -4366,30 +4372,30 @@ var ir = /*#__PURE__*/function () {
|
|
|
4366
4372
|
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;
|
|
4367
4373
|
}
|
|
4368
4374
|
}]);
|
|
4369
|
-
return
|
|
4375
|
+
return sr;
|
|
4370
4376
|
}();
|
|
4371
|
-
var
|
|
4372
|
-
_inherits(
|
|
4373
|
-
function
|
|
4374
|
-
_classCallCheck(this,
|
|
4375
|
-
return _callSuper(this,
|
|
4377
|
+
var or = /*#__PURE__*/function (_sr) {
|
|
4378
|
+
_inherits(or, _sr);
|
|
4379
|
+
function or() {
|
|
4380
|
+
_classCallCheck(this, or);
|
|
4381
|
+
return _callSuper(this, or, arguments);
|
|
4376
4382
|
}
|
|
4377
|
-
return _createClass(
|
|
4378
|
-
}(
|
|
4379
|
-
var
|
|
4380
|
-
|
|
4383
|
+
return _createClass(or);
|
|
4384
|
+
}(sr);
|
|
4385
|
+
var ar = Symbol["for"]("__stytch_DataLayer"),
|
|
4386
|
+
cr = function cr(e, t) {
|
|
4381
4387
|
var r = function () {
|
|
4382
4388
|
var e = window;
|
|
4383
|
-
return e[
|
|
4389
|
+
return e[ar] || (e[ar] = {}), e[ar];
|
|
4384
4390
|
}();
|
|
4385
|
-
return r[e] || (r[e] = new
|
|
4391
|
+
return r[e] || (r[e] = new or(e, t)), r[e];
|
|
4386
4392
|
},
|
|
4387
|
-
|
|
4393
|
+
ur = function ur(e, t) {
|
|
4388
4394
|
Object.values(e).forEach(function (e) {
|
|
4389
4395
|
return e(t);
|
|
4390
4396
|
});
|
|
4391
4397
|
},
|
|
4392
|
-
|
|
4398
|
+
lr = function () {
|
|
4393
4399
|
var _ref8 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
4394
4400
|
_ref8$KEYS_TO_EXCLUDE = _ref8.KEYS_TO_EXCLUDE,
|
|
4395
4401
|
e = _ref8$KEYS_TO_EXCLUDE === void 0 ? [] : _ref8$KEYS_TO_EXCLUDE;
|
|
@@ -4411,12 +4417,12 @@ var or = Symbol["for"]("__stytch_DataLayer"),
|
|
|
4411
4417
|
}({
|
|
4412
4418
|
KEYS_TO_EXCLUDE: ["last_accessed_at"]
|
|
4413
4419
|
});
|
|
4414
|
-
var
|
|
4415
|
-
function
|
|
4420
|
+
var dr = /*#__PURE__*/function () {
|
|
4421
|
+
function dr(e, t) {
|
|
4416
4422
|
var _this9 = this;
|
|
4417
|
-
_classCallCheck(this,
|
|
4423
|
+
_classCallCheck(this, dr);
|
|
4418
4424
|
this._publicToken = e, this._datalayer = t, this.fromCache = !0, this._listen = function (e) {
|
|
4419
|
-
if (e.key !==
|
|
4425
|
+
if (e.key !== tr(_this9._publicToken)) return;
|
|
4420
4426
|
var t = null === e.newValue || "null" === e.newValue ? null : JSON.parse(e.newValue);
|
|
4421
4427
|
_this9.updateState(t, !0);
|
|
4422
4428
|
}, window.addEventListener("storage", this._listen);
|
|
@@ -4424,7 +4430,7 @@ var lr = /*#__PURE__*/function () {
|
|
|
4424
4430
|
r = _this$_datalayer$read.session_token;
|
|
4425
4431
|
r || this.destroySession();
|
|
4426
4432
|
}
|
|
4427
|
-
_createClass(
|
|
4433
|
+
_createClass(dr, [{
|
|
4428
4434
|
key: "getTokens",
|
|
4429
4435
|
value: function getTokens() {
|
|
4430
4436
|
var _this$_datalayer$read2 = this._datalayer.readSessionCookie(),
|
|
@@ -4462,7 +4468,7 @@ var lr = /*#__PURE__*/function () {
|
|
|
4462
4468
|
r = null === e.state ? null : Object.assign(Object.assign({}, this._datalayer.state), e.state);
|
|
4463
4469
|
this._datalayer.state = r;
|
|
4464
4470
|
var n = this.getFromCache();
|
|
4465
|
-
this.setCacheRefreshed(), !n &&
|
|
4471
|
+
this.setCacheRefreshed(), !n && lr(t, r) || ur(this._datalayer.subscriptions, r);
|
|
4466
4472
|
}
|
|
4467
4473
|
}, {
|
|
4468
4474
|
key: "updateStateAndTokens",
|
|
@@ -4478,8 +4484,8 @@ var lr = /*#__PURE__*/function () {
|
|
|
4478
4484
|
this._datalayer.state = n;
|
|
4479
4485
|
var i = this.getFromCache();
|
|
4480
4486
|
this.setCacheRefreshed();
|
|
4481
|
-
var s = !
|
|
4482
|
-
(i || s) && (
|
|
4487
|
+
var s = !lr(r, n);
|
|
4488
|
+
(i || s) && (ur(this._datalayer.subscriptions, n), s && !t && this._datalayer.syncToLocalStorage());
|
|
4483
4489
|
}
|
|
4484
4490
|
}, {
|
|
4485
4491
|
key: "updateTokens",
|
|
@@ -4529,14 +4535,14 @@ var lr = /*#__PURE__*/function () {
|
|
|
4529
4535
|
this.fromCache = !1;
|
|
4530
4536
|
}
|
|
4531
4537
|
}]);
|
|
4532
|
-
return
|
|
4538
|
+
return dr;
|
|
4533
4539
|
}();
|
|
4534
|
-
var
|
|
4535
|
-
_inherits(
|
|
4536
|
-
function
|
|
4540
|
+
var hr = /*#__PURE__*/function (_dr) {
|
|
4541
|
+
_inherits(hr, _dr);
|
|
4542
|
+
function hr() {
|
|
4537
4543
|
var _this10;
|
|
4538
|
-
_classCallCheck(this,
|
|
4539
|
-
_this10 = _callSuper(this,
|
|
4544
|
+
_classCallCheck(this, hr);
|
|
4545
|
+
_this10 = _callSuper(this, hr, arguments), _this10.updateUser = function (e) {
|
|
4540
4546
|
return _this10.updateState({
|
|
4541
4547
|
user: e
|
|
4542
4548
|
});
|
|
@@ -4549,10 +4555,10 @@ var dr = /*#__PURE__*/function (_lr) {
|
|
|
4549
4555
|
};
|
|
4550
4556
|
return _this10;
|
|
4551
4557
|
}
|
|
4552
|
-
return _createClass(
|
|
4553
|
-
}(
|
|
4554
|
-
var
|
|
4555
|
-
exports.BiometricsFailedError =
|
|
4558
|
+
return _createClass(hr);
|
|
4559
|
+
}(dr);
|
|
4560
|
+
var pr = Symbol["for"]("stytch__internal_b2c");
|
|
4561
|
+
exports.BiometricsFailedError = ee, exports.BiometricsUnavailableError = B, exports.ChallengeSigningFailedError = J, exports.DeviceCredentialsNotAllowedError = q, exports.FailedCodeChallengeError = X, exports.FailedToDecryptDataError = Q, exports.InternalError = F, exports.InvalidAuthorizationCredentialError = z, exports.InvalidCredentialTypeError = ie, exports.InvalidRedirectSchemeError = re, exports.InvalidStartUrlError = te, exports.JSONDataNotConvertibleToStringError = oe, exports.KeyInvalidatedError = L, exports.KeystoreUnavailableError = M, exports.MissingAttestationObjectError = se, exports.MissingAuthorizationCredentialIDTokenError = H, exports.MissingGoogleClientIDError = W, exports.MissingPKCEError = G, exports.MissingPublicKeyError = Y, exports.MissingUrlError = ne, exports.NoBiometricsEnrolledError = N, exports.NoBiometricsRegistrationError = j, exports.NoCredentialsPresentError = V, exports.NoCurrentSessionError = I, exports.PasskeysInvalidEncoding = ce, exports.PasskeysMisconfigured = ue, exports.PasskeysUnsupportedError = Z, exports.RandomNumberGenerationFailed = ae, exports.SDKAPIUnreachableError = S, exports.SDKNotConfiguredError = $, exports.SignInWithAppleMisconfigured = le, exports.StytchAPIError = D, exports.StytchAPISchemaError = E, exports.StytchAPIUnreachableError = A, exports.StytchError = T, exports.StytchHeadlessClient = /*#__PURE__*/function () {
|
|
4556
4562
|
function _class(e, t) {
|
|
4557
4563
|
var _this11 = this;
|
|
4558
4564
|
_classCallCheck(this, _class);
|
|
@@ -4560,7 +4566,7 @@ exports.BiometricsFailedError = Q, exports.BiometricsUnavailableError = B, expor
|
|
|
4560
4566
|
!function (e) {
|
|
4561
4567
|
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";
|
|
4562
4568
|
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"));
|
|
4563
|
-
}("StytchHeadlessClient"), "string" != typeof (r = e) ?
|
|
4569
|
+
}("StytchHeadlessClient"), "string" != typeof (r = e) ? Ve("Public token is malformed. Expected a string, got ".concat(_e(r), ".").concat(Je)) : "" === r ? Ve('Public token is malformed. Expected "public-token-...", got an empty string.'.concat(Je)) : r.startsWith("public-token-") || Ve('Public token is malformed. Expected "public-token-...", got '.concat(r, ".").concat(Je));
|
|
4564
4570
|
var n = t,
|
|
4565
4571
|
i = {
|
|
4566
4572
|
cookieOptions: null == (s = n) ? void 0 : s.cookieOptions,
|
|
@@ -4573,30 +4579,30 @@ exports.BiometricsFailedError = Q, exports.BiometricsUnavailableError = B, expor
|
|
|
4573
4579
|
}
|
|
4574
4580
|
};
|
|
4575
4581
|
var s, o, a, c, u, l, d, h, p, f, _;
|
|
4576
|
-
this._dataLayer =
|
|
4582
|
+
this._dataLayer = cr(e, n), this._subscriptionService = new hr(e, this._dataLayer), this._stateChangeClient = new Mt(this._subscriptionService, {}), this.onStateChange = function () {
|
|
4577
4583
|
var _this11$_stateChangeC;
|
|
4578
4584
|
return (_this11$_stateChangeC = _this11._stateChangeClient).onStateChange.apply(_this11$_stateChangeC, arguments);
|
|
4579
4585
|
};
|
|
4580
|
-
var m = new
|
|
4581
|
-
this._networkClient = new
|
|
4586
|
+
var m = new Xt(this._dataLayer, "passwords");
|
|
4587
|
+
this._networkClient = new Ht(e, this._dataLayer, i.endpoints.sdkBackendURL, function () {
|
|
4582
4588
|
var e, t, r, n;
|
|
4583
4589
|
return {
|
|
4584
4590
|
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,
|
|
4585
4591
|
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
|
|
4586
4592
|
};
|
|
4587
4593
|
});
|
|
4588
|
-
var v = new
|
|
4589
|
-
y = new
|
|
4590
|
-
g = new
|
|
4591
|
-
b = new
|
|
4592
|
-
k = new
|
|
4593
|
-
w = new
|
|
4594
|
+
var v = new Ut(e, this._networkClient, this._dataLayer),
|
|
4595
|
+
y = new qt(v.getAsync()),
|
|
4596
|
+
g = new Qe(e, i.endpoints.dfpBackendURL, v.getAsync(), y.executeRecaptcha),
|
|
4597
|
+
b = new Wt(i.endpoints.clientsideServicesIframeURL),
|
|
4598
|
+
k = new Jt(e, b),
|
|
4599
|
+
w = new Bt(this._networkClient, g);
|
|
4594
4600
|
var S, x;
|
|
4595
|
-
this.user = new
|
|
4601
|
+
this.user = new nt(this._networkClient, this._subscriptionService), this.session = new it(this._networkClient, this._subscriptionService), this.magicLinks = new ot(this._networkClient, this._subscriptionService, new Xt(this._dataLayer, "magic_links"), m, v.getAsync(), g), this.otps = new at(this._networkClient, this._subscriptionService, y.executeRecaptcha, g), this.oauth = new Gt(this._networkClient, this._subscriptionService, new Xt(this._dataLayer, "oauth"), v.getAsync(), {
|
|
4596
4602
|
publicToken: e,
|
|
4597
4603
|
testAPIURL: i.endpoints.testAPIURL,
|
|
4598
4604
|
liveAPIURL: i.endpoints.liveAPIURL
|
|
4599
|
-
}, k), this.cryptoWallets = new
|
|
4605
|
+
}, k), this.cryptoWallets = new ut(this._networkClient, this._subscriptionService, y.executeRecaptcha, g), this.totps = new lt(this._networkClient, this._subscriptionService, g), this.webauthn = new Rt(this._networkClient, this._subscriptionService, g), this.passwords = new Ft(this._networkClient, this._subscriptionService, m, v.getAsync(), g), this._sessionManager = new Lt(this._subscriptionService, this.session), this._dataLayer.readSessionCookie().session_token && this._sessionManager.performBackgroundRefresh(), this._networkClient.logEvent({
|
|
4600
4606
|
name: "sdk_instance_instantiated",
|
|
4601
4607
|
details: {
|
|
4602
4608
|
event_callback_registered: !1,
|
|
@@ -4612,7 +4618,7 @@ exports.BiometricsFailedError = Q, exports.BiometricsUnavailableError = B, expor
|
|
|
4612
4618
|
publicToken: e,
|
|
4613
4619
|
dataLayer: this._dataLayer,
|
|
4614
4620
|
networkClient: this._networkClient
|
|
4615
|
-
}, Object.assign(S, _defineProperty({},
|
|
4621
|
+
}, Object.assign(S, _defineProperty({}, pr, x));
|
|
4616
4622
|
}
|
|
4617
4623
|
return _createClass(_class);
|
|
4618
4624
|
}(), exports.StytchSDKAPIError = P, exports.StytchSDKError = R, exports.StytchSDKSchemaError = C, exports.StytchSDKUsageError = x, exports.UNRECOVERABLE_ERROR_TYPES = O, exports.UserCancellationError = U, exports.UserLockedOutError = K, exports.errorToStytchError = function (e) {
|
|
@@ -4649,39 +4655,41 @@ exports.BiometricsFailedError = Q, exports.BiometricsUnavailableError = B, expor
|
|
|
4649
4655
|
case "invalid_authorization_credential":
|
|
4650
4656
|
return new z();
|
|
4651
4657
|
case "missing_public_key":
|
|
4652
|
-
return new V();
|
|
4653
|
-
case "challenge_signing_failed":
|
|
4654
4658
|
return new Y();
|
|
4655
|
-
case "
|
|
4659
|
+
case "challenge_signing_failed":
|
|
4656
4660
|
return new J();
|
|
4657
|
-
case "
|
|
4661
|
+
case "no_credentials_present":
|
|
4662
|
+
return new V();
|
|
4663
|
+
case "sdk_not_configured":
|
|
4658
4664
|
return new $();
|
|
4659
|
-
case "
|
|
4665
|
+
case "failed_code_challenge":
|
|
4660
4666
|
return new X();
|
|
4661
|
-
case "
|
|
4667
|
+
case "passkeys_unsupported":
|
|
4662
4668
|
return new Z();
|
|
4663
|
-
case "
|
|
4669
|
+
case "failed_to_decrypt_data":
|
|
4664
4670
|
return new Q();
|
|
4665
|
-
case "
|
|
4671
|
+
case "biometrics_failed":
|
|
4666
4672
|
return new ee();
|
|
4667
|
-
case "
|
|
4673
|
+
case "invalid_start_url":
|
|
4668
4674
|
return new te();
|
|
4669
|
-
case "
|
|
4675
|
+
case "invalid_redirect_scheme":
|
|
4670
4676
|
return new re();
|
|
4671
|
-
case "
|
|
4677
|
+
case "missing_url":
|
|
4672
4678
|
return new ne();
|
|
4673
|
-
case "
|
|
4679
|
+
case "invalid_credential_type":
|
|
4674
4680
|
return new ie();
|
|
4675
|
-
case "
|
|
4681
|
+
case "missing_attestation_object":
|
|
4676
4682
|
return new se();
|
|
4677
|
-
case "
|
|
4683
|
+
case "json_data_not_convertible_to_string":
|
|
4678
4684
|
return new oe();
|
|
4679
|
-
case "
|
|
4685
|
+
case "random_number_generation_failed":
|
|
4680
4686
|
return new ae();
|
|
4681
|
-
case "
|
|
4687
|
+
case "passkeys_invalid_encoding":
|
|
4682
4688
|
return new ce();
|
|
4683
|
-
case "
|
|
4689
|
+
case "passkeys_misconfigured":
|
|
4684
4690
|
return new ue();
|
|
4691
|
+
case "signinwithapple_misconfigured":
|
|
4692
|
+
return new le();
|
|
4685
4693
|
default:
|
|
4686
4694
|
return new R(e.name, e.message);
|
|
4687
4695
|
}
|