@stytch/vanilla-js 4.7.1 → 4.7.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 +15 -0
- package/dist/b2b/index.esm.js +120 -68
- package/dist/b2b/index.headless.esm.js +181 -129
- package/dist/b2b/index.headless.js +158 -106
- package/dist/b2b/index.js +120 -68
- package/dist/index.esm.js +18 -11
- package/dist/index.headless.esm.js +31 -24
- package/dist/index.headless.js +125 -118
- package/dist/index.js +18 -11
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @stytch/vanilla-js
|
|
2
2
|
|
|
3
|
+
## 4.7.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [b7f2e1d]
|
|
8
|
+
- @stytch/core@2.10.0
|
|
9
|
+
|
|
10
|
+
## 4.7.2
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- e83a832: Added DFP functionality to users search in passwords screen
|
|
15
|
+
- Updated dependencies [e83a832]
|
|
16
|
+
- @stytch/core@2.9.1
|
|
17
|
+
|
|
3
18
|
## 4.7.1
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/dist/b2b/index.esm.js
CHANGED
|
@@ -1922,20 +1922,29 @@ var Xe = Promise.resolve({
|
|
|
1922
1922
|
case 2:
|
|
1923
1923
|
return r = n.sent, n.next = 5, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
1924
1924
|
case 5:
|
|
1925
|
-
return o = n.sent, i = o.dfp_telemetry_id, a = o.captcha_token,
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1925
|
+
return o = n.sent, i = o.dfp_telemetry_id, a = o.captcha_token, n.t0 = Object, n.t1 = null == r ? void 0 : r.code_verifier, n.t2 = i, n.t3 = a, n.next = 14, this._subscriptionService.getIntermediateSessionToken();
|
|
1926
|
+
case 14:
|
|
1927
|
+
if (n.t4 = n.sent, n.t4) {
|
|
1928
|
+
n.next = 17;
|
|
1929
|
+
break;
|
|
1930
|
+
}
|
|
1931
|
+
n.t4 = void 0;
|
|
1932
|
+
case 17:
|
|
1933
|
+
return n.t5 = n.t4, n.t6 = {
|
|
1934
|
+
pkce_code_verifier: n.t1,
|
|
1935
|
+
dfp_telemetry_id: n.t2,
|
|
1936
|
+
captcha_token: n.t3,
|
|
1937
|
+
intermediate_session_token: n.t5
|
|
1938
|
+
}, n.t7 = t, s = n.t0.assign.call(n.t0, n.t6, n.t7), n.next = 23, this._networkClient.retriableFetchSDK({
|
|
1930
1939
|
url: "/b2b/magic_links/authenticate",
|
|
1931
1940
|
body: s,
|
|
1932
1941
|
errorMessage: "Failed to authenticate token",
|
|
1933
1942
|
method: "POST",
|
|
1934
1943
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
1935
1944
|
});
|
|
1936
|
-
case
|
|
1945
|
+
case 23:
|
|
1937
1946
|
return c = n.sent, e.clearPKPair(), n.abrupt("return", c);
|
|
1938
|
-
case
|
|
1947
|
+
case 26:
|
|
1939
1948
|
case "end":
|
|
1940
1949
|
return n.stop();
|
|
1941
1950
|
}
|
|
@@ -2190,19 +2199,28 @@ var Xe = Promise.resolve({
|
|
|
2190
2199
|
case 3:
|
|
2191
2200
|
return (n = t.sent) || $e("No code verifier found in local storage for SSO flow.\nConsider using stytch.sso.start() to add PKCE to your SSO flows for added security.\nSee https://stytch.com/docs/oauth#guides_pkce for more information."), t.next = 7, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2192
2201
|
case 7:
|
|
2193
|
-
return r = t.sent, o = r.dfp_telemetry_id, i = r.captcha_token, t.
|
|
2202
|
+
return r = t.sent, o = r.dfp_telemetry_id, i = r.captcha_token, t.t0 = this._networkClient, t.t1 = Object, t.t2 = Object.assign({
|
|
2203
|
+
pkce_code_verifier: null == n ? void 0 : n.code_verifier
|
|
2204
|
+
}, e), t.t3 = o, t.t4 = i, t.next = 17, this._subscriptionService.getIntermediateSessionToken();
|
|
2205
|
+
case 17:
|
|
2206
|
+
if (t.t5 = t.sent, t.t5) {
|
|
2207
|
+
t.next = 20;
|
|
2208
|
+
break;
|
|
2209
|
+
}
|
|
2210
|
+
t.t5 = void 0;
|
|
2211
|
+
case 20:
|
|
2212
|
+
return t.t6 = t.t5, t.t7 = {
|
|
2213
|
+
dfp_telemetry_id: t.t3,
|
|
2214
|
+
captcha_token: t.t4,
|
|
2215
|
+
intermediate_session_token: t.t6
|
|
2216
|
+
}, t.t8 = t.t1.assign.call(t.t1, t.t2, t.t7), t.t9 = this.dfpProtectedAuth.retryWithCaptchaAndDFP, t.t10 = {
|
|
2194
2217
|
url: "/b2b/sso/authenticate",
|
|
2195
2218
|
method: "POST",
|
|
2196
|
-
body:
|
|
2197
|
-
pkce_code_verifier: null == n ? void 0 : n.code_verifier
|
|
2198
|
-
}, e), {
|
|
2199
|
-
dfp_telemetry_id: o,
|
|
2200
|
-
captcha_token: i
|
|
2201
|
-
}),
|
|
2219
|
+
body: t.t8,
|
|
2202
2220
|
errorMessage: "Failed to authenticate token",
|
|
2203
|
-
retryCallback:
|
|
2204
|
-
});
|
|
2205
|
-
case
|
|
2221
|
+
retryCallback: t.t9
|
|
2222
|
+
}, t.next = 27, t.t0.retriableFetchSDK.call(t.t0, t.t10);
|
|
2223
|
+
case 27:
|
|
2206
2224
|
return a = t.sent, this._pkceManager.clearPKPair(), a.member_session ? this._subscriptionService.updateStateAndTokens({
|
|
2207
2225
|
state: {
|
|
2208
2226
|
session: a.member_session,
|
|
@@ -2218,7 +2236,7 @@ var Xe = Promise.resolve({
|
|
|
2218
2236
|
session_jwt: null,
|
|
2219
2237
|
intermediate_session_token: a.intermediate_session_token
|
|
2220
2238
|
}), t.abrupt("return", a);
|
|
2221
|
-
case
|
|
2239
|
+
case 31:
|
|
2222
2240
|
case "end":
|
|
2223
2241
|
return t.stop();
|
|
2224
2242
|
}
|
|
@@ -2595,18 +2613,27 @@ var Xe = Promise.resolve({
|
|
|
2595
2613
|
case 3:
|
|
2596
2614
|
return (n = t.sent) || $e("No code verifier found in local storage for OAuth flow.\nConsider using stytch.oauth.$provider.start() to add PKCE to your OAuth flows for added security.\nSee https://stytch.com/docs/oauth#guides_pkce for more information."), t.next = 7, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2597
2615
|
case 7:
|
|
2598
|
-
return r = t.sent, o = r.dfp_telemetry_id, i = r.captcha_token, t.next =
|
|
2616
|
+
return r = t.sent, o = r.dfp_telemetry_id, i = r.captcha_token, t.t0 = this._networkClient, t.t1 = Object, t.t2 = null == n ? void 0 : n.code_verifier, t.t3 = o, t.t4 = i, t.next = 17, this._subscriptionService.getIntermediateSessionToken();
|
|
2617
|
+
case 17:
|
|
2618
|
+
if (t.t5 = t.sent, t.t5) {
|
|
2619
|
+
t.next = 20;
|
|
2620
|
+
break;
|
|
2621
|
+
}
|
|
2622
|
+
t.t5 = void 0;
|
|
2623
|
+
case 20:
|
|
2624
|
+
return t.t6 = t.t5, t.t7 = {
|
|
2625
|
+
pkce_code_verifier: t.t2,
|
|
2626
|
+
dfp_telemetry_id: t.t3,
|
|
2627
|
+
captcha_token: t.t4,
|
|
2628
|
+
intermediate_session_token: t.t6
|
|
2629
|
+
}, t.t8 = e, t.t9 = t.t1.assign.call(t.t1, t.t7, t.t8), t.t10 = this.dfpProtectedAuth.retryWithCaptchaAndDFP, t.t11 = {
|
|
2599
2630
|
url: "/b2b/oauth/authenticate",
|
|
2600
2631
|
method: "POST",
|
|
2601
|
-
body:
|
|
2602
|
-
pkce_code_verifier: null == n ? void 0 : n.code_verifier,
|
|
2603
|
-
dfp_telemetry_id: o,
|
|
2604
|
-
captcha_token: i
|
|
2605
|
-
}, e),
|
|
2632
|
+
body: t.t9,
|
|
2606
2633
|
errorMessage: "Failed to authenticate token",
|
|
2607
|
-
retryCallback:
|
|
2608
|
-
});
|
|
2609
|
-
case
|
|
2634
|
+
retryCallback: t.t10
|
|
2635
|
+
}, t.next = 28, t.t0.retriableFetchSDK.call(t.t0, t.t11);
|
|
2636
|
+
case 28:
|
|
2610
2637
|
return a = t.sent, this._pkceManager.clearPKPair(), a.member_session ? this._subscriptionService.updateStateAndTokens({
|
|
2611
2638
|
state: {
|
|
2612
2639
|
session: a.member_session,
|
|
@@ -2622,7 +2649,7 @@ var Xe = Promise.resolve({
|
|
|
2622
2649
|
session_jwt: null,
|
|
2623
2650
|
intermediate_session_token: a.intermediate_session_token
|
|
2624
2651
|
}), t.abrupt("return", a);
|
|
2625
|
-
case
|
|
2652
|
+
case 32:
|
|
2626
2653
|
case "end":
|
|
2627
2654
|
return t.stop();
|
|
2628
2655
|
}
|
|
@@ -3047,23 +3074,32 @@ var Xe = Promise.resolve({
|
|
|
3047
3074
|
case 3:
|
|
3048
3075
|
return n = t.sent, r = null == n ? void 0 : n.code_verifier, t.next = 7, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3049
3076
|
case 7:
|
|
3050
|
-
return o = t.sent, i = o.dfp_telemetry_id, a = o.captcha_token, t.next =
|
|
3077
|
+
return o = t.sent, i = o.dfp_telemetry_id, a = o.captcha_token, t.t0 = this._networkClient, t.t1 = e.organization_id, t.t2 = e.email_address, t.t3 = e.password, t.t4 = e.session_duration_minutes, t.t5 = e.locale, t.t6 = a, t.t7 = i, t.t8 = r, t.next = 21, this._subscriptionService.getIntermediateSessionToken();
|
|
3078
|
+
case 21:
|
|
3079
|
+
if (t.t9 = t.sent, t.t9) {
|
|
3080
|
+
t.next = 24;
|
|
3081
|
+
break;
|
|
3082
|
+
}
|
|
3083
|
+
t.t9 = void 0;
|
|
3084
|
+
case 24:
|
|
3085
|
+
return t.t10 = t.t9, t.t11 = {
|
|
3086
|
+
organization_id: t.t1,
|
|
3087
|
+
email_address: t.t2,
|
|
3088
|
+
password: t.t3,
|
|
3089
|
+
session_duration_minutes: t.t4,
|
|
3090
|
+
locale: t.t5,
|
|
3091
|
+
captcha_token: t.t6,
|
|
3092
|
+
dfp_telemetry_id: t.t7,
|
|
3093
|
+
code_verifier: t.t8,
|
|
3094
|
+
intermediate_session_token: t.t10
|
|
3095
|
+
}, t.t12 = this.dfpProtectedAuth.retryWithCaptchaAndDFP, t.t13 = {
|
|
3051
3096
|
url: "/b2b/passwords/authenticate",
|
|
3052
3097
|
method: "POST",
|
|
3053
3098
|
errorMessage: "Failed to authenticate password.",
|
|
3054
|
-
body:
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
session_duration_minutes: e.session_duration_minutes,
|
|
3059
|
-
locale: e.locale,
|
|
3060
|
-
captcha_token: a,
|
|
3061
|
-
dfp_telemetry_id: i,
|
|
3062
|
-
code_verifier: r
|
|
3063
|
-
},
|
|
3064
|
-
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
3065
|
-
});
|
|
3066
|
-
case 12:
|
|
3099
|
+
body: t.t11,
|
|
3100
|
+
retryCallback: t.t12
|
|
3101
|
+
}, t.next = 30, t.t0.retriableFetchSDK.call(t.t0, t.t13);
|
|
3102
|
+
case 30:
|
|
3067
3103
|
return (s = t.sent).member_session ? this._subscriptionService.updateStateAndTokens({
|
|
3068
3104
|
state: {
|
|
3069
3105
|
session: s.member_session,
|
|
@@ -3079,7 +3115,7 @@ var Xe = Promise.resolve({
|
|
|
3079
3115
|
session_jwt: null,
|
|
3080
3116
|
intermediate_session_token: s.intermediate_session_token
|
|
3081
3117
|
}), t.abrupt("return", s);
|
|
3082
|
-
case
|
|
3118
|
+
case 33:
|
|
3083
3119
|
case "end":
|
|
3084
3120
|
return t.stop();
|
|
3085
3121
|
}
|
|
@@ -3134,22 +3170,31 @@ var Xe = Promise.resolve({
|
|
|
3134
3170
|
case 3:
|
|
3135
3171
|
return n = t.sent, r = n.dfp_telemetry_id, o = n.captcha_token, t.next = 8, this._pkceManager.getPKPair();
|
|
3136
3172
|
case 8:
|
|
3137
|
-
return i = t.sent, a = null == i ? void 0 : i.code_verifier, t.next =
|
|
3173
|
+
return i = t.sent, a = null == i ? void 0 : i.code_verifier, t.t0 = this._networkClient, t.t1 = e.password_reset_token, t.t2 = e.password, t.t3 = e.session_duration_minutes, t.t4 = e.locale, t.t5 = o, t.t6 = r, t.t7 = a, t.next = 20, this._subscriptionService.getIntermediateSessionToken();
|
|
3174
|
+
case 20:
|
|
3175
|
+
if (t.t8 = t.sent, t.t8) {
|
|
3176
|
+
t.next = 23;
|
|
3177
|
+
break;
|
|
3178
|
+
}
|
|
3179
|
+
t.t8 = void 0;
|
|
3180
|
+
case 23:
|
|
3181
|
+
return t.t9 = t.t8, t.t10 = {
|
|
3182
|
+
password_reset_token: t.t1,
|
|
3183
|
+
password: t.t2,
|
|
3184
|
+
session_duration_minutes: t.t3,
|
|
3185
|
+
locale: t.t4,
|
|
3186
|
+
captcha_token: t.t5,
|
|
3187
|
+
dfp_telemetry_id: t.t6,
|
|
3188
|
+
code_verifier: t.t7,
|
|
3189
|
+
intermediate_session_token: t.t9
|
|
3190
|
+
}, t.t11 = this.dfpProtectedAuth.retryWithCaptchaAndDFP, t.t12 = {
|
|
3138
3191
|
url: "/b2b/passwords/email/reset",
|
|
3139
3192
|
method: "POST",
|
|
3140
3193
|
errorMessage: "Failed to reset password.",
|
|
3141
|
-
body:
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
locale: e.locale,
|
|
3146
|
-
captcha_token: o,
|
|
3147
|
-
dfp_telemetry_id: r,
|
|
3148
|
-
code_verifier: a
|
|
3149
|
-
},
|
|
3150
|
-
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
3151
|
-
});
|
|
3152
|
-
case 12:
|
|
3194
|
+
body: t.t10,
|
|
3195
|
+
retryCallback: t.t11
|
|
3196
|
+
}, t.next = 29, t.t0.retriableFetchSDK.call(t.t0, t.t12);
|
|
3197
|
+
case 29:
|
|
3153
3198
|
return s = t.sent, this._pkceManager.clearPKPair(), s.member_session ? this._subscriptionService.updateStateAndTokens({
|
|
3154
3199
|
state: {
|
|
3155
3200
|
session: s.member_session,
|
|
@@ -3165,7 +3210,7 @@ var Xe = Promise.resolve({
|
|
|
3165
3210
|
session_jwt: null,
|
|
3166
3211
|
intermediate_session_token: s.intermediate_session_token
|
|
3167
3212
|
}), t.abrupt("return", s);
|
|
3168
|
-
case
|
|
3213
|
+
case 33:
|
|
3169
3214
|
case "end":
|
|
3170
3215
|
return t.stop();
|
|
3171
3216
|
}
|
|
@@ -3641,19 +3686,26 @@ var Xe = Promise.resolve({
|
|
|
3641
3686
|
}]), e;
|
|
3642
3687
|
}(),
|
|
3643
3688
|
mt = function () {
|
|
3644
|
-
function e(t) {
|
|
3645
|
-
ve(this, e), this._networkClient = t;
|
|
3689
|
+
function e(t, n) {
|
|
3690
|
+
ve(this, e), this._networkClient = t, this.dfpProtectedAuth = n;
|
|
3646
3691
|
}
|
|
3647
3692
|
return _e(e, [{
|
|
3648
3693
|
key: "searchUser",
|
|
3649
3694
|
value: function value(e) {
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3695
|
+
var t = this;
|
|
3696
|
+
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha().then(function (n) {
|
|
3697
|
+
var r = n.dfp_telemetry_id,
|
|
3698
|
+
o = n.captcha_token;
|
|
3699
|
+
return t._networkClient.fetchSDK({
|
|
3700
|
+
url: "/users/search",
|
|
3701
|
+
method: "POST",
|
|
3702
|
+
body: {
|
|
3703
|
+
email: e,
|
|
3704
|
+
dfp_telemetry_id: r,
|
|
3705
|
+
captcha_token: o
|
|
3706
|
+
},
|
|
3707
|
+
errorMessage: "Error searching for user ".concat(e)
|
|
3708
|
+
});
|
|
3657
3709
|
});
|
|
3658
3710
|
}
|
|
3659
3711
|
}, {
|
|
@@ -4073,7 +4125,7 @@ var wt = /*#__PURE__*/function () {
|
|
|
4073
4125
|
},
|
|
4074
4126
|
sdk: {
|
|
4075
4127
|
identifier: "Stytch.js Javascript SDK",
|
|
4076
|
-
version: "4.7.
|
|
4128
|
+
version: "4.7.3"
|
|
4077
4129
|
}
|
|
4078
4130
|
});
|
|
4079
4131
|
}
|
|
@@ -4741,7 +4793,7 @@ var $t = /*#__PURE__*/_createClass(function $t(e, t) {
|
|
|
4741
4793
|
testAPIURL: o.endpoints.testAPIURL,
|
|
4742
4794
|
liveAPIURL: o.endpoints.liveAPIURL
|
|
4743
4795
|
}), this.discovery = new at(this._networkClient, this._subscriptionService), this.passwords = new ct(this._networkClient, this._subscriptionService, i, a.getAsync(), c), this.otps = new lt(this._networkClient, this._subscriptionService, c), this.totp = new ut(this._networkClient, this._subscriptionService, c), this.recoveryCodes = new dt(this._networkClient, this._subscriptionService, c), this.rbac = new pt(a.getSync(), a.getAsync(), this._subscriptionService), this._sessionManager = new ft(this._subscriptionService, this.session);
|
|
4744
|
-
var u = new mt(this._networkClient);
|
|
4796
|
+
var u = new mt(this._networkClient, c);
|
|
4745
4797
|
this._dataLayer.readSessionCookie().session_token && this._sessionManager.performBackgroundRefresh(), this._networkClient.logEvent({
|
|
4746
4798
|
name: "b2b_sdk_instance_instantiated",
|
|
4747
4799
|
details: {
|