@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
|
@@ -181,19 +181,19 @@ var g,
|
|
|
181
181
|
return a(t, c(Error)), r(t);
|
|
182
182
|
}(),
|
|
183
183
|
T = ["unauthorized_credentials", "user_unauthenticated", "invalid_secret_authentication", "session_not_found"],
|
|
184
|
-
|
|
184
|
+
E = function (e) {
|
|
185
185
|
function t(e, r) {
|
|
186
186
|
var n;
|
|
187
187
|
return i(this, t), (n = o(this, t, [r])).name = e, n;
|
|
188
188
|
}
|
|
189
189
|
return a(t, c(Error)), r(t);
|
|
190
190
|
}(),
|
|
191
|
-
|
|
191
|
+
O = function (e) {
|
|
192
192
|
function t(e) {
|
|
193
193
|
var r;
|
|
194
194
|
return i(this, t), r = o(this, t, ["StytchAPIUnreachableError", e]), Object.setPrototypeOf(s(r), t.prototype), r;
|
|
195
195
|
}
|
|
196
|
-
return a(t,
|
|
196
|
+
return a(t, E), r(t);
|
|
197
197
|
}(),
|
|
198
198
|
A = function (e) {
|
|
199
199
|
function t(e) {
|
|
@@ -204,7 +204,7 @@ var g,
|
|
|
204
204
|
}).join("\n");
|
|
205
205
|
return o(this, t, ["StytchAPISchemaError", "Request does not match expected schema\n".concat(n)]);
|
|
206
206
|
}
|
|
207
|
-
return a(t,
|
|
207
|
+
return a(t, E), r(t);
|
|
208
208
|
}(),
|
|
209
209
|
D = function (e) {
|
|
210
210
|
function t(e) {
|
|
@@ -217,14 +217,14 @@ var g,
|
|
|
217
217
|
u = e.request_id;
|
|
218
218
|
return (r = o(this, t, ["StytchAPIError", "[".concat(n, "] ").concat(s, "\n") + "".concat(a, "\n") + "See ".concat(c, " for more information.\n") + (u ? "request_id: ".concat(u, "\n") : "")])).error_type = s, r.error_message = a, r.error_url = c, r.request_id = u, r.status_code = n, r;
|
|
219
219
|
}
|
|
220
|
-
return a(t,
|
|
220
|
+
return a(t, E), r(t);
|
|
221
221
|
}(),
|
|
222
222
|
I = function (e) {
|
|
223
223
|
function t(e, r, n) {
|
|
224
224
|
var s;
|
|
225
225
|
return i(this, t), (s = o(this, t, [e, r])).options = n, s;
|
|
226
226
|
}
|
|
227
|
-
return a(t,
|
|
227
|
+
return a(t, E), r(t);
|
|
228
228
|
}(),
|
|
229
229
|
R = function (e) {
|
|
230
230
|
function t() {
|
|
@@ -312,116 +312,122 @@ var g,
|
|
|
312
312
|
}(),
|
|
313
313
|
V = function (e) {
|
|
314
314
|
function t() {
|
|
315
|
-
return i(this, t), o(this, t, ["
|
|
315
|
+
return i(this, t), o(this, t, ["NoCredentialsPresentError", "The user did not provide credentials for a Google OneTap attempt"]);
|
|
316
316
|
}
|
|
317
317
|
return a(t, I), r(t);
|
|
318
318
|
}(),
|
|
319
319
|
Y = function (e) {
|
|
320
320
|
function t() {
|
|
321
|
-
return i(this, t), o(this, t, ["
|
|
321
|
+
return i(this, t), o(this, t, ["MissingPublicKeyError", "Failed to retrieve the public key. Add a new biometric registration."]);
|
|
322
322
|
}
|
|
323
323
|
return a(t, I), r(t);
|
|
324
324
|
}(),
|
|
325
325
|
J = function (e) {
|
|
326
326
|
function t() {
|
|
327
|
-
return i(this, t), o(this, t, ["
|
|
327
|
+
return i(this, t), o(this, t, ["ChallengeSigningFailedError", "Failed to sign the challenge with the key."]);
|
|
328
328
|
}
|
|
329
329
|
return a(t, I), r(t);
|
|
330
330
|
}(),
|
|
331
331
|
$ = function (e) {
|
|
332
332
|
function t() {
|
|
333
|
-
return i(this, t), o(this, t, ["
|
|
333
|
+
return i(this, t), o(this, t, ["SDKNotConfiguredError", "Stytch client is not confiured. You must call the configure method before using the SDK"]);
|
|
334
334
|
}
|
|
335
335
|
return a(t, I), r(t);
|
|
336
336
|
}(),
|
|
337
337
|
X = function (e) {
|
|
338
338
|
function t() {
|
|
339
|
-
return i(this, t), o(this, t, ["
|
|
339
|
+
return i(this, t), o(this, t, ["FailedCodeChallengeError", "Failed to create a code challenge"]);
|
|
340
340
|
}
|
|
341
341
|
return a(t, I), r(t);
|
|
342
342
|
}(),
|
|
343
343
|
Z = function (e) {
|
|
344
344
|
function t() {
|
|
345
|
-
return i(this, t), o(this, t, ["
|
|
345
|
+
return i(this, t), o(this, t, ["PasskeysUnsupportedError", "Passkeys are not supported on this device"]);
|
|
346
346
|
}
|
|
347
347
|
return a(t, I), r(t);
|
|
348
348
|
}(),
|
|
349
349
|
Q = function (e) {
|
|
350
350
|
function t() {
|
|
351
|
-
return i(this, t), o(this, t, ["
|
|
351
|
+
return i(this, t), o(this, t, ["FailedToDecryptDataError", "Failed to decrypt user data"]);
|
|
352
352
|
}
|
|
353
353
|
return a(t, I), r(t);
|
|
354
354
|
}(),
|
|
355
355
|
ee = function (e) {
|
|
356
356
|
function t() {
|
|
357
|
-
return i(this, t), o(this, t, ["
|
|
357
|
+
return i(this, t), o(this, t, ["BiometricsFailedError", "Biometric authentication failed"]);
|
|
358
358
|
}
|
|
359
359
|
return a(t, I), r(t);
|
|
360
360
|
}(),
|
|
361
361
|
te = function (e) {
|
|
362
362
|
function t() {
|
|
363
|
-
return i(this, t), o(this, t, ["
|
|
363
|
+
return i(this, t), o(this, t, ["InvalidStartUrlError", "The start URL was invalid or improperly formatted."]);
|
|
364
364
|
}
|
|
365
365
|
return a(t, I), r(t);
|
|
366
366
|
}(),
|
|
367
367
|
re = function (e) {
|
|
368
368
|
function t() {
|
|
369
|
-
return i(this, t), o(this, t, ["
|
|
369
|
+
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."]);
|
|
370
370
|
}
|
|
371
371
|
return a(t, I), r(t);
|
|
372
372
|
}(),
|
|
373
373
|
ne = function (e) {
|
|
374
374
|
function t() {
|
|
375
|
-
return i(this, t), o(this, t, ["
|
|
375
|
+
return i(this, t), o(this, t, ["MissingUrlError", "The underlying web authentication service failed to return a URL."]);
|
|
376
376
|
}
|
|
377
377
|
return a(t, I), r(t);
|
|
378
378
|
}(),
|
|
379
379
|
ie = function (e) {
|
|
380
380
|
function t() {
|
|
381
|
-
return i(this, t), o(this, t, ["
|
|
381
|
+
return i(this, t), o(this, t, ["InvalidCredentialTypeError", "The public key credential type was not of the expected type."]);
|
|
382
382
|
}
|
|
383
383
|
return a(t, I), r(t);
|
|
384
384
|
}(),
|
|
385
385
|
oe = function (e) {
|
|
386
386
|
function t() {
|
|
387
|
-
return i(this, t), o(this, t, ["
|
|
387
|
+
return i(this, t), o(this, t, ["MissingAttestationObjectError", "The public key credential is missing the attestation object."]);
|
|
388
388
|
}
|
|
389
389
|
return a(t, I), r(t);
|
|
390
390
|
}(),
|
|
391
391
|
se = function (e) {
|
|
392
392
|
function t() {
|
|
393
|
-
return i(this, t), o(this, t, ["
|
|
393
|
+
return i(this, t), o(this, t, ["JSONDataNotConvertibleToStringError", "JSON data unable to be converted to String type."]);
|
|
394
394
|
}
|
|
395
395
|
return a(t, I), r(t);
|
|
396
396
|
}(),
|
|
397
397
|
ae = function (e) {
|
|
398
398
|
function t() {
|
|
399
|
-
return i(this, t), o(this, t, ["
|
|
399
|
+
return i(this, t), o(this, t, ["RandomNumberGenerationFailed", "Random number generation failed"]);
|
|
400
400
|
}
|
|
401
401
|
return a(t, I), r(t);
|
|
402
402
|
}(),
|
|
403
403
|
ce = function (e) {
|
|
404
404
|
function t() {
|
|
405
|
-
return i(this, t), o(this, t, ["
|
|
405
|
+
return i(this, t), o(this, t, ["PasskeysInvalidEncoding", "Invalid passkey encoding"]);
|
|
406
406
|
}
|
|
407
407
|
return a(t, I), r(t);
|
|
408
408
|
}(),
|
|
409
409
|
ue = function (e) {
|
|
410
|
+
function t() {
|
|
411
|
+
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."]);
|
|
412
|
+
}
|
|
413
|
+
return a(t, I), r(t);
|
|
414
|
+
}(),
|
|
415
|
+
le = function (e) {
|
|
410
416
|
function t() {
|
|
411
417
|
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."]);
|
|
412
418
|
}
|
|
413
419
|
return a(t, I), r(t);
|
|
414
420
|
}();
|
|
415
|
-
function
|
|
421
|
+
function de(e, t) {
|
|
416
422
|
var r = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
417
423
|
if (!r) {
|
|
418
424
|
if (Array.isArray(e) || (r = function (e, t) {
|
|
419
425
|
if (!e) return;
|
|
420
|
-
if ("string" == typeof e) return
|
|
426
|
+
if ("string" == typeof e) return he(e, t);
|
|
421
427
|
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
422
428
|
"Object" === r && e.constructor && (r = e.constructor.name);
|
|
423
429
|
if ("Map" === r || "Set" === r) return Array.from(e);
|
|
424
|
-
if ("Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return
|
|
430
|
+
if ("Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return he(e, t);
|
|
425
431
|
}(e)) || t && e && "number" == typeof e.length) {
|
|
426
432
|
r && (e = r);
|
|
427
433
|
var _n = 0,
|
|
@@ -467,21 +473,21 @@ function le(e, t) {
|
|
|
467
473
|
}
|
|
468
474
|
};
|
|
469
475
|
}
|
|
470
|
-
function
|
|
476
|
+
function he(e, t) {
|
|
471
477
|
(null == t || t > e.length) && (t = e.length);
|
|
472
478
|
for (var r = 0, n = new Array(t); r < t; r++) n[r] = e[r];
|
|
473
479
|
return n;
|
|
474
480
|
}
|
|
475
|
-
function
|
|
476
|
-
return
|
|
481
|
+
function pe(e) {
|
|
482
|
+
return pe = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
|
|
477
483
|
return _typeof(e);
|
|
478
484
|
} : function (e) {
|
|
479
485
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
|
|
480
|
-
},
|
|
486
|
+
}, pe(e);
|
|
481
487
|
}
|
|
482
|
-
function
|
|
488
|
+
function fe() {
|
|
483
489
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
484
|
-
|
|
490
|
+
fe = function fe() {
|
|
485
491
|
return t;
|
|
486
492
|
};
|
|
487
493
|
var e,
|
|
@@ -561,7 +567,7 @@ function pe() {
|
|
|
561
567
|
if ("throw" !== c.type) {
|
|
562
568
|
var u = c.arg,
|
|
563
569
|
l = u.value;
|
|
564
|
-
return l && "object" ==
|
|
570
|
+
return l && "object" == pe(l) && n.call(l, "__await") ? t.resolve(l.__await).then(function (e) {
|
|
565
571
|
r("next", e, s, a);
|
|
566
572
|
}, function (e) {
|
|
567
573
|
r("throw", e, s, a);
|
|
@@ -631,20 +637,20 @@ function pe() {
|
|
|
631
637
|
var s = o.arg;
|
|
632
638
|
return s ? s.done ? (r[t.resultName] = s.value, r.next = t.nextLoc, "return" !== r.method && (r.method = "next", r.arg = e), r.delegate = null, m) : s : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, m);
|
|
633
639
|
}
|
|
634
|
-
function
|
|
640
|
+
function E(e) {
|
|
635
641
|
var t = {
|
|
636
642
|
tryLoc: e[0]
|
|
637
643
|
};
|
|
638
644
|
1 in e && (t.catchLoc = e[1]), 2 in e && (t.finallyLoc = e[2], t.afterLoc = e[3]), this.tryEntries.push(t);
|
|
639
645
|
}
|
|
640
|
-
function
|
|
646
|
+
function O(e) {
|
|
641
647
|
var t = e.completion || {};
|
|
642
648
|
t.type = "normal", delete t.arg, e.completion = t;
|
|
643
649
|
}
|
|
644
650
|
function A(e) {
|
|
645
651
|
this.tryEntries = [{
|
|
646
652
|
tryLoc: "root"
|
|
647
|
-
}], e.forEach(
|
|
653
|
+
}], e.forEach(E, this), this.reset(!0);
|
|
648
654
|
}
|
|
649
655
|
function D(t) {
|
|
650
656
|
if (t || "" === t) {
|
|
@@ -660,7 +666,7 @@ function pe() {
|
|
|
660
666
|
return o.next = o;
|
|
661
667
|
}
|
|
662
668
|
}
|
|
663
|
-
throw new TypeError(
|
|
669
|
+
throw new TypeError(pe(t) + " is not iterable");
|
|
664
670
|
}
|
|
665
671
|
return b.prototype = g, i(S, "constructor", {
|
|
666
672
|
value: g,
|
|
@@ -703,7 +709,7 @@ function pe() {
|
|
|
703
709
|
}, t.values = D, A.prototype = {
|
|
704
710
|
constructor: A,
|
|
705
711
|
reset: function reset(t) {
|
|
706
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = e, this.done = !1, this.delegate = null, this.method = "next", this.arg = e, this.tryEntries.forEach(
|
|
712
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = e, this.done = !1, this.delegate = null, this.method = "next", this.arg = e, this.tryEntries.forEach(O), !t) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = e);
|
|
707
713
|
},
|
|
708
714
|
stop: function stop() {
|
|
709
715
|
this.done = !0;
|
|
@@ -755,7 +761,7 @@ function pe() {
|
|
|
755
761
|
finish: function finish(e) {
|
|
756
762
|
for (var t = this.tryEntries.length - 1; t >= 0; --t) {
|
|
757
763
|
var r = this.tryEntries[t];
|
|
758
|
-
if (r.finallyLoc === e) return this.complete(r.completion, r.afterLoc),
|
|
764
|
+
if (r.finallyLoc === e) return this.complete(r.completion, r.afterLoc), O(r), m;
|
|
759
765
|
}
|
|
760
766
|
},
|
|
761
767
|
"catch": function _catch(e) {
|
|
@@ -765,7 +771,7 @@ function pe() {
|
|
|
765
771
|
var n = r.completion;
|
|
766
772
|
if ("throw" === n.type) {
|
|
767
773
|
var i = n.arg;
|
|
768
|
-
|
|
774
|
+
O(r);
|
|
769
775
|
}
|
|
770
776
|
return i;
|
|
771
777
|
}
|
|
@@ -781,46 +787,46 @@ function pe() {
|
|
|
781
787
|
}
|
|
782
788
|
}, t;
|
|
783
789
|
}
|
|
784
|
-
function
|
|
790
|
+
function _e(e, t) {
|
|
785
791
|
for (var r = 0; r < t.length; r++) {
|
|
786
792
|
var n = t[r];
|
|
787
|
-
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e,
|
|
793
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, ve(n.key), n);
|
|
788
794
|
}
|
|
789
795
|
}
|
|
790
|
-
function
|
|
791
|
-
return t &&
|
|
796
|
+
function me(e, t, r) {
|
|
797
|
+
return t && _e(e.prototype, t), r && _e(e, r), Object.defineProperty(e, "prototype", {
|
|
792
798
|
writable: !1
|
|
793
799
|
}), e;
|
|
794
800
|
}
|
|
795
|
-
function
|
|
801
|
+
function ve(e) {
|
|
796
802
|
var t = function (e, t) {
|
|
797
|
-
if ("object" !=
|
|
803
|
+
if ("object" != pe(e) || !e) return e;
|
|
798
804
|
var r = e[Symbol.toPrimitive];
|
|
799
805
|
if (void 0 !== r) {
|
|
800
806
|
var n = r.call(e, t || "default");
|
|
801
|
-
if ("object" !=
|
|
807
|
+
if ("object" != pe(n)) return n;
|
|
802
808
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
803
809
|
}
|
|
804
810
|
return ("string" === t ? String : Number)(e);
|
|
805
811
|
}(e, "string");
|
|
806
|
-
return "symbol" ==
|
|
812
|
+
return "symbol" == pe(t) ? t : String(t);
|
|
807
813
|
}
|
|
808
|
-
function
|
|
814
|
+
function be(e, t) {
|
|
809
815
|
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
|
|
810
816
|
}
|
|
811
|
-
function
|
|
812
|
-
return t =
|
|
813
|
-
if (t && ("object" ===
|
|
817
|
+
function ge(e, t, r) {
|
|
818
|
+
return t = Se(t), function (e, t) {
|
|
819
|
+
if (t && ("object" === pe(t) || "function" == typeof t)) return t;
|
|
814
820
|
if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
|
|
815
821
|
return function (e) {
|
|
816
822
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
817
823
|
return e;
|
|
818
824
|
}(e);
|
|
819
|
-
}(e,
|
|
825
|
+
}(e, ke() ? Reflect.construct(t, r || [], Se(e).constructor) : t.apply(e, r));
|
|
820
826
|
}
|
|
821
|
-
function
|
|
827
|
+
function ye(e) {
|
|
822
828
|
var t = "function" == typeof Map ? new Map() : void 0;
|
|
823
|
-
return
|
|
829
|
+
return ye = function ye(e) {
|
|
824
830
|
if (null === e || !function (e) {
|
|
825
831
|
try {
|
|
826
832
|
return -1 !== Function.toString.call(e).indexOf("[native code]");
|
|
@@ -835,12 +841,12 @@ function ge(e) {
|
|
|
835
841
|
}
|
|
836
842
|
function r() {
|
|
837
843
|
return function (e, t, r) {
|
|
838
|
-
if (
|
|
844
|
+
if (ke()) return Reflect.construct.apply(null, arguments);
|
|
839
845
|
var n = [null];
|
|
840
846
|
n.push.apply(n, t);
|
|
841
847
|
var i = new (e.bind.apply(e, n))();
|
|
842
|
-
return r &&
|
|
843
|
-
}(e, arguments,
|
|
848
|
+
return r && we(i, r.prototype), i;
|
|
849
|
+
}(e, arguments, Se(this).constructor);
|
|
844
850
|
}
|
|
845
851
|
return r.prototype = Object.create(e.prototype, {
|
|
846
852
|
constructor: {
|
|
@@ -849,30 +855,30 @@ function ge(e) {
|
|
|
849
855
|
writable: !0,
|
|
850
856
|
configurable: !0
|
|
851
857
|
}
|
|
852
|
-
}),
|
|
853
|
-
},
|
|
858
|
+
}), we(r, e);
|
|
859
|
+
}, ye(e);
|
|
854
860
|
}
|
|
855
|
-
function
|
|
861
|
+
function ke() {
|
|
856
862
|
try {
|
|
857
863
|
var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
858
864
|
} catch (e) {}
|
|
859
|
-
return (
|
|
865
|
+
return (ke = function ke() {
|
|
860
866
|
return !!e;
|
|
861
867
|
})();
|
|
862
868
|
}
|
|
863
|
-
function
|
|
864
|
-
return
|
|
869
|
+
function we(e, t) {
|
|
870
|
+
return we = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) {
|
|
865
871
|
return e.__proto__ = t, e;
|
|
866
|
-
},
|
|
872
|
+
}, we(e, t);
|
|
867
873
|
}
|
|
868
|
-
function
|
|
869
|
-
return
|
|
874
|
+
function Se(e) {
|
|
875
|
+
return Se = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) {
|
|
870
876
|
return e.__proto__ || Object.getPrototypeOf(e);
|
|
871
|
-
},
|
|
877
|
+
}, Se(e);
|
|
872
878
|
}
|
|
873
879
|
exports.B2BProducts = void 0, (g = exports.B2BProducts || (exports.B2BProducts = {})).emailMagicLinks = "emailMagicLinks", g.sso = "sso", g.passwords = "passwords", g.oauth = "oauth", exports.AuthFlowType = void 0, (y = exports.AuthFlowType || (exports.AuthFlowType = {})).Discovery = "Discovery", y.Organization = "Organization", y.PasswordReset = "PasswordReset", exports.B2BMFAProducts = void 0, (k = exports.B2BMFAProducts || (exports.B2BMFAProducts = {})).smsOtp = "smsOtp", k.totp = "totp", exports.B2BOAuthProviders = void 0, (w = exports.B2BOAuthProviders || (exports.B2BOAuthProviders = {})).Google = "google", w.Microsoft = "microsoft";
|
|
874
|
-
var
|
|
875
|
-
function
|
|
880
|
+
var Pe;
|
|
881
|
+
function xe(e, t, r, n) {
|
|
876
882
|
return new (r || (r = Promise))(function (i, o) {
|
|
877
883
|
function s(e) {
|
|
878
884
|
try {
|
|
@@ -899,12 +905,12 @@ function Pe(e, t, r, n) {
|
|
|
899
905
|
}
|
|
900
906
|
"function" == typeof SuppressedError && SuppressedError, function (e) {
|
|
901
907
|
e.RequiredCatcha = "Catcha Required";
|
|
902
|
-
}(
|
|
903
|
-
var
|
|
904
|
-
|
|
908
|
+
}(Pe || (Pe = {}));
|
|
909
|
+
var Ce,
|
|
910
|
+
Te = function (e) {
|
|
905
911
|
function t(e) {
|
|
906
912
|
var r;
|
|
907
|
-
return
|
|
913
|
+
return be(this, t), (r = ge(this, t, [e])).type = e, r;
|
|
908
914
|
}
|
|
909
915
|
return function (e, t) {
|
|
910
916
|
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
|
|
@@ -916,10 +922,10 @@ var xe,
|
|
|
916
922
|
}
|
|
917
923
|
}), Object.defineProperty(e, "prototype", {
|
|
918
924
|
writable: !1
|
|
919
|
-
}), t &&
|
|
920
|
-
}(t,
|
|
925
|
+
}), t && we(e, t);
|
|
926
|
+
}(t, ye(Error)), me(t);
|
|
921
927
|
}();
|
|
922
|
-
function
|
|
928
|
+
function Ee(e) {
|
|
923
929
|
var t,
|
|
924
930
|
r = e.method,
|
|
925
931
|
n = e.finalURL,
|
|
@@ -927,9 +933,9 @@ function Te(e) {
|
|
|
927
933
|
o = e.xSDKClientHeader,
|
|
928
934
|
s = e.xSDKParentHostHeader,
|
|
929
935
|
a = e.body;
|
|
930
|
-
return
|
|
936
|
+
return xe(this, void 0, void 0, fe().mark(function e() {
|
|
931
937
|
var c, u, l, d, h, p;
|
|
932
|
-
return
|
|
938
|
+
return fe().wrap(function (e) {
|
|
933
939
|
for (;;) switch (e.prev = e.next) {
|
|
934
940
|
case 0:
|
|
935
941
|
return c = {
|
|
@@ -949,7 +955,7 @@ function Te(e) {
|
|
|
949
955
|
e.next = 13;
|
|
950
956
|
break;
|
|
951
957
|
}
|
|
952
|
-
throw new
|
|
958
|
+
throw new O("Unable to contact the Stytch servers. Are you online?");
|
|
953
959
|
case 13:
|
|
954
960
|
throw e.t0;
|
|
955
961
|
case 14:
|
|
@@ -961,7 +967,7 @@ function Te(e) {
|
|
|
961
967
|
case 18:
|
|
962
968
|
return d = e.sent, e.abrupt("return", d.data);
|
|
963
969
|
case 22:
|
|
964
|
-
throw e.prev = 22, e.t1 = e["catch"](15), new
|
|
970
|
+
throw e.prev = 22, e.t1 = e["catch"](15), new O("Invalid JSON response from the Stytch servers.");
|
|
965
971
|
case 25:
|
|
966
972
|
if (200 === l.status || !(null === (t = l.headers.get("content-type")) || void 0 === t ? void 0 : t.includes("application/json"))) {
|
|
967
973
|
e.next = 38;
|
|
@@ -972,7 +978,7 @@ function Te(e) {
|
|
|
972
978
|
h = e.sent, e.next = 35;
|
|
973
979
|
break;
|
|
974
980
|
case 32:
|
|
975
|
-
throw e.prev = 32, e.t2 = e["catch"](26), new
|
|
981
|
+
throw e.prev = 32, e.t2 = e["catch"](26), new O("Invalid or no response from server");
|
|
976
982
|
case 35:
|
|
977
983
|
if (!("body" in h || "params" in h || "query" in h)) {
|
|
978
984
|
e.next = 37;
|
|
@@ -987,15 +993,15 @@ function Te(e) {
|
|
|
987
993
|
p = e.sent, e.next = 47;
|
|
988
994
|
break;
|
|
989
995
|
case 44:
|
|
990
|
-
throw e.prev = 44, e.t3 = e["catch"](38), new
|
|
996
|
+
throw e.prev = 44, e.t3 = e["catch"](38), new O("Invalid response from the Stytch servers.");
|
|
991
997
|
case 47:
|
|
992
998
|
if (!p.includes("Captcha required")) {
|
|
993
999
|
e.next = 49;
|
|
994
1000
|
break;
|
|
995
1001
|
}
|
|
996
|
-
throw new
|
|
1002
|
+
throw new Te(Pe.RequiredCatcha);
|
|
997
1003
|
case 49:
|
|
998
|
-
throw new
|
|
1004
|
+
throw new O("Invalid response from the Stytch servers.");
|
|
999
1005
|
case 50:
|
|
1000
1006
|
case "end":
|
|
1001
1007
|
return e.stop();
|
|
@@ -1004,42 +1010,42 @@ function Te(e) {
|
|
|
1004
1010
|
}));
|
|
1005
1011
|
}
|
|
1006
1012
|
var Oe = new Uint8Array(16);
|
|
1007
|
-
function
|
|
1008
|
-
if (!
|
|
1009
|
-
return
|
|
1013
|
+
function Ae() {
|
|
1014
|
+
if (!Ce && !(Ce = "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");
|
|
1015
|
+
return Ce(Oe);
|
|
1010
1016
|
}
|
|
1011
|
-
var
|
|
1012
|
-
for (var
|
|
1013
|
-
function
|
|
1017
|
+
var De = /^(?:[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;
|
|
1018
|
+
for (var Ie = [], Re = 0; Re < 256; ++Re) Ie.push((Re + 256).toString(16).substr(1));
|
|
1019
|
+
function Fe(e) {
|
|
1014
1020
|
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
|
|
1015
|
-
r = (
|
|
1021
|
+
r = (Ie[e[t + 0]] + Ie[e[t + 1]] + Ie[e[t + 2]] + Ie[e[t + 3]] + "-" + Ie[e[t + 4]] + Ie[e[t + 5]] + "-" + Ie[e[t + 6]] + Ie[e[t + 7]] + "-" + Ie[e[t + 8]] + Ie[e[t + 9]] + "-" + Ie[e[t + 10]] + Ie[e[t + 11]] + Ie[e[t + 12]] + Ie[e[t + 13]] + Ie[e[t + 14]] + Ie[e[t + 15]]).toLowerCase();
|
|
1016
1022
|
if (!function (e) {
|
|
1017
|
-
return "string" == typeof e &&
|
|
1023
|
+
return "string" == typeof e && De.test(e);
|
|
1018
1024
|
}(r)) throw TypeError("Stringified UUID is invalid");
|
|
1019
1025
|
return r;
|
|
1020
1026
|
}
|
|
1021
|
-
function
|
|
1022
|
-
var n = (e = e || {}).random || (e.rng ||
|
|
1027
|
+
function Be(e, t, r) {
|
|
1028
|
+
var n = (e = e || {}).random || (e.rng || Ae)();
|
|
1023
1029
|
if (n[6] = 15 & n[6] | 64, n[8] = 63 & n[8] | 128, t) {
|
|
1024
1030
|
r = r || 0;
|
|
1025
1031
|
for (var i = 0; i < 16; ++i) t[r + i] = n[i];
|
|
1026
1032
|
return t;
|
|
1027
1033
|
}
|
|
1028
|
-
return
|
|
1034
|
+
return Fe(n);
|
|
1029
1035
|
}
|
|
1030
|
-
var
|
|
1031
|
-
function
|
|
1032
|
-
return
|
|
1033
|
-
return
|
|
1036
|
+
var Me = {};
|
|
1037
|
+
function je(e, t) {
|
|
1038
|
+
return xe(this, void 0, void 0, fe().mark(function r() {
|
|
1039
|
+
return fe().wrap(function (r) {
|
|
1034
1040
|
for (;;) switch (r.prev = r.next) {
|
|
1035
1041
|
case 0:
|
|
1036
|
-
if (void 0 ===
|
|
1042
|
+
if (void 0 === Me[e]) {
|
|
1037
1043
|
r.next = 2;
|
|
1038
1044
|
break;
|
|
1039
1045
|
}
|
|
1040
|
-
return r.abrupt("return",
|
|
1046
|
+
return r.abrupt("return", Me[e]);
|
|
1041
1047
|
case 2:
|
|
1042
|
-
return
|
|
1048
|
+
return Me[e] = Le(e, t), r.abrupt("return", Me[e]);
|
|
1043
1049
|
case 4:
|
|
1044
1050
|
case "end":
|
|
1045
1051
|
return r.stop();
|
|
@@ -1047,10 +1053,10 @@ function Me(e, t) {
|
|
|
1047
1053
|
}, r);
|
|
1048
1054
|
}));
|
|
1049
1055
|
}
|
|
1050
|
-
function
|
|
1056
|
+
function Le(e, t) {
|
|
1051
1057
|
return new Promise(function (r, n) {
|
|
1052
1058
|
var i = function (e) {
|
|
1053
|
-
var t =
|
|
1059
|
+
var t = Ke(e);
|
|
1054
1060
|
if (t[0]) return t[0];
|
|
1055
1061
|
}(e);
|
|
1056
1062
|
if (i && "true" === i.dataset.loaded) try {
|
|
@@ -1074,27 +1080,27 @@ function je(e, t) {
|
|
|
1074
1080
|
});
|
|
1075
1081
|
});
|
|
1076
1082
|
}
|
|
1077
|
-
var
|
|
1083
|
+
var Ke = function Ke(e) {
|
|
1078
1084
|
return document.querySelectorAll('script[src="'.concat(e, '"]'));
|
|
1079
1085
|
};
|
|
1080
|
-
var
|
|
1081
|
-
|
|
1082
|
-
|
|
1086
|
+
var Ne,
|
|
1087
|
+
ze = ["[Stytch]"],
|
|
1088
|
+
Ue = function Ue() {
|
|
1083
1089
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
1084
|
-
return (e = console).warn.apply(e,
|
|
1090
|
+
return (e = console).warn.apply(e, ze.concat(r));
|
|
1085
1091
|
},
|
|
1086
|
-
|
|
1092
|
+
qe = function qe() {
|
|
1087
1093
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
1088
|
-
return (e = console).error.apply(e,
|
|
1094
|
+
return (e = console).error.apply(e, ze.concat(r));
|
|
1089
1095
|
},
|
|
1090
|
-
|
|
1091
|
-
|
|
1096
|
+
We = "\nYou can find your public token at https://stytch.com/dashboard/api-keys.",
|
|
1097
|
+
He = function He(e) {
|
|
1092
1098
|
return e.includes("public-token-test");
|
|
1093
1099
|
},
|
|
1094
|
-
|
|
1100
|
+
Ge = function Ge(e) {
|
|
1095
1101
|
var t = {
|
|
1096
1102
|
isObject: function isObject(r, n) {
|
|
1097
|
-
var i = "object" ===
|
|
1103
|
+
var i = "object" === pe(n) && !Array.isArray(n) && null !== n;
|
|
1098
1104
|
if (!i) throw new P(e, r + " must be an object.");
|
|
1099
1105
|
return t;
|
|
1100
1106
|
},
|
|
@@ -1111,7 +1117,7 @@ var Ke,
|
|
|
1111
1117
|
isStringArray: function isStringArray(r, n) {
|
|
1112
1118
|
if (!Array.isArray(n)) throw new P(e, r + " must be an array of strings.");
|
|
1113
1119
|
var i,
|
|
1114
|
-
o =
|
|
1120
|
+
o = de(n);
|
|
1115
1121
|
try {
|
|
1116
1122
|
for (o.s(); !(i = o.n()).done;) {
|
|
1117
1123
|
if ("string" != typeof i.value) throw new P(e, r + " must be an array of strings.");
|
|
@@ -1143,14 +1149,14 @@ var Ke,
|
|
|
1143
1149
|
};
|
|
1144
1150
|
return t;
|
|
1145
1151
|
},
|
|
1146
|
-
|
|
1152
|
+
Ve = me(function e(t, r, n) {
|
|
1147
1153
|
var i = this,
|
|
1148
1154
|
o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : function () {
|
|
1149
1155
|
return Promise.resolve(void 0);
|
|
1150
1156
|
};
|
|
1151
|
-
|
|
1152
|
-
return
|
|
1153
|
-
return
|
|
1157
|
+
be(this, e), this.bootstrapPromise = n, this.isEnabled = function () {
|
|
1158
|
+
return xe(i, void 0, void 0, fe().mark(function e() {
|
|
1159
|
+
return fe().wrap(function (e) {
|
|
1154
1160
|
for (;;) switch (e.prev = e.next) {
|
|
1155
1161
|
case 0:
|
|
1156
1162
|
return e.abrupt("return", this.state.then(function (e) {
|
|
@@ -1163,9 +1169,9 @@ var Ke,
|
|
|
1163
1169
|
}, e, this);
|
|
1164
1170
|
}));
|
|
1165
1171
|
}, this.getTelemetryID = function () {
|
|
1166
|
-
return
|
|
1172
|
+
return xe(i, void 0, void 0, fe().mark(function e() {
|
|
1167
1173
|
var t, r, n, i;
|
|
1168
|
-
return
|
|
1174
|
+
return fe().wrap(function (e) {
|
|
1169
1175
|
for (;;) switch (e.prev = e.next) {
|
|
1170
1176
|
case 0:
|
|
1171
1177
|
return e.next = 2, this.state;
|
|
@@ -1186,9 +1192,9 @@ var Ke,
|
|
|
1186
1192
|
}, e, this);
|
|
1187
1193
|
}));
|
|
1188
1194
|
}, this.getDFPTelemetryIDAndCaptcha = function () {
|
|
1189
|
-
return
|
|
1195
|
+
return xe(i, void 0, void 0, fe().mark(function e() {
|
|
1190
1196
|
var t, r, n, i, o, s;
|
|
1191
|
-
return
|
|
1197
|
+
return fe().wrap(function (e) {
|
|
1192
1198
|
for (;;) switch (e.prev = e.next) {
|
|
1193
1199
|
case 0:
|
|
1194
1200
|
return e.next = 2, this.state;
|
|
@@ -1231,14 +1237,14 @@ var Ke,
|
|
|
1231
1237
|
}, e, this);
|
|
1232
1238
|
}));
|
|
1233
1239
|
}, this.retryWithCaptchaAndDFP = function (e, t) {
|
|
1234
|
-
return
|
|
1240
|
+
return xe(i, void 0, void 0, fe().mark(function r() {
|
|
1235
1241
|
var n, i, o;
|
|
1236
|
-
return
|
|
1242
|
+
return fe().wrap(function (r) {
|
|
1237
1243
|
for (;;) switch (r.prev = r.next) {
|
|
1238
1244
|
case 0:
|
|
1239
1245
|
return r.next = 2, this.state;
|
|
1240
1246
|
case 2:
|
|
1241
|
-
if (n = r.sent, i = n.enabled, o = n.executeRecaptcha, e.type !==
|
|
1247
|
+
if (n = r.sent, i = n.enabled, o = n.executeRecaptcha, e.type !== Pe.RequiredCatcha || !i) {
|
|
1242
1248
|
r.next = 14;
|
|
1243
1249
|
break;
|
|
1244
1250
|
}
|
|
@@ -1262,8 +1268,8 @@ var Ke,
|
|
|
1262
1268
|
}, r, this);
|
|
1263
1269
|
}));
|
|
1264
1270
|
}, this.state = n.then(function (e) {
|
|
1265
|
-
return
|
|
1266
|
-
return
|
|
1271
|
+
return xe(i, void 0, void 0, fe().mark(function n() {
|
|
1272
|
+
return fe().wrap(function (n) {
|
|
1267
1273
|
for (;;) switch (n.prev = n.next) {
|
|
1268
1274
|
case 0:
|
|
1269
1275
|
if (e.runDFPProtectedAuth) {
|
|
@@ -1278,7 +1284,7 @@ var Ke,
|
|
|
1278
1284
|
executeRecaptcha: o
|
|
1279
1285
|
});
|
|
1280
1286
|
case 2:
|
|
1281
|
-
return n.next = 4,
|
|
1287
|
+
return n.next = 4, je("".concat("https://elements.stytch.com", "/telemetry.js"), function () {
|
|
1282
1288
|
return window.GetTelemetryID;
|
|
1283
1289
|
});
|
|
1284
1290
|
case 4:
|
|
@@ -1298,11 +1304,11 @@ var Ke,
|
|
|
1298
1304
|
}));
|
|
1299
1305
|
});
|
|
1300
1306
|
}),
|
|
1301
|
-
|
|
1307
|
+
Ye = function Ye() {
|
|
1302
1308
|
return {
|
|
1303
1309
|
isEnabled: function isEnabled() {
|
|
1304
|
-
return
|
|
1305
|
-
return
|
|
1310
|
+
return xe(void 0, void 0, void 0, fe().mark(function e() {
|
|
1311
|
+
return fe().wrap(function (e) {
|
|
1306
1312
|
for (;;) switch (e.prev = e.next) {
|
|
1307
1313
|
case 0:
|
|
1308
1314
|
return e.abrupt("return", !1);
|
|
@@ -1314,8 +1320,8 @@ var Ke,
|
|
|
1314
1320
|
}));
|
|
1315
1321
|
},
|
|
1316
1322
|
getTelemetryID: function getTelemetryID() {
|
|
1317
|
-
return
|
|
1318
|
-
return
|
|
1323
|
+
return xe(void 0, void 0, void 0, fe().mark(function e() {
|
|
1324
|
+
return fe().wrap(function (e) {
|
|
1319
1325
|
for (;;) switch (e.prev = e.next) {
|
|
1320
1326
|
case 0:
|
|
1321
1327
|
return e.abrupt("return", void 0);
|
|
@@ -1327,8 +1333,8 @@ var Ke,
|
|
|
1327
1333
|
}));
|
|
1328
1334
|
},
|
|
1329
1335
|
getDFPTelemetryIDAndCaptcha: function getDFPTelemetryIDAndCaptcha() {
|
|
1330
|
-
return
|
|
1331
|
-
return
|
|
1336
|
+
return xe(void 0, void 0, void 0, fe().mark(function e() {
|
|
1337
|
+
return fe().wrap(function (e) {
|
|
1332
1338
|
for (;;) switch (e.prev = e.next) {
|
|
1333
1339
|
case 0:
|
|
1334
1340
|
return e.abrupt("return", {
|
|
@@ -1343,8 +1349,8 @@ var Ke,
|
|
|
1343
1349
|
}));
|
|
1344
1350
|
},
|
|
1345
1351
|
retryWithCaptchaAndDFP: function retryWithCaptchaAndDFP() {
|
|
1346
|
-
return
|
|
1347
|
-
return
|
|
1352
|
+
return xe(void 0, void 0, void 0, fe().mark(function e() {
|
|
1353
|
+
return fe().wrap(function (e) {
|
|
1348
1354
|
for (;;) switch (e.prev = e.next) {
|
|
1349
1355
|
case 0:
|
|
1350
1356
|
throw new Error("DFP protected auth is disabled");
|
|
@@ -1357,11 +1363,11 @@ var Ke,
|
|
|
1357
1363
|
}
|
|
1358
1364
|
};
|
|
1359
1365
|
},
|
|
1360
|
-
|
|
1366
|
+
Je = function () {
|
|
1361
1367
|
function e() {
|
|
1362
|
-
|
|
1368
|
+
be(this, e);
|
|
1363
1369
|
}
|
|
1364
|
-
return
|
|
1370
|
+
return me(e, null, [{
|
|
1365
1371
|
key: "marshall",
|
|
1366
1372
|
value: function value(e) {
|
|
1367
1373
|
return Object.assign(Object.assign({}, e), {
|
|
@@ -1385,7 +1391,7 @@ var Ke,
|
|
|
1385
1391
|
case "StytchSDKSchemaError":
|
|
1386
1392
|
return e.inflate(x, t);
|
|
1387
1393
|
case "StytchAPIUnreachableError":
|
|
1388
|
-
return e.inflate(
|
|
1394
|
+
return e.inflate(O, t);
|
|
1389
1395
|
case "StytchAPISchemaError":
|
|
1390
1396
|
return e.inflate(A, t);
|
|
1391
1397
|
case "StytchSDKAPIError":
|
|
@@ -1409,11 +1415,11 @@ var Ke,
|
|
|
1409
1415
|
}
|
|
1410
1416
|
}]), e;
|
|
1411
1417
|
}(),
|
|
1412
|
-
|
|
1418
|
+
$e = function () {
|
|
1413
1419
|
function e(t) {
|
|
1414
|
-
|
|
1420
|
+
be(this, e), this.maxBatchSize = t.maxBatchSize, this.logEventURL = t.logEventURL, setInterval(this.flush.bind(this), t.intervalDurationMs), this.batch = [];
|
|
1415
1421
|
}
|
|
1416
|
-
return
|
|
1422
|
+
return me(e, [{
|
|
1417
1423
|
key: "logEvent",
|
|
1418
1424
|
value: function value(e, t) {
|
|
1419
1425
|
this.batch.push({
|
|
@@ -1424,9 +1430,9 @@ var Ke,
|
|
|
1424
1430
|
}, {
|
|
1425
1431
|
key: "flush",
|
|
1426
1432
|
value: function value() {
|
|
1427
|
-
return
|
|
1433
|
+
return xe(this, void 0, void 0, fe().mark(function e() {
|
|
1428
1434
|
var t;
|
|
1429
|
-
return
|
|
1435
|
+
return fe().wrap(function (e) {
|
|
1430
1436
|
for (;;) switch (e.prev = e.next) {
|
|
1431
1437
|
case 0:
|
|
1432
1438
|
if (this.batch.length) {
|
|
@@ -1458,26 +1464,26 @@ var Ke,
|
|
|
1458
1464
|
}();
|
|
1459
1465
|
!function (e) {
|
|
1460
1466
|
e.LoginOrCreateEML = "login_or_create_eml", e.LoginOrCreateOTP = "login_or_create_otp", e.ResetPassword = "reset_password";
|
|
1461
|
-
}(
|
|
1467
|
+
}(Ne || (Ne = {})), Promise.resolve({
|
|
1462
1468
|
pkceRequiredForEmailMagicLinks: !1
|
|
1463
1469
|
}), Promise.resolve({
|
|
1464
1470
|
pkceRequiredForPasswordResets: !1
|
|
1465
1471
|
});
|
|
1466
|
-
var
|
|
1472
|
+
var Xe = Promise.resolve({
|
|
1467
1473
|
pkceRequiredForEmailMagicLinks: !1
|
|
1468
1474
|
}),
|
|
1469
|
-
|
|
1475
|
+
Ze = function () {
|
|
1470
1476
|
function e(t, r, n, i) {
|
|
1471
1477
|
var o = this,
|
|
1472
|
-
s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] :
|
|
1473
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
1474
|
-
|
|
1478
|
+
s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : Xe,
|
|
1479
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : Ye();
|
|
1480
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._passwordResetPKCEManager = i, this._config = s, this.dfpProtectedAuth = a, this.email = {
|
|
1475
1481
|
invite: function invite(e) {
|
|
1476
|
-
return
|
|
1477
|
-
return
|
|
1482
|
+
return xe(o, void 0, void 0, fe().mark(function t() {
|
|
1483
|
+
return fe().wrap(function (t) {
|
|
1478
1484
|
for (;;) switch (t.prev = t.next) {
|
|
1479
1485
|
case 0:
|
|
1480
|
-
return
|
|
1486
|
+
return Ge("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({
|
|
1481
1487
|
url: "/b2b/magic_links/email/invite",
|
|
1482
1488
|
body: e,
|
|
1483
1489
|
errorMessage: "Failed to send invite.",
|
|
@@ -1491,12 +1497,12 @@ var $e = Promise.resolve({
|
|
|
1491
1497
|
}));
|
|
1492
1498
|
},
|
|
1493
1499
|
loginOrSignup: function loginOrSignup(e) {
|
|
1494
|
-
return
|
|
1500
|
+
return xe(o, void 0, void 0, fe().mark(function t() {
|
|
1495
1501
|
var r, n;
|
|
1496
|
-
return
|
|
1502
|
+
return fe().wrap(function (t) {
|
|
1497
1503
|
for (;;) switch (t.prev = t.next) {
|
|
1498
1504
|
case 0:
|
|
1499
|
-
return
|
|
1505
|
+
return Ge("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();
|
|
1500
1506
|
case 3:
|
|
1501
1507
|
return r = t.sent, n = Object.assign(Object.assign({}, e), {
|
|
1502
1508
|
pkce_code_challenge: r
|
|
@@ -1515,12 +1521,12 @@ var $e = Promise.resolve({
|
|
|
1515
1521
|
},
|
|
1516
1522
|
discovery: {
|
|
1517
1523
|
send: function send(e) {
|
|
1518
|
-
return
|
|
1524
|
+
return xe(o, void 0, void 0, fe().mark(function t() {
|
|
1519
1525
|
var r, n;
|
|
1520
|
-
return
|
|
1526
|
+
return fe().wrap(function (t) {
|
|
1521
1527
|
for (;;) switch (t.prev = t.next) {
|
|
1522
1528
|
case 0:
|
|
1523
|
-
return
|
|
1529
|
+
return Ge("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();
|
|
1524
1530
|
case 3:
|
|
1525
1531
|
return r = t.sent, n = Object.assign(Object.assign({}, e), {
|
|
1526
1532
|
pkce_code_challenge: r
|
|
@@ -1539,12 +1545,12 @@ var $e = Promise.resolve({
|
|
|
1539
1545
|
}
|
|
1540
1546
|
}
|
|
1541
1547
|
}, this.authenticate = function (e) {
|
|
1542
|
-
return
|
|
1548
|
+
return xe(o, void 0, void 0, fe().mark(function t() {
|
|
1543
1549
|
var r, n;
|
|
1544
|
-
return
|
|
1550
|
+
return fe().wrap(function (t) {
|
|
1545
1551
|
for (;;) switch (t.prev = t.next) {
|
|
1546
1552
|
case 0:
|
|
1547
|
-
return
|
|
1553
|
+
return Ge("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();
|
|
1548
1554
|
case 3:
|
|
1549
1555
|
if (r = t.sent, n = null, !(null == r ? void 0 : r.code_verifier)) {
|
|
1550
1556
|
t.next = 19;
|
|
@@ -1595,12 +1601,12 @@ var $e = Promise.resolve({
|
|
|
1595
1601
|
}));
|
|
1596
1602
|
}, this.discovery = {
|
|
1597
1603
|
authenticate: function authenticate(e) {
|
|
1598
|
-
return
|
|
1604
|
+
return xe(o, void 0, void 0, fe().mark(function t() {
|
|
1599
1605
|
var r, n, i, o, s, a;
|
|
1600
|
-
return
|
|
1606
|
+
return fe().wrap(function (t) {
|
|
1601
1607
|
for (;;) switch (t.prev = t.next) {
|
|
1602
1608
|
case 0:
|
|
1603
|
-
return
|
|
1609
|
+
return Ge("stytch.magicLinks.discovery.authenticate").isString("discovery_magic_links_token", e.discovery_magic_links_token), t.next = 3, this._pkceManager.getPKPair();
|
|
1604
1610
|
case 3:
|
|
1605
1611
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
1606
1612
|
case 6:
|
|
@@ -1631,12 +1637,12 @@ var $e = Promise.resolve({
|
|
|
1631
1637
|
}
|
|
1632
1638
|
};
|
|
1633
1639
|
}
|
|
1634
|
-
return
|
|
1640
|
+
return me(e, [{
|
|
1635
1641
|
key: "getCodeChallenge",
|
|
1636
1642
|
value: function value() {
|
|
1637
|
-
return
|
|
1643
|
+
return xe(this, void 0, void 0, fe().mark(function e() {
|
|
1638
1644
|
var t, r;
|
|
1639
|
-
return
|
|
1645
|
+
return fe().wrap(function (e) {
|
|
1640
1646
|
for (;;) switch (e.prev = e.next) {
|
|
1641
1647
|
case 0:
|
|
1642
1648
|
return e.next = 2, this._config;
|
|
@@ -1668,9 +1674,9 @@ var $e = Promise.resolve({
|
|
|
1668
1674
|
}, {
|
|
1669
1675
|
key: "handlePKCEForAuthenticate",
|
|
1670
1676
|
value: function value(e, t) {
|
|
1671
|
-
return
|
|
1677
|
+
return xe(this, void 0, void 0, fe().mark(function r() {
|
|
1672
1678
|
var n, i, o, s, a, c;
|
|
1673
|
-
return
|
|
1679
|
+
return fe().wrap(function (r) {
|
|
1674
1680
|
for (;;) switch (r.prev = r.next) {
|
|
1675
1681
|
case 0:
|
|
1676
1682
|
return r.next = 2, e.getPKPair();
|
|
@@ -1708,12 +1714,12 @@ var $e = Promise.resolve({
|
|
|
1708
1714
|
}
|
|
1709
1715
|
}]), e;
|
|
1710
1716
|
}(),
|
|
1711
|
-
|
|
1717
|
+
Qe = me(function e(t, r) {
|
|
1712
1718
|
var n = this;
|
|
1713
|
-
|
|
1714
|
-
return
|
|
1719
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
|
|
1720
|
+
return xe(n, void 0, void 0, fe().mark(function e() {
|
|
1715
1721
|
var t;
|
|
1716
|
-
return
|
|
1722
|
+
return fe().wrap(function (e) {
|
|
1717
1723
|
for (;;) switch (e.prev = e.next) {
|
|
1718
1724
|
case 0:
|
|
1719
1725
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1742,12 +1748,12 @@ var $e = Promise.resolve({
|
|
|
1742
1748
|
return e(null !== (r = null == t ? void 0 : t.member) && void 0 !== r ? r : null);
|
|
1743
1749
|
});
|
|
1744
1750
|
}, this.update = function (e) {
|
|
1745
|
-
return
|
|
1751
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
1746
1752
|
var r;
|
|
1747
|
-
return
|
|
1753
|
+
return fe().wrap(function (t) {
|
|
1748
1754
|
for (;;) switch (t.prev = t.next) {
|
|
1749
1755
|
case 0:
|
|
1750
|
-
return
|
|
1756
|
+
return Ge("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({
|
|
1751
1757
|
url: "/b2b/organizations/members/update",
|
|
1752
1758
|
body: e,
|
|
1753
1759
|
errorMessage: "Failed to update member.",
|
|
@@ -1762,9 +1768,9 @@ var $e = Promise.resolve({
|
|
|
1762
1768
|
}, t, this);
|
|
1763
1769
|
}));
|
|
1764
1770
|
}, this.deleteMFAPhoneNumber = function () {
|
|
1765
|
-
return
|
|
1771
|
+
return xe(n, void 0, void 0, fe().mark(function e() {
|
|
1766
1772
|
var t;
|
|
1767
|
-
return
|
|
1773
|
+
return fe().wrap(function (e) {
|
|
1768
1774
|
for (;;) switch (e.prev = e.next) {
|
|
1769
1775
|
case 0:
|
|
1770
1776
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1781,9 +1787,9 @@ var $e = Promise.resolve({
|
|
|
1781
1787
|
}, e, this);
|
|
1782
1788
|
}));
|
|
1783
1789
|
}, this.deleteMFATOTP = function () {
|
|
1784
|
-
return
|
|
1790
|
+
return xe(n, void 0, void 0, fe().mark(function e() {
|
|
1785
1791
|
var t;
|
|
1786
|
-
return
|
|
1792
|
+
return fe().wrap(function (e) {
|
|
1787
1793
|
for (;;) switch (e.prev = e.next) {
|
|
1788
1794
|
case 0:
|
|
1789
1795
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1800,9 +1806,9 @@ var $e = Promise.resolve({
|
|
|
1800
1806
|
}, e, this);
|
|
1801
1807
|
}));
|
|
1802
1808
|
}, this.deletePassword = function (e) {
|
|
1803
|
-
return
|
|
1809
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
1804
1810
|
var r;
|
|
1805
|
-
return
|
|
1811
|
+
return fe().wrap(function (t) {
|
|
1806
1812
|
for (;;) switch (t.prev = t.next) {
|
|
1807
1813
|
case 0:
|
|
1808
1814
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1820,14 +1826,14 @@ var $e = Promise.resolve({
|
|
|
1820
1826
|
}));
|
|
1821
1827
|
};
|
|
1822
1828
|
}),
|
|
1823
|
-
|
|
1829
|
+
et = function () {
|
|
1824
1830
|
function e(t, r, n, i, o) {
|
|
1825
1831
|
var s = this,
|
|
1826
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
1827
|
-
|
|
1832
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : Ye();
|
|
1833
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = o, this.dfpProtectedAuth = a, this.saml = {
|
|
1828
1834
|
createConnection: function createConnection(e) {
|
|
1829
|
-
return
|
|
1830
|
-
return
|
|
1835
|
+
return xe(s, void 0, void 0, fe().mark(function t() {
|
|
1836
|
+
return fe().wrap(function (t) {
|
|
1831
1837
|
for (;;) switch (t.prev = t.next) {
|
|
1832
1838
|
case 0:
|
|
1833
1839
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1846,8 +1852,8 @@ var $e = Promise.resolve({
|
|
|
1846
1852
|
}));
|
|
1847
1853
|
},
|
|
1848
1854
|
updateConnection: function updateConnection(e) {
|
|
1849
|
-
return
|
|
1850
|
-
return
|
|
1855
|
+
return xe(s, void 0, void 0, fe().mark(function t() {
|
|
1856
|
+
return fe().wrap(function (t) {
|
|
1851
1857
|
for (;;) switch (t.prev = t.next) {
|
|
1852
1858
|
case 0:
|
|
1853
1859
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1866,8 +1872,8 @@ var $e = Promise.resolve({
|
|
|
1866
1872
|
}));
|
|
1867
1873
|
},
|
|
1868
1874
|
updateConnectionByURL: function updateConnectionByURL(e) {
|
|
1869
|
-
return
|
|
1870
|
-
return
|
|
1875
|
+
return xe(s, void 0, void 0, fe().mark(function t() {
|
|
1876
|
+
return fe().wrap(function (t) {
|
|
1871
1877
|
for (;;) switch (t.prev = t.next) {
|
|
1872
1878
|
case 0:
|
|
1873
1879
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1886,8 +1892,8 @@ var $e = Promise.resolve({
|
|
|
1886
1892
|
}));
|
|
1887
1893
|
},
|
|
1888
1894
|
deleteVerificationCertificate: function deleteVerificationCertificate(e) {
|
|
1889
|
-
return
|
|
1890
|
-
return
|
|
1895
|
+
return xe(s, void 0, void 0, fe().mark(function t() {
|
|
1896
|
+
return fe().wrap(function (t) {
|
|
1891
1897
|
for (;;) switch (t.prev = t.next) {
|
|
1892
1898
|
case 0:
|
|
1893
1899
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1906,8 +1912,8 @@ var $e = Promise.resolve({
|
|
|
1906
1912
|
}
|
|
1907
1913
|
}, this.oidc = {
|
|
1908
1914
|
createConnection: function createConnection(e) {
|
|
1909
|
-
return
|
|
1910
|
-
return
|
|
1915
|
+
return xe(s, void 0, void 0, fe().mark(function t() {
|
|
1916
|
+
return fe().wrap(function (t) {
|
|
1911
1917
|
for (;;) switch (t.prev = t.next) {
|
|
1912
1918
|
case 0:
|
|
1913
1919
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1926,8 +1932,8 @@ var $e = Promise.resolve({
|
|
|
1926
1932
|
}));
|
|
1927
1933
|
},
|
|
1928
1934
|
updateConnection: function updateConnection(e) {
|
|
1929
|
-
return
|
|
1930
|
-
return
|
|
1935
|
+
return xe(s, void 0, void 0, fe().mark(function t() {
|
|
1936
|
+
return fe().wrap(function (t) {
|
|
1931
1937
|
for (;;) switch (t.prev = t.next) {
|
|
1932
1938
|
case 0:
|
|
1933
1939
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1947,17 +1953,17 @@ var $e = Promise.resolve({
|
|
|
1947
1953
|
}
|
|
1948
1954
|
};
|
|
1949
1955
|
}
|
|
1950
|
-
return
|
|
1956
|
+
return me(e, [{
|
|
1951
1957
|
key: "authenticate",
|
|
1952
1958
|
value: function value(e) {
|
|
1953
|
-
return
|
|
1959
|
+
return xe(this, void 0, void 0, fe().mark(function t() {
|
|
1954
1960
|
var r, n, i, o, s;
|
|
1955
|
-
return
|
|
1961
|
+
return fe().wrap(function (t) {
|
|
1956
1962
|
for (;;) switch (t.prev = t.next) {
|
|
1957
1963
|
case 0:
|
|
1958
|
-
return
|
|
1964
|
+
return Ge("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();
|
|
1959
1965
|
case 3:
|
|
1960
|
-
return (r = t.sent) ||
|
|
1966
|
+
return (r = t.sent) || Ue("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();
|
|
1961
1967
|
case 7:
|
|
1962
1968
|
return n = t.sent, i = n.dfp_telemetry_id, o = n.captcha_token, t.t0 = this._networkClient, t.t1 = Object, t.t2 = Object.assign({
|
|
1963
1969
|
pkce_code_verifier: null == r ? void 0 : r.code_verifier
|
|
@@ -2006,11 +2012,11 @@ var $e = Promise.resolve({
|
|
|
2006
2012
|
}, {
|
|
2007
2013
|
key: "getBaseApiUrl",
|
|
2008
2014
|
value: function value() {
|
|
2009
|
-
return
|
|
2010
|
-
return
|
|
2015
|
+
return xe(this, void 0, void 0, fe().mark(function e() {
|
|
2016
|
+
return fe().wrap(function (e) {
|
|
2011
2017
|
for (;;) switch (e.prev = e.next) {
|
|
2012
2018
|
case 0:
|
|
2013
|
-
if (!
|
|
2019
|
+
if (!He(this._config.publicToken)) {
|
|
2014
2020
|
e.next = 2;
|
|
2015
2021
|
break;
|
|
2016
2022
|
}
|
|
@@ -2030,9 +2036,9 @@ var $e = Promise.resolve({
|
|
|
2030
2036
|
var t = e.connection_id,
|
|
2031
2037
|
r = e.login_redirect_url,
|
|
2032
2038
|
n = e.signup_redirect_url;
|
|
2033
|
-
return
|
|
2039
|
+
return xe(this, void 0, void 0, fe().mark(function e() {
|
|
2034
2040
|
var i, o, s, a, c;
|
|
2035
|
-
return
|
|
2041
|
+
return fe().wrap(function (e) {
|
|
2036
2042
|
for (;;) switch (e.prev = e.next) {
|
|
2037
2043
|
case 0:
|
|
2038
2044
|
return e.next = 2, this._dynamicConfig;
|
|
@@ -2061,8 +2067,8 @@ var $e = Promise.resolve({
|
|
|
2061
2067
|
}, {
|
|
2062
2068
|
key: "getConnections",
|
|
2063
2069
|
value: function value() {
|
|
2064
|
-
return
|
|
2065
|
-
return
|
|
2070
|
+
return xe(this, void 0, void 0, fe().mark(function e() {
|
|
2071
|
+
return fe().wrap(function (e) {
|
|
2066
2072
|
for (;;) switch (e.prev = e.next) {
|
|
2067
2073
|
case 0:
|
|
2068
2074
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2082,8 +2088,8 @@ var $e = Promise.resolve({
|
|
|
2082
2088
|
}, {
|
|
2083
2089
|
key: "deleteConnection",
|
|
2084
2090
|
value: function value(e) {
|
|
2085
|
-
return
|
|
2086
|
-
return
|
|
2091
|
+
return xe(this, void 0, void 0, fe().mark(function t() {
|
|
2092
|
+
return fe().wrap(function (t) {
|
|
2087
2093
|
for (;;) switch (t.prev = t.next) {
|
|
2088
2094
|
case 0:
|
|
2089
2095
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2100,12 +2106,12 @@ var $e = Promise.resolve({
|
|
|
2100
2106
|
}
|
|
2101
2107
|
}]), e;
|
|
2102
2108
|
}(),
|
|
2103
|
-
|
|
2109
|
+
tt = me(function e(t, r) {
|
|
2104
2110
|
var n = this;
|
|
2105
|
-
|
|
2106
|
-
return
|
|
2111
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
|
|
2112
|
+
return xe(n, void 0, void 0, fe().mark(function e() {
|
|
2107
2113
|
var t;
|
|
2108
|
-
return
|
|
2114
|
+
return fe().wrap(function (e) {
|
|
2109
2115
|
for (;;) switch (e.prev = e.next) {
|
|
2110
2116
|
case 0:
|
|
2111
2117
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2134,9 +2140,9 @@ var $e = Promise.resolve({
|
|
|
2134
2140
|
return e(null !== (r = null == t ? void 0 : t.organization) && void 0 !== r ? r : null);
|
|
2135
2141
|
});
|
|
2136
2142
|
}, this.update = function (e) {
|
|
2137
|
-
return
|
|
2143
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2138
2144
|
var r;
|
|
2139
|
-
return
|
|
2145
|
+
return fe().wrap(function (t) {
|
|
2140
2146
|
for (;;) switch (t.prev = t.next) {
|
|
2141
2147
|
case 0:
|
|
2142
2148
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2154,9 +2160,9 @@ var $e = Promise.resolve({
|
|
|
2154
2160
|
}, t, this);
|
|
2155
2161
|
}));
|
|
2156
2162
|
}, this["delete"] = function () {
|
|
2157
|
-
return
|
|
2163
|
+
return xe(n, void 0, void 0, fe().mark(function e() {
|
|
2158
2164
|
var t;
|
|
2159
|
-
return
|
|
2165
|
+
return fe().wrap(function (e) {
|
|
2160
2166
|
for (;;) switch (e.prev = e.next) {
|
|
2161
2167
|
case 0:
|
|
2162
2168
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2174,8 +2180,8 @@ var $e = Promise.resolve({
|
|
|
2174
2180
|
}));
|
|
2175
2181
|
}, this.members = {
|
|
2176
2182
|
create: function create(e) {
|
|
2177
|
-
return
|
|
2178
|
-
return
|
|
2183
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2184
|
+
return fe().wrap(function (t) {
|
|
2179
2185
|
for (;;) switch (t.prev = t.next) {
|
|
2180
2186
|
case 0:
|
|
2181
2187
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2192,8 +2198,8 @@ var $e = Promise.resolve({
|
|
|
2192
2198
|
}));
|
|
2193
2199
|
},
|
|
2194
2200
|
search: function search(e) {
|
|
2195
|
-
return
|
|
2196
|
-
return
|
|
2201
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2202
|
+
return fe().wrap(function (t) {
|
|
2197
2203
|
for (;;) switch (t.prev = t.next) {
|
|
2198
2204
|
case 0:
|
|
2199
2205
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2210,8 +2216,8 @@ var $e = Promise.resolve({
|
|
|
2210
2216
|
}));
|
|
2211
2217
|
},
|
|
2212
2218
|
update: function update(e) {
|
|
2213
|
-
return
|
|
2214
|
-
return
|
|
2219
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2220
|
+
return fe().wrap(function (t) {
|
|
2215
2221
|
for (;;) switch (t.prev = t.next) {
|
|
2216
2222
|
case 0:
|
|
2217
2223
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2228,8 +2234,8 @@ var $e = Promise.resolve({
|
|
|
2228
2234
|
}));
|
|
2229
2235
|
},
|
|
2230
2236
|
deletePassword: function deletePassword(e) {
|
|
2231
|
-
return
|
|
2232
|
-
return
|
|
2237
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2238
|
+
return fe().wrap(function (t) {
|
|
2233
2239
|
for (;;) switch (t.prev = t.next) {
|
|
2234
2240
|
case 0:
|
|
2235
2241
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2245,8 +2251,8 @@ var $e = Promise.resolve({
|
|
|
2245
2251
|
}));
|
|
2246
2252
|
},
|
|
2247
2253
|
deleteMFAPhoneNumber: function deleteMFAPhoneNumber(e) {
|
|
2248
|
-
return
|
|
2249
|
-
return
|
|
2254
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2255
|
+
return fe().wrap(function (t) {
|
|
2250
2256
|
for (;;) switch (t.prev = t.next) {
|
|
2251
2257
|
case 0:
|
|
2252
2258
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2262,8 +2268,8 @@ var $e = Promise.resolve({
|
|
|
2262
2268
|
}));
|
|
2263
2269
|
},
|
|
2264
2270
|
deleteMFATOTP: function deleteMFATOTP(e) {
|
|
2265
|
-
return
|
|
2266
|
-
return
|
|
2271
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2272
|
+
return fe().wrap(function (t) {
|
|
2267
2273
|
for (;;) switch (t.prev = t.next) {
|
|
2268
2274
|
case 0:
|
|
2269
2275
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2279,8 +2285,8 @@ var $e = Promise.resolve({
|
|
|
2279
2285
|
}));
|
|
2280
2286
|
},
|
|
2281
2287
|
"delete": function _delete(e) {
|
|
2282
|
-
return
|
|
2283
|
-
return
|
|
2288
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2289
|
+
return fe().wrap(function (t) {
|
|
2284
2290
|
for (;;) switch (t.prev = t.next) {
|
|
2285
2291
|
case 0:
|
|
2286
2292
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2296,8 +2302,8 @@ var $e = Promise.resolve({
|
|
|
2296
2302
|
}));
|
|
2297
2303
|
},
|
|
2298
2304
|
reactivate: function reactivate(e) {
|
|
2299
|
-
return
|
|
2300
|
-
return
|
|
2305
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2306
|
+
return fe().wrap(function (t) {
|
|
2301
2307
|
for (;;) switch (t.prev = t.next) {
|
|
2302
2308
|
case 0:
|
|
2303
2309
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2314,18 +2320,18 @@ var $e = Promise.resolve({
|
|
|
2314
2320
|
}
|
|
2315
2321
|
};
|
|
2316
2322
|
}),
|
|
2317
|
-
|
|
2323
|
+
rt = function () {
|
|
2318
2324
|
function e(t, r, n, i, o) {
|
|
2319
2325
|
var s = this,
|
|
2320
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
2321
|
-
|
|
2326
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : Ye();
|
|
2327
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = o, this.dfpProtectedAuth = a, this.discovery = {
|
|
2322
2328
|
authenticate: function authenticate(e) {
|
|
2323
|
-
return
|
|
2329
|
+
return xe(s, void 0, void 0, fe().mark(function t() {
|
|
2324
2330
|
var r, n, i, o, s, a;
|
|
2325
|
-
return
|
|
2331
|
+
return fe().wrap(function (t) {
|
|
2326
2332
|
for (;;) switch (t.prev = t.next) {
|
|
2327
2333
|
case 0:
|
|
2328
|
-
return
|
|
2334
|
+
return Ge("stytch.oauth.discovery.authenticate").isString("discovery_oauth_token", e.discovery_oauth_token), t.next = 3, this._pkceManager.getPKPair();
|
|
2329
2335
|
case 3:
|
|
2330
2336
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2331
2337
|
case 6:
|
|
@@ -2366,17 +2372,17 @@ var $e = Promise.resolve({
|
|
|
2366
2372
|
}
|
|
2367
2373
|
};
|
|
2368
2374
|
}
|
|
2369
|
-
return
|
|
2375
|
+
return me(e, [{
|
|
2370
2376
|
key: "authenticate",
|
|
2371
2377
|
value: function value(e) {
|
|
2372
|
-
return
|
|
2378
|
+
return xe(this, void 0, void 0, fe().mark(function t() {
|
|
2373
2379
|
var r, n, i, o, s;
|
|
2374
|
-
return
|
|
2380
|
+
return fe().wrap(function (t) {
|
|
2375
2381
|
for (;;) switch (t.prev = t.next) {
|
|
2376
2382
|
case 0:
|
|
2377
|
-
return
|
|
2383
|
+
return Ge("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();
|
|
2378
2384
|
case 3:
|
|
2379
|
-
return (r = t.sent) ||
|
|
2385
|
+
return (r = t.sent) || Ue("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();
|
|
2380
2386
|
case 7:
|
|
2381
2387
|
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();
|
|
2382
2388
|
case 17:
|
|
@@ -2424,9 +2430,9 @@ var $e = Promise.resolve({
|
|
|
2424
2430
|
}, {
|
|
2425
2431
|
key: "getBaseApiUrl",
|
|
2426
2432
|
value: function value() {
|
|
2427
|
-
return
|
|
2433
|
+
return xe(this, void 0, void 0, fe().mark(function e() {
|
|
2428
2434
|
var t, r;
|
|
2429
|
-
return
|
|
2435
|
+
return fe().wrap(function (e) {
|
|
2430
2436
|
for (;;) switch (e.prev = e.next) {
|
|
2431
2437
|
case 0:
|
|
2432
2438
|
return e.next = 2, this._dynamicConfig;
|
|
@@ -2437,7 +2443,7 @@ var $e = Promise.resolve({
|
|
|
2437
2443
|
}
|
|
2438
2444
|
return e.abrupt("return", "https://".concat(r));
|
|
2439
2445
|
case 6:
|
|
2440
|
-
if (!
|
|
2446
|
+
if (!He(this._config.publicToken)) {
|
|
2441
2447
|
e.next = 8;
|
|
2442
2448
|
break;
|
|
2443
2449
|
}
|
|
@@ -2462,16 +2468,16 @@ var $e = Promise.resolve({
|
|
|
2462
2468
|
s = r.signup_redirect_url,
|
|
2463
2469
|
a = r.custom_scopes,
|
|
2464
2470
|
c = r.provider_params;
|
|
2465
|
-
return
|
|
2471
|
+
return xe(t, void 0, void 0, fe().mark(function t() {
|
|
2466
2472
|
var r, u, l, d, h, p;
|
|
2467
|
-
return
|
|
2473
|
+
return fe().wrap(function (t) {
|
|
2468
2474
|
for (;;) switch (t.prev = t.next) {
|
|
2469
2475
|
case 0:
|
|
2470
2476
|
return t.next = 2, this._dynamicConfig;
|
|
2471
2477
|
case 2:
|
|
2472
2478
|
return r = t.sent, u = r.pkceRequiredForOAuth, t.next = 6, this.getBaseApiUrl();
|
|
2473
2479
|
case 6:
|
|
2474
|
-
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 && (
|
|
2480
|
+
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 && (Ge("startOAuthFlow").isStringArray("custom_scopes", a), d.searchParams.set("custom_scopes", a.join(" "))), c) for (h in Ge("startOAuthFlow").isOptionalObject("provider_params", c), c) d.searchParams.set("provider_" + h, c[h]);
|
|
2475
2481
|
if (!u) {
|
|
2476
2482
|
t.next = 20;
|
|
2477
2483
|
break;
|
|
@@ -2500,16 +2506,16 @@ var $e = Promise.resolve({
|
|
|
2500
2506
|
var n = r.discovery_redirect_url,
|
|
2501
2507
|
i = r.custom_scopes,
|
|
2502
2508
|
o = r.provider_params;
|
|
2503
|
-
return
|
|
2509
|
+
return xe(t, void 0, void 0, fe().mark(function t() {
|
|
2504
2510
|
var r, s, a, c, u, l;
|
|
2505
|
-
return
|
|
2511
|
+
return fe().wrap(function (t) {
|
|
2506
2512
|
for (;;) switch (t.prev = t.next) {
|
|
2507
2513
|
case 0:
|
|
2508
2514
|
return t.next = 2, this._dynamicConfig;
|
|
2509
2515
|
case 2:
|
|
2510
2516
|
return r = t.sent, s = r.pkceRequiredForOAuth, t.next = 6, this.getBaseApiUrl();
|
|
2511
2517
|
case 6:
|
|
2512
|
-
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 && (
|
|
2518
|
+
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 && (Ge("startOAuthFlow").isStringArray("custom_scopes", i), c.searchParams.set("custom_scopes", i.join(" "))), o) for (u in Ge("startOAuthFlow").isOptionalObject("provider_params", o), o) c.searchParams.set("provider_" + u, o[u]);
|
|
2513
2519
|
if (!s) {
|
|
2514
2520
|
t.next = 18;
|
|
2515
2521
|
break;
|
|
@@ -2532,10 +2538,10 @@ var $e = Promise.resolve({
|
|
|
2532
2538
|
}
|
|
2533
2539
|
}]), e;
|
|
2534
2540
|
}(),
|
|
2535
|
-
|
|
2541
|
+
nt = function () {
|
|
2536
2542
|
function e(t, r) {
|
|
2537
2543
|
var n = this;
|
|
2538
|
-
|
|
2544
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this.getSync = function () {
|
|
2539
2545
|
return n._subscriptionService.getSession();
|
|
2540
2546
|
}, this.getInfo = function () {
|
|
2541
2547
|
return {
|
|
@@ -2548,9 +2554,9 @@ var $e = Promise.resolve({
|
|
|
2548
2554
|
return e(null !== (r = null == t ? void 0 : t.session) && void 0 !== r ? r : null);
|
|
2549
2555
|
});
|
|
2550
2556
|
}, this.revoke = function (e) {
|
|
2551
|
-
return
|
|
2557
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2552
2558
|
var r;
|
|
2553
|
-
return
|
|
2559
|
+
return fe().wrap(function (t) {
|
|
2554
2560
|
for (;;) switch (t.prev = t.next) {
|
|
2555
2561
|
case 0:
|
|
2556
2562
|
return t.prev = 0, t.next = 3, this._networkClient.fetchSDK({
|
|
@@ -2569,13 +2575,13 @@ var $e = Promise.resolve({
|
|
|
2569
2575
|
}, t, this, [[0, 8]]);
|
|
2570
2576
|
}));
|
|
2571
2577
|
}, this.authenticate = function (e) {
|
|
2572
|
-
return
|
|
2578
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2573
2579
|
var r,
|
|
2574
2580
|
n,
|
|
2575
2581
|
i,
|
|
2576
2582
|
o,
|
|
2577
2583
|
s = this;
|
|
2578
|
-
return
|
|
2584
|
+
return fe().wrap(function (t) {
|
|
2579
2585
|
for (;;) switch (t.prev = t.next) {
|
|
2580
2586
|
case 0:
|
|
2581
2587
|
return r = this._subscriptionService.getSession(), n = function n() {
|
|
@@ -2621,12 +2627,12 @@ var $e = Promise.resolve({
|
|
|
2621
2627
|
}, t, this, [[2, 13]]);
|
|
2622
2628
|
}));
|
|
2623
2629
|
}, this.exchange = function (e) {
|
|
2624
|
-
return
|
|
2630
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2625
2631
|
var r;
|
|
2626
|
-
return
|
|
2632
|
+
return fe().wrap(function (t) {
|
|
2627
2633
|
for (;;) switch (t.prev = t.next) {
|
|
2628
2634
|
case 0:
|
|
2629
|
-
return
|
|
2635
|
+
return Ge("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({
|
|
2630
2636
|
url: "/b2b/sessions/exchange",
|
|
2631
2637
|
body: e,
|
|
2632
2638
|
errorMessage: "Failed to exchange session",
|
|
@@ -2658,7 +2664,7 @@ var $e = Promise.resolve({
|
|
|
2658
2664
|
}));
|
|
2659
2665
|
};
|
|
2660
2666
|
}
|
|
2661
|
-
return
|
|
2667
|
+
return me(e, [{
|
|
2662
2668
|
key: "getTokens",
|
|
2663
2669
|
value: function value() {
|
|
2664
2670
|
return this._subscriptionService.getTokens();
|
|
@@ -2670,12 +2676,12 @@ var $e = Promise.resolve({
|
|
|
2670
2676
|
}
|
|
2671
2677
|
}]), e;
|
|
2672
2678
|
}(),
|
|
2673
|
-
|
|
2679
|
+
it = me(function e(t, r) {
|
|
2674
2680
|
var n = this;
|
|
2675
|
-
|
|
2681
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this.organizations = {
|
|
2676
2682
|
list: function list() {
|
|
2677
|
-
return
|
|
2678
|
-
return
|
|
2683
|
+
return xe(n, void 0, void 0, fe().mark(function e() {
|
|
2684
|
+
return fe().wrap(function (e) {
|
|
2679
2685
|
for (;;) switch (e.prev = e.next) {
|
|
2680
2686
|
case 0:
|
|
2681
2687
|
return e.t0 = this._networkClient, e.next = 3, this._subscriptionService.getIntermediateSessionToken();
|
|
@@ -2702,12 +2708,12 @@ var $e = Promise.resolve({
|
|
|
2702
2708
|
}));
|
|
2703
2709
|
},
|
|
2704
2710
|
create: function create(e) {
|
|
2705
|
-
return
|
|
2711
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2706
2712
|
var r, n;
|
|
2707
|
-
return
|
|
2713
|
+
return fe().wrap(function (t) {
|
|
2708
2714
|
for (;;) switch (t.prev = t.next) {
|
|
2709
2715
|
case 0:
|
|
2710
|
-
return
|
|
2716
|
+
return Ge("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();
|
|
2711
2717
|
case 5:
|
|
2712
2718
|
if (t.t2 = t.sent, t.t2) {
|
|
2713
2719
|
t.next = 8;
|
|
@@ -2748,12 +2754,12 @@ var $e = Promise.resolve({
|
|
|
2748
2754
|
}
|
|
2749
2755
|
}, this.intermediateSessions = {
|
|
2750
2756
|
exchange: function exchange(e) {
|
|
2751
|
-
return
|
|
2757
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2752
2758
|
var r, n;
|
|
2753
|
-
return
|
|
2759
|
+
return fe().wrap(function (t) {
|
|
2754
2760
|
for (;;) switch (t.prev = t.next) {
|
|
2755
2761
|
case 0:
|
|
2756
|
-
return
|
|
2762
|
+
return Ge("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();
|
|
2757
2763
|
case 5:
|
|
2758
2764
|
if (t.t2 = t.sent, t.t2) {
|
|
2759
2765
|
t.next = 8;
|
|
@@ -2794,21 +2800,21 @@ var $e = Promise.resolve({
|
|
|
2794
2800
|
}
|
|
2795
2801
|
};
|
|
2796
2802
|
}),
|
|
2797
|
-
|
|
2803
|
+
ot = Promise.resolve({
|
|
2798
2804
|
pkceRequiredForPasswordResets: !1
|
|
2799
2805
|
}),
|
|
2800
|
-
|
|
2806
|
+
st = function () {
|
|
2801
2807
|
function e(t, r, n) {
|
|
2802
|
-
var i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] :
|
|
2803
|
-
o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] :
|
|
2804
|
-
|
|
2808
|
+
var i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : ot,
|
|
2809
|
+
o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : Ye();
|
|
2810
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._config = i, this.dfpProtectedAuth = o;
|
|
2805
2811
|
}
|
|
2806
|
-
return
|
|
2812
|
+
return me(e, [{
|
|
2807
2813
|
key: "getCodeChallenge",
|
|
2808
2814
|
value: function value() {
|
|
2809
|
-
return
|
|
2815
|
+
return xe(this, void 0, void 0, fe().mark(function e() {
|
|
2810
2816
|
var t, r;
|
|
2811
|
-
return
|
|
2817
|
+
return fe().wrap(function (e) {
|
|
2812
2818
|
for (;;) switch (e.prev = e.next) {
|
|
2813
2819
|
case 0:
|
|
2814
2820
|
return e.next = 2, this._config;
|
|
@@ -2840,12 +2846,12 @@ var $e = Promise.resolve({
|
|
|
2840
2846
|
}, {
|
|
2841
2847
|
key: "authenticate",
|
|
2842
2848
|
value: function value(e) {
|
|
2843
|
-
return
|
|
2849
|
+
return xe(this, void 0, void 0, fe().mark(function t() {
|
|
2844
2850
|
var r, n, i, o, s, a;
|
|
2845
|
-
return
|
|
2851
|
+
return fe().wrap(function (t) {
|
|
2846
2852
|
for (;;) switch (t.prev = t.next) {
|
|
2847
2853
|
case 0:
|
|
2848
|
-
return
|
|
2854
|
+
return Ge("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();
|
|
2849
2855
|
case 3:
|
|
2850
2856
|
return r = t.sent, n = null == r ? void 0 : r.code_verifier, t.next = 7, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2851
2857
|
case 7:
|
|
@@ -2900,12 +2906,12 @@ var $e = Promise.resolve({
|
|
|
2900
2906
|
}, {
|
|
2901
2907
|
key: "resetByEmailStart",
|
|
2902
2908
|
value: function value(e) {
|
|
2903
|
-
return
|
|
2909
|
+
return xe(this, void 0, void 0, fe().mark(function t() {
|
|
2904
2910
|
var r, n, i, o;
|
|
2905
|
-
return
|
|
2911
|
+
return fe().wrap(function (t) {
|
|
2906
2912
|
for (;;) switch (t.prev = t.next) {
|
|
2907
2913
|
case 0:
|
|
2908
|
-
return
|
|
2914
|
+
return Ge("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();
|
|
2909
2915
|
case 3:
|
|
2910
2916
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2911
2917
|
case 6:
|
|
@@ -2936,12 +2942,12 @@ var $e = Promise.resolve({
|
|
|
2936
2942
|
}, {
|
|
2937
2943
|
key: "resetByEmail",
|
|
2938
2944
|
value: function value(e) {
|
|
2939
|
-
return
|
|
2945
|
+
return xe(this, void 0, void 0, fe().mark(function t() {
|
|
2940
2946
|
var r, n, i, o, s, a;
|
|
2941
|
-
return
|
|
2947
|
+
return fe().wrap(function (t) {
|
|
2942
2948
|
for (;;) switch (t.prev = t.next) {
|
|
2943
2949
|
case 0:
|
|
2944
|
-
return
|
|
2950
|
+
return Ge("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();
|
|
2945
2951
|
case 3:
|
|
2946
2952
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._pkceManager.getPKPair();
|
|
2947
2953
|
case 8:
|
|
@@ -2995,12 +3001,12 @@ var $e = Promise.resolve({
|
|
|
2995
3001
|
}, {
|
|
2996
3002
|
key: "resetByExistingPassword",
|
|
2997
3003
|
value: function value(e) {
|
|
2998
|
-
return
|
|
3004
|
+
return xe(this, void 0, void 0, fe().mark(function t() {
|
|
2999
3005
|
var r, n, i, o;
|
|
3000
|
-
return
|
|
3006
|
+
return fe().wrap(function (t) {
|
|
3001
3007
|
for (;;) switch (t.prev = t.next) {
|
|
3002
3008
|
case 0:
|
|
3003
|
-
return
|
|
3009
|
+
return Ge("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();
|
|
3004
3010
|
case 3:
|
|
3005
3011
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
3006
3012
|
url: "/b2b/passwords/existing_password/reset",
|
|
@@ -3044,12 +3050,12 @@ var $e = Promise.resolve({
|
|
|
3044
3050
|
}, {
|
|
3045
3051
|
key: "resetBySession",
|
|
3046
3052
|
value: function value(e) {
|
|
3047
|
-
return
|
|
3053
|
+
return xe(this, void 0, void 0, fe().mark(function t() {
|
|
3048
3054
|
var r, n, i, o;
|
|
3049
|
-
return
|
|
3055
|
+
return fe().wrap(function (t) {
|
|
3050
3056
|
for (;;) switch (t.prev = t.next) {
|
|
3051
3057
|
case 0:
|
|
3052
|
-
return
|
|
3058
|
+
return Ge("stytch.passwords.resetBySession").isString("password", e.password), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3053
3059
|
case 3:
|
|
3054
3060
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
3055
3061
|
url: "/b2b/passwords/session/reset",
|
|
@@ -3083,11 +3089,11 @@ var $e = Promise.resolve({
|
|
|
3083
3089
|
}, {
|
|
3084
3090
|
key: "strengthCheck",
|
|
3085
3091
|
value: function value(e) {
|
|
3086
|
-
return
|
|
3087
|
-
return
|
|
3092
|
+
return xe(this, void 0, void 0, fe().mark(function t() {
|
|
3093
|
+
return fe().wrap(function (t) {
|
|
3088
3094
|
for (;;) switch (t.prev = t.next) {
|
|
3089
3095
|
case 0:
|
|
3090
|
-
return
|
|
3096
|
+
return Ge("stytch.passwords.strengthCheck").isOptionalString("email", e.email_address).isString("password", e.password), t.abrupt("return", this._networkClient.fetchSDK({
|
|
3091
3097
|
url: "/b2b/passwords/strength_check",
|
|
3092
3098
|
method: "POST",
|
|
3093
3099
|
errorMessage: "Failed to check password strength.",
|
|
@@ -3105,17 +3111,17 @@ var $e = Promise.resolve({
|
|
|
3105
3111
|
}
|
|
3106
3112
|
}]), e;
|
|
3107
3113
|
}(),
|
|
3108
|
-
|
|
3114
|
+
at = me(function e(t, r) {
|
|
3109
3115
|
var n = this,
|
|
3110
|
-
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] :
|
|
3111
|
-
|
|
3116
|
+
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : Ye();
|
|
3117
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = i, this.sms = {
|
|
3112
3118
|
send: function send(e) {
|
|
3113
|
-
return
|
|
3119
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
3114
3120
|
var r, n, i;
|
|
3115
|
-
return
|
|
3121
|
+
return fe().wrap(function (t) {
|
|
3116
3122
|
for (;;) switch (t.prev = t.next) {
|
|
3117
3123
|
case 0:
|
|
3118
|
-
return
|
|
3124
|
+
return Ge("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();
|
|
3119
3125
|
case 3:
|
|
3120
3126
|
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();
|
|
3121
3127
|
case 13:
|
|
@@ -3144,12 +3150,12 @@ var $e = Promise.resolve({
|
|
|
3144
3150
|
}));
|
|
3145
3151
|
},
|
|
3146
3152
|
authenticate: function authenticate(e) {
|
|
3147
|
-
return
|
|
3153
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
3148
3154
|
var r, n, i, o, s;
|
|
3149
|
-
return
|
|
3155
|
+
return fe().wrap(function (t) {
|
|
3150
3156
|
for (;;) switch (t.prev = t.next) {
|
|
3151
3157
|
case 0:
|
|
3152
|
-
return
|
|
3158
|
+
return Ge("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();
|
|
3153
3159
|
case 3:
|
|
3154
3160
|
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();
|
|
3155
3161
|
case 12:
|
|
@@ -3190,20 +3196,20 @@ var $e = Promise.resolve({
|
|
|
3190
3196
|
}
|
|
3191
3197
|
};
|
|
3192
3198
|
}),
|
|
3193
|
-
|
|
3199
|
+
ct = function () {
|
|
3194
3200
|
function e(t, r) {
|
|
3195
|
-
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] :
|
|
3196
|
-
|
|
3201
|
+
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : Ye();
|
|
3202
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n;
|
|
3197
3203
|
}
|
|
3198
|
-
return
|
|
3204
|
+
return me(e, [{
|
|
3199
3205
|
key: "create",
|
|
3200
3206
|
value: function value(e) {
|
|
3201
|
-
return
|
|
3207
|
+
return xe(this, void 0, void 0, fe().mark(function t() {
|
|
3202
3208
|
var r, n, i;
|
|
3203
|
-
return
|
|
3209
|
+
return fe().wrap(function (t) {
|
|
3204
3210
|
for (;;) switch (t.prev = t.next) {
|
|
3205
3211
|
case 0:
|
|
3206
|
-
return
|
|
3212
|
+
return Ge("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();
|
|
3207
3213
|
case 3:
|
|
3208
3214
|
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();
|
|
3209
3215
|
case 13:
|
|
@@ -3234,12 +3240,12 @@ var $e = Promise.resolve({
|
|
|
3234
3240
|
}, {
|
|
3235
3241
|
key: "authenticate",
|
|
3236
3242
|
value: function value(e) {
|
|
3237
|
-
return
|
|
3243
|
+
return xe(this, void 0, void 0, fe().mark(function t() {
|
|
3238
3244
|
var r, n, i, o, s;
|
|
3239
|
-
return
|
|
3245
|
+
return fe().wrap(function (t) {
|
|
3240
3246
|
for (;;) switch (t.prev = t.next) {
|
|
3241
3247
|
case 0:
|
|
3242
|
-
return
|
|
3248
|
+
return Ge("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();
|
|
3243
3249
|
case 3:
|
|
3244
3250
|
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();
|
|
3245
3251
|
case 12:
|
|
@@ -3280,20 +3286,20 @@ var $e = Promise.resolve({
|
|
|
3280
3286
|
}
|
|
3281
3287
|
}]), e;
|
|
3282
3288
|
}(),
|
|
3283
|
-
|
|
3289
|
+
ut = function () {
|
|
3284
3290
|
function e(t, r) {
|
|
3285
|
-
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] :
|
|
3286
|
-
|
|
3291
|
+
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : Ye();
|
|
3292
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n;
|
|
3287
3293
|
}
|
|
3288
|
-
return
|
|
3294
|
+
return me(e, [{
|
|
3289
3295
|
key: "recover",
|
|
3290
3296
|
value: function value(e) {
|
|
3291
|
-
return
|
|
3297
|
+
return xe(this, void 0, void 0, fe().mark(function t() {
|
|
3292
3298
|
var r, n, i, o, s;
|
|
3293
|
-
return
|
|
3299
|
+
return fe().wrap(function (t) {
|
|
3294
3300
|
for (;;) switch (t.prev = t.next) {
|
|
3295
3301
|
case 0:
|
|
3296
|
-
return
|
|
3302
|
+
return Ge("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();
|
|
3297
3303
|
case 3:
|
|
3298
3304
|
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();
|
|
3299
3305
|
case 12:
|
|
@@ -3335,9 +3341,9 @@ var $e = Promise.resolve({
|
|
|
3335
3341
|
}, {
|
|
3336
3342
|
key: "rotate",
|
|
3337
3343
|
value: function value() {
|
|
3338
|
-
return
|
|
3344
|
+
return xe(this, void 0, void 0, fe().mark(function e() {
|
|
3339
3345
|
var t, r, n;
|
|
3340
|
-
return
|
|
3346
|
+
return fe().wrap(function (e) {
|
|
3341
3347
|
for (;;) switch (e.prev = e.next) {
|
|
3342
3348
|
case 0:
|
|
3343
3349
|
return e.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
@@ -3362,8 +3368,8 @@ var $e = Promise.resolve({
|
|
|
3362
3368
|
}, {
|
|
3363
3369
|
key: "get",
|
|
3364
3370
|
value: function value() {
|
|
3365
|
-
return
|
|
3366
|
-
return
|
|
3371
|
+
return xe(this, void 0, void 0, fe().mark(function e() {
|
|
3372
|
+
return fe().wrap(function (e) {
|
|
3367
3373
|
for (;;) switch (e.prev = e.next) {
|
|
3368
3374
|
case 0:
|
|
3369
3375
|
return e.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -3380,21 +3386,21 @@ var $e = Promise.resolve({
|
|
|
3380
3386
|
}
|
|
3381
3387
|
}]), e;
|
|
3382
3388
|
}(),
|
|
3383
|
-
|
|
3389
|
+
lt = function () {
|
|
3384
3390
|
function e(t, r, n) {
|
|
3385
3391
|
var i = this;
|
|
3386
|
-
|
|
3392
|
+
be(this, e), this._subscriptionService = n, this.isAuthorizedSync = function (e, t) {
|
|
3387
3393
|
var r;
|
|
3388
3394
|
return !!(null === (r = i.cachedPolicy) || void 0 === r ? void 0 : r.callerIsAuthorized(i.roleIds(), e, t));
|
|
3389
3395
|
}, this.isAuthorized = function (e, t) {
|
|
3390
3396
|
return i.policyPromise.then(function (r) {
|
|
3391
3397
|
return r.callerIsAuthorized(i.roleIds(), e, t);
|
|
3392
3398
|
});
|
|
3393
|
-
}, this.cachedPolicy = t.rbacPolicy ?
|
|
3394
|
-
return e.rbacPolicy ? (i.cachedPolicy =
|
|
3399
|
+
}, this.cachedPolicy = t.rbacPolicy ? _t.fromJSON(t.rbacPolicy) : null, this.policyPromise = r.then(function (e) {
|
|
3400
|
+
return e.rbacPolicy ? (i.cachedPolicy = _t.fromJSON(e.rbacPolicy), i.cachedPolicy) : (qe("Unable to retrieve RBAC policy from servers. Assuming caller has no permissions."), new _t([], []));
|
|
3395
3401
|
});
|
|
3396
3402
|
}
|
|
3397
|
-
return
|
|
3403
|
+
return me(e, [{
|
|
3398
3404
|
key: "allPermissions",
|
|
3399
3405
|
value: function value() {
|
|
3400
3406
|
var e = this;
|
|
@@ -3411,15 +3417,15 @@ var $e = Promise.resolve({
|
|
|
3411
3417
|
}
|
|
3412
3418
|
}]), e;
|
|
3413
3419
|
}(),
|
|
3414
|
-
|
|
3420
|
+
dt = function () {
|
|
3415
3421
|
function e(t) {
|
|
3416
|
-
|
|
3422
|
+
be(this, e), this.iframeURL = t, this.createIframe();
|
|
3417
3423
|
}
|
|
3418
|
-
return
|
|
3424
|
+
return me(e, [{
|
|
3419
3425
|
key: "createIframe",
|
|
3420
3426
|
value: function value() {
|
|
3421
3427
|
var e = document.querySelector('[src~="'.concat(this.iframeURL, '"]'));
|
|
3422
|
-
e ?
|
|
3428
|
+
e ? Ue("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) {
|
|
3423
3429
|
e.addEventListener("load", function () {
|
|
3424
3430
|
e.dataset.loaded = "true", t(e);
|
|
3425
3431
|
}, {
|
|
@@ -3430,11 +3436,11 @@ var $e = Promise.resolve({
|
|
|
3430
3436
|
}, {
|
|
3431
3437
|
key: "call",
|
|
3432
3438
|
value: function value(e, t) {
|
|
3433
|
-
return
|
|
3439
|
+
return xe(this, void 0, void 0, fe().mark(function r() {
|
|
3434
3440
|
var n,
|
|
3435
3441
|
i,
|
|
3436
3442
|
o = this;
|
|
3437
|
-
return
|
|
3443
|
+
return fe().wrap(function (r) {
|
|
3438
3444
|
for (;;) switch (r.prev = r.next) {
|
|
3439
3445
|
case 0:
|
|
3440
3446
|
return r.next = 2, this.frame;
|
|
@@ -3443,7 +3449,7 @@ var $e = Promise.resolve({
|
|
|
3443
3449
|
var a;
|
|
3444
3450
|
i.port1.onmessage = function (e) {
|
|
3445
3451
|
var t = e.data;
|
|
3446
|
-
i.port1.close(), t.success ? r(t.payload) : s(
|
|
3452
|
+
i.port1.close(), t.success ? r(t.payload) : s(Je.unmarshall(t.error));
|
|
3447
3453
|
};
|
|
3448
3454
|
var c = {
|
|
3449
3455
|
method: e,
|
|
@@ -3460,11 +3466,11 @@ var $e = Promise.resolve({
|
|
|
3460
3466
|
}
|
|
3461
3467
|
}]), e;
|
|
3462
3468
|
}(),
|
|
3463
|
-
|
|
3469
|
+
ht = function () {
|
|
3464
3470
|
function e(t, r) {
|
|
3465
|
-
|
|
3471
|
+
be(this, e), this._networkClient = t, this.dfpProtectedAuth = r;
|
|
3466
3472
|
}
|
|
3467
|
-
return
|
|
3473
|
+
return me(e, [{
|
|
3468
3474
|
key: "searchUser",
|
|
3469
3475
|
value: function value(e) {
|
|
3470
3476
|
var t = this;
|
|
@@ -3510,17 +3516,17 @@ var $e = Promise.resolve({
|
|
|
3510
3516
|
}
|
|
3511
3517
|
}]), e;
|
|
3512
3518
|
}(),
|
|
3513
|
-
|
|
3519
|
+
pt = function () {
|
|
3514
3520
|
function e(t, r) {
|
|
3515
3521
|
var n = this;
|
|
3516
|
-
|
|
3522
|
+
be(this, e), this._subscriptionService = t, this._headlessSessionClient = r, this._onDataChange = function (e) {
|
|
3517
3523
|
!function (e) {
|
|
3518
3524
|
return !!(null == e ? void 0 : e.session);
|
|
3519
3525
|
}(e) ? n.cancelBackgroundRefresh() : n.scheduleBackgroundRefresh();
|
|
3520
3526
|
}, this._reauthenticateWithBackoff = function () {
|
|
3521
|
-
return
|
|
3527
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
3522
3528
|
var r;
|
|
3523
|
-
return
|
|
3529
|
+
return fe().wrap(function (t) {
|
|
3524
3530
|
for (;;) switch (t.prev = t.next) {
|
|
3525
3531
|
case 0:
|
|
3526
3532
|
r = 0;
|
|
@@ -3549,14 +3555,14 @@ var $e = Promise.resolve({
|
|
|
3549
3555
|
}));
|
|
3550
3556
|
}, this.timeout = null, this._subscriptionService.subscribeToState(this._onDataChange);
|
|
3551
3557
|
}
|
|
3552
|
-
return
|
|
3558
|
+
return me(e, [{
|
|
3553
3559
|
key: "performBackgroundRefresh",
|
|
3554
3560
|
value: function value() {
|
|
3555
3561
|
var e = this;
|
|
3556
3562
|
this._reauthenticateWithBackoff().then(function () {
|
|
3557
3563
|
e.scheduleBackgroundRefresh();
|
|
3558
3564
|
})["catch"](function (t) {
|
|
3559
|
-
|
|
3565
|
+
Ue("Session background refresh failed. Signalling to app that user is logged out.", {
|
|
3560
3566
|
error: t
|
|
3561
3567
|
}), e._subscriptionService.destroySession();
|
|
3562
3568
|
});
|
|
@@ -3586,23 +3592,23 @@ var $e = Promise.resolve({
|
|
|
3586
3592
|
}
|
|
3587
3593
|
}]), e;
|
|
3588
3594
|
}();
|
|
3589
|
-
|
|
3590
|
-
var
|
|
3595
|
+
pt.REFRESH_INTERVAL_MS = 18e4;
|
|
3596
|
+
var ft = me(function e(t, r) {
|
|
3591
3597
|
var n = this;
|
|
3592
|
-
|
|
3598
|
+
be(this, e), this._subscriptionService = t, this.emptyState = r, this.onStateChange = function (e) {
|
|
3593
3599
|
return n._subscriptionService.subscribeToState(function (t) {
|
|
3594
3600
|
e(null != t ? t : n.emptyState);
|
|
3595
3601
|
});
|
|
3596
3602
|
};
|
|
3597
3603
|
}),
|
|
3598
|
-
|
|
3604
|
+
_t = function () {
|
|
3599
3605
|
function e(t, r) {
|
|
3600
3606
|
var n = this;
|
|
3601
|
-
|
|
3607
|
+
be(this, e), this.roles = t, this.resources = r, this.rolesByID = {}, t.forEach(function (e) {
|
|
3602
3608
|
return n.rolesByID[e.role_id] = e;
|
|
3603
3609
|
});
|
|
3604
3610
|
}
|
|
3605
|
-
return
|
|
3611
|
+
return me(e, [{
|
|
3606
3612
|
key: "callerIsAuthorized",
|
|
3607
3613
|
value: function value(e, t, r) {
|
|
3608
3614
|
var n = this;
|
|
@@ -3636,19 +3642,19 @@ var pt = _e(function e(t, r) {
|
|
|
3636
3642
|
}
|
|
3637
3643
|
}]), e;
|
|
3638
3644
|
}();
|
|
3639
|
-
var
|
|
3640
|
-
var
|
|
3641
|
-
function
|
|
3645
|
+
var mt = "bootstrap";
|
|
3646
|
+
var vt = /*#__PURE__*/function () {
|
|
3647
|
+
function vt(e, t, r) {
|
|
3642
3648
|
var _this = this;
|
|
3643
|
-
_classCallCheck(this,
|
|
3649
|
+
_classCallCheck(this, vt);
|
|
3644
3650
|
this._publicToken = e, this._networkClient = t, this._dataLayer = r, this._bootstrapDataPromise = this._networkClient.fetchSDK({
|
|
3645
3651
|
url: "/projects/bootstrap/".concat(this._publicToken),
|
|
3646
3652
|
method: "GET",
|
|
3647
3653
|
errorMessage: "Error fetching bootstrap data for SDK for ".concat(this._publicToken)
|
|
3648
|
-
}).then(
|
|
3649
|
-
return _this._dataLayer.setItem(
|
|
3654
|
+
}).then(vt.mapBootstrapData).then(function (e) {
|
|
3655
|
+
return _this._dataLayer.setItem(mt, JSON.stringify(e)), e;
|
|
3650
3656
|
})["catch"](function (e) {
|
|
3651
|
-
return
|
|
3657
|
+
return qe(e), {
|
|
3652
3658
|
displayWatermark: !1,
|
|
3653
3659
|
cnameDomain: null,
|
|
3654
3660
|
emailDomains: ["stytch.com"],
|
|
@@ -3667,10 +3673,10 @@ var mt = /*#__PURE__*/function () {
|
|
|
3667
3673
|
};
|
|
3668
3674
|
});
|
|
3669
3675
|
}
|
|
3670
|
-
_createClass(
|
|
3676
|
+
_createClass(vt, [{
|
|
3671
3677
|
key: "getSync",
|
|
3672
3678
|
value: function getSync() {
|
|
3673
|
-
var e = this._dataLayer.getItem(
|
|
3679
|
+
var e = this._dataLayer.getItem(mt);
|
|
3674
3680
|
if (null === e) return {
|
|
3675
3681
|
displayWatermark: !1,
|
|
3676
3682
|
cnameDomain: null,
|
|
@@ -3741,9 +3747,9 @@ var mt = /*#__PURE__*/function () {
|
|
|
3741
3747
|
};
|
|
3742
3748
|
}
|
|
3743
3749
|
}]);
|
|
3744
|
-
return
|
|
3750
|
+
return vt;
|
|
3745
3751
|
}();
|
|
3746
|
-
function
|
|
3752
|
+
function bt(e, t, r, n) {
|
|
3747
3753
|
return new (r || (r = Promise))(function (i, o) {
|
|
3748
3754
|
function s(e) {
|
|
3749
3755
|
try {
|
|
@@ -3769,11 +3775,11 @@ function vt(e, t, r, n) {
|
|
|
3769
3775
|
});
|
|
3770
3776
|
}
|
|
3771
3777
|
"function" == typeof SuppressedError && SuppressedError;
|
|
3772
|
-
var
|
|
3778
|
+
var gt = /*#__PURE__*/_createClass(function gt(e) {
|
|
3773
3779
|
var _this2 = this;
|
|
3774
|
-
_classCallCheck(this,
|
|
3780
|
+
_classCallCheck(this, gt);
|
|
3775
3781
|
this.bootstrapPromise = e, this.executeRecaptcha = function () {
|
|
3776
|
-
return
|
|
3782
|
+
return bt(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
3777
3783
|
var _yield$this$state, e, t, r;
|
|
3778
3784
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3779
3785
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -3804,7 +3810,7 @@ var bt = /*#__PURE__*/_createClass(function bt(e) {
|
|
|
3804
3810
|
}, _callee, this);
|
|
3805
3811
|
}));
|
|
3806
3812
|
}, this.state = e.then(function (e) {
|
|
3807
|
-
return
|
|
3813
|
+
return bt(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
3808
3814
|
var t;
|
|
3809
3815
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3810
3816
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -3815,7 +3821,7 @@ var bt = /*#__PURE__*/_createClass(function bt(e) {
|
|
|
3815
3821
|
}
|
|
3816
3822
|
_context2.t1 = !0;
|
|
3817
3823
|
_context2.next = 4;
|
|
3818
|
-
return t = e.captchaSettings.siteKey,
|
|
3824
|
+
return t = e.captchaSettings.siteKey, je("https://www.google.com/recaptcha/enterprise.js?render=".concat(t), function () {
|
|
3819
3825
|
return window.grecaptcha.enterprise;
|
|
3820
3826
|
});
|
|
3821
3827
|
case 4:
|
|
@@ -3842,10 +3848,10 @@ var bt = /*#__PURE__*/_createClass(function bt(e) {
|
|
|
3842
3848
|
}));
|
|
3843
3849
|
});
|
|
3844
3850
|
});
|
|
3845
|
-
var
|
|
3846
|
-
function
|
|
3851
|
+
var yt = /*#__PURE__*/function () {
|
|
3852
|
+
function yt(e) {
|
|
3847
3853
|
var _this3 = this;
|
|
3848
|
-
_classCallCheck(this,
|
|
3854
|
+
_classCallCheck(this, yt);
|
|
3849
3855
|
this.iframeURL = e, this.oneTapStart = function (e) {
|
|
3850
3856
|
return _this3.call("oneTapStart", e);
|
|
3851
3857
|
}, this.oneTapSubmit = function (e) {
|
|
@@ -3854,11 +3860,11 @@ var gt = /*#__PURE__*/function () {
|
|
|
3854
3860
|
return _this3.call("parsedPhoneNumber", e);
|
|
3855
3861
|
};
|
|
3856
3862
|
}
|
|
3857
|
-
_createClass(
|
|
3863
|
+
_createClass(yt, [{
|
|
3858
3864
|
key: "frameClient",
|
|
3859
3865
|
get: function get() {
|
|
3860
3866
|
var e;
|
|
3861
|
-
return this._frameClient = null !== (e = this._frameClient) && void 0 !== e ? e : new
|
|
3867
|
+
return this._frameClient = null !== (e = this._frameClient) && void 0 !== e ? e : new dt(this.iframeURL), this._frameClient;
|
|
3862
3868
|
}
|
|
3863
3869
|
}, {
|
|
3864
3870
|
key: "call",
|
|
@@ -3866,20 +3872,20 @@ var gt = /*#__PURE__*/function () {
|
|
|
3866
3872
|
return this.frameClient.call(e, [t]);
|
|
3867
3873
|
}
|
|
3868
3874
|
}]);
|
|
3869
|
-
return
|
|
3875
|
+
return yt;
|
|
3870
3876
|
}();
|
|
3871
|
-
var
|
|
3872
|
-
function
|
|
3873
|
-
_classCallCheck(this,
|
|
3877
|
+
var kt = /*#__PURE__*/function () {
|
|
3878
|
+
function kt(e, t, r, n) {
|
|
3879
|
+
_classCallCheck(this, kt);
|
|
3874
3880
|
this._publicToken = e, this._subscriptionDataLayer = t, this.baseURL = r, this.additionalTelemetryDataFn = n, this.updateSessionToken = function () {
|
|
3875
3881
|
return null;
|
|
3876
|
-
}, this.eventLogger = new
|
|
3882
|
+
}, this.eventLogger = new $e({
|
|
3877
3883
|
maxBatchSize: 15,
|
|
3878
3884
|
intervalDurationMs: 800,
|
|
3879
3885
|
logEventURL: this.buildSDKUrl("/events")
|
|
3880
3886
|
});
|
|
3881
3887
|
}
|
|
3882
|
-
_createClass(
|
|
3888
|
+
_createClass(kt, [{
|
|
3883
3889
|
key: "logEvent",
|
|
3884
3890
|
value: function logEvent(_ref) {
|
|
3885
3891
|
var e = _ref.name,
|
|
@@ -3899,9 +3905,9 @@ var yt = /*#__PURE__*/function () {
|
|
|
3899
3905
|
key: "createTelemetryBlob",
|
|
3900
3906
|
value: function createTelemetryBlob() {
|
|
3901
3907
|
return Object.assign(Object.assign({
|
|
3902
|
-
event_id: "event-id-".concat(
|
|
3903
|
-
app_session_id: "app-session-id-".concat(
|
|
3904
|
-
persistent_id: "persistent-id-".concat(
|
|
3908
|
+
event_id: "event-id-".concat(Be()),
|
|
3909
|
+
app_session_id: "app-session-id-".concat(Be()),
|
|
3910
|
+
persistent_id: "persistent-id-".concat(Be()),
|
|
3905
3911
|
client_sent_at: new Date().toISOString(),
|
|
3906
3912
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
3907
3913
|
}, this.additionalTelemetryDataFn()), {
|
|
@@ -3910,7 +3916,7 @@ var yt = /*#__PURE__*/function () {
|
|
|
3910
3916
|
},
|
|
3911
3917
|
sdk: {
|
|
3912
3918
|
identifier: "Stytch.js Javascript SDK",
|
|
3913
|
-
version: "4.9.
|
|
3919
|
+
version: "4.9.1"
|
|
3914
3920
|
}
|
|
3915
3921
|
});
|
|
3916
3922
|
}
|
|
@@ -3921,13 +3927,13 @@ var yt = /*#__PURE__*/function () {
|
|
|
3921
3927
|
t = _ref2.body,
|
|
3922
3928
|
r = _ref2.errorMessage,
|
|
3923
3929
|
n = _ref2.method;
|
|
3924
|
-
return
|
|
3930
|
+
return bt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
3925
3931
|
var i, o, s, a;
|
|
3926
3932
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3927
3933
|
while (1) switch (_context3.prev = _context3.next) {
|
|
3928
3934
|
case 0:
|
|
3929
3935
|
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;
|
|
3930
|
-
return _context3.abrupt("return",
|
|
3936
|
+
return _context3.abrupt("return", Ee({
|
|
3931
3937
|
basicAuthHeader: o,
|
|
3932
3938
|
body: t,
|
|
3933
3939
|
errorMessage: r,
|
|
@@ -3951,7 +3957,7 @@ var yt = /*#__PURE__*/function () {
|
|
|
3951
3957
|
r = _ref3.errorMessage,
|
|
3952
3958
|
n = _ref3.method,
|
|
3953
3959
|
i = _ref3.retryCallback;
|
|
3954
|
-
return
|
|
3960
|
+
return bt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
3955
3961
|
var o, s, a, c;
|
|
3956
3962
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
3957
3963
|
while (1) switch (_context4.prev = _context4.next) {
|
|
@@ -3966,9 +3972,9 @@ var yt = /*#__PURE__*/function () {
|
|
|
3966
3972
|
s = e.xSDKParentHostHeader,
|
|
3967
3973
|
a = e.body,
|
|
3968
3974
|
c = e.retryCallback;
|
|
3969
|
-
return
|
|
3975
|
+
return xe(this, void 0, void 0, fe().mark(function e() {
|
|
3970
3976
|
var u;
|
|
3971
|
-
return
|
|
3977
|
+
return fe().wrap(function (e) {
|
|
3972
3978
|
for (;;) switch (e.prev = e.next) {
|
|
3973
3979
|
case 0:
|
|
3974
3980
|
return u = {
|
|
@@ -3979,18 +3985,18 @@ var yt = /*#__PURE__*/function () {
|
|
|
3979
3985
|
xSDKClientHeader: o,
|
|
3980
3986
|
xSDKParentHostHeader: s,
|
|
3981
3987
|
body: a
|
|
3982
|
-
}, e.prev = 1, e.next = 4,
|
|
3988
|
+
}, e.prev = 1, e.next = 4, Ee(u);
|
|
3983
3989
|
case 4:
|
|
3984
3990
|
case 15:
|
|
3985
3991
|
return e.abrupt("return", e.sent);
|
|
3986
3992
|
case 7:
|
|
3987
|
-
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof
|
|
3993
|
+
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof Te)) {
|
|
3988
3994
|
e.next = 16;
|
|
3989
3995
|
break;
|
|
3990
3996
|
}
|
|
3991
3997
|
return e.next = 12, c(e.t0, u);
|
|
3992
3998
|
case 12:
|
|
3993
|
-
return u = e.sent, e.next = 15,
|
|
3999
|
+
return u = e.sent, e.next = 15, Ee(u);
|
|
3994
4000
|
case 16:
|
|
3995
4001
|
throw e.t0;
|
|
3996
4002
|
case 17:
|
|
@@ -4022,18 +4028,18 @@ var yt = /*#__PURE__*/function () {
|
|
|
4022
4028
|
return "".concat(this.baseURL, "/sdk/v1").concat(e);
|
|
4023
4029
|
}
|
|
4024
4030
|
}]);
|
|
4025
|
-
return
|
|
4031
|
+
return kt;
|
|
4026
4032
|
}();
|
|
4027
|
-
function
|
|
4033
|
+
function wt(e) {
|
|
4028
4034
|
var t = e.toString(16);
|
|
4029
4035
|
return 1 === t.length && (t = "0" + t), t;
|
|
4030
4036
|
}
|
|
4031
|
-
var
|
|
4032
|
-
function
|
|
4033
|
-
_classCallCheck(this,
|
|
4037
|
+
var St = /*#__PURE__*/function () {
|
|
4038
|
+
function St(e, t) {
|
|
4039
|
+
_classCallCheck(this, St);
|
|
4034
4040
|
this._dataLayer = e, this.namespace = t;
|
|
4035
4041
|
}
|
|
4036
|
-
_createClass(
|
|
4042
|
+
_createClass(St, [{
|
|
4037
4043
|
key: "key",
|
|
4038
4044
|
value: function key() {
|
|
4039
4045
|
return "PKCE_VERIFIER:" + this.namespace;
|
|
@@ -4041,13 +4047,13 @@ var wt = /*#__PURE__*/function () {
|
|
|
4041
4047
|
}, {
|
|
4042
4048
|
key: "startPKCETransaction",
|
|
4043
4049
|
value: function startPKCETransaction() {
|
|
4044
|
-
return
|
|
4050
|
+
return bt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
4045
4051
|
var e;
|
|
4046
4052
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
4047
4053
|
while (1) switch (_context5.prev = _context5.next) {
|
|
4048
4054
|
case 0:
|
|
4049
4055
|
_context5.next = 2;
|
|
4050
|
-
return
|
|
4056
|
+
return St.createProofkeyPair();
|
|
4051
4057
|
case 2:
|
|
4052
4058
|
e = _context5.sent;
|
|
4053
4059
|
return _context5.abrupt("return", (this._dataLayer.setItem(this.key(), JSON.stringify(e)), e));
|
|
@@ -4065,7 +4071,7 @@ var wt = /*#__PURE__*/function () {
|
|
|
4065
4071
|
if (null !== e) try {
|
|
4066
4072
|
return JSON.parse(e);
|
|
4067
4073
|
} catch (e) {
|
|
4068
|
-
return void
|
|
4074
|
+
return void Ue("Found malformed Proof Key pair in localstorage.");
|
|
4069
4075
|
}
|
|
4070
4076
|
}
|
|
4071
4077
|
}, {
|
|
@@ -4076,7 +4082,7 @@ var wt = /*#__PURE__*/function () {
|
|
|
4076
4082
|
}], [{
|
|
4077
4083
|
key: "createProofkeyPair",
|
|
4078
4084
|
value: function createProofkeyPair() {
|
|
4079
|
-
return
|
|
4085
|
+
return bt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
4080
4086
|
var _String$fromCharCode;
|
|
4081
4087
|
var e, t, r, n;
|
|
4082
4088
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
@@ -4084,7 +4090,7 @@ var wt = /*#__PURE__*/function () {
|
|
|
4084
4090
|
case 0:
|
|
4085
4091
|
e = new Uint32Array(16);
|
|
4086
4092
|
window.crypto.getRandomValues(e);
|
|
4087
|
-
t = Array.from(e).map(
|
|
4093
|
+
t = Array.from(e).map(wt).join("");
|
|
4088
4094
|
_context6.next = 5;
|
|
4089
4095
|
return window.crypto.subtle.digest("SHA-256", new TextEncoder().encode(t));
|
|
4090
4096
|
case 5:
|
|
@@ -4101,9 +4107,9 @@ var wt = /*#__PURE__*/function () {
|
|
|
4101
4107
|
}));
|
|
4102
4108
|
}
|
|
4103
4109
|
}]);
|
|
4104
|
-
return
|
|
4110
|
+
return St;
|
|
4105
4111
|
}();
|
|
4106
|
-
var
|
|
4112
|
+
var Pt = function Pt(e) {
|
|
4107
4113
|
return (document.cookie ? document.cookie.split("; ") : []).filter(function (t) {
|
|
4108
4114
|
var _t$split = t.split("="),
|
|
4109
4115
|
_t$split2 = _slicedToArray(_t$split, 1),
|
|
@@ -4112,17 +4118,17 @@ var St = function St(e) {
|
|
|
4112
4118
|
}).length > 1;
|
|
4113
4119
|
};
|
|
4114
4120
|
/*! js-cookie v3.0.1 | MIT */
|
|
4115
|
-
function
|
|
4121
|
+
function xt(e) {
|
|
4116
4122
|
for (var t = 1; t < arguments.length; t++) {
|
|
4117
4123
|
var r = arguments[t];
|
|
4118
4124
|
for (var n in r) e[n] = r[n];
|
|
4119
4125
|
}
|
|
4120
4126
|
return e;
|
|
4121
4127
|
}
|
|
4122
|
-
var
|
|
4128
|
+
var Ct = function e(t, r) {
|
|
4123
4129
|
function n(e, n, i) {
|
|
4124
4130
|
if ("undefined" != typeof document) {
|
|
4125
|
-
"number" == typeof (i =
|
|
4131
|
+
"number" == typeof (i = xt({}, 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);
|
|
4126
4132
|
var o = "";
|
|
4127
4133
|
for (var s in i) i[s] && (o += "; " + s, !0 !== i[s] && (o += "=" + i[s].split(";")[0]));
|
|
4128
4134
|
return document.cookie = e + "=" + t.write(n, e) + o;
|
|
@@ -4144,15 +4150,15 @@ var xt = function e(t, r) {
|
|
|
4144
4150
|
}
|
|
4145
4151
|
},
|
|
4146
4152
|
remove: function remove(e, t) {
|
|
4147
|
-
n(e, "",
|
|
4153
|
+
n(e, "", xt({}, t, {
|
|
4148
4154
|
expires: -1
|
|
4149
4155
|
}));
|
|
4150
4156
|
},
|
|
4151
4157
|
withAttributes: function withAttributes(t) {
|
|
4152
|
-
return e(this.converter,
|
|
4158
|
+
return e(this.converter, xt({}, this.attributes, t));
|
|
4153
4159
|
},
|
|
4154
4160
|
withConverter: function withConverter(t) {
|
|
4155
|
-
return e(
|
|
4161
|
+
return e(xt({}, this.converter, t), this.attributes);
|
|
4156
4162
|
}
|
|
4157
4163
|
}, {
|
|
4158
4164
|
attributes: {
|
|
@@ -4172,37 +4178,37 @@ var xt = function e(t, r) {
|
|
|
4172
4178
|
}, {
|
|
4173
4179
|
path: "/"
|
|
4174
4180
|
});
|
|
4175
|
-
var
|
|
4181
|
+
var Tt = function Tt(e) {
|
|
4176
4182
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
4177
4183
|
return "stytch_sdk_state_".concat(e).concat(t ? "::".concat(t) : "");
|
|
4178
4184
|
},
|
|
4179
|
-
|
|
4185
|
+
Et = new Map(),
|
|
4180
4186
|
Ot = function Ot(e) {
|
|
4181
|
-
clearTimeout(
|
|
4187
|
+
clearTimeout(Et.get(e));
|
|
4182
4188
|
},
|
|
4183
|
-
|
|
4189
|
+
At = function At(e, t, r) {
|
|
4184
4190
|
Ot(e);
|
|
4185
4191
|
var n = setTimeout(function () {
|
|
4186
|
-
void 0 ===
|
|
4192
|
+
void 0 === Ct.get(e) && Ct.set(e, t, r);
|
|
4187
4193
|
}, 10);
|
|
4188
|
-
return
|
|
4194
|
+
return Et.set(e, n), Ct.set(e, t, r);
|
|
4189
4195
|
};
|
|
4190
|
-
var
|
|
4191
|
-
function
|
|
4196
|
+
var Dt = /*#__PURE__*/function () {
|
|
4197
|
+
function Dt(e, t) {
|
|
4192
4198
|
var _this4 = this;
|
|
4193
|
-
_classCallCheck(this,
|
|
4199
|
+
_classCallCheck(this, Dt);
|
|
4194
4200
|
this.browserSessionStorage = {
|
|
4195
4201
|
getItem: function getItem(e) {
|
|
4196
|
-
return sessionStorage.getItem(
|
|
4202
|
+
return sessionStorage.getItem(Tt(_this4.publicToken, e));
|
|
4197
4203
|
},
|
|
4198
4204
|
setItem: function setItem(e, t) {
|
|
4199
|
-
return sessionStorage.setItem(
|
|
4205
|
+
return sessionStorage.setItem(Tt(_this4.publicToken, e), t);
|
|
4200
4206
|
},
|
|
4201
4207
|
removeItem: function removeItem(e) {
|
|
4202
|
-
return sessionStorage.removeItem(
|
|
4208
|
+
return sessionStorage.removeItem(Tt(_this4.publicToken, e));
|
|
4203
4209
|
}
|
|
4204
|
-
}, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (
|
|
4205
|
-
var r = localStorage.getItem(
|
|
4210
|
+
}, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (Ge("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);
|
|
4211
|
+
var r = localStorage.getItem(Tt(this.publicToken));
|
|
4206
4212
|
if (!r) return;
|
|
4207
4213
|
var n;
|
|
4208
4214
|
try {
|
|
@@ -4212,7 +4218,7 @@ var At = /*#__PURE__*/function () {
|
|
|
4212
4218
|
}
|
|
4213
4219
|
this.state = n;
|
|
4214
4220
|
}
|
|
4215
|
-
_createClass(
|
|
4221
|
+
_createClass(Dt, [{
|
|
4216
4222
|
key: "opaqueTokenCookieName",
|
|
4217
4223
|
get: function get() {
|
|
4218
4224
|
var e;
|
|
@@ -4234,14 +4240,14 @@ var At = /*#__PURE__*/function () {
|
|
|
4234
4240
|
key: "readSessionCookie",
|
|
4235
4241
|
value: function readSessionCookie() {
|
|
4236
4242
|
return {
|
|
4237
|
-
session_token:
|
|
4238
|
-
session_jwt:
|
|
4243
|
+
session_token: Ct.get(this.opaqueTokenCookieName),
|
|
4244
|
+
session_jwt: Ct.get(this.jwtCookieName)
|
|
4239
4245
|
};
|
|
4240
4246
|
}
|
|
4241
4247
|
}, {
|
|
4242
4248
|
key: "readIntermediateSessionTokenCookie",
|
|
4243
4249
|
value: function readIntermediateSessionTokenCookie() {
|
|
4244
|
-
return
|
|
4250
|
+
return Ct.get(this.istCookieName);
|
|
4245
4251
|
}
|
|
4246
4252
|
}, {
|
|
4247
4253
|
key: "writeSessionCookie",
|
|
@@ -4250,32 +4256,32 @@ var At = /*#__PURE__*/function () {
|
|
|
4250
4256
|
var o = e.state,
|
|
4251
4257
|
s = e.session_token,
|
|
4252
4258
|
a = e.session_jwt,
|
|
4253
|
-
c =
|
|
4259
|
+
c = Dt.generateCookieOpts({
|
|
4254
4260
|
expiresAt: null !== (r = null === (t = null == o ? void 0 : o.session) || void 0 === t ? void 0 : t.expires_at) && void 0 !== r ? r : "",
|
|
4255
4261
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4256
4262
|
path: this._cookiePath,
|
|
4257
4263
|
domain: this._domain
|
|
4258
4264
|
});
|
|
4259
|
-
|
|
4260
|
-
var u =
|
|
4265
|
+
At(this.opaqueTokenCookieName, s, c), At(this.jwtCookieName, a, c);
|
|
4266
|
+
var u = Dt.generateCookieOpts({
|
|
4261
4267
|
expiresAt: null !== (i = null === (n = null == o ? void 0 : o.session) || void 0 === n ? void 0 : n.expires_at) && void 0 !== i ? i : "",
|
|
4262
4268
|
availableToSubdomains: !this._cookieAvailableToSubdomains,
|
|
4263
4269
|
path: this._cookiePath,
|
|
4264
4270
|
domain: this._domain
|
|
4265
4271
|
});
|
|
4266
|
-
|
|
4272
|
+
Pt(this.jwtCookieName) && Ct.remove(this.jwtCookieName, u), Pt(this.opaqueTokenCookieName) && Ct.remove(this.opaqueTokenCookieName, u), Pt(this.jwtCookieName) && Ue("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) && Ue("Could not remove extraneous opaque token cookie.");
|
|
4267
4273
|
}
|
|
4268
4274
|
}, {
|
|
4269
4275
|
key: "writeIntermediateSessionTokenCookie",
|
|
4270
4276
|
value: function writeIntermediateSessionTokenCookie(e) {
|
|
4271
4277
|
var t = new Date(Date.now() + 6e5),
|
|
4272
|
-
r =
|
|
4278
|
+
r = Dt.generateCookieOpts({
|
|
4273
4279
|
expiresAt: t.toString(),
|
|
4274
4280
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4275
4281
|
path: this._cookiePath,
|
|
4276
4282
|
domain: this._domain
|
|
4277
4283
|
});
|
|
4278
|
-
|
|
4284
|
+
At(this.istCookieName, e, r);
|
|
4279
4285
|
}
|
|
4280
4286
|
}, {
|
|
4281
4287
|
key: "removeSessionCookie",
|
|
@@ -4294,14 +4300,14 @@ var At = /*#__PURE__*/function () {
|
|
|
4294
4300
|
[!0, !1].forEach(function (t) {
|
|
4295
4301
|
[_this5._cookiePath, null].forEach(function (r) {
|
|
4296
4302
|
[_this5._domain, null].forEach(function (n) {
|
|
4297
|
-
var i =
|
|
4303
|
+
var i = Dt.generateCookieOpts({
|
|
4298
4304
|
expiresAt: new Date(0).toString(),
|
|
4299
4305
|
availableToSubdomains: t,
|
|
4300
4306
|
path: r,
|
|
4301
4307
|
domain: n
|
|
4302
4308
|
});
|
|
4303
4309
|
e.forEach(function (e) {
|
|
4304
|
-
|
|
4310
|
+
Ct.remove(e, i);
|
|
4305
4311
|
});
|
|
4306
4312
|
});
|
|
4307
4313
|
});
|
|
@@ -4310,22 +4316,22 @@ var At = /*#__PURE__*/function () {
|
|
|
4310
4316
|
}, {
|
|
4311
4317
|
key: "syncToLocalStorage",
|
|
4312
4318
|
value: function syncToLocalStorage() {
|
|
4313
|
-
localStorage.setItem(
|
|
4319
|
+
localStorage.setItem(Tt(this.publicToken), JSON.stringify(this.state));
|
|
4314
4320
|
}
|
|
4315
4321
|
}, {
|
|
4316
4322
|
key: "getItem",
|
|
4317
4323
|
value: function getItem(e) {
|
|
4318
|
-
return localStorage.getItem(
|
|
4324
|
+
return localStorage.getItem(Tt(this.publicToken, e));
|
|
4319
4325
|
}
|
|
4320
4326
|
}, {
|
|
4321
4327
|
key: "setItem",
|
|
4322
4328
|
value: function setItem(e, t) {
|
|
4323
|
-
return localStorage.setItem(
|
|
4329
|
+
return localStorage.setItem(Tt(this.publicToken, e), t);
|
|
4324
4330
|
}
|
|
4325
4331
|
}, {
|
|
4326
4332
|
key: "removeItem",
|
|
4327
4333
|
value: function removeItem(e) {
|
|
4328
|
-
return localStorage.removeItem(
|
|
4334
|
+
return localStorage.removeItem(Tt(this.publicToken, e));
|
|
4329
4335
|
}
|
|
4330
4336
|
}], [{
|
|
4331
4337
|
key: "generateCookieOpts",
|
|
@@ -4341,30 +4347,30 @@ var At = /*#__PURE__*/function () {
|
|
|
4341
4347
|
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;
|
|
4342
4348
|
}
|
|
4343
4349
|
}]);
|
|
4344
|
-
return
|
|
4350
|
+
return Dt;
|
|
4345
4351
|
}();
|
|
4346
|
-
var
|
|
4347
|
-
_inherits(
|
|
4348
|
-
function
|
|
4349
|
-
_classCallCheck(this,
|
|
4350
|
-
return _callSuper(this,
|
|
4352
|
+
var It = /*#__PURE__*/function (_Dt) {
|
|
4353
|
+
_inherits(It, _Dt);
|
|
4354
|
+
function It() {
|
|
4355
|
+
_classCallCheck(this, It);
|
|
4356
|
+
return _callSuper(this, It, arguments);
|
|
4351
4357
|
}
|
|
4352
|
-
return _createClass(
|
|
4353
|
-
}(
|
|
4354
|
-
var
|
|
4355
|
-
|
|
4358
|
+
return _createClass(It);
|
|
4359
|
+
}(Dt);
|
|
4360
|
+
var Rt = Symbol["for"]("__stytch_b2b_DataLayer"),
|
|
4361
|
+
Ft = function Ft(e, t) {
|
|
4356
4362
|
var r = function () {
|
|
4357
4363
|
var e = window;
|
|
4358
|
-
return e[
|
|
4364
|
+
return e[Rt] || (e[Rt] = {}), e[Rt];
|
|
4359
4365
|
}();
|
|
4360
|
-
return r[e] || (r[e] = new
|
|
4366
|
+
return r[e] || (r[e] = new It(e, t)), r[e];
|
|
4361
4367
|
},
|
|
4362
|
-
|
|
4368
|
+
Bt = function Bt(e, t) {
|
|
4363
4369
|
Object.values(e).forEach(function (e) {
|
|
4364
4370
|
return e(t);
|
|
4365
4371
|
});
|
|
4366
4372
|
},
|
|
4367
|
-
|
|
4373
|
+
Mt = function () {
|
|
4368
4374
|
var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
4369
4375
|
_ref5$KEYS_TO_EXCLUDE = _ref5.KEYS_TO_EXCLUDE,
|
|
4370
4376
|
e = _ref5$KEYS_TO_EXCLUDE === void 0 ? [] : _ref5$KEYS_TO_EXCLUDE;
|
|
@@ -4386,12 +4392,12 @@ var It = Symbol["for"]("__stytch_b2b_DataLayer"),
|
|
|
4386
4392
|
}({
|
|
4387
4393
|
KEYS_TO_EXCLUDE: ["last_accessed_at"]
|
|
4388
4394
|
});
|
|
4389
|
-
var
|
|
4390
|
-
function
|
|
4395
|
+
var jt = /*#__PURE__*/function () {
|
|
4396
|
+
function jt(e, t) {
|
|
4391
4397
|
var _this6 = this;
|
|
4392
|
-
_classCallCheck(this,
|
|
4398
|
+
_classCallCheck(this, jt);
|
|
4393
4399
|
this._publicToken = e, this._datalayer = t, this.fromCache = !0, this._listen = function (e) {
|
|
4394
|
-
if (e.key !==
|
|
4400
|
+
if (e.key !== Tt(_this6._publicToken)) return;
|
|
4395
4401
|
var t = null === e.newValue || "null" === e.newValue ? null : JSON.parse(e.newValue);
|
|
4396
4402
|
_this6.updateState(t, !0);
|
|
4397
4403
|
}, window.addEventListener("storage", this._listen);
|
|
@@ -4399,7 +4405,7 @@ var Mt = /*#__PURE__*/function () {
|
|
|
4399
4405
|
r = _this$_datalayer$read.session_token;
|
|
4400
4406
|
r || this.destroySession();
|
|
4401
4407
|
}
|
|
4402
|
-
_createClass(
|
|
4408
|
+
_createClass(jt, [{
|
|
4403
4409
|
key: "getTokens",
|
|
4404
4410
|
value: function getTokens() {
|
|
4405
4411
|
var _this$_datalayer$read2 = this._datalayer.readSessionCookie(),
|
|
@@ -4437,7 +4443,7 @@ var Mt = /*#__PURE__*/function () {
|
|
|
4437
4443
|
r = null === e.state ? null : Object.assign(Object.assign({}, this._datalayer.state), e.state);
|
|
4438
4444
|
this._datalayer.state = r;
|
|
4439
4445
|
var n = this.getFromCache();
|
|
4440
|
-
this.setCacheRefreshed(), !n &&
|
|
4446
|
+
this.setCacheRefreshed(), !n && Mt(t, r) || Bt(this._datalayer.subscriptions, r);
|
|
4441
4447
|
}
|
|
4442
4448
|
}, {
|
|
4443
4449
|
key: "updateStateAndTokens",
|
|
@@ -4453,8 +4459,8 @@ var Mt = /*#__PURE__*/function () {
|
|
|
4453
4459
|
this._datalayer.state = n;
|
|
4454
4460
|
var i = this.getFromCache();
|
|
4455
4461
|
this.setCacheRefreshed();
|
|
4456
|
-
var o = !
|
|
4457
|
-
(i || o) && (
|
|
4462
|
+
var o = !Mt(r, n);
|
|
4463
|
+
(i || o) && (Bt(this._datalayer.subscriptions, n), o && !t && this._datalayer.syncToLocalStorage());
|
|
4458
4464
|
}
|
|
4459
4465
|
}, {
|
|
4460
4466
|
key: "updateTokens",
|
|
@@ -4504,14 +4510,14 @@ var Mt = /*#__PURE__*/function () {
|
|
|
4504
4510
|
this.fromCache = !1;
|
|
4505
4511
|
}
|
|
4506
4512
|
}]);
|
|
4507
|
-
return
|
|
4513
|
+
return jt;
|
|
4508
4514
|
}();
|
|
4509
|
-
var
|
|
4510
|
-
_inherits(
|
|
4511
|
-
function
|
|
4515
|
+
var Lt = /*#__PURE__*/function (_jt) {
|
|
4516
|
+
_inherits(Lt, _jt);
|
|
4517
|
+
function Lt() {
|
|
4512
4518
|
var _this7;
|
|
4513
|
-
_classCallCheck(this,
|
|
4514
|
-
_this7 = _callSuper(this,
|
|
4519
|
+
_classCallCheck(this, Lt);
|
|
4520
|
+
_this7 = _callSuper(this, Lt, arguments), _this7.updateMember = function (e) {
|
|
4515
4521
|
return _this7.updateState({
|
|
4516
4522
|
member: e
|
|
4517
4523
|
});
|
|
@@ -4531,17 +4537,17 @@ var jt = /*#__PURE__*/function (_Mt) {
|
|
|
4531
4537
|
};
|
|
4532
4538
|
return _this7;
|
|
4533
4539
|
}
|
|
4534
|
-
return _createClass(
|
|
4535
|
-
}(
|
|
4536
|
-
var
|
|
4537
|
-
exports.BiometricsFailedError =
|
|
4540
|
+
return _createClass(Lt);
|
|
4541
|
+
}(jt);
|
|
4542
|
+
var Kt = Symbol["for"]("stytch__internal_b2b");
|
|
4543
|
+
exports.BiometricsFailedError = ee, exports.BiometricsUnavailableError = M, exports.ChallengeSigningFailedError = J, exports.DeviceCredentialsNotAllowedError = U, exports.FailedCodeChallengeError = X, exports.FailedToDecryptDataError = Q, exports.InternalError = F, exports.InvalidAuthorizationCredentialError = G, exports.InvalidCredentialTypeError = ie, exports.InvalidRedirectSchemeError = re, exports.InvalidStartUrlError = te, exports.JSONDataNotConvertibleToStringError = se, exports.KeyInvalidatedError = j, exports.KeystoreUnavailableError = L, exports.MissingAttestationObjectError = oe, exports.MissingAuthorizationCredentialIDTokenError = H, exports.MissingGoogleClientIDError = q, exports.MissingPKCEError = W, exports.MissingPublicKeyError = Y, exports.MissingUrlError = ne, exports.NoBiometricsEnrolledError = K, exports.NoBiometricsRegistrationError = B, exports.NoCredentialsPresentError = V, exports.NoCurrentSessionError = R, exports.PasskeysInvalidEncoding = ce, exports.PasskeysMisconfigured = ue, exports.PasskeysUnsupportedError = Z, exports.RandomNumberGenerationFailed = ae, exports.SDKAPIUnreachableError = S, exports.SDKNotConfiguredError = $, exports.SignInWithAppleMisconfigured = le, exports.StytchAPIError = D, exports.StytchAPISchemaError = A, exports.StytchAPIUnreachableError = O, exports.StytchB2BHeadlessClient = /*#__PURE__*/function () {
|
|
4538
4544
|
function _class(e, t) {
|
|
4539
4545
|
var _this8 = this;
|
|
4540
4546
|
_classCallCheck(this, _class);
|
|
4541
4547
|
var r;
|
|
4542
4548
|
!function (e) {
|
|
4543
4549
|
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"));
|
|
4544
|
-
}("StytchB2BHeadlessClient"), "string" != typeof (r = e) ?
|
|
4550
|
+
}("StytchB2BHeadlessClient"), "string" != typeof (r = e) ? Ue("Public token is malformed. Expected a string, got ".concat(pe(r), ".").concat(We)) : "" === r ? Ue('Public token is malformed. Expected "public-token-...", got an empty string.'.concat(We)) : r.startsWith("public-token-") || Ue('Public token is malformed. Expected "public-token-...", got '.concat(r, ".").concat(We));
|
|
4545
4551
|
var n = t,
|
|
4546
4552
|
i = {
|
|
4547
4553
|
cookieOptions: null == (o = n) ? void 0 : o.cookieOptions,
|
|
@@ -4554,32 +4560,32 @@ exports.BiometricsFailedError = Q, exports.BiometricsUnavailableError = M, expor
|
|
|
4554
4560
|
}
|
|
4555
4561
|
};
|
|
4556
4562
|
var o, s, a, c, u, l, d, h, p, f, _;
|
|
4557
|
-
this._dataLayer =
|
|
4563
|
+
this._dataLayer = Ft(e, n), this._subscriptionService = new Lt(e, this._dataLayer), this._stateChangeClient = new ft(this._subscriptionService, {}), this.onStateChange = function () {
|
|
4558
4564
|
var _this8$_stateChangeCl;
|
|
4559
4565
|
return (_this8$_stateChangeCl = _this8._stateChangeClient).onStateChange.apply(_this8$_stateChangeCl, arguments);
|
|
4560
4566
|
};
|
|
4561
|
-
var m = new
|
|
4562
|
-
this._networkClient = new
|
|
4567
|
+
var m = new St(this._dataLayer, "passwords");
|
|
4568
|
+
this._networkClient = new kt(e, this._dataLayer, i.endpoints.sdkBackendURL, function () {
|
|
4563
4569
|
var e, t, r, n;
|
|
4564
4570
|
return {
|
|
4565
4571
|
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,
|
|
4566
4572
|
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
|
|
4567
4573
|
};
|
|
4568
4574
|
});
|
|
4569
|
-
var v = new
|
|
4570
|
-
b = new
|
|
4571
|
-
g = new
|
|
4572
|
-
y = new
|
|
4573
|
-
this.organization = new
|
|
4575
|
+
var v = new vt(e, this._networkClient, this._dataLayer),
|
|
4576
|
+
b = new gt(v.getAsync()),
|
|
4577
|
+
g = new Ve(e, i.endpoints.dfpBackendURL, v.getAsync(), b.executeRecaptcha),
|
|
4578
|
+
y = new yt(i.endpoints.clientsideServicesIframeURL);
|
|
4579
|
+
this.organization = new tt(this._networkClient, this._subscriptionService), this.member = new Qe(this._networkClient, this._subscriptionService), this.self = new Qe(this._networkClient, this._subscriptionService), this.session = new nt(this._networkClient, this._subscriptionService), this.magicLinks = new Ze(this._networkClient, this._subscriptionService, new St(this._dataLayer, "magic_links"), m, v.getAsync(), g), this.oauth = new rt(this._networkClient, this._subscriptionService, new St(this._dataLayer, "oauth"), v.getAsync(), {
|
|
4574
4580
|
publicToken: e,
|
|
4575
4581
|
testAPIURL: i.endpoints.testAPIURL,
|
|
4576
4582
|
liveAPIURL: i.endpoints.liveAPIURL
|
|
4577
|
-
}, g), this.sso = new
|
|
4583
|
+
}, g), this.sso = new et(this._networkClient, this._subscriptionService, new St(this._dataLayer, "sso"), v.getAsync(), {
|
|
4578
4584
|
publicToken: e,
|
|
4579
4585
|
testAPIURL: i.endpoints.testAPIURL,
|
|
4580
4586
|
liveAPIURL: i.endpoints.liveAPIURL
|
|
4581
|
-
}), this.discovery = new
|
|
4582
|
-
var k = new
|
|
4587
|
+
}), this.discovery = new it(this._networkClient, this._subscriptionService), this.passwords = new st(this._networkClient, this._subscriptionService, m, v.getAsync(), g), this.otps = new at(this._networkClient, this._subscriptionService, g), this.totp = new ct(this._networkClient, this._subscriptionService, g), this.recoveryCodes = new ut(this._networkClient, this._subscriptionService, g), this.rbac = new lt(v.getSync(), v.getAsync(), this._subscriptionService), this._sessionManager = new pt(this._subscriptionService, this.session);
|
|
4588
|
+
var k = new ht(this._networkClient, g);
|
|
4583
4589
|
this._dataLayer.readSessionCookie().session_token && this._sessionManager.performBackgroundRefresh(), this._networkClient.logEvent({
|
|
4584
4590
|
name: "b2b_sdk_instance_instantiated",
|
|
4585
4591
|
details: {
|
|
@@ -4589,7 +4595,7 @@ exports.BiometricsFailedError = Q, exports.BiometricsUnavailableError = M, expor
|
|
|
4589
4595
|
}
|
|
4590
4596
|
});
|
|
4591
4597
|
(function (e, t) {
|
|
4592
|
-
Object.assign(e, _defineProperty({},
|
|
4598
|
+
Object.assign(e, _defineProperty({}, Kt, t));
|
|
4593
4599
|
})(this, {
|
|
4594
4600
|
bootstrap: v,
|
|
4595
4601
|
clientsideServices: y,
|
|
@@ -4600,7 +4606,7 @@ exports.BiometricsFailedError = Q, exports.BiometricsUnavailableError = M, expor
|
|
|
4600
4606
|
});
|
|
4601
4607
|
}
|
|
4602
4608
|
return _createClass(_class);
|
|
4603
|
-
}(), exports.StytchError =
|
|
4609
|
+
}(), exports.StytchError = E, exports.StytchSDKAPIError = C, exports.StytchSDKError = I, exports.StytchSDKSchemaError = x, exports.StytchSDKUsageError = P, exports.UNRECOVERABLE_ERROR_TYPES = T, exports.UserCancellationError = N, exports.UserLockedOutError = z, exports.errorToStytchError = function (e) {
|
|
4604
4610
|
switch (e.message) {
|
|
4605
4611
|
case "internal_error":
|
|
4606
4612
|
return new F(e.message);
|
|
@@ -4634,39 +4640,41 @@ exports.BiometricsFailedError = Q, exports.BiometricsUnavailableError = M, expor
|
|
|
4634
4640
|
case "invalid_authorization_credential":
|
|
4635
4641
|
return new G();
|
|
4636
4642
|
case "missing_public_key":
|
|
4637
|
-
return new V();
|
|
4638
|
-
case "challenge_signing_failed":
|
|
4639
4643
|
return new Y();
|
|
4640
|
-
case "
|
|
4644
|
+
case "challenge_signing_failed":
|
|
4641
4645
|
return new J();
|
|
4642
|
-
case "
|
|
4646
|
+
case "no_credentials_present":
|
|
4647
|
+
return new V();
|
|
4648
|
+
case "sdk_not_configured":
|
|
4643
4649
|
return new $();
|
|
4644
|
-
case "
|
|
4650
|
+
case "failed_code_challenge":
|
|
4645
4651
|
return new X();
|
|
4646
|
-
case "
|
|
4652
|
+
case "passkeys_unsupported":
|
|
4647
4653
|
return new Z();
|
|
4648
|
-
case "
|
|
4654
|
+
case "failed_to_decrypt_data":
|
|
4649
4655
|
return new Q();
|
|
4650
|
-
case "
|
|
4656
|
+
case "biometrics_failed":
|
|
4651
4657
|
return new ee();
|
|
4652
|
-
case "
|
|
4658
|
+
case "invalid_start_url":
|
|
4653
4659
|
return new te();
|
|
4654
|
-
case "
|
|
4660
|
+
case "invalid_redirect_scheme":
|
|
4655
4661
|
return new re();
|
|
4656
|
-
case "
|
|
4662
|
+
case "missing_url":
|
|
4657
4663
|
return new ne();
|
|
4658
|
-
case "
|
|
4664
|
+
case "invalid_credential_type":
|
|
4659
4665
|
return new ie();
|
|
4660
|
-
case "
|
|
4666
|
+
case "missing_attestation_object":
|
|
4661
4667
|
return new oe();
|
|
4662
|
-
case "
|
|
4668
|
+
case "json_data_not_convertible_to_string":
|
|
4663
4669
|
return new se();
|
|
4664
|
-
case "
|
|
4670
|
+
case "random_number_generation_failed":
|
|
4665
4671
|
return new ae();
|
|
4666
|
-
case "
|
|
4672
|
+
case "passkeys_invalid_encoding":
|
|
4667
4673
|
return new ce();
|
|
4668
|
-
case "
|
|
4674
|
+
case "passkeys_misconfigured":
|
|
4669
4675
|
return new ue();
|
|
4676
|
+
case "signinwithapple_misconfigured":
|
|
4677
|
+
return new le();
|
|
4670
4678
|
default:
|
|
4671
4679
|
return new I(e.name, e.message);
|
|
4672
4680
|
}
|