@stytch/vanilla-js 5.22.2 → 5.22.4

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.
@@ -632,12 +632,36 @@ var SignInWithAppleMisconfigured = /*#__PURE__*/function (_StytchSDKError33) {
632
632
  _inherits$1(SignInWithAppleMisconfigured, _StytchSDKError33);
633
633
  return _createClass$1(SignInWithAppleMisconfigured);
634
634
  }(StytchSDKError);
635
- var IDPOAuthFlowMissingParamError = /*#__PURE__*/function (_StytchSDKError34) {
635
+ var MissingCipherIv = /*#__PURE__*/function (_StytchSDKError34) {
636
+ function MissingCipherIv() {
637
+ _classCallCheck$1(this, MissingCipherIv);
638
+ return _callSuper$1(this, MissingCipherIv, ['MissingCipherIv', 'The expected cipher Iv was not found when attempting to decrypt an existing biometric key.']);
639
+ }
640
+ _inherits$1(MissingCipherIv, _StytchSDKError34);
641
+ return _createClass$1(MissingCipherIv);
642
+ }(StytchSDKError);
643
+ var InvalidPrivateKeyLength = /*#__PURE__*/function (_StytchSDKError35) {
644
+ function InvalidPrivateKeyLength() {
645
+ _classCallCheck$1(this, InvalidPrivateKeyLength);
646
+ return _callSuper$1(this, InvalidPrivateKeyLength, ['InvalidPrivateKeyLength', "The private key was of an incorrect length."]);
647
+ }
648
+ _inherits$1(InvalidPrivateKeyLength, _StytchSDKError35);
649
+ return _createClass$1(InvalidPrivateKeyLength);
650
+ }(StytchSDKError);
651
+ var BiometricRegistrationIdIsNullOrBlank = /*#__PURE__*/function (_StytchSDKError36) {
652
+ function BiometricRegistrationIdIsNullOrBlank() {
653
+ _classCallCheck$1(this, BiometricRegistrationIdIsNullOrBlank);
654
+ return _callSuper$1(this, BiometricRegistrationIdIsNullOrBlank, ['BiometricRegistrationIdIsNullOrBlank', 'Attempted to set a blank or null biometric registration ID. This is not allowed, and indicates no registration was created on the server. Consider deleting any local keys that may have been generated.']);
655
+ }
656
+ _inherits$1(BiometricRegistrationIdIsNullOrBlank, _StytchSDKError36);
657
+ return _createClass$1(BiometricRegistrationIdIsNullOrBlank);
658
+ }(StytchSDKError);
659
+ var IDPOAuthFlowMissingParamError = /*#__PURE__*/function (_StytchSDKError37) {
636
660
  function IDPOAuthFlowMissingParamError(details) {
637
661
  _classCallCheck$1(this, IDPOAuthFlowMissingParamError);
638
662
  return _callSuper$1(this, IDPOAuthFlowMissingParamError, ['IDPOAuthFlowMissingParamError', details]);
639
663
  }
640
- _inherits$1(IDPOAuthFlowMissingParamError, _StytchSDKError34);
664
+ _inherits$1(IDPOAuthFlowMissingParamError, _StytchSDKError37);
641
665
  return _createClass$1(IDPOAuthFlowMissingParamError);
642
666
  }(StytchSDKError);
643
667
  function errorToStytchError(error) {
@@ -714,6 +738,12 @@ function errorToStytchError(error) {
714
738
  return new PasskeysMisconfigured();
715
739
  case 'signinwithapple_misconfigured':
716
740
  return new SignInWithAppleMisconfigured();
741
+ case 'missing_cipher_iv':
742
+ return new MissingCipherIv();
743
+ case 'invalid_private_key_length':
744
+ return new InvalidPrivateKeyLength();
745
+ case 'biometric_registration_id_is_null_or_blank':
746
+ return new BiometricRegistrationIdIsNullOrBlank();
717
747
  default:
718
748
  return new InternalError(error);
719
749
  }
@@ -2232,15 +2262,6 @@ var ErrorMarshaller = /*#__PURE__*/function () {
2232
2262
  _classCallCheck(this, ErrorMarshaller);
2233
2263
  }
2234
2264
  return _createClass(ErrorMarshaller, null, [{
2235
- key: "marshall",
2236
- value: function marshall(error) {
2237
- return Object.assign(Object.assign({}, error), {
2238
- name: error.name,
2239
- message: error.message,
2240
- stack: error.stack
2241
- });
2242
- }
2243
- }, {
2244
2265
  key: "inflate",
2245
2266
  value: function inflate(ErrorClass, ErrorData) {
2246
2267
  var err = new ErrorClass(ErrorData);
@@ -2380,7 +2401,7 @@ var HeadlessB2BMagicLinksClient = /*#__PURE__*/function () {
2380
2401
  return _regeneratorRuntime().wrap(function _callee62$(_context62) {
2381
2402
  while (1) switch (_context62.prev = _context62.next) {
2382
2403
  case 0:
2383
- validate('stytch.magicLinks.email.loginOrSignup').isString('email_address', data.email_address).isOptionalString('invite_redirect_url', data.invite_redirect_url).isOptionalString('invite_template_id', data.invite_template_id).isOptionalString('name', data.name).isOptionalString('locale', data.locale).isOptionalStringArray('roles', data.roles);
2404
+ validate('stytch.magicLinks.email.invite').isString('email_address', data.email_address).isOptionalString('invite_redirect_url', data.invite_redirect_url).isOptionalString('invite_template_id', data.invite_template_id).isOptionalString('name', data.name).isOptionalString('locale', data.locale).isOptionalStringArray('roles', data.roles).isOptionalNumber('invite_expiration_minutes', data.invite_expiration_minutes);
2384
2405
  return _context62.abrupt("return", this._networkClient.fetchSDK({
2385
2406
  url: '/b2b/magic_links/email/invite',
2386
2407
  body: data,
@@ -2399,7 +2420,7 @@ var HeadlessB2BMagicLinksClient = /*#__PURE__*/function () {
2399
2420
  return _regeneratorRuntime().wrap(function _callee63$(_context63) {
2400
2421
  while (1) switch (_context63.prev = _context63.next) {
2401
2422
  case 0:
2402
- validate('stytch.magicLinks.email.loginOrSignup').isString('email_address', data.email_address).isString('organization_id', data.organization_id).isOptionalString('login_redirect_url', data.login_redirect_url).isOptionalString('login_template_id', data.login_template_id).isOptionalString('signup_redirect_url', data.signup_redirect_url).isOptionalString('signup_template_id', data.signup_template_id).isOptionalString('locale', data.locale);
2423
+ validate('stytch.magicLinks.email.loginOrSignup').isString('email_address', data.email_address).isString('organization_id', data.organization_id).isOptionalString('login_redirect_url', data.login_redirect_url).isOptionalString('login_template_id', data.login_template_id).isOptionalString('signup_redirect_url', data.signup_redirect_url).isOptionalString('signup_template_id', data.signup_template_id).isOptionalString('locale', data.locale).isOptionalNumber('login_expiration_minutes', data.login_expiration_minutes).isOptionalNumber('signup_expiration_minutes', data.signup_expiration_minutes);
2403
2424
  _context63.next = 3;
2404
2425
  return this.getCodeChallenge();
2405
2426
  case 3:
@@ -2426,7 +2447,7 @@ var HeadlessB2BMagicLinksClient = /*#__PURE__*/function () {
2426
2447
  return _regeneratorRuntime().wrap(function _callee64$(_context64) {
2427
2448
  while (1) switch (_context64.prev = _context64.next) {
2428
2449
  case 0:
2429
- validate('stytch.magicLinks.email.discovery.send').isString('email_address', data.email_address).isOptionalString('discovery_redirect_url', data.discovery_redirect_url).isOptionalString('login_template_id', data.login_template_id).isOptionalString('locale', data.locale);
2450
+ validate('stytch.magicLinks.email.discovery.send').isString('email_address', data.email_address).isOptionalString('discovery_redirect_url', data.discovery_redirect_url).isOptionalString('login_template_id', data.login_template_id).isOptionalString('locale', data.locale).isOptionalNumber('discovery_expiration_minutes', data.discovery_expiration_minutes);
2430
2451
  _context64.next = 3;
2431
2452
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
2432
2453
  case 3:
@@ -4923,7 +4944,7 @@ var HeadlessB2BOTPsClient = /*#__PURE__*/_createClass(function HeadlessB2BOTPsCl
4923
4944
  return _regeneratorRuntime().wrap(function _callee135$(_context135) {
4924
4945
  while (1) switch (_context135.prev = _context135.next) {
4925
4946
  case 0:
4926
- validate('stytch.otps.email.loginOrSignup').isString('organization_id', data.organization_id).isString('email_address', data.email_address).isOptionalString('login_template_id', data.login_template_id).isOptionalString('signup_template_id', data.signup_template_id).isOptionalString('locale', data.locale);
4947
+ validate('stytch.otps.email.loginOrSignup').isString('organization_id', data.organization_id).isString('email_address', data.email_address).isOptionalString('login_template_id', data.login_template_id).isOptionalString('signup_template_id', data.signup_template_id).isOptionalString('locale', data.locale).isOptionalNumber('login_expiration_minutes', data.login_expiration_minutes).isOptionalNumber('signup_expiration_minutes', data.signup_expiration_minutes);
4927
4948
  _context135.next = 3;
4928
4949
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
4929
4950
  case 3:
@@ -5008,7 +5029,7 @@ var HeadlessB2BOTPsClient = /*#__PURE__*/_createClass(function HeadlessB2BOTPsCl
5008
5029
  return _regeneratorRuntime().wrap(function _callee137$(_context137) {
5009
5030
  while (1) switch (_context137.prev = _context137.next) {
5010
5031
  case 0:
5011
- validate('stytch.otps.email.discovery.send').isString('email_address', data.email_address).isOptionalString('login_template_id', data.login_template_id).isOptionalString('locale', data.locale);
5032
+ validate('stytch.otps.email.discovery.send').isString('email_address', data.email_address).isOptionalString('login_template_id', data.login_template_id).isOptionalString('locale', data.locale).isOptionalNumber('discovery_expiration_minutes', data.discovery_expiration_minutes);
5012
5033
  _context137.next = 3;
5013
5034
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
5014
5035
  case 3:
@@ -5520,11 +5541,11 @@ var SearchDataManager = /*#__PURE__*/function () {
5520
5541
  return _createClass(SearchDataManager, [{
5521
5542
  key: "searchUser",
5522
5543
  value: function searchUser(email) {
5523
- var _this30 = this;
5544
+ var _this29 = this;
5524
5545
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha().then(function (_ref10) {
5525
5546
  var dfp_telemetry_id = _ref10.dfp_telemetry_id,
5526
5547
  captcha_token = _ref10.captcha_token;
5527
- return _this30._networkClient.fetchSDK({
5548
+ return _this29._networkClient.fetchSDK({
5528
5549
  url: "/users/search",
5529
5550
  method: 'POST',
5530
5551
  body: {
@@ -5583,53 +5604,53 @@ var SessionManagerRegistry = /*#__PURE__*/function () {
5583
5604
  }();
5584
5605
  var SessionManager = /*#__PURE__*/function () {
5585
5606
  function SessionManager(_subscriptionService, _headlessSessionClient, _publicToken) {
5586
- var _this31 = this;
5607
+ var _this30 = this;
5587
5608
  _classCallCheck(this, SessionManager);
5588
5609
  this._subscriptionService = _subscriptionService;
5589
5610
  this._headlessSessionClient = _headlessSessionClient;
5590
5611
  this._publicToken = _publicToken;
5591
5612
  this._onDataChange = function (state) {
5592
5613
  if (shouldTryRefresh(state)) {
5593
- _this31.scheduleBackgroundRefresh();
5614
+ _this30.scheduleBackgroundRefresh();
5594
5615
  } else {
5595
- _this31.cancelBackgroundRefresh();
5616
+ _this30.cancelBackgroundRefresh();
5596
5617
  }
5597
5618
  };
5598
5619
  this._reauthenticateWithBackoff = function () {
5599
- return __awaiter$1(_this31, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee147() {
5620
+ return __awaiter$1(_this30, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee146() {
5600
5621
  var count;
5601
- return _regeneratorRuntime().wrap(function _callee147$(_context147) {
5602
- while (1) switch (_context147.prev = _context147.next) {
5622
+ return _regeneratorRuntime().wrap(function _callee146$(_context146) {
5623
+ while (1) switch (_context146.prev = _context146.next) {
5603
5624
  case 0:
5604
5625
  count = 0;
5605
5626
  case 1:
5606
- _context147.prev = 2;
5607
- _context147.next = 5;
5627
+ _context146.prev = 2;
5628
+ _context146.next = 5;
5608
5629
  return this._headlessSessionClient.authenticate();
5609
5630
  case 5:
5610
- return _context147.abrupt("return", _context147.sent);
5631
+ return _context146.abrupt("return", _context146.sent);
5611
5632
  case 8:
5612
- _context147.prev = 8;
5613
- _context147.t0 = _context147["catch"](2);
5614
- if (!SessionManager.isUnrecoverableError(_context147.t0)) {
5615
- _context147.next = 12;
5633
+ _context146.prev = 8;
5634
+ _context146.t0 = _context146["catch"](2);
5635
+ if (!SessionManager.isUnrecoverableError(_context146.t0)) {
5636
+ _context146.next = 12;
5616
5637
  break;
5617
5638
  }
5618
- return _context147.abrupt("return", Promise.reject(_context147.t0));
5639
+ return _context146.abrupt("return", Promise.reject(_context146.t0));
5619
5640
  case 12:
5620
5641
  count++;
5621
- _context147.next = 15;
5642
+ _context146.next = 15;
5622
5643
  return new Promise(function (done) {
5623
5644
  return setTimeout(done, SessionManager.timeoutForAttempt(count));
5624
5645
  });
5625
5646
  case 15:
5626
- _context147.next = 1;
5647
+ _context146.next = 1;
5627
5648
  break;
5628
5649
  case 17:
5629
5650
  case "end":
5630
- return _context147.stop();
5651
+ return _context146.stop();
5631
5652
  }
5632
- }, _callee147, this, [[2, 8]]);
5653
+ }, _callee146, this, [[2, 8]]);
5633
5654
  }));
5634
5655
  };
5635
5656
  this.timeout = null;
@@ -5648,24 +5669,24 @@ var SessionManager = /*#__PURE__*/function () {
5648
5669
  }, {
5649
5670
  key: "performBackgroundRefresh",
5650
5671
  value: function performBackgroundRefresh() {
5651
- var _this32 = this;
5672
+ var _this31 = this;
5652
5673
  this._reauthenticateWithBackoff().then(function () {
5653
- _this32.scheduleBackgroundRefresh();
5674
+ _this31.scheduleBackgroundRefresh();
5654
5675
  })["catch"](function (error) {
5655
5676
  logger.warn('Session background refresh failed. Signalling to app that user is logged out.', {
5656
5677
  error: error
5657
5678
  });
5658
- _this32._subscriptionService.destroySession();
5679
+ _this31._subscriptionService.destroySession();
5659
5680
  });
5660
5681
  }
5661
5682
  }, {
5662
5683
  key: "scheduleBackgroundRefresh",
5663
5684
  value: function scheduleBackgroundRefresh() {
5664
- var _this33 = this;
5685
+ var _this32 = this;
5665
5686
  this.cancelBackgroundRefresh();
5666
5687
  this.register();
5667
5688
  this.timeout = setTimeout(function () {
5668
- _this33.performBackgroundRefresh();
5689
+ _this32.performBackgroundRefresh();
5669
5690
  }, SessionManager.REFRESH_INTERVAL_MS);
5670
5691
  }
5671
5692
  }, {
@@ -5695,13 +5716,13 @@ var SessionManager = /*#__PURE__*/function () {
5695
5716
  SessionManager.REFRESH_INTERVAL_MS = 1000 * 60 * 3;
5696
5717
  SessionManager.registry = new SessionManagerRegistry();
5697
5718
  var StateChangeClient = /*#__PURE__*/_createClass(function StateChangeClient(_subscriptionService, emptyState) {
5698
- var _this34 = this;
5719
+ var _this33 = this;
5699
5720
  _classCallCheck(this, StateChangeClient);
5700
5721
  this._subscriptionService = _subscriptionService;
5701
5722
  this.emptyState = emptyState;
5702
5723
  this.onStateChange = function (callback) {
5703
- return _this34._subscriptionService.subscribeToState(function (state) {
5704
- callback(state !== null && state !== void 0 ? state : _this34.emptyState);
5724
+ return _this33._subscriptionService.subscribeToState(function (state) {
5725
+ callback(state !== null && state !== void 0 ? state : _this33.emptyState);
5705
5726
  });
5706
5727
  };
5707
5728
  });
@@ -5828,6 +5849,7 @@ var readB2BInternals = function readB2BInternals(obj) {
5828
5849
  }
5829
5850
  return casted[internalSymB2B];
5830
5851
  };
5852
+ exports.BiometricRegistrationIdIsNullOrBlank = BiometricRegistrationIdIsNullOrBlank;
5831
5853
  exports.BiometricsAlreadyEnrolledError = BiometricsAlreadyEnrolledError;
5832
5854
  exports.BiometricsFailedError = BiometricsFailedError;
5833
5855
  exports.BiometricsUnavailableError = BiometricsUnavailableError;
@@ -5864,6 +5886,7 @@ exports.IframeHostClient = IframeHostClient;
5864
5886
  exports.InternalError = InternalError;
5865
5887
  exports.InvalidAuthorizationCredentialError = InvalidAuthorizationCredentialError;
5866
5888
  exports.InvalidCredentialTypeError = InvalidCredentialTypeError;
5889
+ exports.InvalidPrivateKeyLength = InvalidPrivateKeyLength;
5867
5890
  exports.InvalidRedirectSchemeError = InvalidRedirectSchemeError;
5868
5891
  exports.InvalidStartUrlError = InvalidStartUrlError;
5869
5892
  exports.JSONDataNotConvertibleToStringError = JSONDataNotConvertibleToStringError;
@@ -5871,6 +5894,7 @@ exports.KeyInvalidatedError = KeyInvalidatedError;
5871
5894
  exports.KeystoreUnavailableError = KeystoreUnavailableError;
5872
5895
  exports.MissingAttestationObjectError = MissingAttestationObjectError;
5873
5896
  exports.MissingAuthorizationCredentialIDTokenError = MissingAuthorizationCredentialIDTokenError;
5897
+ exports.MissingCipherIv = MissingCipherIv;
5874
5898
  exports.MissingGoogleClientIDError = MissingGoogleClientIDError;
5875
5899
  exports.MissingPKCEError = MissingPKCEError;
5876
5900
  exports.MissingPublicKeyError = MissingPublicKeyError;
@@ -630,12 +630,36 @@ var SignInWithAppleMisconfigured = /*#__PURE__*/function (_StytchSDKError33) {
630
630
  _inherits$1(SignInWithAppleMisconfigured, _StytchSDKError33);
631
631
  return _createClass$1(SignInWithAppleMisconfigured);
632
632
  }(StytchSDKError);
633
- var IDPOAuthFlowMissingParamError = /*#__PURE__*/function (_StytchSDKError34) {
633
+ var MissingCipherIv = /*#__PURE__*/function (_StytchSDKError34) {
634
+ function MissingCipherIv() {
635
+ _classCallCheck$1(this, MissingCipherIv);
636
+ return _callSuper$1(this, MissingCipherIv, ['MissingCipherIv', 'The expected cipher Iv was not found when attempting to decrypt an existing biometric key.']);
637
+ }
638
+ _inherits$1(MissingCipherIv, _StytchSDKError34);
639
+ return _createClass$1(MissingCipherIv);
640
+ }(StytchSDKError);
641
+ var InvalidPrivateKeyLength = /*#__PURE__*/function (_StytchSDKError35) {
642
+ function InvalidPrivateKeyLength() {
643
+ _classCallCheck$1(this, InvalidPrivateKeyLength);
644
+ return _callSuper$1(this, InvalidPrivateKeyLength, ['InvalidPrivateKeyLength', "The private key was of an incorrect length."]);
645
+ }
646
+ _inherits$1(InvalidPrivateKeyLength, _StytchSDKError35);
647
+ return _createClass$1(InvalidPrivateKeyLength);
648
+ }(StytchSDKError);
649
+ var BiometricRegistrationIdIsNullOrBlank = /*#__PURE__*/function (_StytchSDKError36) {
650
+ function BiometricRegistrationIdIsNullOrBlank() {
651
+ _classCallCheck$1(this, BiometricRegistrationIdIsNullOrBlank);
652
+ return _callSuper$1(this, BiometricRegistrationIdIsNullOrBlank, ['BiometricRegistrationIdIsNullOrBlank', 'Attempted to set a blank or null biometric registration ID. This is not allowed, and indicates no registration was created on the server. Consider deleting any local keys that may have been generated.']);
653
+ }
654
+ _inherits$1(BiometricRegistrationIdIsNullOrBlank, _StytchSDKError36);
655
+ return _createClass$1(BiometricRegistrationIdIsNullOrBlank);
656
+ }(StytchSDKError);
657
+ var IDPOAuthFlowMissingParamError = /*#__PURE__*/function (_StytchSDKError37) {
634
658
  function IDPOAuthFlowMissingParamError(details) {
635
659
  _classCallCheck$1(this, IDPOAuthFlowMissingParamError);
636
660
  return _callSuper$1(this, IDPOAuthFlowMissingParamError, ['IDPOAuthFlowMissingParamError', details]);
637
661
  }
638
- _inherits$1(IDPOAuthFlowMissingParamError, _StytchSDKError34);
662
+ _inherits$1(IDPOAuthFlowMissingParamError, _StytchSDKError37);
639
663
  return _createClass$1(IDPOAuthFlowMissingParamError);
640
664
  }(StytchSDKError);
641
665
  function errorToStytchError(error) {
@@ -712,6 +736,12 @@ function errorToStytchError(error) {
712
736
  return new PasskeysMisconfigured();
713
737
  case 'signinwithapple_misconfigured':
714
738
  return new SignInWithAppleMisconfigured();
739
+ case 'missing_cipher_iv':
740
+ return new MissingCipherIv();
741
+ case 'invalid_private_key_length':
742
+ return new InvalidPrivateKeyLength();
743
+ case 'biometric_registration_id_is_null_or_blank':
744
+ return new BiometricRegistrationIdIsNullOrBlank();
715
745
  default:
716
746
  return new InternalError(error);
717
747
  }
@@ -2230,15 +2260,6 @@ var ErrorMarshaller = /*#__PURE__*/function () {
2230
2260
  _classCallCheck(this, ErrorMarshaller);
2231
2261
  }
2232
2262
  return _createClass(ErrorMarshaller, null, [{
2233
- key: "marshall",
2234
- value: function marshall(error) {
2235
- return Object.assign(Object.assign({}, error), {
2236
- name: error.name,
2237
- message: error.message,
2238
- stack: error.stack
2239
- });
2240
- }
2241
- }, {
2242
2263
  key: "inflate",
2243
2264
  value: function inflate(ErrorClass, ErrorData) {
2244
2265
  var err = new ErrorClass(ErrorData);
@@ -2378,7 +2399,7 @@ var HeadlessB2BMagicLinksClient = /*#__PURE__*/function () {
2378
2399
  return _regeneratorRuntime().wrap(function _callee62$(_context62) {
2379
2400
  while (1) switch (_context62.prev = _context62.next) {
2380
2401
  case 0:
2381
- validate('stytch.magicLinks.email.loginOrSignup').isString('email_address', data.email_address).isOptionalString('invite_redirect_url', data.invite_redirect_url).isOptionalString('invite_template_id', data.invite_template_id).isOptionalString('name', data.name).isOptionalString('locale', data.locale).isOptionalStringArray('roles', data.roles);
2402
+ validate('stytch.magicLinks.email.invite').isString('email_address', data.email_address).isOptionalString('invite_redirect_url', data.invite_redirect_url).isOptionalString('invite_template_id', data.invite_template_id).isOptionalString('name', data.name).isOptionalString('locale', data.locale).isOptionalStringArray('roles', data.roles).isOptionalNumber('invite_expiration_minutes', data.invite_expiration_minutes);
2382
2403
  return _context62.abrupt("return", this._networkClient.fetchSDK({
2383
2404
  url: '/b2b/magic_links/email/invite',
2384
2405
  body: data,
@@ -2397,7 +2418,7 @@ var HeadlessB2BMagicLinksClient = /*#__PURE__*/function () {
2397
2418
  return _regeneratorRuntime().wrap(function _callee63$(_context63) {
2398
2419
  while (1) switch (_context63.prev = _context63.next) {
2399
2420
  case 0:
2400
- validate('stytch.magicLinks.email.loginOrSignup').isString('email_address', data.email_address).isString('organization_id', data.organization_id).isOptionalString('login_redirect_url', data.login_redirect_url).isOptionalString('login_template_id', data.login_template_id).isOptionalString('signup_redirect_url', data.signup_redirect_url).isOptionalString('signup_template_id', data.signup_template_id).isOptionalString('locale', data.locale);
2421
+ validate('stytch.magicLinks.email.loginOrSignup').isString('email_address', data.email_address).isString('organization_id', data.organization_id).isOptionalString('login_redirect_url', data.login_redirect_url).isOptionalString('login_template_id', data.login_template_id).isOptionalString('signup_redirect_url', data.signup_redirect_url).isOptionalString('signup_template_id', data.signup_template_id).isOptionalString('locale', data.locale).isOptionalNumber('login_expiration_minutes', data.login_expiration_minutes).isOptionalNumber('signup_expiration_minutes', data.signup_expiration_minutes);
2401
2422
  _context63.next = 3;
2402
2423
  return this.getCodeChallenge();
2403
2424
  case 3:
@@ -2424,7 +2445,7 @@ var HeadlessB2BMagicLinksClient = /*#__PURE__*/function () {
2424
2445
  return _regeneratorRuntime().wrap(function _callee64$(_context64) {
2425
2446
  while (1) switch (_context64.prev = _context64.next) {
2426
2447
  case 0:
2427
- validate('stytch.magicLinks.email.discovery.send').isString('email_address', data.email_address).isOptionalString('discovery_redirect_url', data.discovery_redirect_url).isOptionalString('login_template_id', data.login_template_id).isOptionalString('locale', data.locale);
2448
+ validate('stytch.magicLinks.email.discovery.send').isString('email_address', data.email_address).isOptionalString('discovery_redirect_url', data.discovery_redirect_url).isOptionalString('login_template_id', data.login_template_id).isOptionalString('locale', data.locale).isOptionalNumber('discovery_expiration_minutes', data.discovery_expiration_minutes);
2428
2449
  _context64.next = 3;
2429
2450
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
2430
2451
  case 3:
@@ -4921,7 +4942,7 @@ var HeadlessB2BOTPsClient = /*#__PURE__*/_createClass(function HeadlessB2BOTPsCl
4921
4942
  return _regeneratorRuntime().wrap(function _callee135$(_context135) {
4922
4943
  while (1) switch (_context135.prev = _context135.next) {
4923
4944
  case 0:
4924
- validate('stytch.otps.email.loginOrSignup').isString('organization_id', data.organization_id).isString('email_address', data.email_address).isOptionalString('login_template_id', data.login_template_id).isOptionalString('signup_template_id', data.signup_template_id).isOptionalString('locale', data.locale);
4945
+ validate('stytch.otps.email.loginOrSignup').isString('organization_id', data.organization_id).isString('email_address', data.email_address).isOptionalString('login_template_id', data.login_template_id).isOptionalString('signup_template_id', data.signup_template_id).isOptionalString('locale', data.locale).isOptionalNumber('login_expiration_minutes', data.login_expiration_minutes).isOptionalNumber('signup_expiration_minutes', data.signup_expiration_minutes);
4925
4946
  _context135.next = 3;
4926
4947
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
4927
4948
  case 3:
@@ -5006,7 +5027,7 @@ var HeadlessB2BOTPsClient = /*#__PURE__*/_createClass(function HeadlessB2BOTPsCl
5006
5027
  return _regeneratorRuntime().wrap(function _callee137$(_context137) {
5007
5028
  while (1) switch (_context137.prev = _context137.next) {
5008
5029
  case 0:
5009
- validate('stytch.otps.email.discovery.send').isString('email_address', data.email_address).isOptionalString('login_template_id', data.login_template_id).isOptionalString('locale', data.locale);
5030
+ validate('stytch.otps.email.discovery.send').isString('email_address', data.email_address).isOptionalString('login_template_id', data.login_template_id).isOptionalString('locale', data.locale).isOptionalNumber('discovery_expiration_minutes', data.discovery_expiration_minutes);
5010
5031
  _context137.next = 3;
5011
5032
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
5012
5033
  case 3:
@@ -5518,11 +5539,11 @@ var SearchDataManager = /*#__PURE__*/function () {
5518
5539
  return _createClass(SearchDataManager, [{
5519
5540
  key: "searchUser",
5520
5541
  value: function searchUser(email) {
5521
- var _this30 = this;
5542
+ var _this29 = this;
5522
5543
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha().then(function (_ref10) {
5523
5544
  var dfp_telemetry_id = _ref10.dfp_telemetry_id,
5524
5545
  captcha_token = _ref10.captcha_token;
5525
- return _this30._networkClient.fetchSDK({
5546
+ return _this29._networkClient.fetchSDK({
5526
5547
  url: "/users/search",
5527
5548
  method: 'POST',
5528
5549
  body: {
@@ -5581,53 +5602,53 @@ var SessionManagerRegistry = /*#__PURE__*/function () {
5581
5602
  }();
5582
5603
  var SessionManager = /*#__PURE__*/function () {
5583
5604
  function SessionManager(_subscriptionService, _headlessSessionClient, _publicToken) {
5584
- var _this31 = this;
5605
+ var _this30 = this;
5585
5606
  _classCallCheck(this, SessionManager);
5586
5607
  this._subscriptionService = _subscriptionService;
5587
5608
  this._headlessSessionClient = _headlessSessionClient;
5588
5609
  this._publicToken = _publicToken;
5589
5610
  this._onDataChange = function (state) {
5590
5611
  if (shouldTryRefresh(state)) {
5591
- _this31.scheduleBackgroundRefresh();
5612
+ _this30.scheduleBackgroundRefresh();
5592
5613
  } else {
5593
- _this31.cancelBackgroundRefresh();
5614
+ _this30.cancelBackgroundRefresh();
5594
5615
  }
5595
5616
  };
5596
5617
  this._reauthenticateWithBackoff = function () {
5597
- return __awaiter$1(_this31, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee147() {
5618
+ return __awaiter$1(_this30, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee146() {
5598
5619
  var count;
5599
- return _regeneratorRuntime().wrap(function _callee147$(_context147) {
5600
- while (1) switch (_context147.prev = _context147.next) {
5620
+ return _regeneratorRuntime().wrap(function _callee146$(_context146) {
5621
+ while (1) switch (_context146.prev = _context146.next) {
5601
5622
  case 0:
5602
5623
  count = 0;
5603
5624
  case 1:
5604
- _context147.prev = 2;
5605
- _context147.next = 5;
5625
+ _context146.prev = 2;
5626
+ _context146.next = 5;
5606
5627
  return this._headlessSessionClient.authenticate();
5607
5628
  case 5:
5608
- return _context147.abrupt("return", _context147.sent);
5629
+ return _context146.abrupt("return", _context146.sent);
5609
5630
  case 8:
5610
- _context147.prev = 8;
5611
- _context147.t0 = _context147["catch"](2);
5612
- if (!SessionManager.isUnrecoverableError(_context147.t0)) {
5613
- _context147.next = 12;
5631
+ _context146.prev = 8;
5632
+ _context146.t0 = _context146["catch"](2);
5633
+ if (!SessionManager.isUnrecoverableError(_context146.t0)) {
5634
+ _context146.next = 12;
5614
5635
  break;
5615
5636
  }
5616
- return _context147.abrupt("return", Promise.reject(_context147.t0));
5637
+ return _context146.abrupt("return", Promise.reject(_context146.t0));
5617
5638
  case 12:
5618
5639
  count++;
5619
- _context147.next = 15;
5640
+ _context146.next = 15;
5620
5641
  return new Promise(function (done) {
5621
5642
  return setTimeout(done, SessionManager.timeoutForAttempt(count));
5622
5643
  });
5623
5644
  case 15:
5624
- _context147.next = 1;
5645
+ _context146.next = 1;
5625
5646
  break;
5626
5647
  case 17:
5627
5648
  case "end":
5628
- return _context147.stop();
5649
+ return _context146.stop();
5629
5650
  }
5630
- }, _callee147, this, [[2, 8]]);
5651
+ }, _callee146, this, [[2, 8]]);
5631
5652
  }));
5632
5653
  };
5633
5654
  this.timeout = null;
@@ -5646,24 +5667,24 @@ var SessionManager = /*#__PURE__*/function () {
5646
5667
  }, {
5647
5668
  key: "performBackgroundRefresh",
5648
5669
  value: function performBackgroundRefresh() {
5649
- var _this32 = this;
5670
+ var _this31 = this;
5650
5671
  this._reauthenticateWithBackoff().then(function () {
5651
- _this32.scheduleBackgroundRefresh();
5672
+ _this31.scheduleBackgroundRefresh();
5652
5673
  })["catch"](function (error) {
5653
5674
  logger.warn('Session background refresh failed. Signalling to app that user is logged out.', {
5654
5675
  error: error
5655
5676
  });
5656
- _this32._subscriptionService.destroySession();
5677
+ _this31._subscriptionService.destroySession();
5657
5678
  });
5658
5679
  }
5659
5680
  }, {
5660
5681
  key: "scheduleBackgroundRefresh",
5661
5682
  value: function scheduleBackgroundRefresh() {
5662
- var _this33 = this;
5683
+ var _this32 = this;
5663
5684
  this.cancelBackgroundRefresh();
5664
5685
  this.register();
5665
5686
  this.timeout = setTimeout(function () {
5666
- _this33.performBackgroundRefresh();
5687
+ _this32.performBackgroundRefresh();
5667
5688
  }, SessionManager.REFRESH_INTERVAL_MS);
5668
5689
  }
5669
5690
  }, {
@@ -5693,13 +5714,13 @@ var SessionManager = /*#__PURE__*/function () {
5693
5714
  SessionManager.REFRESH_INTERVAL_MS = 1000 * 60 * 3;
5694
5715
  SessionManager.registry = new SessionManagerRegistry();
5695
5716
  var StateChangeClient = /*#__PURE__*/_createClass(function StateChangeClient(_subscriptionService, emptyState) {
5696
- var _this34 = this;
5717
+ var _this33 = this;
5697
5718
  _classCallCheck(this, StateChangeClient);
5698
5719
  this._subscriptionService = _subscriptionService;
5699
5720
  this.emptyState = emptyState;
5700
5721
  this.onStateChange = function (callback) {
5701
- return _this34._subscriptionService.subscribeToState(function (state) {
5702
- callback(state !== null && state !== void 0 ? state : _this34.emptyState);
5722
+ return _this33._subscriptionService.subscribeToState(function (state) {
5723
+ callback(state !== null && state !== void 0 ? state : _this33.emptyState);
5703
5724
  });
5704
5725
  };
5705
5726
  });
@@ -5826,4 +5847,4 @@ var readB2BInternals = function readB2BInternals(obj) {
5826
5847
  }
5827
5848
  return casted[internalSymB2B];
5828
5849
  };
5829
- export { RandomNumberGenerationFailed as $, AuthFlowType as A, B2BMFAProducts as B, COUNTRIES_LIST as C, DEFAULT_SESSION_DURATION_MINUTES as D, EMAIL_REGEX as E, FailedCodeChallengeError as F, MissingPKCEError as G, MissingPublicKeyError as H, IDPOAuthFlowMissingParamError as I, JSONDataNotConvertibleToStringError as J, KeyInvalidatedError as K, MissingUrlError as L, MissingAttestationObjectError as M, NoCurrentSessionError as N, OAuthProviders as O, Products as P, NoBiometricsEnrolledError as Q, RedirectURLType as R, StytchEventType as S, NoBiometricsRegistrationError as T, NoCredentialsPresentError as U, PasskeysInvalidEncoding as V, Wallets as W, PasskeysMisconfigured as X, PasskeysUnsupportedError as Y, RNUIProducts as Z, __rest as _, B2BProducts as a, SDKAPIUnreachableError as a0, SDKNotConfiguredError as a1, SignInWithAppleMisconfigured as a2, StytchAPISchemaError as a3, StytchAPIUnreachableError as a4, StytchError as a5, StytchSDKAPIError as a6, StytchSDKSchemaError as a7, StytchSDKUsageError as a8, UNRECOVERABLE_ERROR_TYPES as a9, DFPProtectedAuthProvider as aA, HeadlessB2BOrganizationClient as aB, HeadlessB2BSelfClient as aC, HeadlessB2BSessionClient as aD, HeadlessB2BMagicLinksClient as aE, HeadlessB2BSSOClient as aF, HeadlessB2BDiscoveryClient as aG, HeadlessB2BPasswordsClient as aH, HeadlessB2BOTPsClient as aI, HeadlessB2BTOTPsClient as aJ, HeadlessB2BRecoveryCodesClient as aK, HeadlessB2BRBACClient as aL, HeadlessB2BSCIMClient as aM, HeadlessB2BImpersonationClient as aN, SessionManager as aO, SearchDataManager as aP, VERTICAL_CONSUMER as aQ, writeB2BInternals as aR, UserCancellationError as aa, UserLockedOutError as ab, errorToStytchError as ac, createDeepEqual as ad, getPersistentStorageKey as ae, loadESModule as af, IframeHostClient as ag, EventLogger as ah, DEFAULT_MAX_BATCH_SIZE as ai, DEFAULT_INTERVAL_DURATION_MS as aj, createEventId as ak, createAppSessionId as al, createPersistentId as am, baseFetchSDK as an, baseSubmitFormSDK as ao, retriableFetchSDK as ap, validate as aq, hasMultipleCookies as ar, isLocalhost as as, HeadlessB2BOAuthClient$1 as at, DisabledDFPProtectedAuthProvider as au, GOOGLE_ONE_TAP_HOST as av, GOOGLE_ONE_TAP_SCRIPT_URL as aw, checkPublicToken as ax, buildFinalConfig as ay, StateChangeClient as az, OTPMethods as b, B2BOAuthProviders as c, __awaiter as d, StytchAPIError as e, OneTapPositions as f, debounce as g, StytchSDKError as h, isTestPublicToken as i, checkB2BNotSSR as j, BiometricsAlreadyEnrolledError as k, logger as l, BiometricsFailedError as m, BiometricsUnavailableError as n, ChallengeSigningFailedError as o, DeviceCredentialsNotAllowedError as p, FailedToDecryptDataError as q, readB2BInternals as r, InternalError as s, InvalidAuthorizationCredentialError as t, InvalidCredentialTypeError as u, InvalidRedirectSchemeError as v, InvalidStartUrlError as w, KeystoreUnavailableError as x, MissingAuthorizationCredentialIDTokenError as y, MissingGoogleClientIDError as z };
5850
+ export { PasskeysMisconfigured as $, AuthFlowType as A, B2BMFAProducts as B, COUNTRIES_LIST as C, DEFAULT_SESSION_DURATION_MINUTES as D, EMAIL_REGEX as E, FailedCodeChallengeError as F, MissingAuthorizationCredentialIDTokenError as G, MissingCipherIv as H, IDPOAuthFlowMissingParamError as I, JSONDataNotConvertibleToStringError as J, KeyInvalidatedError as K, MissingGoogleClientIDError as L, MissingAttestationObjectError as M, NoCurrentSessionError as N, OAuthProviders as O, Products as P, MissingPKCEError as Q, RedirectURLType as R, StytchEventType as S, MissingPublicKeyError as T, MissingUrlError as U, NoBiometricsEnrolledError as V, Wallets as W, NoBiometricsRegistrationError as X, NoCredentialsPresentError as Y, PasskeysInvalidEncoding as Z, __rest as _, B2BProducts as a, PasskeysUnsupportedError as a0, RNUIProducts as a1, RandomNumberGenerationFailed as a2, SDKAPIUnreachableError as a3, SDKNotConfiguredError as a4, SignInWithAppleMisconfigured as a5, StytchAPISchemaError as a6, StytchAPIUnreachableError as a7, StytchError as a8, StytchSDKAPIError as a9, checkPublicToken as aA, buildFinalConfig as aB, StateChangeClient as aC, DFPProtectedAuthProvider as aD, HeadlessB2BOrganizationClient as aE, HeadlessB2BSelfClient as aF, HeadlessB2BSessionClient as aG, HeadlessB2BMagicLinksClient as aH, HeadlessB2BSSOClient as aI, HeadlessB2BDiscoveryClient as aJ, HeadlessB2BPasswordsClient as aK, HeadlessB2BOTPsClient as aL, HeadlessB2BTOTPsClient as aM, HeadlessB2BRecoveryCodesClient as aN, HeadlessB2BRBACClient as aO, HeadlessB2BSCIMClient as aP, HeadlessB2BImpersonationClient as aQ, SessionManager as aR, SearchDataManager as aS, VERTICAL_CONSUMER as aT, writeB2BInternals as aU, StytchSDKSchemaError as aa, StytchSDKUsageError as ab, UNRECOVERABLE_ERROR_TYPES as ac, UserCancellationError as ad, UserLockedOutError as ae, errorToStytchError as af, createDeepEqual as ag, getPersistentStorageKey as ah, loadESModule as ai, IframeHostClient as aj, EventLogger as ak, DEFAULT_MAX_BATCH_SIZE as al, DEFAULT_INTERVAL_DURATION_MS as am, createEventId as an, createAppSessionId as ao, createPersistentId as ap, baseFetchSDK as aq, baseSubmitFormSDK as ar, retriableFetchSDK as as, validate as at, hasMultipleCookies as au, isLocalhost as av, HeadlessB2BOAuthClient$1 as aw, DisabledDFPProtectedAuthProvider as ax, GOOGLE_ONE_TAP_HOST as ay, GOOGLE_ONE_TAP_SCRIPT_URL as az, OTPMethods as b, B2BOAuthProviders as c, __awaiter as d, StytchAPIError as e, OneTapPositions as f, debounce as g, StytchSDKError as h, isTestPublicToken as i, checkB2BNotSSR as j, BiometricRegistrationIdIsNullOrBlank as k, logger as l, BiometricsAlreadyEnrolledError as m, BiometricsFailedError as n, BiometricsUnavailableError as o, ChallengeSigningFailedError as p, DeviceCredentialsNotAllowedError as q, readB2BInternals as r, FailedToDecryptDataError as s, InternalError as t, InvalidAuthorizationCredentialError as u, InvalidCredentialTypeError as v, InvalidPrivateKeyLength as w, InvalidRedirectSchemeError as x, InvalidStartUrlError as y, KeystoreUnavailableError as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stytch/vanilla-js",
3
- "version": "5.22.2",
3
+ "version": "5.22.4",
4
4
  "description": "Stytch's official Javascript Client Library",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.esm.js",
@@ -39,7 +39,7 @@
39
39
  "hoistingLimits": "workspaces"
40
40
  },
41
41
  "dependencies": {
42
- "@stytch/core": "2.47.1",
42
+ "@stytch/core": "2.48.0",
43
43
  "@types/google-one-tap": "^1.2.0",
44
44
  "type-fest": "4.15.0"
45
45
  },
@@ -108,7 +108,7 @@
108
108
  "swr": "2.1.1",
109
109
  "typescript": "5.3.3",
110
110
  "uuid": "8.3.2",
111
- "vite": "6.2.5",
111
+ "vite": "6.2.6",
112
112
  "wait-on": "7.2.0"
113
113
  },
114
114
  "homepage": "https://stytch.com/docs/sdks/javascript-sdk",