diff --git a/functions/hrm/prepopulateForm.ts b/functions/hrm/prepopulateForm.ts index dd6c6342..18f771eb 100644 --- a/functions/hrm/prepopulateForm.ts +++ b/functions/hrm/prepopulateForm.ts @@ -204,7 +204,8 @@ const mapGenericOption = (options: string[]) => (value: string) => { const getUnknownOption = (key: string, definition: FormItemDefinition[]) => { const inputDef = definition.find((e) => e.name === key); - if (inputDef && inputDef.type === 'select') { + // inputDef.options check needed whilst we use an el cheapo copy of the type, once we share the flex type it won't be needed + if (inputDef?.type === 'select' && inputDef.options) { const unknownOption = inputDef.unknownOption ? inputDef.options.find((e) => e.value === inputDef.unknownOption) : inputDef.options.find((e) => e.value === 'Unknown'); @@ -221,8 +222,10 @@ const getUnknownOption = (key: string, definition: FormItemDefinition[]) => { */ const getSelectOptions = (key: string) => (definition: FormItemDefinition[]) => { const inputDef = definition.find((e) => e.name === key); - - if (inputDef?.type === 'select') return inputDef.options.map((e) => e.value) || []; + // inputDef.options check needed whilst we use an el cheapo copy of the type, once we share the flex type it won't be needed + if (inputDef?.type === 'select' && inputDef.options) { + return inputDef.options.map((e) => e.value) || []; + } console.error(`getSelectOptions called with key ${key} but is a non-select input type.`); return []; diff --git a/package-lock.json b/package-lock.json index d019a0a4..dd210cd1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@twilio/runtime-handler": "1.2.4", "aws-sdk": "2.1366.0", "axios": "0.28.0", - "date-fns": "^3.6.0", + "date-fns": "^2.30.0", "form-data": "^4.0.0", "lodash": "4.17.21", "moment-timezone": "0.5.37", @@ -602,6 +602,17 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/runtime": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.0.tgz", + "integrity": "sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==", + "dependencies": { + "regenerator-runtime": "^0.14.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@babel/template": { "version": "7.25.7", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.7.tgz", @@ -3559,12 +3570,18 @@ } }, "node_modules/date-fns": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-3.6.0.tgz", - "integrity": "sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==", + "version": "2.30.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz", + "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==", + "dependencies": { + "@babel/runtime": "^7.21.0" + }, + "engines": { + "node": ">=0.11" + }, "funding": { - "type": "github", - "url": "https://github.com/sponsors/kossnocorp" + "type": "opencollective", + "url": "https://opencollective.com/date-fns" } }, "node_modules/dayjs": { @@ -11986,6 +12003,11 @@ "node": ">=12" } }, + "node_modules/regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" + }, "node_modules/regexp.prototype.flags": { "version": "1.4.3", "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", @@ -14513,6 +14535,14 @@ "@babel/helper-plugin-utils": "^7.24.7" } }, + "@babel/runtime": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.0.tgz", + "integrity": "sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==", + "requires": { + "regenerator-runtime": "^0.14.0" + } + }, "@babel/template": { "version": "7.25.7", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.7.tgz", @@ -16796,9 +16826,12 @@ } }, "date-fns": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-3.6.0.tgz", - "integrity": "sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==" + "version": "2.30.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz", + "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==", + "requires": { + "@babel/runtime": "^7.21.0" + } }, "dayjs": { "version": "1.11.5", @@ -23348,6 +23381,11 @@ } } }, + "regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" + }, "regexp.prototype.flags": { "version": "1.4.3", "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", diff --git a/package.json b/package.json index acfad125..2ea43e88 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "@twilio/runtime-handler": "1.2.4", "aws-sdk": "2.1366.0", "axios": "0.28.0", - "date-fns": "^3.6.0", + "date-fns": "^2.30.0", "form-data": "^4.0.0", "lodash": "4.17.21", "moment-timezone": "0.5.37",