@stytch/vanilla-js 5.10.2 → 5.10.3

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