@stytch/vanilla-js 4.4.1 → 4.4.3
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 +16 -0
- package/dist/b2b/index.esm.js +47 -6
- package/dist/b2b/index.headless.esm.js +47 -6
- package/dist/b2b/index.headless.js +47 -6
- package/dist/b2b/index.js +47 -6
- package/dist/index.esm.js +10 -6
- package/dist/index.headless.esm.js +10 -6
- package/dist/index.headless.js +94 -90
- package/dist/index.js +10 -6
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @stytch/vanilla-js
|
|
2
2
|
|
|
3
|
+
## 4.4.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [521fc22]
|
|
8
|
+
- @stytch/core@2.6.0
|
|
9
|
+
|
|
10
|
+
## 4.4.2
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 119952e: Fix an issue where ISTs were being deleted before they could be used
|
|
15
|
+
- Updated dependencies [56fd625]
|
|
16
|
+
- Updated dependencies [119952e]
|
|
17
|
+
- @stytch/core@2.5.1
|
|
18
|
+
|
|
3
19
|
## 4.4.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/b2b/index.esm.js
CHANGED
|
@@ -1917,6 +1917,25 @@ var qe = Promise.resolve({
|
|
|
1917
1917
|
}
|
|
1918
1918
|
}, e, this);
|
|
1919
1919
|
}));
|
|
1920
|
+
}, this.deleteMFATOTP = function () {
|
|
1921
|
+
return we(r, void 0, void 0, de().mark(function e() {
|
|
1922
|
+
var t;
|
|
1923
|
+
return de().wrap(function (e) {
|
|
1924
|
+
for (;;) switch (e.prev = e.next) {
|
|
1925
|
+
case 0:
|
|
1926
|
+
return e.next = 2, this._networkClient.fetchSDK({
|
|
1927
|
+
url: "/b2b/organizations/members/deleteTOTP",
|
|
1928
|
+
errorMessage: "Failed to delete member totp.",
|
|
1929
|
+
method: "DELETE"
|
|
1930
|
+
});
|
|
1931
|
+
case 2:
|
|
1932
|
+
return t = e.sent, this._subscriptionService.updateMember(t.member), e.abrupt("return", t);
|
|
1933
|
+
case 5:
|
|
1934
|
+
case "end":
|
|
1935
|
+
return e.stop();
|
|
1936
|
+
}
|
|
1937
|
+
}, e, this);
|
|
1938
|
+
}));
|
|
1920
1939
|
}, this.deletePassword = function (e) {
|
|
1921
1940
|
return we(r, void 0, void 0, de().mark(function t() {
|
|
1922
1941
|
var n;
|
|
@@ -2365,6 +2384,23 @@ var qe = Promise.resolve({
|
|
|
2365
2384
|
}, t, this);
|
|
2366
2385
|
}));
|
|
2367
2386
|
},
|
|
2387
|
+
deleteMFATOTP: function deleteMFATOTP(e) {
|
|
2388
|
+
return we(r, void 0, void 0, de().mark(function t() {
|
|
2389
|
+
return de().wrap(function (t) {
|
|
2390
|
+
for (;;) switch (t.prev = t.next) {
|
|
2391
|
+
case 0:
|
|
2392
|
+
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
2393
|
+
url: "/b2b/organizations/members/totp/".concat(e),
|
|
2394
|
+
errorMessage: "Failed to delete member totp.",
|
|
2395
|
+
method: "DELETE"
|
|
2396
|
+
}));
|
|
2397
|
+
case 1:
|
|
2398
|
+
case "end":
|
|
2399
|
+
return t.stop();
|
|
2400
|
+
}
|
|
2401
|
+
}, t, this);
|
|
2402
|
+
}));
|
|
2403
|
+
},
|
|
2368
2404
|
"delete": function _delete(e) {
|
|
2369
2405
|
return we(r, void 0, void 0, de().mark(function t() {
|
|
2370
2406
|
return de().wrap(function (t) {
|
|
@@ -2686,7 +2722,7 @@ var qe = Promise.resolve({
|
|
|
2686
2722
|
}
|
|
2687
2723
|
return t.abrupt("return", this.authenticate(e));
|
|
2688
2724
|
case 17:
|
|
2689
|
-
throw C.includes(t.t0.error_type) && this._subscriptionService.
|
|
2725
|
+
throw C.includes(t.t0.error_type) && this._subscriptionService.destroySession(), t.t0;
|
|
2690
2726
|
case 19:
|
|
2691
2727
|
case "end":
|
|
2692
2728
|
return t.stop();
|
|
@@ -3217,7 +3253,7 @@ var tt = he(function e(t, n) {
|
|
|
3217
3253
|
})["catch"](function (t) {
|
|
3218
3254
|
Fe("Session background refresh failed. Signalling to app that user is logged out.", {
|
|
3219
3255
|
error: t
|
|
3220
|
-
}), e._subscriptionService.
|
|
3256
|
+
}), e._subscriptionService.destroySession();
|
|
3221
3257
|
});
|
|
3222
3258
|
}
|
|
3223
3259
|
}, {
|
|
@@ -3714,6 +3750,7 @@ var wt = /*#__PURE__*/function () {
|
|
|
3714
3750
|
existing_password: e.existing_password,
|
|
3715
3751
|
new_password: e.new_password,
|
|
3716
3752
|
locale: e.locale,
|
|
3753
|
+
session_duration_minutes: e.session_duration_minutes,
|
|
3717
3754
|
captcha_token: n,
|
|
3718
3755
|
dfp_telemetry_id: t
|
|
3719
3756
|
},
|
|
@@ -4063,7 +4100,7 @@ var xt = /*#__PURE__*/function () {
|
|
|
4063
4100
|
},
|
|
4064
4101
|
sdk: {
|
|
4065
4102
|
identifier: "Stytch.js Javascript SDK",
|
|
4066
|
-
version: "4.4.
|
|
4103
|
+
version: "4.4.3"
|
|
4067
4104
|
}
|
|
4068
4105
|
});
|
|
4069
4106
|
}
|
|
@@ -4587,13 +4624,12 @@ var Qt = /*#__PURE__*/function () {
|
|
|
4587
4624
|
_classCallCheck(this, Qt);
|
|
4588
4625
|
this._publicToken = e, this._datalayer = t, this._listen = function (e) {
|
|
4589
4626
|
if (e.key !== Lt(_this7._publicToken)) return;
|
|
4590
|
-
|
|
4591
|
-
var t = JSON.parse(e.newValue);
|
|
4627
|
+
var t = null === e.newValue || "null" === e.newValue ? null : JSON.parse(e.newValue);
|
|
4592
4628
|
_this7.updateState(t);
|
|
4593
4629
|
}, window.addEventListener("storage", this._listen);
|
|
4594
4630
|
var _this$_datalayer$read = this._datalayer.readSessionCookie(),
|
|
4595
4631
|
n = _this$_datalayer$read.session_token;
|
|
4596
|
-
n || this.
|
|
4632
|
+
n || this.destroySession();
|
|
4597
4633
|
}
|
|
4598
4634
|
_createClass(Qt, [{
|
|
4599
4635
|
key: "getTokens",
|
|
@@ -4621,6 +4657,11 @@ var Qt = /*#__PURE__*/function () {
|
|
|
4621
4657
|
intermediate_session_token: null
|
|
4622
4658
|
});
|
|
4623
4659
|
}
|
|
4660
|
+
}, {
|
|
4661
|
+
key: "destroySession",
|
|
4662
|
+
value: function destroySession() {
|
|
4663
|
+
this._datalayer.removeSessionCookie(), this.updateState(null);
|
|
4664
|
+
}
|
|
4624
4665
|
}, {
|
|
4625
4666
|
key: "_updateStateAndTokensInternal",
|
|
4626
4667
|
value: function _updateStateAndTokensInternal(e) {
|
|
@@ -1915,6 +1915,25 @@ var Ye = Promise.resolve({
|
|
|
1915
1915
|
}
|
|
1916
1916
|
}, e, this);
|
|
1917
1917
|
}));
|
|
1918
|
+
}, this.deleteMFATOTP = function () {
|
|
1919
|
+
return we(n, void 0, void 0, de().mark(function e() {
|
|
1920
|
+
var t;
|
|
1921
|
+
return de().wrap(function (e) {
|
|
1922
|
+
for (;;) switch (e.prev = e.next) {
|
|
1923
|
+
case 0:
|
|
1924
|
+
return e.next = 2, this._networkClient.fetchSDK({
|
|
1925
|
+
url: "/b2b/organizations/members/deleteTOTP",
|
|
1926
|
+
errorMessage: "Failed to delete member totp.",
|
|
1927
|
+
method: "DELETE"
|
|
1928
|
+
});
|
|
1929
|
+
case 2:
|
|
1930
|
+
return t = e.sent, this._subscriptionService.updateMember(t.member), e.abrupt("return", t);
|
|
1931
|
+
case 5:
|
|
1932
|
+
case "end":
|
|
1933
|
+
return e.stop();
|
|
1934
|
+
}
|
|
1935
|
+
}, e, this);
|
|
1936
|
+
}));
|
|
1918
1937
|
}, this.deletePassword = function (e) {
|
|
1919
1938
|
return we(n, void 0, void 0, de().mark(function t() {
|
|
1920
1939
|
var r;
|
|
@@ -2363,6 +2382,23 @@ var Ye = Promise.resolve({
|
|
|
2363
2382
|
}, t, this);
|
|
2364
2383
|
}));
|
|
2365
2384
|
},
|
|
2385
|
+
deleteMFATOTP: function deleteMFATOTP(e) {
|
|
2386
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2387
|
+
return de().wrap(function (t) {
|
|
2388
|
+
for (;;) switch (t.prev = t.next) {
|
|
2389
|
+
case 0:
|
|
2390
|
+
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
2391
|
+
url: "/b2b/organizations/members/totp/".concat(e),
|
|
2392
|
+
errorMessage: "Failed to delete member totp.",
|
|
2393
|
+
method: "DELETE"
|
|
2394
|
+
}));
|
|
2395
|
+
case 1:
|
|
2396
|
+
case "end":
|
|
2397
|
+
return t.stop();
|
|
2398
|
+
}
|
|
2399
|
+
}, t, this);
|
|
2400
|
+
}));
|
|
2401
|
+
},
|
|
2366
2402
|
"delete": function _delete(e) {
|
|
2367
2403
|
return we(n, void 0, void 0, de().mark(function t() {
|
|
2368
2404
|
return de().wrap(function (t) {
|
|
@@ -2684,7 +2720,7 @@ var Ye = Promise.resolve({
|
|
|
2684
2720
|
}
|
|
2685
2721
|
return t.abrupt("return", this.authenticate(e));
|
|
2686
2722
|
case 17:
|
|
2687
|
-
throw C.includes(t.t0.error_type) && this._subscriptionService.
|
|
2723
|
+
throw C.includes(t.t0.error_type) && this._subscriptionService.destroySession(), t.t0;
|
|
2688
2724
|
case 19:
|
|
2689
2725
|
case "end":
|
|
2690
2726
|
return t.stop();
|
|
@@ -3215,7 +3251,7 @@ var tt = pe(function e(t, r) {
|
|
|
3215
3251
|
})["catch"](function (t) {
|
|
3216
3252
|
Ke("Session background refresh failed. Signalling to app that user is logged out.", {
|
|
3217
3253
|
error: t
|
|
3218
|
-
}), e._subscriptionService.
|
|
3254
|
+
}), e._subscriptionService.destroySession();
|
|
3219
3255
|
});
|
|
3220
3256
|
}
|
|
3221
3257
|
}, {
|
|
@@ -3712,6 +3748,7 @@ var wt = /*#__PURE__*/function () {
|
|
|
3712
3748
|
existing_password: e.existing_password,
|
|
3713
3749
|
new_password: e.new_password,
|
|
3714
3750
|
locale: e.locale,
|
|
3751
|
+
session_duration_minutes: e.session_duration_minutes,
|
|
3715
3752
|
captcha_token: r,
|
|
3716
3753
|
dfp_telemetry_id: t
|
|
3717
3754
|
},
|
|
@@ -4061,7 +4098,7 @@ var Tt = /*#__PURE__*/function () {
|
|
|
4061
4098
|
},
|
|
4062
4099
|
sdk: {
|
|
4063
4100
|
identifier: "Stytch.js Javascript SDK",
|
|
4064
|
-
version: "4.4.
|
|
4101
|
+
version: "4.4.3"
|
|
4065
4102
|
}
|
|
4066
4103
|
});
|
|
4067
4104
|
}
|
|
@@ -4584,13 +4621,12 @@ var zt = /*#__PURE__*/function () {
|
|
|
4584
4621
|
_classCallCheck(this, zt);
|
|
4585
4622
|
this._publicToken = e, this._datalayer = t, this._listen = function (e) {
|
|
4586
4623
|
if (e.key !== Bt(_this7._publicToken)) return;
|
|
4587
|
-
|
|
4588
|
-
var t = JSON.parse(e.newValue);
|
|
4624
|
+
var t = null === e.newValue || "null" === e.newValue ? null : JSON.parse(e.newValue);
|
|
4589
4625
|
_this7.updateState(t);
|
|
4590
4626
|
}, window.addEventListener("storage", this._listen);
|
|
4591
4627
|
var _this$_datalayer$read = this._datalayer.readSessionCookie(),
|
|
4592
4628
|
r = _this$_datalayer$read.session_token;
|
|
4593
|
-
r || this.
|
|
4629
|
+
r || this.destroySession();
|
|
4594
4630
|
}
|
|
4595
4631
|
_createClass(zt, [{
|
|
4596
4632
|
key: "getTokens",
|
|
@@ -4618,6 +4654,11 @@ var zt = /*#__PURE__*/function () {
|
|
|
4618
4654
|
intermediate_session_token: null
|
|
4619
4655
|
});
|
|
4620
4656
|
}
|
|
4657
|
+
}, {
|
|
4658
|
+
key: "destroySession",
|
|
4659
|
+
value: function destroySession() {
|
|
4660
|
+
this._datalayer.removeSessionCookie(), this.updateState(null);
|
|
4661
|
+
}
|
|
4621
4662
|
}, {
|
|
4622
4663
|
key: "_updateStateAndTokensInternal",
|
|
4623
4664
|
value: function _updateStateAndTokensInternal(e) {
|
|
@@ -1847,6 +1847,25 @@ var Fe = Promise.resolve({
|
|
|
1847
1847
|
}
|
|
1848
1848
|
}, e, this);
|
|
1849
1849
|
}));
|
|
1850
|
+
}, this.deleteMFATOTP = function () {
|
|
1851
|
+
return he(n, void 0, void 0, te().mark(function e() {
|
|
1852
|
+
var t;
|
|
1853
|
+
return te().wrap(function (e) {
|
|
1854
|
+
for (;;) switch (e.prev = e.next) {
|
|
1855
|
+
case 0:
|
|
1856
|
+
return e.next = 2, this._networkClient.fetchSDK({
|
|
1857
|
+
url: "/b2b/organizations/members/deleteTOTP",
|
|
1858
|
+
errorMessage: "Failed to delete member totp.",
|
|
1859
|
+
method: "DELETE"
|
|
1860
|
+
});
|
|
1861
|
+
case 2:
|
|
1862
|
+
return t = e.sent, this._subscriptionService.updateMember(t.member), e.abrupt("return", t);
|
|
1863
|
+
case 5:
|
|
1864
|
+
case "end":
|
|
1865
|
+
return e.stop();
|
|
1866
|
+
}
|
|
1867
|
+
}, e, this);
|
|
1868
|
+
}));
|
|
1850
1869
|
}, this.deletePassword = function (e) {
|
|
1851
1870
|
return he(n, void 0, void 0, te().mark(function t() {
|
|
1852
1871
|
var r;
|
|
@@ -2295,6 +2314,23 @@ var Fe = Promise.resolve({
|
|
|
2295
2314
|
}, t, this);
|
|
2296
2315
|
}));
|
|
2297
2316
|
},
|
|
2317
|
+
deleteMFATOTP: function deleteMFATOTP(e) {
|
|
2318
|
+
return he(n, void 0, void 0, te().mark(function t() {
|
|
2319
|
+
return te().wrap(function (t) {
|
|
2320
|
+
for (;;) switch (t.prev = t.next) {
|
|
2321
|
+
case 0:
|
|
2322
|
+
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
2323
|
+
url: "/b2b/organizations/members/totp/".concat(e),
|
|
2324
|
+
errorMessage: "Failed to delete member totp.",
|
|
2325
|
+
method: "DELETE"
|
|
2326
|
+
}));
|
|
2327
|
+
case 1:
|
|
2328
|
+
case "end":
|
|
2329
|
+
return t.stop();
|
|
2330
|
+
}
|
|
2331
|
+
}, t, this);
|
|
2332
|
+
}));
|
|
2333
|
+
},
|
|
2298
2334
|
"delete": function _delete(e) {
|
|
2299
2335
|
return he(n, void 0, void 0, te().mark(function t() {
|
|
2300
2336
|
return te().wrap(function (t) {
|
|
@@ -2616,7 +2652,7 @@ var Fe = Promise.resolve({
|
|
|
2616
2652
|
}
|
|
2617
2653
|
return t.abrupt("return", this.authenticate(e));
|
|
2618
2654
|
case 17:
|
|
2619
|
-
throw m.includes(t.t0.error_type) && this._subscriptionService.
|
|
2655
|
+
throw m.includes(t.t0.error_type) && this._subscriptionService.destroySession(), t.t0;
|
|
2620
2656
|
case 19:
|
|
2621
2657
|
case "end":
|
|
2622
2658
|
return t.stop();
|
|
@@ -3147,7 +3183,7 @@ var Ge = ne(function e(t, r) {
|
|
|
3147
3183
|
})["catch"](function (t) {
|
|
3148
3184
|
Oe("Session background refresh failed. Signalling to app that user is logged out.", {
|
|
3149
3185
|
error: t
|
|
3150
|
-
}), e._subscriptionService.
|
|
3186
|
+
}), e._subscriptionService.destroySession();
|
|
3151
3187
|
});
|
|
3152
3188
|
}
|
|
3153
3189
|
}, {
|
|
@@ -3644,6 +3680,7 @@ var ht = /*#__PURE__*/function () {
|
|
|
3644
3680
|
existing_password: e.existing_password,
|
|
3645
3681
|
new_password: e.new_password,
|
|
3646
3682
|
locale: e.locale,
|
|
3683
|
+
session_duration_minutes: e.session_duration_minutes,
|
|
3647
3684
|
captcha_token: r,
|
|
3648
3685
|
dfp_telemetry_id: t
|
|
3649
3686
|
},
|
|
@@ -3993,7 +4030,7 @@ var vt = /*#__PURE__*/function () {
|
|
|
3993
4030
|
},
|
|
3994
4031
|
sdk: {
|
|
3995
4032
|
identifier: "Stytch.js Javascript SDK",
|
|
3996
|
-
version: "4.4.
|
|
4033
|
+
version: "4.4.3"
|
|
3997
4034
|
}
|
|
3998
4035
|
});
|
|
3999
4036
|
}
|
|
@@ -4516,13 +4553,12 @@ var Dt = /*#__PURE__*/function () {
|
|
|
4516
4553
|
_classCallCheck(this, Dt);
|
|
4517
4554
|
this._publicToken = e, this._datalayer = t, this._listen = function (e) {
|
|
4518
4555
|
if (e.key !== Pt(_this7._publicToken)) return;
|
|
4519
|
-
|
|
4520
|
-
var t = JSON.parse(e.newValue);
|
|
4556
|
+
var t = null === e.newValue || "null" === e.newValue ? null : JSON.parse(e.newValue);
|
|
4521
4557
|
_this7.updateState(t);
|
|
4522
4558
|
}, window.addEventListener("storage", this._listen);
|
|
4523
4559
|
var _this$_datalayer$read = this._datalayer.readSessionCookie(),
|
|
4524
4560
|
r = _this$_datalayer$read.session_token;
|
|
4525
|
-
r || this.
|
|
4561
|
+
r || this.destroySession();
|
|
4526
4562
|
}
|
|
4527
4563
|
_createClass(Dt, [{
|
|
4528
4564
|
key: "getTokens",
|
|
@@ -4550,6 +4586,11 @@ var Dt = /*#__PURE__*/function () {
|
|
|
4550
4586
|
intermediate_session_token: null
|
|
4551
4587
|
});
|
|
4552
4588
|
}
|
|
4589
|
+
}, {
|
|
4590
|
+
key: "destroySession",
|
|
4591
|
+
value: function destroySession() {
|
|
4592
|
+
this._datalayer.removeSessionCookie(), this.updateState(null);
|
|
4593
|
+
}
|
|
4553
4594
|
}, {
|
|
4554
4595
|
key: "_updateStateAndTokensInternal",
|
|
4555
4596
|
value: function _updateStateAndTokensInternal(e) {
|
package/dist/b2b/index.js
CHANGED
|
@@ -1849,6 +1849,25 @@ var je = Promise.resolve({
|
|
|
1849
1849
|
}
|
|
1850
1850
|
}, e, this);
|
|
1851
1851
|
}));
|
|
1852
|
+
}, this.deleteMFATOTP = function () {
|
|
1853
|
+
return pe(r, void 0, void 0, te().mark(function e() {
|
|
1854
|
+
var t;
|
|
1855
|
+
return te().wrap(function (e) {
|
|
1856
|
+
for (;;) switch (e.prev = e.next) {
|
|
1857
|
+
case 0:
|
|
1858
|
+
return e.next = 2, this._networkClient.fetchSDK({
|
|
1859
|
+
url: "/b2b/organizations/members/deleteTOTP",
|
|
1860
|
+
errorMessage: "Failed to delete member totp.",
|
|
1861
|
+
method: "DELETE"
|
|
1862
|
+
});
|
|
1863
|
+
case 2:
|
|
1864
|
+
return t = e.sent, this._subscriptionService.updateMember(t.member), e.abrupt("return", t);
|
|
1865
|
+
case 5:
|
|
1866
|
+
case "end":
|
|
1867
|
+
return e.stop();
|
|
1868
|
+
}
|
|
1869
|
+
}, e, this);
|
|
1870
|
+
}));
|
|
1852
1871
|
}, this.deletePassword = function (e) {
|
|
1853
1872
|
return pe(r, void 0, void 0, te().mark(function t() {
|
|
1854
1873
|
var n;
|
|
@@ -2297,6 +2316,23 @@ var je = Promise.resolve({
|
|
|
2297
2316
|
}, t, this);
|
|
2298
2317
|
}));
|
|
2299
2318
|
},
|
|
2319
|
+
deleteMFATOTP: function deleteMFATOTP(e) {
|
|
2320
|
+
return pe(r, void 0, void 0, te().mark(function t() {
|
|
2321
|
+
return te().wrap(function (t) {
|
|
2322
|
+
for (;;) switch (t.prev = t.next) {
|
|
2323
|
+
case 0:
|
|
2324
|
+
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
2325
|
+
url: "/b2b/organizations/members/totp/".concat(e),
|
|
2326
|
+
errorMessage: "Failed to delete member totp.",
|
|
2327
|
+
method: "DELETE"
|
|
2328
|
+
}));
|
|
2329
|
+
case 1:
|
|
2330
|
+
case "end":
|
|
2331
|
+
return t.stop();
|
|
2332
|
+
}
|
|
2333
|
+
}, t, this);
|
|
2334
|
+
}));
|
|
2335
|
+
},
|
|
2300
2336
|
"delete": function _delete(e) {
|
|
2301
2337
|
return pe(r, void 0, void 0, te().mark(function t() {
|
|
2302
2338
|
return te().wrap(function (t) {
|
|
@@ -2618,7 +2654,7 @@ var je = Promise.resolve({
|
|
|
2618
2654
|
}
|
|
2619
2655
|
return t.abrupt("return", this.authenticate(e));
|
|
2620
2656
|
case 17:
|
|
2621
|
-
throw _.includes(t.t0.error_type) && this._subscriptionService.
|
|
2657
|
+
throw _.includes(t.t0.error_type) && this._subscriptionService.destroySession(), t.t0;
|
|
2622
2658
|
case 19:
|
|
2623
2659
|
case "end":
|
|
2624
2660
|
return t.stop();
|
|
@@ -3149,7 +3185,7 @@ var He = re(function e(t, n) {
|
|
|
3149
3185
|
})["catch"](function (t) {
|
|
3150
3186
|
Pe("Session background refresh failed. Signalling to app that user is logged out.", {
|
|
3151
3187
|
error: t
|
|
3152
|
-
}), e._subscriptionService.
|
|
3188
|
+
}), e._subscriptionService.destroySession();
|
|
3153
3189
|
});
|
|
3154
3190
|
}
|
|
3155
3191
|
}, {
|
|
@@ -3646,6 +3682,7 @@ var pt = /*#__PURE__*/function () {
|
|
|
3646
3682
|
existing_password: e.existing_password,
|
|
3647
3683
|
new_password: e.new_password,
|
|
3648
3684
|
locale: e.locale,
|
|
3685
|
+
session_duration_minutes: e.session_duration_minutes,
|
|
3649
3686
|
captcha_token: n,
|
|
3650
3687
|
dfp_telemetry_id: t
|
|
3651
3688
|
},
|
|
@@ -3995,7 +4032,7 @@ var gt = /*#__PURE__*/function () {
|
|
|
3995
4032
|
},
|
|
3996
4033
|
sdk: {
|
|
3997
4034
|
identifier: "Stytch.js Javascript SDK",
|
|
3998
|
-
version: "4.4.
|
|
4035
|
+
version: "4.4.3"
|
|
3999
4036
|
}
|
|
4000
4037
|
});
|
|
4001
4038
|
}
|
|
@@ -4519,13 +4556,12 @@ var It = /*#__PURE__*/function () {
|
|
|
4519
4556
|
_classCallCheck(this, It);
|
|
4520
4557
|
this._publicToken = e, this._datalayer = t, this._listen = function (e) {
|
|
4521
4558
|
if (e.key !== Et(_this7._publicToken)) return;
|
|
4522
|
-
|
|
4523
|
-
var t = JSON.parse(e.newValue);
|
|
4559
|
+
var t = null === e.newValue || "null" === e.newValue ? null : JSON.parse(e.newValue);
|
|
4524
4560
|
_this7.updateState(t);
|
|
4525
4561
|
}, window.addEventListener("storage", this._listen);
|
|
4526
4562
|
var _this$_datalayer$read = this._datalayer.readSessionCookie(),
|
|
4527
4563
|
n = _this$_datalayer$read.session_token;
|
|
4528
|
-
n || this.
|
|
4564
|
+
n || this.destroySession();
|
|
4529
4565
|
}
|
|
4530
4566
|
_createClass(It, [{
|
|
4531
4567
|
key: "getTokens",
|
|
@@ -4553,6 +4589,11 @@ var It = /*#__PURE__*/function () {
|
|
|
4553
4589
|
intermediate_session_token: null
|
|
4554
4590
|
});
|
|
4555
4591
|
}
|
|
4592
|
+
}, {
|
|
4593
|
+
key: "destroySession",
|
|
4594
|
+
value: function destroySession() {
|
|
4595
|
+
this._datalayer.removeSessionCookie(), this.updateState(null);
|
|
4596
|
+
}
|
|
4556
4597
|
}, {
|
|
4557
4598
|
key: "_updateStateAndTokensInternal",
|
|
4558
4599
|
value: function _updateStateAndTokensInternal(e) {
|
package/dist/index.esm.js
CHANGED
|
@@ -1923,7 +1923,7 @@ var tt = fe(function e(t, n) {
|
|
|
1923
1923
|
}
|
|
1924
1924
|
return t.abrupt("return", this.authenticate(e));
|
|
1925
1925
|
case 17:
|
|
1926
|
-
throw k.includes(t.t0.error_type) && this._subscriptionService.
|
|
1926
|
+
throw k.includes(t.t0.error_type) && this._subscriptionService.destroySession(), t.t0;
|
|
1927
1927
|
case 19:
|
|
1928
1928
|
case "end":
|
|
1929
1929
|
return t.stop();
|
|
@@ -3474,7 +3474,7 @@ var Pt = function () {
|
|
|
3474
3474
|
})["catch"](function (t) {
|
|
3475
3475
|
Ze("Session background refresh failed. Signalling to app that user is logged out.", {
|
|
3476
3476
|
error: t
|
|
3477
|
-
}), e._subscriptionService.
|
|
3477
|
+
}), e._subscriptionService.destroySession();
|
|
3478
3478
|
});
|
|
3479
3479
|
}
|
|
3480
3480
|
}, {
|
|
@@ -3833,7 +3833,7 @@ var Qt = /*#__PURE__*/function () {
|
|
|
3833
3833
|
},
|
|
3834
3834
|
sdk: {
|
|
3835
3835
|
identifier: "Stytch.js Javascript SDK",
|
|
3836
|
-
version: "4.4.
|
|
3836
|
+
version: "4.4.3"
|
|
3837
3837
|
}
|
|
3838
3838
|
});
|
|
3839
3839
|
}
|
|
@@ -4594,13 +4594,12 @@ var ln = /*#__PURE__*/function () {
|
|
|
4594
4594
|
_classCallCheck(this, ln);
|
|
4595
4595
|
this._publicToken = e, this._datalayer = t, this._listen = function (e) {
|
|
4596
4596
|
if (e.key !== tn(_this10._publicToken)) return;
|
|
4597
|
-
|
|
4598
|
-
var t = JSON.parse(e.newValue);
|
|
4597
|
+
var t = null === e.newValue || "null" === e.newValue ? null : JSON.parse(e.newValue);
|
|
4599
4598
|
_this10.updateState(t);
|
|
4600
4599
|
}, window.addEventListener("storage", this._listen);
|
|
4601
4600
|
var _this$_datalayer$read = this._datalayer.readSessionCookie(),
|
|
4602
4601
|
n = _this$_datalayer$read.session_token;
|
|
4603
|
-
n || this.
|
|
4602
|
+
n || this.destroySession();
|
|
4604
4603
|
}
|
|
4605
4604
|
_createClass(ln, [{
|
|
4606
4605
|
key: "getTokens",
|
|
@@ -4628,6 +4627,11 @@ var ln = /*#__PURE__*/function () {
|
|
|
4628
4627
|
intermediate_session_token: null
|
|
4629
4628
|
});
|
|
4630
4629
|
}
|
|
4630
|
+
}, {
|
|
4631
|
+
key: "destroySession",
|
|
4632
|
+
value: function destroySession() {
|
|
4633
|
+
this._datalayer.removeSessionCookie(), this.updateState(null);
|
|
4634
|
+
}
|
|
4631
4635
|
}, {
|
|
4632
4636
|
key: "_updateStateAndTokensInternal",
|
|
4633
4637
|
value: function _updateStateAndTokensInternal(e) {
|
|
@@ -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.
|
|
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.
|
|
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.
|
|
3818
|
+
version: "4.4.3"
|
|
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
|
-
|
|
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.
|
|
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) {
|