@okta/okta-auth-js 5.11.0 → 6.0.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 (228) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +5 -2
  3. package/cjs/AuthStateManager.js +2 -1
  4. package/cjs/AuthStateManager.js.map +1 -1
  5. package/cjs/OktaAuth.js +75 -71
  6. package/cjs/OktaAuth.js.map +1 -1
  7. package/cjs/OktaUserAgent.js +2 -2
  8. package/cjs/OktaUserAgent.js.map +1 -1
  9. package/cjs/PromiseQueue.js +6 -1
  10. package/cjs/PromiseQueue.js.map +1 -1
  11. package/cjs/StorageManager.js +3 -1
  12. package/cjs/StorageManager.js.map +1 -1
  13. package/cjs/TokenManager.js +9 -3
  14. package/cjs/TokenManager.js.map +1 -1
  15. package/cjs/TransactionManager.js +17 -4
  16. package/cjs/TransactionManager.js.map +1 -1
  17. package/cjs/browser/browserStorage.js +7 -5
  18. package/cjs/browser/browserStorage.js.map +1 -1
  19. package/cjs/browser/fingerprint.js +3 -1
  20. package/cjs/browser/fingerprint.js.map +1 -1
  21. package/cjs/builderUtil.js +3 -17
  22. package/cjs/builderUtil.js.map +1 -1
  23. package/cjs/crypto/oidcHash.js.map +1 -1
  24. package/cjs/features.js +9 -3
  25. package/cjs/features.js.map +1 -1
  26. package/cjs/fetch/fetchRequest.js +2 -1
  27. package/cjs/fetch/fetchRequest.js.map +1 -1
  28. package/cjs/http/request.js +2 -0
  29. package/cjs/http/request.js.map +1 -1
  30. package/cjs/idx/authenticate.js +8 -5
  31. package/cjs/idx/authenticate.js.map +1 -1
  32. package/cjs/idx/authenticator/SecurityQuestionVerification.js +1 -0
  33. package/cjs/idx/authenticator/SecurityQuestionVerification.js.map +1 -1
  34. package/cjs/idx/authenticator/VerificationCodeAuthenticator.js +2 -2
  35. package/cjs/idx/authenticator/VerificationCodeAuthenticator.js.map +1 -1
  36. package/cjs/idx/authenticator/getAuthenticator.js +5 -6
  37. package/cjs/idx/authenticator/getAuthenticator.js.map +1 -1
  38. package/cjs/idx/cancel.js.map +1 -1
  39. package/cjs/idx/emailVerify.js +73 -0
  40. package/cjs/idx/emailVerify.js.map +1 -0
  41. package/cjs/idx/flow/FlowSpecification.js +16 -4
  42. package/cjs/idx/flow/FlowSpecification.js.map +1 -1
  43. package/cjs/idx/flow/RegistrationFlow.js +2 -0
  44. package/cjs/idx/flow/RegistrationFlow.js.map +1 -1
  45. package/cjs/idx/handleInteractionCodeRedirect.js +1 -0
  46. package/cjs/idx/handleInteractionCodeRedirect.js.map +1 -1
  47. package/cjs/idx/index.js +13 -0
  48. package/cjs/idx/index.js.map +1 -1
  49. package/cjs/idx/interact.js +46 -34
  50. package/cjs/idx/interact.js.map +1 -1
  51. package/cjs/idx/introspect.js +12 -14
  52. package/cjs/idx/introspect.js.map +1 -1
  53. package/cjs/idx/proceed.js +4 -7
  54. package/cjs/idx/proceed.js.map +1 -1
  55. package/cjs/idx/recoverPassword.js +1 -1
  56. package/cjs/idx/recoverPassword.js.map +1 -1
  57. package/cjs/idx/register.js +6 -15
  58. package/cjs/idx/register.js.map +1 -1
  59. package/cjs/idx/remediate.js +21 -5
  60. package/cjs/idx/remediate.js.map +1 -1
  61. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js +2 -0
  62. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js.map +1 -1
  63. package/cjs/idx/remediators/AuthenticatorVerificationData.js +5 -3
  64. package/cjs/idx/remediators/AuthenticatorVerificationData.js.map +1 -1
  65. package/cjs/idx/remediators/Base/AuthenticatorData.js +5 -3
  66. package/cjs/idx/remediators/Base/AuthenticatorData.js.map +1 -1
  67. package/cjs/idx/remediators/Base/Remediator.js +2 -0
  68. package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
  69. package/cjs/idx/remediators/Base/SelectAuthenticator.js +4 -3
  70. package/cjs/idx/remediators/Base/SelectAuthenticator.js.map +1 -1
  71. package/cjs/idx/remediators/Base/VerifyAuthenticator.js.map +1 -1
  72. package/cjs/idx/remediators/ChallengeAuthenticator.js.map +1 -1
  73. package/cjs/idx/remediators/EnrollAuthenticator.js.map +1 -1
  74. package/cjs/idx/remediators/EnrollPoll.js +2 -3
  75. package/cjs/idx/remediators/EnrollPoll.js.map +1 -1
  76. package/cjs/idx/remediators/EnrollProfile.js +4 -1
  77. package/cjs/idx/remediators/EnrollProfile.js.map +1 -1
  78. package/cjs/idx/remediators/EnrollmentChannelData.js +80 -0
  79. package/cjs/idx/remediators/EnrollmentChannelData.js.map +1 -0
  80. package/cjs/idx/remediators/Identify.js.map +1 -1
  81. package/cjs/idx/remediators/ReEnrollAuthenticator.js +1 -0
  82. package/cjs/idx/remediators/ReEnrollAuthenticator.js.map +1 -1
  83. package/cjs/idx/remediators/ResetAuthenticator.js.map +1 -1
  84. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js +2 -2
  85. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js.map +1 -1
  86. package/cjs/idx/remediators/SelectAuthenticatorEnroll.js.map +1 -1
  87. package/cjs/idx/remediators/SelectEnrollProfile.js.map +1 -1
  88. package/cjs/idx/remediators/SelectEnrollmentChannel.js +74 -0
  89. package/cjs/idx/remediators/SelectEnrollmentChannel.js.map +1 -0
  90. package/cjs/idx/remediators/Skip.js.map +1 -1
  91. package/cjs/idx/remediators/index.js +26 -0
  92. package/cjs/idx/remediators/index.js.map +1 -1
  93. package/cjs/idx/remediators/util.js +7 -2
  94. package/cjs/idx/remediators/util.js.map +1 -1
  95. package/cjs/idx/run.js +111 -45
  96. package/cjs/idx/run.js.map +1 -1
  97. package/cjs/idx/startTransaction.js +4 -2
  98. package/cjs/idx/startTransaction.js.map +1 -1
  99. package/cjs/idx/transactionMeta.js +82 -69
  100. package/cjs/idx/transactionMeta.js.map +1 -1
  101. package/cjs/idx/types/idx-js.js.map +1 -1
  102. package/cjs/idx/types/index.js +19 -3
  103. package/cjs/idx/types/index.js.map +1 -1
  104. package/cjs/index.js +14 -0
  105. package/cjs/index.js.map +1 -1
  106. package/cjs/oidc/endpoints/authorize.js +2 -0
  107. package/cjs/oidc/endpoints/authorize.js.map +1 -1
  108. package/cjs/oidc/endpoints/token.js +1 -0
  109. package/cjs/oidc/endpoints/token.js.map +1 -1
  110. package/cjs/oidc/exchangeCodeForTokens.js +3 -3
  111. package/cjs/oidc/exchangeCodeForTokens.js.map +1 -1
  112. package/cjs/oidc/getToken.js +3 -1
  113. package/cjs/oidc/getToken.js.map +1 -1
  114. package/cjs/oidc/getWithRedirect.js +10 -37
  115. package/cjs/oidc/getWithRedirect.js.map +1 -1
  116. package/cjs/oidc/handleOAuthResponse.js +80 -86
  117. package/cjs/oidc/handleOAuthResponse.js.map +1 -1
  118. package/cjs/oidc/parseFromUrl.js.map +1 -1
  119. package/cjs/oidc/renewToken.js.map +1 -1
  120. package/cjs/oidc/renewTokens.js +1 -1
  121. package/cjs/oidc/renewTokens.js.map +1 -1
  122. package/cjs/oidc/revokeToken.js +28 -29
  123. package/cjs/oidc/revokeToken.js.map +1 -1
  124. package/cjs/oidc/util/index.js +14 -0
  125. package/cjs/oidc/util/index.js.map +1 -1
  126. package/cjs/oidc/util/loginRedirect.js +6 -1
  127. package/cjs/oidc/util/loginRedirect.js.map +1 -1
  128. package/cjs/oidc/util/oauth.js.map +1 -1
  129. package/cjs/oidc/util/oauthMeta.js +36 -0
  130. package/cjs/oidc/util/oauthMeta.js.map +1 -0
  131. package/cjs/oidc/util/pkce.js.map +1 -1
  132. package/cjs/oidc/util/prepareTokenParams.js +57 -36
  133. package/cjs/oidc/util/prepareTokenParams.js.map +1 -1
  134. package/cjs/oidc/util/validateClaims.js +2 -0
  135. package/cjs/oidc/util/validateClaims.js.map +1 -1
  136. package/cjs/oidc/verifyToken.js +2 -1
  137. package/cjs/oidc/verifyToken.js.map +1 -1
  138. package/cjs/options.js +6 -2
  139. package/cjs/options.js.map +1 -1
  140. package/cjs/server/serverStorage.js +1 -1
  141. package/cjs/server/serverStorage.js.map +1 -1
  142. package/cjs/services/TokenService.js +3 -0
  143. package/cjs/services/TokenService.js.map +1 -1
  144. package/cjs/tx/AuthTransaction.js +3 -0
  145. package/cjs/tx/AuthTransaction.js.map +1 -1
  146. package/cjs/tx/TransactionState.js +0 -17
  147. package/cjs/tx/TransactionState.js.map +1 -1
  148. package/cjs/tx/api.js +3 -2
  149. package/cjs/tx/api.js.map +1 -1
  150. package/cjs/types/Transaction.js.map +1 -1
  151. package/cjs/util/index.js +0 -13
  152. package/cjs/util/index.js.map +1 -1
  153. package/cjs/util/url.js.map +1 -1
  154. package/dist/okta-auth-js.min.js +1 -1
  155. package/dist/okta-auth-js.min.js.map +1 -1
  156. package/dist/okta-auth-js.umd.js +1 -1
  157. package/dist/okta-auth-js.umd.js.map +1 -1
  158. package/esm/index.js +1334 -758
  159. package/esm/index.js.map +1 -1
  160. package/lib/AuthStateManager.d.ts +1 -2
  161. package/lib/OktaAuth.d.ts +4 -10
  162. package/lib/StorageManager.d.ts +1 -1
  163. package/lib/TokenManager.d.ts +2 -2
  164. package/lib/TransactionManager.d.ts +3 -2
  165. package/lib/browser/fingerprint.d.ts +1 -1
  166. package/lib/builderUtil.d.ts +1 -2
  167. package/lib/crypto/browser.d.ts +1 -1
  168. package/lib/features.d.ts +1 -1
  169. package/lib/idx/authenticate.d.ts +1 -1
  170. package/lib/idx/authenticator/VerificationCodeAuthenticator.d.ts +1 -1
  171. package/lib/idx/cancel.d.ts +1 -1
  172. package/lib/{util → idx}/emailVerify.d.ts +10 -1
  173. package/lib/idx/flow/FlowSpecification.d.ts +1 -0
  174. package/lib/idx/index.d.ts +1 -0
  175. package/lib/idx/interact.d.ts +4 -11
  176. package/lib/idx/introspect.d.ts +3 -2
  177. package/lib/idx/proceed.d.ts +4 -2
  178. package/lib/idx/recoverPassword.d.ts +1 -1
  179. package/lib/idx/remediate.d.ts +10 -4
  180. package/lib/idx/remediators/AuthenticatorEnrollmentData.d.ts +3 -3
  181. package/lib/idx/remediators/AuthenticatorVerificationData.d.ts +3 -3
  182. package/lib/idx/remediators/Base/AuthenticatorData.d.ts +7 -7
  183. package/lib/idx/remediators/Base/Remediator.d.ts +1 -1
  184. package/lib/idx/remediators/Base/SelectAuthenticator.d.ts +7 -7
  185. package/lib/idx/remediators/Base/VerifyAuthenticator.d.ts +2 -1
  186. package/lib/idx/remediators/EnrollProfile.d.ts +1 -1
  187. package/lib/idx/remediators/EnrollmentChannelData.d.ts +53 -0
  188. package/lib/idx/remediators/Identify.d.ts +2 -2
  189. package/lib/idx/remediators/ReEnrollAuthenticator.d.ts +2 -2
  190. package/lib/idx/remediators/RedirectIdp.d.ts +3 -3
  191. package/lib/idx/remediators/SelectEnrollmentChannel.d.ts +39 -0
  192. package/lib/idx/remediators/index.d.ts +2 -0
  193. package/lib/idx/remediators/util.d.ts +2 -2
  194. package/lib/idx/run.d.ts +3 -1
  195. package/lib/idx/startTransaction.d.ts +3 -2
  196. package/lib/idx/transactionMeta.d.ts +6 -27
  197. package/lib/idx/types/idx-js.d.ts +8 -1
  198. package/lib/idx/types/index.d.ts +17 -6
  199. package/lib/index.d.ts +1 -0
  200. package/lib/oidc/exchangeCodeForTokens.d.ts +12 -0
  201. package/lib/oidc/getWithRedirect.d.ts +1 -1
  202. package/lib/oidc/handleOAuthResponse.d.ts +1 -1
  203. package/lib/oidc/parseFromUrl.d.ts +1 -1
  204. package/lib/oidc/renewToken.d.ts +1 -1
  205. package/lib/oidc/renewTokens.d.ts +1 -1
  206. package/lib/oidc/util/browser.d.ts +1 -1
  207. package/lib/oidc/util/errors.d.ts +1 -1
  208. package/lib/oidc/util/index.d.ts +1 -0
  209. package/lib/oidc/util/oauth.d.ts +1 -8
  210. package/lib/oidc/util/oauthMeta.d.ts +2 -0
  211. package/lib/oidc/util/prepareTokenParams.d.ts +3 -0
  212. package/lib/server/serverStorage.d.ts +1 -1
  213. package/lib/services/TokenService.d.ts +2 -2
  214. package/lib/tx/AuthTransaction.d.ts +2 -2
  215. package/lib/tx/TransactionState.d.ts +11 -1
  216. package/lib/tx/api.d.ts +6 -6
  217. package/lib/types/OktaAuthOptions.d.ts +5 -6
  218. package/lib/types/Storage.d.ts +3 -3
  219. package/lib/types/Transaction.d.ts +11 -0
  220. package/lib/types/UserClaims.d.ts +3 -3
  221. package/lib/types/api.d.ts +28 -16
  222. package/lib/util/console.d.ts +1 -1
  223. package/lib/util/index.d.ts +0 -1
  224. package/lib/util/types.d.ts +1 -1
  225. package/lib/util/url.d.ts +2 -2
  226. package/package.json +5 -5
  227. package/cjs/util/emailVerify.js +0 -28
  228. package/cjs/util/emailVerify.js.map +0 -1
package/esm/index.js CHANGED
@@ -27,14 +27,14 @@ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
27
27
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
28
28
  import _get from '@babel/runtime/helpers/get';
29
29
 
