@stytch/vanilla-js 5.3.1 → 5.5.0

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/adminPortal/components/DeleteConnection.d.ts +5 -2
  3. package/dist/adminPortal/components/Select.d.ts +2 -0
  4. package/dist/adminPortal/index.esm.js +2 -2
  5. package/dist/adminPortal/index.js +2 -2
  6. package/dist/adminPortal/scim/AdminPortalSCIM.d.ts +11 -1
  7. package/dist/adminPortal/scim/SCIMConnectionDangerZoneSection.d.ts +5 -0
  8. package/dist/adminPortal/scim/SCIMConnectionDetailsSection.d.ts +5 -0
  9. package/dist/adminPortal/scim/SCIMConnectionRoleAssignmentsSection.d.ts +7 -0
  10. package/dist/adminPortal/scim/SCIMConnectionTokenRotationSection.d.ts +5 -0
  11. package/dist/adminPortal/scim/mountAdminPortalSCIM.d.ts +1 -1
  12. package/dist/adminPortal/sso/AdminPortalSSO.d.ts +2 -2
  13. package/dist/adminPortal/sso/IdpInfo.d.ts +6 -2
  14. package/dist/adminPortal/sso/RoleAssignmentsSection.d.ts +2 -2
  15. package/dist/adminPortal/sso/SSONewConnectionConfigureScreen.d.ts +3 -3
  16. package/dist/adminPortal/sso/SSORouter.d.ts +7 -7
  17. package/dist/adminPortal/sso/TaggedConnection.d.ts +5 -2
  18. package/dist/adminPortal/utils/Connection.d.ts +1 -1
  19. package/dist/adminPortal/utils/ConnectionType.d.ts +1 -1
  20. package/dist/adminPortal/utils/FeatureStateComponent.d.ts +10 -0
  21. package/dist/adminPortal/utils/getFeatureState.d.ts +9 -0
  22. package/dist/adminPortal/utils/getSsoRoleAssignments.d.ts +8 -0
  23. package/dist/adminPortal/utils/prependAsterisks.d.ts +1 -0
  24. package/dist/adminPortal/utils/useAdminPortalConfig.d.ts +4 -3
  25. package/dist/adminPortal/utils/useMutateScimConnection.d.ts +1 -1
  26. package/dist/adminPortal/utils/useMutateSsoConnection.d.ts +2 -5
  27. package/dist/b2b/index.esm.js +979 -1137
  28. package/dist/b2b/index.headless.esm.js +3 -3
  29. package/dist/b2b/index.headless.js +2 -2
  30. package/dist/b2b/index.js +971 -1129
  31. package/dist/{extractErrorMessage-Ch-qCHrd.js → extractErrorMessage-CW4Nxx1B.js} +1 -1
  32. package/dist/{extractErrorMessage-m6TJ9iVT.js → extractErrorMessage-Ca4zQC5N.js} +1 -1
  33. package/dist/index.esm.js +1 -1
  34. package/dist/index.headless.esm.js +28 -28
  35. package/dist/index.headless.js +28 -28
  36. package/dist/index.js +1 -1
  37. package/dist/{internal-DA5LySQi.js → internal-2fj7jjLQ.js} +746 -702
  38. package/dist/{internal-k7t3AQud.js → internal-C29Dtv6A.js} +746 -702
  39. package/package.json +15 -16
@@ -1408,7 +1408,7 @@ function baseFetchSDK(_ref2) {
1408
1408
  _context2.next = 13;
1409
1409
  break;
1410
1410
  }
1411
- throw new StytchAPIUnreachableError('Unable to contact the Stytch servers. Are you online?');
1411
+ throw new StytchAPIUnreachableError('Unable to contact our servers.');
1412
1412
  case 13:
1413
1413
  throw _context2.t0;
1414
1414
  case 14:
@@ -1425,7 +1425,7 @@ function baseFetchSDK(_ref2) {
1425
1425
  case 22:
1426
1426
  _context2.prev = 22;
1427
1427
  _context2.t1 = _context2["catch"](15);
1428
- throw new StytchAPIUnreachableError('Invalid JSON response from the Stytch servers.');
1428
+ throw new StytchAPIUnreachableError('Invalid JSON response from our servers.');
1429
1429
  case 25:
1430
1430
  if (!(resp.status !== 200 && ((_a = resp.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.includes('application/json')))) {
1431
1431
  _context2.next = 38;
@@ -1461,7 +1461,7 @@ function baseFetchSDK(_ref2) {
1461
1461
  case 44:
1462
1462
  _context2.prev = 44;
1463
1463
  _context2.t3 = _context2["catch"](38);
1464
- throw new StytchAPIUnreachableError('Invalid response from the Stytch servers.');
1464
+ throw new StytchAPIUnreachableError('Invalid response from our servers.');
1465
1465
  case 47:
1466
1466
  if (!respData.includes('Captcha required')) {
1467
1467
  _context2.next = 49;
@@ -1469,7 +1469,7 @@ function baseFetchSDK(_ref2) {
1469
1469
  }
1470
1470
  throw new RetriableError(RetriableErrorType.RequiredCatcha);
1471
1471
  case 49:
1472
- throw new StytchAPIUnreachableError('Invalid response from the Stytch servers.');
1472
+ throw new StytchAPIUnreachableError('Invalid response from our servers.');
1473
1473
  case 50:
1474
1474
  case "end":
1475
1475
  return _context2.stop();
@@ -2856,65 +2856,109 @@ var HeadlessB2BSSOClient = /*#__PURE__*/function () {
2856
2856
  }));
2857
2857
  }
2858
2858
  };
2859
+ this.external = {
2860
+ createConnection: function createConnection(data) {
2861
+ return __awaiter$1(_this11, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee79() {
2862
+ return _regeneratorRuntime().wrap(function _callee79$(_context79) {
2863
+ while (1) switch (_context79.prev = _context79.next) {
2864
+ case 0:
2865
+ _context79.next = 2;
2866
+ return this._networkClient.fetchSDK({
2867
+ url: '/b2b/sso/external',
2868
+ method: 'POST',
2869
+ body: data,
2870
+ errorMessage: 'Failed to create External Connection.'
2871
+ });
2872
+ case 2:
2873
+ return _context79.abrupt("return", _context79.sent);
2874
+ case 3:
2875
+ case "end":
2876
+ return _context79.stop();
2877
+ }
2878
+ }, _callee79, this);
2879
+ }));
2880
+ },
2881
+ updateConnection: function updateConnection(data) {
2882
+ return __awaiter$1(_this11, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee80() {
2883
+ return _regeneratorRuntime().wrap(function _callee80$(_context80) {
2884
+ while (1) switch (_context80.prev = _context80.next) {
2885
+ case 0:
2886
+ _context80.next = 2;
2887
+ return this._networkClient.fetchSDK({
2888
+ url: "/b2b/sso/external/".concat(data.connection_id),
2889
+ method: 'PUT',
2890
+ body: data,
2891
+ errorMessage: 'Failed to update External Connection.'
2892
+ });
2893
+ case 2:
2894
+ return _context80.abrupt("return", _context80.sent);
2895
+ case 3:
2896
+ case "end":
2897
+ return _context80.stop();
2898
+ }
2899
+ }, _callee80, this);
2900
+ }));
2901
+ }
2902
+ };
2859
2903
  }
