@stytch/vanilla-js 4.7.2 → 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 CHANGED
@@ -1,5 +1,12 @@
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
+
3
10
  ## 4.7.2
4
11
 
5
12
  ### Patch Changes
@@ -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, s = Object.assign({
1926
- pkce_code_verifier: null == r ? void 0 : r.code_verifier,
1927
- dfp_telemetry_id: i,
1928
- captcha_token: a
1929
- }, t), n.next = 11, this._networkClient.retriableFetchSDK({
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 11:
1945
+ case 23:
1937
1946
  return c = n.sent, e.clearPKPair(), n.abrupt("return", c);
1938
- case 14:
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.next = 12, this._networkClient.retriableFetchSDK({
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: Object.assign(Object.assign({
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: this.dfpProtectedAuth.retryWithCaptchaAndDFP
2204
- });
2205
- case 12:
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 16:
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 = 12, this._networkClient.retriableFetchSDK({
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: Object.assign({
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: this.dfpProtectedAuth.retryWithCaptchaAndDFP
2608
- });
2609
- case 12:
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 16:
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 = 12, this._networkClient.retriableFetchSDK({
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
- organization_id: e.organization_id,
3056
- email_address: e.email_address,
3057
- password: e.password,
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 15:
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 = 12, this._networkClient.retriableFetchSDK({
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
- password_reset_token: e.password_reset_token,
3143
- password: e.password,
3144
- session_duration_minutes: e.session_duration_minutes,
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 16:
3213
+ case 33:
3169
3214
  case "end":
3170
3215
  return t.stop();
3171
3216
  }
@@ -4080,7 +4125,7 @@ var wt = /*#__PURE__*/function () {
4080
4125
  },
4081
4126
  sdk: {
4082
4127
  identifier: "Stytch.js Javascript SDK",
4083
- version: "4.7.2"
4128
+ version: "4.7.3"
4084
4129
  }
4085
4130
  });
4086
4131
  }