30
- function _createSuper$r(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$r(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
30
+ function _createSuper$u(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$u(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
31
31
 
32
- function _isNativeReflectConstruct$r() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
32
+ function _isNativeReflectConstruct$u() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
33
33
 
34
34
  var CustomError = /*#__PURE__*/function (_Error) {
35
35
  _inherits(CustomError, _Error);
36
36
 
37
- var _super = _createSuper$r(CustomError);
37
+ var _super = _createSuper$u(CustomError);
38
38
 
39
39
  function CustomError(message) {
40
40
  var _this;
@@ -49,14 +49,14 @@ var CustomError = /*#__PURE__*/function (_Error) {
49
49
  return CustomError;
50
50
  }( /*#__PURE__*/_wrapNativeSuper(Error));
51
51
 
52
- function _createSuper$q(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$q(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
52
+ function _createSuper$t(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$t(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
53
53
 
54
- function _isNativeReflectConstruct$q() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
54
+ function _isNativeReflectConstruct$t() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
55
55
 
56
56
  var AuthApiError = /*#__PURE__*/function (_CustomError) {
57
57
  _inherits(AuthApiError, _CustomError);
58
58
 
59
- var _super = _createSuper$q(AuthApiError);
59
+ var _super = _createSuper$t(AuthApiError);
60
60
 
61
61
  function AuthApiError(err, xhr) {
62
62
  var _this;
@@ -82,14 +82,14 @@ var AuthApiError = /*#__PURE__*/function (_CustomError) {
82
82
  return AuthApiError;
83
83
  }(CustomError);
84
84
 
85
- function _createSuper$p(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$p(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
85
+ function _createSuper$s(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$s(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
86
86
 
87
- function _isNativeReflectConstruct$p() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
87
+ function _isNativeReflectConstruct$s() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
88
88
 
89
89
  var AuthPollStopError = /*#__PURE__*/function (_CustomError) {
90
90
  _inherits(AuthPollStopError, _CustomError);
91
91
 
92
- var _super = _createSuper$p(AuthPollStopError);
92
+ var _super = _createSuper$s(AuthPollStopError);
93
93
 
94
94
  function AuthPollStopError() {
95
95
  _classCallCheck(this, AuthPollStopError);
@@ -101,14 +101,14 @@ var AuthPollStopError = /*#__PURE__*/function (_CustomError) {
101
101
  return AuthPollStopError;
102
102
  }(CustomError);
103
103
 
104
- function _createSuper$o(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$o(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
104
+ function _createSuper$r(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$r(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
105
105
 
106
- function _isNativeReflectConstruct$o() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
106
+ function _isNativeReflectConstruct$r() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
107
107
 
108
108
  var AuthSdkError = /*#__PURE__*/function (_CustomError) {
109
109
  _inherits(AuthSdkError, _CustomError);
110
110
 
111
- var _super = _createSuper$o(AuthSdkError);
111
+ var _super = _createSuper$r(AuthSdkError);
112
112
 
113
113
  function AuthSdkError(msg, xhr) {
114
114
  var _this;
@@ -133,14 +133,14 @@ var AuthSdkError = /*#__PURE__*/function (_CustomError) {
133
133
  return AuthSdkError;
134
134
  }(CustomError);
135
135
 
136
- function _createSuper$n(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$n(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
136
+ function _createSuper$q(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$q(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
137
137
 
138
- function _isNativeReflectConstruct$n() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
138
+ function _isNativeReflectConstruct$q() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
139
139
 
140
140
  var OAuthError = /*#__PURE__*/function (_CustomError) {
141
141
  _inherits(OAuthError, _CustomError);
142
142
 
143
- var _super = _createSuper$n(OAuthError);
143
+ var _super = _createSuper$q(OAuthError);
144
144
 
145
145
  function OAuthError(errorCode, summary) {
146
146
  var _this;
@@ -268,49 +268,6 @@ function deprecateWrap(text, fn) {
268
268
  };
269
269
  }
270
270
 
271
- function urlParamsToObject(hashOrSearch) {
272
- var plus2space = /\+/g;
273
- var paramSplit = /([^&=]+)=?([^&]*)/g;
274
- var fragment = hashOrSearch || '';
275
-
276
- if (fragment.charAt(0) === '#' && fragment.charAt(1) === '/') {
277
- fragment = fragment.substring(2);
278
- }
279
-
280
- if (fragment.charAt(0) === '#' || fragment.charAt(0) === '?') {
281
- fragment = fragment.substring(1);
282
- }
283
-
284
- var obj = {};
285
- var param;
286
-
287
- while (true) {
288
- param = paramSplit.exec(fragment);
289
-
290
- if (!param) {
291
- break;
292
- }
293
-
294
- var key = param[1];
295
- var value = param[2];
296
-
297
- if (key === 'id_token' || key === 'access_token' || key === 'code') {
298
- obj[key] = value;
299
- } else {
300
- obj[key] = decodeURIComponent(value.replace(plus2space, ' '));
301
- }
302
- }
303
-
304
- return obj;
305
- }
306
-
307
- function isEmailVerifyCallback(urlPath) {
308
- return /(stateTokenExternalId=)/i.test(urlPath) && /(state=)/i.test(urlPath);
309
- }
310
- function parseEmailVerifyCallback(urlPath) {
311
- return urlParamsToObject(urlPath);
312
- }
313
-
314
271
  function isoToUTCString(str) {
315
272
  var parts = str.match(/\d+/g),
316
273
  isoTime = Date.UTC(parts[0], parts[1] - 1, parts[2], parts[3], parts[4], parts[5]),
@@ -852,6 +809,9 @@ var AuthTransaction = function AuthTransaction(sdk) {
852
809
 
853
810
  _classCallCheck(this, AuthTransaction);
854
811
 
812
+ this.data = undefined;
813
+ this.status = undefined;
814
+
855
815
  if (res) {
856
816
  this.data = res;
857
817
 
@@ -1036,7 +996,6 @@ function transactionStatus(sdk, args) {
1036
996
  withCredentials: true
1037
997
  });
1038
998
  }
1039
-
1040
999
  function resumeTransaction(sdk, args) {
1041
1000
  if (!args || !args.stateToken) {
1042
1001
  var stateToken = sdk.tx.exists._get(STATE_TOKEN_KEY_NAME);
@@ -1054,8 +1013,7 @@ function resumeTransaction(sdk, args) {
1054
1013
  return new AuthTransaction(sdk, res);
1055
1014
  });
1056
1015
  }
1057
-
1058
- function introspect$1(sdk, args) {
1016
+ function introspectAuthn(sdk, args) {
1059
1017
  if (!args || !args.stateToken) {
1060
1018
  var stateToken = sdk.tx.exists._get(STATE_TOKEN_KEY_NAME);
1061
1019
 
@@ -1072,18 +1030,15 @@ function introspect$1(sdk, args) {
1072
1030
  return new AuthTransaction(sdk, res);
1073
1031
  });
1074
1032
  }
1075
-
1076
1033
  function transactionStep(sdk, args) {
1077
1034
  args = addStateToken(sdk, args);
1078
1035
  return post(sdk, sdk.getIssuerOrigin() + '/api/v1/authn/introspect', args, {
1079
1036
  withCredentials: true
1080
1037
  });
1081
1038
  }
1082
-
1083
1039
  function transactionExists(sdk) {
1084
1040
  return !!sdk.tx.exists._get(STATE_TOKEN_KEY_NAME);
1085
1041
  }
1086
-
1087
1042
  function postToTransaction(sdk, url, args, options) {
1088
1043
  options = Object.assign({
1089
1044
  withCredentials: true
@@ -1093,10 +1048,6 @@ function postToTransaction(sdk, url, args, options) {
1093
1048
  });
1094
1049
  }
1095
1050
 
1096
- var TransactionState = function TransactionState() {
1097
- _classCallCheck(this, TransactionState);
1098
- };
1099
-
1100
1051
  function dec2hex(dec) {
1101
1052
  return ('0' + dec.toString(16)).substr(-2);
1102
1053
  }
@@ -1466,13 +1417,18 @@ function isBrowser() {
1466
1417
  return typeof document !== 'undefined' && typeof window !== 'undefined';
1467
1418
  }
1468
1419
  function isIE11OrLess() {
1469
- return isBrowser() && !!document.documentMode && document.documentMode <= 11;
1420
+ if (!isBrowser()) {
1421
+ return false;
1422
+ }
1423
+
1424
+ var documentMode = document.documentMode;
1425
+ return !!documentMode && documentMode <= 11;
1470
1426
  }
1471
- function getUserAgent$1() {
1427
+ function getUserAgent() {
1472
1428
  return navigator.userAgent;
1473
1429
  }
1474
1430
  function isFingerprintSupported() {
1475
- var agent = getUserAgent$1();
1431
+ var agent = getUserAgent();
1476
1432
  return agent && !isWindowsPhone.test(agent);
1477
1433
  }
1478
1434
  function isPopupPostMessageSupported() {
@@ -1480,9 +1436,10 @@ function isPopupPostMessageSupported() {
1480
1436
  return false;
1481
1437
  }
1482
1438
 
1483
- var isIE8or9 = document.documentMode && document.documentMode < 10;
1439
+ var documentMode = document.documentMode;
1440
+ var isIE8or9 = documentMode && documentMode < 10;
1484
1441
 
1485
- if (window.postMessage && !isIE8or9) {
1442
+ if (typeof window.postMessage !== 'undefined' && !isIE8or9) {
1486
1443
  return true;
1487
1444
  }
1488
1445
 
@@ -1512,7 +1469,7 @@ var features = /*#__PURE__*/Object.freeze({
1512
1469
  __proto__: null,
1513
1470
  isBrowser: isBrowser,
1514
1471
  isIE11OrLess: isIE11OrLess,
1515
- getUserAgent: getUserAgent$1,
1472
+ getUserAgent: getUserAgent,
1516
1473
  isFingerprintSupported: isFingerprintSupported,
1517
1474
  isPopupPostMessageSupported: isPopupPostMessageSupported,
1518
1475
  isTokenVerifySupported: isTokenVerifySupported,
@@ -1579,7 +1536,12 @@ function hasErrorInUrl(hashOrSearch) {
1579
1536
  }
1580
1537
  function isRedirectUri(uri, sdk) {
1581
1538
  var authParams = sdk.options;
1582
- return uri && uri.indexOf(authParams.redirectUri) === 0;
1539
+
1540
+ if (!uri || !authParams.redirectUri) {
1541
+ return false;
1542
+ }
1543
+
1544
+ return uri.indexOf(authParams.redirectUri) === 0;
1583
1545
  }
1584
1546
  function isCodeFlow(options) {
1585
1547
  return options.pkce || options.responseType === 'code' || options.responseMode === 'query';
@@ -1620,14 +1582,35 @@ function isInteractionRequired(sdk, hashOrSearch) {
1620
1582
  return /(error=interaction_required)/i.test(hashOrSearch);
1621
1583
  }
1622
1584
 
1623
- function prepareTokenParams(sdk, tokenParams) {
1624
- var defaults = getDefaultTokenParams(sdk);
1625
- tokenParams = Object.assign({}, defaults, clone(tokenParams));
1585
+ function createOAuthMeta(sdk, tokenParams) {
1586
+ var issuer = sdk.options.issuer;
1587
+ var urls = getOAuthUrls(sdk, tokenParams);
1588
+ var oauthMeta = {
1589
+ issuer: issuer,
1590
+ urls: urls,
1591
+ clientId: tokenParams.clientId,
1592
+ redirectUri: tokenParams.redirectUri,
1593
+ responseType: tokenParams.responseType,
1594
+ responseMode: tokenParams.responseMode,
1595
+ scopes: tokenParams.scopes,
1596
+ state: tokenParams.state,
1597
+ nonce: tokenParams.nonce,
1598
+ ignoreSignature: tokenParams.ignoreSignature
1599
+ };
1626
1600
 
1627
1601
  if (tokenParams.pkce === false) {
1628
- return Promise.resolve(tokenParams);
1602
+ return oauthMeta;
1629
1603
  }
1630
1604
 
1605
+ var pkceMeta = Object.assign(Object.assign({}, oauthMeta), {
1606
+ codeVerifier: tokenParams.codeVerifier,
1607
+ codeChallengeMethod: tokenParams.codeChallengeMethod,
1608
+ codeChallenge: tokenParams.codeChallenge
1609
+ });
1610
+ return pkceMeta;
1611
+ }
1612
+
1613
+ function assertPKCESupport(sdk) {
1631
1614
  if (!sdk.features.isPKCESupported()) {
1632
1615
  var errorMessage = 'PKCE requires a modern browser with encryption support running in a secure context.';
1633
1616
 
@@ -1639,33 +1622,135 @@ function prepareTokenParams(sdk, tokenParams) {
1639
1622
  errorMessage += '\n"TextEncoder" is not defined. To use PKCE, you may need to include a polyfill/shim for this browser.';
1640
1623
  }
1641
1624
 
1642
- return Promise.reject(new AuthSdkError(errorMessage));
1625
+ throw new AuthSdkError(errorMessage);
1643
1626
  }
1627
+ }
1628
+ function validateCodeChallengeMethod(_x, _x2) {
1629
+ return _validateCodeChallengeMethod.apply(this, arguments);
1630
+ }
1644
1631
 
1645
- if (!tokenParams.codeChallengeMethod) {
1646
- tokenParams.codeChallengeMethod = DEFAULT_CODE_CHALLENGE_METHOD;
1647
- }
1632
+ function _validateCodeChallengeMethod() {
1633
+ _validateCodeChallengeMethod = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(sdk, codeChallengeMethod) {
1634
+ var wellKnownResponse, methods;
1635
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
1636
+ while (1) {
1637
+ switch (_context.prev = _context.next) {
1638
+ case 0:
1639
+ codeChallengeMethod = codeChallengeMethod || sdk.options.codeChallengeMethod || DEFAULT_CODE_CHALLENGE_METHOD;
1640
+ _context.next = 3;
1641
+ return getWellKnown(sdk);
1648
1642
 
1649
- tokenParams.responseType = 'code';
1650
- return getWellKnown(sdk, null).then(function (res) {
1651
- var methods = res['code_challenge_methods_supported'] || [];
1643
+ case 3:
1644
+ wellKnownResponse = _context.sent;
1645
+ methods = wellKnownResponse['code_challenge_methods_supported'] || [];
1652
1646
 
1653
- if (methods.indexOf(tokenParams.codeChallengeMethod) === -1) {
1654
- throw new AuthSdkError('Invalid code_challenge_method');
1655
- }
1656
- }).then(function () {
1657
- if (!tokenParams.codeVerifier) {
1658
- tokenParams.codeVerifier = PKCE.generateVerifier();
1659
- }
1647
+ if (!(methods.indexOf(codeChallengeMethod) === -1)) {
1648
+ _context.next = 7;
1649
+ break;
1650
+ }
1660
1651
 
1661
- return PKCE.computeChallenge(tokenParams.codeVerifier);
1662
- }).then(function (codeChallenge) {
1663
- var clonedParams = clone(tokenParams) || {};
1664
- Object.assign(clonedParams, tokenParams, {
1665
- codeChallenge: codeChallenge
1666
- });
1667
- return clonedParams;
1668
- });
1652
+ throw new AuthSdkError('Invalid code_challenge_method');
1653
+
1654
+ case 7:
1655
+ return _context.abrupt("return", codeChallengeMethod);
1656
+
1657
+ case 8:
1658
+ case "end":
1659
+ return _context.stop();
1660
+ }
1661
+ }
1662
+ }, _callee);
1663
+ }));
1664
+ return _validateCodeChallengeMethod.apply(this, arguments);
1665
+ }
1666
+
1667
+ function preparePKCE(_x3, _x4) {
1668
+ return _preparePKCE.apply(this, arguments);
1669
+ }
1670
+
1671
+ function _preparePKCE() {
1672
+ _preparePKCE = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(sdk, tokenParams) {
1673
+ var _tokenParams, codeVerifier, codeChallenge, codeChallengeMethod;
1674
+
1675
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
1676
+ while (1) {
1677
+ switch (_context2.prev = _context2.next) {
1678
+ case 0:
1679
+ _tokenParams = tokenParams, codeVerifier = _tokenParams.codeVerifier, codeChallenge = _tokenParams.codeChallenge, codeChallengeMethod = _tokenParams.codeChallengeMethod;
1680
+ codeChallenge = codeChallenge || sdk.options.codeChallenge;
1681
+
1682
+ if (codeChallenge) {
1683
+ _context2.next = 8;
1684
+ break;
1685
+ }
1686
+
1687
+ assertPKCESupport(sdk);
1688
+ codeVerifier = codeVerifier || PKCE.generateVerifier();
1689
+ _context2.next = 7;
1690
+ return PKCE.computeChallenge(codeVerifier);
1691
+
1692
+ case 7:
1693
+ codeChallenge = _context2.sent;
1694
+
1695
+ case 8:
1696
+ _context2.next = 10;
1697
+ return validateCodeChallengeMethod(sdk, codeChallengeMethod);
1698
+
1699
+ case 10:
1700
+ codeChallengeMethod = _context2.sent;
1701
+ tokenParams = Object.assign(Object.assign({}, tokenParams), {
1702
+ responseType: 'code',
1703
+ codeVerifier: codeVerifier,
1704
+ codeChallenge: codeChallenge,
1705
+ codeChallengeMethod: codeChallengeMethod
1706
+ });
1707
+ return _context2.abrupt("return", tokenParams);
1708
+
1709
+ case 13:
1710
+ case "end":
1711
+ return _context2.stop();
1712
+ }
1713
+ }
1714
+ }, _callee2);
1715
+ }));
1716
+ return _preparePKCE.apply(this, arguments);
1717
+ }
1718
+
1719
+ function prepareTokenParams(_x5) {
1720
+ return _prepareTokenParams.apply(this, arguments);
1721
+ }
1722
+
1723
+ function _prepareTokenParams() {
1724
+ _prepareTokenParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(sdk) {
1725
+ var tokenParams,
1726
+ defaults,
1727
+ _args3 = arguments;
1728
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
1729
+ while (1) {
1730
+ switch (_context3.prev = _context3.next) {
1731
+ case 0:
1732
+ tokenParams = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
1733
+ defaults = getDefaultTokenParams(sdk);
1734
+ tokenParams = Object.assign({}, defaults, clone(tokenParams));
1735
+
1736
+ if (!(tokenParams.pkce === false)) {
1737
+ _context3.next = 5;
1738
+ break;
1739
+ }
1740
+
1741
+ return _context3.abrupt("return", tokenParams);
1742
+
1743
+ case 5:
1744
+ return _context3.abrupt("return", preparePKCE(sdk, tokenParams));
1745
+
1746
+ case 6:
1747
+ case "end":
1748
+ return _context3.stop();
1749
+ }
1750
+ }
1751
+ }, _callee3);
1752
+ }));
1753
+ return _prepareTokenParams.apply(this, arguments);
1669
1754
  }
1670
1755
 
1671
1756
  function isSameRefreshToken(a, b) {
@@ -1689,6 +1774,42 @@ function isRefreshTokenError(err) {
1689
1774
  return false;
1690
1775
  }
1691
1776
 
1777
+ function urlParamsToObject(hashOrSearch) {
1778
+ var plus2space = /\+/g;
1779
+ var paramSplit = /([^&=]+)=?([^&]*)/g;
1780
+ var fragment = hashOrSearch || '';
1781
+
1782
+ if (fragment.charAt(0) === '#' && fragment.charAt(1) === '/') {
1783
+ fragment = fragment.substring(2);
1784
+ }
1785
+
1786
+ if (fragment.charAt(0) === '#' || fragment.charAt(0) === '?') {
1787
+ fragment = fragment.substring(1);
1788
+ }
1789
+
1790
+ var obj = {};
1791
+ var param;
1792
+
1793
+ while (true) {
1794
+ param = paramSplit.exec(fragment);
1795
+
1796
+ if (!param) {
1797
+ break;
1798
+ }
1799
+
1800
+ var key = param[1];
1801
+ var value = param[2];
1802
+
1803
+ if (key === 'id_token' || key === 'access_token' || key === 'code') {
1804
+ obj[key] = value;
1805
+ } else {
1806
+ obj[key] = decodeURIComponent(value.replace(plus2space, ' '));
1807
+ }
1808
+ }
1809
+
1810
+ return obj;
1811
+ }
1812
+
1692
1813
  function validateClaims(sdk, claims, validationParams) {
1693
1814
  var aud = validationParams.clientId;
1694
1815
  var iss = validationParams.issuer;
@@ -1798,9 +1919,9 @@ var AuthenticatorKey;
1798
1919
  var IdxFeature;
1799
1920
 
1800
1921
  (function (IdxFeature) {
1801
- IdxFeature[IdxFeature["PASSWORD_RECOVERY"] = 0] = "PASSWORD_RECOVERY";
1802
- IdxFeature[IdxFeature["REGISTRATION"] = 1] = "REGISTRATION";
1803
- IdxFeature[IdxFeature["SOCIAL_IDP"] = 2] = "SOCIAL_IDP";
1922
+ IdxFeature["PASSWORD_RECOVERY"] = "recover-password";
1923
+ IdxFeature["REGISTRATION"] = "enroll-profile";
1924
+ IdxFeature["SOCIAL_IDP"] = "redirect-idp";
1804
1925
  })(IdxFeature || (IdxFeature = {}));
1805
1926
 
1806
1927
  function isToken(obj) {
@@ -1855,40 +1976,65 @@ function decodeToken(token) {
1855
1976
  return decodedToken;
1856
1977
  }
1857
1978
 
1858
- function revokeToken(sdk, token) {
1859
- return Promise.resolve().then(function () {
1860
- var accessToken;
1861
- var refreshToken;
1979
+ function revokeToken(_x, _x2) {
1980
+ return _revokeToken.apply(this, arguments);
1981
+ }
1862
1982
 
1863
- if (token) {
1864
- accessToken = token.accessToken;
1865
- refreshToken = token.refreshToken;
1866
- }
1983
+ function _revokeToken() {
1984
+ _revokeToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(sdk, token) {
1985
+ var accessToken, refreshToken, clientId, clientSecret, revokeUrl, args, creds;
1986
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
1987
+ while (1) {
1988
+ switch (_context.prev = _context.next) {
1989
+ case 0:
1990
+ accessToken = '';
1991
+ refreshToken = '';
1867
1992
 
1868
- if (!accessToken && !refreshToken) {
1869
- throw new AuthSdkError('A valid access or refresh token object is required');
1870
- }
1993
+ if (token) {
1994
+ accessToken = token.accessToken;
1995
+ refreshToken = token.refreshToken;
1996
+ }
1997
+
1998
+ if (!(!accessToken && !refreshToken)) {
1999
+ _context.next = 5;
2000
+ break;
2001
+ }
1871
2002
 
1872
- var clientId = sdk.options.clientId;
1873
- var clientSecret = sdk.options.clientSecret;
2003
+ throw new AuthSdkError('A valid access or refresh token object is required');
1874
2004
 
1875
- if (!clientId) {
1876
- throw new AuthSdkError('A clientId must be specified in the OktaAuth constructor to revoke a token');
1877
- }
2005
+ case 5:
2006
+ clientId = sdk.options.clientId;
2007
+ clientSecret = sdk.options.clientSecret;
2008
+
2009
+ if (clientId) {
2010
+ _context.next = 9;
2011
+ break;
2012
+ }
2013
+
2014
+ throw new AuthSdkError('A clientId must be specified in the OktaAuth constructor to revoke a token');
2015
+
2016
+ case 9:
2017
+ revokeUrl = getOAuthUrls(sdk).revokeUrl;
2018
+ args = toQueryString({
2019
+ token_type_hint: refreshToken ? 'refresh_token' : 'access_token',
2020
+ token: refreshToken || accessToken
2021
+ }).slice(1);
2022
+ creds = clientSecret ? b("".concat(clientId, ":").concat(clientSecret)) : b(clientId);
2023
+ return _context.abrupt("return", post(sdk, revokeUrl, args, {
2024
+ headers: {
2025
+ 'Content-Type': 'application/x-www-form-urlencoded',
2026
+ 'Authorization': 'Basic ' + creds
2027
+ }
2028
+ }));
1878
2029
 
1879
- var revokeUrl = getOAuthUrls(sdk).revokeUrl;
1880
- var args = toQueryString({
1881
- token_type_hint: refreshToken ? 'refresh_token' : 'access_token',
1882
- token: refreshToken || accessToken
1883
- }).slice(1);
1884
- var creds = clientSecret ? b("".concat(clientId, ":").concat(clientSecret)) : b(clientId);
1885
- return post(sdk, revokeUrl, args, {
1886
- headers: {
1887
- 'Content-Type': 'application/x-www-form-urlencoded',
1888
- 'Authorization': 'Basic ' + creds
2030
+ case 13:
2031
+ case "end":
2032
+ return _context.stop();
2033
+ }
1889
2034
  }
1890
- });
1891
- });
2035
+ }, _callee);
2036
+ }));
2037
+ return _revokeToken.apply(this, arguments);
1892
2038
  }
1893
2039
 
1894
2040
  function exchangeCodeForTokens(sdk, tokenParams, urls) {
@@ -2029,7 +2175,7 @@ function _verifyToken() {
2029
2175
  }
2030
2176
 
2031
2177
  function validateResponse(res, oauthParams) {
2032
- if (res['error'] || res['error_description']) {
2178
+ if (res['error'] && res['error_description']) {
2033
2179
  throw new OAuthError(res['error'], res['error_description']);
2034
2180
  }
2035
2181
 
@@ -2038,112 +2184,141 @@ function validateResponse(res, oauthParams) {
2038
2184
  }
2039
2185
  }
2040
2186
 
2041
- function handleOAuthResponse(sdk, tokenParams, res, urls) {
2042
- var pkce = sdk.options.pkce !== false;
2187
+ function handleOAuthResponse(_x, _x2, _x3, _x4) {
2188
+ return _handleOAuthResponse.apply(this, arguments);
2189
+ }
2043
2190
 
2044
- if (pkce && (res.code || res.interaction_code)) {
2045
- return exchangeCodeForTokens(sdk, Object.assign({}, tokenParams, {
2046
- authorizationCode: res.code,
2047
- interactionCode: res.interaction_code
2048
- }), urls);
2049
- }
2191
+ function _handleOAuthResponse() {
2192
+ _handleOAuthResponse = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(sdk, tokenParams, res, urls) {
2193
+ var pkce, responseType, scopes, clientId, tokenDict, expiresIn, tokenType, accessToken, idToken, refreshToken, now, accessJwt, idJwt, idTokenObj, validationParams;
2194
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
2195
+ while (1) {
2196
+ switch (_context.prev = _context.next) {
2197
+ case 0:
2198
+ pkce = sdk.options.pkce !== false;
2050
2199
 
2051
- tokenParams = tokenParams || getDefaultTokenParams(sdk);
2052
- urls = urls || getOAuthUrls(sdk, tokenParams);
2053
- var responseType = tokenParams.responseType;
2200
+ if (!(pkce && (res.code || res.interaction_code))) {
2201
+ _context.next = 3;
2202
+ break;
2203
+ }
2054
2204
 
2055
- if (!Array.isArray(responseType)) {
2056
- responseType = [responseType];
2057
- }
2205
+ return _context.abrupt("return", exchangeCodeForTokens(sdk, Object.assign({}, tokenParams, {
2206
+ authorizationCode: res.code,
2207
+ interactionCode: res.interaction_code
2208
+ }), urls));
2058
2209
 
2059
- var scopes;
2210
+ case 3:
2211
+ tokenParams = tokenParams || getDefaultTokenParams(sdk);
2212
+ urls = urls || getOAuthUrls(sdk, tokenParams);
2213
+ responseType = tokenParams.responseType || [];
2060
2214
 
2061
- if (res.scope) {
2062
- scopes = res.scope.split(' ');
2063
- } else {
2064
- scopes = clone(tokenParams.scopes);
2065
- }
2066
-
2067
- var clientId = tokenParams.clientId || sdk.options.clientId;
2068
- return Promise.resolve().then(function () {
2069
- validateResponse(res, tokenParams);
2070
- }).then(function () {
2071
- var tokenDict = {};
2072
- var expiresIn = res.expires_in;
2073
- var tokenType = res.token_type;
2074
- var accessToken = res.access_token;
2075
- var idToken = res.id_token;
2076
- var refreshToken = res.refresh_token;
2077
- var now = Math.floor(Date.now() / 1000);
2078
-
2079
- if (accessToken) {
2080
- var accessJwt = sdk.token.decode(accessToken);
2081
- tokenDict.accessToken = {
2082
- accessToken: accessToken,
2083
- claims: accessJwt.payload,
2084
- expiresAt: Number(expiresIn) + now,
2085
- tokenType: tokenType,
2086
- scopes: scopes,
2087
- authorizeUrl: urls.authorizeUrl,
2088
- userinfoUrl: urls.userinfoUrl
2089
- };
2090
- }
2215
+ if (!Array.isArray(responseType)) {
2216
+ responseType = [responseType];
2217
+ }
2091
2218
 
2092
- if (refreshToken) {
2093
- tokenDict.refreshToken = {
2094
- refreshToken: refreshToken,
2095
- expiresAt: Number(expiresIn) + now,
2096
- scopes: scopes,
2097
- tokenUrl: urls.tokenUrl,
2098
- authorizeUrl: urls.authorizeUrl,
2099
- issuer: urls.issuer
2100
- };
2101
- }
2219
+ if (res.scope) {
2220
+ scopes = res.scope.split(' ');
2221
+ } else {
2222
+ scopes = clone(tokenParams.scopes);
2223
+ }
2102
2224
 
2103
- if (idToken) {
2104
- var idJwt = sdk.token.decode(idToken);
2105
- var idTokenObj = {
2106
- idToken: idToken,
2107
- claims: idJwt.payload,
2108
- expiresAt: idJwt.payload.exp - idJwt.payload.iat + now,
2109
- scopes: scopes,
2110
- authorizeUrl: urls.authorizeUrl,
2111
- issuer: urls.issuer,
2112
- clientId: clientId
2113
- };
2114
- var validationParams = {
2115
- clientId: clientId,
2116
- issuer: urls.issuer,
2117
- nonce: tokenParams.nonce,
2118
- accessToken: accessToken
2119
- };
2225
+ clientId = tokenParams.clientId || sdk.options.clientId;
2226
+ validateResponse(res, tokenParams);
2227
+ tokenDict = {};
2228
+ expiresIn = res.expires_in;
2229
+ tokenType = res.token_type;
2230
+ accessToken = res.access_token;
2231
+ idToken = res.id_token;
2232
+ refreshToken = res.refresh_token;
2233
+ now = Math.floor(Date.now() / 1000);
2234
+
2235
+ if (accessToken) {
2236
+ accessJwt = sdk.token.decode(accessToken);
2237
+ tokenDict.accessToken = {
2238
+ accessToken: accessToken,
2239
+ claims: accessJwt.payload,
2240
+ expiresAt: Number(expiresIn) + now,
2241
+ tokenType: tokenType,
2242
+ scopes: scopes,
2243
+ authorizeUrl: urls.authorizeUrl,
2244
+ userinfoUrl: urls.userinfoUrl
2245
+ };
2246
+ }
2120
2247
 
2121
- if (tokenParams.ignoreSignature !== undefined) {
2122
- validationParams.ignoreSignature = tokenParams.ignoreSignature;
2123
- }
2248
+ if (refreshToken) {
2249
+ tokenDict.refreshToken = {
2250
+ refreshToken: refreshToken,
2251
+ expiresAt: Number(expiresIn) + now,
2252
+ scopes: scopes,
2253
+ tokenUrl: urls.tokenUrl,
2254
+ authorizeUrl: urls.authorizeUrl,
2255
+ issuer: urls.issuer
2256
+ };
2257
+ }
2124
2258
 
2125
- return verifyToken(sdk, idTokenObj, validationParams).then(function () {
2126
- tokenDict.idToken = idTokenObj;
2127
- return tokenDict;
2128
- });
2129
- }
2259
+ if (!idToken) {
2260
+ _context.next = 27;
2261
+ break;
2262
+ }
2130
2263
 
2131
- return tokenDict;
2132
- }).then(function (tokenDict) {
2133
- if (responseType.indexOf('token') !== -1 && !tokenDict.accessToken) {
2134
- throw new AuthSdkError('Unable to parse OAuth flow response: response type "token" was requested but "access_token" was not returned.');
2135
- }
2264
+ idJwt = sdk.token.decode(idToken);
2265
+ idTokenObj = {
2266
+ idToken: idToken,
2267
+ claims: idJwt.payload,
2268
+ expiresAt: idJwt.payload.exp - idJwt.payload.iat + now,
2269
+ scopes: scopes,
2270
+ authorizeUrl: urls.authorizeUrl,
2271
+ issuer: urls.issuer,
2272
+ clientId: clientId
2273
+ };
2274
+ validationParams = {
2275
+ clientId: clientId,
2276
+ issuer: urls.issuer,
2277
+ nonce: tokenParams.nonce,
2278
+ accessToken: accessToken
2279
+ };
2136
2280
 
2137
- if (responseType.indexOf('id_token') !== -1 && !tokenDict.idToken) {
2138
- throw new AuthSdkError('Unable to parse OAuth flow response: response type "id_token" was requested but "id_token" was not returned.');
2139
- }
2281
+ if (tokenParams.ignoreSignature !== undefined) {
2282
+ validationParams.ignoreSignature = tokenParams.ignoreSignature;
2283
+ }
2140
2284
 
2141
- return {
2142
- tokens: tokenDict,
2143
- state: res.state,
2144
- code: res.code
2145
- };
2146
- });
2285
+ _context.next = 26;
2286
+ return verifyToken(sdk, idTokenObj, validationParams);
2287
+
2288
+ case 26:
2289
+ tokenDict.idToken = idTokenObj;
2290
+
2291
+ case 27:
2292
+ if (!(responseType.indexOf('token') !== -1 && !tokenDict.accessToken)) {
2293
+ _context.next = 29;
2294
+ break;
2295
+ }
2296
+
2297
+ throw new AuthSdkError('Unable to parse OAuth flow response: response type "token" was requested but "access_token" was not returned.');
2298
+
2299
+ case 29:
2300
+ if (!(responseType.indexOf('id_token') !== -1 && !tokenDict.idToken)) {
2301
+ _context.next = 31;
2302
+ break;
2303
+ }
2304
+
2305
+ throw new AuthSdkError('Unable to parse OAuth flow response: response type "id_token" was requested but "id_token" was not returned.');
2306
+
2307
+ case 31:
2308
+ return _context.abrupt("return", {
2309
+ tokens: tokenDict,
2310
+ state: res.state,
2311
+ code: res.code
2312
+ });
2313
+
2314
+ case 32:
2315
+ case "end":
2316
+ return _context.stop();
2317
+ }
2318
+ }
2319
+ }, _callee);
2320
+ }));
2321
+ return _handleOAuthResponse.apply(this, arguments);
2147
2322
  }
2148
2323
 
2149
2324
  function getToken(sdk, options) {
@@ -2191,8 +2366,10 @@ function getToken(sdk, options) {
2191
2366
  return iframePromise.then(function (res) {
2192
2367
  return handleOAuthResponse(sdk, tokenParams, res, urls);
2193
2368
  }).finally(function () {
2369
+ var _a;
2370
+
2194
2371
  if (document.body.contains(iframeEl)) {
2195
- iframeEl.parentElement.removeChild(iframeEl);
2372
+ (_a = iframeEl.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(iframeEl);
2196
2373
  }
2197
2374
  });
2198
2375
 
@@ -2405,7 +2582,7 @@ function _renewTokens() {
2405
2582
  break;
2406
2583
  }
2407
2584
 
2408
- return _context.abrupt("return", renewTokensWithRefresh(sdk, options, tokens.refreshToken));
2585
+ return _context.abrupt("return", renewTokensWithRefresh(sdk, options || {}, tokens.refreshToken));
2409
2586
 
2410
2587
  case 3:
2411
2588
  if (!(!tokens.accessToken && !tokens.idToken)) {
@@ -2578,46 +2755,50 @@ function getWithPopup(sdk, options) {
2578
2755
  return getToken(sdk, options);
2579
2756
  }
2580
2757
 
2581
- function getWithRedirect(sdk, options) {
2582
- if (arguments.length > 2) {
2583
- return Promise.reject(new AuthSdkError('As of version 3.0, "getWithRedirect" takes only a single set of options'));
2584
- }
2758
+ function getWithRedirect(_x, _x2) {
2759
+ return _getWithRedirect.apply(this, arguments);
2760
+ }
2585
2761
 
2586
- options = clone(options) || {};
2587
- return prepareTokenParams(sdk, options).then(function (tokenParams) {
2588
- var urls = getOAuthUrls(sdk, options);
2589
- var requestUrl = urls.authorizeUrl + buildAuthorizeParams(tokenParams);
2590
- var issuer = sdk.options.issuer;
2591
- var responseType = tokenParams.responseType,
2592
- state = tokenParams.state,
2593
- nonce = tokenParams.nonce,
2594
- scopes = tokenParams.scopes,
2595
- clientId = tokenParams.clientId,
2596
- ignoreSignature = tokenParams.ignoreSignature,
2597
- redirectUri = tokenParams.redirectUri,
2598
- codeVerifier = tokenParams.codeVerifier,
2599
- codeChallenge = tokenParams.codeChallenge,
2600
- codeChallengeMethod = tokenParams.codeChallengeMethod;
2601
- var oauthMeta = {
2602
- issuer: issuer,
2603
- responseType: responseType,
2604
- state: state,
2605
- nonce: nonce,
2606
- scopes: scopes,
2607
- clientId: clientId,
2608
- urls: urls,
2609
- ignoreSignature: ignoreSignature,
2610
- redirectUri: redirectUri,
2611
- codeVerifier: codeVerifier,
2612
- codeChallenge: codeChallenge,
2613
- codeChallengeMethod: codeChallengeMethod
2614
- };
2615
- sdk.transactionManager.save(oauthMeta, {
2616
- oauth: true
2617
- });
2762
+ function _getWithRedirect() {
2763
+ _getWithRedirect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(sdk, options) {
2764
+ var tokenParams,
2765
+ meta,
2766
+ requestUrl,
2767
+ _args = arguments;
2768
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
2769
+ while (1) {
2770
+ switch (_context.prev = _context.next) {
2771
+ case 0:
2772
+ if (!(_args.length > 2)) {
2773
+ _context.next = 2;
2774
+ break;
2775
+ }
2618
2776
 
2619
- sdk.token.getWithRedirect._setLocation(requestUrl);
2620
- });
2777
+ return _context.abrupt("return", Promise.reject(new AuthSdkError('As of version 3.0, "getWithRedirect" takes only a single set of options')));
2778
+
2779
+ case 2:
2780
+ options = clone(options) || {};
2781
+ _context.next = 5;
2782
+ return prepareTokenParams(sdk, options);
2783
+
2784
+ case 5:
2785
+ tokenParams = _context.sent;
2786
+ meta = createOAuthMeta(sdk, tokenParams);
2787
+ requestUrl = meta.urls.authorizeUrl + buildAuthorizeParams(tokenParams);
2788
+ sdk.transactionManager.save(meta, {
2789
+ oauth: true
2790
+ });
2791
+
2792
+ sdk.token.getWithRedirect._setLocation(requestUrl);
2793
+
2794
+ case 10:
2795
+ case "end":
2796
+ return _context.stop();
2797
+ }
2798
+ }
2799
+ }, _callee);
2800
+ }));
2801
+ return _getWithRedirect.apply(this, arguments);
2621
2802
  }
2622
2803
 
2623
2804
  function removeHash(sdk) {
@@ -2806,7 +2987,7 @@ var storageUtil = {
2806
2987
  return supported;
2807
2988
  },
2808
2989
  getStorageByType: function getStorageByType(storageType, options) {
2809
- var storageProvider = null;
2990
+ var storageProvider;
2810
2991
 
2811
2992
  switch (storageType) {
2812
2993
  case 'sessionStorage':
@@ -2879,7 +3060,7 @@ var storageUtil = {
2879
3060
  }
2880
3061
  };
2881
3062
 
2882
- if (!options.useMultipleCookies) {
3063
+ if (!options.useSeparateCookies) {
2883
3064
  return storage;
2884
3065
  }
2885
3066
 
@@ -2972,45 +3153,6 @@ var storageUtil = {
2972
3153
  }
2973
3154
  };
2974
3155
 
2975
- function assertValidConfig(args) {
2976
- args = args || {};
2977
- var scopes = args.scopes;
2978
-
2979
- if (scopes && !Array.isArray(scopes)) {
2980
- throw new AuthSdkError('scopes must be a array of strings. ' + 'Required usage: new OktaAuth({scopes: ["openid", "email"]})');
2981
- }
2982
-
2983
- var issuer = args.issuer;
2984
-
2985
- if (!issuer) {
2986
- throw new AuthSdkError('No issuer passed to constructor. ' + 'Required usage: new OktaAuth({issuer: "https://{yourOktaDomain}.com/oauth2/{authServerId}"})');
2987
- }
2988
-
2989
- var isUrlRegex = new RegExp('^http?s?://.+');
2990
-
2991
- if (!isUrlRegex.test(args.issuer)) {
2992
- throw new AuthSdkError('Issuer must be a valid URL. ' + 'Required usage: new OktaAuth({issuer: "https://{yourOktaDomain}.com/oauth2/{authServerId}"})');
2993
- }
2994
-
2995
- if (issuer.indexOf('-admin.') !== -1) {
2996
- throw new AuthSdkError('Issuer URL passed to constructor contains "-admin" in subdomain. ' + 'Required usage: new OktaAuth({issuer: "https://{yourOktaDomain}.com})');
2997
- }
2998
- }
2999
-
3000
- function getUserAgent(args, sdkValue) {
3001
- var userAgent = args.userAgent || {};
3002
-
3003
- if (userAgent.value) {
3004
- return userAgent.value;
3005
- }
3006
-
3007
- if (userAgent.template) {
3008
- return userAgent.template.replace('$OKTA_AUTH_JS', sdkValue);
3009
- }
3010
-
3011
- return sdkValue;
3012
- }
3013
-
3014
3156
  var SdkClock = /*#__PURE__*/function () {
3015
3157
  function SdkClock(localOffset) {
3016
3158
  _classCallCheck(this, SdkClock);
@@ -3056,6 +3198,8 @@ var TokenService = /*#__PURE__*/function () {
3056
3198
 
3057
3199
  this.tokenManager = tokenManager;
3058
3200
  this.options = options;
3201
+ this.storageListener = undefined;
3202
+ this.onTokenExpiredHandler = undefined;
3059
3203
  }
3060
3204
 
3061
3205
  _createClass(TokenService, [{
@@ -3158,6 +3302,7 @@ var TokenManager = /*#__PURE__*/function () {
3158
3302
  throw new AuthSdkError('Emitter should be initialized before TokenManager');
3159
3303
  }
3160
3304
 
3305
+ this.service = null;
3161
3306
  options = Object.assign({}, DEFAULT_OPTIONS, removeNils(options));
3162
3307
 
3163
3308
  if (isIE11OrLess()) {
@@ -3180,7 +3325,9 @@ var TokenManager = /*#__PURE__*/function () {
3180
3325
  storageOptions.storageType = options.storage;
3181
3326
  }
3182
3327
 
3183
- this.storage = sdk.storageManager.getTokenStorage(storageOptions);
3328
+ this.storage = sdk.storageManager.getTokenStorage(Object.assign(Object.assign({}, storageOptions), {
3329
+ useSeparateCookies: true
3330
+ }));
3184
3331
  this.clock = SdkClock.create();
3185
3332
  this.state = defaultState();
3186
3333
  this.on = this.emitter.on.bind(this.emitter);
@@ -3217,7 +3364,8 @@ var TokenManager = /*#__PURE__*/function () {
3217
3364
  }, {
3218
3365
  key: "getExpireTime",
3219
3366
  value: function getExpireTime(token) {
3220
- var expireTime = token.expiresAt - this.options.expireEarlySeconds;
3367
+ var expireEarlySeconds = this.options.expireEarlySeconds || 0;
3368
+ var expireTime = token.expiresAt - expireEarlySeconds;
3221
3369
  return expireTime;
3222
3370
  }
3223
3371
  }, {
@@ -3536,11 +3684,13 @@ var TokenManager = /*#__PURE__*/function () {
3536
3684
  key: "renewToken",
3537
3685
  value: function () {
3538
3686
  var _renewToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(token) {
3687
+ var _a;
3688
+
3539
3689
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
3540
3690
  while (1) {
3541
3691
  switch (_context3.prev = _context3.next) {
3542
3692
  case 0:
3543
- return _context3.abrupt("return", this.sdk.token.renew(token));
3693
+ return _context3.abrupt("return", (_a = this.sdk.token) === null || _a === void 0 ? void 0 : _a.renew(token));
3544
3694
 
3545
3695
  case 1:
3546
3696
  case "end":
@@ -3676,6 +3826,10 @@ var PromiseQueue = /*#__PURE__*/function () {
3676
3826
  }
3677
3827
 
3678
3828
  return new Promise(function (resolve, reject) {
3829
+ if (_this.queue.length > 0) {
3830
+ warn('Async method is being called but another async method is already running. ' + 'The new method will be delayed until the previous method completes.');
3831
+ }
3832
+
3679
3833
  _this.queue.push({
3680
3834
  method: method,
3681
3835
  thisObject: thisObject,
@@ -3766,7 +3920,7 @@ function fingerprint(sdk, options) {
3766
3920
  document.body.appendChild(iframe);
3767
3921
  timeout = setTimeout(function () {
3768
3922
  reject(new AuthSdkError('Fingerprinting timed out'));
3769
- }, options.timeout || 15000);
3923
+ }, (options === null || options === void 0 ? void 0 : options.timeout) || 15000);
3770
3924
  });
3771
3925
  return promise.finally(function () {
3772
3926
  clearTimeout(timeout);
@@ -3810,6 +3964,7 @@ var AuthStateManager = /*#__PURE__*/function () {
3810
3964
  this._pending = Object.assign({}, DEFAULT_PENDING);
3811
3965
  this._authState = INITIAL_AUTH_STATE;
3812
3966
  this._logOptions = {};
3967
+ this._prevAuthState = null;
3813
3968
  sdk.tokenManager.on(EVENT_ADDED, function (key, token) {
3814
3969
  _this._setLogOptions({
3815
3970
  event: EVENT_ADDED,
@@ -4120,7 +4275,7 @@ var StorageManager = /*#__PURE__*/function () {
4120
4275
 
4121
4276
  if (idx >= 0) {
4122
4277
  storageTypes = storageTypes.slice(idx);
4123
- storageType = null;
4278
+ storageType = undefined;
4124
4279
  }
4125
4280
  }
4126
4281
 
@@ -4308,6 +4463,7 @@ var TransactionManager = /*#__PURE__*/function () {
4308
4463
  this.saveStateCookie = options.saveStateCookie === false ? false : true;
4309
4464
  this.saveParamsCookie = options.saveParamsCookie === false ? false : true;
4310
4465
  this.enableSharedStorage = options.enableSharedStorage === false ? false : true;
4466
+ this.saveLastResponse = options.saveLastResponse === false ? false : true;
4311
4467
  this.options = options;
4312
4468
  }
4313
4469
 
@@ -4320,7 +4476,7 @@ var TransactionManager = /*#__PURE__*/function () {
4320
4476
  transactionStorage.clearStorage();
4321
4477
  this.clearIdxResponse();
4322
4478
 
4323
- if (this.enableSharedStorage && options.clearSharedStorage) {
4479
+ if (this.enableSharedStorage && options.clearSharedStorage !== false) {
4324
4480
  var state = options.state || (meta === null || meta === void 0 ? void 0 : meta.state);
4325
4481
 
4326
4482
  if (state) {
@@ -4504,7 +4660,7 @@ var TransactionManager = /*#__PURE__*/function () {
4504
4660
  }
4505
4661
  }
4506
4662
 
4507
- throw new AuthSdkError('Could not load PKCE codeVerifier from storage. This may indicate the auth flow has already completed or multiple auth flows are executing concurrently.', null);
4663
+ throw new AuthSdkError('Could not load PKCE codeVerifier from storage. This may indicate the auth flow has already completed or multiple auth flows are executing concurrently.', undefined);
4508
4664
  }
4509
4665
  }, {
4510
4666
  key: "clearLegacyOAuthParams",
@@ -4558,6 +4714,10 @@ var TransactionManager = /*#__PURE__*/function () {
4558
4714
  }, {
4559
4715
  key: "saveIdxResponse",
4560
4716
  value: function saveIdxResponse(idxResponse) {
4717
+ if (!this.saveLastResponse) {
4718
+ return;
4719
+ }
4720
+
4561
4721
  var storage = this.storageManager.getIdxResponseStorage();
4562
4722
 
4563
4723
  if (!storage) {
@@ -4569,6 +4729,10 @@ var TransactionManager = /*#__PURE__*/function () {
4569
4729
  }, {
4570
4730
  key: "loadIdxResponse",
4571
4731
  value: function loadIdxResponse() {
4732
+ if (!this.saveLastResponse) {
4733
+ return null;
4734
+ }
4735
+
4572
4736
  var storage = this.storageManager.getIdxResponseStorage();
4573
4737
 
4574
4738
  if (!storage) {
@@ -4586,6 +4750,10 @@ var TransactionManager = /*#__PURE__*/function () {
4586
4750
  }, {
4587
4751
  key: "clearIdxResponse",
4588
4752
  value: function clearIdxResponse() {
4753
+ if (!this.saveLastResponse) {
4754
+ return;
4755
+ }
4756
+
4589
4757
  var storage = this.storageManager.getIdxResponseStorage();
4590
4758
  storage === null || storage === void 0 ? void 0 : storage.clearStorage();
4591
4759
  }
@@ -4594,6 +4762,31 @@ var TransactionManager = /*#__PURE__*/function () {
4594
4762
  return TransactionManager;
4595
4763
  }();
4596
4764
 
4765
+ function assertValidConfig(args) {
4766
+ args = args || {};
4767
+ var scopes = args.scopes;
4768
+
4769
+ if (scopes && !Array.isArray(scopes)) {
4770
+ throw new AuthSdkError('scopes must be a array of strings. ' + 'Required usage: new OktaAuth({scopes: ["openid", "email"]})');
4771
+ }
4772
+
4773
+ var issuer = args.issuer;
4774
+
4775
+ if (!issuer) {
4776
+ throw new AuthSdkError('No issuer passed to constructor. ' + 'Required usage: new OktaAuth({issuer: "https://{yourOktaDomain}.com/oauth2/{authServerId}"})');
4777
+ }
4778
+
4779
+ var isUrlRegex = new RegExp('^http?s?://.+');
4780
+
4781
+ if (!isUrlRegex.test(issuer)) {
4782
+ throw new AuthSdkError('Issuer must be a valid URL. ' + 'Required usage: new OktaAuth({issuer: "https://{yourOktaDomain}.com/oauth2/{authServerId}"})');
4783
+ }
4784
+
4785
+ if (issuer.indexOf('-admin.') !== -1) {
4786
+ throw new AuthSdkError('Issuer URL passed to constructor contains "-admin" in subdomain. ' + 'Required usage: new OktaAuth({issuer: "https://{yourOktaDomain}.com})');
4787
+ }
4788
+ }
4789
+
4597
4790
  function _createForOfIteratorHelper$4(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$4(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4598
4791
 
4599
4792
  function _unsupportedIterableToArray$4(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$4(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen); }
@@ -4745,7 +4938,7 @@ var ServerStorage = /*#__PURE__*/function () {
4745
4938
  }, {
4746
4939
  key: "getStorageByType",
4747
4940
  value: function getStorageByType(storageType) {
4748
- var storageProvider = null;
4941
+ var storageProvider;
4749
4942
 
4750
4943
  switch (storageType) {
4751
4944
  case 'memory':
@@ -4789,8 +4982,7 @@ var serverStorage = new ServerStorage(sharedStorage);
4789
4982
 
4790
4983
  var BROWSER_STORAGE = {
4791
4984
  token: {
4792
- storageTypes: ['localStorage', 'sessionStorage', 'cookie'],
4793
- useMultipleCookies: true
4985
+ storageTypes: ['localStorage', 'sessionStorage', 'cookie']
4794
4986
  },
4795
4987
  cache: {
4796
4988
  storageTypes: ['localStorage', 'sessionStorage', 'cookie']
@@ -4894,51 +5086,58 @@ function buildOptions() {
4894
5086
  storageManager: args.storageManager,
4895
5087
  transactionManager: args.transactionManager,
4896
5088
  cookies: isBrowser() ? getCookieSettings(args, isHTTPS()) : args.cookies,
5089
+ flow: args.flow,
5090
+ codeChallenge: args.codeChallenge,
5091
+ codeChallengeMethod: args.codeChallengeMethod,
5092
+ recoveryToken: args.recoveryToken,
5093
+ activationToken: args.activationToken,
4897
5094
  ignoreSignature: !!args.ignoreSignature,
4898
5095
  clientSecret: args.clientSecret
4899
5096
  });
4900
5097
  }
4901
5098
 
4902
- function createTransactionMeta(_x, _x2) {
5099
+ function createTransactionMeta(_x) {
4903
5100
  return _createTransactionMeta.apply(this, arguments);
4904
5101
  }
4905
5102
 
4906
5103
  function _createTransactionMeta() {
4907
- _createTransactionMeta = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(authClient, options) {
4908
- var tokenParams, pkce, clientId, redirectUri, responseType, responseMode, scopes, state, nonce, ignoreSignature, codeVerifier, codeChallengeMethod, codeChallenge, urls, flow, issuer, meta;
5104
+ _createTransactionMeta = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(authClient) {
5105
+ var options,
5106
+ tokenParams,
5107
+ pkceMeta,
5108
+ _Object$assign,
5109
+ _Object$assign$flow,
5110
+ flow,
5111
+ _Object$assign$withCr,
5112
+ withCredentials,
5113
+ _Object$assign$activa,
5114
+ activationToken,
5115
+ _Object$assign$recove,
5116
+ recoveryToken,
5117
+ meta,
5118
+ _args = arguments;
5119
+
4909
5120
  return _regeneratorRuntime.wrap(function _callee$(_context) {
4910
5121
  while (1) {
4911
5122
  switch (_context.prev = _context.next) {
4912
5123
  case 0:
4913
- _context.next = 2;
5124
+ options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
5125
+ _context.next = 3;
4914
5126
  return authClient.token.prepareTokenParams(options);
4915
5127
 
4916
- case 2:
5128
+ case 3:
4917
5129
  tokenParams = _context.sent;
4918
- pkce = tokenParams.pkce, clientId = tokenParams.clientId, redirectUri = tokenParams.redirectUri, responseType = tokenParams.responseType, responseMode = tokenParams.responseMode, scopes = tokenParams.scopes, state = tokenParams.state, nonce = tokenParams.nonce, ignoreSignature = tokenParams.ignoreSignature, codeVerifier = tokenParams.codeVerifier, codeChallengeMethod = tokenParams.codeChallengeMethod, codeChallenge = tokenParams.codeChallenge;
4919
- urls = getOAuthUrls(authClient, tokenParams);
4920
- flow = authClient.idx.getFlow() || 'default';
4921
- issuer = authClient.options.issuer;
4922
- meta = {
5130
+ pkceMeta = createOAuthMeta(authClient, tokenParams);
5131
+ _Object$assign = Object.assign(Object.assign({}, authClient.options), options), _Object$assign$flow = _Object$assign.flow, flow = _Object$assign$flow === void 0 ? 'default' : _Object$assign$flow, _Object$assign$withCr = _Object$assign.withCredentials, withCredentials = _Object$assign$withCr === void 0 ? true : _Object$assign$withCr, _Object$assign$activa = _Object$assign.activationToken, activationToken = _Object$assign$activa === void 0 ? undefined : _Object$assign$activa, _Object$assign$recove = _Object$assign.recoveryToken, recoveryToken = _Object$assign$recove === void 0 ? undefined : _Object$assign$recove;
5132
+ meta = Object.assign(Object.assign({}, pkceMeta), {
4923
5133
  flow: flow,
4924
- issuer: issuer,
4925
- pkce: pkce,
4926
- clientId: clientId,
4927
- redirectUri: redirectUri,
4928
- responseType: responseType,
4929
- responseMode: responseMode,
4930
- scopes: scopes,
4931
- state: state,
4932
- nonce: nonce,
4933
- urls: urls,
4934
- ignoreSignature: ignoreSignature,
4935
- codeVerifier: codeVerifier,
4936
- codeChallengeMethod: codeChallengeMethod,
4937
- codeChallenge: codeChallenge
4938
- };
5134
+ withCredentials: withCredentials,
5135
+ activationToken: activationToken,
5136
+ recoveryToken: recoveryToken
5137
+ });
4939
5138
  return _context.abrupt("return", meta);
4940
5139
 
4941
- case 9:
5140
+ case 8:
4942
5141
  case "end":
4943
5142
  return _context.stop();
4944
5143
  }
@@ -4948,28 +5147,35 @@ function _createTransactionMeta() {
4948
5147
  return _createTransactionMeta.apply(this, arguments);
4949
5148
  }
4950
5149
 
4951
- function transactionMetaExist(authClient, options) {
4952
- if (authClient.transactionManager.exists(options)) {
4953
- var existing = authClient.transactionManager.load(options);
5150
+ function hasSavedInteractionHandle(authClient, options) {
5151
+ var savedMeta = getSavedTransactionMeta(authClient, options);
4954
5152
 
4955
- if (isTransactionMetaValid(authClient, existing) && existing.interactionHandle) {
4956
- return true;
4957
- }
5153
+ if (savedMeta === null || savedMeta === void 0 ? void 0 : savedMeta.interactionHandle) {
5154
+ return true;
4958
5155
  }
4959
5156
 
4960
5157
  return false;
4961
5158
  }
4962
5159
  function getSavedTransactionMeta(authClient, options) {
4963
- var state = (options === null || options === void 0 ? void 0 : options.state) || authClient.options.state;
4964
- var existing = authClient.transactionManager.load({
4965
- state: state
4966
- });
5160
+ options = removeNils(options);
5161
+ options = Object.assign(Object.assign({}, authClient.options), options);
5162
+ var savedMeta;
5163
+
5164
+ try {
5165
+ savedMeta = authClient.transactionManager.load(options);
5166
+ } catch (e) {}
4967
5167
 
4968
- if (existing && isTransactionMetaValid(authClient, existing)) {
4969
- return existing;
5168
+ if (!savedMeta) {
5169
+ return;
5170
+ }
5171
+
5172
+ if (isTransactionMetaValid(savedMeta, options)) {
5173
+ return savedMeta;
4970
5174
  }
5175
+
5176
+ warn('Saved transaction meta does not match the current configuration. ' + 'This may indicate that two apps are sharing a storage key.');
4971
5177
  }
4972
- function getTransactionMeta(_x3, _x4) {
5178
+ function getTransactionMeta(_x2, _x3) {
4973
5179
  return _getTransactionMeta.apply(this, arguments);
4974
5180
  }
4975
5181
 
@@ -4980,23 +5186,17 @@ function _getTransactionMeta() {
4980
5186
  while (1) {
4981
5187
  switch (_context2.prev = _context2.next) {
4982
5188
  case 0:
4983
- if (!authClient.transactionManager.exists(options)) {
4984
- _context2.next = 5;
4985
- break;
4986
- }
4987
-
5189
+ options = removeNils(options);
5190
+ options = Object.assign(Object.assign({}, authClient.options), options);
4988
5191
  validExistingMeta = getSavedTransactionMeta(authClient, options);
4989
5192
 
4990
5193
  if (!validExistingMeta) {
4991
- _context2.next = 4;
5194
+ _context2.next = 5;
4992
5195
  break;
4993
5196
  }
4994
5197
 
4995
5198
  return _context2.abrupt("return", validExistingMeta);
4996
5199
 
4997
- case 4:
4998
- warn('Saved transaction meta does not match the current configuration. ' + 'This may indicate that two apps are sharing a storage key.');
4999
-
5000
5200
  case 5:
5001
5201
  return _context2.abrupt("return", createTransactionMeta(authClient, options));
5002
5202
 
@@ -5015,23 +5215,26 @@ function saveTransactionMeta(authClient, meta) {
5015
5215
  muteWarning: true
5016
5216
  });
5017
5217
  }
5018
- function isTransactionMetaValid(authClient, meta) {
5019
- var keys = ['issuer', 'clientId', 'redirectUri'];
5218
+ function clearTransactionMeta(authClient) {
5219
+ authClient.transactionManager.clear();
5220
+ }
5221
+ function isTransactionMetaValid(meta) {
5222
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5223
+ var keys = ['issuer', 'clientId', 'redirectUri', 'state', 'codeChallenge', 'codeChallengeMethod', 'activationToken', 'recoveryToken'];
5020
5224
 
5021
- if (keys.some(function (key) {
5022
- return authClient.options[key] !== meta[key];
5023
- })) {
5225
+ if (isTransactionMetaValidForOptions(meta, options, keys) === false) {
5024
5226
  return false;
5025
5227
  }
5026
5228
 
5027
- var _authClient$options = authClient.options,
5028
- flow = _authClient$options.flow,
5029
- state = _authClient$options.state;
5229
+ var flow = options.flow;
5030
5230
 
5031
- if (state && state !== meta.state) {
5231
+ if (isTransactionMetaValidForFlow(meta, flow) === false) {
5032
5232
  return false;
5033
5233
  }
5034
5234
 
5235
+ return true;
5236
+ }
5237
+ function isTransactionMetaValidForFlow(meta, flow) {
5035
5238
  var shouldValidateFlow = flow && flow !== 'default' && flow !== 'proceed';
5036
5239
 
5037
5240
  if (shouldValidateFlow) {
@@ -5042,6 +5245,16 @@ function isTransactionMetaValid(authClient, meta) {
5042
5245
 
5043
5246
  return true;
5044
5247
  }
5248
+ function isTransactionMetaValidForOptions(meta, options, keys) {
5249
+ var mismatch = keys.some(function (key) {
5250
+ var value = options[key];
5251
+
5252
+ if (value && value !== meta[key]) {
5253
+ return true;
5254
+ }
5255
+ });
5256
+ return !mismatch;
5257
+ }
5045
5258
 
5046
5259
  function getResponse(meta) {
5047
5260
  return {
@@ -5058,16 +5271,20 @@ function interact(_x) {
5058
5271
  function _interact() {
5059
5272
  _interact = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(authClient) {
5060
5273
  var options,
5061
- state,
5062
5274
  meta,
5063
- codeChallenge,
5064
- codeChallengeMethod,
5065
- _authClient$options,
5275
+ baseUrl,
5276
+ _meta,
5066
5277
  clientId,
5067
5278
  redirectUri,
5279
+ state,
5068
5280
  scopes,
5281
+ withCredentials,
5282
+ codeChallenge,
5283
+ codeChallengeMethod,
5069
5284
  activationToken,
5070
- baseUrl,
5285
+ recoveryToken,
5286
+ interactionHandle,
5287
+ newMeta,
5071
5288
  _args = arguments;
5072
5289
 
5073
5290
  return _regeneratorRuntime.wrap(function _callee$(_context) {
@@ -5075,30 +5292,27 @@ function _interact() {
5075
5292
  switch (_context.prev = _context.next) {
5076
5293
  case 0:
5077
5294
  options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
5078
- state = options.state || authClient.options.state;
5079
- _context.next = 4;
5080
- return getTransactionMeta(authClient, {
5081
- state: state
5082
- });
5083
-
5084
- case 4:
5085
- meta = _context.sent;
5295
+ options = removeNils(options);
5296
+ meta = getSavedTransactionMeta(authClient, options);
5086
5297
 
5087
- if (!meta.interactionHandle) {
5088
- _context.next = 7;
5298
+ if (!(meta === null || meta === void 0 ? void 0 : meta.interactionHandle)) {
5299
+ _context.next = 5;
5089
5300
  break;
5090
5301
  }
5091
5302
 
5092
5303
  return _context.abrupt("return", getResponse(meta));
5093
5304
 
5305
+ case 5:
5306
+ _context.next = 7;
5307
+ return createTransactionMeta(authClient, Object.assign(Object.assign({}, meta), options));
5308
+
5094
5309
  case 7:
5095
- codeChallenge = meta.codeChallenge, codeChallengeMethod = meta.codeChallengeMethod;
5096
- _authClient$options = authClient.options, clientId = _authClient$options.clientId, redirectUri = _authClient$options.redirectUri;
5097
- state = state || meta.state;
5098
- scopes = options.scopes || authClient.options.scopes || meta.scopes;
5099
- activationToken = options.activationToken;
5310
+ meta = _context.sent;
5100
5311
  baseUrl = getOAuthBaseUrl(authClient);
5101
- return _context.abrupt("return", idx.interact({
5312
+ _meta = meta, clientId = _meta.clientId, redirectUri = _meta.redirectUri, state = _meta.state, scopes = _meta.scopes, withCredentials = _meta.withCredentials, codeChallenge = _meta.codeChallenge, codeChallengeMethod = _meta.codeChallengeMethod, activationToken = _meta.activationToken, recoveryToken = _meta.recoveryToken;
5313
+ _context.next = 12;
5314
+ return idx.interact({
5315
+ withCredentials: withCredentials,
5102
5316
  clientId: clientId,
5103
5317
  baseUrl: baseUrl,
5104
5318
  scopes: scopes,
@@ -5106,18 +5320,24 @@ function _interact() {
5106
5320
  redirectUri: redirectUri,
5107
5321
  codeChallenge: codeChallenge,
5108
5322
  codeChallengeMethod: codeChallengeMethod,
5323
+ activationToken: activationToken,
5324
+ recoveryToken: recoveryToken
5325
+ });
5326
+
5327
+ case 12:
5328
+ interactionHandle = _context.sent;
5329
+ newMeta = Object.assign(Object.assign({}, meta), {
5330
+ interactionHandle: interactionHandle,
5331
+ withCredentials: withCredentials,
5332
+ state: state,
5333
+ scopes: scopes,
5334
+ recoveryToken: recoveryToken,
5109
5335
  activationToken: activationToken
5110
- }).then(function (interactionHandle) {
5111
- var newMeta = Object.assign(Object.assign({}, meta), {
5112
- interactionHandle: interactionHandle,
5113
- state: state,
5114
- scopes: scopes
5115
- });
5116
- saveTransactionMeta(authClient, newMeta);
5117
- return getResponse(newMeta);
5118
- }));
5336
+ });
5337
+ saveTransactionMeta(authClient, newMeta);
5338
+ return _context.abrupt("return", getResponse(newMeta));
5119
5339
 
5120
- case 14:
5340
+ case 16:
5121
5341
  case "end":
5122
5342
  return _context.stop();
5123
5343
  }
@@ -5127,36 +5347,39 @@ function _interact() {
5127
5347
  return _interact.apply(this, arguments);
5128
5348
  }
5129
5349
 
5130
- function introspect(_x, _x2) {
5350
+ function introspect(_x) {
5131
5351
  return _introspect.apply(this, arguments);
5132
5352
  }
5133
5353
 
5134
5354
  function _introspect() {
5135
- _introspect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(authClient, options) {
5136
- var useLastResponse, rawIdxResponse, version, domain;
5355
+ _introspect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(authClient) {
5356
+ var options,
5357
+ rawIdxResponse,
5358
+ version,
5359
+ domain,
5360
+ withCredentials,
5361
+ _args = arguments;
5137
5362
  return _regeneratorRuntime.wrap(function _callee$(_context) {
5138
5363
  while (1) {
5139
5364
  switch (_context.prev = _context.next) {
5140
5365
  case 0:
5141
- useLastResponse = !options.stateTokenExternalId;
5142
-
5143
- if (useLastResponse) {
5144
- rawIdxResponse = authClient.transactionManager.loadIdxResponse();
5145
- }
5366
+ options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
5367
+ rawIdxResponse = authClient.transactionManager.loadIdxResponse();
5146
5368
 
5147
5369
  if (rawIdxResponse) {
5148
5370
  _context.next = 18;
5149
5371
  break;
5150
5372
  }
5151
5373
 
5152
- version = IDX_API_VERSION;
5374
+ version = options.version || IDX_API_VERSION;
5153
5375
  domain = getOAuthDomain(authClient);
5154
5376
  _context.prev = 5;
5155
5377
  _context.next = 8;
5156
- return idx.introspect(Object.assign({
5157
- domain: domain,
5378
+ return idx.introspect(Object.assign(Object.assign({
5379
+ domain: domain
5380
+ }, options), {
5158
5381
  version: version
5159
- }, options));
5382
+ }));
5160
5383
 
5161
5384
  case 8:
5162
5385
  rawIdxResponse = _context.sent;
@@ -5180,9 +5403,12 @@ function _introspect() {
5180
5403
  throw _context.t0;
5181
5404
 
5182
5405
  case 18:
5183
- return _context.abrupt("return", idx.makeIdxState(rawIdxResponse));
5406
+ withCredentials = options.withCredentials;
5407
+ return _context.abrupt("return", idx.makeIdxState(rawIdxResponse, {
5408
+ withCredentials: withCredentials
5409
+ }));
5184
5410
 
5185
- case 19:
5411
+ case 20:
5186
5412
  case "end":
5187
5413
  return _context.stop();
5188
5414
  }
@@ -5193,12 +5419,16 @@ function _introspect() {
5193
5419
  }
5194
5420
 
5195
5421
  function getAllValues(idxRemediation) {
5196
- return idxRemediation.value.map(function (r) {
5422
+ var _a;
5423
+
5424
+ return (_a = idxRemediation.value) === null || _a === void 0 ? void 0 : _a.map(function (r) {
5197
5425
  return r.name;
5198
5426
  });
5199
5427
  }
5200
5428
  function getRequiredValues(idxRemediation) {
5201
- return idxRemediation.value.reduce(function (required, cur) {
5429
+ var _a;
5430
+
5431
+ return (_a = idxRemediation.value) === null || _a === void 0 ? void 0 : _a.reduce(function (required, cur) {
5202
5432
  if (cur.required) {
5203
5433
  required.push(cur.name);
5204
5434
  }
@@ -5474,13 +5704,13 @@ var Authenticator = function Authenticator(authenticator) {
5474
5704
  this.meta = authenticator;
5475
5705
  };
5476
5706
 
5477
- function _createSuper$m(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$m(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
5707
+ function _createSuper$p(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$p(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
5478
5708
 
5479
- function _isNativeReflectConstruct$m() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
5709
+ function _isNativeReflectConstruct$p() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
5480
5710
  var VerificationCodeAuthenticator = /*#__PURE__*/function (_Authenticator) {
5481
5711
  _inherits(VerificationCodeAuthenticator, _Authenticator);
5482
5712
 
5483
- var _super = _createSuper$m(VerificationCodeAuthenticator);
5713
+ var _super = _createSuper$p(VerificationCodeAuthenticator);
5484
5714
 
5485
5715
  function VerificationCodeAuthenticator() {
5486
5716
  _classCallCheck(this, VerificationCodeAuthenticator);
@@ -5491,13 +5721,13 @@ var VerificationCodeAuthenticator = /*#__PURE__*/function (_Authenticator) {
5491
5721
  _createClass(VerificationCodeAuthenticator, [{
5492
5722
  key: "canVerify",
5493
5723
  value: function canVerify(values) {
5494
- return !!values.verificationCode;
5724
+ return values.verificationCode || values.otp;
5495
5725
  }
5496
5726
  }, {
5497
5727
  key: "mapCredentials",
5498
5728
  value: function mapCredentials(values) {
5499
5729
  return {
5500
- passcode: values.verificationCode
5730
+ passcode: values.verificationCode || values.otp
5501
5731
  };
5502
5732
  }
5503
5733
  }, {
@@ -5516,13 +5746,13 @@ var VerificationCodeAuthenticator = /*#__PURE__*/function (_Authenticator) {
5516
5746
  return VerificationCodeAuthenticator;
5517
5747
  }(Authenticator);
5518
5748
 
5519
- function _createSuper$l(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$l(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
5749
+ function _createSuper$o(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$o(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
5520
5750
 
5521
- function _isNativeReflectConstruct$l() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
5751
+ function _isNativeReflectConstruct$o() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
5522
5752
  var OktaVerifyTotp = /*#__PURE__*/function (_VerificationCodeAuth) {
5523
5753
  _inherits(OktaVerifyTotp, _VerificationCodeAuth);
5524
5754
 
5525
- var _super = _createSuper$l(OktaVerifyTotp);
5755
+ var _super = _createSuper$o(OktaVerifyTotp);
5526
5756
 
5527
5757
  function OktaVerifyTotp() {
5528
5758
  _classCallCheck(this, OktaVerifyTotp);
@@ -5542,13 +5772,13 @@ var OktaVerifyTotp = /*#__PURE__*/function (_VerificationCodeAuth) {
5542
5772
  return OktaVerifyTotp;
5543
5773
  }(VerificationCodeAuthenticator);
5544
5774
 
5545
- function _createSuper$k(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$k(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
5775
+ function _createSuper$n(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$n(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
5546
5776
 
5547
- function _isNativeReflectConstruct$k() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
5777
+ function _isNativeReflectConstruct$n() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
5548
5778
  var OktaPassword = /*#__PURE__*/function (_Authenticator) {
5549
5779
  _inherits(OktaPassword, _Authenticator);
5550
5780
 
5551
- var _super = _createSuper$k(OktaPassword);
5781
+ var _super = _createSuper$n(OktaPassword);
5552
5782
 
5553
5783
  function OktaPassword() {
5554
5784
  _classCallCheck(this, OktaPassword);
@@ -5584,13 +5814,13 @@ var OktaPassword = /*#__PURE__*/function (_Authenticator) {
5584
5814
  return OktaPassword;
5585
5815
  }(Authenticator);
5586
5816
 
5587
- function _createSuper$j(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$j(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
5817
+ function _createSuper$m(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$m(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
5588
5818
 
5589
- function _isNativeReflectConstruct$j() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
5819
+ function _isNativeReflectConstruct$m() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
5590
5820
  var SecurityQuestionEnrollment = /*#__PURE__*/function (_Authenticator) {
5591
5821
  _inherits(SecurityQuestionEnrollment, _Authenticator);
5592
5822
 
5593
- var _super = _createSuper$j(SecurityQuestionEnrollment);
5823
+ var _super = _createSuper$m(SecurityQuestionEnrollment);
5594
5824
 
5595
5825
  function SecurityQuestionEnrollment() {
5596
5826
  _classCallCheck(this, SecurityQuestionEnrollment);
@@ -5641,13 +5871,13 @@ var SecurityQuestionEnrollment = /*#__PURE__*/function (_Authenticator) {
5641
5871
  return SecurityQuestionEnrollment;
5642
5872
  }(Authenticator);
5643
5873
 
5644
- function _createSuper$i(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$i(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
5874
+ function _createSuper$l(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$l(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
5645
5875
 
5646
- function _isNativeReflectConstruct$i() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
5876
+ function _isNativeReflectConstruct$l() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
5647
5877
  var SecurityQuestionVerification = /*#__PURE__*/function (_Authenticator) {
5648
5878
  _inherits(SecurityQuestionVerification, _Authenticator);
5649
5879
 
5650
- var _super = _createSuper$i(SecurityQuestionVerification);
5880
+ var _super = _createSuper$l(SecurityQuestionVerification);
5651
5881
 
5652
5882
  function SecurityQuestionVerification() {
5653
5883
  _classCallCheck(this, SecurityQuestionVerification);
@@ -5684,16 +5914,17 @@ var SecurityQuestionVerification = /*#__PURE__*/function (_Authenticator) {
5684
5914
  }(Authenticator);
5685
5915
 
5686
5916
  function getAuthenticator(remediation) {
5687
- var _remediation$relatesT = remediation.relatesTo;
5688
- _remediation$relatesT = _remediation$relatesT === void 0 ? {} : _remediation$relatesT;
5689
- var value = _remediation$relatesT.value;
5917
+ var _a;
5918
+
5919
+ var relatesTo = remediation.relatesTo;
5920
+ var value = (relatesTo === null || relatesTo === void 0 ? void 0 : relatesTo.value) || {};
5690
5921
 
5691
5922
  switch (value.key) {
5692
5923
  case AuthenticatorKey.OKTA_PASSWORD:
5693
5924
  return new OktaPassword(value);
5694
5925
 
5695
5926
  case AuthenticatorKey.SECURITY_QUESTION:
5696
- if (value.contextualData.enrolledQuestion) {
5927
+ if ((_a = value.contextualData) === null || _a === void 0 ? void 0 : _a.enrolledQuestion) {
5697
5928
  return new SecurityQuestionVerification(value);
5698
5929
  } else {
5699
5930
  return new SecurityQuestionEnrollment(value);
@@ -5707,13 +5938,13 @@ function getAuthenticator(remediation) {
5707
5938
  }
5708
5939
  }
5709
5940
 
5710
- function _createSuper$h(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$h(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
5941
+ function _createSuper$k(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$k(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
5711
5942
 
5712
- function _isNativeReflectConstruct$h() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
5943
+ function _isNativeReflectConstruct$k() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
5713
5944
  var VerifyAuthenticator = /*#__PURE__*/function (_Remediator) {
5714
5945
  _inherits(VerifyAuthenticator, _Remediator);
5715
5946
 
5716
- var _super = _createSuper$h(VerifyAuthenticator);
5947
+ var _super = _createSuper$k(VerifyAuthenticator);
5717
5948
 
5718
5949
  function VerifyAuthenticator(remediation) {
5719
5950
  var _this;
@@ -5750,13 +5981,13 @@ var VerifyAuthenticator = /*#__PURE__*/function (_Remediator) {
5750
5981
  return VerifyAuthenticator;
5751
5982
  }(Remediator);
5752
5983
 
5753
- function _createSuper$g(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$g(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
5984
+ function _createSuper$j(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$j(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
5754
5985
 
5755
- function _isNativeReflectConstruct$g() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
5986
+ function _isNativeReflectConstruct$j() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
5756
5987
  var EnrollAuthenticator = /*#__PURE__*/function (_VerifyAuthenticator) {
5757
5988
  _inherits(EnrollAuthenticator, _VerifyAuthenticator);
5758
5989
 
5759
- var _super = _createSuper$g(EnrollAuthenticator);
5990
+ var _super = _createSuper$j(EnrollAuthenticator);
5760
5991
 
5761
5992
  function EnrollAuthenticator() {
5762
5993
  _classCallCheck(this, EnrollAuthenticator);
@@ -5768,13 +5999,13 @@ var EnrollAuthenticator = /*#__PURE__*/function (_VerifyAuthenticator) {
5768
5999
  }(VerifyAuthenticator);
5769
6000
  EnrollAuthenticator.remediationName = 'enroll-authenticator';
5770
6001
 
5771
- function _createSuper$f(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$f(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6002
+ function _createSuper$i(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$i(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
5772
6003
 
5773
- function _isNativeReflectConstruct$f() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6004
+ function _isNativeReflectConstruct$i() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
5774
6005
  var EnrollPoll = /*#__PURE__*/function (_Remediator) {
5775
6006
  _inherits(EnrollPoll, _Remediator);
5776
6007
 
5777
- var _super = _createSuper$f(EnrollPoll);
6008
+ var _super = _createSuper$i(EnrollPoll);
5778
6009
 
5779
6010
  function EnrollPoll() {
5780
6011
  _classCallCheck(this, EnrollPoll);
@@ -5790,21 +6021,21 @@ var EnrollPoll = /*#__PURE__*/function (_Remediator) {
5790
6021
  }, {
5791
6022
  key: "getNextStep",
5792
6023
  value: function getNextStep(context) {
5793
- var name = this.getName();
6024
+ var common = _get(_getPrototypeOf(EnrollPoll.prototype), "getNextStep", this).call(this, context);
6025
+
5794
6026
  var authenticator = this.getAuthenticator();
5795
6027
 
5796
6028
  if (!authenticator && (context === null || context === void 0 ? void 0 : context.currentAuthenticator)) {
5797
6029
  authenticator = context.currentAuthenticator.value;
5798
6030
  }
5799
6031
 
5800
- return {
5801
- name: name,
6032
+ return Object.assign(Object.assign({}, common), {
5802
6033
  authenticator: authenticator,
5803
6034
  poll: {
5804
6035
  required: true,
5805
6036
  refresh: this.remediation.refresh
5806
6037
  }
5807
- };
6038
+ });
5808
6039
  }
5809
6040
  }, {
5810
6041
  key: "getValuesAfterProceed",
@@ -5824,13 +6055,170 @@ var EnrollPoll = /*#__PURE__*/function (_Remediator) {
5824
6055
  }(Remediator);
5825
6056
  EnrollPoll.remediationName = 'enroll-poll';
5826
6057
 
5827
- function _createSuper$e(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$e(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6058
+ function _createSuper$h(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$h(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
5828
6059
 
5829
- function _isNativeReflectConstruct$e() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6060
+ function _isNativeReflectConstruct$h() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6061
+ var SelectEnrollmentChannel = /*#__PURE__*/function (_Remediator) {
6062
+ _inherits(SelectEnrollmentChannel, _Remediator);
6063
+
6064
+ var _super = _createSuper$h(SelectEnrollmentChannel);
6065
+
6066
+ function SelectEnrollmentChannel() {
6067
+ _classCallCheck(this, SelectEnrollmentChannel);
6068
+
6069
+ return _super.apply(this, arguments);
6070
+ }
6071
+
6072
+ _createClass(SelectEnrollmentChannel, [{
6073
+ key: "canRemediate",
6074
+ value: function canRemediate() {
6075
+ return Boolean(this.values.channel);
6076
+ }
6077
+ }, {
6078
+ key: "getNextStep",
6079
+ value: function getNextStep(context) {
6080
+ var common = _get(_getPrototypeOf(SelectEnrollmentChannel.prototype), "getNextStep", this).call(this);
6081
+
6082
+ var options = this.getChannels();
6083
+ var authenticator = context.currentAuthenticator.value;
6084
+ return Object.assign(Object.assign(Object.assign({}, common), options && {
6085
+ options: options
6086
+ }), {
6087
+ authenticator: authenticator
6088
+ });
6089
+ }
6090
+ }, {
6091
+ key: "getChannels",
6092
+ value: function getChannels() {
6093
+ var _a;
6094
+
6095
+ var authenticator = getAuthenticatorFromRemediation(this.remediation);
6096
+ var remediationValue = authenticator.value;
6097
+ return (_a = remediationValue.form.value.find(function (_ref) {
6098
+ var name = _ref.name;
6099
+ return name === 'channel';
6100
+ })) === null || _a === void 0 ? void 0 : _a.options;
6101
+ }
6102
+ }, {
6103
+ key: "getData",
6104
+ value: function getData() {
6105
+ var remediationValue = this.remediation.value[0].value;
6106
+ return {
6107
+ authenticator: {
6108
+ id: remediationValue.form.value[0].value,
6109
+ channel: this.values.channel
6110
+ },
6111
+ stateHandle: this.values.stateHandle
6112
+ };
6113
+ }
6114
+ }, {
6115
+ key: "getValuesAfterProceed",
6116
+ value: function getValuesAfterProceed() {
6117
+ var _this = this;
6118
+
6119
+ var trimmedValues = Object.keys(this.values).filter(function (valueKey) {
6120
+ return valueKey !== 'channel';
6121
+ });
6122
+ return trimmedValues.reduce(function (values, valueKey) {
6123
+ return Object.assign(Object.assign({}, values), _defineProperty({}, valueKey, _this.values[valueKey]));
6124
+ }, {});
6125
+ }
6126
+ }]);
6127
+
6128
+ return SelectEnrollmentChannel;
6129
+ }(Remediator);
6130
+ SelectEnrollmentChannel.remediationName = 'select-enrollment-channel';
6131
+
6132
+ function _createSuper$g(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$g(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6133
+
6134
+ function _isNativeReflectConstruct$g() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6135
+ var EnrollmentChannelData = /*#__PURE__*/function (_Remediator) {
6136
+ _inherits(EnrollmentChannelData, _Remediator);
6137
+
6138
+ var _super = _createSuper$g(EnrollmentChannelData);
6139
+
6140
+ function EnrollmentChannelData() {
6141
+ var _this;
6142
+
6143
+ _classCallCheck(this, EnrollmentChannelData);
6144
+
6145
+ _this = _super.apply(this, arguments);
6146
+ _this.map = {
6147
+ email: [],
6148
+ phoneNumber: []
6149
+ };
6150
+ return _this;
6151
+ }
6152
+
6153
+ _createClass(EnrollmentChannelData, [{
6154
+ key: "getInputEmail",
6155
+ value: function getInputEmail() {
6156
+ return [{
6157
+ name: 'email',
6158
+ type: 'string',
6159
+ required: true,
6160
+ label: 'Email'
6161
+ }];
6162
+ }
6163
+ }, {
6164
+ key: "getInputPhoneNumber",
6165
+ value: function getInputPhoneNumber() {
6166
+ return [{
6167
+ name: 'phoneNumber',
6168
+ type: 'string',
6169
+ required: true,
6170
+ label: 'Phone Number'
6171
+ }];
6172
+ }
6173
+ }, {
6174
+ key: "canRemediate",
6175
+ value: function canRemediate() {
6176
+ return Boolean(this.values.email || this.values.phoneNumber);
6177
+ }
6178
+ }, {
6179
+ key: "getNextStep",
6180
+ value: function getNextStep(context) {
6181
+ var common = _get(_getPrototypeOf(EnrollmentChannelData.prototype), "getNextStep", this).call(this);
6182
+
6183
+ var authenticator = context.currentAuthenticator.value;
6184
+ return Object.assign(Object.assign({}, common), {
6185
+ authenticator: authenticator
6186
+ });
6187
+ }
6188
+ }, {
6189
+ key: "getData",
6190
+ value: function getData() {
6191
+ return {
6192
+ stateHandle: this.values.stateHandle,
6193
+ email: this.values.email,
6194
+ phoneNumber: this.values.phoneNumber
6195
+ };
6196
+ }
6197
+ }, {
6198
+ key: "getValuesAfterProceed",
6199
+ value: function getValuesAfterProceed() {
6200
+ var _this2 = this;
6201
+
6202
+ var trimmedValues = Object.keys(this.values).filter(function (valueKey) {
6203
+ return !['email', 'phoneNumber'].includes(valueKey);
6204
+ });
6205
+ return trimmedValues.reduce(function (values, valueKey) {
6206
+ return Object.assign(Object.assign({}, values), _defineProperty({}, valueKey, _this2.values[valueKey]));
6207
+ }, {});
6208
+ }
6209
+ }]);
6210
+
6211
+ return EnrollmentChannelData;
6212
+ }(Remediator);
6213
+ EnrollmentChannelData.remediationName = 'enrollment-channel-data';
6214
+
6215
+ function _createSuper$f(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$f(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6216
+
6217
+ function _isNativeReflectConstruct$f() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
5830
6218
  var ChallengeAuthenticator = /*#__PURE__*/function (_VerifyAuthenticator) {
5831
6219
  _inherits(ChallengeAuthenticator, _VerifyAuthenticator);
5832
6220
 
5833
- var _super = _createSuper$e(ChallengeAuthenticator);
6221
+ var _super = _createSuper$f(ChallengeAuthenticator);
5834
6222
 
5835
6223
  function ChallengeAuthenticator() {
5836
6224
  _classCallCheck(this, ChallengeAuthenticator);
@@ -5842,13 +6230,13 @@ var ChallengeAuthenticator = /*#__PURE__*/function (_VerifyAuthenticator) {
5842
6230
  }(VerifyAuthenticator);
5843
6231
  ChallengeAuthenticator.remediationName = 'challenge-authenticator';
5844
6232
 
5845
- function _createSuper$d(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$d(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6233
+ function _createSuper$e(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$e(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
5846
6234
 
5847
- function _isNativeReflectConstruct$d() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6235
+ function _isNativeReflectConstruct$e() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
5848
6236
  var ChallengePoll = /*#__PURE__*/function (_EnrollPoll) {
5849
6237
  _inherits(ChallengePoll, _EnrollPoll);
5850
6238
 
5851
- var _super = _createSuper$d(ChallengePoll);
6239
+ var _super = _createSuper$e(ChallengePoll);
5852
6240
 
5853
6241
  function ChallengePoll() {
5854
6242
  _classCallCheck(this, ChallengePoll);
@@ -5860,13 +6248,13 @@ var ChallengePoll = /*#__PURE__*/function (_EnrollPoll) {
5860
6248
  }(EnrollPoll);
5861
6249
  ChallengePoll.remediationName = 'challenge-poll';
5862
6250
 
5863
- function _createSuper$c(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$c(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6251
+ function _createSuper$d(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$d(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
5864
6252
 
5865
- function _isNativeReflectConstruct$c() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6253
+ function _isNativeReflectConstruct$d() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
5866
6254
  var ResetAuthenticator = /*#__PURE__*/function (_VerifyAuthenticator) {
5867
6255
  _inherits(ResetAuthenticator, _VerifyAuthenticator);
5868
6256
 
5869
- var _super = _createSuper$c(ResetAuthenticator);
6257
+ var _super = _createSuper$d(ResetAuthenticator);
5870
6258
 
5871
6259
  function ResetAuthenticator() {
5872
6260
  _classCallCheck(this, ResetAuthenticator);
@@ -5878,13 +6266,13 @@ var ResetAuthenticator = /*#__PURE__*/function (_VerifyAuthenticator) {
5878
6266
  }(VerifyAuthenticator);
5879
6267
  ResetAuthenticator.remediationName = 'reset-authenticator';
5880
6268
 
5881
- function _createSuper$b(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$b(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6269
+ function _createSuper$c(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$c(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
5882
6270
 
5883
- function _isNativeReflectConstruct$b() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6271
+ function _isNativeReflectConstruct$c() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
5884
6272
  var EnrollProfile = /*#__PURE__*/function (_Remediator) {
5885
6273
  _inherits(EnrollProfile, _Remediator);
5886
6274
 
5887
- var _super = _createSuper$b(EnrollProfile);
6275
+ var _super = _createSuper$c(EnrollProfile);
5888
6276
 
5889
6277
  function EnrollProfile() {
5890
6278
  var _this;
@@ -5950,13 +6338,13 @@ var EnrollProfile = /*#__PURE__*/function (_Remediator) {
5950
6338
  }(Remediator);
5951
6339
  EnrollProfile.remediationName = 'enroll-profile';
5952
6340
 
5953
- function _createSuper$a(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$a(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6341
+ function _createSuper$b(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$b(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
5954
6342
 
5955
- function _isNativeReflectConstruct$a() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6343
+ function _isNativeReflectConstruct$b() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
5956
6344
  var Identify = /*#__PURE__*/function (_Remediator) {
5957
6345
  _inherits(Identify, _Remediator);
5958
6346
 
5959
- var _super = _createSuper$a(Identify);
6347
+ var _super = _createSuper$b(Identify);
5960
6348
 
5961
6349
  function Identify() {
5962
6350
  var _this;
@@ -6001,13 +6389,13 @@ var Identify = /*#__PURE__*/function (_Remediator) {
6001
6389
  }(Remediator);
6002
6390
  Identify.remediationName = 'identify';
6003
6391
 
6004
- function _createSuper$9(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$9(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6392
+ function _createSuper$a(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$a(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6005
6393
 
6006
- function _isNativeReflectConstruct$9() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6394
+ function _isNativeReflectConstruct$a() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6007
6395
  var ReEnrollAuthenticator = /*#__PURE__*/function (_Remediator) {
6008
6396
  _inherits(ReEnrollAuthenticator, _Remediator);
6009
6397
 
6010
- var _super = _createSuper$9(ReEnrollAuthenticator);
6398
+ var _super = _createSuper$a(ReEnrollAuthenticator);
6011
6399
 
6012
6400
  function ReEnrollAuthenticator() {
6013
6401
  var _this;
@@ -6043,13 +6431,13 @@ var ReEnrollAuthenticator = /*#__PURE__*/function (_Remediator) {
6043
6431
  }(Remediator);
6044
6432
  ReEnrollAuthenticator.remediationName = 'reenroll-authenticator';
6045
6433
 
6046
- function _createSuper$8(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$8(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6434
+ function _createSuper$9(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$9(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6047
6435
 
6048
- function _isNativeReflectConstruct$8() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6436
+ function _isNativeReflectConstruct$9() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6049
6437
  var RedirectIdp = /*#__PURE__*/function (_Remediator) {
6050
6438
  _inherits(RedirectIdp, _Remediator);
6051
6439
 
6052
- var _super = _createSuper$8(RedirectIdp);
6440
+ var _super = _createSuper$9(RedirectIdp);
6053
6441
 
6054
6442
  function RedirectIdp() {
6055
6443
  _classCallCheck(this, RedirectIdp);
@@ -6083,9 +6471,9 @@ var RedirectIdp = /*#__PURE__*/function (_Remediator) {
6083
6471
  }(Remediator);
6084
6472
  RedirectIdp.remediationName = 'redirect-idp';
6085
6473
 
6086
- function _createSuper$7(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$7(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6474
+ function _createSuper$8(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$8(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6087
6475
 
6088
- function _isNativeReflectConstruct$7() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6476
+ function _isNativeReflectConstruct$8() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6089
6477
 
6090
6478
  function _createForOfIteratorHelper$2(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
6091
6479
 
@@ -6129,7 +6517,7 @@ function findMatchedOption(authenticators, options) {
6129
6517
  var SelectAuthenticator = /*#__PURE__*/function (_Remediator) {
6130
6518
  _inherits(SelectAuthenticator, _Remediator);
6131
6519
 
6132
- var _super = _createSuper$7(SelectAuthenticator);
6520
+ var _super = _createSuper$8(SelectAuthenticator);
6133
6521
 
6134
6522
  function SelectAuthenticator() {
6135
6523
  var _this;
@@ -6170,7 +6558,8 @@ var SelectAuthenticator = /*#__PURE__*/function (_Remediator) {
6170
6558
  var authenticatorFromRemediation = getAuthenticatorFromRemediation(this.remediation);
6171
6559
  var options = authenticatorFromRemediation.options.map(function (option) {
6172
6560
  var label = option.label,
6173
- key = option.relatesTo.key;
6561
+ relatesTo = option.relatesTo;
6562
+ var key = relatesTo.key;
6174
6563
  return {
6175
6564
  label: label,
6176
6565
  value: key
@@ -6220,13 +6609,13 @@ var SelectAuthenticator = /*#__PURE__*/function (_Remediator) {
6220
6609
  return SelectAuthenticator;
6221
6610
  }(Remediator);
6222
6611
 
6223
- function _createSuper$6(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$6(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6612
+ function _createSuper$7(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$7(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6224
6613
 
6225
- function _isNativeReflectConstruct$6() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6614
+ function _isNativeReflectConstruct$7() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6226
6615
  var SelectAuthenticatorAuthenticate = /*#__PURE__*/function (_SelectAuthenticator) {
6227
6616
  _inherits(SelectAuthenticatorAuthenticate, _SelectAuthenticator);
6228
6617
 
6229
- var _super = _createSuper$6(SelectAuthenticatorAuthenticate);
6618
+ var _super = _createSuper$7(SelectAuthenticatorAuthenticate);
6230
6619
 
6231
6620
  function SelectAuthenticatorAuthenticate(remediation) {
6232
6621
  var _this;
@@ -6240,11 +6629,11 @@ var SelectAuthenticatorAuthenticate = /*#__PURE__*/function (_SelectAuthenticato
6240
6629
  _this = _super.call(this, remediation, values);
6241
6630
  var hasPasswordInOptions = (_a = getAuthenticatorFromRemediation(remediation).options) === null || _a === void 0 ? void 0 : _a.some(function (_ref) {
6242
6631
  var relatesTo = _ref.relatesTo;
6243
- return relatesTo.key === AuthenticatorKey.OKTA_PASSWORD;
6632
+ return (relatesTo === null || relatesTo === void 0 ? void 0 : relatesTo.key) === AuthenticatorKey.OKTA_PASSWORD;
6244
6633
  });
6245
6634
 
6246
6635
  if (hasPasswordInOptions && (_this.values.flow === 'recoverPassword' || _this.values.password)) {
6247
- _this.values.authenticators = [].concat(_toConsumableArray(_this.values.authenticators), [{
6636
+ _this.values.authenticators = [].concat(_toConsumableArray(_this.values.authenticators || []), [{
6248
6637
  key: AuthenticatorKey.OKTA_PASSWORD
6249
6638
  }]);
6250
6639
  }
@@ -6256,13 +6645,13 @@ var SelectAuthenticatorAuthenticate = /*#__PURE__*/function (_SelectAuthenticato
6256
6645
  }(SelectAuthenticator);
6257
6646
  SelectAuthenticatorAuthenticate.remediationName = 'select-authenticator-authenticate';
6258
6647
 
6259
- function _createSuper$5(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$5(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6648
+ function _createSuper$6(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$6(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6260
6649
 
6261
- function _isNativeReflectConstruct$5() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6650
+ function _isNativeReflectConstruct$6() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6262
6651
  var SelectAuthenticatorEnroll = /*#__PURE__*/function (_SelectAuthenticator) {
6263
6652
  _inherits(SelectAuthenticatorEnroll, _SelectAuthenticator);
6264
6653
 
6265
- var _super = _createSuper$5(SelectAuthenticatorEnroll);
6654
+ var _super = _createSuper$6(SelectAuthenticatorEnroll);
6266
6655
 
6267
6656
  function SelectAuthenticatorEnroll() {
6268
6657
  _classCallCheck(this, SelectAuthenticatorEnroll);
@@ -6274,13 +6663,13 @@ var SelectAuthenticatorEnroll = /*#__PURE__*/function (_SelectAuthenticator) {
6274
6663
  }(SelectAuthenticator);
6275
6664
  SelectAuthenticatorEnroll.remediationName = 'select-authenticator-enroll';
6276
6665
 
6277
- function _createSuper$4(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$4(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6666
+ function _createSuper$5(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$5(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6278
6667
 
6279
- function _isNativeReflectConstruct$4() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6668
+ function _isNativeReflectConstruct$5() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6280
6669
  var SelectEnrollProfile = /*#__PURE__*/function (_Remediator) {
6281
6670
  _inherits(SelectEnrollProfile, _Remediator);
6282
6671
 
6283
- var _super = _createSuper$4(SelectEnrollProfile);
6672
+ var _super = _createSuper$5(SelectEnrollProfile);
6284
6673
 
6285
6674
  function SelectEnrollProfile() {
6286
6675
  _classCallCheck(this, SelectEnrollProfile);
@@ -6299,13 +6688,13 @@ var SelectEnrollProfile = /*#__PURE__*/function (_Remediator) {
6299
6688
  }(Remediator);
6300
6689
  SelectEnrollProfile.remediationName = 'select-enroll-profile';
6301
6690
 
6302
- function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6691
+ function _createSuper$4(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$4(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6303
6692
 
6304
- function _isNativeReflectConstruct$3() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6693
+ function _isNativeReflectConstruct$4() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6305
6694
  var AuthenticatorData = /*#__PURE__*/function (_Remediator) {
6306
6695
  _inherits(AuthenticatorData, _Remediator);
6307
6696
 
6308
- var _super = _createSuper$3(AuthenticatorData);
6697
+ var _super = _createSuper$4(AuthenticatorData);
6309
6698
 
6310
6699
  function AuthenticatorData(remediation) {
6311
6700
  var _this;
@@ -6426,13 +6815,13 @@ var AuthenticatorData = /*#__PURE__*/function (_Remediator) {
6426
6815
  return AuthenticatorData;
6427
6816
  }(Remediator);
6428
6817
 
6429
- function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6818
+ function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6430
6819
 
6431
- function _isNativeReflectConstruct$2() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6820
+ function _isNativeReflectConstruct$3() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6432
6821
  var AuthenticatorVerificationData = /*#__PURE__*/function (_AuthenticatorData) {
6433
6822
  _inherits(AuthenticatorVerificationData, _AuthenticatorData);
6434
6823
 
6435
- var _super = _createSuper$2(AuthenticatorVerificationData);
6824
+ var _super = _createSuper$3(AuthenticatorVerificationData);
6436
6825
 
6437
6826
  function AuthenticatorVerificationData() {
6438
6827
  _classCallCheck(this, AuthenticatorVerificationData);
@@ -6486,13 +6875,13 @@ var AuthenticatorVerificationData = /*#__PURE__*/function (_AuthenticatorData) {
6486
6875
  }(AuthenticatorData);
6487
6876
  AuthenticatorVerificationData.remediationName = 'authenticator-verification-data';
6488
6877
 
6489
- function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6878
+ function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6490
6879
 
6491
- function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6880
+ function _isNativeReflectConstruct$2() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6492
6881
  var AuthenticatorEnrollmentData = /*#__PURE__*/function (_AuthenticatorData) {
6493
6882
  _inherits(AuthenticatorEnrollmentData, _AuthenticatorData);
6494
6883
 
6495
- var _super = _createSuper$1(AuthenticatorEnrollmentData);
6884
+ var _super = _createSuper$2(AuthenticatorEnrollmentData);
6496
6885
 
6497
6886
  function AuthenticatorEnrollmentData() {
6498
6887
  _classCallCheck(this, AuthenticatorEnrollmentData);
@@ -6544,13 +6933,13 @@ var AuthenticatorEnrollmentData = /*#__PURE__*/function (_AuthenticatorData) {
6544
6933
  }(AuthenticatorData);
6545
6934
  AuthenticatorEnrollmentData.remediationName = 'authenticator-enrollment-data';
6546
6935
 
6547
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6936
+ function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6548
6937
 
6549
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6938
+ function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6550
6939
  var Skip = /*#__PURE__*/function (_Remediator) {
6551
6940
  _inherits(Skip, _Remediator);
6552
6941
 
6553
- var _super = _createSuper(Skip);
6942
+ var _super = _createSuper$1(Skip);
6554
6943
 
6555
6944
  function Skip() {
6556
6945
  var _this;
@@ -6580,6 +6969,8 @@ var remediators = /*#__PURE__*/Object.freeze({
6580
6969
  Remediator: Remediator,
6581
6970
  EnrollAuthenticator: EnrollAuthenticator,
6582
6971
  EnrollPoll: EnrollPoll,
6972
+ SelectEnrollmentChannel: SelectEnrollmentChannel,
6973
+ EnrollmentChannelData: EnrollmentChannelData,
6583
6974
  ChallengeAuthenticator: ChallengeAuthenticator,
6584
6975
  ChallengePoll: ChallengePoll,
6585
6976
  ResetAuthenticator: ResetAuthenticator,
@@ -6603,6 +6994,16 @@ function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) le
6603
6994
  function getRemediator(idxRemediations, values, options) {
6604
6995
  var remediators = options.remediators;
6605
6996
  var remediator;
6997
+
6998
+ if (options.step) {
6999
+ var remediation = idxRemediations.find(function (_ref) {
7000
+ var name = _ref.name;
7001
+ return name === options.step;
7002
+ });
7003
+ var T = remediators[remediation.name];
7004
+ return new T(remediation, values);
7005
+ }
7006
+
6606
7007
  var remediatorCandidates = [];
6607
7008
 
6608
7009
  var _iterator = _createForOfIteratorHelper$1(idxRemediations),
@@ -6610,15 +7011,15 @@ function getRemediator(idxRemediations, values, options) {
6610
7011
 
6611
7012
  try {
6612
7013
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
6613
- var remediation = _step.value;
6614
- var isRemeditionInFlow = Object.keys(remediators).includes(remediation.name);
7014
+ var _remediation = _step.value;
7015
+ var isRemeditionInFlow = Object.keys(remediators).includes(_remediation.name);
6615
7016
 
6616
7017
  if (!isRemeditionInFlow) {
6617
7018
  continue;
6618
7019
  }
6619
7020
 
6620
- var T = remediators[remediation.name];
6621
- remediator = new T(remediation, values);
7021
+ var _T = remediators[_remediation.name];
7022
+ remediator = new _T(_remediation, values);
6622
7023
 
6623
7024
  if (remediator.canRemediate()) {
6624
7025
  return remediator;
@@ -6642,8 +7043,8 @@ function isTerminalResponse(idxResponse) {
6642
7043
  }
6643
7044
 
6644
7045
  function canSkipFn(idxResponse) {
6645
- return idxResponse.neededToProceed.some(function (_ref) {
6646
- var name = _ref.name;
7046
+ return idxResponse.neededToProceed.some(function (_ref2) {
7047
+ var name = _ref2.name;
6647
7048
  return name === 'skip';
6648
7049
  });
6649
7050
  }
@@ -6742,14 +7143,14 @@ function remediate(_x, _x2, _x3) {
6742
7143
 
6743
7144
  function _remediate() {
6744
7145
  _remediate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(idxResponse, values, options) {
6745
- var _idxResponse, neededToProceed, interactionCode, remediators, terminal, messages, remediator, nextStep, actionFromValues, actions, _iterator3, _step3, action, valuesWithoutExecutedAction, _nextStep, name, data;
7146
+ var _idxResponse, neededToProceed, interactionCode, remediators, flow, terminal, messages, remediator, nextStep, actionFromValues, actions, _iterator3, _step3, action, valuesWithoutExecutedAction, _nextStep, name, data;
6746
7147
 
6747
7148
  return _regeneratorRuntime.wrap(function _callee$(_context) {
6748
7149
  while (1) {
6749
7150
  switch (_context.prev = _context.next) {
6750
7151
  case 0:
6751
7152
  _idxResponse = idxResponse, neededToProceed = _idxResponse.neededToProceed, interactionCode = _idxResponse.interactionCode;
6752
- remediators = options.remediators;
7153
+ remediators = options.remediators, flow = options.flow;
6753
7154
 
6754
7155
  if (!interactionCode) {
6755
7156
  _context.next = 4;
@@ -6777,18 +7178,28 @@ function _remediate() {
6777
7178
  case 8:
6778
7179
  remediator = getRemediator(neededToProceed, values, options);
6779
7180
 
6780
- if (remediator) {
7181
+ if (!(!remediator && flow === 'default')) {
6781
7182
  _context.next = 11;
6782
7183
  break;
6783
7184
  }
6784
7185
 
7186
+ return _context.abrupt("return", {
7187
+ idxResponse: idxResponse
7188
+ });
7189
+
7190
+ case 11:
7191
+ if (remediator) {
7192
+ _context.next = 13;
7193
+ break;
7194
+ }
7195
+
6785
7196
  throw new AuthSdkError("\n No remediation can match current flow, check policy settings in your org.\n Remediations: [".concat(neededToProceed.reduce(function (acc, curr) {
6786
7197
  return acc ? acc + ' ,' + curr.name : curr.name;
6787
7198
  }, ''), "]\n "));
6788
7199
 
6789
- case 11:
7200
+ case 13:
6790
7201
  if (!messages.length) {
6791
- _context.next = 14;
7202
+ _context.next = 16;
6792
7203
  break;
6793
7204
  }
6794
7205
 
@@ -6798,23 +7209,23 @@ function _remediate() {
6798
7209
  messages: messages
6799
7210
  });
6800
7211
 
6801
- case 14:
7212
+ case 16:
6802
7213
  actionFromValues = getActionFromValues(values, idxResponse);
6803
7214
  actions = [].concat(_toConsumableArray(options.actions || []), _toConsumableArray(actionFromValues && [actionFromValues] || []));
6804
7215
 
6805
7216
  if (!actions) {
6806
- _context.next = 46;
7217
+ _context.next = 48;
6807
7218
  break;
6808
7219
  }
6809
7220
 
6810
7221
  _iterator3 = _createForOfIteratorHelper$1(actions);
6811
- _context.prev = 18;
7222
+ _context.prev = 20;
6812
7223
 
6813
7224
  _iterator3.s();
6814
7225
 
6815
- case 20:
7226
+ case 22:
6816
7227
  if ((_step3 = _iterator3.n()).done) {
6817
- _context.next = 38;
7228
+ _context.next = 40;
6818
7229
  break;
6819
7230
  }
6820
7231
 
@@ -6822,27 +7233,27 @@ function _remediate() {
6822
7233
  valuesWithoutExecutedAction = removeActionFromValues(values);
6823
7234
 
6824
7235
  if (!(typeof idxResponse.actions[action] === 'function')) {
6825
- _context.next = 36;
7236
+ _context.next = 38;
6826
7237
  break;
6827
7238
  }
6828
7239
 
6829
- _context.prev = 24;
6830
- _context.next = 27;
7240
+ _context.prev = 26;
7241
+ _context.next = 29;
6831
7242
  return idxResponse.actions[action]();
6832
7243
 
6833
- case 27:
7244
+ case 29:
6834
7245
  idxResponse = _context.sent;
6835
- _context.next = 33;
7246
+ _context.next = 35;
6836
7247
  break;
6837
7248
 
6838
- case 30:
6839
- _context.prev = 30;
6840
- _context.t0 = _context["catch"](24);
7249
+ case 32:
7250
+ _context.prev = 32;
7251
+ _context.t0 = _context["catch"](26);
6841
7252
  return _context.abrupt("return", handleIdxError(_context.t0, remediators));
6842
7253
 
6843
- case 33:
7254
+ case 35:
6844
7255
  if (!(action === 'cancel')) {
6845
- _context.next = 35;
7256
+ _context.next = 37;
6846
7257
  break;
6847
7258
  }
6848
7259
 
@@ -6850,33 +7261,33 @@ function _remediate() {
6850
7261
  canceled: true
6851
7262
  });
6852
7263
 
6853
- case 35:
7264
+ case 37:
6854
7265
  return _context.abrupt("return", remediate(idxResponse, valuesWithoutExecutedAction, options));
6855
7266
 
6856
- case 36:
6857
- _context.next = 20;
6858
- break;
6859
-
6860
7267
  case 38:
6861
- _context.next = 43;
7268
+ _context.next = 22;
6862
7269
  break;
6863
7270
 
6864
7271
  case 40:
6865
- _context.prev = 40;
6866
- _context.t1 = _context["catch"](18);
7272
+ _context.next = 45;
7273
+ break;
7274
+
7275
+ case 42:
7276
+ _context.prev = 42;
7277
+ _context.t1 = _context["catch"](20);
6867
7278
 
6868
7279
  _iterator3.e(_context.t1);
6869
7280
 
6870
- case 43:
6871
- _context.prev = 43;
7281
+ case 45:
7282
+ _context.prev = 45;
6872
7283
 
6873
7284
  _iterator3.f();
6874
7285
 
6875
- return _context.finish(43);
7286
+ return _context.finish(45);
6876
7287
 
6877
- case 46:
7288
+ case 48:
6878
7289
  if (remediator.canRemediate()) {
6879
- _context.next = 49;
7290
+ _context.next = 51;
6880
7291
  break;
6881
7292
  }
6882
7293
 
@@ -6886,33 +7297,110 @@ function _remediate() {
6886
7297
  nextStep: _nextStep
6887
7298
  });
6888
7299
 
6889
- case 49:
7300
+ case 51:
6890
7301
  name = remediator.getName();
6891
7302
  data = remediator.getData();
6892
- _context.prev = 51;
6893
- _context.next = 54;
7303
+ _context.prev = 53;
7304
+ _context.next = 56;
6894
7305
  return idxResponse.proceed(name, data);
6895
7306
 
6896
- case 54:
7307
+ case 56:
6897
7308
  idxResponse = _context.sent;
6898
7309
  values = remediator.getValuesAfterProceed();
6899
7310
  return _context.abrupt("return", remediate(idxResponse, values, options));
6900
7311
 
6901
- case 59:
6902
- _context.prev = 59;
6903
- _context.t2 = _context["catch"](51);
7312
+ case 61:
7313
+ _context.prev = 61;
7314
+ _context.t2 = _context["catch"](53);
6904
7315
  return _context.abrupt("return", handleIdxError(_context.t2, remediator));
6905
7316
 
6906
- case 62:
7317
+ case 64:
6907
7318
  case "end":
6908
7319
  return _context.stop();
6909
7320
  }
6910
7321
  }
6911
- }, _callee, null, [[18, 40, 43, 46], [24, 30], [51, 59]]);
7322
+ }, _callee, null, [[20, 42, 45, 48], [26, 32], [53, 61]]);
6912
7323
  }));
6913
7324
  return _remediate.apply(this, arguments);
6914
7325
  }
6915
7326
 
7327
+ var AuthenticationFlow = {
7328
+ 'identify': Identify,
7329
+ 'select-authenticator-authenticate': SelectAuthenticatorAuthenticate,
7330
+ 'select-authenticator-enroll': SelectAuthenticatorEnroll,
7331
+ 'authenticator-enrollment-data': AuthenticatorEnrollmentData,
7332
+ 'authenticator-verification-data': AuthenticatorVerificationData,
7333
+ 'enroll-authenticator': EnrollAuthenticator,
7334
+ 'challenge-authenticator': ChallengeAuthenticator,
7335
+ 'challenge-poll': ChallengePoll,
7336
+ 'reenroll-authenticator': ReEnrollAuthenticator,
7337
+ 'enroll-poll': EnrollPoll,
7338
+ 'redirect-idp': RedirectIdp,
7339
+ 'skip': Skip
7340
+ };
7341
+
7342
+ var PasswordRecoveryFlow = {
7343
+ 'identify': Identify,
7344
+ 'identify-recovery': Identify,
7345
+ 'select-authenticator-authenticate': SelectAuthenticatorAuthenticate,
7346
+ 'challenge-authenticator': ChallengeAuthenticator,
7347
+ 'authenticator-verification-data': AuthenticatorVerificationData,
7348
+ 'reset-authenticator': ResetAuthenticator,
7349
+ 'reenroll-authenticator': ReEnrollAuthenticator
7350
+ };
7351
+
7352
+ var RegistrationFlow = {
7353
+ 'select-enroll-profile': SelectEnrollProfile,
7354
+ 'enroll-profile': EnrollProfile,
7355
+ 'authenticator-enrollment-data': AuthenticatorEnrollmentData,
7356
+ 'select-authenticator-enroll': SelectAuthenticatorEnroll,
7357
+ 'enroll-poll': EnrollPoll,
7358
+ 'select-enrollment-channel': SelectEnrollmentChannel,
7359
+ 'enrollment-channel-data': EnrollmentChannelData,
7360
+ 'enroll-authenticator': EnrollAuthenticator,
7361
+ 'skip': Skip
7362
+ };
7363
+
7364
+ function getFlowSpecification(oktaAuth) {
7365
+ var flow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
7366
+ var remediators,
7367
+ actions,
7368
+ withCredentials = true;
7369
+
7370
+ switch (flow) {
7371
+ case 'register':
7372
+ case 'signup':
7373
+ case 'enrollProfile':
7374
+ remediators = RegistrationFlow;
7375
+ withCredentials = false;
7376
+ break;
7377
+
7378
+ case 'recoverPassword':
7379
+ case 'resetPassword':
7380
+ remediators = PasswordRecoveryFlow;
7381
+ actions = ['currentAuthenticator-recover', 'currentAuthenticatorEnrollment-recover'];
7382
+ withCredentials = false;
7383
+ break;
7384
+
7385
+ case 'authenticate':
7386
+ case 'login':
7387
+ case 'signin':
7388
+ remediators = AuthenticationFlow;
7389
+ break;
7390
+
7391
+ default:
7392
+ remediators = AuthenticationFlow;
7393
+ break;
7394
+ }
7395
+
7396
+ return {
7397
+ flow: flow,
7398
+ remediators: remediators,
7399
+ actions: actions,
7400
+ withCredentials: withCredentials
7401
+ };
7402
+ }
7403
+
6916
7404
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
6917
7405
 
6918
7406
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -6945,7 +7433,7 @@ function getEnabledFeatures(idxResponse) {
6945
7433
  return res;
6946
7434
  }
6947
7435
 
6948
- function getAvailableSteps(remediations) {
7436
+ function getAvailableSteps(idxResponse) {
6949
7437
  var res = [];
6950
7438
  var remediatorMap = Object.values(remediators).reduce(function (map, remediatorClass) {
6951
7439
  if (remediatorClass.remediationName) {
@@ -6955,7 +7443,7 @@ function getAvailableSteps(remediations) {
6955
7443
  return map;
6956
7444
  }, {});
6957
7445
 
6958
- var _iterator = _createForOfIteratorHelper(remediations),
7446
+ var _iterator = _createForOfIteratorHelper(idxResponse.neededToProceed),
6959
7447
  _step;
6960
7448
 
6961
7449
  try {
@@ -6965,7 +7453,7 @@ function getAvailableSteps(remediations) {
6965
7453
 
6966
7454
  if (T) {
6967
7455
  var remediator = new T(remediation);
6968
- res.push(remediator.getNextStep());
7456
+ res.push(remediator.getNextStep(idxResponse.context));
6969
7457
  }
6970
7458
  }
6971
7459
  } catch (err) {
@@ -6993,12 +7481,22 @@ function _run() {
6993
7481
  availableSteps,
6994
7482
  status,
6995
7483
  shouldClearTransaction,
7484
+ clearSharedStorage,
6996
7485
  idxResponse,
6997
7486
  interactionHandle,
6998
7487
  metaFromResp,
7488
+ interactionCode,
6999
7489
  flow,
7000
- stateTokenExternalId,
7001
7490
  state,
7491
+ scopes,
7492
+ version,
7493
+ _remediators,
7494
+ _actions,
7495
+ withCredentials,
7496
+ exchangeCodeForTokens,
7497
+ autoRemediate,
7498
+ step,
7499
+ flowSpec,
7002
7500
  interactResponse,
7003
7501
  values,
7004
7502
  _yield$remediate,
@@ -7013,7 +7511,13 @@ function _run() {
7013
7511
  ignoreSignature,
7014
7512
  redirectUri,
7015
7513
  urls,
7016
- scopes,
7514
+ _scopes,
7515
+ _ref3,
7516
+ actions,
7517
+ context,
7518
+ neededToProceed,
7519
+ proceed,
7520
+ rawIdxState,
7017
7521
  _args = arguments;
7018
7522
 
7019
7523
  return _regeneratorRuntime.wrap(function _callee$(_context) {
@@ -7023,11 +7527,17 @@ function _run() {
7023
7527
  options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
7024
7528
  status = IdxStatus.PENDING;
7025
7529
  shouldClearTransaction = false;
7026
- _context.prev = 3;
7027
- flow = options.flow, stateTokenExternalId = options.stateTokenExternalId, state = options.state;
7530
+ clearSharedStorage = true;
7531
+ _context.prev = 4;
7532
+ flow = options.flow, state = options.state, scopes = options.scopes, version = options.version, _remediators = options.remediators, _actions = options.actions, withCredentials = options.withCredentials, exchangeCodeForTokens = options.exchangeCodeForTokens, autoRemediate = options.autoRemediate, step = options.step;
7533
+ flow = flow || authClient.idx.getFlow() || 'default';
7028
7534
 
7029
7535
  if (flow) {
7030
7536
  authClient.idx.setFlow(flow);
7537
+ flowSpec = getFlowSpecification(authClient, flow);
7538
+ withCredentials = typeof withCredentials !== 'undefined' ? withCredentials : flowSpec.withCredentials;
7539
+ _remediators = _remediators || flowSpec.remediators;
7540
+ _actions = _actions || flowSpec.actions;
7031
7541
  }
7032
7542
 
7033
7543
  metaFromResp = getSavedTransactionMeta(authClient, {
@@ -7035,117 +7545,153 @@ function _run() {
7035
7545
  });
7036
7546
  interactionHandle = metaFromResp === null || metaFromResp === void 0 ? void 0 : metaFromResp.interactionHandle;
7037
7547
 
7038
- if (!(!interactionHandle && !stateTokenExternalId)) {
7039
- _context.next = 15;
7548
+ if (interactionHandle) {
7549
+ _context.next = 18;
7040
7550
  break;
7041
7551
  }
7042
7552
 
7043
7553
  authClient.transactionManager.clear();
7044
- _context.next = 12;
7045
- return interact(authClient, options);
7554
+ _context.next = 14;
7555
+ return interact(authClient, {
7556
+ withCredentials: withCredentials,
7557
+ state: state,
7558
+ scopes: scopes
7559
+ });
7046
7560
 
7047
- case 12:
7561
+ case 14:
7048
7562
  interactResponse = _context.sent;
7049
7563
  interactionHandle = interactResponse.interactionHandle;
7050
7564
  metaFromResp = interactResponse.meta;
7565
+ withCredentials = metaFromResp.withCredentials;
7051
7566
 
7052
- case 15:
7053
- _context.next = 17;
7567
+ case 18:
7568
+ _context.next = 20;
7054
7569
  return introspect(authClient, {
7055
- interactionHandle: interactionHandle,
7056
- stateTokenExternalId: stateTokenExternalId
7570
+ withCredentials: withCredentials,
7571
+ version: version,
7572
+ interactionHandle: interactionHandle
7057
7573
  });
7058
7574
 
7059
- case 17:
7575
+ case 20:
7060
7576
  idxResponse = _context.sent;
7577
+ enabledFeatures = getEnabledFeatures(idxResponse);
7578
+ availableSteps = getAvailableSteps(idxResponse);
7579
+ meta = metaFromResp;
7061
7580
 
7062
- if (!(!options.remediators && !options.actions)) {
7063
- _context.next = 24;
7581
+ if (!(autoRemediate !== false && (_remediators || _actions))) {
7582
+ _context.next = 57;
7064
7583
  break;
7065
7584
  }
7066
7585
 
7067
- meta = metaFromResp;
7068
- enabledFeatures = getEnabledFeatures(idxResponse);
7069
- availableSteps = getAvailableSteps(idxResponse.neededToProceed);
7070
- _context.next = 49;
7071
- break;
7072
-
7073
- case 24:
7074
7586
  values = Object.assign(Object.assign({}, options), {
7075
7587
  stateHandle: idxResponse.rawIdxState.stateHandle
7076
7588
  });
7077
- _context.next = 27;
7078
- return remediate(idxResponse, values, options);
7589
+ _context.next = 28;
7590
+ return remediate(idxResponse, values, {
7591
+ remediators: _remediators,
7592
+ actions: _actions,
7593
+ flow: flow,
7594
+ step: step
7595
+ });
7079
7596
 
7080
- case 27:
7597
+ case 28:
7081
7598
  _yield$remediate = _context.sent;
7082
7599
  idxResponseFromResp = _yield$remediate.idxResponse;
7083
7600
  nextStepFromResp = _yield$remediate.nextStep;
7084
7601
  terminal = _yield$remediate.terminal;
7085
7602
  canceled = _yield$remediate.canceled;
7086
7603
  messagesFromResp = _yield$remediate.messages;
7604
+ idxResponse = idxResponseFromResp || idxResponse;
7087
7605
  nextStep = nextStepFromResp;
7088
7606
  messages = messagesFromResp;
7089
7607
 
7090
- if (nextStep && idxResponseFromResp) {
7091
- authClient.transactionManager.saveIdxResponse(idxResponseFromResp.rawIdxState);
7608
+ if (nextStep) {
7609
+ authClient.transactionManager.saveIdxResponse(idxResponse.rawIdxState);
7610
+ availableSteps = getAvailableSteps(idxResponse);
7092
7611
  }
7093
7612
 
7094
7613
  if (terminal) {
7095
7614
  status = IdxStatus.TERMINAL;
7096
7615
  shouldClearTransaction = true;
7616
+ clearSharedStorage = false;
7097
7617
  }
7098
7618
 
7099
7619
  if (!canceled) {
7100
- _context.next = 42;
7620
+ _context.next = 44;
7101
7621
  break;
7102
7622
  }
7103
7623
 
7104
7624
  status = IdxStatus.CANCELED;
7105
7625
  shouldClearTransaction = true;
7106
- _context.next = 49;
7626
+ _context.next = 57;
7107
7627
  break;
7108
7628
 
7109
- case 42:
7110
- if (!(idxResponseFromResp === null || idxResponseFromResp === void 0 ? void 0 : idxResponseFromResp.interactionCode)) {
7111
- _context.next = 49;
7629
+ case 44:
7630
+ if (!(idxResponse === null || idxResponse === void 0 ? void 0 : idxResponse.interactionCode)) {
7631
+ _context.next = 57;
7632
+ break;
7633
+ }
7634
+
7635
+ interactionCode = idxResponse.interactionCode;
7636
+
7637
+ if (!(exchangeCodeForTokens === false)) {
7638
+ _context.next = 51;
7112
7639
  break;
7113
7640
  }
7114
7641
 
7115
- _metaFromResp = metaFromResp, clientId = _metaFromResp.clientId, codeVerifier = _metaFromResp.codeVerifier, ignoreSignature = _metaFromResp.ignoreSignature, redirectUri = _metaFromResp.redirectUri, urls = _metaFromResp.urls, scopes = _metaFromResp.scopes;
7116
- _context.next = 46;
7642
+ status = IdxStatus.SUCCESS;
7643
+ shouldClearTransaction = false;
7644
+ _context.next = 57;
7645
+ break;
7646
+
7647
+ case 51:
7648
+ _metaFromResp = metaFromResp, clientId = _metaFromResp.clientId, codeVerifier = _metaFromResp.codeVerifier, ignoreSignature = _metaFromResp.ignoreSignature, redirectUri = _metaFromResp.redirectUri, urls = _metaFromResp.urls, _scopes = _metaFromResp.scopes;
7649
+ _context.next = 54;
7117
7650
  return authClient.token.exchangeCodeForTokens({
7118
- interactionCode: idxResponseFromResp.interactionCode,
7651
+ interactionCode: interactionCode,
7119
7652
  clientId: clientId,
7120
7653
  codeVerifier: codeVerifier,
7121
7654
  ignoreSignature: ignoreSignature,
7122
7655
  redirectUri: redirectUri,
7123
- scopes: scopes
7656
+ scopes: _scopes
7124
7657
  }, urls);
7125
7658
 
7126
- case 46:
7659
+ case 54:
7127
7660
  tokens = _context.sent;
7128
7661
  status = IdxStatus.SUCCESS;
7129
7662
  shouldClearTransaction = true;
7130
7663
 
7131
- case 49:
7132
- _context.next = 56;
7664
+ case 57:
7665
+ _context.next = 68;
7133
7666
  break;
7134
7667
 
7135
- case 51:
7136
- _context.prev = 51;
7137
- _context.t0 = _context["catch"](3);
7668
+ case 59:
7669
+ _context.prev = 59;
7670
+ _context.t0 = _context["catch"](4);
7671
+
7672
+ if (!isIdxResponse(_context.t0)) {
7673
+ _context.next = 67;
7674
+ break;
7675
+ }
7676
+
7138
7677
  error = _context.t0;
7139
7678
  status = IdxStatus.FAILURE;
7140
7679
  shouldClearTransaction = true;
7680
+ _context.next = 68;
7681
+ break;
7141
7682
 
7142
- case 56:
7683
+ case 67:
7684
+ throw _context.t0;
7685
+
7686
+ case 68:
7143
7687
  if (shouldClearTransaction) {
7144
- authClient.transactionManager.clear();
7688
+ authClient.transactionManager.clear({
7689
+ clearSharedStorage: clearSharedStorage
7690
+ });
7145
7691
  }
7146
7692
 
7147
- return _context.abrupt("return", Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
7148
- _idxResponse: idxResponse,
7693
+ _ref3 = idxResponse || {}, actions = _ref3.actions, context = _ref3.context, neededToProceed = _ref3.neededToProceed, proceed = _ref3.proceed, rawIdxState = _ref3.rawIdxState;
7694
+ return _context.abrupt("return", Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
7149
7695
  status: status
7150
7696
  }, meta && {
7151
7697
  meta: meta
@@ -7161,97 +7707,48 @@ function _run() {
7161
7707
  messages: messages
7162
7708
  }), error && {
7163
7709
  error: error
7710
+ }), {
7711
+ interactionCode: interactionCode,
7712
+ actions: actions,
7713
+ context: context,
7714
+ neededToProceed: neededToProceed,
7715
+ proceed: proceed,
7716
+ rawIdxState: rawIdxState
7164
7717
  }));
7165
7718
 
7166
- case 58:
7719
+ case 71:
7167
7720
  case "end":
7168
7721
  return _context.stop();
7169
7722
  }
7170
7723
  }
7171
- }, _callee, null, [[3, 51]]);
7724
+ }, _callee, null, [[4, 59]]);
7172
7725
  }));
7173
7726
  return _run.apply(this, arguments);
7174
7727
  }
7175
7728
 
7176
- var AuthenticationFlow = {
7177
- 'identify': Identify,
7178
- 'select-authenticator-authenticate': SelectAuthenticatorAuthenticate,
7179
- 'select-authenticator-enroll': SelectAuthenticatorEnroll,
7180
- 'authenticator-enrollment-data': AuthenticatorEnrollmentData,
7181
- 'authenticator-verification-data': AuthenticatorVerificationData,
7182
- 'enroll-authenticator': EnrollAuthenticator,
7183
- 'challenge-authenticator': ChallengeAuthenticator,
7184
- 'challenge-poll': ChallengePoll,
7185
- 'reenroll-authenticator': ReEnrollAuthenticator,
7186
- 'enroll-poll': EnrollPoll,
7187
- 'redirect-idp': RedirectIdp,
7188
- 'skip': Skip
7189
- };
7190
-
7191
- var PasswordRecoveryFlow = {
7192
- 'identify': Identify,
7193
- 'identify-recovery': Identify,
7194
- 'select-authenticator-authenticate': SelectAuthenticatorAuthenticate,
7195
- 'challenge-authenticator': ChallengeAuthenticator,
7196
- 'authenticator-verification-data': AuthenticatorVerificationData,
7197
- 'reset-authenticator': ResetAuthenticator,
7198
- 'reenroll-authenticator': ReEnrollAuthenticator
7199
- };
7200
-
7201
- var RegistrationFlow = {
7202
- 'select-enroll-profile': SelectEnrollProfile,
7203
- 'enroll-profile': EnrollProfile,
7204
- 'authenticator-enrollment-data': AuthenticatorEnrollmentData,
7205
- 'select-authenticator-enroll': SelectAuthenticatorEnroll,
7206
- 'enroll-poll': EnrollPoll,
7207
- 'enroll-authenticator': EnrollAuthenticator,
7208
- 'skip': Skip
7209
- };
7210
-
7211
- function getFlowSpecification(oktaAuth) {
7212
- var flow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'proceed';
7213
- var remediators, actions;
7214
-
7215
- switch (flow) {
7216
- case 'register':
7217
- case 'signup':
7218
- case 'enrollProfile':
7219
- remediators = RegistrationFlow;
7220
- break;
7221
-
7222
- case 'recoverPassword':
7223
- case 'resetPassword':
7224
- remediators = PasswordRecoveryFlow;
7225
- actions = ['currentAuthenticator-recover', 'currentAuthenticatorEnrollment-recover'];
7226
- break;
7227
-
7228
- default:
7229
- remediators = AuthenticationFlow;
7230
- break;
7231
- }
7232
-
7233
- return {
7234
- flow: flow,
7235
- remediators: remediators,
7236
- actions: actions
7237
- };
7238
- }
7239
-
7240
- function authenticate(_x, _x2) {
7729
+ function authenticate(_x) {
7241
7730
  return _authenticate.apply(this, arguments);
7242
7731
  }
7243
7732
 
7244
7733
  function _authenticate() {
7245
- _authenticate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(authClient, options) {
7246
- var flowSpec;
7734
+ _authenticate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(authClient) {
7735
+ var options,
7736
+ _args = arguments;
7247
7737
  return _regeneratorRuntime.wrap(function _callee$(_context) {
7248
7738
  while (1) {
7249
7739
  switch (_context.prev = _context.next) {
7250
7740
  case 0:
7251
- flowSpec = getFlowSpecification(authClient, 'authenticate');
7252
- return _context.abrupt("return", run(authClient, Object.assign(Object.assign({}, options), flowSpec)));
7741
+ options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
7253
7742
 
7254
- case 2:
7743
+ if (options.password && !options.authenticator) {
7744
+ options.authenticator = AuthenticatorKey.OKTA_PASSWORD;
7745
+ }
7746
+
7747
+ return _context.abrupt("return", run(authClient, Object.assign(Object.assign({}, options), {
7748
+ flow: 'authenticate'
7749
+ })));
7750
+
7751
+ case 3:
7255
7752
  case "end":
7256
7753
  return _context.stop();
7257
7754
  }
@@ -7288,6 +7785,85 @@ function _cancel() {
7288
7785
  return _cancel.apply(this, arguments);
7289
7786
  }
7290
7787
 
7788
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
7789
+
7790
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
7791
+ var EmailVerifyCallbackError = /*#__PURE__*/function (_CustomError) {
7792
+ _inherits(EmailVerifyCallbackError, _CustomError);
7793
+
7794
+ var _super = _createSuper(EmailVerifyCallbackError);
7795
+
7796
+ function EmailVerifyCallbackError(state, otp) {
7797
+ var _this;
7798
+
7799
+ _classCallCheck(this, EmailVerifyCallbackError);
7800
+
7801
+ _this = _super.call(this, "Enter the OTP code in the originating client: ".concat(otp));
7802
+ _this.name = 'EmailVerifyCallbackError';
7803
+ _this.state = state;
7804
+ _this.otp = otp;
7805
+ return _this;
7806
+ }
7807
+
7808
+ return EmailVerifyCallbackError;
7809
+ }(CustomError);
7810
+ function isEmailVerifyCallbackError(error) {
7811
+ return error.name === 'EmailVerifyCallbackError';
7812
+ }
7813
+ function isEmailVerifyCallback(urlPath) {
7814
+ return /(otp=)/i.test(urlPath) && /(state=)/i.test(urlPath);
7815
+ }
7816
+ function parseEmailVerifyCallback(urlPath) {
7817
+ return urlParamsToObject(urlPath);
7818
+ }
7819
+ function handleEmailVerifyCallback(_x, _x2) {
7820
+ return _handleEmailVerifyCallback.apply(this, arguments);
7821
+ }
7822
+
7823
+ function _handleEmailVerifyCallback() {
7824
+ _handleEmailVerifyCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(authClient, search) {
7825
+ var _parseEmailVerifyCall, state, otp;
7826
+
7827
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
7828
+ while (1) {
7829
+ switch (_context.prev = _context.next) {
7830
+ case 0:
7831
+ if (!isEmailVerifyCallback(search)) {
7832
+ _context.next = 9;
7833
+ break;
7834
+ }
7835
+
7836
+ _parseEmailVerifyCall = parseEmailVerifyCallback(search), state = _parseEmailVerifyCall.state, otp = _parseEmailVerifyCall.otp;
7837
+
7838
+ if (!authClient.idx.canProceed({
7839
+ state: state
7840
+ })) {
7841
+ _context.next = 8;
7842
+ break;
7843
+ }
7844
+
7845
+ _context.next = 5;
7846
+ return authClient.idx.proceed({
7847
+ state: state,
7848
+ otp: otp
7849
+ });
7850
+
7851
+ case 5:
7852
+ return _context.abrupt("return", _context.sent);
7853
+
7854
+ case 8:
7855
+ throw new EmailVerifyCallbackError(state, otp);
7856
+
7857
+ case 9:
7858
+ case "end":
7859
+ return _context.stop();
7860
+ }
7861
+ }
7862
+ }, _callee);
7863
+ }));
7864
+ return _handleEmailVerifyCallback.apply(this, arguments);
7865
+ }
7866
+
7291
7867
  function canProceed(authClient, options) {
7292
7868
  var meta = getSavedTransactionMeta(authClient, options);
7293
7869
  return !!meta;
@@ -7299,22 +7875,21 @@ function proceed(_x) {
7299
7875
  function _proceed() {
7300
7876
  _proceed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(authClient) {
7301
7877
  var options,
7302
- stateTokenExternalId,
7303
7878
  state,
7304
7879
  meta,
7305
- flowSpec,
7880
+ flow,
7306
7881
  _args = arguments;
7307
7882
  return _regeneratorRuntime.wrap(function _callee$(_context) {
7308
7883
  while (1) {
7309
7884
  switch (_context.prev = _context.next) {
7310
7885
  case 0:
7311
7886
  options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
7312
- stateTokenExternalId = options.stateTokenExternalId, state = options.state;
7887
+ state = options.state;
7313
7888
  meta = getSavedTransactionMeta(authClient, {
7314
7889
  state: state
7315
7890
  });
7316
7891
 
7317
- if (!(!meta && !stateTokenExternalId)) {
7892
+ if (meta) {
7318
7893
  _context.next = 5;
7319
7894
  break;
7320
7895
  }
@@ -7322,8 +7897,10 @@ function _proceed() {
7322
7897
  throw new AuthSdkError('Unable to proceed: saved transaction could not be loaded');
7323
7898
 
7324
7899
  case 5:
7325
- flowSpec = getFlowSpecification(authClient, meta === null || meta === void 0 ? void 0 : meta.flow);
7326
- return _context.abrupt("return", run(authClient, Object.assign(Object.assign({}, options), flowSpec)));
7900
+ flow = meta === null || meta === void 0 ? void 0 : meta.flow;
7901
+ return _context.abrupt("return", run(authClient, Object.assign(Object.assign({}, options), {
7902
+ flow: flow
7903
+ })));
7327
7904
 
7328
7905
  case 7:
7329
7906
  case "end":
@@ -7432,7 +8009,9 @@ function _startTransaction() {
7432
8009
  case 0:
7433
8010
  options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
7434
8011
  authClient.transactionManager.clear();
7435
- return _context.abrupt("return", run(authClient, options));
8012
+ return _context.abrupt("return", run(authClient, Object.assign({
8013
+ exchangeCodeForTokens: false
8014
+ }, options)));
7436
8015
 
7437
8016
  case 3:
7438
8017
  case "end":
@@ -7456,7 +8035,6 @@ function _register() {
7456
8035
  availableSteps,
7457
8036
  error,
7458
8037
  _error,
7459
- flowSpec,
7460
8038
  _args = arguments;
7461
8039
 
7462
8040
  return _regeneratorRuntime.wrap(function _callee$(_context) {
@@ -7465,15 +8043,16 @@ function _register() {
7465
8043
  case 0:
7466
8044
  options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
7467
8045
 
7468
- if (transactionMetaExist(authClient)) {
8046
+ if (hasSavedInteractionHandle(authClient)) {
7469
8047
  _context.next = 13;
7470
8048
  break;
7471
8049
  }
7472
8050
 
7473
8051
  _context.next = 4;
7474
- return startTransaction(authClient, Object.assign({
7475
- flow: 'register'
7476
- }, options));
8052
+ return startTransaction(authClient, Object.assign(Object.assign({}, options), {
8053
+ flow: 'register',
8054
+ autoRemediate: false
8055
+ }));
7477
8056
 
7478
8057
  case 4:
7479
8058
  _yield$startTransacti = _context.sent;
@@ -7486,10 +8065,7 @@ function _register() {
7486
8065
  }
7487
8066
 
7488
8067
  error = new AuthSdkError('Registration is not supported based on your current org configuration.');
7489
- return _context.abrupt("return", {
7490
- status: IdxStatus.FAILURE,
7491
- error: error
7492
- });
8068
+ throw error;
7493
8069
 
7494
8070
  case 10:
7495
8071
  if (!(options.activationToken && (availableSteps === null || availableSteps === void 0 ? void 0 : availableSteps.some(function (_ref) {
@@ -7501,16 +8077,14 @@ function _register() {
7501
8077
  }
7502
8078
 
7503
8079
  _error = new AuthSdkError('activationToken is not supported based on your current org configuration.');
7504
- return _context.abrupt("return", {
7505
- status: IdxStatus.FAILURE,
7506
- error: _error
7507
- });
8080
+ throw _error;
7508
8081
 
7509
8082
  case 13:
7510
- flowSpec = getFlowSpecification(authClient, 'register');
7511
- return _context.abrupt("return", run(authClient, Object.assign(Object.assign({}, options), flowSpec)));
8083
+ return _context.abrupt("return", run(authClient, Object.assign(Object.assign({}, options), {
8084
+ flow: 'register'
8085
+ })));
7512
8086
 
7513
- case 15:
8087
+ case 14:
7514
8088
  case "end":
7515
8089
  return _context.stop();
7516
8090
  }
@@ -7520,21 +8094,24 @@ function _register() {
7520
8094
  return _register.apply(this, arguments);
7521
8095
  }
7522
8096
 
7523
- function recoverPassword(_x, _x2) {
8097
+ function recoverPassword(_x) {
7524
8098
  return _recoverPassword.apply(this, arguments);
7525
8099
  }
7526
8100
 
7527
8101
  function _recoverPassword() {
7528
- _recoverPassword = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(authClient, options) {
7529
- var flowSpec;
8102
+ _recoverPassword = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(authClient) {
8103
+ var options,
8104
+ flowSpec,
8105
+ _args = arguments;
7530
8106
  return _regeneratorRuntime.wrap(function _callee$(_context) {
7531
8107
  while (1) {
7532
8108
  switch (_context.prev = _context.next) {
7533
8109
  case 0:
8110
+ options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
7534
8111
  flowSpec = getFlowSpecification(authClient, 'recoverPassword');
7535
8112
  return _context.abrupt("return", run(authClient, Object.assign(Object.assign({}, options), flowSpec)));
7536
8113
 
7537
- case 2:
8114
+ case 3:
7538
8115
  case "end":
7539
8116
  return _context.stop();
7540
8117
  }
@@ -7635,7 +8212,7 @@ var OktaUserAgent = /*#__PURE__*/function () {
7635
8212
  function OktaUserAgent() {
7636
8213
  _classCallCheck(this, OktaUserAgent);
7637
8214
 
7638
- this.environments = ["okta-auth-js/".concat("5.11.0")];
8215
+ this.environments = ["okta-auth-js/".concat("6.0.0")];
7639
8216
  }
7640
8217
 
7641
8218
  _createClass(OktaUserAgent, [{
@@ -7654,7 +8231,7 @@ var OktaUserAgent = /*#__PURE__*/function () {
7654
8231
  }, {
7655
8232
  key: "getVersion",
7656
8233
  value: function getVersion() {
7657
- return "5.11.0";
8234
+ return "6.0.0";
7658
8235
  }
7659
8236
  }, {
7660
8237
  key: "maybeAddNodeEnvironment",
@@ -7694,7 +8271,7 @@ var OktaAuth = /*#__PURE__*/function () {
7694
8271
  return storage.get(name);
7695
8272
  }
7696
8273
  }),
7697
- introspect: introspect$1.bind(null, this)
8274
+ introspect: introspectAuthn.bind(null, this)
7698
8275
  };
7699
8276
  this.pkce = {
7700
8277
  DEFAULT_CODE_CHALLENGE_METHOD: PKCE.DEFAULT_CODE_CHALLENGE_METHOD,
@@ -7713,9 +8290,6 @@ var OktaAuth = /*#__PURE__*/function () {
7713
8290
  this.options = Object.assign(this.options, {
7714
8291
  redirectUri: toAbsoluteUrl(args.redirectUri, window.location.origin)
7715
8292
  });
7716
- this.userAgent = getUserAgent(args, "okta-auth-js/".concat("5.11.0"));
7717
- } else {
7718
- this.userAgent = getUserAgent(args, "okta-auth-js-server/".concat("5.11.0"));
7719
8293
  }
7720
8294
 
7721
8295
  if (!args.maxClockSkew && args.maxClockSkew !== 0) {
@@ -7733,13 +8307,36 @@ var OktaAuth = /*#__PURE__*/function () {
7733
8307
  setCookieAndRedirect: setCookieAndRedirect.bind(null, this)
7734
8308
  };
7735
8309
  this._tokenQueue = new PromiseQueue();
8310
+
8311
+ var useQueue = function useQueue(method) {
8312
+ return PromiseQueue.prototype.push.bind(_this._tokenQueue, method, null);
8313
+ };
8314
+
8315
+ var getWithRedirectFn = useQueue(getWithRedirect.bind(null, this));
8316
+ var getWithRedirectApi = Object.assign(getWithRedirectFn, {
8317
+ _setLocation: function _setLocation(url) {
8318
+ window.location = url;
8319
+ }
8320
+ });
8321
+ var parseFromUrlFn = useQueue(parseFromUrl.bind(null, this));
8322
+ var parseFromUrlApi = Object.assign(parseFromUrlFn, {
8323
+ _getHistory: function _getHistory() {
8324
+ return window.history;
8325
+ },
8326
+ _getLocation: function _getLocation() {
8327
+ return window.location;
8328
+ },
8329
+ _getDocument: function _getDocument() {
8330
+ return window.document;
8331
+ }
8332
+ });
7736
8333
  this.token = {
7737
8334
  prepareTokenParams: prepareTokenParams.bind(null, this),
7738
8335
  exchangeCodeForTokens: exchangeCodeForTokens.bind(null, this),
7739
8336
  getWithoutPrompt: getWithoutPrompt.bind(null, this),
7740
8337
  getWithPopup: getWithPopup.bind(null, this),
7741
- getWithRedirect: getWithRedirect.bind(null, this),
7742
- parseFromUrl: parseFromUrl.bind(null, this),
8338
+ getWithRedirect: getWithRedirectApi,
8339
+ parseFromUrl: parseFromUrlApi,
7743
8340
  decode: decodeToken,
7744
8341
  revoke: revokeToken.bind(null, this),
7745
8342
  renew: renewToken.bind(null, this),
@@ -7749,7 +8346,7 @@ var OktaAuth = /*#__PURE__*/function () {
7749
8346
  verify: verifyToken.bind(null, this),
7750
8347
  isLoginRedirect: isLoginRedirect.bind(null, this)
7751
8348
  };
7752
- var syncMethods = ['decode', 'isLoginRedirect'];
8349
+ var syncMethods = ['decode', 'isLoginRedirect', 'getWithRedirect', 'parseFromUrl'];
7753
8350
  Object.keys(this.token).forEach(function (key) {
7754
8351
  if (syncMethods.indexOf(key) >= 0) {
7755
8352
  return;
@@ -7758,33 +8355,31 @@ var OktaAuth = /*#__PURE__*/function () {
7758
8355
  var method = _this.token[key];
7759
8356
  _this.token[key] = PromiseQueue.prototype.push.bind(_this._tokenQueue, method, null);
7760
8357
  });
7761
- Object.assign(this.token.getWithRedirect, {
7762
- _setLocation: function _setLocation(url) {
7763
- window.location = url;
7764
- }
7765
- });
7766
- Object.assign(this.token.parseFromUrl, {
7767
- _getHistory: function _getHistory() {
7768
- return window.history;
7769
- },
7770
- _getLocation: function _getLocation() {
7771
- return window.location;
7772
- },
7773
- _getDocument: function _getDocument() {
7774
- return window.document;
7775
- }
7776
- });
8358
+ var boundStartTransaction = startTransaction.bind(null, this);
7777
8359
  this.idx = {
7778
8360
  interact: interact.bind(null, this),
7779
8361
  introspect: introspect.bind(null, this),
7780
8362
  authenticate: authenticate.bind(null, this),
7781
8363
  register: register.bind(null, this),
8364
+ start: boundStartTransaction,
8365
+ startTransaction: boundStartTransaction,
7782
8366
  poll: poll.bind(null, this),
7783
8367
  proceed: proceed.bind(null, this),
7784
8368
  cancel: cancel.bind(null, this),
7785
8369
  recoverPassword: recoverPassword.bind(null, this),
7786
8370
  handleInteractionCodeRedirect: handleInteractionCodeRedirect.bind(null, this),
7787
- startTransaction: startTransaction.bind(null, this),
8371
+ isInteractionRequired: isInteractionRequired.bind(null, this),
8372
+ isInteractionRequiredError: isInteractionRequiredError,
8373
+ handleEmailVerifyCallback: handleEmailVerifyCallback.bind(null, this),
8374
+ isEmailVerifyCallback: isEmailVerifyCallback,
8375
+ parseEmailVerifyCallback: parseEmailVerifyCallback,
8376
+ isEmailVerifyCallbackError: isEmailVerifyCallbackError,
8377
+ getSavedTransactionMeta: getSavedTransactionMeta.bind(null, this),
8378
+ createTransactionMeta: createTransactionMeta.bind(null, this),
8379
+ getTransactionMeta: getTransactionMeta.bind(null, this),
8380
+ saveTransactionMeta: saveTransactionMeta.bind(null, this),
8381
+ clearTransactionMeta: clearTransactionMeta.bind(null, this),
8382
+ isTransactionMetaValid: isTransactionMetaValid,
7788
8383
  setFlow: function setFlow(flow) {
7789
8384
  _this.options.flow = flow;
7790
8385
  },
@@ -7822,26 +8417,6 @@ var OktaAuth = /*#__PURE__*/function () {
7822
8417
  value: function setHeaders(headers) {
7823
8418
  this.options.headers = Object.assign({}, this.options.headers, headers);
7824
8419
  }
7825
- }, {
7826
- key: "isInteractionRequired",
7827
- value: function isInteractionRequired$1(hashOrSearch) {
7828
- return isInteractionRequired(this, hashOrSearch);
7829
- }
7830
- }, {
7831
- key: "isInteractionRequiredError",
7832
- value: function isInteractionRequiredError$1(error) {
7833
- return isInteractionRequiredError(error);
7834
- }
7835
- }, {
7836
- key: "isEmailVerifyCallback",
7837
- value: function isEmailVerifyCallback$1(urlPath) {
7838
- return isEmailVerifyCallback(urlPath);
7839
- }
7840
- }, {
7841
- key: "parseEmailVerifyCallback",
7842
- value: function parseEmailVerifyCallback$1(urlPath) {
7843
- return parseEmailVerifyCallback(urlPath);
7844
- }
7845
8420
  }, {
7846
8421
  key: "signIn",
7847
8422
  value: function () {
@@ -8191,10 +8766,10 @@ var OktaAuth = /*#__PURE__*/function () {
8191
8766
  }));
8192
8767
 
8193
8768
  case 22:
8194
- if (options.clearTokensAfterRedirect) {
8195
- this.tokenManager.addPendingRemoveFlags();
8196
- } else {
8769
+ if (options.clearTokensBeforeRedirect) {
8197
8770
  this.tokenManager.clear();
8771
+ } else {
8772
+ this.tokenManager.addPendingRemoveFlags();
8198
8773
  }
8199
8774
 
8200
8775
  window.location.assign(logoutUri);
@@ -8242,7 +8817,7 @@ var OktaAuth = /*#__PURE__*/function () {
8242
8817
  break;
8243
8818
  }
8244
8819
 
8245
- accessToken = null;
8820
+ accessToken = undefined;
8246
8821
 
8247
8822
  if (!autoRenew) {
8248
8823
  _context8.next = 15;
@@ -8277,7 +8852,7 @@ var OktaAuth = /*#__PURE__*/function () {
8277
8852
  break;
8278
8853
  }
8279
8854
 
8280
- idToken = null;
8855
+ idToken = undefined;
8281
8856
 
8282
8857
  if (!autoRenew) {
8283
8858
  _context8.next = 29;
@@ -8433,7 +9008,7 @@ var OktaAuth = /*#__PURE__*/function () {
8433
9008
  }
8434
9009
 
8435
9010
  var storage = storageUtil.getSessionStorage();
8436
- return storage ? storage.getItem(REFERRER_PATH_STORAGE_KEY) : undefined;
9011
+ return storage ? storage.getItem(REFERRER_PATH_STORAGE_KEY) || undefined : undefined;
8437
9012
  }
8438
9013
  }, {
8439
9014
  key: "removeOriginalUri",
@@ -8444,7 +9019,7 @@ var OktaAuth = /*#__PURE__*/function () {
8444
9019
 
8445
9020
  if (state) {
8446
9021
  var sharedStorage = this.storageManager.getOriginalUriStorage();
8447
- sharedStorage.removeItem(state);
9022
+ sharedStorage.removeItem && sharedStorage.removeItem(state);
8448
9023
  }
8449
9024
  }
8450
9025
  }, {
@@ -8517,7 +9092,9 @@ var OktaAuth = /*#__PURE__*/function () {
8517
9092
  break;
8518
9093
 
8519
9094
  case 26:
8520
- window.location.replace(originalUri);
9095
+ if (originalUri) {
9096
+ window.location.replace(originalUri);
9097
+ }
8521
9098
 
8522
9099
  case 27:
8523
9100
  case "end":
@@ -8583,9 +9160,8 @@ var OktaAuth = /*#__PURE__*/function () {
8583
9160
 
8584
9161
  OktaAuth.features = OktaAuth.prototype.features = features;
8585
9162
  Object.assign(OktaAuth, {
8586
- constants: constants,
8587
- isInteractionRequiredError: isInteractionRequiredError
9163
+ constants: constants
8588
9164
  });
8589
9165
 
8590
- export { ACCESS_TOKEN_STORAGE_KEY, AuthApiError, AuthPollStopError, AuthSdkError, AuthStateManager, AuthTransaction, AuthenticatorKey, CACHE_STORAGE_NAME, DEFAULT_CACHE_DURATION, DEFAULT_CODE_CHALLENGE_METHOD, DEFAULT_MAX_CLOCK_SKEW, DEFAULT_POLLING_DELAY, EVENT_ADDED, EVENT_ERROR, EVENT_EXPIRED, EVENT_REMOVED, EVENT_RENEWED, IDX_API_VERSION, IDX_RESPONSE_STORAGE_NAME, ID_TOKEN_STORAGE_KEY, INITIAL_AUTH_STATE, IdxFeature, IdxStatus, MAX_VERIFIER_LENGTH, MIN_VERIFIER_LENGTH, OAuthError, ORIGINAL_URI_STORAGE_NAME, OktaAuth, PKCE_STORAGE_NAME, REDIRECT_NONCE_COOKIE_NAME, REDIRECT_OAUTH_PARAMS_NAME, REDIRECT_STATE_COOKIE_NAME, REFERRER_PATH_STORAGE_KEY, REFRESH_TOKEN_STORAGE_KEY, SHARED_TRANSACTION_STORAGE_NAME, STATE_TOKEN_KEY_NAME, TOKEN_STORAGE_NAME, TRANSACTION_STORAGE_NAME, TokenManager, TransactionState, addListener, addPostMessageListener, addStateToken, bind, buildAuthorizeParams, clone, convertTokenParamsToOAuthParams, index as crypto, decodeToken, delay, deprecate, deprecateWrap, exchangeCodeForTokens, extend, find, genRandomString, generateNonce, generateState, getConsole, getDefaultTokenParams, getHashOrSearch, getKey, getLink, getNativeConsole, getOAuthBaseUrl, getOAuthDomain, getOAuthUrls, getPollFn, getStateToken, getToken, getUserInfo, getWellKnown, getWithPopup, getWithRedirect, getWithoutPrompt, handleOAuthResponse, hasAuthorizationCode, hasErrorInUrl, hasInteractionCode, hasTokensInHash, introspect$1 as introspect, isAbsoluteUrl, isAccessToken, isAuthApiError, isAuthorizationCodeError, isCodeFlow, isCustomAuthTransactionMeta, isEmailVerifyCallback, isFunction, isIDToken, isIdxTransactionMeta, isInteractionRequired, isInteractionRequiredError, isLoginRedirect, isNumber, isOAuthTransactionMeta, isObject, isPKCETransactionMeta, isPromise, isRedirectUri, isRefreshToken, isRefreshTokenError, isSameRefreshToken, isString, isToken, isTransactionMeta, isoToUTCString, loadFrame, loadPopup, omit, parseEmailVerifyCallback, parseFromUrl, PKCE as pkce, postRefreshToken, postToTokenEndpoint, postToTransaction, prepareTokenParams, removeListener, removeNils, removeTrailingSlash, renewToken, renewTokens, renewTokensWithRefresh, resumeTransaction, revokeToken, toAbsoluteUrl, toQueryString, toRelativeUrl, transactionExists, transactionStatus, urlParamsToObject, validateClaims, validateToken, verifyToken, warn };
9166
+ export { ACCESS_TOKEN_STORAGE_KEY, AuthApiError, AuthPollStopError, AuthSdkError, AuthStateManager, AuthTransaction, AuthenticatorKey, CACHE_STORAGE_NAME, DEFAULT_CACHE_DURATION, DEFAULT_CODE_CHALLENGE_METHOD, DEFAULT_MAX_CLOCK_SKEW, DEFAULT_POLLING_DELAY, EVENT_ADDED, EVENT_ERROR, EVENT_EXPIRED, EVENT_REMOVED, EVENT_RENEWED, EmailVerifyCallbackError, IDX_API_VERSION, IDX_RESPONSE_STORAGE_NAME, ID_TOKEN_STORAGE_KEY, INITIAL_AUTH_STATE, IdxFeature, IdxStatus, MAX_VERIFIER_LENGTH, MIN_VERIFIER_LENGTH, OAuthError, ORIGINAL_URI_STORAGE_NAME, OktaAuth, PKCE_STORAGE_NAME, REDIRECT_NONCE_COOKIE_NAME, REDIRECT_OAUTH_PARAMS_NAME, REDIRECT_STATE_COOKIE_NAME, REFERRER_PATH_STORAGE_KEY, REFRESH_TOKEN_STORAGE_KEY, SHARED_TRANSACTION_STORAGE_NAME, STATE_TOKEN_KEY_NAME, TOKEN_STORAGE_NAME, TRANSACTION_STORAGE_NAME, TokenManager, addListener, addPostMessageListener, addStateToken, assertPKCESupport, authenticate, bind, buildAuthorizeParams, canProceed, cancel, clearTransactionMeta, clone, convertTokenParamsToOAuthParams, createOAuthMeta, createTransactionMeta, index as crypto, decodeToken, delay, deprecate, deprecateWrap, exchangeCodeForTokens, extend, find, genRandomString, generateNonce, generateState, getConsole, getDefaultTokenParams, getHashOrSearch, getKey, getLink, getNativeConsole, getOAuthBaseUrl, getOAuthDomain, getOAuthUrls, getPollFn, getSavedTransactionMeta, getStateToken, getToken, getTransactionMeta, getUserInfo, getWellKnown, getWithPopup, getWithRedirect, getWithoutPrompt, handleEmailVerifyCallback, handleInteractionCodeRedirect, handleOAuthResponse, hasAuthorizationCode, hasErrorInUrl, hasInteractionCode, hasSavedInteractionHandle, hasTokensInHash, interact, introspect, introspectAuthn, isAbsoluteUrl, isAccessToken, isAuthApiError, isAuthorizationCodeError, isCodeFlow, isCustomAuthTransactionMeta, isEmailVerifyCallback, isEmailVerifyCallbackError, isFunction, isIDToken, isIdxTransactionMeta, isInteractionRequired, isInteractionRequiredError, isLoginRedirect, isNumber, isOAuthTransactionMeta, isObject, isPKCETransactionMeta, isPromise, isRedirectUri, isRefreshToken, isRefreshTokenError, isSameRefreshToken, isString, isToken, isTransactionMeta, isTransactionMetaValid, isTransactionMetaValidForFlow, isTransactionMetaValidForOptions, isoToUTCString, loadFrame, loadPopup, omit, parseEmailVerifyCallback, parseFromUrl, PKCE as pkce, poll, postRefreshToken, postToTokenEndpoint, postToTransaction, preparePKCE, prepareTokenParams, proceed, recoverPassword, register, removeListener, removeNils, removeTrailingSlash, renewToken, renewTokens, renewTokensWithRefresh, resumeTransaction, revokeToken, saveTransactionMeta, startTransaction, toAbsoluteUrl, toQueryString, toRelativeUrl, transactionExists, transactionStatus, transactionStep, urlParamsToObject, validateClaims, validateCodeChallengeMethod, validateToken, verifyToken, warn };
8591
9167
  //# sourceMappingURL=index.js.map