diff --git a/CHANGELOG.md b/CHANGELOG.md index 5adea5a35..98c7b85c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Fixes - [#1231](https://github.com/okta/okta-auth-js/pull/1231) IDX: exposes field level error messages +- [#1234](https://github.com/okta/okta-auth-js/pull/1234) IDX: passes unknown selected option to backend for validation when use GenericRemediator (beta) ## 6.6.1 diff --git a/lib/idx/remediators/GenericRemediator/util.ts b/lib/idx/remediators/GenericRemediator/util.ts index 4508529cc..6ae487194 100644 --- a/lib/idx/remediators/GenericRemediator/util.ts +++ b/lib/idx/remediators/GenericRemediator/util.ts @@ -54,12 +54,17 @@ export function hasValidInputValue(input, values) { // handle options field // 1. object type options - check if each object field is required and value can be found from the selectedOption // 2. primitive options - required field is avaiable from top level + // 3. unknown format - pass to backend for validation if (options) { // object type options if (type === 'object') { const selectedOption = values[name]; - if (!selectedOption?.id) { - return false; + if (!selectedOption) { + return false; + } + if (!selectedOption.id) { + // unknown option format, pass to backend for validation + return true; } const optionSchema = options.find((option) => { const idSchema = option.value.find(({ name }) => name === 'id' ); diff --git a/test/spec/idx/remediators/util/hasValidInputValue.ts b/test/spec/idx/remediators/util/hasValidInputValue.ts index d36afac9d..f90d24151 100644 --- a/test/spec/idx/remediators/util/hasValidInputValue.ts +++ b/test/spec/idx/remediators/util/hasValidInputValue.ts @@ -392,6 +392,15 @@ describe('hasValidInputValue - validate each input with inputValues', () => { }); }); + it('returns true when selected option is in unknown format', () => { + const values = { + authenticator: { + noId: 'fake' + } + }; + const res = hasValidInputValue(input, values); + expect(res).toBe(true); + }); it('returns true when selected option has all required values', () => { // email option - only id is required