@stytch/vanilla-js 4.9.0 → 4.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/b2b/index.esm.js +2882 -2866
- package/dist/b2b/index.headless.esm.js +510 -502
- package/dist/b2b/index.headless.js +522 -514
- package/dist/b2b/index.js +2902 -2886
- package/dist/index.esm.js +3500 -3480
- package/dist/index.headless.esm.js +608 -600
- package/dist/index.headless.js +605 -597
- package/dist/index.js +3513 -3493
- package/package.json +2 -2
|
@@ -322,107 +322,113 @@ var g,
|
|
|
322
322
|
}(),
|
|
323
323
|
V = function (e) {
|
|
324
324
|
function t() {
|
|
325
|
-
return i(this, t), o(this, t, ["
|
|
325
|
+
return i(this, t), o(this, t, ["NoCredentialsPresentError", "The user did not provide credentials for a Google OneTap attempt"]);
|
|
326
326
|
}
|
|
327
327
|
return a(t, I), r(t);
|
|
328
328
|
}(),
|
|
329
329
|
Y = function (e) {
|
|
330
330
|
function t() {
|
|
331
|
-
return i(this, t), o(this, t, ["
|
|
331
|
+
return i(this, t), o(this, t, ["MissingPublicKeyError", "Failed to retrieve the public key. Add a new biometric registration."]);
|
|
332
332
|
}
|
|
333
333
|
return a(t, I), r(t);
|
|
334
334
|
}(),
|
|
335
335
|
J = function (e) {
|
|
336
336
|
function t() {
|
|
337
|
-
return i(this, t), o(this, t, ["
|
|
337
|
+
return i(this, t), o(this, t, ["ChallengeSigningFailedError", "Failed to sign the challenge with the key."]);
|
|
338
338
|
}
|
|
339
339
|
return a(t, I), r(t);
|
|
340
340
|
}(),
|
|
341
341
|
$ = function (e) {
|
|
342
342
|
function t() {
|
|
343
|
-
return i(this, t), o(this, t, ["
|
|
343
|
+
return i(this, t), o(this, t, ["SDKNotConfiguredError", "Stytch client is not confiured. You must call the configure method before using the SDK"]);
|
|
344
344
|
}
|
|
345
345
|
return a(t, I), r(t);
|
|
346
346
|
}(),
|
|
347
347
|
X = function (e) {
|
|
348
348
|
function t() {
|
|
349
|
-
return i(this, t), o(this, t, ["
|
|
349
|
+
return i(this, t), o(this, t, ["FailedCodeChallengeError", "Failed to create a code challenge"]);
|
|
350
350
|
}
|
|
351
351
|
return a(t, I), r(t);
|
|
352
352
|
}(),
|
|
353
353
|
Z = function (e) {
|
|
354
354
|
function t() {
|
|
355
|
-
return i(this, t), o(this, t, ["
|
|
355
|
+
return i(this, t), o(this, t, ["PasskeysUnsupportedError", "Passkeys are not supported on this device"]);
|
|
356
356
|
}
|
|
357
357
|
return a(t, I), r(t);
|
|
358
358
|
}(),
|
|
359
359
|
Q = function (e) {
|
|
360
360
|
function t() {
|
|
361
|
-
return i(this, t), o(this, t, ["
|
|
361
|
+
return i(this, t), o(this, t, ["FailedToDecryptDataError", "Failed to decrypt user data"]);
|
|
362
362
|
}
|
|
363
363
|
return a(t, I), r(t);
|
|
364
364
|
}(),
|
|
365
365
|
ee = function (e) {
|
|
366
366
|
function t() {
|
|
367
|
-
return i(this, t), o(this, t, ["
|
|
367
|
+
return i(this, t), o(this, t, ["BiometricsFailedError", "Biometric authentication failed"]);
|
|
368
368
|
}
|
|
369
369
|
return a(t, I), r(t);
|
|
370
370
|
}(),
|
|
371
371
|
te = function (e) {
|
|
372
372
|
function t() {
|
|
373
|
-
return i(this, t), o(this, t, ["
|
|
373
|
+
return i(this, t), o(this, t, ["InvalidStartUrlError", "The start URL was invalid or improperly formatted."]);
|
|
374
374
|
}
|
|
375
375
|
return a(t, I), r(t);
|
|
376
376
|
}(),
|
|
377
377
|
re = function (e) {
|
|
378
378
|
function t() {
|
|
379
|
-
return i(this, t), o(this, t, ["
|
|
379
|
+
return i(this, t), o(this, t, ["InvalidRedirectSchemeError", "The scheme from the given redirect urls was invalid. Possible reasons include: nil scheme, non-custom scheme (using http or https), or differing schemes for login/signup urls."]);
|
|
380
380
|
}
|
|
381
381
|
return a(t, I), r(t);
|
|
382
382
|
}(),
|
|
383
383
|
ne = function (e) {
|
|
384
384
|
function t() {
|
|
385
|
-
return i(this, t), o(this, t, ["
|
|
385
|
+
return i(this, t), o(this, t, ["MissingUrlError", "The underlying web authentication service failed to return a URL."]);
|
|
386
386
|
}
|
|
387
387
|
return a(t, I), r(t);
|
|
388
388
|
}(),
|
|
389
389
|
ie = function (e) {
|
|
390
390
|
function t() {
|
|
391
|
-
return i(this, t), o(this, t, ["
|
|
391
|
+
return i(this, t), o(this, t, ["InvalidCredentialTypeError", "The public key credential type was not of the expected type."]);
|
|
392
392
|
}
|
|
393
393
|
return a(t, I), r(t);
|
|
394
394
|
}(),
|
|
395
395
|
oe = function (e) {
|
|
396
396
|
function t() {
|
|
397
|
-
return i(this, t), o(this, t, ["
|
|
397
|
+
return i(this, t), o(this, t, ["MissingAttestationObjectError", "The public key credential is missing the attestation object."]);
|
|
398
398
|
}
|
|
399
399
|
return a(t, I), r(t);
|
|
400
400
|
}(),
|
|
401
401
|
se = function (e) {
|
|
402
402
|
function t() {
|
|
403
|
-
return i(this, t), o(this, t, ["
|
|
403
|
+
return i(this, t), o(this, t, ["JSONDataNotConvertibleToStringError", "JSON data unable to be converted to String type."]);
|
|
404
404
|
}
|
|
405
405
|
return a(t, I), r(t);
|
|
406
406
|
}(),
|
|
407
407
|
ae = function (e) {
|
|
408
408
|
function t() {
|
|
409
|
-
return i(this, t), o(this, t, ["
|
|
409
|
+
return i(this, t), o(this, t, ["RandomNumberGenerationFailed", "Random number generation failed"]);
|
|
410
410
|
}
|
|
411
411
|
return a(t, I), r(t);
|
|
412
412
|
}(),
|
|
413
413
|
ce = function (e) {
|
|
414
414
|
function t() {
|
|
415
|
-
return i(this, t), o(this, t, ["
|
|
415
|
+
return i(this, t), o(this, t, ["PasskeysInvalidEncoding", "Invalid passkey encoding"]);
|
|
416
416
|
}
|
|
417
417
|
return a(t, I), r(t);
|
|
418
418
|
}(),
|
|
419
419
|
ue = function (e) {
|
|
420
|
+
function t() {
|
|
421
|
+
return i(this, t), o(this, t, ["PasskeysMisconfigured", "Passkeys are misconfigured. Verify that you have added the correct associated domain for your application, and that the signing information is correct."]);
|
|
422
|
+
}
|
|
423
|
+
return a(t, I), r(t);
|
|
424
|
+
}(),
|
|
425
|
+
le = function (e) {
|
|
420
426
|
function t() {
|
|
421
427
|
return i(this, t), o(this, t, ["SignInWithAppleMisconfigured", "Sign In With Apple is misconfigured. Verify that you have correctly configured Apple OAuth in the Stytch Dashboard and added the Sign In With Apple capability to your project."]);
|
|
422
428
|
}
|
|
423
429
|
return a(t, I), r(t);
|
|
424
430
|
}();
|
|
425
|
-
function
|
|
431
|
+
function de(e) {
|
|
426
432
|
switch (e.message) {
|
|
427
433
|
case "internal_error":
|
|
428
434
|
return new F(e.message);
|
|
@@ -456,53 +462,55 @@ function le(e) {
|
|
|
456
462
|
case "invalid_authorization_credential":
|
|
457
463
|
return new G();
|
|
458
464
|
case "missing_public_key":
|
|
459
|
-
return new V();
|
|
460
|
-
case "challenge_signing_failed":
|
|
461
465
|
return new Y();
|
|
462
|
-
case "
|
|
466
|
+
case "challenge_signing_failed":
|
|
463
467
|
return new J();
|
|
464
|
-
case "
|
|
468
|
+
case "no_credentials_present":
|
|
469
|
+
return new V();
|
|
470
|
+
case "sdk_not_configured":
|
|
465
471
|
return new $();
|
|
466
|
-
case "
|
|
472
|
+
case "failed_code_challenge":
|
|
467
473
|
return new X();
|
|
468
|
-
case "
|
|
474
|
+
case "passkeys_unsupported":
|
|
469
475
|
return new Z();
|
|
470
|
-
case "
|
|
476
|
+
case "failed_to_decrypt_data":
|
|
471
477
|
return new Q();
|
|
472
|
-
case "
|
|
478
|
+
case "biometrics_failed":
|
|
473
479
|
return new ee();
|
|
474
|
-
case "
|
|
480
|
+
case "invalid_start_url":
|
|
475
481
|
return new te();
|
|
476
|
-
case "
|
|
482
|
+
case "invalid_redirect_scheme":
|
|
477
483
|
return new re();
|
|
478
|
-
case "
|
|
484
|
+
case "missing_url":
|
|
479
485
|
return new ne();
|
|
480
|
-
case "
|
|
486
|
+
case "invalid_credential_type":
|
|
481
487
|
return new ie();
|
|
482
|
-
case "
|
|
488
|
+
case "missing_attestation_object":
|
|
483
489
|
return new oe();
|
|
484
|
-
case "
|
|
490
|
+
case "json_data_not_convertible_to_string":
|
|
485
491
|
return new se();
|
|
486
|
-
case "
|
|
492
|
+
case "random_number_generation_failed":
|
|
487
493
|
return new ae();
|
|
488
|
-
case "
|
|
494
|
+
case "passkeys_invalid_encoding":
|
|
489
495
|
return new ce();
|
|
490
|
-
case "
|
|
496
|
+
case "passkeys_misconfigured":
|
|
491
497
|
return new ue();
|
|
498
|
+
case "signinwithapple_misconfigured":
|
|
499
|
+
return new le();
|
|
492
500
|
default:
|
|
493
501
|
return new I(e.name, e.message);
|
|
494
502
|
}
|
|
495
503
|
}
|
|
496
|
-
function
|
|
504
|
+
function he(e, t) {
|
|
497
505
|
var r = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
498
506
|
if (!r) {
|
|
499
507
|
if (Array.isArray(e) || (r = function (e, t) {
|
|
500
508
|
if (!e) return;
|
|
501
|
-
if ("string" == typeof e) return
|
|
509
|
+
if ("string" == typeof e) return pe(e, t);
|
|
502
510
|
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
503
511
|
"Object" === r && e.constructor && (r = e.constructor.name);
|
|
504
512
|
if ("Map" === r || "Set" === r) return Array.from(e);
|
|
505
|
-
if ("Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return
|
|
513
|
+
if ("Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return pe(e, t);
|
|
506
514
|
}(e)) || t && e && "number" == typeof e.length) {
|
|
507
515
|
r && (e = r);
|
|
508
516
|
var _n = 0,
|
|
@@ -548,21 +556,21 @@ function de(e, t) {
|
|
|
548
556
|
}
|
|
549
557
|
};
|
|
550
558
|
}
|
|
551
|
-
function
|
|
559
|
+
function pe(e, t) {
|
|
552
560
|
(null == t || t > e.length) && (t = e.length);
|
|
553
561
|
for (var r = 0, n = new Array(t); r < t; r++) n[r] = e[r];
|
|
554
562
|
return n;
|
|
555
563
|
}
|
|
556
|
-
function
|
|
557
|
-
return
|
|
564
|
+
function fe(e) {
|
|
565
|
+
return fe = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
|
|
558
566
|
return _typeof(e);
|
|
559
567
|
} : function (e) {
|
|
560
568
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
|
|
561
|
-
},
|
|
569
|
+
}, fe(e);
|
|
562
570
|
}
|
|
563
|
-
function
|
|
571
|
+
function _e() {
|
|
564
572
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
565
|
-
|
|
573
|
+
_e = function _e() {
|
|
566
574
|
return t;
|
|
567
575
|
};
|
|
568
576
|
var e,
|
|
@@ -642,7 +650,7 @@ function fe() {
|
|
|
642
650
|
if ("throw" !== c.type) {
|
|
643
651
|
var u = c.arg,
|
|
644
652
|
l = u.value;
|
|
645
|
-
return l && "object" ==
|
|
653
|
+
return l && "object" == fe(l) && n.call(l, "__await") ? t.resolve(l.__await).then(function (e) {
|
|
646
654
|
r("next", e, s, a);
|
|
647
655
|
}, function (e) {
|
|
648
656
|
r("throw", e, s, a);
|
|
@@ -741,7 +749,7 @@ function fe() {
|
|
|
741
749
|
return o.next = o;
|
|
742
750
|
}
|
|
743
751
|
}
|
|
744
|
-
throw new TypeError(
|
|
752
|
+
throw new TypeError(fe(t) + " is not iterable");
|
|
745
753
|
}
|
|
746
754
|
return b.prototype = g, i(S, "constructor", {
|
|
747
755
|
value: g,
|
|
@@ -862,46 +870,46 @@ function fe() {
|
|
|
862
870
|
}
|
|
863
871
|
}, t;
|
|
864
872
|
}
|
|
865
|
-
function
|
|
873
|
+
function me(e, t) {
|
|
866
874
|
for (var r = 0; r < t.length; r++) {
|
|
867
875
|
var n = t[r];
|
|
868
|
-
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e,
|
|
876
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, be(n.key), n);
|
|
869
877
|
}
|
|
870
878
|
}
|
|
871
|
-
function
|
|
872
|
-
return t &&
|
|
879
|
+
function ve(e, t, r) {
|
|
880
|
+
return t && me(e.prototype, t), r && me(e, r), Object.defineProperty(e, "prototype", {
|
|
873
881
|
writable: !1
|
|
874
882
|
}), e;
|
|
875
883
|
}
|
|
876
|
-
function
|
|
884
|
+
function be(e) {
|
|
877
885
|
var t = function (e, t) {
|
|
878
|
-
if ("object" !=
|
|
886
|
+
if ("object" != fe(e) || !e) return e;
|
|
879
887
|
var r = e[Symbol.toPrimitive];
|
|
880
888
|
if (void 0 !== r) {
|
|
881
889
|
var n = r.call(e, t || "default");
|
|
882
|
-
if ("object" !=
|
|
890
|
+
if ("object" != fe(n)) return n;
|
|
883
891
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
884
892
|
}
|
|
885
893
|
return ("string" === t ? String : Number)(e);
|
|
886
894
|
}(e, "string");
|
|
887
|
-
return "symbol" ==
|
|
895
|
+
return "symbol" == fe(t) ? t : String(t);
|
|
888
896
|
}
|
|
889
|
-
function
|
|
897
|
+
function ge(e, t) {
|
|
890
898
|
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
|
|
891
899
|
}
|
|
892
|
-
function
|
|
893
|
-
return t =
|
|
894
|
-
if (t && ("object" ===
|
|
900
|
+
function ke(e, t, r) {
|
|
901
|
+
return t = Ce(t), function (e, t) {
|
|
902
|
+
if (t && ("object" === fe(t) || "function" == typeof t)) return t;
|
|
895
903
|
if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
|
|
896
904
|
return function (e) {
|
|
897
905
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
898
906
|
return e;
|
|
899
907
|
}(e);
|
|
900
|
-
}(e,
|
|
908
|
+
}(e, we() ? Reflect.construct(t, r || [], Ce(e).constructor) : t.apply(e, r));
|
|
901
909
|
}
|
|
902
|
-
function
|
|
910
|
+
function ye(e) {
|
|
903
911
|
var t = "function" == typeof Map ? new Map() : void 0;
|
|
904
|
-
return
|
|
912
|
+
return ye = function ye(e) {
|
|
905
913
|
if (null === e || !function (e) {
|
|
906
914
|
try {
|
|
907
915
|
return -1 !== Function.toString.call(e).indexOf("[native code]");
|
|
@@ -916,12 +924,12 @@ function ke(e) {
|
|
|
916
924
|
}
|
|
917
925
|
function r() {
|
|
918
926
|
return function (e, t, r) {
|
|
919
|
-
if (
|
|
927
|
+
if (we()) return Reflect.construct.apply(null, arguments);
|
|
920
928
|
var n = [null];
|
|
921
929
|
n.push.apply(n, t);
|
|
922
930
|
var i = new (e.bind.apply(e, n))();
|
|
923
|
-
return r &&
|
|
924
|
-
}(e, arguments,
|
|
931
|
+
return r && Se(i, r.prototype), i;
|
|
932
|
+
}(e, arguments, Ce(this).constructor);
|
|
925
933
|
}
|
|
926
934
|
return r.prototype = Object.create(e.prototype, {
|
|
927
935
|
constructor: {
|
|
@@ -930,26 +938,26 @@ function ke(e) {
|
|
|
930
938
|
writable: !0,
|
|
931
939
|
configurable: !0
|
|
932
940
|
}
|
|
933
|
-
}),
|
|
934
|
-
},
|
|
941
|
+
}), Se(r, e);
|
|
942
|
+
}, ye(e);
|
|
935
943
|
}
|
|
936
|
-
function
|
|
944
|
+
function we() {
|
|
937
945
|
try {
|
|
938
946
|
var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
939
947
|
} catch (e) {}
|
|
940
|
-
return (
|
|
948
|
+
return (we = function we() {
|
|
941
949
|
return !!e;
|
|
942
950
|
})();
|
|
943
951
|
}
|
|
944
|
-
function
|
|
945
|
-
return
|
|
952
|
+
function Se(e, t) {
|
|
953
|
+
return Se = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) {
|
|
946
954
|
return e.__proto__ = t, e;
|
|
947
|
-
},
|
|
955
|
+
}, Se(e, t);
|
|
948
956
|
}
|
|
949
|
-
function
|
|
950
|
-
return
|
|
957
|
+
function Ce(e) {
|
|
958
|
+
return Ce = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) {
|
|
951
959
|
return e.__proto__ || Object.getPrototypeOf(e);
|
|
952
|
-
},
|
|
960
|
+
}, Ce(e);
|
|
953
961
|
}
|
|
954
962
|
!function (e) {
|
|
955
963
|
e.emailMagicLinks = "emailMagicLinks", e.sso = "sso", e.passwords = "passwords", e.oauth = "oauth";
|
|
@@ -960,8 +968,8 @@ function Se(e) {
|
|
|
960
968
|
}(y || (y = {})), function (e) {
|
|
961
969
|
e.Google = "google", e.Microsoft = "microsoft";
|
|
962
970
|
}(w || (w = {}));
|
|
963
|
-
var
|
|
964
|
-
function
|
|
971
|
+
var Pe;
|
|
972
|
+
function Te(e, t, r, n) {
|
|
965
973
|
return new (r || (r = Promise))(function (i, o) {
|
|
966
974
|
function s(e) {
|
|
967
975
|
try {
|
|
@@ -988,12 +996,12 @@ function Pe(e, t, r, n) {
|
|
|
988
996
|
}
|
|
989
997
|
"function" == typeof SuppressedError && SuppressedError, function (e) {
|
|
990
998
|
e.RequiredCatcha = "Catcha Required";
|
|
991
|
-
}(
|
|
992
|
-
var
|
|
993
|
-
|
|
999
|
+
}(Pe || (Pe = {}));
|
|
1000
|
+
var Oe,
|
|
1001
|
+
xe = function (e) {
|
|
994
1002
|
function t(e) {
|
|
995
1003
|
var r;
|
|
996
|
-
return
|
|
1004
|
+
return ge(this, t), (r = ke(this, t, [e])).type = e, r;
|
|
997
1005
|
}
|
|
998
1006
|
return function (e, t) {
|
|
999
1007
|
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
|
|
@@ -1005,10 +1013,10 @@ var Te,
|
|
|
1005
1013
|
}
|
|
1006
1014
|
}), Object.defineProperty(e, "prototype", {
|
|
1007
1015
|
writable: !1
|
|
1008
|
-
}), t &&
|
|
1009
|
-
}(t,
|
|
1016
|
+
}), t && Se(e, t);
|
|
1017
|
+
}(t, ye(Error)), ve(t);
|
|
1010
1018
|
}();
|
|
1011
|
-
function
|
|
1019
|
+
function Ae(e) {
|
|
1012
1020
|
var t,
|
|
1013
1021
|
r = e.method,
|
|
1014
1022
|
n = e.finalURL,
|
|
@@ -1016,9 +1024,9 @@ function xe(e) {
|
|
|
1016
1024
|
o = e.xSDKClientHeader,
|
|
1017
1025
|
s = e.xSDKParentHostHeader,
|
|
1018
1026
|
a = e.body;
|
|
1019
|
-
return
|
|
1027
|
+
return Te(this, void 0, void 0, _e().mark(function e() {
|
|
1020
1028
|
var c, u, l, d, h, p;
|
|
1021
|
-
return
|
|
1029
|
+
return _e().wrap(function (e) {
|
|
1022
1030
|
for (;;) switch (e.prev = e.next) {
|
|
1023
1031
|
case 0:
|
|
1024
1032
|
return c = {
|
|
@@ -1082,7 +1090,7 @@ function xe(e) {
|
|
|
1082
1090
|
e.next = 49;
|
|
1083
1091
|
break;
|
|
1084
1092
|
}
|
|
1085
|
-
throw new
|
|
1093
|
+
throw new xe(Pe.RequiredCatcha);
|
|
1086
1094
|
case 49:
|
|
1087
1095
|
throw new A("Invalid response from the Stytch servers.");
|
|
1088
1096
|
case 50:
|
|
@@ -1092,43 +1100,43 @@ function xe(e) {
|
|
|
1092
1100
|
}, e, null, [[3, 9], [15, 22], [26, 32], [38, 44]]);
|
|
1093
1101
|
}));
|
|
1094
1102
|
}
|
|
1095
|
-
var
|
|
1096
|
-
function
|
|
1097
|
-
if (!
|
|
1098
|
-
return
|
|
1103
|
+
var Ee = new Uint8Array(16);
|
|
1104
|
+
function De() {
|
|
1105
|
+
if (!Oe && !(Oe = "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");
|
|
1106
|
+
return Oe(Ee);
|
|
1099
1107
|
}
|
|
1100
|
-
var
|
|
1101
|
-
for (var
|
|
1102
|
-
function
|
|
1108
|
+
var Ie = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
1109
|
+
for (var Re = [], Fe = 0; Fe < 256; ++Fe) Re.push((Fe + 256).toString(16).substr(1));
|
|
1110
|
+
function je(e) {
|
|
1103
1111
|
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
|
|
1104
|
-
r = (
|
|
1112
|
+
r = (Re[e[t + 0]] + Re[e[t + 1]] + Re[e[t + 2]] + Re[e[t + 3]] + "-" + Re[e[t + 4]] + Re[e[t + 5]] + "-" + Re[e[t + 6]] + Re[e[t + 7]] + "-" + Re[e[t + 8]] + Re[e[t + 9]] + "-" + Re[e[t + 10]] + Re[e[t + 11]] + Re[e[t + 12]] + Re[e[t + 13]] + Re[e[t + 14]] + Re[e[t + 15]]).toLowerCase();
|
|
1105
1113
|
if (!function (e) {
|
|
1106
|
-
return "string" == typeof e &&
|
|
1114
|
+
return "string" == typeof e && Ie.test(e);
|
|
1107
1115
|
}(r)) throw TypeError("Stringified UUID is invalid");
|
|
1108
1116
|
return r;
|
|
1109
1117
|
}
|
|
1110
|
-
function
|
|
1111
|
-
var n = (e = e || {}).random || (e.rng ||
|
|
1118
|
+
function Le(e, t, r) {
|
|
1119
|
+
var n = (e = e || {}).random || (e.rng || De)();
|
|
1112
1120
|
if (n[6] = 15 & n[6] | 64, n[8] = 63 & n[8] | 128, t) {
|
|
1113
1121
|
r = r || 0;
|
|
1114
1122
|
for (var i = 0; i < 16; ++i) t[r + i] = n[i];
|
|
1115
1123
|
return t;
|
|
1116
1124
|
}
|
|
1117
|
-
return
|
|
1125
|
+
return je(n);
|
|
1118
1126
|
}
|
|
1119
|
-
var
|
|
1120
|
-
function
|
|
1121
|
-
return
|
|
1122
|
-
return
|
|
1127
|
+
var Me = {};
|
|
1128
|
+
function Be(e, t) {
|
|
1129
|
+
return Te(this, void 0, void 0, _e().mark(function r() {
|
|
1130
|
+
return _e().wrap(function (r) {
|
|
1123
1131
|
for (;;) switch (r.prev = r.next) {
|
|
1124
1132
|
case 0:
|
|
1125
|
-
if (void 0 ===
|
|
1133
|
+
if (void 0 === Me[e]) {
|
|
1126
1134
|
r.next = 2;
|
|
1127
1135
|
break;
|
|
1128
1136
|
}
|
|
1129
|
-
return r.abrupt("return",
|
|
1137
|
+
return r.abrupt("return", Me[e]);
|
|
1130
1138
|
case 2:
|
|
1131
|
-
return
|
|
1139
|
+
return Me[e] = Ke(e, t), r.abrupt("return", Me[e]);
|
|
1132
1140
|
case 4:
|
|
1133
1141
|
case "end":
|
|
1134
1142
|
return r.stop();
|
|
@@ -1136,10 +1144,10 @@ function Me(e, t) {
|
|
|
1136
1144
|
}, r);
|
|
1137
1145
|
}));
|
|
1138
1146
|
}
|
|
1139
|
-
function
|
|
1147
|
+
function Ke(e, t) {
|
|
1140
1148
|
return new Promise(function (r, n) {
|
|
1141
1149
|
var i = function (e) {
|
|
1142
|
-
var t =
|
|
1150
|
+
var t = ze(e);
|
|
1143
1151
|
if (t[0]) return t[0];
|
|
1144
1152
|
}(e);
|
|
1145
1153
|
if (i && "true" === i.dataset.loaded) try {
|
|
@@ -1163,27 +1171,27 @@ function Be(e, t) {
|
|
|
1163
1171
|
});
|
|
1164
1172
|
});
|
|
1165
1173
|
}
|
|
1166
|
-
var
|
|
1174
|
+
var ze = function ze(e) {
|
|
1167
1175
|
return document.querySelectorAll('script[src="'.concat(e, '"]'));
|
|
1168
1176
|
};
|
|
1169
|
-
var
|
|
1170
|
-
|
|
1171
|
-
|
|
1177
|
+
var Ne,
|
|
1178
|
+
Ue = ["[Stytch]"],
|
|
1179
|
+
qe = function qe() {
|
|
1172
1180
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
1173
|
-
return (e = console).warn.apply(e,
|
|
1181
|
+
return (e = console).warn.apply(e, Ue.concat(r));
|
|
1174
1182
|
},
|
|
1175
|
-
|
|
1183
|
+
We = function We() {
|
|
1176
1184
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
1177
|
-
return (e = console).error.apply(e,
|
|
1185
|
+
return (e = console).error.apply(e, Ue.concat(r));
|
|
1178
1186
|
},
|
|
1179
|
-
|
|
1180
|
-
|
|
1187
|
+
He = "\nYou can find your public token at https://stytch.com/dashboard/api-keys.",
|
|
1188
|
+
Ge = function Ge(e) {
|
|
1181
1189
|
return e.includes("public-token-test");
|
|
1182
1190
|
},
|
|
1183
|
-
|
|
1191
|
+
Ve = function Ve(e) {
|
|
1184
1192
|
var t = {
|
|
1185
1193
|
isObject: function isObject(r, n) {
|
|
1186
|
-
var i = "object" ===
|
|
1194
|
+
var i = "object" === fe(n) && !Array.isArray(n) && null !== n;
|
|
1187
1195
|
if (!i) throw new C(e, r + " must be an object.");
|
|
1188
1196
|
return t;
|
|
1189
1197
|
},
|
|
@@ -1200,7 +1208,7 @@ var ze,
|
|
|
1200
1208
|
isStringArray: function isStringArray(r, n) {
|
|
1201
1209
|
if (!Array.isArray(n)) throw new C(e, r + " must be an array of strings.");
|
|
1202
1210
|
var i,
|
|
1203
|
-
o =
|
|
1211
|
+
o = he(n);
|
|
1204
1212
|
try {
|
|
1205
1213
|
for (o.s(); !(i = o.n()).done;) {
|
|
1206
1214
|
if ("string" != typeof i.value) throw new C(e, r + " must be an array of strings.");
|
|
@@ -1232,14 +1240,14 @@ var ze,
|
|
|
1232
1240
|
};
|
|
1233
1241
|
return t;
|
|
1234
1242
|
},
|
|
1235
|
-
|
|
1243
|
+
Ye = ve(function e(t, r, n) {
|
|
1236
1244
|
var i = this,
|
|
1237
1245
|
o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : function () {
|
|
1238
1246
|
return Promise.resolve(void 0);
|
|
1239
1247
|
};
|
|
1240
|
-
|
|
1241
|
-
return
|
|
1242
|
-
return
|
|
1248
|
+
ge(this, e), this.bootstrapPromise = n, this.isEnabled = function () {
|
|
1249
|
+
return Te(i, void 0, void 0, _e().mark(function e() {
|
|
1250
|
+
return _e().wrap(function (e) {
|
|
1243
1251
|
for (;;) switch (e.prev = e.next) {
|
|
1244
1252
|
case 0:
|
|
1245
1253
|
return e.abrupt("return", this.state.then(function (e) {
|
|
@@ -1252,9 +1260,9 @@ var ze,
|
|
|
1252
1260
|
}, e, this);
|
|
1253
1261
|
}));
|
|
1254
1262
|
}, this.getTelemetryID = function () {
|
|
1255
|
-
return
|
|
1263
|
+
return Te(i, void 0, void 0, _e().mark(function e() {
|
|
1256
1264
|
var t, r, n, i;
|
|
1257
|
-
return
|
|
1265
|
+
return _e().wrap(function (e) {
|
|
1258
1266
|
for (;;) switch (e.prev = e.next) {
|
|
1259
1267
|
case 0:
|
|
1260
1268
|
return e.next = 2, this.state;
|
|
@@ -1275,9 +1283,9 @@ var ze,
|
|
|
1275
1283
|
}, e, this);
|
|
1276
1284
|
}));
|
|
1277
1285
|
}, this.getDFPTelemetryIDAndCaptcha = function () {
|
|
1278
|
-
return
|
|
1286
|
+
return Te(i, void 0, void 0, _e().mark(function e() {
|
|
1279
1287
|
var t, r, n, i, o, s;
|
|
1280
|
-
return
|
|
1288
|
+
return _e().wrap(function (e) {
|
|
1281
1289
|
for (;;) switch (e.prev = e.next) {
|
|
1282
1290
|
case 0:
|
|
1283
1291
|
return e.next = 2, this.state;
|
|
@@ -1320,14 +1328,14 @@ var ze,
|
|
|
1320
1328
|
}, e, this);
|
|
1321
1329
|
}));
|
|
1322
1330
|
}, this.retryWithCaptchaAndDFP = function (e, t) {
|
|
1323
|
-
return
|
|
1331
|
+
return Te(i, void 0, void 0, _e().mark(function r() {
|
|
1324
1332
|
var n, i, o;
|
|
1325
|
-
return
|
|
1333
|
+
return _e().wrap(function (r) {
|
|
1326
1334
|
for (;;) switch (r.prev = r.next) {
|
|
1327
1335
|
case 0:
|
|
1328
1336
|
return r.next = 2, this.state;
|
|
1329
1337
|
case 2:
|
|
1330
|
-
if (n = r.sent, i = n.enabled, o = n.executeRecaptcha, e.type !==
|
|
1338
|
+
if (n = r.sent, i = n.enabled, o = n.executeRecaptcha, e.type !== Pe.RequiredCatcha || !i) {
|
|
1331
1339
|
r.next = 14;
|
|
1332
1340
|
break;
|
|
1333
1341
|
}
|
|
@@ -1351,8 +1359,8 @@ var ze,
|
|
|
1351
1359
|
}, r, this);
|
|
1352
1360
|
}));
|
|
1353
1361
|
}, this.state = n.then(function (e) {
|
|
1354
|
-
return
|
|
1355
|
-
return
|
|
1362
|
+
return Te(i, void 0, void 0, _e().mark(function n() {
|
|
1363
|
+
return _e().wrap(function (n) {
|
|
1356
1364
|
for (;;) switch (n.prev = n.next) {
|
|
1357
1365
|
case 0:
|
|
1358
1366
|
if (e.runDFPProtectedAuth) {
|
|
@@ -1367,7 +1375,7 @@ var ze,
|
|
|
1367
1375
|
executeRecaptcha: o
|
|
1368
1376
|
});
|
|
1369
1377
|
case 2:
|
|
1370
|
-
return n.next = 4,
|
|
1378
|
+
return n.next = 4, Be("".concat("https://elements.stytch.com", "/telemetry.js"), function () {
|
|
1371
1379
|
return window.GetTelemetryID;
|
|
1372
1380
|
});
|
|
1373
1381
|
case 4:
|
|
@@ -1387,11 +1395,11 @@ var ze,
|
|
|
1387
1395
|
}));
|
|
1388
1396
|
});
|
|
1389
1397
|
}),
|
|
1390
|
-
|
|
1398
|
+
Je = function Je() {
|
|
1391
1399
|
return {
|
|
1392
1400
|
isEnabled: function isEnabled() {
|
|
1393
|
-
return
|
|
1394
|
-
return
|
|
1401
|
+
return Te(void 0, void 0, void 0, _e().mark(function e() {
|
|
1402
|
+
return _e().wrap(function (e) {
|
|
1395
1403
|
for (;;) switch (e.prev = e.next) {
|
|
1396
1404
|
case 0:
|
|
1397
1405
|
return e.abrupt("return", !1);
|
|
@@ -1403,8 +1411,8 @@ var ze,
|
|
|
1403
1411
|
}));
|
|
1404
1412
|
},
|
|
1405
1413
|
getTelemetryID: function getTelemetryID() {
|
|
1406
|
-
return
|
|
1407
|
-
return
|
|
1414
|
+
return Te(void 0, void 0, void 0, _e().mark(function e() {
|
|
1415
|
+
return _e().wrap(function (e) {
|
|
1408
1416
|
for (;;) switch (e.prev = e.next) {
|
|
1409
1417
|
case 0:
|
|
1410
1418
|
return e.abrupt("return", void 0);
|
|
@@ -1416,8 +1424,8 @@ var ze,
|
|
|
1416
1424
|
}));
|
|
1417
1425
|
},
|
|
1418
1426
|
getDFPTelemetryIDAndCaptcha: function getDFPTelemetryIDAndCaptcha() {
|
|
1419
|
-
return
|
|
1420
|
-
return
|
|
1427
|
+
return Te(void 0, void 0, void 0, _e().mark(function e() {
|
|
1428
|
+
return _e().wrap(function (e) {
|
|
1421
1429
|
for (;;) switch (e.prev = e.next) {
|
|
1422
1430
|
case 0:
|
|
1423
1431
|
return e.abrupt("return", {
|
|
@@ -1432,8 +1440,8 @@ var ze,
|
|
|
1432
1440
|
}));
|
|
1433
1441
|
},
|
|
1434
1442
|
retryWithCaptchaAndDFP: function retryWithCaptchaAndDFP() {
|
|
1435
|
-
return
|
|
1436
|
-
return
|
|
1443
|
+
return Te(void 0, void 0, void 0, _e().mark(function e() {
|
|
1444
|
+
return _e().wrap(function (e) {
|
|
1437
1445
|
for (;;) switch (e.prev = e.next) {
|
|
1438
1446
|
case 0:
|
|
1439
1447
|
throw new Error("DFP protected auth is disabled");
|
|
@@ -1446,11 +1454,11 @@ var ze,
|
|
|
1446
1454
|
}
|
|
1447
1455
|
};
|
|
1448
1456
|
},
|
|
1449
|
-
|
|
1457
|
+
$e = function () {
|
|
1450
1458
|
function e() {
|
|
1451
|
-
|
|
1459
|
+
ge(this, e);
|
|
1452
1460
|
}
|
|
1453
|
-
return
|
|
1461
|
+
return ve(e, null, [{
|
|
1454
1462
|
key: "marshall",
|
|
1455
1463
|
value: function value(e) {
|
|
1456
1464
|
return Object.assign(Object.assign({}, e), {
|
|
@@ -1498,11 +1506,11 @@ var ze,
|
|
|
1498
1506
|
}
|
|
1499
1507
|
}]), e;
|
|
1500
1508
|
}(),
|
|
1501
|
-
|
|
1509
|
+
Xe = function () {
|
|
1502
1510
|
function e(t) {
|
|
1503
|
-
|
|
1511
|
+
ge(this, e), this.maxBatchSize = t.maxBatchSize, this.logEventURL = t.logEventURL, setInterval(this.flush.bind(this), t.intervalDurationMs), this.batch = [];
|
|
1504
1512
|
}
|
|
1505
|
-
return
|
|
1513
|
+
return ve(e, [{
|
|
1506
1514
|
key: "logEvent",
|
|
1507
1515
|
value: function value(e, t) {
|
|
1508
1516
|
this.batch.push({
|
|
@@ -1513,9 +1521,9 @@ var ze,
|
|
|
1513
1521
|
}, {
|
|
1514
1522
|
key: "flush",
|
|
1515
1523
|
value: function value() {
|
|
1516
|
-
return
|
|
1524
|
+
return Te(this, void 0, void 0, _e().mark(function e() {
|
|
1517
1525
|
var t;
|
|
1518
|
-
return
|
|
1526
|
+
return _e().wrap(function (e) {
|
|
1519
1527
|
for (;;) switch (e.prev = e.next) {
|
|
1520
1528
|
case 0:
|
|
1521
1529
|
if (this.batch.length) {
|
|
@@ -1547,26 +1555,26 @@ var ze,
|
|
|
1547
1555
|
}();
|
|
1548
1556
|
!function (e) {
|
|
1549
1557
|
e.LoginOrCreateEML = "login_or_create_eml", e.LoginOrCreateOTP = "login_or_create_otp", e.ResetPassword = "reset_password";
|
|
1550
|
-
}(
|
|
1558
|
+
}(Ne || (Ne = {})), Promise.resolve({
|
|
1551
1559
|
pkceRequiredForEmailMagicLinks: !1
|
|
1552
1560
|
}), Promise.resolve({
|
|
1553
1561
|
pkceRequiredForPasswordResets: !1
|
|
1554
1562
|
});
|
|
1555
|
-
var
|
|
1563
|
+
var Ze = Promise.resolve({
|
|
1556
1564
|
pkceRequiredForEmailMagicLinks: !1
|
|
1557
1565
|
}),
|
|
1558
|
-
|
|
1566
|
+
Qe = function () {
|
|
1559
1567
|
function e(t, r, n, i) {
|
|
1560
1568
|
var o = this,
|
|
1561
|
-
s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] :
|
|
1562
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
1563
|
-
|
|
1569
|
+
s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : Ze,
|
|
1570
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : Je();
|
|
1571
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._passwordResetPKCEManager = i, this._config = s, this.dfpProtectedAuth = a, this.email = {
|
|
1564
1572
|
invite: function invite(e) {
|
|
1565
|
-
return
|
|
1566
|
-
return
|
|
1573
|
+
return Te(o, void 0, void 0, _e().mark(function t() {
|
|
1574
|
+
return _e().wrap(function (t) {
|
|
1567
1575
|
for (;;) switch (t.prev = t.next) {
|
|
1568
1576
|
case 0:
|
|
1569
|
-
return
|
|
1577
|
+
return Ve("stytch.magicLinks.email.loginOrSignup").isString("email_address", e.email_address).isOptionalString("invite_redirect_url", e.invite_redirect_url).isOptionalString("invite_template_id", e.invite_template_id).isOptionalString("name", e.name).isOptionalString("locale", e.locale).isOptionalStringArray("roles", e.roles), t.abrupt("return", this._networkClient.fetchSDK({
|
|
1570
1578
|
url: "/b2b/magic_links/email/invite",
|
|
1571
1579
|
body: e,
|
|
1572
1580
|
errorMessage: "Failed to send invite.",
|
|
@@ -1580,12 +1588,12 @@ var Xe = Promise.resolve({
|
|
|
1580
1588
|
}));
|
|
1581
1589
|
},
|
|
1582
1590
|
loginOrSignup: function loginOrSignup(e) {
|
|
1583
|
-
return
|
|
1591
|
+
return Te(o, void 0, void 0, _e().mark(function t() {
|
|
1584
1592
|
var r, n;
|
|
1585
|
-
return
|
|
1593
|
+
return _e().wrap(function (t) {
|
|
1586
1594
|
for (;;) switch (t.prev = t.next) {
|
|
1587
1595
|
case 0:
|
|
1588
|
-
return
|
|
1596
|
+
return Ve("stytch.magicLinks.email.loginOrSignup").isString("email_address", e.email_address).isString("organization_id", e.organization_id).isOptionalString("login_redirect_url", e.login_redirect_url).isOptionalString("login_template_id", e.login_template_id).isOptionalString("signup_redirect_url", e.signup_redirect_url).isOptionalString("signup_template_id", e.signup_template_id).isOptionalString("locale", e.locale), t.next = 3, this.getCodeChallenge();
|
|
1589
1597
|
case 3:
|
|
1590
1598
|
return r = t.sent, n = Object.assign(Object.assign({}, e), {
|
|
1591
1599
|
pkce_code_challenge: r
|
|
@@ -1604,12 +1612,12 @@ var Xe = Promise.resolve({
|
|
|
1604
1612
|
},
|
|
1605
1613
|
discovery: {
|
|
1606
1614
|
send: function send(e) {
|
|
1607
|
-
return
|
|
1615
|
+
return Te(o, void 0, void 0, _e().mark(function t() {
|
|
1608
1616
|
var r, n;
|
|
1609
|
-
return
|
|
1617
|
+
return _e().wrap(function (t) {
|
|
1610
1618
|
for (;;) switch (t.prev = t.next) {
|
|
1611
1619
|
case 0:
|
|
1612
|
-
return
|
|
1620
|
+
return Ve("stytch.magicLinks.email.discovery.send").isString("email_address", e.email_address).isOptionalString("discovery_redirect_url", e.discovery_redirect_url).isOptionalString("login_template_id", e.login_template_id).isOptionalString("locale", e.locale), t.next = 3, this.getCodeChallenge();
|
|
1613
1621
|
case 3:
|
|
1614
1622
|
return r = t.sent, n = Object.assign(Object.assign({}, e), {
|
|
1615
1623
|
pkce_code_challenge: r
|
|
@@ -1628,12 +1636,12 @@ var Xe = Promise.resolve({
|
|
|
1628
1636
|
}
|
|
1629
1637
|
}
|
|
1630
1638
|
}, this.authenticate = function (e) {
|
|
1631
|
-
return
|
|
1639
|
+
return Te(o, void 0, void 0, _e().mark(function t() {
|
|
1632
1640
|
var r, n;
|
|
1633
|
-
return
|
|
1641
|
+
return _e().wrap(function (t) {
|
|
1634
1642
|
for (;;) switch (t.prev = t.next) {
|
|
1635
1643
|
case 0:
|
|
1636
|
-
return
|
|
1644
|
+
return Ve("stytch.magicLinks.authenticate").isString("magic_links_token", e.magic_links_token).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._passwordResetPKCEManager.getPKPair();
|
|
1637
1645
|
case 3:
|
|
1638
1646
|
if (r = t.sent, n = null, !(null == r ? void 0 : r.code_verifier)) {
|
|
1639
1647
|
t.next = 19;
|
|
@@ -1684,12 +1692,12 @@ var Xe = Promise.resolve({
|
|
|
1684
1692
|
}));
|
|
1685
1693
|
}, this.discovery = {
|
|
1686
1694
|
authenticate: function authenticate(e) {
|
|
1687
|
-
return
|
|
1695
|
+
return Te(o, void 0, void 0, _e().mark(function t() {
|
|
1688
1696
|
var r, n, i, o, s, a;
|
|
1689
|
-
return
|
|
1697
|
+
return _e().wrap(function (t) {
|
|
1690
1698
|
for (;;) switch (t.prev = t.next) {
|
|
1691
1699
|
case 0:
|
|
1692
|
-
return
|
|
1700
|
+
return Ve("stytch.magicLinks.discovery.authenticate").isString("discovery_magic_links_token", e.discovery_magic_links_token), t.next = 3, this._pkceManager.getPKPair();
|
|
1693
1701
|
case 3:
|
|
1694
1702
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
1695
1703
|
case 6:
|
|
@@ -1720,12 +1728,12 @@ var Xe = Promise.resolve({
|
|
|
1720
1728
|
}
|
|
1721
1729
|
};
|
|
1722
1730
|
}
|
|
1723
|
-
return
|
|
1731
|
+
return ve(e, [{
|
|
1724
1732
|
key: "getCodeChallenge",
|
|
1725
1733
|
value: function value() {
|
|
1726
|
-
return
|
|
1734
|
+
return Te(this, void 0, void 0, _e().mark(function e() {
|
|
1727
1735
|
var t, r;
|
|
1728
|
-
return
|
|
1736
|
+
return _e().wrap(function (e) {
|
|
1729
1737
|
for (;;) switch (e.prev = e.next) {
|
|
1730
1738
|
case 0:
|
|
1731
1739
|
return e.next = 2, this._config;
|
|
@@ -1757,9 +1765,9 @@ var Xe = Promise.resolve({
|
|
|
1757
1765
|
}, {
|
|
1758
1766
|
key: "handlePKCEForAuthenticate",
|
|
1759
1767
|
value: function value(e, t) {
|
|
1760
|
-
return
|
|
1768
|
+
return Te(this, void 0, void 0, _e().mark(function r() {
|
|
1761
1769
|
var n, i, o, s, a, c;
|
|
1762
|
-
return
|
|
1770
|
+
return _e().wrap(function (r) {
|
|
1763
1771
|
for (;;) switch (r.prev = r.next) {
|
|
1764
1772
|
case 0:
|
|
1765
1773
|
return r.next = 2, e.getPKPair();
|
|
@@ -1797,12 +1805,12 @@ var Xe = Promise.resolve({
|
|
|
1797
1805
|
}
|
|
1798
1806
|
}]), e;
|
|
1799
1807
|
}(),
|
|
1800
|
-
|
|
1808
|
+
et = ve(function e(t, r) {
|
|
1801
1809
|
var n = this;
|
|
1802
|
-
|
|
1803
|
-
return
|
|
1810
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
|
|
1811
|
+
return Te(n, void 0, void 0, _e().mark(function e() {
|
|
1804
1812
|
var t;
|
|
1805
|
-
return
|
|
1813
|
+
return _e().wrap(function (e) {
|
|
1806
1814
|
for (;;) switch (e.prev = e.next) {
|
|
1807
1815
|
case 0:
|
|
1808
1816
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1831,12 +1839,12 @@ var Xe = Promise.resolve({
|
|
|
1831
1839
|
return e(null !== (r = null == t ? void 0 : t.member) && void 0 !== r ? r : null);
|
|
1832
1840
|
});
|
|
1833
1841
|
}, this.update = function (e) {
|
|
1834
|
-
return
|
|
1842
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
1835
1843
|
var r;
|
|
1836
|
-
return
|
|
1844
|
+
return _e().wrap(function (t) {
|
|
1837
1845
|
for (;;) switch (t.prev = t.next) {
|
|
1838
1846
|
case 0:
|
|
1839
|
-
return
|
|
1847
|
+
return Ve("stytch.self.update").isOptionalString("name", e.name).isOptionalObject("untrusted_metadata", e.untrusted_metadata).isOptionalBoolean("mfa_enrolled", e.mfa_enrolled).isOptionalString("mfa_phone_number", e.mfa_phone_number).isOptionalString("default_mfa_method", e.default_mfa_method), t.next = 3, this._networkClient.fetchSDK({
|
|
1840
1848
|
url: "/b2b/organizations/members/update",
|
|
1841
1849
|
body: e,
|
|
1842
1850
|
errorMessage: "Failed to update member.",
|
|
@@ -1851,9 +1859,9 @@ var Xe = Promise.resolve({
|
|
|
1851
1859
|
}, t, this);
|
|
1852
1860
|
}));
|
|
1853
1861
|
}, this.deleteMFAPhoneNumber = function () {
|
|
1854
|
-
return
|
|
1862
|
+
return Te(n, void 0, void 0, _e().mark(function e() {
|
|
1855
1863
|
var t;
|
|
1856
|
-
return
|
|
1864
|
+
return _e().wrap(function (e) {
|
|
1857
1865
|
for (;;) switch (e.prev = e.next) {
|
|
1858
1866
|
case 0:
|
|
1859
1867
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1870,9 +1878,9 @@ var Xe = Promise.resolve({
|
|
|
1870
1878
|
}, e, this);
|
|
1871
1879
|
}));
|
|
1872
1880
|
}, this.deleteMFATOTP = function () {
|
|
1873
|
-
return
|
|
1881
|
+
return Te(n, void 0, void 0, _e().mark(function e() {
|
|
1874
1882
|
var t;
|
|
1875
|
-
return
|
|
1883
|
+
return _e().wrap(function (e) {
|
|
1876
1884
|
for (;;) switch (e.prev = e.next) {
|
|
1877
1885
|
case 0:
|
|
1878
1886
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1889,9 +1897,9 @@ var Xe = Promise.resolve({
|
|
|
1889
1897
|
}, e, this);
|
|
1890
1898
|
}));
|
|
1891
1899
|
}, this.deletePassword = function (e) {
|
|
1892
|
-
return
|
|
1900
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
1893
1901
|
var r;
|
|
1894
|
-
return
|
|
1902
|
+
return _e().wrap(function (t) {
|
|
1895
1903
|
for (;;) switch (t.prev = t.next) {
|
|
1896
1904
|
case 0:
|
|
1897
1905
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1909,14 +1917,14 @@ var Xe = Promise.resolve({
|
|
|
1909
1917
|
}));
|
|
1910
1918
|
};
|
|
1911
1919
|
}),
|
|
1912
|
-
|
|
1920
|
+
tt = function () {
|
|
1913
1921
|
function e(t, r, n, i, o) {
|
|
1914
1922
|
var s = this,
|
|
1915
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
1916
|
-
|
|
1923
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : Je();
|
|
1924
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = o, this.dfpProtectedAuth = a, this.saml = {
|
|
1917
1925
|
createConnection: function createConnection(e) {
|
|
1918
|
-
return
|
|
1919
|
-
return
|
|
1926
|
+
return Te(s, void 0, void 0, _e().mark(function t() {
|
|
1927
|
+
return _e().wrap(function (t) {
|
|
1920
1928
|
for (;;) switch (t.prev = t.next) {
|
|
1921
1929
|
case 0:
|
|
1922
1930
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1935,8 +1943,8 @@ var Xe = Promise.resolve({
|
|
|
1935
1943
|
}));
|
|
1936
1944
|
},
|
|
1937
1945
|
updateConnection: function updateConnection(e) {
|
|
1938
|
-
return
|
|
1939
|
-
return
|
|
1946
|
+
return Te(s, void 0, void 0, _e().mark(function t() {
|
|
1947
|
+
return _e().wrap(function (t) {
|
|
1940
1948
|
for (;;) switch (t.prev = t.next) {
|
|
1941
1949
|
case 0:
|
|
1942
1950
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1955,8 +1963,8 @@ var Xe = Promise.resolve({
|
|
|
1955
1963
|
}));
|
|
1956
1964
|
},
|
|
1957
1965
|
updateConnectionByURL: function updateConnectionByURL(e) {
|
|
1958
|
-
return
|
|
1959
|
-
return
|
|
1966
|
+
return Te(s, void 0, void 0, _e().mark(function t() {
|
|
1967
|
+
return _e().wrap(function (t) {
|
|
1960
1968
|
for (;;) switch (t.prev = t.next) {
|
|
1961
1969
|
case 0:
|
|
1962
1970
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1975,8 +1983,8 @@ var Xe = Promise.resolve({
|
|
|
1975
1983
|
}));
|
|
1976
1984
|
},
|
|
1977
1985
|
deleteVerificationCertificate: function deleteVerificationCertificate(e) {
|
|
1978
|
-
return
|
|
1979
|
-
return
|
|
1986
|
+
return Te(s, void 0, void 0, _e().mark(function t() {
|
|
1987
|
+
return _e().wrap(function (t) {
|
|
1980
1988
|
for (;;) switch (t.prev = t.next) {
|
|
1981
1989
|
case 0:
|
|
1982
1990
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1995,8 +2003,8 @@ var Xe = Promise.resolve({
|
|
|
1995
2003
|
}
|
|
1996
2004
|
}, this.oidc = {
|
|
1997
2005
|
createConnection: function createConnection(e) {
|
|
1998
|
-
return
|
|
1999
|
-
return
|
|
2006
|
+
return Te(s, void 0, void 0, _e().mark(function t() {
|
|
2007
|
+
return _e().wrap(function (t) {
|
|
2000
2008
|
for (;;) switch (t.prev = t.next) {
|
|
2001
2009
|
case 0:
|
|
2002
2010
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2015,8 +2023,8 @@ var Xe = Promise.resolve({
|
|
|
2015
2023
|
}));
|
|
2016
2024
|
},
|
|
2017
2025
|
updateConnection: function updateConnection(e) {
|
|
2018
|
-
return
|
|
2019
|
-
return
|
|
2026
|
+
return Te(s, void 0, void 0, _e().mark(function t() {
|
|
2027
|
+
return _e().wrap(function (t) {
|
|
2020
2028
|
for (;;) switch (t.prev = t.next) {
|
|
2021
2029
|
case 0:
|
|
2022
2030
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2036,17 +2044,17 @@ var Xe = Promise.resolve({
|
|
|
2036
2044
|
}
|
|
2037
2045
|
};
|
|
2038
2046
|
}
|
|
2039
|
-
return
|
|
2047
|
+
return ve(e, [{
|
|
2040
2048
|
key: "authenticate",
|
|
2041
2049
|
value: function value(e) {
|
|
2042
|
-
return
|
|
2050
|
+
return Te(this, void 0, void 0, _e().mark(function t() {
|
|
2043
2051
|
var r, n, i, o, s;
|
|
2044
|
-
return
|
|
2052
|
+
return _e().wrap(function (t) {
|
|
2045
2053
|
for (;;) switch (t.prev = t.next) {
|
|
2046
2054
|
case 0:
|
|
2047
|
-
return
|
|
2055
|
+
return Ve("stytch.sso.authenticate").isString("sso_token", e.sso_token).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._pkceManager.getPKPair();
|
|
2048
2056
|
case 3:
|
|
2049
|
-
return (r = t.sent) ||
|
|
2057
|
+
return (r = t.sent) || qe("No code verifier found in local storage for SSO flow.\nConsider using stytch.sso.start() to add PKCE to your SSO flows for added security.\nSee https://stytch.com/docs/oauth#guides_pkce for more information."), t.next = 7, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2050
2058
|
case 7:
|
|
2051
2059
|
return n = t.sent, i = n.dfp_telemetry_id, o = n.captcha_token, t.t0 = this._networkClient, t.t1 = Object, t.t2 = Object.assign({
|
|
2052
2060
|
pkce_code_verifier: null == r ? void 0 : r.code_verifier
|
|
@@ -2095,11 +2103,11 @@ var Xe = Promise.resolve({
|
|
|
2095
2103
|
}, {
|
|
2096
2104
|
key: "getBaseApiUrl",
|
|
2097
2105
|
value: function value() {
|
|
2098
|
-
return
|
|
2099
|
-
return
|
|
2106
|
+
return Te(this, void 0, void 0, _e().mark(function e() {
|
|
2107
|
+
return _e().wrap(function (e) {
|
|
2100
2108
|
for (;;) switch (e.prev = e.next) {
|
|
2101
2109
|
case 0:
|
|
2102
|
-
if (!
|
|
2110
|
+
if (!Ge(this._config.publicToken)) {
|
|
2103
2111
|
e.next = 2;
|
|
2104
2112
|
break;
|
|
2105
2113
|
}
|
|
@@ -2119,9 +2127,9 @@ var Xe = Promise.resolve({
|
|
|
2119
2127
|
var t = e.connection_id,
|
|
2120
2128
|
r = e.login_redirect_url,
|
|
2121
2129
|
n = e.signup_redirect_url;
|
|
2122
|
-
return
|
|
2130
|
+
return Te(this, void 0, void 0, _e().mark(function e() {
|
|
2123
2131
|
var i, o, s, a, c;
|
|
2124
|
-
return
|
|
2132
|
+
return _e().wrap(function (e) {
|
|
2125
2133
|
for (;;) switch (e.prev = e.next) {
|
|
2126
2134
|
case 0:
|
|
2127
2135
|
return e.next = 2, this._dynamicConfig;
|
|
@@ -2150,8 +2158,8 @@ var Xe = Promise.resolve({
|
|
|
2150
2158
|
}, {
|
|
2151
2159
|
key: "getConnections",
|
|
2152
2160
|
value: function value() {
|
|
2153
|
-
return
|
|
2154
|
-
return
|
|
2161
|
+
return Te(this, void 0, void 0, _e().mark(function e() {
|
|
2162
|
+
return _e().wrap(function (e) {
|
|
2155
2163
|
for (;;) switch (e.prev = e.next) {
|
|
2156
2164
|
case 0:
|
|
2157
2165
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2171,8 +2179,8 @@ var Xe = Promise.resolve({
|
|
|
2171
2179
|
}, {
|
|
2172
2180
|
key: "deleteConnection",
|
|
2173
2181
|
value: function value(e) {
|
|
2174
|
-
return
|
|
2175
|
-
return
|
|
2182
|
+
return Te(this, void 0, void 0, _e().mark(function t() {
|
|
2183
|
+
return _e().wrap(function (t) {
|
|
2176
2184
|
for (;;) switch (t.prev = t.next) {
|
|
2177
2185
|
case 0:
|
|
2178
2186
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2189,12 +2197,12 @@ var Xe = Promise.resolve({
|
|
|
2189
2197
|
}
|
|
2190
2198
|
}]), e;
|
|
2191
2199
|
}(),
|
|
2192
|
-
|
|
2200
|
+
rt = ve(function e(t, r) {
|
|
2193
2201
|
var n = this;
|
|
2194
|
-
|
|
2195
|
-
return
|
|
2202
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
|
|
2203
|
+
return Te(n, void 0, void 0, _e().mark(function e() {
|
|
2196
2204
|
var t;
|
|
2197
|
-
return
|
|
2205
|
+
return _e().wrap(function (e) {
|
|
2198
2206
|
for (;;) switch (e.prev = e.next) {
|
|
2199
2207
|
case 0:
|
|
2200
2208
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2223,9 +2231,9 @@ var Xe = Promise.resolve({
|
|
|
2223
2231
|
return e(null !== (r = null == t ? void 0 : t.organization) && void 0 !== r ? r : null);
|
|
2224
2232
|
});
|
|
2225
2233
|
}, this.update = function (e) {
|
|
2226
|
-
return
|
|
2234
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2227
2235
|
var r;
|
|
2228
|
-
return
|
|
2236
|
+
return _e().wrap(function (t) {
|
|
2229
2237
|
for (;;) switch (t.prev = t.next) {
|
|
2230
2238
|
case 0:
|
|
2231
2239
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2243,9 +2251,9 @@ var Xe = Promise.resolve({
|
|
|
2243
2251
|
}, t, this);
|
|
2244
2252
|
}));
|
|
2245
2253
|
}, this["delete"] = function () {
|
|
2246
|
-
return
|
|
2254
|
+
return Te(n, void 0, void 0, _e().mark(function e() {
|
|
2247
2255
|
var t;
|
|
2248
|
-
return
|
|
2256
|
+
return _e().wrap(function (e) {
|
|
2249
2257
|
for (;;) switch (e.prev = e.next) {
|
|
2250
2258
|
case 0:
|
|
2251
2259
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2263,8 +2271,8 @@ var Xe = Promise.resolve({
|
|
|
2263
2271
|
}));
|
|
2264
2272
|
}, this.members = {
|
|
2265
2273
|
create: function create(e) {
|
|
2266
|
-
return
|
|
2267
|
-
return
|
|
2274
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2275
|
+
return _e().wrap(function (t) {
|
|
2268
2276
|
for (;;) switch (t.prev = t.next) {
|
|
2269
2277
|
case 0:
|
|
2270
2278
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2281,8 +2289,8 @@ var Xe = Promise.resolve({
|
|
|
2281
2289
|
}));
|
|
2282
2290
|
},
|
|
2283
2291
|
search: function search(e) {
|
|
2284
|
-
return
|
|
2285
|
-
return
|
|
2292
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2293
|
+
return _e().wrap(function (t) {
|
|
2286
2294
|
for (;;) switch (t.prev = t.next) {
|
|
2287
2295
|
case 0:
|
|
2288
2296
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2299,8 +2307,8 @@ var Xe = Promise.resolve({
|
|
|
2299
2307
|
}));
|
|
2300
2308
|
},
|
|
2301
2309
|
update: function update(e) {
|
|
2302
|
-
return
|
|
2303
|
-
return
|
|
2310
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2311
|
+
return _e().wrap(function (t) {
|
|
2304
2312
|
for (;;) switch (t.prev = t.next) {
|
|
2305
2313
|
case 0:
|
|
2306
2314
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2317,8 +2325,8 @@ var Xe = Promise.resolve({
|
|
|
2317
2325
|
}));
|
|
2318
2326
|
},
|
|
2319
2327
|
deletePassword: function deletePassword(e) {
|
|
2320
|
-
return
|
|
2321
|
-
return
|
|
2328
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2329
|
+
return _e().wrap(function (t) {
|
|
2322
2330
|
for (;;) switch (t.prev = t.next) {
|
|
2323
2331
|
case 0:
|
|
2324
2332
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2334,8 +2342,8 @@ var Xe = Promise.resolve({
|
|
|
2334
2342
|
}));
|
|
2335
2343
|
},
|
|
2336
2344
|
deleteMFAPhoneNumber: function deleteMFAPhoneNumber(e) {
|
|
2337
|
-
return
|
|
2338
|
-
return
|
|
2345
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2346
|
+
return _e().wrap(function (t) {
|
|
2339
2347
|
for (;;) switch (t.prev = t.next) {
|
|
2340
2348
|
case 0:
|
|
2341
2349
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2351,8 +2359,8 @@ var Xe = Promise.resolve({
|
|
|
2351
2359
|
}));
|
|
2352
2360
|
},
|
|
2353
2361
|
deleteMFATOTP: function deleteMFATOTP(e) {
|
|
2354
|
-
return
|
|
2355
|
-
return
|
|
2362
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2363
|
+
return _e().wrap(function (t) {
|
|
2356
2364
|
for (;;) switch (t.prev = t.next) {
|
|
2357
2365
|
case 0:
|
|
2358
2366
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2368,8 +2376,8 @@ var Xe = Promise.resolve({
|
|
|
2368
2376
|
}));
|
|
2369
2377
|
},
|
|
2370
2378
|
"delete": function _delete(e) {
|
|
2371
|
-
return
|
|
2372
|
-
return
|
|
2379
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2380
|
+
return _e().wrap(function (t) {
|
|
2373
2381
|
for (;;) switch (t.prev = t.next) {
|
|
2374
2382
|
case 0:
|
|
2375
2383
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2385,8 +2393,8 @@ var Xe = Promise.resolve({
|
|
|
2385
2393
|
}));
|
|
2386
2394
|
},
|
|
2387
2395
|
reactivate: function reactivate(e) {
|
|
2388
|
-
return
|
|
2389
|
-
return
|
|
2396
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2397
|
+
return _e().wrap(function (t) {
|
|
2390
2398
|
for (;;) switch (t.prev = t.next) {
|
|
2391
2399
|
case 0:
|
|
2392
2400
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2403,18 +2411,18 @@ var Xe = Promise.resolve({
|
|
|
2403
2411
|
}
|
|
2404
2412
|
};
|
|
2405
2413
|
}),
|
|
2406
|
-
|
|
2414
|
+
nt = function () {
|
|
2407
2415
|
function e(t, r, n, i, o) {
|
|
2408
2416
|
var s = this,
|
|
2409
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
2410
|
-
|
|
2417
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : Je();
|
|
2418
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = o, this.dfpProtectedAuth = a, this.discovery = {
|
|
2411
2419
|
authenticate: function authenticate(e) {
|
|
2412
|
-
return
|
|
2420
|
+
return Te(s, void 0, void 0, _e().mark(function t() {
|
|
2413
2421
|
var r, n, i, o, s, a;
|
|
2414
|
-
return
|
|
2422
|
+
return _e().wrap(function (t) {
|
|
2415
2423
|
for (;;) switch (t.prev = t.next) {
|
|
2416
2424
|
case 0:
|
|
2417
|
-
return
|
|
2425
|
+
return Ve("stytch.oauth.discovery.authenticate").isString("discovery_oauth_token", e.discovery_oauth_token), t.next = 3, this._pkceManager.getPKPair();
|
|
2418
2426
|
case 3:
|
|
2419
2427
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2420
2428
|
case 6:
|
|
@@ -2455,17 +2463,17 @@ var Xe = Promise.resolve({
|
|
|
2455
2463
|
}
|
|
2456
2464
|
};
|
|
2457
2465
|
}
|
|
2458
|
-
return
|
|
2466
|
+
return ve(e, [{
|
|
2459
2467
|
key: "authenticate",
|
|
2460
2468
|
value: function value(e) {
|
|
2461
|
-
return
|
|
2469
|
+
return Te(this, void 0, void 0, _e().mark(function t() {
|
|
2462
2470
|
var r, n, i, o, s;
|
|
2463
|
-
return
|
|
2471
|
+
return _e().wrap(function (t) {
|
|
2464
2472
|
for (;;) switch (t.prev = t.next) {
|
|
2465
2473
|
case 0:
|
|
2466
|
-
return
|
|
2474
|
+
return Ve("stytch.oauth.authenticate").isString("oauth_token", e.oauth_token).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._pkceManager.getPKPair();
|
|
2467
2475
|
case 3:
|
|
2468
|
-
return (r = t.sent) ||
|
|
2476
|
+
return (r = t.sent) || qe("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."), t.next = 7, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2469
2477
|
case 7:
|
|
2470
2478
|
return n = t.sent, i = n.dfp_telemetry_id, o = n.captcha_token, t.t0 = this._networkClient, t.t1 = Object, t.t2 = null == r ? void 0 : r.code_verifier, t.t3 = i, t.t4 = o, t.next = 17, this._subscriptionService.getIntermediateSessionToken();
|
|
2471
2479
|
case 17:
|
|
@@ -2513,9 +2521,9 @@ var Xe = Promise.resolve({
|
|
|
2513
2521
|
}, {
|
|
2514
2522
|
key: "getBaseApiUrl",
|
|
2515
2523
|
value: function value() {
|
|
2516
|
-
return
|
|
2524
|
+
return Te(this, void 0, void 0, _e().mark(function e() {
|
|
2517
2525
|
var t, r;
|
|
2518
|
-
return
|
|
2526
|
+
return _e().wrap(function (e) {
|
|
2519
2527
|
for (;;) switch (e.prev = e.next) {
|
|
2520
2528
|
case 0:
|
|
2521
2529
|
return e.next = 2, this._dynamicConfig;
|
|
@@ -2526,7 +2534,7 @@ var Xe = Promise.resolve({
|
|
|
2526
2534
|
}
|
|
2527
2535
|
return e.abrupt("return", "https://".concat(r));
|
|
2528
2536
|
case 6:
|
|
2529
|
-
if (!
|
|
2537
|
+
if (!Ge(this._config.publicToken)) {
|
|
2530
2538
|
e.next = 8;
|
|
2531
2539
|
break;
|
|
2532
2540
|
}
|
|
@@ -2551,16 +2559,16 @@ var Xe = Promise.resolve({
|
|
|
2551
2559
|
s = r.signup_redirect_url,
|
|
2552
2560
|
a = r.custom_scopes,
|
|
2553
2561
|
c = r.provider_params;
|
|
2554
|
-
return
|
|
2562
|
+
return Te(t, void 0, void 0, _e().mark(function t() {
|
|
2555
2563
|
var r, u, l, d, h, p;
|
|
2556
|
-
return
|
|
2564
|
+
return _e().wrap(function (t) {
|
|
2557
2565
|
for (;;) switch (t.prev = t.next) {
|
|
2558
2566
|
case 0:
|
|
2559
2567
|
return t.next = 2, this._dynamicConfig;
|
|
2560
2568
|
case 2:
|
|
2561
2569
|
return r = t.sent, u = r.pkceRequiredForOAuth, t.next = 6, this.getBaseApiUrl();
|
|
2562
2570
|
case 6:
|
|
2563
|
-
if (l = t.sent, (d = new URL("".concat(l, "/v1/b2b/public/oauth/").concat(e, "/start"))).searchParams.set("public_token", this._config.publicToken), n && "" != n && d.searchParams.set("organization_id", n), i && "" != i && d.searchParams.set("slug", i), a && (
|
|
2571
|
+
if (l = t.sent, (d = new URL("".concat(l, "/v1/b2b/public/oauth/").concat(e, "/start"))).searchParams.set("public_token", this._config.publicToken), n && "" != n && d.searchParams.set("organization_id", n), i && "" != i && d.searchParams.set("slug", i), a && (Ve("startOAuthFlow").isStringArray("custom_scopes", a), d.searchParams.set("custom_scopes", a.join(" "))), c) for (h in Ve("startOAuthFlow").isOptionalObject("provider_params", c), c) d.searchParams.set("provider_" + h, c[h]);
|
|
2564
2572
|
if (!u) {
|
|
2565
2573
|
t.next = 20;
|
|
2566
2574
|
break;
|
|
@@ -2589,16 +2597,16 @@ var Xe = Promise.resolve({
|
|
|
2589
2597
|
var n = r.discovery_redirect_url,
|
|
2590
2598
|
i = r.custom_scopes,
|
|
2591
2599
|
o = r.provider_params;
|
|
2592
|
-
return
|
|
2600
|
+
return Te(t, void 0, void 0, _e().mark(function t() {
|
|
2593
2601
|
var r, s, a, c, u, l;
|
|
2594
|
-
return
|
|
2602
|
+
return _e().wrap(function (t) {
|
|
2595
2603
|
for (;;) switch (t.prev = t.next) {
|
|
2596
2604
|
case 0:
|
|
2597
2605
|
return t.next = 2, this._dynamicConfig;
|
|
2598
2606
|
case 2:
|
|
2599
2607
|
return r = t.sent, s = r.pkceRequiredForOAuth, t.next = 6, this.getBaseApiUrl();
|
|
2600
2608
|
case 6:
|
|
2601
|
-
if (a = t.sent, (c = new URL("".concat(a, "/v1/b2b/public/oauth/").concat(e, "/discovery/start"))).searchParams.set("public_token", this._config.publicToken), i && (
|
|
2609
|
+
if (a = t.sent, (c = new URL("".concat(a, "/v1/b2b/public/oauth/").concat(e, "/discovery/start"))).searchParams.set("public_token", this._config.publicToken), i && (Ve("startOAuthFlow").isStringArray("custom_scopes", i), c.searchParams.set("custom_scopes", i.join(" "))), o) for (u in Ve("startOAuthFlow").isOptionalObject("provider_params", o), o) c.searchParams.set("provider_" + u, o[u]);
|
|
2602
2610
|
if (!s) {
|
|
2603
2611
|
t.next = 18;
|
|
2604
2612
|
break;
|
|
@@ -2621,10 +2629,10 @@ var Xe = Promise.resolve({
|
|
|
2621
2629
|
}
|
|
2622
2630
|
}]), e;
|
|
2623
2631
|
}(),
|
|
2624
|
-
|
|
2632
|
+
it = function () {
|
|
2625
2633
|
function e(t, r) {
|
|
2626
2634
|
var n = this;
|
|
2627
|
-
|
|
2635
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this.getSync = function () {
|
|
2628
2636
|
return n._subscriptionService.getSession();
|
|
2629
2637
|
}, this.getInfo = function () {
|
|
2630
2638
|
return {
|
|
@@ -2637,9 +2645,9 @@ var Xe = Promise.resolve({
|
|
|
2637
2645
|
return e(null !== (r = null == t ? void 0 : t.session) && void 0 !== r ? r : null);
|
|
2638
2646
|
});
|
|
2639
2647
|
}, this.revoke = function (e) {
|
|
2640
|
-
return
|
|
2648
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2641
2649
|
var r;
|
|
2642
|
-
return
|
|
2650
|
+
return _e().wrap(function (t) {
|
|
2643
2651
|
for (;;) switch (t.prev = t.next) {
|
|
2644
2652
|
case 0:
|
|
2645
2653
|
return t.prev = 0, t.next = 3, this._networkClient.fetchSDK({
|
|
@@ -2658,13 +2666,13 @@ var Xe = Promise.resolve({
|
|
|
2658
2666
|
}, t, this, [[0, 8]]);
|
|
2659
2667
|
}));
|
|
2660
2668
|
}, this.authenticate = function (e) {
|
|
2661
|
-
return
|
|
2669
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2662
2670
|
var r,
|
|
2663
2671
|
n,
|
|
2664
2672
|
i,
|
|
2665
2673
|
o,
|
|
2666
2674
|
s = this;
|
|
2667
|
-
return
|
|
2675
|
+
return _e().wrap(function (t) {
|
|
2668
2676
|
for (;;) switch (t.prev = t.next) {
|
|
2669
2677
|
case 0:
|
|
2670
2678
|
return r = this._subscriptionService.getSession(), n = function n() {
|
|
@@ -2710,12 +2718,12 @@ var Xe = Promise.resolve({
|
|
|
2710
2718
|
}, t, this, [[2, 13]]);
|
|
2711
2719
|
}));
|
|
2712
2720
|
}, this.exchange = function (e) {
|
|
2713
|
-
return
|
|
2721
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2714
2722
|
var r;
|
|
2715
|
-
return
|
|
2723
|
+
return _e().wrap(function (t) {
|
|
2716
2724
|
for (;;) switch (t.prev = t.next) {
|
|
2717
2725
|
case 0:
|
|
2718
|
-
return
|
|
2726
|
+
return Ve("stytch.sessions.exchange").isString("organization_id", e.organization_id).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.prev = 1, t.next = 4, this._networkClient.fetchSDK({
|
|
2719
2727
|
url: "/b2b/sessions/exchange",
|
|
2720
2728
|
body: e,
|
|
2721
2729
|
errorMessage: "Failed to exchange session",
|
|
@@ -2747,7 +2755,7 @@ var Xe = Promise.resolve({
|
|
|
2747
2755
|
}));
|
|
2748
2756
|
};
|
|
2749
2757
|
}
|
|
2750
|
-
return
|
|
2758
|
+
return ve(e, [{
|
|
2751
2759
|
key: "getTokens",
|
|
2752
2760
|
value: function value() {
|
|
2753
2761
|
return this._subscriptionService.getTokens();
|
|
@@ -2759,12 +2767,12 @@ var Xe = Promise.resolve({
|
|
|
2759
2767
|
}
|
|
2760
2768
|
}]), e;
|
|
2761
2769
|
}(),
|
|
2762
|
-
|
|
2770
|
+
ot = ve(function e(t, r) {
|
|
2763
2771
|
var n = this;
|
|
2764
|
-
|
|
2772
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this.organizations = {
|
|
2765
2773
|
list: function list() {
|
|
2766
|
-
return
|
|
2767
|
-
return
|
|
2774
|
+
return Te(n, void 0, void 0, _e().mark(function e() {
|
|
2775
|
+
return _e().wrap(function (e) {
|
|
2768
2776
|
for (;;) switch (e.prev = e.next) {
|
|
2769
2777
|
case 0:
|
|
2770
2778
|
return e.t0 = this._networkClient, e.next = 3, this._subscriptionService.getIntermediateSessionToken();
|
|
@@ -2791,12 +2799,12 @@ var Xe = Promise.resolve({
|
|
|
2791
2799
|
}));
|
|
2792
2800
|
},
|
|
2793
2801
|
create: function create(e) {
|
|
2794
|
-
return
|
|
2802
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2795
2803
|
var r, n;
|
|
2796
|
-
return
|
|
2804
|
+
return _e().wrap(function (t) {
|
|
2797
2805
|
for (;;) switch (t.prev = t.next) {
|
|
2798
2806
|
case 0:
|
|
2799
|
-
return
|
|
2807
|
+
return Ve("stytch.discovery.organizations.create").isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("organization_name", e.organization_name).isOptionalString("organization_slug", e.organization_slug).isOptionalString("organization_logo_url", e.organization_logo_url).isOptionalString("sso_jit_provisioning", e.sso_jit_provisioning).isOptionalStringArray("email_allowed_domains", e.email_allowed_domains).isOptionalString("email_invites", e.email_invites).isOptionalString("auth_methods", e.auth_methods).isOptionalStringArray("allowed_auth_methods", e.allowed_auth_methods).isOptionalString("mfa_policy", e.mfa_policy), t.t0 = Object, t.t1 = Object.assign({}, e), t.next = 5, this._subscriptionService.getIntermediateSessionToken();
|
|
2800
2808
|
case 5:
|
|
2801
2809
|
if (t.t2 = t.sent, t.t2) {
|
|
2802
2810
|
t.next = 8;
|
|
@@ -2837,12 +2845,12 @@ var Xe = Promise.resolve({
|
|
|
2837
2845
|
}
|
|
2838
2846
|
}, this.intermediateSessions = {
|
|
2839
2847
|
exchange: function exchange(e) {
|
|
2840
|
-
return
|
|
2848
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2841
2849
|
var r, n;
|
|
2842
|
-
return
|
|
2850
|
+
return _e().wrap(function (t) {
|
|
2843
2851
|
for (;;) switch (t.prev = t.next) {
|
|
2844
2852
|
case 0:
|
|
2845
|
-
return
|
|
2853
|
+
return Ve("stytch.discovery.intermediateSessions.exchange").isString("organization_id", e.organization_id).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.t0 = Object, t.t1 = Object.assign({}, e), t.next = 5, this._subscriptionService.getIntermediateSessionToken();
|
|
2846
2854
|
case 5:
|
|
2847
2855
|
if (t.t2 = t.sent, t.t2) {
|
|
2848
2856
|
t.next = 8;
|
|
@@ -2883,21 +2891,21 @@ var Xe = Promise.resolve({
|
|
|
2883
2891
|
}
|
|
2884
2892
|
};
|
|
2885
2893
|
}),
|
|
2886
|
-
|
|
2894
|
+
st = Promise.resolve({
|
|
2887
2895
|
pkceRequiredForPasswordResets: !1
|
|
2888
2896
|
}),
|
|
2889
|
-
|
|
2897
|
+
at = function () {
|
|
2890
2898
|
function e(t, r, n) {
|
|
2891
|
-
var i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] :
|
|
2892
|
-
o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] :
|
|
2893
|
-
|
|
2899
|
+
var i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : st,
|
|
2900
|
+
o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : Je();
|
|
2901
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._config = i, this.dfpProtectedAuth = o;
|
|
2894
2902
|
}
|
|
2895
|
-
return
|
|
2903
|
+
return ve(e, [{
|
|
2896
2904
|
key: "getCodeChallenge",
|
|
2897
2905
|
value: function value() {
|
|
2898
|
-
return
|
|
2906
|
+
return Te(this, void 0, void 0, _e().mark(function e() {
|
|
2899
2907
|
var t, r;
|
|
2900
|
-
return
|
|
2908
|
+
return _e().wrap(function (e) {
|
|
2901
2909
|
for (;;) switch (e.prev = e.next) {
|
|
2902
2910
|
case 0:
|
|
2903
2911
|
return e.next = 2, this._config;
|
|
@@ -2929,12 +2937,12 @@ var Xe = Promise.resolve({
|
|
|
2929
2937
|
}, {
|
|
2930
2938
|
key: "authenticate",
|
|
2931
2939
|
value: function value(e) {
|
|
2932
|
-
return
|
|
2940
|
+
return Te(this, void 0, void 0, _e().mark(function t() {
|
|
2933
2941
|
var r, n, i, o, s, a;
|
|
2934
|
-
return
|
|
2942
|
+
return _e().wrap(function (t) {
|
|
2935
2943
|
for (;;) switch (t.prev = t.next) {
|
|
2936
2944
|
case 0:
|
|
2937
|
-
return
|
|
2945
|
+
return Ve("stytch.passwords.authenticate").isString("org_id", e.organization_id).isString("password", e.password).isString("email_address", e.email_address).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._pkceManager.getPKPair();
|
|
2938
2946
|
case 3:
|
|
2939
2947
|
return r = t.sent, n = null == r ? void 0 : r.code_verifier, t.next = 7, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2940
2948
|
case 7:
|
|
@@ -2989,12 +2997,12 @@ var Xe = Promise.resolve({
|
|
|
2989
2997
|
}, {
|
|
2990
2998
|
key: "resetByEmailStart",
|
|
2991
2999
|
value: function value(e) {
|
|
2992
|
-
return
|
|
3000
|
+
return Te(this, void 0, void 0, _e().mark(function t() {
|
|
2993
3001
|
var r, n, i, o;
|
|
2994
|
-
return
|
|
3002
|
+
return _e().wrap(function (t) {
|
|
2995
3003
|
for (;;) switch (t.prev = t.next) {
|
|
2996
3004
|
case 0:
|
|
2997
|
-
return
|
|
3005
|
+
return Ve("stytch.passwords.resetByEmailStart").isString("email", e.email_address).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();
|
|
2998
3006
|
case 3:
|
|
2999
3007
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3000
3008
|
case 6:
|
|
@@ -3025,12 +3033,12 @@ var Xe = Promise.resolve({
|
|
|
3025
3033
|
}, {
|
|
3026
3034
|
key: "resetByEmail",
|
|
3027
3035
|
value: function value(e) {
|
|
3028
|
-
return
|
|
3036
|
+
return Te(this, void 0, void 0, _e().mark(function t() {
|
|
3029
3037
|
var r, n, i, o, s, a;
|
|
3030
|
-
return
|
|
3038
|
+
return _e().wrap(function (t) {
|
|
3031
3039
|
for (;;) switch (t.prev = t.next) {
|
|
3032
3040
|
case 0:
|
|
3033
|
-
return
|
|
3041
|
+
return Ve("stytch.passwords.resetByEmail").isString("password_reset_token", e.password_reset_token).isString("password", e.password).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3034
3042
|
case 3:
|
|
3035
3043
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._pkceManager.getPKPair();
|
|
3036
3044
|
case 8:
|
|
@@ -3084,12 +3092,12 @@ var Xe = Promise.resolve({
|
|
|
3084
3092
|
}, {
|
|
3085
3093
|
key: "resetByExistingPassword",
|
|
3086
3094
|
value: function value(e) {
|
|
3087
|
-
return
|
|
3095
|
+
return Te(this, void 0, void 0, _e().mark(function t() {
|
|
3088
3096
|
var r, n, i, o;
|
|
3089
|
-
return
|
|
3097
|
+
return _e().wrap(function (t) {
|
|
3090
3098
|
for (;;) switch (t.prev = t.next) {
|
|
3091
3099
|
case 0:
|
|
3092
|
-
return
|
|
3100
|
+
return Ve("stytch.passwords.resetByExistingPassword").isString("email", e.email_address).isString("existing_password", e.existing_password).isString("new_password", e.new_password).isOptionalString("locale", e.locale), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3093
3101
|
case 3:
|
|
3094
3102
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
3095
3103
|
url: "/b2b/passwords/existing_password/reset",
|
|
@@ -3133,12 +3141,12 @@ var Xe = Promise.resolve({
|
|
|
3133
3141
|
}, {
|
|
3134
3142
|
key: "resetBySession",
|
|
3135
3143
|
value: function value(e) {
|
|
3136
|
-
return
|
|
3144
|
+
return Te(this, void 0, void 0, _e().mark(function t() {
|
|
3137
3145
|
var r, n, i, o;
|
|
3138
|
-
return
|
|
3146
|
+
return _e().wrap(function (t) {
|
|
3139
3147
|
for (;;) switch (t.prev = t.next) {
|
|
3140
3148
|
case 0:
|
|
3141
|
-
return
|
|
3149
|
+
return Ve("stytch.passwords.resetBySession").isString("password", e.password), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3142
3150
|
case 3:
|
|
3143
3151
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
3144
3152
|
url: "/b2b/passwords/session/reset",
|
|
@@ -3172,11 +3180,11 @@ var Xe = Promise.resolve({
|
|
|
3172
3180
|
}, {
|
|
3173
3181
|
key: "strengthCheck",
|
|
3174
3182
|
value: function value(e) {
|
|
3175
|
-
return
|
|
3176
|
-
return
|
|
3183
|
+
return Te(this, void 0, void 0, _e().mark(function t() {
|
|
3184
|
+
return _e().wrap(function (t) {
|
|
3177
3185
|
for (;;) switch (t.prev = t.next) {
|
|
3178
3186
|
case 0:
|
|
3179
|
-
return
|
|
3187
|
+
return Ve("stytch.passwords.strengthCheck").isOptionalString("email", e.email_address).isString("password", e.password), t.abrupt("return", this._networkClient.fetchSDK({
|
|
3180
3188
|
url: "/b2b/passwords/strength_check",
|
|
3181
3189
|
method: "POST",
|
|
3182
3190
|
errorMessage: "Failed to check password strength.",
|
|
@@ -3194,17 +3202,17 @@ var Xe = Promise.resolve({
|
|
|
3194
3202
|
}
|
|
3195
3203
|
}]), e;
|
|
3196
3204
|
}(),
|
|
3197
|
-
|
|
3205
|
+
ct = ve(function e(t, r) {
|
|
3198
3206
|
var n = this,
|
|
3199
|
-
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] :
|
|
3200
|
-
|
|
3207
|
+
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : Je();
|
|
3208
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = i, this.sms = {
|
|
3201
3209
|
send: function send(e) {
|
|
3202
|
-
return
|
|
3210
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
3203
3211
|
var r, n, i;
|
|
3204
|
-
return
|
|
3212
|
+
return _e().wrap(function (t) {
|
|
3205
3213
|
for (;;) switch (t.prev = t.next) {
|
|
3206
3214
|
case 0:
|
|
3207
|
-
return
|
|
3215
|
+
return Ve("stytch.otps.sms.send").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isOptionalString("mfa_phone_number", e.mfa_phone_number).isOptionalString("locale", e.locale), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3208
3216
|
case 3:
|
|
3209
3217
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.t0 = this._networkClient, t.t1 = Object, t.t2 = Object.assign({}, e), t.t3 = n, t.t4 = i, t.next = 13, this._subscriptionService.getIntermediateSessionToken();
|
|
3210
3218
|
case 13:
|
|
@@ -3233,12 +3241,12 @@ var Xe = Promise.resolve({
|
|
|
3233
3241
|
}));
|
|
3234
3242
|
},
|
|
3235
3243
|
authenticate: function authenticate(e) {
|
|
3236
|
-
return
|
|
3244
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
3237
3245
|
var r, n, i, o, s;
|
|
3238
|
-
return
|
|
3246
|
+
return _e().wrap(function (t) {
|
|
3239
3247
|
for (;;) switch (t.prev = t.next) {
|
|
3240
3248
|
case 0:
|
|
3241
|
-
return
|
|
3249
|
+
return Ve("stytch.otps.sms.authenticate").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isString("code", e.code).isOptionalString("set_mfa_enrollment", e.set_mfa_enrollment), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3242
3250
|
case 3:
|
|
3243
3251
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.t0 = Object, t.t1 = Object.assign({}, e), t.t2 = n, t.t3 = i, t.next = 12, this._subscriptionService.getIntermediateSessionToken();
|
|
3244
3252
|
case 12:
|
|
@@ -3279,20 +3287,20 @@ var Xe = Promise.resolve({
|
|
|
3279
3287
|
}
|
|
3280
3288
|
};
|
|
3281
3289
|
}),
|
|
3282
|
-
|
|
3290
|
+
ut = function () {
|
|
3283
3291
|
function e(t, r) {
|
|
3284
|
-
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] :
|
|
3285
|
-
|
|
3292
|
+
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : Je();
|
|
3293
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n;
|
|
3286
3294
|
}
|
|
3287
|
-
return
|
|
3295
|
+
return ve(e, [{
|
|
3288
3296
|
key: "create",
|
|
3289
3297
|
value: function value(e) {
|
|
3290
|
-
return
|
|
3298
|
+
return Te(this, void 0, void 0, _e().mark(function t() {
|
|
3291
3299
|
var r, n, i;
|
|
3292
|
-
return
|
|
3300
|
+
return _e().wrap(function (t) {
|
|
3293
3301
|
for (;;) switch (t.prev = t.next) {
|
|
3294
3302
|
case 0:
|
|
3295
|
-
return
|
|
3303
|
+
return Ve("stytch.totp.create").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isOptionalNumber("expiration_minutes", e.expiration_minutes), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3296
3304
|
case 3:
|
|
3297
3305
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.t0 = this._networkClient, t.t1 = Object, t.t2 = Object.assign({}, e), t.t3 = n, t.t4 = i, t.next = 13, this._subscriptionService.getIntermediateSessionToken();
|
|
3298
3306
|
case 13:
|
|
@@ -3323,12 +3331,12 @@ var Xe = Promise.resolve({
|
|
|
3323
3331
|
}, {
|
|
3324
3332
|
key: "authenticate",
|
|
3325
3333
|
value: function value(e) {
|
|
3326
|
-
return
|
|
3334
|
+
return Te(this, void 0, void 0, _e().mark(function t() {
|
|
3327
3335
|
var r, n, i, o, s;
|
|
3328
|
-
return
|
|
3336
|
+
return _e().wrap(function (t) {
|
|
3329
3337
|
for (;;) switch (t.prev = t.next) {
|
|
3330
3338
|
case 0:
|
|
3331
|
-
return
|
|
3339
|
+
return Ve("stytch.totp.authenticate").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isString("code", e.code).isOptionalString("set_mfa_enrollment", e.set_mfa_enrollment).isOptionalBoolean("set_default_mfa", e.set_default_mfa), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3332
3340
|
case 3:
|
|
3333
3341
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.t0 = Object, t.t1 = Object.assign({}, e), t.t2 = n, t.t3 = i, t.next = 12, this._subscriptionService.getIntermediateSessionToken();
|
|
3334
3342
|
case 12:
|
|
@@ -3369,20 +3377,20 @@ var Xe = Promise.resolve({
|
|
|
3369
3377
|
}
|
|
3370
3378
|
}]), e;
|
|
3371
3379
|
}(),
|
|
3372
|
-
|
|
3380
|
+
lt = function () {
|
|
3373
3381
|
function e(t, r) {
|
|
3374
|
-
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] :
|
|
3375
|
-
|
|
3382
|
+
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : Je();
|
|
3383
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n;
|
|
3376
3384
|
}
|
|
3377
|
-
return
|
|
3385
|
+
return ve(e, [{
|
|
3378
3386
|
key: "recover",
|
|
3379
3387
|
value: function value(e) {
|
|
3380
|
-
return
|
|
3388
|
+
return Te(this, void 0, void 0, _e().mark(function t() {
|
|
3381
3389
|
var r, n, i, o, s;
|
|
3382
|
-
return
|
|
3390
|
+
return _e().wrap(function (t) {
|
|
3383
3391
|
for (;;) switch (t.prev = t.next) {
|
|
3384
3392
|
case 0:
|
|
3385
|
-
return
|
|
3393
|
+
return Ve("stytch.recoveryCodes.recover").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isString("recovery_code", e.recovery_code), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3386
3394
|
case 3:
|
|
3387
3395
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.t0 = Object, t.t1 = Object.assign({}, e), t.t2 = n, t.t3 = i, t.next = 12, this._subscriptionService.getIntermediateSessionToken();
|
|
3388
3396
|
case 12:
|
|
@@ -3424,9 +3432,9 @@ var Xe = Promise.resolve({
|
|
|
3424
3432
|
}, {
|
|
3425
3433
|
key: "rotate",
|
|
3426
3434
|
value: function value() {
|
|
3427
|
-
return
|
|
3435
|
+
return Te(this, void 0, void 0, _e().mark(function e() {
|
|
3428
3436
|
var t, r, n;
|
|
3429
|
-
return
|
|
3437
|
+
return _e().wrap(function (e) {
|
|
3430
3438
|
for (;;) switch (e.prev = e.next) {
|
|
3431
3439
|
case 0:
|
|
3432
3440
|
return e.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
@@ -3451,8 +3459,8 @@ var Xe = Promise.resolve({
|
|
|
3451
3459
|
}, {
|
|
3452
3460
|
key: "get",
|
|
3453
3461
|
value: function value() {
|
|
3454
|
-
return
|
|
3455
|
-
return
|
|
3462
|
+
return Te(this, void 0, void 0, _e().mark(function e() {
|
|
3463
|
+
return _e().wrap(function (e) {
|
|
3456
3464
|
for (;;) switch (e.prev = e.next) {
|
|
3457
3465
|
case 0:
|
|
3458
3466
|
return e.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -3469,21 +3477,21 @@ var Xe = Promise.resolve({
|
|
|
3469
3477
|
}
|
|
3470
3478
|
}]), e;
|
|
3471
3479
|
}(),
|
|
3472
|
-
|
|
3480
|
+
dt = function () {
|
|
3473
3481
|
function e(t, r, n) {
|
|
3474
3482
|
var i = this;
|
|
3475
|
-
|
|
3483
|
+
ge(this, e), this._subscriptionService = n, this.isAuthorizedSync = function (e, t) {
|
|
3476
3484
|
var r;
|
|
3477
3485
|
return !!(null === (r = i.cachedPolicy) || void 0 === r ? void 0 : r.callerIsAuthorized(i.roleIds(), e, t));
|
|
3478
3486
|
}, this.isAuthorized = function (e, t) {
|
|
3479
3487
|
return i.policyPromise.then(function (r) {
|
|
3480
3488
|
return r.callerIsAuthorized(i.roleIds(), e, t);
|
|
3481
3489
|
});
|
|
3482
|
-
}, this.cachedPolicy = t.rbacPolicy ?
|
|
3483
|
-
return e.rbacPolicy ? (i.cachedPolicy =
|
|
3490
|
+
}, this.cachedPolicy = t.rbacPolicy ? mt.fromJSON(t.rbacPolicy) : null, this.policyPromise = r.then(function (e) {
|
|
3491
|
+
return e.rbacPolicy ? (i.cachedPolicy = mt.fromJSON(e.rbacPolicy), i.cachedPolicy) : (We("Unable to retrieve RBAC policy from servers. Assuming caller has no permissions."), new mt([], []));
|
|
3484
3492
|
});
|
|
3485
3493
|
}
|
|
3486
|
-
return
|
|
3494
|
+
return ve(e, [{
|
|
3487
3495
|
key: "allPermissions",
|
|
3488
3496
|
value: function value() {
|
|
3489
3497
|
var e = this;
|
|
@@ -3500,15 +3508,15 @@ var Xe = Promise.resolve({
|
|
|
3500
3508
|
}
|
|
3501
3509
|
}]), e;
|
|
3502
3510
|
}(),
|
|
3503
|
-
|
|
3511
|
+
ht = function () {
|
|
3504
3512
|
function e(t) {
|
|
3505
|
-
|
|
3513
|
+
ge(this, e), this.iframeURL = t, this.createIframe();
|
|
3506
3514
|
}
|
|
3507
|
-
return
|
|
3515
|
+
return ve(e, [{
|
|
3508
3516
|
key: "createIframe",
|
|
3509
3517
|
value: function value() {
|
|
3510
3518
|
var e = document.querySelector('[src~="'.concat(this.iframeURL, '"]'));
|
|
3511
|
-
e ?
|
|
3519
|
+
e ? qe("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) {
|
|
3512
3520
|
e.addEventListener("load", function () {
|
|
3513
3521
|
e.dataset.loaded = "true", t(e);
|
|
3514
3522
|
}, {
|
|
@@ -3519,11 +3527,11 @@ var Xe = Promise.resolve({
|
|
|
3519
3527
|
}, {
|
|
3520
3528
|
key: "call",
|
|
3521
3529
|
value: function value(e, t) {
|
|
3522
|
-
return
|
|
3530
|
+
return Te(this, void 0, void 0, _e().mark(function r() {
|
|
3523
3531
|
var n,
|
|
3524
3532
|
i,
|
|
3525
3533
|
o = this;
|
|
3526
|
-
return
|
|
3534
|
+
return _e().wrap(function (r) {
|
|
3527
3535
|
for (;;) switch (r.prev = r.next) {
|
|
3528
3536
|
case 0:
|
|
3529
3537
|
return r.next = 2, this.frame;
|
|
@@ -3532,7 +3540,7 @@ var Xe = Promise.resolve({
|
|
|
3532
3540
|
var a;
|
|
3533
3541
|
i.port1.onmessage = function (e) {
|
|
3534
3542
|
var t = e.data;
|
|
3535
|
-
i.port1.close(), t.success ? r(t.payload) : s(
|
|
3543
|
+
i.port1.close(), t.success ? r(t.payload) : s($e.unmarshall(t.error));
|
|
3536
3544
|
};
|
|
3537
3545
|
var c = {
|
|
3538
3546
|
method: e,
|
|
@@ -3549,11 +3557,11 @@ var Xe = Promise.resolve({
|
|
|
3549
3557
|
}
|
|
3550
3558
|
}]), e;
|
|
3551
3559
|
}(),
|
|
3552
|
-
|
|
3560
|
+
pt = function () {
|
|
3553
3561
|
function e(t, r) {
|
|
3554
|
-
|
|
3562
|
+
ge(this, e), this._networkClient = t, this.dfpProtectedAuth = r;
|
|
3555
3563
|
}
|
|
3556
|
-
return
|
|
3564
|
+
return ve(e, [{
|
|
3557
3565
|
key: "searchUser",
|
|
3558
3566
|
value: function value(e) {
|
|
3559
3567
|
var t = this;
|
|
@@ -3599,17 +3607,17 @@ var Xe = Promise.resolve({
|
|
|
3599
3607
|
}
|
|
3600
3608
|
}]), e;
|
|
3601
3609
|
}(),
|
|
3602
|
-
|
|
3610
|
+
ft = function () {
|
|
3603
3611
|
function e(t, r) {
|
|
3604
3612
|
var n = this;
|
|
3605
|
-
|
|
3613
|
+
ge(this, e), this._subscriptionService = t, this._headlessSessionClient = r, this._onDataChange = function (e) {
|
|
3606
3614
|
!function (e) {
|
|
3607
3615
|
return !!(null == e ? void 0 : e.session);
|
|
3608
3616
|
}(e) ? n.cancelBackgroundRefresh() : n.scheduleBackgroundRefresh();
|
|
3609
3617
|
}, this._reauthenticateWithBackoff = function () {
|
|
3610
|
-
return
|
|
3618
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
3611
3619
|
var r;
|
|
3612
|
-
return
|
|
3620
|
+
return _e().wrap(function (t) {
|
|
3613
3621
|
for (;;) switch (t.prev = t.next) {
|
|
3614
3622
|
case 0:
|
|
3615
3623
|
r = 0;
|
|
@@ -3638,14 +3646,14 @@ var Xe = Promise.resolve({
|
|
|
3638
3646
|
}));
|
|
3639
3647
|
}, this.timeout = null, this._subscriptionService.subscribeToState(this._onDataChange);
|
|
3640
3648
|
}
|
|
3641
|
-
return
|
|
3649
|
+
return ve(e, [{
|
|
3642
3650
|
key: "performBackgroundRefresh",
|
|
3643
3651
|
value: function value() {
|
|
3644
3652
|
var e = this;
|
|
3645
3653
|
this._reauthenticateWithBackoff().then(function () {
|
|
3646
3654
|
e.scheduleBackgroundRefresh();
|
|
3647
3655
|
})["catch"](function (t) {
|
|
3648
|
-
|
|
3656
|
+
qe("Session background refresh failed. Signalling to app that user is logged out.", {
|
|
3649
3657
|
error: t
|
|
3650
3658
|
}), e._subscriptionService.destroySession();
|
|
3651
3659
|
});
|
|
@@ -3675,23 +3683,23 @@ var Xe = Promise.resolve({
|
|
|
3675
3683
|
}
|
|
3676
3684
|
}]), e;
|
|
3677
3685
|
}();
|
|
3678
|
-
|
|
3679
|
-
var
|
|
3686
|
+
ft.REFRESH_INTERVAL_MS = 18e4;
|
|
3687
|
+
var _t = ve(function e(t, r) {
|
|
3680
3688
|
var n = this;
|
|
3681
|
-
|
|
3689
|
+
ge(this, e), this._subscriptionService = t, this.emptyState = r, this.onStateChange = function (e) {
|
|
3682
3690
|
return n._subscriptionService.subscribeToState(function (t) {
|
|
3683
3691
|
e(null != t ? t : n.emptyState);
|
|
3684
3692
|
});
|
|
3685
3693
|
};
|
|
3686
3694
|
}),
|
|
3687
|
-
|
|
3695
|
+
mt = function () {
|
|
3688
3696
|
function e(t, r) {
|
|
3689
3697
|
var n = this;
|
|
3690
|
-
|
|
3698
|
+
ge(this, e), this.roles = t, this.resources = r, this.rolesByID = {}, t.forEach(function (e) {
|
|
3691
3699
|
return n.rolesByID[e.role_id] = e;
|
|
3692
3700
|
});
|
|
3693
3701
|
}
|
|
3694
|
-
return
|
|
3702
|
+
return ve(e, [{
|
|
3695
3703
|
key: "callerIsAuthorized",
|
|
3696
3704
|
value: function value(e, t, r) {
|
|
3697
3705
|
var n = this;
|
|
@@ -3725,19 +3733,19 @@ var ft = me(function e(t, r) {
|
|
|
3725
3733
|
}
|
|
3726
3734
|
}]), e;
|
|
3727
3735
|
}();
|
|
3728
|
-
var
|
|
3729
|
-
var
|
|
3730
|
-
function
|
|
3736
|
+
var vt = "bootstrap";
|
|
3737
|
+
var bt = /*#__PURE__*/function () {
|
|
3738
|
+
function bt(e, t, r) {
|
|
3731
3739
|
var _this = this;
|
|
3732
|
-
_classCallCheck(this,
|
|
3740
|
+
_classCallCheck(this, bt);
|
|
3733
3741
|
this._publicToken = e, this._networkClient = t, this._dataLayer = r, this._bootstrapDataPromise = this._networkClient.fetchSDK({
|
|
3734
3742
|
url: "/projects/bootstrap/".concat(this._publicToken),
|
|
3735
3743
|
method: "GET",
|
|
3736
3744
|
errorMessage: "Error fetching bootstrap data for SDK for ".concat(this._publicToken)
|
|
3737
|
-
}).then(
|
|
3738
|
-
return _this._dataLayer.setItem(
|
|
3745
|
+
}).then(bt.mapBootstrapData).then(function (e) {
|
|
3746
|
+
return _this._dataLayer.setItem(vt, JSON.stringify(e)), e;
|
|
3739
3747
|
})["catch"](function (e) {
|
|
3740
|
-
return
|
|
3748
|
+
return We(e), {
|
|
3741
3749
|
displayWatermark: !1,
|
|
3742
3750
|
cnameDomain: null,
|
|
3743
3751
|
emailDomains: ["stytch.com"],
|
|
@@ -3756,10 +3764,10 @@ var vt = /*#__PURE__*/function () {
|
|
|
3756
3764
|
};
|
|
3757
3765
|
});
|
|
3758
3766
|
}
|
|
3759
|
-
_createClass(
|
|
3767
|
+
_createClass(bt, [{
|
|
3760
3768
|
key: "getSync",
|
|
3761
3769
|
value: function getSync() {
|
|
3762
|
-
var e = this._dataLayer.getItem(
|
|
3770
|
+
var e = this._dataLayer.getItem(vt);
|
|
3763
3771
|
if (null === e) return {
|
|
3764
3772
|
displayWatermark: !1,
|
|
3765
3773
|
cnameDomain: null,
|
|
@@ -3830,9 +3838,9 @@ var vt = /*#__PURE__*/function () {
|
|
|
3830
3838
|
};
|
|
3831
3839
|
}
|
|
3832
3840
|
}]);
|
|
3833
|
-
return
|
|
3841
|
+
return bt;
|
|
3834
3842
|
}();
|
|
3835
|
-
function
|
|
3843
|
+
function gt(e, t, r, n) {
|
|
3836
3844
|
return new (r || (r = Promise))(function (i, o) {
|
|
3837
3845
|
function s(e) {
|
|
3838
3846
|
try {
|
|
@@ -3858,11 +3866,11 @@ function bt(e, t, r, n) {
|
|
|
3858
3866
|
});
|
|
3859
3867
|
}
|
|
3860
3868
|
"function" == typeof SuppressedError && SuppressedError;
|
|
3861
|
-
var
|
|
3869
|
+
var kt = /*#__PURE__*/_createClass(function kt(e) {
|
|
3862
3870
|
var _this2 = this;
|
|
3863
|
-
_classCallCheck(this,
|
|
3871
|
+
_classCallCheck(this, kt);
|
|
3864
3872
|
this.bootstrapPromise = e, this.executeRecaptcha = function () {
|
|
3865
|
-
return
|
|
3873
|
+
return gt(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
3866
3874
|
var _yield$this$state, e, t, r;
|
|
3867
3875
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3868
3876
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -3893,7 +3901,7 @@ var gt = /*#__PURE__*/_createClass(function gt(e) {
|
|
|
3893
3901
|
}, _callee, this);
|
|
3894
3902
|
}));
|
|
3895
3903
|
}, this.state = e.then(function (e) {
|
|
3896
|
-
return
|
|
3904
|
+
return gt(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
3897
3905
|
var t;
|
|
3898
3906
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3899
3907
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -3904,7 +3912,7 @@ var gt = /*#__PURE__*/_createClass(function gt(e) {
|
|
|
3904
3912
|
}
|
|
3905
3913
|
_context2.t1 = !0;
|
|
3906
3914
|
_context2.next = 4;
|
|
3907
|
-
return t = e.captchaSettings.siteKey,
|
|
3915
|
+
return t = e.captchaSettings.siteKey, Be("https://www.google.com/recaptcha/enterprise.js?render=".concat(t), function () {
|
|
3908
3916
|
return window.grecaptcha.enterprise;
|
|
3909
3917
|
});
|
|
3910
3918
|
case 4:
|
|
@@ -3931,10 +3939,10 @@ var gt = /*#__PURE__*/_createClass(function gt(e) {
|
|
|
3931
3939
|
}));
|
|
3932
3940
|
});
|
|
3933
3941
|
});
|
|
3934
|
-
var
|
|
3935
|
-
function
|
|
3942
|
+
var yt = /*#__PURE__*/function () {
|
|
3943
|
+
function yt(e) {
|
|
3936
3944
|
var _this3 = this;
|
|
3937
|
-
_classCallCheck(this,
|
|
3945
|
+
_classCallCheck(this, yt);
|
|
3938
3946
|
this.iframeURL = e, this.oneTapStart = function (e) {
|
|
3939
3947
|
return _this3.call("oneTapStart", e);
|
|
3940
3948
|
}, this.oneTapSubmit = function (e) {
|
|
@@ -3943,11 +3951,11 @@ var kt = /*#__PURE__*/function () {
|
|
|
3943
3951
|
return _this3.call("parsedPhoneNumber", e);
|
|
3944
3952
|
};
|
|
3945
3953
|
}
|
|
3946
|
-
_createClass(
|
|
3954
|
+
_createClass(yt, [{
|
|
3947
3955
|
key: "frameClient",
|
|
3948
3956
|
get: function get() {
|
|
3949
3957
|
var e;
|
|
3950
|
-
return this._frameClient = null !== (e = this._frameClient) && void 0 !== e ? e : new
|
|
3958
|
+
return this._frameClient = null !== (e = this._frameClient) && void 0 !== e ? e : new ht(this.iframeURL), this._frameClient;
|
|
3951
3959
|
}
|
|
3952
3960
|
}, {
|
|
3953
3961
|
key: "call",
|
|
@@ -3955,20 +3963,20 @@ var kt = /*#__PURE__*/function () {
|
|
|
3955
3963
|
return this.frameClient.call(e, [t]);
|
|
3956
3964
|
}
|
|
3957
3965
|
}]);
|
|
3958
|
-
return
|
|
3966
|
+
return yt;
|
|
3959
3967
|
}();
|
|
3960
|
-
var
|
|
3961
|
-
function
|
|
3962
|
-
_classCallCheck(this,
|
|
3968
|
+
var wt = /*#__PURE__*/function () {
|
|
3969
|
+
function wt(e, t, r, n) {
|
|
3970
|
+
_classCallCheck(this, wt);
|
|
3963
3971
|
this._publicToken = e, this._subscriptionDataLayer = t, this.baseURL = r, this.additionalTelemetryDataFn = n, this.updateSessionToken = function () {
|
|
3964
3972
|
return null;
|
|
3965
|
-
}, this.eventLogger = new
|
|
3973
|
+
}, this.eventLogger = new Xe({
|
|
3966
3974
|
maxBatchSize: 15,
|
|
3967
3975
|
intervalDurationMs: 800,
|
|
3968
3976
|
logEventURL: this.buildSDKUrl("/events")
|
|
3969
3977
|
});
|
|
3970
3978
|
}
|
|
3971
|
-
_createClass(
|
|
3979
|
+
_createClass(wt, [{
|
|
3972
3980
|
key: "logEvent",
|
|
3973
3981
|
value: function logEvent(_ref) {
|
|
3974
3982
|
var e = _ref.name,
|
|
@@ -3988,9 +3996,9 @@ var yt = /*#__PURE__*/function () {
|
|
|
3988
3996
|
key: "createTelemetryBlob",
|
|
3989
3997
|
value: function createTelemetryBlob() {
|
|
3990
3998
|
return Object.assign(Object.assign({
|
|
3991
|
-
event_id: "event-id-".concat(
|
|
3992
|
-
app_session_id: "app-session-id-".concat(
|
|
3993
|
-
persistent_id: "persistent-id-".concat(
|
|
3999
|
+
event_id: "event-id-".concat(Le()),
|
|
4000
|
+
app_session_id: "app-session-id-".concat(Le()),
|
|
4001
|
+
persistent_id: "persistent-id-".concat(Le()),
|
|
3994
4002
|
client_sent_at: new Date().toISOString(),
|
|
3995
4003
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
3996
4004
|
}, this.additionalTelemetryDataFn()), {
|
|
@@ -3999,7 +4007,7 @@ var yt = /*#__PURE__*/function () {
|
|
|
3999
4007
|
},
|
|
4000
4008
|
sdk: {
|
|
4001
4009
|
identifier: "Stytch.js Javascript SDK",
|
|
4002
|
-
version: "4.9.
|
|
4010
|
+
version: "4.9.1"
|
|
4003
4011
|
}
|
|
4004
4012
|
});
|
|
4005
4013
|
}
|
|
@@ -4010,13 +4018,13 @@ var yt = /*#__PURE__*/function () {
|
|
|
4010
4018
|
t = _ref2.body,
|
|
4011
4019
|
r = _ref2.errorMessage,
|
|
4012
4020
|
n = _ref2.method;
|
|
4013
|
-
return
|
|
4021
|
+
return gt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
4014
4022
|
var i, o, s, a;
|
|
4015
4023
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
4016
4024
|
while (1) switch (_context3.prev = _context3.next) {
|
|
4017
4025
|
case 0:
|
|
4018
4026
|
i = this._subscriptionDataLayer.readSessionCookie().session_token, o = "Basic " + window.btoa(this._publicToken + ":" + (i || this._publicToken)), s = window.btoa(JSON.stringify(this.createTelemetryBlob())), a = window.location.origin;
|
|
4019
|
-
return _context3.abrupt("return",
|
|
4027
|
+
return _context3.abrupt("return", Ae({
|
|
4020
4028
|
basicAuthHeader: o,
|
|
4021
4029
|
body: t,
|
|
4022
4030
|
errorMessage: r,
|
|
@@ -4040,7 +4048,7 @@ var yt = /*#__PURE__*/function () {
|
|
|
4040
4048
|
r = _ref3.errorMessage,
|
|
4041
4049
|
n = _ref3.method,
|
|
4042
4050
|
i = _ref3.retryCallback;
|
|
4043
|
-
return
|
|
4051
|
+
return gt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
4044
4052
|
var o, s, a, c;
|
|
4045
4053
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
4046
4054
|
while (1) switch (_context4.prev = _context4.next) {
|
|
@@ -4055,9 +4063,9 @@ var yt = /*#__PURE__*/function () {
|
|
|
4055
4063
|
s = e.xSDKParentHostHeader,
|
|
4056
4064
|
a = e.body,
|
|
4057
4065
|
c = e.retryCallback;
|
|
4058
|
-
return
|
|
4066
|
+
return Te(this, void 0, void 0, _e().mark(function e() {
|
|
4059
4067
|
var u;
|
|
4060
|
-
return
|
|
4068
|
+
return _e().wrap(function (e) {
|
|
4061
4069
|
for (;;) switch (e.prev = e.next) {
|
|
4062
4070
|
case 0:
|
|
4063
4071
|
return u = {
|
|
@@ -4068,18 +4076,18 @@ var yt = /*#__PURE__*/function () {
|
|
|
4068
4076
|
xSDKClientHeader: o,
|
|
4069
4077
|
xSDKParentHostHeader: s,
|
|
4070
4078
|
body: a
|
|
4071
|
-
}, e.prev = 1, e.next = 4,
|
|
4079
|
+
}, e.prev = 1, e.next = 4, Ae(u);
|
|
4072
4080
|
case 4:
|
|
4073
4081
|
case 15:
|
|
4074
4082
|
return e.abrupt("return", e.sent);
|
|
4075
4083
|
case 7:
|
|
4076
|
-
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof
|
|
4084
|
+
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof xe)) {
|
|
4077
4085
|
e.next = 16;
|
|
4078
4086
|
break;
|
|
4079
4087
|
}
|
|
4080
4088
|
return e.next = 12, c(e.t0, u);
|
|
4081
4089
|
case 12:
|
|
4082
|
-
return u = e.sent, e.next = 15,
|
|
4090
|
+
return u = e.sent, e.next = 15, Ae(u);
|
|
4083
4091
|
case 16:
|
|
4084
4092
|
throw e.t0;
|
|
4085
4093
|
case 17:
|
|
@@ -4111,18 +4119,18 @@ var yt = /*#__PURE__*/function () {
|
|
|
4111
4119
|
return "".concat(this.baseURL, "/sdk/v1").concat(e);
|
|
4112
4120
|
}
|
|
4113
4121
|
}]);
|
|
4114
|
-
return
|
|
4122
|
+
return wt;
|
|
4115
4123
|
}();
|
|
4116
|
-
function
|
|
4124
|
+
function St(e) {
|
|
4117
4125
|
var t = e.toString(16);
|
|
4118
4126
|
return 1 === t.length && (t = "0" + t), t;
|
|
4119
4127
|
}
|
|
4120
|
-
var
|
|
4121
|
-
function
|
|
4122
|
-
_classCallCheck(this,
|
|
4128
|
+
var Ct = /*#__PURE__*/function () {
|
|
4129
|
+
function Ct(e, t) {
|
|
4130
|
+
_classCallCheck(this, Ct);
|
|
4123
4131
|
this._dataLayer = e, this.namespace = t;
|
|
4124
4132
|
}
|
|
4125
|
-
_createClass(
|
|
4133
|
+
_createClass(Ct, [{
|
|
4126
4134
|
key: "key",
|
|
4127
4135
|
value: function key() {
|
|
4128
4136
|
return "PKCE_VERIFIER:" + this.namespace;
|
|
@@ -4130,13 +4138,13 @@ var St = /*#__PURE__*/function () {
|
|
|
4130
4138
|
}, {
|
|
4131
4139
|
key: "startPKCETransaction",
|
|
4132
4140
|
value: function startPKCETransaction() {
|
|
4133
|
-
return
|
|
4141
|
+
return gt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
4134
4142
|
var e;
|
|
4135
4143
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
4136
4144
|
while (1) switch (_context5.prev = _context5.next) {
|
|
4137
4145
|
case 0:
|
|
4138
4146
|
_context5.next = 2;
|
|
4139
|
-
return
|
|
4147
|
+
return Ct.createProofkeyPair();
|
|
4140
4148
|
case 2:
|
|
4141
4149
|
e = _context5.sent;
|
|
4142
4150
|
return _context5.abrupt("return", (this._dataLayer.setItem(this.key(), JSON.stringify(e)), e));
|
|
@@ -4154,7 +4162,7 @@ var St = /*#__PURE__*/function () {
|
|
|
4154
4162
|
if (null !== e) try {
|
|
4155
4163
|
return JSON.parse(e);
|
|
4156
4164
|
} catch (e) {
|
|
4157
|
-
return void
|
|
4165
|
+
return void qe("Found malformed Proof Key pair in localstorage.");
|
|
4158
4166
|
}
|
|
4159
4167
|
}
|
|
4160
4168
|
}, {
|
|
@@ -4165,7 +4173,7 @@ var St = /*#__PURE__*/function () {
|
|
|
4165
4173
|
}], [{
|
|
4166
4174
|
key: "createProofkeyPair",
|
|
4167
4175
|
value: function createProofkeyPair() {
|
|
4168
|
-
return
|
|
4176
|
+
return gt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
4169
4177
|
var _String$fromCharCode;
|
|
4170
4178
|
var e, t, r, n;
|
|
4171
4179
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
@@ -4173,7 +4181,7 @@ var St = /*#__PURE__*/function () {
|
|
|
4173
4181
|
case 0:
|
|
4174
4182
|
e = new Uint32Array(16);
|
|
4175
4183
|
window.crypto.getRandomValues(e);
|
|
4176
|
-
t = Array.from(e).map(
|
|
4184
|
+
t = Array.from(e).map(St).join("");
|
|
4177
4185
|
_context6.next = 5;
|
|
4178
4186
|
return window.crypto.subtle.digest("SHA-256", new TextEncoder().encode(t));
|
|
4179
4187
|
case 5:
|
|
@@ -4190,9 +4198,9 @@ var St = /*#__PURE__*/function () {
|
|
|
4190
4198
|
}));
|
|
4191
4199
|
}
|
|
4192
4200
|
}]);
|
|
4193
|
-
return
|
|
4201
|
+
return Ct;
|
|
4194
4202
|
}();
|
|
4195
|
-
var
|
|
4203
|
+
var Pt = function Pt(e) {
|
|
4196
4204
|
return (document.cookie ? document.cookie.split("; ") : []).filter(function (t) {
|
|
4197
4205
|
var _t$split = t.split("="),
|
|
4198
4206
|
_t$split2 = _slicedToArray(_t$split, 1),
|
|
@@ -4201,17 +4209,17 @@ var Ct = function Ct(e) {
|
|
|
4201
4209
|
}).length > 1;
|
|
4202
4210
|
};
|
|
4203
4211
|
/*! js-cookie v3.0.1 | MIT */
|
|
4204
|
-
function
|
|
4212
|
+
function Tt(e) {
|
|
4205
4213
|
for (var t = 1; t < arguments.length; t++) {
|
|
4206
4214
|
var r = arguments[t];
|
|
4207
4215
|
for (var n in r) e[n] = r[n];
|
|
4208
4216
|
}
|
|
4209
4217
|
return e;
|
|
4210
4218
|
}
|
|
4211
|
-
var
|
|
4219
|
+
var Ot = function e(t, r) {
|
|
4212
4220
|
function n(e, n, i) {
|
|
4213
4221
|
if ("undefined" != typeof document) {
|
|
4214
|
-
"number" == typeof (i =
|
|
4222
|
+
"number" == typeof (i = Tt({}, r, i)).expires && (i.expires = new Date(Date.now() + 864e5 * i.expires)), i.expires && (i.expires = i.expires.toUTCString()), e = encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
|
|
4215
4223
|
var o = "";
|
|
4216
4224
|
for (var s in i) i[s] && (o += "; " + s, !0 !== i[s] && (o += "=" + i[s].split(";")[0]));
|
|
4217
4225
|
return document.cookie = e + "=" + t.write(n, e) + o;
|
|
@@ -4233,15 +4241,15 @@ var Tt = function e(t, r) {
|
|
|
4233
4241
|
}
|
|
4234
4242
|
},
|
|
4235
4243
|
remove: function remove(e, t) {
|
|
4236
|
-
n(e, "",
|
|
4244
|
+
n(e, "", Tt({}, t, {
|
|
4237
4245
|
expires: -1
|
|
4238
4246
|
}));
|
|
4239
4247
|
},
|
|
4240
4248
|
withAttributes: function withAttributes(t) {
|
|
4241
|
-
return e(this.converter,
|
|
4249
|
+
return e(this.converter, Tt({}, this.attributes, t));
|
|
4242
4250
|
},
|
|
4243
4251
|
withConverter: function withConverter(t) {
|
|
4244
|
-
return e(
|
|
4252
|
+
return e(Tt({}, this.converter, t), this.attributes);
|
|
4245
4253
|
}
|
|
4246
4254
|
}, {
|
|
4247
4255
|
attributes: {
|
|
@@ -4261,37 +4269,37 @@ var Tt = function e(t, r) {
|
|
|
4261
4269
|
}, {
|
|
4262
4270
|
path: "/"
|
|
4263
4271
|
});
|
|
4264
|
-
var
|
|
4272
|
+
var xt = function xt(e) {
|
|
4265
4273
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
4266
4274
|
return "stytch_sdk_state_".concat(e).concat(t ? "::".concat(t) : "");
|
|
4267
4275
|
},
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
clearTimeout(
|
|
4276
|
+
At = new Map(),
|
|
4277
|
+
Et = function Et(e) {
|
|
4278
|
+
clearTimeout(At.get(e));
|
|
4271
4279
|
},
|
|
4272
|
-
|
|
4273
|
-
|
|
4280
|
+
Dt = function Dt(e, t, r) {
|
|
4281
|
+
Et(e);
|
|
4274
4282
|
var n = setTimeout(function () {
|
|
4275
|
-
void 0 ===
|
|
4283
|
+
void 0 === Ot.get(e) && Ot.set(e, t, r);
|
|
4276
4284
|
}, 10);
|
|
4277
|
-
return
|
|
4285
|
+
return At.set(e, n), Ot.set(e, t, r);
|
|
4278
4286
|
};
|
|
4279
|
-
var
|
|
4280
|
-
function
|
|
4287
|
+
var It = /*#__PURE__*/function () {
|
|
4288
|
+
function It(e, t) {
|
|
4281
4289
|
var _this4 = this;
|
|
4282
|
-
_classCallCheck(this,
|
|
4290
|
+
_classCallCheck(this, It);
|
|
4283
4291
|
this.browserSessionStorage = {
|
|
4284
4292
|
getItem: function getItem(e) {
|
|
4285
|
-
return sessionStorage.getItem(
|
|
4293
|
+
return sessionStorage.getItem(xt(_this4.publicToken, e));
|
|
4286
4294
|
},
|
|
4287
4295
|
setItem: function setItem(e, t) {
|
|
4288
|
-
return sessionStorage.setItem(
|
|
4296
|
+
return sessionStorage.setItem(xt(_this4.publicToken, e), t);
|
|
4289
4297
|
},
|
|
4290
4298
|
removeItem: function removeItem(e) {
|
|
4291
|
-
return sessionStorage.removeItem(
|
|
4299
|
+
return sessionStorage.removeItem(xt(_this4.publicToken, e));
|
|
4292
4300
|
}
|
|
4293
|
-
}, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (
|
|
4294
|
-
var r = localStorage.getItem(
|
|
4301
|
+
}, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (Ve("SubscriptionDataLayer").isOptionalString("cookieOptions.opaqueTokenCookieName", t.cookieOptions.opaqueTokenCookieName).isOptionalString("cookieOptions.jwtCookieName", t.cookieOptions.jwtCookieName).isOptionalString("cookieOptions.istCookieName", t.cookieOptions.istCookieName).isOptionalString("cookieOptions.path", t.cookieOptions.path).isOptionalString("cookieOptions.domain", t.cookieOptions.domain), this._jwtCookieName = t.cookieOptions.jwtCookieName || null, this._opaqueTokenCookieName = t.cookieOptions.opaqueTokenCookieName || null, this._cookiePath = t.cookieOptions.path || null, this._domain = t.cookieOptions.domain || null, this._cookieAvailableToSubdomains = t.cookieOptions.availableToSubdomains || !1, this._istCookieName = t.cookieOptions.istCookieName || null) : (this._opaqueTokenCookieName = null, this._jwtCookieName = null, this._cookiePath = null, this._domain = null, this._cookieAvailableToSubdomains = !1, this._istCookieName = null);
|
|
4302
|
+
var r = localStorage.getItem(xt(this.publicToken));
|
|
4295
4303
|
if (!r) return;
|
|
4296
4304
|
var n;
|
|
4297
4305
|
try {
|
|
@@ -4301,7 +4309,7 @@ var Dt = /*#__PURE__*/function () {
|
|
|
4301
4309
|
}
|
|
4302
4310
|
this.state = n;
|
|
4303
4311
|
}
|
|
4304
|
-
_createClass(
|
|
4312
|
+
_createClass(It, [{
|
|
4305
4313
|
key: "opaqueTokenCookieName",
|
|
4306
4314
|
get: function get() {
|
|
4307
4315
|
var e;
|
|
@@ -4323,14 +4331,14 @@ var Dt = /*#__PURE__*/function () {
|
|
|
4323
4331
|
key: "readSessionCookie",
|
|
4324
4332
|
value: function readSessionCookie() {
|
|
4325
4333
|
return {
|
|
4326
|
-
session_token:
|
|
4327
|
-
session_jwt:
|
|
4334
|
+
session_token: Ot.get(this.opaqueTokenCookieName),
|
|
4335
|
+
session_jwt: Ot.get(this.jwtCookieName)
|
|
4328
4336
|
};
|
|
4329
4337
|
}
|
|
4330
4338
|
}, {
|
|
4331
4339
|
key: "readIntermediateSessionTokenCookie",
|
|
4332
4340
|
value: function readIntermediateSessionTokenCookie() {
|
|
4333
|
-
return
|
|
4341
|
+
return Ot.get(this.istCookieName);
|
|
4334
4342
|
}
|
|
4335
4343
|
}, {
|
|
4336
4344
|
key: "writeSessionCookie",
|
|
@@ -4339,32 +4347,32 @@ var Dt = /*#__PURE__*/function () {
|
|
|
4339
4347
|
var o = e.state,
|
|
4340
4348
|
s = e.session_token,
|
|
4341
4349
|
a = e.session_jwt,
|
|
4342
|
-
c =
|
|
4350
|
+
c = It.generateCookieOpts({
|
|
4343
4351
|
expiresAt: null !== (r = null === (t = null == o ? void 0 : o.session) || void 0 === t ? void 0 : t.expires_at) && void 0 !== r ? r : "",
|
|
4344
4352
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4345
4353
|
path: this._cookiePath,
|
|
4346
4354
|
domain: this._domain
|
|
4347
4355
|
});
|
|
4348
|
-
|
|
4349
|
-
var u =
|
|
4356
|
+
Dt(this.opaqueTokenCookieName, s, c), Dt(this.jwtCookieName, a, c);
|
|
4357
|
+
var u = It.generateCookieOpts({
|
|
4350
4358
|
expiresAt: null !== (i = null === (n = null == o ? void 0 : o.session) || void 0 === n ? void 0 : n.expires_at) && void 0 !== i ? i : "",
|
|
4351
4359
|
availableToSubdomains: !this._cookieAvailableToSubdomains,
|
|
4352
4360
|
path: this._cookiePath,
|
|
4353
4361
|
domain: this._domain
|
|
4354
4362
|
});
|
|
4355
|
-
|
|
4363
|
+
Pt(this.jwtCookieName) && Ot.remove(this.jwtCookieName, u), Pt(this.opaqueTokenCookieName) && Ot.remove(this.opaqueTokenCookieName, u), Pt(this.jwtCookieName) && qe("Could not remove extraneous JWT cookie. This might happen if the cookie has been set using multiple `path` settings, and may produce unwanted behavior."), Pt(this.opaqueTokenCookieName) && qe("Could not remove extraneous opaque token cookie.");
|
|
4356
4364
|
}
|
|
4357
4365
|
}, {
|
|
4358
4366
|
key: "writeIntermediateSessionTokenCookie",
|
|
4359
4367
|
value: function writeIntermediateSessionTokenCookie(e) {
|
|
4360
4368
|
var t = new Date(Date.now() + 6e5),
|
|
4361
|
-
r =
|
|
4369
|
+
r = It.generateCookieOpts({
|
|
4362
4370
|
expiresAt: t.toString(),
|
|
4363
4371
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4364
4372
|
path: this._cookiePath,
|
|
4365
4373
|
domain: this._domain
|
|
4366
4374
|
});
|
|
4367
|
-
|
|
4375
|
+
Dt(this.istCookieName, e, r);
|
|
4368
4376
|
}
|
|
4369
4377
|
}, {
|
|
4370
4378
|
key: "removeSessionCookie",
|
|
@@ -4383,38 +4391,38 @@ var Dt = /*#__PURE__*/function () {
|
|
|
4383
4391
|
[!0, !1].forEach(function (t) {
|
|
4384
4392
|
[_this5._cookiePath, null].forEach(function (r) {
|
|
4385
4393
|
[_this5._domain, null].forEach(function (n) {
|
|
4386
|
-
var i =
|
|
4394
|
+
var i = It.generateCookieOpts({
|
|
4387
4395
|
expiresAt: new Date(0).toString(),
|
|
4388
4396
|
availableToSubdomains: t,
|
|
4389
4397
|
path: r,
|
|
4390
4398
|
domain: n
|
|
4391
4399
|
});
|
|
4392
4400
|
e.forEach(function (e) {
|
|
4393
|
-
|
|
4401
|
+
Ot.remove(e, i);
|
|
4394
4402
|
});
|
|
4395
4403
|
});
|
|
4396
4404
|
});
|
|
4397
|
-
}), e.forEach(
|
|
4405
|
+
}), e.forEach(Et);
|
|
4398
4406
|
}
|
|
4399
4407
|
}, {
|
|
4400
4408
|
key: "syncToLocalStorage",
|
|
4401
4409
|
value: function syncToLocalStorage() {
|
|
4402
|
-
localStorage.setItem(
|
|
4410
|
+
localStorage.setItem(xt(this.publicToken), JSON.stringify(this.state));
|
|
4403
4411
|
}
|
|
4404
4412
|
}, {
|
|
4405
4413
|
key: "getItem",
|
|
4406
4414
|
value: function getItem(e) {
|
|
4407
|
-
return localStorage.getItem(
|
|
4415
|
+
return localStorage.getItem(xt(this.publicToken, e));
|
|
4408
4416
|
}
|
|
4409
4417
|
}, {
|
|
4410
4418
|
key: "setItem",
|
|
4411
4419
|
value: function setItem(e, t) {
|
|
4412
|
-
return localStorage.setItem(
|
|
4420
|
+
return localStorage.setItem(xt(this.publicToken, e), t);
|
|
4413
4421
|
}
|
|
4414
4422
|
}, {
|
|
4415
4423
|
key: "removeItem",
|
|
4416
4424
|
value: function removeItem(e) {
|
|
4417
|
-
return localStorage.removeItem(
|
|
4425
|
+
return localStorage.removeItem(xt(this.publicToken, e));
|
|
4418
4426
|
}
|
|
4419
4427
|
}], [{
|
|
4420
4428
|
key: "generateCookieOpts",
|
|
@@ -4430,30 +4438,30 @@ var Dt = /*#__PURE__*/function () {
|
|
|
4430
4438
|
return e && (i.path = e), Boolean("localhost" === window.location.hostname || "[::1]" === window.location.hostname || window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)) ? i.secure = !1 : (r && (i.domain = t || window.location.host), i.secure = !0), i;
|
|
4431
4439
|
}
|
|
4432
4440
|
}]);
|
|
4433
|
-
return
|
|
4441
|
+
return It;
|
|
4434
4442
|
}();
|
|
4435
|
-
var
|
|
4436
|
-
_inherits(
|
|
4437
|
-
function
|
|
4438
|
-
_classCallCheck(this,
|
|
4439
|
-
return _callSuper(this,
|
|
4443
|
+
var Rt = /*#__PURE__*/function (_It) {
|
|
4444
|
+
_inherits(Rt, _It);
|
|
4445
|
+
function Rt() {
|
|
4446
|
+
_classCallCheck(this, Rt);
|
|
4447
|
+
return _callSuper(this, Rt, arguments);
|
|
4440
4448
|
}
|
|
4441
|
-
return _createClass(
|
|
4442
|
-
}(
|
|
4443
|
-
var
|
|
4444
|
-
|
|
4449
|
+
return _createClass(Rt);
|
|
4450
|
+
}(It);
|
|
4451
|
+
var Ft = Symbol["for"]("__stytch_b2b_DataLayer"),
|
|
4452
|
+
jt = function jt(e, t) {
|
|
4445
4453
|
var r = function () {
|
|
4446
4454
|
var e = window;
|
|
4447
|
-
return e[
|
|
4455
|
+
return e[Ft] || (e[Ft] = {}), e[Ft];
|
|
4448
4456
|
}();
|
|
4449
|
-
return r[e] || (r[e] = new
|
|
4457
|
+
return r[e] || (r[e] = new Rt(e, t)), r[e];
|
|
4450
4458
|
},
|
|
4451
|
-
|
|
4459
|
+
Lt = function Lt(e, t) {
|
|
4452
4460
|
Object.values(e).forEach(function (e) {
|
|
4453
4461
|
return e(t);
|
|
4454
4462
|
});
|
|
4455
4463
|
},
|
|
4456
|
-
|
|
4464
|
+
Mt = function () {
|
|
4457
4465
|
var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
4458
4466
|
_ref5$KEYS_TO_EXCLUDE = _ref5.KEYS_TO_EXCLUDE,
|
|
4459
4467
|
e = _ref5$KEYS_TO_EXCLUDE === void 0 ? [] : _ref5$KEYS_TO_EXCLUDE;
|
|
@@ -4475,12 +4483,12 @@ var Rt = Symbol["for"]("__stytch_b2b_DataLayer"),
|
|
|
4475
4483
|
}({
|
|
4476
4484
|
KEYS_TO_EXCLUDE: ["last_accessed_at"]
|
|
4477
4485
|
});
|
|
4478
|
-
var
|
|
4479
|
-
function
|
|
4486
|
+
var Bt = /*#__PURE__*/function () {
|
|
4487
|
+
function Bt(e, t) {
|
|
4480
4488
|
var _this6 = this;
|
|
4481
|
-
_classCallCheck(this,
|
|
4489
|
+
_classCallCheck(this, Bt);
|
|
4482
4490
|
this._publicToken = e, this._datalayer = t, this.fromCache = !0, this._listen = function (e) {
|
|
4483
|
-
if (e.key !==
|
|
4491
|
+
if (e.key !== xt(_this6._publicToken)) return;
|
|
4484
4492
|
var t = null === e.newValue || "null" === e.newValue ? null : JSON.parse(e.newValue);
|
|
4485
4493
|
_this6.updateState(t, !0);
|
|
4486
4494
|
}, window.addEventListener("storage", this._listen);
|
|
@@ -4488,7 +4496,7 @@ var Mt = /*#__PURE__*/function () {
|
|
|
4488
4496
|
r = _this$_datalayer$read.session_token;
|
|
4489
4497
|
r || this.destroySession();
|
|
4490
4498
|
}
|
|
4491
|
-
_createClass(
|
|
4499
|
+
_createClass(Bt, [{
|
|
4492
4500
|
key: "getTokens",
|
|
4493
4501
|
value: function getTokens() {
|
|
4494
4502
|
var _this$_datalayer$read2 = this._datalayer.readSessionCookie(),
|
|
@@ -4526,7 +4534,7 @@ var Mt = /*#__PURE__*/function () {
|
|
|
4526
4534
|
r = null === e.state ? null : Object.assign(Object.assign({}, this._datalayer.state), e.state);
|
|
4527
4535
|
this._datalayer.state = r;
|
|
4528
4536
|
var n = this.getFromCache();
|
|
4529
|
-
this.setCacheRefreshed(), !n &&
|
|
4537
|
+
this.setCacheRefreshed(), !n && Mt(t, r) || Lt(this._datalayer.subscriptions, r);
|
|
4530
4538
|
}
|
|
4531
4539
|
}, {
|
|
4532
4540
|
key: "updateStateAndTokens",
|
|
@@ -4542,8 +4550,8 @@ var Mt = /*#__PURE__*/function () {
|
|
|
4542
4550
|
this._datalayer.state = n;
|
|
4543
4551
|
var i = this.getFromCache();
|
|
4544
4552
|
this.setCacheRefreshed();
|
|
4545
|
-
var o = !
|
|
4546
|
-
(i || o) && (
|
|
4553
|
+
var o = !Mt(r, n);
|
|
4554
|
+
(i || o) && (Lt(this._datalayer.subscriptions, n), o && !t && this._datalayer.syncToLocalStorage());
|
|
4547
4555
|
}
|
|
4548
4556
|
}, {
|
|
4549
4557
|
key: "updateTokens",
|
|
@@ -4593,14 +4601,14 @@ var Mt = /*#__PURE__*/function () {
|
|
|
4593
4601
|
this.fromCache = !1;
|
|
4594
4602
|
}
|
|
4595
4603
|
}]);
|
|
4596
|
-
return
|
|
4604
|
+
return Bt;
|
|
4597
4605
|
}();
|
|
4598
|
-
var
|
|
4599
|
-
_inherits(
|
|
4600
|
-
function
|
|
4606
|
+
var Kt = /*#__PURE__*/function (_Bt) {
|
|
4607
|
+
_inherits(Kt, _Bt);
|
|
4608
|
+
function Kt() {
|
|
4601
4609
|
var _this7;
|
|
4602
|
-
_classCallCheck(this,
|
|
4603
|
-
_this7 = _callSuper(this,
|
|
4610
|
+
_classCallCheck(this, Kt);
|
|
4611
|
+
_this7 = _callSuper(this, Kt, arguments), _this7.updateMember = function (e) {
|
|
4604
4612
|
return _this7.updateState({
|
|
4605
4613
|
member: e
|
|
4606
4614
|
});
|
|
@@ -4620,16 +4628,16 @@ var Bt = /*#__PURE__*/function (_Mt) {
|
|
|
4620
4628
|
};
|
|
4621
4629
|
return _this7;
|
|
4622
4630
|
}
|
|
4623
|
-
return _createClass(
|
|
4624
|
-
}(
|
|
4625
|
-
var
|
|
4626
|
-
var
|
|
4631
|
+
return _createClass(Kt);
|
|
4632
|
+
}(Bt);
|
|
4633
|
+
var zt = Symbol["for"]("stytch__internal_b2b");
|
|
4634
|
+
var Nt = /*#__PURE__*/_createClass(function Nt(e, t) {
|
|
4627
4635
|
var _this8 = this;
|
|
4628
|
-
_classCallCheck(this,
|
|
4636
|
+
_classCallCheck(this, Nt);
|
|
4629
4637
|
var r;
|
|
4630
4638
|
!function (e) {
|
|
4631
4639
|
if ("undefined" == typeof window) throw new Error("The ".concat(e, " is not compatible with server-side environments.\nIf using nextjs, use the create").concat(e, " method instead.\n```\n").concat("import { createStytchB2BHeadlessClient } from '@stytch/nextjs/b2b';\n \n const stytch = createStytchB2BHeadlessClient('public-token-...');\n ", "\n```\n"));
|
|
4632
|
-
}("StytchB2BHeadlessClient"), "string" != typeof (r = e) ?
|
|
4640
|
+
}("StytchB2BHeadlessClient"), "string" != typeof (r = e) ? qe("Public token is malformed. Expected a string, got ".concat(fe(r), ".").concat(He)) : "" === r ? qe('Public token is malformed. Expected "public-token-...", got an empty string.'.concat(He)) : r.startsWith("public-token-") || qe('Public token is malformed. Expected "public-token-...", got '.concat(r, ".").concat(He));
|
|
4633
4641
|
var n = t,
|
|
4634
4642
|
i = {
|
|
4635
4643
|
cookieOptions: null == (o = n) ? void 0 : o.cookieOptions,
|
|
@@ -4642,32 +4650,32 @@ var zt = /*#__PURE__*/_createClass(function zt(e, t) {
|
|
|
4642
4650
|
}
|
|
4643
4651
|
};
|
|
4644
4652
|
var o, s, a, c, u, l, d, h, p, f, _;
|
|
4645
|
-
this._dataLayer =
|
|
4653
|
+
this._dataLayer = jt(e, n), this._subscriptionService = new Kt(e, this._dataLayer), this._stateChangeClient = new _t(this._subscriptionService, {}), this.onStateChange = function () {
|
|
4646
4654
|
var _this8$_stateChangeCl;
|
|
4647
4655
|
return (_this8$_stateChangeCl = _this8._stateChangeClient).onStateChange.apply(_this8$_stateChangeCl, arguments);
|
|
4648
4656
|
};
|
|
4649
|
-
var m = new
|
|
4650
|
-
this._networkClient = new
|
|
4657
|
+
var m = new Ct(this._dataLayer, "passwords");
|
|
4658
|
+
this._networkClient = new wt(e, this._dataLayer, i.endpoints.sdkBackendURL, function () {
|
|
4651
4659
|
var e, t, r, n;
|
|
4652
4660
|
return {
|
|
4653
4661
|
stytch_member_id: null === (t = null === (e = _this8._dataLayer.state) || void 0 === e ? void 0 : e.member) || void 0 === t ? void 0 : t.member_id,
|
|
4654
4662
|
stytch_member_session_id: null === (n = null === (r = _this8._dataLayer.state) || void 0 === r ? void 0 : r.session) || void 0 === n ? void 0 : n.member_session_id
|
|
4655
4663
|
};
|
|
4656
4664
|
});
|
|
4657
|
-
var v = new
|
|
4658
|
-
b = new
|
|
4659
|
-
g = new
|
|
4660
|
-
k = new
|
|
4661
|
-
this.organization = new
|
|
4665
|
+
var v = new bt(e, this._networkClient, this._dataLayer),
|
|
4666
|
+
b = new kt(v.getAsync()),
|
|
4667
|
+
g = new Ye(e, i.endpoints.dfpBackendURL, v.getAsync(), b.executeRecaptcha),
|
|
4668
|
+
k = new yt(i.endpoints.clientsideServicesIframeURL);
|
|
4669
|
+
this.organization = new rt(this._networkClient, this._subscriptionService), this.member = new et(this._networkClient, this._subscriptionService), this.self = new et(this._networkClient, this._subscriptionService), this.session = new it(this._networkClient, this._subscriptionService), this.magicLinks = new Qe(this._networkClient, this._subscriptionService, new Ct(this._dataLayer, "magic_links"), m, v.getAsync(), g), this.oauth = new nt(this._networkClient, this._subscriptionService, new Ct(this._dataLayer, "oauth"), v.getAsync(), {
|
|
4662
4670
|
publicToken: e,
|
|
4663
4671
|
testAPIURL: i.endpoints.testAPIURL,
|
|
4664
4672
|
liveAPIURL: i.endpoints.liveAPIURL
|
|
4665
|
-
}, g), this.sso = new
|
|
4673
|
+
}, g), this.sso = new tt(this._networkClient, this._subscriptionService, new Ct(this._dataLayer, "sso"), v.getAsync(), {
|
|
4666
4674
|
publicToken: e,
|
|
4667
4675
|
testAPIURL: i.endpoints.testAPIURL,
|
|
4668
4676
|
liveAPIURL: i.endpoints.liveAPIURL
|
|
4669
|
-
}), this.discovery = new
|
|
4670
|
-
var y = new
|
|
4677
|
+
}), this.discovery = new ot(this._networkClient, this._subscriptionService), this.passwords = new at(this._networkClient, this._subscriptionService, m, v.getAsync(), g), this.otps = new ct(this._networkClient, this._subscriptionService, g), this.totp = new ut(this._networkClient, this._subscriptionService, g), this.recoveryCodes = new lt(this._networkClient, this._subscriptionService, g), this.rbac = new dt(v.getSync(), v.getAsync(), this._subscriptionService), this._sessionManager = new ft(this._subscriptionService, this.session);
|
|
4678
|
+
var y = new pt(this._networkClient, g);
|
|
4671
4679
|
this._dataLayer.readSessionCookie().session_token && this._sessionManager.performBackgroundRefresh(), this._networkClient.logEvent({
|
|
4672
4680
|
name: "b2b_sdk_instance_instantiated",
|
|
4673
4681
|
details: {
|
|
@@ -4677,7 +4685,7 @@ var zt = /*#__PURE__*/_createClass(function zt(e, t) {
|
|
|
4677
4685
|
}
|
|
4678
4686
|
});
|
|
4679
4687
|
(function (e, t) {
|
|
4680
|
-
Object.assign(e, _defineProperty({},
|
|
4688
|
+
Object.assign(e, _defineProperty({}, zt, t));
|
|
4681
4689
|
})(this, {
|
|
4682
4690
|
bootstrap: v,
|
|
4683
4691
|
clientsideServices: k,
|
|
@@ -4687,4 +4695,4 @@ var zt = /*#__PURE__*/_createClass(function zt(e, t) {
|
|
|
4687
4695
|
networkClient: this._networkClient
|
|
4688
4696
|
});
|
|
4689
4697
|
});
|
|
4690
|
-
export { k as AuthFlowType, y as B2BMFAProducts, w as B2BOAuthProviders, g as B2BProducts,
|
|
4698
|
+
export { k as AuthFlowType, y as B2BMFAProducts, w as B2BOAuthProviders, g as B2BProducts, ee as BiometricsFailedError, L as BiometricsUnavailableError, J as ChallengeSigningFailedError, U as DeviceCredentialsNotAllowedError, X as FailedCodeChallengeError, Q as FailedToDecryptDataError, F as InternalError, G as InvalidAuthorizationCredentialError, ie as InvalidCredentialTypeError, re as InvalidRedirectSchemeError, te as InvalidStartUrlError, se as JSONDataNotConvertibleToStringError, M as KeyInvalidatedError, B as KeystoreUnavailableError, oe as MissingAttestationObjectError, H as MissingAuthorizationCredentialIDTokenError, q as MissingGoogleClientIDError, W as MissingPKCEError, Y as MissingPublicKeyError, ne as MissingUrlError, K as NoBiometricsEnrolledError, j as NoBiometricsRegistrationError, V as NoCredentialsPresentError, R as NoCurrentSessionError, p as OAuthProviders, m as OTPMethods, _ as OneTapPositions, ce as PasskeysInvalidEncoding, ue as PasskeysMisconfigured, Z as PasskeysUnsupportedError, h as Products, b as RNUIProducts, ae as RandomNumberGenerationFailed, S as SDKAPIUnreachableError, $ as SDKNotConfiguredError, le as SignInWithAppleMisconfigured, D as StytchAPIError, E as StytchAPISchemaError, A as StytchAPIUnreachableError, Nt as StytchB2BHeadlessClient, x as StytchError, v as StytchEventType, T as StytchSDKAPIError, I as StytchSDKError, P as StytchSDKSchemaError, C as StytchSDKUsageError, O as UNRECOVERABLE_ERROR_TYPES, z as UserCancellationError, N as UserLockedOutError, f as Wallets, de as errorToStytchError };
|