@stytch/vanilla-js 5.6.1 → 5.7.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.
@@ -219,6 +219,7 @@ var StytchEventType;
219
219
  StytchEventType["B2BDiscoveryOrganizationsCreate"] = "B2B_DISCOVERY_ORGANIZATIONS_CREATE";
220
220
  StytchEventType["B2BDiscoveryIntermediateSessionExchange"] = "B2B_DISCOVERY_INTERMEDIATE_SESSION_EXCHANGE";
221
221
  StytchEventType["B2BPasswordAuthenticate"] = "B2B_PASSWORD_AUTHENTICATE";
222
+ StytchEventType["B2BPasswordDiscoveryAuthenticate"] = "B2B_PASSWORD_DISCOVERY_AUTHENTICATE";
222
223
  StytchEventType["B2BPasswordResetByEmailStart"] = "B2B_PASSWORD_RESET_BY_EMAIL_START";
223
224
  StytchEventType["B2BPasswordResetByEmail"] = "B2B_PASSWORD_RESET_BY_EMAIL";
224
225
  StytchEventType["B2BPasswordResetBySession"] = "B2B_PASSWORD_RESET_BY_SESSION";
@@ -227,6 +228,8 @@ var StytchEventType;
227
228
  StytchEventType["B2BTOTPCreate"] = "B2B_TOTP_CREATE";
228
229
  StytchEventType["B2BTOTPAuthenticate"] = "B2B_TOTP_AUTHENTICATE";
229
230
  StytchEventType["B2BRecoveryCodesRecover"] = "B2B_RECOVERY_CODES_RECOVER";
231
+ StytchEventType["B2BPasswordDiscoveryResetStart"] = "B2B_PASSWORD_DISCOVERY_RESET_BY_EMAIL_START";
232
+ StytchEventType["B2BDiscoveryPasswordReset"] = "B2B_PASSWORD_DISCOVERY_RESET_BY_EMAIL";
230
233
  })(StytchEventType || (StytchEventType = {}));
231
234
  var RNUIProducts;
