@stytch/nextjs 14.0.0 → 16.0.0

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.
@@ -278,14 +278,456 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
278
278
  catch (e) {
279
279
  return false;
280
280
  } }
281
- function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
281
+ function _isNativeFunction(fn) { try {
282
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
283
+ }
284
+ catch (e) {
285
+ return typeof fn === "function";
286
+ } }
282
287
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
283
288
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
284
289
  function _typeof(o) {
285
290
  "@babel/helpers - typeof";
286
291
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o);
287
292
  }
288
- function e(e, r) {
293
+ function e(t) {
294
+ return e = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
295
+ return _typeof(e);
296
+ } : function (e) {
297
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
298
+ }, e(t);
299
+ }
300
+ function t(t, r) {
301
+ for (var n = 0; n < r.length; n++) {
302
+ var i = r[n];
303
+ i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(t, (o = i.key, s = void 0, s = function (t, r) {
304
+ if ("object" !== e(t) || null === t)
305
+ return t;
306
+ var n = t[Symbol.toPrimitive];
307
+ if (void 0 !== n) {
308
+ var i = n.call(t, r || "default");
309
+ if ("object" !== e(i))
310
+ return i;
311
+ throw new TypeError("@@toPrimitive must return a primitive value.");
312
+ }
313
+ return ("string" === r ? String : Number)(t);
314
+ }(o, "string"), "symbol" === e(s) ? s : String(s)), i);
315
+ }
316
+ var o, s;
317
+ }
318
+ function r(e, r, n) {
319
+ return r && t(e.prototype, r), n && t(e, n), Object.defineProperty(e, "prototype", {
320
+ writable: !1
321
+ }), e;
322
+ }
323
+ function n(e, t) {
324
+ if (!(e instanceof t))
325
+ throw new TypeError("Cannot call a class as a function");
326
+ }
327
+ function i(e, t) {
328
+ if ("function" != typeof t && null !== t)
329
+ throw new TypeError("Super expression must either be null or a function");
330
+ e.prototype = Object.create(t && t.prototype, {
331
+ constructor: {
332
+ value: e,
333
+ writable: !0,
334
+ configurable: !0
335
+ }
336
+ }), Object.defineProperty(e, "prototype", {
337
+ writable: !1
338
+ }), t && l(e, t);
339
+ }
340
+ function o(t) {
341
+ var r = u();
342
+ return function () {
343
+ var n, i = d(t);
344
+ if (r) {
345
+ var o = d(this).constructor;
346
+ n = Reflect.construct(i, arguments, o);
347
+ }
348
+ else
349
+ n = i.apply(this, arguments);
350
+ return function (t, r) {
351
+ if (r && ("object" === e(r) || "function" == typeof r))
352
+ return r;
353
+ if (void 0 !== r)
354
+ throw new TypeError("Derived constructors may only return object or undefined");
355
+ return s(t);
356
+ }(this, n);
357
+ };
358
+ }
359
+ function s(e) {
360
+ if (void 0 === e)
361
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
362
+ return e;
363
+ }
364
+ function a(e) {
365
+ var t = "function" == typeof Map ? new Map() : void 0;
366
+ return a = function a(e) {
367
+ if (null === e || !function (e) {
368
+ try {
369
+ return -1 !== Function.toString.call(e).indexOf("[native code]");
370
+ }
371
+ catch (t) {
372
+ return "function" == typeof e;
373
+ }
374
+ }(e))
375
+ return e;
376
+ if ("function" != typeof e)
377
+ throw new TypeError("Super expression must either be null or a function");
378
+ if (void 0 !== t) {
379
+ if (t.has(e))
380
+ return t.get(e);
381
+ t.set(e, r);
382
+ }
383
+ function r() {
384
+ return c(e, arguments, d(this).constructor);
385
+ }
386
+ return r.prototype = Object.create(e.prototype, {
387
+ constructor: {
388
+ value: r,
389
+ enumerable: !1,
390
+ writable: !0,
391
+ configurable: !0
392
+ }
393
+ }), l(r, e);
394
+ }, a(e);
395
+ }
396
+ function c(e, t, r) {
397
+ return c = u() ? Reflect.construct.bind() : function (e, t, r) {
398
+ var n = [null];
399
+ n.push.apply(n, t);
400
+ var i = new (Function.bind.apply(e, n))();
401
+ return r && l(i, r.prototype), i;
402
+ }, c.apply(null, arguments);
403
+ }
404
+ function u() {
405
+ if ("undefined" == typeof Reflect || !Reflect.construct)
406
+ return !1;
407
+ if (Reflect.construct.sham)
408
+ return !1;
409
+ if ("function" == typeof Proxy)
410
+ return !0;
411
+ try {
412
+ return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () { })), !0;
413
+ }
414
+ catch (e) {
415
+ return !1;
416
+ }
417
+ }
418
+ function l(e, t) {
419
+ return l = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) {
420
+ return e.__proto__ = t, e;
421
+ }, l(e, t);
422
+ }
423
+ function d(e) {
424
+ return d = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) {
425
+ return e.__proto__ || Object.getPrototypeOf(e);
426
+ }, d(e);
427
+ }
428
+ var h, p, _, f, m, v;
429
+ !function (e) {
430
+ e.emailMagicLinks = "emailMagicLinks", e.oauth = "oauth", e.otp = "otp", e.crypto = "crypto", e.passwords = "passwords", e.passkeys = "passkeys";
431
+ }(h || (h = {})), function (e) {
432
+ e.Google = "google", e.Microsoft = "microsoft", e.Apple = "apple", e.Github = "github", e.GitLab = "gitlab", e.Facebook = "facebook", e.Discord = "discord", e.Salesforce = "salesforce", e.Slack = "slack", e.Amazon = "amazon", e.Bitbucket = "bitbucket", e.LinkedIn = "linkedin", e.Coinbase = "coinbase", e.Twitch = "twitch", e.Twitter = "twitter", e.TikTok = "tiktok", e.Snapchat = "snapchat", e.Figma = "figma", e.Yahoo = "yahoo";
433
+ }(p || (p = {})), function (e) {
434
+ e.Vessel = "Vessel", e.Phantom = "Phantom", e.Metamask = "Metamask", e.Coinbase = "Coinbase", e.Binance = "Binance", e.GenericEthereumWallet = "Other Ethereum Wallet", e.GenericSolanaWallet = "Other Solana Wallet";
435
+ }(_ || (_ = {})), function (e) {
436
+ e.embedded = "embedded", e.floating = "floating";
437
+ }(f || (f = {})), function (e) {
438
+ e.SMS = "sms", e.WhatsApp = "whatsapp", e.Email = "email";
439
+ }(m || (m = {})), function (e) {
440
+ e.MagicLinkLoginOrCreateEvent = "MAGIC_LINK_LOGIN_OR_CREATE", e.OTPsLoginOrCreateEvent = "OTP_LOGIN_OR_CREATE", e.OTPsAuthenticate = "OTP_AUTHENTICATE", e.CryptoWalletAuthenticateStart = "CRYPTO_WALLET_AUTHENTICATE_START", e.CryptoWalletAuthenticate = "CRYPTO_WALLET_AUTHENTICATE", e.PasswordCreate = "PASSWORD_CREATE", e.PasswordAuthenticate = "PASSWORD_AUTHENTICATE", e.PasswordResetByEmailStart = "PASSWORD_RESET_BY_EMAIL_START", e.PasswordResetByEmail = "PASSWORD_RESET_BY_EMAIL", e.PasskeyRegister = "PASSKEY_REGISTER", e.PasskeyAuthenticate = "PASSKEY_AUTHENTICATE", e.PasskeySkip = "PASSKEY_SKIP", e.PasskeyDone = "PASSKEY_DONE", e.B2BMagicLinkEmailLoginOrSignup = "B2B_MAGIC_LINK_EMAIL_LOGIN_OR_SIGNUP", e.B2BMagicLinkAuthenticate = "B2B_MAGIC_LINK_AUTHENTICATE", e.B2BMagicLinkEmailDiscoverySend = "B2B_MAGIC_LINK_EMAIL_DISCOVERY_SEND", e.B2BMagicLinkDiscoveryAuthenticate = "B2B_MAGIC_LINK_DISCOVERY_AUTHENTICATE", e.B2BSSOStart = "B2B_SSO_START", e.B2BSSOAuthenticate = "B2B_SSO_AUTHENTICATE", e.B2BOAuthAuthenticate = "B2B_OAUTH_AUTHENTICATE", e.B2BOAuthDiscoveryAuthenticate = "B2B_OAUTH_DISCOVERY_AUTHENTICATE", e.B2BDiscoveryOrganizationsCreate = "B2B_DISCOVERY_ORGANIZATIONS_CREATE", e.B2BDiscoveryIntermediateSessionExchange = "B2B_DISCOVERY_INTERMEDIATE_SESSION_EXCHANGE", e.B2BPasswordAuthenticate = "B2B_PASSWORD_AUTHENTICATE", e.B2BPasswordResetByEmailStart = "B2B_PASSWORD_RESET_BY_EMAIL_START", e.B2BPasswordResetByEmail = "B2B_PASSWORD_RESET_BY_EMAIL", e.B2BPasswordResetBySession = "B2B_PASSWORD_RESET_BY_SESSION";
441
+ }(v || (v = {}));
442
+ var b, g, y; (function (e) {
443
+ i(c, a(Error));
444
+ var t = o(c);
445
+ function c(e, r) {
446
+ var i;
447
+ return n(this, c), (i = t.call(this, e + "\n" + r)).message = e + "\n" + r, i.name = "SDKAPIUnreachableError", i.details = r, Object.setPrototypeOf(s(i), c.prototype), i;
448
+ }
449
+ return r(c);
450
+ })(); var w = function (e) {
451
+ i(s, a(Error));
452
+ var t = o(s);
453
+ function s(e, r) {
454
+ var i;
455
+ return n(this, s), (i = t.call(this)).name = "StytchSDKUsageError", i.message = "Invalid call to ".concat(e, "\n") + r, i;
456
+ }
457
+ return r(s);
458
+ }(); (function (e) {
459
+ i(s, a(Error));
460
+ var t = o(s);
461
+ function s(e) {
462
+ var r, i;
463
+ n(this, s), (r = t.call(this)).name = "StytchSDKSchemaError";
464
+ var o = null === (i = e.body) || void 0 === i ? void 0 : i.map(function (e) {
465
+ return "".concat(e.dataPath, ": ").concat(e.message);
466
+ }).join("\n");
467
+ return r.message = "[400] Request does not match expected schema\n".concat(o), r;
468
+ }
469
+ return r(s);
470
+ })(); (function (e) {
471
+ i(s, a(Error));
472
+ var t = o(s);
473
+ function s(e) {
474
+ var r;
475
+ n(this, s), (r = t.call(this)).name = "StytchSDKAPIError";
476
+ var i = e.status_code, o = e.error_type, a = e.error_message, c = e.error_url, u = e.request_id;
477
+ return r.error_type = o, r.error_message = a, r.error_url = c, r.request_id = u, r.status_code = i, r.message = "[".concat(i, "] ").concat(o, "\n") + "".concat(a, "\n") + "See ".concat(c, " for more information.\n") + (u ? "request_id: ".concat(u, "\n") : ""), r;
478
+ }
479
+ return r(s);
480
+ })(); var A = ["unauthorized_credentials", "user_unauthenticated", "invalid_secret_authentication", "session_not_found"], C = function (e) {
481
+ i(s, a(Error));
482
+ var t = o(s);
483
+ function s(e, r) {
484
+ var i;
485
+ return n(this, s), (i = t.call(this, r)).name = e, i;
486
+ }
487
+ return r(s);
488
+ }(), T = function (e) {
489
+ i(a, C);
490
+ var t = o(a);
491
+ function a(e) {
492
+ var r;
493
+ return n(this, a), r = t.call(this, "StytchAPIUnreachableError", e), Object.setPrototypeOf(s(r), a.prototype), r;
494
+ }
495
+ return r(a);
496
+ }(), O = function (e) {
497
+ i(s, C);
498
+ var t = o(s);
499
+ function s(e) {
500
+ var r;
501
+ n(this, s);
502
+ var i = null === (r = e.body) || void 0 === r ? void 0 : r.map(function (e) {
503
+ return "".concat(e.dataPath, ": ").concat(e.message);
504
+ }).join("\n");
505
+ return t.call(this, "StytchAPISchemaError", "Request does not match expected schema\n".concat(i));
506
+ }
507
+ return r(s);
508
+ }(), E = function (e) {
509
+ i(s, C);
510
+ var t = o(s);
511
+ function s(e) {
512
+ var r;
513
+ n(this, s);
514
+ var i = e.status_code, o = e.error_type, a = e.error_message, c = e.error_url, u = e.request_id;
515
+ return (r = t.call(this, "StytchAPIError", "[".concat(i, "] ").concat(o, "\n") + "".concat(a, "\n") + "See ".concat(c, " for more information.\n") + (u ? "request_id: ".concat(u, "\n") : ""))).error_type = o, r.error_message = a, r.error_url = c, r.request_id = u, r.status_code = i, r;
516
+ }
517
+ return r(s);
518
+ }(), x = function (e) {
519
+ i(s, C);
520
+ var t = o(s);
521
+ function s(e, r, i) {
522
+ var o;
523
+ return n(this, s), (o = t.call(this, e, r)).options = i, o;
524
+ }
525
+ return r(s);
526
+ }(); (function (e) {
527
+ i(s, x);
528
+ var t = o(s);
529
+ function s() {
530
+ return n(this, s), t.call(this, "NoCurrentSessionError", "There is no session currently available. Make sure the user is authenticated with a valid session.");
531
+ }
532
+ return r(s);
533
+ })(); (function (e) {
534
+ i(s, x);
535
+ var t = o(s);
536
+ function s(e) {
537
+ return n(this, s), t.call(this, "InternalError", e || "An internal error has occurred. Please contact Stytch if this occurs.");
538
+ }
539
+ return r(s);
540
+ })(); (function (e) {
541
+ i(s, x);
542
+ var t = o(s);
543
+ function s() {
544
+ return n(this, s), t.call(this, "NoBiometricsRegistrationError", "There is no biometric registration available. Authenticate with another method and add a new biometric registration first.");
545
+ }
546
+ return r(s);
547
+ })(); (function (e) {
548
+ i(s, x);
549
+ var t = o(s);
550
+ function s() {
551
+ return n(this, s), t.call(this, "BiometricsUnavailableError", "Biometrics is not available on the device.");
552
+ }
553
+ return r(s);
554
+ })(); (function (e) {
555
+ i(s, x);
556
+ var t = o(s);
557
+ function s() {
558
+ return n(this, s), t.call(this, "KeyInvalidatedError", "The biometrics enrollment on the device has changed.");
559
+ }
560
+ return r(s);
561
+ })(); (function (e) {
562
+ i(s, x);
563
+ var t = o(s);
564
+ function s() {
565
+ return n(this, s), t.call(this, "KeystoreUnavailableError", "The Android keystore is unavailable on the device. Consider setting allowFallbackToCleartext to true.");
566
+ }
567
+ return r(s);
568
+ })(); (function (e) {
569
+ i(s, x);
570
+ var t = o(s);
571
+ function s() {
572
+ return n(this, s), t.call(this, "NoBiometricsEnrolledError", "There is no biometric factor enrolled on the device. Add a biometric factor in the device settings.");
573
+ }
574
+ return r(s);
575
+ })(); (function (e) {
576
+ i(s, x);
577
+ var t = o(s);
578
+ function s() {
579
+ return n(this, s), t.call(this, "UserCancellationError", "The user canceled the prompt. Ask the user to try again.");
580
+ }
581
+ return r(s);
582
+ })(); (function (e) {
583
+ i(s, x);
584
+ var t = o(s);
585
+ function s() {
586
+ return n(this, s), t.call(this, "UserLockedOutError", "The user has been locked out due to too many failed attempts. Ask the user to try again later.");
587
+ }
588
+ return r(s);
589
+ })(); (function (e) {
590
+ i(s, x);
591
+ var t = o(s);
592
+ function s() {
593
+ return n(this, s), t.call(this, "DeviceCredentialsNotAllowedError", "The device credentials allowment is mismatched. Change the allowDeviceCredentials parameter to be the same in both the register and authenticate methods.");
594
+ }
595
+ return r(s);
596
+ })(); (function (e) {
597
+ i(s, x);
598
+ var t = o(s);
599
+ function s() {
600
+ return n(this, s), t.call(this, "MissingGoogleClientIDError", "No Google client ID was found in the project.");
601
+ }
602
+ return r(s);
603
+ })(); (function (e) {
604
+ i(s, x);
605
+ var t = o(s);
606
+ function s() {
607
+ return n(this, s), t.call(this, "MissingPKCEError", "Make sure this flow is completed on the same device on which it was started.");
608
+ }
609
+ return r(s);
610
+ })(); (function (e) {
611
+ i(s, x);
612
+ var t = o(s);
613
+ function s() {
614
+ return n(this, s), t.call(this, "MissingAuthorizationCredentialIDTokenError", "The authorization credential is missing an ID token.");
615
+ }
616
+ return r(s);
617
+ })(); (function (e) {
618
+ i(s, x);
619
+ var t = o(s);
620
+ function s() {
621
+ return n(this, s), t.call(this, "InvalidAuthorizationCredentialError", "The authorization credential is invalid. Verify that OAuth is set up correctly in the developer console, and call the start flow method.");
622
+ }
623
+ return r(s);
624
+ })(); (function (e) {
625
+ i(s, x);
626
+ var t = o(s);
627
+ function s() {
628
+ return n(this, s), t.call(this, "MissingPublicKeyError", "Failed to retrieve the public key. Add a new biometric registration.");
629
+ }
630
+ return r(s);
631
+ })(); (function (e) {
632
+ i(s, x);
633
+ var t = o(s);
634
+ function s() {
635
+ return n(this, s), t.call(this, "ChallengeSigningFailedError", "Failed to sign the challenge with the key.");
636
+ }
637
+ return r(s);
638
+ })(); (function (e) {
639
+ i(s, x);
640
+ var t = o(s);
641
+ function s() {
642
+ return n(this, s), t.call(this, "SDKNotConfiguredError", "Stytch client is not confiured. You must call the configure method before using the SDK");
643
+ }
644
+ return r(s);
645
+ })(); (function (e) {
646
+ i(s, x);
647
+ var t = o(s);
648
+ function s() {
649
+ return n(this, s), t.call(this, "FailedCodeChallengeError", "Failed to create a code challenge");
650
+ }
651
+ return r(s);
652
+ })(); (function (e) {
653
+ i(s, x);
654
+ var t = o(s);
655
+ function s() {
656
+ return n(this, s), t.call(this, "PasskeysUnsupportedError", "Passkeys are not supported on this device");
657
+ }
658
+ return r(s);
659
+ })(); (function (e) {
660
+ i(s, x);
661
+ var t = o(s);
662
+ function s() {
663
+ return n(this, s), t.call(this, "FailedToDecryptDataError", "Failed to decrypt user data");
664
+ }
665
+ return r(s);
666
+ })(); (function (e) {
667
+ i(s, x);
668
+ var t = o(s);
669
+ function s() {
670
+ return n(this, s), t.call(this, "BiometricsFailedError", "Biometric authentication failed");
671
+ }
672
+ return r(s);
673
+ })(); (function (e) {
674
+ i(s, x);
675
+ var t = o(s);
676
+ function s() {
677
+ return n(this, s), t.call(this, "InvalidStartUrlError", "The start URL was invalid or improperly formatted.");
678
+ }
679
+ return r(s);
680
+ })(); (function (e) {
681
+ i(s, x);
682
+ var t = o(s);
683
+ function s() {
684
+ return n(this, s), t.call(this, "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.");
685
+ }
686
+ return r(s);
687
+ })(); (function (e) {
688
+ i(s, x);
689
+ var t = o(s);
690
+ function s() {
691
+ return n(this, s), t.call(this, "MissingUrlError", "The underlying web authentication service failed to return a URL.");
692
+ }
693
+ return r(s);
694
+ })(); (function (e) {
695
+ i(s, x);
696
+ var t = o(s);
697
+ function s() {
698
+ return n(this, s), t.call(this, "InvalidCredentialTypeError", "The public key credential type was not of the expected type.");
699
+ }
700
+ return r(s);
701
+ })(); (function (e) {
702
+ i(s, x);
703
+ var t = o(s);
704
+ function s() {
705
+ return n(this, s), t.call(this, "MissingAttestationObjectError", "The public key credential is missing the attestation object.");
706
+ }
707
+ return r(s);
708
+ })(); (function (e) {
709
+ i(s, x);
710
+ var t = o(s);
711
+ function s() {
712
+ return n(this, s), t.call(this, "JSONDataNotConvertibleToStringError", "JSON data unable to be converted to String type.");
713
+ }
714
+ return r(s);
715
+ })(); (function (e) {
716
+ i(s, x);
717
+ var t = o(s);
718
+ function s() {
719
+ return n(this, s), t.call(this, "RandomNumberGenerationFailed", "Random number generation failed");
720
+ }
721
+ return r(s);
722
+ })(); (function (e) {
723
+ i(s, x);
724
+ var t = o(s);
725
+ function s() {
726
+ return n(this, s), t.call(this, "PasskeysInvalidEncoding", "Invalid passkey encoding");
727
+ }
728
+ return r(s);
729
+ })();
730
+ function ae(e, t) {
289
731
  return function (e) {
290
732
  if (Array.isArray(e))
291
733
  return e;
@@ -318,40 +760,40 @@ function e(e, r) {
318
760
  }
319
761
  return a;
320
762
  }
321
- }(e, r) || t(e, r) || function () {
763
+ }(e, t) || ce(e, t) || function () {
322
764
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
323
765
  }();
324
766
  }
325
- function t(e, t) {
767
+ function ce(e, t) {
326
768
  if (e) {
327
769
  if ("string" == typeof e)
328
- return r(e, t);
329
- var n = Object.prototype.toString.call(e).slice(8, -1);
330
- return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? r(e, t) : void 0;
770
+ return ue(e, t);
771
+ var r = Object.prototype.toString.call(e).slice(8, -1);
772
+ 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) ? ue(e, t) : void 0;
331
773
  }
332
774
  }
333
- function r(e, t) {
775
+ function ue(e, t) {
334
776
  (null == t || t > e.length) && (t = e.length);
335
777
  for (var r = 0, n = new Array(t); r < t; r++)
336
778
  n[r] = e[r];
337
779
  return n;
338
780
  }
339
- function n(e) {
340
- return n = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
781
+ function le(e) {
782
+ return le = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
341
783
  return _typeof(e);
342
784
  } : function (e) {
343
785
  return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
344
- }, n(e);
786
+ }, le(e);
345
787
  }
