@okta/okta-auth-js 7.5.0 → 7.6.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 (174) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +27 -5
  3. package/cjs/browser/fingerprint.js +1 -2
  4. package/cjs/browser/fingerprint.js.map +1 -1
  5. package/cjs/core/ServiceManager/browser.js +13 -6
  6. package/cjs/core/ServiceManager/browser.js.map +1 -1
  7. package/cjs/core/types/Service.js.map +1 -1
  8. package/cjs/core/types/api.js.map +1 -1
  9. package/cjs/fetch/fetchRequest.js +1 -2
  10. package/cjs/fetch/fetchRequest.js.map +1 -1
  11. package/cjs/http/OktaUserAgent.js +2 -2
  12. package/cjs/http/request.js +11 -5
  13. package/cjs/http/request.js.map +1 -1
  14. package/cjs/idx/IdxTransactionManager.js +1 -1
  15. package/cjs/idx/IdxTransactionManager.js.map +1 -1
  16. package/cjs/idx/authenticator/Authenticator.js.map +1 -1
  17. package/cjs/idx/authenticator/OktaPassword.js +17 -6
  18. package/cjs/idx/authenticator/OktaPassword.js.map +1 -1
  19. package/cjs/idx/authenticator/VerificationCodeAuthenticator.js +1 -2
  20. package/cjs/idx/authenticator/VerificationCodeAuthenticator.js.map +1 -1
  21. package/cjs/idx/authenticator/getAuthenticator.js +3 -4
  22. package/cjs/idx/authenticator/getAuthenticator.js.map +1 -1
  23. package/cjs/idx/idxState/index.js +1 -1
  24. package/cjs/idx/idxState/index.js.map +1 -1
  25. package/cjs/idx/idxState/v1/generateIdxAction.js +2 -2
  26. package/cjs/idx/idxState/v1/generateIdxAction.js.map +1 -1
  27. package/cjs/idx/idxState/v1/idxResponseParser.js +2 -4
  28. package/cjs/idx/idxState/v1/idxResponseParser.js.map +1 -1
  29. package/cjs/idx/idxState/v1/makeIdxState.js +1 -2
  30. package/cjs/idx/idxState/v1/makeIdxState.js.map +1 -1
  31. package/cjs/idx/interact.js +1 -2
  32. package/cjs/idx/interact.js.map +1 -1
  33. package/cjs/idx/poll.js +3 -5
  34. package/cjs/idx/poll.js.map +1 -1
  35. package/cjs/idx/proceed.js +1 -1
  36. package/cjs/idx/proceed.js.map +1 -1
  37. package/cjs/idx/remediators/Base/AuthenticatorData.js +1 -1
  38. package/cjs/idx/remediators/Base/AuthenticatorData.js.map +1 -1
  39. package/cjs/idx/remediators/Base/Remediator.js +5 -7
  40. package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
  41. package/cjs/idx/remediators/Base/SelectAuthenticator.js +3 -4
  42. package/cjs/idx/remediators/Base/SelectAuthenticator.js.map +1 -1
  43. package/cjs/idx/remediators/Base/VerifyAuthenticator.js +1 -2
  44. package/cjs/idx/remediators/Base/VerifyAuthenticator.js.map +1 -1
  45. package/cjs/idx/remediators/EnrollPoll.js +1 -1
  46. package/cjs/idx/remediators/EnrollPoll.js.map +1 -1
  47. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js +2 -3
  48. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js.map +1 -1
  49. package/cjs/idx/remediators/SelectAuthenticatorUnlockAccount.js +2 -3
  50. package/cjs/idx/remediators/SelectAuthenticatorUnlockAccount.js.map +1 -1
  51. package/cjs/idx/remediators/SelectEnrollmentChannel.js +1 -2
  52. package/cjs/idx/remediators/SelectEnrollmentChannel.js.map +1 -1
  53. package/cjs/idx/remediators/util.js +2 -4
  54. package/cjs/idx/remediators/util.js.map +1 -1
  55. package/cjs/idx/run.js +6 -10
  56. package/cjs/idx/run.js.map +1 -1
  57. package/cjs/idx/transactionMeta.js +1 -1
  58. package/cjs/idx/transactionMeta.js.map +1 -1
  59. package/cjs/idx/types/idx-js.js.map +1 -1
  60. package/cjs/idx/util.js +3 -6
  61. package/cjs/idx/util.js.map +1 -1
  62. package/cjs/myaccount/emailApi.js +1 -1
  63. package/cjs/myaccount/emailApi.js.map +1 -1
  64. package/cjs/myaccount/passwordApi.js +2 -2
  65. package/cjs/myaccount/passwordApi.js.map +1 -1
  66. package/cjs/myaccount/phoneApi.js +1 -1
  67. package/cjs/myaccount/phoneApi.js.map +1 -1
  68. package/cjs/myaccount/profileApi.js +2 -2
  69. package/cjs/myaccount/profileApi.js.map +1 -1
  70. package/cjs/myaccount/request.js +1 -1
  71. package/cjs/myaccount/request.js.map +1 -1
  72. package/cjs/oidc/TokenManager.js +18 -3
  73. package/cjs/oidc/TokenManager.js.map +1 -1
  74. package/cjs/oidc/TransactionManager.js +1 -1
  75. package/cjs/oidc/TransactionManager.js.map +1 -1
  76. package/cjs/oidc/getToken.js +1 -2
  77. package/cjs/oidc/getToken.js.map +1 -1
  78. package/cjs/oidc/introspect.js +3 -5
  79. package/cjs/oidc/introspect.js.map +1 -1
  80. package/cjs/oidc/mixin/index.js +18 -3
  81. package/cjs/oidc/mixin/index.js.map +1 -1
  82. package/cjs/oidc/options/OAuthOptionsConstructor.js +1 -1
  83. package/cjs/oidc/options/OAuthOptionsConstructor.js.map +1 -1
  84. package/cjs/oidc/renewTokens.js +1 -2
  85. package/cjs/oidc/renewTokens.js.map +1 -1
  86. package/cjs/oidc/types/api.js.map +1 -1
  87. package/cjs/oidc/util/errors.js +2 -2
  88. package/cjs/oidc/util/errors.js.map +1 -1
  89. package/cjs/oidc/util/validateClaims.js +1 -1
  90. package/cjs/oidc/util/validateClaims.js.map +1 -1
  91. package/cjs/oidc/verifyToken.js +1 -1
  92. package/cjs/oidc/verifyToken.js.map +1 -1
  93. package/cjs/services/LeaderElectionService.js +3 -6
  94. package/cjs/services/LeaderElectionService.js.map +1 -1
  95. package/cjs/services/RenewOnTabActivationService.js +64 -0
  96. package/cjs/services/RenewOnTabActivationService.js.map +1 -0
  97. package/cjs/services/SyncStorageService.js +6 -11
  98. package/cjs/services/SyncStorageService.js.map +1 -1
  99. package/cjs/services/index.js +11 -0
  100. package/cjs/services/index.js.map +1 -1
  101. package/dist/okta-auth-js.authn.min.analyzer.html +2 -2
  102. package/dist/okta-auth-js.authn.min.js +1 -1
  103. package/dist/okta-auth-js.authn.min.js.map +1 -1
  104. package/dist/okta-auth-js.core.min.analyzer.html +2 -2
  105. package/dist/okta-auth-js.core.min.js +1 -1
  106. package/dist/okta-auth-js.core.min.js.map +1 -1
  107. package/dist/okta-auth-js.idx.min.analyzer.html +2 -2
  108. package/dist/okta-auth-js.idx.min.js +1 -1
  109. package/dist/okta-auth-js.idx.min.js.map +1 -1
  110. package/dist/okta-auth-js.min.analyzer.html +2 -2
  111. package/dist/okta-auth-js.min.js +1 -1
  112. package/dist/okta-auth-js.min.js.map +1 -1
  113. package/dist/okta-auth-js.myaccount.min.analyzer.html +2 -2
  114. package/dist/okta-auth-js.myaccount.min.js +1 -1
  115. package/dist/okta-auth-js.myaccount.min.js.map +1 -1
  116. package/esm/browser/core/ServiceManager/browser.js +9 -2
  117. package/esm/browser/core/ServiceManager/browser.js.map +1 -1
  118. package/esm/browser/http/OktaUserAgent.js +2 -2
  119. package/esm/browser/http/request.js +7 -1
  120. package/esm/browser/http/request.js.map +1 -1
  121. package/esm/browser/idx/authenticator/Authenticator.js.map +1 -1
  122. package/esm/browser/idx/authenticator/OktaPassword.js +17 -4
  123. package/esm/browser/idx/authenticator/OktaPassword.js.map +1 -1
  124. package/esm/browser/idx/types/idx-js.js.map +1 -1
  125. package/esm/browser/oidc/TokenManager.js +12 -1
  126. package/esm/browser/oidc/TokenManager.js.map +1 -1
  127. package/esm/browser/oidc/introspect.js +1 -1
  128. package/esm/browser/oidc/introspect.js.map +1 -1
  129. package/esm/browser/oidc/mixin/index.js +16 -0
  130. package/esm/browser/oidc/mixin/index.js.map +1 -1
  131. package/esm/browser/oidc/options/OAuthOptionsConstructor.js +1 -1
  132. package/esm/browser/oidc/options/OAuthOptionsConstructor.js.map +1 -1
  133. package/esm/browser/oidc/util/validateClaims.js +2 -1
  134. package/esm/browser/oidc/util/validateClaims.js.map +1 -1
  135. package/esm/browser/package.json +1 -1
  136. package/esm/browser/services/RenewOnTabActivationService.js +67 -0
  137. package/esm/browser/services/RenewOnTabActivationService.js.map +1 -0
  138. package/esm/node/http/OktaUserAgent.js +2 -2
  139. package/esm/node/http/request.js +7 -1
  140. package/esm/node/http/request.js.map +1 -1
  141. package/esm/node/idx/authenticator/Authenticator.js.map +1 -1
  142. package/esm/node/idx/authenticator/OktaPassword.js +17 -4
  143. package/esm/node/idx/authenticator/OktaPassword.js.map +1 -1
  144. package/esm/node/idx/types/idx-js.js.map +1 -1
  145. package/esm/node/oidc/TokenManager.js +12 -1
  146. package/esm/node/oidc/TokenManager.js.map +1 -1
  147. package/esm/node/oidc/introspect.js +1 -1
  148. package/esm/node/oidc/introspect.js.map +1 -1
  149. package/esm/node/oidc/mixin/index.js +16 -0
  150. package/esm/node/oidc/mixin/index.js.map +1 -1
  151. package/esm/node/oidc/options/OAuthOptionsConstructor.js +1 -1
  152. package/esm/node/oidc/options/OAuthOptionsConstructor.js.map +1 -1
  153. package/esm/node/oidc/util/validateClaims.js +2 -1
  154. package/esm/node/oidc/util/validateClaims.js.map +1 -1
  155. package/esm/node/package.json +1 -1
  156. package/package.json +4 -6
  157. package/types/lib/core/types/Service.d.ts +7 -1
  158. package/types/lib/core/types/api.d.ts +1 -0
  159. package/types/lib/idx/authenticator/Authenticator.d.ts +1 -1
  160. package/types/lib/idx/authenticator/OktaPassword.d.ts +2 -1
  161. package/types/lib/idx/types/idx-js.d.ts +1 -0
  162. package/types/lib/oidc/types/api.d.ts +1 -0
  163. package/types/lib/services/RenewOnTabActivationService.d.ts +16 -0
  164. package/types/lib/services/index.d.ts +1 -0
  165. package/umd/authn.js +1 -1
  166. package/umd/authn.js.map +1 -1
  167. package/umd/core.js +1 -1
  168. package/umd/core.js.map +1 -1
  169. package/umd/default.js +1 -1
  170. package/umd/default.js.map +1 -1
  171. package/umd/idx.js +1 -1
  172. package/umd/idx.js.map +1 -1
  173. package/umd/myaccount.js +1 -1
  174. package/umd/myaccount.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"SelectAuthenticator.js","names":["SelectAuthenticator","Remediator","findMatchedOption","authenticators","options","option","authenticator","find","relatesTo","key","canRemediate","context","values","authenticatorFromRemediation","getAuthenticatorFromRemediation","remediation","length","isAuthenticator","id","matchedOption","isCurrentAuthenticator","currentAuthenticator","value","isCurrentAuthenticatorEnrollment","currentAuthenticatorEnrollment","mapAuthenticator","remediationValue","selectedAuthenticator","selectedOption","form","name","getInputAuthenticator","map","label","type","getValuesAfterProceed","filter","compareAuthenticators"],"sources":["../../../../../lib/idx/remediators/Base/SelectAuthenticator.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-assertion */\n/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { Remediator, RemediationValues } from './Remediator';\nimport { getAuthenticatorFromRemediation } from '../util';\nimport { IdxRemediationValue, IdxContext, IdxOption } from '../../types/idx-js';\nimport { Authenticator, isAuthenticator } from '../../types/api';\nimport { compareAuthenticators, findMatchedOption} from '../../authenticator/util';\n\nexport type SelectAuthenticatorValues = RemediationValues & {\n authenticator?: string | Authenticator;\n};\n\n// Base class - DO NOT expose static remediationName\nexport class SelectAuthenticator<T extends SelectAuthenticatorValues = SelectAuthenticatorValues>\n extends Remediator<T> {\n selectedAuthenticator?: Authenticator;\n selectedOption?: any;\n\n // Find matched authenticator in provided order\n findMatchedOption(authenticators, options) {\n let option: IdxOption | undefined;\n for (let authenticator of authenticators) {\n option = options\n .find(({ relatesTo }) => relatesTo.key && relatesTo.key === authenticator.key);\n if (option) {\n break;\n }\n }\n return option;\n }\n\n /* eslint complexity:[0,9] */\n canRemediate(context?: IdxContext) {\n const { authenticators, authenticator } = this.values;\n const authenticatorFromRemediation = getAuthenticatorFromRemediation(this.remediation);\n const { options } = authenticatorFromRemediation;\n // Let users select authenticator if no input is provided\n if (!authenticators || !authenticators.length) {\n return false;\n }\n\n // Authenticator is explicitly specified by id\n if (isAuthenticator(authenticator) && authenticator.id) {\n return true;\n }\n\n // Proceed with provided authenticators\n const matchedOption = this.findMatchedOption(authenticators, options!);\n if (matchedOption) {\n // Don't select current authenticator (OKTA-612939)\n const isCurrentAuthenticator = context?.currentAuthenticator\n && context?.currentAuthenticator.value.id === matchedOption.relatesTo?.id;\n const isCurrentAuthenticatorEnrollment = context?.currentAuthenticatorEnrollment\n && context?.currentAuthenticatorEnrollment.value.id === matchedOption.relatesTo?.id;\n return !isCurrentAuthenticator && !isCurrentAuthenticatorEnrollment;\n }\n \n return false;\n }\n\n mapAuthenticator(remediationValue: IdxRemediationValue) {\n const { authenticators, authenticator } = this.values;\n\n // Authenticator is explicitly specified by id\n if (isAuthenticator(authenticator) && authenticator.id) {\n this.selectedAuthenticator = authenticator; // track the selected authenticator\n return authenticator;\n }\n\n const { options } = remediationValue;\n const selectedOption = findMatchedOption(authenticators, options);\n this.selectedAuthenticator = selectedOption.relatesTo; // track the selected authenticator\n this.selectedOption = selectedOption;\n return {\n id: selectedOption?.value.form.value.find(({ name }) => name === 'id').value\n };\n }\n\n getInputAuthenticator(remediation) {\n const options = remediation.options.map(({ label, relatesTo }) => {\n return {\n label,\n value: relatesTo.key\n };\n });\n return { name: 'authenticator', type: 'string', options };\n }\n\n getValuesAfterProceed(): T {\n this.values = super.getValuesAfterProceed();\n // remove used authenticators\n const authenticators = (this.values.authenticators as Authenticator[])\n .filter(authenticator => {\n return compareAuthenticators(authenticator, this.selectedAuthenticator) !== true;\n });\n return { ...this.values, authenticators };\n }\n\n}\n"],"mappings":";;;AAcA;AACA;AAEA;AACA;AAlBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA;AAC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AAqB,GAAM;IACzB,IAAI,CAACvB,MAAM,GAAG,KAAK,CAACuB,qBAAqB,EAAE;IAC3C;IACA,MAAMhC,cAAc,GAAI,IAAI,CAACS,MAAM,CAACT,cAAc,CAC/CiC,MAAM,CAAC9B,aAAa,IAAI;MACvB,OAAO,IAAA+B,4BAAqB,EAAC/B,aAAa,EAAE,IAAI,CAACqB,qBAAqB,CAAC,KAAK,IAAI;IAClF,CAAC,CAAC;IACJ,OAAO;MAAE,GAAG,IAAI,CAACf,MAAM;MAAET;IAAe,CAAC;EAC3C;AAEF;AAAC"}
