@stytch/vanilla-js 5.10.2 → 5.10.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.
@@ -378,9 +378,12 @@ var NoCurrentSessionError = /*#__PURE__*/function (_StytchSDKError) {
378
378
  }(StytchSDKError);
379
379
  var InternalError = /*#__PURE__*/function (_StytchSDKError2) {
380
380
  _inherits$1(InternalError, _StytchSDKError2);
381
- function InternalError(message) {
381
+ function InternalError(error) {
382
+ var _this9;
382
383
  _classCallCheck$1(this, InternalError);
383
- return _callSuper$1(this, InternalError, ['InternalError', message ? message : 'An internal error has occurred. Please contact Stytch if this occurs.']);
384
+ _this9 = _callSuper$1(this, InternalError, [error.name ? error.name : 'Internal Error', error.message ? error.message : 'An internal error has occurred. Please contact Stytch if this occurs.']);
385
+ _this9.nativeStack = error.nativeStackAndroid || error.nativeStackIOS;
386
+ return _this9;
384
387
  }
385
388
  return _createClass$1(InternalError);
386
389
  }(StytchSDKError);
@@ -626,8 +629,6 @@ var SignInWithAppleMisconfigured = /*#__PURE__*/function (_StytchSDKError32) {
626
629
  }(StytchSDKError);
627
630
  function errorToStytchError(error) {
628
631
  switch (error.message) {
629
- case 'internal_error':
630
- return new InternalError(error.message);
631
632
  case 'no_current_session':
632
633
  return new NoCurrentSessionError();
633
634
  case 'no_biometrics_registration':
@@ -701,7 +702,7 @@ function errorToStytchError(error) {
701
702
  case 'signinwithapple_misconfigured':
702
703
  return new SignInWithAppleMisconfigured();
703
704
  default:
704
- return new StytchSDKError(error.name, error.message);
705
+ return new InternalError(error);
705
706
  }
706
707
  }
707
708
  var B2BProducts;
@@ -4248,18 +4249,18 @@ var IframeHostClient = /*#__PURE__*/function () {
4248
4249
  }, {
4249
4250
  key: "call",
4250
4251
  value: function call(method, args) {
4251
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee140() {
4252
- var _this23 = this;
4252
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee141() {
4253
+ var _this24 = this;
4253
4254
  var frame, channel;
4254
- return _regeneratorRuntime().wrap(function _callee140$(_context140) {
4255
- while (1) switch (_context140.prev = _context140.next) {
4255
+ return _regeneratorRuntime().wrap(function _callee141$(_context141) {
4256
+ while (1) switch (_context141.prev = _context141.next) {
4256
4257
  case 0:
4257
- _context140.next = 2;
4258
+ _context141.next = 2;
4258
4259
  return this.frame;
4259
4260
  case 2:
4260
- frame = _context140.sent;
4261
+ frame = _context141.sent;
4261
4262
  channel = new MessageChannel();
4262
- return _context140.abrupt("return", new Promise(function (resolve, reject) {
4263
+ return _context141.abrupt("return", new Promise(function (resolve, reject) {
4263
4264
  var _a;
4264
4265
  channel.port1.onmessage = function (event) {
4265
4266
  var resp = event.data;
@@ -4274,13 +4275,13 @@ var IframeHostClient = /*#__PURE__*/function () {
4274
4275
  method: method,
4275
4276
  args: args
4276
4277
  };
4277
- (_a = frame.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(message, _this23.iframeURL, [channel.port2]);
4278
+ (_a = frame.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(message, _this24.iframeURL, [channel.port2]);
4278
4279
  }));
4279
4280
  case 5:
4280
4281
  case "end":
4281
- return _context140.stop();
4282
+ return _context141.stop();
4282
4283
  }
4283
- }, _callee140, this);
4284
+ }, _callee141, this);
4284
4285
  }));
4285
4286
  }
4286
4287
  }]);
@@ -4295,11 +4296,11 @@ var SearchDataManager = /*#__PURE__*/function () {
4295
4296
  _createClass(SearchDataManager, [{
4296
4297
  key: "searchUser",
4297
4298
  value: function searchUser(email) {
4298
- var _this25 = this;
4299
+ var _this26 = this;
4299
4300
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha().then(function (_ref7) {
4300
4301
  var dfp_telemetry_id = _ref7.dfp_telemetry_id,
4301
4302
  captcha_token = _ref7.captcha_token;
4302
- return _this25._networkClient.fetchSDK({
4303
+ return _this26._networkClient.fetchSDK({
4303
4304
  url: "/users/search",
4304
4305
  method: 'POST',
4305
4306
  body: {
@@ -4330,52 +4331,52 @@ var shouldTryRefresh = function shouldTryRefresh(state) {
4330
4331
  };
4331
4332
  var SessionManager = /*#__PURE__*/function () {
4332
4333
  function SessionManager(_subscriptionService, _headlessSessionClient) {
4333
- var _this26 = this;
4334
+ var _this27 = this;
4334
4335
  _classCallCheck(this, SessionManager);
4335
4336
  this._subscriptionService = _subscriptionService;
4336
4337
  this._headlessSessionClient = _headlessSessionClient;
4337
4338
  this._onDataChange = function (state) {
4338
4339
  if (shouldTryRefresh(state)) {
4339
- _this26.scheduleBackgroundRefresh();
4340
+ _this27.scheduleBackgroundRefresh();
4340
4341
  } else {
4341
- _this26.cancelBackgroundRefresh();
4342
+ _this27.cancelBackgroundRefresh();
4342
4343
  }
4343
4344
  };
4344
4345
  this._reauthenticateWithBackoff = function () {
4345
- return __awaiter$1(_this26, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee142() {
4346
+ return __awaiter$1(_this27, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee143() {
4346
4347
  var count;
4347
- return _regeneratorRuntime().wrap(function _callee142$(_context142) {
4348
- while (1) switch (_context142.prev = _context142.next) {
4348
+ return _regeneratorRuntime().wrap(function _callee143$(_context143) {
4349
+ while (1) switch (_context143.prev = _context143.next) {
4349
4350
  case 0:
4350
4351
  count = 0;
4351
4352
  case 1:
4352
- _context142.prev = 2;
4353
- _context142.next = 5;
4353
+ _context143.prev = 2;
4354
+ _context143.next = 5;
4354
4355
  return this._headlessSessionClient.authenticate();
4355
4356
  case 5:
4356
- return _context142.abrupt("return", _context142.sent);
4357
+ return _context143.abrupt("return", _context143.sent);
4357
4358
  case 8:
4358
- _context142.prev = 8;
4359
- _context142.t0 = _context142["catch"](2);
4360
- if (!SessionManager.isUnrecoverableError(_context142.t0)) {
4361
- _context142.next = 12;
4359
+ _context143.prev = 8;
4360
+ _context143.t0 = _context143["catch"](2);
4361
+ if (!SessionManager.isUnrecoverableError(_context143.t0)) {
4362
+ _context143.next = 12;
4362
4363
  break;
4363
4364
  }
4364
- return _context142.abrupt("return", Promise.reject(_context142.t0));
4365
+ return _context143.abrupt("return", Promise.reject(_context143.t0));
4365
4366
  case 12:
4366
4367
  count++;
4367
- _context142.next = 15;
4368
+ _context143.next = 15;
4368
4369
  return new Promise(function (done) {
4369
4370
  return setTimeout(done, SessionManager.timeoutForAttempt(count));
4370
4371
  });
4371
4372
  case 15:
4372
- _context142.next = 1;
4373
+ _context143.next = 1;
4373
4374
  break;
4374
4375
  case 17:
4375
4376
  case "end":
4376
- return _context142.stop();
4377
+ return _context143.stop();
4377
4378
  }
4378
- }, _callee142, this, [[2, 8]]);
4379
+ }, _callee143, this, [[2, 8]]);
4379
4380
  }));
4380
4381
  };
4381
4382
  this.timeout = null;
@@ -4384,23 +4385,23 @@ var SessionManager = /*#__PURE__*/function () {
4384
4385
  _createClass(SessionManager, [{
4385
4386
  key: "performBackgroundRefresh",
4386
4387
  value: function performBackgroundRefresh() {
4387
- var _this27 = this;
4388
+ var _this28 = this;
4388
4389
  this._reauthenticateWithBackoff().then(function () {
4389
- _this27.scheduleBackgroundRefresh();
4390
+ _this28.scheduleBackgroundRefresh();
4390
4391
  })["catch"](function (error) {
4391
4392
  logger.warn('Session background refresh failed. Signalling to app that user is logged out.', {
4392
4393
  error: error
4393
4394
  });
4394
- _this27._subscriptionService.destroySession();
4395
+ _this28._subscriptionService.destroySession();
4395
4396
  });
4396
4397
  }
4397
4398
  }, {
4398
4399
  key: "scheduleBackgroundRefresh",
4399
4400
  value: function scheduleBackgroundRefresh() {
4400
- var _this28 = this;
4401
+ var _this29 = this;
4401
4402
  this.cancelBackgroundRefresh();
4402
4403
  this.timeout = setTimeout(function () {
4403
- _this28.performBackgroundRefresh();
4404
+ _this29.performBackgroundRefresh();
4404
4405
  }, SessionManager.REFRESH_INTERVAL_MS);
4405
4406
  }
4406
4407
  }, {
@@ -4429,13 +4430,13 @@ var SessionManager = /*#__PURE__*/function () {
4429
4430
  }();
4430
4431
  SessionManager.REFRESH_INTERVAL_MS = 1000 * 60 * 3;
4431
4432
  var StateChangeClient = /*#__PURE__*/_createClass(function StateChangeClient(_subscriptionService, emptyState) {
4432
- var _this29 = this;
4433
+ var _this30 = this;
4433
4434
  _classCallCheck(this, StateChangeClient);
4434
4435
  this._subscriptionService = _subscriptionService;
4435
4436
  this.emptyState = emptyState;
4436
4437
  this.onStateChange = function (callback) {
4437
- return _this29._subscriptionService.subscribeToState(function (state) {
4438
- callback(state !== null && state !== void 0 ? state : _this29.emptyState);
4438
+ return _this30._subscriptionService.subscribeToState(function (state) {
4439
+ callback(state !== null && state !== void 0 ? state : _this30.emptyState);
4439
4440
  });
4440
4441
  };
4441
4442
  });
@@ -4462,7 +4463,7 @@ var DEFAULT_BOOTSTRAP = function DEFAULT_BOOTSTRAP() {
4462
4463
  };
4463
4464
  var BootstrapDataManager = /*#__PURE__*/function () {
4464
4465
  function BootstrapDataManager(_publicToken, _networkClient, _dataLayer) {
4465
- var _this9 = this;
4466
+ var _this10 = this;
4466
4467
  _classCallCheck2(this, BootstrapDataManager);
4467
4468
  this._publicToken = _publicToken;
4468
4469
  this._networkClient = _networkClient;
@@ -4471,7 +4472,7 @@ var BootstrapDataManager = /*#__PURE__*/function () {
4471
4472
  url: "/projects/bootstrap/".concat(this._publicToken),
4472
4473
  method: 'GET'
4473
4474
  }).then(BootstrapDataManager.mapBootstrapData).then(function (data) {
4474
- _this9._dataLayer.setItem(BOOTSTRAP_CACHE_KEY, JSON.stringify(data));
4475
+ _this10._dataLayer.setItem(BOOTSTRAP_CACHE_KEY, JSON.stringify(data));
4475
4476
  return data;
4476
4477
  })["catch"](function (error) {
4477
4478
  logger.error(error);
@@ -4562,11 +4563,11 @@ var loadRecaptchaClient = function loadRecaptchaClient(siteKey) {
4562
4563
  });
4563
4564
  };
4564
4565
  var CaptchaProvider = /*#__PURE__*/_createClass2(function CaptchaProvider(bootstrapPromise) {
4565
- var _this10 = this;
4566
+ var _this11 = this;
4566
4567
  _classCallCheck2(this, CaptchaProvider);
4567
4568
  this.bootstrapPromise = bootstrapPromise;
4568
4569
  this.executeRecaptcha = function () {
4569
- return __awaiter(_this10, void 0, void 0, /*#__PURE__*/_regeneratorRuntime2().mark(function _callee9() {
4570
+ return __awaiter(_this11, void 0, void 0, /*#__PURE__*/_regeneratorRuntime2().mark(function _callee9() {
4570
4571
  var _yield$this$state4, captchaClient, configured, siteKey;
4571
4572
  return _regeneratorRuntime2().wrap(function _callee9$(_context9) {
4572
4573
  while (1) switch (_context9.prev = _context9.next) {
@@ -4600,7 +4601,7 @@ var CaptchaProvider = /*#__PURE__*/_createClass2(function CaptchaProvider(bootst
4600
4601
  }));
4601
4602
  };
4602
4603
  this.state = bootstrapPromise.then(function (bootstrapData) {
4603
- return __awaiter(_this10, void 0, void 0, /*#__PURE__*/_regeneratorRuntime2().mark(function _callee10() {
4604
+ return __awaiter(_this11, void 0, void 0, /*#__PURE__*/_regeneratorRuntime2().mark(function _callee10() {
4604
4605
  return _regeneratorRuntime2().wrap(function _callee10$(_context10) {
4605
4606
  while (1) switch (_context10.prev = _context10.next) {
4606
4607
  case 0:
@@ -4632,17 +4633,17 @@ var CaptchaProvider = /*#__PURE__*/_createClass2(function CaptchaProvider(bootst
4632
4633
  });
4633
4634
  var ClientsideServicesProvider = /*#__PURE__*/function () {
4634
4635
  function ClientsideServicesProvider(iframeURL) {
4635
- var _this11 = this;
4636
+ var _this12 = this;
4636
4637
  _classCallCheck2(this, ClientsideServicesProvider);
4637
4638
  this.iframeURL = iframeURL;
4638
4639
  this.oneTapStart = function (req) {
4639
- return _this11.call('oneTapStart', req);
4640
+ return _this12.call('oneTapStart', req);
4640
4641
  };
4641
4642
  this.oneTapSubmit = function (req) {
4642
- return _this11.call('oneTapSubmit', req);
4643
+ return _this12.call('oneTapSubmit', req);
4643
4644
  };
4644
4645
  this.parsedPhoneNumber = function (req) {
4645
- return _this11.call('parsedPhoneNumber', req);
4646
+ return _this12.call('parsedPhoneNumber', req);
4646
4647
  };
4647
4648
  }
4648
4649
  _createClass2(ClientsideServicesProvider, [{
@@ -4663,12 +4664,12 @@ var ClientsideServicesProvider = /*#__PURE__*/function () {
4663
4664
  var HeadlessOAuthClient = /*#__PURE__*/function (_HeadlessOAuthClient$) {
4664
4665
  _inherits2(HeadlessOAuthClient, _HeadlessOAuthClient$);
4665
4666
  function HeadlessOAuthClient(_networkClient, _subscriptionService, _pkceManager, _dynamicConfig, _config, _oneTap) {
4666
- var _this12;
4667
+ var _this13;
4667
4668
  _classCallCheck2(this, HeadlessOAuthClient);
4668
- _this12 = _callSuper2(this, HeadlessOAuthClient, [_networkClient, _subscriptionService, _pkceManager, _dynamicConfig, _config]);
4669
- _this12._oneTap = _oneTap;
4670
- _this12.startOneTap = function (options) {
4671
- return __awaiter(_assertThisInitialized2(_this12), void 0, void 0, /*#__PURE__*/_regeneratorRuntime2().mark(function _callee11() {
4669
+ _this13 = _callSuper2(this, HeadlessOAuthClient, [_networkClient, _subscriptionService, _pkceManager, _dynamicConfig, _config]);
4670
+ _this13._oneTap = _oneTap;
4671
+ _this13.startOneTap = function (options) {
4672
+ return __awaiter(_assertThisInitialized2(_this13), void 0, void 0, /*#__PURE__*/_regeneratorRuntime2().mark(function _callee11() {
4672
4673
  var clientResult, client, onSuccessCallback;
4673
4674
  return _regeneratorRuntime2().wrap(function _callee11$(_context11) {
4674
4675
  while (1) switch (_context11.prev = _context11.next) {
@@ -4703,10 +4704,10 @@ var HeadlessOAuthClient = /*#__PURE__*/function (_HeadlessOAuthClient$) {
4703
4704
  }, _callee11, this);
4704
4705
  }));
4705
4706
  };
4706
- _this12.googleOneTap = {
4707
- start: _this12.startOneTap
4707
+ _this13.googleOneTap = {
4708
+ start: _this13.startOneTap
4708
4709
  };
4709
- return _this12;
4710
+ return _this13;
4710
4711
  }
4711
4712
  return _createClass2(HeadlessOAuthClient);
4712
4713
  }(HeadlessOAuthClient$1);
@@ -4742,7 +4743,7 @@ var GoogleOneTapClient = /*#__PURE__*/function () {
4742
4743
  onOneTapCancelled = _ref4.onOneTapCancelled,
4743
4744
  style = _ref4.style;
4744
4745
  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime2().mark(function _callee12() {
4745
- var _this13 = this;
4746
+ var _this14 = this;
4746
4747
  var embeddedMode, shouldRenderEmbeddedOneTap, config;
4747
4748
  return _regeneratorRuntime2().wrap(function _callee12$(_context12) {
4748
4749
  while (1) switch (_context12.prev = _context12.next) {
@@ -4763,7 +4764,7 @@ var GoogleOneTapClient = /*#__PURE__*/function () {
4763
4764
  }
4764
4765
  this._googleClient.initialize(config);
4765
4766
  return _context12.abrupt("return", new Promise(function (resolve) {
4766
- _this13._googleClient.prompt(function (notification) {
4767
+ _this14._googleClient.prompt(function (notification) {
4767
4768
  var _a, _b, _c, _d, _e;
4768
4769
  if (notification.isSkippedMoment()) {
4769
4770
  var reason = (_b = (_a = notification.getSkippedReason) === null || _a === void 0 ? void 0 : _a.call(notification)) !== null && _b !== void 0 ? _b : 'unknown_reason';
@@ -4782,7 +4783,7 @@ var GoogleOneTapClient = /*#__PURE__*/function () {
4782
4783
  });
4783
4784
  }
4784
4785
  if (!notification.isDismissedMoment()) {
4785
- _this13.styleFrame(shouldRenderEmbeddedOneTap);
4786
+ _this14.styleFrame(shouldRenderEmbeddedOneTap);
4786
4787
  return resolve({
4787
4788
  success: true
4788
4789
  });
@@ -4818,7 +4819,7 @@ var loadGoogleOneTapClient = function loadGoogleOneTapClient() {
4818
4819
  };
4819
4820
  var OneTapProvider = /*#__PURE__*/function () {
4820
4821
  function OneTapProvider(_publicToken, clientsideServices) {
4821
- var _this14 = this;
4822
+ var _this15 = this;
4822
4823
  _classCallCheck2(this, OneTapProvider);
4823
4824
  this._publicToken = _publicToken;
4824
4825
  this.clientsideServices = clientsideServices;
@@ -4827,7 +4828,7 @@ var OneTapProvider = /*#__PURE__*/function () {
4827
4828
  signupRedirectUrl = _ref5.signupRedirectUrl,
4828
4829
  onSuccess = _ref5.onSuccess;
4829
4830
  return function (response) {
4830
- return __awaiter(_this14, void 0, void 0, /*#__PURE__*/_regeneratorRuntime2().mark(function _callee60() {
4831
+ return __awaiter(_this15, void 0, void 0, /*#__PURE__*/_regeneratorRuntime2().mark(function _callee60() {
4831
4832
  var credential, _yield$this$submitGoo, redirect_url;
4832
4833
  return _regeneratorRuntime2().wrap(function _callee60$(_context60) {
4833
4834
  while (1) switch (_context60.prev = _context60.next) {
@@ -5238,26 +5239,26 @@ var safeLocalStorageOperation = safeStorageOperation(typeof window !== 'undefine
5238
5239
  var safeSessionStorageOperation = safeStorageOperation(typeof window !== 'undefined' ? window.sessionStorage : undefined);
5239
5240
  var SubscriptionDataLayer = /*#__PURE__*/function () {
5240
5241
  function SubscriptionDataLayer(publicToken, options) {
5241
- var _this15 = this;
5242
+ var _this16 = this;
5242
5243
  _classCallCheck2(this, SubscriptionDataLayer);
5243
5244
  this.browserSessionStorage = {
5244
5245
  getItem: function getItem(key) {
5245
5246
  return safeSessionStorageOperation({
5246
5247
  operation: 'get',
5247
- key: getPersistentStorageKey(_this15.publicToken, key)
5248
+ key: getPersistentStorageKey(_this16.publicToken, key)
5248
5249
  });
5249
5250
  },
5250
5251
  setItem: function setItem(key, value) {
5251
5252
  safeSessionStorageOperation({
5252
5253
  operation: 'set',
5253
- key: getPersistentStorageKey(_this15.publicToken, key),
5254
+ key: getPersistentStorageKey(_this16.publicToken, key),
5254
5255
  value: value
5255
5256
  });
5256
5257
  },
5257
5258
  removeItem: function removeItem(key) {
5258
5259
  safeSessionStorageOperation({
5259
5260
  operation: 'remove',
5260
- key: getPersistentStorageKey(_this15.publicToken, key)
5261
+ key: getPersistentStorageKey(_this16.publicToken, key)
5261
5262
  });
5262
5263
  }
5263
5264
  };
@@ -5387,10 +5388,10 @@ var SubscriptionDataLayer = /*#__PURE__*/function () {
5387
5388
  }, {
5388
5389
  key: "removeCookies",
5389
5390
  value: function removeCookies(cookiesToRemove) {
5390
- var _this16 = this;
5391
+ var _this17 = this;
5391
5392
  [true, false].forEach(function (availableToSubdomains) {
5392
- [_this16._cookiePath, null].forEach(function (path) {
5393
- [_this16._domain, null].forEach(function (domain) {
5393
+ [_this17._cookiePath, null].forEach(function (path) {
5394
+ [_this17._domain, null].forEach(function (domain) {
5394
5395
  var cookieOpts = SubscriptionDataLayer.generateCookieOpts({
5395
5396
  expiresAt: new Date(0).toString(),
5396
5397
  availableToSubdomains: availableToSubdomains,
@@ -5505,17 +5506,17 @@ var deepEqualData = createDeepEqual({
5505
5506
  });
5506
5507
  var BaseSubscriptionService = /*#__PURE__*/function () {
5507
5508
  function BaseSubscriptionService(_publicToken, _datalayer) {
5508
- var _this17 = this;
5509
+ var _this18 = this;
5509
5510
  _classCallCheck2(this, BaseSubscriptionService);
5510
5511
  this._publicToken = _publicToken;
5511
5512
  this._datalayer = _datalayer;
5512
5513
  this.fromCache = true;
5513
5514
  this._listen = function (e) {
5514
- if (e.key !== getPersistentStorageKey(_this17._publicToken)) {
5515
+ if (e.key !== getPersistentStorageKey(_this18._publicToken)) {
5515
5516
  return;
5516
5517
  }
5517
5518
  var parsedValue = e.newValue === null || e.newValue === 'null' ? null : JSON.parse(e.newValue);
5518
- _this17.updateState(parsedValue, true);
5519
+ _this18.updateState(parsedValue, true);
5519
5520
  };
5520
5521
  window.addEventListener('storage', this._listen);
5521
5522
  var _this$_datalayer$read = this._datalayer.readSessionCookie(),
@@ -5658,23 +5659,23 @@ var BaseSubscriptionService = /*#__PURE__*/function () {
5658
5659
  var ConsumerSubscriptionService = /*#__PURE__*/function (_BaseSubscriptionServ) {
5659
5660
  _inherits2(ConsumerSubscriptionService, _BaseSubscriptionServ);
5660
5661
  function ConsumerSubscriptionService() {
5661
- var _this18;
5662
+ var _this19;
5662
5663
  _classCallCheck2(this, ConsumerSubscriptionService);
5663
- _this18 = _callSuper2(this, ConsumerSubscriptionService, arguments);
5664
- _this18.updateUser = function (user) {
5665
- return _this18.updateState({
5664
+ _this19 = _callSuper2(this, ConsumerSubscriptionService, arguments);
5665
+ _this19.updateUser = function (user) {
5666
+ return _this19.updateState({
5666
5667
  user: user
5667
5668
  });
5668
5669
  };
5669
- _this18.getUser = function () {
5670
+ _this19.getUser = function () {
5670
5671
  var _a, _b;
5671
- return (_b = (_a = _this18.getState()) === null || _a === void 0 ? void 0 : _a.user) !== null && _b !== void 0 ? _b : null;
5672
+ return (_b = (_a = _this19.getState()) === null || _a === void 0 ? void 0 : _a.user) !== null && _b !== void 0 ? _b : null;
5672
5673
  };
5673
- _this18.getSession = function () {
5674
+ _this19.getSession = function () {
5674
5675
  var _a, _b;
5675
- return (_b = (_a = _this18.getState()) === null || _a === void 0 ? void 0 : _a.session) !== null && _b !== void 0 ? _b : null;
5676
+ return (_b = (_a = _this19.getState()) === null || _a === void 0 ? void 0 : _a.session) !== null && _b !== void 0 ? _b : null;
5676
5677
  };
5677
- return _this18;
5678
+ return _this19;
5678
5679
  }
5679
5680
  return _createClass2(ConsumerSubscriptionService);
5680
5681
  }(BaseSubscriptionService);
@@ -5682,7 +5683,7 @@ var internalSymB2C = Symbol["for"]('stytch__internal_b2c');
5682
5683
  var writeB2CInternals = function writeB2CInternals(obj, internals) {
5683
5684
  Object.assign(obj, _defineProperty({}, internalSymB2C, internals));
5684
5685
  };
5685
- var version = "5.10.2";
5686
+ var version = "5.10.4";
5686
5687
  var NetworkClient = /*#__PURE__*/function () {
5687
5688
  function NetworkClient(_publicToken, _subscriptionDataLayer, _liveAPIURL, _testAPIURL, additionalTelemetryDataFn) {
5688
5689
  _classCallCheck2(this, NetworkClient);
@@ -5808,7 +5809,7 @@ var NetworkClient = /*#__PURE__*/function () {
5808
5809
  return NetworkClient;
5809
5810
  }();
5810
5811
  var StytchHeadlessClient = /*#__PURE__*/_createClass2(function StytchHeadlessClient(_PUBLIC_TOKEN, options) {
5811
- var _this19 = this;
5812
+ var _this20 = this;
5812
5813
  _classCallCheck2(this, StytchHeadlessClient);
5813
5814
  checkNotSSR('StytchHeadlessClient');
5814
5815
  checkPublicToken(_PUBLIC_TOKEN);
@@ -5818,14 +5819,14 @@ var StytchHeadlessClient = /*#__PURE__*/_createClass2(function StytchHeadlessCli
5818
5819
  this._subscriptionService = new ConsumerSubscriptionService(_PUBLIC_TOKEN, this._dataLayer);
5819
5820
  this._stateChangeClient = new StateChangeClient(this._subscriptionService, {});
5820
5821
  this.onStateChange = function () {
5821
- var _this19$_stateChangeC;
5822
- return (_this19$_stateChangeC = _this19._stateChangeClient).onStateChange.apply(_this19$_stateChangeC, arguments);
5822
+ var _this20$_stateChangeC;
5823
+ return (_this20$_stateChangeC = _this20._stateChangeClient).onStateChange.apply(_this20$_stateChangeC, arguments);
5823
5824
  };
5824
5825
  var additionalTelemetryDataFn = function additionalTelemetryDataFn() {
5825
5826
  var _a, _b, _c, _d;
5826
5827
  return {
5827
- stytch_user_id: (_b = (_a = _this19._dataLayer.state) === null || _a === void 0 ? void 0 : _a.user) === null || _b === void 0 ? void 0 : _b.user_id,
5828
- stytch_session_id: (_d = (_c = _this19._dataLayer.state) === null || _c === void 0 ? void 0 : _c.session) === null || _d === void 0 ? void 0 : _d.session_id
5828
+ stytch_user_id: (_b = (_a = _this20._dataLayer.state) === null || _a === void 0 ? void 0 : _a.user) === null || _b === void 0 ? void 0 : _b.user_id,
5829
+ stytch_session_id: (_d = (_c = _this20._dataLayer.state) === null || _c === void 0 ? void 0 : _c.session) === null || _d === void 0 ? void 0 : _d.session_id
5829
5830
  };
5830
5831
  };
5831
5832
  var passwordsPKCEManager = new PKCEManager(this._dataLayer, 'passwords');