232
235
  (function (RNUIProducts) {
@@ -4236,18 +4239,18 @@ var IframeHostClient = /*#__PURE__*/function () {
4236
4239
  }, {
4237
4240
  key: "call",
4238
4241
  value: function call(method, args) {
4239
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee137() {
4240
- var _this22 = this;
4242
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee140() {
4243
+ var _this23 = this;
4241
4244
  var frame, channel;
4242
- return _regeneratorRuntime().wrap(function _callee137$(_context137) {
4243
- while (1) switch (_context137.prev = _context137.next) {
4245
+ return _regeneratorRuntime().wrap(function _callee140$(_context140) {
4246
+ while (1) switch (_context140.prev = _context140.next) {
4244
4247
  case 0:
4245
- _context137.next = 2;
4248
+ _context140.next = 2;
4246
4249
  return this.frame;
4247
4250
  case 2:
4248
- frame = _context137.sent;
4251
+ frame = _context140.sent;
4249
4252
  channel = new MessageChannel();
4250
- return _context137.abrupt("return", new Promise(function (resolve, reject) {
4253
+ return _context140.abrupt("return", new Promise(function (resolve, reject) {
4251
4254
  var _a;
4252
4255
  channel.port1.onmessage = function (event) {
4253
4256
  var resp = event.data;
@@ -4262,13 +4265,13 @@ var IframeHostClient = /*#__PURE__*/function () {
4262
4265
  method: method,
4263
4266
  args: args
4264
4267
  };
4265
- (_a = frame.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(message, _this22.iframeURL, [channel.port2]);
4268
+ (_a = frame.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(message, _this23.iframeURL, [channel.port2]);
4266
4269
  }));
4267
4270
  case 5:
4268
4271
  case "end":
4269
- return _context137.stop();
4272
+ return _context140.stop();
4270
4273
  }
4271
- }, _callee137, this);
4274
+ }, _callee140, this);
4272
4275
  }));
4273
4276
  }
4274
4277
  }]);
@@ -4283,11 +4286,11 @@ var SearchDataManager = /*#__PURE__*/function () {
4283
4286
  _createClass(SearchDataManager, [{
4284
4287
  key: "searchUser",
4285
4288
  value: function searchUser(email) {
4286
- var _this24 = this;
4289
+ var _this25 = this;
4287
4290
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha().then(function (_ref7) {
4288
4291
  var dfp_telemetry_id = _ref7.dfp_telemetry_id,
4289
4292
  captcha_token = _ref7.captcha_token;
4290
- return _this24._networkClient.fetchSDK({
4293
+ return _this25._networkClient.fetchSDK({
4291
4294
  url: "/users/search",
4292
4295
  method: 'POST',
4293
4296
  body: {
@@ -4318,52 +4321,52 @@ var shouldTryRefresh = function shouldTryRefresh(state) {
4318
4321
  };
4319
4322
  var SessionManager = /*#__PURE__*/function () {
4320
4323
  function SessionManager(_subscriptionService, _headlessSessionClient) {
4321
- var _this25 = this;
4324
+ var _this26 = this;
4322
4325
  _classCallCheck(this, SessionManager);
4323
4326
  this._subscriptionService = _subscriptionService;
4324
4327
  this._headlessSessionClient = _headlessSessionClient;
4325
4328
  this._onDataChange = function (state) {
4326
4329
  if (shouldTryRefresh(state)) {
4327
- _this25.scheduleBackgroundRefresh();
4330
+ _this26.scheduleBackgroundRefresh();
4328
4331
  } else {
4329
- _this25.cancelBackgroundRefresh();
4332
+ _this26.cancelBackgroundRefresh();
4330
4333
  }
4331
4334
  };
4332
4335
  this._reauthenticateWithBackoff = function () {
4333
- return __awaiter$1(_this25, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee139() {
4336
+ return __awaiter$1(_this26, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee142() {
4334
4337
  var count;
4335
- return _regeneratorRuntime().wrap(function _callee139$(_context139) {
4336
- while (1) switch (_context139.prev = _context139.next) {
4338
+ return _regeneratorRuntime().wrap(function _callee142$(_context142) {
4339
+ while (1) switch (_context142.prev = _context142.next) {
4337
4340
  case 0:
4338
4341
  count = 0;
4339
4342
  case 1:
4340
- _context139.prev = 2;
4341
- _context139.next = 5;
4343
+ _context142.prev = 2;
4344
+ _context142.next = 5;
4342
4345
  return this._headlessSessionClient.authenticate();
4343
4346
  case 5:
4344
- return _context139.abrupt("return", _context139.sent);
4347
+ return _context142.abrupt("return", _context142.sent);
4345
4348
  case 8:
4346
- _context139.prev = 8;
4347
- _context139.t0 = _context139["catch"](2);
4348
- if (!SessionManager.isUnrecoverableError(_context139.t0)) {
4349
- _context139.next = 12;
4349
+ _context142.prev = 8;
4350
+ _context142.t0 = _context142["catch"](2);
4351
+ if (!SessionManager.isUnrecoverableError(_context142.t0)) {
4352
+ _context142.next = 12;
4350
4353
  break;
4351
4354
  }
4352
- return _context139.abrupt("return", Promise.reject(_context139.t0));
4355
+ return _context142.abrupt("return", Promise.reject(_context142.t0));
4353
4356
  case 12:
4354
4357
  count++;
4355
- _context139.next = 15;
4358
+ _context142.next = 15;
4356
4359
  return new Promise(function (done) {
4357
4360
  return setTimeout(done, SessionManager.timeoutForAttempt(count));
4358
4361
  });
4359
4362
  case 15:
4360
- _context139.next = 1;
4363
+ _context142.next = 1;
4361
4364
  break;
4362
4365
  case 17:
4363
4366
  case "end":
4364
- return _context139.stop();
4367
+ return _context142.stop();
4365
4368
  }
4366
- }, _callee139, this, [[2, 8]]);
4369
+ }, _callee142, this, [[2, 8]]);
4367
4370
  }));
4368
4371
  };
4369
4372
  this.timeout = null;
@@ -4372,23 +4375,23 @@ var SessionManager = /*#__PURE__*/function () {
4372
4375
  _createClass(SessionManager, [{
4373
4376
  key: "performBackgroundRefresh",
4374
4377
  value: function performBackgroundRefresh() {
4375
- var _this26 = this;
4378
+ var _this27 = this;
4376
4379
  this._reauthenticateWithBackoff().then(function () {
4377
- _this26.scheduleBackgroundRefresh();
4380
+ _this27.scheduleBackgroundRefresh();
4378
4381
  })["catch"](function (error) {
4379
4382
  logger.warn('Session background refresh failed. Signalling to app that user is logged out.', {
4380
4383
  error: error
4381
4384
  });
4382
- _this26._subscriptionService.destroySession();
4385
+ _this27._subscriptionService.destroySession();
4383
4386
  });
4384
4387
  }
4385
4388
  }, {
4386
4389
  key: "scheduleBackgroundRefresh",
4387
4390
  value: function scheduleBackgroundRefresh() {
4388
- var _this27 = this;
4391
+ var _this28 = this;
4389
4392
  this.cancelBackgroundRefresh();
4390
4393
  this.timeout = setTimeout(function () {
4391
- _this27.performBackgroundRefresh();
4394
+ _this28.performBackgroundRefresh();
4392
4395
  }, SessionManager.REFRESH_INTERVAL_MS);
4393
4396
  }
4394
4397
  }, {
@@ -4417,13 +4420,13 @@ var SessionManager = /*#__PURE__*/function () {
4417
4420
  }();
4418
4421
  SessionManager.REFRESH_INTERVAL_MS = 1000 * 60 * 3;
4419
4422
  var StateChangeClient = /*#__PURE__*/_createClass(function StateChangeClient(_subscriptionService, emptyState) {
4420
- var _this28 = this;
4423
+ var _this29 = this;
4421
4424
  _classCallCheck(this, StateChangeClient);
4422
4425
  this._subscriptionService = _subscriptionService;
4423
4426
  this.emptyState = emptyState;
4424
4427
  this.onStateChange = function (callback) {
4425
- return _this28._subscriptionService.subscribeToState(function (state) {
4426
- callback(state !== null && state !== void 0 ? state : _this28.emptyState);
4428
+ return _this29._subscriptionService.subscribeToState(function (state) {
4429
+ callback(state !== null && state !== void 0 ? state : _this29.emptyState);
4427
4430
  });
4428
4431
  };
4429
4432
  });
@@ -5195,21 +5198,6 @@ function init(converter, defaultAttributes) {
5195
5198
  var api = init(defaultConverter, {
5196
5199
  path: '/'
5197
5200
  });
5198
- var cookieVerificationTimeouts = new Map();
5199
- var cancelCookieRestoration = function cancelCookieRestoration(name) {
5200
- clearTimeout(cookieVerificationTimeouts.get(name));
5201
- };
5202
- var setCookiePersistently = function setCookiePersistently(name, value, options) {
5203
- var COOKIE_VERIFY_DELAY_MS = 10;
5204
- cancelCookieRestoration(name);
5205
- var timeoutId = setTimeout(function () {
5206
- if (api.get(name) === undefined) {
5207
- api.set(name, value, options);
5208
- }
5209
- }, COOKIE_VERIFY_DELAY_MS);
5210
- cookieVerificationTimeouts.set(name, timeoutId);
5211
- return api.set(name, value, options);
5212
- };
5213
5201
  var STYTCH_SESSION_COOKIE = 'stytch_session';
5214
5202
  var STYTCH_SESSION_JWT_COOKIE = 'stytch_session_jwt';
5215
5203
  var STYTCH_INTERMEDIATE_SESSION_TOKEN_COOKIE = 'stytch_intermediate_session_token';
@@ -5344,8 +5332,8 @@ var SubscriptionDataLayer = /*#__PURE__*/function () {
5344
5332
  path: this._cookiePath,
5345
5333
  domain: this._domain
5346
5334
  });
5347
- setCookiePersistently(this.opaqueTokenCookieName, session_token, cookieOpts);
5348
- setCookiePersistently(this.jwtCookieName, session_jwt, cookieOpts);
5335
+ api.set(this.opaqueTokenCookieName, session_token, cookieOpts);
5336
+ api.set(this.jwtCookieName, session_jwt, cookieOpts);
5349
5337
  var alternateCookieOptions = SubscriptionDataLayer.generateCookieOpts({
5350
5338
  expiresAt: (_d = (_c = state === null || state === void 0 ? void 0 : state.session) === null || _c === void 0 ? void 0 : _c.expires_at) !== null && _d !== void 0 ? _d : '',
5351
5339
  availableToSubdomains: !this._cookieAvailableToSubdomains,
@@ -5375,7 +5363,7 @@ var SubscriptionDataLayer = /*#__PURE__*/function () {
5375
5363
  path: this._cookiePath,
5376
5364
  domain: this._domain
5377
5365
  });
5378
- setCookiePersistently(this.istCookieName, IST, cookieOpts);
5366
+ api.set(this.istCookieName, IST, cookieOpts);
5379
5367
  }
5380
5368
  }, {
5381
5369
  key: "removeSessionCookie",
@@ -5406,7 +5394,6 @@ var SubscriptionDataLayer = /*#__PURE__*/function () {
5406
5394
  });
5407
5395
  });
5408
5396
  });
5409
- cookiesToRemove.forEach(cancelCookieRestoration);
5410
5397
  }
5411
5398
  }, {
5412
5399
  key: "syncToLocalStorage",
@@ -5686,7 +5673,7 @@ var internalSymB2C = Symbol["for"]('stytch__internal_b2c');
5686
5673
  var writeB2CInternals = function writeB2CInternals(obj, internals) {
5687
5674
  Object.assign(obj, _defineProperty({}, internalSymB2C, internals));
5688
5675
  };
5689
- var version = "5.6.1";
5676
+ var version = "5.7.0";
5690
5677
  var NetworkClient = /*#__PURE__*/function () {
5691
5678
  function NetworkClient(_publicToken, _subscriptionDataLayer, _liveAPIURL, _testAPIURL, additionalTelemetryDataFn) {
5692
5679
  _classCallCheck2(this, NetworkClient);
@@ -221,6 +221,7 @@ exports.StytchEventType = void 0;
221
221
  StytchEventType["B2BDiscoveryOrganizationsCreate"] = "B2B_DISCOVERY_ORGANIZATIONS_CREATE";
222
222
  StytchEventType["B2BDiscoveryIntermediateSessionExchange"] = "B2B_DISCOVERY_INTERMEDIATE_SESSION_EXCHANGE";
223
223
  StytchEventType["B2BPasswordAuthenticate"] = "B2B_PASSWORD_AUTHENTICATE";
224
+ StytchEventType["B2BPasswordDiscoveryAuthenticate"] = "B2B_PASSWORD_DISCOVERY_AUTHENTICATE";
224
225
  StytchEventType["B2BPasswordResetByEmailStart"] = "B2B_PASSWORD_RESET_BY_EMAIL_START";
225
226
  StytchEventType["B2BPasswordResetByEmail"] = "B2B_PASSWORD_RESET_BY_EMAIL";
226
227
  StytchEventType["B2BPasswordResetBySession"] = "B2B_PASSWORD_RESET_BY_SESSION";
@@ -229,6 +230,8 @@ exports.StytchEventType = void 0;
229
230
  StytchEventType["B2BTOTPCreate"] = "B2B_TOTP_CREATE";
230
231
  StytchEventType["B2BTOTPAuthenticate"] = "B2B_TOTP_AUTHENTICATE";
231
232
  StytchEventType["B2BRecoveryCodesRecover"] = "B2B_RECOVERY_CODES_RECOVER";
233
+ StytchEventType["B2BPasswordDiscoveryResetStart"] = "B2B_PASSWORD_DISCOVERY_RESET_BY_EMAIL_START";
234
+ StytchEventType["B2BDiscoveryPasswordReset"] = "B2B_PASSWORD_DISCOVERY_RESET_BY_EMAIL";
232
235
  })(exports.StytchEventType || (exports.StytchEventType = {}));
233
236
  exports.RNUIProducts = void 0;
234
237
  (function (RNUIProducts) {
@@ -4238,18 +4241,18 @@ var IframeHostClient = /*#__PURE__*/function () {
4238
4241
  }, {
4239
4242
  key: "call",
4240
4243
  value: function call(method, args) {
4241
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee137() {
4242
- var _this22 = this;
4244
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee140() {
4245
+ var _this23 = this;
4243
4246
  var frame, channel;
4244
- return _regeneratorRuntime().wrap(function _callee137$(_context137) {
4245
- while (1) switch (_context137.prev = _context137.next) {
4247
+ return _regeneratorRuntime().wrap(function _callee140$(_context140) {
4248
+ while (1) switch (_context140.prev = _context140.next) {
4246
4249
  case 0:
4247
- _context137.next = 2;
4250
+ _context140.next = 2;
4248
4251
  return this.frame;
4249
4252
  case 2:
4250
- frame = _context137.sent;
4253
+ frame = _context140.sent;
4251
4254
  channel = new MessageChannel();
4252
- return _context137.abrupt("return", new Promise(function (resolve, reject) {
4255
+ return _context140.abrupt("return", new Promise(function (resolve, reject) {
4253
4256
  var _a;
4254
4257
  channel.port1.onmessage = function (event) {
4255
4258
  var resp = event.data;
@@ -4264,13 +4267,13 @@ var IframeHostClient = /*#__PURE__*/function () {
4264
4267
  method: method,
4265
4268
  args: args
4266
4269
  };
4267
- (_a = frame.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(message, _this22.iframeURL, [channel.port2]);
4270
+ (_a = frame.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(message, _this23.iframeURL, [channel.port2]);
4268
4271
  }));
4269
4272
  case 5:
4270
4273
  case "end":
4271
- return _context137.stop();
4274
+ return _context140.stop();
4272
4275
  }
4273
- }, _callee137, this);
4276
+ }, _callee140, this);
4274
4277
  }));
4275
4278
  }
4276
4279
  }]);
@@ -4285,11 +4288,11 @@ var SearchDataManager = /*#__PURE__*/function () {
4285
4288
  _createClass(SearchDataManager, [{
4286
4289
  key: "searchUser",
4287
4290
  value: function searchUser(email) {
4288
- var _this24 = this;
4291
+ var _this25 = this;
4289
4292
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha().then(function (_ref7) {
4290
4293
  var dfp_telemetry_id = _ref7.dfp_telemetry_id,
4291
4294
  captcha_token = _ref7.captcha_token;
4292
- return _this24._networkClient.fetchSDK({
4295
+ return _this25._networkClient.fetchSDK({
4293
4296
  url: "/users/search",
4294
4297
  method: 'POST',
4295
4298
  body: {
@@ -4320,52 +4323,52 @@ var shouldTryRefresh = function shouldTryRefresh(state) {
4320
4323
  };
4321
4324
  var SessionManager = /*#__PURE__*/function () {
4322
4325
  function SessionManager(_subscriptionService, _headlessSessionClient) {
4323
- var _this25 = this;
4326
+ var _this26 = this;
4324
4327
  _classCallCheck(this, SessionManager);
4325
4328
  this._subscriptionService = _subscriptionService;
4326
4329
  this._headlessSessionClient = _headlessSessionClient;
4327
4330
  this._onDataChange = function (state) {
4328
4331
  if (shouldTryRefresh(state)) {
4329
- _this25.scheduleBackgroundRefresh();
4332
+ _this26.scheduleBackgroundRefresh();
4330
4333
  } else {
4331
- _this25.cancelBackgroundRefresh();
4334
+ _this26.cancelBackgroundRefresh();
4332
4335
  }
4333
4336
  };
4334
4337
  this._reauthenticateWithBackoff = function () {
4335
- return __awaiter$1(_this25, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee139() {
4338
+ return __awaiter$1(_this26, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee142() {
4336
4339
  var count;
4337
- return _regeneratorRuntime().wrap(function _callee139$(_context139) {
4338
- while (1) switch (_context139.prev = _context139.next) {
4340
+ return _regeneratorRuntime().wrap(function _callee142$(_context142) {
4341
+ while (1) switch (_context142.prev = _context142.next) {
4339
4342
  case 0:
4340
4343
  count = 0;
4341
4344
  case 1:
4342
- _context139.prev = 2;
4343
- _context139.next = 5;
4345
+ _context142.prev = 2;
4346
+ _context142.next = 5;
4344
4347
  return this._headlessSessionClient.authenticate();
4345
4348
  case 5:
4346
- return _context139.abrupt("return", _context139.sent);
4349
+ return _context142.abrupt("return", _context142.sent);
4347
4350
  case 8:
4348
- _context139.prev = 8;
4349
- _context139.t0 = _context139["catch"](2);
4350
- if (!SessionManager.isUnrecoverableError(_context139.t0)) {
4351
- _context139.next = 12;
4351
+ _context142.prev = 8;
4352
+ _context142.t0 = _context142["catch"](2);
4353
+ if (!SessionManager.isUnrecoverableError(_context142.t0)) {
4354
+ _context142.next = 12;
4352
4355
  break;
4353
4356
  }
4354
- return _context139.abrupt("return", Promise.reject(_context139.t0));
4357
+ return _context142.abrupt("return", Promise.reject(_context142.t0));
4355
4358
  case 12:
4356
4359
  count++;
4357
- _context139.next = 15;
4360
+ _context142.next = 15;
4358
4361
  return new Promise(function (done) {
4359
4362
  return setTimeout(done, SessionManager.timeoutForAttempt(count));
4360
4363
  });
4361
4364
  case 15:
4362
- _context139.next = 1;
4365
+ _context142.next = 1;
4363
4366
  break;
4364
4367
  case 17:
4365
4368
  case "end":
4366
- return _context139.stop();
4369
+ return _context142.stop();
4367
4370
  }
4368
- }, _callee139, this, [[2, 8]]);
4371
+ }, _callee142, this, [[2, 8]]);
4369
4372
  }));
4370
4373
  };
4371
4374
  this.timeout = null;
@@ -4374,23 +4377,23 @@ var SessionManager = /*#__PURE__*/function () {
4374
4377
  _createClass(SessionManager, [{
4375
4378
  key: "performBackgroundRefresh",
4376
4379
  value: function performBackgroundRefresh() {
4377
- var _this26 = this;
4380
+ var _this27 = this;
4378
4381
  this._reauthenticateWithBackoff().then(function () {
4379
- _this26.scheduleBackgroundRefresh();
4382
+ _this27.scheduleBackgroundRefresh();
4380
4383
  })["catch"](function (error) {
4381
4384
  logger.warn('Session background refresh failed. Signalling to app that user is logged out.', {
4382
4385
  error: error
4383
4386
  });
4384
- _this26._subscriptionService.destroySession();
4387
+ _this27._subscriptionService.destroySession();
4385
4388
  });
4386
4389
  }
4387
4390
  }, {
4388
4391
  key: "scheduleBackgroundRefresh",
4389
4392
  value: function scheduleBackgroundRefresh() {
4390
- var _this27 = this;
4393
+ var _this28 = this;
4391
4394
  this.cancelBackgroundRefresh();
4392
4395
  this.timeout = setTimeout(function () {
4393
- _this27.performBackgroundRefresh();
4396
+ _this28.performBackgroundRefresh();
4394
4397
  }, SessionManager.REFRESH_INTERVAL_MS);
4395
4398
  }
4396
4399
  }, {
@@ -4419,13 +4422,13 @@ var SessionManager = /*#__PURE__*/function () {
4419
4422
  }();
4420
4423
  SessionManager.REFRESH_INTERVAL_MS = 1000 * 60 * 3;
4421
4424
  var StateChangeClient = /*#__PURE__*/_createClass(function StateChangeClient(_subscriptionService, emptyState) {
4422
- var _this28 = this;
4425
+ var _this29 = this;
4423
4426
  _classCallCheck(this, StateChangeClient);
4424
4427
  this._subscriptionService = _subscriptionService;
4425
4428
  this.emptyState = emptyState;
4426
4429
  this.onStateChange = function (callback) {
4427
- return _this28._subscriptionService.subscribeToState(function (state) {
4428
- callback(state !== null && state !== void 0 ? state : _this28.emptyState);
4430
+ return _this29._subscriptionService.subscribeToState(function (state) {
4431
+ callback(state !== null && state !== void 0 ? state : _this29.emptyState);
4429
4432
  });
4430
4433
  };
4431
4434
  });
@@ -5197,21 +5200,6 @@ function init(converter, defaultAttributes) {
5197
5200
  var api = init(defaultConverter, {
5198
5201
  path: '/'
5199
5202
  });
5200
- var cookieVerificationTimeouts = new Map();
5201
- var cancelCookieRestoration = function cancelCookieRestoration(name) {
5202
- clearTimeout(cookieVerificationTimeouts.get(name));
5203
- };
5204
- var setCookiePersistently = function setCookiePersistently(name, value, options) {
5205
- var COOKIE_VERIFY_DELAY_MS = 10;
5206
- cancelCookieRestoration(name);
5207
- var timeoutId = setTimeout(function () {
5208
- if (api.get(name) === undefined) {
5209
- api.set(name, value, options);
5210
- }
5211
- }, COOKIE_VERIFY_DELAY_MS);
5212
- cookieVerificationTimeouts.set(name, timeoutId);
5213
- return api.set(name, value, options);
5214
- };
5215
5203
  var STYTCH_SESSION_COOKIE = 'stytch_session';
5216
5204
  var STYTCH_SESSION_JWT_COOKIE = 'stytch_session_jwt';
5217
5205
  var STYTCH_INTERMEDIATE_SESSION_TOKEN_COOKIE = 'stytch_intermediate_session_token';
@@ -5346,8 +5334,8 @@ var SubscriptionDataLayer = /*#__PURE__*/function () {
5346
5334
  path: this._cookiePath,
5347
5335
  domain: this._domain
5348
5336
  });
5349
- setCookiePersistently(this.opaqueTokenCookieName, session_token, cookieOpts);
5350
- setCookiePersistently(this.jwtCookieName, session_jwt, cookieOpts);
5337
+ api.set(this.opaqueTokenCookieName, session_token, cookieOpts);
5338
+ api.set(this.jwtCookieName, session_jwt, cookieOpts);
5351
5339
  var alternateCookieOptions = SubscriptionDataLayer.generateCookieOpts({
5352
5340
  expiresAt: (_d = (_c = state === null || state === void 0 ? void 0 : state.session) === null || _c === void 0 ? void 0 : _c.expires_at) !== null && _d !== void 0 ? _d : '',
5353
5341
  availableToSubdomains: !this._cookieAvailableToSubdomains,
@@ -5377,7 +5365,7 @@ var SubscriptionDataLayer = /*#__PURE__*/function () {
5377
5365
  path: this._cookiePath,
5378
5366
  domain: this._domain
5379
5367
  });
5380
- setCookiePersistently(this.istCookieName, IST, cookieOpts);
5368
+ api.set(this.istCookieName, IST, cookieOpts);
5381
5369
  }
5382
5370
  }, {
5383
5371
  key: "removeSessionCookie",
@@ -5408,7 +5396,6 @@ var SubscriptionDataLayer = /*#__PURE__*/function () {
5408
5396
  });
5409
5397
  });
5410
5398
  });
5411
- cookiesToRemove.forEach(cancelCookieRestoration);
5412
5399
  }
5413
5400
  }, {
5414
5401
  key: "syncToLocalStorage",
@@ -5688,7 +5675,7 @@ var internalSymB2C = Symbol["for"]('stytch__internal_b2c');
5688
5675
  var writeB2CInternals = function writeB2CInternals(obj, internals) {
5689
5676
  Object.assign(obj, _defineProperty({}, internalSymB2C, internals));
5690
5677
  };
5691
- var version = "5.6.1";
5678
+ var version = "5.7.0";
5692
5679
  var NetworkClient = /*#__PURE__*/function () {
5693
5680
  function NetworkClient(_publicToken, _subscriptionDataLayer, _liveAPIURL, _testAPIURL, additionalTelemetryDataFn) {
5694
5681
  _classCallCheck2(this, NetworkClient);