@stytch/vanilla-js 4.8.0 → 4.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/b2b/index.d.ts +16 -1
- package/dist/b2b/index.esm.d.ts +16 -1
- package/dist/b2b/index.esm.js +2973 -2957
- package/dist/b2b/index.headless.d.ts +16 -1
- package/dist/b2b/index.headless.esm.d.ts +16 -1
- package/dist/b2b/index.headless.esm.js +354 -346
- package/dist/b2b/index.headless.js +371 -363
- package/dist/b2b/index.js +2925 -2909
- package/dist/index.d.ts +16 -1
- package/dist/index.esm.d.ts +16 -1
- package/dist/index.esm.js +3963 -3916
- package/dist/index.headless.d.ts +16 -1
- package/dist/index.headless.esm.d.ts +16 -1
- package/dist/index.headless.esm.js +701 -666
- package/dist/index.headless.js +708 -673
- package/dist/index.js +3863 -3816
- package/package.json +3 -2
package/dist/index.headless.js
CHANGED
|
@@ -156,7 +156,7 @@ var g,
|
|
|
156
156
|
}
|
|
157
157
|
return a(t, c(Error)), r(t);
|
|
158
158
|
}(),
|
|
159
|
-
|
|
159
|
+
C = function (e) {
|
|
160
160
|
function t(e) {
|
|
161
161
|
var r, n;
|
|
162
162
|
i(this, t), (r = s(this, t)).name = "StytchSDKSchemaError";
|
|
@@ -167,7 +167,7 @@ var g,
|
|
|
167
167
|
}
|
|
168
168
|
return a(t, c(Error)), r(t);
|
|
169
169
|
}(),
|
|
170
|
-
|
|
170
|
+
P = function (e) {
|
|
171
171
|
function t(e) {
|
|
172
172
|
var r;
|
|
173
173
|
i(this, t), (r = s(this, t)).name = "StytchSDKAPIError";
|
|
@@ -180,7 +180,7 @@ var g,
|
|
|
180
180
|
}
|
|
181
181
|
return a(t, c(Error)), r(t);
|
|
182
182
|
}(),
|
|
183
|
-
|
|
183
|
+
O = ["unauthorized_credentials", "user_unauthenticated", "invalid_secret_authentication", "session_not_found"],
|
|
184
184
|
T = function (e) {
|
|
185
185
|
function t(e, r) {
|
|
186
186
|
var n;
|
|
@@ -312,110 +312,149 @@ var g,
|
|
|
312
312
|
}(),
|
|
313
313
|
V = function (e) {
|
|
314
314
|
function t() {
|
|
315
|
-
return i(this, t), s(this, t, ["
|
|
315
|
+
return i(this, t), s(this, t, ["NoCredentialsPresentError", "The user did not provide credentials for a Google OneTap attempt"]);
|
|
316
316
|
}
|
|
317
317
|
return a(t, R), r(t);
|
|
318
318
|
}(),
|
|
319
319
|
Y = function (e) {
|
|
320
320
|
function t() {
|
|
321
|
-
return i(this, t), s(this, t, ["
|
|
321
|
+
return i(this, t), s(this, t, ["MissingPublicKeyError", "Failed to retrieve the public key. Add a new biometric registration."]);
|
|
322
322
|
}
|
|
323
323
|
return a(t, R), r(t);
|
|
324
324
|
}(),
|
|
325
325
|
J = function (e) {
|
|
326
326
|
function t() {
|
|
327
|
-
return i(this, t), s(this, t, ["
|
|
327
|
+
return i(this, t), s(this, t, ["ChallengeSigningFailedError", "Failed to sign the challenge with the key."]);
|
|
328
328
|
}
|
|
329
329
|
return a(t, R), r(t);
|
|
330
330
|
}(),
|
|
331
331
|
$ = function (e) {
|
|
332
332
|
function t() {
|
|
333
|
-
return i(this, t), s(this, t, ["
|
|
333
|
+
return i(this, t), s(this, t, ["SDKNotConfiguredError", "Stytch client is not confiured. You must call the configure method before using the SDK"]);
|
|
334
334
|
}
|
|
335
335
|
return a(t, R), r(t);
|
|
336
336
|
}(),
|
|
337
337
|
X = function (e) {
|
|
338
338
|
function t() {
|
|
339
|
-
return i(this, t), s(this, t, ["
|
|
339
|
+
return i(this, t), s(this, t, ["FailedCodeChallengeError", "Failed to create a code challenge"]);
|
|
340
340
|
}
|
|
341
341
|
return a(t, R), r(t);
|
|
342
342
|
}(),
|
|
343
343
|
Z = function (e) {
|
|
344
344
|
function t() {
|
|
345
|
-
return i(this, t), s(this, t, ["
|
|
345
|
+
return i(this, t), s(this, t, ["PasskeysUnsupportedError", "Passkeys are not supported on this device"]);
|
|
346
346
|
}
|
|
347
347
|
return a(t, R), r(t);
|
|
348
348
|
}(),
|
|
349
349
|
Q = function (e) {
|
|
350
350
|
function t() {
|
|
351
|
-
return i(this, t), s(this, t, ["
|
|
351
|
+
return i(this, t), s(this, t, ["FailedToDecryptDataError", "Failed to decrypt user data"]);
|
|
352
352
|
}
|
|
353
353
|
return a(t, R), r(t);
|
|
354
354
|
}(),
|
|
355
355
|
ee = function (e) {
|
|
356
356
|
function t() {
|
|
357
|
-
return i(this, t), s(this, t, ["
|
|
357
|
+
return i(this, t), s(this, t, ["BiometricsFailedError", "Biometric authentication failed"]);
|
|
358
358
|
}
|
|
359
359
|
return a(t, R), r(t);
|
|
360
360
|
}(),
|
|
361
361
|
te = function (e) {
|
|
362
362
|
function t() {
|
|
363
|
-
return i(this, t), s(this, t, ["
|
|
363
|
+
return i(this, t), s(this, t, ["InvalidStartUrlError", "The start URL was invalid or improperly formatted."]);
|
|
364
364
|
}
|
|
365
365
|
return a(t, R), r(t);
|
|
366
366
|
}(),
|
|
367
367
|
re = function (e) {
|
|
368
368
|
function t() {
|
|
369
|
-
return i(this, t), s(this, t, ["
|
|
369
|
+
return i(this, t), s(this, t, ["InvalidRedirectSchemeError", "The scheme from the given redirect urls was invalid. Possible reasons include: nil scheme, non-custom scheme (using http or https), or differing schemes for login/signup urls."]);
|
|
370
370
|
}
|
|
371
371
|
return a(t, R), r(t);
|
|
372
372
|
}(),
|
|
373
373
|
ne = function (e) {
|
|
374
374
|
function t() {
|
|
375
|
-
return i(this, t), s(this, t, ["
|
|
375
|
+
return i(this, t), s(this, t, ["MissingUrlError", "The underlying web authentication service failed to return a URL."]);
|
|
376
376
|
}
|
|
377
377
|
return a(t, R), r(t);
|
|
378
378
|
}(),
|
|
379
379
|
ie = function (e) {
|
|
380
380
|
function t() {
|
|
381
|
-
return i(this, t), s(this, t, ["
|
|
381
|
+
return i(this, t), s(this, t, ["InvalidCredentialTypeError", "The public key credential type was not of the expected type."]);
|
|
382
382
|
}
|
|
383
383
|
return a(t, R), r(t);
|
|
384
384
|
}(),
|
|
385
385
|
se = function (e) {
|
|
386
386
|
function t() {
|
|
387
|
-
return i(this, t), s(this, t, ["
|
|
387
|
+
return i(this, t), s(this, t, ["MissingAttestationObjectError", "The public key credential is missing the attestation object."]);
|
|
388
388
|
}
|
|
389
389
|
return a(t, R), r(t);
|
|
390
390
|
}(),
|
|
391
391
|
oe = function (e) {
|
|
392
392
|
function t() {
|
|
393
|
-
return i(this, t), s(this, t, ["
|
|
393
|
+
return i(this, t), s(this, t, ["JSONDataNotConvertibleToStringError", "JSON data unable to be converted to String type."]);
|
|
394
394
|
}
|
|
395
395
|
return a(t, R), r(t);
|
|
396
396
|
}(),
|
|
397
397
|
ae = function (e) {
|
|
398
398
|
function t() {
|
|
399
|
-
return i(this, t), s(this, t, ["
|
|
399
|
+
return i(this, t), s(this, t, ["RandomNumberGenerationFailed", "Random number generation failed"]);
|
|
400
400
|
}
|
|
401
401
|
return a(t, R), r(t);
|
|
402
402
|
}(),
|
|
403
403
|
ce = function (e) {
|
|
404
404
|
function t() {
|
|
405
|
-
return i(this, t), s(this, t, ["
|
|
405
|
+
return i(this, t), s(this, t, ["PasskeysInvalidEncoding", "Invalid passkey encoding"]);
|
|
406
406
|
}
|
|
407
407
|
return a(t, R), r(t);
|
|
408
408
|
}(),
|
|
409
409
|
ue = function (e) {
|
|
410
|
+
function t() {
|
|
411
|
+
return i(this, t), s(this, t, ["PasskeysMisconfigured", "Passkeys are misconfigured. Verify that you have added the correct associated domain for your application, and that the signing information is correct."]);
|
|
412
|
+
}
|
|
413
|
+
return a(t, R), r(t);
|
|
414
|
+
}(),
|
|
415
|
+
le = function (e) {
|
|
410
416
|
function t() {
|
|
411
417
|
return i(this, t), s(this, t, ["SignInWithAppleMisconfigured", "Sign In With Apple is misconfigured. Verify that you have correctly configured Apple OAuth in the Stytch Dashboard and added the Sign In With Apple capability to your project."]);
|
|
412
418
|
}
|
|
413
419
|
return a(t, R), r(t);
|
|
414
420
|
}();
|
|
415
|
-
function
|
|
421
|
+
function de(e, t) {
|
|
422
|
+
return function (e) {
|
|
423
|
+
if (Array.isArray(e)) return e;
|
|
424
|
+
}(e) || function (e, t) {
|
|
425
|
+
var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
426
|
+
if (null != r) {
|
|
427
|
+
var n,
|
|
428
|
+
i,
|
|
429
|
+
s,
|
|
430
|
+
o,
|
|
431
|
+
a = [],
|
|
432
|
+
c = !0,
|
|
433
|
+
u = !1;
|
|
434
|
+
try {
|
|
435
|
+
if (s = (r = r.call(e)).next, 0 === t) {
|
|
436
|
+
if (Object(r) !== r) return;
|
|
437
|
+
c = !1;
|
|
438
|
+
} else for (; !(c = (n = s.call(r)).done) && (a.push(n.value), a.length !== t); c = !0);
|
|
439
|
+
} catch (e) {
|
|
440
|
+
u = !0, i = e;
|
|
441
|
+
} finally {
|
|
442
|
+
try {
|
|
443
|
+
if (!c && null != r["return"] && (o = r["return"](), Object(o) !== o)) return;
|
|
444
|
+
} finally {
|
|
445
|
+
if (u) throw i;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
return a;
|
|
449
|
+
}
|
|
450
|
+
}(e, t) || pe(e, t) || function () {
|
|
451
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
452
|
+
}();
|
|
453
|
+
}
|
|
454
|
+
function he(e, t) {
|
|
416
455
|
var r = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
417
456
|
if (!r) {
|
|
418
|
-
if (Array.isArray(e) || (r =
|
|
457
|
+
if (Array.isArray(e) || (r = pe(e)) || t && e && "number" == typeof e.length) {
|
|
419
458
|
r && (e = r);
|
|
420
459
|
var _n = 0,
|
|
421
460
|
i = function i() {};
|
|
@@ -460,61 +499,28 @@ function le(e, t) {
|
|
|
460
499
|
}
|
|
461
500
|
};
|
|
462
501
|
}
|
|
463
|
-
function
|
|
464
|
-
return function (e) {
|
|
465
|
-
if (Array.isArray(e)) return e;
|
|
466
|
-
}(e) || function (e, t) {
|
|
467
|
-
var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
468
|
-
if (null != r) {
|
|
469
|
-
var n,
|
|
470
|
-
i,
|
|
471
|
-
s,
|
|
472
|
-
o,
|
|
473
|
-
a = [],
|
|
474
|
-
c = !0,
|
|
475
|
-
u = !1;
|
|
476
|
-
try {
|
|
477
|
-
if (s = (r = r.call(e)).next, 0 === t) {
|
|
478
|
-
if (Object(r) !== r) return;
|
|
479
|
-
c = !1;
|
|
480
|
-
} else for (; !(c = (n = s.call(r)).done) && (a.push(n.value), a.length !== t); c = !0);
|
|
481
|
-
} catch (e) {
|
|
482
|
-
u = !0, i = e;
|
|
483
|
-
} finally {
|
|
484
|
-
try {
|
|
485
|
-
if (!c && null != r["return"] && (o = r["return"](), Object(o) !== o)) return;
|
|
486
|
-
} finally {
|
|
487
|
-
if (u) throw i;
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
return a;
|
|
491
|
-
}
|
|
492
|
-
}(e, t) || he(e, t) || function () {
|
|
493
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
494
|
-
}();
|
|
495
|
-
}
|
|
496
|
-
function he(e, t) {
|
|
502
|
+
function pe(e, t) {
|
|
497
503
|
if (e) {
|
|
498
|
-
if ("string" == typeof e) return
|
|
504
|
+
if ("string" == typeof e) return fe(e, t);
|
|
499
505
|
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
500
|
-
return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ?
|
|
506
|
+
return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? fe(e, t) : void 0;
|
|
501
507
|
}
|
|
502
508
|
}
|
|
503
|
-
function
|
|
509
|
+
function fe(e, t) {
|
|
504
510
|
(null == t || t > e.length) && (t = e.length);
|
|
505
511
|
for (var r = 0, n = new Array(t); r < t; r++) n[r] = e[r];
|
|
506
512
|
return n;
|
|
507
513
|
}
|
|
508
|
-
function
|
|
509
|
-
return
|
|
514
|
+
function _e(e) {
|
|
515
|
+
return _e = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
|
|
510
516
|
return _typeof(e);
|
|
511
517
|
} : function (e) {
|
|
512
518
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
|
|
513
|
-
},
|
|
519
|
+
}, _e(e);
|
|
514
520
|
}
|
|
515
|
-
function
|
|
521
|
+
function me() {
|
|
516
522
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
517
|
-
|
|
523
|
+
me = function me() {
|
|
518
524
|
return t;
|
|
519
525
|
};
|
|
520
526
|
var e,
|
|
@@ -548,7 +554,7 @@ function _e() {
|
|
|
548
554
|
o = Object.create(s.prototype),
|
|
549
555
|
a = new E(n || []);
|
|
550
556
|
return i(o, "_invoke", {
|
|
551
|
-
value:
|
|
557
|
+
value: P(e, r, a)
|
|
552
558
|
}), o;
|
|
553
559
|
}
|
|
554
560
|
function d(e, t, r) {
|
|
@@ -588,13 +594,13 @@ function _e() {
|
|
|
588
594
|
});
|
|
589
595
|
});
|
|
590
596
|
}
|
|
591
|
-
function
|
|
597
|
+
function C(e, t) {
|
|
592
598
|
function r(i, s, o, a) {
|
|
593
599
|
var c = d(e[i], e, s);
|
|
594
600
|
if ("throw" !== c.type) {
|
|
595
601
|
var u = c.arg,
|
|
596
602
|
l = u.value;
|
|
597
|
-
return l && "object" ==
|
|
603
|
+
return l && "object" == _e(l) && n.call(l, "__await") ? t.resolve(l.__await).then(function (e) {
|
|
598
604
|
r("next", e, o, a);
|
|
599
605
|
}, function (e) {
|
|
600
606
|
r("throw", e, o, a);
|
|
@@ -618,7 +624,7 @@ function _e() {
|
|
|
618
624
|
}
|
|
619
625
|
});
|
|
620
626
|
}
|
|
621
|
-
function
|
|
627
|
+
function P(t, r, n) {
|
|
622
628
|
var i = h;
|
|
623
629
|
return function (s, o) {
|
|
624
630
|
if (i === f) throw new Error("Generator is already running");
|
|
@@ -632,7 +638,7 @@ function _e() {
|
|
|
632
638
|
for (n.method = s, n.arg = o;;) {
|
|
633
639
|
var a = n.delegate;
|
|
634
640
|
if (a) {
|
|
635
|
-
var c =
|
|
641
|
+
var c = O(a, n);
|
|
636
642
|
if (c) {
|
|
637
643
|
if (c === m) continue;
|
|
638
644
|
return c;
|
|
@@ -655,10 +661,10 @@ function _e() {
|
|
|
655
661
|
}
|
|
656
662
|
};
|
|
657
663
|
}
|
|
658
|
-
function
|
|
664
|
+
function O(t, r) {
|
|
659
665
|
var n = r.method,
|
|
660
666
|
i = t.iterator[n];
|
|
661
|
-
if (i === e) return r.delegate = null, "throw" === n && t.iterator["return"] && (r.method = "return", r.arg = e,
|
|
667
|
+
if (i === e) return r.delegate = null, "throw" === n && t.iterator["return"] && (r.method = "return", r.arg = e, O(t, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), m;
|
|
662
668
|
var s = d(i, t.iterator, r.arg);
|
|
663
669
|
if ("throw" === s.type) return r.method = "throw", r.arg = s.arg, r.delegate = null, m;
|
|
664
670
|
var o = s.arg;
|
|
@@ -693,7 +699,7 @@ function _e() {
|
|
|
693
699
|
return s.next = s;
|
|
694
700
|
}
|
|
695
701
|
}
|
|
696
|
-
throw new TypeError(
|
|
702
|
+
throw new TypeError(_e(t) + " is not iterable");
|
|
697
703
|
}
|
|
698
704
|
return y.prototype = g, i(S, "constructor", {
|
|
699
705
|
value: g,
|
|
@@ -710,11 +716,11 @@ function _e() {
|
|
|
710
716
|
return {
|
|
711
717
|
__await: e
|
|
712
718
|
};
|
|
713
|
-
}, x(
|
|
719
|
+
}, x(C.prototype), u(C.prototype, a, function () {
|
|
714
720
|
return this;
|
|
715
|
-
}), t.AsyncIterator =
|
|
721
|
+
}), t.AsyncIterator = C, t.async = function (e, r, n, i, s) {
|
|
716
722
|
void 0 === s && (s = Promise);
|
|
717
|
-
var o = new
|
|
723
|
+
var o = new C(l(e, r, n, i), s);
|
|
718
724
|
return t.isGeneratorFunction(r) ? o : o.next().then(function (e) {
|
|
719
725
|
return e.done ? e.value : o.next();
|
|
720
726
|
});
|
|
@@ -814,46 +820,46 @@ function _e() {
|
|
|
814
820
|
}
|
|
815
821
|
}, t;
|
|
816
822
|
}
|
|
817
|
-
function
|
|
823
|
+
function ve(e, t) {
|
|
818
824
|
for (var r = 0; r < t.length; r++) {
|
|
819
825
|
var n = t[r];
|
|
820
|
-
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e,
|
|
826
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, ge(n.key), n);
|
|
821
827
|
}
|
|
822
828
|
}
|
|
823
|
-
function
|
|
824
|
-
return t &&
|
|
829
|
+
function ye(e, t, r) {
|
|
830
|
+
return t && ve(e.prototype, t), r && ve(e, r), Object.defineProperty(e, "prototype", {
|
|
825
831
|
writable: !1
|
|
826
832
|
}), e;
|
|
827
833
|
}
|
|
828
|
-
function
|
|
834
|
+
function ge(e) {
|
|
829
835
|
var t = function (e, t) {
|
|
830
|
-
if ("object" !=
|
|
836
|
+
if ("object" != _e(e) || !e) return e;
|
|
831
837
|
var r = e[Symbol.toPrimitive];
|
|
832
838
|
if (void 0 !== r) {
|
|
833
839
|
var n = r.call(e, t || "default");
|
|
834
|
-
if ("object" !=
|
|
840
|
+
if ("object" != _e(n)) return n;
|
|
835
841
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
836
842
|
}
|
|
837
843
|
return ("string" === t ? String : Number)(e);
|
|
838
844
|
}(e, "string");
|
|
839
|
-
return "symbol" ==
|
|
845
|
+
return "symbol" == _e(t) ? t : String(t);
|
|
840
846
|
}
|
|
841
|
-
function
|
|
847
|
+
function be(e, t) {
|
|
842
848
|
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
|
|
843
849
|
}
|
|
844
|
-
function
|
|
845
|
-
return t =
|
|
846
|
-
if (t && ("object" ===
|
|
850
|
+
function ke(e, t, r) {
|
|
851
|
+
return t = Ce(t), function (e, t) {
|
|
852
|
+
if (t && ("object" === _e(t) || "function" == typeof t)) return t;
|
|
847
853
|
if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
|
|
848
854
|
return function (e) {
|
|
849
855
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
850
856
|
return e;
|
|
851
857
|
}(e);
|
|
852
|
-
}(e,
|
|
858
|
+
}(e, Se() ? Reflect.construct(t, r || [], Ce(e).constructor) : t.apply(e, r));
|
|
853
859
|
}
|
|
854
|
-
function
|
|
860
|
+
function we(e) {
|
|
855
861
|
var t = "function" == typeof Map ? new Map() : void 0;
|
|
856
|
-
return
|
|
862
|
+
return we = function we(e) {
|
|
857
863
|
if (null === e || !function (e) {
|
|
858
864
|
try {
|
|
859
865
|
return -1 !== Function.toString.call(e).indexOf("[native code]");
|
|
@@ -868,12 +874,12 @@ function ke(e) {
|
|
|
868
874
|
}
|
|
869
875
|
function r() {
|
|
870
876
|
return function (e, t, r) {
|
|
871
|
-
if (
|
|
877
|
+
if (Se()) return Reflect.construct.apply(null, arguments);
|
|
872
878
|
var n = [null];
|
|
873
879
|
n.push.apply(n, t);
|
|
874
880
|
var i = new (e.bind.apply(e, n))();
|
|
875
|
-
return r &&
|
|
876
|
-
}(e, arguments,
|
|
881
|
+
return r && xe(i, r.prototype), i;
|
|
882
|
+
}(e, arguments, Ce(this).constructor);
|
|
877
883
|
}
|
|
878
884
|
return r.prototype = Object.create(e.prototype, {
|
|
879
885
|
constructor: {
|
|
@@ -882,32 +888,32 @@ function ke(e) {
|
|
|
882
888
|
writable: !0,
|
|
883
889
|
configurable: !0
|
|
884
890
|
}
|
|
885
|
-
}),
|
|
886
|
-
},
|
|
891
|
+
}), xe(r, e);
|
|
892
|
+
}, we(e);
|
|
887
893
|
}
|
|
888
|
-
function
|
|
894
|
+
function Se() {
|
|
889
895
|
try {
|
|
890
896
|
var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
891
897
|
} catch (e) {}
|
|
892
|
-
return (
|
|
898
|
+
return (Se = function Se() {
|
|
893
899
|
return !!e;
|
|
894
900
|
})();
|
|
895
901
|
}
|
|
896
|
-
function
|
|
897
|
-
return
|
|
902
|
+
function xe(e, t) {
|
|
903
|
+
return xe = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) {
|
|
898
904
|
return e.__proto__ = t, e;
|
|
899
|
-
},
|
|
905
|
+
}, xe(e, t);
|
|
900
906
|
}
|
|
901
|
-
function
|
|
902
|
-
return
|
|
907
|
+
function Ce(e) {
|
|
908
|
+
return Ce = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) {
|
|
903
909
|
return e.__proto__ || Object.getPrototypeOf(e);
|
|
904
|
-
},
|
|
910
|
+
}, Ce(e);
|
|
905
911
|
}
|
|
906
912
|
exports.B2BProducts = void 0, (g = exports.B2BProducts || (exports.B2BProducts = {})).emailMagicLinks = "emailMagicLinks", g.sso = "sso", g.passwords = "passwords", g.oauth = "oauth", exports.AuthFlowType = void 0, (b = exports.AuthFlowType || (exports.AuthFlowType = {})).Discovery = "Discovery", b.Organization = "Organization", b.PasswordReset = "PasswordReset", exports.B2BMFAProducts = void 0, (k = exports.B2BMFAProducts || (exports.B2BMFAProducts = {})).smsOtp = "smsOtp", k.totp = "totp", exports.B2BOAuthProviders = void 0, (w = exports.B2BOAuthProviders || (exports.B2BOAuthProviders = {})).Google = "google", w.Microsoft = "microsoft";
|
|
907
913
|
var Pe,
|
|
908
914
|
Oe = "https://accounts.google.com/gsi",
|
|
909
|
-
|
|
910
|
-
function
|
|
915
|
+
Te = "".concat(Oe, "/client");
|
|
916
|
+
function Ae(e, t) {
|
|
911
917
|
var r = {};
|
|
912
918
|
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
|
|
913
919
|
if (null != e && "function" == typeof Object.getOwnPropertySymbols) {
|
|
@@ -916,7 +922,7 @@ function Te(e, t) {
|
|
|
916
922
|
}
|
|
917
923
|
return r;
|
|
918
924
|
}
|
|
919
|
-
function
|
|
925
|
+
function Ee(e, t, r, n) {
|
|
920
926
|
return new (r || (r = Promise))(function (i, s) {
|
|
921
927
|
function o(e) {
|
|
922
928
|
try {
|
|
@@ -944,11 +950,11 @@ function Ae(e, t, r, n) {
|
|
|
944
950
|
"function" == typeof SuppressedError && SuppressedError, function (e) {
|
|
945
951
|
e.RequiredCatcha = "Catcha Required";
|
|
946
952
|
}(Pe || (Pe = {}));
|
|
947
|
-
var
|
|
948
|
-
|
|
953
|
+
var De,
|
|
954
|
+
Re = function (e) {
|
|
949
955
|
function t(e) {
|
|
950
956
|
var r;
|
|
951
|
-
return
|
|
957
|
+
return be(this, t), (r = ke(this, t, [e])).type = e, r;
|
|
952
958
|
}
|
|
953
959
|
return function (e, t) {
|
|
954
960
|
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
|
|
@@ -960,10 +966,10 @@ var Ee,
|
|
|
960
966
|
}
|
|
961
967
|
}), Object.defineProperty(e, "prototype", {
|
|
962
968
|
writable: !1
|
|
963
|
-
}), t &&
|
|
964
|
-
}(t,
|
|
969
|
+
}), t && xe(e, t);
|
|
970
|
+
}(t, we(Error)), ye(t);
|
|
965
971
|
}();
|
|
966
|
-
function
|
|
972
|
+
function Ie(e) {
|
|
967
973
|
var t,
|
|
968
974
|
r = e.method,
|
|
969
975
|
n = e.finalURL,
|
|
@@ -971,9 +977,9 @@ function Re(e) {
|
|
|
971
977
|
s = e.xSDKClientHeader,
|
|
972
978
|
o = e.xSDKParentHostHeader,
|
|
973
979
|
a = e.body;
|
|
974
|
-
return
|
|
980
|
+
return Ee(this, void 0, void 0, me().mark(function e() {
|
|
975
981
|
var c, u, l, d, h, p;
|
|
976
|
-
return
|
|
982
|
+
return me().wrap(function (e) {
|
|
977
983
|
for (;;) switch (e.prev = e.next) {
|
|
978
984
|
case 0:
|
|
979
985
|
return c = {
|
|
@@ -1037,7 +1043,7 @@ function Re(e) {
|
|
|
1037
1043
|
e.next = 49;
|
|
1038
1044
|
break;
|
|
1039
1045
|
}
|
|
1040
|
-
throw new
|
|
1046
|
+
throw new Re(Pe.RequiredCatcha);
|
|
1041
1047
|
case 49:
|
|
1042
1048
|
throw new A("Invalid response from the Stytch servers.");
|
|
1043
1049
|
case 50:
|
|
@@ -1047,43 +1053,43 @@ function Re(e) {
|
|
|
1047
1053
|
}, e, null, [[3, 9], [15, 22], [26, 32], [38, 44]]);
|
|
1048
1054
|
}));
|
|
1049
1055
|
}
|
|
1050
|
-
var
|
|
1051
|
-
function
|
|
1052
|
-
if (!
|
|
1053
|
-
return
|
|
1056
|
+
var Fe = new Uint8Array(16);
|
|
1057
|
+
function je() {
|
|
1058
|
+
if (!De && !(De = "undefined" != typeof crypto && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || "undefined" != typeof msCrypto && "function" == typeof msCrypto.getRandomValues && msCrypto.getRandomValues.bind(msCrypto))) throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1059
|
+
return De(Fe);
|
|
1054
1060
|
}
|
|
1055
|
-
var
|
|
1056
|
-
for (var
|
|
1057
|
-
function
|
|
1061
|
+
var Be = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
1062
|
+
for (var Le = [], Me = 0; Me < 256; ++Me) Le.push((Me + 256).toString(16).substr(1));
|
|
1063
|
+
function Ne(e) {
|
|
1058
1064
|
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
|
|
1059
|
-
r = (
|
|
1065
|
+
r = (Le[e[t + 0]] + Le[e[t + 1]] + Le[e[t + 2]] + Le[e[t + 3]] + "-" + Le[e[t + 4]] + Le[e[t + 5]] + "-" + Le[e[t + 6]] + Le[e[t + 7]] + "-" + Le[e[t + 8]] + Le[e[t + 9]] + "-" + Le[e[t + 10]] + Le[e[t + 11]] + Le[e[t + 12]] + Le[e[t + 13]] + Le[e[t + 14]] + Le[e[t + 15]]).toLowerCase();
|
|
1060
1066
|
if (!function (e) {
|
|
1061
|
-
return "string" == typeof e &&
|
|
1067
|
+
return "string" == typeof e && Be.test(e);
|
|
1062
1068
|
}(r)) throw TypeError("Stringified UUID is invalid");
|
|
1063
1069
|
return r;
|
|
1064
1070
|
}
|
|
1065
|
-
function
|
|
1066
|
-
var n = (e = e || {}).random || (e.rng ||
|
|
1071
|
+
function Ue(e, t, r) {
|
|
1072
|
+
var n = (e = e || {}).random || (e.rng || je)();
|
|
1067
1073
|
if (n[6] = 15 & n[6] | 64, n[8] = 63 & n[8] | 128, t) {
|
|
1068
1074
|
r = r || 0;
|
|
1069
1075
|
for (var i = 0; i < 16; ++i) t[r + i] = n[i];
|
|
1070
1076
|
return t;
|
|
1071
1077
|
}
|
|
1072
|
-
return
|
|
1078
|
+
return Ne(n);
|
|
1073
1079
|
}
|
|
1074
|
-
var
|
|
1075
|
-
function
|
|
1076
|
-
return
|
|
1077
|
-
return
|
|
1080
|
+
var Ke = {};
|
|
1081
|
+
function qe(e, t) {
|
|
1082
|
+
return Ee(this, void 0, void 0, me().mark(function r() {
|
|
1083
|
+
return me().wrap(function (r) {
|
|
1078
1084
|
for (;;) switch (r.prev = r.next) {
|
|
1079
1085
|
case 0:
|
|
1080
|
-
if (void 0 ===
|
|
1086
|
+
if (void 0 === Ke[e]) {
|
|
1081
1087
|
r.next = 2;
|
|
1082
1088
|
break;
|
|
1083
1089
|
}
|
|
1084
|
-
return r.abrupt("return",
|
|
1090
|
+
return r.abrupt("return", Ke[e]);
|
|
1085
1091
|
case 2:
|
|
1086
|
-
return
|
|
1092
|
+
return Ke[e] = We(e, t), r.abrupt("return", Ke[e]);
|
|
1087
1093
|
case 4:
|
|
1088
1094
|
case "end":
|
|
1089
1095
|
return r.stop();
|
|
@@ -1091,10 +1097,10 @@ function Ke(e, t) {
|
|
|
1091
1097
|
}, r);
|
|
1092
1098
|
}));
|
|
1093
1099
|
}
|
|
1094
|
-
function
|
|
1100
|
+
function We(e, t) {
|
|
1095
1101
|
return new Promise(function (r, n) {
|
|
1096
1102
|
var i = function (e) {
|
|
1097
|
-
var t =
|
|
1103
|
+
var t = Ge(e);
|
|
1098
1104
|
if (t[0]) return t[0];
|
|
1099
1105
|
}(e);
|
|
1100
1106
|
if (i && "true" === i.dataset.loaded) try {
|
|
@@ -1118,24 +1124,24 @@ function qe(e, t) {
|
|
|
1118
1124
|
});
|
|
1119
1125
|
});
|
|
1120
1126
|
}
|
|
1121
|
-
var
|
|
1127
|
+
var Ge = function Ge(e) {
|
|
1122
1128
|
return document.querySelectorAll('script[src="'.concat(e, '"]'));
|
|
1123
1129
|
};
|
|
1124
|
-
var
|
|
1125
|
-
|
|
1126
|
-
|
|
1130
|
+
var He,
|
|
1131
|
+
ze = ["[Stytch]"],
|
|
1132
|
+
Ve = function Ve() {
|
|
1127
1133
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
1128
|
-
return (e = console).warn.apply(e,
|
|
1134
|
+
return (e = console).warn.apply(e, ze.concat(r));
|
|
1129
1135
|
},
|
|
1130
|
-
|
|
1136
|
+
Ye = function Ye() {
|
|
1131
1137
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
1132
|
-
return (e = console).error.apply(e,
|
|
1138
|
+
return (e = console).error.apply(e, ze.concat(r));
|
|
1133
1139
|
},
|
|
1134
|
-
|
|
1135
|
-
|
|
1140
|
+
Je = "\nYou can find your public token at https://stytch.com/dashboard/api-keys.",
|
|
1141
|
+
$e = function $e(e) {
|
|
1136
1142
|
var t = {
|
|
1137
1143
|
isObject: function isObject(r, n) {
|
|
1138
|
-
var i = "object" ===
|
|
1144
|
+
var i = "object" === _e(n) && !Array.isArray(n) && null !== n;
|
|
1139
1145
|
if (!i) throw new x(e, r + " must be an object.");
|
|
1140
1146
|
return t;
|
|
1141
1147
|
},
|
|
@@ -1152,7 +1158,7 @@ var Ge,
|
|
|
1152
1158
|
isStringArray: function isStringArray(r, n) {
|
|
1153
1159
|
if (!Array.isArray(n)) throw new x(e, r + " must be an array of strings.");
|
|
1154
1160
|
var i,
|
|
1155
|
-
s =
|
|
1161
|
+
s = he(n);
|
|
1156
1162
|
try {
|
|
1157
1163
|
for (s.s(); !(i = s.n()).done;) {
|
|
1158
1164
|
if ("string" != typeof i.value) throw new x(e, r + " must be an array of strings.");
|
|
@@ -1184,20 +1190,20 @@ var Ge,
|
|
|
1184
1190
|
};
|
|
1185
1191
|
return t;
|
|
1186
1192
|
},
|
|
1187
|
-
$e = function $e(e) {
|
|
1188
|
-
return Te(e, ["request_id", "status_code"]);
|
|
1189
|
-
},
|
|
1190
1193
|
Xe = function Xe(e) {
|
|
1191
|
-
return
|
|
1194
|
+
return Ae(e, ["request_id", "status_code"]);
|
|
1195
|
+
},
|
|
1196
|
+
Ze = function Ze(e) {
|
|
1197
|
+
return Ae(e, ["__user"]);
|
|
1192
1198
|
},
|
|
1193
|
-
|
|
1199
|
+
Qe = ye(function e(t, r, n) {
|
|
1194
1200
|
var i = this,
|
|
1195
1201
|
s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : function () {
|
|
1196
1202
|
return Promise.resolve(void 0);
|
|
1197
1203
|
};
|
|
1198
|
-
|
|
1199
|
-
return
|
|
1200
|
-
return
|
|
1204
|
+
be(this, e), this.bootstrapPromise = n, this.isEnabled = function () {
|
|
1205
|
+
return Ee(i, void 0, void 0, me().mark(function e() {
|
|
1206
|
+
return me().wrap(function (e) {
|
|
1201
1207
|
for (;;) switch (e.prev = e.next) {
|
|
1202
1208
|
case 0:
|
|
1203
1209
|
return e.abrupt("return", this.state.then(function (e) {
|
|
@@ -1210,9 +1216,9 @@ var Ge,
|
|
|
1210
1216
|
}, e, this);
|
|
1211
1217
|
}));
|
|
1212
1218
|
}, this.getTelemetryID = function () {
|
|
1213
|
-
return
|
|
1219
|
+
return Ee(i, void 0, void 0, me().mark(function e() {
|
|
1214
1220
|
var t, r, n, i;
|
|
1215
|
-
return
|
|
1221
|
+
return me().wrap(function (e) {
|
|
1216
1222
|
for (;;) switch (e.prev = e.next) {
|
|
1217
1223
|
case 0:
|
|
1218
1224
|
return e.next = 2, this.state;
|
|
@@ -1233,9 +1239,9 @@ var Ge,
|
|
|
1233
1239
|
}, e, this);
|
|
1234
1240
|
}));
|
|
1235
1241
|
}, this.getDFPTelemetryIDAndCaptcha = function () {
|
|
1236
|
-
return
|
|
1242
|
+
return Ee(i, void 0, void 0, me().mark(function e() {
|
|
1237
1243
|
var t, r, n, i, s, o;
|
|
1238
|
-
return
|
|
1244
|
+
return me().wrap(function (e) {
|
|
1239
1245
|
for (;;) switch (e.prev = e.next) {
|
|
1240
1246
|
case 0:
|
|
1241
1247
|
return e.next = 2, this.state;
|
|
@@ -1278,9 +1284,9 @@ var Ge,
|
|
|
1278
1284
|
}, e, this);
|
|
1279
1285
|
}));
|
|
1280
1286
|
}, this.retryWithCaptchaAndDFP = function (e, t) {
|
|
1281
|
-
return
|
|
1287
|
+
return Ee(i, void 0, void 0, me().mark(function r() {
|
|
1282
1288
|
var n, i, s;
|
|
1283
|
-
return
|
|
1289
|
+
return me().wrap(function (r) {
|
|
1284
1290
|
for (;;) switch (r.prev = r.next) {
|
|
1285
1291
|
case 0:
|
|
1286
1292
|
return r.next = 2, this.state;
|
|
@@ -1309,8 +1315,8 @@ var Ge,
|
|
|
1309
1315
|
}, r, this);
|
|
1310
1316
|
}));
|
|
1311
1317
|
}, this.state = n.then(function (e) {
|
|
1312
|
-
return
|
|
1313
|
-
return
|
|
1318
|
+
return Ee(i, void 0, void 0, me().mark(function n() {
|
|
1319
|
+
return me().wrap(function (n) {
|
|
1314
1320
|
for (;;) switch (n.prev = n.next) {
|
|
1315
1321
|
case 0:
|
|
1316
1322
|
if (e.runDFPProtectedAuth) {
|
|
@@ -1325,7 +1331,7 @@ var Ge,
|
|
|
1325
1331
|
executeRecaptcha: s
|
|
1326
1332
|
});
|
|
1327
1333
|
case 2:
|
|
1328
|
-
return n.next = 4,
|
|
1334
|
+
return n.next = 4, qe("".concat("https://elements.stytch.com", "/telemetry.js"), function () {
|
|
1329
1335
|
return window.GetTelemetryID;
|
|
1330
1336
|
});
|
|
1331
1337
|
case 4:
|
|
@@ -1345,11 +1351,11 @@ var Ge,
|
|
|
1345
1351
|
}));
|
|
1346
1352
|
});
|
|
1347
1353
|
}),
|
|
1348
|
-
|
|
1354
|
+
et = function et() {
|
|
1349
1355
|
return {
|
|
1350
1356
|
isEnabled: function isEnabled() {
|
|
1351
|
-
return
|
|
1352
|
-
return
|
|
1357
|
+
return Ee(void 0, void 0, void 0, me().mark(function e() {
|
|
1358
|
+
return me().wrap(function (e) {
|
|
1353
1359
|
for (;;) switch (e.prev = e.next) {
|
|
1354
1360
|
case 0:
|
|
1355
1361
|
return e.abrupt("return", !1);
|
|
@@ -1361,8 +1367,8 @@ var Ge,
|
|
|
1361
1367
|
}));
|
|
1362
1368
|
},
|
|
1363
1369
|
getTelemetryID: function getTelemetryID() {
|
|
1364
|
-
return
|
|
1365
|
-
return
|
|
1370
|
+
return Ee(void 0, void 0, void 0, me().mark(function e() {
|
|
1371
|
+
return me().wrap(function (e) {
|
|
1366
1372
|
for (;;) switch (e.prev = e.next) {
|
|
1367
1373
|
case 0:
|
|
1368
1374
|
return e.abrupt("return", void 0);
|
|
@@ -1374,8 +1380,8 @@ var Ge,
|
|
|
1374
1380
|
}));
|
|
1375
1381
|
},
|
|
1376
1382
|
getDFPTelemetryIDAndCaptcha: function getDFPTelemetryIDAndCaptcha() {
|
|
1377
|
-
return
|
|
1378
|
-
return
|
|
1383
|
+
return Ee(void 0, void 0, void 0, me().mark(function e() {
|
|
1384
|
+
return me().wrap(function (e) {
|
|
1379
1385
|
for (;;) switch (e.prev = e.next) {
|
|
1380
1386
|
case 0:
|
|
1381
1387
|
return e.abrupt("return", {
|
|
@@ -1390,8 +1396,8 @@ var Ge,
|
|
|
1390
1396
|
}));
|
|
1391
1397
|
},
|
|
1392
1398
|
retryWithCaptchaAndDFP: function retryWithCaptchaAndDFP() {
|
|
1393
|
-
return
|
|
1394
|
-
return
|
|
1399
|
+
return Ee(void 0, void 0, void 0, me().mark(function e() {
|
|
1400
|
+
return me().wrap(function (e) {
|
|
1395
1401
|
for (;;) switch (e.prev = e.next) {
|
|
1396
1402
|
case 0:
|
|
1397
1403
|
throw new Error("DFP protected auth is disabled");
|
|
@@ -1404,11 +1410,11 @@ var Ge,
|
|
|
1404
1410
|
}
|
|
1405
1411
|
};
|
|
1406
1412
|
},
|
|
1407
|
-
|
|
1413
|
+
tt = function () {
|
|
1408
1414
|
function e() {
|
|
1409
|
-
|
|
1415
|
+
be(this, e);
|
|
1410
1416
|
}
|
|
1411
|
-
return
|
|
1417
|
+
return ye(e, null, [{
|
|
1412
1418
|
key: "marshall",
|
|
1413
1419
|
value: function value(e) {
|
|
1414
1420
|
return Object.assign(Object.assign({}, e), {
|
|
@@ -1430,13 +1436,13 @@ var Ge,
|
|
|
1430
1436
|
case "SDKAPIUnreachableError":
|
|
1431
1437
|
return e.inflate(S, t);
|
|
1432
1438
|
case "StytchSDKSchemaError":
|
|
1433
|
-
return e.inflate(
|
|
1439
|
+
return e.inflate(C, t);
|
|
1434
1440
|
case "StytchAPIUnreachableError":
|
|
1435
1441
|
return e.inflate(A, t);
|
|
1436
1442
|
case "StytchAPISchemaError":
|
|
1437
1443
|
return e.inflate(E, t);
|
|
1438
1444
|
case "StytchSDKAPIError":
|
|
1439
|
-
return e.inflate(
|
|
1445
|
+
return e.inflate(P, t);
|
|
1440
1446
|
case "StytchAPIError":
|
|
1441
1447
|
return e.inflate(D, t);
|
|
1442
1448
|
case "TypeError":
|
|
@@ -1456,11 +1462,11 @@ var Ge,
|
|
|
1456
1462
|
}
|
|
1457
1463
|
}]), e;
|
|
1458
1464
|
}(),
|
|
1459
|
-
|
|
1465
|
+
rt = function () {
|
|
1460
1466
|
function e(t) {
|
|
1461
|
-
|
|
1467
|
+
be(this, e), this.maxBatchSize = t.maxBatchSize, this.logEventURL = t.logEventURL, setInterval(this.flush.bind(this), t.intervalDurationMs), this.batch = [];
|
|
1462
1468
|
}
|
|
1463
|
-
return
|
|
1469
|
+
return ye(e, [{
|
|
1464
1470
|
key: "logEvent",
|
|
1465
1471
|
value: function value(e, t) {
|
|
1466
1472
|
this.batch.push({
|
|
@@ -1471,9 +1477,9 @@ var Ge,
|
|
|
1471
1477
|
}, {
|
|
1472
1478
|
key: "flush",
|
|
1473
1479
|
value: function value() {
|
|
1474
|
-
return
|
|
1480
|
+
return Ee(this, void 0, void 0, me().mark(function e() {
|
|
1475
1481
|
var t;
|
|
1476
|
-
return
|
|
1482
|
+
return me().wrap(function (e) {
|
|
1477
1483
|
for (;;) switch (e.prev = e.next) {
|
|
1478
1484
|
case 0:
|
|
1479
1485
|
if (this.batch.length) {
|
|
@@ -1505,13 +1511,13 @@ var Ge,
|
|
|
1505
1511
|
}();
|
|
1506
1512
|
!function (e) {
|
|
1507
1513
|
e.LoginOrCreateEML = "login_or_create_eml", e.LoginOrCreateOTP = "login_or_create_otp", e.ResetPassword = "reset_password";
|
|
1508
|
-
}(
|
|
1509
|
-
var
|
|
1514
|
+
}(He || (He = {}));
|
|
1515
|
+
var nt = ye(function e(t, r) {
|
|
1510
1516
|
var n = this;
|
|
1511
|
-
|
|
1512
|
-
return
|
|
1517
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
|
|
1518
|
+
return Ee(n, void 0, void 0, me().mark(function e() {
|
|
1513
1519
|
var t, r;
|
|
1514
|
-
return
|
|
1520
|
+
return me().wrap(function (e) {
|
|
1515
1521
|
for (;;) switch (e.prev = e.next) {
|
|
1516
1522
|
case 0:
|
|
1517
1523
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1520,7 +1526,7 @@ var rt = ve(function e(t, r) {
|
|
|
1520
1526
|
method: "GET"
|
|
1521
1527
|
});
|
|
1522
1528
|
case 2:
|
|
1523
|
-
return t = e.sent, r =
|
|
1529
|
+
return t = e.sent, r = Xe(t), this._subscriptionService.updateUser(r), e.abrupt("return", r);
|
|
1524
1530
|
case 6:
|
|
1525
1531
|
case "end":
|
|
1526
1532
|
return e.stop();
|
|
@@ -1529,20 +1535,25 @@ var rt = ve(function e(t, r) {
|
|
|
1529
1535
|
}));
|
|
1530
1536
|
}, this.getSync = function () {
|
|
1531
1537
|
return n._subscriptionService.getUser();
|
|
1538
|
+
}, this.getInfo = function () {
|
|
1539
|
+
return {
|
|
1540
|
+
user: n.getSync(),
|
|
1541
|
+
fromCache: n._subscriptionService.getFromCache()
|
|
1542
|
+
};
|
|
1532
1543
|
}, this.update = function (e) {
|
|
1533
|
-
return
|
|
1544
|
+
return Ee(n, void 0, void 0, me().mark(function t() {
|
|
1534
1545
|
var r, n;
|
|
1535
|
-
return
|
|
1546
|
+
return me().wrap(function (t) {
|
|
1536
1547
|
for (;;) switch (t.prev = t.next) {
|
|
1537
1548
|
case 0:
|
|
1538
|
-
return
|
|
1549
|
+
return $e("stytch.user.update").isOptionalObject("untrusted_metadata", e.untrusted_metadata), t.next = 3, this._networkClient.fetchSDK({
|
|
1539
1550
|
url: "/users/me",
|
|
1540
1551
|
body: e,
|
|
1541
1552
|
errorMessage: "Failed to update user.",
|
|
1542
1553
|
method: "PUT"
|
|
1543
1554
|
});
|
|
1544
1555
|
case 3:
|
|
1545
|
-
return r = t.sent, n =
|
|
1556
|
+
return r = t.sent, n = Xe(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Ze(r));
|
|
1546
1557
|
case 7:
|
|
1547
1558
|
case "end":
|
|
1548
1559
|
return t.stop();
|
|
@@ -1550,9 +1561,9 @@ var rt = ve(function e(t, r) {
|
|
|
1550
1561
|
}, t, this);
|
|
1551
1562
|
}));
|
|
1552
1563
|
}, this.deleteEmail = function (e) {
|
|
1553
|
-
return
|
|
1564
|
+
return Ee(n, void 0, void 0, me().mark(function t() {
|
|
1554
1565
|
var r, n;
|
|
1555
|
-
return
|
|
1566
|
+
return me().wrap(function (t) {
|
|
1556
1567
|
for (;;) switch (t.prev = t.next) {
|
|
1557
1568
|
case 0:
|
|
1558
1569
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1561,7 +1572,7 @@ var rt = ve(function e(t, r) {
|
|
|
1561
1572
|
method: "DELETE"
|
|
1562
1573
|
});
|
|
1563
1574
|
case 2:
|
|
1564
|
-
return r = t.sent, n =
|
|
1575
|
+
return r = t.sent, n = Xe(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Ze(r));
|
|
1565
1576
|
case 6:
|
|
1566
1577
|
case "end":
|
|
1567
1578
|
return t.stop();
|
|
@@ -1569,9 +1580,9 @@ var rt = ve(function e(t, r) {
|
|
|
1569
1580
|
}, t, this);
|
|
1570
1581
|
}));
|
|
1571
1582
|
}, this.deletePhoneNumber = function (e) {
|
|
1572
|
-
return
|
|
1583
|
+
return Ee(n, void 0, void 0, me().mark(function t() {
|
|
1573
1584
|
var r, n;
|
|
1574
|
-
return
|
|
1585
|
+
return me().wrap(function (t) {
|
|
1575
1586
|
for (;;) switch (t.prev = t.next) {
|
|
1576
1587
|
case 0:
|
|
1577
1588
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1580,7 +1591,7 @@ var rt = ve(function e(t, r) {
|
|
|
1580
1591
|
method: "DELETE"
|
|
1581
1592
|
});
|
|
1582
1593
|
case 2:
|
|
1583
|
-
return r = t.sent, n =
|
|
1594
|
+
return r = t.sent, n = Xe(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Ze(r));
|
|
1584
1595
|
case 6:
|
|
1585
1596
|
case "end":
|
|
1586
1597
|
return t.stop();
|
|
@@ -1588,9 +1599,9 @@ var rt = ve(function e(t, r) {
|
|
|
1588
1599
|
}, t, this);
|
|
1589
1600
|
}));
|
|
1590
1601
|
}, this.deleteTOTP = function (e) {
|
|
1591
|
-
return
|
|
1602
|
+
return Ee(n, void 0, void 0, me().mark(function t() {
|
|
1592
1603
|
var r, n;
|
|
1593
|
-
return
|
|
1604
|
+
return me().wrap(function (t) {
|
|
1594
1605
|
for (;;) switch (t.prev = t.next) {
|
|
1595
1606
|
case 0:
|
|
1596
1607
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1599,7 +1610,7 @@ var rt = ve(function e(t, r) {
|
|
|
1599
1610
|
method: "DELETE"
|
|
1600
1611
|
});
|
|
1601
1612
|
case 2:
|
|
1602
|
-
return r = t.sent, n =
|
|
1613
|
+
return r = t.sent, n = Xe(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Ze(r));
|
|
1603
1614
|
case 6:
|
|
1604
1615
|
case "end":
|
|
1605
1616
|
return t.stop();
|
|
@@ -1607,9 +1618,9 @@ var rt = ve(function e(t, r) {
|
|
|
1607
1618
|
}, t, this);
|
|
1608
1619
|
}));
|
|
1609
1620
|
}, this.deleteOAuthRegistration = function (e) {
|
|
1610
|
-
return
|
|
1621
|
+
return Ee(n, void 0, void 0, me().mark(function t() {
|
|
1611
1622
|
var r, n;
|
|
1612
|
-
return
|
|
1623
|
+
return me().wrap(function (t) {
|
|
1613
1624
|
for (;;) switch (t.prev = t.next) {
|
|
1614
1625
|
case 0:
|
|
1615
1626
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1618,7 +1629,7 @@ var rt = ve(function e(t, r) {
|
|
|
1618
1629
|
method: "DELETE"
|
|
1619
1630
|
});
|
|
1620
1631
|
case 2:
|
|
1621
|
-
return r = t.sent, n =
|
|
1632
|
+
return r = t.sent, n = Xe(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Ze(r));
|
|
1622
1633
|
case 6:
|
|
1623
1634
|
case "end":
|
|
1624
1635
|
return t.stop();
|
|
@@ -1626,9 +1637,9 @@ var rt = ve(function e(t, r) {
|
|
|
1626
1637
|
}, t, this);
|
|
1627
1638
|
}));
|
|
1628
1639
|
}, this.deleteWebauthnRegistration = function (e) {
|
|
1629
|
-
return
|
|
1640
|
+
return Ee(n, void 0, void 0, me().mark(function t() {
|
|
1630
1641
|
var r, n;
|
|
1631
|
-
return
|
|
1642
|
+
return me().wrap(function (t) {
|
|
1632
1643
|
for (;;) switch (t.prev = t.next) {
|
|
1633
1644
|
case 0:
|
|
1634
1645
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1637,7 +1648,7 @@ var rt = ve(function e(t, r) {
|
|
|
1637
1648
|
method: "DELETE"
|
|
1638
1649
|
});
|
|
1639
1650
|
case 2:
|
|
1640
|
-
return r = t.sent, n =
|
|
1651
|
+
return r = t.sent, n = Xe(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Ze(r));
|
|
1641
1652
|
case 6:
|
|
1642
1653
|
case "end":
|
|
1643
1654
|
return t.stop();
|
|
@@ -1645,9 +1656,9 @@ var rt = ve(function e(t, r) {
|
|
|
1645
1656
|
}, t, this);
|
|
1646
1657
|
}));
|
|
1647
1658
|
}, this.deleteBiometricRegistration = function (e) {
|
|
1648
|
-
return
|
|
1659
|
+
return Ee(n, void 0, void 0, me().mark(function t() {
|
|
1649
1660
|
var r, n;
|
|
1650
|
-
return
|
|
1661
|
+
return me().wrap(function (t) {
|
|
1651
1662
|
for (;;) switch (t.prev = t.next) {
|
|
1652
1663
|
case 0:
|
|
1653
1664
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1656,7 +1667,7 @@ var rt = ve(function e(t, r) {
|
|
|
1656
1667
|
method: "DELETE"
|
|
1657
1668
|
});
|
|
1658
1669
|
case 2:
|
|
1659
|
-
return r = t.sent, n =
|
|
1670
|
+
return r = t.sent, n = Xe(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Ze(r));
|
|
1660
1671
|
case 6:
|
|
1661
1672
|
case "end":
|
|
1662
1673
|
return t.stop();
|
|
@@ -1671,11 +1682,16 @@ var rt = ve(function e(t, r) {
|
|
|
1671
1682
|
});
|
|
1672
1683
|
};
|
|
1673
1684
|
}),
|
|
1674
|
-
|
|
1685
|
+
it = function () {
|
|
1675
1686
|
function e(t, r) {
|
|
1676
1687
|
var n = this;
|
|
1677
|
-
|
|
1688
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this.getSync = function () {
|
|
1678
1689
|
return n._subscriptionService.getSession();
|
|
1690
|
+
}, this.getInfo = function () {
|
|
1691
|
+
return {
|
|
1692
|
+
session: n.getSync(),
|
|
1693
|
+
fromCache: n._subscriptionService.getFromCache()
|
|
1694
|
+
};
|
|
1679
1695
|
}, this.onChange = function (e) {
|
|
1680
1696
|
var t = n._subscriptionService.getSession();
|
|
1681
1697
|
return n._subscriptionService.subscribeToState(function (r) {
|
|
@@ -1683,9 +1699,9 @@ var rt = ve(function e(t, r) {
|
|
|
1683
1699
|
(null == r ? void 0 : r.session) !== t && (t = null !== (n = null == r ? void 0 : r.session) && void 0 !== n ? n : null, e(t));
|
|
1684
1700
|
});
|
|
1685
1701
|
}, this.revoke = function (e) {
|
|
1686
|
-
return
|
|
1702
|
+
return Ee(n, void 0, void 0, me().mark(function t() {
|
|
1687
1703
|
var r;
|
|
1688
|
-
return
|
|
1704
|
+
return me().wrap(function (t) {
|
|
1689
1705
|
for (;;) switch (t.prev = t.next) {
|
|
1690
1706
|
case 0:
|
|
1691
1707
|
return t.prev = 0, t.next = 3, this._networkClient.fetchSDK({
|
|
@@ -1696,7 +1712,7 @@ var rt = ve(function e(t, r) {
|
|
|
1696
1712
|
case 3:
|
|
1697
1713
|
return r = t.sent, this._subscriptionService.destroyState(), t.abrupt("return", r);
|
|
1698
1714
|
case 8:
|
|
1699
|
-
throw t.prev = 8, t.t0 = t["catch"](0), ((null == e ? void 0 : e.forceClear) ||
|
|
1715
|
+
throw t.prev = 8, t.t0 = t["catch"](0), ((null == e ? void 0 : e.forceClear) || O.includes(t.t0.error_type)) && this._subscriptionService.destroyState(), t.t0;
|
|
1700
1716
|
case 12:
|
|
1701
1717
|
case "end":
|
|
1702
1718
|
return t.stop();
|
|
@@ -1704,13 +1720,13 @@ var rt = ve(function e(t, r) {
|
|
|
1704
1720
|
}, t, this, [[0, 8]]);
|
|
1705
1721
|
}));
|
|
1706
1722
|
}, this.authenticate = function (e) {
|
|
1707
|
-
return
|
|
1723
|
+
return Ee(n, void 0, void 0, me().mark(function t() {
|
|
1708
1724
|
var r,
|
|
1709
1725
|
n,
|
|
1710
1726
|
i,
|
|
1711
1727
|
s,
|
|
1712
1728
|
o = this;
|
|
1713
|
-
return
|
|
1729
|
+
return me().wrap(function (t) {
|
|
1714
1730
|
for (;;) switch (t.prev = t.next) {
|
|
1715
1731
|
case 0:
|
|
1716
1732
|
return r = this._subscriptionService.getSession(), n = function n() {
|
|
@@ -1739,7 +1755,7 @@ var rt = ve(function e(t, r) {
|
|
|
1739
1755
|
session_token: s.session_token,
|
|
1740
1756
|
session_jwt: s.session_jwt,
|
|
1741
1757
|
intermediate_session_token: null
|
|
1742
|
-
}), t.abrupt("return",
|
|
1758
|
+
}), t.abrupt("return", Ze(s));
|
|
1743
1759
|
case 13:
|
|
1744
1760
|
if (t.prev = 13, t.t0 = t["catch"](2), !n()) {
|
|
1745
1761
|
t.next = 17;
|
|
@@ -1747,7 +1763,7 @@ var rt = ve(function e(t, r) {
|
|
|
1747
1763
|
}
|
|
1748
1764
|
return t.abrupt("return", this.authenticate(e));
|
|
1749
1765
|
case 17:
|
|
1750
|
-
throw
|
|
1766
|
+
throw O.includes(t.t0.error_type) && this._subscriptionService.destroySession(), t.t0;
|
|
1751
1767
|
case 19:
|
|
1752
1768
|
case "end":
|
|
1753
1769
|
return t.stop();
|
|
@@ -1756,7 +1772,7 @@ var rt = ve(function e(t, r) {
|
|
|
1756
1772
|
}));
|
|
1757
1773
|
};
|
|
1758
1774
|
}
|
|
1759
|
-
return
|
|
1775
|
+
return ye(e, [{
|
|
1760
1776
|
key: "getTokens",
|
|
1761
1777
|
value: function value() {
|
|
1762
1778
|
return this._subscriptionService.getTokens();
|
|
@@ -1768,20 +1784,20 @@ var rt = ve(function e(t, r) {
|
|
|
1768
1784
|
}
|
|
1769
1785
|
}]), e;
|
|
1770
1786
|
}(),
|
|
1771
|
-
|
|
1787
|
+
st = Promise.resolve({
|
|
1772
1788
|
pkceRequiredForEmailMagicLinks: !1
|
|
1773
1789
|
}),
|
|
1774
|
-
|
|
1790
|
+
ot = function () {
|
|
1775
1791
|
function e(t, r, n, i) {
|
|
1776
1792
|
var s = this,
|
|
1777
|
-
o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] :
|
|
1778
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
1779
|
-
|
|
1793
|
+
o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : st,
|
|
1794
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : et();
|
|
1795
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._passwordResetPKCEManager = i, this._config = o, this.dfpProtectedAuth = a, this.email = {
|
|
1780
1796
|
loginOrCreate: function loginOrCreate(e) {
|
|
1781
1797
|
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
1782
|
-
return
|
|
1798
|
+
return Ee(s, void 0, void 0, me().mark(function r() {
|
|
1783
1799
|
var n, i, s, o, a, c, u;
|
|
1784
|
-
return
|
|
1800
|
+
return me().wrap(function (r) {
|
|
1785
1801
|
for (;;) switch (r.prev = r.next) {
|
|
1786
1802
|
case 0:
|
|
1787
1803
|
return r.next = 2, this._config;
|
|
@@ -1817,9 +1833,9 @@ var rt = ve(function e(t, r) {
|
|
|
1817
1833
|
},
|
|
1818
1834
|
send: function send(e) {
|
|
1819
1835
|
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
1820
|
-
return
|
|
1836
|
+
return Ee(s, void 0, void 0, me().mark(function r() {
|
|
1821
1837
|
var n, i, s, o, a, c, u, l, d;
|
|
1822
|
-
return
|
|
1838
|
+
return me().wrap(function (r) {
|
|
1823
1839
|
for (;;) switch (r.prev = r.next) {
|
|
1824
1840
|
case 0:
|
|
1825
1841
|
return r.next = 2, this._config;
|
|
@@ -1854,12 +1870,12 @@ var rt = ve(function e(t, r) {
|
|
|
1854
1870
|
}));
|
|
1855
1871
|
}
|
|
1856
1872
|
}, this.authenticate = function (e, t) {
|
|
1857
|
-
return
|
|
1873
|
+
return Ee(s, void 0, void 0, me().mark(function r() {
|
|
1858
1874
|
var n, i;
|
|
1859
|
-
return
|
|
1875
|
+
return me().wrap(function (r) {
|
|
1860
1876
|
for (;;) switch (r.prev = r.next) {
|
|
1861
1877
|
case 0:
|
|
1862
|
-
return
|
|
1878
|
+
return $e("stytch.magicLinks.authenticate").isString("Token", e).isNumber("session_duration_minutes", t.session_duration_minutes), r.next = 3, this._passwordResetPKCEManager.getPKPair();
|
|
1863
1879
|
case 3:
|
|
1864
1880
|
if (n = r.sent, i = null, !(null == n ? void 0 : n.code_verifier)) {
|
|
1865
1881
|
r.next = 19;
|
|
@@ -1899,7 +1915,7 @@ var rt = ve(function e(t, r) {
|
|
|
1899
1915
|
session_token: i.session_token,
|
|
1900
1916
|
session_jwt: i.session_jwt,
|
|
1901
1917
|
intermediate_session_token: null
|
|
1902
|
-
}), r.abrupt("return",
|
|
1918
|
+
}), r.abrupt("return", Ze(i));
|
|
1903
1919
|
case 25:
|
|
1904
1920
|
case "end":
|
|
1905
1921
|
return r.stop();
|
|
@@ -1908,12 +1924,12 @@ var rt = ve(function e(t, r) {
|
|
|
1908
1924
|
}));
|
|
1909
1925
|
};
|
|
1910
1926
|
}
|
|
1911
|
-
return
|
|
1927
|
+
return ye(e, [{
|
|
1912
1928
|
key: "getCodeChallenge",
|
|
1913
1929
|
value: function value() {
|
|
1914
|
-
return
|
|
1930
|
+
return Ee(this, void 0, void 0, me().mark(function e() {
|
|
1915
1931
|
var t;
|
|
1916
|
-
return
|
|
1932
|
+
return me().wrap(function (e) {
|
|
1917
1933
|
for (;;) switch (e.prev = e.next) {
|
|
1918
1934
|
case 0:
|
|
1919
1935
|
return e.next = 2, this._pkceManager.getPKPair();
|
|
@@ -1937,9 +1953,9 @@ var rt = ve(function e(t, r) {
|
|
|
1937
1953
|
}, {
|
|
1938
1954
|
key: "handlePKCEForAuthenticate",
|
|
1939
1955
|
value: function value(e, t) {
|
|
1940
|
-
return
|
|
1956
|
+
return Ee(this, void 0, void 0, me().mark(function r() {
|
|
1941
1957
|
var n, i, s;
|
|
1942
|
-
return
|
|
1958
|
+
return me().wrap(function (r) {
|
|
1943
1959
|
for (;;) switch (r.prev = r.next) {
|
|
1944
1960
|
case 0:
|
|
1945
1961
|
return r.next = 2, e.getPKPair();
|
|
@@ -1963,17 +1979,17 @@ var rt = ve(function e(t, r) {
|
|
|
1963
1979
|
}
|
|
1964
1980
|
}]), e;
|
|
1965
1981
|
}(),
|
|
1966
|
-
|
|
1982
|
+
at = ye(function e(t, r) {
|
|
1967
1983
|
var n = this,
|
|
1968
1984
|
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : function () {
|
|
1969
1985
|
return Promise.resolve(void 0);
|
|
1970
1986
|
},
|
|
1971
|
-
s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] :
|
|
1972
|
-
|
|
1987
|
+
s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : et();
|
|
1988
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this.executeRecaptcha = i, this.dfpProtectedAuth = s, this.sms = {
|
|
1973
1989
|
loginOrCreate: function loginOrCreate(e, t) {
|
|
1974
|
-
return
|
|
1990
|
+
return Ee(n, void 0, void 0, me().mark(function r() {
|
|
1975
1991
|
var n, i, s, o;
|
|
1976
|
-
return
|
|
1992
|
+
return me().wrap(function (r) {
|
|
1977
1993
|
for (;;) switch (r.prev = r.next) {
|
|
1978
1994
|
case 0:
|
|
1979
1995
|
return r.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
@@ -1997,9 +2013,9 @@ var rt = ve(function e(t, r) {
|
|
|
1997
2013
|
}));
|
|
1998
2014
|
},
|
|
1999
2015
|
send: function send(e, t) {
|
|
2000
|
-
return
|
|
2016
|
+
return Ee(n, void 0, void 0, me().mark(function r() {
|
|
2001
2017
|
var n, i, s, o, a, c;
|
|
2002
|
-
return
|
|
2018
|
+
return me().wrap(function (r) {
|
|
2003
2019
|
for (;;) switch (r.prev = r.next) {
|
|
2004
2020
|
case 0:
|
|
2005
2021
|
return r.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
@@ -2024,9 +2040,9 @@ var rt = ve(function e(t, r) {
|
|
|
2024
2040
|
}
|
|
2025
2041
|
}, this.whatsapp = {
|
|
2026
2042
|
loginOrCreate: function loginOrCreate(e, t) {
|
|
2027
|
-
return
|
|
2043
|
+
return Ee(n, void 0, void 0, me().mark(function r() {
|
|
2028
2044
|
var n, i, s, o;
|
|
2029
|
-
return
|
|
2045
|
+
return me().wrap(function (r) {
|
|
2030
2046
|
for (;;) switch (r.prev = r.next) {
|
|
2031
2047
|
case 0:
|
|
2032
2048
|
return r.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
@@ -2050,9 +2066,9 @@ var rt = ve(function e(t, r) {
|
|
|
2050
2066
|
}));
|
|
2051
2067
|
},
|
|
2052
2068
|
send: function send(e, t) {
|
|
2053
|
-
return
|
|
2069
|
+
return Ee(n, void 0, void 0, me().mark(function r() {
|
|
2054
2070
|
var n, i, s, o, a, c;
|
|
2055
|
-
return
|
|
2071
|
+
return me().wrap(function (r) {
|
|
2056
2072
|
for (;;) switch (r.prev = r.next) {
|
|
2057
2073
|
case 0:
|
|
2058
2074
|
return r.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
@@ -2077,9 +2093,9 @@ var rt = ve(function e(t, r) {
|
|
|
2077
2093
|
}
|
|
2078
2094
|
}, this.email = {
|
|
2079
2095
|
loginOrCreate: function loginOrCreate(e, t) {
|
|
2080
|
-
return
|
|
2096
|
+
return Ee(n, void 0, void 0, me().mark(function r() {
|
|
2081
2097
|
var n, i;
|
|
2082
|
-
return
|
|
2098
|
+
return me().wrap(function (r) {
|
|
2083
2099
|
for (;;) switch (r.prev = r.next) {
|
|
2084
2100
|
case 0:
|
|
2085
2101
|
return r.next = 2, this.executeRecaptcha();
|
|
@@ -2101,9 +2117,9 @@ var rt = ve(function e(t, r) {
|
|
|
2101
2117
|
}));
|
|
2102
2118
|
},
|
|
2103
2119
|
send: function send(e, t) {
|
|
2104
|
-
return
|
|
2120
|
+
return Ee(n, void 0, void 0, me().mark(function r() {
|
|
2105
2121
|
var n, i, s, o;
|
|
2106
|
-
return
|
|
2122
|
+
return me().wrap(function (r) {
|
|
2107
2123
|
for (;;) switch (r.prev = r.next) {
|
|
2108
2124
|
case 0:
|
|
2109
2125
|
return r.next = 2, this.executeRecaptcha();
|
|
@@ -2125,12 +2141,12 @@ var rt = ve(function e(t, r) {
|
|
|
2125
2141
|
}));
|
|
2126
2142
|
}
|
|
2127
2143
|
}, this.authenticate = function (e, t, r) {
|
|
2128
|
-
return
|
|
2144
|
+
return Ee(n, void 0, void 0, me().mark(function n() {
|
|
2129
2145
|
var i, s, o, a, c;
|
|
2130
|
-
return
|
|
2146
|
+
return me().wrap(function (n) {
|
|
2131
2147
|
for (;;) switch (n.prev = n.next) {
|
|
2132
2148
|
case 0:
|
|
2133
|
-
return
|
|
2149
|
+
return $e("stytch.otps.authenticate").isString("Code", e).isNumber("session_duration_minutes", r.session_duration_minutes), n.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2134
2150
|
case 3:
|
|
2135
2151
|
return i = n.sent, s = i.dfp_telemetry_id, o = i.captcha_token, a = Object.assign({
|
|
2136
2152
|
token: e,
|
|
@@ -2153,7 +2169,7 @@ var rt = ve(function e(t, r) {
|
|
|
2153
2169
|
session_token: c.session_token,
|
|
2154
2170
|
session_jwt: c.session_jwt,
|
|
2155
2171
|
intermediate_session_token: null
|
|
2156
|
-
}), n.abrupt("return",
|
|
2172
|
+
}), n.abrupt("return", Ze(c));
|
|
2157
2173
|
case 12:
|
|
2158
2174
|
case "end":
|
|
2159
2175
|
return n.stop();
|
|
@@ -2162,9 +2178,9 @@ var rt = ve(function e(t, r) {
|
|
|
2162
2178
|
}));
|
|
2163
2179
|
};
|
|
2164
2180
|
}),
|
|
2165
|
-
|
|
2181
|
+
ct = function () {
|
|
2166
2182
|
function e(t, r, n, i, s) {
|
|
2167
|
-
|
|
2183
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = s, this.google = {
|
|
2168
2184
|
start: this.startOAuthFlow(exports.OAuthProviders.Google)
|
|
2169
2185
|
}, this.apple = {
|
|
2170
2186
|
start: this.startOAuthFlow(exports.OAuthProviders.Apple)
|
|
@@ -2204,17 +2220,17 @@ var rt = ve(function e(t, r) {
|
|
|
2204
2220
|
start: this.startOAuthFlow(exports.OAuthProviders.Yahoo)
|
|
2205
2221
|
};
|
|
2206
2222
|
}
|
|
2207
|
-
return
|
|
2223
|
+
return ye(e, [{
|
|
2208
2224
|
key: "authenticate",
|
|
2209
2225
|
value: function value(e, t) {
|
|
2210
|
-
return
|
|
2226
|
+
return Ee(this, void 0, void 0, me().mark(function r() {
|
|
2211
2227
|
var n, i;
|
|
2212
|
-
return
|
|
2228
|
+
return me().wrap(function (r) {
|
|
2213
2229
|
for (;;) switch (r.prev = r.next) {
|
|
2214
2230
|
case 0:
|
|
2215
|
-
return
|
|
2231
|
+
return $e("stytch.oauth.authenticate").isString("Token", e).isNumber("session_duration_minutes", t.session_duration_minutes), r.next = 3, this._pkceManager.getPKPair();
|
|
2216
2232
|
case 3:
|
|
2217
|
-
return (n = r.sent) ||
|
|
2233
|
+
return (n = r.sent) || Ve("No code verifier found in local storage for OAuth flow.\nConsider using stytch.oauth.$provider.start() to add PKCE to your OAuth flows for added security.\nSee https://stytch.com/docs/oauth#guides_pkce for more information."), r.next = 7, this._networkClient.fetchSDK({
|
|
2218
2234
|
url: "/oauth/authenticate",
|
|
2219
2235
|
method: "POST",
|
|
2220
2236
|
body: Object.assign({
|
|
@@ -2227,12 +2243,12 @@ var rt = ve(function e(t, r) {
|
|
|
2227
2243
|
return i = r.sent, this._pkceManager.clearPKPair(), this._subscriptionService.updateStateAndTokens({
|
|
2228
2244
|
state: {
|
|
2229
2245
|
session: i.session,
|
|
2230
|
-
user:
|
|
2246
|
+
user: Xe(i.__user)
|
|
2231
2247
|
},
|
|
2232
2248
|
session_token: i.session_token,
|
|
2233
2249
|
session_jwt: i.session_jwt,
|
|
2234
2250
|
intermediate_session_token: null
|
|
2235
|
-
}), r.abrupt("return",
|
|
2251
|
+
}), r.abrupt("return", Ze(i));
|
|
2236
2252
|
case 11:
|
|
2237
2253
|
case "end":
|
|
2238
2254
|
return r.stop();
|
|
@@ -2243,9 +2259,9 @@ var rt = ve(function e(t, r) {
|
|
|
2243
2259
|
}, {
|
|
2244
2260
|
key: "getBaseApiUrl",
|
|
2245
2261
|
value: function value() {
|
|
2246
|
-
return
|
|
2262
|
+
return Ee(this, void 0, void 0, me().mark(function e() {
|
|
2247
2263
|
var t, r;
|
|
2248
|
-
return
|
|
2264
|
+
return me().wrap(function (e) {
|
|
2249
2265
|
for (;;) switch (e.prev = e.next) {
|
|
2250
2266
|
case 0:
|
|
2251
2267
|
return e.next = 2, this._dynamicConfig;
|
|
@@ -2280,9 +2296,9 @@ var rt = ve(function e(t, r) {
|
|
|
2280
2296
|
i = r.signup_redirect_url,
|
|
2281
2297
|
s = r.custom_scopes,
|
|
2282
2298
|
o = r.provider_params;
|
|
2283
|
-
return
|
|
2299
|
+
return Ee(t, void 0, void 0, me().mark(function t() {
|
|
2284
2300
|
var r, a, c, u, l, d, h;
|
|
2285
|
-
return
|
|
2301
|
+
return me().wrap(function (t) {
|
|
2286
2302
|
for (;;) switch (t.prev = t.next) {
|
|
2287
2303
|
case 0:
|
|
2288
2304
|
return t.next = 2, this._dynamicConfig;
|
|
@@ -2309,7 +2325,7 @@ var rt = ve(function e(t, r) {
|
|
|
2309
2325
|
case 18:
|
|
2310
2326
|
this._pkceManager.clearPKPair();
|
|
2311
2327
|
case 19:
|
|
2312
|
-
if (s && (
|
|
2328
|
+
if (s && ($e("startOAuthFlow").isStringArray("custom_scopes", s), l.searchParams.set("custom_scopes", s.join(" "))), o) for (h in $e("startOAuthFlow").isOptionalObject("provider_params", o), o) l.searchParams.set("provider_" + h, o[h]);
|
|
2313
2329
|
n && l.searchParams.set("login_redirect_url", n), i && l.searchParams.set("signup_redirect_url", i), window.location.href = l.toString();
|
|
2314
2330
|
case 24:
|
|
2315
2331
|
case "end":
|
|
@@ -2321,23 +2337,23 @@ var rt = ve(function e(t, r) {
|
|
|
2321
2337
|
}
|
|
2322
2338
|
}]), e;
|
|
2323
2339
|
}(),
|
|
2324
|
-
|
|
2340
|
+
ut = function () {
|
|
2325
2341
|
function e(t, r) {
|
|
2326
2342
|
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : function () {
|
|
2327
2343
|
return Promise.resolve(void 0);
|
|
2328
2344
|
},
|
|
2329
|
-
i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] :
|
|
2330
|
-
|
|
2345
|
+
i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : et();
|
|
2346
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this.executeRecaptcha = n, this.dfpProtectedAuth = i;
|
|
2331
2347
|
}
|
|
2332
|
-
return
|
|
2348
|
+
return ye(e, [{
|
|
2333
2349
|
key: "authenticateStart",
|
|
2334
2350
|
value: function value(e) {
|
|
2335
|
-
return
|
|
2351
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
2336
2352
|
var r, n, i;
|
|
2337
|
-
return
|
|
2353
|
+
return me().wrap(function (t) {
|
|
2338
2354
|
for (;;) switch (t.prev = t.next) {
|
|
2339
2355
|
case 0:
|
|
2340
|
-
return
|
|
2356
|
+
return $e("stytch.cryptoWallets.authenticateStart").isString("crypto_wallet_address", e.crypto_wallet_address).isString("crypto_wallet_type", e.crypto_wallet_type), r = !!this._subscriptionService.getSession(), t.next = 4, this.executeRecaptcha();
|
|
2341
2357
|
case 4:
|
|
2342
2358
|
return n = t.sent, i = r ? "/crypto_wallets/authenticate/start/secondary" : "/crypto_wallets/authenticate/start/primary", t.abrupt("return", this._networkClient.fetchSDK({
|
|
2343
2359
|
url: i,
|
|
@@ -2359,12 +2375,12 @@ var rt = ve(function e(t, r) {
|
|
|
2359
2375
|
}, {
|
|
2360
2376
|
key: "authenticate",
|
|
2361
2377
|
value: function value(e) {
|
|
2362
|
-
return
|
|
2378
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
2363
2379
|
var r, n, i, s;
|
|
2364
|
-
return
|
|
2380
|
+
return me().wrap(function (t) {
|
|
2365
2381
|
for (;;) switch (t.prev = t.next) {
|
|
2366
2382
|
case 0:
|
|
2367
|
-
return
|
|
2383
|
+
return $e("stytch.cryptoWallets.authenticate").isString("signature", e.signature).isString("crypto_wallet_address", e.crypto_wallet_address).isString("crypto_wallet_type", e.crypto_wallet_type).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2368
2384
|
case 3:
|
|
2369
2385
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2370
2386
|
url: "/crypto_wallets/authenticate",
|
|
@@ -2384,12 +2400,12 @@ var rt = ve(function e(t, r) {
|
|
|
2384
2400
|
return s = t.sent, this._subscriptionService.updateStateAndTokens({
|
|
2385
2401
|
state: {
|
|
2386
2402
|
session: s.session,
|
|
2387
|
-
user:
|
|
2403
|
+
user: Xe(s.__user)
|
|
2388
2404
|
},
|
|
2389
2405
|
session_token: s.session_token,
|
|
2390
2406
|
session_jwt: s.session_jwt,
|
|
2391
2407
|
intermediate_session_token: null
|
|
2392
|
-
}), t.abrupt("return",
|
|
2408
|
+
}), t.abrupt("return", Ze(s));
|
|
2393
2409
|
case 11:
|
|
2394
2410
|
case "end":
|
|
2395
2411
|
return t.stop();
|
|
@@ -2399,19 +2415,19 @@ var rt = ve(function e(t, r) {
|
|
|
2399
2415
|
}
|
|
2400
2416
|
}]), e;
|
|
2401
2417
|
}(),
|
|
2402
|
-
|
|
2418
|
+
lt = function () {
|
|
2403
2419
|
function e(t, r, n) {
|
|
2404
|
-
|
|
2420
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n;
|
|
2405
2421
|
}
|
|
2406
|
-
return
|
|
2422
|
+
return ye(e, [{
|
|
2407
2423
|
key: "create",
|
|
2408
2424
|
value: function value(e) {
|
|
2409
|
-
return
|
|
2425
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
2410
2426
|
var r;
|
|
2411
|
-
return
|
|
2427
|
+
return me().wrap(function (t) {
|
|
2412
2428
|
for (;;) switch (t.prev = t.next) {
|
|
2413
2429
|
case 0:
|
|
2414
|
-
return
|
|
2430
|
+
return $e("stytch.totps.create").isNumber("expiration_minutes", e.expiration_minutes), t.next = 3, this._networkClient.fetchSDK({
|
|
2415
2431
|
url: "/totps",
|
|
2416
2432
|
method: "POST",
|
|
2417
2433
|
errorMessage: "Failed to create TOTP",
|
|
@@ -2420,7 +2436,7 @@ var rt = ve(function e(t, r) {
|
|
|
2420
2436
|
}
|
|
2421
2437
|
});
|
|
2422
2438
|
case 3:
|
|
2423
|
-
return r = t.sent, this._subscriptionService.updateUser(r.__user), t.abrupt("return",
|
|
2439
|
+
return r = t.sent, this._subscriptionService.updateUser(r.__user), t.abrupt("return", Ze(r));
|
|
2424
2440
|
case 6:
|
|
2425
2441
|
case "end":
|
|
2426
2442
|
return t.stop();
|
|
@@ -2431,12 +2447,12 @@ var rt = ve(function e(t, r) {
|
|
|
2431
2447
|
}, {
|
|
2432
2448
|
key: "authenticate",
|
|
2433
2449
|
value: function value(e) {
|
|
2434
|
-
return
|
|
2450
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
2435
2451
|
var r, n, i, s;
|
|
2436
|
-
return
|
|
2452
|
+
return me().wrap(function (t) {
|
|
2437
2453
|
for (;;) switch (t.prev = t.next) {
|
|
2438
2454
|
case 0:
|
|
2439
|
-
return
|
|
2455
|
+
return $e("stytch.totps.authenticate").isNumber("session_duration_minutes", e.session_duration_minutes).isString("totp_code", e.totp_code), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2440
2456
|
case 3:
|
|
2441
2457
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2442
2458
|
url: "/totps/authenticate",
|
|
@@ -2459,7 +2475,7 @@ var rt = ve(function e(t, r) {
|
|
|
2459
2475
|
session_token: s.session_token,
|
|
2460
2476
|
session_jwt: s.session_jwt,
|
|
2461
2477
|
intermediate_session_token: null
|
|
2462
|
-
}), t.abrupt("return",
|
|
2478
|
+
}), t.abrupt("return", Ze(s));
|
|
2463
2479
|
case 11:
|
|
2464
2480
|
case "end":
|
|
2465
2481
|
return t.stop();
|
|
@@ -2470,8 +2486,8 @@ var rt = ve(function e(t, r) {
|
|
|
2470
2486
|
}, {
|
|
2471
2487
|
key: "recoveryCodes",
|
|
2472
2488
|
value: function value() {
|
|
2473
|
-
return
|
|
2474
|
-
return
|
|
2489
|
+
return Ee(this, void 0, void 0, me().mark(function e() {
|
|
2490
|
+
return me().wrap(function (e) {
|
|
2475
2491
|
for (;;) switch (e.prev = e.next) {
|
|
2476
2492
|
case 0:
|
|
2477
2493
|
return e.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2489,12 +2505,12 @@ var rt = ve(function e(t, r) {
|
|
|
2489
2505
|
}, {
|
|
2490
2506
|
key: "recover",
|
|
2491
2507
|
value: function value(e) {
|
|
2492
|
-
return
|
|
2508
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
2493
2509
|
var r, n, i, s;
|
|
2494
|
-
return
|
|
2510
|
+
return me().wrap(function (t) {
|
|
2495
2511
|
for (;;) switch (t.prev = t.next) {
|
|
2496
2512
|
case 0:
|
|
2497
|
-
return
|
|
2513
|
+
return $e("stytch.totps.recover").isNumber("session_duration_minutes", e.session_duration_minutes).isString("recovery_code", e.recovery_code), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2498
2514
|
case 3:
|
|
2499
2515
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2500
2516
|
url: "/totps/recover",
|
|
@@ -2517,7 +2533,7 @@ var rt = ve(function e(t, r) {
|
|
|
2517
2533
|
session_token: s.session_token,
|
|
2518
2534
|
session_jwt: s.session_jwt,
|
|
2519
2535
|
intermediate_session_token: null
|
|
2520
|
-
}), t.abrupt("return",
|
|
2536
|
+
}), t.abrupt("return", Ze(s));
|
|
2521
2537
|
case 11:
|
|
2522
2538
|
case "end":
|
|
2523
2539
|
return t.stop();
|
|
@@ -2527,14 +2543,14 @@ var rt = ve(function e(t, r) {
|
|
|
2527
2543
|
}
|
|
2528
2544
|
}]), e;
|
|
2529
2545
|
}();
|
|
2530
|
-
function
|
|
2546
|
+
function dt(e) {
|
|
2531
2547
|
for (var t = "==".slice(0, (4 - e.length % 4) % 4), r = e.replace(/-/g, "+").replace(/_/g, "/") + t, n = atob(r), i = new ArrayBuffer(n.length), s = new Uint8Array(i), o = 0; o < n.length; o++) s[o] = n.charCodeAt(o);
|
|
2532
2548
|
return i;
|
|
2533
2549
|
}
|
|
2534
|
-
function
|
|
2550
|
+
function ht(e) {
|
|
2535
2551
|
var t,
|
|
2536
2552
|
r = "",
|
|
2537
|
-
n =
|
|
2553
|
+
n = he(new Uint8Array(e));
|
|
2538
2554
|
try {
|
|
2539
2555
|
for (n.s(); !(t = n.n()).done;) {
|
|
2540
2556
|
var i = t.value;
|
|
@@ -2547,13 +2563,13 @@ function dt(e) {
|
|
|
2547
2563
|
}
|
|
2548
2564
|
return btoa(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
2549
2565
|
}
|
|
2550
|
-
var
|
|
2551
|
-
|
|
2552
|
-
function
|
|
2553
|
-
if (t ===
|
|
2554
|
-
if (t ===
|
|
2566
|
+
var pt = "copy",
|
|
2567
|
+
ft = "convert";
|
|
2568
|
+
function _t(e, t, r) {
|
|
2569
|
+
if (t === pt) return r;
|
|
2570
|
+
if (t === ft) return e(r);
|
|
2555
2571
|
if (t instanceof Array) return r.map(function (r) {
|
|
2556
|
-
return
|
|
2572
|
+
return _t(e, t[0], r);
|
|
2557
2573
|
});
|
|
2558
2574
|
if (t instanceof Object) {
|
|
2559
2575
|
for (var n = {}, i = 0, s = Object.entries(t); i < s.length; i++) {
|
|
@@ -2564,117 +2580,117 @@ function ft(e, t, r) {
|
|
|
2564
2580
|
var u = c.derive(r);
|
|
2565
2581
|
void 0 !== u && (r[a] = u);
|
|
2566
2582
|
}
|
|
2567
|
-
if (a in r) null != r[a] ? n[a] =
|
|
2583
|
+
if (a in r) null != r[a] ? n[a] = _t(e, c.schema, r[a]) : n[a] = null;else if (c.required) throw new Error("Missing key: ".concat(a));
|
|
2568
2584
|
}
|
|
2569
2585
|
return n;
|
|
2570
2586
|
}
|
|
2571
2587
|
}
|
|
2572
|
-
function
|
|
2588
|
+
function mt(e, t) {
|
|
2573
2589
|
return {
|
|
2574
2590
|
required: !0,
|
|
2575
2591
|
schema: e,
|
|
2576
2592
|
derive: t
|
|
2577
2593
|
};
|
|
2578
2594
|
}
|
|
2579
|
-
function
|
|
2595
|
+
function vt(e) {
|
|
2580
2596
|
return {
|
|
2581
2597
|
required: !0,
|
|
2582
2598
|
schema: e
|
|
2583
2599
|
};
|
|
2584
2600
|
}
|
|
2585
|
-
function
|
|
2601
|
+
function yt(e) {
|
|
2586
2602
|
return {
|
|
2587
2603
|
required: !1,
|
|
2588
2604
|
schema: e
|
|
2589
2605
|
};
|
|
2590
2606
|
}
|
|
2591
|
-
var
|
|
2592
|
-
type:
|
|
2593
|
-
id:
|
|
2594
|
-
transports:
|
|
2595
|
-
},
|
|
2596
|
-
gt = {
|
|
2597
|
-
appid: vt(ht),
|
|
2598
|
-
appidExclude: vt(ht),
|
|
2599
|
-
credProps: vt(ht)
|
|
2607
|
+
var gt = {
|
|
2608
|
+
type: vt(pt),
|
|
2609
|
+
id: vt(ft),
|
|
2610
|
+
transports: yt(pt)
|
|
2600
2611
|
},
|
|
2601
2612
|
bt = {
|
|
2602
|
-
appid:
|
|
2603
|
-
appidExclude:
|
|
2604
|
-
credProps:
|
|
2613
|
+
appid: yt(pt),
|
|
2614
|
+
appidExclude: yt(pt),
|
|
2615
|
+
credProps: yt(pt)
|
|
2605
2616
|
},
|
|
2606
2617
|
kt = {
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2618
|
+
appid: yt(pt),
|
|
2619
|
+
appidExclude: yt(pt),
|
|
2620
|
+
credProps: yt(pt)
|
|
2621
|
+
},
|
|
2622
|
+
wt = {
|
|
2623
|
+
publicKey: vt({
|
|
2624
|
+
rp: vt(pt),
|
|
2625
|
+
user: vt({
|
|
2626
|
+
id: vt(ft),
|
|
2627
|
+
name: vt(pt),
|
|
2628
|
+
displayName: vt(pt)
|
|
2613
2629
|
}),
|
|
2614
|
-
challenge:
|
|
2615
|
-
pubKeyCredParams:
|
|
2616
|
-
timeout:
|
|
2617
|
-
excludeCredentials:
|
|
2618
|
-
authenticatorSelection:
|
|
2619
|
-
attestation:
|
|
2620
|
-
extensions:
|
|
2630
|
+
challenge: vt(ft),
|
|
2631
|
+
pubKeyCredParams: vt(pt),
|
|
2632
|
+
timeout: yt(pt),
|
|
2633
|
+
excludeCredentials: yt([gt]),
|
|
2634
|
+
authenticatorSelection: yt(pt),
|
|
2635
|
+
attestation: yt(pt),
|
|
2636
|
+
extensions: yt(bt)
|
|
2621
2637
|
}),
|
|
2622
|
-
signal:
|
|
2638
|
+
signal: yt(pt)
|
|
2623
2639
|
},
|
|
2624
|
-
|
|
2625
|
-
type:
|
|
2626
|
-
id:
|
|
2627
|
-
rawId:
|
|
2628
|
-
authenticatorAttachment:
|
|
2629
|
-
response:
|
|
2630
|
-
clientDataJSON:
|
|
2631
|
-
attestationObject:
|
|
2632
|
-
transports:
|
|
2640
|
+
St = {
|
|
2641
|
+
type: vt(pt),
|
|
2642
|
+
id: vt(pt),
|
|
2643
|
+
rawId: vt(ft),
|
|
2644
|
+
authenticatorAttachment: yt(pt),
|
|
2645
|
+
response: vt({
|
|
2646
|
+
clientDataJSON: vt(ft),
|
|
2647
|
+
attestationObject: vt(ft),
|
|
2648
|
+
transports: mt(pt, function (e) {
|
|
2633
2649
|
var t;
|
|
2634
2650
|
return (null == (t = e.getTransports) ? void 0 : t.call(e)) || [];
|
|
2635
2651
|
})
|
|
2636
2652
|
}),
|
|
2637
|
-
clientExtensionResults:
|
|
2653
|
+
clientExtensionResults: mt(kt, function (e) {
|
|
2638
2654
|
return e.getClientExtensionResults();
|
|
2639
2655
|
})
|
|
2640
2656
|
},
|
|
2641
|
-
|
|
2642
|
-
mediation:
|
|
2643
|
-
publicKey:
|
|
2644
|
-
challenge:
|
|
2645
|
-
timeout:
|
|
2646
|
-
rpId:
|
|
2647
|
-
allowCredentials:
|
|
2648
|
-
userVerification:
|
|
2649
|
-
extensions:
|
|
2657
|
+
xt = {
|
|
2658
|
+
mediation: yt(pt),
|
|
2659
|
+
publicKey: vt({
|
|
2660
|
+
challenge: vt(ft),
|
|
2661
|
+
timeout: yt(pt),
|
|
2662
|
+
rpId: yt(pt),
|
|
2663
|
+
allowCredentials: yt([gt]),
|
|
2664
|
+
userVerification: yt(pt),
|
|
2665
|
+
extensions: yt(bt)
|
|
2650
2666
|
}),
|
|
2651
|
-
signal:
|
|
2667
|
+
signal: yt(pt)
|
|
2652
2668
|
},
|
|
2653
|
-
|
|
2654
|
-
type:
|
|
2655
|
-
id:
|
|
2656
|
-
rawId:
|
|
2657
|
-
authenticatorAttachment:
|
|
2658
|
-
response:
|
|
2659
|
-
clientDataJSON:
|
|
2660
|
-
authenticatorData:
|
|
2661
|
-
signature:
|
|
2662
|
-
userHandle:
|
|
2669
|
+
Ct = {
|
|
2670
|
+
type: vt(pt),
|
|
2671
|
+
id: vt(pt),
|
|
2672
|
+
rawId: vt(ft),
|
|
2673
|
+
authenticatorAttachment: yt(pt),
|
|
2674
|
+
response: vt({
|
|
2675
|
+
clientDataJSON: vt(ft),
|
|
2676
|
+
authenticatorData: vt(ft),
|
|
2677
|
+
signature: vt(ft),
|
|
2678
|
+
userHandle: vt(ft)
|
|
2663
2679
|
}),
|
|
2664
|
-
clientExtensionResults:
|
|
2680
|
+
clientExtensionResults: mt(kt, function (e) {
|
|
2665
2681
|
return e.getClientExtensionResults();
|
|
2666
2682
|
})
|
|
2667
2683
|
};
|
|
2668
2684
|
function Pt(e) {
|
|
2669
|
-
return
|
|
2685
|
+
return _t(dt, wt, e);
|
|
2670
2686
|
}
|
|
2671
2687
|
function Ot(e) {
|
|
2672
|
-
return
|
|
2688
|
+
return _t(ht, St, e);
|
|
2673
2689
|
}
|
|
2674
|
-
function
|
|
2675
|
-
return
|
|
2690
|
+
function Tt(e) {
|
|
2691
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
2676
2692
|
var r;
|
|
2677
|
-
return
|
|
2693
|
+
return me().wrap(function (t) {
|
|
2678
2694
|
for (;;) switch (t.prev = t.next) {
|
|
2679
2695
|
case 0:
|
|
2680
2696
|
return t.next = 2, navigator.credentials.create(Pt(e));
|
|
@@ -2687,21 +2703,21 @@ function Ct(e) {
|
|
|
2687
2703
|
}, t);
|
|
2688
2704
|
}));
|
|
2689
2705
|
}
|
|
2690
|
-
function Tt(e) {
|
|
2691
|
-
return ft(lt, St, e);
|
|
2692
|
-
}
|
|
2693
2706
|
function At(e) {
|
|
2694
|
-
return
|
|
2707
|
+
return _t(dt, xt, e);
|
|
2695
2708
|
}
|
|
2696
2709
|
function Et(e) {
|
|
2697
|
-
return
|
|
2710
|
+
return _t(ht, Ct, e);
|
|
2711
|
+
}
|
|
2712
|
+
function Dt(e) {
|
|
2713
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
2698
2714
|
var r;
|
|
2699
|
-
return
|
|
2715
|
+
return me().wrap(function (t) {
|
|
2700
2716
|
for (;;) switch (t.prev = t.next) {
|
|
2701
2717
|
case 0:
|
|
2702
|
-
return t.next = 2, navigator.credentials.get(
|
|
2718
|
+
return t.next = 2, navigator.credentials.get(At(e));
|
|
2703
2719
|
case 2:
|
|
2704
|
-
return r = t.sent, t.abrupt("return",
|
|
2720
|
+
return r = t.sent, t.abrupt("return", Et(r));
|
|
2705
2721
|
case 4:
|
|
2706
2722
|
case "end":
|
|
2707
2723
|
return t.stop();
|
|
@@ -2709,22 +2725,22 @@ function Et(e) {
|
|
|
2709
2725
|
}, t);
|
|
2710
2726
|
}));
|
|
2711
2727
|
}
|
|
2712
|
-
var
|
|
2728
|
+
var Rt = function () {
|
|
2713
2729
|
function e(t, r, n) {
|
|
2714
|
-
|
|
2730
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n, this.checkEligibleInputs = function () {
|
|
2715
2731
|
return !(document.querySelectorAll("input[autocomplete*='webauthn']").length < 1) || (console.error('No <input> with `"webauthn"` in its `autocomplete` attribute was detected'), !1);
|
|
2716
2732
|
};
|
|
2717
2733
|
}
|
|
2718
|
-
return
|
|
2734
|
+
return ye(e, [{
|
|
2719
2735
|
key: "register",
|
|
2720
2736
|
value: function value(e) {
|
|
2721
2737
|
var t, r;
|
|
2722
|
-
return
|
|
2738
|
+
return Ee(this, void 0, void 0, me().mark(function n() {
|
|
2723
2739
|
var i, s, o, a, c;
|
|
2724
|
-
return
|
|
2740
|
+
return me().wrap(function (n) {
|
|
2725
2741
|
for (;;) switch (n.prev = n.next) {
|
|
2726
2742
|
case 0:
|
|
2727
|
-
return
|
|
2743
|
+
return $e("stytch.webauthn.register").isOptionalString("domain", null == e ? void 0 : e.domain).isOptionalString("authenticator_type", null == e ? void 0 : e.authenticator_type).isOptionalBoolean("is_passkey", null == e ? void 0 : e.is_passkey).isOptionalNumber("session_duration_minutes", null == e ? void 0 : e.session_duration_minutes), n.next = 3, this._networkClient.fetchSDK({
|
|
2728
2744
|
url: "/webauthn/register/start",
|
|
2729
2745
|
method: "POST",
|
|
2730
2746
|
errorMessage: "Failed to start WebAuthn registration",
|
|
@@ -2736,7 +2752,7 @@ var Dt = function () {
|
|
|
2736
2752
|
}
|
|
2737
2753
|
});
|
|
2738
2754
|
case 3:
|
|
2739
|
-
return i = n.sent, s = i.public_key_credential_creation_options, o = JSON.parse(s), n.next = 8,
|
|
2755
|
+
return i = n.sent, s = i.public_key_credential_creation_options, o = JSON.parse(s), n.next = 8, Tt({
|
|
2740
2756
|
publicKey: o
|
|
2741
2757
|
});
|
|
2742
2758
|
case 8:
|
|
@@ -2758,7 +2774,7 @@ var Dt = function () {
|
|
|
2758
2774
|
session_token: c.session_token,
|
|
2759
2775
|
session_jwt: c.session_jwt,
|
|
2760
2776
|
intermediate_session_token: null
|
|
2761
|
-
}), n.abrupt("return",
|
|
2777
|
+
}), n.abrupt("return", Ze(c));
|
|
2762
2778
|
case 14:
|
|
2763
2779
|
case "end":
|
|
2764
2780
|
return n.stop();
|
|
@@ -2770,12 +2786,12 @@ var Dt = function () {
|
|
|
2770
2786
|
key: "authenticate",
|
|
2771
2787
|
value: function value(e) {
|
|
2772
2788
|
var t, r;
|
|
2773
|
-
return
|
|
2789
|
+
return Ee(this, void 0, void 0, me().mark(function n() {
|
|
2774
2790
|
var i, s, o, a, c, u, l, d, h, p, f, _;
|
|
2775
|
-
return
|
|
2791
|
+
return me().wrap(function (n) {
|
|
2776
2792
|
for (;;) switch (n.prev = n.next) {
|
|
2777
2793
|
case 0:
|
|
2778
|
-
return
|
|
2794
|
+
return $e("stytch.webauthn.authenticate").isOptionalString("domain", e.domain).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalBoolean("is_passkey", e.is_passkey).isOptionalObject("signal", e.signal), n.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2779
2795
|
case 3:
|
|
2780
2796
|
if (i = n.sent, s = i.dfp_telemetry_id, o = i.captcha_token, !e.conditional_mediation) {
|
|
2781
2797
|
n.next = 14;
|
|
@@ -2810,7 +2826,7 @@ var Dt = function () {
|
|
|
2810
2826
|
signal: null !== (r = e.signal) && void 0 !== r ? r : d.signal
|
|
2811
2827
|
}, p = Object.assign(Object.assign({}, h), {
|
|
2812
2828
|
mediation: "conditional"
|
|
2813
|
-
}), n.next = 25,
|
|
2829
|
+
}), n.next = 25, Dt(e.conditional_mediation ? p : h);
|
|
2814
2830
|
case 25:
|
|
2815
2831
|
return f = n.sent, n.next = 28, this._networkClient.retriableFetchSDK({
|
|
2816
2832
|
url: "/webauthn/authenticate",
|
|
@@ -2833,7 +2849,7 @@ var Dt = function () {
|
|
|
2833
2849
|
session_token: _.session_token,
|
|
2834
2850
|
session_jwt: _.session_jwt,
|
|
2835
2851
|
intermediate_session_token: null
|
|
2836
|
-
}), n.abrupt("return",
|
|
2852
|
+
}), n.abrupt("return", Ze(_));
|
|
2837
2853
|
case 31:
|
|
2838
2854
|
case "end":
|
|
2839
2855
|
return n.stop();
|
|
@@ -2844,9 +2860,9 @@ var Dt = function () {
|
|
|
2844
2860
|
}, {
|
|
2845
2861
|
key: "update",
|
|
2846
2862
|
value: function value(e) {
|
|
2847
|
-
return
|
|
2863
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
2848
2864
|
var r;
|
|
2849
|
-
return
|
|
2865
|
+
return me().wrap(function (t) {
|
|
2850
2866
|
for (;;) switch (t.prev = t.next) {
|
|
2851
2867
|
case 0:
|
|
2852
2868
|
return r = "/webauthn/update/" + e.webauthn_registration_id, t.next = 3, this._networkClient.fetchSDK({
|
|
@@ -2869,9 +2885,9 @@ var Dt = function () {
|
|
|
2869
2885
|
}, {
|
|
2870
2886
|
key: "browserSupportsAutofill",
|
|
2871
2887
|
value: function value() {
|
|
2872
|
-
return
|
|
2888
|
+
return Ee(this, void 0, void 0, me().mark(function e() {
|
|
2873
2889
|
var t;
|
|
2874
|
-
return
|
|
2890
|
+
return me().wrap(function (e) {
|
|
2875
2891
|
for (;;) switch (e.prev = e.next) {
|
|
2876
2892
|
case 0:
|
|
2877
2893
|
if (void 0 !== (t = window.PublicKeyCredential) && void 0 !== t.isConditionalMediationAvailable) {
|
|
@@ -2892,21 +2908,21 @@ var Dt = function () {
|
|
|
2892
2908
|
}
|
|
2893
2909
|
}]), e;
|
|
2894
2910
|
}(),
|
|
2895
|
-
|
|
2911
|
+
It = Promise.resolve({
|
|
2896
2912
|
pkceRequiredForPasswordResets: !1
|
|
2897
2913
|
}),
|
|
2898
|
-
|
|
2914
|
+
Ft = function () {
|
|
2899
2915
|
function e(t, r, n) {
|
|
2900
|
-
var i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] :
|
|
2901
|
-
s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] :
|
|
2902
|
-
|
|
2916
|
+
var i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : It,
|
|
2917
|
+
s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : et();
|
|
2918
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._config = i, this.dfpProtectedAuth = s;
|
|
2903
2919
|
}
|
|
2904
|
-
return
|
|
2920
|
+
return ye(e, [{
|
|
2905
2921
|
key: "getCodeChallenge",
|
|
2906
2922
|
value: function value() {
|
|
2907
|
-
return
|
|
2923
|
+
return Ee(this, void 0, void 0, me().mark(function e() {
|
|
2908
2924
|
var t, r;
|
|
2909
|
-
return
|
|
2925
|
+
return me().wrap(function (e) {
|
|
2910
2926
|
for (;;) switch (e.prev = e.next) {
|
|
2911
2927
|
case 0:
|
|
2912
2928
|
return e.next = 2, this._config;
|
|
@@ -2938,12 +2954,12 @@ var Dt = function () {
|
|
|
2938
2954
|
}, {
|
|
2939
2955
|
key: "create",
|
|
2940
2956
|
value: function value(e) {
|
|
2941
|
-
return
|
|
2957
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
2942
2958
|
var r, n, i, s;
|
|
2943
|
-
return
|
|
2959
|
+
return me().wrap(function (t) {
|
|
2944
2960
|
for (;;) switch (t.prev = t.next) {
|
|
2945
2961
|
case 0:
|
|
2946
|
-
return
|
|
2962
|
+
return $e("stytch.passwords.create").isString("password", e.password).isString("email", e.email).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2947
2963
|
case 3:
|
|
2948
2964
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2949
2965
|
url: "/passwords",
|
|
@@ -2967,7 +2983,7 @@ var Dt = function () {
|
|
|
2967
2983
|
session_token: s.session_token,
|
|
2968
2984
|
session_jwt: s.session_jwt,
|
|
2969
2985
|
intermediate_session_token: null
|
|
2970
|
-
}), t.abrupt("return",
|
|
2986
|
+
}), t.abrupt("return", Ze(s));
|
|
2971
2987
|
case 11:
|
|
2972
2988
|
case "end":
|
|
2973
2989
|
return t.stop();
|
|
@@ -2978,12 +2994,12 @@ var Dt = function () {
|
|
|
2978
2994
|
}, {
|
|
2979
2995
|
key: "authenticate",
|
|
2980
2996
|
value: function value(e) {
|
|
2981
|
-
return
|
|
2997
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
2982
2998
|
var r, n, i, s;
|
|
2983
|
-
return
|
|
2999
|
+
return me().wrap(function (t) {
|
|
2984
3000
|
for (;;) switch (t.prev = t.next) {
|
|
2985
3001
|
case 0:
|
|
2986
|
-
return
|
|
3002
|
+
return $e("stytch.passwords.authenticate").isString("password", e.password).isString("email", e.email).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2987
3003
|
case 3:
|
|
2988
3004
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2989
3005
|
url: "/passwords/authenticate",
|
|
@@ -3007,7 +3023,7 @@ var Dt = function () {
|
|
|
3007
3023
|
session_token: s.session_token,
|
|
3008
3024
|
session_jwt: s.session_jwt,
|
|
3009
3025
|
intermediate_session_token: null
|
|
3010
|
-
}), t.abrupt("return",
|
|
3026
|
+
}), t.abrupt("return", Ze(s));
|
|
3011
3027
|
case 11:
|
|
3012
3028
|
case "end":
|
|
3013
3029
|
return t.stop();
|
|
@@ -3018,12 +3034,12 @@ var Dt = function () {
|
|
|
3018
3034
|
}, {
|
|
3019
3035
|
key: "resetByEmailStart",
|
|
3020
3036
|
value: function value(e) {
|
|
3021
|
-
return
|
|
3037
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
3022
3038
|
var r, n, i, s;
|
|
3023
|
-
return
|
|
3039
|
+
return me().wrap(function (t) {
|
|
3024
3040
|
for (;;) switch (t.prev = t.next) {
|
|
3025
3041
|
case 0:
|
|
3026
|
-
return
|
|
3042
|
+
return $e("stytch.passwords.resetByEmailStart").isString("email", e.email).isOptionalString("login_redirect_url", e.login_redirect_url).isOptionalString("reset_password_redirect_url", e.reset_password_redirect_url).isOptionalString("reset_password_template_id", e.reset_password_template_id).isOptionalNumber("reset_password_expiration_minutes", e.reset_password_expiration_minutes), t.next = 3, this.getCodeChallenge();
|
|
3027
3043
|
case 3:
|
|
3028
3044
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3029
3045
|
case 6:
|
|
@@ -3053,12 +3069,12 @@ var Dt = function () {
|
|
|
3053
3069
|
}, {
|
|
3054
3070
|
key: "resetByEmail",
|
|
3055
3071
|
value: function value(e) {
|
|
3056
|
-
return
|
|
3072
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
3057
3073
|
var r, n, i, s, o, a;
|
|
3058
|
-
return
|
|
3074
|
+
return me().wrap(function (t) {
|
|
3059
3075
|
for (;;) switch (t.prev = t.next) {
|
|
3060
3076
|
case 0:
|
|
3061
|
-
return
|
|
3077
|
+
return $e("stytch.passwords.resetByEmail").isString("token", e.token).isString("password", e.password).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3062
3078
|
case 3:
|
|
3063
3079
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._pkceManager.getPKPair();
|
|
3064
3080
|
case 8:
|
|
@@ -3085,7 +3101,7 @@ var Dt = function () {
|
|
|
3085
3101
|
session_token: a.session_token,
|
|
3086
3102
|
session_jwt: a.session_jwt,
|
|
3087
3103
|
intermediate_session_token: null
|
|
3088
|
-
}), t.abrupt("return",
|
|
3104
|
+
}), t.abrupt("return", Ze(a));
|
|
3089
3105
|
case 16:
|
|
3090
3106
|
case "end":
|
|
3091
3107
|
return t.stop();
|
|
@@ -3096,12 +3112,12 @@ var Dt = function () {
|
|
|
3096
3112
|
}, {
|
|
3097
3113
|
key: "resetByExistingPassword",
|
|
3098
3114
|
value: function value(e) {
|
|
3099
|
-
return
|
|
3115
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
3100
3116
|
var r, n, i, s;
|
|
3101
|
-
return
|
|
3117
|
+
return me().wrap(function (t) {
|
|
3102
3118
|
for (;;) switch (t.prev = t.next) {
|
|
3103
3119
|
case 0:
|
|
3104
|
-
return
|
|
3120
|
+
return $e("stytch.passwords.resetByExistingPassword").isString("email", e.email).isString("existing_password", e.existing_password).isString("new_password", e.new_password).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3105
3121
|
case 3:
|
|
3106
3122
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
3107
3123
|
url: "/passwords/existing_password/reset",
|
|
@@ -3126,7 +3142,7 @@ var Dt = function () {
|
|
|
3126
3142
|
session_token: s.session_token,
|
|
3127
3143
|
session_jwt: s.session_jwt,
|
|
3128
3144
|
intermediate_session_token: null
|
|
3129
|
-
}), t.abrupt("return",
|
|
3145
|
+
}), t.abrupt("return", Ze(s));
|
|
3130
3146
|
case 11:
|
|
3131
3147
|
case "end":
|
|
3132
3148
|
return t.stop();
|
|
@@ -3137,12 +3153,12 @@ var Dt = function () {
|
|
|
3137
3153
|
}, {
|
|
3138
3154
|
key: "resetBySession",
|
|
3139
3155
|
value: function value(e) {
|
|
3140
|
-
return
|
|
3156
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
3141
3157
|
var r, n, i, s;
|
|
3142
|
-
return
|
|
3158
|
+
return me().wrap(function (t) {
|
|
3143
3159
|
for (;;) switch (t.prev = t.next) {
|
|
3144
3160
|
case 0:
|
|
3145
|
-
return
|
|
3161
|
+
return $e("stytch.passwords.resetBySession").isString("password", e.password), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3146
3162
|
case 3:
|
|
3147
3163
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
3148
3164
|
url: "/passwords/session/reset",
|
|
@@ -3176,11 +3192,11 @@ var Dt = function () {
|
|
|
3176
3192
|
}, {
|
|
3177
3193
|
key: "strengthCheck",
|
|
3178
3194
|
value: function value(e) {
|
|
3179
|
-
return
|
|
3180
|
-
return
|
|
3195
|
+
return Ee(this, void 0, void 0, me().mark(function t() {
|
|
3196
|
+
return me().wrap(function (t) {
|
|
3181
3197
|
for (;;) switch (t.prev = t.next) {
|
|
3182
3198
|
case 0:
|
|
3183
|
-
return
|
|
3199
|
+
return $e("stytch.passwords.strengthCheck").isOptionalString("email", e.email).isString("password", e.password), t.abrupt("return", this._networkClient.fetchSDK({
|
|
3184
3200
|
url: "/passwords/strength_check",
|
|
3185
3201
|
method: "POST",
|
|
3186
3202
|
errorMessage: "Failed to check password strength.",
|
|
@@ -3203,15 +3219,15 @@ Promise.resolve({
|
|
|
3203
3219
|
}), Promise.resolve({
|
|
3204
3220
|
pkceRequiredForPasswordResets: !1
|
|
3205
3221
|
});
|
|
3206
|
-
var
|
|
3222
|
+
var jt = function () {
|
|
3207
3223
|
function e(t) {
|
|
3208
|
-
|
|
3224
|
+
be(this, e), this.iframeURL = t, this.createIframe();
|
|
3209
3225
|
}
|
|
3210
|
-
return
|
|
3226
|
+
return ye(e, [{
|
|
3211
3227
|
key: "createIframe",
|
|
3212
3228
|
value: function value() {
|
|
3213
3229
|
var e = document.querySelector('[src~="'.concat(this.iframeURL, '"]'));
|
|
3214
|
-
e ?
|
|
3230
|
+
e ? Ve("It looks like you're creating multiple copies of the Stytch client. This behavior is unsupported, and unintended side effects may occur. Make sure you are creating the Stytch client at the global level, and not inside a component's render function.") : ((e = document.createElement("iframe")).src = this.iframeURL, e.style.position = "absolute", e.style.width = "0", e.style.height = "0", e.style.border = "0", document.body.appendChild(e)), "true" !== e.dataset.loaded ? this.frame = new Promise(function (t) {
|
|
3215
3231
|
e.addEventListener("load", function () {
|
|
3216
3232
|
e.dataset.loaded = "true", t(e);
|
|
3217
3233
|
}, {
|
|
@@ -3222,11 +3238,11 @@ var Ft = function () {
|
|
|
3222
3238
|
}, {
|
|
3223
3239
|
key: "call",
|
|
3224
3240
|
value: function value(e, t) {
|
|
3225
|
-
return
|
|
3241
|
+
return Ee(this, void 0, void 0, me().mark(function r() {
|
|
3226
3242
|
var n,
|
|
3227
3243
|
i,
|
|
3228
3244
|
s = this;
|
|
3229
|
-
return
|
|
3245
|
+
return me().wrap(function (r) {
|
|
3230
3246
|
for (;;) switch (r.prev = r.next) {
|
|
3231
3247
|
case 0:
|
|
3232
3248
|
return r.next = 2, this.frame;
|
|
@@ -3235,7 +3251,7 @@ var Ft = function () {
|
|
|
3235
3251
|
var a;
|
|
3236
3252
|
i.port1.onmessage = function (e) {
|
|
3237
3253
|
var t = e.data;
|
|
3238
|
-
i.port1.close(), t.success ? r(t.payload) : o(
|
|
3254
|
+
i.port1.close(), t.success ? r(t.payload) : o(tt.unmarshall(t.error));
|
|
3239
3255
|
};
|
|
3240
3256
|
var c = {
|
|
3241
3257
|
method: e,
|
|
@@ -3252,11 +3268,11 @@ var Ft = function () {
|
|
|
3252
3268
|
}
|
|
3253
3269
|
}]), e;
|
|
3254
3270
|
}(),
|
|
3255
|
-
|
|
3271
|
+
Bt = function () {
|
|
3256
3272
|
function e(t, r) {
|
|
3257
|
-
|
|
3273
|
+
be(this, e), this._networkClient = t, this.dfpProtectedAuth = r;
|
|
3258
3274
|
}
|
|
3259
|
-
return
|
|
3275
|
+
return ye(e, [{
|
|
3260
3276
|
key: "searchUser",
|
|
3261
3277
|
value: function value(e) {
|
|
3262
3278
|
var t = this;
|
|
@@ -3302,15 +3318,17 @@ var Ft = function () {
|
|
|
3302
3318
|
}
|
|
3303
3319
|
}]), e;
|
|
3304
3320
|
}(),
|
|
3305
|
-
|
|
3321
|
+
Lt = function () {
|
|
3306
3322
|
function e(t, r) {
|
|
3307
3323
|
var n = this;
|
|
3308
|
-
|
|
3309
|
-
(
|
|
3324
|
+
be(this, e), this._subscriptionService = t, this._headlessSessionClient = r, this._onDataChange = function (e) {
|
|
3325
|
+
!function (e) {
|
|
3326
|
+
return !!(null == e ? void 0 : e.session);
|
|
3327
|
+
}(e) ? n.cancelBackgroundRefresh() : n.scheduleBackgroundRefresh();
|
|
3310
3328
|
}, this._reauthenticateWithBackoff = function () {
|
|
3311
|
-
return
|
|
3329
|
+
return Ee(n, void 0, void 0, me().mark(function t() {
|
|
3312
3330
|
var r;
|
|
3313
|
-
return
|
|
3331
|
+
return me().wrap(function (t) {
|
|
3314
3332
|
for (;;) switch (t.prev = t.next) {
|
|
3315
3333
|
case 0:
|
|
3316
3334
|
r = 0;
|
|
@@ -3339,14 +3357,14 @@ var Ft = function () {
|
|
|
3339
3357
|
}));
|
|
3340
3358
|
}, this.timeout = null, this._subscriptionService.subscribeToState(this._onDataChange);
|
|
3341
3359
|
}
|
|
3342
|
-
return
|
|
3360
|
+
return ye(e, [{
|
|
3343
3361
|
key: "performBackgroundRefresh",
|
|
3344
3362
|
value: function value() {
|
|
3345
3363
|
var e = this;
|
|
3346
3364
|
this._reauthenticateWithBackoff().then(function () {
|
|
3347
3365
|
e.scheduleBackgroundRefresh();
|
|
3348
3366
|
})["catch"](function (t) {
|
|
3349
|
-
|
|
3367
|
+
Ve("Session background refresh failed. Signalling to app that user is logged out.", {
|
|
3350
3368
|
error: t
|
|
3351
3369
|
}), e._subscriptionService.destroySession();
|
|
3352
3370
|
});
|
|
@@ -3372,24 +3390,32 @@ var Ft = function () {
|
|
|
3372
3390
|
}, {
|
|
3373
3391
|
key: "isUnrecoverableError",
|
|
3374
3392
|
value: function value(e) {
|
|
3375
|
-
return
|
|
3393
|
+
return O.includes(e.error_type);
|
|
3376
3394
|
}
|
|
3377
3395
|
}]), e;
|
|
3378
3396
|
}();
|
|
3379
|
-
|
|
3380
|
-
var
|
|
3381
|
-
var
|
|
3382
|
-
|
|
3397
|
+
Lt.REFRESH_INTERVAL_MS = 18e4;
|
|
3398
|
+
var Mt = ye(function e(t, r) {
|
|
3399
|
+
var n = this;
|
|
3400
|
+
be(this, e), this._subscriptionService = t, this.emptyState = r, this.onStateChange = function (e) {
|
|
3401
|
+
return n._subscriptionService.subscribeToState(function (t) {
|
|
3402
|
+
e(null != t ? t : n.emptyState);
|
|
3403
|
+
});
|
|
3404
|
+
};
|
|
3405
|
+
});
|
|
3406
|
+
var Nt = "bootstrap";
|
|
3407
|
+
var Ut = /*#__PURE__*/function () {
|
|
3408
|
+
function Ut(e, t, r) {
|
|
3383
3409
|
var _this = this;
|
|
3384
|
-
_classCallCheck(this,
|
|
3410
|
+
_classCallCheck(this, Ut);
|
|
3385
3411
|
this._publicToken = e, this._networkClient = t, this._dataLayer = r, this._bootstrapDataPromise = this._networkClient.fetchSDK({
|
|
3386
3412
|
url: "/projects/bootstrap/".concat(this._publicToken),
|
|
3387
3413
|
method: "GET",
|
|
3388
3414
|
errorMessage: "Error fetching bootstrap data for SDK for ".concat(this._publicToken)
|
|
3389
|
-
}).then(
|
|
3390
|
-
return _this._dataLayer.setItem(
|
|
3415
|
+
}).then(Ut.mapBootstrapData).then(function (e) {
|
|
3416
|
+
return _this._dataLayer.setItem(Nt, JSON.stringify(e)), e;
|
|
3391
3417
|
})["catch"](function (e) {
|
|
3392
|
-
return
|
|
3418
|
+
return Ye(e), {
|
|
3393
3419
|
displayWatermark: !1,
|
|
3394
3420
|
cnameDomain: null,
|
|
3395
3421
|
emailDomains: ["stytch.com"],
|
|
@@ -3408,10 +3434,10 @@ var Mt = /*#__PURE__*/function () {
|
|
|
3408
3434
|
};
|
|
3409
3435
|
});
|
|
3410
3436
|
}
|
|
3411
|
-
_createClass(
|
|
3437
|
+
_createClass(Ut, [{
|
|
3412
3438
|
key: "getSync",
|
|
3413
3439
|
value: function getSync() {
|
|
3414
|
-
var e = this._dataLayer.getItem(
|
|
3440
|
+
var e = this._dataLayer.getItem(Nt);
|
|
3415
3441
|
if (null === e) return {
|
|
3416
3442
|
displayWatermark: !1,
|
|
3417
3443
|
cnameDomain: null,
|
|
@@ -3482,9 +3508,9 @@ var Mt = /*#__PURE__*/function () {
|
|
|
3482
3508
|
};
|
|
3483
3509
|
}
|
|
3484
3510
|
}]);
|
|
3485
|
-
return
|
|
3511
|
+
return Ut;
|
|
3486
3512
|
}();
|
|
3487
|
-
function
|
|
3513
|
+
function Kt(e, t, r, n) {
|
|
3488
3514
|
return new (r || (r = Promise))(function (i, s) {
|
|
3489
3515
|
function o(e) {
|
|
3490
3516
|
try {
|
|
@@ -3510,11 +3536,11 @@ function Nt(e, t, r, n) {
|
|
|
3510
3536
|
});
|
|
3511
3537
|
}
|
|
3512
3538
|
"function" == typeof SuppressedError && SuppressedError;
|
|
3513
|
-
var
|
|
3539
|
+
var qt = /*#__PURE__*/_createClass(function qt(e) {
|
|
3514
3540
|
var _this2 = this;
|
|
3515
|
-
_classCallCheck(this,
|
|
3541
|
+
_classCallCheck(this, qt);
|
|
3516
3542
|
this.bootstrapPromise = e, this.executeRecaptcha = function () {
|
|
3517
|
-
return
|
|
3543
|
+
return Kt(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
3518
3544
|
var _yield$this$state, e, t, r;
|
|
3519
3545
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3520
3546
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -3545,7 +3571,7 @@ var Ut = /*#__PURE__*/_createClass(function Ut(e) {
|
|
|
3545
3571
|
}, _callee, this);
|
|
3546
3572
|
}));
|
|
3547
3573
|
}, this.state = e.then(function (e) {
|
|
3548
|
-
return
|
|
3574
|
+
return Kt(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
3549
3575
|
var t;
|
|
3550
3576
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3551
3577
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -3556,7 +3582,7 @@ var Ut = /*#__PURE__*/_createClass(function Ut(e) {
|
|
|
3556
3582
|
}
|
|
3557
3583
|
_context2.t1 = !0;
|
|
3558
3584
|
_context2.next = 4;
|
|
3559
|
-
return t = e.captchaSettings.siteKey,
|
|
3585
|
+
return t = e.captchaSettings.siteKey, qe("https://www.google.com/recaptcha/enterprise.js?render=".concat(t), function () {
|
|
3560
3586
|
return window.grecaptcha.enterprise;
|
|
3561
3587
|
});
|
|
3562
3588
|
case 4:
|
|
@@ -3583,10 +3609,10 @@ var Ut = /*#__PURE__*/_createClass(function Ut(e) {
|
|
|
3583
3609
|
}));
|
|
3584
3610
|
});
|
|
3585
3611
|
});
|
|
3586
|
-
var
|
|
3587
|
-
function
|
|
3612
|
+
var Wt = /*#__PURE__*/function () {
|
|
3613
|
+
function Wt(e) {
|
|
3588
3614
|
var _this3 = this;
|
|
3589
|
-
_classCallCheck(this,
|
|
3615
|
+
_classCallCheck(this, Wt);
|
|
3590
3616
|
this.iframeURL = e, this.oneTapStart = function (e) {
|
|
3591
3617
|
return _this3.call("oneTapStart", e);
|
|
3592
3618
|
}, this.oneTapSubmit = function (e) {
|
|
@@ -3595,11 +3621,11 @@ var Kt = /*#__PURE__*/function () {
|
|
|
3595
3621
|
return _this3.call("parsedPhoneNumber", e);
|
|
3596
3622
|
};
|
|
3597
3623
|
}
|
|
3598
|
-
_createClass(
|
|
3624
|
+
_createClass(Wt, [{
|
|
3599
3625
|
key: "frameClient",
|
|
3600
3626
|
get: function get() {
|
|
3601
3627
|
var e;
|
|
3602
|
-
return this._frameClient = null !== (e = this._frameClient) && void 0 !== e ? e : new
|
|
3628
|
+
return this._frameClient = null !== (e = this._frameClient) && void 0 !== e ? e : new jt(this.iframeURL), this._frameClient;
|
|
3603
3629
|
}
|
|
3604
3630
|
}, {
|
|
3605
3631
|
key: "call",
|
|
@@ -3607,15 +3633,15 @@ var Kt = /*#__PURE__*/function () {
|
|
|
3607
3633
|
return this.frameClient.call(e, [t]);
|
|
3608
3634
|
}
|
|
3609
3635
|
}]);
|
|
3610
|
-
return
|
|
3636
|
+
return Wt;
|
|
3611
3637
|
}();
|
|
3612
|
-
var
|
|
3613
|
-
_inherits(
|
|
3614
|
-
function
|
|
3638
|
+
var Gt = /*#__PURE__*/function (_ct) {
|
|
3639
|
+
_inherits(Gt, _ct);
|
|
3640
|
+
function Gt(e, t, r, n, i, s) {
|
|
3615
3641
|
var _this4;
|
|
3616
|
-
_classCallCheck(this,
|
|
3617
|
-
_this4 = _callSuper(this,
|
|
3618
|
-
return
|
|
3642
|
+
_classCallCheck(this, Gt);
|
|
3643
|
+
_this4 = _callSuper(this, Gt, [e, t, r, n, i]), _this4._oneTap = s, _this4.startOneTap = function (e) {
|
|
3644
|
+
return Kt(_assertThisInitialized(_this4), void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
3619
3645
|
var t, r, n;
|
|
3620
3646
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3621
3647
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -3653,20 +3679,20 @@ var qt = /*#__PURE__*/function (_at) {
|
|
|
3653
3679
|
};
|
|
3654
3680
|
return _this4;
|
|
3655
3681
|
}
|
|
3656
|
-
return _createClass(
|
|
3657
|
-
}(
|
|
3658
|
-
var
|
|
3659
|
-
function
|
|
3660
|
-
_classCallCheck(this,
|
|
3682
|
+
return _createClass(Gt);
|
|
3683
|
+
}(ct);
|
|
3684
|
+
var Ht = /*#__PURE__*/function () {
|
|
3685
|
+
function Ht(e, t, r, n) {
|
|
3686
|
+
_classCallCheck(this, Ht);
|
|
3661
3687
|
this._publicToken = e, this._subscriptionDataLayer = t, this.baseURL = r, this.additionalTelemetryDataFn = n, this.updateSessionToken = function () {
|
|
3662
3688
|
return null;
|
|
3663
|
-
}, this.eventLogger = new
|
|
3689
|
+
}, this.eventLogger = new rt({
|
|
3664
3690
|
maxBatchSize: 15,
|
|
3665
3691
|
intervalDurationMs: 800,
|
|
3666
3692
|
logEventURL: this.buildSDKUrl("/events")
|
|
3667
3693
|
});
|
|
3668
3694
|
}
|
|
3669
|
-
_createClass(
|
|
3695
|
+
_createClass(Ht, [{
|
|
3670
3696
|
key: "logEvent",
|
|
3671
3697
|
value: function logEvent(_ref) {
|
|
3672
3698
|
var e = _ref.name,
|
|
@@ -3686,9 +3712,9 @@ var Wt = /*#__PURE__*/function () {
|
|
|
3686
3712
|
key: "createTelemetryBlob",
|
|
3687
3713
|
value: function createTelemetryBlob() {
|
|
3688
3714
|
return Object.assign(Object.assign({
|
|
3689
|
-
event_id: "event-id-".concat(
|
|
3690
|
-
app_session_id: "app-session-id-".concat(
|
|
3691
|
-
persistent_id: "persistent-id-".concat(
|
|
3715
|
+
event_id: "event-id-".concat(Ue()),
|
|
3716
|
+
app_session_id: "app-session-id-".concat(Ue()),
|
|
3717
|
+
persistent_id: "persistent-id-".concat(Ue()),
|
|
3692
3718
|
client_sent_at: new Date().toISOString(),
|
|
3693
3719
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
3694
3720
|
}, this.additionalTelemetryDataFn()), {
|
|
@@ -3697,7 +3723,7 @@ var Wt = /*#__PURE__*/function () {
|
|
|
3697
3723
|
},
|
|
3698
3724
|
sdk: {
|
|
3699
3725
|
identifier: "Stytch.js Javascript SDK",
|
|
3700
|
-
version: "4.
|
|
3726
|
+
version: "4.9.1"
|
|
3701
3727
|
}
|
|
3702
3728
|
});
|
|
3703
3729
|
}
|
|
@@ -3708,13 +3734,13 @@ var Wt = /*#__PURE__*/function () {
|
|
|
3708
3734
|
t = _ref2.body,
|
|
3709
3735
|
r = _ref2.errorMessage,
|
|
3710
3736
|
n = _ref2.method;
|
|
3711
|
-
return
|
|
3737
|
+
return Kt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
3712
3738
|
var i, s, o, a;
|
|
3713
3739
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
3714
3740
|
while (1) switch (_context4.prev = _context4.next) {
|
|
3715
3741
|
case 0:
|
|
3716
3742
|
i = this._subscriptionDataLayer.readSessionCookie().session_token, s = "Basic " + window.btoa(this._publicToken + ":" + (i || this._publicToken)), o = window.btoa(JSON.stringify(this.createTelemetryBlob())), a = window.location.origin;
|
|
3717
|
-
return _context4.abrupt("return",
|
|
3743
|
+
return _context4.abrupt("return", Ie({
|
|
3718
3744
|
basicAuthHeader: s,
|
|
3719
3745
|
body: t,
|
|
3720
3746
|
errorMessage: r,
|
|
@@ -3738,7 +3764,7 @@ var Wt = /*#__PURE__*/function () {
|
|
|
3738
3764
|
r = _ref3.errorMessage,
|
|
3739
3765
|
n = _ref3.method,
|
|
3740
3766
|
i = _ref3.retryCallback;
|
|
3741
|
-
return
|
|
3767
|
+
return Kt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
3742
3768
|
var s, o, a, c;
|
|
3743
3769
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
3744
3770
|
while (1) switch (_context5.prev = _context5.next) {
|
|
@@ -3753,9 +3779,9 @@ var Wt = /*#__PURE__*/function () {
|
|
|
3753
3779
|
o = e.xSDKParentHostHeader,
|
|
3754
3780
|
a = e.body,
|
|
3755
3781
|
c = e.retryCallback;
|
|
3756
|
-
return
|
|
3782
|
+
return Ee(this, void 0, void 0, me().mark(function e() {
|
|
3757
3783
|
var u;
|
|
3758
|
-
return
|
|
3784
|
+
return me().wrap(function (e) {
|
|
3759
3785
|
for (;;) switch (e.prev = e.next) {
|
|
3760
3786
|
case 0:
|
|
3761
3787
|
return u = {
|
|
@@ -3766,18 +3792,18 @@ var Wt = /*#__PURE__*/function () {
|
|
|
3766
3792
|
xSDKClientHeader: s,
|
|
3767
3793
|
xSDKParentHostHeader: o,
|
|
3768
3794
|
body: a
|
|
3769
|
-
}, e.prev = 1, e.next = 4,
|
|
3795
|
+
}, e.prev = 1, e.next = 4, Ie(u);
|
|
3770
3796
|
case 4:
|
|
3771
3797
|
case 15:
|
|
3772
3798
|
return e.abrupt("return", e.sent);
|
|
3773
3799
|
case 7:
|
|
3774
|
-
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof
|
|
3800
|
+
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof Re)) {
|
|
3775
3801
|
e.next = 16;
|
|
3776
3802
|
break;
|
|
3777
3803
|
}
|
|
3778
3804
|
return e.next = 12, c(e.t0, u);
|
|
3779
3805
|
case 12:
|
|
3780
|
-
return u = e.sent, e.next = 15,
|
|
3806
|
+
return u = e.sent, e.next = 15, Ie(u);
|
|
3781
3807
|
case 16:
|
|
3782
3808
|
throw e.t0;
|
|
3783
3809
|
case 17:
|
|
@@ -3809,18 +3835,18 @@ var Wt = /*#__PURE__*/function () {
|
|
|
3809
3835
|
return "".concat(this.baseURL, "/sdk/v1").concat(e);
|
|
3810
3836
|
}
|
|
3811
3837
|
}]);
|
|
3812
|
-
return
|
|
3838
|
+
return Ht;
|
|
3813
3839
|
}();
|
|
3814
|
-
var
|
|
3815
|
-
|
|
3840
|
+
var zt = "undefined" != typeof window && "IdentityCredential" in window,
|
|
3841
|
+
Vt = function Vt(e) {
|
|
3816
3842
|
return e === exports.OneTapPositions.forceLegacyEmbedded ? "force" : e === exports.OneTapPositions.embeddedOnly || e === exports.OneTapPositions.embedded || e === exports.OneTapPositions.floatingOrEmbedded;
|
|
3817
3843
|
};
|
|
3818
|
-
var
|
|
3819
|
-
function
|
|
3820
|
-
_classCallCheck(this,
|
|
3844
|
+
var Yt = /*#__PURE__*/function () {
|
|
3845
|
+
function Yt(e, t, r) {
|
|
3846
|
+
_classCallCheck(this, Yt);
|
|
3821
3847
|
this._googleClient = e, this._publicToken = t, this._clientId = r;
|
|
3822
3848
|
}
|
|
3823
|
-
_createClass(
|
|
3849
|
+
_createClass(Yt, [{
|
|
3824
3850
|
key: "cancel",
|
|
3825
3851
|
value: function cancel() {
|
|
3826
3852
|
this._googleClient.cancel();
|
|
@@ -3831,15 +3857,15 @@ var zt = /*#__PURE__*/function () {
|
|
|
3831
3857
|
var e = _ref4.callback,
|
|
3832
3858
|
t = _ref4.onOneTapCancelled,
|
|
3833
3859
|
r = _ref4.style;
|
|
3834
|
-
return
|
|
3860
|
+
return Kt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
3835
3861
|
var _this5 = this;
|
|
3836
3862
|
var n, i, s;
|
|
3837
3863
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
3838
3864
|
while (1) switch (_context6.prev = _context6.next) {
|
|
3839
3865
|
case 0:
|
|
3840
|
-
n =
|
|
3841
|
-
var t =
|
|
3842
|
-
return "force" === t || t && !
|
|
3866
|
+
n = Vt(r.position), i = function (e) {
|
|
3867
|
+
var t = Vt(e);
|
|
3868
|
+
return "force" === t || t && !zt;
|
|
3843
3869
|
}(r.position), s = {
|
|
3844
3870
|
client_id: this._clientId,
|
|
3845
3871
|
callback: e,
|
|
@@ -3881,18 +3907,18 @@ var zt = /*#__PURE__*/function () {
|
|
|
3881
3907
|
});
|
|
3882
3908
|
}
|
|
3883
3909
|
}]);
|
|
3884
|
-
return
|
|
3910
|
+
return Yt;
|
|
3885
3911
|
}();
|
|
3886
|
-
var
|
|
3887
|
-
function
|
|
3912
|
+
var Jt = /*#__PURE__*/function () {
|
|
3913
|
+
function Jt(e, t) {
|
|
3888
3914
|
var _this6 = this;
|
|
3889
|
-
_classCallCheck(this,
|
|
3915
|
+
_classCallCheck(this, Jt);
|
|
3890
3916
|
this._publicToken = e, this.clientsideServices = t, this.createOnSuccessHandler = function (_ref5) {
|
|
3891
3917
|
var e = _ref5.loginRedirectUrl,
|
|
3892
3918
|
t = _ref5.signupRedirectUrl,
|
|
3893
3919
|
r = _ref5.onSuccess;
|
|
3894
3920
|
return function (n) {
|
|
3895
|
-
return
|
|
3921
|
+
return Kt(_this6, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
3896
3922
|
var i, _yield$this$submitGoo, s;
|
|
3897
3923
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
3898
3924
|
while (1) switch (_context7.prev = _context7.next) {
|
|
@@ -3919,10 +3945,10 @@ var Vt = /*#__PURE__*/function () {
|
|
|
3919
3945
|
window.location.href = e;
|
|
3920
3946
|
};
|
|
3921
3947
|
}
|
|
3922
|
-
_createClass(
|
|
3948
|
+
_createClass(Jt, [{
|
|
3923
3949
|
key: "createOneTapClient",
|
|
3924
3950
|
value: function createOneTapClient() {
|
|
3925
|
-
return
|
|
3951
|
+
return Kt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
3926
3952
|
var e, _yield$this$fetchGoog;
|
|
3927
3953
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
3928
3954
|
while (1) switch (_context8.prev = _context8.next) {
|
|
@@ -3953,9 +3979,9 @@ var Vt = /*#__PURE__*/function () {
|
|
|
3953
3979
|
});
|
|
3954
3980
|
case 12:
|
|
3955
3981
|
_context8.t1 = !0;
|
|
3956
|
-
_context8.t2 =
|
|
3982
|
+
_context8.t2 = Yt;
|
|
3957
3983
|
_context8.next = 16;
|
|
3958
|
-
return
|
|
3984
|
+
return qe(Te, function () {
|
|
3959
3985
|
return window.google.accounts.id;
|
|
3960
3986
|
});
|
|
3961
3987
|
case 16:
|
|
@@ -3987,7 +4013,7 @@ var Vt = /*#__PURE__*/function () {
|
|
|
3987
4013
|
var e = _ref6.credential,
|
|
3988
4014
|
t = _ref6.loginRedirectUrl,
|
|
3989
4015
|
r = _ref6.signupRedirectUrl;
|
|
3990
|
-
return
|
|
4016
|
+
return Kt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
3991
4017
|
var _yield$this$fetchGoog2, n;
|
|
3992
4018
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
3993
4019
|
while (1) switch (_context9.prev = _context9.next) {
|
|
@@ -4024,21 +4050,21 @@ var Vt = /*#__PURE__*/function () {
|
|
|
4024
4050
|
}, {
|
|
4025
4051
|
key: "WillGoogleOneTapShowEmbedded",
|
|
4026
4052
|
value: function WillGoogleOneTapShowEmbedded() {
|
|
4027
|
-
return !
|
|
4053
|
+
return !Jt.WillGoogleOneTapShowBannerForUA(navigator.userAgent);
|
|
4028
4054
|
}
|
|
4029
4055
|
}]);
|
|
4030
|
-
return
|
|
4056
|
+
return Jt;
|
|
4031
4057
|
}();
|
|
4032
|
-
function
|
|
4058
|
+
function $t(e) {
|
|
4033
4059
|
var t = e.toString(16);
|
|
4034
4060
|
return 1 === t.length && (t = "0" + t), t;
|
|
4035
4061
|
}
|
|
4036
|
-
var
|
|
4037
|
-
function
|
|
4038
|
-
_classCallCheck(this,
|
|
4062
|
+
var Xt = /*#__PURE__*/function () {
|
|
4063
|
+
function Xt(e, t) {
|
|
4064
|
+
_classCallCheck(this, Xt);
|
|
4039
4065
|
this._dataLayer = e, this.namespace = t;
|
|
4040
4066
|
}
|
|
4041
|
-
_createClass(
|
|
4067
|
+
_createClass(Xt, [{
|
|
4042
4068
|
key: "key",
|
|
4043
4069
|
value: function key() {
|
|
4044
4070
|
return "PKCE_VERIFIER:" + this.namespace;
|
|
@@ -4046,13 +4072,13 @@ var Jt = /*#__PURE__*/function () {
|
|
|
4046
4072
|
}, {
|
|
4047
4073
|
key: "startPKCETransaction",
|
|
4048
4074
|
value: function startPKCETransaction() {
|
|
4049
|
-
return
|
|
4075
|
+
return Kt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
4050
4076
|
var e;
|
|
4051
4077
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
4052
4078
|
while (1) switch (_context10.prev = _context10.next) {
|
|
4053
4079
|
case 0:
|
|
4054
4080
|
_context10.next = 2;
|
|
4055
|
-
return
|
|
4081
|
+
return Xt.createProofkeyPair();
|
|
4056
4082
|
case 2:
|
|
4057
4083
|
e = _context10.sent;
|
|
4058
4084
|
return _context10.abrupt("return", (this._dataLayer.setItem(this.key(), JSON.stringify(e)), e));
|
|
@@ -4070,7 +4096,7 @@ var Jt = /*#__PURE__*/function () {
|
|
|
4070
4096
|
if (null !== e) try {
|
|
4071
4097
|
return JSON.parse(e);
|
|
4072
4098
|
} catch (e) {
|
|
4073
|
-
return void
|
|
4099
|
+
return void Ve("Found malformed Proof Key pair in localstorage.");
|
|
4074
4100
|
}
|
|
4075
4101
|
}
|
|
4076
4102
|
}, {
|
|
@@ -4081,7 +4107,7 @@ var Jt = /*#__PURE__*/function () {
|
|
|
4081
4107
|
}], [{
|
|
4082
4108
|
key: "createProofkeyPair",
|
|
4083
4109
|
value: function createProofkeyPair() {
|
|
4084
|
-
return
|
|
4110
|
+
return Kt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
4085
4111
|
var _String$fromCharCode;
|
|
4086
4112
|
var e, t, r, n;
|
|
4087
4113
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
@@ -4089,7 +4115,7 @@ var Jt = /*#__PURE__*/function () {
|
|
|
4089
4115
|
case 0:
|
|
4090
4116
|
e = new Uint32Array(16);
|
|
4091
4117
|
window.crypto.getRandomValues(e);
|
|
4092
|
-
t = Array.from(e).map(
|
|
4118
|
+
t = Array.from(e).map($t).join("");
|
|
4093
4119
|
_context11.next = 5;
|
|
4094
4120
|
return window.crypto.subtle.digest("SHA-256", new TextEncoder().encode(t));
|
|
4095
4121
|
case 5:
|
|
@@ -4106,9 +4132,9 @@ var Jt = /*#__PURE__*/function () {
|
|
|
4106
4132
|
}));
|
|
4107
4133
|
}
|
|
4108
4134
|
}]);
|
|
4109
|
-
return
|
|
4135
|
+
return Xt;
|
|
4110
4136
|
}();
|
|
4111
|
-
var
|
|
4137
|
+
var Zt = function Zt(e) {
|
|
4112
4138
|
return (document.cookie ? document.cookie.split("; ") : []).filter(function (t) {
|
|
4113
4139
|
var _t$split = t.split("="),
|
|
4114
4140
|
_t$split2 = _slicedToArray(_t$split, 1),
|
|
@@ -4117,17 +4143,17 @@ var $t = function $t(e) {
|
|
|
4117
4143
|
}).length > 1;
|
|
4118
4144
|
};
|
|
4119
4145
|
/*! js-cookie v3.0.1 | MIT */
|
|
4120
|
-
function
|
|
4146
|
+
function Qt(e) {
|
|
4121
4147
|
for (var t = 1; t < arguments.length; t++) {
|
|
4122
4148
|
var r = arguments[t];
|
|
4123
4149
|
for (var n in r) e[n] = r[n];
|
|
4124
4150
|
}
|
|
4125
4151
|
return e;
|
|
4126
4152
|
}
|
|
4127
|
-
var
|
|
4153
|
+
var er = function e(t, r) {
|
|
4128
4154
|
function n(e, n, i) {
|
|
4129
4155
|
if ("undefined" != typeof document) {
|
|
4130
|
-
"number" == typeof (i =
|
|
4156
|
+
"number" == typeof (i = Qt({}, r, i)).expires && (i.expires = new Date(Date.now() + 864e5 * i.expires)), i.expires && (i.expires = i.expires.toUTCString()), e = encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
|
|
4131
4157
|
var s = "";
|
|
4132
4158
|
for (var o in i) i[o] && (s += "; " + o, !0 !== i[o] && (s += "=" + i[o].split(";")[0]));
|
|
4133
4159
|
return document.cookie = e + "=" + t.write(n, e) + s;
|
|
@@ -4149,15 +4175,15 @@ var Zt = function e(t, r) {
|
|
|
4149
4175
|
}
|
|
4150
4176
|
},
|
|
4151
4177
|
remove: function remove(e, t) {
|
|
4152
|
-
n(e, "",
|
|
4178
|
+
n(e, "", Qt({}, t, {
|
|
4153
4179
|
expires: -1
|
|
4154
4180
|
}));
|
|
4155
4181
|
},
|
|
4156
4182
|
withAttributes: function withAttributes(t) {
|
|
4157
|
-
return e(this.converter,
|
|
4183
|
+
return e(this.converter, Qt({}, this.attributes, t));
|
|
4158
4184
|
},
|
|
4159
4185
|
withConverter: function withConverter(t) {
|
|
4160
|
-
return e(
|
|
4186
|
+
return e(Qt({}, this.converter, t), this.attributes);
|
|
4161
4187
|
}
|
|
4162
4188
|
}, {
|
|
4163
4189
|
attributes: {
|
|
@@ -4177,37 +4203,37 @@ var Zt = function e(t, r) {
|
|
|
4177
4203
|
}, {
|
|
4178
4204
|
path: "/"
|
|
4179
4205
|
});
|
|
4180
|
-
var
|
|
4206
|
+
var tr = function tr(e) {
|
|
4181
4207
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
4182
4208
|
return "stytch_sdk_state_".concat(e).concat(t ? "::".concat(t) : "");
|
|
4183
4209
|
},
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
clearTimeout(
|
|
4210
|
+
rr = new Map(),
|
|
4211
|
+
nr = function nr(e) {
|
|
4212
|
+
clearTimeout(rr.get(e));
|
|
4187
4213
|
},
|
|
4188
|
-
|
|
4189
|
-
|
|
4214
|
+
ir = function ir(e, t, r) {
|
|
4215
|
+
nr(e);
|
|
4190
4216
|
var n = setTimeout(function () {
|
|
4191
|
-
void 0 ===
|
|
4217
|
+
void 0 === er.get(e) && er.set(e, t, r);
|
|
4192
4218
|
}, 10);
|
|
4193
|
-
return
|
|
4219
|
+
return rr.set(e, n), er.set(e, t, r);
|
|
4194
4220
|
};
|
|
4195
|
-
var
|
|
4196
|
-
function
|
|
4221
|
+
var sr = /*#__PURE__*/function () {
|
|
4222
|
+
function sr(e, t) {
|
|
4197
4223
|
var _this7 = this;
|
|
4198
|
-
_classCallCheck(this,
|
|
4224
|
+
_classCallCheck(this, sr);
|
|
4199
4225
|
this.browserSessionStorage = {
|
|
4200
4226
|
getItem: function getItem(e) {
|
|
4201
|
-
return sessionStorage.getItem(
|
|
4227
|
+
return sessionStorage.getItem(tr(_this7.publicToken, e));
|
|
4202
4228
|
},
|
|
4203
4229
|
setItem: function setItem(e, t) {
|
|
4204
|
-
return sessionStorage.setItem(
|
|
4230
|
+
return sessionStorage.setItem(tr(_this7.publicToken, e), t);
|
|
4205
4231
|
},
|
|
4206
4232
|
removeItem: function removeItem(e) {
|
|
4207
|
-
return sessionStorage.removeItem(
|
|
4233
|
+
return sessionStorage.removeItem(tr(_this7.publicToken, e));
|
|
4208
4234
|
}
|
|
4209
|
-
}, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (
|
|
4210
|
-
var r = localStorage.getItem(
|
|
4235
|
+
}, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? ($e("SubscriptionDataLayer").isOptionalString("cookieOptions.opaqueTokenCookieName", t.cookieOptions.opaqueTokenCookieName).isOptionalString("cookieOptions.jwtCookieName", t.cookieOptions.jwtCookieName).isOptionalString("cookieOptions.istCookieName", t.cookieOptions.istCookieName).isOptionalString("cookieOptions.path", t.cookieOptions.path).isOptionalString("cookieOptions.domain", t.cookieOptions.domain), this._jwtCookieName = t.cookieOptions.jwtCookieName || null, this._opaqueTokenCookieName = t.cookieOptions.opaqueTokenCookieName || null, this._cookiePath = t.cookieOptions.path || null, this._domain = t.cookieOptions.domain || null, this._cookieAvailableToSubdomains = t.cookieOptions.availableToSubdomains || !1, this._istCookieName = t.cookieOptions.istCookieName || null) : (this._opaqueTokenCookieName = null, this._jwtCookieName = null, this._cookiePath = null, this._domain = null, this._cookieAvailableToSubdomains = !1, this._istCookieName = null);
|
|
4236
|
+
var r = localStorage.getItem(tr(this.publicToken));
|
|
4211
4237
|
if (!r) return;
|
|
4212
4238
|
var n;
|
|
4213
4239
|
try {
|
|
@@ -4217,7 +4243,7 @@ var nr = /*#__PURE__*/function () {
|
|
|
4217
4243
|
}
|
|
4218
4244
|
this.state = n;
|
|
4219
4245
|
}
|
|
4220
|
-
_createClass(
|
|
4246
|
+
_createClass(sr, [{
|
|
4221
4247
|
key: "opaqueTokenCookieName",
|
|
4222
4248
|
get: function get() {
|
|
4223
4249
|
var e;
|
|
@@ -4239,14 +4265,14 @@ var nr = /*#__PURE__*/function () {
|
|
|
4239
4265
|
key: "readSessionCookie",
|
|
4240
4266
|
value: function readSessionCookie() {
|
|
4241
4267
|
return {
|
|
4242
|
-
session_token:
|
|
4243
|
-
session_jwt:
|
|
4268
|
+
session_token: er.get(this.opaqueTokenCookieName),
|
|
4269
|
+
session_jwt: er.get(this.jwtCookieName)
|
|
4244
4270
|
};
|
|
4245
4271
|
}
|
|
4246
4272
|
}, {
|
|
4247
4273
|
key: "readIntermediateSessionTokenCookie",
|
|
4248
4274
|
value: function readIntermediateSessionTokenCookie() {
|
|
4249
|
-
return
|
|
4275
|
+
return er.get(this.istCookieName);
|
|
4250
4276
|
}
|
|
4251
4277
|
}, {
|
|
4252
4278
|
key: "writeSessionCookie",
|
|
@@ -4255,32 +4281,32 @@ var nr = /*#__PURE__*/function () {
|
|
|
4255
4281
|
var s = e.state,
|
|
4256
4282
|
o = e.session_token,
|
|
4257
4283
|
a = e.session_jwt,
|
|
4258
|
-
c =
|
|
4284
|
+
c = sr.generateCookieOpts({
|
|
4259
4285
|
expiresAt: null !== (r = null === (t = null == s ? void 0 : s.session) || void 0 === t ? void 0 : t.expires_at) && void 0 !== r ? r : "",
|
|
4260
4286
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4261
4287
|
path: this._cookiePath,
|
|
4262
4288
|
domain: this._domain
|
|
4263
4289
|
});
|
|
4264
|
-
|
|
4265
|
-
var u =
|
|
4290
|
+
ir(this.opaqueTokenCookieName, o, c), ir(this.jwtCookieName, a, c);
|
|
4291
|
+
var u = sr.generateCookieOpts({
|
|
4266
4292
|
expiresAt: null !== (i = null === (n = null == s ? void 0 : s.session) || void 0 === n ? void 0 : n.expires_at) && void 0 !== i ? i : "",
|
|
4267
4293
|
availableToSubdomains: !this._cookieAvailableToSubdomains,
|
|
4268
4294
|
path: this._cookiePath,
|
|
4269
4295
|
domain: this._domain
|
|
4270
4296
|
});
|
|
4271
|
-
|
|
4297
|
+
Zt(this.jwtCookieName) && er.remove(this.jwtCookieName, u), Zt(this.opaqueTokenCookieName) && er.remove(this.opaqueTokenCookieName, u), Zt(this.jwtCookieName) && Ve("Could not remove extraneous JWT cookie. This might happen if the cookie has been set using multiple `path` settings, and may produce unwanted behavior."), Zt(this.opaqueTokenCookieName) && Ve("Could not remove extraneous opaque token cookie.");
|
|
4272
4298
|
}
|
|
4273
4299
|
}, {
|
|
4274
4300
|
key: "writeIntermediateSessionTokenCookie",
|
|
4275
4301
|
value: function writeIntermediateSessionTokenCookie(e) {
|
|
4276
4302
|
var t = new Date(Date.now() + 6e5),
|
|
4277
|
-
r =
|
|
4303
|
+
r = sr.generateCookieOpts({
|
|
4278
4304
|
expiresAt: t.toString(),
|
|
4279
4305
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4280
4306
|
path: this._cookiePath,
|
|
4281
4307
|
domain: this._domain
|
|
4282
4308
|
});
|
|
4283
|
-
|
|
4309
|
+
ir(this.istCookieName, e, r);
|
|
4284
4310
|
}
|
|
4285
4311
|
}, {
|
|
4286
4312
|
key: "removeSessionCookie",
|
|
@@ -4299,47 +4325,38 @@ var nr = /*#__PURE__*/function () {
|
|
|
4299
4325
|
[!0, !1].forEach(function (t) {
|
|
4300
4326
|
[_this8._cookiePath, null].forEach(function (r) {
|
|
4301
4327
|
[_this8._domain, null].forEach(function (n) {
|
|
4302
|
-
var i =
|
|
4328
|
+
var i = sr.generateCookieOpts({
|
|
4303
4329
|
expiresAt: new Date(0).toString(),
|
|
4304
4330
|
availableToSubdomains: t,
|
|
4305
4331
|
path: r,
|
|
4306
4332
|
domain: n
|
|
4307
4333
|
});
|
|
4308
4334
|
e.forEach(function (e) {
|
|
4309
|
-
|
|
4335
|
+
er.remove(e, i);
|
|
4310
4336
|
});
|
|
4311
4337
|
});
|
|
4312
4338
|
});
|
|
4313
|
-
}), e.forEach(
|
|
4339
|
+
}), e.forEach(nr);
|
|
4314
4340
|
}
|
|
4315
4341
|
}, {
|
|
4316
4342
|
key: "syncToLocalStorage",
|
|
4317
4343
|
value: function syncToLocalStorage() {
|
|
4318
|
-
localStorage.setItem(
|
|
4344
|
+
localStorage.setItem(tr(this.publicToken), JSON.stringify(this.state));
|
|
4319
4345
|
}
|
|
4320
4346
|
}, {
|
|
4321
4347
|
key: "getItem",
|
|
4322
4348
|
value: function getItem(e) {
|
|
4323
|
-
return localStorage.getItem(
|
|
4349
|
+
return localStorage.getItem(tr(this.publicToken, e));
|
|
4324
4350
|
}
|
|
4325
4351
|
}, {
|
|
4326
4352
|
key: "setItem",
|
|
4327
4353
|
value: function setItem(e, t) {
|
|
4328
|
-
return localStorage.setItem(
|
|
4354
|
+
return localStorage.setItem(tr(this.publicToken, e), t);
|
|
4329
4355
|
}
|
|
4330
4356
|
}, {
|
|
4331
4357
|
key: "removeItem",
|
|
4332
4358
|
value: function removeItem(e) {
|
|
4333
|
-
return localStorage.removeItem(
|
|
4334
|
-
}
|
|
4335
|
-
}, {
|
|
4336
|
-
key: "markStateKeysUpdated",
|
|
4337
|
-
value: function markStateKeysUpdated(e) {
|
|
4338
|
-
var _this9 = this;
|
|
4339
|
-
var t = this.stateKeysUpdated.size;
|
|
4340
|
-
return e.forEach(function (e) {
|
|
4341
|
-
return _this9.stateKeysUpdated.add(e);
|
|
4342
|
-
}), t !== this.stateKeysUpdated.size;
|
|
4359
|
+
return localStorage.removeItem(tr(this.publicToken, e));
|
|
4343
4360
|
}
|
|
4344
4361
|
}], [{
|
|
4345
4362
|
key: "generateCookieOpts",
|
|
@@ -4355,62 +4372,65 @@ var nr = /*#__PURE__*/function () {
|
|
|
4355
4372
|
return e && (i.path = e), Boolean("localhost" === window.location.hostname || "[::1]" === window.location.hostname || window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)) ? i.secure = !1 : (r && (i.domain = t || window.location.host), i.secure = !0), i;
|
|
4356
4373
|
}
|
|
4357
4374
|
}]);
|
|
4358
|
-
return
|
|
4375
|
+
return sr;
|
|
4359
4376
|
}();
|
|
4360
|
-
var
|
|
4361
|
-
_inherits(
|
|
4362
|
-
function
|
|
4363
|
-
_classCallCheck(this,
|
|
4364
|
-
return _callSuper(this,
|
|
4377
|
+
var or = /*#__PURE__*/function (_sr) {
|
|
4378
|
+
_inherits(or, _sr);
|
|
4379
|
+
function or() {
|
|
4380
|
+
_classCallCheck(this, or);
|
|
4381
|
+
return _callSuper(this, or, arguments);
|
|
4365
4382
|
}
|
|
4366
|
-
return _createClass(
|
|
4367
|
-
}(
|
|
4368
|
-
var
|
|
4369
|
-
|
|
4383
|
+
return _createClass(or);
|
|
4384
|
+
}(sr);
|
|
4385
|
+
var ar = Symbol["for"]("__stytch_DataLayer"),
|
|
4386
|
+
cr = function cr(e, t) {
|
|
4370
4387
|
var r = function () {
|
|
4371
4388
|
var e = window;
|
|
4372
|
-
return e[
|
|
4389
|
+
return e[ar] || (e[ar] = {}), e[ar];
|
|
4373
4390
|
}();
|
|
4374
|
-
return r[e] || (r[e] = new
|
|
4391
|
+
return r[e] || (r[e] = new or(e, t)), r[e];
|
|
4375
4392
|
},
|
|
4376
|
-
|
|
4393
|
+
ur = function ur(e, t) {
|
|
4377
4394
|
Object.values(e).forEach(function (e) {
|
|
4378
4395
|
return e(t);
|
|
4379
4396
|
});
|
|
4380
4397
|
},
|
|
4381
|
-
|
|
4382
|
-
var
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4398
|
+
lr = function () {
|
|
4399
|
+
var _ref8 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
4400
|
+
_ref8$KEYS_TO_EXCLUDE = _ref8.KEYS_TO_EXCLUDE,
|
|
4401
|
+
e = _ref8$KEYS_TO_EXCLUDE === void 0 ? [] : _ref8$KEYS_TO_EXCLUDE;
|
|
4402
|
+
var t = function t(r, n) {
|
|
4403
|
+
return _typeof(r) == _typeof(n) && (null === r || null === n ? r === n : "object" == _typeof(r) ? Object.keys(r).length === Object.keys(n).length && !Object.keys(r).some(function (e) {
|
|
4386
4404
|
return !(e in n);
|
|
4387
|
-
}) && Object.entries(r).filter(function (
|
|
4388
|
-
var
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4405
|
+
}) && Object.entries(r).filter(function (_ref9) {
|
|
4406
|
+
var _ref10 = _slicedToArray(_ref9, 1),
|
|
4407
|
+
t = _ref10[0];
|
|
4408
|
+
return !e.includes(t);
|
|
4409
|
+
}).every(function (_ref11) {
|
|
4410
|
+
var _ref12 = _slicedToArray(_ref11, 2),
|
|
4411
|
+
e = _ref12[0],
|
|
4412
|
+
r = _ref12[1];
|
|
4413
|
+
return t(r, n[e]);
|
|
4395
4414
|
}) : r === n);
|
|
4396
4415
|
};
|
|
4416
|
+
return t;
|
|
4397
4417
|
}({
|
|
4398
4418
|
KEYS_TO_EXCLUDE: ["last_accessed_at"]
|
|
4399
4419
|
});
|
|
4400
|
-
var
|
|
4401
|
-
function
|
|
4402
|
-
var
|
|
4403
|
-
_classCallCheck(this,
|
|
4404
|
-
this._publicToken = e, this._datalayer = t, this._listen = function (e) {
|
|
4405
|
-
if (e.key !==
|
|
4420
|
+
var dr = /*#__PURE__*/function () {
|
|
4421
|
+
function dr(e, t) {
|
|
4422
|
+
var _this9 = this;
|
|
4423
|
+
_classCallCheck(this, dr);
|
|
4424
|
+
this._publicToken = e, this._datalayer = t, this.fromCache = !0, this._listen = function (e) {
|
|
4425
|
+
if (e.key !== tr(_this9._publicToken)) return;
|
|
4406
4426
|
var t = null === e.newValue || "null" === e.newValue ? null : JSON.parse(e.newValue);
|
|
4407
|
-
|
|
4427
|
+
_this9.updateState(t, !0);
|
|
4408
4428
|
}, window.addEventListener("storage", this._listen);
|
|
4409
4429
|
var _this$_datalayer$read = this._datalayer.readSessionCookie(),
|
|
4410
4430
|
r = _this$_datalayer$read.session_token;
|
|
4411
4431
|
r || this.destroySession();
|
|
4412
4432
|
}
|
|
4413
|
-
_createClass(
|
|
4433
|
+
_createClass(dr, [{
|
|
4414
4434
|
key: "getTokens",
|
|
4415
4435
|
value: function getTokens() {
|
|
4416
4436
|
var _this$_datalayer$read2 = this._datalayer.readSessionCookie(),
|
|
@@ -4447,8 +4467,8 @@ var ur = /*#__PURE__*/function () {
|
|
|
4447
4467
|
var t = this._datalayer.state,
|
|
4448
4468
|
r = null === e.state ? null : Object.assign(Object.assign({}, this._datalayer.state), e.state);
|
|
4449
4469
|
this._datalayer.state = r;
|
|
4450
|
-
var n =
|
|
4451
|
-
|
|
4470
|
+
var n = this.getFromCache();
|
|
4471
|
+
this.setCacheRefreshed(), !n && lr(t, r) || ur(this._datalayer.subscriptions, r);
|
|
4452
4472
|
}
|
|
4453
4473
|
}, {
|
|
4454
4474
|
key: "updateStateAndTokens",
|
|
@@ -4462,10 +4482,10 @@ var ur = /*#__PURE__*/function () {
|
|
|
4462
4482
|
var r = this._datalayer.state,
|
|
4463
4483
|
n = null === e ? null : Object.assign(Object.assign({}, this._datalayer.state), e);
|
|
4464
4484
|
this._datalayer.state = n;
|
|
4465
|
-
var i =
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
(
|
|
4485
|
+
var i = this.getFromCache();
|
|
4486
|
+
this.setCacheRefreshed();
|
|
4487
|
+
var s = !lr(r, n);
|
|
4488
|
+
(i || s) && (ur(this._datalayer.subscriptions, n), s && !t && this._datalayer.syncToLocalStorage());
|
|
4469
4489
|
}
|
|
4470
4490
|
}, {
|
|
4471
4491
|
key: "updateTokens",
|
|
@@ -4504,39 +4524,49 @@ var ur = /*#__PURE__*/function () {
|
|
|
4504
4524
|
value: function syncFromDeviceStorage() {
|
|
4505
4525
|
return null;
|
|
4506
4526
|
}
|
|
4527
|
+
}, {
|
|
4528
|
+
key: "getFromCache",
|
|
4529
|
+
value: function getFromCache() {
|
|
4530
|
+
return this.fromCache;
|
|
4531
|
+
}
|
|
4532
|
+
}, {
|
|
4533
|
+
key: "setCacheRefreshed",
|
|
4534
|
+
value: function setCacheRefreshed() {
|
|
4535
|
+
this.fromCache = !1;
|
|
4536
|
+
}
|
|
4507
4537
|
}]);
|
|
4508
|
-
return
|
|
4538
|
+
return dr;
|
|
4509
4539
|
}();
|
|
4510
|
-
var
|
|
4511
|
-
_inherits(
|
|
4512
|
-
function
|
|
4513
|
-
var
|
|
4514
|
-
_classCallCheck(this,
|
|
4515
|
-
|
|
4516
|
-
return
|
|
4540
|
+
var hr = /*#__PURE__*/function (_dr) {
|
|
4541
|
+
_inherits(hr, _dr);
|
|
4542
|
+
function hr() {
|
|
4543
|
+
var _this10;
|
|
4544
|
+
_classCallCheck(this, hr);
|
|
4545
|
+
_this10 = _callSuper(this, hr, arguments), _this10.updateUser = function (e) {
|
|
4546
|
+
return _this10.updateState({
|
|
4517
4547
|
user: e
|
|
4518
4548
|
});
|
|
4519
|
-
},
|
|
4549
|
+
}, _this10.getUser = function () {
|
|
4520
4550
|
var e, t;
|
|
4521
|
-
return null !== (t = null === (e =
|
|
4522
|
-
},
|
|
4551
|
+
return null !== (t = null === (e = _this10.getState()) || void 0 === e ? void 0 : e.user) && void 0 !== t ? t : null;
|
|
4552
|
+
}, _this10.getSession = function () {
|
|
4523
4553
|
var e, t;
|
|
4524
|
-
return null !== (t = null === (e =
|
|
4554
|
+
return null !== (t = null === (e = _this10.getState()) || void 0 === e ? void 0 : e.session) && void 0 !== t ? t : null;
|
|
4525
4555
|
};
|
|
4526
|
-
return
|
|
4556
|
+
return _this10;
|
|
4527
4557
|
}
|
|
4528
|
-
return _createClass(
|
|
4529
|
-
}(
|
|
4530
|
-
var
|
|
4531
|
-
exports.BiometricsFailedError =
|
|
4558
|
+
return _createClass(hr);
|
|
4559
|
+
}(dr);
|
|
4560
|
+
var pr = Symbol["for"]("stytch__internal_b2c");
|
|
4561
|
+
exports.BiometricsFailedError = ee, exports.BiometricsUnavailableError = B, exports.ChallengeSigningFailedError = J, exports.DeviceCredentialsNotAllowedError = q, exports.FailedCodeChallengeError = X, exports.FailedToDecryptDataError = Q, exports.InternalError = F, exports.InvalidAuthorizationCredentialError = z, exports.InvalidCredentialTypeError = ie, exports.InvalidRedirectSchemeError = re, exports.InvalidStartUrlError = te, exports.JSONDataNotConvertibleToStringError = oe, exports.KeyInvalidatedError = L, exports.KeystoreUnavailableError = M, exports.MissingAttestationObjectError = se, exports.MissingAuthorizationCredentialIDTokenError = H, exports.MissingGoogleClientIDError = W, exports.MissingPKCEError = G, exports.MissingPublicKeyError = Y, exports.MissingUrlError = ne, exports.NoBiometricsEnrolledError = N, exports.NoBiometricsRegistrationError = j, exports.NoCredentialsPresentError = V, exports.NoCurrentSessionError = I, exports.PasskeysInvalidEncoding = ce, exports.PasskeysMisconfigured = ue, exports.PasskeysUnsupportedError = Z, exports.RandomNumberGenerationFailed = ae, exports.SDKAPIUnreachableError = S, exports.SDKNotConfiguredError = $, exports.SignInWithAppleMisconfigured = le, exports.StytchAPIError = D, exports.StytchAPISchemaError = E, exports.StytchAPIUnreachableError = A, exports.StytchError = T, exports.StytchHeadlessClient = /*#__PURE__*/function () {
|
|
4532
4562
|
function _class(e, t) {
|
|
4533
|
-
var
|
|
4563
|
+
var _this11 = this;
|
|
4534
4564
|
_classCallCheck(this, _class);
|
|
4535
4565
|
var r;
|
|
4536
4566
|
!function (e) {
|
|
4537
4567
|
var t = "StytchUIClient" === e ? "import { createStytchUIClient } from '@stytch/nextjs/ui';\n \nconst stytch = createStytchUIClient('public-token-...');\n" : "import { createStytchHeadlessClient } from '@stytch/nextjs/ui';\n \nconst stytch = createStytchHeadlessClient('public-token-...');\n";
|
|
4538
4568
|
if ("undefined" == typeof window) throw new Error("The ".concat(e, " is not compatible with server-side environments.\nIf using nextjs, use the create").concat(e, " method instead.\n```\n").concat(t, "\n```\n"));
|
|
4539
|
-
}("StytchHeadlessClient"), "string" != typeof (r = e) ?
|
|
4569
|
+
}("StytchHeadlessClient"), "string" != typeof (r = e) ? Ve("Public token is malformed. Expected a string, got ".concat(_e(r), ".").concat(Je)) : "" === r ? Ve('Public token is malformed. Expected "public-token-...", got an empty string.'.concat(Je)) : r.startsWith("public-token-") || Ve('Public token is malformed. Expected "public-token-...", got '.concat(r, ".").concat(Je));
|
|
4540
4570
|
var n = t,
|
|
4541
4571
|
i = {
|
|
4542
4572
|
cookieOptions: null == (s = n) ? void 0 : s.cookieOptions,
|
|
@@ -4549,27 +4579,30 @@ exports.BiometricsFailedError = Q, exports.BiometricsUnavailableError = B, expor
|
|
|
4549
4579
|
}
|
|
4550
4580
|
};
|
|
4551
4581
|
var s, o, a, c, u, l, d, h, p, f, _;
|
|
4552
|
-
this._dataLayer =
|
|
4553
|
-
|
|
4554
|
-
|
|
4582
|
+
this._dataLayer = cr(e, n), this._subscriptionService = new hr(e, this._dataLayer), this._stateChangeClient = new Mt(this._subscriptionService, {}), this.onStateChange = function () {
|
|
4583
|
+
var _this11$_stateChangeC;
|
|
4584
|
+
return (_this11$_stateChangeC = _this11._stateChangeClient).onStateChange.apply(_this11$_stateChangeC, arguments);
|
|
4585
|
+
};
|
|
4586
|
+
var m = new Xt(this._dataLayer, "passwords");
|
|
4587
|
+
this._networkClient = new Ht(e, this._dataLayer, i.endpoints.sdkBackendURL, function () {
|
|
4555
4588
|
var e, t, r, n;
|
|
4556
4589
|
return {
|
|
4557
|
-
stytch_user_id: null === (t = null === (e =
|
|
4558
|
-
stytch_session_id: null === (n = null === (r =
|
|
4590
|
+
stytch_user_id: null === (t = null === (e = _this11._dataLayer.state) || void 0 === e ? void 0 : e.user) || void 0 === t ? void 0 : t.user_id,
|
|
4591
|
+
stytch_session_id: null === (n = null === (r = _this11._dataLayer.state) || void 0 === r ? void 0 : r.session) || void 0 === n ? void 0 : n.session_id
|
|
4559
4592
|
};
|
|
4560
4593
|
});
|
|
4561
|
-
var v = new
|
|
4562
|
-
y = new
|
|
4563
|
-
g = new
|
|
4564
|
-
b = new
|
|
4565
|
-
k = new
|
|
4566
|
-
w = new
|
|
4594
|
+
var v = new Ut(e, this._networkClient, this._dataLayer),
|
|
4595
|
+
y = new qt(v.getAsync()),
|
|
4596
|
+
g = new Qe(e, i.endpoints.dfpBackendURL, v.getAsync(), y.executeRecaptcha),
|
|
4597
|
+
b = new Wt(i.endpoints.clientsideServicesIframeURL),
|
|
4598
|
+
k = new Jt(e, b),
|
|
4599
|
+
w = new Bt(this._networkClient, g);
|
|
4567
4600
|
var S, x;
|
|
4568
|
-
this.user = new
|
|
4601
|
+
this.user = new nt(this._networkClient, this._subscriptionService), this.session = new it(this._networkClient, this._subscriptionService), this.magicLinks = new ot(this._networkClient, this._subscriptionService, new Xt(this._dataLayer, "magic_links"), m, v.getAsync(), g), this.otps = new at(this._networkClient, this._subscriptionService, y.executeRecaptcha, g), this.oauth = new Gt(this._networkClient, this._subscriptionService, new Xt(this._dataLayer, "oauth"), v.getAsync(), {
|
|
4569
4602
|
publicToken: e,
|
|
4570
4603
|
testAPIURL: i.endpoints.testAPIURL,
|
|
4571
4604
|
liveAPIURL: i.endpoints.liveAPIURL
|
|
4572
|
-
}, k), this.cryptoWallets = new
|
|
4605
|
+
}, k), this.cryptoWallets = new ut(this._networkClient, this._subscriptionService, y.executeRecaptcha, g), this.totps = new lt(this._networkClient, this._subscriptionService, g), this.webauthn = new Rt(this._networkClient, this._subscriptionService, g), this.passwords = new Ft(this._networkClient, this._subscriptionService, m, v.getAsync(), g), this._sessionManager = new Lt(this._subscriptionService, this.session), this._dataLayer.readSessionCookie().session_token && this._sessionManager.performBackgroundRefresh(), this._networkClient.logEvent({
|
|
4573
4606
|
name: "sdk_instance_instantiated",
|
|
4574
4607
|
details: {
|
|
4575
4608
|
event_callback_registered: !1,
|
|
@@ -4585,10 +4618,10 @@ exports.BiometricsFailedError = Q, exports.BiometricsUnavailableError = B, expor
|
|
|
4585
4618
|
publicToken: e,
|
|
4586
4619
|
dataLayer: this._dataLayer,
|
|
4587
4620
|
networkClient: this._networkClient
|
|
4588
|
-
}, Object.assign(S, _defineProperty({},
|
|
4621
|
+
}, Object.assign(S, _defineProperty({}, pr, x));
|
|
4589
4622
|
}
|
|
4590
4623
|
return _createClass(_class);
|
|
4591
|
-
}(), exports.StytchSDKAPIError =
|
|
4624
|
+
}(), exports.StytchSDKAPIError = P, exports.StytchSDKError = R, exports.StytchSDKSchemaError = C, exports.StytchSDKUsageError = x, exports.UNRECOVERABLE_ERROR_TYPES = O, exports.UserCancellationError = U, exports.UserLockedOutError = K, exports.errorToStytchError = function (e) {
|
|
4592
4625
|
switch (e.message) {
|
|
4593
4626
|
case "internal_error":
|
|
4594
4627
|
return new F(e.message);
|
|
@@ -4622,39 +4655,41 @@ exports.BiometricsFailedError = Q, exports.BiometricsUnavailableError = B, expor
|
|
|
4622
4655
|
case "invalid_authorization_credential":
|
|
4623
4656
|
return new z();
|
|
4624
4657
|
case "missing_public_key":
|
|
4625
|
-
return new V();
|
|
4626
|
-
case "challenge_signing_failed":
|
|
4627
4658
|
return new Y();
|
|
4628
|
-
case "
|
|
4659
|
+
case "challenge_signing_failed":
|
|
4629
4660
|
return new J();
|
|
4630
|
-
case "
|
|
4661
|
+
case "no_credentials_present":
|
|
4662
|
+
return new V();
|
|
4663
|
+
case "sdk_not_configured":
|
|
4631
4664
|
return new $();
|
|
4632
|
-
case "
|
|
4665
|
+
case "failed_code_challenge":
|
|
4633
4666
|
return new X();
|
|
4634
|
-
case "
|
|
4667
|
+
case "passkeys_unsupported":
|
|
4635
4668
|
return new Z();
|
|
4636
|
-
case "
|
|
4669
|
+
case "failed_to_decrypt_data":
|
|
4637
4670
|
return new Q();
|
|
4638
|
-
case "
|
|
4671
|
+
case "biometrics_failed":
|
|
4639
4672
|
return new ee();
|
|
4640
|
-
case "
|
|
4673
|
+
case "invalid_start_url":
|
|
4641
4674
|
return new te();
|
|
4642
|
-
case "
|
|
4675
|
+
case "invalid_redirect_scheme":
|
|
4643
4676
|
return new re();
|
|
4644
|
-
case "
|
|
4677
|
+
case "missing_url":
|
|
4645
4678
|
return new ne();
|
|
4646
|
-
case "
|
|
4679
|
+
case "invalid_credential_type":
|
|
4647
4680
|
return new ie();
|
|
4648
|
-
case "
|
|
4681
|
+
case "missing_attestation_object":
|
|
4649
4682
|
return new se();
|
|
4650
|
-
case "
|
|
4683
|
+
case "json_data_not_convertible_to_string":
|
|
4651
4684
|
return new oe();
|
|
4652
|
-
case "
|
|
4685
|
+
case "random_number_generation_failed":
|
|
4653
4686
|
return new ae();
|
|
4654
|
-
case "
|
|
4687
|
+
case "passkeys_invalid_encoding":
|
|
4655
4688
|
return new ce();
|
|
4656
|
-
case "
|
|
4689
|
+
case "passkeys_misconfigured":
|
|
4657
4690
|
return new ue();
|
|
4691
|
+
case "signinwithapple_misconfigured":
|
|
4692
|
+
return new le();
|
|
4658
4693
|
default:
|
|
4659
4694
|
return new R(e.name, e.message);
|
|
4660
4695
|
}
|