346
- function i() {
788
+ function de() {
347
789
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
348
- i = function i() {
790
+ de = function de() {
349
791
  return t;
350
792
  };
351
- var e, t = {}, r = Object.prototype, o = r.hasOwnProperty, s = Object.defineProperty || function (e, t, r) {
793
+ var e, t = {}, r = Object.prototype, n = r.hasOwnProperty, i = Object.defineProperty || function (e, t, r) {
352
794
  e[t] = r.value;
353
- }, a = "function" == typeof Symbol ? Symbol : {}, c = a.iterator || "@@iterator", u = a.asyncIterator || "@@asyncIterator", l = a.toStringTag || "@@toStringTag";
354
- function d(e, t, r) {
795
+ }, o = "function" == typeof Symbol ? Symbol : {}, s = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", c = o.toStringTag || "@@toStringTag";
796
+ function u(e, t, r) {
355
797
  return Object.defineProperty(e, t, {
356
798
  value: r,
357
799
  enumerable: !0,
@@ -360,20 +802,20 @@ function i() {
360
802
  }), e[t];
361
803
  }
362
804
  try {
363
- d({}, "");
805
+ u({}, "");
364
806
  }
365
807
  catch (e) {
366
- d = function d(e, t, r) {
808
+ u = function u(e, t, r) {
367
809
  return e[t] = r;
368
810
  };
369
811
  }
370
- function h(e, t, r, n) {
371
- var i = t && t.prototype instanceof g ? t : g, o = Object.create(i.prototype), a = new x(n || []);
372
- return s(o, "_invoke", {
373
- value: P(e, r, a)
374
- }), o;
812
+ function l(e, t, r, n) {
813
+ var o = t && t.prototype instanceof v ? t : v, s = Object.create(o.prototype), a = new x(n || []);
814
+ return i(s, "_invoke", {
815
+ value: C(e, r, a)
816
+ }), s;
375
817
  }
376
- function p(e, t, r) {
818
+ function d(e, t, r) {
377
819
  try {
378
820
  return {
379
821
  type: "normal",
@@ -387,60 +829,60 @@ function i() {
387
829
  };
388
830
  }
389
831
  }
390
- t.wrap = h;
391
- var _ = "suspendedStart", m = "suspendedYield", f = "executing", v = "completed", b = {};
832
+ t.wrap = l;
833
+ var h = "suspendedStart", p = "suspendedYield", _ = "executing", f = "completed", m = {};
834
+ function v() { }
835
+ function b() { }
392
836
  function g() { }
393
- function y() { }
394
- function k() { }
395
- var S = {};
396
- d(S, c, function () {
837
+ var y = {};
838
+ u(y, s, function () {
397
839
  return this;
398
840
  });
399
- var w = Object.getPrototypeOf, A = w && w(w(I([])));
400
- A && A !== r && o.call(A, c) && (S = A);
401
- var E = k.prototype = g.prototype = Object.create(S);
402
- function T(e) {
841
+ var k = Object.getPrototypeOf, w = k && k(k(D([])));
842
+ w && w !== r && n.call(w, s) && (y = w);
843
+ var S = g.prototype = v.prototype = Object.create(y);
844
+ function P(e) {
403
845
  ["next", "throw", "return"].forEach(function (t) {
404
- d(e, t, function (e) {
846
+ u(e, t, function (e) {
405
847
  return this._invoke(t, e);
406
848
  });
407
849
  });
408
850
  }
409
- function O(e, t) {
410
- function r(i, s, a, c) {
411
- var u = p(e[i], e, s);
412
- if ("throw" !== u.type) {
413
- var l = u.arg, d = l.value;
414
- return d && "object" == n(d) && o.call(d, "__await") ? t.resolve(d.__await).then(function (e) {
415
- r("next", e, a, c);
851
+ function A(e, t) {
852
+ function r(i, o, s, a) {
853
+ var c = d(e[i], e, o);
854
+ if ("throw" !== c.type) {
855
+ var u = c.arg, l = u.value;
856
+ return l && "object" == le(l) && n.call(l, "__await") ? t.resolve(l.__await).then(function (e) {
857
+ r("next", e, s, a);
416
858
  }, function (e) {
417
- r("throw", e, a, c);
418
- }) : t.resolve(d).then(function (e) {
419
- l.value = e, a(l);
859
+ r("throw", e, s, a);
860
+ }) : t.resolve(l).then(function (e) {
861
+ u.value = e, s(u);
420
862
  }, function (e) {
421
- return r("throw", e, a, c);
863
+ return r("throw", e, s, a);
422
864
  });
423
865
  }
424
- c(u.arg);
866
+ a(c.arg);
425
867
  }
426
- var i;
427
- s(this, "_invoke", {
868
+ var o;
869
+ i(this, "_invoke", {
428
870
  value: function value(e, n) {
429
- function o() {
871
+ function i() {
430
872
  return new t(function (t, i) {
431
873
  r(e, n, t, i);
432
874
  });
433
875
  }
434
- return i = i ? i.then(o, o) : o();
876
+ return o = o ? o.then(i, i) : i();
435
877
  }
436
878
  });
437
879
  }
438
- function P(t, r, n) {
439
- var i = _;
880
+ function C(t, r, n) {
881
+ var i = h;
440
882
  return function (o, s) {
441
- if (i === f)
883
+ if (i === _)
442
884
  throw new Error("Generator is already running");
443
- if (i === v) {
885
+ if (i === f) {
444
886
  if ("throw" === o)
445
887
  throw s;
446
888
  return {
@@ -451,9 +893,9 @@ function i() {
451
893
  for (n.method = o, n.arg = s;;) {
452
894
  var a = n.delegate;
453
895
  if (a) {
454
- var c = C(a, n);
896
+ var c = T(a, n);
455
897
  if (c) {
456
- if (c === b)
898
+ if (c === m)
457
899
  continue;
458
900
  return c;
459
901
  }
@@ -461,96 +903,96 @@ function i() {
461
903
  if ("next" === n.method)
462
904
  n.sent = n._sent = n.arg;
463
905
  else if ("throw" === n.method) {
464
- if (i === _)
465
- throw i = v, n.arg;
906
+ if (i === h)
907
+ throw i = f, n.arg;
466
908
  n.dispatchException(n.arg);
467
909
  }
468
910
  else
469
911
  "return" === n.method && n.abrupt("return", n.arg);
470
- i = f;
471
- var u = p(t, r, n);
912
+ i = _;
913
+ var u = d(t, r, n);
472
914
  if ("normal" === u.type) {
473
- if (i = n.done ? v : m, u.arg === b)
915
+ if (i = n.done ? f : p, u.arg === m)
474
916
  continue;
475
917
  return {
476
918
  value: u.arg,
477
919
  done: n.done
478
920
  };
479
921
  }
480
- "throw" === u.type && (i = v, n.method = "throw", n.arg = u.arg);
922
+ "throw" === u.type && (i = f, n.method = "throw", n.arg = u.arg);
481
923
  }
482
924
  };
483
925
  }
484
- function C(t, r) {
926
+ function T(t, r) {
485
927
  var n = r.method, i = t.iterator[n];
486
928
  if (i === e)
487
- return r.delegate = null, "throw" === n && t.iterator["return"] && (r.method = "return", r.arg = e, C(t, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), b;
488
- var o = p(i, t.iterator, r.arg);
929
+ return r.delegate = null, "throw" === n && t.iterator["return"] && (r.method = "return", r.arg = e, T(t, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), m;
930
+ var o = d(i, t.iterator, r.arg);
489
931
  if ("throw" === o.type)
490
- return r.method = "throw", r.arg = o.arg, r.delegate = null, b;
932
+ return r.method = "throw", r.arg = o.arg, r.delegate = null, m;
491
933
  var s = o.arg;
492
- return s ? s.done ? (r[t.resultName] = s.value, r.next = t.nextLoc, "return" !== r.method && (r.method = "next", r.arg = e), r.delegate = null, b) : s : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, b);
934
+ return s ? s.done ? (r[t.resultName] = s.value, r.next = t.nextLoc, "return" !== r.method && (r.method = "next", r.arg = e), r.delegate = null, m) : s : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, m);
493
935
  }
494
- function B(e) {
936
+ function O(e) {
495
937
  var t = {
496
938
  tryLoc: e[0]
497
939
  };
498
940
  1 in e && (t.catchLoc = e[1]), 2 in e && (t.finallyLoc = e[2], t.afterLoc = e[3]), this.tryEntries.push(t);
499
941
  }
500
- function R(e) {
942
+ function E(e) {
501
943
  var t = e.completion || {};
502
944
  t.type = "normal", delete t.arg, e.completion = t;
503
945
  }
504
946
  function x(e) {
505
947
  this.tryEntries = [{
506
948
  tryLoc: "root"
507
- }], e.forEach(B, this), this.reset(!0);
949
+ }], e.forEach(O, this), this.reset(!0);
508
950
  }
509
- function I(t) {
951
+ function D(t) {
510
952
  if (t || "" === t) {
511
- var r = t[c];
953
+ var r = t[s];
512
954
  if (r)
513
955
  return r.call(t);
514
956
  if ("function" == typeof t.next)
515
957
  return t;
516
958
  if (!isNaN(t.length)) {
517
- var i = -1, s = function r() {
959
+ var i = -1, o = function r() {
518
960
  for (; ++i < t.length;)
519
- if (o.call(t, i))
961
+ if (n.call(t, i))
520
962
  return r.value = t[i], r.done = !1, r;
521
963
  return r.value = e, r.done = !0, r;
522
964
  };
523
- return s.next = s;
965
+ return o.next = o;
524
966
  }
525
967
  }
526
- throw new TypeError(n(t) + " is not iterable");
968
+ throw new TypeError(le(t) + " is not iterable");
527
969
  }
528
- return y.prototype = k, s(E, "constructor", {
529
- value: k,
970
+ return b.prototype = g, i(S, "constructor", {
971
+ value: g,
530
972
  configurable: !0
531
- }), s(k, "constructor", {
532
- value: y,
973
+ }), i(g, "constructor", {
974
+ value: b,
533
975
  configurable: !0
534
- }), y.displayName = d(k, l, "GeneratorFunction"), t.isGeneratorFunction = function (e) {
976
+ }), b.displayName = u(g, c, "GeneratorFunction"), t.isGeneratorFunction = function (e) {
535
977
  var t = "function" == typeof e && e.constructor;
536
- return !!t && (t === y || "GeneratorFunction" === (t.displayName || t.name));
978
+ return !!t && (t === b || "GeneratorFunction" === (t.displayName || t.name));
537
979
  }, t.mark = function (e) {
538
- return Object.setPrototypeOf ? Object.setPrototypeOf(e, k) : (e.__proto__ = k, d(e, l, "GeneratorFunction")), e.prototype = Object.create(E), e;
980
+ return Object.setPrototypeOf ? Object.setPrototypeOf(e, g) : (e.__proto__ = g, u(e, c, "GeneratorFunction")), e.prototype = Object.create(S), e;
539
981
  }, t.awrap = function (e) {
540
982
  return {
541
983
  __await: e
542
984
  };
543
- }, T(O.prototype), d(O.prototype, u, function () {
985
+ }, P(A.prototype), u(A.prototype, a, function () {
544
986
  return this;
545
- }), t.AsyncIterator = O, t.async = function (e, r, n, i, o) {
987
+ }), t.AsyncIterator = A, t.async = function (e, r, n, i, o) {
546
988
  void 0 === o && (o = Promise);
547
- var s = new O(h(e, r, n, i), o);
989
+ var s = new A(l(e, r, n, i), o);
548
990
  return t.isGeneratorFunction(r) ? s : s.next().then(function (e) {
549
991
  return e.done ? e.value : s.next();
550
992
  });
551
- }, T(E), d(E, l, "Generator"), d(E, c, function () {
993
+ }, P(S), u(S, c, "Generator"), u(S, s, function () {
552
994
  return this;
553
- }), d(E, "toString", function () {
995
+ }), u(S, "toString", function () {
554
996
  return "[object Generator]";
555
997
  }), t.keys = function (e) {
556
998
  var t = Object(e), r = [];
@@ -564,12 +1006,12 @@ function i() {
564
1006
  }
565
1007
  return e.done = !0, e;
566
1008
  };
567
- }, t.values = I, x.prototype = {
1009
+ }, t.values = D, x.prototype = {
568
1010
  constructor: x,
569
1011
  reset: function reset(t) {
570
- if (this.prev = 0, this.next = 0, this.sent = this._sent = e, this.done = !1, this.delegate = null, this.method = "next", this.arg = e, this.tryEntries.forEach(R), !t)
1012
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = e, this.done = !1, this.delegate = null, this.method = "next", this.arg = e, this.tryEntries.forEach(E), !t)
571
1013
  for (var r in this)
572
- "t" === r.charAt(0) && o.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = e);
1014
+ "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = e);
573
1015
  },
574
1016
  stop: function stop() {
575
1017
  this.done = !0;
@@ -582,56 +1024,56 @@ function i() {
582
1024
  if (this.done)
583
1025
  throw t;
584
1026
  var r = this;
585
- function n(n, i) {
1027
+ function i(n, i) {
586
1028
  return a.type = "throw", a.arg = t, r.next = n, i && (r.method = "next", r.arg = e), !!i;
587
1029
  }
588
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
589
- var s = this.tryEntries[i], a = s.completion;
1030
+ for (var o = this.tryEntries.length - 1; o >= 0; --o) {
1031
+ var s = this.tryEntries[o], a = s.completion;
590
1032
  if ("root" === s.tryLoc)
591
- return n("end");
1033
+ return i("end");
592
1034
  if (s.tryLoc <= this.prev) {
593
- var c = o.call(s, "catchLoc"), u = o.call(s, "finallyLoc");
1035
+ var c = n.call(s, "catchLoc"), u = n.call(s, "finallyLoc");
594
1036
  if (c && u) {
595
1037
  if (this.prev < s.catchLoc)
596
- return n(s.catchLoc, !0);
1038
+ return i(s.catchLoc, !0);
597
1039
  if (this.prev < s.finallyLoc)
598
- return n(s.finallyLoc);
1040
+ return i(s.finallyLoc);
599
1041
  }
600
1042
  else if (c) {
601
1043
  if (this.prev < s.catchLoc)
602
- return n(s.catchLoc, !0);
1044
+ return i(s.catchLoc, !0);
603
1045
  }
604
1046
  else {
605
1047
  if (!u)
606
1048
  throw new Error("try statement without catch or finally");
607
1049
  if (this.prev < s.finallyLoc)
608
- return n(s.finallyLoc);
1050
+ return i(s.finallyLoc);
609
1051
  }
610
1052
  }
611
1053
  }
612
1054
  },
613
1055
  abrupt: function abrupt(e, t) {
614
1056
  for (var r = this.tryEntries.length - 1; r >= 0; --r) {
615
- var n = this.tryEntries[r];
616
- if (n.tryLoc <= this.prev && o.call(n, "finallyLoc") && this.prev < n.finallyLoc) {
617
- var i = n;
1057
+ var i = this.tryEntries[r];
1058
+ if (i.tryLoc <= this.prev && n.call(i, "finallyLoc") && this.prev < i.finallyLoc) {
1059
+ var o = i;
618
1060
  break;
619
1061
  }
620
1062
  }
621
- i && ("break" === e || "continue" === e) && i.tryLoc <= t && t <= i.finallyLoc && (i = null);
622
- var s = i ? i.completion : {};
623
- return s.type = e, s.arg = t, i ? (this.method = "next", this.next = i.finallyLoc, b) : this.complete(s);
1063
+ o && ("break" === e || "continue" === e) && o.tryLoc <= t && t <= o.finallyLoc && (o = null);
1064
+ var s = o ? o.completion : {};
1065
+ return s.type = e, s.arg = t, o ? (this.method = "next", this.next = o.finallyLoc, m) : this.complete(s);
624
1066
  },
625
1067
  complete: function complete(e, t) {
626
1068
  if ("throw" === e.type)
627
1069
  throw e.arg;
628
- return "break" === e.type || "continue" === e.type ? this.next = e.arg : "return" === e.type ? (this.rval = this.arg = e.arg, this.method = "return", this.next = "end") : "normal" === e.type && t && (this.next = t), b;
1070
+ return "break" === e.type || "continue" === e.type ? this.next = e.arg : "return" === e.type ? (this.rval = this.arg = e.arg, this.method = "return", this.next = "end") : "normal" === e.type && t && (this.next = t), m;
629
1071
  },
630
1072
  finish: function finish(e) {
631
1073
  for (var t = this.tryEntries.length - 1; t >= 0; --t) {
632
1074
  var r = this.tryEntries[t];
633
1075
  if (r.finallyLoc === e)
634
- return this.complete(r.completion, r.afterLoc), R(r), b;
1076
+ return this.complete(r.completion, r.afterLoc), E(r), m;
635
1077
  }
636
1078
  },
637
1079
  "catch": function _catch(e) {
@@ -641,7 +1083,7 @@ function i() {
641
1083
  var n = r.completion;
642
1084
  if ("throw" === n.type) {
643
1085
  var i = n.arg;
644
- R(r);
1086
+ E(r);
645
1087
  }
646
1088
  return i;
647
1089
  }
@@ -650,112 +1092,104 @@ function i() {
650
1092
  },
651
1093
  delegateYield: function delegateYield(t, r, n) {
652
1094
  return this.delegate = {
653
- iterator: I(t),
1095
+ iterator: D(t),
654
1096
  resultName: r,
655
1097
  nextLoc: n
656
- }, "next" === this.method && (this.arg = e), b;
1098
+ }, "next" === this.method && (this.arg = e), m;
657
1099
  }
658
1100
  }, t;
659
1101
  }
660
- function o(e, t) {
1102
+ function he(e, t) {
661
1103
  for (var r = 0; r < t.length; r++) {
662
- var i = t[r];
663
- i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (o = i.key, s = void 0, s = function (e, t) {
664
- if ("object" !== n(e) || null === e)
1104
+ var n = t[r];
1105
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, (i = n.key, o = void 0, o = function (e, t) {
1106
+ if ("object" !== le(e) || null === e)
665
1107
  return e;
666
1108
  var r = e[Symbol.toPrimitive];
667
1109
  if (void 0 !== r) {
668
- var i = r.call(e, t || "default");
669
- if ("object" !== n(i))
670
- return i;
1110
+ var n = r.call(e, t || "default");
1111
+ if ("object" !== le(n))
1112
+ return n;
671
1113
  throw new TypeError("@@toPrimitive must return a primitive value.");
672
1114
  }
673
1115
  return ("string" === t ? String : Number)(e);
674
- }(o, "string"), "symbol" === n(s) ? s : String(s)), i);
1116
+ }(i, "string"), "symbol" === le(o) ? o : String(o)), n);
675
1117
  }
676
- var o, s;
1118
+ var i, o;
677
1119
  }
678
- function s(e, t, r) {
679
- return t && o(e.prototype, t), r && o(e, r), Object.defineProperty(e, "prototype", {
1120
+ function pe(e, t, r) {
1121
+ return t && he(e.prototype, t), r && he(e, r), Object.defineProperty(e, "prototype", {
680
1122
  writable: !1
681
1123
  }), e;
682
1124
  }
683
- function a(e, t) {
1125
+ function _e(e, t) {
684
1126
  if (!(e instanceof t))
685
1127
  throw new TypeError("Cannot call a class as a function");
686
1128
  }
687
- function c(e, t) {
688
- if ("function" != typeof t && null !== t)
689
- throw new TypeError("Super expression must either be null or a function");
690
- e.prototype = Object.create(t && t.prototype, {
691
- constructor: {
692
- value: e,
693
- writable: !0,
694
- configurable: !0
695
- }
696
- }), Object.defineProperty(e, "prototype", {
697
- writable: !1
698
- }), t && _(e, t);
699
- }
700
- function u(e) {
701
- var t = p();
1129
+ function fe(e) {
1130
+ var t = be();
702
1131
  return function () {
703
- var r, i = m(e);
1132
+ var r, n = ye(e);
704
1133
  if (t) {
705
- var o = m(this).constructor;
706
- r = Reflect.construct(i, arguments, o);
1134
+ var i = ye(this).constructor;
1135
+ r = Reflect.construct(n, arguments, i);
707
1136
  }
708
1137
  else
709
- r = i.apply(this, arguments);
1138
+ r = n.apply(this, arguments);
710
1139
  return function (e, t) {
711
- if (t && ("object" === n(t) || "function" == typeof t))
1140
+ if (t && ("object" === le(t) || "function" == typeof t))
712
1141
  return t;
713
1142
  if (void 0 !== t)
714
1143
  throw new TypeError("Derived constructors may only return object or undefined");
715
- return l(e);
1144
+ return function (e) {
1145
+ if (void 0 === e)
1146
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1147
+ return e;
1148
+ }(e);
716
1149
  }(this, r);
717
1150
  };
718
1151
  }
719
- function l(e) {
720
- if (void 0 === e)
721
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
722
- return e;
723
- }
724
- function d(e) {
1152
+ function me(e) {
725
1153
  var t = "function" == typeof Map ? new Map() : void 0;
726
- return d = function d(e) {
727
- if (null === e || (r = e, -1 === Function.toString.call(r).indexOf("[native code]")))
1154
+ return me = function me(e) {
1155
+ if (null === e || !function (e) {
1156
+ try {
1157
+ return -1 !== Function.toString.call(e).indexOf("[native code]");
1158
+ }
1159
+ catch (t) {
1160
+ return "function" == typeof e;
1161
+ }
1162
+ }(e))
728
1163
  return e;
729
- var r;
730
1164
  if ("function" != typeof e)
731
1165
  throw new TypeError("Super expression must either be null or a function");
732
1166
  if (void 0 !== t) {
733
1167
  if (t.has(e))
734
1168
  return t.get(e);
735
- t.set(e, n);
1169
+ t.set(e, r);
736
1170
  }
737
- function n() {
738
- return h(e, arguments, m(this).constructor);
1171
+ function r() {
1172
+ return ve(e, arguments, ye(this).constructor);
739
1173
  }
740
- return n.prototype = Object.create(e.prototype, {
1174
+ return r.prototype = Object.create(e.prototype, {
741
1175
  constructor: {
742
- value: n,
1176
+ value: r,
743
1177
  enumerable: !1,
744
1178
  writable: !0,
745
1179
  configurable: !0
746
1180
  }
747
- }), _(n, e);
748
- }, d(e);
1181
+ }), ge(r, e);
1182
+ }, me(e);
749
1183
  }
750
- function h(e, t, r) {
751
- return h = p() ? Reflect.construct.bind() : function (e, t, r) {
1184
+ function ve(e, t, r) {
1185
+ return ve = be() ? Reflect.construct.bind() : function (e, t, r) {
752
1186
  var n = [null];
753
1187
  n.push.apply(n, t);
754
1188
  var i = new (Function.bind.apply(e, n))();
755
- return r && _(i, r.prototype), i;
756
- }, h.apply(null, arguments);
1189
+ return r && ge(i, r.prototype), i;
1190
+ }, ve.apply(null, arguments);
757
1191
  }
758
- function p() {
1192
+ function be() {
759
1193
  if ("undefined" == typeof Reflect || !Reflect.construct)
760
1194
  return !1;
761
1195
  if (Reflect.construct.sham)
@@ -769,18 +1203,25 @@ function p() {
769
1203
  return !1;
770
1204
  }
771
1205
  }
772
- function _(e, t) {
773
- return _ = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) {
1206
+ function ge(e, t) {
1207
+ return ge = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) {
774
1208
  return e.__proto__ = t, e;
775
- }, _(e, t);
1209
+ }, ge(e, t);
776
1210
  }
777
- function m(e) {
778
- return m = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) {
1211
+ function ye(e) {
1212
+ return ye = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) {
779
1213
  return e.__proto__ || Object.getPrototypeOf(e);
780
- }, m(e);
1214
+ }, ye(e);
781
1215
  }
782
- var f, v, b, g, y, k;
783
- function S(e, t, r, n) {
1216
+ !function (e) {
1217
+ e.emailMagicLinks = "emailMagicLinks", e.sso = "sso", e.passwords = "passwords", e.oauth = "oauth";
1218
+ }(b || (b = {})), function (e) {
1219
+ e.Discovery = "Discovery", e.Organization = "Organization", e.PasswordReset = "PasswordReset";
1220
+ }(g || (g = {})), function (e) {
1221
+ e.Google = "google", e.Microsoft = "microsoft";
1222
+ }(y || (y = {}));
1223
+ var ke;
1224
+ function we(e, t, r, n) {
784
1225
  return new (r || (r = Promise))(function (i, o) {
785
1226
  function s(e) {
786
1227
  try {
@@ -807,196 +1248,148 @@ function S(e, t, r, n) {
807
1248
  c((n = n.apply(e, t || [])).next());
808
1249
  });
809
1250
  }
810
- "function" == typeof SuppressedError && SuppressedError, function (e) {
811
- e.emailMagicLinks = "emailMagicLinks", e.oauth = "oauth", e.otp = "otp", e.crypto = "crypto", e.passwords = "passwords", e.passkeys = "passkeys";
812
- }(f || (f = {})), function (e) {
813
- e.Google = "google", e.Microsoft = "microsoft", e.Apple = "apple", e.Github = "github", e.GitLab = "gitlab", e.Facebook = "facebook", e.Discord = "discord", e.Salesforce = "salesforce", e.Slack = "slack", e.Amazon = "amazon", e.Bitbucket = "bitbucket", e.LinkedIn = "linkedin", e.Coinbase = "coinbase", e.Twitch = "twitch", e.Twitter = "twitter", e.TikTok = "tiktok", e.Snapchat = "snapchat", e.Figma = "figma", e.Yahoo = "yahoo";
814
- }(v || (v = {})), function (e) {
815
- e.Vessel = "Vessel", e.Phantom = "Phantom", e.Metamask = "Metamask", e.Coinbase = "Coinbase", e.Binance = "Binance", e.GenericEthereumWallet = "Other Ethereum Wallet", e.GenericSolanaWallet = "Other Solana Wallet";
816
- }(b || (b = {})), function (e) {
817
- e.embedded = "embedded", e.floating = "floating";
818
- }(g || (g = {})), function (e) {
819
- e.SMS = "sms", e.WhatsApp = "whatsapp", e.Email = "email";
820
- }(y || (y = {})), function (e) {
821
- e.MagicLinkLoginOrCreateEvent = "MAGIC_LINK_LOGIN_OR_CREATE", e.OTPsLoginOrCreateEvent = "OTP_LOGIN_OR_CREATE", e.OTPsAuthenticate = "OTP_AUTHENTICATE", e.CryptoWalletAuthenticateStart = "CRYPTO_WALLET_AUTHENTICATE_START", e.CryptoWalletAuthenticate = "CRYPTO_WALLET_AUTHENTICATE", e.PasswordCreate = "PASSWORD_CREATE", e.PasswordAuthenticate = "PASSWORD_AUTHENTICATE", e.PasswordResetByEmailStart = "PASSWORD_RESET_BY_EMAIL_START", e.PasswordResetByEmail = "PASSWORD_RESET_BY_EMAIL", e.PasskeyRegister = "PASSKEY_REGISTER", e.PasskeyAuthenticate = "PASSKEY_AUTHENTICATE", e.PasskeySkip = "PASSKEY_SKIP", e.PasskeyDone = "PASSKEY_DONE", e.B2BMagicLinkEmailLoginOrSignup = "B2B_MAGIC_LINK_EMAIL_LOGIN_OR_SIGNUP", e.B2BMagicLinkAuthenticate = "B2B_MAGIC_LINK_AUTHENTICATE", e.B2BMagicLinkEmailDiscoverySend = "B2B_MAGIC_LINK_EMAIL_DISCOVERY_SEND", e.B2BMagicLinkDiscoveryAuthenticate = "B2B_MAGIC_LINK_DISCOVERY_AUTHENTICATE", e.B2BSSOStart = "B2B_SSO_START", e.B2BSSOAuthenticate = "B2B_SSO_AUTHENTICATE", e.B2BOAuthAuthenticate = "B2B_SSO_AUTHENTICATE", e.B2BOAuthDiscoveryAuthenticate = "B2B_OAUTH_DISCOVERY_AUTHENTICATE", e.B2BDiscoveryOrganizationsCreate = "B2B_DISCOVERY_ORGANIZATIONS_CREATE", e.B2BDiscoveryIntermediateSessionExchange = "B2B_DISCOVERY_INTERMEDIATE_SESSION_EXCHANGE", e.B2BPasswordAuthenticate = "B2B_PASSWORD_AUTHENTICATE", e.B2BPasswordResetByEmailStart = "B2B_PASSWORD_RESET_BY_EMAIL_START", e.B2BPasswordResetByEmail = "B2B_PASSWORD_RESET_BY_EMAIL", e.B2BPasswordResetBySession = "B2B_PASSWORD_RESET_BY_SESSION";
822
- }(k || (k = {}));
823
- var w, A, E, T, O, P = function (e) {
824
- c(r, d(Error));
825
- var t = u(r);
826
- function r(e, n) {
827
- var i;
828
- return a(this, r), (i = t.call(this, e + "\n" + n)).message = e + "\n" + n, i.name = "SDKAPIUnreachableError", i.details = n, Object.setPrototypeOf(l(i), r.prototype), i;
829
- }
830
- return s(r);
831
- }(), C = function (e) {
832
- c(r, d(Error));
833
- var t = u(r);
834
- function r(e, n) {
835
- var i;
836
- return a(this, r), (i = t.call(this)).name = "StytchSDKUsageError", i.message = "Invalid call to ".concat(e, "\n") + n, i;
837
- }
838
- return s(r);
839
- }(), B = function (e) {
840
- c(r, d(Error));
841
- var t = u(r);
842
- function r(e) {
843
- var n, i;
844
- a(this, r), (n = t.call(this)).name = "StytchSDKSchemaError";
845
- var o = null === (i = e.body) || void 0 === i ? void 0 : i.map(function (e) {
846
- return "".concat(e.dataPath, ": ").concat(e.message);
847
- }).join("\n");
848
- return n.message = "[400] Request does not match expected schema\n".concat(o), n;
849
- }
850
- return s(r);
851
- }(), R = function (e) {
852
- c(r, d(Error));
853
- var t = u(r);
854
- function r(e) {
855
- var n;
856
- a(this, r), (n = t.call(this)).name = "StytchSDKAPIError";
857
- var i = e.status_code, o = e.error_type, s = e.error_message, c = e.error_url, u = e.request_id;
858
- return n.error_type = o, n.error_message = s, n.error_url = c, n.request_id = u, n.status_code = i, n.message = "[".concat(i, "] ").concat(o, "\n") + "".concat(s, "\n") + "See ".concat(c, " for more information.\n") + (u ? "request_id: ".concat(u, "\n") : ""), n;
859
- }
860
- return s(r);
861
- }(), x = ["unauthorized_credentials", "user_unauthenticated", "invalid_secret_authentication", "session_not_found"];
862
- !function (e) {
863
- e.BiometricsSensorError = "biometrics_sensor_error", e.DeviceCredentialsNotAllowed = "device_credentials_not_allowed", e.DeviceHardwareError = "device_hardware_error", e.InternalError = "internal_error", e.KeyInvalidated = "key_invalidated", e.KeystoreUnavailable = "keystore_unavailable", e.NoBiometricsEnrolled = "no_biometrics_enrolled", e.NoBiometricsRegistration = "no_biometrics_registration", e.SessionExpired = "session_expired", e.UserCancellation = "user_cancellation", e.UserLockedOut = "user_locked_out", e.BiometricsNotAvailable = "biometrics_not_available";
864
- }(w || (w = {})), function (e) {
865
- e.emailMagicLinks = "emailMagicLinks", e.sso = "sso", e.passwords = "passwords", e.oauth = "oauth";
866
- }(A || (A = {})), function (e) {
867
- e.Discovery = "Discovery", e.Organization = "Organization", e.PasswordReset = "PasswordReset";
868
- }(E || (E = {})), function (e) {
869
- e.Google = "google", e.Microsoft = "microsoft";
870
- }(T || (T = {})), (O || (O = {})).RequiredCatcha = "Catcha Required";
871
- var I, D = function (e) {
872
- c(r, d(Error));
873
- var t = u(r);
1251
+ "function" == typeof SuppressedError && SuppressedError, (ke || (ke = {})).RequiredCatcha = "Catcha Required";
1252
+ var Se, Pe = function (e) {
1253
+ !function (e, t) {
1254
+ if ("function" != typeof t && null !== t)
1255
+ throw new TypeError("Super expression must either be null or a function");
1256
+ e.prototype = Object.create(t && t.prototype, {
1257
+ constructor: {
1258
+ value: e,
1259
+ writable: !0,
1260
+ configurable: !0
1261
+ }
1262
+ }), Object.defineProperty(e, "prototype", {
1263
+ writable: !1
1264
+ }), t && ge(e, t);
1265
+ }(r, me(Error));
1266
+ var t = fe(r);
874
1267
  function r(e) {
875
1268
  var n;
876
- return a(this, r), (n = t.call(this, e)).type = e, n;
1269
+ return _e(this, r), (n = t.call(this, e)).type = e, n;
877
1270
  }
878
- return s(r);
1271
+ return pe(r);
879
1272
  }();
880
- function L(e) {
881
- var t = e.method, r = e.errorMessage, n = e.finalURL, o = e.basicAuthHeader, s = e.xSDKClientHeader, a = e.xSDKParentHostHeader, c = e.body;
882
- return S(this, void 0, void 0, i().mark(function e() {
883
- var u, l, d, h, p, _;
884
- return i().wrap(function (e) {
1273
+ function Ae(e) {
1274
+ var t, r = e.method, n = e.finalURL, i = e.basicAuthHeader, o = e.xSDKClientHeader, s = e.xSDKParentHostHeader, a = e.body;
1275
+ return we(this, void 0, void 0, de().mark(function e() {
1276
+ var c, u, l, d, h, p;
1277
+ return de().wrap(function (e) {
885
1278
  for (;;)
886
1279
  switch (e.prev = e.next) {
887
1280
  case 0:
888
- return u = {
889
- Authorization: o,
1281
+ return c = {
1282
+ Authorization: i,
890
1283
  "Content-Type": "application/json",
891
- "X-SDK-Client": s
892
- }, a && (u["X-SDK-Parent-Host"] = a), l = {
893
- method: t,
894
- headers: u,
895
- body: c && JSON.stringify(c)
896
- }, e.prev = 3, e.next = 6, fetch(n, l);
1284
+ "X-SDK-Client": o
1285
+ }, s && (c["X-SDK-Parent-Host"] = s), u = {
1286
+ method: r,
1287
+ headers: c,
1288
+ body: a && JSON.stringify(a)
1289
+ }, e.prev = 3, e.next = 6, fetch(n, u);
897
1290
  case 6:
898
- d = e.sent, e.next = 14;
1291
+ l = e.sent, e.next = 14;
899
1292
  break;
900
1293
  case 9:
901
1294
  if (e.prev = 9, e.t0 = e["catch"](3), "Failed to fetch" !== e.t0.message) {
902
1295
  e.next = 13;
903
1296
  break;
904
1297
  }
905
- throw new P(r, "Unable to contact the Stytch servers. Are you online?");
1298
+ throw new T("Unable to contact the Stytch servers. Are you online?");
906
1299
  case 13:
907
1300
  throw e.t0;
908
1301
  case 14:
909
- if (403 !== d.status) {
910
- e.next = 27;
1302
+ if (!(l.status <= 299)) {
1303
+ e.next = 25;
911
1304
  break;
912
1305
  }
913
- return e.prev = 15, e.next = 18, d.text();
1306
+ return e.prev = 15, e.next = 18, l.json();
914
1307
  case 18:
915
- h = e.sent, e.next = 24;
916
- break;
917
- case 21:
918
- throw e.prev = 21, e.t1 = e["catch"](15), new P(r, "Invalid response from the Stytch servers.");
919
- case 24:
920
- if (!h.includes("Captcha required")) {
921
- e.next = 26;
1308
+ return d = e.sent, e.abrupt("return", d.data);
1309
+ case 22:
1310
+ throw e.prev = 22, e.t1 = e["catch"](15), new T("Invalid JSON response from the Stytch servers.");
1311
+ case 25:
1312
+ if (200 === l.status || !(null === (t = l.headers.get("content-type")) || void 0 === t ? void 0 : t.includes("application/json"))) {
1313
+ e.next = 38;
922
1314
  break;
923
1315
  }
924
- throw new D(O.RequiredCatcha);
925
- case 26:
926
- throw new P(r, "Invalid response from the Stytch servers.");
927
- case 27:
928
- if (200 === d.status) {
929
- e.next = 40;
1316
+ return e.prev = 26, e.next = 29, l.json();
1317
+ case 29:
1318
+ h = e.sent, e.next = 35;
1319
+ break;
1320
+ case 32:
1321
+ throw e.prev = 32, e.t2 = e["catch"](26), new T("Invalid or no response from server");
1322
+ case 35:
1323
+ if (!("body" in h || "params" in h || "query" in h)) {
1324
+ e.next = 37;
930
1325
  break;
931
1326
  }
932
- return e.prev = 28, e.next = 31, d.json();
933
- case 31:
934
- p = e.sent, e.next = 37;
935
- break;
936
- case 34:
937
- throw e.prev = 34, e.t2 = e["catch"](28), new P(r, "Invalid or no response from server");
1327
+ throw new O(h);
938
1328
  case 37:
939
- if (!("body" in p || "params" in p || "query" in p)) {
940
- e.next = 39;
1329
+ throw new E(h);
1330
+ case 38:
1331
+ return e.prev = 38, e.next = 41, l.text();
1332
+ case 41:
1333
+ p = e.sent, e.next = 47;
1334
+ break;
1335
+ case 44:
1336
+ throw e.prev = 44, e.t3 = e["catch"](38), new T("Invalid response from the Stytch servers.");
1337
+ case 47:
1338
+ if (!p.includes("Captcha required")) {
1339
+ e.next = 49;
941
1340
  break;
942
1341
  }
943
- throw new B(p);
944
- case 39:
945
- throw new R(p);
946
- case 40:
947
- return e.prev = 40, e.next = 43, d.json();
948
- case 43:
949
- return _ = e.sent, e.abrupt("return", _.data);
950
- case 47:
951
- throw e.prev = 47, e.t3 = e["catch"](40), new P(r, "Invalid response from the Stytch servers.");
1342
+ throw new Pe(ke.RequiredCatcha);
1343
+ case 49:
1344
+ throw new T("Invalid response from the Stytch servers.");
952
1345
  case 50:
953
1346
  case "end":
954
1347
  return e.stop();
955
1348
  }
956
- }, e, null, [[3, 9], [15, 21], [28, 34], [40, 47]]);
1349
+ }, e, null, [[3, 9], [15, 22], [26, 32], [38, 44]]);
957
1350
  }));
958
1351
  }
959
- var M = new Uint8Array(16);
960
- function N() {
961
- if (!I && !(I = "undefined" != typeof crypto && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || "undefined" != typeof msCrypto && "function" == typeof msCrypto.getRandomValues && msCrypto.getRandomValues.bind(msCrypto)))
1352
+ var Ce = new Uint8Array(16);
1353
+ function Te() {
1354
+ if (!Se && !(Se = "undefined" != typeof crypto && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || "undefined" != typeof msCrypto && "function" == typeof msCrypto.getRandomValues && msCrypto.getRandomValues.bind(msCrypto)))
962
1355
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
963
- return I(M);
1356
+ return Se(Ce);
964
1357
  }
965
- var j = /^(?:[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;
966
- for (var F = [], K = 0; K < 256; ++K)
967
- F.push((K + 256).toString(16).substr(1));
968
- function U(e) {
969
- var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, r = (F[e[t + 0]] + F[e[t + 1]] + F[e[t + 2]] + F[e[t + 3]] + "-" + F[e[t + 4]] + F[e[t + 5]] + "-" + F[e[t + 6]] + F[e[t + 7]] + "-" + F[e[t + 8]] + F[e[t + 9]] + "-" + F[e[t + 10]] + F[e[t + 11]] + F[e[t + 12]] + F[e[t + 13]] + F[e[t + 14]] + F[e[t + 15]]).toLowerCase();
1358
+ var Oe = /^(?:[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;
1359
+ for (var Ee = [], xe = 0; xe < 256; ++xe)
1360
+ Ee.push((xe + 256).toString(16).substr(1));
1361
+ function De(e) {
1362
+ var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, r = (Ee[e[t + 0]] + Ee[e[t + 1]] + Ee[e[t + 2]] + Ee[e[t + 3]] + "-" + Ee[e[t + 4]] + Ee[e[t + 5]] + "-" + Ee[e[t + 6]] + Ee[e[t + 7]] + "-" + Ee[e[t + 8]] + Ee[e[t + 9]] + "-" + Ee[e[t + 10]] + Ee[e[t + 11]] + Ee[e[t + 12]] + Ee[e[t + 13]] + Ee[e[t + 14]] + Ee[e[t + 15]]).toLowerCase();
970
1363
  if (!function (e) {
971
- return "string" == typeof e && j.test(e);
1364
+ return "string" == typeof e && Oe.test(e);
972
1365
  }(r))
973
1366
  throw TypeError("Stringified UUID is invalid");
974
1367
  return r;
975
1368
  }
976
- function z(e, t, r) {
977
- var n = (e = e || {}).random || (e.rng || N)();
1369
+ function Re(e, t, r) {
1370
+ var n = (e = e || {}).random || (e.rng || Te)();
978
1371
  if (n[6] = 15 & n[6] | 64, n[8] = 63 & n[8] | 128, t) {
979
1372
  r = r || 0;
980
1373
  for (var i = 0; i < 16; ++i)
981
1374
  t[r + i] = n[i];
982
1375
  return t;
983
1376
  }
984
- return U(n);
1377
+ return De(n);
985
1378
  }
986
- var W = {};
987
- function G(e, t) {
988
- return S(this, void 0, void 0, i().mark(function r() {
989
- return i().wrap(function (r) {
1379
+ var Ie = {};
1380
+ function Be(e, t) {
1381
+ return we(this, void 0, void 0, de().mark(function r() {
1382
+ return de().wrap(function (r) {
990
1383
  for (;;)
991
1384
  switch (r.prev = r.next) {
992
1385
  case 0:
993
- if (void 0 === W[e]) {
1386
+ if (void 0 === Ie[e]) {
994
1387
  r.next = 2;
995
1388
  break;
996
1389
  }
997
- return r.abrupt("return", W[e]);
1390
+ return r.abrupt("return", Ie[e]);
998
1391
  case 2:
999
- return W[e] = H(e, t), r.abrupt("return", W[e]);
1392
+ return Ie[e] = Le(e, t), r.abrupt("return", Ie[e]);
1000
1393
  case 4:
1001
1394
  case "end":
1002
1395
  return r.stop();
@@ -1004,10 +1397,10 @@ function G(e, t) {
1004
1397
  }, r);
1005
1398
  }));
1006
1399
  }
1007
- function H(e, t) {
1400
+ function Le(e, t) {
1008
1401
  return new Promise(function (r, n) {
1009
1402
  var i = function (e) {
1010
- var t = q(e);
1403
+ var t = Me(e);
1011
1404
  if (t[0])
1012
1405
  return t[0];
1013
1406
  }(e);
@@ -1035,130 +1428,130 @@ function H(e, t) {
1035
1428
  });
1036
1429
  });
1037
1430
  }
1038
- var q = function q(e) {
1431
+ var Me = function Me(e) {
1039
1432
  return document.querySelectorAll('script[src="'.concat(e, '"]'));
1040
1433
  };
1041
- var Y, V = ["[Stytch]"], $ = function $() {
1434
+ var je, Fe = ["[Stytch]"], Ne = function Ne() {
1042
1435
  for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++)
1043
1436
  r[n] = arguments[n];
1044
- return (e = console).warn.apply(e, V.concat(r));
1045
- }, J = function J() {
1437
+ return (e = console).warn.apply(e, Fe.concat(r));
1438
+ }, Ke = function Ke() {
1046
1439
  for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++)
1047
1440
  r[n] = arguments[n];
1048
- return (e = console).error.apply(e, V.concat(r));
1049
- }, X = "\nYou can find your public token at https://stytch.com/dashboard/api-keys.", Z = function Z(e) {
1441
+ return (e = console).error.apply(e, Fe.concat(r));
1442
+ }, Ue = "\nYou can find your public token at https://stytch.com/dashboard/api-keys.", ze = function ze(e) {
1050
1443
  return e.includes("public-token-test");
1051
- }, Q = function Q(e) {
1052
- var r = {
1053
- isObject: function isObject(t, i) {
1054
- var o = "object" === n(i) && !Array.isArray(i) && null !== i;
1055
- if (!o)
1056
- throw new C(e, t + " must be an object.");
1057
- return r;
1444
+ }, qe = function qe(e) {
1445
+ var t = {
1446
+ isObject: function isObject(r, n) {
1447
+ var i = "object" === le(n) && !Array.isArray(n) && null !== n;
1448
+ if (!i)
1449
+ throw new w(e, r + " must be an object.");
1450
+ return t;
1058
1451
  },
1059
- isOptionalObject: function isOptionalObject(e, t) {
1060
- return void 0 === t ? r : r.isObject(e, t);
1452
+ isOptionalObject: function isOptionalObject(e, r) {
1453
+ return void 0 === r ? t : t.isObject(e, r);
1061
1454
  },
1062
- isString: function isString(t, n) {
1455
+ isString: function isString(r, n) {
1063
1456
  if ("string" != typeof n)
1064
- throw new C(e, t + " must be a string.");
1065
- return r;
1457
+ throw new w(e, r + " must be a string.");
1458
+ return t;
1066
1459
  },
1067
- isOptionalString: function isOptionalString(e, t) {
1068
- return void 0 === t ? r : r.isString(e, t);
1460
+ isOptionalString: function isOptionalString(e, r) {
1461
+ return void 0 === r ? t : t.isString(e, r);
1069
1462
  },
1070
- isStringArray: function isStringArray(n, i) {
1071
- if (!Array.isArray(i))
1072
- throw new C(e, n + " must be an array of strings.");
1073
- var o, s = function (e, r) {
1074
- var _n = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
1075
- if (!_n) {
1076
- if (Array.isArray(e) || (_n = t(e)) || r && e && "number" == typeof e.length) {
1077
- _n && (e = _n);
1078
- var i = 0, o = function o() { };
1463
+ isStringArray: function isStringArray(r, n) {
1464
+ if (!Array.isArray(n))
1465
+ throw new w(e, r + " must be an array of strings.");
1466
+ var i, o = function (e, t) {
1467
+ var r = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
1468
+ if (!r) {
1469
+ if (Array.isArray(e) || (r = ce(e)) || t && e && "number" == typeof e.length) {
1470
+ r && (e = r);
1471
+ var _n = 0, i = function i() { };
1079
1472
  return {
1080
- s: o,
1473
+ s: i,
1081
1474
  n: function n() {
1082
- return i >= e.length ? {
1475
+ return _n >= e.length ? {
1083
1476
  done: !0
1084
1477
  } : {
1085
1478
  done: !1,
1086
- value: e[i++]
1479
+ value: e[_n++]
1087
1480
  };
1088
1481
  },
1089
1482
  e: function e(_e2) {
1090
1483
  throw _e2;
1091
1484
  },
1092
- f: o
1485
+ f: i
1093
1486
  };
1094
1487
  }
1095
1488
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1096
1489
  }
1097
- var s, a = !0, c = !1;
1490
+ var o, s = !0, a = !1;
1098
1491
  return {
1099
1492
  s: function s() {
1100
- _n = _n.call(e);
1493
+ r = r.call(e);
1101
1494
  },
1102
1495
  n: function n() {
1103
- var e = _n.next();
1104
- return a = e.done, e;
1496
+ var e = r.next();
1497
+ return s = e.done, e;
1105
1498
  },
1106
1499
  e: function e(_e3) {
1107
- c = !0, s = _e3;
1500
+ a = !0, o = _e3;
1108
1501
  },
1109
1502
  f: function f() {
1110
1503
  try {
1111
- a || null == _n["return"] || _n["return"]();
1504
+ s || null == r["return"] || r["return"]();
1112
1505
  }
1113
1506
  finally {
1114
- if (c)
1115
- throw s;
1507
+ if (a)
1508
+ throw o;
1116
1509
  }
1117
1510
  }
1118
1511
  };
1119
- }(i);
1512
+ }(n);
1120
1513
  try {
1121
- for (s.s(); !(o = s.n()).done;) {
1122
- if ("string" != typeof o.value)
1123
- throw new C(e, n + " must be an array of strings.");
1514
+ for (o.s(); !(i = o.n()).done;) {
1515
+ if ("string" != typeof i.value)
1516
+ throw new w(e, r + " must be an array of strings.");
1124
1517
  }
1125
1518
  }
1126
1519
  catch (e) {
1127
- s.e(e);
1520
+ o.e(e);
1128
1521
  }
1129
1522
  finally {
1130
- s.f();
1523
+ o.f();
1131
1524
  }
1132
- return r;
1525
+ return t;
1133
1526
  },
1134
- isOptionalStringArray: function isOptionalStringArray(e, t) {
1135
- return void 0 === t ? r : r.isStringArray(e, t);
1527
+ isOptionalStringArray: function isOptionalStringArray(e, r) {
1528
+ return void 0 === r ? t : t.isStringArray(e, r);
1136
1529
  },
1137
- isNumber: function isNumber(t, n) {
1530
+ isNumber: function isNumber(r, n) {
1138
1531
  if ("number" != typeof n)
1139
- throw new C(e, t + " must be a number.");
1140
- return r;
1532
+ throw new w(e, r + " must be a number.");
1533
+ return t;
1141
1534
  },
1142
- isOptionalNumber: function isOptionalNumber(e, t) {
1143
- return void 0 === t ? r : r.isNumber(e, t);
1535
+ isOptionalNumber: function isOptionalNumber(e, r) {
1536
+ return void 0 === r ? t : t.isNumber(e, r);
1144
1537
  },
1145
- isBoolean: function isBoolean(t, n) {
1538
+ isBoolean: function isBoolean(r, n) {
1146
1539
  if ("boolean" != typeof n)
1147
- throw new C(e, t + " must be a boolean.");
1148
- return r;
1540
+ throw new w(e, r + " must be a boolean.");
1541
+ return t;
1149
1542
  },
1150
- isOptionalBoolean: function isOptionalBoolean(e, t) {
1151
- return void 0 === t ? r : r.isBoolean(e, t);
1543
+ isOptionalBoolean: function isOptionalBoolean(e, r) {
1544
+ return void 0 === r ? t : t.isBoolean(e, r);
1152
1545
  }
1153
1546
  };
1154
- return r;
1155
- }, ee = s(function e(t, r, n) {
1156
- var o = this, s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : function () {
1547
+ return t;
1548
+ }, We = pe(function e(t, r, n) {
1549
+ var i = this, o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : function () {
1157
1550
  return Promise.resolve(void 0);
1158
1551
  };
1159
- a(this, e), this.bootstrapPromise = n, this.isEnabled = function () {
1160
- return S(o, void 0, void 0, i().mark(function e() {
1161
- return i().wrap(function (e) {
1552
+ _e(this, e), this.bootstrapPromise = n, this.isEnabled = function () {
1553
+ return we(i, void 0, void 0, de().mark(function e() {
1554
+ return de().wrap(function (e) {
1162
1555
  for (;;)
1163
1556
  switch (e.prev = e.next) {
1164
1557
  case 0:
@@ -1172,21 +1565,21 @@ var Y, V = ["[Stytch]"], $ = function $() {
1172
1565
  }, e, this);
1173
1566
  }));
1174
1567
  }, this.getTelemetryID = function () {
1175
- return S(o, void 0, void 0, i().mark(function e() {
1176
- var t, r, n, o;
1177
- return i().wrap(function (e) {
1568
+ return we(i, void 0, void 0, de().mark(function e() {
1569
+ var t, r, n, i;
1570
+ return de().wrap(function (e) {
1178
1571
  for (;;)
1179
1572
  switch (e.prev = e.next) {
1180
1573
  case 0:
1181
1574
  return e.next = 2, this.state;
1182
1575
  case 2:
1183
- if (t = e.sent, r = t.publicToken, n = t.enabled, o = t.dfpBackendURL, n) {
1576
+ if (t = e.sent, r = t.publicToken, n = t.enabled, i = t.dfpBackendURL, n) {
1184
1577
  e.next = 8;
1185
1578
  break;
1186
1579
  }
1187
1580
  return e.abrupt("return", void 0);
1188
1581
  case 8:
1189
- return e.next = 10, window.GetTelemetryID(r, "".concat(o, "/submit"));
1582
+ return e.next = 10, window.GetTelemetryID(r, "".concat(i, "/submit"));
1190
1583
  case 10:
1191
1584
  return e.abrupt("return", e.sent);
1192
1585
  case 11:
@@ -1196,44 +1589,44 @@ var Y, V = ["[Stytch]"], $ = function $() {
1196
1589
  }, e, this);
1197
1590
  }));
1198
1591
  }, this.getDFPTelemetryIDAndCaptcha = function () {
1199
- return S(o, void 0, void 0, i().mark(function e() {
1200
- var t, r, n, o, s, a;
1201
- return i().wrap(function (e) {
1592
+ return we(i, void 0, void 0, de().mark(function e() {
1593
+ var t, r, n, i, o, s;
1594
+ return de().wrap(function (e) {
1202
1595
  for (;;)
1203
1596
  switch (e.prev = e.next) {
1204
1597
  case 0:
1205
1598
  return e.next = 2, this.state;
1206
1599
  case 2:
1207
- if (t = e.sent, r = t.enabled, n = t.executeRecaptcha, o = t.mode, s = void 0, a = void 0, r) {
1600
+ if (t = e.sent, r = t.enabled, n = t.executeRecaptcha, i = t.mode, o = void 0, s = void 0, r) {
1208
1601
  e.next = 12;
1209
1602
  break;
1210
1603
  }
1211
1604
  return e.next = 11, n();
1212
1605
  case 11:
1213
- a = e.sent;
1606
+ s = e.sent;
1214
1607
  case 12:
1215
- if ("DECISIONING" !== o) {
1608
+ if ("DECISIONING" !== i) {
1216
1609
  e.next = 18;
1217
1610
  break;
1218
1611
  }
1219
1612
  return e.next = 15, this.getTelemetryID();
1220
1613
  case 15:
1221
- s = e.sent, e.next = 25;
1614
+ o = e.sent, e.next = 25;
1222
1615
  break;
1223
1616
  case 18:
1224
- if ("OBSERVATION" !== o) {
1617
+ if ("OBSERVATION" !== i) {
1225
1618
  e.next = 25;
1226
1619
  break;
1227
1620
  }
1228
1621
  return e.next = 21, this.getTelemetryID();
1229
1622
  case 21:
1230
- return s = e.sent, e.next = 24, n();
1623
+ return o = e.sent, e.next = 24, n();
1231
1624
  case 24:
1232
- a = e.sent;
1625
+ s = e.sent;
1233
1626
  case 25:
1234
1627
  return e.abrupt("return", {
1235
- dfp_telemetry_id: s,
1236
- captcha_token: a
1628
+ dfp_telemetry_id: o,
1629
+ captcha_token: s
1237
1630
  });
1238
1631
  case 26:
1239
1632
  case "end":
@@ -1242,15 +1635,15 @@ var Y, V = ["[Stytch]"], $ = function $() {
1242
1635
  }, e, this);
1243
1636
  }));
1244
1637
  }, this.retryWithCaptchaAndDFP = function (e, t) {
1245
- return S(o, void 0, void 0, i().mark(function r() {
1246
- var n, o, s;
1247
- return i().wrap(function (r) {
1638
+ return we(i, void 0, void 0, de().mark(function r() {
1639
+ var n, i, o;
1640
+ return de().wrap(function (r) {
1248
1641
  for (;;)
1249
1642
  switch (r.prev = r.next) {
1250
1643
  case 0:
1251
1644
  return r.next = 2, this.state;
1252
1645
  case 2:
1253
- if (n = r.sent, o = n.enabled, s = n.executeRecaptcha, e.type !== O.RequiredCatcha || !o) {
1646
+ if (n = r.sent, i = n.enabled, o = n.executeRecaptcha, e.type !== ke.RequiredCatcha || !i) {
1254
1647
  r.next = 14;
1255
1648
  break;
1256
1649
  }
@@ -1260,7 +1653,7 @@ var Y, V = ["[Stytch]"], $ = function $() {
1260
1653
  }
1261
1654
  return r.next = 9, this.getTelemetryID();
1262
1655
  case 9:
1263
- return t.body.dfp_telemetry_id = r.sent, r.next = 12, s();
1656
+ return t.body.dfp_telemetry_id = r.sent, r.next = 12, o();
1264
1657
  case 12:
1265
1658
  t.body.captcha_token = r.sent;
1266
1659
  case 13:
@@ -1274,8 +1667,8 @@ var Y, V = ["[Stytch]"], $ = function $() {
1274
1667
  }, r, this);
1275
1668
  }));
1276
1669
  }, this.state = n.then(function (e) {
1277
- return S(o, void 0, void 0, i().mark(function n() {
1278
- return i().wrap(function (n) {
1670
+ return we(i, void 0, void 0, de().mark(function n() {
1671
+ return de().wrap(function (n) {
1279
1672
  for (;;)
1280
1673
  switch (n.prev = n.next) {
1281
1674
  case 0:
@@ -1288,10 +1681,10 @@ var Y, V = ["[Stytch]"], $ = function $() {
1288
1681
  dfpBackendURL: r,
1289
1682
  enabled: !1,
1290
1683
  loaded: !1,
1291
- executeRecaptcha: s
1684
+ executeRecaptcha: o
1292
1685
  });
1293
1686
  case 2:
1294
- return n.next = 4, void G("".concat("https://elements.stytch.com", "/telemetry.js"), function () {
1687
+ return n.next = 4, void Be("".concat("https://elements.stytch.com", "/telemetry.js"), function () {
1295
1688
  return window;
1296
1689
  });
1297
1690
  case 4:
@@ -1301,7 +1694,7 @@ var Y, V = ["[Stytch]"], $ = function $() {
1301
1694
  enabled: !0,
1302
1695
  mode: e.dfpProtectedAuthMode || "OBSERVATION",
1303
1696
  loaded: !0,
1304
- executeRecaptcha: s
1697
+ executeRecaptcha: o
1305
1698
  });
1306
1699
  case 5:
1307
1700
  case "end":
@@ -1310,11 +1703,11 @@ var Y, V = ["[Stytch]"], $ = function $() {
1310
1703
  }, n);
1311
1704
  }));
1312
1705
  });
1313
- }), te = function te() {
1706
+ }), Ge = function Ge() {
1314
1707
  return {
1315
1708
  isEnabled: function isEnabled() {
1316
- return S(void 0, void 0, void 0, i().mark(function e() {
1317
- return i().wrap(function (e) {
1709
+ return we(void 0, void 0, void 0, de().mark(function e() {
1710
+ return de().wrap(function (e) {
1318
1711
  for (;;)
1319
1712
  switch (e.prev = e.next) {
1320
1713
  case 0:
@@ -1327,8 +1720,8 @@ var Y, V = ["[Stytch]"], $ = function $() {
1327
1720
  }));
1328
1721
  },
1329
1722
  getTelemetryID: function getTelemetryID() {
1330
- return S(void 0, void 0, void 0, i().mark(function e() {
1331
- return i().wrap(function (e) {
1723
+ return we(void 0, void 0, void 0, de().mark(function e() {
1724
+ return de().wrap(function (e) {
1332
1725
  for (;;)
1333
1726
  switch (e.prev = e.next) {
1334
1727
  case 0:
@@ -1341,8 +1734,8 @@ var Y, V = ["[Stytch]"], $ = function $() {
1341
1734
  }));
1342
1735
  },
1343
1736
  getDFPTelemetryIDAndCaptcha: function getDFPTelemetryIDAndCaptcha() {
1344
- return S(void 0, void 0, void 0, i().mark(function e() {
1345
- return i().wrap(function (e) {
1737
+ return we(void 0, void 0, void 0, de().mark(function e() {
1738
+ return de().wrap(function (e) {
1346
1739
  for (;;)
1347
1740
  switch (e.prev = e.next) {
1348
1741
  case 0:
@@ -1358,8 +1751,8 @@ var Y, V = ["[Stytch]"], $ = function $() {
1358
1751
  }));
1359
1752
  },
1360
1753
  retryWithCaptchaAndDFP: function retryWithCaptchaAndDFP() {
1361
- return S(void 0, void 0, void 0, i().mark(function e() {
1362
- return i().wrap(function (e) {
1754
+ return we(void 0, void 0, void 0, de().mark(function e() {
1755
+ return de().wrap(function (e) {
1363
1756
  for (;;)
1364
1757
  switch (e.prev = e.next) {
1365
1758
  case 0:
@@ -1372,11 +1765,11 @@ var Y, V = ["[Stytch]"], $ = function $() {
1372
1765
  }));
1373
1766
  }
1374
1767
  };
1375
- }, re = function () {
1768
+ }, He = function () {
1376
1769
  function e(t) {
1377
- a(this, e), this.maxBatchSize = t.maxBatchSize, this.logEventURL = t.logEventURL, setInterval(this.flush.bind(this), t.intervalDurationMs), this.batch = [];
1770
+ _e(this, e), this.maxBatchSize = t.maxBatchSize, this.logEventURL = t.logEventURL, setInterval(this.flush.bind(this), t.intervalDurationMs), this.batch = [];
1378
1771
  }
1379
- return s(e, [{
1772
+ return pe(e, [{
1380
1773
  key: "logEvent",
1381
1774
  value: function value(e, t) {
1382
1775
  this.batch.push({
@@ -1387,9 +1780,9 @@ var Y, V = ["[Stytch]"], $ = function $() {
1387
1780
  }, {
1388
1781
  key: "flush",
1389
1782
  value: function value() {
1390
- return S(this, void 0, void 0, i().mark(function e() {
1783
+ return we(this, void 0, void 0, de().mark(function e() {
1391
1784
  var t;
1392
- return i().wrap(function (e) {
1785
+ return de().wrap(function (e) {
1393
1786
  for (;;)
1394
1787
  switch (e.prev = e.next) {
1395
1788
  case 0:
@@ -1422,25 +1815,44 @@ var Y, V = ["[Stytch]"], $ = function $() {
1422
1815
  }();
1423
1816
  !function (e) {
1424
1817
  e.LoginOrCreateEML = "login_or_create_eml", e.LoginOrCreateOTP = "login_or_create_otp", e.ResetPassword = "reset_password";
1425
- }(Y || (Y = {})), Promise.resolve({
1818
+ }(je || (je = {})), Promise.resolve({
1426
1819
  pkceRequiredForEmailMagicLinks: !1
1427
1820
  }), Promise.resolve({
1428
1821
  pkceRequiredForPasswordResets: !1
1429
1822
  });
1430
- var ne = Promise.resolve({
1823
+ var Ye = Promise.resolve({
1431
1824
  pkceRequiredForEmailMagicLinks: !1
1432
- }), ie = function () {
1433
- function e(t, r, n, o) {
1434
- var s = this, c = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : ne, u = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : te();
1435
- a(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._passwordResetPKCEManager = o, this._config = c, this.dfpProtectedAuth = u, this.email = {
1825
+ }), Ve = function () {
1826
+ function e(t, r, n, i) {
1827
+ var o = this, s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : Ye, a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : Ge();
1828
+ _e(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._passwordResetPKCEManager = i, this._config = s, this.dfpProtectedAuth = a, this.email = {
1829
+ invite: function invite(e) {
1830
+ return we(o, void 0, void 0, de().mark(function t() {
1831
+ return de().wrap(function (t) {
1832
+ for (;;)
1833
+ switch (t.prev = t.next) {
1834
+ case 0:
1835
+ return qe("stytch.magicLinks.email.loginOrSignup").isString("email_address", e.email_address).isOptionalString("invite_redirect_url", e.invite_redirect_url).isOptionalString("invite_template_id", e.invite_template_id).isOptionalString("name", e.name).isOptionalString("locale", e.locale).isOptionalStringArray("roles", e.roles), t.abrupt("return", this._networkClient.fetchSDK({
1836
+ url: "/b2b/magic_links/email/invite",
1837
+ body: e,
1838
+ errorMessage: "Failed to send invite.",
1839
+ method: "POST"
1840
+ }));
1841
+ case 2:
1842
+ case "end":
1843
+ return t.stop();
1844
+ }
1845
+ }, t, this);
1846
+ }));
1847
+ },
1436
1848
  loginOrSignup: function loginOrSignup(e) {
1437
- return S(s, void 0, void 0, i().mark(function t() {
1849
+ return we(o, void 0, void 0, de().mark(function t() {
1438
1850
  var r, n;
1439
- return i().wrap(function (t) {
1851
+ return de().wrap(function (t) {
1440
1852
  for (;;)
1441
1853
  switch (t.prev = t.next) {
1442
1854
  case 0:
1443
- return Q("stytch.magicLinks.email.loginOrSignup").isString("email", e.email_address).isString("organization_id", e.organization_id).isOptionalString("login_redirect_url", e.login_redirect_url).isOptionalString("login_template_id", e.login_template_id).isOptionalString("signup_redirect_url", e.signup_redirect_url).isOptionalString("signup_template_id", e.signup_template_id).isOptionalString("locale", e.locale), t.next = 3, this.getCodeChallenge();
1855
+ return qe("stytch.magicLinks.email.loginOrSignup").isString("email_address", e.email_address).isString("organization_id", e.organization_id).isOptionalString("login_redirect_url", e.login_redirect_url).isOptionalString("login_template_id", e.login_template_id).isOptionalString("signup_redirect_url", e.signup_redirect_url).isOptionalString("signup_template_id", e.signup_template_id).isOptionalString("locale", e.locale), t.next = 3, this.getCodeChallenge();
1444
1856
  case 3:
1445
1857
  return r = t.sent, n = Object.assign(Object.assign({}, e), {
1446
1858
  pkce_code_challenge: r
@@ -1459,13 +1871,13 @@ var ne = Promise.resolve({
1459
1871
  },
1460
1872
  discovery: {
1461
1873
  send: function send(e) {
1462
- return S(s, void 0, void 0, i().mark(function t() {
1874
+ return we(o, void 0, void 0, de().mark(function t() {
1463
1875
  var r, n;
1464
- return i().wrap(function (t) {
1876
+ return de().wrap(function (t) {
1465
1877
  for (;;)
1466
1878
  switch (t.prev = t.next) {
1467
1879
  case 0:
1468
- return Q("stytch.magicLinks.email.discovery.send").isString("email_address", e.email_address).isOptionalString("discovery_redirect_url", e.discovery_redirect_url).isOptionalString("login_template_id", e.login_template_id).isOptionalString("locale", e.locale), t.next = 3, this.getCodeChallenge();
1880
+ return qe("stytch.magicLinks.email.discovery.send").isString("email_address", e.email_address).isOptionalString("discovery_redirect_url", e.discovery_redirect_url).isOptionalString("login_template_id", e.login_template_id).isOptionalString("locale", e.locale), t.next = 3, this.getCodeChallenge();
1469
1881
  case 3:
1470
1882
  return r = t.sent, n = Object.assign(Object.assign({}, e), {
1471
1883
  pkce_code_challenge: r
@@ -1484,13 +1896,13 @@ var ne = Promise.resolve({
1484
1896
  }
1485
1897
  }
1486
1898
  }, this.authenticate = function (e) {
1487
- return S(s, void 0, void 0, i().mark(function t() {
1899
+ return we(o, void 0, void 0, de().mark(function t() {
1488
1900
  var r, n;
1489
- return i().wrap(function (t) {
1901
+ return de().wrap(function (t) {
1490
1902
  for (;;)
1491
1903
  switch (t.prev = t.next) {
1492
1904
  case 0:
1493
- return Q("stytch.magicLinks.authenticate").isString("magic_links_token", e.magic_links_token).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._passwordResetPKCEManager.getPKPair();
1905
+ return qe("stytch.magicLinks.authenticate").isString("magic_links_token", e.magic_links_token).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._passwordResetPKCEManager.getPKPair();
1494
1906
  case 3:
1495
1907
  if (r = t.sent, n = null, !(null == r ? void 0 : r.code_verifier)) {
1496
1908
  t.next = 19;
@@ -1540,34 +1952,34 @@ var ne = Promise.resolve({
1540
1952
  }));
1541
1953
  }, this.discovery = {
1542
1954
  authenticate: function authenticate(e) {
1543
- return S(s, void 0, void 0, i().mark(function t() {
1544
- var r, n, o, s, a, c;
1545
- return i().wrap(function (t) {
1955
+ return we(o, void 0, void 0, de().mark(function t() {
1956
+ var r, n, i, o, s, a;
1957
+ return de().wrap(function (t) {
1546
1958
  for (;;)
1547
1959
  switch (t.prev = t.next) {
1548
1960
  case 0:
1549
- return Q("stytch.magicLinks.discovery.authenticate").isString("discovery_magic_links_token", e.discovery_magic_links_token), t.next = 3, this._pkceManager.getPKPair();
1961
+ return qe("stytch.magicLinks.discovery.authenticate").isString("discovery_magic_links_token", e.discovery_magic_links_token), t.next = 3, this._pkceManager.getPKPair();
1550
1962
  case 3:
1551
1963
  return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
1552
1964
  case 6:
1553
- return n = t.sent, o = n.dfp_telemetry_id, s = n.captcha_token, a = Object.assign({
1965
+ return n = t.sent, i = n.dfp_telemetry_id, o = n.captcha_token, s = Object.assign({
1554
1966
  pkce_code_verifier: null == r ? void 0 : r.code_verifier,
1555
- dfp_telemetry_id: o,
1556
- captcha_token: s
1967
+ dfp_telemetry_id: i,
1968
+ captcha_token: o
1557
1969
  }, e), t.next = 12, this._networkClient.retriableFetchSDK({
1558
1970
  url: "/b2b/magic_links/discovery/authenticate",
1559
- body: a,
1971
+ body: s,
1560
1972
  errorMessage: "Failed to authenticate intermediate magic link token",
1561
1973
  method: "POST",
1562
1974
  retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
1563
1975
  });
1564
1976
  case 12:
1565
- return c = t.sent, this._pkceManager.clearPKPair(), this._subscriptionService.updateStateAndTokens({
1977
+ return a = t.sent, this._pkceManager.clearPKPair(), this._subscriptionService.updateStateAndTokens({
1566
1978
  state: null,
1567
1979
  session_token: null,
1568
1980
  session_jwt: null,
1569
- intermediate_session_token: c.intermediate_session_token
1570
- }), t.abrupt("return", c);
1981
+ intermediate_session_token: a.intermediate_session_token
1982
+ }), t.abrupt("return", a);
1571
1983
  case 16:
1572
1984
  case "end":
1573
1985
  return t.stop();
@@ -1577,12 +1989,12 @@ var ne = Promise.resolve({
1577
1989
  }
1578
1990
  };
1579
1991
  }
1580
- return s(e, [{
1992
+ return pe(e, [{
1581
1993
  key: "getCodeChallenge",
1582
1994
  value: function value() {
1583
- return S(this, void 0, void 0, i().mark(function e() {
1995
+ return we(this, void 0, void 0, de().mark(function e() {
1584
1996
  var t, r;
1585
- return i().wrap(function (e) {
1997
+ return de().wrap(function (e) {
1586
1998
  for (;;)
1587
1999
  switch (e.prev = e.next) {
1588
2000
  case 0:
@@ -1615,9 +2027,9 @@ var ne = Promise.resolve({
1615
2027
  }, {
1616
2028
  key: "handlePKCEForAuthenticate",
1617
2029
  value: function value(e, t) {
1618
- return S(this, void 0, void 0, i().mark(function r() {
1619
- var n, o, s, a, c, u;
1620
- return i().wrap(function (r) {
2030
+ return we(this, void 0, void 0, de().mark(function r() {
2031
+ var n, i, o, s, a, c;
2032
+ return de().wrap(function (r) {
1621
2033
  for (;;)
1622
2034
  switch (r.prev = r.next) {
1623
2035
  case 0:
@@ -1625,19 +2037,19 @@ var ne = Promise.resolve({
1625
2037
  case 2:
1626
2038
  return n = r.sent, r.next = 5, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
1627
2039
  case 5:
1628
- return o = r.sent, s = o.dfp_telemetry_id, a = o.captcha_token, c = Object.assign({
2040
+ return i = r.sent, o = i.dfp_telemetry_id, s = i.captcha_token, a = Object.assign({
1629
2041
  pkce_code_verifier: null == n ? void 0 : n.code_verifier,
1630
- dfp_telemetry_id: s,
1631
- captcha_token: a
2042
+ dfp_telemetry_id: o,
2043
+ captcha_token: s
1632
2044
  }, t), r.next = 11, this._networkClient.retriableFetchSDK({
1633
2045
  url: "/b2b/magic_links/authenticate",
1634
- body: c,
2046
+ body: a,
1635
2047
  errorMessage: "Failed to authenticate token",
1636
2048
  method: "POST",
1637
2049
  retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
1638
2050
  });
1639
2051
  case 11:
1640
- return u = r.sent, e.clearPKPair(), r.abrupt("return", u);
2052
+ return c = r.sent, e.clearPKPair(), r.abrupt("return", c);
1641
2053
  case 14:
1642
2054
  case "end":
1643
2055
  return r.stop();
@@ -1646,12 +2058,12 @@ var ne = Promise.resolve({
1646
2058
  }));
1647
2059
  }
1648
2060
  }]), e;
1649
- }(), oe = s(function e(t, r) {
2061
+ }(), Je = pe(function e(t, r) {
1650
2062
  var n = this;
1651
- a(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
1652
- return S(n, void 0, void 0, i().mark(function e() {
2063
+ _e(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
2064
+ return we(n, void 0, void 0, de().mark(function e() {
1653
2065
  var t;
1654
- return i().wrap(function (e) {
2066
+ return de().wrap(function (e) {
1655
2067
  for (;;)
1656
2068
  switch (e.prev = e.next) {
1657
2069
  case 0:
@@ -1676,13 +2088,13 @@ var ne = Promise.resolve({
1676
2088
  return e(null !== (r = null == t ? void 0 : t.member) && void 0 !== r ? r : null);
1677
2089
  });
1678
2090
  }, this.update = function (e) {
1679
- return S(n, void 0, void 0, i().mark(function t() {
2091
+ return we(n, void 0, void 0, de().mark(function t() {
1680
2092
  var r;
1681
- return i().wrap(function (t) {
2093
+ return de().wrap(function (t) {
1682
2094
  for (;;)
1683
2095
  switch (t.prev = t.next) {
1684
2096
  case 0:
1685
- return Q("stytch.member.update").isOptionalString("name", e.name).isOptionalObject("untrusted_metadata", e.untrusted_metadata).isOptionalBoolean("mfa_enrolled", e.mfa_enrolled).isOptionalString("mfa_phone_number", e.mfa_phone_number), t.next = 3, this._networkClient.fetchSDK({
2097
+ return qe("stytch.self.update").isOptionalString("name", e.name).isOptionalObject("untrusted_metadata", e.untrusted_metadata).isOptionalBoolean("mfa_enrolled", e.mfa_enrolled).isOptionalString("mfa_phone_number", e.mfa_phone_number), t.next = 3, this._networkClient.fetchSDK({
1686
2098
  url: "/b2b/organizations/members/update",
1687
2099
  body: e,
1688
2100
  errorMessage: "Failed to update member.",
@@ -1697,9 +2109,9 @@ var ne = Promise.resolve({
1697
2109
  }, t, this);
1698
2110
  }));
1699
2111
  }, this.deleteMFAPhoneNumber = function () {
1700
- return S(n, void 0, void 0, i().mark(function e() {
2112
+ return we(n, void 0, void 0, de().mark(function e() {
1701
2113
  var t;
1702
- return i().wrap(function (e) {
2114
+ return de().wrap(function (e) {
1703
2115
  for (;;)
1704
2116
  switch (e.prev = e.next) {
1705
2117
  case 0:
@@ -1716,52 +2128,199 @@ var ne = Promise.resolve({
1716
2128
  }
1717
2129
  }, e, this);
1718
2130
  }));
2131
+ }, this.deletePassword = function (e) {
2132
+ return we(n, void 0, void 0, de().mark(function t() {
2133
+ var r;
2134
+ return de().wrap(function (t) {
2135
+ for (;;)
2136
+ switch (t.prev = t.next) {
2137
+ case 0:
2138
+ return t.next = 2, this._networkClient.fetchSDK({
2139
+ url: "/b2b/organizations/members/passwords/".concat(e),
2140
+ errorMessage: "Failed to delete member password.",
2141
+ method: "DELETE"
2142
+ });
2143
+ case 2:
2144
+ return r = t.sent, this._subscriptionService.updateMember(r.member), t.abrupt("return", r);
2145
+ case 5:
2146
+ case "end":
2147
+ return t.stop();
2148
+ }
2149
+ }, t, this);
2150
+ }));
1719
2151
  };
1720
- }), se = function () {
2152
+ }), $e = function () {
1721
2153
  function e(t, r, n, i, o) {
1722
- var s = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : te();
1723
- a(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = o, this.dfpProtectedAuth = s;
2154
+ var s = this, a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : Ge();
2155
+ _e(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = o, this.dfpProtectedAuth = a, this.saml = {
2156
+ createConnection: function createConnection(e) {
2157
+ return we(s, void 0, void 0, de().mark(function t() {
2158
+ return de().wrap(function (t) {
2159
+ for (;;)
2160
+ switch (t.prev = t.next) {
2161
+ case 0:
2162
+ return t.next = 2, this._networkClient.fetchSDK({
2163
+ url: "/b2b/sso/saml",
2164
+ method: "POST",
2165
+ body: e,
2166
+ errorMessage: "Failed to create SAML Connection."
2167
+ });
2168
+ case 2:
2169
+ return t.abrupt("return", t.sent);
2170
+ case 3:
2171
+ case "end":
2172
+ return t.stop();
2173
+ }
2174
+ }, t, this);
2175
+ }));
2176
+ },
2177
+ updateConnection: function updateConnection(e) {
2178
+ return we(s, void 0, void 0, de().mark(function t() {
2179
+ return de().wrap(function (t) {
2180
+ for (;;)
2181
+ switch (t.prev = t.next) {
2182
+ case 0:
2183
+ return t.next = 2, this._networkClient.fetchSDK({
2184
+ url: "/b2b/sso/saml/".concat(e.connection_id),
2185
+ method: "PUT",
2186
+ body: e,
2187
+ errorMessage: "Failed to update SAML Connection."
2188
+ });
2189
+ case 2:
2190
+ return t.abrupt("return", t.sent);
2191
+ case 3:
2192
+ case "end":
2193
+ return t.stop();
2194
+ }
2195
+ }, t, this);
2196
+ }));
2197
+ },
2198
+ updateConnectionByURL: function updateConnectionByURL(e) {
2199
+ return we(s, void 0, void 0, de().mark(function t() {
2200
+ return de().wrap(function (t) {
2201
+ for (;;)
2202
+ switch (t.prev = t.next) {
2203
+ case 0:
2204
+ return t.next = 2, this._networkClient.fetchSDK({
2205
+ url: "/b2b/sso/saml/".concat(e.connection_id, "/url"),
2206
+ method: "PUT",
2207
+ body: e,
2208
+ errorMessage: "Failed to update SAML Connection."
2209
+ });
2210
+ case 2:
2211
+ return t.abrupt("return", t.sent);
2212
+ case 3:
2213
+ case "end":
2214
+ return t.stop();
2215
+ }
2216
+ }, t, this);
2217
+ }));
2218
+ },
2219
+ deleteVerificationCertificate: function deleteVerificationCertificate(e) {
2220
+ return we(s, void 0, void 0, de().mark(function t() {
2221
+ return de().wrap(function (t) {
2222
+ for (;;)
2223
+ switch (t.prev = t.next) {
2224
+ case 0:
2225
+ return t.next = 2, this._networkClient.fetchSDK({
2226
+ url: "/b2b/sso/saml/".concat(e.connection_id, "/verification_certificates/").concat(e.certificate_id),
2227
+ method: "DELETE",
2228
+ errorMessage: "Failed to delete SAML Verification Certificate."
2229
+ });
2230
+ case 2:
2231
+ return t.abrupt("return", t.sent);
2232
+ case 3:
2233
+ case "end":
2234
+ return t.stop();
2235
+ }
2236
+ }, t, this);
2237
+ }));
2238
+ }
2239
+ }, this.oidc = {
2240
+ createConnection: function createConnection(e) {
2241
+ return we(s, void 0, void 0, de().mark(function t() {
2242
+ return de().wrap(function (t) {
2243
+ for (;;)
2244
+ switch (t.prev = t.next) {
2245
+ case 0:
2246
+ return t.next = 2, this._networkClient.fetchSDK({
2247
+ url: "/b2b/sso/oidc",
2248
+ method: "POST",
2249
+ body: e,
2250
+ errorMessage: "Failed to create OIDC Connection."
2251
+ });
2252
+ case 2:
2253
+ return t.abrupt("return", t.sent);
2254
+ case 3:
2255
+ case "end":
2256
+ return t.stop();
2257
+ }
2258
+ }, t, this);
2259
+ }));
2260
+ },
2261
+ updateConnection: function updateConnection(e) {
2262
+ return we(s, void 0, void 0, de().mark(function t() {
2263
+ return de().wrap(function (t) {
2264
+ for (;;)
2265
+ switch (t.prev = t.next) {
2266
+ case 0:
2267
+ return t.next = 2, this._networkClient.fetchSDK({
2268
+ url: "/b2b/sso/oidc/".concat(e.connection_id),
2269
+ method: "PUT",
2270
+ body: e,
2271
+ errorMessage: "Failed to update OIDC Connection."
2272
+ });
2273
+ case 2:
2274
+ return t.abrupt("return", t.sent);
2275
+ case 3:
2276
+ case "end":
2277
+ return t.stop();
2278
+ }
2279
+ }, t, this);
2280
+ }));
2281
+ }
2282
+ };
1724
2283
  }
1725
- return s(e, [{
2284
+ return pe(e, [{
1726
2285
  key: "authenticate",
1727
2286
  value: function value(e) {
1728
- return S(this, void 0, void 0, i().mark(function t() {
1729
- var r, n, o, s, a;
1730
- return i().wrap(function (t) {
2287
+ return we(this, void 0, void 0, de().mark(function t() {
2288
+ var r, n, i, o, s;
2289
+ return de().wrap(function (t) {
1731
2290
  for (;;)
1732
2291
  switch (t.prev = t.next) {
1733
2292
  case 0:
1734
- return Q("stytch.sso.authenticate").isString("sso_token", e.sso_token).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._pkceManager.getPKPair();
2293
+ return qe("stytch.sso.authenticate").isString("sso_token", e.sso_token).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._pkceManager.getPKPair();
1735
2294
  case 3:
1736
- return (r = t.sent) || $("No code verifier found in local storage for SSO flow.\nConsider using stytch.sso.start() to add PKCE to your SSO flows for added security.\nSee https://stytch.com/docs/oauth#guides_pkce for more information."), t.next = 7, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
2295
+ return (r = t.sent) || Ne("No code verifier found in local storage for SSO flow.\nConsider using stytch.sso.start() to add PKCE to your SSO flows for added security.\nSee https://stytch.com/docs/oauth#guides_pkce for more information."), t.next = 7, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
1737
2296
  case 7:
1738
- return n = t.sent, o = n.dfp_telemetry_id, s = n.captcha_token, t.next = 12, this._networkClient.retriableFetchSDK({
2297
+ return n = t.sent, i = n.dfp_telemetry_id, o = n.captcha_token, t.next = 12, this._networkClient.retriableFetchSDK({
1739
2298
  url: "/b2b/sso/authenticate",
1740
2299
  method: "POST",
1741
2300
  body: Object.assign(Object.assign({
1742
2301
  pkce_code_verifier: null == r ? void 0 : r.code_verifier
1743
2302
  }, e), {
1744
- dfp_telemetry_id: o,
1745
- captcha_token: s
2303
+ dfp_telemetry_id: i,
2304
+ captcha_token: o
1746
2305
  }),
1747
2306
  errorMessage: "Failed to authenticate token",
1748
2307
  retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
1749
2308
  });
1750
2309
  case 12:
1751
- return a = t.sent, this._pkceManager.clearPKPair(), a.member_session ? this._subscriptionService.updateStateAndTokens({
2310
+ return s = t.sent, this._pkceManager.clearPKPair(), s.member_session ? this._subscriptionService.updateStateAndTokens({
1752
2311
  state: {
1753
- session: a.member_session,
1754
- member: a.member
2312
+ session: s.member_session,
2313
+ member: s.member
1755
2314
  },
1756
- session_token: a.session_token,
1757
- session_jwt: a.session_jwt,
2315
+ session_token: s.session_token,
2316
+ session_jwt: s.session_jwt,
1758
2317
  intermediate_session_token: null
1759
2318
  }) : this._subscriptionService.updateStateAndTokens({
1760
2319
  state: null,
1761
2320
  session_token: null,
1762
2321
  session_jwt: null,
1763
- intermediate_session_token: a.intermediate_session_token
1764
- }), t.abrupt("return", a);
2322
+ intermediate_session_token: s.intermediate_session_token
2323
+ }), t.abrupt("return", s);
1765
2324
  case 16:
1766
2325
  case "end":
1767
2326
  return t.stop();
@@ -1772,12 +2331,12 @@ var ne = Promise.resolve({
1772
2331
  }, {
1773
2332
  key: "getBaseApiUrl",
1774
2333
  value: function value() {
1775
- return S(this, void 0, void 0, i().mark(function e() {
1776
- return i().wrap(function (e) {
2334
+ return we(this, void 0, void 0, de().mark(function e() {
2335
+ return de().wrap(function (e) {
1777
2336
  for (;;)
1778
2337
  switch (e.prev = e.next) {
1779
2338
  case 0:
1780
- if (!Z(this._config.publicToken)) {
2339
+ if (!ze(this._config.publicToken)) {
1781
2340
  e.next = 2;
1782
2341
  break;
1783
2342
  }
@@ -1795,28 +2354,28 @@ var ne = Promise.resolve({
1795
2354
  key: "start",
1796
2355
  value: function value(e) {
1797
2356
  var t = e.connection_id, r = e.login_redirect_url, n = e.signup_redirect_url;
1798
- return S(this, void 0, void 0, i().mark(function e() {
1799
- var o, s, a, c, u;
1800
- return i().wrap(function (e) {
2357
+ return we(this, void 0, void 0, de().mark(function e() {
2358
+ var i, o, s, a, c;
2359
+ return de().wrap(function (e) {
1801
2360
  for (;;)
1802
2361
  switch (e.prev = e.next) {
1803
2362
  case 0:
1804
2363
  return e.next = 2, this._dynamicConfig;
1805
2364
  case 2:
1806
- return o = e.sent, s = o.pkceRequiredForSso, e.next = 6, this.getBaseApiUrl();
2365
+ return i = e.sent, o = i.pkceRequiredForSso, e.next = 6, this.getBaseApiUrl();
1807
2366
  case 6:
1808
- if (a = e.sent, (c = new URL("".concat(a, "/v1/public/sso/start"))).searchParams.set("public_token", this._config.publicToken), c.searchParams.set("connection_id", t), !s) {
2367
+ if (s = e.sent, (a = new URL("".concat(s, "/v1/public/sso/start"))).searchParams.set("public_token", this._config.publicToken), a.searchParams.set("connection_id", t), !o) {
1809
2368
  e.next = 17;
1810
2369
  break;
1811
2370
  }
1812
2371
  return e.next = 13, this._pkceManager.startPKCETransaction();
1813
2372
  case 13:
1814
- u = e.sent, c.searchParams.set("pkce_code_challenge", u.code_challenge), e.next = 18;
2373
+ c = e.sent, a.searchParams.set("pkce_code_challenge", c.code_challenge), e.next = 18;
1815
2374
  break;
1816
2375
  case 17:
1817
2376
  this._pkceManager.clearPKPair();
1818
2377
  case 18:
1819
- r && c.searchParams.set("login_redirect_url", r), n && c.searchParams.set("signup_redirect_url", n), window.location.href = c.toString();
2378
+ r && a.searchParams.set("login_redirect_url", r), n && a.searchParams.set("signup_redirect_url", n), window.location.href = a.toString();
1820
2379
  case 21:
1821
2380
  case "end":
1822
2381
  return e.stop();
@@ -1824,13 +2383,55 @@ var ne = Promise.resolve({
1824
2383
  }, e, this);
1825
2384
  }));
1826
2385
  }
2386
+ }, {
2387
+ key: "getConnections",
2388
+ value: function value() {
2389
+ return we(this, void 0, void 0, de().mark(function e() {
2390
+ return de().wrap(function (e) {
2391
+ for (;;)
2392
+ switch (e.prev = e.next) {
2393
+ case 0:
2394
+ return e.next = 2, this._networkClient.fetchSDK({
2395
+ url: "/b2b/sso",
2396
+ method: "GET",
2397
+ errorMessage: "Failed to get SSO Connections."
2398
+ });
2399
+ case 2:
2400
+ return e.abrupt("return", e.sent);
2401
+ case 3:
2402
+ case "end":
2403
+ return e.stop();
2404
+ }
2405
+ }, e, this);
2406
+ }));
2407
+ }
2408
+ }, {
2409
+ key: "deleteConnection",
2410
+ value: function value(e) {
2411
+ return we(this, void 0, void 0, de().mark(function t() {
2412
+ return de().wrap(function (t) {
2413
+ for (;;)
2414
+ switch (t.prev = t.next) {
2415
+ case 0:
2416
+ return t.abrupt("return", this._networkClient.fetchSDK({
2417
+ url: "/b2b/sso/".concat(e),
2418
+ method: "DELETE",
2419
+ errorMessage: "Failed to delete SSO Connection."
2420
+ }));
2421
+ case 1:
2422
+ case "end":
2423
+ return t.stop();
2424
+ }
2425
+ }, t, this);
2426
+ }));
2427
+ }
1827
2428
  }]), e;
1828
- }(), ae = s(function e(t) {
1829
- var r = this;
1830
- a(this, e), this._networkClient = t, this.get = function () {
1831
- return S(r, void 0, void 0, i().mark(function e() {
2429
+ }(), Xe = pe(function e(t, r) {
2430
+ var n = this;
2431
+ _e(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
2432
+ return we(n, void 0, void 0, de().mark(function e() {
1832
2433
  var t;
1833
- return i().wrap(function (e) {
2434
+ return de().wrap(function (e) {
1834
2435
  for (;;)
1835
2436
  switch (e.prev = e.next) {
1836
2437
  case 0:
@@ -1847,40 +2448,211 @@ var ne = Promise.resolve({
1847
2448
  }
1848
2449
  }, e, this);
1849
2450
  }));
2451
+ }, this.update = function (e) {
2452
+ return we(n, void 0, void 0, de().mark(function t() {
2453
+ var r;
2454
+ return de().wrap(function (t) {
2455
+ for (;;)
2456
+ switch (t.prev = t.next) {
2457
+ case 0:
2458
+ return t.next = 2, this._networkClient.fetchSDK({
2459
+ url: "/b2b/organizations/me",
2460
+ errorMessage: "Failed to update organization info.",
2461
+ method: "PUT",
2462
+ body: e
2463
+ });
2464
+ case 2:
2465
+ return r = t.sent, t.abrupt("return", r);
2466
+ case 4:
2467
+ case "end":
2468
+ return t.stop();
2469
+ }
2470
+ }, t, this);
2471
+ }));
2472
+ }, this["delete"] = function () {
2473
+ return we(n, void 0, void 0, de().mark(function e() {
2474
+ var t;
2475
+ return de().wrap(function (e) {
2476
+ for (;;)
2477
+ switch (e.prev = e.next) {
2478
+ case 0:
2479
+ return e.next = 2, this._networkClient.fetchSDK({
2480
+ url: "/b2b/organizations/me",
2481
+ errorMessage: "Failed to delete organization.",
2482
+ method: "DELETE"
2483
+ });
2484
+ case 2:
2485
+ return t = e.sent, this._subscriptionService.destroyState(), e.abrupt("return", t);
2486
+ case 5:
2487
+ case "end":
2488
+ return e.stop();
2489
+ }
2490
+ }, e, this);
2491
+ }));
2492
+ }, this.members = {
2493
+ create: function create(e) {
2494
+ return we(n, void 0, void 0, de().mark(function t() {
2495
+ return de().wrap(function (t) {
2496
+ for (;;)
2497
+ switch (t.prev = t.next) {
2498
+ case 0:
2499
+ return t.abrupt("return", this._networkClient.fetchSDK({
2500
+ url: "/b2b/organizations/members",
2501
+ errorMessage: "Failed to create member.",
2502
+ method: "POST",
2503
+ body: e
2504
+ }));
2505
+ case 1:
2506
+ case "end":
2507
+ return t.stop();
2508
+ }
2509
+ }, t, this);
2510
+ }));
2511
+ },
2512
+ search: function search(e) {
2513
+ return we(n, void 0, void 0, de().mark(function t() {
2514
+ return de().wrap(function (t) {
2515
+ for (;;)
2516
+ switch (t.prev = t.next) {
2517
+ case 0:
2518
+ return t.abrupt("return", this._networkClient.fetchSDK({
2519
+ url: "/b2b/organizations/me/members/search",
2520
+ errorMessage: "Failed to search members.",
2521
+ method: "POST",
2522
+ body: e
2523
+ }));
2524
+ case 1:
2525
+ case "end":
2526
+ return t.stop();
2527
+ }
2528
+ }, t, this);
2529
+ }));
2530
+ },
2531
+ update: function update(e) {
2532
+ return we(n, void 0, void 0, de().mark(function t() {
2533
+ return de().wrap(function (t) {
2534
+ for (;;)
2535
+ switch (t.prev = t.next) {
2536
+ case 0:
2537
+ return t.abrupt("return", this._networkClient.fetchSDK({
2538
+ url: "/b2b/organizations/members/".concat(e.member_id),
2539
+ errorMessage: "Failed to update member.",
2540
+ method: "PUT",
2541
+ body: e
2542
+ }));
2543
+ case 1:
2544
+ case "end":
2545
+ return t.stop();
2546
+ }
2547
+ }, t, this);
2548
+ }));
2549
+ },
2550
+ deletePassword: function deletePassword(e) {
2551
+ return we(n, void 0, void 0, de().mark(function t() {
2552
+ return de().wrap(function (t) {
2553
+ for (;;)
2554
+ switch (t.prev = t.next) {
2555
+ case 0:
2556
+ return t.abrupt("return", this._networkClient.fetchSDK({
2557
+ url: "/b2b/organizations/members/passwords/".concat(e),
2558
+ errorMessage: "Failed to delete member password.",
2559
+ method: "DELETE"
2560
+ }));
2561
+ case 1:
2562
+ case "end":
2563
+ return t.stop();
2564
+ }
2565
+ }, t, this);
2566
+ }));
2567
+ },
2568
+ deleteMFAPhoneNumber: function deleteMFAPhoneNumber(e) {
2569
+ return we(n, void 0, void 0, de().mark(function t() {
2570
+ return de().wrap(function (t) {
2571
+ for (;;)
2572
+ switch (t.prev = t.next) {
2573
+ case 0:
2574
+ return t.abrupt("return", this._networkClient.fetchSDK({
2575
+ url: "/b2b/organizations/members/mfa_phone_numbers/".concat(e),
2576
+ errorMessage: "Failed to delete member MFA Phone number.",
2577
+ method: "DELETE"
2578
+ }));
2579
+ case 1:
2580
+ case "end":
2581
+ return t.stop();
2582
+ }
2583
+ }, t, this);
2584
+ }));
2585
+ },
2586
+ "delete": function _delete(e) {
2587
+ return we(n, void 0, void 0, de().mark(function t() {
2588
+ return de().wrap(function (t) {
2589
+ for (;;)
2590
+ switch (t.prev = t.next) {
2591
+ case 0:
2592
+ return t.abrupt("return", this._networkClient.fetchSDK({
2593
+ url: "/b2b/organizations/members/".concat(e),
2594
+ errorMessage: "Failed to delete member.",
2595
+ method: "DELETE"
2596
+ }));
2597
+ case 1:
2598
+ case "end":
2599
+ return t.stop();
2600
+ }
2601
+ }, t, this);
2602
+ }));
2603
+ },
2604
+ reactivate: function reactivate(e) {
2605
+ return we(n, void 0, void 0, de().mark(function t() {
2606
+ return de().wrap(function (t) {
2607
+ for (;;)
2608
+ switch (t.prev = t.next) {
2609
+ case 0:
2610
+ return t.abrupt("return", this._networkClient.fetchSDK({
2611
+ url: "/b2b/organizations/members/".concat(e, "/reactivate"),
2612
+ errorMessage: "Failed to reactivate member.",
2613
+ method: "PUT"
2614
+ }));
2615
+ case 1:
2616
+ case "end":
2617
+ return t.stop();
2618
+ }
2619
+ }, t, this);
2620
+ }));
2621
+ }
1850
2622
  };
1851
- }), ce = function () {
1852
- function e(t, r, n, o, s) {
1853
- var c = this, u = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : te();
1854
- a(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = o, this._config = s, this.dfpProtectedAuth = u, this.discovery = {
2623
+ }), Ze = function () {
2624
+ function e(t, r, n, i, o) {
2625
+ var s = this, a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : Ge();
2626
+ _e(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = o, this.dfpProtectedAuth = a, this.discovery = {
1855
2627
  authenticate: function authenticate(e) {
1856
- return S(c, void 0, void 0, i().mark(function t() {
1857
- var r, n, o, s, a, c;
1858
- return i().wrap(function (t) {
2628
+ return we(s, void 0, void 0, de().mark(function t() {
2629
+ var r, n, i, o, s, a;
2630
+ return de().wrap(function (t) {
1859
2631
  for (;;)
1860
2632
  switch (t.prev = t.next) {
1861
2633
  case 0:
1862
- return Q("stytch.oauth.discovery.authenticate").isString("discovery_oauth_token", e.discovery_oauth_token), t.next = 3, this._pkceManager.getPKPair();
2634
+ return qe("stytch.oauth.discovery.authenticate").isString("discovery_oauth_token", e.discovery_oauth_token), t.next = 3, this._pkceManager.getPKPair();
1863
2635
  case 3:
1864
2636
  return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
1865
2637
  case 6:
1866
- return n = t.sent, o = n.dfp_telemetry_id, s = n.captcha_token, a = Object.assign({
2638
+ return n = t.sent, i = n.dfp_telemetry_id, o = n.captcha_token, s = Object.assign({
1867
2639
  pkce_code_verifier: null == r ? void 0 : r.code_verifier,
1868
- dfp_telemetry_id: o,
1869
- captcha_token: s
2640
+ dfp_telemetry_id: i,
2641
+ captcha_token: o
1870
2642
  }, e), t.next = 12, this._networkClient.retriableFetchSDK({
1871
2643
  url: "/b2b/oauth/discovery/authenticate",
1872
- body: a,
2644
+ body: s,
1873
2645
  errorMessage: "Failed to authenticate discovery oauth token",
1874
2646
  method: "POST",
1875
2647
  retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
1876
2648
  });
1877
2649
  case 12:
1878
- return c = t.sent, this._pkceManager.clearPKPair(), this._subscriptionService.updateStateAndTokens({
2650
+ return a = t.sent, this._pkceManager.clearPKPair(), this._subscriptionService.updateStateAndTokens({
1879
2651
  state: null,
1880
2652
  session_token: null,
1881
2653
  session_jwt: null,
1882
- intermediate_session_token: c.intermediate_session_token
1883
- }), t.abrupt("return", c);
2654
+ intermediate_session_token: a.intermediate_session_token
2655
+ }), t.abrupt("return", a);
1884
2656
  case 16:
1885
2657
  case "end":
1886
2658
  return t.stop();
@@ -1889,56 +2661,56 @@ var ne = Promise.resolve({
1889
2661
  }));
1890
2662
  }
1891
2663
  }, this.google = {
1892
- start: this.startOAuthFlow(T.Google),
2664
+ start: this.startOAuthFlow(y.Google),
1893
2665
  discovery: {
1894
- start: this.startDiscoveryOAuthFlow(T.Google)
2666
+ start: this.startDiscoveryOAuthFlow(y.Google)
1895
2667
  }
1896
2668
  }, this.microsoft = {
1897
- start: this.startOAuthFlow(T.Microsoft),
2669
+ start: this.startOAuthFlow(y.Microsoft),
1898
2670
  discovery: {
1899
- start: this.startDiscoveryOAuthFlow(T.Microsoft)
2671
+ start: this.startDiscoveryOAuthFlow(y.Microsoft)
1900
2672
  }
1901
2673
  };
1902
2674
  }
1903
- return s(e, [{
2675
+ return pe(e, [{
1904
2676
  key: "authenticate",
1905
2677
  value: function value(e) {
1906
- return S(this, void 0, void 0, i().mark(function t() {
1907
- var r, n, o, s, a;
1908
- return i().wrap(function (t) {
2678
+ return we(this, void 0, void 0, de().mark(function t() {
2679
+ var r, n, i, o, s;
2680
+ return de().wrap(function (t) {
1909
2681
  for (;;)
1910
2682
  switch (t.prev = t.next) {
1911
2683
  case 0:
1912
- return Q("stytch.oauth.authenticate").isString("oauth_token", e.oauth_token).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._pkceManager.getPKPair();
2684
+ return qe("stytch.oauth.authenticate").isString("oauth_token", e.oauth_token).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._pkceManager.getPKPair();
1913
2685
  case 3:
1914
- return (r = t.sent) || $("No code verifier found in local storage for OAuth flow.\nConsider using stytch.oauth.$provider.start() to add PKCE to your OAuth flows for added security.\nSee https://stytch.com/docs/oauth#guides_pkce for more information."), t.next = 7, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
2686
+ return (r = t.sent) || Ne("No code verifier found in local storage for OAuth flow.\nConsider using stytch.oauth.$provider.start() to add PKCE to your OAuth flows for added security.\nSee https://stytch.com/docs/oauth#guides_pkce for more information."), t.next = 7, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
1915
2687
  case 7:
1916
- return n = t.sent, o = n.dfp_telemetry_id, s = n.captcha_token, t.next = 12, this._networkClient.retriableFetchSDK({
2688
+ return n = t.sent, i = n.dfp_telemetry_id, o = n.captcha_token, t.next = 12, this._networkClient.retriableFetchSDK({
1917
2689
  url: "/b2b/oauth/authenticate",
1918
2690
  method: "POST",
1919
2691
  body: Object.assign({
1920
2692
  pkce_code_verifier: null == r ? void 0 : r.code_verifier,
1921
- dfp_telemetry_id: o,
1922
- captcha_token: s
2693
+ dfp_telemetry_id: i,
2694
+ captcha_token: o
1923
2695
  }, e),
1924
2696
  errorMessage: "Failed to authenticate token",
1925
2697
  retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
1926
2698
  });
1927
2699
  case 12:
1928
- return a = t.sent, this._pkceManager.clearPKPair(), a.member_session ? this._subscriptionService.updateStateAndTokens({
2700
+ return s = t.sent, this._pkceManager.clearPKPair(), s.member_session ? this._subscriptionService.updateStateAndTokens({
1929
2701
  state: {
1930
- session: a.member_session,
1931
- member: a.member
2702
+ session: s.member_session,
2703
+ member: s.member
1932
2704
  },
1933
- session_token: a.session_token,
1934
- session_jwt: a.session_jwt,
2705
+ session_token: s.session_token,
2706
+ session_jwt: s.session_jwt,
1935
2707
  intermediate_session_token: null
1936
2708
  }) : this._subscriptionService.updateStateAndTokens({
1937
2709
  state: null,
1938
2710
  session_token: null,
1939
2711
  session_jwt: null,
1940
- intermediate_session_token: a.intermediate_session_token
1941
- }), t.abrupt("return", a);
2712
+ intermediate_session_token: s.intermediate_session_token
2713
+ }), t.abrupt("return", s);
1942
2714
  case 16:
1943
2715
  case "end":
1944
2716
  return t.stop();
@@ -1949,9 +2721,9 @@ var ne = Promise.resolve({
1949
2721
  }, {
1950
2722
  key: "getBaseApiUrl",
1951
2723
  value: function value() {
1952
- return S(this, void 0, void 0, i().mark(function e() {
2724
+ return we(this, void 0, void 0, de().mark(function e() {
1953
2725
  var t, r;
1954
- return i().wrap(function (e) {
2726
+ return de().wrap(function (e) {
1955
2727
  for (;;)
1956
2728
  switch (e.prev = e.next) {
1957
2729
  case 0:
@@ -1963,7 +2735,7 @@ var ne = Promise.resolve({
1963
2735
  }
1964
2736
  return e.abrupt("return", "https://".concat(r));
1965
2737
  case 6:
1966
- if (!Z(this._config.publicToken)) {
2738
+ if (!ze(this._config.publicToken)) {
1967
2739
  e.next = 8;
1968
2740
  break;
1969
2741
  }
@@ -1982,32 +2754,32 @@ var ne = Promise.resolve({
1982
2754
  value: function value(e) {
1983
2755
  var t = this;
1984
2756
  return function (r) {
1985
- var n = r.organization_id, o = r.organization_slug, s = r.login_redirect_url, a = r.signup_redirect_url, c = r.custom_scopes, u = r.provider_params;
1986
- return S(t, void 0, void 0, i().mark(function t() {
1987
- var r, l, d, h, p, _;
1988
- return i().wrap(function (t) {
2757
+ var n = r.organization_id, i = r.organization_slug, o = r.login_redirect_url, s = r.signup_redirect_url, a = r.custom_scopes, c = r.provider_params;
2758
+ return we(t, void 0, void 0, de().mark(function t() {
2759
+ var r, u, l, d, h, p;
2760
+ return de().wrap(function (t) {
1989
2761
  for (;;)
1990
2762
  switch (t.prev = t.next) {
1991
2763
  case 0:
1992
2764
  return t.next = 2, this._dynamicConfig;
1993
2765
  case 2:
1994
- return r = t.sent, l = r.pkceRequiredForOAuth, t.next = 6, this.getBaseApiUrl();
2766
+ return r = t.sent, u = r.pkceRequiredForOAuth, t.next = 6, this.getBaseApiUrl();
1995
2767
  case 6:
1996
- if (d = t.sent, (h = new URL("".concat(d, "/v1/b2b/public/oauth/").concat(e, "/start"))).searchParams.set("public_token", this._config.publicToken), n && "" != n && h.searchParams.set("organization_id", n), o && "" != o && h.searchParams.set("slug", o), c && (Q("startOAuthFlow").isStringArray("custom_scopes", c), h.searchParams.set("custom_scopes", c.join(" "))), u)
1997
- for (p in Q("startOAuthFlow").isOptionalObject("provider_params", u), u)
1998
- h.searchParams.set("provider_" + p, u[p]);
1999
- if (!l) {
2768
+ if (l = t.sent, (d = new URL("".concat(l, "/v1/b2b/public/oauth/").concat(e, "/start"))).searchParams.set("public_token", this._config.publicToken), n && "" != n && d.searchParams.set("organization_id", n), i && "" != i && d.searchParams.set("slug", i), a && (qe("startOAuthFlow").isStringArray("custom_scopes", a), d.searchParams.set("custom_scopes", a.join(" "))), c)
2769
+ for (h in qe("startOAuthFlow").isOptionalObject("provider_params", c), c)
2770
+ d.searchParams.set("provider_" + h, c[h]);
2771
+ if (!u) {
2000
2772
  t.next = 20;
2001
2773
  break;
2002
2774
  }
2003
2775
  return t.next = 16, this._pkceManager.startPKCETransaction();
2004
2776
  case 16:
2005
- _ = t.sent, h.searchParams.set("pkce_code_challenge", _.code_challenge), t.next = 21;
2777
+ p = t.sent, d.searchParams.set("pkce_code_challenge", p.code_challenge), t.next = 21;
2006
2778
  break;
2007
2779
  case 20:
2008
2780
  this._pkceManager.clearPKPair();
2009
2781
  case 21:
2010
- s && h.searchParams.set("login_redirect_url", s), a && h.searchParams.set("signup_redirect_url", a), window.location.href = h.toString();
2782
+ o && d.searchParams.set("login_redirect_url", o), s && d.searchParams.set("signup_redirect_url", s), window.location.href = d.toString();
2011
2783
  case 24:
2012
2784
  case "end":
2013
2785
  return t.stop();
@@ -2021,32 +2793,32 @@ var ne = Promise.resolve({
2021
2793
  value: function value(e) {
2022
2794
  var t = this;
2023
2795
  return function (r) {
2024
- var n = r.discovery_redirect_url, o = r.custom_scopes, s = r.provider_params;
2025
- return S(t, void 0, void 0, i().mark(function t() {
2026
- var r, a, c, u, l, d;
2027
- return i().wrap(function (t) {
2796
+ var n = r.discovery_redirect_url, i = r.custom_scopes, o = r.provider_params;
2797
+ return we(t, void 0, void 0, de().mark(function t() {
2798
+ var r, s, a, c, u, l;
2799
+ return de().wrap(function (t) {
2028
2800
  for (;;)
2029
2801
  switch (t.prev = t.next) {
2030
2802
  case 0:
2031
2803
  return t.next = 2, this._dynamicConfig;
2032
2804
  case 2:
2033
- return r = t.sent, a = r.pkceRequiredForOAuth, t.next = 6, this.getBaseApiUrl();
2805
+ return r = t.sent, s = r.pkceRequiredForOAuth, t.next = 6, this.getBaseApiUrl();
2034
2806
  case 6:
2035
- if (c = t.sent, (u = new URL("".concat(c, "/v1/b2b/public/oauth/").concat(e, "/discovery/start"))).searchParams.set("public_token", this._config.publicToken), o && (Q("startOAuthFlow").isStringArray("custom_scopes", o), u.searchParams.set("custom_scopes", o.join(" "))), s)
2036
- for (l in Q("startOAuthFlow").isOptionalObject("provider_params", s), s)
2037
- u.searchParams.set("provider_" + l, s[l]);
2038
- if (!a) {
2807
+ if (a = t.sent, (c = new URL("".concat(a, "/v1/b2b/public/oauth/").concat(e, "/discovery/start"))).searchParams.set("public_token", this._config.publicToken), i && (qe("startOAuthFlow").isStringArray("custom_scopes", i), c.searchParams.set("custom_scopes", i.join(" "))), o)
2808
+ for (u in qe("startOAuthFlow").isOptionalObject("provider_params", o), o)
2809
+ c.searchParams.set("provider_" + u, o[u]);
2810
+ if (!s) {
2039
2811
  t.next = 18;
2040
2812
  break;
2041
2813
  }
2042
2814
  return t.next = 14, this._pkceManager.startPKCETransaction();
2043
2815
  case 14:
2044
- d = t.sent, u.searchParams.set("pkce_code_challenge", d.code_challenge), t.next = 19;
2816
+ l = t.sent, c.searchParams.set("pkce_code_challenge", l.code_challenge), t.next = 19;
2045
2817
  break;
2046
2818
  case 18:
2047
2819
  this._pkceManager.clearPKPair();
2048
2820
  case 19:
2049
- n && u.searchParams.set("discovery_redirect_url", n), window.location.href = u.toString();
2821
+ n && c.searchParams.set("discovery_redirect_url", n), window.location.href = c.toString();
2050
2822
  case 21:
2051
2823
  case "end":
2052
2824
  return t.stop();
@@ -2056,10 +2828,10 @@ var ne = Promise.resolve({
2056
2828
  };
2057
2829
  }
2058
2830
  }]), e;
2059
- }(), ue = function () {
2831
+ }(), Qe = function () {
2060
2832
  function e(t, r) {
2061
2833
  var n = this;
2062
- a(this, e), this._networkClient = t, this._subscriptionService = r, this.getSync = function () {
2834
+ _e(this, e), this._networkClient = t, this._subscriptionService = r, this.getSync = function () {
2063
2835
  return n._subscriptionService.getSession();
2064
2836
  }, this.onChange = function (e) {
2065
2837
  return n._subscriptionService.subscribeToState(function (t) {
@@ -2067,9 +2839,9 @@ var ne = Promise.resolve({
2067
2839
  return e(null !== (r = null == t ? void 0 : t.session) && void 0 !== r ? r : null);
2068
2840
  });
2069
2841
  }, this.revoke = function (e) {
2070
- return S(n, void 0, void 0, i().mark(function t() {
2842
+ return we(n, void 0, void 0, de().mark(function t() {
2071
2843
  var r;
2072
- return i().wrap(function (t) {
2844
+ return de().wrap(function (t) {
2073
2845
  for (;;)
2074
2846
  switch (t.prev = t.next) {
2075
2847
  case 0:
@@ -2081,7 +2853,7 @@ var ne = Promise.resolve({
2081
2853
  case 3:
2082
2854
  return r = t.sent, this._subscriptionService.destroyState(), t.abrupt("return", r);
2083
2855
  case 8:
2084
- throw t.prev = 8, t.t0 = t["catch"](0), ((null == e ? void 0 : e.forceClear) || x.includes(t.t0.error_type)) && this._subscriptionService.destroyState(), t.t0;
2856
+ throw t.prev = 8, t.t0 = t["catch"](0), ((null == e ? void 0 : e.forceClear) || A.includes(t.t0.error_type)) && this._subscriptionService.destroyState(), t.t0;
2085
2857
  case 12:
2086
2858
  case "end":
2087
2859
  return t.stop();
@@ -2089,9 +2861,9 @@ var ne = Promise.resolve({
2089
2861
  }, t, this, [[0, 8]]);
2090
2862
  }));
2091
2863
  }, this.authenticate = function (e) {
2092
- return S(n, void 0, void 0, i().mark(function t() {
2864
+ return we(n, void 0, void 0, de().mark(function t() {
2093
2865
  var r, n;
2094
- return i().wrap(function (t) {
2866
+ return de().wrap(function (t) {
2095
2867
  for (;;)
2096
2868
  switch (t.prev = t.next) {
2097
2869
  case 0:
@@ -2114,7 +2886,7 @@ var ne = Promise.resolve({
2114
2886
  intermediate_session_token: null
2115
2887
  }), t.abrupt("return", n);
2116
2888
  case 9:
2117
- throw t.prev = 9, t.t0 = t["catch"](0), x.includes(t.t0.error_type) && this._subscriptionService.destroyState(), t.t0;
2889
+ throw t.prev = 9, t.t0 = t["catch"](0), A.includes(t.t0.error_type) && this._subscriptionService.destroyState(), t.t0;
2118
2890
  case 13:
2119
2891
  case "end":
2120
2892
  return t.stop();
@@ -2122,13 +2894,13 @@ var ne = Promise.resolve({
2122
2894
  }, t, this, [[0, 9]]);
2123
2895
  }));
2124
2896
  }, this.exchange = function (e) {
2125
- return S(n, void 0, void 0, i().mark(function t() {
2897
+ return we(n, void 0, void 0, de().mark(function t() {
2126
2898
  var r;
2127
- return i().wrap(function (t) {
2899
+ return de().wrap(function (t) {
2128
2900
  for (;;)
2129
2901
  switch (t.prev = t.next) {
2130
2902
  case 0:
2131
- return Q("stytch.sessions.exchange").isString("organization_id", e.organization_id).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.prev = 1, t.next = 4, this._networkClient.fetchSDK({
2903
+ return qe("stytch.sessions.exchange").isString("organization_id", e.organization_id).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.prev = 1, t.next = 4, this._networkClient.fetchSDK({
2132
2904
  url: "/b2b/sessions/exchange",
2133
2905
  body: e,
2134
2906
  errorMessage: "Failed to exchange session",
@@ -2159,18 +2931,18 @@ var ne = Promise.resolve({
2159
2931
  }));
2160
2932
  };
2161
2933
  }
2162
- return s(e, [{
2934
+ return pe(e, [{
2163
2935
  key: "getTokens",
2164
2936
  value: function value() {
2165
2937
  return this._subscriptionService.getTokens();
2166
2938
  }
2167
2939
  }]), e;
2168
- }(), le = s(function e(t, r) {
2940
+ }(), et = pe(function e(t, r) {
2169
2941
  var n = this;
2170
- a(this, e), this._networkClient = t, this._subscriptionService = r, this.organizations = {
2942
+ _e(this, e), this._networkClient = t, this._subscriptionService = r, this.organizations = {
2171
2943
  list: function list() {
2172
- return S(n, void 0, void 0, i().mark(function e() {
2173
- return i().wrap(function (e) {
2944
+ return we(n, void 0, void 0, de().mark(function e() {
2945
+ return de().wrap(function (e) {
2174
2946
  for (;;)
2175
2947
  switch (e.prev = e.next) {
2176
2948
  case 0:
@@ -2198,13 +2970,13 @@ var ne = Promise.resolve({
2198
2970
  }));
2199
2971
  },
2200
2972
  create: function create(e) {
2201
- return S(n, void 0, void 0, i().mark(function t() {
2973
+ return we(n, void 0, void 0, de().mark(function t() {
2202
2974
  var r, n;
2203
- return i().wrap(function (t) {
2975
+ return de().wrap(function (t) {
2204
2976
  for (;;)
2205
2977
  switch (t.prev = t.next) {
2206
2978
  case 0:
2207
- return Q("stytch.discovery.organizations.create").isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("organization_name", e.organization_name).isOptionalString("organization_slug", e.organization_slug).isOptionalString("organization_logo_url", e.organization_logo_url).isOptionalString("sso_jit_provisioning", e.sso_jit_provisioning).isOptionalStringArray("email_allowed_domains", e.email_allowed_domains).isOptionalString("email_invites", e.email_invites).isOptionalString("auth_methods", e.auth_methods).isOptionalStringArray("allowed_auth_methods", e.allowed_auth_methods).isOptionalString("mfa_policy", e.mfa_policy), t.t0 = Object, t.t1 = Object.assign({}, e), t.next = 5, this._subscriptionService.getIntermediateSessionToken();
2979
+ return qe("stytch.discovery.organizations.create").isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("organization_name", e.organization_name).isOptionalString("organization_slug", e.organization_slug).isOptionalString("organization_logo_url", e.organization_logo_url).isOptionalString("sso_jit_provisioning", e.sso_jit_provisioning).isOptionalStringArray("email_allowed_domains", e.email_allowed_domains).isOptionalString("email_invites", e.email_invites).isOptionalString("auth_methods", e.auth_methods).isOptionalStringArray("allowed_auth_methods", e.allowed_auth_methods).isOptionalString("mfa_policy", e.mfa_policy), t.t0 = Object, t.t1 = Object.assign({}, e), t.next = 5, this._subscriptionService.getIntermediateSessionToken();
2208
2980
  case 5:
2209
2981
  if (t.t2 = t.sent, t.t2) {
2210
2982
  t.next = 8;
@@ -2244,13 +3016,13 @@ var ne = Promise.resolve({
2244
3016
  }
2245
3017
  }, this.intermediateSessions = {
2246
3018
  exchange: function exchange(e) {
2247
- return S(n, void 0, void 0, i().mark(function t() {
3019
+ return we(n, void 0, void 0, de().mark(function t() {
2248
3020
  var r, n;
2249
- return i().wrap(function (t) {
3021
+ return de().wrap(function (t) {
2250
3022
  for (;;)
2251
3023
  switch (t.prev = t.next) {
2252
3024
  case 0:
2253
- return Q("stytch.discovery.intermediateSessions.exchange").isString("organization_id", e.organization_id).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.t0 = Object, t.t1 = Object.assign({}, e), t.next = 5, this._subscriptionService.getIntermediateSessionToken();
3025
+ return qe("stytch.discovery.intermediateSessions.exchange").isString("organization_id", e.organization_id).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.t0 = Object, t.t1 = Object.assign({}, e), t.next = 5, this._subscriptionService.getIntermediateSessionToken();
2254
3026
  case 5:
2255
3027
  if (t.t2 = t.sent, t.t2) {
2256
3028
  t.next = 8;
@@ -2293,23 +3065,23 @@ var ne = Promise.resolve({
2293
3065
  Promise.resolve({
2294
3066
  pkceRequiredForPasswordResets: !1
2295
3067
  });
2296
- var de, he, pe, _e, me, fe, ve, be, ge, ye, ke, Se = s(function e(t, r) {
2297
- var n = this, o = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : te();
2298
- a(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = o, this.sms = {
3068
+ var tt = pe(function e(t, r) {
3069
+ var n = this, i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : Ge();
3070
+ _e(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = i, this.sms = {
2299
3071
  send: function send(e) {
2300
- return S(n, void 0, void 0, i().mark(function t() {
2301
- var r, n, o;
2302
- return i().wrap(function (t) {
3072
+ return we(n, void 0, void 0, de().mark(function t() {
3073
+ var r, n, i;
3074
+ return de().wrap(function (t) {
2303
3075
  for (;;)
2304
3076
  switch (t.prev = t.next) {
2305
3077
  case 0:
2306
- return Q("stytch.otps.sms.send").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isOptionalString("mfa_phone_number", e.mfa_phone_number).isOptionalString("locale", e.locale), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
3078
+ return qe("stytch.otps.sms.send").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isOptionalString("mfa_phone_number", e.mfa_phone_number).isOptionalString("locale", e.locale), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
2307
3079
  case 3:
2308
- return r = t.sent, n = r.dfp_telemetry_id, o = r.captcha_token, t.abrupt("return", this._networkClient.retriableFetchSDK({
3080
+ return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.abrupt("return", this._networkClient.retriableFetchSDK({
2309
3081
  url: "/b2b/otps/sms/send",
2310
3082
  body: Object.assign(Object.assign({}, e), {
2311
3083
  dfp_telemetry_id: n,
2312
- captcha_token: o
3084
+ captcha_token: i
2313
3085
  }),
2314
3086
  errorMessage: "Failed to send one time passcode",
2315
3087
  method: "POST",
@@ -2323,15 +3095,15 @@ var de, he, pe, _e, me, fe, ve, be, ge, ye, ke, Se = s(function e(t, r) {
2323
3095
  }));
2324
3096
  },
2325
3097
  authenticate: function authenticate(e) {
2326
- return S(n, void 0, void 0, i().mark(function t() {
2327
- var r, n, o, s, a;
2328
- return i().wrap(function (t) {
3098
+ return we(n, void 0, void 0, de().mark(function t() {
3099
+ var r, n, i, o, s;
3100
+ return de().wrap(function (t) {
2329
3101
  for (;;)
2330
3102
  switch (t.prev = t.next) {
2331
3103
  case 0:
2332
- return Q("stytch.otps.sms.authenticate").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isString("code", e.code).isOptionalString("set_mfa_enrollment", e.set_mfa_enrollment), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
3104
+ return qe("stytch.otps.sms.authenticate").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isString("code", e.code).isOptionalString("set_mfa_enrollment", e.set_mfa_enrollment), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
2333
3105
  case 3:
2334
- return r = t.sent, n = r.dfp_telemetry_id, o = r.captcha_token, t.t0 = Object, t.t1 = Object.assign({}, e), t.t2 = n, t.t3 = o, t.next = 12, this._subscriptionService.getIntermediateSessionToken();
3106
+ return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.t0 = Object, t.t1 = Object.assign({}, e), t.t2 = n, t.t3 = i, t.next = 12, this._subscriptionService.getIntermediateSessionToken();
2335
3107
  case 12:
2336
3108
  if (t.t4 = t.sent, t.t4) {
2337
3109
  t.next = 15;
@@ -2343,23 +3115,23 @@ var de, he, pe, _e, me, fe, ve, be, ge, ye, ke, Se = s(function e(t, r) {
2343
3115
  dfp_telemetry_id: t.t2,
2344
3116
  captcha_token: t.t3,
2345
3117
  intermediate_session_token: t.t5
2346
- }, s = t.t0.assign.call(t.t0, t.t1, t.t6), t.next = 20, this._networkClient.retriableFetchSDK({
3118
+ }, o = t.t0.assign.call(t.t0, t.t1, t.t6), t.next = 20, this._networkClient.retriableFetchSDK({
2347
3119
  url: "/b2b/otps/sms/authenticate",
2348
- body: s,
3120
+ body: o,
2349
3121
  errorMessage: "Failed to authenticate one time passcode",
2350
3122
  method: "POST",
2351
3123
  retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
2352
3124
  });
2353
3125
  case 20:
2354
- return a = t.sent, this._subscriptionService.updateStateAndTokens({
3126
+ return s = t.sent, this._subscriptionService.updateStateAndTokens({
2355
3127
  state: {
2356
- session: a.member_session,
2357
- member: a.member
3128
+ session: s.member_session,
3129
+ member: s.member
2358
3130
  },
2359
- session_token: a.session_token,
2360
- session_jwt: a.session_jwt,
3131
+ session_token: s.session_token,
3132
+ session_jwt: s.session_jwt,
2361
3133
  intermediate_session_token: null
2362
- }), t.abrupt("return", a);
3134
+ }), t.abrupt("return", s);
2363
3135
  case 23:
2364
3136
  case "end":
2365
3137
  return t.stop();
@@ -2368,15 +3140,125 @@ var de, he, pe, _e, me, fe, ve, be, ge, ye, ke, Se = s(function e(t, r) {
2368
3140
  }));
2369
3141
  }
2370
3142
  };
2371
- }), we = function () {
3143
+ }), rt = function () {
3144
+ function e(t, r) {
3145
+ var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : Ge();
3146
+ _e(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n;
3147
+ }
3148
+ return pe(e, [{
3149
+ key: "create",
3150
+ value: function value(e) {
3151
+ return we(this, void 0, void 0, de().mark(function t() {
3152
+ var r, n, i;
3153
+ return de().wrap(function (t) {
3154
+ for (;;)
3155
+ switch (t.prev = t.next) {
3156
+ case 0:
3157
+ return qe("stytch.totp.create").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isOptionalNumber("expiration_minutes", e.expiration_minutes), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
3158
+ case 3:
3159
+ return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.abrupt("return", this._networkClient.retriableFetchSDK({
3160
+ url: "/b2b/totp",
3161
+ body: Object.assign(Object.assign({}, e), {
3162
+ dfp_telemetry_id: n,
3163
+ captcha_token: i
3164
+ }),
3165
+ errorMessage: "Failed to create TOTP",
3166
+ method: "POST",
3167
+ retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
3168
+ }));
3169
+ case 7:
3170
+ case "end":
3171
+ return t.stop();
3172
+ }
3173
+ }, t, this);
3174
+ }));
3175
+ }
3176
+ }, {
3177
+ key: "authenticate",
3178
+ value: function value(e) {
3179
+ return we(this, void 0, void 0, de().mark(function t() {
3180
+ var r, n, i, o, s;
3181
+ return de().wrap(function (t) {
3182
+ for (;;)
3183
+ switch (t.prev = t.next) {
3184
+ case 0:
3185
+ return qe("stytch.totp.authenticate").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isString("code", e.code).isOptionalString("set_mfa_enrollment", e.set_mfa_enrollment).isOptionalBoolean("set_default_mfa", e.set_default_mfa), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
3186
+ case 3:
3187
+ return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.t0 = Object, t.t1 = Object.assign({}, e), t.t2 = n, t.t3 = i, t.next = 12, this._subscriptionService.getIntermediateSessionToken();
3188
+ case 12:
3189
+ if (t.t4 = t.sent, t.t4) {
3190
+ t.next = 15;
3191
+ break;
3192
+ }
3193
+ t.t4 = void 0;
3194
+ case 15:
3195
+ return t.t5 = t.t4, t.t6 = {
3196
+ dfp_telemetry_id: t.t2,
3197
+ captcha_token: t.t3,
3198
+ intermediate_session_token: t.t5
3199
+ }, o = t.t0.assign.call(t.t0, t.t1, t.t6), t.next = 20, this._networkClient.retriableFetchSDK({
3200
+ url: "/b2b/totp/authenticate",
3201
+ body: o,
3202
+ errorMessage: "Failed to authenticate TOTP",
3203
+ method: "POST",
3204
+ retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
3205
+ });
3206
+ case 20:
3207
+ return s = t.sent, this._subscriptionService.updateStateAndTokens({
3208
+ state: {
3209
+ session: s.member_session,
3210
+ member: s.member
3211
+ },
3212
+ session_token: s.session_token,
3213
+ session_jwt: s.session_jwt,
3214
+ intermediate_session_token: null
3215
+ }), t.abrupt("return", s);
3216
+ case 23:
3217
+ case "end":
3218
+ return t.stop();
3219
+ }
3220
+ }, t, this);
3221
+ }));
3222
+ }
3223
+ }]), e;
3224
+ }(), nt = function () {
3225
+ function e(t, r, n) {
3226
+ var i = this;
3227
+ _e(this, e), this._subscriptionService = n, this.isAuthorizedSync = function (e, t) {
3228
+ var r;
3229
+ return !!(null === (r = i.cachedPolicy) || void 0 === r ? void 0 : r.callerIsAuthorized(i.roleIds(), e, t));
3230
+ }, this.isAuthorized = function (e, t) {
3231
+ return i.policyPromise.then(function (r) {
3232
+ return r.callerIsAuthorized(i.roleIds(), e, t);
3233
+ });
3234
+ }, this.cachedPolicy = t.rbacPolicy ? ft.fromJSON(t.rbacPolicy) : null, this.policyPromise = r.then(function (e) {
3235
+ return e.rbacPolicy ? (i.cachedPolicy = ft.fromJSON(e.rbacPolicy), i.cachedPolicy) : (Ke("Unable to retrieve RBAC policy from servers. Assuming caller has no permissions."), new ft([], []));
3236
+ });
3237
+ }
3238
+ return pe(e, [{
3239
+ key: "allPermissions",
3240
+ value: function value() {
3241
+ var e = this;
3242
+ return this.policyPromise.then(function (t) {
3243
+ return t.allPermissionsForCaller(e.roleIds());
3244
+ });
3245
+ }
3246
+ }, {
3247
+ key: "roleIds",
3248
+ value: function value() {
3249
+ var e, t = this._subscriptionService.getSession();
3250
+ return t && null !== (e = t.roles) && void 0 !== e ? e : [];
3251
+ }
3252
+ }]), e;
3253
+ }(), it = function () {
2372
3254
  function e(t, r) {
2373
3255
  var n = this;
2374
- a(this, e), this._subscriptionService = t, this._headlessSessionClient = r, this._onDataChange = function (e) {
3256
+ _e(this, e), this._subscriptionService = t, this._headlessSessionClient = r, this._onDataChange = function (e) {
2375
3257
  (null == e ? void 0 : e.session) ? n.scheduleBackgroundRefresh() : n.cancelBackgroundRefresh();
2376
3258
  }, this._reauthenticateWithBackoff = function () {
2377
- return S(n, void 0, void 0, i().mark(function t() {
3259
+ return we(n, void 0, void 0, de().mark(function t() {
2378
3260
  var r;
2379
- return i().wrap(function (t) {
3261
+ return de().wrap(function (t) {
2380
3262
  for (;;)
2381
3263
  switch (t.prev = t.next) {
2382
3264
  case 0:
@@ -2406,14 +3288,14 @@ var de, he, pe, _e, me, fe, ve, be, ge, ye, ke, Se = s(function e(t, r) {
2406
3288
  }));
2407
3289
  }, this.timeout = null, this._subscriptionService.subscribeToState(this._onDataChange);
2408
3290
  }
2409
- return s(e, [{
3291
+ return pe(e, [{
2410
3292
  key: "performBackgroundRefresh",
2411
3293
  value: function value() {
2412
3294
  var e = this;
2413
3295
  this._reauthenticateWithBackoff().then(function () {
2414
3296
  e.scheduleBackgroundRefresh();
2415
3297
  })["catch"](function (t) {
2416
- $("Session background refresh failed. Signalling to app that user is logged out.", {
3298
+ Ne("Session background refresh failed. Signalling to app that user is logged out.", {
2417
3299
  error: t
2418
3300
  }), e._subscriptionService.destroyState();
2419
3301
  });
@@ -2439,11 +3321,52 @@ var de, he, pe, _e, me, fe, ve, be, ge, ye, ke, Se = s(function e(t, r) {
2439
3321
  }, {
2440
3322
  key: "isUnrecoverableError",
2441
3323
  value: function value(e) {
2442
- return x.includes(e.error_type);
3324
+ return A.includes(e.error_type);
3325
+ }
3326
+ }]), e;
3327
+ }();
3328
+ it.REFRESH_INTERVAL_MS = 18e4;
3329
+ var ot, st, at, ct, ut, lt, dt, ht, pt, _t, ft = function () {
3330
+ function e(t, r) {
3331
+ var n = this;
3332
+ _e(this, e), this.roles = t, this.resources = r, this.rolesByID = {}, t.forEach(function (e) {
3333
+ return n.rolesByID[e.role_id] = e;
3334
+ });
3335
+ }
3336
+ return pe(e, [{
3337
+ key: "callerIsAuthorized",
3338
+ value: function value(e, t, r) {
3339
+ var n = this;
3340
+ return !!e.map(function (e) {
3341
+ return n.rolesByID[e];
3342
+ }).filter(function (e) {
3343
+ return e;
3344
+ }).flatMap(function (e) {
3345
+ return e.permissions;
3346
+ }).filter(function (e) {
3347
+ return e.resource_id === t;
3348
+ }).find(function (e) {
3349
+ return e.actions.includes(r) || e.actions.includes("*");
3350
+ });
3351
+ }
3352
+ }, {
3353
+ key: "allPermissionsForCaller",
3354
+ value: function value(e) {
3355
+ var t = this, r = {};
3356
+ return this.resources.forEach(function (n) {
3357
+ r[n.resource_id] = {}, n.actions.forEach(function (i) {
3358
+ r[n.resource_id][i] = t.callerIsAuthorized(e, n.resource_id, i);
3359
+ });
3360
+ }), r;
3361
+ }
3362
+ }], [{
3363
+ key: "fromJSON",
3364
+ value: function value(t) {
3365
+ return new e(t.roles, t.resources);
2443
3366
  }
2444
3367
  }]), e;
2445
3368
  }();
2446
- function Ae(e, t, r, n) {
3369
+ function mt(e, t, r, n) {
2447
3370
  return new (r || (r = Promise))(function (i, o) {
2448
3371
  function s(e) {
2449
3372
  try {
@@ -2470,46 +3393,44 @@ function Ae(e, t, r, n) {
2470
3393
  c((n = n.apply(e, t || [])).next());
2471
3394
  });
2472
3395
  }
2473
- we.REFRESH_INTERVAL_MS = 18e4, "function" == typeof SuppressedError && SuppressedError, function (e) {
3396
+ "function" == typeof SuppressedError && SuppressedError, function (e) {
2474
3397
  e.emailMagicLinks = "emailMagicLinks", e.oauth = "oauth", e.otp = "otp", e.crypto = "crypto", e.passwords = "passwords", e.passkeys = "passkeys";
2475
- }(de || (de = {})), function (e) {
3398
+ }(ot || (ot = {})), function (e) {
2476
3399
  e.Google = "google", e.Microsoft = "microsoft", e.Apple = "apple", e.Github = "github", e.GitLab = "gitlab", e.Facebook = "facebook", e.Discord = "discord", e.Salesforce = "salesforce", e.Slack = "slack", e.Amazon = "amazon", e.Bitbucket = "bitbucket", e.LinkedIn = "linkedin", e.Coinbase = "coinbase", e.Twitch = "twitch", e.Twitter = "twitter", e.TikTok = "tiktok", e.Snapchat = "snapchat", e.Figma = "figma", e.Yahoo = "yahoo";
2477
- }(he || (he = {})), function (e) {
3400
+ }(st || (st = {})), function (e) {
2478
3401
  e.Vessel = "Vessel", e.Phantom = "Phantom", e.Metamask = "Metamask", e.Coinbase = "Coinbase", e.Binance = "Binance", e.GenericEthereumWallet = "Other Ethereum Wallet", e.GenericSolanaWallet = "Other Solana Wallet";
2479
- }(pe || (pe = {})), function (e) {
3402
+ }(at || (at = {})), function (e) {
2480
3403
  e.embedded = "embedded", e.floating = "floating";
2481
- }(_e || (_e = {})), function (e) {
3404
+ }(ct || (ct = {})), function (e) {
2482
3405
  e.SMS = "sms", e.WhatsApp = "whatsapp", e.Email = "email";
2483
- }(me || (me = {})), function (e) {
2484
- e.MagicLinkLoginOrCreateEvent = "MAGIC_LINK_LOGIN_OR_CREATE", e.OTPsLoginOrCreateEvent = "OTP_LOGIN_OR_CREATE", e.OTPsAuthenticate = "OTP_AUTHENTICATE", e.CryptoWalletAuthenticateStart = "CRYPTO_WALLET_AUTHENTICATE_START", e.CryptoWalletAuthenticate = "CRYPTO_WALLET_AUTHENTICATE", e.PasswordCreate = "PASSWORD_CREATE", e.PasswordAuthenticate = "PASSWORD_AUTHENTICATE", e.PasswordResetByEmailStart = "PASSWORD_RESET_BY_EMAIL_START", e.PasswordResetByEmail = "PASSWORD_RESET_BY_EMAIL", e.PasskeyRegister = "PASSKEY_REGISTER", e.PasskeyAuthenticate = "PASSKEY_AUTHENTICATE", e.PasskeySkip = "PASSKEY_SKIP", e.PasskeyDone = "PASSKEY_DONE", e.B2BMagicLinkEmailLoginOrSignup = "B2B_MAGIC_LINK_EMAIL_LOGIN_OR_SIGNUP", e.B2BMagicLinkAuthenticate = "B2B_MAGIC_LINK_AUTHENTICATE", e.B2BMagicLinkEmailDiscoverySend = "B2B_MAGIC_LINK_EMAIL_DISCOVERY_SEND", e.B2BMagicLinkDiscoveryAuthenticate = "B2B_MAGIC_LINK_DISCOVERY_AUTHENTICATE", e.B2BSSOStart = "B2B_SSO_START", e.B2BSSOAuthenticate = "B2B_SSO_AUTHENTICATE", e.B2BOAuthAuthenticate = "B2B_SSO_AUTHENTICATE", e.B2BOAuthDiscoveryAuthenticate = "B2B_OAUTH_DISCOVERY_AUTHENTICATE", e.B2BDiscoveryOrganizationsCreate = "B2B_DISCOVERY_ORGANIZATIONS_CREATE", e.B2BDiscoveryIntermediateSessionExchange = "B2B_DISCOVERY_INTERMEDIATE_SESSION_EXCHANGE", e.B2BPasswordAuthenticate = "B2B_PASSWORD_AUTHENTICATE", e.B2BPasswordResetByEmailStart = "B2B_PASSWORD_RESET_BY_EMAIL_START", e.B2BPasswordResetByEmail = "B2B_PASSWORD_RESET_BY_EMAIL", e.B2BPasswordResetBySession = "B2B_PASSWORD_RESET_BY_SESSION";
2485
- }(fe || (fe = {}));
2486
- var Ee = /*#__PURE__*/ function (_Error) {
2487
- _inherits(Ee, _Error);
2488
- var _super = _createSuper(Ee);
2489
- function Ee(e, t) {
3406
+ }(ut || (ut = {})), function (e) {
3407
+ e.MagicLinkLoginOrCreateEvent = "MAGIC_LINK_LOGIN_OR_CREATE", e.OTPsLoginOrCreateEvent = "OTP_LOGIN_OR_CREATE", e.OTPsAuthenticate = "OTP_AUTHENTICATE", e.CryptoWalletAuthenticateStart = "CRYPTO_WALLET_AUTHENTICATE_START", e.CryptoWalletAuthenticate = "CRYPTO_WALLET_AUTHENTICATE", e.PasswordCreate = "PASSWORD_CREATE", e.PasswordAuthenticate = "PASSWORD_AUTHENTICATE", e.PasswordResetByEmailStart = "PASSWORD_RESET_BY_EMAIL_START", e.PasswordResetByEmail = "PASSWORD_RESET_BY_EMAIL", e.PasskeyRegister = "PASSKEY_REGISTER", e.PasskeyAuthenticate = "PASSKEY_AUTHENTICATE", e.PasskeySkip = "PASSKEY_SKIP", e.PasskeyDone = "PASSKEY_DONE", e.B2BMagicLinkEmailLoginOrSignup = "B2B_MAGIC_LINK_EMAIL_LOGIN_OR_SIGNUP", e.B2BMagicLinkAuthenticate = "B2B_MAGIC_LINK_AUTHENTICATE", e.B2BMagicLinkEmailDiscoverySend = "B2B_MAGIC_LINK_EMAIL_DISCOVERY_SEND", e.B2BMagicLinkDiscoveryAuthenticate = "B2B_MAGIC_LINK_DISCOVERY_AUTHENTICATE", e.B2BSSOStart = "B2B_SSO_START", e.B2BSSOAuthenticate = "B2B_SSO_AUTHENTICATE", e.B2BOAuthAuthenticate = "B2B_OAUTH_AUTHENTICATE", e.B2BOAuthDiscoveryAuthenticate = "B2B_OAUTH_DISCOVERY_AUTHENTICATE", e.B2BDiscoveryOrganizationsCreate = "B2B_DISCOVERY_ORGANIZATIONS_CREATE", e.B2BDiscoveryIntermediateSessionExchange = "B2B_DISCOVERY_INTERMEDIATE_SESSION_EXCHANGE", e.B2BPasswordAuthenticate = "B2B_PASSWORD_AUTHENTICATE", e.B2BPasswordResetByEmailStart = "B2B_PASSWORD_RESET_BY_EMAIL_START", e.B2BPasswordResetByEmail = "B2B_PASSWORD_RESET_BY_EMAIL", e.B2BPasswordResetBySession = "B2B_PASSWORD_RESET_BY_SESSION";
3408
+ }(lt || (lt = {}));
3409
+ var vt = /*#__PURE__*/ function (_Error) {
3410
+ _inherits(vt, _Error);
3411
+ var _super = _createSuper(vt);
3412
+ function vt(e, t) {
2490
3413
  var _this;
2491
- _classCallCheck(this, Ee);
3414
+ _classCallCheck(this, vt);
2492
3415
  _this = _super.call(this), _this.name = "StytchSDKUsageError", _this.message = "Invalid call to ".concat(e, "\n") + t;
2493
3416
  return _this;
2494
3417
  }
2495
- return _createClass(Ee);
3418
+ return _createClass(vt);
2496
3419
  }(/*#__PURE__*/ _wrapNativeSuper(Error));
2497
3420
  !function (e) {
2498
- e.BiometricsSensorError = "biometrics_sensor_error", e.DeviceCredentialsNotAllowed = "device_credentials_not_allowed", e.DeviceHardwareError = "device_hardware_error", e.InternalError = "internal_error", e.KeyInvalidated = "key_invalidated", e.KeystoreUnavailable = "keystore_unavailable", e.NoBiometricsEnrolled = "no_biometrics_enrolled", e.NoBiometricsRegistration = "no_biometrics_registration", e.SessionExpired = "session_expired", e.UserCancellation = "user_cancellation", e.UserLockedOut = "user_locked_out", e.BiometricsNotAvailable = "biometrics_not_available";
2499
- }(ve || (ve = {})), function (e) {
2500
3421
  e.emailMagicLinks = "emailMagicLinks", e.sso = "sso", e.passwords = "passwords", e.oauth = "oauth";
2501
- }(be || (be = {})), function (e) {
3422
+ }(dt || (dt = {})), function (e) {
2502
3423
  e.Discovery = "Discovery", e.Organization = "Organization", e.PasswordReset = "PasswordReset";
2503
- }(ge || (ge = {})), function (e) {
3424
+ }(ht || (ht = {})), function (e) {
2504
3425
  e.Google = "google", e.Microsoft = "microsoft";
2505
- }(ye || (ye = {})), function (e) {
3426
+ }(pt || (pt = {})), function (e) {
2506
3427
  e.RequiredCatcha = "Catcha Required";
2507
- }(ke || (ke = {}));
2508
- var Te = function Te(e) {
3428
+ }(_t || (_t = {}));
3429
+ var bt = function bt(e) {
2509
3430
  var t = {
2510
3431
  isObject: function isObject(r, n) {
2511
3432
  if (!("object" == _typeof(n) && !Array.isArray(n) && null !== n))
2512
- throw new Ee(e, r + " must be an object.");
3433
+ throw new vt(e, r + " must be an object.");
2513
3434
  return t;
2514
3435
  },
2515
3436
  isOptionalObject: function isOptionalObject(e, r) {
@@ -2517,7 +3438,7 @@ var Te = function Te(e) {
2517
3438
  },
2518
3439
  isString: function isString(r, n) {
2519
3440
  if ("string" != typeof n)
2520
- throw new Ee(e, r + " must be a string.");
3441
+ throw new vt(e, r + " must be a string.");
2521
3442
  return t;
2522
3443
  },
2523
3444
  isOptionalString: function isOptionalString(e, r) {
@@ -2525,13 +3446,13 @@ var Te = function Te(e) {
2525
3446
  },
2526
3447
  isStringArray: function isStringArray(r, n) {
2527
3448
  if (!Array.isArray(n))
2528
- throw new Ee(e, r + " must be an array of strings.");
3449
+ throw new vt(e, r + " must be an array of strings.");
2529
3450
  var _iterator = _createForOfIteratorHelper(n), _step;
2530
3451
  try {
2531
3452
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
2532
3453
  var _t2 = _step.value;
2533
3454
  if ("string" != typeof _t2)
2534
- throw new Ee(e, r + " must be an array of strings.");
3455
+ throw new vt(e, r + " must be an array of strings.");
2535
3456
  }
2536
3457
  }
2537
3458
  catch (err) {
@@ -2547,7 +3468,7 @@ var Te = function Te(e) {
2547
3468
  },
2548
3469
  isNumber: function isNumber(r, n) {
2549
3470
  if ("number" != typeof n)
2550
- throw new Ee(e, r + " must be a number.");
3471
+ throw new vt(e, r + " must be a number.");
2551
3472
  return t;
2552
3473
  },
2553
3474
  isOptionalNumber: function isOptionalNumber(e, r) {
@@ -2555,7 +3476,7 @@ var Te = function Te(e) {
2555
3476
  },
2556
3477
  isBoolean: function isBoolean(r, n) {
2557
3478
  if ("boolean" != typeof n)
2558
- throw new Ee(e, r + " must be a boolean.");
3479
+ throw new vt(e, r + " must be a boolean.");
2559
3480
  return t;
2560
3481
  },
2561
3482
  isOptionalBoolean: function isOptionalBoolean(e, r) {
@@ -2564,26 +3485,26 @@ var Te = function Te(e) {
2564
3485
  };
2565
3486
  return t;
2566
3487
  };
2567
- var Oe;
3488
+ var gt;
2568
3489
  !function (e) {
2569
3490
  e.LoginOrCreateEML = "login_or_create_eml", e.LoginOrCreateOTP = "login_or_create_otp", e.ResetPassword = "reset_password";
2570
- }(Oe || (Oe = {})), Promise.resolve({
3491
+ }(gt || (gt = {})), Promise.resolve({
2571
3492
  pkceRequiredForEmailMagicLinks: !1
2572
3493
  }), Promise.resolve({
2573
3494
  pkceRequiredForPasswordResets: !1
2574
3495
  }), Promise.resolve({
2575
3496
  pkceRequiredForEmailMagicLinks: !1
2576
3497
  });
2577
- var Pe = Promise.resolve({
3498
+ var yt = Promise.resolve({
2578
3499
  pkceRequiredForPasswordResets: !1
2579
3500
  });
2580
- var Ce = /*#__PURE__*/ function () {
2581
- function Ce(e, t, r) {
2582
- var n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Pe;
3501
+ var kt = /*#__PURE__*/ function () {
3502
+ function kt(e, t, r) {
3503
+ var n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : yt;
2583
3504
  var i = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function () {
2584
3505
  return {
2585
3506
  isEnabled: function isEnabled() {
2586
- return Ae(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee() {
3507
+ return mt(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee() {
2587
3508
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2588
3509
  while (1)
2589
3510
  switch (_context.prev = _context.next) {
@@ -2597,7 +3518,7 @@ var Ce = /*#__PURE__*/ function () {
2597
3518
  }));
2598
3519
  },
2599
3520
  getTelemetryID: function getTelemetryID() {
2600
- return Ae(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee2() {
3521
+ return mt(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee2() {
2601
3522
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2602
3523
  while (1)
2603
3524
  switch (_context2.prev = _context2.next) {
@@ -2609,7 +3530,7 @@ var Ce = /*#__PURE__*/ function () {
2609
3530
  }));
2610
3531
  },
2611
3532
  getDFPTelemetryIDAndCaptcha: function getDFPTelemetryIDAndCaptcha() {
2612
- return Ae(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee3() {
3533
+ return mt(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee3() {
2613
3534
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
2614
3535
  while (1)
2615
3536
  switch (_context3.prev = _context3.next) {
@@ -2626,7 +3547,7 @@ var Ce = /*#__PURE__*/ function () {
2626
3547
  }));
2627
3548
  },
2628
3549
  retryWithCaptchaAndDFP: function retryWithCaptchaAndDFP() {
2629
- return Ae(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee4() {
3550
+ return mt(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee4() {
2630
3551
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
2631
3552
  while (1)
2632
3553
  switch (_context4.prev = _context4.next) {
@@ -2641,13 +3562,13 @@ var Ce = /*#__PURE__*/ function () {
2641
3562
  }
2642
3563
  };
2643
3564
  }();
2644
- _classCallCheck(this, Ce);
3565
+ _classCallCheck(this, kt);
2645
3566
  this._networkClient = e, this._subscriptionService = t, this._pkceManager = r, this._config = n, this.dfpProtectedAuth = i;
2646
3567
  }
2647
- _createClass(Ce, [{
3568
+ _createClass(kt, [{
2648
3569
  key: "getCodeChallenge",
2649
3570
  value: function getCodeChallenge() {
2650
- return Ae(this, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee5() {
3571
+ return mt(this, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee5() {
2651
3572
  var _yield$this$_config, e, t;
2652
3573
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
2653
3574
  while (1)
@@ -2689,13 +3610,13 @@ var Ce = /*#__PURE__*/ function () {
2689
3610
  }, {
2690
3611
  key: "authenticate",
2691
3612
  value: function authenticate(e) {
2692
- return Ae(this, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee6() {
3613
+ return mt(this, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee6() {
2693
3614
  var t, r, _yield$this$dfpProtec, n, i, o;
2694
3615
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
2695
3616
  while (1)
2696
3617
  switch (_context6.prev = _context6.next) {
2697
3618
  case 0:
2698
- Te("stytch.passwords.authenticate").isString("org_id", e.organization_id).isString("password", e.password).isString("email_address", e.email_address).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale);
3619
+ bt("stytch.passwords.authenticate").isString("org_id", e.organization_id).isString("password", e.password).isString("email_address", e.email_address).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale);
2699
3620
  _context6.next = 3;
2700
3621
  return this._pkceManager.getPKPair();
2701
3622
  case 3:
@@ -2750,13 +3671,13 @@ var Ce = /*#__PURE__*/ function () {
2750
3671
  }, {
2751
3672
  key: "resetByEmailStart",
2752
3673
  value: function resetByEmailStart(e) {
2753
- return Ae(this, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee7() {
3674
+ return mt(this, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee7() {
2754
3675
  var t, _yield$this$dfpProtec2, r, n;
2755
3676
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
2756
3677
  while (1)
2757
3678
  switch (_context7.prev = _context7.next) {
2758
3679
  case 0:
2759
- Te("stytch.passwords.resetByEmailStart").isString("email", e.email_address).isOptionalString("login_redirect_url", e.login_redirect_url).isOptionalString("reset_password_redirect_url", e.reset_password_redirect_url).isOptionalString("reset_password_template_id", e.reset_password_template_id).isOptionalNumber("reset_password_expiration_minutes", e.reset_password_expiration_minutes);
3680
+ bt("stytch.passwords.resetByEmailStart").isString("email", e.email_address).isOptionalString("login_redirect_url", e.login_redirect_url).isOptionalString("reset_password_redirect_url", e.reset_password_redirect_url).isOptionalString("reset_password_template_id", e.reset_password_template_id).isOptionalNumber("reset_password_expiration_minutes", e.reset_password_expiration_minutes);
2760
3681
  _context7.next = 3;
2761
3682
  return this.getCodeChallenge();
2762
3683
  case 3:
@@ -2794,13 +3715,13 @@ var Ce = /*#__PURE__*/ function () {
2794
3715
  }, {
2795
3716
  key: "resetByEmail",
2796
3717
  value: function resetByEmail(e) {
2797
- return Ae(this, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee8() {
3718
+ return mt(this, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee8() {
2798
3719
  var _yield$this$dfpProtec3, t, r, n, i, o;
2799
3720
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
2800
3721
  while (1)
2801
3722
  switch (_context8.prev = _context8.next) {
2802
3723
  case 0:
2803
- Te("stytch.passwords.resetByEmail").isString("password_reset_token", e.password_reset_token).isString("password", e.password).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale);
3724
+ bt("stytch.passwords.resetByEmail").isString("password_reset_token", e.password_reset_token).isString("password", e.password).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale);
2804
3725
  _context8.next = 3;
2805
3726
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
2806
3727
  case 3:
@@ -2854,13 +3775,13 @@ var Ce = /*#__PURE__*/ function () {
2854
3775
  }, {
2855
3776
  key: "resetByExistingPassword",
2856
3777
  value: function resetByExistingPassword(e) {
2857
- return Ae(this, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee9() {
3778
+ return mt(this, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee9() {
2858
3779
  var _yield$this$dfpProtec4, t, r, n;
2859
3780
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
2860
3781
  while (1)
2861
3782
  switch (_context9.prev = _context9.next) {
2862
3783
  case 0:
2863
- Te("stytch.passwords.resetByExistingPassword").isString("email", e.email_address).isString("existing_password", e.existing_password).isString("new_password", e.new_password).isOptionalString("locale", e.locale);
3784
+ bt("stytch.passwords.resetByExistingPassword").isString("email", e.email_address).isString("existing_password", e.existing_password).isString("new_password", e.new_password).isOptionalString("locale", e.locale);
2864
3785
  _context9.next = 3;
2865
3786
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
2866
3787
  case 3:
@@ -2909,13 +3830,13 @@ var Ce = /*#__PURE__*/ function () {
2909
3830
  }, {
2910
3831
  key: "resetBySession",
2911
3832
  value: function resetBySession(e) {
2912
- return Ae(this, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee10() {
3833
+ return mt(this, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee10() {
2913
3834
  var _yield$this$dfpProtec5, t, r, n;
2914
3835
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
2915
3836
  while (1)
2916
3837
  switch (_context10.prev = _context10.next) {
2917
3838
  case 0:
2918
- Te("stytch.passwords.resetBySession").isString("password", e.password);
3839
+ bt("stytch.passwords.resetBySession").isString("password", e.password);
2919
3840
  _context10.next = 3;
2920
3841
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
2921
3842
  case 3:
@@ -2955,12 +3876,12 @@ var Ce = /*#__PURE__*/ function () {
2955
3876
  }, {
2956
3877
  key: "strengthCheck",
2957
3878
  value: function strengthCheck(e) {
2958
- return Ae(this, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee11() {
3879
+ return mt(this, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee11() {
2959
3880
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
2960
3881
  while (1)
2961
3882
  switch (_context11.prev = _context11.next) {
2962
3883
  case 0:
2963
- return _context11.abrupt("return", (Te("stytch.passwords.strengthCheck").isOptionalString("email", e.email_address).isString("password", e.password), this._networkClient.fetchSDK({
3884
+ return _context11.abrupt("return", (bt("stytch.passwords.strengthCheck").isOptionalString("email", e.email_address).isString("password", e.password), this._networkClient.fetchSDK({
2964
3885
  url: "/b2b/passwords/strength_check",
2965
3886
  method: "POST",
2966
3887
  errorMessage: "Failed to check password strength.",
@@ -2977,21 +3898,21 @@ var Ce = /*#__PURE__*/ function () {
2977
3898
  }));
2978
3899
  }
2979
3900
  }]);
2980
- return Ce;
3901
+ return kt;
2981
3902
  }();
2982
- var Be = "bootstrap";
2983
- var Re = /*#__PURE__*/ function () {
2984
- function Re(e, t, r) {
3903
+ var wt = "bootstrap";
3904
+ var St = /*#__PURE__*/ function () {
3905
+ function St(e, t, r) {
2985
3906
  var _this2 = this;
2986
- _classCallCheck(this, Re);
3907
+ _classCallCheck(this, St);
2987
3908
  this._publicToken = e, this._networkClient = t, this._dataLayer = r, this._bootstrapDataPromise = this._networkClient.fetchSDK({
2988
3909
  url: "/projects/bootstrap/".concat(this._publicToken),
2989
3910
  method: "GET",
2990
3911
  errorMessage: "Error fetching bootstrap data for SDK for ".concat(this._publicToken)
2991
- }).then(Re.mapBootstrapData).then(function (e) {
2992
- return _this2._dataLayer.setItem(Be, JSON.stringify(e)), e;
3912
+ }).then(St.mapBootstrapData).then(function (e) {
3913
+ return _this2._dataLayer.setItem(wt, JSON.stringify(e)), e;
2993
3914
  })["catch"](function (e) {
2994
- return J(e), {
3915
+ return Ke(e), {
2995
3916
  displayWatermark: !1,
2996
3917
  cnameDomain: null,
2997
3918
  emailDomains: ["stytch.com"],
@@ -3005,14 +3926,15 @@ var Re = /*#__PURE__*/ function () {
3005
3926
  slugPattern: null,
3006
3927
  createOrganizationEnabled: !1,
3007
3928
  passwordConfig: null,
3008
- runDFPProtectedAuth: !1
3929
+ runDFPProtectedAuth: !1,
3930
+ rbacPolicy: null
3009
3931
  };
3010
3932
  });
3011
3933
  }
3012
- _createClass(Re, [{
3934
+ _createClass(St, [{
3013
3935
  key: "getSync",
3014
3936
  value: function getSync() {
3015
- var e = this._dataLayer.getItem(Be);
3937
+ var e = this._dataLayer.getItem(wt);
3016
3938
  if (null === e)
3017
3939
  return {
3018
3940
  displayWatermark: !1,
@@ -3028,7 +3950,8 @@ var Re = /*#__PURE__*/ function () {
3028
3950
  slugPattern: null,
3029
3951
  createOrganizationEnabled: !1,
3030
3952
  passwordConfig: null,
3031
- runDFPProtectedAuth: !1
3953
+ runDFPProtectedAuth: !1,
3954
+ rbacPolicy: null
3032
3955
  };
3033
3956
  try {
3034
3957
  return JSON.parse(e);
@@ -3048,7 +3971,8 @@ var Re = /*#__PURE__*/ function () {
3048
3971
  slugPattern: null,
3049
3972
  createOrganizationEnabled: !1,
3050
3973
  passwordConfig: null,
3051
- runDFPProtectedAuth: !1
3974
+ runDFPProtectedAuth: !1,
3975
+ rbacPolicy: null
3052
3976
  };
3053
3977
  }
3054
3978
  }
@@ -3060,8 +3984,8 @@ var Re = /*#__PURE__*/ function () {
3060
3984
  }], [{
3061
3985
  key: "mapBootstrapData",
3062
3986
  value: function mapBootstrapData(e) {
3063
- var t;
3064
- var r = null !== e.password_config ? {
3987
+ var t, r;
3988
+ var n = null !== e.password_config ? {
3065
3989
  ludsComplexity: e.password_config.luds_complexity,
3066
3990
  ludsMinimumCount: e.password_config.luds_minimum_count
3067
3991
  } : null;
@@ -3076,19 +4000,20 @@ var Re = /*#__PURE__*/ function () {
3076
4000
  pkceRequiredForSso: e.pkce_required_for_sso,
3077
4001
  slugPattern: e.slug_pattern,
3078
4002
  createOrganizationEnabled: e.create_organization_enabled,
3079
- passwordConfig: r,
4003
+ passwordConfig: n,
3080
4004
  runDFPProtectedAuth: null !== (t = e.dfp_protected_auth_enabled) && void 0 !== t && t,
3081
- dfpProtectedAuthMode: e.dfp_protected_auth_mode
4005
+ dfpProtectedAuthMode: e.dfp_protected_auth_mode,
4006
+ rbacPolicy: null !== (r = e.rbac_policy) && void 0 !== r ? r : null
3082
4007
  };
3083
4008
  }
3084
4009
  }]);
3085
- return Re;
4010
+ return St;
3086
4011
  }();
3087
- var xe = /*#__PURE__*/ _createClass(function xe(e) {
4012
+ var Pt = /*#__PURE__*/ _createClass(function Pt(e) {
3088
4013
  var _this3 = this;
3089
- _classCallCheck(this, xe);
4014
+ _classCallCheck(this, Pt);
3090
4015
  this.bootstrapPromise = e, this.executeRecaptcha = function () {
3091
- return Ae(_this3, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee12() {
4016
+ return mt(_this3, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee12() {
3092
4017
  var _yield$this$state, e, t, r;
3093
4018
  return _regeneratorRuntime().wrap(function _callee12$(_context12) {
3094
4019
  while (1)
@@ -3120,7 +4045,7 @@ var xe = /*#__PURE__*/ _createClass(function xe(e) {
3120
4045
  }, _callee12, this);
3121
4046
  }));
3122
4047
  }, this.state = e.then(function (e) {
3123
- return Ae(_this3, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee13() {
4048
+ return mt(_this3, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee13() {
3124
4049
  var t;
3125
4050
  return _regeneratorRuntime().wrap(function _callee13$(_context13) {
3126
4051
  while (1)
@@ -3132,7 +4057,7 @@ var xe = /*#__PURE__*/ _createClass(function xe(e) {
3132
4057
  }
3133
4058
  _context13.t1 = !0;
3134
4059
  _context13.next = 4;
3135
- return t = e.captchaSettings.siteKey, G("https://www.google.com/recaptcha/enterprise.js?render=".concat(t), function () {
4060
+ return t = e.captchaSettings.siteKey, Be("https://www.google.com/recaptcha/enterprise.js?render=".concat(t), function () {
3136
4061
  return window.grecaptcha.enterprise;
3137
4062
  });
3138
4063
  case 4:
@@ -3159,18 +4084,18 @@ var xe = /*#__PURE__*/ _createClass(function xe(e) {
3159
4084
  }));
3160
4085
  });
3161
4086
  });
3162
- var Ie = /*#__PURE__*/ function () {
3163
- function Ie(e, t, r, n) {
3164
- _classCallCheck(this, Ie);
4087
+ var At = /*#__PURE__*/ function () {
4088
+ function At(e, t, r, n) {
4089
+ _classCallCheck(this, At);
3165
4090
  this._publicToken = e, this._subscriptionDataLayer = t, this.baseURL = r, this.additionalTelemetryDataFn = n, this.updateSessionToken = function () {
3166
4091
  return null;
3167
- }, this.eventLogger = new re({
4092
+ }, this.eventLogger = new He({
3168
4093
  maxBatchSize: 15,
3169
4094
  intervalDurationMs: 800,
3170
4095
  logEventURL: this.buildSDKUrl("/events")
3171
4096
  });
3172
4097
  }
3173
- _createClass(Ie, [{
4098
+ _createClass(At, [{
3174
4099
  key: "logEvent",
3175
4100
  value: function logEvent(_ref) {
3176
4101
  var e = _ref.name, t = _ref.details, _ref$error = _ref.error, r = _ref$error === void 0 ? {} : _ref$error;
@@ -3187,9 +4112,9 @@ var Ie = /*#__PURE__*/ function () {
3187
4112
  key: "createTelemetryBlob",
3188
4113
  value: function createTelemetryBlob() {
3189
4114
  return Object.assign(Object.assign({
3190
- event_id: "event-id-".concat(z()),
3191
- app_session_id: "app-session-id-".concat(z()),
3192
- persistent_id: "persistent-id-".concat(z()),
4115
+ event_id: "event-id-".concat(Re()),
4116
+ app_session_id: "app-session-id-".concat(Re()),
4117
+ persistent_id: "persistent-id-".concat(Re()),
3193
4118
  client_sent_at: new Date().toISOString(),
3194
4119
  timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
3195
4120
  }, this.additionalTelemetryDataFn()), {
@@ -3198,7 +4123,7 @@ var Ie = /*#__PURE__*/ function () {
3198
4123
  },
3199
4124
  sdk: {
3200
4125
  identifier: "Stytch.js Javascript SDK",
3201
- version: "3.2.0"
4126
+ version: "4.1.0"
3202
4127
  }
3203
4128
  });
3204
4129
  }
@@ -3206,14 +4131,14 @@ var Ie = /*#__PURE__*/ function () {
3206
4131
  key: "fetchSDK",
3207
4132
  value: function fetchSDK(_ref2) {
3208
4133
  var e = _ref2.url, t = _ref2.body, r = _ref2.errorMessage, n = _ref2.method;
3209
- return Ae(this, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee14() {
4134
+ return mt(this, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee14() {
3210
4135
  var i, o, s, a;
3211
4136
  return _regeneratorRuntime().wrap(function _callee14$(_context14) {
3212
4137
  while (1)
3213
4138
  switch (_context14.prev = _context14.next) {
3214
4139
  case 0:
3215
4140
  i = this._subscriptionDataLayer.readSessionCookie().session_token, o = "Basic " + window.btoa(this._publicToken + ":" + (i || this._publicToken)), s = window.btoa(JSON.stringify(this.createTelemetryBlob())), a = window.location.origin;
3216
- return _context14.abrupt("return", L({
4141
+ return _context14.abrupt("return", Ae({
3217
4142
  basicAuthHeader: o,
3218
4143
  body: t,
3219
4144
  errorMessage: r,
@@ -3232,42 +4157,42 @@ var Ie = /*#__PURE__*/ function () {
3232
4157
  }, {
3233
4158
  key: "retriableFetchSDK",
3234
4159
  value: function retriableFetchSDK(_ref3) {
3235
- var e = _ref3.url, t = _ref3.body, r = _ref3.errorMessage, n = _ref3.method, o = _ref3.retryCallback;
3236
- return Ae(this, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee15() {
3237
- var s, a, c, u;
4160
+ var e = _ref3.url, t = _ref3.body, r = _ref3.errorMessage, n = _ref3.method, i = _ref3.retryCallback;
4161
+ return mt(this, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee15() {
4162
+ var o, s, a, c;
3238
4163
  return _regeneratorRuntime().wrap(function _callee15$(_context15) {
3239
4164
  while (1)
3240
4165
  switch (_context15.prev = _context15.next) {
3241
4166
  case 0:
3242
- s = this._subscriptionDataLayer.readSessionCookie().session_token, a = "Basic " + window.btoa(this._publicToken + ":" + (s || this._publicToken)), c = window.btoa(JSON.stringify(this.createTelemetryBlob())), u = window.location.origin;
4167
+ o = this._subscriptionDataLayer.readSessionCookie().session_token, s = "Basic " + window.btoa(this._publicToken + ":" + (o || this._publicToken)), a = window.btoa(JSON.stringify(this.createTelemetryBlob())), c = window.location.origin;
3243
4168
  return _context15.abrupt("return", function (e) {
3244
- var t = e.method, r = e.errorMessage, n = e.finalURL, o = e.basicAuthHeader, s = e.xSDKClientHeader, a = e.xSDKParentHostHeader, c = e.body, u = e.retryCallback;
3245
- return S(this, void 0, void 0, i().mark(function e() {
3246
- var l;
3247
- return i().wrap(function (e) {
4169
+ var t = e.method, r = e.errorMessage, n = e.finalURL, i = e.basicAuthHeader, o = e.xSDKClientHeader, s = e.xSDKParentHostHeader, a = e.body, c = e.retryCallback;
4170
+ return we(this, void 0, void 0, de().mark(function e() {
4171
+ var u;
4172
+ return de().wrap(function (e) {
3248
4173
  for (;;)
3249
4174
  switch (e.prev = e.next) {
3250
4175
  case 0:
3251
- return l = {
4176
+ return u = {
3252
4177
  method: t,
3253
4178
  errorMessage: r,
3254
4179
  finalURL: n,
3255
- basicAuthHeader: o,
3256
- xSDKClientHeader: s,
3257
- xSDKParentHostHeader: a,
3258
- body: c
3259
- }, e.prev = 1, e.next = 4, L(l);
4180
+ basicAuthHeader: i,
4181
+ xSDKClientHeader: o,
4182
+ xSDKParentHostHeader: s,
4183
+ body: a
4184
+ }, e.prev = 1, e.next = 4, Ae(u);
3260
4185
  case 4:
3261
4186
  case 15:
3262
4187
  return e.abrupt("return", e.sent);
3263
4188
  case 7:
3264
- if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof D)) {
4189
+ if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof Pe)) {
3265
4190
  e.next = 16;
3266
4191
  break;
3267
4192
  }
3268
- return e.next = 12, u(e.t0, l);
4193
+ return e.next = 12, c(e.t0, u);
3269
4194
  case 12:
3270
- return l = e.sent, e.next = 15, L(l);
4195
+ return u = e.sent, e.next = 15, Ae(u);
3271
4196
  case 16:
3272
4197
  throw e.t0;
3273
4198
  case 17:
@@ -3277,14 +4202,14 @@ var Ie = /*#__PURE__*/ function () {
3277
4202
  }, e, null, [[1, 7]]);
3278
4203
  }));
3279
4204
  }({
3280
- basicAuthHeader: a,
4205
+ basicAuthHeader: s,
3281
4206
  body: t,
3282
4207
  errorMessage: r,
3283
4208
  finalURL: this.buildSDKUrl(e),
3284
4209
  method: n,
3285
- xSDKClientHeader: c,
3286
- xSDKParentHostHeader: u,
3287
- retryCallback: o
4210
+ xSDKClientHeader: a,
4211
+ xSDKParentHostHeader: c,
4212
+ retryCallback: i
3288
4213
  }));
3289
4214
  case 2:
3290
4215
  case "end":
@@ -3299,18 +4224,18 @@ var Ie = /*#__PURE__*/ function () {
3299
4224
  return "".concat(this.baseURL, "/sdk/v1").concat(e);
3300
4225
  }
3301
4226
  }]);
3302
- return Ie;
4227
+ return At;
3303
4228
  }();
3304
- function De(e) {
4229
+ function Ct(e) {
3305
4230
  var t = e.toString(16);
3306
4231
  return 1 === t.length && (t = "0" + t), t;
3307
4232
  }
3308
- var Le = /*#__PURE__*/ function () {
3309
- function Le(e, t) {
3310
- _classCallCheck(this, Le);
4233
+ var Tt = /*#__PURE__*/ function () {
4234
+ function Tt(e, t) {
4235
+ _classCallCheck(this, Tt);
3311
4236
  this._dataLayer = e, this.namespace = t;
3312
4237
  }
3313
- _createClass(Le, [{
4238
+ _createClass(Tt, [{
3314
4239
  key: "key",
3315
4240
  value: function key() {
3316
4241
  return "PKCE_VERIFIER:" + this.namespace;
@@ -3318,14 +4243,14 @@ var Le = /*#__PURE__*/ function () {
3318
4243
  }, {
3319
4244
  key: "startPKCETransaction",
3320
4245
  value: function startPKCETransaction() {
3321
- return Ae(this, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee16() {
4246
+ return mt(this, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee16() {
3322
4247
  var e;
3323
4248
  return _regeneratorRuntime().wrap(function _callee16$(_context16) {
3324
4249
  while (1)
3325
4250
  switch (_context16.prev = _context16.next) {
3326
4251
  case 0:
3327
4252
  _context16.next = 2;
3328
- return Le.createProofkeyPair();
4253
+ return Tt.createProofkeyPair();
3329
4254
  case 2:
3330
4255
  e = _context16.sent;
3331
4256
  return _context16.abrupt("return", (this._dataLayer.setItem(this.key(), JSON.stringify(e)), e));
@@ -3345,7 +4270,7 @@ var Le = /*#__PURE__*/ function () {
3345
4270
  return JSON.parse(e);
3346
4271
  }
3347
4272
  catch (e) {
3348
- return void $("Found malformed Proof Key pair in localstorage.");
4273
+ return void Ne("Found malformed Proof Key pair in localstorage.");
3349
4274
  }
3350
4275
  }
3351
4276
  }, {
@@ -3356,7 +4281,7 @@ var Le = /*#__PURE__*/ function () {
3356
4281
  }], [{
3357
4282
  key: "createProofkeyPair",
3358
4283
  value: function createProofkeyPair() {
3359
- return Ae(this, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee17() {
4284
+ return mt(this, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee17() {
3360
4285
  var _String$fromCharCode;
3361
4286
  var e, t, r, n;
3362
4287
  return _regeneratorRuntime().wrap(function _callee17$(_context17) {
@@ -3365,7 +4290,7 @@ var Le = /*#__PURE__*/ function () {
3365
4290
  case 0:
3366
4291
  e = new Uint32Array(16);
3367
4292
  window.crypto.getRandomValues(e);
3368
- t = Array.from(e).map(De).join("");
4293
+ t = Array.from(e).map(Ct).join("");
3369
4294
  _context17.next = 5;
3370
4295
  return window.crypto.subtle.digest("SHA-256", new TextEncoder().encode(t));
3371
4296
  case 5:
@@ -3382,14 +4307,14 @@ var Le = /*#__PURE__*/ function () {
3382
4307
  }));
3383
4308
  }
3384
4309
  }]);
3385
- return Le;
4310
+ return Tt;
3386
4311
  }();
3387
- var Me = /*#__PURE__*/ function () {
3388
- function Me(e) {
3389
- _classCallCheck(this, Me);
4312
+ var Ot = /*#__PURE__*/ function () {
4313
+ function Ot(e) {
4314
+ _classCallCheck(this, Ot);
3390
4315
  this._networkClient = e;
3391
4316
  }
3392
- _createClass(Me, [{
4317
+ _createClass(Ot, [{
3393
4318
  key: "searchUser",
3394
4319
  value: function searchUser(e) {
3395
4320
  return this._networkClient.fetchSDK({
@@ -3427,16 +4352,16 @@ var Me = /*#__PURE__*/ function () {
3427
4352
  });
3428
4353
  }
3429
4354
  }]);
3430
- return Me;
4355
+ return Ot;
3431
4356
  }();
3432
- var Ne = function Ne(e) {
4357
+ var Et = function Et(e) {
3433
4358
  return (document.cookie ? document.cookie.split("; ") : []).filter(function (t) {
3434
4359
  var _t$split = t.split("="), _t$split2 = _slicedToArray(_t$split, 1), r = _t$split2[0];
3435
4360
  return e === r;
3436
4361
  }).length > 1;
3437
4362
  };
3438
4363
  /*! js-cookie v3.0.1 | MIT */
3439
- function je(e) {
4364
+ function xt(e) {
3440
4365
  for (var t = 1; t < arguments.length; t++) {
3441
4366
  var r = arguments[t];
3442
4367
  for (var n in r)
@@ -3444,10 +4369,10 @@ function je(e) {
3444
4369
  }
3445
4370
  return e;
3446
4371
  }
3447
- var Fe = function e(t, r) {
4372
+ var Dt = function e(t, r) {
3448
4373
  function n(e, n, i) {
3449
4374
  if ("undefined" != typeof document) {
3450
- "number" == typeof (i = je({}, 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);
4375
+ "number" == typeof (i = xt({}, r, i)).expires && (i.expires = new Date(Date.now() + 864e5 * i.expires)), i.expires && (i.expires = i.expires.toUTCString()), e = encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
3451
4376
  var o = "";
3452
4377
  for (var s in i)
3453
4378
  i[s] && (o += "; " + s, !0 !== i[s] && (o += "=" + i[s].split(";")[0]));
@@ -3471,15 +4396,15 @@ var Fe = function e(t, r) {
3471
4396
  }
3472
4397
  },
3473
4398
  remove: function remove(e, t) {
3474
- n(e, "", je({}, t, {
4399
+ n(e, "", xt({}, t, {
3475
4400
  expires: -1
3476
4401
  }));
3477
4402
  },
3478
4403
  withAttributes: function withAttributes(t) {
3479
- return e(this.converter, je({}, this.attributes, t));
4404
+ return e(this.converter, xt({}, this.attributes, t));
3480
4405
  },
3481
4406
  withConverter: function withConverter(t) {
3482
- return e(je({}, this.converter, t), this.attributes);
4407
+ return e(xt({}, this.converter, t), this.attributes);
3483
4408
  }
3484
4409
  }, {
3485
4410
  attributes: {
@@ -3499,26 +4424,26 @@ var Fe = function e(t, r) {
3499
4424
  }, {
3500
4425
  path: "/"
3501
4426
  });
3502
- var Ke = function Ke(e) {
4427
+ var Rt = function Rt(e) {
3503
4428
  var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
3504
4429
  return "stytch_sdk_state_".concat(e).concat(t ? "::".concat(t) : "");
3505
4430
  };
3506
- var Ue = /*#__PURE__*/ function () {
3507
- function Ue(e, t) {
4431
+ var It = /*#__PURE__*/ function () {
4432
+ function It(e, t) {
3508
4433
  var _this4 = this;
3509
- _classCallCheck(this, Ue);
4434
+ _classCallCheck(this, It);
3510
4435
  this.browserSessionStorage = {
3511
4436
  getItem: function getItem(e) {
3512
- return sessionStorage.getItem(Ke(_this4.publicToken, e));
4437
+ return sessionStorage.getItem(Rt(_this4.publicToken, e));
3513
4438
  },
3514
4439
  setItem: function setItem(e, t) {
3515
- return sessionStorage.setItem(Ke(_this4.publicToken, e), t);
4440
+ return sessionStorage.setItem(Rt(_this4.publicToken, e), t);
3516
4441
  },
3517
4442
  removeItem: function removeItem(e) {
3518
- return sessionStorage.removeItem(Ke(_this4.publicToken, e));
4443
+ return sessionStorage.removeItem(Rt(_this4.publicToken, e));
3519
4444
  }
3520
- }, this.publicToken = e, this.state = null, this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (Q("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);
3521
- var r = localStorage.getItem(Ke(this.publicToken));
4445
+ }, this.publicToken = e, this.state = null, this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (qe("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);
4446
+ var r = localStorage.getItem(Rt(this.publicToken));
3522
4447
  if (!r)
3523
4448
  return;
3524
4449
  var n;
@@ -3530,7 +4455,7 @@ var Ue = /*#__PURE__*/ function () {
3530
4455
  }
3531
4456
  this.state = n;
3532
4457
  }
3533
- _createClass(Ue, [{
4458
+ _createClass(It, [{
3534
4459
  key: "opaqueTokenCookieName",
3535
4460
  get: function get() {
3536
4461
  var e;
@@ -3552,44 +4477,44 @@ var Ue = /*#__PURE__*/ function () {
3552
4477
  key: "readSessionCookie",
3553
4478
  value: function readSessionCookie() {
3554
4479
  return {
3555
- session_token: Fe.get(this.opaqueTokenCookieName),
3556
- session_jwt: Fe.get(this.jwtCookieName)
4480
+ session_token: Dt.get(this.opaqueTokenCookieName),
4481
+ session_jwt: Dt.get(this.jwtCookieName)
3557
4482
  };
3558
4483
  }
3559
4484
  }, {
3560
4485
  key: "readIntermediateSessionTokenCookie",
3561
4486
  value: function readIntermediateSessionTokenCookie() {
3562
- return Fe.get(this.istCookieName);
4487
+ return Dt.get(this.istCookieName);
3563
4488
  }
3564
4489
  }, {
3565
4490
  key: "writeSessionCookie",
3566
4491
  value: function writeSessionCookie(e) {
3567
4492
  var t, r, n, i;
3568
- var o = e.state, s = e.session_token, a = e.session_jwt, c = Ue.generateCookieOpts({
4493
+ var o = e.state, s = e.session_token, a = e.session_jwt, c = It.generateCookieOpts({
3569
4494
  expiresAt: null !== (r = null === (t = null == o ? void 0 : o.session) || void 0 === t ? void 0 : t.expires_at) && void 0 !== r ? r : "",
3570
4495
  availableToSubdomains: this._cookieAvailableToSubdomains,
3571
4496
  path: this._cookiePath,
3572
4497
  domain: this._domain
3573
4498
  });
3574
- Fe.set(this.opaqueTokenCookieName, s, c), Fe.set(this.jwtCookieName, a, c);
3575
- var u = Ue.generateCookieOpts({
4499
+ Dt.set(this.opaqueTokenCookieName, s, c), Dt.set(this.jwtCookieName, a, c);
4500
+ var u = It.generateCookieOpts({
3576
4501
  expiresAt: null !== (i = null === (n = null == o ? void 0 : o.session) || void 0 === n ? void 0 : n.expires_at) && void 0 !== i ? i : "",
3577
4502
  availableToSubdomains: !this._cookieAvailableToSubdomains,
3578
4503
  path: this._cookiePath,
3579
4504
  domain: this._domain
3580
4505
  });
3581
- Ne(this.jwtCookieName) && Fe.remove(this.jwtCookieName, u), Ne(this.opaqueTokenCookieName) && Fe.remove(this.opaqueTokenCookieName, u), Ne(this.jwtCookieName) && $("Could not remove extraneous JWT cookie. This might happen if the cookie has been set using multiple `path` settings, and may produce unwanted behavior."), Ne(this.opaqueTokenCookieName) && $("Could not remove extraneous opaque token cookie.");
4506
+ Et(this.jwtCookieName) && Dt.remove(this.jwtCookieName, u), Et(this.opaqueTokenCookieName) && Dt.remove(this.opaqueTokenCookieName, u), Et(this.jwtCookieName) && Ne("Could not remove extraneous JWT cookie. This might happen if the cookie has been set using multiple `path` settings, and may produce unwanted behavior."), Et(this.opaqueTokenCookieName) && Ne("Could not remove extraneous opaque token cookie.");
3582
4507
  }
3583
4508
  }, {
3584
4509
  key: "writeIntermediateSessionTokenCookie",
3585
4510
  value: function writeIntermediateSessionTokenCookie(e) {
3586
- var t = new Date(Date.now() + 6e5), r = Ue.generateCookieOpts({
4511
+ var t = new Date(Date.now() + 6e5), r = It.generateCookieOpts({
3587
4512
  expiresAt: t.toString(),
3588
4513
  availableToSubdomains: this._cookieAvailableToSubdomains,
3589
4514
  path: this._cookiePath,
3590
4515
  domain: this._domain
3591
4516
  });
3592
- Fe.set(this.istCookieName, e, r);
4517
+ Dt.set(this.istCookieName, e, r);
3593
4518
  }
3594
4519
  }, {
3595
4520
  key: "removeSessionCookie",
@@ -3608,14 +4533,14 @@ var Ue = /*#__PURE__*/ function () {
3608
4533
  [!0, !1].forEach(function (t) {
3609
4534
  [_this5._cookiePath, null].forEach(function (r) {
3610
4535
  [_this5._domain, null].forEach(function (n) {
3611
- var i = Ue.generateCookieOpts({
4536
+ var i = It.generateCookieOpts({
3612
4537
  expiresAt: new Date(0).toString(),
3613
4538
  availableToSubdomains: t,
3614
4539
  path: r,
3615
4540
  domain: n
3616
4541
  });
3617
4542
  e.forEach(function (e) {
3618
- Fe.remove(e, i);
4543
+ Dt.remove(e, i);
3619
4544
  });
3620
4545
  });
3621
4546
  });
@@ -3624,22 +4549,22 @@ var Ue = /*#__PURE__*/ function () {
3624
4549
  }, {
3625
4550
  key: "syncToLocalStorage",
3626
4551
  value: function syncToLocalStorage() {
3627
- localStorage.setItem(Ke(this.publicToken), JSON.stringify(this.state));
4552
+ localStorage.setItem(Rt(this.publicToken), JSON.stringify(this.state));
3628
4553
  }
3629
4554
  }, {
3630
4555
  key: "getItem",
3631
4556
  value: function getItem(e) {
3632
- return localStorage.getItem(Ke(this.publicToken, e));
4557
+ return localStorage.getItem(Rt(this.publicToken, e));
3633
4558
  }
3634
4559
  }, {
3635
4560
  key: "setItem",
3636
4561
  value: function setItem(e, t) {
3637
- return localStorage.setItem(Ke(this.publicToken, e), t);
4562
+ return localStorage.setItem(Rt(this.publicToken, e), t);
3638
4563
  }
3639
4564
  }, {
3640
4565
  key: "removeItem",
3641
4566
  value: function removeItem(e) {
3642
- return localStorage.removeItem(Ke(this.publicToken, e));
4567
+ return localStorage.removeItem(Rt(this.publicToken, e));
3643
4568
  }
3644
4569
  }], [{
3645
4570
  key: "generateCookieOpts",
@@ -3652,49 +4577,49 @@ var Ue = /*#__PURE__*/ function () {
3652
4577
  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;
3653
4578
  }
3654
4579
  }]);
3655
- return Ue;
4580
+ return It;
3656
4581
  }();
3657
- var ze = /*#__PURE__*/ function (_Ue) {
3658
- _inherits(ze, _Ue);
3659
- var _super2 = _createSuper(ze);
3660
- function ze() {
3661
- _classCallCheck(this, ze);
4582
+ var Bt = /*#__PURE__*/ function (_It) {
4583
+ _inherits(Bt, _It);
4584
+ var _super2 = _createSuper(Bt);
4585
+ function Bt() {
4586
+ _classCallCheck(this, Bt);
3662
4587
  return _super2.apply(this, arguments);
3663
4588
  }
3664
- return _createClass(ze);
3665
- }(Ue);
3666
- var We = Symbol["for"]("__stytch_b2b_DataLayer"), Ge = function Ge(e, t) {
4589
+ return _createClass(Bt);
4590
+ }(It);
4591
+ var Lt = Symbol["for"]("__stytch_b2b_DataLayer"), Mt = function Mt(e, t) {
3667
4592
  var r = function () {
3668
4593
  var e = window;
3669
- return e[We] || (e[We] = {}), e[We];
4594
+ return e[Lt] || (e[Lt] = {}), e[Lt];
3670
4595
  }();
3671
- return r[e] || (r[e] = new ze(e, t)), r[e];
3672
- }, He = function He(e, t) {
4596
+ return r[e] || (r[e] = new Bt(e, t)), r[e];
4597
+ }, jt = function jt(e, t) {
3673
4598
  Object.values(e).forEach(function (e) {
3674
4599
  return e(t);
3675
4600
  });
3676
- }, qe = function () {
3677
- var t = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}).KEYS_TO_EXCLUDE, r = void 0 === t ? [] : t;
3678
- return function t(i, o) {
3679
- return n(i) === n(o) && (null === i || null === o ? i === o : "object" === n(i) ? Object.keys(i).length === Object.keys(o).length && !Object.keys(i).some(function (e) {
3680
- return !(e in o);
3681
- }) && Object.entries(i).filter(function (t) {
3682
- var n = e(t, 1)[0];
3683
- return !r.includes(n);
3684
- }).every(function (r) {
3685
- var n = e(r, 2), i = n[0], s = n[1];
3686
- return t(s, o[i]);
3687
- }) : i === o);
4601
+ }, Ft = function () {
4602
+ var e = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}).KEYS_TO_EXCLUDE, t = void 0 === e ? [] : e;
4603
+ return function e(r, n) {
4604
+ return le(r) === le(n) && (null === r || null === n ? r === n : "object" === le(r) ? Object.keys(r).length === Object.keys(n).length && !Object.keys(r).some(function (e) {
4605
+ return !(e in n);
4606
+ }) && Object.entries(r).filter(function (e) {
4607
+ var r = ae(e, 1)[0];
4608
+ return !t.includes(r);
4609
+ }).every(function (t) {
4610
+ var r = ae(t, 2), i = r[0], o = r[1];
4611
+ return e(o, n[i]);
4612
+ }) : r === n);
3688
4613
  };
3689
4614
  }({
3690
4615
  KEYS_TO_EXCLUDE: ["last_accessed_at"]
3691
4616
  });
3692
- var Ye = /*#__PURE__*/ function () {
3693
- function Ye(e, t) {
4617
+ var Nt = /*#__PURE__*/ function () {
4618
+ function Nt(e, t) {
3694
4619
  var _this6 = this;
3695
- _classCallCheck(this, Ye);
4620
+ _classCallCheck(this, Nt);
3696
4621
  this._publicToken = e, this._datalayer = t, this._listen = function (e) {
3697
- if (e.key !== Ke(_this6._publicToken))
4622
+ if (e.key !== Rt(_this6._publicToken))
3698
4623
  return;
3699
4624
  if (null === e.newValue || "null" === e.newValue)
3700
4625
  return void _this6.destroyState();
@@ -3704,7 +4629,7 @@ var Ye = /*#__PURE__*/ function () {
3704
4629
  var _this$_datalayer$read = this._datalayer.readSessionCookie(), r = _this$_datalayer$read.session_token;
3705
4630
  r || this.destroyState();
3706
4631
  }
3707
- _createClass(Ye, [{
4632
+ _createClass(Nt, [{
3708
4633
  key: "getTokens",
3709
4634
  value: function getTokens() {
3710
4635
  var _this$_datalayer$read2 = this._datalayer.readSessionCookie(), e = _this$_datalayer$read2.session_token, t = _this$_datalayer$read2.session_jwt;
@@ -3732,7 +4657,7 @@ var Ye = /*#__PURE__*/ function () {
3732
4657
  key: "_updateStateAndTokensInternal",
3733
4658
  value: function _updateStateAndTokensInternal(e) {
3734
4659
  var t = this._datalayer.state, r = null === e.state ? null : Object.assign(Object.assign({}, this._datalayer.state), e.state);
3735
- this._datalayer.state = r, qe(t, r) || He(this._datalayer.subscriptions, r);
4660
+ this._datalayer.state = r, Ft(t, r) || jt(this._datalayer.subscriptions, r);
3736
4661
  }
3737
4662
  }, {
3738
4663
  key: "updateStateAndTokens",
@@ -3743,7 +4668,7 @@ var Ye = /*#__PURE__*/ function () {
3743
4668
  key: "updateState",
3744
4669
  value: function updateState(e) {
3745
4670
  var t = this._datalayer.state, r = null === e ? null : Object.assign(Object.assign({}, this._datalayer.state), e);
3746
- this._datalayer.state = r, qe(t, r) || (He(this._datalayer.subscriptions, r), this._datalayer.syncToLocalStorage());
4671
+ this._datalayer.state = r, Ft(t, r) || (jt(this._datalayer.subscriptions, r), this._datalayer.syncToLocalStorage());
3747
4672
  }
3748
4673
  }, {
3749
4674
  key: "updateTokens",
@@ -3780,14 +4705,14 @@ var Ye = /*#__PURE__*/ function () {
3780
4705
  return null;
3781
4706
  }
3782
4707
  }]);
3783
- return Ye;
4708
+ return Nt;
3784
4709
  }();
3785
- var Ve = /*#__PURE__*/ function (_Ye) {
3786
- _inherits(Ve, _Ye);
3787
- var _super3 = _createSuper(Ve);
3788
- function Ve() {
4710
+ var Kt = /*#__PURE__*/ function (_Nt) {
4711
+ _inherits(Kt, _Nt);
4712
+ var _super3 = _createSuper(Kt);
4713
+ function Kt() {
3789
4714
  var _this7;
3790
- _classCallCheck(this, Ve);
4715
+ _classCallCheck(this, Kt);
3791
4716
  _this7 = _super3.apply(this, arguments), _this7.updateMember = function (e) {
3792
4717
  return _this7.updateState({
3793
4718
  member: e
@@ -3801,48 +4726,48 @@ var Ve = /*#__PURE__*/ function (_Ye) {
3801
4726
  };
3802
4727
  return _this7;
3803
4728
  }
3804
- return _createClass(Ve);
3805
- }(Ye);
3806
- var $e = Symbol["for"]("stytch__internal_b2b");
3807
- var Je = /*#__PURE__*/ _createClass(function Je(e, t) {
4729
+ return _createClass(Kt);
4730
+ }(Nt);
4731
+ var Ut = Symbol["for"]("stytch__internal_b2b");
4732
+ var zt = /*#__PURE__*/ _createClass(function zt(e, t) {
3808
4733
  var _this8 = this;
3809
- _classCallCheck(this, Je);
4734
+ _classCallCheck(this, zt);
3810
4735
  var r;
3811
4736
  !function (e) {
3812
4737
  if ("undefined" == typeof window)
3813
4738
  throw new Error("The ".concat(e, " is not compatible with server-side environments.\nIf using nextjs, use the create").concat(e, " method instead.\n```\n").concat("import { createStytchB2BHeadlessClient } from '@stytch/nextjs/b2b';\n \n const stytch = createStytchB2BHeadlessClient('public-token-...');\n ", "\n```\n"));
3814
- }("StytchB2BHeadlessClient"), "string" != typeof (r = e) ? $("Public token is malformed. Expected a string, got ".concat(n(r), ".").concat(X)) : "" === r ? $('Public token is malformed. Expected "public-token-...", got an empty string.'.concat(X)) : r.startsWith("public-token-") || $('Public token is malformed. Expected "public-token-...", got '.concat(r, ".").concat(X));
3815
- var i = t, o = {
3816
- cookieOptions: null == (s = i) ? void 0 : s.cookieOptions,
4739
+ }("StytchB2BHeadlessClient"), "string" != typeof (r = e) ? Ne("Public token is malformed. Expected a string, got ".concat(le(r), ".").concat(Ue)) : "" === r ? Ne('Public token is malformed. Expected "public-token-...", got an empty string.'.concat(Ue)) : r.startsWith("public-token-") || Ne('Public token is malformed. Expected "public-token-...", got '.concat(r, ".").concat(Ue));
4740
+ var n = t, i = {
4741
+ cookieOptions: null == (o = n) ? void 0 : o.cookieOptions,
3817
4742
  endpoints: {
3818
- sdkBackendURL: null !== (c = null === (a = null == s ? void 0 : s.endpoints) || void 0 === a ? void 0 : a.sdkBackendURL) && void 0 !== c ? c : "https://web.stytch.com",
3819
- testAPIURL: null !== (l = null === (u = null == s ? void 0 : s.endpoints) || void 0 === u ? void 0 : u.testAPIURL) && void 0 !== l ? l : "https://test.stytch.com",
3820
- liveAPIURL: null !== (h = null === (d = null == s ? void 0 : s.endpoints) || void 0 === d ? void 0 : d.liveAPIURL) && void 0 !== h ? h : "https://api.stytch.com",
3821
- dfpBackendURL: null !== (_ = null === (p = null == s ? void 0 : s.endpoints) || void 0 === p ? void 0 : p.dfpBackendURL) && void 0 !== _ ? _ : "https://telemetry.stytch.com",
3822
- clientsideServicesIframeURL: null !== (f = null === (m = null == s ? void 0 : s.endpoints) || void 0 === m ? void 0 : m.clientsideServicesIframeURL) && void 0 !== f ? f : "https://js.stytch.com/clientside-services/index.html"
4743
+ sdkBackendURL: null !== (a = null === (s = null == o ? void 0 : o.endpoints) || void 0 === s ? void 0 : s.sdkBackendURL) && void 0 !== a ? a : "https://web.stytch.com",
4744
+ testAPIURL: null !== (u = null === (c = null == o ? void 0 : o.endpoints) || void 0 === c ? void 0 : c.testAPIURL) && void 0 !== u ? u : "https://test.stytch.com",
4745
+ liveAPIURL: null !== (d = null === (l = null == o ? void 0 : o.endpoints) || void 0 === l ? void 0 : l.liveAPIURL) && void 0 !== d ? d : "https://api.stytch.com",
4746
+ dfpBackendURL: null !== (p = null === (h = null == o ? void 0 : o.endpoints) || void 0 === h ? void 0 : h.dfpBackendURL) && void 0 !== p ? p : "https://telemetry.stytch.com",
4747
+ clientsideServicesIframeURL: null !== (f = null === (_ = null == o ? void 0 : o.endpoints) || void 0 === _ ? void 0 : _.clientsideServicesIframeURL) && void 0 !== f ? f : "https://js.stytch.com/clientside-services/index.html"
3823
4748
  }
3824
4749
  };
3825
- var s, a, c, u, l, d, h, p, _, m, f;
3826
- this._dataLayer = Ge(e, i), this._subscriptionService = new Ve(e, this._dataLayer);
3827
- var v = new Le(this._dataLayer, "passwords");
3828
- this._networkClient = new Ie(e, this._dataLayer, o.endpoints.sdkBackendURL, function () {
4750
+ var o, s, a, c, u, l, d, h, p, _, f;
4751
+ this._dataLayer = Mt(e, n), this._subscriptionService = new Kt(e, this._dataLayer);
4752
+ var m = new Tt(this._dataLayer, "passwords");
4753
+ this._networkClient = new At(e, this._dataLayer, i.endpoints.sdkBackendURL, function () {
3829
4754
  var e, t, r, n;
3830
4755
  return {
3831
4756
  stytch_member_id: null === (t = null === (e = _this8._dataLayer.state) || void 0 === e ? void 0 : e.member) || void 0 === t ? void 0 : t.member_id,
3832
4757
  stytch_member_session_id: null === (n = null === (r = _this8._dataLayer.state) || void 0 === r ? void 0 : r.session) || void 0 === n ? void 0 : n.member_session_id
3833
4758
  };
3834
4759
  });
3835
- var b = new Re(e, this._networkClient, this._dataLayer), g = new xe(b.getAsync()), y = new ee(e, o.endpoints.dfpBackendURL, b.getAsync(), g.executeRecaptcha);
3836
- this.organization = new ae(this._networkClient), this.member = new oe(this._networkClient, this._subscriptionService), this.session = new ue(this._networkClient, this._subscriptionService), this.magicLinks = new ie(this._networkClient, this._subscriptionService, new Le(this._dataLayer, "magic_links"), v, b.getAsync(), y), this.oauth = new ce(this._networkClient, this._subscriptionService, new Le(this._dataLayer, "oauth"), b.getAsync(), {
4760
+ var v = new St(e, this._networkClient, this._dataLayer), b = new Pt(v.getAsync()), g = new We(e, i.endpoints.dfpBackendURL, v.getAsync(), b.executeRecaptcha);
4761
+ this.organization = new Xe(this._networkClient, this._subscriptionService), this.member = new Je(this._networkClient, this._subscriptionService), this.self = new Je(this._networkClient, this._subscriptionService), this.session = new Qe(this._networkClient, this._subscriptionService), this.magicLinks = new Ve(this._networkClient, this._subscriptionService, new Tt(this._dataLayer, "magic_links"), m, v.getAsync(), g), this.oauth = new Ze(this._networkClient, this._subscriptionService, new Tt(this._dataLayer, "oauth"), v.getAsync(), {
3837
4762
  publicToken: e,
3838
- testAPIURL: o.endpoints.testAPIURL,
3839
- liveAPIURL: o.endpoints.liveAPIURL
3840
- }, y), this.sso = new se(this._networkClient, this._subscriptionService, new Le(this._dataLayer, "sso"), b.getAsync(), {
4763
+ testAPIURL: i.endpoints.testAPIURL,
4764
+ liveAPIURL: i.endpoints.liveAPIURL
4765
+ }, g), this.sso = new $e(this._networkClient, this._subscriptionService, new Tt(this._dataLayer, "sso"), v.getAsync(), {
3841
4766
  publicToken: e,
3842
- testAPIURL: o.endpoints.testAPIURL,
3843
- liveAPIURL: o.endpoints.liveAPIURL
3844
- }), this.discovery = new le(this._networkClient, this._subscriptionService), this.passwords = new Ce(this._networkClient, this._subscriptionService, v, b.getAsync(), y), this.otps = new Se(this._networkClient, this._subscriptionService, y), this._sessionManager = new we(this._subscriptionService, this.session);
3845
- var k = new Me(this._networkClient);
4767
+ testAPIURL: i.endpoints.testAPIURL,
4768
+ liveAPIURL: i.endpoints.liveAPIURL
4769
+ }), this.discovery = new et(this._networkClient, this._subscriptionService), this.passwords = new kt(this._networkClient, this._subscriptionService, m, v.getAsync(), g), this.otps = new tt(this._networkClient, this._subscriptionService, g), this.totp = new rt(this._networkClient, this._subscriptionService, g), this.rbac = new nt(v.getSync(), v.getAsync(), this._subscriptionService), this._sessionManager = new it(this._subscriptionService, this.session);
4770
+ var y = new Ot(this._networkClient);
3846
4771
  this._dataLayer.readSessionCookie().session_token && this._sessionManager.performBackgroundRefresh(), this._networkClient.logEvent({
3847
4772
  name: "b2b_sdk_instance_instantiated",
3848
4773
  details: {
@@ -3852,214 +4777,15 @@ var Je = /*#__PURE__*/ _createClass(function Je(e, t) {
3852
4777
  }
3853
4778
  });
3854
4779
  (function (e, t) {
3855
- Object.assign(e, _defineProperty({}, $e, t));
4780
+ Object.assign(e, _defineProperty({}, Ut, t));
3856
4781
  })(this, {
3857
- bootstrap: b,
4782
+ bootstrap: v,
3858
4783
  publicToken: e,
3859
- searchManager: k,
4784
+ searchManager: y,
3860
4785
  dataLayer: this._dataLayer,
3861
4786
  networkClient: this._networkClient
3862
4787
  });
3863
4788
  });
3864
- function Xe(e) {
3865
- return Xe = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
3866
- return _typeof(e);
3867
- } : function (e) {
3868
- return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
3869
- }, Xe(e);
3870
- }
3871
- function Ze(e, t) {
3872
- for (var r = 0; r < t.length; r++) {
3873
- var n = t[r];
3874
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, (i = n.key, o = void 0, o = function (e, t) {
3875
- if ("object" !== Xe(e) || null === e)
3876
- return e;
3877
- var r = e[Symbol.toPrimitive];
3878
- if (void 0 !== r) {
3879
- var n = r.call(e, t || "default");
3880
- if ("object" !== Xe(n))
3881
- return n;
3882
- throw new TypeError("@@toPrimitive must return a primitive value.");
3883
- }
3884
- return ("string" === t ? String : Number)(e);
3885
- }(i, "string"), "symbol" === Xe(o) ? o : String(o)), n);
3886
- }
3887
- var i, o;
3888
- }
3889
- function Qe(e, t, r) {
3890
- return t && Ze(e.prototype, t), r && Ze(e, r), Object.defineProperty(e, "prototype", {
3891
- writable: !1
3892
- }), e;
3893
- }
3894
- function et(e, t) {
3895
- if (!(e instanceof t))
3896
- throw new TypeError("Cannot call a class as a function");
3897
- }
3898
- function tt(e, t) {
3899
- if ("function" != typeof t && null !== t)
3900
- throw new TypeError("Super expression must either be null or a function");
3901
- e.prototype = Object.create(t && t.prototype, {
3902
- constructor: {
3903
- value: e,
3904
- writable: !0,
3905
- configurable: !0
3906
- }
3907
- }), Object.defineProperty(e, "prototype", {
3908
- writable: !1
3909
- }), t && at(e, t);
3910
- }
3911
- function rt(e) {
3912
- var t = st();
3913
- return function () {
3914
- var r, n = ct(e);
3915
- if (t) {
3916
- var i = ct(this).constructor;
3917
- r = Reflect.construct(n, arguments, i);
3918
- }
3919
- else
3920
- r = n.apply(this, arguments);
3921
- return function (e, t) {
3922
- if (t && ("object" === Xe(t) || "function" == typeof t))
3923
- return t;
3924
- if (void 0 !== t)
3925
- throw new TypeError("Derived constructors may only return object or undefined");
3926
- return nt(e);
3927
- }(this, r);
3928
- };
3929
- }
3930
- function nt(e) {
3931
- if (void 0 === e)
3932
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3933
- return e;
3934
- }
3935
- function it(e) {
3936
- var t = "function" == typeof Map ? new Map() : void 0;
3937
- return it = function it(e) {
3938
- if (null === e || (r = e, -1 === Function.toString.call(r).indexOf("[native code]")))
3939
- return e;
3940
- var r;
3941
- if ("function" != typeof e)
3942
- throw new TypeError("Super expression must either be null or a function");
3943
- if (void 0 !== t) {
3944
- if (t.has(e))
3945
- return t.get(e);
3946
- t.set(e, n);
3947
- }
3948
- function n() {
3949
- return ot(e, arguments, ct(this).constructor);
3950
- }
3951
- return n.prototype = Object.create(e.prototype, {
3952
- constructor: {
3953
- value: n,
3954
- enumerable: !1,
3955
- writable: !0,
3956
- configurable: !0
3957
- }
3958
- }), at(n, e);
3959
- }, it(e);
3960
- }
3961
- function ot(e, t, r) {
3962
- return ot = st() ? Reflect.construct.bind() : function (e, t, r) {
3963
- var n = [null];
3964
- n.push.apply(n, t);
3965
- var i = new (Function.bind.apply(e, n))();
3966
- return r && at(i, r.prototype), i;
3967
- }, ot.apply(null, arguments);
3968
- }
3969
- function st() {
3970
- if ("undefined" == typeof Reflect || !Reflect.construct)
3971
- return !1;
3972
- if (Reflect.construct.sham)
3973
- return !1;
3974
- if ("function" == typeof Proxy)
3975
- return !0;
3976
- try {
3977
- return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () { })), !0;
3978
- }
3979
- catch (e) {
3980
- return !1;
3981
- }
3982
- }
3983
- function at(e, t) {
3984
- return at = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) {
3985
- return e.__proto__ = t, e;
3986
- }, at(e, t);
3987
- }
3988
- function ct(e) {
3989
- return ct = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) {
3990
- return e.__proto__ || Object.getPrototypeOf(e);
3991
- }, ct(e);
3992
- }
3993
- var ut, lt, dt, ht, pt, _t;
3994
- !function (e) {
3995
- e.emailMagicLinks = "emailMagicLinks", e.oauth = "oauth", e.otp = "otp", e.crypto = "crypto", e.passwords = "passwords", e.passkeys = "passkeys";
3996
- }(ut || (ut = {})), function (e) {
3997
- e.Google = "google", e.Microsoft = "microsoft", e.Apple = "apple", e.Github = "github", e.GitLab = "gitlab", e.Facebook = "facebook", e.Discord = "discord", e.Salesforce = "salesforce", e.Slack = "slack", e.Amazon = "amazon", e.Bitbucket = "bitbucket", e.LinkedIn = "linkedin", e.Coinbase = "coinbase", e.Twitch = "twitch", e.Twitter = "twitter", e.TikTok = "tiktok", e.Snapchat = "snapchat", e.Figma = "figma", e.Yahoo = "yahoo";
3998
- }(lt || (lt = {})), function (e) {
3999
- e.Vessel = "Vessel", e.Phantom = "Phantom", e.Metamask = "Metamask", e.Coinbase = "Coinbase", e.Binance = "Binance", e.GenericEthereumWallet = "Other Ethereum Wallet", e.GenericSolanaWallet = "Other Solana Wallet";
4000
- }(dt || (dt = {})), function (e) {
4001
- e.embedded = "embedded", e.floating = "floating";
4002
- }(ht || (ht = {})), function (e) {
4003
- e.SMS = "sms", e.WhatsApp = "whatsapp", e.Email = "email";
4004
- }(pt || (pt = {})), function (e) {
4005
- e.MagicLinkLoginOrCreateEvent = "MAGIC_LINK_LOGIN_OR_CREATE", e.OTPsLoginOrCreateEvent = "OTP_LOGIN_OR_CREATE", e.OTPsAuthenticate = "OTP_AUTHENTICATE", e.CryptoWalletAuthenticateStart = "CRYPTO_WALLET_AUTHENTICATE_START", e.CryptoWalletAuthenticate = "CRYPTO_WALLET_AUTHENTICATE", e.PasswordCreate = "PASSWORD_CREATE", e.PasswordAuthenticate = "PASSWORD_AUTHENTICATE", e.PasswordResetByEmailStart = "PASSWORD_RESET_BY_EMAIL_START", e.PasswordResetByEmail = "PASSWORD_RESET_BY_EMAIL", e.PasskeyRegister = "PASSKEY_REGISTER", e.PasskeyAuthenticate = "PASSKEY_AUTHENTICATE", e.PasskeySkip = "PASSKEY_SKIP", e.PasskeyDone = "PASSKEY_DONE", e.B2BMagicLinkEmailLoginOrSignup = "B2B_MAGIC_LINK_EMAIL_LOGIN_OR_SIGNUP", e.B2BMagicLinkAuthenticate = "B2B_MAGIC_LINK_AUTHENTICATE", e.B2BMagicLinkEmailDiscoverySend = "B2B_MAGIC_LINK_EMAIL_DISCOVERY_SEND", e.B2BMagicLinkDiscoveryAuthenticate = "B2B_MAGIC_LINK_DISCOVERY_AUTHENTICATE", e.B2BSSOStart = "B2B_SSO_START", e.B2BSSOAuthenticate = "B2B_SSO_AUTHENTICATE", e.B2BOAuthAuthenticate = "B2B_SSO_AUTHENTICATE", e.B2BOAuthDiscoveryAuthenticate = "B2B_OAUTH_DISCOVERY_AUTHENTICATE", e.B2BDiscoveryOrganizationsCreate = "B2B_DISCOVERY_ORGANIZATIONS_CREATE", e.B2BDiscoveryIntermediateSessionExchange = "B2B_DISCOVERY_INTERMEDIATE_SESSION_EXCHANGE", e.B2BPasswordAuthenticate = "B2B_PASSWORD_AUTHENTICATE", e.B2BPasswordResetByEmailStart = "B2B_PASSWORD_RESET_BY_EMAIL_START", e.B2BPasswordResetByEmail = "B2B_PASSWORD_RESET_BY_EMAIL", e.B2BPasswordResetBySession = "B2B_PASSWORD_RESET_BY_SESSION";
4006
- }(_t || (_t = {}));
4007
- var mt, ft, vt, bt; (function (e) {
4008
- tt(r, it(Error));
4009
- var t = rt(r);
4010
- function r(e, n) {
4011
- var i;
4012
- return et(this, r), (i = t.call(this, e + "\n" + n)).message = e + "\n" + n, i.name = "SDKAPIUnreachableError", i.details = n, Object.setPrototypeOf(nt(i), r.prototype), i;
4013
- }
4014
- return Qe(r);
4015
- })(); (function (e) {
4016
- tt(r, it(Error));
4017
- var t = rt(r);
4018
- function r(e, n) {
4019
- var i;
4020
- return et(this, r), (i = t.call(this)).name = "StytchSDKUsageError", i.message = "Invalid call to ".concat(e, "\n") + n, i;
4021
- }
4022
- return Qe(r);
4023
- })(); (function (e) {
4024
- tt(r, it(Error));
4025
- var t = rt(r);
4026
- function r(e) {
4027
- var n, i;
4028
- et(this, r), (n = t.call(this)).name = "StytchSDKSchemaError";
4029
- var o = null === (i = e.body) || void 0 === i ? void 0 : i.map(function (e) {
4030
- return "".concat(e.dataPath, ": ").concat(e.message);
4031
- }).join("\n");
4032
- return n.message = "[400] Request does not match expected schema\n".concat(o), n;
4033
- }
4034
- return Qe(r);
4035
- })(); (function (e) {
4036
- tt(r, it(Error));
4037
- var t = rt(r);
4038
- function r(e) {
4039
- var n;
4040
- et(this, r), (n = t.call(this)).name = "StytchSDKAPIError";
4041
- var i = e.status_code, o = e.error_type, s = e.error_message, a = e.error_url, c = e.request_id;
4042
- return n.error_type = o, n.error_message = s, n.error_url = a, n.request_id = c, n.status_code = i, n.message = "[".concat(i, "] ").concat(o, "\n") + "".concat(s, "\n") + "See ".concat(a, " for more information.\n") + (c ? "request_id: ".concat(c, "\n") : ""), n;
4043
- }
4044
- return Qe(r);
4045
- })(); (function (e) {
4046
- tt(r, it(Error));
4047
- var t = rt(r);
4048
- function r(e) {
4049
- var n;
4050
- return et(this, r), (n = t.call(this)).name = "StytchSDKNativeError", n.error_type = e, n.message = "".concat(e), n;
4051
- }
4052
- return Qe(r);
4053
- })();
4054
- !function (e) {
4055
- e.BiometricsSensorError = "biometrics_sensor_error", e.DeviceCredentialsNotAllowed = "device_credentials_not_allowed", e.DeviceHardwareError = "device_hardware_error", e.InternalError = "internal_error", e.KeyInvalidated = "key_invalidated", e.KeystoreUnavailable = "keystore_unavailable", e.NoBiometricsEnrolled = "no_biometrics_enrolled", e.NoBiometricsRegistration = "no_biometrics_registration", e.SessionExpired = "session_expired", e.UserCancellation = "user_cancellation", e.UserLockedOut = "user_locked_out", e.BiometricsNotAvailable = "biometrics_not_available";
4056
- }(mt || (mt = {})), function (e) {
4057
- e.emailMagicLinks = "emailMagicLinks", e.sso = "sso", e.passwords = "passwords", e.oauth = "oauth";
4058
- }(ft || (ft = {})), function (e) {
4059
- e.Discovery = "Discovery", e.Organization = "Organization", e.PasswordReset = "PasswordReset";
4060
- }(vt || (vt = {})), function (e) {
4061
- e.Google = "google", e.Microsoft = "microsoft";
4062
- }(bt || (bt = {}));
4063
4789
 
4064
4790
  const cannotInvokeMethodOnServerError = (path) => `[Stytch] Invalid serverside function call to ${path}.
4065
4791
  The Stytch Javascript SDK is intended to ony be used on the client side.
@@ -4116,7 +4842,7 @@ const createStytchB2BHeadlessClient = (...args) => {
4116
4842
  if (typeof window === 'undefined') {
4117
4843
  return createStytchSSRProxy();
4118
4844
  }
4119
- return new Je(...args);
4845
+ return new zt(...args);
4120
4846
  };
4121
4847
 
4122
4848
  exports.createStytchB2BHeadlessClient = createStytchB2BHeadlessClient;