1
+ {"version":3,"file":"SelectAuthenticator.js","names":["SelectAuthenticator","Remediator","findMatchedOption","authenticators","options","option","authenticator","find","relatesTo","key","canRemediate","context","values","authenticatorFromRemediation","getAuthenticatorFromRemediation","remediation","length","isAuthenticator","id","matchedOption","isCurrentAuthenticator","currentAuthenticator","value","isCurrentAuthenticatorEnrollment","currentAuthenticatorEnrollment","mapAuthenticator","remediationValue","selectedAuthenticator","selectedOption","form","name","getInputAuthenticator","map","label","type","getValuesAfterProceed","filter","compareAuthenticators"],"sources":["../../../../../lib/idx/remediators/Base/SelectAuthenticator.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-assertion */\n/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { Remediator, RemediationValues } from './Remediator';\nimport { getAuthenticatorFromRemediation } from '../util';\nimport { IdxRemediationValue, IdxContext, IdxOption } from '../../types/idx-js';\nimport { Authenticator, isAuthenticator } from '../../types/api';\nimport { compareAuthenticators, findMatchedOption} from '../../authenticator/util';\n\nexport type SelectAuthenticatorValues = RemediationValues & {\n authenticator?: string | Authenticator;\n};\n\n// Base class - DO NOT expose static remediationName\nexport class SelectAuthenticator<T extends SelectAuthenticatorValues = SelectAuthenticatorValues>\n extends Remediator<T> {\n selectedAuthenticator?: Authenticator;\n selectedOption?: any;\n\n // Find matched authenticator in provided order\n findMatchedOption(authenticators, options) {\n let option: IdxOption | undefined;\n for (let authenticator of authenticators) {\n option = options\n .find(({ relatesTo }) => relatesTo.key && relatesTo.key === authenticator.key);\n if (option) {\n break;\n }\n }\n return option;\n }\n\n /* eslint complexity:[0,9] */\n canRemediate(context?: IdxContext) {\n const { authenticators, authenticator } = this.values;\n const authenticatorFromRemediation = getAuthenticatorFromRemediation(this.remediation);\n const { options } = authenticatorFromRemediation;\n // Let users select authenticator if no input is provided\n if (!authenticators || !authenticators.length) {\n return false;\n }\n\n // Authenticator is explicitly specified by id\n if (isAuthenticator(authenticator) && authenticator.id) {\n return true;\n }\n\n // Proceed with provided authenticators\n const matchedOption = this.findMatchedOption(authenticators, options!);\n if (matchedOption) {\n // Don't select current authenticator (OKTA-612939)\n const isCurrentAuthenticator = context?.currentAuthenticator\n && context?.currentAuthenticator.value.id === matchedOption.relatesTo?.id;\n const isCurrentAuthenticatorEnrollment = context?.currentAuthenticatorEnrollment\n && context?.currentAuthenticatorEnrollment.value.id === matchedOption.relatesTo?.id;\n return !isCurrentAuthenticator && !isCurrentAuthenticatorEnrollment;\n }\n \n return false;\n }\n\n mapAuthenticator(remediationValue: IdxRemediationValue) {\n const { authenticators, authenticator } = this.values;\n\n // Authenticator is explicitly specified by id\n if (isAuthenticator(authenticator) && authenticator.id) {\n this.selectedAuthenticator = authenticator; // track the selected authenticator\n return authenticator;\n }\n\n const { options } = remediationValue;\n const selectedOption = findMatchedOption(authenticators, options);\n this.selectedAuthenticator = selectedOption.relatesTo; // track the selected authenticator\n this.selectedOption = selectedOption;\n return {\n id: selectedOption?.value.form.value.find(({ name }) => name === 'id').value\n };\n }\n\n getInputAuthenticator(remediation) {\n const options = remediation.options.map(({ label, relatesTo }) => {\n return {\n label,\n value: relatesTo.key\n };\n });\n return { name: 'authenticator', type: 'string', options };\n }\n\n getValuesAfterProceed(): T {\n this.values = super.getValuesAfterProceed();\n // remove used authenticators\n const authenticators = (this.values.authenticators as Authenticator[])\n .filter(authenticator => {\n return compareAuthenticators(authenticator, this.selectedAuthenticator) !== true;\n });\n return { ...this.values, authenticators };\n }\n\n}\n"],"mappings":";;;AAcA;AACA;AAEA;AACA;AAlBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA;AACO,MAAMA,mBAAmB,SACtBC,sBAAU,CAAI;EAItB;EACAC,iBAAiB,CAACC,cAAc,EAAEC,OAAO,EAAE;IACzC,IAAIC,MAA6B;IACjC,KAAK,IAAIC,aAAa,IAAIH,cAAc,EAAE;MACxCE,MAAM,GAAGD,OAAO,CACbG,IAAI,CAAC,CAAC;QAAEC;MAAU,CAAC,KAAKA,SAAS,CAACC,GAAG,IAAID,SAAS,CAACC,GAAG,KAAKH,aAAa,CAACG,GAAG,CAAC;MAChF,IAAIJ,MAAM,EAAE;QACV;MACF;IACF;IACA,OAAOA,MAAM;EACf;;EAEA;EACAK,YAAY,CAACC,OAAoB,EAAE;IACjC,MAAM;MAAER,cAAc;MAAEG;IAAc,CAAC,GAAG,IAAI,CAACM,MAAM;IACrD,MAAMC,4BAA4B,GAAG,IAAAC,qCAA+B,EAAC,IAAI,CAACC,WAAW,CAAC;IACtF,MAAM;MAAEX;IAAQ,CAAC,GAAGS,4BAA4B;IAChD;IACA,IAAI,CAACV,cAAc,IAAI,CAACA,cAAc,CAACa,MAAM,EAAE;MAC7C,OAAO,KAAK;IACd;;IAEA;IACA,IAAI,IAAAC,oBAAe,EAACX,aAAa,CAAC,IAAIA,aAAa,CAACY,EAAE,EAAE;MACtD,OAAO,IAAI;IACb;;IAEA;IACA,MAAMC,aAAa,GAAG,IAA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MAAEzB;IAAU,CAAC,KAAK;MAChE,OAAO;QACLyB,KAAK;QACLX,KAAK,EAAEd,SAAS,CAACC;MACnB,CAAC;IACH,CAAC,CAAC;IACF,OAAO;MAAEqB,IAAI,EAAE,eAAe;MAAEI,IAAI,EAAE,QAAQ;MAAE9B;IAAQ,CAAC;EAC3D;EAEA+B,qBAAqB,GAAM;IACzB,IAAI,CAACvB,MAAM,GAAG,KAAK,CAACuB,qBAAqB,EAAE;IAC3C;IACA,MAAMhC,cAAc,GAAI,IAAI,CAACS,MAAM,CAACT,cAAc,CAC/CiC,MAAM,CAAC9B,aAAa,IAAI;MACvB,OAAO,IAAA+B,4BAAqB,EAAC/B,aAAa,EAAE,IAAI,CAACqB,qBAAqB,CAAC,KAAK,IAAI;IAClF,CAAC,CAAC;IACJ,OAAO;MAAE,GAAG,IAAI,CAACf,MAAM;MAAET;IAAe,CAAC;EAC3C;AAEF;AAAC"}
@@ -22,9 +22,8 @@ class VerifyAuthenticator extends _Remediator.Remediator {
22
22
  this.authenticator = (0, _authenticator.getAuthenticator)(remediation);
23
23
  }
