@stytch/nextjs 16.0.0 → 16.0.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.
- package/CHANGELOG.md +8 -0
- package/dist/b2b/index.headless.esm.js +32 -19
- package/dist/b2b/index.headless.js +32 -19
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @stytch/nextjs
|
|
2
2
|
|
|
3
|
+
## 16.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e6832cb: Fix an issue where `fromCache` would not update to `false` after cached data was refreshed
|
|
8
|
+
- Updated dependencies [e6832cb]
|
|
9
|
+
- @stytch/vanilla-js@4.1.1
|
|
10
|
+
|
|
3
11
|
## 16.0.0
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -4119,7 +4119,7 @@ var At = /*#__PURE__*/ function () {
|
|
|
4119
4119
|
},
|
|
4120
4120
|
sdk: {
|
|
4121
4121
|
identifier: "Stytch.js Javascript SDK",
|
|
4122
|
-
version: "4.1.
|
|
4122
|
+
version: "4.1.1"
|
|
4123
4123
|
}
|
|
4124
4124
|
});
|
|
4125
4125
|
}
|
|
@@ -4438,7 +4438,7 @@ var It = /*#__PURE__*/ function () {
|
|
|
4438
4438
|
removeItem: function removeItem(e) {
|
|
4439
4439
|
return sessionStorage.removeItem(Rt(_this4.publicToken, e));
|
|
4440
4440
|
}
|
|
4441
|
-
}, this.publicToken = e, this.state = null, 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);
|
|
4441
|
+
}, 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);
|
|
4442
4442
|
var r = localStorage.getItem(Rt(this.publicToken));
|
|
4443
4443
|
if (!r)
|
|
4444
4444
|
return;
|
|
@@ -4562,6 +4562,15 @@ var It = /*#__PURE__*/ function () {
|
|
|
4562
4562
|
value: function removeItem(e) {
|
|
4563
4563
|
return localStorage.removeItem(Rt(this.publicToken, e));
|
|
4564
4564
|
}
|
|
4565
|
+
}, {
|
|
4566
|
+
key: "markStateKeysUpdated",
|
|
4567
|
+
value: function markStateKeysUpdated(e) {
|
|
4568
|
+
var _this6 = this;
|
|
4569
|
+
var t = this.stateKeysUpdated.size;
|
|
4570
|
+
return e.forEach(function (e) {
|
|
4571
|
+
return _this6.stateKeysUpdated.add(e);
|
|
4572
|
+
}), t !== this.stateKeysUpdated.size;
|
|
4573
|
+
}
|
|
4565
4574
|
}], [{
|
|
4566
4575
|
key: "generateCookieOpts",
|
|
4567
4576
|
value: function generateCookieOpts(_ref4) {
|
|
@@ -4612,15 +4621,15 @@ var Lt = Symbol["for"]("__stytch_b2b_DataLayer"), Mt = function Mt(e, t) {
|
|
|
4612
4621
|
});
|
|
4613
4622
|
var Nt = /*#__PURE__*/ function () {
|
|
4614
4623
|
function Nt(e, t) {
|
|
4615
|
-
var
|
|
4624
|
+
var _this7 = this;
|
|
4616
4625
|
_classCallCheck(this, Nt);
|
|
4617
4626
|
this._publicToken = e, this._datalayer = t, this._listen = function (e) {
|
|
4618
|
-
if (e.key !== Rt(
|
|
4627
|
+
if (e.key !== Rt(_this7._publicToken))
|
|
4619
4628
|
return;
|
|
4620
4629
|
if (null === e.newValue || "null" === e.newValue)
|
|
4621
|
-
return void
|
|
4630
|
+
return void _this7.destroyState();
|
|
4622
4631
|
var t = JSON.parse(e.newValue);
|
|
4623
|
-
|
|
4632
|
+
_this7.updateState(t);
|
|
4624
4633
|
}, window.addEventListener("storage", this._listen);
|
|
4625
4634
|
var _this$_datalayer$read = this._datalayer.readSessionCookie(), r = _this$_datalayer$read.session_token;
|
|
4626
4635
|
r || this.destroyState();
|
|
@@ -4653,7 +4662,9 @@ var Nt = /*#__PURE__*/ function () {
|
|
|
4653
4662
|
key: "_updateStateAndTokensInternal",
|
|
4654
4663
|
value: function _updateStateAndTokensInternal(e) {
|
|
4655
4664
|
var t = this._datalayer.state, r = null === e.state ? null : Object.assign(Object.assign({}, this._datalayer.state), e.state);
|
|
4656
|
-
this._datalayer.state = r
|
|
4665
|
+
this._datalayer.state = r;
|
|
4666
|
+
var n = e.state ? Object.keys(e.state) : [];
|
|
4667
|
+
!this._datalayer.markStateKeysUpdated(n) && Ft(t, r) || jt(this._datalayer.subscriptions, r);
|
|
4657
4668
|
}
|
|
4658
4669
|
}, {
|
|
4659
4670
|
key: "updateStateAndTokens",
|
|
@@ -4664,7 +4675,9 @@ var Nt = /*#__PURE__*/ function () {
|
|
|
4664
4675
|
key: "updateState",
|
|
4665
4676
|
value: function updateState(e) {
|
|
4666
4677
|
var t = this._datalayer.state, r = null === e ? null : Object.assign(Object.assign({}, this._datalayer.state), e);
|
|
4667
|
-
this._datalayer.state = r
|
|
4678
|
+
this._datalayer.state = r;
|
|
4679
|
+
var n = e ? Object.keys(e) : [], i = this._datalayer.markStateKeysUpdated(n), o = !Ft(t, r);
|
|
4680
|
+
(i || o) && (jt(this._datalayer.subscriptions, r), o && this._datalayer.syncToLocalStorage());
|
|
4668
4681
|
}
|
|
4669
4682
|
}, {
|
|
4670
4683
|
key: "updateTokens",
|
|
@@ -4707,26 +4720,26 @@ var Kt = /*#__PURE__*/ function (_Nt) {
|
|
|
4707
4720
|
_inherits(Kt, _Nt);
|
|
4708
4721
|
var _super3 = _createSuper(Kt);
|
|
4709
4722
|
function Kt() {
|
|
4710
|
-
var
|
|
4723
|
+
var _this8;
|
|
4711
4724
|
_classCallCheck(this, Kt);
|
|
4712
|
-
|
|
4713
|
-
return
|
|
4725
|
+
_this8 = _super3.apply(this, arguments), _this8.updateMember = function (e) {
|
|
4726
|
+
return _this8.updateState({
|
|
4714
4727
|
member: e
|
|
4715
4728
|
});
|
|
4716
|
-
},
|
|
4729
|
+
}, _this8.getMember = function () {
|
|
4717
4730
|
var e, t;
|
|
4718
|
-
return null !== (t = null === (e =
|
|
4719
|
-
},
|
|
4731
|
+
return null !== (t = null === (e = _this8.getState()) || void 0 === e ? void 0 : e.member) && void 0 !== t ? t : null;
|
|
4732
|
+
}, _this8.getSession = function () {
|
|
4720
4733
|
var e, t;
|
|
4721
|
-
return null !== (t = null === (e =
|
|
4734
|
+
return null !== (t = null === (e = _this8.getState()) || void 0 === e ? void 0 : e.session) && void 0 !== t ? t : null;
|
|
4722
4735
|
};
|
|
4723
|
-
return
|
|
4736
|
+
return _this8;
|
|
4724
4737
|
}
|
|
4725
4738
|
return _createClass(Kt);
|
|
4726
4739
|
}(Nt);
|
|
4727
4740
|
var Ut = Symbol["for"]("stytch__internal_b2b");
|
|
4728
4741
|
var zt = /*#__PURE__*/ _createClass(function zt(e, t) {
|
|
4729
|
-
var
|
|
4742
|
+
var _this9 = this;
|
|
4730
4743
|
_classCallCheck(this, zt);
|
|
4731
4744
|
var r;
|
|
4732
4745
|
!function (e) {
|
|
@@ -4749,8 +4762,8 @@ var zt = /*#__PURE__*/ _createClass(function zt(e, t) {
|
|
|
4749
4762
|
this._networkClient = new At(e, this._dataLayer, i.endpoints.sdkBackendURL, function () {
|
|
4750
4763
|
var e, t, r, n;
|
|
4751
4764
|
return {
|
|
4752
|
-
stytch_member_id: null === (t = null === (e =
|
|
4753
|
-
stytch_member_session_id: null === (n = null === (r =
|
|
4765
|
+
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,
|
|
4766
|
+
stytch_member_session_id: null === (n = null === (r = _this9._dataLayer.state) || void 0 === r ? void 0 : r.session) || void 0 === n ? void 0 : n.member_session_id
|
|
4754
4767
|
};
|
|
4755
4768
|
});
|
|
4756
4769
|
var v = new St(e, this._networkClient, this._dataLayer), b = new Pt(v.getAsync()), g = new We(e, i.endpoints.dfpBackendURL, v.getAsync(), b.executeRecaptcha);
|
|
@@ -4123,7 +4123,7 @@ var At = /*#__PURE__*/ function () {
|
|
|
4123
4123
|
},
|
|
4124
4124
|
sdk: {
|
|
4125
4125
|
identifier: "Stytch.js Javascript SDK",
|
|
4126
|
-
version: "4.1.
|
|
4126
|
+
version: "4.1.1"
|
|
4127
4127
|
}
|
|
4128
4128
|
});
|
|
4129
4129
|
}
|
|
@@ -4442,7 +4442,7 @@ var It = /*#__PURE__*/ function () {
|
|
|
4442
4442
|
removeItem: function removeItem(e) {
|
|
4443
4443
|
return sessionStorage.removeItem(Rt(_this4.publicToken, e));
|
|
4444
4444
|
}
|
|
4445
|
-
}, this.publicToken = e, this.state = null, 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);
|
|
4445
|
+
}, 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);
|
|
4446
4446
|
var r = localStorage.getItem(Rt(this.publicToken));
|
|
4447
4447
|
if (!r)
|
|
4448
4448
|
return;
|
|
@@ -4566,6 +4566,15 @@ var It = /*#__PURE__*/ function () {
|
|
|
4566
4566
|
value: function removeItem(e) {
|
|
4567
4567
|
return localStorage.removeItem(Rt(this.publicToken, e));
|
|
4568
4568
|
}
|
|
4569
|
+
}, {
|
|
4570
|
+
key: "markStateKeysUpdated",
|
|
4571
|
+
value: function markStateKeysUpdated(e) {
|
|
4572
|
+
var _this6 = this;
|
|
4573
|
+
var t = this.stateKeysUpdated.size;
|
|
4574
|
+
return e.forEach(function (e) {
|
|
4575
|
+
return _this6.stateKeysUpdated.add(e);
|
|
4576
|
+
}), t !== this.stateKeysUpdated.size;
|
|
4577
|
+
}
|
|
4569
4578
|
}], [{
|
|
4570
4579
|
key: "generateCookieOpts",
|
|
4571
4580
|
value: function generateCookieOpts(_ref4) {
|
|
@@ -4616,15 +4625,15 @@ var Lt = Symbol["for"]("__stytch_b2b_DataLayer"), Mt = function Mt(e, t) {
|
|
|
4616
4625
|
});
|
|
4617
4626
|
var Nt = /*#__PURE__*/ function () {
|
|
4618
4627
|
function Nt(e, t) {
|
|
4619
|
-
var
|
|
4628
|
+
var _this7 = this;
|
|
4620
4629
|
_classCallCheck(this, Nt);
|
|
4621
4630
|
this._publicToken = e, this._datalayer = t, this._listen = function (e) {
|
|
4622
|
-
if (e.key !== Rt(
|
|
4631
|
+
if (e.key !== Rt(_this7._publicToken))
|
|
4623
4632
|
return;
|
|
4624
4633
|
if (null === e.newValue || "null" === e.newValue)
|
|
4625
|
-
return void
|
|
4634
|
+
return void _this7.destroyState();
|
|
4626
4635
|
var t = JSON.parse(e.newValue);
|
|
4627
|
-
|
|
4636
|
+
_this7.updateState(t);
|
|
4628
4637
|
}, window.addEventListener("storage", this._listen);
|
|
4629
4638
|
var _this$_datalayer$read = this._datalayer.readSessionCookie(), r = _this$_datalayer$read.session_token;
|
|
4630
4639
|
r || this.destroyState();
|
|
@@ -4657,7 +4666,9 @@ var Nt = /*#__PURE__*/ function () {
|
|
|
4657
4666
|
key: "_updateStateAndTokensInternal",
|
|
4658
4667
|
value: function _updateStateAndTokensInternal(e) {
|
|
4659
4668
|
var t = this._datalayer.state, r = null === e.state ? null : Object.assign(Object.assign({}, this._datalayer.state), e.state);
|
|
4660
|
-
this._datalayer.state = r
|
|
4669
|
+
this._datalayer.state = r;
|
|
4670
|
+
var n = e.state ? Object.keys(e.state) : [];
|
|
4671
|
+
!this._datalayer.markStateKeysUpdated(n) && Ft(t, r) || jt(this._datalayer.subscriptions, r);
|
|
4661
4672
|
}
|
|
4662
4673
|
}, {
|
|
4663
4674
|
key: "updateStateAndTokens",
|
|
@@ -4668,7 +4679,9 @@ var Nt = /*#__PURE__*/ function () {
|
|
|
4668
4679
|
key: "updateState",
|
|
4669
4680
|
value: function updateState(e) {
|
|
4670
4681
|
var t = this._datalayer.state, r = null === e ? null : Object.assign(Object.assign({}, this._datalayer.state), e);
|
|
4671
|
-
this._datalayer.state = r
|
|
4682
|
+
this._datalayer.state = r;
|
|
4683
|
+
var n = e ? Object.keys(e) : [], i = this._datalayer.markStateKeysUpdated(n), o = !Ft(t, r);
|
|
4684
|
+
(i || o) && (jt(this._datalayer.subscriptions, r), o && this._datalayer.syncToLocalStorage());
|
|
4672
4685
|
}
|
|
4673
4686
|
}, {
|
|
4674
4687
|
key: "updateTokens",
|
|
@@ -4711,26 +4724,26 @@ var Kt = /*#__PURE__*/ function (_Nt) {
|
|
|
4711
4724
|
_inherits(Kt, _Nt);
|
|
4712
4725
|
var _super3 = _createSuper(Kt);
|
|
4713
4726
|
function Kt() {
|
|
4714
|
-
var
|
|
4727
|
+
var _this8;
|
|
4715
4728
|
_classCallCheck(this, Kt);
|
|
4716
|
-
|
|
4717
|
-
return
|
|
4729
|
+
_this8 = _super3.apply(this, arguments), _this8.updateMember = function (e) {
|
|
4730
|
+
return _this8.updateState({
|
|
4718
4731
|
member: e
|
|
4719
4732
|
});
|
|
4720
|
-
},
|
|
4733
|
+
}, _this8.getMember = function () {
|
|
4721
4734
|
var e, t;
|
|
4722
|
-
return null !== (t = null === (e =
|
|
4723
|
-
},
|
|
4735
|
+
return null !== (t = null === (e = _this8.getState()) || void 0 === e ? void 0 : e.member) && void 0 !== t ? t : null;
|
|
4736
|
+
}, _this8.getSession = function () {
|
|
4724
4737
|
var e, t;
|
|
4725
|
-
return null !== (t = null === (e =
|
|
4738
|
+
return null !== (t = null === (e = _this8.getState()) || void 0 === e ? void 0 : e.session) && void 0 !== t ? t : null;
|
|
4726
4739
|
};
|
|
4727
|
-
return
|
|
4740
|
+
return _this8;
|
|
4728
4741
|
}
|
|
4729
4742
|
return _createClass(Kt);
|
|
4730
4743
|
}(Nt);
|
|
4731
4744
|
var Ut = Symbol["for"]("stytch__internal_b2b");
|
|
4732
4745
|
var zt = /*#__PURE__*/ _createClass(function zt(e, t) {
|
|
4733
|
-
var
|
|
4746
|
+
var _this9 = this;
|
|
4734
4747
|
_classCallCheck(this, zt);
|
|
4735
4748
|
var r;
|
|
4736
4749
|
!function (e) {
|
|
@@ -4753,8 +4766,8 @@ var zt = /*#__PURE__*/ _createClass(function zt(e, t) {
|
|
|
4753
4766
|
this._networkClient = new At(e, this._dataLayer, i.endpoints.sdkBackendURL, function () {
|
|
4754
4767
|
var e, t, r, n;
|
|
4755
4768
|
return {
|
|
4756
|
-
stytch_member_id: null === (t = null === (e =
|
|
4757
|
-
stytch_member_session_id: null === (n = null === (r =
|
|
4769
|
+
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,
|
|
4770
|
+
stytch_member_session_id: null === (n = null === (r = _this9._dataLayer.state) || void 0 === r ? void 0 : r.session) || void 0 === n ? void 0 : n.member_session_id
|
|
4758
4771
|
};
|
|
4759
4772
|
});
|
|
4760
4773
|
var v = new St(e, this._networkClient, this._dataLayer), b = new Pt(v.getAsync()), g = new We(e, i.endpoints.dfpBackendURL, v.getAsync(), b.executeRecaptcha);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stytch/nextjs",
|
|
3
|
-
"version": "16.0.
|
|
3
|
+
"version": "16.0.1",
|
|
4
4
|
"description": "Stytch's official Next.js Library",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"author": "Stytch",
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@babel/runtime": "7.18.6",
|
|
25
|
-
"@stytch/vanilla-js": "4.1.
|
|
25
|
+
"@stytch/vanilla-js": "4.1.1",
|
|
26
26
|
"@testing-library/react": "14.0.0",
|
|
27
27
|
"eslint-config-custom": "0.0.1",
|
|
28
28
|
"react-dom": ">= 17.0.2",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"typescript": "4.7.4"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@stytch/vanilla-js": "^4.1.
|
|
34
|
+
"@stytch/vanilla-js": "^4.1.1",
|
|
35
35
|
"react": ">= 17.0.2",
|
|
36
36
|
"react-dom": ">= 17.0.2"
|
|
37
37
|
},
|