@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.
@@ -3920,11 +3920,37 @@ var Pt = /*#__PURE__*/function () {
3920
3920
  }]);
3921
3921
  return Pt;
3922
3922
  }();
3923
- var Ct = /*#__PURE__*/_createClass(function Ct(e) {
3923
+ function Ct(e, t, r, n) {
3924
+ return new (r || (r = Promise))(function (i, o) {
3925
+ function s(e) {
3926
+ try {
3927
+ c(n.next(e));
3928
+ } catch (e) {
3929
+ o(e);
3930
+ }
3931
+ }
3932
+ function a(e) {
3933
+ try {
3934
+ c(n["throw"](e));
3935
+ } catch (e) {
3936
+ o(e);
3937
+ }
3938
+ }
3939
+ function c(e) {
3940
+ var t;
3941
+ e.done ? i(e.value) : (t = e.value, t instanceof r ? t : new r(function (e) {
3942
+ e(t);
3943
+ })).then(s, a);
3944
+ }
3945
+ c((n = n.apply(e, t || [])).next());
3946
+ });
3947
+ }
3948
+ "function" == typeof SuppressedError && SuppressedError;
3949
+ var At = /*#__PURE__*/_createClass(function At(e) {
3924
3950
  var _this3 = this;
3925
- _classCallCheck(this, Ct);
3951
+ _classCallCheck(this, At);
3926
3952
  this.bootstrapPromise = e, this.executeRecaptcha = function () {
3927
- return vt(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
3953
+ return Ct(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
3928
3954
  var _yield$this$state, e, t, r;
3929
3955
  return _regeneratorRuntime().wrap(function _callee12$(_context12) {
3930
3956
  while (1) switch (_context12.prev = _context12.next) {
@@ -3955,7 +3981,7 @@ var Ct = /*#__PURE__*/_createClass(function Ct(e) {
3955
3981
  }, _callee12, this);
3956
3982
  }));
3957
3983
  }, this.state = e.then(function (e) {
3958
- return vt(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
3984
+ return Ct(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
3959
3985
  var t;
3960
3986
  return _regeneratorRuntime().wrap(function _callee13$(_context13) {
3961
3987
  while (1) switch (_context13.prev = _context13.next) {
@@ -3993,9 +4019,9 @@ var Ct = /*#__PURE__*/_createClass(function Ct(e) {
3993
4019
  }));
3994
4020
  });
3995
4021
  });
3996
- var At = /*#__PURE__*/function () {
3997
- function At(e, t, r, n) {
3998
- _classCallCheck(this, At);
4022
+ var Tt = /*#__PURE__*/function () {
4023
+ function Tt(e, t, r, n) {
4024
+ _classCallCheck(this, Tt);
3999
4025
  this._publicToken = e, this._subscriptionDataLayer = t, this.baseURL = r, this.additionalTelemetryDataFn = n, this.updateSessionToken = function () {
4000
4026
  return null;
4001
4027
  }, this.eventLogger = new He({
@@ -4004,7 +4030,7 @@ var At = /*#__PURE__*/function () {
4004
4030
  logEventURL: this.buildSDKUrl("/events")
4005
4031
  });
4006
4032
  }
4007
- _createClass(At, [{
4033
+ _createClass(Tt, [{
4008
4034
  key: "logEvent",
4009
4035
  value: function logEvent(_ref) {
4010
4036
  var e = _ref.name,
@@ -4035,7 +4061,7 @@ var At = /*#__PURE__*/function () {
4035
4061
  },
4036
4062
  sdk: {
4037
4063
  identifier: "Stytch.js Javascript SDK",
4038
- version: "4.4.0"
4064
+ version: "4.4.1"
4039
4065
  }
4040
4066
  });
4041
4067
  }
@@ -4046,7 +4072,7 @@ var At = /*#__PURE__*/function () {
4046
4072
  t = _ref2.body,
4047
4073
  r = _ref2.errorMessage,
4048
4074
  n = _ref2.method;
4049
- return vt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
4075
+ return Ct(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
4050
4076
  var i, o, s, a;
4051
4077
  return _regeneratorRuntime().wrap(function _callee14$(_context14) {
4052
4078
  while (1) switch (_context14.prev = _context14.next) {
@@ -4076,7 +4102,7 @@ var At = /*#__PURE__*/function () {
4076
4102
  r = _ref3.errorMessage,
4077
4103
  n = _ref3.method,
4078
4104
  i = _ref3.retryCallback;
4079
- return vt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
4105
+ return Ct(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
4080
4106
  var o, s, a, c;
4081
4107
  return _regeneratorRuntime().wrap(function _callee15$(_context15) {
4082
4108
  while (1) switch (_context15.prev = _context15.next) {
@@ -4147,18 +4173,18 @@ var At = /*#__PURE__*/function () {
4147
4173
  return "".concat(this.baseURL, "/sdk/v1").concat(e);
4148
4174
  }
4149
4175
  }]);
4150
- return At;
4176
+ return Tt;
4151
4177
  }();
4152
- function Tt(e) {
4178
+ function Ot(e) {
4153
4179
  var t = e.toString(16);
4154
4180
  return 1 === t.length && (t = "0" + t), t;
4155
4181
  }
4156
- var Ot = /*#__PURE__*/function () {
4157
- function Ot(e, t) {
4158
- _classCallCheck(this, Ot);
4182
+ var Et = /*#__PURE__*/function () {
4183
+ function Et(e, t) {
4184
+ _classCallCheck(this, Et);
4159
4185
  this._dataLayer = e, this.namespace = t;
4160
4186
  }
4161
- _createClass(Ot, [{
4187
+ _createClass(Et, [{
4162
4188
  key: "key",
4163
4189
  value: function key() {
4164
4190
  return "PKCE_VERIFIER:" + this.namespace;
@@ -4166,13 +4192,13 @@ var Ot = /*#__PURE__*/function () {
4166
4192
  }, {
4167
4193
  key: "startPKCETransaction",
4168
4194
  value: function startPKCETransaction() {
4169
- return vt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
4195
+ return Ct(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
4170
4196
  var e;
4171
4197
  return _regeneratorRuntime().wrap(function _callee16$(_context16) {
4172
4198
  while (1) switch (_context16.prev = _context16.next) {
4173
4199
  case 0:
4174
4200
  _context16.next = 2;
4175
- return Ot.createProofkeyPair();
4201
+ return Et.createProofkeyPair();
4176
4202
  case 2:
4177
4203
  e = _context16.sent;
4178
4204
  return _context16.abrupt("return", (this._dataLayer.setItem(this.key(), JSON.stringify(e)), e));
@@ -4201,7 +4227,7 @@ var Ot = /*#__PURE__*/function () {
4201
4227
  }], [{
4202
4228
  key: "createProofkeyPair",
4203
4229
  value: function createProofkeyPair() {
4204
- return vt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
4230
+ return Ct(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
4205
4231
  var _String$fromCharCode;
4206
4232
  var e, t, r, n;
4207
4233
  return _regeneratorRuntime().wrap(function _callee17$(_context17) {
@@ -4209,7 +4235,7 @@ var Ot = /*#__PURE__*/function () {
4209
4235
  case 0:
4210
4236
  e = new Uint32Array(16);
4211
4237
  window.crypto.getRandomValues(e);
4212
- t = Array.from(e).map(Tt).join("");
4238
+ t = Array.from(e).map(Ot).join("");
4213
4239
  _context17.next = 5;
4214
4240
  return window.crypto.subtle.digest("SHA-256", new TextEncoder().encode(t));
4215
4241
  case 5:
@@ -4226,14 +4252,14 @@ var Ot = /*#__PURE__*/function () {
4226
4252
  }));
4227
4253
  }
4228
4254
  }]);
4229
- return Ot;
4255
+ return Et;
4230
4256
  }();
4231
- var Et = /*#__PURE__*/function () {
4232
- function Et(e) {
4233
- _classCallCheck(this, Et);
4257
+ var xt = /*#__PURE__*/function () {
4258
+ function xt(e) {
4259
+ _classCallCheck(this, xt);
4234
4260
  this._networkClient = e;
4235
4261
  }
4236
- _createClass(Et, [{
4262
+ _createClass(xt, [{
4237
4263
  key: "searchUser",
4238
4264
  value: function searchUser(e) {
4239
4265
  return this._networkClient.fetchSDK({
@@ -4271,9 +4297,9 @@ var Et = /*#__PURE__*/function () {
4271
4297
  });
4272
4298
  }
4273
4299
  }]);
4274
- return Et;
4300
+ return xt;
4275
4301
  }();
4276
- var xt = function xt(e) {
4302
+ var Dt = function Dt(e) {
4277
4303
  return (document.cookie ? document.cookie.split("; ") : []).filter(function (t) {
4278
4304
  var _t$split = t.split("="),
4279
4305
  _t$split2 = _slicedToArray(_t$split, 1),
@@ -4282,17 +4308,17 @@ var xt = function xt(e) {
4282
4308
  }).length > 1;
4283
4309
  };
4284
4310
  /*! js-cookie v3.0.1 | MIT */
4285
- function Dt(e) {
4311
+ function It(e) {
4286
4312
  for (var t = 1; t < arguments.length; t++) {
4287
4313
  var r = arguments[t];
4288
4314
  for (var n in r) e[n] = r[n];
4289
4315
  }
4290
4316
  return e;
4291
4317
  }
4292
- var It = function e(t, r) {
4318
+ var Rt = function e(t, r) {
4293
4319
  function n(e, n, i) {
4294
4320
  if ("undefined" != typeof document) {
4295
- "number" == typeof (i = Dt({}, 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);
4321
+ "number" == typeof (i = It({}, 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);
4296
4322
  var o = "";
4297
4323
  for (var s in i) i[s] && (o += "; " + s, !0 !== i[s] && (o += "=" + i[s].split(";")[0]));
4298
4324
  return document.cookie = e + "=" + t.write(n, e) + o;
@@ -4314,15 +4340,15 @@ var It = function e(t, r) {
4314
4340
  }
4315
4341
  },
4316
4342
  remove: function remove(e, t) {
4317
- n(e, "", Dt({}, t, {
4343
+ n(e, "", It({}, t, {
4318
4344
  expires: -1
4319
4345
  }));
4320
4346
  },
4321
4347
  withAttributes: function withAttributes(t) {
4322
- return e(this.converter, Dt({}, this.attributes, t));
4348
+ return e(this.converter, It({}, this.attributes, t));
4323
4349
  },
4324
4350
  withConverter: function withConverter(t) {
4325
- return e(Dt({}, this.converter, t), this.attributes);
4351
+ return e(It({}, this.converter, t), this.attributes);
4326
4352
  }
4327
4353
  }, {
4328
4354
  attributes: {
@@ -4342,26 +4368,26 @@ var It = function e(t, r) {
4342
4368
  }, {
4343
4369
  path: "/"
4344
4370
  });
4345
- var Rt = function Rt(e) {
4371
+ var Bt = function Bt(e) {
4346
4372
  var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
4347
4373
  return "stytch_sdk_state_".concat(e).concat(t ? "::".concat(t) : "");
4348
4374
  };
4349
- var Bt = /*#__PURE__*/function () {
4350
- function Bt(e, t) {
4375
+ var Lt = /*#__PURE__*/function () {
4376
+ function Lt(e, t) {
4351
4377
  var _this4 = this;
4352
- _classCallCheck(this, Bt);
4378
+ _classCallCheck(this, Lt);
4353
4379
  this.browserSessionStorage = {
4354
4380
  getItem: function getItem(e) {
4355
- return sessionStorage.getItem(Rt(_this4.publicToken, e));
4381
+ return sessionStorage.getItem(Bt(_this4.publicToken, e));
4356
4382
  },
4357
4383
  setItem: function setItem(e, t) {
4358
- return sessionStorage.setItem(Rt(_this4.publicToken, e), t);
4384
+ return sessionStorage.setItem(Bt(_this4.publicToken, e), t);
4359
4385
  },
4360
4386
  removeItem: function removeItem(e) {
4361
- return sessionStorage.removeItem(Rt(_this4.publicToken, e));
4387
+ return sessionStorage.removeItem(Bt(_this4.publicToken, e));
4362
4388
  }
4363
4389
  }, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (qe("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);
4364
- var r = localStorage.getItem(Rt(this.publicToken));
4390
+ var r = localStorage.getItem(Bt(this.publicToken));
4365
4391
  if (!r) return;
4366
4392
  var n;
4367
4393
  try {
@@ -4371,7 +4397,7 @@ var Bt = /*#__PURE__*/function () {
4371
4397
  }
4372
4398
  this.state = n;
4373
4399
  }
4374
- _createClass(Bt, [{
4400
+ _createClass(Lt, [{
4375
4401
  key: "opaqueTokenCookieName",
4376
4402
  get: function get() {
4377
4403
  var e;
@@ -4393,14 +4419,14 @@ var Bt = /*#__PURE__*/function () {
4393
4419
  key: "readSessionCookie",
4394
4420
  value: function readSessionCookie() {
4395
4421
  return {
4396
- session_token: It.get(this.opaqueTokenCookieName),
4397
- session_jwt: It.get(this.jwtCookieName)
4422
+ session_token: Rt.get(this.opaqueTokenCookieName),
4423
+ session_jwt: Rt.get(this.jwtCookieName)
4398
4424
  };
4399
4425
  }
4400
4426
  }, {
4401
4427
  key: "readIntermediateSessionTokenCookie",
4402
4428
  value: function readIntermediateSessionTokenCookie() {
4403
- return It.get(this.istCookieName);
4429
+ return Rt.get(this.istCookieName);
4404
4430
  }
4405
4431
  }, {
4406
4432
  key: "writeSessionCookie",
@@ -4409,32 +4435,32 @@ var Bt = /*#__PURE__*/function () {
4409
4435
  var o = e.state,
4410
4436
  s = e.session_token,
4411
4437
  a = e.session_jwt,
4412
- c = Bt.generateCookieOpts({
4438
+ c = Lt.generateCookieOpts({
4413
4439
  expiresAt: null !== (r = null === (t = null == o ? void 0 : o.session) || void 0 === t ? void 0 : t.expires_at) && void 0 !== r ? r : "",
4414
4440
  availableToSubdomains: this._cookieAvailableToSubdomains,
4415
4441
  path: this._cookiePath,
4416
4442
  domain: this._domain
4417
4443
  });
4418
- It.set(this.opaqueTokenCookieName, s, c), It.set(this.jwtCookieName, a, c);
4419
- var u = Bt.generateCookieOpts({
4444
+ Rt.set(this.opaqueTokenCookieName, s, c), Rt.set(this.jwtCookieName, a, c);
4445
+ var u = Lt.generateCookieOpts({
4420
4446
  expiresAt: null !== (i = null === (n = null == o ? void 0 : o.session) || void 0 === n ? void 0 : n.expires_at) && void 0 !== i ? i : "",
4421
4447
  availableToSubdomains: !this._cookieAvailableToSubdomains,
4422
4448
  path: this._cookiePath,
4423
4449
  domain: this._domain
4424
4450
  });
4425
- xt(this.jwtCookieName) && It.remove(this.jwtCookieName, u), xt(this.opaqueTokenCookieName) && It.remove(this.opaqueTokenCookieName, u), xt(this.jwtCookieName) && Ke("Could not remove extraneous JWT cookie. This might happen if the cookie has been set using multiple `path` settings, and may produce unwanted behavior."), xt(this.opaqueTokenCookieName) && Ke("Could not remove extraneous opaque token cookie.");
4451
+ Dt(this.jwtCookieName) && Rt.remove(this.jwtCookieName, u), Dt(this.opaqueTokenCookieName) && Rt.remove(this.opaqueTokenCookieName, u), Dt(this.jwtCookieName) && Ke("Could not remove extraneous JWT cookie. This might happen if the cookie has been set using multiple `path` settings, and may produce unwanted behavior."), Dt(this.opaqueTokenCookieName) && Ke("Could not remove extraneous opaque token cookie.");
4426
4452
  }
4427
4453
  }, {
4428
4454
  key: "writeIntermediateSessionTokenCookie",
4429
4455
  value: function writeIntermediateSessionTokenCookie(e) {
4430
4456
  var t = new Date(Date.now() + 6e5),
4431
- r = Bt.generateCookieOpts({
4457
+ r = Lt.generateCookieOpts({
4432
4458
  expiresAt: t.toString(),
4433
4459
  availableToSubdomains: this._cookieAvailableToSubdomains,
4434
4460
  path: this._cookiePath,
4435
4461
  domain: this._domain
4436
4462
  });
4437
- It.set(this.istCookieName, e, r);
4463
+ Rt.set(this.istCookieName, e, r);
4438
4464
  }
4439
4465
  }, {
4440
4466
  key: "removeSessionCookie",
@@ -4453,14 +4479,14 @@ var Bt = /*#__PURE__*/function () {
4453
4479
  [!0, !1].forEach(function (t) {
4454
4480
  [_this5._cookiePath, null].forEach(function (r) {
4455
4481
  [_this5._domain, null].forEach(function (n) {
4456
- var i = Bt.generateCookieOpts({
4482
+ var i = Lt.generateCookieOpts({
4457
4483
  expiresAt: new Date(0).toString(),
4458
4484
  availableToSubdomains: t,
4459
4485
  path: r,
4460
4486
  domain: n
4461
4487
  });
4462
4488
  e.forEach(function (e) {
4463
- It.remove(e, i);
4489
+ Rt.remove(e, i);
4464
4490
  });
4465
4491
  });
4466
4492
  });
@@ -4469,22 +4495,22 @@ var Bt = /*#__PURE__*/function () {
4469
4495
  }, {
4470
4496
  key: "syncToLocalStorage",
4471
4497
  value: function syncToLocalStorage() {
4472
- localStorage.setItem(Rt(this.publicToken), JSON.stringify(this.state));
4498
+ localStorage.setItem(Bt(this.publicToken), JSON.stringify(this.state));
4473
4499
  }
4474
4500
  }, {
4475
4501
  key: "getItem",
4476
4502
  value: function getItem(e) {
4477
- return localStorage.getItem(Rt(this.publicToken, e));
4503
+ return localStorage.getItem(Bt(this.publicToken, e));
4478
4504
  }
4479
4505
  }, {
4480
4506
  key: "setItem",
4481
4507
  value: function setItem(e, t) {
4482
- return localStorage.setItem(Rt(this.publicToken, e), t);
4508
+ return localStorage.setItem(Bt(this.publicToken, e), t);
4483
4509
  }
4484
4510
  }, {
4485
4511
  key: "removeItem",
4486
4512
  value: function removeItem(e) {
4487
- return localStorage.removeItem(Rt(this.publicToken, e));
4513
+ return localStorage.removeItem(Bt(this.publicToken, e));
4488
4514
  }
4489
4515
  }, {
4490
4516
  key: "markStateKeysUpdated",
@@ -4509,31 +4535,31 @@ var Bt = /*#__PURE__*/function () {
4509
4535
  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;
4510
4536
  }
4511
4537
  }]);
4512
- return Bt;
4538
+ return Lt;
4513
4539
  }();
4514
- var Lt = /*#__PURE__*/function (_Bt) {
4515
- _inherits(Lt, _Bt);
4516
- var _super2 = _createSuper(Lt);
4517
- function Lt() {
4518
- _classCallCheck(this, Lt);
4540
+ var Mt = /*#__PURE__*/function (_Lt) {
4541
+ _inherits(Mt, _Lt);
4542
+ var _super2 = _createSuper(Mt);
4543
+ function Mt() {
4544
+ _classCallCheck(this, Mt);
4519
4545
  return _super2.apply(this, arguments);
4520
4546
  }
4521
- return _createClass(Lt);
4522
- }(Bt);
4523
- var Mt = Symbol["for"]("__stytch_b2b_DataLayer"),
4524
- Ft = function Ft(e, t) {
4547
+ return _createClass(Mt);
4548
+ }(Lt);
4549
+ var Ft = Symbol["for"]("__stytch_b2b_DataLayer"),
4550
+ jt = function jt(e, t) {
4525
4551
  var r = function () {
4526
4552
  var e = window;
4527
- return e[Mt] || (e[Mt] = {}), e[Mt];
4553
+ return e[Ft] || (e[Ft] = {}), e[Ft];
4528
4554
  }();
4529
- return r[e] || (r[e] = new Lt(e, t)), r[e];
4555
+ return r[e] || (r[e] = new Mt(e, t)), r[e];
4530
4556
  },
4531
- jt = function jt(e, t) {
4557
+ Kt = function Kt(e, t) {
4532
4558
  Object.values(e).forEach(function (e) {
4533
4559
  return e(t);
4534
4560
  });
4535
4561
  },
4536
- Kt = function () {
4562
+ Nt = function () {
4537
4563
  var e = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}).KEYS_TO_EXCLUDE,
4538
4564
  t = void 0 === e ? [] : e;
4539
4565
  return function e(r, n) {
@@ -4552,12 +4578,12 @@ var Mt = Symbol["for"]("__stytch_b2b_DataLayer"),
4552
4578
  }({
4553
4579
  KEYS_TO_EXCLUDE: ["last_accessed_at"]
4554
4580
  });
4555
- var Nt = /*#__PURE__*/function () {
4556
- function Nt(e, t) {
4581
+ var zt = /*#__PURE__*/function () {
4582
+ function zt(e, t) {
4557
4583
  var _this7 = this;
4558
- _classCallCheck(this, Nt);
4584
+ _classCallCheck(this, zt);
4559
4585
  this._publicToken = e, this._datalayer = t, this._listen = function (e) {
4560
- if (e.key !== Rt(_this7._publicToken)) return;
4586
+ if (e.key !== Bt(_this7._publicToken)) return;
4561
4587
  if (null === e.newValue || "null" === e.newValue) return void _this7.destroyState();
4562
4588
  var t = JSON.parse(e.newValue);
4563
4589
  _this7.updateState(t);
@@ -4566,7 +4592,7 @@ var Nt = /*#__PURE__*/function () {
4566
4592
  r = _this$_datalayer$read.session_token;
4567
4593
  r || this.destroyState();
4568
4594
  }
4569
- _createClass(Nt, [{
4595
+ _createClass(zt, [{
4570
4596
  key: "getTokens",
4571
4597
  value: function getTokens() {
4572
4598
  var _this$_datalayer$read2 = this._datalayer.readSessionCookie(),
@@ -4599,7 +4625,7 @@ var Nt = /*#__PURE__*/function () {
4599
4625
  r = null === e.state ? null : Object.assign(Object.assign({}, this._datalayer.state), e.state);
4600
4626
  this._datalayer.state = r;
4601
4627
  var n = e.state ? Object.keys(e.state) : [];
4602
- !this._datalayer.markStateKeysUpdated(n) && Kt(t, r) || jt(this._datalayer.subscriptions, r);
4628
+ !this._datalayer.markStateKeysUpdated(n) && Nt(t, r) || Kt(this._datalayer.subscriptions, r);
4603
4629
  }
4604
4630
  }, {
4605
4631
  key: "updateStateAndTokens",
@@ -4614,8 +4640,8 @@ var Nt = /*#__PURE__*/function () {
4614
4640
  this._datalayer.state = r;
4615
4641
  var n = e ? Object.keys(e) : [],
4616
4642
  i = this._datalayer.markStateKeysUpdated(n),
4617
- o = !Kt(t, r);
4618
- (i || o) && (jt(this._datalayer.subscriptions, r), o && this._datalayer.syncToLocalStorage());
4643
+ o = !Nt(t, r);
4644
+ (i || o) && (Kt(this._datalayer.subscriptions, r), o && this._datalayer.syncToLocalStorage());
4619
4645
  }
4620
4646
  }, {
4621
4647
  key: "updateTokens",
@@ -4655,14 +4681,14 @@ var Nt = /*#__PURE__*/function () {
4655
4681
  return null;
4656
4682
  }
4657
4683
  }]);
4658
- return Nt;
4684
+ return zt;
4659
4685
  }();
4660
- var zt = /*#__PURE__*/function (_Nt) {
4661
- _inherits(zt, _Nt);
4662
- var _super3 = _createSuper(zt);
4663
- function zt() {
4686
+ var Ut = /*#__PURE__*/function (_zt) {
4687
+ _inherits(Ut, _zt);
4688
+ var _super3 = _createSuper(Ut);
4689
+ function Ut() {
4664
4690
  var _this8;
4665
- _classCallCheck(this, zt);
4691
+ _classCallCheck(this, Ut);
4666
4692
  _this8 = _super3.apply(this, arguments), _this8.updateMember = function (e) {
4667
4693
  return _this8.updateState({
4668
4694
  member: e
@@ -4683,12 +4709,12 @@ var zt = /*#__PURE__*/function (_Nt) {
4683
4709
  };
4684
4710
  return _this8;
4685
4711
  }
4686
- return _createClass(zt);
4687
- }(Nt);
4688
- var Ut = Symbol["for"]("stytch__internal_b2b");
4689
- var qt = /*#__PURE__*/_createClass(function qt(e, t) {
4712
+ return _createClass(Ut);
4713
+ }(zt);
4714
+ var qt = Symbol["for"]("stytch__internal_b2b");
4715
+ var Wt = /*#__PURE__*/_createClass(function Wt(e, t) {
4690
4716
  var _this9 = this;
4691
- _classCallCheck(this, qt);
4717
+ _classCallCheck(this, Wt);
4692
4718
  var r;
4693
4719
  !function (e) {
4694
4720
  if ("undefined" == typeof window) throw new Error("The ".concat(e, " is not compatible with server-side environments.\nIf using nextjs, use the create").concat(e, " method instead.\n```\n").concat("import { createStytchB2BHeadlessClient } from '@stytch/nextjs/b2b';\n \n const stytch = createStytchB2BHeadlessClient('public-token-...');\n ", "\n```\n"));
@@ -4705,9 +4731,9 @@ var qt = /*#__PURE__*/_createClass(function qt(e, t) {
4705
4731
  }
4706
4732
  };
4707
4733
  var o, s, a, c, u, l, d, h, p, _, f;
4708
- this._dataLayer = Ft(e, n), this._subscriptionService = new zt(e, this._dataLayer);
4709
- var m = new Ot(this._dataLayer, "passwords");
4710
- this._networkClient = new At(e, this._dataLayer, i.endpoints.sdkBackendURL, function () {
4734
+ this._dataLayer = jt(e, n), this._subscriptionService = new Ut(e, this._dataLayer);
4735
+ var m = new Et(this._dataLayer, "passwords");
4736
+ this._networkClient = new Tt(e, this._dataLayer, i.endpoints.sdkBackendURL, function () {
4711
4737
  var e, t, r, n;
4712
4738
  return {
4713
4739
  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,
@@ -4715,18 +4741,18 @@ var qt = /*#__PURE__*/_createClass(function qt(e, t) {
4715
4741
  };
4716
4742
  });
4717
4743
  var v = new Pt(e, this._networkClient, this._dataLayer),
4718
- b = new Ct(v.getAsync()),
4744
+ b = new At(v.getAsync()),
4719
4745
  g = new We(e, i.endpoints.dfpBackendURL, v.getAsync(), b.executeRecaptcha);
4720
- this.organization = new Xe(this._networkClient, this._subscriptionService), this.member = new Je(this._networkClient, this._subscriptionService), this.self = new Je(this._networkClient, this._subscriptionService), this.session = new Qe(this._networkClient, this._subscriptionService), this.magicLinks = new Ve(this._networkClient, this._subscriptionService, new Ot(this._dataLayer, "magic_links"), m, v.getAsync(), g), this.oauth = new Ze(this._networkClient, this._subscriptionService, new Ot(this._dataLayer, "oauth"), v.getAsync(), {
4746
+ this.organization = new Xe(this._networkClient, this._subscriptionService), this.member = new Je(this._networkClient, this._subscriptionService), this.self = new Je(this._networkClient, this._subscriptionService), this.session = new Qe(this._networkClient, this._subscriptionService), this.magicLinks = new Ve(this._networkClient, this._subscriptionService, new Et(this._dataLayer, "magic_links"), m, v.getAsync(), g), this.oauth = new Ze(this._networkClient, this._subscriptionService, new Et(this._dataLayer, "oauth"), v.getAsync(), {
4721
4747
  publicToken: e,
4722
4748
  testAPIURL: i.endpoints.testAPIURL,
4723
4749
  liveAPIURL: i.endpoints.liveAPIURL
4724
- }, g), this.sso = new $e(this._networkClient, this._subscriptionService, new Ot(this._dataLayer, "sso"), v.getAsync(), {
4750
+ }, g), this.sso = new $e(this._networkClient, this._subscriptionService, new Et(this._dataLayer, "sso"), v.getAsync(), {
4725
4751
  publicToken: e,
4726
4752
  testAPIURL: i.endpoints.testAPIURL,
4727
4753
  liveAPIURL: i.endpoints.liveAPIURL
4728
4754
  }), this.discovery = new et(this._networkClient, this._subscriptionService), this.passwords = new wt(this._networkClient, this._subscriptionService, m, v.getAsync(), g), this.otps = new tt(this._networkClient, this._subscriptionService, g), this.totp = new rt(this._networkClient, this._subscriptionService, g), this.recoveryCodes = new nt(this._networkClient, this._subscriptionService, g), this.rbac = new it(v.getSync(), v.getAsync(), this._subscriptionService), this._sessionManager = new ot(this._subscriptionService, this.session);
4729
- var y = new Et(this._networkClient);
4755
+ var y = new xt(this._networkClient);
4730
4756
  this._dataLayer.readSessionCookie().session_token && this._sessionManager.performBackgroundRefresh(), this._networkClient.logEvent({
4731
4757
  name: "b2b_sdk_instance_instantiated",
4732
4758
  details: {
@@ -4736,7 +4762,7 @@ var qt = /*#__PURE__*/_createClass(function qt(e, t) {
4736
4762
  }
4737
4763
  });
4738
4764
  (function (e, t) {
4739
- Object.assign(e, _defineProperty({}, Ut, t));
4765
+ Object.assign(e, _defineProperty({}, qt, t));
4740
4766
  })(this, {
4741
4767
  bootstrap: v,
4742
4768
  publicToken: e,
@@ -4745,4 +4771,4 @@ var qt = /*#__PURE__*/_createClass(function qt(e, t) {
4745
4771
  networkClient: this._networkClient
4746
4772
  });
4747
4773
  });
4748
- export { g as AuthFlowType, y as B2BOAuthProviders, b as B2BProducts, X as BiometricsFailedError, B as BiometricsUnavailableError, H as ChallengeSigningFailedError, N as DeviceCredentialsNotAllowedError, V as FailedCodeChallengeError, $ as FailedToDecryptDataError, I as InternalError, W as InvalidAuthorizationCredentialError, te as InvalidCredentialTypeError, Q as InvalidRedirectSchemeError, Z as InvalidStartUrlError, ne as JSONDataNotConvertibleToStringError, L as KeyInvalidatedError, M as KeystoreUnavailableError, re as MissingAttestationObjectError, q as MissingAuthorizationCredentialIDTokenError, z as MissingGoogleClientIDError, U as MissingPKCEError, G as MissingPublicKeyError, ee as MissingUrlError, F as NoBiometricsEnrolledError, R as NoBiometricsRegistrationError, D as NoCurrentSessionError, p as OAuthProviders, m as OTPMethods, f as OneTapPositions, oe as PasskeysInvalidEncoding, J as PasskeysUnsupportedError, h as Products, ie as RandomNumberGenerationFailed, k as SDKAPIUnreachableError, Y as SDKNotConfiguredError, E as StytchAPIError, O as StytchAPISchemaError, T as StytchAPIUnreachableError, qt as StytchB2BHeadlessClient, A as StytchError, v as StytchEventType, P as StytchSDKAPIError, x as StytchSDKError, S as StytchSDKSchemaError, w as StytchSDKUsageError, C as UNRECOVERABLE_ERROR_TYPES, j as UserCancellationError, K as UserLockedOutError, _ as Wallets, se as errorToStytchError };
4774
+ export { g as AuthFlowType, y as B2BOAuthProviders, b as B2BProducts, X as BiometricsFailedError, B as BiometricsUnavailableError, H as ChallengeSigningFailedError, N as DeviceCredentialsNotAllowedError, V as FailedCodeChallengeError, $ as FailedToDecryptDataError, I as InternalError, W as InvalidAuthorizationCredentialError, te as InvalidCredentialTypeError, Q as InvalidRedirectSchemeError, Z as InvalidStartUrlError, ne as JSONDataNotConvertibleToStringError, L as KeyInvalidatedError, M as KeystoreUnavailableError, re as MissingAttestationObjectError, q as MissingAuthorizationCredentialIDTokenError, z as MissingGoogleClientIDError, U as MissingPKCEError, G as MissingPublicKeyError, ee as MissingUrlError, F as NoBiometricsEnrolledError, R as NoBiometricsRegistrationError, D as NoCurrentSessionError, p as OAuthProviders, m as OTPMethods, f as OneTapPositions, oe as PasskeysInvalidEncoding, J as PasskeysUnsupportedError, h as Products, ie as RandomNumberGenerationFailed, k as SDKAPIUnreachableError, Y as SDKNotConfiguredError, E as StytchAPIError, O as StytchAPISchemaError, T as StytchAPIUnreachableError, Wt as StytchB2BHeadlessClient, A as StytchError, v as StytchEventType, P as StytchSDKAPIError, x as StytchSDKError, S as StytchSDKSchemaError, w as StytchSDKUsageError, C as UNRECOVERABLE_ERROR_TYPES, j as UserCancellationError, K as UserLockedOutError, _ as Wallets, se as errorToStytchError };