@stytch/vanilla-js 4.4.0 → 4.4.2

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.
@@ -1914,7 +1914,7 @@ var Qe = fe(function e(t, r) {
1914
1914
  }
1915
1915
  return t.abrupt("return", this.authenticate(e));
1916
1916
  case 17:
1917
- throw T.includes(t.t0.error_type) && this._subscriptionService.destroyState(), t.t0;
1917
+ throw T.includes(t.t0.error_type) && this._subscriptionService.destroySession(), t.t0;
1918
1918
  case 19:
1919
1919
  case "end":
1920
1920
  return t.stop();
@@ -3465,7 +3465,7 @@ var Dt = function () {
3465
3465
  })["catch"](function (t) {
3466
3466
  We("Session background refresh failed. Signalling to app that user is logged out.", {
3467
3467
  error: t
3468
- }), e._subscriptionService.destroyState();
3468
+ }), e._subscriptionService.destroySession();
3469
3469
  });
3470
3470
  }
3471
3471
  }, {
@@ -3815,7 +3815,7 @@ var Nt = /*#__PURE__*/function () {
3815
3815
  },
3816
3816
  sdk: {
3817
3817
  identifier: "Stytch.js Javascript SDK",
3818
- version: "4.4.0"
3818
+ version: "4.4.2"
3819
3819
  }
3820
3820
  });
3821
3821
  }
@@ -4543,13 +4543,12 @@ var tr = /*#__PURE__*/function () {
4543
4543
  _classCallCheck(this, tr);
4544
4544
  this._publicToken = e, this._datalayer = t, this._listen = function (e) {
4545
4545
  if (e.key !== Vt(_this10._publicToken)) return;
4546
- if (null === e.newValue || "null" === e.newValue) return void _this10.destroyState();
4547
- var t = JSON.parse(e.newValue);
4546
+ var t = null === e.newValue || "null" === e.newValue ? null : JSON.parse(e.newValue);
4548
4547
  _this10.updateState(t);
4549
4548
  }, window.addEventListener("storage", this._listen);
4550
4549
  var _this$_datalayer$read = this._datalayer.readSessionCookie(),
4551
4550
  r = _this$_datalayer$read.session_token;
4552
- r || this.destroyState();
4551
+ r || this.destroySession();
4553
4552
  }
4554
4553
  _createClass(tr, [{
4555
4554
  key: "getTokens",
@@ -4577,6 +4576,11 @@ var tr = /*#__PURE__*/function () {
4577
4576
  intermediate_session_token: null
4578
4577
  });
4579
4578
  }
4579
+ }, {
4580
+ key: "destroySession",
4581
+ value: function destroySession() {
4582
+ this._datalayer.removeSessionCookie(), this.updateState(null);
4583
+ }
4580
4584
  }, {
4581
4585
  key: "_updateStateAndTokensInternal",
4582
4586
  value: function _updateStateAndTokensInternal(e) {