@stytch/vanilla-js 4.4.0 → 4.4.1

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.
@@ -3852,11 +3852,37 @@ var _t = /*#__PURE__*/function () {
3852
3852
  }]);
3853
3853
  return _t;
3854
3854
  }();
3855
- var ft = /*#__PURE__*/_createClass(function ft(e) {
3855
+ function ft(e, t, r, n) {
3856
+ return new (r || (r = Promise))(function (i, o) {
3857
+ function s(e) {
3858
+ try {
3859
+ c(n.next(e));
3860
+ } catch (e) {
3861
+ o(e);
3862
+ }
3863
+ }
3864
+ function a(e) {
3865
+ try {
3866
+ c(n["throw"](e));
3867
+ } catch (e) {
3868
+ o(e);
3869
+ }
3870
+ }
3871
+ function c(e) {
3872
+ var t;
3873
+ e.done ? i(e.value) : (t = e.value, t instanceof r ? t : new r(function (e) {
3874
+ e(t);
3875
+ })).then(s, a);
3876
+ }
3877
+ c((n = n.apply(e, t || [])).next());
3878
+ });
3879
+ }
3880
+ "function" == typeof SuppressedError && SuppressedError;
3881
+ var mt = /*#__PURE__*/_createClass(function mt(e) {
3856
3882
  var _this3 = this;
3857
- _classCallCheck(this, ft);
3883
+ _classCallCheck(this, mt);
3858
3884
  this.bootstrapPromise = e, this.executeRecaptcha = function () {
3859
- return at(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
3885
+ return ft(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
3860
3886
  var _yield$this$state, e, t, r;
3861
3887
  return _regeneratorRuntime().wrap(function _callee12$(_context12) {
3862
3888
  while (1) switch (_context12.prev = _context12.next) {
@@ -3887,7 +3913,7 @@ var ft = /*#__PURE__*/_createClass(function ft(e) {
3887
3913
  }, _callee12, this);
3888
3914
  }));
3889
3915
  }, this.state = e.then(function (e) {
3890
- return at(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
3916
+ return ft(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
3891
3917
  var t;
3892
3918
  return _regeneratorRuntime().wrap(function _callee13$(_context13) {
3893
3919
  while (1) switch (_context13.prev = _context13.next) {
@@ -3925,9 +3951,9 @@ var ft = /*#__PURE__*/_createClass(function ft(e) {
3925
3951
  }));
3926
3952
  });
3927
3953
  });
3928
- var mt = /*#__PURE__*/function () {
3929
- function mt(e, t, r, n) {
3930
- _classCallCheck(this, mt);
3954
+ var vt = /*#__PURE__*/function () {
3955
+ function vt(e, t, r, n) {
3956
+ _classCallCheck(this, vt);
3931
3957
  this._publicToken = e, this._subscriptionDataLayer = t, this.baseURL = r, this.additionalTelemetryDataFn = n, this.updateSessionToken = function () {
3932
3958
  return null;
3933
3959
  }, this.eventLogger = new Me({
@@ -3936,7 +3962,7 @@ var mt = /*#__PURE__*/function () {
3936
3962
  logEventURL: this.buildSDKUrl("/events")
3937
3963
  });
3938
3964
  }
3939
- _createClass(mt, [{
3965
+ _createClass(vt, [{
3940
3966
  key: "logEvent",
3941
3967
  value: function logEvent(_ref) {
3942
3968
  var e = _ref.name,
@@ -3967,7 +3993,7 @@ var mt = /*#__PURE__*/function () {
3967
3993
  },
3968
3994
  sdk: {
3969
3995
  identifier: "Stytch.js Javascript SDK",
3970
- version: "4.4.0"
3996
+ version: "4.4.1"
3971
3997
  }
3972
3998
  });
3973
3999
  }
@@ -3978,7 +4004,7 @@ var mt = /*#__PURE__*/function () {
3978
4004
  t = _ref2.body,
3979
4005
  r = _ref2.errorMessage,
3980
4006
  n = _ref2.method;
3981
- return at(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
4007
+ return ft(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
3982
4008
  var i, o, s, a;
3983
4009
  return _regeneratorRuntime().wrap(function _callee14$(_context14) {
3984
4010
  while (1) switch (_context14.prev = _context14.next) {
@@ -4008,7 +4034,7 @@ var mt = /*#__PURE__*/function () {
4008
4034
  r = _ref3.errorMessage,
4009
4035
  n = _ref3.method,
4010
4036
  i = _ref3.retryCallback;
4011
- return at(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
4037
+ return ft(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
4012
4038
  var o, s, a, c;
4013
4039
  return _regeneratorRuntime().wrap(function _callee15$(_context15) {
4014
4040
  while (1) switch (_context15.prev = _context15.next) {
@@ -4079,18 +4105,18 @@ var mt = /*#__PURE__*/function () {
4079
4105
  return "".concat(this.baseURL, "/sdk/v1").concat(e);
4080
4106
  }
4081
4107
  }]);
4082
- return mt;
4108
+ return vt;
4083
4109
  }();
4084
- function vt(e) {
4110
+ function bt(e) {
4085
4111
  var t = e.toString(16);
4086
4112
  return 1 === t.length && (t = "0" + t), t;
4087
4113
  }
4088
- var bt = /*#__PURE__*/function () {
4089
- function bt(e, t) {
4090
- _classCallCheck(this, bt);
4114
+ var gt = /*#__PURE__*/function () {
4115
+ function gt(e, t) {
4116
+ _classCallCheck(this, gt);
4091
4117
  this._dataLayer = e, this.namespace = t;
4092
4118
  }
4093
- _createClass(bt, [{
4119
+ _createClass(gt, [{
4094
4120
  key: "key",
4095
4121
  value: function key() {
4096
4122
  return "PKCE_VERIFIER:" + this.namespace;
@@ -4098,13 +4124,13 @@ var bt = /*#__PURE__*/function () {
4098
4124
  }, {
4099
4125
  key: "startPKCETransaction",
4100
4126
  value: function startPKCETransaction() {
4101
- return at(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
4127
+ return ft(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
4102
4128
  var e;
4103
4129
  return _regeneratorRuntime().wrap(function _callee16$(_context16) {
4104
4130
  while (1) switch (_context16.prev = _context16.next) {
4105
4131
  case 0:
4106
4132
  _context16.next = 2;
4107
- return bt.createProofkeyPair();
4133
+ return gt.createProofkeyPair();
4108
4134
  case 2:
4109
4135
  e = _context16.sent;
4110
4136
  return _context16.abrupt("return", (this._dataLayer.setItem(this.key(), JSON.stringify(e)), e));
@@ -4133,7 +4159,7 @@ var bt = /*#__PURE__*/function () {
4133
4159
  }], [{
4134
4160
  key: "createProofkeyPair",
4135
4161
  value: function createProofkeyPair() {
4136
- return at(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
4162
+ return ft(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
4137
4163
  var _String$fromCharCode;
4138
4164
  var e, t, r, n;
4139
4165
  return _regeneratorRuntime().wrap(function _callee17$(_context17) {
@@ -4141,7 +4167,7 @@ var bt = /*#__PURE__*/function () {
4141
4167
  case 0:
4142
4168
  e = new Uint32Array(16);
4143
4169
  window.crypto.getRandomValues(e);
4144
- t = Array.from(e).map(vt).join("");
4170
+ t = Array.from(e).map(bt).join("");
4145
4171
  _context17.next = 5;
4146
4172
  return window.crypto.subtle.digest("SHA-256", new TextEncoder().encode(t));
4147
4173
  case 5:
@@ -4158,14 +4184,14 @@ var bt = /*#__PURE__*/function () {
4158
4184
  }));
4159
4185
  }
4160
4186
  }]);
4161
- return bt;
4187
+ return gt;
4162
4188
  }();
4163
- var gt = /*#__PURE__*/function () {
4164
- function gt(e) {
4165
- _classCallCheck(this, gt);
4189
+ var yt = /*#__PURE__*/function () {
4190
+ function yt(e) {
4191
+ _classCallCheck(this, yt);
4166
4192
  this._networkClient = e;
4167
4193
  }
4168
- _createClass(gt, [{
4194
+ _createClass(yt, [{
4169
4195
  key: "searchUser",
4170
4196
  value: function searchUser(e) {
4171
4197
  return this._networkClient.fetchSDK({
@@ -4203,9 +4229,9 @@ var gt = /*#__PURE__*/function () {
4203
4229
  });
4204
4230
  }
4205
4231
  }]);
4206
- return gt;
4232
+ return yt;
4207
4233
  }();
4208
- var yt = function yt(e) {
4234
+ var kt = function kt(e) {
4209
4235
  return (document.cookie ? document.cookie.split("; ") : []).filter(function (t) {
4210
4236
  var _t$split = t.split("="),
4211
4237
  _t$split2 = _slicedToArray(_t$split, 1),
@@ -4214,17 +4240,17 @@ var yt = function yt(e) {
4214
4240
  }).length > 1;
4215
4241
  };
4216
4242
  /*! js-cookie v3.0.1 | MIT */
4217
- function kt(e) {
4243
+ function wt(e) {
4218
4244
  for (var t = 1; t < arguments.length; t++) {
4219
4245
  var r = arguments[t];
4220
4246
  for (var n in r) e[n] = r[n];
4221
4247
  }
4222
4248
  return e;
4223
4249
  }
4224
- var wt = function e(t, r) {
4250
+ var St = function e(t, r) {
4225
4251
  function n(e, n, i) {
4226
4252
  if ("undefined" != typeof document) {
4227
- "number" == typeof (i = kt({}, r, i)).expires && (i.expires = new Date(Date.now() + 864e5 * i.expires)), i.expires && (i.expires = i.expires.toUTCString()), e = encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
4253
+ "number" == typeof (i = wt({}, r, i)).expires && (i.expires = new Date(Date.now() + 864e5 * i.expires)), i.expires && (i.expires = i.expires.toUTCString()), e = encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
4228
4254
  var o = "";
4229
4255
  for (var s in i) i[s] && (o += "; " + s, !0 !== i[s] && (o += "=" + i[s].split(";")[0]));
4230
4256
  return document.cookie = e + "=" + t.write(n, e) + o;
@@ -4246,15 +4272,15 @@ var wt = function e(t, r) {
4246
4272
  }
4247
4273
  },
4248
4274
  remove: function remove(e, t) {
4249
- n(e, "", kt({}, t, {
4275
+ n(e, "", wt({}, t, {
4250
4276
  expires: -1
4251
4277
  }));
4252
4278
  },
4253
4279
  withAttributes: function withAttributes(t) {
4254
- return e(this.converter, kt({}, this.attributes, t));
4280
+ return e(this.converter, wt({}, this.attributes, t));
4255
4281
  },
4256
4282
  withConverter: function withConverter(t) {
4257
- return e(kt({}, this.converter, t), this.attributes);
4283
+ return e(wt({}, this.converter, t), this.attributes);
4258
4284
  }
4259
4285
  }, {
4260
4286
  attributes: {
@@ -4274,26 +4300,26 @@ var wt = function e(t, r) {
4274
4300
  }, {
4275
4301
  path: "/"
4276
4302
  });
4277
- var St = function St(e) {
4303
+ var Pt = function Pt(e) {
4278
4304
  var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
4279
4305
  return "stytch_sdk_state_".concat(e).concat(t ? "::".concat(t) : "");
4280
4306
  };
4281
- var Pt = /*#__PURE__*/function () {
4282
- function Pt(e, t) {
4307
+ var At = /*#__PURE__*/function () {
4308
+ function At(e, t) {
4283
4309
  var _this4 = this;
4284
- _classCallCheck(this, Pt);
4310
+ _classCallCheck(this, At);
4285
4311
  this.browserSessionStorage = {
4286
4312
  getItem: function getItem(e) {
4287
- return sessionStorage.getItem(St(_this4.publicToken, e));
4313
+ return sessionStorage.getItem(Pt(_this4.publicToken, e));
4288
4314
  },
4289
4315
  setItem: function setItem(e, t) {
4290
- return sessionStorage.setItem(St(_this4.publicToken, e), t);
4316
+ return sessionStorage.setItem(Pt(_this4.publicToken, e), t);
4291
4317
  },
4292
4318
  removeItem: function removeItem(e) {
4293
- return sessionStorage.removeItem(St(_this4.publicToken, e));
4319
+ return sessionStorage.removeItem(Pt(_this4.publicToken, e));
4294
4320
  }
4295
4321
  }, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (Be("SubscriptionDataLayer").isOptionalString("cookieOptions.opaqueTokenCookieName", t.cookieOptions.opaqueTokenCookieName).isOptionalString("cookieOptions.jwtCookieName", t.cookieOptions.jwtCookieName).isOptionalString("cookieOptions.istCookieName", t.cookieOptions.istCookieName).isOptionalString("cookieOptions.path", t.cookieOptions.path).isOptionalString("cookieOptions.domain", t.cookieOptions.domain), this._jwtCookieName = t.cookieOptions.jwtCookieName || null, this._opaqueTokenCookieName = t.cookieOptions.opaqueTokenCookieName || null, this._cookiePath = t.cookieOptions.path || null, this._domain = t.cookieOptions.domain || null, this._cookieAvailableToSubdomains = t.cookieOptions.availableToSubdomains || !1, this._istCookieName = t.cookieOptions.istCookieName || null) : (this._opaqueTokenCookieName = null, this._jwtCookieName = null, this._cookiePath = null, this._domain = null, this._cookieAvailableToSubdomains = !1, this._istCookieName = null);
4296
- var r = localStorage.getItem(St(this.publicToken));
4322
+ var r = localStorage.getItem(Pt(this.publicToken));
4297
4323
  if (!r) return;
4298
4324
  var n;
4299
4325
  try {
@@ -4303,7 +4329,7 @@ var Pt = /*#__PURE__*/function () {
4303
4329
  }
4304
4330
  this.state = n;
4305
4331
  }
4306
- _createClass(Pt, [{
4332
+ _createClass(At, [{
4307
4333
  key: "opaqueTokenCookieName",
4308
4334
  get: function get() {
4309
4335
  var e;
@@ -4325,14 +4351,14 @@ var Pt = /*#__PURE__*/function () {
4325
4351
  key: "readSessionCookie",
4326
4352
  value: function readSessionCookie() {
4327
4353
  return {
4328
- session_token: wt.get(this.opaqueTokenCookieName),
4329
- session_jwt: wt.get(this.jwtCookieName)
4354
+ session_token: St.get(this.opaqueTokenCookieName),
4355
+ session_jwt: St.get(this.jwtCookieName)
4330
4356
  };
4331
4357
  }
4332
4358
  }, {
4333
4359
  key: "readIntermediateSessionTokenCookie",
4334
4360
  value: function readIntermediateSessionTokenCookie() {
4335
- return wt.get(this.istCookieName);
4361
+ return St.get(this.istCookieName);
4336
4362
  }
4337
4363
  }, {
4338
4364
  key: "writeSessionCookie",
@@ -4341,32 +4367,32 @@ var Pt = /*#__PURE__*/function () {
4341
4367
  var o = e.state,
4342
4368
  s = e.session_token,
4343
4369
  a = e.session_jwt,
4344
- c = Pt.generateCookieOpts({
4370
+ c = At.generateCookieOpts({
4345
4371
  expiresAt: null !== (r = null === (t = null == o ? void 0 : o.session) || void 0 === t ? void 0 : t.expires_at) && void 0 !== r ? r : "",
4346
4372
  availableToSubdomains: this._cookieAvailableToSubdomains,
4347
4373
  path: this._cookiePath,
4348
4374
  domain: this._domain
4349
4375
  });
4350
- wt.set(this.opaqueTokenCookieName, s, c), wt.set(this.jwtCookieName, a, c);
4351
- var u = Pt.generateCookieOpts({
4376
+ St.set(this.opaqueTokenCookieName, s, c), St.set(this.jwtCookieName, a, c);
4377
+ var u = At.generateCookieOpts({
4352
4378
  expiresAt: null !== (i = null === (n = null == o ? void 0 : o.session) || void 0 === n ? void 0 : n.expires_at) && void 0 !== i ? i : "",
4353
4379
  availableToSubdomains: !this._cookieAvailableToSubdomains,
4354
4380
  path: this._cookiePath,
4355
4381
  domain: this._domain
4356
4382
  });
4357
- yt(this.jwtCookieName) && wt.remove(this.jwtCookieName, u), yt(this.opaqueTokenCookieName) && wt.remove(this.opaqueTokenCookieName, u), yt(this.jwtCookieName) && Oe("Could not remove extraneous JWT cookie. This might happen if the cookie has been set using multiple `path` settings, and may produce unwanted behavior."), yt(this.opaqueTokenCookieName) && Oe("Could not remove extraneous opaque token cookie.");
4383
+ kt(this.jwtCookieName) && St.remove(this.jwtCookieName, u), kt(this.opaqueTokenCookieName) && St.remove(this.opaqueTokenCookieName, u), kt(this.jwtCookieName) && Oe("Could not remove extraneous JWT cookie. This might happen if the cookie has been set using multiple `path` settings, and may produce unwanted behavior."), kt(this.opaqueTokenCookieName) && Oe("Could not remove extraneous opaque token cookie.");
4358
4384
  }
4359
4385
  }, {
4360
4386
  key: "writeIntermediateSessionTokenCookie",
4361
4387
  value: function writeIntermediateSessionTokenCookie(e) {
4362
4388
  var t = new Date(Date.now() + 6e5),
4363
- r = Pt.generateCookieOpts({
4389
+ r = At.generateCookieOpts({
4364
4390
  expiresAt: t.toString(),
4365
4391
  availableToSubdomains: this._cookieAvailableToSubdomains,
4366
4392
  path: this._cookiePath,
4367
4393
  domain: this._domain
4368
4394
  });
4369
- wt.set(this.istCookieName, e, r);
4395
+ St.set(this.istCookieName, e, r);
4370
4396
  }
4371
4397
  }, {
4372
4398
  key: "removeSessionCookie",
@@ -4385,14 +4411,14 @@ var Pt = /*#__PURE__*/function () {
4385
4411
  [!0, !1].forEach(function (t) {
4386
4412
  [_this5._cookiePath, null].forEach(function (r) {
4387
4413
  [_this5._domain, null].forEach(function (n) {
4388
- var i = Pt.generateCookieOpts({
4414
+ var i = At.generateCookieOpts({
4389
4415
  expiresAt: new Date(0).toString(),
4390
4416
  availableToSubdomains: t,
4391
4417
  path: r,
4392
4418
  domain: n
4393
4419
  });
4394
4420
  e.forEach(function (e) {
4395
- wt.remove(e, i);
4421
+ St.remove(e, i);
4396
4422
  });
4397
4423
  });
4398
4424
  });
@@ -4401,22 +4427,22 @@ var Pt = /*#__PURE__*/function () {
4401
4427
  }, {
4402
4428
  key: "syncToLocalStorage",
4403
4429
  value: function syncToLocalStorage() {
4404
- localStorage.setItem(St(this.publicToken), JSON.stringify(this.state));
4430
+ localStorage.setItem(Pt(this.publicToken), JSON.stringify(this.state));
4405
4431
  }
4406
4432
  }, {
4407
4433
  key: "getItem",
4408
4434
  value: function getItem(e) {
4409
- return localStorage.getItem(St(this.publicToken, e));
4435
+ return localStorage.getItem(Pt(this.publicToken, e));
4410
4436
  }
4411
4437
  }, {
4412
4438
  key: "setItem",
4413
4439
  value: function setItem(e, t) {
4414
- return localStorage.setItem(St(this.publicToken, e), t);
4440
+ return localStorage.setItem(Pt(this.publicToken, e), t);
4415
4441
  }
4416
4442
  }, {
4417
4443
  key: "removeItem",
4418
4444
  value: function removeItem(e) {
4419
- return localStorage.removeItem(St(this.publicToken, e));
4445
+ return localStorage.removeItem(Pt(this.publicToken, e));
4420
4446
  }
4421
4447
  }, {
4422
4448
  key: "markStateKeysUpdated",
@@ -4441,31 +4467,31 @@ var Pt = /*#__PURE__*/function () {
4441
4467
  return e && (i.path = e), Boolean("localhost" === window.location.hostname || "[::1]" === window.location.hostname || window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)) ? i.secure = !1 : (r && (i.domain = t || window.location.host), i.secure = !0), i;
4442
4468
  }
4443
4469
  }]);
4444
- return Pt;
4470
+ return At;
4445
4471
  }();
4446
- var At = /*#__PURE__*/function (_Pt) {
4447
- _inherits(At, _Pt);
4448
- var _super2 = _createSuper(At);
4449
- function At() {
4450
- _classCallCheck(this, At);
4472
+ var Ct = /*#__PURE__*/function (_At) {
4473
+ _inherits(Ct, _At);
4474
+ var _super2 = _createSuper(Ct);
4475
+ function Ct() {
4476
+ _classCallCheck(this, Ct);
4451
4477
  return _super2.apply(this, arguments);
4452
4478
  }
4453
- return _createClass(At);
4454
- }(Pt);
4455
- var Ct = Symbol["for"]("__stytch_b2b_DataLayer"),
4456
- Et = function Et(e, t) {
4479
+ return _createClass(Ct);
4480
+ }(At);
4481
+ var Et = Symbol["for"]("__stytch_b2b_DataLayer"),
4482
+ Tt = function Tt(e, t) {
4457
4483
  var r = function () {
4458
4484
  var e = window;
4459
- return e[Ct] || (e[Ct] = {}), e[Ct];
4485
+ return e[Et] || (e[Et] = {}), e[Et];
4460
4486
  }();
4461
- return r[e] || (r[e] = new At(e, t)), r[e];
4487
+ return r[e] || (r[e] = new Ct(e, t)), r[e];
4462
4488
  },
4463
- Tt = function Tt(e, t) {
4489
+ Ot = function Ot(e, t) {
4464
4490
  Object.values(e).forEach(function (e) {
4465
4491
  return e(t);
4466
4492
  });
4467
4493
  },
4468
- Ot = function () {
4494
+ xt = function () {
4469
4495
  var e = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}).KEYS_TO_EXCLUDE,
4470
4496
  t = void 0 === e ? [] : e;
4471
4497
  return function e(r, n) {
@@ -4484,12 +4510,12 @@ var Ct = Symbol["for"]("__stytch_b2b_DataLayer"),
4484
4510
  }({
4485
4511
  KEYS_TO_EXCLUDE: ["last_accessed_at"]
4486
4512
  });
4487
- var xt = /*#__PURE__*/function () {
4488
- function xt(e, t) {
4513
+ var Dt = /*#__PURE__*/function () {
4514
+ function Dt(e, t) {
4489
4515
  var _this7 = this;
4490
- _classCallCheck(this, xt);
4516
+ _classCallCheck(this, Dt);
4491
4517
  this._publicToken = e, this._datalayer = t, this._listen = function (e) {
4492
- if (e.key !== St(_this7._publicToken)) return;
4518
+ if (e.key !== Pt(_this7._publicToken)) return;
4493
4519
  if (null === e.newValue || "null" === e.newValue) return void _this7.destroyState();
4494
4520
  var t = JSON.parse(e.newValue);
4495
4521
  _this7.updateState(t);
@@ -4498,7 +4524,7 @@ var xt = /*#__PURE__*/function () {
4498
4524
  r = _this$_datalayer$read.session_token;
4499
4525
  r || this.destroyState();
4500
4526
  }
4501
- _createClass(xt, [{
4527
+ _createClass(Dt, [{
4502
4528
  key: "getTokens",
4503
4529
  value: function getTokens() {
4504
4530
  var _this$_datalayer$read2 = this._datalayer.readSessionCookie(),
@@ -4531,7 +4557,7 @@ var xt = /*#__PURE__*/function () {
4531
4557
  r = null === e.state ? null : Object.assign(Object.assign({}, this._datalayer.state), e.state);
4532
4558
  this._datalayer.state = r;
4533
4559
  var n = e.state ? Object.keys(e.state) : [];
4534
- !this._datalayer.markStateKeysUpdated(n) && Ot(t, r) || Tt(this._datalayer.subscriptions, r);
4560
+ !this._datalayer.markStateKeysUpdated(n) && xt(t, r) || Ot(this._datalayer.subscriptions, r);
4535
4561
  }
4536
4562
  }, {
4537
4563
  key: "updateStateAndTokens",
@@ -4546,8 +4572,8 @@ var xt = /*#__PURE__*/function () {
4546
4572
  this._datalayer.state = r;
4547
4573
  var n = e ? Object.keys(e) : [],
4548
4574
  i = this._datalayer.markStateKeysUpdated(n),
4549
- o = !Ot(t, r);
4550
- (i || o) && (Tt(this._datalayer.subscriptions, r), o && this._datalayer.syncToLocalStorage());
4575
+ o = !xt(t, r);
4576
+ (i || o) && (Ot(this._datalayer.subscriptions, r), o && this._datalayer.syncToLocalStorage());
4551
4577
  }
4552
4578
  }, {
4553
4579
  key: "updateTokens",
@@ -4587,14 +4613,14 @@ var xt = /*#__PURE__*/function () {
4587
4613
  return null;
4588
4614
  }
4589
4615
  }]);
4590
- return xt;
4616
+ return Dt;
4591
4617
  }();
4592
- var Dt = /*#__PURE__*/function (_xt) {
4593
- _inherits(Dt, _xt);
4594
- var _super3 = _createSuper(Dt);
4595
- function Dt() {
4618
+ var It = /*#__PURE__*/function (_Dt) {
4619
+ _inherits(It, _Dt);
4620
+ var _super3 = _createSuper(It);
4621
+ function It() {
4596
4622
  var _this8;
4597
- _classCallCheck(this, Dt);
4623
+ _classCallCheck(this, It);
4598
4624
  _this8 = _super3.apply(this, arguments), _this8.updateMember = function (e) {
4599
4625
  return _this8.updateState({
4600
4626
  member: e
@@ -4615,9 +4641,9 @@ var Dt = /*#__PURE__*/function (_xt) {
4615
4641
  };
4616
4642
  return _this8;
4617
4643
  }
4618
- return _createClass(Dt);
4619
- }(xt);
4620
- var It = Symbol["for"]("stytch__internal_b2b");
4644
+ return _createClass(It);
4645
+ }(Dt);
4646
+ var Bt = Symbol["for"]("stytch__internal_b2b");
4621
4647
  exports.BiometricsFailedError = U, exports.BiometricsUnavailableError = A, exports.ChallengeSigningFailedError = F, exports.DeviceCredentialsNotAllowedError = D, exports.FailedCodeChallengeError = K, exports.FailedToDecryptDataError = z, exports.InternalError = S, exports.InvalidAuthorizationCredentialError = L, exports.InvalidCredentialTypeError = H, exports.InvalidRedirectSchemeError = W, exports.InvalidStartUrlError = q, exports.JSONDataNotConvertibleToStringError = V, exports.KeyInvalidatedError = C, exports.KeystoreUnavailableError = E, exports.MissingAttestationObjectError = Y, exports.MissingAuthorizationCredentialIDTokenError = R, exports.MissingGoogleClientIDError = I, exports.MissingPKCEError = B, exports.MissingPublicKeyError = M, exports.MissingUrlError = G, exports.NoBiometricsEnrolledError = T, exports.NoBiometricsRegistrationError = P, exports.NoCurrentSessionError = w, exports.PasskeysInvalidEncoding = $, exports.PasskeysUnsupportedError = N, exports.RandomNumberGenerationFailed = J, exports.SDKAPIUnreachableError = h, exports.SDKNotConfiguredError = j, exports.StytchAPIError = y, exports.StytchAPISchemaError = g, exports.StytchAPIUnreachableError = b, exports.StytchB2BHeadlessClient = /*#__PURE__*/function () {
4622
4648
  function _class(e, t) {
4623
4649
  var _this9 = this;
@@ -4638,9 +4664,9 @@ exports.BiometricsFailedError = U, exports.BiometricsUnavailableError = A, expor
4638
4664
  }
4639
4665
  };
4640
4666
  var o, s, a, c, u, l, d, h, p, _, f;
4641
- this._dataLayer = Et(e, n), this._subscriptionService = new Dt(e, this._dataLayer);
4642
- var m = new bt(this._dataLayer, "passwords");
4643
- this._networkClient = new mt(e, this._dataLayer, i.endpoints.sdkBackendURL, function () {
4667
+ this._dataLayer = Tt(e, n), this._subscriptionService = new It(e, this._dataLayer);
4668
+ var m = new gt(this._dataLayer, "passwords");
4669
+ this._networkClient = new vt(e, this._dataLayer, i.endpoints.sdkBackendURL, function () {
4644
4670
  var e, t, r, n;
4645
4671
  return {
4646
4672
  stytch_member_id: null === (t = null === (e = _this9._dataLayer.state) || void 0 === e ? void 0 : e.member) || void 0 === t ? void 0 : t.member_id,
@@ -4648,18 +4674,18 @@ exports.BiometricsFailedError = U, exports.BiometricsUnavailableError = A, expor
4648
4674
  };
4649
4675
  });
4650
4676
  var v = new _t(e, this._networkClient, this._dataLayer),
4651
- b = new ft(v.getAsync()),
4677
+ b = new mt(v.getAsync()),
4652
4678
  g = new Re(e, i.endpoints.dfpBackendURL, v.getAsync(), b.executeRecaptcha);
4653
- this.organization = new ze(this._networkClient, this._subscriptionService), this.member = new Ke(this._networkClient, this._subscriptionService), this.self = new Ke(this._networkClient, this._subscriptionService), this.session = new qe(this._networkClient, this._subscriptionService), this.magicLinks = new je(this._networkClient, this._subscriptionService, new bt(this._dataLayer, "magic_links"), m, v.getAsync(), g), this.oauth = new Ue(this._networkClient, this._subscriptionService, new bt(this._dataLayer, "oauth"), v.getAsync(), {
4679
+ this.organization = new ze(this._networkClient, this._subscriptionService), this.member = new Ke(this._networkClient, this._subscriptionService), this.self = new Ke(this._networkClient, this._subscriptionService), this.session = new qe(this._networkClient, this._subscriptionService), this.magicLinks = new je(this._networkClient, this._subscriptionService, new gt(this._dataLayer, "magic_links"), m, v.getAsync(), g), this.oauth = new Ue(this._networkClient, this._subscriptionService, new gt(this._dataLayer, "oauth"), v.getAsync(), {
4654
4680
  publicToken: e,
4655
4681
  testAPIURL: i.endpoints.testAPIURL,
4656
4682
  liveAPIURL: i.endpoints.liveAPIURL
4657
- }, g), this.sso = new Ne(this._networkClient, this._subscriptionService, new bt(this._dataLayer, "sso"), v.getAsync(), {
4683
+ }, g), this.sso = new Ne(this._networkClient, this._subscriptionService, new gt(this._dataLayer, "sso"), v.getAsync(), {
4658
4684
  publicToken: e,
4659
4685
  testAPIURL: i.endpoints.testAPIURL,
4660
4686
  liveAPIURL: i.endpoints.liveAPIURL
4661
4687
  }), this.discovery = new We(this._networkClient, this._subscriptionService), this.passwords = new ht(this._networkClient, this._subscriptionService, m, v.getAsync(), g), this.otps = new Ge(this._networkClient, this._subscriptionService, g), this.totp = new He(this._networkClient, this._subscriptionService, g), this.recoveryCodes = new Ye(this._networkClient, this._subscriptionService, g), this.rbac = new Ve(v.getSync(), v.getAsync(), this._subscriptionService), this._sessionManager = new Je(this._subscriptionService, this.session);
4662
- var y = new gt(this._networkClient);
4688
+ var y = new yt(this._networkClient);
4663
4689
  this._dataLayer.readSessionCookie().session_token && this._sessionManager.performBackgroundRefresh(), this._networkClient.logEvent({
4664
4690
  name: "b2b_sdk_instance_instantiated",
4665
4691
  details: {
@@ -4669,7 +4695,7 @@ exports.BiometricsFailedError = U, exports.BiometricsUnavailableError = A, expor
4669
4695
  }
4670
4696
  });
4671
4697
  (function (e, t) {
4672
- Object.assign(e, _defineProperty({}, It, t));
4698
+ Object.assign(e, _defineProperty({}, Bt, t));
4673
4699
  })(this, {
4674
4700
  bootstrap: v,
4675
4701
  publicToken: e,