24
24
  getNextStep(authClient, context) {
25
- var _context$authenticato;
26
25
  const nextStep = super.getNextStep(authClient, context);
27
- const authenticatorEnrollments = context === null || context === void 0 ? void 0 : (_context$authenticato = context.authenticatorEnrollments) === null || _context$authenticato === void 0 ? void 0 : _context$authenticato.value;
26
+ const authenticatorEnrollments = context?.authenticatorEnrollments?.value;
28
27
  return {
29
28
  ...nextStep,
30
29
  authenticatorEnrollments
@@ -1 +1 @@
1
- {"version":3,"file":"VerifyAuthenticator.js","names":["VerifyAuthenticator","Remediator","constructor","remediation","values","authenticator","getAuthenticator","getNextStep","authClient","context","nextStep","authenticatorEnrollments","value","canRemediate","canVerify","mapCredentials","getInputCredentials","input","getInputs","getValuesAfterProceed","trimmedValues","Object","keys","filter","valueKey","reduce"],"sources":["../../../../../lib/idx/remediators/Base/VerifyAuthenticator.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { Remediator, RemediationValues } from './Remediator';\nimport { getAuthenticator, Authenticator, AuthenticatorValues } from '../../authenticator';\nimport { IdxRemediation, IdxContext } from '../../types/idx-js';\nimport { OktaAuthIdxInterface, NextStep } from '../../types';\n\nexport type VerifyAuthenticatorValues = AuthenticatorValues & RemediationValues;\n\n// Base class - DO NOT expose static remediationName\nexport class VerifyAuthenticator<T extends VerifyAuthenticatorValues = VerifyAuthenticatorValues>\n extends Remediator<T> {\n\n authenticator: Authenticator<VerifyAuthenticatorValues>;\n\n constructor(remediation: IdxRemediation, values: T = {} as T) {\n super(remediation, values);\n this.authenticator = getAuthenticator(remediation);\n }\n\n getNextStep(authClient: OktaAuthIdxInterface, context?: IdxContext): NextStep {\n const nextStep = super.getNextStep(authClient, context);\n const authenticatorEnrollments = context?.authenticatorEnrollments?.value;\n\n return {\n ...nextStep,\n authenticatorEnrollments\n };\n }\n\n canRemediate() {\n return this.authenticator.canVerify(this.values);\n }\n\n mapCredentials() {\n return this.authenticator.mapCredentials(this.values);\n }\n\n getInputCredentials(input) {\n return this.authenticator.getInputs(input);\n }\n\n getValuesAfterProceed(): T {\n this.values = super.getValuesAfterProceed();\n let trimmedValues = Object.keys(this.values).filter(valueKey => valueKey !== 'credentials');\n return trimmedValues.reduce((values, valueKey) => ({...values, [valueKey]: this.values[valueKey]}), {} as T);\n }\n}\n"],"mappings":";;;AAaA;AACA;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA;AACO,MAAMA,mBAAmB,SACtBC,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ator.js","names":["VerifyAuthenticator","Remediator","constructor","remediation","values","authenticator","getAuthenticator","getNextStep","authClient","context","nextStep","authenticatorEnrollments","value","canRemediate","canVerify","mapCredentials","getInputCredentials","input","getInputs","getValuesAfterProceed","trimmedValues","Object","keys","filter","valueKey","reduce"],"sources":["../../../../../lib/idx/remediators/Base/VerifyAuthenticator.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { Remediator, RemediationValues } from './Remediator';\nimport { getAuthenticator, Authenticator, AuthenticatorValues } from '../../authenticator';\nimport { IdxRemediation, IdxContext } from '../../types/idx-js';\nimport { OktaAuthIdxInterface, NextStep } from '../../types';\n\nexport type VerifyAuthenticatorValues = AuthenticatorValues & RemediationValues;\n\n// Base class - DO NOT expose static remediationName\nexport class VerifyAuthenticator<T extends VerifyAuthenticatorValues = VerifyAuthenticatorValues>\n extends Remediator<T> {\n\n authenticator: Authenticator<VerifyAuthenticatorValues>;\n\n constructor(remediation: IdxRemediation, values: T = {} as T) {\n super(remediation, values);\n this.authenticator = getAuthenticator(remediation);\n }\n\n getNextStep(authClient: OktaAuthIdxInterface, context?: IdxContext): NextStep {\n const nextStep = super.getNextStep(authClient, context);\n const authenticatorEnrollments = context?.authenticatorEnrollments?.value;\n\n return {\n ...nextStep,\n authenticatorEnrollments\n };\n }\n\n canRemediate() {\n return this.authenticator.canVerify(this.values);\n }\n\n mapCredentials() {\n return this.authenticator.mapCredentials(this.values);\n }\n\n getInputCredentials(input) {\n return this.authenticator.getInputs(input);\n }\n\n getValuesAfterProceed(): T {\n this.values = super.getValuesAfterProceed();\n let trimmedValues = Object.keys(this.values).filter(valueKey => valueKey !== 'credentials');\n return trimmedValues.reduce((values, valueKey) => ({...values, [valueKey]: this.values[valueKey]}), {} as T);\n }\n}\n"],"mappings":";;;AAaA;AACA;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA;AACO,MAAMA,mBAAmB,SACtBC,sBAAU,CAAI;EAItBC,WAAW,CAACC,WAA2B,EAAEC,MAAS,GAAG,CAAC,CAAM,EAAE;IAC5D,KAAK,CAACD,WAAW,EAAEC,MAAM,CAAC;IAC1B,IAAI,CAACC,aAAa,GAAG,IAAAC,+BAAgB,EAACH,WAAW,CAAC;EACpD;EAEAI,WAAW,CAACC,UAAgC,EAAEC,OAAoB,EAAY;IAC5E,MAAMC,QAAQ,GAAG,KAAK,CAACH,WAAW,CAACC,UAAU,EAAEC,OAAO,CAAC;IACvD,MAAME,wBAAwB,GAAGF,OAAO,EAAEE,wBAAwB,EAAEC,KAAK;IAEzE,OAAO;MACL,GAAGF,QAAQ;MACXC;IACF,CAAC;EACH;EAEAE,YAAY,GAAG;IACb,OAAO,IAAI,CAACR,aAAa,CAACS,SAAS,CAAC,IAAI,CAACV,MAAM,CAAC;EAClD;EAEAW,cAAc,GAAG;IACf,OAAO,IAAI,CAACV,aAAa,CAACU,cAAc,CAAC,IAAI,CAACX,MAAM,CAAC;EACvD;EAEAY,mBAAmB,CAACC,KAAK,EAAE;IACzB,OAAO,IAAI,CAACZ,aAAa,CAACa,SAAS,CAACD,KAAK,CAAC;EAC5C;EAEAE,qBAAqB,GAAM;IACzB,IAAI,CAACf,MAAM,GAAG,KAAK,CAACe,qBAAqB,EAAE;IAC3C,IAAIC,aAAa,GAAGC,MAAM,CAACC,IAAI,CAAC,IAAI,CAAClB,MAAM,CAAC,CAACmB,MAAM,CAACC,QAAQ,IAAIA,QAAQ,KAAK,aAAa,CAAC;IAC3F,OAAOJ,aAAa,CAACK,MAAM,CAAC,CAACrB,MAAM,EAAEoB,QAAQ,MAAM;MAAC,GAAGpB,MAAM;MAAE,CAACoB,QAAQ,GAAG,IAAI,CAACpB,MAAM,CAACoB,QAAQ;IAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAM;EAC9G;AACF;AAAC"}
@@ -23,7 +23,7 @@ class EnrollPoll extends _Remediator.Remediator {
23
23
  getNextStep(authClient, context) {
24
24
  const common = super.getNextStep(authClient, context);
25
25
  let authenticator = this.getAuthenticator();
26
- if (!authenticator && context !== null && context !== void 0 && context.currentAuthenticator) {
26
+ if (!authenticator && context?.currentAuthenticator) {
27
27
  authenticator = context.currentAuthenticator.value;
28
28
  }
29
29
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"EnrollPoll.js","names":["EnrollPoll","Remediator","canRemediate","values","startPolling","options","step","getNextStep","authClient","context","common","authenticator","getAuthenticator","currentAuthenticator","value","poll","required","refresh","remediation","getValuesAfterProceed","trimmedValues","Object","keys","filter","valueKey","reduce"],"sources":["../../../../lib/idx/remediators/EnrollPoll.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { Remediator, RemediationValues } from './Base/Remediator';\nimport { NextStep, OktaAuthIdxInterface } from '../types';\nimport { IdxContext } from '../types/idx-js';\n\nexport interface EnrollPollValues extends RemediationValues {\n startPolling?: boolean;\n}\n\nexport class EnrollPoll extends Remediator<EnrollPollValues> {\n static remediationName = 'enroll-poll';\n\n canRemediate() {\n return !!this.values.startPolling || this.options.step === 'enroll-poll';\n }\n\n getNextStep(authClient: OktaAuthIdxInterface, context?: IdxContext): NextStep {\n const common = super.getNextStep(authClient, context);\n let authenticator = this.getAuthenticator();\n if (!authenticator && context?.currentAuthenticator) {\n authenticator = context.currentAuthenticator.value;\n }\n return {\n ...common,\n authenticator,\n poll: {\n required: true,\n refresh: this.remediation.refresh\n },\n };\n }\n\n getValuesAfterProceed(): EnrollPollValues {\n let trimmedValues = Object.keys(this.values).filter(valueKey => valueKey !== 'startPolling');\n return trimmedValues.reduce((values, valueKey) => ({...values, [valueKey]: this.values[valueKey]}), {});\n }\n}\n"],"mappings":";;;;;AAaA;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWO,MAAMA,UAAU,SAASC,sBAAU,CAAmB;EAG3DC,YAAY,GAAG;IACb,OAAO,CAAC,CAAC,IAAI,CAACC,MAAM,CAACC,YAAY,IAAI,IAAI,CAACC,OAAO,CAACC,IAAI,KAAK,aAAa;EAC1E;EAEAC,WAAW,CAACC,UAAgC,EAAEC,OAAoB,EAAY;IAC5E,MAAMC,MAAM,GAAG,KAAK,CAACH,WAAW,CAACC,UAAU,EAAEC,OAAO,CAAC;IACrD,IAAIE,aAAa,GAAG,IAAI,CAACC,gBAAgB,EAAE;IAC3C,IAAI,CAACD,aAAa,IAAIF,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEI,oBAAoB,EAAE;MACnDF,aAAa,GAAGF,OAAO,CAACI,oBAAoB,CAACC,KAAK;IACpD;IACA,OAAO;MACL,GAAGJ,MAAM;MACTC,aAAa;MACbI,IAAI,EAAE;QACJC,QAAQ,EAAE,IAAI;QACdC,OAAO,EAAE,IAAI,CAACC,WAAW,CAACD;MAC5B;IACF,CAAC;EACH;EAEAE,qBAAqB,GAAqB;IACxC,IAAIC,aAAa,GAAGC,MAAM,CAACC,IAAI,CAAC,IAAI,CAACnB,MAAM,CAAC,CAACoB,MAAM,CAACC,QAAQ,IAAIA,QAAQ,KAAK,cAAc,CAAC;IAC5F,OAAOJ,aAAa,CAACK,MAAM,CAAC,CAACtB,MAAM,EAAEqB,QAAQ,MAAM;MAAC,GAAGrB,MAAM;MAAE,CAACqB,QAAQ,GAAG,IAAI,CAACrB,MAAM,CAACqB,QAAQ;IAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;EACzG;AACF;AAAC;AAAA,8BA3BYxB,UAAU,qBACI,aAAa"}
1
+ {"version":3,"file":"EnrollPoll.js","names":["EnrollPoll","Remediator","canRemediate","values","startPolling","options","step","getNextStep","authClient","context","common","authenticator","getAuthenticator","currentAuthenticator","value","poll","required","refresh","remediation","getValuesAfterProceed","trimmedValues","Object","keys","filter","valueKey","reduce"],"sources":["../../../../lib/idx/remediators/EnrollPoll.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { Remediator, RemediationValues } from './Base/Remediator';\nimport { NextStep, OktaAuthIdxInterface } from '../types';\nimport { IdxContext } from '../types/idx-js';\n\nexport interface EnrollPollValues extends RemediationValues {\n startPolling?: boolean;\n}\n\nexport class EnrollPoll extends Remediator<EnrollPollValues> {\n static remediationName = 'enroll-poll';\n\n canRemediate() {\n return !!this.values.startPolling || this.options.step === 'enroll-poll';\n }\n\n getNextStep(authClient: OktaAuthIdxInterface, context?: IdxContext): NextStep {\n const common = super.getNextStep(authClient, context);\n let authenticator = this.getAuthenticator();\n if (!authenticator && context?.currentAuthenticator) {\n authenticator = context.currentAuthenticator.value;\n }\n return {\n ...common,\n authenticator,\n poll: {\n required: true,\n refresh: this.remediation.refresh\n },\n };\n }\n\n getValuesAfterProceed(): EnrollPollValues {\n let trimmedValues = Object.keys(this.values).filter(valueKey => valueKey !== 'startPolling');\n return trimmedValues.reduce((values, valueKey) => ({...values, [valueKey]: this.values[valueKey]}), {});\n }\n}\n"],"mappings":";;;;;AAaA;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWO,MAAMA,UAAU,SAASC,sBAAU,CAAmB;EAG3DC,YAAY,GAAG;IACb,OAAO,CAAC,CAAC,IAAI,CAACC,MAAM,CAACC,YAAY,IAAI,IAAI,CAACC,OAAO,CAACC,IAAI,KAAK,aAAa;EAC1E;EAEAC,WAAW,CAACC,UAAgC,EAAEC,OAAoB,EAAY;IAC5E,MAAMC,MAAM,GAAG,KAAK,CAACH,WAAW,CAACC,UAAU,EAAEC,OAAO,CAAC;IACrD,IAAIE,aAAa,GAAG,IAAI,CAACC,gBAAgB,EAAE;IAC3C,IAAI,CAACD,aAAa,IAAIF,OAAO,EAAEI,oBAAoB,EAAE;MACnDF,aAAa,GAAGF,OAAO,CAACI,oBAAoB,CAACC,KAAK;IACpD;IACA,OAAO;MACL,GAAGJ,MAAM;MACTC,aAAa;MACbI,IAAI,EAAE;QACJC,QAAQ,EAAE,IAAI;QACdC,OAAO,EAAE,IAAI,CAACC,WAAW,CAACD;MAC5B;IACF,CAAC;EACH;EAEAE,qBAAqB,GAAqB;IACxC,IAAIC,aAAa,GAAGC,MAAM,CAACC,IAAI,CAAC,IAAI,CAACnB,MAAM,CAAC,CAACoB,MAAM,CAACC,QAAQ,IAAIA,QAAQ,KAAK,cAAc,CAAC;IAC5F,OAAOJ,aAAa,CAACK,MAAM,CAAC,CAACtB,MAAM,EAAEqB,QAAQ,MAAM;MAAC,GAAGrB,MAAM;MAAE,CAACqB,QAAQ,GAAG,IAAI,CAACrB,MAAM,CAACqB,QAAQ;IAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;EACzG;AACF;AAAC;AAAA,8BA3BYxB,UAAU,qBACI,aAAa"}
@@ -20,14 +20,13 @@ var _types = require("../types");
20
20
 
21
21
  class SelectAuthenticatorAuthenticate extends _SelectAuthenticator.SelectAuthenticator {
22
22
  constructor(remediation, values = {}, options = {}) {
23
- var _getAuthenticatorFrom;
24
23
  super(remediation, values, options);
25
24
 
26
25
  // Preset password authenticator to trigger recover action
27
26
  const isRecoveryFlow = this.options.flow === 'recoverPassword';
28
- const hasPasswordInOptions = (_getAuthenticatorFrom = (0, _util.getAuthenticatorFromRemediation)(remediation).options) === null || _getAuthenticatorFrom === void 0 ? void 0 : _getAuthenticatorFrom.some(({
27
+ const hasPasswordInOptions = (0, _util.getAuthenticatorFromRemediation)(remediation).options?.some(({
29
28
  relatesTo
30
- }) => (relatesTo === null || relatesTo === void 0 ? void 0 : relatesTo.key) === _types.AuthenticatorKey.OKTA_PASSWORD);
29
+ }) => relatesTo?.key === _types.AuthenticatorKey.OKTA_PASSWORD);
31
30
  if (hasPasswordInOptions && (isRecoveryFlow || this.values.password)) {
32
31
  this.values.authenticators = [...(this.values.authenticators || []), {
33
32
  key: _types.AuthenticatorKey.OKTA_PASSWORD
@@ -1 +1 @@
1
- {"version":3,"file":"SelectAuthenticatorAuthenticate.js","names":["SelectAuthenticatorAuthenticate","SelectAuthenticator","constructor","remediation","values","options","isRecoveryFlow","flow","hasPasswordInOptions","getAuthenticatorFromRemediation","some","relatesTo","key","AuthenticatorKey","OKTA_PASSWORD","password","authenticators"],"sources":["../../../../lib/idx/remediators/SelectAuthenticatorAuthenticate.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { SelectAuthenticator, SelectAuthenticatorValues } from './Base/SelectAuthenticator';\nimport { getAuthenticatorFromRemediation } from './util';\nimport { IdxRemediation } from '../types/idx-js';\nimport { AuthenticatorKey, Authenticator, RemediateOptions } from '../types';\n\nexport type SelectAuthenticatorAuthenticateValues = SelectAuthenticatorValues & {\n password?: string;\n};\n\nexport class SelectAuthenticatorAuthenticate extends SelectAuthenticator<SelectAuthenticatorAuthenticateValues> {\n static remediationName = 'select-authenticator-authenticate';\n\n constructor(\n remediation: IdxRemediation, \n values: SelectAuthenticatorValues = {}, \n options: RemediateOptions = {}\n ) {\n super(remediation, values, options);\n\n // Preset password authenticator to trigger recover action\n const isRecoveryFlow = this.options.flow === 'recoverPassword';\n const hasPasswordInOptions = getAuthenticatorFromRemediation(remediation)\n .options?.some(({ relatesTo }) => relatesTo?.key === AuthenticatorKey.OKTA_PASSWORD);\n if (hasPasswordInOptions && (isRecoveryFlow || this.values.password)) {\n this.values.authenticators = [\n ...this.values.authenticators || [],\n { key: AuthenticatorKey.OKTA_PASSWORD }\n ] as Authenticator[];\n }\n }\n}\n"],"mappings":";;;;;AAaA;AACA;AAEA;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYO,MAAMA,+BAA+B,SAASC,wCAAmB,CAAwC;EAG9GC,WAAW,CACTC,WAA2B,EAC3BC,MAAiC,GAAG,CAAC,CAAC,EACtCC,OAAyB,GAAG,CAAC,CAAC,EAC9B;IAAA;IACA,KAAK,CAACF,WAAW,EAAEC,MAAM,EAAEC,OAAO,CAAC;;IAEnC;IACA,MAAMC,cAAc,GAAG,IAAI,CAACD,OAAO,CAACE,IAAI,KAAK,iBAAiB;IAC9D,MAAMC,oBAAoB,4BAAG,IAAAC,qCAA+B,EAACN,WAAW,CAAC,CACtEE,OAAO,0DADmB,sBACjBK,IAAI,CAAC,CAAC;MAAEC;IAAU,CAAC,KAAK,CAAAA,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEC,GAAG,MAAKC,uBAAgB,CAACC,aAAa,CAAC;IACtF,IAAIN,oBAAoB,KAAKF,cAAc,IAAI,IAAI,CAACF,MAAM,CAACW,QAAQ,CAAC,EAAE;MACpE,IAAI,CAACX,MAAM,CAACY,cAAc,GAAG,CAC3B,IAAG,IAAI,CAACZ,MAAM,CAACY,cAAc,IAAI,EAAE,GACnC;QAAEJ,GAAG,EAAEC,uBAAgB,CAACC;MAAc,CAAC,CACrB;IACtB;EACF;AACF;AAAC;AAAA,8BArBYd,+BAA+B,qBACjB,mCAAmC"}
1
+ {"version":3,"file":"SelectAuthenticatorAuthenticate.js","names":["SelectAuthenticatorAuthenticate","SelectAuthenticator","constructor","remediation","values","options","isRecoveryFlow","flow","hasPasswordInOptions","getAuthenticatorFromRemediation","some","relatesTo","key","AuthenticatorKey","OKTA_PASSWORD","password","authenticators"],"sources":["../../../../lib/idx/remediators/SelectAuthenticatorAuthenticate.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { SelectAuthenticator, SelectAuthenticatorValues } from './Base/SelectAuthenticator';\nimport { getAuthenticatorFromRemediation } from './util';\nimport { IdxRemediation } from '../types/idx-js';\nimport { AuthenticatorKey, Authenticator, RemediateOptions } from '../types';\n\nexport type SelectAuthenticatorAuthenticateValues = SelectAuthenticatorValues & {\n password?: string;\n};\n\nexport class SelectAuthenticatorAuthenticate extends SelectAuthenticator<SelectAuthenticatorAuthenticateValues> {\n static remediationName = 'select-authenticator-authenticate';\n\n constructor(\n remediation: IdxRemediation, \n values: SelectAuthenticatorValues = {}, \n options: RemediateOptions = {}\n ) {\n super(remediation, values, options);\n\n // Preset password authenticator to trigger recover action\n const isRecoveryFlow = this.options.flow === 'recoverPassword';\n const hasPasswordInOptions = getAuthenticatorFromRemediation(remediation)\n .options?.some(({ relatesTo }) => relatesTo?.key === AuthenticatorKey.OKTA_PASSWORD);\n if (hasPasswordInOptions && (isRecoveryFlow || this.values.password)) {\n this.values.authenticators = [\n ...this.values.authenticators || [],\n { key: AuthenticatorKey.OKTA_PASSWORD }\n ] as Authenticator[];\n }\n }\n}\n"],"mappings":";;;;;AAaA;AACA;AAEA;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYO,MAAMA,+BAA+B,SAASC,wCAAmB,CAAwC;EAG9GC,WAAW,CACTC,WAA2B,EAC3BC,MAAiC,GAAG,CAAC,CAAC,EACtCC,OAAyB,GAAG,CAAC,CAAC,EAC9B;IACA,KAAK,CAACF,WAAW,EAAEC,MAAM,EAAEC,OAAO,CAAC;;IAEnC;IACA,MAAMC,cAAc,GAAG,IAAI,CAACD,OAAO,CAACE,IAAI,KAAK,iBAAiB;IAC9D,MAAMC,oBAAoB,GAAG,IAAAC,qCAA+B,EAACN,WAAW,CAAC,CACtEE,OAAO,EAAEK,IAAI,CAAC,CAAC;MAAEC;IAAU,CAAC,KAAKA,SAAS,EAAEC,GAAG,KAAKC,uBAAgB,CAACC,aAAa,CAAC;IACtF,IAAIN,oBAAoB,KAAKF,cAAc,IAAI,IAAI,CAACF,MAAM,CAACW,QAAQ,CAAC,EAAE;MACpE,IAAI,CAACX,MAAM,CAACY,cAAc,GAAG,CAC3B,IAAG,IAAI,CAACZ,MAAM,CAACY,cAAc,IAAI,EAAE,GACnC;QAAEJ,GAAG,EAAEC,uBAAgB,CAACC;MAAc,CAAC,CACrB;IACtB;EACF;AACF;AAAC;AAAA,8BArBYd,+BAA+B,qBACjB,mCAAmC"}
@@ -28,16 +28,15 @@ class SelectAuthenticatorUnlockAccount extends _SelectAuthenticator.SelectAuthen
28
28
  return !!identifier && super.canRemediate();
29
29
  }
30
30
  mapAuthenticator(remediationValue) {
31
- var _this$selectedOption, _methodTypeOption$opt, _methodTypeOption$opt2;
32
31
  const authenticatorMap = super.mapAuthenticator(remediationValue);
33
- const methodTypeOption = (_this$selectedOption = this.selectedOption) === null || _this$selectedOption === void 0 ? void 0 : _this$selectedOption.value.form.value.find(({
32
+ const methodTypeOption = this.selectedOption?.value.form.value.find(({
34
33
  name
35
34
  }) => name === 'methodType');
36
35
 
37
36
  // defaults to 'manually defined' value
38
37
  // 2nd: option may have pre-defined value, like stateHandle
39
38
  // 3rd: if only a single OV option is available, default to that option
40
- const methodTypeValue = this.values.methodType || (methodTypeOption === null || methodTypeOption === void 0 ? void 0 : methodTypeOption.value) || (methodTypeOption === null || methodTypeOption === void 0 ? void 0 : (_methodTypeOption$opt = methodTypeOption.options) === null || _methodTypeOption$opt === void 0 ? void 0 : (_methodTypeOption$opt2 = _methodTypeOption$opt[0]) === null || _methodTypeOption$opt2 === void 0 ? void 0 : _methodTypeOption$opt2.value);
39
+ const methodTypeValue = this.values.methodType || methodTypeOption?.value || methodTypeOption?.options?.[0]?.value;
41
40
  if (methodTypeValue) {
42
41
  return {
43
42
  ...authenticatorMap,
@@ -1 +1 @@
1
- {"version":3,"file":"SelectAuthenticatorUnlockAccount.js","names":["SelectAuthenticatorUnlockAccount","SelectAuthenticator","identifier","canRemediate","getData","mapAuthenticator","remediationValue","authenticatorMap","methodTypeOption","selectedOption","value","form","find","name","methodTypeValue","values","methodType","options","getInputUsername","type"],"sources":["../../../../lib/idx/remediators/SelectAuthenticatorUnlockAccount.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { SelectAuthenticator, SelectAuthenticatorValues } from './Base/SelectAuthenticator';\nimport { Authenticator } from '../types';\nimport { IdxRemediationValue } from '../types/idx-js';\n\n\nexport type SelectAuthenticatorUnlockAccountValues = SelectAuthenticatorValues & {\n identifier?: string;\n methodType?: string;\n};\n\nexport class SelectAuthenticatorUnlockAccount extends SelectAuthenticator<SelectAuthenticatorUnlockAccountValues> {\n static remediationName = 'select-authenticator-unlock-account';\n authenticator?: Authenticator;\n\n map = {\n identifier: ['username']\n };\n\n canRemediate() {\n const identifier = this.getData('identifier');\n return !!identifier && super.canRemediate();\n }\n\n mapAuthenticator(remediationValue: IdxRemediationValue) {\n const authenticatorMap = super.mapAuthenticator(remediationValue);\n const methodTypeOption = this.selectedOption?.value.form.value.find(({ name }) => name === 'methodType');\n\n // defaults to 'manually defined' value\n // 2nd: option may have pre-defined value, like stateHandle\n // 3rd: if only a single OV option is available, default to that option\n const methodTypeValue = this.values.methodType ||\n methodTypeOption?.value as string || methodTypeOption?.options?.[0]?.value as string;\n\n if (methodTypeValue) {\n return {\n ...authenticatorMap,\n methodType: methodTypeValue\n };\n }\n\n return authenticatorMap;\n }\n\n getInputUsername () {\n return { name: 'username', type: 'string' };\n }\n\n}\n"],"mappings":";;;;;AAaA;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaO,MAAMA,gCAAgC,SAASC,wCAAmB,CAAyC;EAAA;IAAA;IAAA,2CAI1G;MACJC,UAAU,EAAE,CAAC,UAAU;IACzB,CAAC;EAAA;EAEDC,YAAY,GAAG;IACb,MAAMD,UAAU,GAAG,IAAI,CAACE,OAAO,CAAC,YAAY,CAAC;IAC7C,OAAO,CAAC,CAACF,UAAU,IAAI,KAAK,CAACC,YAAY,EAAE;EAC7C;EAEAE,gBAAgB,CAACC,gBAAqC,EAAE;IAAA;IACtD,MAAMC,gBAAgB,GAAG,KAAK,CAACF,gBAAgB,CAACC,gBAAgB,CAAC;IACjE,MAAME,gBAAgB,2BAAG,IAAI,CAACC,cAAc,yDAAnB,qBAAqBC,KAAK,CAACC,IAAI,CAACD,KAAK,CAACE,IAAI,CAAC,CAAC;MAAEC;IAAK,CAAC,KAAKA,IAAI,KAAK,YAAY,CAAC;;IAExG;IACA;IACA;IACA,MAAMC,eAAe,GAAG,IAAI,CAACC,MAAM,CAACC,UAAU,KAC5CR,gBAAgB,aAAhBA,gBAAgB,uBAAhBA,gBAAgB,CAAEE,KAAK,CAAU,KAAIF,gBAAgB,aAAhBA,gBAAgB,gDAAhBA,gBAAgB,CAAES,OAAO,oFAAzB,sBAA4B,CAAC,CAAC,2DAA9B,uBAAgCP,KAAK,CAAU;IAEtF,IAAII,eAAe,EAAE;MACnB,OAAO;QACL,GAAGP,gBAAgB;QACnBS,UAAU,EAAEF;MACd,CAAC;IACH;IAEA,OAAOP,gBAAgB;EACzB;EAEAW,gBAAgB,GAAI;IAClB,OAAO;MAAEL,IAAI,EAAE,UAAU;MAAEM,IAAI,EAAE;IAAS,CAAC;EAC7C;AAEF;AAAC;AAAA,8BArCYnB,gCAAgC,qBAClB,qCAAqC"}
1
+ {"version":3,"file":"SelectAuthenticatorUnlockAccount.js","names":["SelectAuthenticatorUnlockAccount","SelectAuthenticator","identifier","canRemediate","getData","mapAuthenticator","remediationValue","authenticatorMap","methodTypeOption","selectedOption","value","form","find","name","methodTypeValue","values","methodType","options","getInputUsername","type"],"sources":["../../../../lib/idx/remediators/SelectAuthenticatorUnlockAccount.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { SelectAuthenticator, SelectAuthenticatorValues } from './Base/SelectAuthenticator';\nimport { Authenticator } from '../types';\nimport { IdxRemediationValue } from '../types/idx-js';\n\n\nexport type SelectAuthenticatorUnlockAccountValues = SelectAuthenticatorValues & {\n identifier?: string;\n methodType?: string;\n};\n\nexport class SelectAuthenticatorUnlockAccount extends SelectAuthenticator<SelectAuthenticatorUnlockAccountValues> {\n static remediationName = 'select-authenticator-unlock-account';\n authenticator?: Authenticator;\n\n map = {\n identifier: ['username']\n };\n\n canRemediate() {\n const identifier = this.getData('identifier');\n return !!identifier && super.canRemediate();\n }\n\n mapAuthenticator(remediationValue: IdxRemediationValue) {\n const authenticatorMap = super.mapAuthenticator(remediationValue);\n const methodTypeOption = this.selectedOption?.value.form.value.find(({ name }) => name === 'methodType');\n\n // defaults to 'manually defined' value\n // 2nd: option may have pre-defined value, like stateHandle\n // 3rd: if only a single OV option is available, default to that option\n const methodTypeValue = this.values.methodType ||\n methodTypeOption?.value as string || methodTypeOption?.options?.[0]?.value as string;\n\n if (methodTypeValue) {\n return {\n ...authenticatorMap,\n methodType: methodTypeValue\n };\n }\n\n return authenticatorMap;\n }\n\n getInputUsername () {\n return { name: 'username', type: 'string' };\n }\n\n}\n"],"mappings":";;;;;AAaA;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaO,MAAMA,gCAAgC,SAASC,wCAAmB,CAAyC;EAAA;IAAA;IAAA,2CAI1G;MACJC,UAAU,EAAE,CAAC,UAAU;IACzB,CAAC;EAAA;EAEDC,YAAY,GAAG;IACb,MAAMD,UAAU,GAAG,IAAI,CAACE,OAAO,CAAC,YAAY,CAAC;IAC7C,OAAO,CAAC,CAACF,UAAU,IAAI,KAAK,CAACC,YAAY,EAAE;EAC7C;EAEAE,gBAAgB,CAACC,gBAAqC,EAAE;IACtD,MAAMC,gBAAgB,GAAG,KAAK,CAACF,gBAAgB,CAACC,gBAAgB,CAAC;IACjE,MAAME,gBAAgB,GAAG,IAAI,CAACC,cAAc,EAAEC,KAAK,CAACC,IAAI,CAACD,KAAK,CAACE,IAAI,CAAC,CAAC;MAAEC;IAAK,CAAC,KAAKA,IAAI,KAAK,YAAY,CAAC;;IAExG;IACA;IACA;IACA,MAAMC,eAAe,GAAG,IAAI,CAACC,MAAM,CAACC,UAAU,IAC5CR,gBAAgB,EAAEE,KAAe,IAAIF,gBAAgB,EAAES,OAAO,GAAG,CAAC,CAAC,EAAEP,KAAe;IAEtF,IAAII,eAAe,EAAE;MACnB,OAAO;QACL,GAAGP,gBAAgB;QACnBS,UAAU,EAAEF;MACd,CAAC;IACH;IAEA,OAAOP,gBAAgB;EACzB;EAEAW,gBAAgB,GAAI;IAClB,OAAO;MAAEL,IAAI,EAAE,UAAU;MAAEM,IAAI,EAAE;IAAS,CAAC;EAC7C;AAEF;AAAC;AAAA,8BArCYnB,gCAAgC,qBAClB,qCAAqC"}
@@ -41,13 +41,12 @@ class SelectEnrollmentChannel extends _Remediator.Remediator {
41
41
  };
42
42
  }
43
43
  getData() {
44
- var _this$values$authenti;
45
44
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
46
45
  const remediationValue = this.remediation.value[0].value;
47
46
  return {
48
47
  authenticator: {
49
48
  id: remediationValue.form.value[0].value,
50
- channel: ((_this$values$authenti = this.values.authenticator) === null || _this$values$authenti === void 0 ? void 0 : _this$values$authenti.channel) || this.values.channel
49
+ channel: this.values.authenticator?.channel || this.values.channel
51
50
  },
52
51
  stateHandle: this.values.stateHandle
53
52
  };
@@ -1 +1 @@
1
- {"version":3,"file":"SelectEnrollmentChannel.js","names":["SelectEnrollmentChannel","Remediator","canRemediate","values","channel","authenticator","id","getNextStep","authClient","context","common","currentAuthenticator","value","getData","remediationValue","remediation","form","stateHandle","getValuesAfterProceed","authenticators","filterKey","trimmedValues","Object","keys","filter","valueKey","reduce"],"sources":["../../../../lib/idx/remediators/SelectEnrollmentChannel.ts"],"sourcesContent":["/*!\n * Copyright (c) 2021-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { Remediator, RemediationValues } from './Base/Remediator';\nimport { IdxRemediationValueForm, IdxContext } from '../types/idx-js';\nimport { Authenticator, OktaAuthIdxInterface } from '../types/api';\n\n\nexport type SelectEnrollmentChannelValues = RemediationValues & {\n channel?: string;\n};\n\nexport class SelectEnrollmentChannel extends Remediator<SelectEnrollmentChannelValues> {\n static remediationName = 'select-enrollment-channel';\n\n canRemediate() {\n if (this.values.channel) {\n return true;\n }\n\n if (this.values.authenticator) {\n const { id, channel } = this.values.authenticator as Authenticator;\n if (!!id && !!channel) {\n return true;\n }\n }\n\n return false;\n }\n\n getNextStep(authClient: OktaAuthIdxInterface, context: IdxContext) {\n const common = super.getNextStep(authClient, context);\n const authenticator = context.currentAuthenticator.value;\n return {\n ...common,\n authenticator,\n };\n }\n\n getData() {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const remediationValue = this.remediation!.value![0].value as IdxRemediationValueForm;\n return {\n authenticator: {\n id: remediationValue.form.value[0].value,\n channel: (this.values.authenticator as Authenticator)?.channel || this.values.channel,\n },\n stateHandle: this.values.stateHandle,\n\n };\n }\n\n getValuesAfterProceed(): SelectEnrollmentChannelValues {\n this.values = super.getValuesAfterProceed();\n delete this.values.authenticators; // required to prevent infinite loops from auto-remediating via values\n const filterKey = this.values.channel ? 'channel' : 'authenticator';\n let trimmedValues = Object.keys(this.values).filter(valueKey => valueKey !== filterKey);\n return trimmedValues.reduce((values, valueKey) => ({...values, [valueKey]: this.values[valueKey]}), {});\n }\n}\n"],"mappings":";;;;;AAaA;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYO,MAAMA,uBAAuB,SAASC,sBAAU,CAAgC;EAGrFC,YAAY,GAAG;IACb,IAAI,IAAI,CAACC,MAAM,CAACC,OAAO,EAAE;MACvB,OAAO,IAAI;IACb;IAEA,IAAI,IAAI,CAACD,MAAM,CAACE,aAAa,EAAE;MAC7B,MAAM;QAAEC,EAAE;QAAEF;MAAQ,CAAC,GAAG,IAAI,CAACD,MAAM,CAACE,aAA8B;MAClE,IAAI,CAAC,CAACC,EAAE,IAAI,CAAC,CAACF,OAAO,EAAE;QACrB,OAAO,IAAI;MACb;IACF;IAEA,OAAO,KAAK;EACd;EAEAG,WAAW,CAACC,UAAgC,EAAEC,OAAmB,EAAE;IACjE,MAAMC,MAAM,GAAG,KAAK,CAACH,WAAW,CAACC,UAAU,EAAEC,OAAO,CAAC;IACrD,MAAMJ,aAAa,GAAGI,OAAO,CAACE,oBAAoB,CAACC,KAAK;IACxD,OAAO;MACL,GAAGF,MAAM;MACTL;IACF,CAAC;EACH;EAEAQ,OAAO,GAAG;IAAA;IACR;IACA,MAAMC,gBAAgB,GAAG,IAAI,CAACC,WAAW,CAAEH,KAAK,CAAE,CAAC,CAAC,CAACA,KAAgC;IACrF,OAAO;MACLP,aAAa,EAAE;QACbC,EAAE,EAAEQ,gBAAgB,CAACE,IAAI,CAACJ,KAAK,CAAC,CAAC,CAAC,CAACA,KAAK;QACxCR,OAAO,EAAE,0BAAC,IAAI,CAACD,MAAM,CAACE,aAAa,0DAA1B,sBAA8CD,OAAO,KAAI,IAAI,CAACD,MAAM,CAACC;MAChF,CAAC;MACDa,WAAW,EAAE,IAAI,CAACd,MAAM,CAACc;IAE3B,CAAC;EACH;EAEAC,qBAAqB,GAAkC;IACrD,IAAI,CAACf,MAAM,GAAG,KAAK,CAACe,qBAAqB,EAAE;IAC3C,OAAO,IAAI,CAACf,MAAM,CAACgB,cAAc,CAAC,CAAI;IACtC,MAAMC,SAAS,GAAG,IAAI,CAACjB,MAAM,CAACC,OAAO,GAAG,SAAS,GAAG,eAAe;IACnE,IAAIiB,aAAa,GAAGC,MAAM,CAACC,IAAI,CAAC,IAAI,CAACpB,MAAM,CAAC,CAACqB,MAAM,CAACC,QAAQ,IAAIA,QAAQ,KAAKL,SAAS,CAAC;IACvF,OAAOC,aAAa,CAACK,MAAM,CAAC,CAACvB,MAAM,EAAEsB,QAAQ,MAAM;MAAC,GAAGtB,MAAM;MAAE,CAACsB,QAAQ,GAAG,IAAI,CAACtB,MAAM,CAACsB,QAAQ;IAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;EACzG;AACF;AAAC;AAAA,8BA/CYzB,uBAAuB,qBACT,2BAA2B"}
1
+ {"version":3,"file":"SelectEnrollmentChannel.js","names":["SelectEnrollmentChannel","Remediator","canRemediate","values","channel","authenticator","id","getNextStep","authClient","context","common","currentAuthenticator","value","getData","remediationValue","remediation","form","stateHandle","getValuesAfterProceed","authenticators","filterKey","trimmedValues","Object","keys","filter","valueKey","reduce"],"sources":["../../../../lib/idx/remediators/SelectEnrollmentChannel.ts"],"sourcesContent":["/*!\n * Copyright (c) 2021-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { Remediator, RemediationValues } from './Base/Remediator';\nimport { IdxRemediationValueForm, IdxContext } from '../types/idx-js';\nimport { Authenticator, OktaAuthIdxInterface } from '../types/api';\n\n\nexport type SelectEnrollmentChannelValues = RemediationValues & {\n channel?: string;\n};\n\nexport class SelectEnrollmentChannel extends Remediator<SelectEnrollmentChannelValues> {\n static remediationName = 'select-enrollment-channel';\n\n canRemediate() {\n if (this.values.channel) {\n return true;\n }\n\n if (this.values.authenticator) {\n const { id, channel } = this.values.authenticator as Authenticator;\n if (!!id && !!channel) {\n return true;\n }\n }\n\n return false;\n }\n\n getNextStep(authClient: OktaAuthIdxInterface, context: IdxContext) {\n const common = super.getNextStep(authClient, context);\n const authenticator = context.currentAuthenticator.value;\n return {\n ...common,\n authenticator,\n };\n }\n\n getData() {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const remediationValue = this.remediation!.value![0].value as IdxRemediationValueForm;\n return {\n authenticator: {\n id: remediationValue.form.value[0].value,\n channel: (this.values.authenticator as Authenticator)?.channel || this.values.channel,\n },\n stateHandle: this.values.stateHandle,\n\n };\n }\n\n getValuesAfterProceed(): SelectEnrollmentChannelValues {\n this.values = super.getValuesAfterProceed();\n delete this.values.authenticators; // required to prevent infinite loops from auto-remediating via values\n const filterKey = this.values.channel ? 'channel' : 'authenticator';\n let trimmedValues = Object.keys(this.values).filter(valueKey => valueKey !== filterKey);\n return trimmedValues.reduce((values, valueKey) => ({...values, [valueKey]: this.values[valueKey]}), {});\n }\n}\n"],"mappings":";;;;;AAaA;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYO,MAAMA,uBAAuB,SAASC,sBAAU,CAAgC;EAGrFC,YAAY,GAAG;IACb,IAAI,IAAI,CAACC,MAAM,CAACC,OAAO,EAAE;MACvB,OAAO,IAAI;IACb;IAEA,IAAI,IAAI,CAACD,MAAM,CAACE,aAAa,EAAE;MAC7B,MAAM;QAAEC,EAAE;QAAEF;MAAQ,CAAC,GAAG,IAAI,CAACD,MAAM,CAACE,aAA8B;MAClE,IAAI,CAAC,CAACC,EAAE,IAAI,CAAC,CAACF,OAAO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C;EACzG;AACF;AAAC;AAAA,8BA/CYzB,uBAAuB,qBACT,2BAA2B"}
@@ -17,12 +17,10 @@ exports.titleCase = titleCase;
17
17
  */
18
18
 
19
19
  function getAllValues(idxRemediation) {
20
- var _idxRemediation$value;
21
- return (_idxRemediation$value = idxRemediation.value) === null || _idxRemediation$value === void 0 ? void 0 : _idxRemediation$value.map(r => r.name);
20
+ return idxRemediation.value?.map(r => r.name);
22
21
  }
23
22
  function getRequiredValues(idxRemediation) {
24
- var _idxRemediation$value2;
25
- return (_idxRemediation$value2 = idxRemediation.value) === null || _idxRemediation$value2 === void 0 ? void 0 : _idxRemediation$value2.reduce((required, cur) => {
23
+ return idxRemediation.value?.reduce((required, cur) => {
26
24
  if (cur.required) {
27
25
  required.push(cur.name);
28
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","names":["getAllValues","idxRemediation","value","map","r","name","getRequiredValues","reduce","required","cur","push","titleCase","str","charAt","toUpperCase","substring","getAuthenticatorFromRemediation","remediation","find"],"sources":["../../../../lib/idx/remediators/util.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { IdxRemediation, IdxRemediationValue } from '../types/idx-js';\n\nexport function getAllValues(idxRemediation: IdxRemediation) {\n return idxRemediation.value?.map(r => r.name);\n}\n\nexport function getRequiredValues(idxRemediation: IdxRemediation) {\n return idxRemediation.value?.reduce((required, cur) => {\n if (cur.required) {\n required.push(cur.name as never);\n }\n return required;\n }, []);\n}\n\nexport function titleCase(str: string) {\n return str.charAt(0).toUpperCase() + str.substring(1);\n}\n\nexport function getAuthenticatorFromRemediation(\n remediation: IdxRemediation\n): IdxRemediationValue {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return remediation.value!.find(({ name }) => name === 'authenticator') as IdxRemediationValue;\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIO,SAASA,YAAY,CAACC,cAA8B,EAAE;EAAA;EAC3D,gCAAOA,cAAc,CAACC,KAAK,0DAApB,sBAAsBC,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,IAAI,CAAC;AAC/C;AAEO,SAASC,iBAAiB,CAACL,cAA8B,EAAE;EAAA;EAChE,iCAAOA,cAAc,CAACC,KAAK,2DAApB,uBAAsBK,MAAM,CAAC,CAACC,QAAQ,EAAEC,GAAG,KAAK;IACrD,IAAIA,GAAG,CAACD,QAAQ,EAAE;MAChBA,QAAQ,CAACE,IAAI,CAACD,GAAG,CAACJ,IAAI,CAAU;IAClC;IACA,OAAOG,QAAQ;EACjB,CAAC,EAAE,EAAE,CAAC;AACR;AAEO,SAASG,SAAS,CAACC,GAAW,EAAE;EACrC,OAAOA,GAAG,CAACC,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,EAAE,GAAGF,GAAG,CAACG,SAAS,CAAC,CAAC,CAAC;AACvD;AAEO,SAASC,+BAA+B,CAC7CC,WAA2B,EACN;EACrB;EACA,OAAOA,WAAW,CAACf,KAAK,CAAEgB,IAAI,CAAC,CAAC;IAAEb;EAAK,CAAC,KAAKA,IAAI,KAAK,eAAe,CAAC;AACxE"}
1
+ {"version":3,"file":"util.js","names":["getAllValues","idxRemediation","value","map","r","name","getRequiredValues","reduce","required","cur","push","titleCase","str","charAt","toUpperCase","substring","getAuthenticatorFromRemediation","remediation","find"],"sources":["../../../../lib/idx/remediators/util.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { IdxRemediation, IdxRemediationValue } from '../types/idx-js';\n\nexport function getAllValues(idxRemediation: IdxRemediation) {\n return idxRemediation.value?.map(r => r.name);\n}\n\nexport function getRequiredValues(idxRemediation: IdxRemediation) {\n return idxRemediation.value?.reduce((required, cur) => {\n if (cur.required) {\n required.push(cur.name as never);\n }\n return required;\n }, []);\n}\n\nexport function titleCase(str: string) {\n return str.charAt(0).toUpperCase() + str.substring(1);\n}\n\nexport function getAuthenticatorFromRemediation(\n remediation: IdxRemediation\n): IdxRemediationValue {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return remediation.value!.find(({ name }) => name === 'authenticator') as IdxRemediationValue;\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIO,SAASA,YAAY,CAACC,cAA8B,EAAE;EAC3D,OAAOA,cAAc,CAACC,KAAK,EAAEC,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,IAAI,CAAC;AAC/C;AAEO,SAASC,iBAAiB,CAACL,cAA8B,EAAE;EAChE,OAAOA,cAAc,CAACC,KAAK,EAAEK,MAAM,CAAC,CAACC,QAAQ,EAAEC,GAAG,KAAK;IACrD,IAAIA,GAAG,CAACD,QAAQ,EAAE;MAChBA,QAAQ,CAACE,IAAI,CAACD,GAAG,CAACJ,IAAI,CAAU;IAClC;IACA,OAAOG,QAAQ;EACjB,CAAC,EAAE,EAAE,CAAC;AACR;AAEO,SAASG,SAAS,CAACC,GAAW,EAAE;EACrC,OAAOA,GAAG,CAACC,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,EAAE,GAAGF,GAAG,CAACG,SAAS,CAAC,CAAC,CAAC;AACvD;AAEO,SAASC,+BAA+B,CAC7CC,WAA2B,EACN;EACrB;EACA,OAAOA,WAAW,CAACf,KAAK,CAAEgB,IAAI,CAAC,CAAC;IAAEb;EAAK,CAAC,KAAKA,IAAI,KAAK,eAAe,CAAC;AACxE"}
package/cjs/idx/run.js CHANGED
@@ -34,7 +34,6 @@ function initializeValues(options) {
34
34
  return values;
35
35
  }
36
36
  function initializeData(authClient, data) {
37
- var _authClient$idx$getFl, _authClient$idx;
38
37
  let {
39
38
  options
40
39
  } = data;
@@ -51,10 +50,9 @@ function initializeData(authClient, data) {
51
50
  const status = _types.IdxStatus.PENDING;
52
51
 
53
52
  // certain options can be set by the flow specification
54
- flow = flow || ((_authClient$idx$getFl = (_authClient$idx = authClient.idx).getFlow) === null || _authClient$idx$getFl === void 0 ? void 0 : _authClient$idx$getFl.call(_authClient$idx)) || 'default';
53
+ flow = flow || authClient.idx.getFlow?.() || 'default';
55
54
  if (flow) {
56
- var _authClient$idx$setFl, _authClient$idx2;
57
- (_authClient$idx$setFl = (_authClient$idx2 = authClient.idx).setFlow) === null || _authClient$idx$setFl === void 0 ? void 0 : _authClient$idx$setFl.call(_authClient$idx2, flow);
55
+ authClient.idx.setFlow?.(flow);
58
56
  const flowSpec = (0, _util.getFlowSpecification)(authClient, flow);
59
57
  // Favor option values over flow spec
60
58
  withCredentials = typeof withCredentials !== 'undefined' ? withCredentials : flowSpec.withCredentials;
@@ -103,8 +101,7 @@ async function getDataFromIntrospect(authClient, data) {
103
101
  stateHandle
104
102
  });
105
103
  } else {
106
- var _meta;
107
- let interactionHandle = (_meta = meta) === null || _meta === void 0 ? void 0 : _meta.interactionHandle; // may be undefined
104
+ let interactionHandle = meta?.interactionHandle; // may be undefined
108
105
  if (!interactionHandle) {
109
106
  // start a new transaction
110
107
  authClient.transactionManager.clear();
@@ -251,7 +248,7 @@ async function finalizeData(authClient, data) {
251
248
  } else if (canceled) {
252
249
  status = _types.IdxStatus.CANCELED;
253
250
  shouldClearTransaction = true;
254
- } else if (idxResponse !== null && idxResponse !== void 0 && idxResponse.interactionCode) {
251
+ } else if (idxResponse?.interactionCode) {
255
252
  interactionCode = idxResponse.interactionCode;
256
253
  if (exchangeCodeForTokens === false) {
257
254
  status = _types.IdxStatus.SUCCESS;
@@ -310,7 +307,6 @@ async function run(authClient, options = {}) {
310
307
  ...meta
311
308
  });
312
309
  if (shouldSaveResponse) {
313
- var _context;
314
310
  // Save intermediate idx response in storage to reduce introspect call
315
311
  const {
316
312
  rawIdxState: rawIdxResponse,
@@ -319,8 +315,8 @@ async function run(authClient, options = {}) {
319
315
  authClient.transactionManager.saveIdxResponse({
320
316
  rawIdxResponse,
321
317
  requestDidSucceed,
322
- stateHandle: (_context = idxResponse.context) === null || _context === void 0 ? void 0 : _context.stateHandle,
323
- interactionHandle: meta === null || meta === void 0 ? void 0 : meta.interactionHandle
318
+ stateHandle: idxResponse.context?.stateHandle,
319
+ interactionHandle: meta?.interactionHandle
324
320
  });
325
321
  }
326
322
  }
@@ -1 +1 @@
1
- {"version":3,"file":"run.js","names":["initializeValues","options","knownOptions","values","forEach","option","initializeData","authClient","data","idx","flow","withCredentials","remediators","actions","status","IdxStatus","PENDING","getFlow","setFlow","flowSpec","getFlowSpecification","getDataFromIntrospect","stateHandle","version","state","scopes","recoveryToken","activationToken","maxAge","acrValues","nonce","idxResponse","meta","getSavedTransactionMeta","introspect","interactionHandle","transactionManager","clear","interactResponse","interact","getDataFromRemediate","autoRemediate","step","useGenericRemediator","shouldRemediate","rawIdxState","idxResponseFromRemediation","nextStep","canceled","remediate","getTokens","interactionCode","clientId","codeVerifier","ignoreSignature","redirectUri","urls","tokenResponse","token","exchangeCodeForTokens","tokens","finalizeData","shouldSaveResponse","shouldClearTransaction","clearSharedStorage","enabledFeatures","availableSteps","messages","terminal","requestDidSucceed","stepUp","getEnabledFeatures","getAvailableSteps","getMessagesFromResponse","isTerminalResponse","TERMINAL","hasActions","Object","keys","length","hasErrors","find","msg","class","isTerminalSuccess","CANCELED","SUCCESS","run","error","saveTransactionMeta","rawIdxResponse","saveIdxResponse","context","neededToProceed","proceed"],"sources":["../../../lib/idx/run.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-assertion */\n/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\n/* eslint-disable max-statements, complexity, max-depth */\nimport { interact } from './interact';\nimport { introspect } from './introspect';\nimport { remediate } from './remediate';\nimport { RemediationValues } from './remediators/Base/Remediator';\nimport { \n OktaAuthIdxInterface,\n IdxStatus,\n IdxTransaction,\n IdxFeature,\n NextStep,\n RunOptions,\n IdxTransactionMeta,\n} from './types';\nimport { IdxMessage, IdxResponse } from './types/idx-js';\nimport { getSavedTransactionMeta, saveTransactionMeta } from './transactionMeta';\nimport {\n getAvailableSteps,\n getEnabledFeatures,\n getMessagesFromResponse,\n isTerminalResponse,\n getFlowSpecification\n} from './util';\nimport { Tokens } from '../oidc/types';\nimport { APIError } from '../errors/types';\ndeclare interface RunData {\n options: RunOptions;\n values: RemediationValues;\n status?: IdxStatus;\n tokens?: Tokens;\n nextStep?: NextStep;\n messages?: IdxMessage[];\n error?: APIError | IdxResponse;\n meta?: IdxTransactionMeta;\n enabledFeatures?: IdxFeature[];\n availableSteps?: NextStep[];\n idxResponse?: IdxResponse;\n canceled?: boolean;\n interactionCode?: string;\n shouldSaveResponse?: boolean;\n shouldClearTransaction?: boolean;\n clearSharedStorage?: boolean;\n terminal?: boolean;\n}\n\nfunction initializeValues(options: RunOptions) {\n // remove known options, everything else is assumed to be a value\n const knownOptions = [\n 'flow', \n 'remediators', \n 'actions', \n 'withCredentials', \n 'step',\n 'useGenericRemediator',\n 'exchangeCodeForTokens',\n ];\n const values = { ...options };\n knownOptions.forEach(option => {\n delete values[option];\n });\n return values;\n}\n\nfunction initializeData(authClient: OktaAuthIdxInterface, data: RunData): RunData {\n let { options } = data;\n options = {\n ...authClient.options.idx,\n ...options\n };\n let {\n flow,\n withCredentials,\n remediators,\n actions,\n } = options;\n\n const status = IdxStatus.PENDING;\n\n // certain options can be set by the flow specification\n flow = flow || authClient.idx.getFlow?.() || 'default';\n if (flow) {\n authClient.idx.setFlow?.(flow);\n const flowSpec = getFlowSpecification(authClient, flow);\n // Favor option values over flow spec\n withCredentials = (typeof withCredentials !== 'undefined') ? withCredentials : flowSpec.withCredentials;\n remediators = remediators || flowSpec.remediators;\n actions = actions || flowSpec.actions;\n }\n\n return { \n ...data,\n options: { \n ...options, \n flow, \n withCredentials, \n remediators, \n actions,\n },\n status\n };\n}\n\nasync function getDataFromIntrospect(authClient: OktaAuthIdxInterface, data: RunData): Promise<RunData> {\n const { options } = data;\n const {\n stateHandle,\n withCredentials,\n version,\n state,\n scopes,\n recoveryToken,\n activationToken,\n maxAge,\n acrValues,\n nonce,\n } = options;\n\n let idxResponse;\n let meta = getSavedTransactionMeta(authClient, { state, recoveryToken, activationToken }); // may be undefined\n\n if (stateHandle) {\n idxResponse = await introspect(authClient, { withCredentials, version, stateHandle });\n } else {\n let interactionHandle = meta?.interactionHandle; // may be undefined\n if (!interactionHandle) {\n // start a new transaction\n authClient.transactionManager.clear();\n const interactResponse = await interact(authClient, {\n withCredentials,\n state,\n scopes,\n activationToken,\n recoveryToken,\n maxAge,\n acrValues,\n nonce,\n }); \n interactionHandle = interactResponse.interactionHandle;\n meta = interactResponse.meta;\n }\n \n // Introspect to get idx response\n idxResponse = await introspect(authClient, { withCredentials, version, interactionHandle });\n }\n return { ...data, idxResponse, meta };\n}\n\nasync function getDataFromRemediate(authClient: OktaAuthIdxInterface, data: RunData): Promise<RunData> {\n let {\n idxResponse,\n options,\n values\n } = data;\n\n const {\n autoRemediate,\n remediators,\n actions,\n flow,\n step,\n useGenericRemediator,\n } = options;\n \n const shouldRemediate = (autoRemediate !== false && (remediators || actions || step));\n if (!shouldRemediate) {\n return data;\n }\n\n values = { \n ...values, \n stateHandle: idxResponse!.rawIdxState.stateHandle \n };\n\n // Can we handle the remediations?\n const { \n idxResponse: idxResponseFromRemediation, \n nextStep,\n canceled,\n } = await remediate(\n authClient,\n idxResponse!, \n values, \n {\n remediators,\n actions,\n flow,\n step,\n useGenericRemediator,\n }\n );\n idxResponse = idxResponseFromRemediation;\n\n return { ...data, idxResponse, nextStep, canceled };\n}\n\nasync function getTokens(authClient: OktaAuthIdxInterface, data: RunData): Promise<Tokens> {\n let { meta, idxResponse } = data;\n const { interactionCode } = idxResponse as IdxResponse;\n const {\n clientId,\n codeVerifier,\n ignoreSignature,\n redirectUri,\n urls,\n scopes,\n } = meta as IdxTransactionMeta;\n const tokenResponse = await authClient.token.exchangeCodeForTokens({\n interactionCode,\n clientId,\n codeVerifier,\n ignoreSignature,\n redirectUri,\n scopes\n }, urls);\n return tokenResponse.tokens;\n}\n\nasync function finalizeData(authClient: OktaAuthIdxInterface, data: RunData): Promise<RunData> {\n let {\n options,\n idxResponse,\n canceled,\n status,\n } = data;\n const { exchangeCodeForTokens } = options;\n let shouldSaveResponse = false;\n let shouldClearTransaction = false;\n let clearSharedStorage = true;\n let interactionCode;\n let tokens;\n let enabledFeatures;\n let availableSteps;\n let messages;\n let terminal;\n\n if (idxResponse) {\n shouldSaveResponse = !!(idxResponse.requestDidSucceed || idxResponse.stepUp);\n enabledFeatures = getEnabledFeatures(idxResponse);\n availableSteps = getAvailableSteps(authClient, idxResponse, options.useGenericRemediator);\n messages = getMessagesFromResponse(idxResponse, options);\n terminal = isTerminalResponse(idxResponse);\n }\n\n if (terminal) {\n status = IdxStatus.TERMINAL;\n\n // In most cases a terminal response should not clear transaction data. The user should cancel or skip to continue.\n // A terminal \"success\" is a non-error response with no further actions available.\n // In these narrow cases, saved transaction data should be cleared.\n // One example of a terminal success is when the email verify flow is continued in another tab\n const hasActions = Object.keys(idxResponse!.actions).length > 0;\n const hasErrors = !!messages.find(msg => msg.class === 'ERROR');\n const isTerminalSuccess = !hasActions && !hasErrors && idxResponse!.requestDidSucceed === true;\n if (isTerminalSuccess) {\n shouldClearTransaction = true;\n } else {\n // save response if there are actions available (ignore messages)\n shouldSaveResponse = !!hasActions;\n }\n // leave shared storage intact so the transaction can be continued in another tab\n clearSharedStorage = false;\n } else if (canceled) {\n status = IdxStatus.CANCELED;\n shouldClearTransaction = true;\n } else if (idxResponse?.interactionCode) { \n interactionCode = idxResponse.interactionCode;\n if (exchangeCodeForTokens === false) {\n status = IdxStatus.SUCCESS;\n shouldClearTransaction = false;\n } else {\n tokens = await getTokens(authClient, data);\n status = IdxStatus.SUCCESS;\n shouldClearTransaction = true;\n }\n }\n return {\n ...data,\n status,\n interactionCode,\n tokens,\n shouldSaveResponse,\n shouldClearTransaction,\n clearSharedStorage,\n enabledFeatures,\n availableSteps,\n messages,\n terminal\n };\n}\n\nexport async function run(\n authClient: OktaAuthIdxInterface, \n options: RunOptions = {},\n): Promise<IdxTransaction> {\n let data: RunData = {\n options,\n values: initializeValues(options)\n };\n\n data = initializeData(authClient, data);\n data = await getDataFromIntrospect(authClient, data);\n data = await getDataFromRemediate(authClient, data);\n data = await finalizeData(authClient, data);\n\n const {\n idxResponse,\n meta,\n shouldSaveResponse,\n shouldClearTransaction,\n clearSharedStorage,\n status,\n enabledFeatures,\n availableSteps,\n tokens,\n nextStep,\n messages,\n error,\n interactionCode\n } = data;\n\n if (shouldClearTransaction) {\n authClient.transactionManager.clear({ clearSharedStorage });\n }\n else {\n // ensures state is saved to sessionStorage\n saveTransactionMeta(authClient, { ...meta });\n\n if (shouldSaveResponse) {\n // Save intermediate idx response in storage to reduce introspect call\n const { rawIdxState: rawIdxResponse, requestDidSucceed } = idxResponse!;\n authClient.transactionManager.saveIdxResponse({\n rawIdxResponse,\n requestDidSucceed,\n stateHandle: idxResponse!.context?.stateHandle,\n interactionHandle: meta?.interactionHandle\n });\n }\n }\n \n // copy all fields from idxResponse which are needed by the widget\n const { actions, context, neededToProceed, proceed, rawIdxState, requestDidSucceed, stepUp } = idxResponse || {};\n return {\n status: status!,\n ...(meta && { meta }),\n ...(enabledFeatures && { enabledFeatures }),\n ...(availableSteps && { availableSteps }),\n ...(tokens && { tokens }),\n ...(nextStep && { nextStep }),\n ...(messages && messages.length && { messages }),\n ...(error && { error }),\n ...(stepUp && { stepUp }),\n interactionCode, // if options.exchangeCodeForTokens is false\n\n // from idx-js\n actions: actions!,\n context: context!,\n neededToProceed: neededToProceed!,\n proceed: proceed!,\n rawIdxState: rawIdxState!,\n requestDidSucceed\n };\n}\n"],"mappings":";;;AAeA;AACA;AACA;AAEA;AAUA;AACA;AA9BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;;AA6CA,SAASA,gBAAgB,CAACC,OAAmB,EAAE;EAC7C;EACA,MAAMC,YAAY,GAAG,CACnB,MAAM,EACN,aAAa,EACb,SAAS,EACT,iBAAiB,EACjB,MAAM,EACN,sBAAsB,EACtB,uBAAuB,CACxB;EACD,MAAMC,MAAM,GAAG;IAAE,GAAGF;EAAQ,CAAC;EAC7BC,YAAY,CAACE,OAAO,CAACC,MAAM,IAAI;IAC7B,OAAOF,MAAM,CAACE,MAAM,CAAC;EACvB,CAAC,CAAC;EACF,OAAOF,MAAM;AACf;AAEA,SAASG,cAAc,CAACC,UAAgC,EAAEC,IAAa,EAAW;EAAA;EAChF,IAAI;IAAEP;EAAQ,CAAC,GAAGO,IAAI;EACtBP,OAAO,GAAG;IACR,GAAGM,UAAU,CAACN,OAAO,CAACQ,GAAG;IACzB,GAAGR;EACL,CAAC;EACD,IAAI;IACFS,IAAI;IACJC,eAAe;IACfC,WAAW;IAC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,WAAW,EAAE6C,cAAc;QAAErB;MAAkB,CAAC,GAAGtC,WAAY;MACvExB,UAAU,CAAC6B,kBAAkB,CAACuD,eAAe,CAAC;QAC5CD,cAAc;QACdrB,iBAAiB;QACjB/C,WAAW,cAAES,WAAW,CAAE6D,OAAO,6CAApB,SAAsBtE,WAAW;QAC9Ca,iBAAiB,EAAEH,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEG;MAC3B,CAAC,CAAC;IACJ;EACF;;EAEA;EACA,MAAM;IAAEtB,OAAO;IAAE+E,OAAO;IAAEC,eAAe;IAAEC,OAAO;IAAEjD,WAAW;IAAEwB,iBAAiB;IAAEC;EAAO,CAAC,GAAGvC,WAAW,IAAI,CAAC,CAAC;EAChH,OAAO;IACLjB,MAAM,EAAEA,MAAO;IACf,IAAIkB,IAAI,IAAI;MAAEA;IAAK,CAAC,CAAC;IACrB,IAAIiC,eAAe,IAAI;MAAEA;IAAgB,CAAC,CAAC;IAC3C,IAAIC,cAAc,IAAI;MAAEA;IAAe,CAAC,CAAC;IACzC,IAAIN,MAAM,IAAI;MAAEA;IAAO,CAAC,CAAC;IACzB,IAAIb,QAAQ,IAAI;MAAEA;IAAS,CAAC,CAAC;IAC7B,IAAIoB,QAAQ,IAAIA,QAAQ,CAACY,MAAM,IAAI;MAAEZ;IAAS,CAAC,CAAC;IAChD,IAAIqB,KAAK,IAAI;MAAEA;IAAM,CAAC,CAAC;IACvB,IAAIlB,MAAM,IAAI;MAAEA;IAAO,CAAC,CAAC;IACzBnB,eAAe;IAAE;;IAEjB;IACAtC,OAAO,EAAEA,OAAQ;IACjB+E,OAAO,EAAEA,OAAQ;IACjBC,eAAe,EAAEA,eAAgB;IACjCC,OAAO,EAAEA,OAAQ;IACjBjD,WAAW,EAAEA,WAAY;IACzBwB;EACF,CAAC;AACH"}
1
+ {"version":3,"file":"run.js","names":["initializeValues","options","knownOptions","values","forEach","option","initializeData","authClient","data","idx","flow","withCredentials","remediators","actions","status","IdxStatus","PENDING","getFlow","setFlow","flowSpec","getFlowSpecification","getDataFromIntrospect","stateHandle","version","state","scopes","recoveryToken","activationToken","maxAge","acrValues","nonce","idxResponse","meta","getSavedTransactionMeta","introspect","interactionHandle","transactionManager","clear","interactResponse","interact","getDataFromRemediate","autoRemediate","step","useGenericRemediator","shouldRemediate","rawIdxState","idxResponseFromRemediation","nextStep","canceled","remediate","getTokens","interactionCode","clientId","codeVerifier","ignoreSignature","redirectUri","urls","tokenResponse","token","exchangeCodeForTokens","tokens","finalizeData","shouldSaveResponse","shouldClearTransaction","clearSharedStorage","enabledFeatures","availableSteps","messages","terminal","requestDidSucceed","stepUp","getEnabledFeatures","getAvailableSteps","getMessagesFromResponse","isTerminalResponse","TERMINAL","hasActions","Object","keys","length","hasErrors","find","msg","class","isTerminalSuccess","CANCELED","SUCCESS","run","error","saveTransactionMeta","rawIdxResponse","saveIdxResponse","context","neededToProceed","proceed"],"sources":["../../../lib/idx/run.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-assertion */\n/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\n/* eslint-disable max-statements, complexity, max-depth */\nimport { interact } from './interact';\nimport { introspect } from './introspect';\nimport { remediate } from './remediate';\nimport { RemediationValues } from './remediators/Base/Remediator';\nimport { \n OktaAuthIdxInterface,\n IdxStatus,\n IdxTransaction,\n IdxFeature,\n NextStep,\n RunOptions,\n IdxTransactionMeta,\n} from './types';\nimport { IdxMessage, IdxResponse } from './types/idx-js';\nimport { getSavedTransactionMeta, saveTransactionMeta } from './transactionMeta';\nimport {\n getAvailableSteps,\n getEnabledFeatures,\n getMessagesFromResponse,\n isTerminalResponse,\n getFlowSpecification\n} from './util';\nimport { Tokens } from '../oidc/types';\nimport { APIError } from '../errors/types';\ndeclare interface RunData {\n options: RunOptions;\n values: RemediationValues;\n status?: IdxStatus;\n tokens?: Tokens;\n nextStep?: NextStep;\n messages?: IdxMessage[];\n error?: APIError | IdxResponse;\n meta?: IdxTransactionMeta;\n enabledFeatures?: IdxFeature[];\n availableSteps?: NextStep[];\n idxResponse?: IdxResponse;\n canceled?: boolean;\n interactionCode?: string;\n shouldSaveResponse?: boolean;\n shouldClearTransaction?: boolean;\n clearSharedStorage?: boolean;\n terminal?: boolean;\n}\n\nfunction initializeValues(options: RunOptions) {\n // remove known options, everything else is assumed to be a value\n const knownOptions = [\n 'flow', \n 'remediators', \n 'actions', \n 'withCredentials', \n 'step',\n 'useGenericRemediator',\n 'exchangeCodeForTokens',\n ];\n const values = { ...options };\n knownOptions.forEach(option => {\n delete values[option];\n });\n return values;\n}\n\nfunction initializeData(authClient: OktaAuthIdxInterface, data: RunData): RunData {\n let { options } = data;\n options = {\n ...authClient.options.idx,\n ...options\n };\n let {\n flow,\n withCredentials,\n remediators,\n actions,\n } = options;\n\n const status = IdxStatus.PENDING;\n\n // certain options can be set by the flow specification\n flow = flow || authClient.idx.getFlow?.() || 'default';\n if (flow) {\n authClient.idx.setFlow?.(flow);\n const flowSpec = getFlowSpecification(authClient, flow);\n // Favor option values over flow spec\n withCredentials = (typeof withCredentials !== 'undefined') ? withCredentials : flowSpec.withCredentials;\n remediators = remediators || flowSpec.remediators;\n actions = actions || flowSpec.actions;\n }\n\n return { \n ...data,\n options: { \n ...options, \n flow, \n withCredentials, \n remediators, \n actions,\n },\n status\n };\n}\n\nasync function getDataFromIntrospect(authClient: OktaAuthIdxInterface, data: RunData): Promise<RunData> {\n const { options } = data;\n const {\n stateHandle,\n withCredentials,\n version,\n state,\n scopes,\n recoveryToken,\n activationToken,\n maxAge,\n acrValues,\n nonce,\n } = options;\n\n let idxResponse;\n let meta = getSavedTransactionMeta(authClient, { state, recoveryToken, activationToken }); // may be undefined\n\n if (stateHandle) {\n idxResponse = await introspect(authClient, { withCredentials, version, stateHandle });\n } else {\n let interactionHandle = meta?.interactionHandle; // may be undefined\n if (!interactionHandle) {\n // start a new transaction\n authClient.transactionManager.clear();\n const interactResponse = await interact(authClient, {\n withCredentials,\n state,\n scopes,\n activationToken,\n recoveryToken,\n maxAge,\n acrValues,\n nonce,\n }); \n interactionHandle = interactResponse.interactionHandle;\n meta = interactResponse.meta;\n }\n \n // Introspect to get idx response\n idxResponse = await introspect(authClient, { withCredentials, version, interactionHandle });\n }\n return { ...data, idxResponse, meta };\n}\n\nasync function getDataFromRemediate(authClient: OktaAuthIdxInterface, data: RunData): Promise<RunData> {\n let {\n idxResponse,\n options,\n values\n } = data;\n\n const {\n autoRemediate,\n remediators,\n actions,\n flow,\n step,\n useGenericRemediator,\n } = options;\n \n const shouldRemediate = (autoRemediate !== false && (remediators || actions || step));\n if (!shouldRemediate) {\n return data;\n }\n\n values = { \n ...values, \n stateHandle: idxResponse!.rawIdxState.stateHandle \n };\n\n // Can we handle the remediations?\n const { \n idxResponse: idxResponseFromRemediation, \n nextStep,\n canceled,\n } = await remediate(\n authClient,\n idxResponse!, \n values, \n {\n remediators,\n actions,\n flow,\n step,\n useGenericRemediator,\n }\n );\n idxResponse = idxResponseFromRemediation;\n\n return { ...data, idxResponse, nextStep, canceled };\n}\n\nasync function getTokens(authClient: OktaAuthIdxInterface, data: RunData): Promise<Tokens> {\n let { meta, idxResponse } = data;\n const { interactionCode } = idxResponse as IdxResponse;\n const {\n clientId,\n codeVerifier,\n ignoreSignature,\n redirectUri,\n urls,\n scopes,\n } = meta as IdxTransactionMeta;\n const tokenResponse = await authClient.token.exchangeCodeForTokens({\n interactionCode,\n clientId,\n codeVerifier,\n ignoreSignature,\n redirectUri,\n scopes\n }, urls);\n return tokenResponse.tokens;\n}\n\nasync function finalizeData(authClient: OktaAuthIdxInterface, data: RunData): Promise<RunData> {\n let {\n options,\n idxResponse,\n canceled,\n status,\n } = data;\n const { exchangeCodeForTokens } = options;\n let shouldSaveResponse = false;\n let shouldClearTransaction = false;\n let clearSharedStorage = true;\n let interactionCode;\n let tokens;\n let enabledFeatures;\n let availableSteps;\n let messages;\n let terminal;\n\n if (idxResponse) {\n shouldSaveResponse = !!(idxResponse.requestDidSucceed || idxResponse.stepUp);\n enabledFeatures = getEnabledFeatures(idxResponse);\n availableSteps = getAvailableSteps(authClient, idxResponse, options.useGenericRemediator);\n messages = getMessagesFromResponse(idxResponse, options);\n terminal = isTerminalResponse(idxResponse);\n }\n\n if (terminal) {\n status = IdxStatus.TERMINAL;\n\n // In most cases a terminal response should not clear transaction data. The user should cancel or skip to continue.\n // A terminal \"success\" is a non-error response with no further actions available.\n // In these narrow cases, saved transaction data should be cleared.\n // One example of a terminal success is when the email verify flow is continued in another tab\n const hasActions = Object.keys(idxResponse!.actions).length > 0;\n const hasErrors = !!messages.find(msg => msg.class === 'ERROR');\n const isTerminalSuccess = !hasActions && !hasErrors && idxResponse!.requestDidSucceed === true;\n if (isTerminalSuccess) {\n shouldClearTransaction = true;\n } else {\n // save response if there are actions available (ignore messages)\n shouldSaveResponse = !!hasActions;\n }\n // leave shared storage intact so the transaction can be continued in another tab\n clearSharedStorage = false;\n } else if (canceled) {\n status = IdxStatus.CANCELED;\n shouldClearTransaction = true;\n } else if (idxResponse?.interactionCode) { \n interactionCode = idxResponse.interactionCode;\n if (exchangeCodeForTokens === false) {\n status = IdxStatus.SUCCESS;\n shouldClearTransaction = false;\n } else {\n tokens = await getTokens(authClient, data);\n status = IdxStatus.SUCCESS;\n shouldClearTransaction = true;\n }\n }\n return {\n ...data,\n status,\n interactionCode,\n tokens,\n shouldSaveResponse,\n shouldClearTransaction,\n clearSharedStorage,\n enabledFeatures,\n availableSteps,\n messages,\n terminal\n };\n}\n\nexport async function run(\n authClient: OktaAuthIdxInterface, \n options: RunOptions = {},\n): Promise<IdxTransaction> {\n let data: RunData = {\n options,\n values: initializeValues(options)\n };\n\n data = initializeData(authClient, data);\n data = await getDataFromIntrospect(authClient, data);\n data = await getDataFromRemediate(authClient, data);\n data = await finalizeData(authClient, data);\n\n const {\n idxResponse,\n meta,\n shouldSaveResponse,\n shouldClearTransaction,\n clearSharedStorage,\n status,\n enabledFeatures,\n availableSteps,\n tokens,\n nextStep,\n messages,\n error,\n interactionCode\n } = data;\n\n if (shouldClearTransaction) {\n authClient.transactionManager.clear({ clearSharedStorage });\n }\n else {\n // ensures state is saved to sessionStorage\n saveTransactionMeta(authClient, { ...meta });\n\n if (shouldSaveResponse) {\n // Save intermediate idx response in storage to reduce introspect call\n const { rawIdxState: rawIdxResponse, requestDidSucceed } = idxResponse!;\n authClient.transactionManager.saveIdxResponse({\n rawIdxResponse,\n requestDidSucceed,\n stateHandle: idxResponse!.context?.stateHandle,\n interactionHandle: meta?.interactionHandle\n });\n }\n }\n \n // copy all fields from idxResponse which are needed by the widget\n const { actions, context, neededToProceed, proceed, rawIdxState, requestDidSucceed, stepUp } = idxResponse || {};\n return {\n status: status!,\n ...(meta && { meta }),\n ...(enabledFeatures && { enabledFeatures }),\n ...(availableSteps && { availableSteps }),\n ...(tokens && { tokens }),\n ...(nextStep && { nextStep }),\n ...(messages && messages.length && { messages }),\n ...(error && { error }),\n ...(stepUp && { stepUp }),\n interactionCode, // if options.exchangeCodeForTokens is false\n\n // from idx-js\n actions: actions!,\n context: context!,\n neededToProceed: neededToProceed!,\n proceed: proceed!,\n rawIdxState: rawIdxState!,\n requestDidSucceed\n };\n}\n"],"mappings":";;;AAeA;AACA;AACA;AAEA;AAUA;AACA;AA9BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;;AA6CA,SAASA,gBAAgB,CAACC,OAAmB,EAAE;EAC7C;EACA,MAAMC,YAAY,GAAG,CACnB,MAAM,EACN,aAAa,EACb,SAAS,EACT,iBAAiB,EACjB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AEA;IAAO,CAAC,CAAC;IACzBnB,eAAe;IAAE;;IAEjB;IACAtC,OAAO,EAAEA,OAAQ;IACjB+E,OAAO,EAAEA,OAAQ;IACjBC,eAAe,EAAEA,eAAgB;IACjCC,OAAO,EAAEA,OAAQ;IACjBjD,WAAW,EAAEA,WAAY;IACzBwB;EACF,CAAC;AACH"}
@@ -53,7 +53,7 @@ async function createTransactionMeta(authClient, options = {}) {
53
53
  }
54
54
  function hasSavedInteractionHandle(authClient, options) {
55
55
  const savedMeta = getSavedTransactionMeta(authClient, options);
56
- if (savedMeta !== null && savedMeta !== void 0 && savedMeta.interactionHandle) {
56
+ if (savedMeta?.interactionHandle) {
57
57
  return true;
58
58
  }
59
59
  return false;
@@ -1 +1 @@
1
- {"version":3,"file":"transactionMeta.js","names":["createTransactionMeta","authClient","options","tokenParams","token","prepareTokenParams","pkceMeta","createOAuthMeta","flow","withCredentials","activationToken","undefined","recoveryToken","maxAge","acrValues","meta","hasSavedInteractionHandle","savedMeta","getSavedTransactionMeta","interactionHandle","removeNils","transactionManager","load","e","isTransactionMetaValid","warn","getTransactionMeta","validExistingMeta","saveTransactionMeta","save","muteWarning","clearTransactionMeta","clear","keys","isTransactionMetaValidForOptions","isTransactionMetaValidForFlow","shouldValidateFlow","mismatch","some","key","value"],"sources":["../../../lib/idx/transactionMeta.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-assertion */\n/*!\n * Copyright (c) 2021, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { OktaAuthIdxInterface, IdxTransactionMeta, IdxTransactionMetaOptions } from './types';\nimport { removeNils, warn } from '../util';\nimport { createOAuthMeta, PKCETransactionMeta } from '../oidc';\n\n// Calculate new values\nexport async function createTransactionMeta(\n authClient: OktaAuthIdxInterface,\n options: IdxTransactionMetaOptions = {}\n): Promise<IdxTransactionMeta> {\n const tokenParams = await authClient.token.prepareTokenParams(options);\n const pkceMeta = createOAuthMeta(authClient, tokenParams) as PKCETransactionMeta;\n let {\n flow = 'default',\n withCredentials = true,\n activationToken = undefined,\n recoveryToken = undefined,\n maxAge = undefined,\n acrValues = undefined,\n } = { ...authClient.options, ...options }; // local options override SDK options\n\n const meta: IdxTransactionMeta = {\n ...pkceMeta,\n flow,\n withCredentials,\n activationToken,\n recoveryToken,\n maxAge,\n acrValues\n };\n return meta;\n}\n\nexport function hasSavedInteractionHandle(\n authClient: OktaAuthIdxInterface,\n options?: IdxTransactionMetaOptions\n): boolean {\n const savedMeta = getSavedTransactionMeta(authClient, options);\n if (savedMeta?.interactionHandle) {\n return true;\n }\n return false;\n}\n\n// Returns the saved transaction meta, if it exists and is valid\nexport function getSavedTransactionMeta(\n authClient: OktaAuthIdxInterface,\n options?: IdxTransactionMetaOptions\n): IdxTransactionMeta | undefined {\n options = removeNils(options);\n options = { ...authClient.options, ...options }; // local options override SDK options\n let savedMeta;\n try {\n savedMeta = authClient.transactionManager.load(options) as IdxTransactionMeta;\n } catch (e) {\n // ignore errors here\n }\n\n if (!savedMeta) {\n return;\n }\n\n if (isTransactionMetaValid(savedMeta, options)) {\n return savedMeta;\n }\n\n // existing meta is not valid for this configuration\n // this is common when changing configuration in local development environment\n // in a production environment, this may indicate that two apps are sharing a storage key\n warn('Saved transaction meta does not match the current configuration. ' + \n 'This may indicate that two apps are sharing a storage key.');\n\n}\n\nexport async function getTransactionMeta(\n authClient: OktaAuthIdxInterface,\n options?: IdxTransactionMetaOptions\n): Promise<IdxTransactionMeta> {\n options = removeNils(options);\n options = { ...authClient.options, ...options }; // local options override SDK options\n // Load existing transaction meta from storage\n const validExistingMeta = getSavedTransactionMeta(authClient, options);\n if (validExistingMeta) {\n return validExistingMeta;\n }\n // No existing? Create new transaction meta.\n return createTransactionMeta(authClient, options);\n}\n\nexport function saveTransactionMeta (authClient: OktaAuthIdxInterface, meta): void {\n authClient.transactionManager.save(meta, { muteWarning: true });\n}\n\nexport function clearTransactionMeta (authClient: OktaAuthIdxInterface): void {\n authClient.transactionManager.clear();\n}\n\nexport function isTransactionMetaValid (meta, options: IdxTransactionMetaOptions = {}): boolean {\n // Validate against certain options. If these exist in options, they must match in meta\n const keys = [\n 'issuer',\n 'clientId',\n 'redirectUri',\n 'state',\n 'codeChallenge',\n 'codeChallengeMethod',\n 'activationToken',\n 'recoveryToken'\n ];\n if (isTransactionMetaValidForOptions(meta, options, keys) === false) {\n return false;\n }\n\n // Validate configured flow\n const { flow } = options;\n if (isTransactionMetaValidForFlow(meta, flow) === false) {\n return false;\n }\n\n return true;\n}\n\nexport function isTransactionMetaValidForFlow(meta, flow) {\n // Specific flows should not share transaction data\n const shouldValidateFlow = flow && flow !== 'default' && flow !== 'proceed';\n if (shouldValidateFlow) {\n if (flow !== meta.flow) {\n // The flow has changed; abandon the old transaction\n return false;\n }\n }\n return true;\n}\n\nexport function isTransactionMetaValidForOptions(meta, options, keys) {\n // returns false if values in meta do not match options\n // if the option does not have a value for a specific key, it is ignored\n const mismatch = keys.some(key => {\n const value = options[key];\n if (value && value !== meta[key]) {\n return true;\n }\n });\n return !mismatch;\n}\n"],"mappings":";;;;;;;;;;;AAcA;AACA;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACO,eAAeA,qBAAqB,CACzCC,UAAgC,EAChCC,OAAkC,GAAG,CAAC,CAAC,EACV;EAC7B,MAAMC,WAAW,GAAG,MAAMF,UAAU,CAACG,KAAK,CAACC,kBAAkB,CAACH,OAAO,CAAC;EACtE,MAAMI,QAAQ,GAAG,IAAAC,qBAAe,EAACN,UAAU,EAAEE,WAAW,CAAwB;EAChF,IA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I,KAAK,SAAS;EAC3E,IAAI4B,kBAAkB,EAAE;IACtB,IAAI5B,IAAI,KAAKO,IAAI,CAACP,IAAI,EAAE;MACtB;MACA,OAAO,KAAK;IACd;EACF;EACA,OAAO,IAAI;AACb;AAEO,SAAS0B,gCAAgC,CAACnB,IAAI,EAAEb,OAAO,EAAE+B,IAAI,EAAE;EACpE;EACA;EACA,MAAMI,QAAQ,GAAGJ,IAAI,CAACK,IAAI,CAACC,GAAG,IAAI;IAChC,MAAMC,KAAK,GAAGtC,OAAO,CAACqC,GAAG,CAAC;IAC1B,IAAIC,KAAK,IAAIA,KAAK,KAAKzB,IAAI,CAACwB,GAAG,CAAC,EAAE;MAChC,OAAO,IAAI;IACb;EACF,CAAC,CAAC;EACF,OAAO,CAACF,QAAQ;AAClB"}
1
+ {"version":3,"file":"transactionMeta.js","names":["createTransactionMeta","authClient","options","tokenParams","token","prepareTokenParams","pkceMeta","createOAuthMeta","flow","withCredentials","activationToken","undefined","recoveryToken","maxAge","acrValues","meta","hasSavedInteractionHandle","savedMeta","getSavedTransactionMeta","interactionHandle","removeNils","transactionManager","load","e","isTransactionMetaValid","warn","getTransactionMeta","validExistingMeta","saveTransactionMeta","save","muteWarning","clearTransactionMeta","clear","keys","isTransactionMetaValidForOptions","isTransactionMetaValidForFlow","shouldValidateFlow","mismatch","some","key","value"],"sources":["../../../lib/idx/transactionMeta.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-assertion */\n/*!\n * Copyright (c) 2021, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { OktaAuthIdxInterface, IdxTransactionMeta, IdxTransactionMetaOptions } from './types';\nimport { removeNils, warn } from '../util';\nimport { createOAuthMeta, PKCETransactionMeta } from '../oidc';\n\n// Calculate new values\nexport async function createTransactionMeta(\n authClient: OktaAuthIdxInterface,\n options: IdxTransactionMetaOptions = {}\n): Promise<IdxTransactionMeta> {\n const tokenParams = await authClient.token.prepareTokenParams(options);\n const pkceMeta = createOAuthMeta(authClient, tokenParams) as PKCETransactionMeta;\n let {\n flow = 'default',\n withCredentials = true,\n activationToken = undefined,\n recoveryToken = undefined,\n maxAge = undefined,\n acrValues = undefined,\n } = { ...authClient.options, ...options }; // local options override SDK options\n\n const meta: IdxTransactionMeta = {\n ...pkceMeta,\n flow,\n withCredentials,\n activationToken,\n recoveryToken,\n maxAge,\n acrValues\n };\n return meta;\n}\n\nexport function hasSavedInteractionHandle(\n authClient: OktaAuthIdxInterface,\n options?: IdxTransactionMetaOptions\n): boolean {\n const savedMeta = getSavedTransactionMeta(authClient, options);\n if (savedMeta?.interactionHandle) {\n return true;\n }\n return false;\n}\n\n// Returns the saved transaction meta, if it exists and is valid\nexport function getSavedTransactionMeta(\n authClient: OktaAuthIdxInterface,\n options?: IdxTransactionMetaOptions\n): IdxTransactionMeta | undefined {\n options = removeNils(options);\n options = { ...authClient.options, ...options }; // local options override SDK options\n let savedMeta;\n try {\n savedMeta = authClient.transactionManager.load(options) as IdxTransactionMeta;\n } catch (e) {\n // ignore errors here\n }\n\n if (!savedMeta) {\n return;\n }\n\n if (isTransactionMetaValid(savedMeta, options)) {\n return savedMeta;\n }\n\n // existing meta is not valid for this configuration\n // this is common when changing configuration in local development environment\n // in a production environment, this may indicate that two apps are sharing a storage key\n warn('Saved transaction meta does not match the current configuration. ' + \n 'This may indicate that two apps are sharing a storage key.');\n\n}\n\nexport async function getTransactionMeta(\n authClient: OktaAuthIdxInterface,\n options?: IdxTransactionMetaOptions\n): Promise<IdxTransactionMeta> {\n options = removeNils(options);\n options = { ...authClient.options, ...options }; // local options override SDK options\n // Load existing transaction meta from storage\n const validExistingMeta = getSavedTransactionMeta(authClient, options);\n if (validExistingMeta) {\n return validExistingMeta;\n }\n // No existing? Create new transaction meta.\n return createTransactionMeta(authClient, options);\n}\n\nexport function saveTransactionMeta (authClient: OktaAuthIdxInterface, meta): void {\n authClient.transactionManager.save(meta, { muteWarning: true });\n}\n\nexport function clearTransactionMeta (authClient: OktaAuthIdxInterface): void {\n authClient.transactionManager.clear();\n}\n\nexport function isTransactionMetaValid (meta, options: IdxTransactionMetaOptions = {}): boolean {\n // Validate against certain options. If these exist in options, they must match in meta\n const keys = [\n 'issuer',\n 'clientId',\n 'redirectUri',\n 'state',\n 'codeChallenge',\n 'codeChallengeMethod',\n 'activationToken',\n 'recoveryToken'\n ];\n if (isTransactionMetaValidForOptions(meta, options, keys) === false) {\n return false;\n }\n\n // Validate configured flow\n const { flow } = options;\n if (isTransactionMetaValidForFlow(meta, flow) === false) {\n return false;\n }\n\n return true;\n}\n\nexport function isTransactionMetaValidForFlow(meta, flow) {\n // Specific flows should not share transaction data\n const shouldValidateFlow = flow && flow !== 'default' && flow !== 'proceed';\n if (shouldValidateFlow) {\n if (flow !== meta.flow) {\n // The flow has changed; abandon the old transaction\n return false;\n }\n }\n return true;\n}\n\nexport function isTransactionMetaValidForOptions(meta, options, keys) {\n // returns false if values in meta do not match options\n // if the option does not have a value for a specific key, it is ignored\n const mismatch = keys.some(key => {\n const value = options[key];\n if (value && value !== meta[key]) {\n return true;\n }\n });\n return !mismatch;\n}\n"],"mappings":";;;;;;;;;;;AAcA;AACA;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACO,eAAeA,qBAAqB,CACzCC,UAAgC,EAChCC,OAAkC,GAAG,CAAC,CAAC,EACV;EAC7B,MAAMC,WAAW,GAAG,MAAMF,UAAU,CAACG,KAAK,CAACC,kBAAkB,CAACH,OAAO,CAAC;EACtE,MAAMI,QAAQ,GAAG,IAAAC,qBAAe,EAACN,UA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AIA,IAAI,KAAK,SAAS;EAC3E,IAAI4B,kBAAkB,EAAE;IACtB,IAAI5B,IAAI,KAAKO,IAAI,CAACP,IAAI,EAAE;MACtB;MACA,OAAO,KAAK;IACd;EACF;EACA,OAAO,IAAI;AACb;AAEO,SAAS0B,gCAAgC,CAACnB,IAAI,EAAEb,OAAO,EAAE+B,IAAI,EAAE;EACpE;EACA;EACA,MAAMI,QAAQ,GAAGJ,IAAI,CAACK,IAAI,CAACC,GAAG,IAAI;IAChC,MAAMC,KAAK,GAAGtC,OAAO,CAACqC,GAAG,CAAC;IAC1B,IAAIC,KAAK,IAAIA,KAAK,KAAKzB,IAAI,CAACwB,GAAG,CAAC,EAAE;MAChC,OAAO,IAAI;IACb;EACF,CAAC,CAAC;EACF,OAAO,CAACF,QAAQ;AAClB"}
@@ -1 +1 @@
1
- {"version":3,"file":"idx-js.js","names":["isRawIdxResponse","obj","version","isIdxResponse","rawIdxState"],"sources":["../../../../lib/idx/types/idx-js.ts"],"sourcesContent":["/* eslint-disable no-use-before-define */\n/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { Input } from './api';\n\n\n// TODO: remove when idx-js provides type information\n\nexport interface ChallengeData {\n challenge: string; \n userVerification: string; \n extensions?: {\n appid: string;\n };\n}\nexport interface ActivationData {\n challenge: string;\n rp: {\n name: string;\n };\n user: {\n id: string;\n name: string;\n displayName: string;\n };\n pubKeyCredParams: {\n type: string;\n alg: number;\n }[];\n attestation?: string;\n authenticatorSelection?: {\n userVerification?: string;\n authenticatorAttachment?: string;\n requireResidentKey?: boolean;\n residentKey?: string;\n };\n excludeCredentials?: {\n id: string;\n type: string;\n }[];\n}\nexport interface IdxAuthenticatorMethod {\n type: string;\n}\nexport interface IdxAuthenticator {\n displayName: string;\n id: string;\n key: string;\n methods: IdxAuthenticatorMethod[];\n type: string;\n settings?: {\n complexity?: unknown;\n age?: unknown;\n };\n contextualData?: {\n enrolledQuestion?: {\n question: string;\n questionKey: string;\n };\n qrcode?: { \n href: string; \n method: string; \n type: string; \n };\n sharedSecret?: string;\n questions?: {\n questionKey: string;\n question: string;\n }[];\n questionKeys?: string[];\n selectedChannel?: string;\n activationData?: ActivationData;\n challengeData?: ChallengeData;\n };\n credentialId?: string;\n enrollmentId?: string;\n profile?: Record<string, unknown>;\n resend?: Record<string, unknown>;\n poll?: Record<string, unknown>;\n recover?: Record<string, unknown>;\n deviceKnown?: boolean;\n}\n\nexport interface IdxForm {\n value: IdxRemediationValue[];\n}\n\nexport interface IdxOption {\n value: string | {form: IdxForm} | Input[];\n label: string;\n relatesTo?: IdxAuthenticator;\n}\n\nexport interface IdpConfig {\n id: string;\n name: string;\n}\n\nexport interface IdxRemediationValueForm {\n form: IdxForm;\n}\n\nexport interface IdxRemediationValue {\n name: string;\n type?: string;\n required?: boolean;\n secret?: boolean;\n visible?: boolean;\n mutable?: boolean;\n value?: string | IdxRemediationValueForm;\n label?: string;\n form?: IdxForm;\n options?: IdxOption[];\n messages?: IdxMessages;\n minLength?: number;\n maxLength?: number;\n relatesTo?: {\n type?: string;\n value: IdxAuthenticator;\n };\n}\n\nexport interface IdxRemediation {\n name: string;\n label?: string;\n value?: IdxRemediationValue[];\n relatesTo?: {\n type?: string;\n value: IdxAuthenticator;\n };\n idp?: IdpConfig;\n href?: string;\n method?: string;\n type?: string;\n accepts?: string;\n produces?: string;\n refresh?: number;\n rel?: string[];\n action?: (payload?: IdxActionParams) => Promise<IdxResponse>;\n}\n\nexport interface IdxContext {\n version: string;\n stateHandle: string;\n expiresAt: string;\n intent: string;\n currentAuthenticator: {\n type: string;\n value: IdxAuthenticator;\n };\n currentAuthenticatorEnrollment: {\n type: string;\n value: IdxAuthenticator;\n };\n authenticators: {\n type: string;\n value: IdxAuthenticator[];\n };\n authenticatorEnrollments: {\n type: string;\n value: IdxAuthenticator[];\n };\n enrollmentAuthenticator: {\n type: string;\n value: IdxAuthenticator;\n };\n user?: {\n type: string;\n value: Record<string, unknown>;\n };\n uiDisplay?: IdxContextUIDisplay\n app: {\n type: string;\n value: Record<string, unknown>;\n };\n messages?: IdxMessages;\n success?: IdxRemediation;\n failure?: IdxRemediation;\n}\n\nexport interface IdxContextUIDisplay {\n type: string;\n value: {\n label?: string;\n buttonLabel?: string;\n }\n}\n\nexport interface IdxMessage {\n message: string;\n class: string;\n i18n: {\n key: string;\n params?: unknown[];\n };\n}\n\nexport interface IdxMessages {\n type: 'array';\n value: IdxMessage[];\n}\n\n// JSON response from the server\nexport interface RawIdxResponse {\n version: string;\n stateHandle: string;\n intent?: string;\n expiresAt?: string;\n remediation?: {\n type: 'array';\n value: IdxRemediation[];\n };\n messages?: IdxMessages;\n success?: boolean;\n successWithInteractionCode?: IdxRemediation;\n currentAuthenticator?: {\n type: string;\n value: IdxAuthenticator;\n };\n currentAuthenticatorEnrollment?: {\n type: string;\n value: IdxAuthenticator;\n };\n}\n\nexport function isRawIdxResponse(obj: any): obj is RawIdxResponse {\n return obj && obj.version;\n}\n\nexport interface IdxActionParams {\n [key: string]: string | boolean | number | object;\n}\n\nexport interface IdxActions {\n [key: string]: (params?: IdxActionParams) => Promise<IdxResponse>;\n}\n\nexport interface IdxToPersist {\n interactionHandle?: string;\n withCredentials?: boolean;\n}\n\nexport interface IdxActionFunction {\n (params: IdxActionParams): Promise<IdxResponse>;\n neededParams?: Array<Array<IdxRemediationValue>>;\n}\n\nexport interface IdxResponse {\n proceed: (remediationName: string, params: unknown) => Promise<IdxResponse>;\n neededToProceed: IdxRemediation[];\n rawIdxState: RawIdxResponse;\n interactionCode?: string;\n actions: IdxActions;\n toPersist: IdxToPersist;\n context?: IdxContext;\n requestDidSucceed?: boolean;\n stepUp?: boolean;\n}\n\nexport function isIdxResponse(obj: any): obj is IdxResponse {\n return obj && isRawIdxResponse(obj.rawIdxState);\n}\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;;AAoMA;;AAuBO,SAASA,gBAAgB,CAACC,GAAQ,EAAyB;EAChE,OAAOA,GAAG,IAAIA,GAAG,CAACC,OAAO;AAC3B;AAgCO,SAASC,aAAa,CAACF,GAAQ,EAAsB;EAC1D,OAAOA,GAAG,IAAID,gBAAgB,CAACC,GAAG,CAACG,WAAW,CAAC;AACjD"}
1
+ {"version":3,"file":"idx-js.js","names":["isRawIdxResponse","obj","version","isIdxResponse","rawIdxState"],"sources":["../../../../lib/idx/types/idx-js.ts"],"sourcesContent":["/* eslint-disable no-use-before-define */\n/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { Input } from './api';\n\n\n// TODO: remove when idx-js provides type information\n\nexport interface ChallengeData {\n challenge: string; \n userVerification: string; \n extensions?: {\n appid: string;\n };\n}\nexport interface ActivationData {\n challenge: string;\n rp: {\n name: string;\n };\n user: {\n id: string;\n name: string;\n displayName: string;\n };\n pubKeyCredParams: {\n type: string;\n alg: number;\n }[];\n attestation?: string;\n authenticatorSelection?: {\n userVerification?: string;\n authenticatorAttachment?: string;\n requireResidentKey?: boolean;\n residentKey?: string;\n };\n excludeCredentials?: {\n id: string;\n type: string;\n }[];\n}\nexport interface IdxAuthenticatorMethod {\n type: string;\n}\nexport interface IdxAuthenticator {\n displayName: string;\n id: string;\n key: string;\n methods: IdxAuthenticatorMethod[];\n type: string;\n settings?: {\n complexity?: unknown;\n age?: unknown;\n };\n contextualData?: {\n enrolledQuestion?: {\n question: string;\n questionKey: string;\n };\n qrcode?: { \n href: string; \n method: string; \n type: string; \n };\n sharedSecret?: string;\n questions?: {\n questionKey: string;\n question: string;\n }[];\n questionKeys?: string[];\n selectedChannel?: string;\n activationData?: ActivationData;\n challengeData?: ChallengeData;\n };\n credentialId?: string;\n enrollmentId?: string;\n profile?: Record<string, unknown>;\n resend?: Record<string, unknown>;\n poll?: Record<string, unknown>;\n recover?: Record<string, unknown>;\n deviceKnown?: boolean;\n nickname?: string;\n}\n\nexport interface IdxForm {\n value: IdxRemediationValue[];\n}\n\nexport interface IdxOption {\n value: string | {form: IdxForm} | Input[];\n label: string;\n relatesTo?: IdxAuthenticator;\n}\n\nexport interface IdpConfig {\n id: string;\n name: string;\n}\n\nexport interface IdxRemediationValueForm {\n form: IdxForm;\n}\n\nexport interface IdxRemediationValue {\n name: string;\n type?: string;\n required?: boolean;\n secret?: boolean;\n visible?: boolean;\n mutable?: boolean;\n value?: string | IdxRemediationValueForm;\n label?: string;\n form?: IdxForm;\n options?: IdxOption[];\n messages?: IdxMessages;\n minLength?: number;\n maxLength?: number;\n relatesTo?: {\n type?: string;\n value: IdxAuthenticator;\n };\n}\n\nexport interface IdxRemediation {\n name: string;\n label?: string;\n value?: IdxRemediationValue[];\n relatesTo?: {\n type?: string;\n value: IdxAuthenticator;\n };\n idp?: IdpConfig;\n href?: string;\n method?: string;\n type?: string;\n accepts?: string;\n produces?: string;\n refresh?: number;\n rel?: string[];\n action?: (payload?: IdxActionParams) => Promise<IdxResponse>;\n}\n\nexport interface IdxContext {\n version: string;\n stateHandle: string;\n expiresAt: string;\n intent: string;\n currentAuthenticator: {\n type: string;\n value: IdxAuthenticator;\n };\n currentAuthenticatorEnrollment: {\n type: string;\n value: IdxAuthenticator;\n };\n authenticators: {\n type: string;\n value: IdxAuthenticator[];\n };\n authenticatorEnrollments: {\n type: string;\n value: IdxAuthenticator[];\n };\n enrollmentAuthenticator: {\n type: string;\n value: IdxAuthenticator;\n };\n user?: {\n type: string;\n value: Record<string, unknown>;\n };\n uiDisplay?: IdxContextUIDisplay\n app: {\n type: string;\n value: Record<string, unknown>;\n };\n messages?: IdxMessages;\n success?: IdxRemediation;\n failure?: IdxRemediation;\n}\n\nexport interface IdxContextUIDisplay {\n type: string;\n value: {\n label?: string;\n buttonLabel?: string;\n }\n}\n\nexport interface IdxMessage {\n message: string;\n class: string;\n i18n: {\n key: string;\n params?: unknown[];\n };\n}\n\nexport interface IdxMessages {\n type: 'array';\n value: IdxMessage[];\n}\n\n// JSON response from the server\nexport interface RawIdxResponse {\n version: string;\n stateHandle: string;\n intent?: string;\n expiresAt?: string;\n remediation?: {\n type: 'array';\n value: IdxRemediation[];\n };\n messages?: IdxMessages;\n success?: boolean;\n successWithInteractionCode?: IdxRemediation;\n currentAuthenticator?: {\n type: string;\n value: IdxAuthenticator;\n };\n currentAuthenticatorEnrollment?: {\n type: string;\n value: IdxAuthenticator;\n };\n}\n\nexport function isRawIdxResponse(obj: any): obj is RawIdxResponse {\n return obj && obj.version;\n}\n\nexport interface IdxActionParams {\n [key: string]: string | boolean | number | object;\n}\n\nexport interface IdxActions {\n [key: string]: (params?: IdxActionParams) => Promise<IdxResponse>;\n}\n\nexport interface IdxToPersist {\n interactionHandle?: string;\n withCredentials?: boolean;\n}\n\nexport interface IdxActionFunction {\n (params: IdxActionParams): Promise<IdxResponse>;\n neededParams?: Array<Array<IdxRemediationValue>>;\n}\n\nexport interface IdxResponse {\n proceed: (remediationName: string, params: unknown) => Promise<IdxResponse>;\n neededToProceed: IdxRemediation[];\n rawIdxState: RawIdxResponse;\n interactionCode?: string;\n actions: IdxActions;\n toPersist: IdxToPersist;\n context?: IdxContext;\n requestDidSucceed?: boolean;\n stepUp?: boolean;\n}\n\nexport function isIdxResponse(obj: any): obj is IdxResponse {\n return obj && isRawIdxResponse(obj.rawIdxState);\n}\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;;AAqMA;;AAuBO,SAASA,gBAAgB,CAACC,GAAQ,EAAyB;EAChE,OAAOA,GAAG,IAAIA,GAAG,CAACC,OAAO;AAC3B;AAgCO,SAASC,aAAa,CAACF,GAAQ,EAAsB;EAC1D,OAAOA,GAAG,IAAID,gBAAgB,CAACC,GAAG,CAACG,WAAW,CAAC;AACjD"}
package/cjs/idx/util.js CHANGED
@@ -75,7 +75,6 @@ function getMessagesFromIdxRemediationValue(value) {
75
75
  }, []);
76
76
  }
77
77
  function getMessagesFromResponse(idxResponse, options) {
78
- var _rawIdxState$messages;
79
78
  let messages = [];
80
79
  const {
81
80
  rawIdxState,
@@ -83,7 +82,7 @@ function getMessagesFromResponse(idxResponse, options) {
83
82
  } = idxResponse;
84
83
 
85
84
  // Handle global messages
86
- const globalMessages = (_rawIdxState$messages = rawIdxState.messages) === null || _rawIdxState$messages === void 0 ? void 0 : _rawIdxState$messages.value.map(message => message);
85
+ const globalMessages = rawIdxState.messages?.value.map(message => message);
87
86
  if (globalMessages) {
88
87
  messages = [...messages, ...globalMessages];
89
88
  }
@@ -103,8 +102,7 @@ function getMessagesFromResponse(idxResponse, options) {
103
102
  // API may return identical error on same field, filter by i18n key
104
103
  const seen = {};
105
104
  messages = messages.reduce((filtered, message) => {
106
- var _message$i18n;
107
- const key = (_message$i18n = message.i18n) === null || _message$i18n === void 0 ? void 0 : _message$i18n.key;
105
+ const key = message.i18n?.key;
108
106
  if (key && seen[key] && message.message === seen[key].message) {
109
107
  return filtered;
110
108
  }
@@ -172,7 +170,6 @@ function getAvailableSteps(authClient, idxResponse, useGenericRemediator) {
172
170
  }
173
171
  };
174
172
  if (name.startsWith('currentAuthenticator')) {
175
- var _actionObj$value;
176
173
  const [part1, part2] = (0, _util.split2)(name, '-');
177
174
  const actionObj = idxResponse.rawIdxState[part1].value[part2];
178
175
  /* eslint-disable no-unused-vars, @typescript-eslint/no-unused-vars */
@@ -185,7 +182,7 @@ function getAvailableSteps(authClient, idxResponse, useGenericRemediator) {
185
182
  ...rest
186
183
  } = actionObj;
187
184
  /* eslint-enable no-unused-vars, @typescript-eslint/no-unused-vars */
188
- const value = (_actionObj$value = actionObj.value) === null || _actionObj$value === void 0 ? void 0 : _actionObj$value.filter(item => item.name !== 'stateHandle');
185
+ const value = actionObj.value?.filter(item => item.name !== 'stateHandle');
189
186
  stepObj = {
190
187
  ...rest,
191
188
  ...(value && {