2860
2904
  _createClass(HeadlessB2BSSOClient, [{
2861
2905
  key: "authenticate",
2862
2906
  value: function authenticate(options) {
2863
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee79() {
2907
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee81() {
2864
2908
  var keyPair, _yield$this$dfpProtec21, dfp_telemetry_id, captcha_token, resp;
2865
- return _regeneratorRuntime().wrap(function _callee79$(_context79) {
2866
- while (1) switch (_context79.prev = _context79.next) {
2909
+ return _regeneratorRuntime().wrap(function _callee81$(_context81) {
2910
+ while (1) switch (_context81.prev = _context81.next) {
2867
2911
  case 0:
2868
2912
  validate('stytch.sso.authenticate').isString('sso_token', options.sso_token).isNumber('session_duration_minutes', options.session_duration_minutes).isOptionalString('locale', options.locale);
2869
- _context79.next = 3;
2913
+ _context81.next = 3;
2870
2914
  return this._pkceManager.getPKPair();
2871
2915
  case 3:
2872
- keyPair = _context79.sent;
2916
+ keyPair = _context81.sent;
2873
2917
  if (!keyPair) {
2874
2918
  logger.warn('No code verifier found in local storage for SSO flow.\n' + 'Consider using stytch.sso.start() to add PKCE to your SSO flows for added security.\n' + 'See https://stytch.com/docs/oauth#guides_pkce for more information.');
2875
2919
  }
2876
- _context79.next = 7;
2920
+ _context81.next = 7;
2877
2921
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
2878
2922
  case 7:
2879
- _yield$this$dfpProtec21 = _context79.sent;
2923
+ _yield$this$dfpProtec21 = _context81.sent;
2880
2924
  dfp_telemetry_id = _yield$this$dfpProtec21.dfp_telemetry_id;
2881
2925
  captcha_token = _yield$this$dfpProtec21.captcha_token;
2882
- _context79.t0 = this._networkClient;
2883
- _context79.t1 = Object;
2884
- _context79.t2 = Object.assign({
2926
+ _context81.t0 = this._networkClient;
2927
+ _context81.t1 = Object;
2928
+ _context81.t2 = Object.assign({
2885
2929
  pkce_code_verifier: keyPair === null || keyPair === void 0 ? void 0 : keyPair.code_verifier
2886
2930
  }, options);
2887
- _context79.t3 = dfp_telemetry_id;
2888
- _context79.t4 = captcha_token;
2889
- _context79.next = 17;
2931
+ _context81.t3 = dfp_telemetry_id;
2932
+ _context81.t4 = captcha_token;
2933
+ _context81.next = 17;
2890
2934
  return this._subscriptionService.getIntermediateSessionToken();
2891
2935
  case 17:
2892
- _context79.t5 = _context79.sent;
2893
- if (_context79.t5) {
2894
- _context79.next = 20;
2936
+ _context81.t5 = _context81.sent;
2937
+ if (_context81.t5) {
2938
+ _context81.next = 20;
2895
2939
  break;
2896
2940
  }
2897
- _context79.t5 = undefined;
2941
+ _context81.t5 = undefined;
2898
2942
  case 20:
2899
- _context79.t6 = _context79.t5;
2900
- _context79.t7 = {
2901
- dfp_telemetry_id: _context79.t3,
2902
- captcha_token: _context79.t4,
2903
- intermediate_session_token: _context79.t6
2943
+ _context81.t6 = _context81.t5;
2944
+ _context81.t7 = {
2945
+ dfp_telemetry_id: _context81.t3,
2946
+ captcha_token: _context81.t4,
2947
+ intermediate_session_token: _context81.t6
2904
2948
  };
2905
- _context79.t8 = _context79.t1.assign.call(_context79.t1, _context79.t2, _context79.t7);
2906
- _context79.t9 = this.dfpProtectedAuth.retryWithCaptchaAndDFP;
2907
- _context79.t10 = {
2949
+ _context81.t8 = _context81.t1.assign.call(_context81.t1, _context81.t2, _context81.t7);
2950
+ _context81.t9 = this.dfpProtectedAuth.retryWithCaptchaAndDFP;
2951
+ _context81.t10 = {
2908
2952
  url: '/b2b/sso/authenticate',
2909
2953
  method: 'POST',
2910
- body: _context79.t8,
2954
+ body: _context81.t8,
2911
2955
  errorMessage: 'Failed to authenticate token',
2912
- retryCallback: _context79.t9
2956
+ retryCallback: _context81.t9
2913
2957
  };
2914
- _context79.next = 27;
2915
- return _context79.t0.retriableFetchSDK.call(_context79.t0, _context79.t10);
2958
+ _context81.next = 27;
2959
+ return _context81.t0.retriableFetchSDK.call(_context81.t0, _context81.t10);
2916
2960
  case 27:
2917
- resp = _context79.sent;
2961
+ resp = _context81.sent;
2918
2962
  this._pkceManager.clearPKPair();
2919
2963
  if (resp.member_session) {
2920
2964
  this._subscriptionService.updateStateAndTokens({
@@ -2935,33 +2979,33 @@ var HeadlessB2BSSOClient = /*#__PURE__*/function () {
2935
2979
  intermediate_session_token: resp.intermediate_session_token
2936
2980
  });
2937
2981
  }
2938
- return _context79.abrupt("return", resp);
2982
+ return _context81.abrupt("return", resp);
2939
2983
  case 31:
2940
2984
  case "end":
2941
- return _context79.stop();
2985
+ return _context81.stop();
2942
2986
  }
2943
- }, _callee79, this);
2987
+ }, _callee81, this);
2944
2988
  }));
2945
2989
  }
2946
2990
  }, {
2947
2991
  key: "getBaseApiUrl",
2948
2992
  value: function getBaseApiUrl() {
2949
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee80() {
2950
- return _regeneratorRuntime().wrap(function _callee80$(_context80) {
2951
- while (1) switch (_context80.prev = _context80.next) {
2993
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee82() {
2994
+ return _regeneratorRuntime().wrap(function _callee82$(_context82) {
2995
+ while (1) switch (_context82.prev = _context82.next) {
2952
2996
  case 0:
2953
2997
  if (!isTestPublicToken(this._config.publicToken)) {
2954
- _context80.next = 2;
2998
+ _context82.next = 2;
2955
2999
  break;
2956
3000
  }
2957
- return _context80.abrupt("return", this._config.testAPIURL);
3001
+ return _context82.abrupt("return", this._config.testAPIURL);
2958
3002
  case 2:
2959
- return _context80.abrupt("return", this._config.liveAPIURL);
3003
+ return _context82.abrupt("return", this._config.liveAPIURL);
2960
3004
  case 3:
2961
3005
  case "end":
2962
- return _context80.stop();
3006
+ return _context82.stop();
2963
3007
  }
2964
- }, _callee80, this);
3008
+ }, _callee82, this);
2965
3009
  }));
2966
3010
  }
2967
3011
  }, {
@@ -2970,33 +3014,33 @@ var HeadlessB2BSSOClient = /*#__PURE__*/function () {
2970
3014
  var connection_id = _ref4.connection_id,
2971
3015
  login_redirect_url = _ref4.login_redirect_url,
2972
3016
  signup_redirect_url = _ref4.signup_redirect_url;
2973
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee81() {
3017
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee83() {
2974
3018
  var _yield$this$_dynamicC3, pkceRequiredForSso, baseURL, startUrl, keyPair;
2975
- return _regeneratorRuntime().wrap(function _callee81$(_context81) {
2976
- while (1) switch (_context81.prev = _context81.next) {
3019
+ return _regeneratorRuntime().wrap(function _callee83$(_context83) {
3020
+ while (1) switch (_context83.prev = _context83.next) {
2977
3021
  case 0:
2978
- _context81.next = 2;
3022
+ _context83.next = 2;
2979
3023
  return this._dynamicConfig;
2980
3024
  case 2:
2981
- _yield$this$_dynamicC3 = _context81.sent;
3025
+ _yield$this$_dynamicC3 = _context83.sent;
2982
3026
  pkceRequiredForSso = _yield$this$_dynamicC3.pkceRequiredForSso;
2983
- _context81.next = 6;
3027
+ _context83.next = 6;
2984
3028
  return this.getBaseApiUrl();
2985
3029
  case 6:
2986
- baseURL = _context81.sent;
3030
+ baseURL = _context83.sent;
2987
3031
  startUrl = new URL("".concat(baseURL, "/v1/public/sso/start"));
2988
3032
  startUrl.searchParams.set('public_token', this._config.publicToken);
2989
3033
  startUrl.searchParams.set('connection_id', connection_id);
2990
3034
  if (!pkceRequiredForSso) {
2991
- _context81.next = 17;
3035
+ _context83.next = 17;
2992
3036
  break;
2993
3037
  }
2994
- _context81.next = 13;
3038
+ _context83.next = 13;
2995
3039
  return this._pkceManager.startPKCETransaction();
2996
3040
  case 13:
2997
- keyPair = _context81.sent;
3041
+ keyPair = _context83.sent;
2998
3042
  startUrl.searchParams.set('pkce_code_challenge', keyPair.code_challenge);
2999
- _context81.next = 18;
3043
+ _context83.next = 18;
3000
3044
  break;
3001
3045
  case 17:
3002
3046
  this._pkceManager.clearPKPair();
@@ -3006,50 +3050,50 @@ var HeadlessB2BSSOClient = /*#__PURE__*/function () {
3006
3050
  window.location.href = startUrl.toString();
3007
3051
  case 21:
3008
3052
  case "end":
3009
- return _context81.stop();
3053
+ return _context83.stop();
3010
3054
  }
3011
- }, _callee81, this);
3055
+ }, _callee83, this);
3012
3056
  }));
3013
3057
  }
3014
3058
  }, {
3015
3059
  key: "getConnections",
3016
3060
  value: function getConnections() {
3017
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee82() {
3018
- return _regeneratorRuntime().wrap(function _callee82$(_context82) {
3019
- while (1) switch (_context82.prev = _context82.next) {
3061
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee84() {
3062
+ return _regeneratorRuntime().wrap(function _callee84$(_context84) {
3063
+ while (1) switch (_context84.prev = _context84.next) {
3020
3064
  case 0:
3021
- _context82.next = 2;
3065
+ _context84.next = 2;
3022
3066
  return this._networkClient.fetchSDK({
3023
3067
  url: '/b2b/sso',
3024
3068
  method: 'GET',
3025
3069
  errorMessage: 'Failed to get SSO Connections.'
3026
3070
  });
3027
3071
  case 2:
3028
- return _context82.abrupt("return", _context82.sent);
3072
+ return _context84.abrupt("return", _context84.sent);
3029
3073
  case 3:
3030
3074
  case "end":
3031
- return _context82.stop();
3075
+ return _context84.stop();
3032
3076
  }
3033
- }, _callee82, this);
3077
+ }, _callee84, this);
3034
3078
  }));
3035
3079
  }
3036
3080
  }, {
3037
3081
  key: "deleteConnection",
3038
3082
  value: function deleteConnection(connectionId) {
3039
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee83() {
3040
- return _regeneratorRuntime().wrap(function _callee83$(_context83) {
3041
- while (1) switch (_context83.prev = _context83.next) {
3083
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee85() {
3084
+ return _regeneratorRuntime().wrap(function _callee85$(_context85) {
3085
+ while (1) switch (_context85.prev = _context85.next) {
3042
3086
  case 0:
3043
- return _context83.abrupt("return", this._networkClient.fetchSDK({
3087
+ return _context85.abrupt("return", this._networkClient.fetchSDK({
3044
3088
  url: "/b2b/sso/".concat(connectionId),
3045
3089
  method: 'DELETE',
3046
3090
  errorMessage: 'Failed to delete SSO Connection.'
3047
3091
  }));
3048
3092
  case 1:
3049
3093
  case "end":
3050
- return _context83.stop();
3094
+ return _context85.stop();
3051
3095
  }
3052
- }, _callee83, this);
3096
+ }, _callee85, this);
3053
3097
  }));
3054
3098
  }
3055
3099
  }]);
@@ -3064,12 +3108,12 @@ var HeadlessB2BSCIMClient = /*#__PURE__*/function () {
3064
3108
  _createClass(HeadlessB2BSCIMClient, [{
3065
3109
  key: "createConnection",
3066
3110
  value: function createConnection(data) {
3067
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee84() {
3068
- return _regeneratorRuntime().wrap(function _callee84$(_context84) {
3069
- while (1) switch (_context84.prev = _context84.next) {
3111
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee86() {
3112
+ return _regeneratorRuntime().wrap(function _callee86$(_context86) {
3113
+ while (1) switch (_context86.prev = _context86.next) {
3070
3114
  case 0:
3071
3115
  validate('stytch.scim.createConnection').isOptionalString('display_name', data.display_name).isOptionalString('identity_provider', data.identity_provider);
3072
- _context84.next = 3;
3116
+ _context86.next = 3;
3073
3117
  return this._networkClient.fetchSDK({
3074
3118
  url: '/b2b/scim',
3075
3119
  method: 'POST',
@@ -3077,23 +3121,23 @@ var HeadlessB2BSCIMClient = /*#__PURE__*/function () {
3077
3121
  errorMessage: 'Failed to create SCIM Connection.'
3078
3122
  });
3079
3123
  case 3:
3080
- return _context84.abrupt("return", _context84.sent);
3124
+ return _context86.abrupt("return", _context86.sent);
3081
3125
  case 4:
3082
3126
  case "end":
3083
- return _context84.stop();
3127
+ return _context86.stop();
3084
3128
  }
3085
- }, _callee84, this);
3129
+ }, _callee86, this);
3086
3130
  }));
3087
3131
  }
3088
3132
  }, {
3089
3133
  key: "updateConnection",
3090
3134
  value: function updateConnection(data) {
3091
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee85() {
3092
- return _regeneratorRuntime().wrap(function _callee85$(_context85) {
3093
- while (1) switch (_context85.prev = _context85.next) {
3135
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee87() {
3136
+ return _regeneratorRuntime().wrap(function _callee87$(_context87) {
3137
+ while (1) switch (_context87.prev = _context87.next) {
3094
3138
  case 0:
3095
3139
  validate('stytch.scim.updateConnection').isString('connection_id', data.connection_id).isOptionalString('display_name', data.display_name).isOptionalString('identity_provider', data.identity_provider);
3096
- _context85.next = 3;
3140
+ _context87.next = 3;
3097
3141
  return this._networkClient.fetchSDK({
3098
3142
  url: "/b2b/scim/".concat(data.connection_id),
3099
3143
  method: 'PUT',
@@ -3101,68 +3145,68 @@ var HeadlessB2BSCIMClient = /*#__PURE__*/function () {
3101
3145
  errorMessage: 'Failed to update SCIM Connection.'
3102
3146
  });
3103
3147
  case 3:
3104
- return _context85.abrupt("return", _context85.sent);
3148
+ return _context87.abrupt("return", _context87.sent);
3105
3149
  case 4:
3106
3150
  case "end":
3107
- return _context85.stop();
3151
+ return _context87.stop();
3108
3152
  }
3109
- }, _callee85, this);
3153
+ }, _callee87, this);
3110
3154
  }));
3111
3155
  }
3112
3156
  }, {
3113
3157
  key: "deleteConnection",
3114
3158
  value: function deleteConnection(connectionId) {
3115
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee86() {
3116
- return _regeneratorRuntime().wrap(function _callee86$(_context86) {
3117
- while (1) switch (_context86.prev = _context86.next) {
3159
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee88() {
3160
+ return _regeneratorRuntime().wrap(function _callee88$(_context88) {
3161
+ while (1) switch (_context88.prev = _context88.next) {
3118
3162
  case 0:
3119
3163
  validate('stytch.scim.deleteConnection').isString('connection_id', connectionId);
3120
- _context86.next = 3;
3164
+ _context88.next = 3;
3121
3165
  return this._networkClient.fetchSDK({
3122
3166
  url: "/b2b/scim/".concat(connectionId),
3123
3167
  method: 'DELETE',
3124
3168
  errorMessage: 'Failed to delete SCIM Connection.'
3125
3169
  });
3126
3170
  case 3:
3127
- return _context86.abrupt("return", _context86.sent);
3171
+ return _context88.abrupt("return", _context88.sent);
3128
3172
  case 4:
3129
3173
  case "end":
3130
- return _context86.stop();
3174
+ return _context88.stop();
3131
3175
  }
3132
- }, _callee86, this);
3176
+ }, _callee88, this);
3133
3177
  }));
3134
3178
  }
3135
3179
  }, {
3136
3180
  key: "getConnection",
3137
3181
  value: function getConnection() {
3138
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee87() {
3139
- return _regeneratorRuntime().wrap(function _callee87$(_context87) {
3140
- while (1) switch (_context87.prev = _context87.next) {
3182
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee89() {
3183
+ return _regeneratorRuntime().wrap(function _callee89$(_context89) {
3184
+ while (1) switch (_context89.prev = _context89.next) {
3141
3185
  case 0:
3142
- _context87.next = 2;
3186
+ _context89.next = 2;
3143
3187
  return this._networkClient.fetchSDK({
3144
3188
  url: '/b2b/scim',
3145
3189
  method: 'GET',
3146
3190
  errorMessage: 'Failed to get SCIM Connection.'
3147
3191
  });
3148
3192
  case 2:
3149
- return _context87.abrupt("return", _context87.sent);
3193
+ return _context89.abrupt("return", _context89.sent);
3150
3194
  case 3:
3151
3195
  case "end":
3152
- return _context87.stop();
3196
+ return _context89.stop();
3153
3197
  }
3154
- }, _callee87, this);
3198
+ }, _callee89, this);
3155
3199
  }));
3156
3200
  }
3157
3201
  }, {
3158
3202
  key: "getConnectionGroups",
3159
3203
  value: function getConnectionGroups(data) {
3160
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee88() {
3161
- return _regeneratorRuntime().wrap(function _callee88$(_context88) {
3162
- while (1) switch (_context88.prev = _context88.next) {
3204
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee90() {
3205
+ return _regeneratorRuntime().wrap(function _callee90$(_context90) {
3206
+ while (1) switch (_context90.prev = _context90.next) {
3163
3207
  case 0:
3164
3208
  validate('stytch.scim.getConnectionGroups').isOptionalNumber('limit', data.limit).isOptionalString('cursor', data.cursor);
3165
- _context88.next = 3;
3209
+ _context90.next = 3;
3166
3210
  return this._networkClient.fetchSDK({
3167
3211
  url: '/b2b/scim/groups',
3168
3212
  method: 'POST',
@@ -3170,23 +3214,23 @@ var HeadlessB2BSCIMClient = /*#__PURE__*/function () {
3170
3214
  errorMessage: 'Failed to get SCIM Connection groups.'
3171
3215
  });
3172
3216
  case 3:
3173
- return _context88.abrupt("return", _context88.sent);
3217
+ return _context90.abrupt("return", _context90.sent);
3174
3218
  case 4:
3175
3219
  case "end":
3176
- return _context88.stop();
3220
+ return _context90.stop();
3177
3221
  }
3178
- }, _callee88, this);
3222
+ }, _callee90, this);
3179
3223
  }));
3180
3224
  }
3181
3225
  }, {
3182
3226
  key: "rotateStart",
3183
3227
  value: function rotateStart(connectionId) {
3184
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee89() {
3185
- return _regeneratorRuntime().wrap(function _callee89$(_context89) {
3186
- while (1) switch (_context89.prev = _context89.next) {
3228
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee91() {
3229
+ return _regeneratorRuntime().wrap(function _callee91$(_context91) {
3230
+ while (1) switch (_context91.prev = _context91.next) {
3187
3231
  case 0:
3188
3232
  validate('stytch.scim.rotateStart').isString('connectionId', connectionId);
3189
- _context89.next = 3;
3233
+ _context91.next = 3;
3190
3234
  return this._networkClient.fetchSDK({
3191
3235
  url: "/b2b/scim/rotate/start",
3192
3236
  method: 'POST',
@@ -3196,23 +3240,23 @@ var HeadlessB2BSCIMClient = /*#__PURE__*/function () {
3196
3240
  errorMessage: 'Failed to start SCIM token rotation.'
3197
3241
  });
3198
3242
  case 3:
3199
- return _context89.abrupt("return", _context89.sent);
3243
+ return _context91.abrupt("return", _context91.sent);
3200
3244
  case 4:
3201
3245
  case "end":
3202
- return _context89.stop();
3246
+ return _context91.stop();
3203
3247
  }
3204
- }, _callee89, this);
3248
+ }, _callee91, this);
3205
3249
  }));
3206
3250
  }
3207
3251
  }, {
3208
3252
  key: "rotateComplete",
3209
3253
  value: function rotateComplete(connectionId) {
3210
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee90() {
3211
- return _regeneratorRuntime().wrap(function _callee90$(_context90) {
3212
- while (1) switch (_context90.prev = _context90.next) {
3254
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee92() {
3255
+ return _regeneratorRuntime().wrap(function _callee92$(_context92) {
3256
+ while (1) switch (_context92.prev = _context92.next) {
3213
3257
  case 0:
3214
3258
  validate('stytch.scim.rotateComplete').isString('connectionId', connectionId);
3215
- _context90.next = 3;
3259
+ _context92.next = 3;
3216
3260
  return this._networkClient.fetchSDK({
3217
3261
  url: "/b2b/scim/rotate/complete",
3218
3262
  method: 'POST',
@@ -3222,23 +3266,23 @@ var HeadlessB2BSCIMClient = /*#__PURE__*/function () {
3222
3266
  errorMessage: 'Failed to complete SCIM token rotation.'
3223
3267
  });
3224
3268
  case 3:
3225
- return _context90.abrupt("return", _context90.sent);
3269
+ return _context92.abrupt("return", _context92.sent);
3226
3270
  case 4:
3227
3271
  case "end":
3228
- return _context90.stop();
3272
+ return _context92.stop();
3229
3273
  }
3230
- }, _callee90, this);
3274
+ }, _callee92, this);
3231
3275
  }));
3232
3276
  }
3233
3277
  }, {
3234
3278
  key: "rotateCancel",
3235
3279
  value: function rotateCancel(connectionId) {
3236
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee91() {
3237
- return _regeneratorRuntime().wrap(function _callee91$(_context91) {
3238
- while (1) switch (_context91.prev = _context91.next) {
3280
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee93() {
3281
+ return _regeneratorRuntime().wrap(function _callee93$(_context93) {
3282
+ while (1) switch (_context93.prev = _context93.next) {
3239
3283
  case 0:
3240
3284
  validate('stytch.scim.rotateCancel').isString('connectionId', connectionId);
3241
- _context91.next = 3;
3285
+ _context93.next = 3;
3242
3286
  return this._networkClient.fetchSDK({
3243
3287
  url: "/b2b/scim/rotate/cancel",
3244
3288
  method: 'POST',
@@ -3248,12 +3292,12 @@ var HeadlessB2BSCIMClient = /*#__PURE__*/function () {
3248
3292
  errorMessage: 'Failed to cancel SCIM token rotation.'
3249
3293
  });
3250
3294
  case 3:
3251
- return _context91.abrupt("return", _context91.sent);
3295
+ return _context93.abrupt("return", _context93.sent);
3252
3296
  case 4:
3253
3297
  case "end":
3254
- return _context91.stop();
3298
+ return _context93.stop();
3255
3299
  }
3256
- }, _callee91, this);
3300
+ }, _callee93, this);
3257
3301
  }));
3258
3302
  }
3259
3303
  }]);
@@ -3266,26 +3310,26 @@ var HeadlessB2BOrganizationClient = /*#__PURE__*/_createClass(function HeadlessB
3266
3310
  this._apiNetworkClient = _apiNetworkClient;
3267
3311
  this._subscriptionService = _subscriptionService;
3268
3312
  this.get = function () {
3269
- return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee92() {
3313
+ return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee94() {
3270
3314
  var resp;
3271
- return _regeneratorRuntime().wrap(function _callee92$(_context92) {
3272
- while (1) switch (_context92.prev = _context92.next) {
3315
+ return _regeneratorRuntime().wrap(function _callee94$(_context94) {
3316
+ while (1) switch (_context94.prev = _context94.next) {
3273
3317
  case 0:
3274
- _context92.next = 2;
3318
+ _context94.next = 2;
3275
3319
  return this._networkClient.fetchSDK({
3276
3320
  url: "/b2b/organizations/me",
3277
3321
  errorMessage: 'Failed to retrieve organization info.',
3278
3322
  method: 'GET'
3279
3323
  });
3280
3324
  case 2:
3281
- resp = _context92.sent;
3325
+ resp = _context94.sent;
3282
3326
  this._subscriptionService.updateOrganization(resp.organization);
3283
- return _context92.abrupt("return", resp.organization);
3327
+ return _context94.abrupt("return", resp.organization);
3284
3328
  case 5:
3285
3329
  case "end":
3286
- return _context92.stop();
3330
+ return _context94.stop();
3287
3331
  }
3288
- }, _callee92, this);
3332
+ }, _callee94, this);
3289
3333
  }));
3290
3334
  };
3291
3335
  this.getSync = function () {
@@ -3304,12 +3348,12 @@ var HeadlessB2BOrganizationClient = /*#__PURE__*/_createClass(function HeadlessB
3304
3348
  });
3305
3349
  };
3306
3350
  this.update = function (data) {
3307
- return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee93() {
3351
+ return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee95() {
3308
3352
  var resp;
3309
- return _regeneratorRuntime().wrap(function _callee93$(_context93) {
3310
- while (1) switch (_context93.prev = _context93.next) {
3353
+ return _regeneratorRuntime().wrap(function _callee95$(_context95) {
3354
+ while (1) switch (_context95.prev = _context95.next) {
3311
3355
  case 0:
3312
- _context93.next = 2;
3356
+ _context95.next = 2;
3313
3357
  return this._networkClient.fetchSDK({
3314
3358
  url: "/b2b/organizations/me",
3315
3359
  errorMessage: 'Failed to update organization info.',
@@ -3317,45 +3361,45 @@ var HeadlessB2BOrganizationClient = /*#__PURE__*/_createClass(function HeadlessB
3317
3361
  body: data
3318
3362
  });
3319
3363
  case 2:
3320
- resp = _context93.sent;
3321
- return _context93.abrupt("return", resp);
3364
+ resp = _context95.sent;
3365
+ return _context95.abrupt("return", resp);
3322
3366
  case 4:
3323
3367
  case "end":
3324
- return _context93.stop();
3368
+ return _context95.stop();
3325
3369
  }
3326
- }, _callee93, this);
3370
+ }, _callee95, this);
3327
3371
  }));
3328
3372
  };
3329
3373
  this["delete"] = function () {
3330
- return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee94() {
3374
+ return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee96() {
3331
3375
  var resp;
3332
- return _regeneratorRuntime().wrap(function _callee94$(_context94) {
3333
- while (1) switch (_context94.prev = _context94.next) {
3376
+ return _regeneratorRuntime().wrap(function _callee96$(_context96) {
3377
+ while (1) switch (_context96.prev = _context96.next) {
3334
3378
  case 0:
3335
- _context94.next = 2;
3379
+ _context96.next = 2;
3336
3380
  return this._networkClient.fetchSDK({
3337
3381
  url: "/b2b/organizations/me",
3338
3382
  errorMessage: 'Failed to delete organization.',
3339
3383
  method: 'DELETE'
3340
3384
  });
3341
3385
  case 2:
3342
- resp = _context94.sent;
3386
+ resp = _context96.sent;
3343
3387
  this._subscriptionService.destroyState();
3344
- return _context94.abrupt("return", resp);
3388
+ return _context96.abrupt("return", resp);
3345
3389
  case 5:
3346
3390
  case "end":
3347
- return _context94.stop();
3391
+ return _context96.stop();
3348
3392
  }
3349
- }, _callee94, this);
3393
+ }, _callee96, this);
3350
3394
  }));
3351
3395
  };
3352
3396
  this.getBySlug = function (data) {
3353
- return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee95() {
3354
- return _regeneratorRuntime().wrap(function _callee95$(_context95) {
3355
- while (1) switch (_context95.prev = _context95.next) {
3397
+ return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee97() {
3398
+ return _regeneratorRuntime().wrap(function _callee97$(_context97) {
3399
+ while (1) switch (_context97.prev = _context97.next) {
3356
3400
  case 0:
3357
3401
  validate('stytch.organization.getBySlug').isString('organization_slug', data.organization_slug);
3358
- return _context95.abrupt("return", this._networkClient.fetchSDK({
3402
+ return _context97.abrupt("return", this._networkClient.fetchSDK({
3359
3403
  url: "/b2b/organizations/search",
3360
3404
  errorMessage: 'Failed to get organization by slug.',
3361
3405
  method: 'POST',
@@ -3363,18 +3407,18 @@ var HeadlessB2BOrganizationClient = /*#__PURE__*/_createClass(function HeadlessB
3363
3407
  }));
3364
3408
  case 2:
3365
3409
  case "end":
3366
- return _context95.stop();
3410
+ return _context97.stop();
3367
3411
  }
3368
- }, _callee95, this);
3412
+ }, _callee97, this);
3369
3413
  }));
3370
3414
  };
3371
3415
  this.members = {
3372
3416
  create: function create(data) {
3373
- return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee96() {
3374
- return _regeneratorRuntime().wrap(function _callee96$(_context96) {
3375
- while (1) switch (_context96.prev = _context96.next) {
3417
+ return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee98() {
3418
+ return _regeneratorRuntime().wrap(function _callee98$(_context98) {
3419
+ while (1) switch (_context98.prev = _context98.next) {
3376
3420
  case 0:
3377
- return _context96.abrupt("return", this._networkClient.fetchSDK({
3421
+ return _context98.abrupt("return", this._networkClient.fetchSDK({
3378
3422
  url: "/b2b/organizations/members",
3379
3423
  errorMessage: 'Failed to create member.',
3380
3424
  method: 'POST',
@@ -3382,17 +3426,17 @@ var HeadlessB2BOrganizationClient = /*#__PURE__*/_createClass(function HeadlessB
3382
3426
  }));
3383
3427
  case 1:
3384
3428
  case "end":
3385
- return _context96.stop();
3429
+ return _context98.stop();
3386
3430
  }
3387
- }, _callee96, this);
3431
+ }, _callee98, this);
3388
3432
  }));
3389
3433
  },
3390
3434
  search: function search(data) {
3391
- return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee97() {
3392
- return _regeneratorRuntime().wrap(function _callee97$(_context97) {
3393
- while (1) switch (_context97.prev = _context97.next) {
3435
+ return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee99() {
3436
+ return _regeneratorRuntime().wrap(function _callee99$(_context99) {
3437
+ while (1) switch (_context99.prev = _context99.next) {
3394
3438
  case 0:
3395
- return _context97.abrupt("return", this._networkClient.fetchSDK({
3439
+ return _context99.abrupt("return", this._networkClient.fetchSDK({
3396
3440
  url: "/b2b/organizations/me/members/search",
3397
3441
  errorMessage: 'Failed to search members.',
3398
3442
  method: 'POST',
@@ -3400,17 +3444,17 @@ var HeadlessB2BOrganizationClient = /*#__PURE__*/_createClass(function HeadlessB
3400
3444
  }));
3401
3445
  case 1:
3402
3446
  case "end":
3403
- return _context97.stop();
3447
+ return _context99.stop();
3404
3448
  }
3405
- }, _callee97, this);
3449
+ }, _callee99, this);
3406
3450
  }));
3407
3451
  },
3408
3452
  update: function update(data) {
3409
- return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee98() {
3410
- return _regeneratorRuntime().wrap(function _callee98$(_context98) {
3411
- while (1) switch (_context98.prev = _context98.next) {
3453
+ return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee100() {
3454
+ return _regeneratorRuntime().wrap(function _callee100$(_context100) {
3455
+ while (1) switch (_context100.prev = _context100.next) {
3412
3456
  case 0:
3413
- return _context98.abrupt("return", this._networkClient.fetchSDK({
3457
+ return _context100.abrupt("return", this._networkClient.fetchSDK({
3414
3458
  url: "/b2b/organizations/members/".concat(data.member_id),
3415
3459
  errorMessage: 'Failed to update member.',
3416
3460
  method: 'PUT',
@@ -3418,104 +3462,104 @@ var HeadlessB2BOrganizationClient = /*#__PURE__*/_createClass(function HeadlessB
3418
3462
  }));
3419
3463
  case 1:
3420
3464
  case "end":
3421
- return _context98.stop();
3465
+ return _context100.stop();
3422
3466
  }
3423
- }, _callee98, this);
3467
+ }, _callee100, this);
3424
3468
  }));
3425
3469
  },
3426
3470
  deletePassword: function deletePassword(passwordId) {
3427
- return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee99() {
3428
- return _regeneratorRuntime().wrap(function _callee99$(_context99) {
3429
- while (1) switch (_context99.prev = _context99.next) {
3471
+ return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee101() {
3472
+ return _regeneratorRuntime().wrap(function _callee101$(_context101) {
3473
+ while (1) switch (_context101.prev = _context101.next) {
3430
3474
  case 0:
3431
- return _context99.abrupt("return", this._networkClient.fetchSDK({
3475
+ return _context101.abrupt("return", this._networkClient.fetchSDK({
3432
3476
  url: "/b2b/organizations/members/passwords/".concat(passwordId),
3433
3477
  errorMessage: 'Failed to delete member password.',
3434
3478
  method: 'DELETE'
3435
3479
  }));
3436
3480
  case 1:
3437
3481
  case "end":
3438
- return _context99.stop();
3482
+ return _context101.stop();
3439
3483
  }
3440
- }, _callee99, this);
3484
+ }, _callee101, this);
3441
3485
  }));
3442
3486
  },
3443
3487
  deleteMFAPhoneNumber: function deleteMFAPhoneNumber(memberId) {
3444
- return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee100() {
3445
- return _regeneratorRuntime().wrap(function _callee100$(_context100) {
3446
- while (1) switch (_context100.prev = _context100.next) {
3488
+ return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee102() {
3489
+ return _regeneratorRuntime().wrap(function _callee102$(_context102) {
3490
+ while (1) switch (_context102.prev = _context102.next) {
3447
3491
  case 0:
3448
- return _context100.abrupt("return", this._networkClient.fetchSDK({
3492
+ return _context102.abrupt("return", this._networkClient.fetchSDK({
3449
3493
  url: "/b2b/organizations/members/mfa_phone_numbers/".concat(memberId),
3450
3494
  errorMessage: 'Failed to delete member MFA Phone number.',
3451
3495
  method: 'DELETE'
3452
3496
  }));
3453
3497
  case 1:
3454
3498
  case "end":
3455
- return _context100.stop();
3499
+ return _context102.stop();
3456
3500
  }
3457
- }, _callee100, this);
3501
+ }, _callee102, this);
3458
3502
  }));
3459
3503
  },
3460
3504
  deleteMFATOTP: function deleteMFATOTP(memberId) {
3461
- return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee101() {
3462
- return _regeneratorRuntime().wrap(function _callee101$(_context101) {
3463
- while (1) switch (_context101.prev = _context101.next) {
3505
+ return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee103() {
3506
+ return _regeneratorRuntime().wrap(function _callee103$(_context103) {
3507
+ while (1) switch (_context103.prev = _context103.next) {
3464
3508
  case 0:
3465
- return _context101.abrupt("return", this._networkClient.fetchSDK({
3509
+ return _context103.abrupt("return", this._networkClient.fetchSDK({
3466
3510
  url: "/b2b/organizations/members/totp/".concat(memberId),
3467
3511
  errorMessage: 'Failed to delete member totp.',
3468
3512
  method: 'DELETE'
3469
3513
  }));
3470
3514
  case 1:
3471
3515
  case "end":
3472
- return _context101.stop();
3516
+ return _context103.stop();
3473
3517
  }
3474
- }, _callee101, this);
3518
+ }, _callee103, this);
3475
3519
  }));
3476
3520
  },
3477
3521
  "delete": function _delete(memberId) {
3478
- return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee102() {
3479
- return _regeneratorRuntime().wrap(function _callee102$(_context102) {
3480
- while (1) switch (_context102.prev = _context102.next) {
3522
+ return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee104() {
3523
+ return _regeneratorRuntime().wrap(function _callee104$(_context104) {
3524
+ while (1) switch (_context104.prev = _context104.next) {
3481
3525
  case 0:
3482
- return _context102.abrupt("return", this._networkClient.fetchSDK({
3526
+ return _context104.abrupt("return", this._networkClient.fetchSDK({
3483
3527
  url: "/b2b/organizations/members/".concat(memberId),
3484
3528
  errorMessage: 'Failed to delete member.',
3485
3529
  method: 'DELETE'
3486
3530
  }));
3487
3531
  case 1:
3488
3532
  case "end":
3489
- return _context102.stop();
3533
+ return _context104.stop();
3490
3534
  }
3491
- }, _callee102, this);
3535
+ }, _callee104, this);
3492
3536
  }));
3493
3537
  },
3494
3538
  reactivate: function reactivate(memberId) {
3495
- return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee103() {
3496
- return _regeneratorRuntime().wrap(function _callee103$(_context103) {
3497
- while (1) switch (_context103.prev = _context103.next) {
3539
+ return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee105() {
3540
+ return _regeneratorRuntime().wrap(function _callee105$(_context105) {
3541
+ while (1) switch (_context105.prev = _context105.next) {
3498
3542
  case 0:
3499
- return _context103.abrupt("return", this._networkClient.fetchSDK({
3543
+ return _context105.abrupt("return", this._networkClient.fetchSDK({
3500
3544
  url: "/b2b/organizations/members/".concat(memberId, "/reactivate"),
3501
3545
  errorMessage: 'Failed to reactivate member.',
3502
3546
  method: 'PUT'
3503
3547
  }));
3504
3548
  case 1:
3505
3549
  case "end":
3506
- return _context103.stop();
3550
+ return _context105.stop();
3507
3551
  }
3508
- }, _callee103, this);
3552
+ }, _callee105, this);
3509
3553
  }));
3510
3554
  },
3511
3555
  unlinkRetiredEmail: function unlinkRetiredEmail(data) {
3512
- return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee104() {
3556
+ return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee106() {
3513
3557
  var member_id, body;
3514
- return _regeneratorRuntime().wrap(function _callee104$(_context104) {
3515
- while (1) switch (_context104.prev = _context104.next) {
3558
+ return _regeneratorRuntime().wrap(function _callee106$(_context106) {
3559
+ while (1) switch (_context106.prev = _context106.next) {
3516
3560
  case 0:
3517
3561
  member_id = data.member_id, body = __rest$1(data, ["member_id"]);
3518
- return _context104.abrupt("return", this._apiNetworkClient.fetchSDK({
3562
+ return _context106.abrupt("return", this._apiNetworkClient.fetchSDK({
3519
3563
  url: "/b2b/organizations/members/".concat(member_id, "/unlink_retired_email"),
3520
3564
  errorMessage: 'Failed to unlink retired email.',
3521
3565
  method: 'POST',
@@ -3523,9 +3567,9 @@ var HeadlessB2BOrganizationClient = /*#__PURE__*/_createClass(function HeadlessB
3523
3567
  }));
3524
3568
  case 2:
3525
3569
  case "end":
3526
- return _context104.stop();
3570
+ return _context106.stop();
3527
3571
  }
3528
- }, _callee104, this);
3572
+ }, _callee106, this);
3529
3573
  }));
3530
3574
  }
3531
3575
  };
@@ -3542,20 +3586,20 @@ var HeadlessB2BOAuthClient$1 = /*#__PURE__*/function () {
3542
3586
  this.dfpProtectedAuth = dfpProtectedAuth;
3543
3587
  this.discovery = {
3544
3588
  authenticate: function authenticate(data) {
3545
- return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee105() {
3589
+ return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee107() {
3546
3590
  var pkPair, _yield$this$dfpProtec22, dfp_telemetry_id, captcha_token, requestBody, resp;
3547
- return _regeneratorRuntime().wrap(function _callee105$(_context105) {
3548
- while (1) switch (_context105.prev = _context105.next) {
3591
+ return _regeneratorRuntime().wrap(function _callee107$(_context107) {
3592
+ while (1) switch (_context107.prev = _context107.next) {
3549
3593
  case 0:
3550
3594
  validate('stytch.oauth.discovery.authenticate').isString('discovery_oauth_token', data.discovery_oauth_token);
3551
- _context105.next = 3;
3595
+ _context107.next = 3;
3552
3596
  return this._pkceManager.getPKPair();
3553
3597
  case 3:
3554
- pkPair = _context105.sent;
3555
- _context105.next = 6;
3598
+ pkPair = _context107.sent;
3599
+ _context107.next = 6;
3556
3600
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
3557
3601
  case 6:
3558
- _yield$this$dfpProtec22 = _context105.sent;
3602
+ _yield$this$dfpProtec22 = _context107.sent;
3559
3603
  dfp_telemetry_id = _yield$this$dfpProtec22.dfp_telemetry_id;
3560
3604
  captcha_token = _yield$this$dfpProtec22.captcha_token;
3561
3605
  requestBody = Object.assign({
@@ -3563,7 +3607,7 @@ var HeadlessB2BOAuthClient$1 = /*#__PURE__*/function () {
3563
3607
  dfp_telemetry_id: dfp_telemetry_id,
3564
3608
  captcha_token: captcha_token
3565
3609
  }, data);
3566
- _context105.next = 12;
3610
+ _context107.next = 12;
3567
3611
  return this._networkClient.retriableFetchSDK({
3568
3612
  url: '/b2b/oauth/discovery/authenticate',
3569
3613
  body: requestBody,
@@ -3572,7 +3616,7 @@ var HeadlessB2BOAuthClient$1 = /*#__PURE__*/function () {
3572
3616
  retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
3573
3617
  });
3574
3618
  case 12:
3575
- resp = _context105.sent;
3619
+ resp = _context107.sent;
3576
3620
  this._pkceManager.clearPKPair();
3577
3621
  this._subscriptionService.updateStateAndTokens({
3578
3622
  state: null,
@@ -3580,12 +3624,12 @@ var HeadlessB2BOAuthClient$1 = /*#__PURE__*/function () {
3580
3624
  session_jwt: null,
3581
3625
  intermediate_session_token: resp.intermediate_session_token
3582
3626
  });
3583
- return _context105.abrupt("return", resp);
3627
+ return _context107.abrupt("return", resp);
3584
3628
  case 16:
3585
3629
  case "end":
3586
- return _context105.stop();
3630
+ return _context107.stop();
3587
3631
  }
3588
- }, _callee105, this);
3632
+ }, _callee107, this);
3589
3633
  }));
3590
3634
  }
3591
3635
  };
@@ -3617,61 +3661,61 @@ var HeadlessB2BOAuthClient$1 = /*#__PURE__*/function () {
3617
3661
  _createClass(HeadlessB2BOAuthClient, [{
3618
3662
  key: "authenticate",
3619
3663
  value: function authenticate(options) {
3620
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee106() {
3664
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee108() {
3621
3665
  var keyPair, _yield$this$dfpProtec23, dfp_telemetry_id, captcha_token, resp;
3622
- return _regeneratorRuntime().wrap(function _callee106$(_context106) {
3623
- while (1) switch (_context106.prev = _context106.next) {
3666
+ return _regeneratorRuntime().wrap(function _callee108$(_context108) {
3667
+ while (1) switch (_context108.prev = _context108.next) {
3624
3668
  case 0:
3625
3669
  validate('stytch.oauth.authenticate').isString('oauth_token', options.oauth_token).isNumber('session_duration_minutes', options.session_duration_minutes).isOptionalString('locale', options.locale);
3626
- _context106.next = 3;
3670
+ _context108.next = 3;
3627
3671
  return this._pkceManager.getPKPair();
3628
3672
  case 3:
3629
- keyPair = _context106.sent;
3673
+ keyPair = _context108.sent;
3630
3674
  if (!keyPair) {
3631
3675
  logger.warn('No code verifier found in local storage for OAuth flow.\n' + 'Consider using stytch.oauth.$provider.start() to add PKCE to your OAuth flows for added security.\n' + 'See https://stytch.com/docs/oauth#guides_pkce for more information.');
3632
3676
  }
3633
- _context106.next = 7;
3677
+ _context108.next = 7;
3634
3678
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
3635
3679
  case 7:
3636
- _yield$this$dfpProtec23 = _context106.sent;
3680
+ _yield$this$dfpProtec23 = _context108.sent;
3637
3681
  dfp_telemetry_id = _yield$this$dfpProtec23.dfp_telemetry_id;
3638
3682
  captcha_token = _yield$this$dfpProtec23.captcha_token;
3639
- _context106.t0 = this._networkClient;
3640
- _context106.t1 = Object;
3641
- _context106.t2 = keyPair === null || keyPair === void 0 ? void 0 : keyPair.code_verifier;
3642
- _context106.t3 = dfp_telemetry_id;
3643
- _context106.t4 = captcha_token;
3644
- _context106.next = 17;
3683
+ _context108.t0 = this._networkClient;
3684
+ _context108.t1 = Object;
3685
+ _context108.t2 = keyPair === null || keyPair === void 0 ? void 0 : keyPair.code_verifier;
3686
+ _context108.t3 = dfp_telemetry_id;
3687
+ _context108.t4 = captcha_token;
3688
+ _context108.next = 17;
3645
3689
  return this._subscriptionService.getIntermediateSessionToken();
3646
3690
  case 17:
3647
- _context106.t5 = _context106.sent;
3648
- if (_context106.t5) {
3649
- _context106.next = 20;
3691
+ _context108.t5 = _context108.sent;
3692
+ if (_context108.t5) {
3693
+ _context108.next = 20;
3650
3694
  break;
3651
3695
  }
3652
- _context106.t5 = undefined;
3696
+ _context108.t5 = undefined;
3653
3697
  case 20:
3654
- _context106.t6 = _context106.t5;
3655
- _context106.t7 = {
3656
- pkce_code_verifier: _context106.t2,
3657
- dfp_telemetry_id: _context106.t3,
3658
- captcha_token: _context106.t4,
3659
- intermediate_session_token: _context106.t6
3698
+ _context108.t6 = _context108.t5;
3699
+ _context108.t7 = {
3700
+ pkce_code_verifier: _context108.t2,
3701
+ dfp_telemetry_id: _context108.t3,
3702
+ captcha_token: _context108.t4,
3703
+ intermediate_session_token: _context108.t6
3660
3704
  };
3661
- _context106.t8 = options;
3662
- _context106.t9 = _context106.t1.assign.call(_context106.t1, _context106.t7, _context106.t8);
3663
- _context106.t10 = this.dfpProtectedAuth.retryWithCaptchaAndDFP;
3664
- _context106.t11 = {
3705
+ _context108.t8 = options;
3706
+ _context108.t9 = _context108.t1.assign.call(_context108.t1, _context108.t7, _context108.t8);
3707
+ _context108.t10 = this.dfpProtectedAuth.retryWithCaptchaAndDFP;
3708
+ _context108.t11 = {
3665
3709
  url: '/b2b/oauth/authenticate',
3666
3710
  method: 'POST',
3667
- body: _context106.t9,
3711
+ body: _context108.t9,
3668
3712
  errorMessage: 'Failed to authenticate token',
3669
- retryCallback: _context106.t10
3713
+ retryCallback: _context108.t10
3670
3714
  };
3671
- _context106.next = 28;
3672
- return _context106.t0.retriableFetchSDK.call(_context106.t0, _context106.t11);
3715
+ _context108.next = 28;
3716
+ return _context108.t0.retriableFetchSDK.call(_context108.t0, _context108.t11);
3673
3717
  case 28:
3674
- resp = _context106.sent;
3718
+ resp = _context108.sent;
3675
3719
  this._pkceManager.clearPKPair();
3676
3720
  if (resp.member_session) {
3677
3721
  this._subscriptionService.updateStateAndTokens({
@@ -3692,45 +3736,45 @@ var HeadlessB2BOAuthClient$1 = /*#__PURE__*/function () {
3692
3736
  intermediate_session_token: resp.intermediate_session_token
3693
3737
  });
3694
3738
  }
3695
- return _context106.abrupt("return", resp);
3739
+ return _context108.abrupt("return", resp);
3696
3740
  case 32:
3697
3741
  case "end":
3698
- return _context106.stop();
3742
+ return _context108.stop();
3699
3743
  }
3700
- }, _callee106, this);
3744
+ }, _callee108, this);
3701
3745
  }));
3702
3746
  }
3703
3747
  }, {
3704
3748
  key: "getBaseApiUrl",
3705
3749
  value: function getBaseApiUrl() {
3706
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee107() {
3750
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee109() {
3707
3751
  var _yield$this$_dynamicC4, cnameDomain;
3708
- return _regeneratorRuntime().wrap(function _callee107$(_context107) {
3709
- while (1) switch (_context107.prev = _context107.next) {
3752
+ return _regeneratorRuntime().wrap(function _callee109$(_context109) {
3753
+ while (1) switch (_context109.prev = _context109.next) {
3710
3754
  case 0:
3711
- _context107.next = 2;
3755
+ _context109.next = 2;
3712
3756
  return this._dynamicConfig;
3713
3757
  case 2:
3714
- _yield$this$_dynamicC4 = _context107.sent;
3758
+ _yield$this$_dynamicC4 = _context109.sent;
3715
3759
  cnameDomain = _yield$this$_dynamicC4.cnameDomain;
3716
3760
  if (!cnameDomain) {
3717
- _context107.next = 6;
3761
+ _context109.next = 6;
3718
3762
  break;
3719
3763
  }
3720
- return _context107.abrupt("return", "https://".concat(cnameDomain));
3764
+ return _context109.abrupt("return", "https://".concat(cnameDomain));
3721
3765
  case 6:
3722
3766
  if (!isTestPublicToken(this._config.publicToken)) {
3723
- _context107.next = 8;
3767
+ _context109.next = 8;
3724
3768
  break;
3725
3769
  }
3726
- return _context107.abrupt("return", this._config.testAPIURL);
3770
+ return _context109.abrupt("return", this._config.testAPIURL);
3727
3771
  case 8:
3728
- return _context107.abrupt("return", this._config.liveAPIURL);
3772
+ return _context109.abrupt("return", this._config.liveAPIURL);
3729
3773
  case 9:
3730
3774
  case "end":
3731
- return _context107.stop();
3775
+ return _context109.stop();
3732
3776
  }
3733
- }, _callee107, this);
3777
+ }, _callee109, this);
3734
3778
  }));
3735
3779
  }
3736
3780
  }, {
@@ -3744,20 +3788,20 @@ var HeadlessB2BOAuthClient$1 = /*#__PURE__*/function () {
3744
3788
  signup_redirect_url = _ref5.signup_redirect_url,
3745
3789
  custom_scopes = _ref5.custom_scopes,
3746
3790
  provider_params = _ref5.provider_params;
3747
- return __awaiter$1(_this14, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee108() {
3791
+ return __awaiter$1(_this14, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee110() {
3748
3792
  var _yield$this$_dynamicC5, pkceRequiredForOAuth, baseURL, startUrl, key, keyPair;
3749
- return _regeneratorRuntime().wrap(function _callee108$(_context108) {
3750
- while (1) switch (_context108.prev = _context108.next) {
3793
+ return _regeneratorRuntime().wrap(function _callee110$(_context110) {
3794
+ while (1) switch (_context110.prev = _context110.next) {
3751
3795
  case 0:
3752
- _context108.next = 2;
3796
+ _context110.next = 2;
3753
3797
  return this._dynamicConfig;
3754
3798
  case 2:
3755
- _yield$this$_dynamicC5 = _context108.sent;
3799
+ _yield$this$_dynamicC5 = _context110.sent;
3756
3800
  pkceRequiredForOAuth = _yield$this$_dynamicC5.pkceRequiredForOAuth;
3757
- _context108.next = 6;
3801
+ _context110.next = 6;
3758
3802
  return this.getBaseApiUrl();
3759
3803
  case 6:
3760
- baseURL = _context108.sent;
3804
+ baseURL = _context110.sent;
3761
3805
  startUrl = new URL("".concat(baseURL, "/v1/b2b/public/oauth/").concat(providerType, "/start"));
3762
3806
  startUrl.searchParams.set('public_token', this._config.publicToken);
3763
3807
  if (organization_id && organization_id != '') {
@@ -3777,15 +3821,15 @@ var HeadlessB2BOAuthClient$1 = /*#__PURE__*/function () {
3777
3821
  }
3778
3822
  }
3779
3823
  if (!pkceRequiredForOAuth) {
3780
- _context108.next = 20;
3824
+ _context110.next = 20;
3781
3825
  break;
3782
3826
  }
3783
- _context108.next = 16;
3827
+ _context110.next = 16;
3784
3828
  return this._pkceManager.startPKCETransaction();
3785
3829
  case 16:
3786
- keyPair = _context108.sent;
3830
+ keyPair = _context110.sent;
3787
3831
  startUrl.searchParams.set('pkce_code_challenge', keyPair.code_challenge);
3788
- _context108.next = 21;
3832
+ _context110.next = 21;
3789
3833
  break;
3790
3834
  case 20:
3791
3835
  this._pkceManager.clearPKPair();
@@ -3795,9 +3839,9 @@ var HeadlessB2BOAuthClient$1 = /*#__PURE__*/function () {
3795
3839
  window.location.href = startUrl.toString();
3796
3840
  case 24:
3797
3841
  case "end":
3798
- return _context108.stop();
3842
+ return _context110.stop();
3799
3843
  }
3800
- }, _callee108, this);
3844
+ }, _callee110, this);
3801
3845
  }));
3802
3846
  };
3803
3847
  }
@@ -3809,20 +3853,20 @@ var HeadlessB2BOAuthClient$1 = /*#__PURE__*/function () {
3809
3853
  var discovery_redirect_url = _ref6.discovery_redirect_url,
3810
3854
  custom_scopes = _ref6.custom_scopes,
3811
3855
  provider_params = _ref6.provider_params;
3812
- return __awaiter$1(_this15, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee109() {
3856
+ return __awaiter$1(_this15, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee111() {
3813
3857
  var _yield$this$_dynamicC6, pkceRequiredForOAuth, baseURL, startUrl, key, keyPair;
3814
- return _regeneratorRuntime().wrap(function _callee109$(_context109) {
3815
- while (1) switch (_context109.prev = _context109.next) {
3858
+ return _regeneratorRuntime().wrap(function _callee111$(_context111) {
3859
+ while (1) switch (_context111.prev = _context111.next) {
3816
3860
  case 0:
3817
- _context109.next = 2;
3861
+ _context111.next = 2;
3818
3862
  return this._dynamicConfig;
3819
3863
  case 2:
3820
- _yield$this$_dynamicC6 = _context109.sent;
3864
+ _yield$this$_dynamicC6 = _context111.sent;
3821
3865
  pkceRequiredForOAuth = _yield$this$_dynamicC6.pkceRequiredForOAuth;
3822
- _context109.next = 6;
3866
+ _context111.next = 6;
3823
3867
  return this.getBaseApiUrl();
3824
3868
  case 6:
3825
- baseURL = _context109.sent;
3869
+ baseURL = _context111.sent;
3826
3870
  startUrl = new URL("".concat(baseURL, "/v1/b2b/public/oauth/").concat(providerType, "/discovery/start"));
3827
3871
  startUrl.searchParams.set('public_token', this._config.publicToken);
3828
3872
  if (custom_scopes) {
@@ -3836,15 +3880,15 @@ var HeadlessB2BOAuthClient$1 = /*#__PURE__*/function () {
3836
3880
  }
3837
3881
  }
3838
3882
  if (!pkceRequiredForOAuth) {
3839
- _context109.next = 18;
3883
+ _context111.next = 18;
3840
3884
  break;
3841
3885
  }
3842
- _context109.next = 14;
3886
+ _context111.next = 14;
3843
3887
  return this._pkceManager.startPKCETransaction();
3844
3888
  case 14:
3845
- keyPair = _context109.sent;
3889
+ keyPair = _context111.sent;
3846
3890
  startUrl.searchParams.set('pkce_code_challenge', keyPair.code_challenge);
3847
- _context109.next = 19;
3891
+ _context111.next = 19;
3848
3892
  break;
3849
3893
  case 18:
3850
3894
  this._pkceManager.clearPKPair();
@@ -3853,9 +3897,9 @@ var HeadlessB2BOAuthClient$1 = /*#__PURE__*/function () {
3853
3897
  window.location.href = startUrl.toString();
3854
3898
  case 21:
3855
3899
  case "end":
3856
- return _context109.stop();
3900
+ return _context111.stop();
3857
3901
  }
3858
- }, _callee109, this);
3902
+ }, _callee111, this);
3859
3903
  }));
3860
3904
  };
3861
3905
  }
@@ -3884,76 +3928,76 @@ var HeadlessB2BSessionClient = /*#__PURE__*/function () {
3884
3928
  });
3885
3929
  };
3886
3930
  this.revoke = function (options) {
3887
- return __awaiter$1(_this16, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee110() {
3931
+ return __awaiter$1(_this16, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee112() {
3888
3932
  var resp;
3889
- return _regeneratorRuntime().wrap(function _callee110$(_context110) {
3890
- while (1) switch (_context110.prev = _context110.next) {
3933
+ return _regeneratorRuntime().wrap(function _callee112$(_context112) {
3934
+ while (1) switch (_context112.prev = _context112.next) {
3891
3935
  case 0:
3892
- _context110.prev = 0;
3893
- _context110.next = 3;
3936
+ _context112.prev = 0;
3937
+ _context112.next = 3;
3894
3938
  return this._networkClient.fetchSDK({
3895
3939
  url: "/b2b/sessions/revoke",
3896
3940
  errorMessage: 'Error revoking session',
3897
3941
  method: 'POST'
3898
3942
  });
3899
3943
  case 3:
3900
- resp = _context110.sent;
3944
+ resp = _context112.sent;
3901
3945
  this._subscriptionService.destroyState();
3902
- return _context110.abrupt("return", resp);
3946
+ return _context112.abrupt("return", resp);
3903
3947
  case 8:
3904
- _context110.prev = 8;
3905
- _context110.t0 = _context110["catch"](0);
3948
+ _context112.prev = 8;
3949
+ _context112.t0 = _context112["catch"](0);
3906
3950
  if (!!(options === null || options === void 0 ? void 0 : options.forceClear)) {
3907
3951
  this._subscriptionService.destroyState();
3908
- } else if (UNRECOVERABLE_ERROR_TYPES.includes(_context110.t0.error_type)) {
3952
+ } else if (UNRECOVERABLE_ERROR_TYPES.includes(_context112.t0.error_type)) {
3909
3953
  this._subscriptionService.destroyState();
3910
3954
  }
3911
- throw _context110.t0;
3955
+ throw _context112.t0;
3912
3956
  case 12:
3913
3957
  case "end":
3914
- return _context110.stop();
3958
+ return _context112.stop();
3915
3959
  }
3916
- }, _callee110, this, [[0, 8]]);
3960
+ }, _callee112, this, [[0, 8]]);
3917
3961
  }));
3918
3962
  };
3919
3963
  this.revokeForMember = function (options) {
3920
- return __awaiter$1(_this16, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee111() {
3921
- return _regeneratorRuntime().wrap(function _callee111$(_context111) {
3922
- while (1) switch (_context111.prev = _context111.next) {
3964
+ return __awaiter$1(_this16, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee113() {
3965
+ return _regeneratorRuntime().wrap(function _callee113$(_context113) {
3966
+ while (1) switch (_context113.prev = _context113.next) {
3923
3967
  case 0:
3924
3968
  validate('stytch.sessions.revokeForMember').isString('member_id', options.member_id);
3925
- _context111.next = 3;
3969
+ _context113.next = 3;
3926
3970
  return this._networkClient.fetchSDK({
3927
3971
  url: "/b2b/sessions/revoke/".concat(options.member_id),
3928
3972
  errorMessage: 'Error revoking session',
3929
3973
  method: 'POST'
3930
3974
  });
3931
3975
  case 3:
3932
- return _context111.abrupt("return", _context111.sent);
3976
+ return _context113.abrupt("return", _context113.sent);
3933
3977
  case 4:
3934
3978
  case "end":
3935
- return _context111.stop();
3979
+ return _context113.stop();
3936
3980
  }
3937
- }, _callee111, this);
3981
+ }, _callee113, this);
3938
3982
  }));
3939
3983
  };
3940
3984
  this.authenticate = function (options) {
3941
- return __awaiter$1(_this16, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee112() {
3985
+ return __awaiter$1(_this16, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee114() {
3942
3986
  var _this17 = this;
3943
3987
  var initialSession, isSessionStale, requestBody, resp;
3944
- return _regeneratorRuntime().wrap(function _callee112$(_context112) {
3945
- while (1) switch (_context112.prev = _context112.next) {
3988
+ return _regeneratorRuntime().wrap(function _callee114$(_context114) {
3989
+ while (1) switch (_context114.prev = _context114.next) {
3946
3990
  case 0:
3947
3991
  initialSession = this._subscriptionService.getSession();
3948
3992
  isSessionStale = function isSessionStale() {
3949
3993
  var _a;
3950
3994
  return (initialSession === null || initialSession === void 0 ? void 0 : initialSession.member_session_id) !== ((_a = _this17._subscriptionService.getSession()) === null || _a === void 0 ? void 0 : _a.member_session_id);
3951
3995
  };
3952
- _context112.prev = 2;
3996
+ _context114.prev = 2;
3953
3997
  requestBody = {
3954
3998
  session_duration_minutes: options === null || options === void 0 ? void 0 : options.session_duration_minutes
3955
3999
  };
3956
- _context112.next = 6;
4000
+ _context114.next = 6;
3957
4001
  return this._networkClient.fetchSDK({
3958
4002
  url: '/b2b/sessions/authenticate',
3959
4003
  body: requestBody,
@@ -3961,12 +4005,12 @@ var HeadlessB2BSessionClient = /*#__PURE__*/function () {
3961
4005
  method: 'POST'
3962
4006
  });
3963
4007
  case 6:
3964
- resp = _context112.sent;
4008
+ resp = _context114.sent;
3965
4009
  if (!isSessionStale()) {
3966
- _context112.next = 9;
4010
+ _context114.next = 9;
3967
4011
  break;
3968
4012
  }
3969
- return _context112.abrupt("return", this.authenticate(options));
4013
+ return _context114.abrupt("return", this.authenticate(options));
3970
4014
  case 9:
3971
4015
  this._subscriptionService.updateStateAndTokens({
3972
4016
  state: {
@@ -3978,36 +4022,36 @@ var HeadlessB2BSessionClient = /*#__PURE__*/function () {
3978
4022
  session_jwt: resp.session_jwt,
3979
4023
  intermediate_session_token: null
3980
4024
  });
3981
- return _context112.abrupt("return", resp);
4025
+ return _context114.abrupt("return", resp);
3982
4026
  case 13:
3983
- _context112.prev = 13;
3984
- _context112.t0 = _context112["catch"](2);
4027
+ _context114.prev = 13;
4028
+ _context114.t0 = _context114["catch"](2);
3985
4029
  if (!isSessionStale()) {
3986
- _context112.next = 17;
4030
+ _context114.next = 17;
3987
4031
  break;
3988
4032
  }
3989
- return _context112.abrupt("return", this.authenticate(options));
4033
+ return _context114.abrupt("return", this.authenticate(options));
3990
4034
  case 17:
3991
- if (UNRECOVERABLE_ERROR_TYPES.includes(_context112.t0.error_type)) {
4035
+ if (UNRECOVERABLE_ERROR_TYPES.includes(_context114.t0.error_type)) {
3992
4036
  this._subscriptionService.destroySession();
3993
4037
  }
3994
- throw _context112.t0;
4038
+ throw _context114.t0;
3995
4039
  case 19:
3996
4040
  case "end":
3997
- return _context112.stop();
4041
+ return _context114.stop();
3998
4042
  }
3999
- }, _callee112, this, [[2, 13]]);
4043
+ }, _callee114, this, [[2, 13]]);
4000
4044
  }));
4001
4045
  };
4002
4046
  this.exchange = function (data) {
4003
- return __awaiter$1(_this16, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee113() {
4047
+ return __awaiter$1(_this16, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee115() {
4004
4048
  var resp;
4005
- return _regeneratorRuntime().wrap(function _callee113$(_context113) {
4006
- while (1) switch (_context113.prev = _context113.next) {
4049
+ return _regeneratorRuntime().wrap(function _callee115$(_context115) {
4050
+ while (1) switch (_context115.prev = _context115.next) {
4007
4051
  case 0:
4008
4052
  validate('stytch.sessions.exchange').isString('organization_id', data.organization_id).isNumber('session_duration_minutes', data.session_duration_minutes).isOptionalString('locale', data.locale);
4009
- _context113.prev = 1;
4010
- _context113.next = 4;
4053
+ _context115.prev = 1;
4054
+ _context115.next = 4;
4011
4055
  return this._networkClient.fetchSDK({
4012
4056
  url: '/b2b/sessions/exchange',
4013
4057
  body: data,
@@ -4015,7 +4059,7 @@ var HeadlessB2BSessionClient = /*#__PURE__*/function () {
4015
4059
  method: 'POST'
4016
4060
  });
4017
4061
  case 4:
4018
- resp = _context113.sent;
4062
+ resp = _context115.sent;
4019
4063
  if (resp.member_session) {
4020
4064
  this._subscriptionService.updateStateAndTokens({
4021
4065
  state: {
@@ -4035,16 +4079,16 @@ var HeadlessB2BSessionClient = /*#__PURE__*/function () {
4035
4079
  intermediate_session_token: resp.intermediate_session_token
4036
4080
  });
4037
4081
  }
4038
- return _context113.abrupt("return", resp);
4082
+ return _context115.abrupt("return", resp);
4039
4083
  case 9:
4040
- _context113.prev = 9;
4041
- _context113.t0 = _context113["catch"](1);
4042
- throw _context113.t0;
4084
+ _context115.prev = 9;
4085
+ _context115.t0 = _context115["catch"](1);
4086
+ throw _context115.t0;
4043
4087
  case 12:
4044
4088
  case "end":
4045
- return _context113.stop();
4089
+ return _context115.stop();
4046
4090
  }
4047
- }, _callee113, this, [[1, 9]]);
4091
+ }, _callee115, this, [[1, 9]]);
4048
4092
  }));
4049
4093
  };
4050
4094
  }
@@ -4070,64 +4114,64 @@ var HeadlessB2BDiscoveryClient = /*#__PURE__*/_createClass(function HeadlessB2BD
4070
4114
  this._subscriptionService = _subscriptionService;
4071
4115
  this.organizations = {
4072
4116
  list: function list() {
4073
- return __awaiter$1(_this18, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee114() {
4074
- return _regeneratorRuntime().wrap(function _callee114$(_context114) {
4075
- while (1) switch (_context114.prev = _context114.next) {
4117
+ return __awaiter$1(_this18, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee116() {
4118
+ return _regeneratorRuntime().wrap(function _callee116$(_context116) {
4119
+ while (1) switch (_context116.prev = _context116.next) {
4076
4120
  case 0:
4077
- _context114.t0 = this._networkClient;
4078
- _context114.next = 3;
4121
+ _context116.t0 = this._networkClient;
4122
+ _context116.next = 3;
4079
4123
  return this._subscriptionService.getIntermediateSessionToken();
4080
4124
  case 3:
4081
- _context114.t1 = _context114.sent;
4082
- if (_context114.t1) {
4083
- _context114.next = 6;
4125
+ _context116.t1 = _context116.sent;
4126
+ if (_context116.t1) {
4127
+ _context116.next = 6;
4084
4128
  break;
4085
4129
  }
4086
- _context114.t1 = undefined;
4130
+ _context116.t1 = undefined;
4087
4131
  case 6:
4088
- _context114.t2 = _context114.t1;
4089
- _context114.t3 = {
4090
- intermediate_session_token: _context114.t2
4132
+ _context116.t2 = _context116.t1;
4133
+ _context116.t3 = {
4134
+ intermediate_session_token: _context116.t2
4091
4135
  };
4092
- _context114.t4 = {
4136
+ _context116.t4 = {
4093
4137
  url: '/b2b/discovery/organizations',
4094
- body: _context114.t3,
4138
+ body: _context116.t3,
4095
4139
  errorMessage: 'Failed to retrieve discovered organizations',
4096
4140
  method: 'POST'
4097
4141
  };
4098
- return _context114.abrupt("return", _context114.t0.fetchSDK.call(_context114.t0, _context114.t4));
4142
+ return _context116.abrupt("return", _context116.t0.fetchSDK.call(_context116.t0, _context116.t4));
4099
4143
  case 10:
4100
4144
  case "end":
4101
- return _context114.stop();
4145
+ return _context116.stop();
4102
4146
  }
4103
- }, _callee114, this);
4147
+ }, _callee116, this);
4104
4148
  }));
4105
4149
  },
4106
4150
  create: function create(data) {
4107
- return __awaiter$1(_this18, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee115() {
4151
+ return __awaiter$1(_this18, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee117() {
4108
4152
  var requestBody, resp;
4109
- return _regeneratorRuntime().wrap(function _callee115$(_context115) {
4110
- while (1) switch (_context115.prev = _context115.next) {
4153
+ return _regeneratorRuntime().wrap(function _callee117$(_context117) {
4154
+ while (1) switch (_context117.prev = _context117.next) {
4111
4155
  case 0:
4112
4156
  validate('stytch.discovery.organizations.create').isNumber('session_duration_minutes', data.session_duration_minutes).isOptionalString('organization_name', data.organization_name).isOptionalString('organization_slug', data.organization_slug).isOptionalString('organization_logo_url', data.organization_logo_url).isOptionalString('sso_jit_provisioning', data.sso_jit_provisioning).isOptionalStringArray('email_allowed_domains', data.email_allowed_domains).isOptionalString('email_invites', data.email_invites).isOptionalString('auth_methods', data.auth_methods).isOptionalStringArray('allowed_auth_methods', data.allowed_auth_methods).isOptionalString('mfa_policy', data.mfa_policy);
4113
- _context115.t0 = Object;
4114
- _context115.t1 = Object.assign({}, data);
4115
- _context115.next = 5;
4157
+ _context117.t0 = Object;
4158
+ _context117.t1 = Object.assign({}, data);
4159
+ _context117.next = 5;
4116
4160
  return this._subscriptionService.getIntermediateSessionToken();
4117
4161
  case 5:
4118
- _context115.t2 = _context115.sent;
4119
- if (_context115.t2) {
4120
- _context115.next = 8;
4162
+ _context117.t2 = _context117.sent;
4163
+ if (_context117.t2) {
4164
+ _context117.next = 8;
4121
4165
  break;
4122
4166
  }
4123
- _context115.t2 = undefined;
4167
+ _context117.t2 = undefined;
4124
4168
  case 8:
4125
- _context115.t3 = _context115.t2;
4126
- _context115.t4 = {
4127
- intermediate_session_token: _context115.t3
4169
+ _context117.t3 = _context117.t2;
4170
+ _context117.t4 = {
4171
+ intermediate_session_token: _context117.t3
4128
4172
  };
4129
- requestBody = _context115.t0.assign.call(_context115.t0, _context115.t1, _context115.t4);
4130
- _context115.next = 13;
4173
+ requestBody = _context117.t0.assign.call(_context117.t0, _context117.t1, _context117.t4);
4174
+ _context117.next = 13;
4131
4175
  return this._networkClient.fetchSDK({
4132
4176
  url: '/b2b/discovery/organizations/create',
4133
4177
  body: requestBody,
@@ -4135,7 +4179,7 @@ var HeadlessB2BDiscoveryClient = /*#__PURE__*/_createClass(function HeadlessB2BD
4135
4179
  method: 'POST'
4136
4180
  });
4137
4181
  case 13:
4138
- resp = _context115.sent;
4182
+ resp = _context117.sent;
4139
4183
  if (resp.member_session) {
4140
4184
  this._subscriptionService.updateStateAndTokens({
4141
4185
  state: {
@@ -4155,41 +4199,41 @@ var HeadlessB2BDiscoveryClient = /*#__PURE__*/_createClass(function HeadlessB2BD
4155
4199
  intermediate_session_token: resp.intermediate_session_token
4156
4200
  });
4157
4201
  }
4158
- return _context115.abrupt("return", resp);
4202
+ return _context117.abrupt("return", resp);
4159
4203
  case 16:
4160
4204
  case "end":
4161
- return _context115.stop();
4205
+ return _context117.stop();
4162
4206
  }
4163
- }, _callee115, this);
4207
+ }, _callee117, this);
4164
4208
  }));
4165
4209
  }
4166
4210
  };
4167
4211
  this.intermediateSessions = {
4168
4212
  exchange: function exchange(data) {
4169
- return __awaiter$1(_this18, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee116() {
4213
+ return __awaiter$1(_this18, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee118() {
4170
4214
  var requestBody, resp;
4171
- return _regeneratorRuntime().wrap(function _callee116$(_context116) {
4172
- while (1) switch (_context116.prev = _context116.next) {
4215
+ return _regeneratorRuntime().wrap(function _callee118$(_context118) {
4216
+ while (1) switch (_context118.prev = _context118.next) {
4173
4217
  case 0:
4174
4218
  validate('stytch.discovery.intermediateSessions.exchange').isString('organization_id', data.organization_id).isNumber('session_duration_minutes', data.session_duration_minutes).isOptionalString('locale', data.locale);
4175
- _context116.t0 = Object;
4176
- _context116.t1 = Object.assign({}, data);
4177
- _context116.next = 5;
4219
+ _context118.t0 = Object;
4220
+ _context118.t1 = Object.assign({}, data);
4221
+ _context118.next = 5;
4178
4222
  return this._subscriptionService.getIntermediateSessionToken();
4179
4223
  case 5:
4180
- _context116.t2 = _context116.sent;
4181
- if (_context116.t2) {
4182
- _context116.next = 8;
4224
+ _context118.t2 = _context118.sent;
4225
+ if (_context118.t2) {
4226
+ _context118.next = 8;
4183
4227
  break;
4184
4228
  }
4185
- _context116.t2 = undefined;
4229
+ _context118.t2 = undefined;
4186
4230
  case 8:
4187
- _context116.t3 = _context116.t2;
4188
- _context116.t4 = {
4189
- intermediate_session_token: _context116.t3
4231
+ _context118.t3 = _context118.t2;
4232
+ _context118.t4 = {
4233
+ intermediate_session_token: _context118.t3
4190
4234
  };
4191
- requestBody = _context116.t0.assign.call(_context116.t0, _context116.t1, _context116.t4);
4192
- _context116.next = 13;
4235
+ requestBody = _context118.t0.assign.call(_context118.t0, _context118.t1, _context118.t4);
4236
+ _context118.next = 13;
4193
4237
  return this._networkClient.fetchSDK({
4194
4238
  url: '/b2b/discovery/intermediate_sessions/exchange',
4195
4239
  body: requestBody,
@@ -4197,7 +4241,7 @@ var HeadlessB2BDiscoveryClient = /*#__PURE__*/_createClass(function HeadlessB2BD
4197
4241
  method: 'POST'
4198
4242
  });
4199
4243
  case 13:
4200
- resp = _context116.sent;
4244
+ resp = _context118.sent;
4201
4245
  if (resp.member_session) {
4202
4246
  this._subscriptionService.updateStateAndTokens({
4203
4247
  state: {
@@ -4217,12 +4261,12 @@ var HeadlessB2BDiscoveryClient = /*#__PURE__*/_createClass(function HeadlessB2BD
4217
4261
  intermediate_session_token: resp.intermediate_session_token
4218
4262
  });
4219
4263
  }
4220
- return _context116.abrupt("return", resp);
4264
+ return _context118.abrupt("return", resp);
4221
4265
  case 16:
4222
4266
  case "end":
4223
- return _context116.stop();
4267
+ return _context118.stop();
4224
4268
  }
4225
- }, _callee116, this);
4269
+ }, _callee118, this);
4226
4270
  }));
4227
4271
  }
4228
4272
  };
@@ -4244,107 +4288,107 @@ var HeadlessB2BPasswordsClient = /*#__PURE__*/function () {
4244
4288
  _createClass(HeadlessB2BPasswordsClient, [{
4245
4289
  key: "getCodeChallenge",
4246
4290
  value: function getCodeChallenge() {
4247
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee117() {
4291
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee119() {
4248
4292
  var _yield$this$_config6, pkceRequiredForPasswordResets, keyPair;
4249
- return _regeneratorRuntime().wrap(function _callee117$(_context117) {
4250
- while (1) switch (_context117.prev = _context117.next) {
4293
+ return _regeneratorRuntime().wrap(function _callee119$(_context119) {
4294
+ while (1) switch (_context119.prev = _context119.next) {
4251
4295
  case 0:
4252
- _context117.next = 2;
4296
+ _context119.next = 2;
4253
4297
  return this._config;
4254
4298
  case 2:
4255
- _yield$this$_config6 = _context117.sent;
4299
+ _yield$this$_config6 = _context119.sent;
4256
4300
  pkceRequiredForPasswordResets = _yield$this$_config6.pkceRequiredForPasswordResets;
4257
4301
  if (pkceRequiredForPasswordResets) {
4258
- _context117.next = 6;
4302
+ _context119.next = 6;
4259
4303
  break;
4260
4304
  }
4261
- return _context117.abrupt("return", undefined);
4305
+ return _context119.abrupt("return", undefined);
4262
4306
  case 6:
4263
- _context117.next = 8;
4307
+ _context119.next = 8;
4264
4308
  return this._pkceManager.getPKPair();
4265
4309
  case 8:
4266
- keyPair = _context117.sent;
4310
+ keyPair = _context119.sent;
4267
4311
  if (!keyPair) {
4268
- _context117.next = 11;
4312
+ _context119.next = 11;
4269
4313
  break;
4270
4314
  }
4271
- return _context117.abrupt("return", keyPair.code_challenge);
4315
+ return _context119.abrupt("return", keyPair.code_challenge);
4272
4316
  case 11:
4273
- _context117.next = 13;
4317
+ _context119.next = 13;
4274
4318
  return this._pkceManager.startPKCETransaction();
4275
4319
  case 13:
4276
- keyPair = _context117.sent;
4277
- return _context117.abrupt("return", keyPair.code_challenge);
4320
+ keyPair = _context119.sent;
4321
+ return _context119.abrupt("return", keyPair.code_challenge);
4278
4322
  case 15:
4279
4323
  case "end":
4280
- return _context117.stop();
4324
+ return _context119.stop();
4281
4325
  }
4282
- }, _callee117, this);
4326
+ }, _callee119, this);
4283
4327
  }));
4284
4328
  }
4285
4329
  }, {
4286
4330
  key: "authenticate",
4287
4331
  value: function authenticate(options) {
4288
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee118() {
4332
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee120() {
4289
4333
  var pkPair, code_verifier, _yield$this$dfpProtec24, dfp_telemetry_id, captcha_token, resp;
4290
- return _regeneratorRuntime().wrap(function _callee118$(_context118) {
4291
- while (1) switch (_context118.prev = _context118.next) {
4334
+ return _regeneratorRuntime().wrap(function _callee120$(_context120) {
4335
+ while (1) switch (_context120.prev = _context120.next) {
4292
4336
  case 0:
4293
4337
  validate('stytch.passwords.authenticate').isString('org_id', options.organization_id).isString('password', options.password).isString('email_address', options.email_address).isNumber('session_duration_minutes', options.session_duration_minutes).isOptionalString('locale', options.locale);
4294
- _context118.next = 3;
4338
+ _context120.next = 3;
4295
4339
  return this._pkceManager.getPKPair();
4296
4340
  case 3:
4297
- pkPair = _context118.sent;
4341
+ pkPair = _context120.sent;
4298
4342
  code_verifier = pkPair === null || pkPair === void 0 ? void 0 : pkPair.code_verifier;
4299
- _context118.next = 7;
4343
+ _context120.next = 7;
4300
4344
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
4301
4345
  case 7:
4302
- _yield$this$dfpProtec24 = _context118.sent;
4346
+ _yield$this$dfpProtec24 = _context120.sent;
4303
4347
  dfp_telemetry_id = _yield$this$dfpProtec24.dfp_telemetry_id;
4304
4348
  captcha_token = _yield$this$dfpProtec24.captcha_token;
4305
- _context118.t0 = this._networkClient;
4306
- _context118.t1 = options.organization_id;
4307
- _context118.t2 = options.email_address;
4308
- _context118.t3 = options.password;
4309
- _context118.t4 = options.session_duration_minutes;
4310
- _context118.t5 = options.locale;
4311
- _context118.t6 = captcha_token;
4312
- _context118.t7 = dfp_telemetry_id;
4313
- _context118.t8 = code_verifier;
4314
- _context118.next = 21;
4349
+ _context120.t0 = this._networkClient;
4350
+ _context120.t1 = options.organization_id;
4351
+ _context120.t2 = options.email_address;
4352
+ _context120.t3 = options.password;
4353
+ _context120.t4 = options.session_duration_minutes;
4354
+ _context120.t5 = options.locale;
4355
+ _context120.t6 = captcha_token;
4356
+ _context120.t7 = dfp_telemetry_id;
4357
+ _context120.t8 = code_verifier;
4358
+ _context120.next = 21;
4315
4359
  return this._subscriptionService.getIntermediateSessionToken();
4316
4360
  case 21:
4317
- _context118.t9 = _context118.sent;
4318
- if (_context118.t9) {
4319
- _context118.next = 24;
4361
+ _context120.t9 = _context120.sent;
4362
+ if (_context120.t9) {
4363
+ _context120.next = 24;
4320
4364
  break;
4321
4365
  }
4322
- _context118.t9 = undefined;
4366
+ _context120.t9 = undefined;
4323
4367
  case 24:
4324
- _context118.t10 = _context118.t9;
4325
- _context118.t11 = {
4326
- organization_id: _context118.t1,
4327
- email_address: _context118.t2,
4328
- password: _context118.t3,
4329
- session_duration_minutes: _context118.t4,
4330
- locale: _context118.t5,
4331
- captcha_token: _context118.t6,
4332
- dfp_telemetry_id: _context118.t7,
4333
- code_verifier: _context118.t8,
4334
- intermediate_session_token: _context118.t10
4368
+ _context120.t10 = _context120.t9;
4369
+ _context120.t11 = {
4370
+ organization_id: _context120.t1,
4371
+ email_address: _context120.t2,
4372
+ password: _context120.t3,
4373
+ session_duration_minutes: _context120.t4,
4374
+ locale: _context120.t5,
4375
+ captcha_token: _context120.t6,
4376
+ dfp_telemetry_id: _context120.t7,
4377
+ code_verifier: _context120.t8,
4378
+ intermediate_session_token: _context120.t10
4335
4379
  };
4336
- _context118.t12 = this.dfpProtectedAuth.retryWithCaptchaAndDFP;
4337
- _context118.t13 = {
4380
+ _context120.t12 = this.dfpProtectedAuth.retryWithCaptchaAndDFP;
4381
+ _context120.t13 = {
4338
4382
  url: '/b2b/passwords/authenticate',
4339
4383
  method: 'POST',
4340
4384
  errorMessage: 'Failed to authenticate password.',
4341
- body: _context118.t11,
4342
- retryCallback: _context118.t12
4385
+ body: _context120.t11,
4386
+ retryCallback: _context120.t12
4343
4387
  };
4344
- _context118.next = 30;
4345
- return _context118.t0.retriableFetchSDK.call(_context118.t0, _context118.t13);
4388
+ _context120.next = 30;
4389
+ return _context120.t0.retriableFetchSDK.call(_context120.t0, _context120.t13);
4346
4390
  case 30:
4347
- resp = _context118.sent;
4391
+ resp = _context120.sent;
4348
4392
  if (resp.member_session) {
4349
4393
  this._subscriptionService.updateStateAndTokens({
4350
4394
  state: {
@@ -4364,34 +4408,34 @@ var HeadlessB2BPasswordsClient = /*#__PURE__*/function () {
4364
4408
  intermediate_session_token: resp.intermediate_session_token
4365
4409
  });
4366
4410
  }
4367
- return _context118.abrupt("return", resp);
4411
+ return _context120.abrupt("return", resp);
4368
4412
  case 33:
4369
4413
  case "end":
4370
- return _context118.stop();
4414
+ return _context120.stop();
4371
4415
  }
4372
- }, _callee118, this);
4416
+ }, _callee120, this);
4373
4417
  }));
4374
4418
  }
4375
4419
  }, {
4376
4420
  key: "resetByEmailStart",
4377
4421
  value: function resetByEmailStart(options) {
4378
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee119() {
4422
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee121() {
4379
4423
  var code_challenge, _yield$this$dfpProtec25, dfp_telemetry_id, captcha_token;
4380
- return _regeneratorRuntime().wrap(function _callee119$(_context119) {
4381
- while (1) switch (_context119.prev = _context119.next) {
4424
+ return _regeneratorRuntime().wrap(function _callee121$(_context121) {
4425
+ while (1) switch (_context121.prev = _context121.next) {
4382
4426
  case 0:
4383
4427
  validate('stytch.passwords.resetByEmailStart').isString('email', options.email_address).isOptionalString('login_redirect_url', options.login_redirect_url).isOptionalString('reset_password_redirect_url', options.reset_password_redirect_url).isOptionalString('reset_password_template_id', options.reset_password_template_id).isOptionalNumber('reset_password_expiration_minutes', options.reset_password_expiration_minutes);
4384
- _context119.next = 3;
4428
+ _context121.next = 3;
4385
4429
  return this.getCodeChallenge();
4386
4430
  case 3:
4387
- code_challenge = _context119.sent;
4388
- _context119.next = 6;
4431
+ code_challenge = _context121.sent;
4432
+ _context121.next = 6;
4389
4433
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
4390
4434
  case 6:
4391
- _yield$this$dfpProtec25 = _context119.sent;
4435
+ _yield$this$dfpProtec25 = _context121.sent;
4392
4436
  dfp_telemetry_id = _yield$this$dfpProtec25.dfp_telemetry_id;
4393
4437
  captcha_token = _yield$this$dfpProtec25.captcha_token;
4394
- return _context119.abrupt("return", this._networkClient.retriableFetchSDK({
4438
+ return _context121.abrupt("return", this._networkClient.retriableFetchSDK({
4395
4439
  url: '/b2b/passwords/email/reset/start',
4396
4440
  method: 'POST',
4397
4441
  errorMessage: 'Failed to start password reset flow.',
@@ -4410,72 +4454,72 @@ var HeadlessB2BPasswordsClient = /*#__PURE__*/function () {
4410
4454
  }));
4411
4455
  case 10:
4412
4456
  case "end":
4413
- return _context119.stop();
4457
+ return _context121.stop();
4414
4458
  }
4415
- }, _callee119, this);
4459
+ }, _callee121, this);
4416
4460
  }));
4417
4461
  }
4418
4462
  }, {
4419
4463
  key: "resetByEmail",
4420
4464
  value: function resetByEmail(options) {
4421
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee120() {
4465
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee122() {
4422
4466
  var _yield$this$dfpProtec26, dfp_telemetry_id, captcha_token, pkPair, code_verifier, resp;
4423
- return _regeneratorRuntime().wrap(function _callee120$(_context120) {
4424
- while (1) switch (_context120.prev = _context120.next) {
4467
+ return _regeneratorRuntime().wrap(function _callee122$(_context122) {
4468
+ while (1) switch (_context122.prev = _context122.next) {
4425
4469
  case 0:
4426
4470
  validate('stytch.passwords.resetByEmail').isString('password_reset_token', options.password_reset_token).isString('password', options.password).isNumber('session_duration_minutes', options.session_duration_minutes).isOptionalString('locale', options.locale);
4427
- _context120.next = 3;
4471
+ _context122.next = 3;
4428
4472
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
4429
4473
  case 3:
4430
- _yield$this$dfpProtec26 = _context120.sent;
4474
+ _yield$this$dfpProtec26 = _context122.sent;
4431
4475
  dfp_telemetry_id = _yield$this$dfpProtec26.dfp_telemetry_id;
4432
4476
  captcha_token = _yield$this$dfpProtec26.captcha_token;
4433
- _context120.next = 8;
4477
+ _context122.next = 8;
4434
4478
  return this._pkceManager.getPKPair();
4435
4479
  case 8:
4436
- pkPair = _context120.sent;
4480
+ pkPair = _context122.sent;
4437
4481
  code_verifier = pkPair === null || pkPair === void 0 ? void 0 : pkPair.code_verifier;
4438
- _context120.t0 = this._networkClient;
4439
- _context120.t1 = options.password_reset_token;
4440
- _context120.t2 = options.password;
4441
- _context120.t3 = options.session_duration_minutes;
4442
- _context120.t4 = options.locale;
4443
- _context120.t5 = captcha_token;
4444
- _context120.t6 = dfp_telemetry_id;
4445
- _context120.t7 = code_verifier;
4446
- _context120.next = 20;
4482
+ _context122.t0 = this._networkClient;
4483
+ _context122.t1 = options.password_reset_token;
4484
+ _context122.t2 = options.password;
4485
+ _context122.t3 = options.session_duration_minutes;
4486
+ _context122.t4 = options.locale;
4487
+ _context122.t5 = captcha_token;
4488
+ _context122.t6 = dfp_telemetry_id;
4489
+ _context122.t7 = code_verifier;
4490
+ _context122.next = 20;
4447
4491
  return this._subscriptionService.getIntermediateSessionToken();
4448
4492
  case 20:
4449
- _context120.t8 = _context120.sent;
4450
- if (_context120.t8) {
4451
- _context120.next = 23;
4493
+ _context122.t8 = _context122.sent;
4494
+ if (_context122.t8) {
4495
+ _context122.next = 23;
4452
4496
  break;
4453
4497
  }
4454
- _context120.t8 = undefined;
4498
+ _context122.t8 = undefined;
4455
4499
  case 23:
4456
- _context120.t9 = _context120.t8;
4457
- _context120.t10 = {
4458
- password_reset_token: _context120.t1,
4459
- password: _context120.t2,
4460
- session_duration_minutes: _context120.t3,
4461
- locale: _context120.t4,
4462
- captcha_token: _context120.t5,
4463
- dfp_telemetry_id: _context120.t6,
4464
- code_verifier: _context120.t7,
4465
- intermediate_session_token: _context120.t9
4500
+ _context122.t9 = _context122.t8;
4501
+ _context122.t10 = {
4502
+ password_reset_token: _context122.t1,
4503
+ password: _context122.t2,
4504
+ session_duration_minutes: _context122.t3,
4505
+ locale: _context122.t4,
4506
+ captcha_token: _context122.t5,
4507
+ dfp_telemetry_id: _context122.t6,
4508
+ code_verifier: _context122.t7,
4509
+ intermediate_session_token: _context122.t9
4466
4510
  };
4467
- _context120.t11 = this.dfpProtectedAuth.retryWithCaptchaAndDFP;
4468
- _context120.t12 = {
4511
+ _context122.t11 = this.dfpProtectedAuth.retryWithCaptchaAndDFP;
4512
+ _context122.t12 = {
4469
4513
  url: '/b2b/passwords/email/reset',
4470
4514
  method: 'POST',
4471
4515
  errorMessage: 'Failed to reset password.',
4472
- body: _context120.t10,
4473
- retryCallback: _context120.t11
4516
+ body: _context122.t10,
4517
+ retryCallback: _context122.t11
4474
4518
  };
4475
- _context120.next = 29;
4476
- return _context120.t0.retriableFetchSDK.call(_context120.t0, _context120.t12);
4519
+ _context122.next = 29;
4520
+ return _context122.t0.retriableFetchSDK.call(_context122.t0, _context122.t12);
4477
4521
  case 29:
4478
- resp = _context120.sent;
4522
+ resp = _context122.sent;
4479
4523
  this._pkceManager.clearPKPair();
4480
4524
  if (resp.member_session) {
4481
4525
  this._subscriptionService.updateStateAndTokens({
@@ -4496,30 +4540,30 @@ var HeadlessB2BPasswordsClient = /*#__PURE__*/function () {
4496
4540
  intermediate_session_token: resp.intermediate_session_token
4497
4541
  });
4498
4542
  }
4499
- return _context120.abrupt("return", resp);
4543
+ return _context122.abrupt("return", resp);
4500
4544
  case 33:
4501
4545
  case "end":
4502
- return _context120.stop();
4546
+ return _context122.stop();
4503
4547
  }
4504
- }, _callee120, this);
4548
+ }, _callee122, this);
4505
4549
  }));
4506
4550
  }
4507
4551
  }, {
4508
4552
  key: "resetByExistingPassword",
4509
4553
  value: function resetByExistingPassword(options) {
4510
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee121() {
4554
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee123() {
4511
4555
  var _yield$this$dfpProtec27, dfp_telemetry_id, captcha_token, resp;
4512
- return _regeneratorRuntime().wrap(function _callee121$(_context121) {
4513
- while (1) switch (_context121.prev = _context121.next) {
4556
+ return _regeneratorRuntime().wrap(function _callee123$(_context123) {
4557
+ while (1) switch (_context123.prev = _context123.next) {
4514
4558
  case 0:
4515
4559
  validate('stytch.passwords.resetByExistingPassword').isString('email', options.email_address).isString('existing_password', options.existing_password).isString('new_password', options.new_password).isOptionalString('locale', options.locale);
4516
- _context121.next = 3;
4560
+ _context123.next = 3;
4517
4561
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
4518
4562
  case 3:
4519
- _yield$this$dfpProtec27 = _context121.sent;
4563
+ _yield$this$dfpProtec27 = _context123.sent;
4520
4564
  dfp_telemetry_id = _yield$this$dfpProtec27.dfp_telemetry_id;
4521
4565
  captcha_token = _yield$this$dfpProtec27.captcha_token;
4522
- _context121.next = 8;
4566
+ _context123.next = 8;
4523
4567
  return this._networkClient.retriableFetchSDK({
4524
4568
  url: '/b2b/passwords/existing_password/reset',
4525
4569
  method: 'POST',
@@ -4537,7 +4581,7 @@ var HeadlessB2BPasswordsClient = /*#__PURE__*/function () {
4537
4581
  retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
4538
4582
  });
4539
4583
  case 8:
4540
- resp = _context121.sent;
4584
+ resp = _context123.sent;
4541
4585
  if (resp.member_session) {
4542
4586
  this._subscriptionService.updateStateAndTokens({
4543
4587
  state: {
@@ -4557,30 +4601,30 @@ var HeadlessB2BPasswordsClient = /*#__PURE__*/function () {
4557
4601
  intermediate_session_token: resp.intermediate_session_token
4558
4602
  });
4559
4603
  }
4560
- return _context121.abrupt("return", resp);
4604
+ return _context123.abrupt("return", resp);
4561
4605
  case 11:
4562
4606
  case "end":
4563
- return _context121.stop();
4607
+ return _context123.stop();
4564
4608
  }
4565
- }, _callee121, this);
4609
+ }, _callee123, this);
4566
4610
  }));
4567
4611
  }
4568
4612
  }, {
4569
4613
  key: "resetBySession",
4570
4614
  value: function resetBySession(options) {
4571
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee122() {
4615
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee124() {
4572
4616
  var _yield$this$dfpProtec28, dfp_telemetry_id, captcha_token, resp;
4573
- return _regeneratorRuntime().wrap(function _callee122$(_context122) {
4574
- while (1) switch (_context122.prev = _context122.next) {
4617
+ return _regeneratorRuntime().wrap(function _callee124$(_context124) {
4618
+ while (1) switch (_context124.prev = _context124.next) {
4575
4619
  case 0:
4576
4620
  validate('stytch.passwords.resetBySession').isString('password', options.password);
4577
- _context122.next = 3;
4621
+ _context124.next = 3;
4578
4622
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
4579
4623
  case 3:
4580
- _yield$this$dfpProtec28 = _context122.sent;
4624
+ _yield$this$dfpProtec28 = _context124.sent;
4581
4625
  dfp_telemetry_id = _yield$this$dfpProtec28.dfp_telemetry_id;
4582
4626
  captcha_token = _yield$this$dfpProtec28.captcha_token;
4583
- _context122.next = 8;
4627
+ _context124.next = 8;
4584
4628
  return this._networkClient.retriableFetchSDK({
4585
4629
  url: '/b2b/passwords/session/reset',
4586
4630
  method: 'POST',
@@ -4593,7 +4637,7 @@ var HeadlessB2BPasswordsClient = /*#__PURE__*/function () {
4593
4637
  retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
4594
4638
  });
4595
4639
  case 8:
4596
- resp = _context122.sent;
4640
+ resp = _context124.sent;
4597
4641
  this._subscriptionService.updateStateAndTokens({
4598
4642
  state: {
4599
4643
  session: resp.member_session,
@@ -4604,23 +4648,23 @@ var HeadlessB2BPasswordsClient = /*#__PURE__*/function () {
4604
4648
  session_jwt: resp.session_jwt,
4605
4649
  intermediate_session_token: null
4606
4650
  });
4607
- return _context122.abrupt("return", resp);
4651
+ return _context124.abrupt("return", resp);
4608
4652
  case 11:
4609
4653
  case "end":
4610
- return _context122.stop();
4654
+ return _context124.stop();
4611
4655
  }
4612
- }, _callee122, this);
4656
+ }, _callee124, this);
4613
4657
  }));
4614
4658
  }
4615
4659
  }, {
4616
4660
  key: "strengthCheck",
4617
4661
  value: function strengthCheck(options) {
4618
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee123() {
4619
- return _regeneratorRuntime().wrap(function _callee123$(_context123) {
4620
- while (1) switch (_context123.prev = _context123.next) {
4662
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee125() {
4663
+ return _regeneratorRuntime().wrap(function _callee125$(_context125) {
4664
+ while (1) switch (_context125.prev = _context125.next) {
4621
4665
  case 0:
4622
4666
  validate('stytch.passwords.strengthCheck').isOptionalString('email', options.email_address).isString('password', options.password);
4623
- return _context123.abrupt("return", this._networkClient.fetchSDK({
4667
+ return _context125.abrupt("return", this._networkClient.fetchSDK({
4624
4668
  url: '/b2b/passwords/strength_check',
4625
4669
  method: 'POST',
4626
4670
  errorMessage: 'Failed to check password strength.',
@@ -4631,9 +4675,9 @@ var HeadlessB2BPasswordsClient = /*#__PURE__*/function () {
4631
4675
  }));
4632
4676
  case 2:
4633
4677
  case "end":
4634
- return _context123.stop();
4678
+ return _context125.stop();
4635
4679
  }
4636
- }, _callee123, this);
4680
+ }, _callee125, this);
4637
4681
  }));
4638
4682
  }
4639
4683
  }]);
@@ -4647,91 +4691,91 @@ var HeadlessB2BOTPsClient = /*#__PURE__*/_createClass(function HeadlessB2BOTPsCl
4647
4691
  this.dfpProtectedAuth = dfpProtectedAuth;
4648
4692
  this.sms = {
4649
4693
  send: function send(data) {
4650
- return __awaiter$1(_this19, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee124() {
4694
+ return __awaiter$1(_this19, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee126() {
4651
4695
  var _yield$this$dfpProtec29, dfp_telemetry_id, captcha_token;
4652
- return _regeneratorRuntime().wrap(function _callee124$(_context124) {
4653
- while (1) switch (_context124.prev = _context124.next) {
4696
+ return _regeneratorRuntime().wrap(function _callee126$(_context126) {
4697
+ while (1) switch (_context126.prev = _context126.next) {
4654
4698
  case 0:
4655
4699
  validate('stytch.otps.sms.send').isString('organization_id', data.organization_id).isString('member_id', data.member_id).isOptionalString('mfa_phone_number', data.mfa_phone_number).isOptionalString('locale', data.locale);
4656
- _context124.next = 3;
4700
+ _context126.next = 3;
4657
4701
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
4658
4702
  case 3:
4659
- _yield$this$dfpProtec29 = _context124.sent;
4703
+ _yield$this$dfpProtec29 = _context126.sent;
4660
4704
  dfp_telemetry_id = _yield$this$dfpProtec29.dfp_telemetry_id;
4661
4705
  captcha_token = _yield$this$dfpProtec29.captcha_token;
4662
- _context124.t0 = this._networkClient;
4663
- _context124.t1 = Object;
4664
- _context124.t2 = Object.assign({}, data);
4665
- _context124.t3 = dfp_telemetry_id;
4666
- _context124.t4 = captcha_token;
4667
- _context124.next = 13;
4706
+ _context126.t0 = this._networkClient;
4707
+ _context126.t1 = Object;
4708
+ _context126.t2 = Object.assign({}, data);
4709
+ _context126.t3 = dfp_telemetry_id;
4710
+ _context126.t4 = captcha_token;
4711
+ _context126.next = 13;
4668
4712
  return this._subscriptionService.getIntermediateSessionToken();
4669
4713
  case 13:
4670
- _context124.t5 = _context124.sent;
4671
- if (_context124.t5) {
4672
- _context124.next = 16;
4714
+ _context126.t5 = _context126.sent;
4715
+ if (_context126.t5) {
4716
+ _context126.next = 16;
4673
4717
  break;
4674
4718
  }
4675
- _context124.t5 = undefined;
4719
+ _context126.t5 = undefined;
4676
4720
  case 16:
4677
- _context124.t6 = _context124.t5;
4678
- _context124.t7 = {
4679
- dfp_telemetry_id: _context124.t3,
4680
- captcha_token: _context124.t4,
4681
- intermediate_session_token: _context124.t6
4721
+ _context126.t6 = _context126.t5;
4722
+ _context126.t7 = {
4723
+ dfp_telemetry_id: _context126.t3,
4724
+ captcha_token: _context126.t4,
4725
+ intermediate_session_token: _context126.t6
4682
4726
  };
4683
- _context124.t8 = _context124.t1.assign.call(_context124.t1, _context124.t2, _context124.t7);
4684
- _context124.t9 = this.dfpProtectedAuth.retryWithCaptchaAndDFP;
4685
- _context124.t10 = {
4727
+ _context126.t8 = _context126.t1.assign.call(_context126.t1, _context126.t2, _context126.t7);
4728
+ _context126.t9 = this.dfpProtectedAuth.retryWithCaptchaAndDFP;
4729
+ _context126.t10 = {
4686
4730
  url: '/b2b/otps/sms/send',
4687
- body: _context124.t8,
4731
+ body: _context126.t8,
4688
4732
  errorMessage: 'Failed to send one time passcode',
4689
4733
  method: 'POST',
4690
- retryCallback: _context124.t9
4734
+ retryCallback: _context126.t9
4691
4735
  };
4692
- return _context124.abrupt("return", _context124.t0.retriableFetchSDK.call(_context124.t0, _context124.t10));
4736
+ return _context126.abrupt("return", _context126.t0.retriableFetchSDK.call(_context126.t0, _context126.t10));
4693
4737
  case 22:
4694
4738
  case "end":
4695
- return _context124.stop();
4739
+ return _context126.stop();
4696
4740
  }
4697
- }, _callee124, this);
4741
+ }, _callee126, this);
4698
4742
  }));
4699
4743
  },
4700
4744
  authenticate: function authenticate(data) {
4701
- return __awaiter$1(_this19, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee125() {
4745
+ return __awaiter$1(_this19, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee127() {
4702
4746
  var _yield$this$dfpProtec30, dfp_telemetry_id, captcha_token, requestBody, resp;
4703
- return _regeneratorRuntime().wrap(function _callee125$(_context125) {
4704
- while (1) switch (_context125.prev = _context125.next) {
4747
+ return _regeneratorRuntime().wrap(function _callee127$(_context127) {
4748
+ while (1) switch (_context127.prev = _context127.next) {
4705
4749
  case 0:
4706
4750
  validate('stytch.otps.sms.authenticate').isString('organization_id', data.organization_id).isString('member_id', data.member_id).isString('code', data.code).isOptionalString('set_mfa_enrollment', data.set_mfa_enrollment);
4707
- _context125.next = 3;
4751
+ _context127.next = 3;
4708
4752
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
4709
4753
  case 3:
4710
- _yield$this$dfpProtec30 = _context125.sent;
4754
+ _yield$this$dfpProtec30 = _context127.sent;
4711
4755
  dfp_telemetry_id = _yield$this$dfpProtec30.dfp_telemetry_id;
4712
4756
  captcha_token = _yield$this$dfpProtec30.captcha_token;
4713
- _context125.t0 = Object;
4714
- _context125.t1 = Object.assign({}, data);
4715
- _context125.t2 = dfp_telemetry_id;
4716
- _context125.t3 = captcha_token;
4717
- _context125.next = 12;
4757
+ _context127.t0 = Object;
4758
+ _context127.t1 = Object.assign({}, data);
4759
+ _context127.t2 = dfp_telemetry_id;
4760
+ _context127.t3 = captcha_token;
4761
+ _context127.next = 12;
4718
4762
  return this._subscriptionService.getIntermediateSessionToken();
4719
4763
  case 12:
4720
- _context125.t4 = _context125.sent;
4721
- if (_context125.t4) {
4722
- _context125.next = 15;
4764
+ _context127.t4 = _context127.sent;
4765
+ if (_context127.t4) {
4766
+ _context127.next = 15;
4723
4767
  break;
4724
4768
  }
4725
- _context125.t4 = undefined;
4769
+ _context127.t4 = undefined;
4726
4770
  case 15:
4727
- _context125.t5 = _context125.t4;
4728
- _context125.t6 = {
4729
- dfp_telemetry_id: _context125.t2,
4730
- captcha_token: _context125.t3,
4731
- intermediate_session_token: _context125.t5
4771
+ _context127.t5 = _context127.t4;
4772
+ _context127.t6 = {
4773
+ dfp_telemetry_id: _context127.t2,
4774
+ captcha_token: _context127.t3,
4775
+ intermediate_session_token: _context127.t5
4732
4776
  };
4733
- requestBody = _context125.t0.assign.call(_context125.t0, _context125.t1, _context125.t6);
4734
- _context125.next = 20;
4777
+ requestBody = _context127.t0.assign.call(_context127.t0, _context127.t1, _context127.t6);
4778
+ _context127.next = 20;
4735
4779
  return this._networkClient.retriableFetchSDK({
4736
4780
  url: '/b2b/otps/sms/authenticate',
4737
4781
  body: requestBody,
@@ -4740,7 +4784,7 @@ var HeadlessB2BOTPsClient = /*#__PURE__*/_createClass(function HeadlessB2BOTPsCl
4740
4784
  retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
4741
4785
  });
4742
4786
  case 20:
4743
- resp = _context125.sent;
4787
+ resp = _context127.sent;
4744
4788
  this._subscriptionService.updateStateAndTokens({
4745
4789
  state: {
4746
4790
  session: resp.member_session,
@@ -4751,12 +4795,12 @@ var HeadlessB2BOTPsClient = /*#__PURE__*/_createClass(function HeadlessB2BOTPsCl
4751
4795
  session_jwt: resp.session_jwt,
4752
4796
  intermediate_session_token: null
4753
4797
  });
4754
- return _context125.abrupt("return", resp);
4798
+ return _context127.abrupt("return", resp);
4755
4799
  case 23:
4756
4800
  case "end":
4757
- return _context125.stop();
4801
+ return _context127.stop();
4758
4802
  }
4759
- }, _callee125, this);
4803
+ }, _callee127, this);
4760
4804
  }));
4761
4805
  }
4762
4806
  };
@@ -4771,93 +4815,93 @@ var HeadlessB2BTOTPsClient = /*#__PURE__*/function () {
4771
4815
  _createClass(HeadlessB2BTOTPsClient, [{
4772
4816
  key: "create",
4773
4817
  value: function create(data) {
4774
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee126() {
4818
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee128() {
4775
4819
  var _yield$this$dfpProtec31, dfp_telemetry_id, captcha_token;
4776
- return _regeneratorRuntime().wrap(function _callee126$(_context126) {
4777
- while (1) switch (_context126.prev = _context126.next) {
4820
+ return _regeneratorRuntime().wrap(function _callee128$(_context128) {
4821
+ while (1) switch (_context128.prev = _context128.next) {
4778
4822
  case 0:
4779
4823
  validate('stytch.totp.create').isString('organization_id', data.organization_id).isString('member_id', data.member_id).isOptionalNumber('expiration_minutes', data.expiration_minutes);
4780
- _context126.next = 3;
4824
+ _context128.next = 3;
4781
4825
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
4782
4826
  case 3:
4783
- _yield$this$dfpProtec31 = _context126.sent;
4827
+ _yield$this$dfpProtec31 = _context128.sent;
4784
4828
  dfp_telemetry_id = _yield$this$dfpProtec31.dfp_telemetry_id;
4785
4829
  captcha_token = _yield$this$dfpProtec31.captcha_token;
4786
- _context126.t0 = this._networkClient;
4787
- _context126.t1 = Object;
4788
- _context126.t2 = Object.assign({}, data);
4789
- _context126.t3 = dfp_telemetry_id;
4790
- _context126.t4 = captcha_token;
4791
- _context126.next = 13;
4830
+ _context128.t0 = this._networkClient;
4831
+ _context128.t1 = Object;
4832
+ _context128.t2 = Object.assign({}, data);
4833
+ _context128.t3 = dfp_telemetry_id;
4834
+ _context128.t4 = captcha_token;
4835
+ _context128.next = 13;
4792
4836
  return this._subscriptionService.getIntermediateSessionToken();
4793
4837
  case 13:
4794
- _context126.t5 = _context126.sent;
4795
- if (_context126.t5) {
4796
- _context126.next = 16;
4838
+ _context128.t5 = _context128.sent;
4839
+ if (_context128.t5) {
4840
+ _context128.next = 16;
4797
4841
  break;
4798
4842
  }
4799
- _context126.t5 = undefined;
4843
+ _context128.t5 = undefined;
4800
4844
  case 16:
4801
- _context126.t6 = _context126.t5;
4802
- _context126.t7 = {
4803
- dfp_telemetry_id: _context126.t3,
4804
- captcha_token: _context126.t4,
4805
- intermediate_session_token: _context126.t6
4845
+ _context128.t6 = _context128.t5;
4846
+ _context128.t7 = {
4847
+ dfp_telemetry_id: _context128.t3,
4848
+ captcha_token: _context128.t4,
4849
+ intermediate_session_token: _context128.t6
4806
4850
  };
4807
- _context126.t8 = _context126.t1.assign.call(_context126.t1, _context126.t2, _context126.t7);
4808
- _context126.t9 = this.dfpProtectedAuth.retryWithCaptchaAndDFP;
4809
- _context126.t10 = {
4851
+ _context128.t8 = _context128.t1.assign.call(_context128.t1, _context128.t2, _context128.t7);
4852
+ _context128.t9 = this.dfpProtectedAuth.retryWithCaptchaAndDFP;
4853
+ _context128.t10 = {
4810
4854
  url: '/b2b/totp',
4811
- body: _context126.t8,
4855
+ body: _context128.t8,
4812
4856
  errorMessage: 'Failed to create TOTP',
4813
4857
  method: 'POST',
4814
- retryCallback: _context126.t9
4858
+ retryCallback: _context128.t9
4815
4859
  };
4816
- return _context126.abrupt("return", _context126.t0.retriableFetchSDK.call(_context126.t0, _context126.t10));
4860
+ return _context128.abrupt("return", _context128.t0.retriableFetchSDK.call(_context128.t0, _context128.t10));
4817
4861
  case 22:
4818
4862
  case "end":
4819
- return _context126.stop();
4863
+ return _context128.stop();
4820
4864
  }
4821
- }, _callee126, this);
4865
+ }, _callee128, this);
4822
4866
  }));
4823
4867
  }
4824
4868
  }, {
4825
4869
  key: "authenticate",
4826
4870
  value: function authenticate(data) {
4827
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee127() {
4871
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee129() {
4828
4872
  var _yield$this$dfpProtec32, dfp_telemetry_id, captcha_token, requestBody, resp;
4829
- return _regeneratorRuntime().wrap(function _callee127$(_context127) {
4830
- while (1) switch (_context127.prev = _context127.next) {
4873
+ return _regeneratorRuntime().wrap(function _callee129$(_context129) {
4874
+ while (1) switch (_context129.prev = _context129.next) {
4831
4875
  case 0:
4832
4876
  validate('stytch.totp.authenticate').isString('organization_id', data.organization_id).isString('member_id', data.member_id).isString('code', data.code).isOptionalString('set_mfa_enrollment', data.set_mfa_enrollment).isOptionalBoolean('set_default_mfa', data.set_default_mfa);
4833
- _context127.next = 3;
4877
+ _context129.next = 3;
4834
4878
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
4835
4879
  case 3:
4836
- _yield$this$dfpProtec32 = _context127.sent;
4880
+ _yield$this$dfpProtec32 = _context129.sent;
4837
4881
  dfp_telemetry_id = _yield$this$dfpProtec32.dfp_telemetry_id;
4838
4882
  captcha_token = _yield$this$dfpProtec32.captcha_token;
4839
- _context127.t0 = Object;
4840
- _context127.t1 = Object.assign({}, data);
4841
- _context127.t2 = dfp_telemetry_id;
4842
- _context127.t3 = captcha_token;
4843
- _context127.next = 12;
4883
+ _context129.t0 = Object;
4884
+ _context129.t1 = Object.assign({}, data);
4885
+ _context129.t2 = dfp_telemetry_id;
4886
+ _context129.t3 = captcha_token;
4887
+ _context129.next = 12;
4844
4888
  return this._subscriptionService.getIntermediateSessionToken();
4845
4889
  case 12:
4846
- _context127.t4 = _context127.sent;
4847
- if (_context127.t4) {
4848
- _context127.next = 15;
4890
+ _context129.t4 = _context129.sent;
4891
+ if (_context129.t4) {
4892
+ _context129.next = 15;
4849
4893
  break;
4850
4894
  }
4851
- _context127.t4 = undefined;
4895
+ _context129.t4 = undefined;
4852
4896
  case 15:
4853
- _context127.t5 = _context127.t4;
4854
- _context127.t6 = {
4855
- dfp_telemetry_id: _context127.t2,
4856
- captcha_token: _context127.t3,
4857
- intermediate_session_token: _context127.t5
4897
+ _context129.t5 = _context129.t4;
4898
+ _context129.t6 = {
4899
+ dfp_telemetry_id: _context129.t2,
4900
+ captcha_token: _context129.t3,
4901
+ intermediate_session_token: _context129.t5
4858
4902
  };
4859
- requestBody = _context127.t0.assign.call(_context127.t0, _context127.t1, _context127.t6);
4860
- _context127.next = 20;
4903
+ requestBody = _context129.t0.assign.call(_context129.t0, _context129.t1, _context129.t6);
4904
+ _context129.next = 20;
4861
4905
  return this._networkClient.retriableFetchSDK({
4862
4906
  url: '/b2b/totp/authenticate',
4863
4907
  body: requestBody,
@@ -4866,7 +4910,7 @@ var HeadlessB2BTOTPsClient = /*#__PURE__*/function () {
4866
4910
  retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
4867
4911
  });
4868
4912
  case 20:
4869
- resp = _context127.sent;
4913
+ resp = _context129.sent;
4870
4914
  this._subscriptionService.updateStateAndTokens({
4871
4915
  state: {
4872
4916
  session: resp.member_session,
@@ -4877,12 +4921,12 @@ var HeadlessB2BTOTPsClient = /*#__PURE__*/function () {
4877
4921
  session_jwt: resp.session_jwt,
4878
4922
  intermediate_session_token: null
4879
4923
  });
4880
- return _context127.abrupt("return", resp);
4924
+ return _context129.abrupt("return", resp);
4881
4925
  case 23:
4882
4926
  case "end":
4883
- return _context127.stop();
4927
+ return _context129.stop();
4884
4928
  }
4885
- }, _callee127, this);
4929
+ }, _callee129, this);
4886
4930
  }));
4887
4931
  }
4888
4932
  }]);
@@ -4898,40 +4942,40 @@ var HeadlessB2BRecoveryCodesClient = /*#__PURE__*/function () {
4898
4942
  _createClass(HeadlessB2BRecoveryCodesClient, [{
4899
4943
  key: "recover",
4900
4944
  value: function recover(data) {
4901
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee128() {
4945
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee130() {
4902
4946
  var _yield$this$dfpProtec33, dfp_telemetry_id, captcha_token, requestBody, resp;
4903
- return _regeneratorRuntime().wrap(function _callee128$(_context128) {
4904
- while (1) switch (_context128.prev = _context128.next) {
4947
+ return _regeneratorRuntime().wrap(function _callee130$(_context130) {
4948
+ while (1) switch (_context130.prev = _context130.next) {
4905
4949
  case 0:
4906
4950
  validate('stytch.recoveryCodes.recover').isString('organization_id', data.organization_id).isString('member_id', data.member_id).isString('recovery_code', data.recovery_code);
4907
- _context128.next = 3;
4951
+ _context130.next = 3;
4908
4952
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
4909
4953
  case 3:
4910
- _yield$this$dfpProtec33 = _context128.sent;
4954
+ _yield$this$dfpProtec33 = _context130.sent;
4911
4955
  dfp_telemetry_id = _yield$this$dfpProtec33.dfp_telemetry_id;
4912
4956
  captcha_token = _yield$this$dfpProtec33.captcha_token;
4913
- _context128.t0 = Object;
4914
- _context128.t1 = Object.assign({}, data);
4915
- _context128.t2 = dfp_telemetry_id;
4916
- _context128.t3 = captcha_token;
4917
- _context128.next = 12;
4957
+ _context130.t0 = Object;
4958
+ _context130.t1 = Object.assign({}, data);
4959
+ _context130.t2 = dfp_telemetry_id;
4960
+ _context130.t3 = captcha_token;
4961
+ _context130.next = 12;
4918
4962
  return this._subscriptionService.getIntermediateSessionToken();
4919
4963
  case 12:
4920
- _context128.t4 = _context128.sent;
4921
- if (_context128.t4) {
4922
- _context128.next = 15;
4964
+ _context130.t4 = _context130.sent;
4965
+ if (_context130.t4) {
4966
+ _context130.next = 15;
4923
4967
  break;
4924
4968
  }
4925
- _context128.t4 = undefined;
4969
+ _context130.t4 = undefined;
4926
4970
  case 15:
4927
- _context128.t5 = _context128.t4;
4928
- _context128.t6 = {
4929
- dfp_telemetry_id: _context128.t2,
4930
- captcha_token: _context128.t3,
4931
- intermediate_session_token: _context128.t5
4971
+ _context130.t5 = _context130.t4;
4972
+ _context130.t6 = {
4973
+ dfp_telemetry_id: _context130.t2,
4974
+ captcha_token: _context130.t3,
4975
+ intermediate_session_token: _context130.t5
4932
4976
  };
4933
- requestBody = _context128.t0.assign.call(_context128.t0, _context128.t1, _context128.t6);
4934
- _context128.next = 20;
4977
+ requestBody = _context130.t0.assign.call(_context130.t0, _context130.t1, _context130.t6);
4978
+ _context130.next = 20;
4935
4979
  return this._networkClient.retriableFetchSDK({
4936
4980
  url: '/b2b/recovery_codes/recover',
4937
4981
  body: requestBody,
@@ -4940,7 +4984,7 @@ var HeadlessB2BRecoveryCodesClient = /*#__PURE__*/function () {
4940
4984
  retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
4941
4985
  });
4942
4986
  case 20:
4943
- resp = _context128.sent;
4987
+ resp = _context130.sent;
4944
4988
  this._subscriptionService.updateStateAndTokens({
4945
4989
  state: {
4946
4990
  session: resp.member_session,
@@ -4951,29 +4995,29 @@ var HeadlessB2BRecoveryCodesClient = /*#__PURE__*/function () {
4951
4995
  session_jwt: resp.session_jwt,
4952
4996
  intermediate_session_token: null
4953
4997
  });
4954
- return _context128.abrupt("return", resp);
4998
+ return _context130.abrupt("return", resp);
4955
4999
  case 23:
4956
5000
  case "end":
4957
- return _context128.stop();
5001
+ return _context130.stop();
4958
5002
  }
4959
- }, _callee128, this);
5003
+ }, _callee130, this);
4960
5004
  }));
4961
5005
  }
4962
5006
  }, {
4963
5007
  key: "rotate",
4964
5008
  value: function rotate() {
4965
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee129() {
5009
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee131() {
4966
5010
  var _yield$this$dfpProtec34, dfp_telemetry_id, captcha_token;
4967
- return _regeneratorRuntime().wrap(function _callee129$(_context129) {
4968
- while (1) switch (_context129.prev = _context129.next) {
5011
+ return _regeneratorRuntime().wrap(function _callee131$(_context131) {
5012
+ while (1) switch (_context131.prev = _context131.next) {
4969
5013
  case 0:
4970
- _context129.next = 2;
5014
+ _context131.next = 2;
4971
5015
  return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
4972
5016
  case 2:
4973
- _yield$this$dfpProtec34 = _context129.sent;
5017
+ _yield$this$dfpProtec34 = _context131.sent;
4974
5018
  dfp_telemetry_id = _yield$this$dfpProtec34.dfp_telemetry_id;
4975
5019
  captcha_token = _yield$this$dfpProtec34.captcha_token;
4976
- return _context129.abrupt("return", this._networkClient.retriableFetchSDK({
5020
+ return _context131.abrupt("return", this._networkClient.retriableFetchSDK({
4977
5021
  url: '/b2b/recovery_codes/rotate',
4978
5022
  body: {
4979
5023
  dfp_telemetry_id: dfp_telemetry_id,
@@ -4985,28 +5029,28 @@ var HeadlessB2BRecoveryCodesClient = /*#__PURE__*/function () {
4985
5029
  }));
4986
5030
  case 6:
4987
5031
  case "end":
4988
- return _context129.stop();
5032
+ return _context131.stop();
4989
5033
  }
4990
- }, _callee129, this);
5034
+ }, _callee131, this);
4991
5035
  }));
4992
5036
  }
4993
5037
  }, {
4994
5038
  key: "get",
4995
5039
  value: function get() {
4996
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee130() {
4997
- return _regeneratorRuntime().wrap(function _callee130$(_context130) {
4998
- while (1) switch (_context130.prev = _context130.next) {
5040
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee132() {
5041
+ return _regeneratorRuntime().wrap(function _callee132$(_context132) {
5042
+ while (1) switch (_context132.prev = _context132.next) {
4999
5043
  case 0:
5000
- return _context130.abrupt("return", this._networkClient.fetchSDK({
5044
+ return _context132.abrupt("return", this._networkClient.fetchSDK({
5001
5045
  url: '/b2b/recovery_codes',
5002
5046
  errorMessage: 'Failed to get recovery codes',
5003
5047
  method: 'GET'
5004
5048
  }));
5005
5049
  case 1:
5006
5050
  case "end":
5007
- return _context130.stop();
5051
+ return _context132.stop();
5008
5052
  }
5009
- }, _callee130, this);
5053
+ }, _callee132, this);
5010
5054
  }));
5011
5055
  }
5012
5056
  }]);
@@ -5094,18 +5138,18 @@ var IframeHostClient = /*#__PURE__*/function () {
5094
5138
  }, {
5095
5139
  key: "call",
5096
5140
  value: function call(method, args) {
5097
- return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee131() {
5141
+ return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee133() {
5098
5142
  var _this22 = this;
5099
5143
  var frame, channel;
5100
- return _regeneratorRuntime().wrap(function _callee131$(_context131) {
5101
- while (1) switch (_context131.prev = _context131.next) {
5144
+ return _regeneratorRuntime().wrap(function _callee133$(_context133) {
5145
+ while (1) switch (_context133.prev = _context133.next) {
5102
5146
  case 0:
5103
- _context131.next = 2;
5147
+ _context133.next = 2;
5104
5148
  return this.frame;
5105
5149
  case 2:
5106
- frame = _context131.sent;
5150
+ frame = _context133.sent;
5107
5151
  channel = new MessageChannel();
5108
- return _context131.abrupt("return", new Promise(function (resolve, reject) {
5152
+ return _context133.abrupt("return", new Promise(function (resolve, reject) {
5109
5153
  var _a;
5110
5154
  channel.port1.onmessage = function (event) {
5111
5155
  var resp = event.data;
@@ -5124,9 +5168,9 @@ var IframeHostClient = /*#__PURE__*/function () {
5124
5168
  }));
5125
5169
  case 5:
5126
5170
  case "end":
5127
- return _context131.stop();
5171
+ return _context133.stop();
5128
5172
  }
5129
- }, _callee131, this);
5173
+ }, _callee133, this);
5130
5174
  }));
5131
5175
  }
5132
5176
  }]);
@@ -5190,40 +5234,40 @@ var SessionManager = /*#__PURE__*/function () {
5190
5234
  }
5191
5235
  };
5192
5236
  this._reauthenticateWithBackoff = function () {
5193
- return __awaiter$1(_this25, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee133() {
5237
+ return __awaiter$1(_this25, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee135() {
5194
5238
  var count;
5195
- return _regeneratorRuntime().wrap(function _callee133$(_context133) {
5196
- while (1) switch (_context133.prev = _context133.next) {
5239
+ return _regeneratorRuntime().wrap(function _callee135$(_context135) {
5240
+ while (1) switch (_context135.prev = _context135.next) {
5197
5241
  case 0:
5198
5242
  count = 0;
5199
5243
  case 1:
5200
- _context133.prev = 2;
5201
- _context133.next = 5;
5244
+ _context135.prev = 2;
5245
+ _context135.next = 5;
5202
5246
  return this._headlessSessionClient.authenticate();
5203
5247
  case 5:
5204
- return _context133.abrupt("return", _context133.sent);
5248
+ return _context135.abrupt("return", _context135.sent);
5205
5249
  case 8:
5206
- _context133.prev = 8;
5207
- _context133.t0 = _context133["catch"](2);
5208
- if (!SessionManager.isUnrecoverableError(_context133.t0)) {
5209
- _context133.next = 12;
5250
+ _context135.prev = 8;
5251
+ _context135.t0 = _context135["catch"](2);
5252
+ if (!SessionManager.isUnrecoverableError(_context135.t0)) {
5253
+ _context135.next = 12;
5210
5254
  break;
5211
5255
  }
5212
- return _context133.abrupt("return", Promise.reject(_context133.t0));
5256
+ return _context135.abrupt("return", Promise.reject(_context135.t0));
5213
5257
  case 12:
5214
5258
  count++;
5215
- _context133.next = 15;
5259
+ _context135.next = 15;
5216
5260
  return new Promise(function (done) {
5217
5261
  return setTimeout(done, SessionManager.timeoutForAttempt(count));
5218
5262
  });
5219
5263
  case 15:
5220
- _context133.next = 1;
5264
+ _context135.next = 1;
5221
5265
  break;
5222
5266
  case 17:
5223
5267
  case "end":
5224
- return _context133.stop();
5268
+ return _context135.stop();
5225
5269
  }
5226
- }, _callee133, this, [[2, 8]]);
5270
+ }, _callee135, this, [[2, 8]]);
5227
5271
  }));
5228
5272
  };
5229
5273
  this.timeout = null;