diff --git a/CHANGELOG.md b/CHANGELOG.md index 1be6e53b90..6d77235946 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,14 +4,22 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [v6.76.1](https://github.com/opengovsg/FormSG/compare/v6.76.0...v6.76.1) + +- fix: invalid mixed digit input [`#6701`](https://github.com/opengovsg/FormSG/pull/6701) +- build: release v6.76.0 [`#6698`](https://github.com/opengovsg/FormSG/pull/6698) + #### [v6.76.0](https://github.com/opengovsg/FormSG/compare/v6.75.1...v6.76.0) +> 7 September 2023 + - fix: remove index from myinfo child question name [`#6697`](https://github.com/opengovsg/FormSG/pull/6697) - feat: update config for efs uninterrupted availability [`#6691`](https://github.com/opengovsg/FormSG/pull/6691) - docs(undp): add steps to migrate from mongodb in README [`#6695`](https://github.com/opengovsg/FormSG/pull/6695) - fix: update Myinfo occupation list [`#6684`](https://github.com/opengovsg/FormSG/pull/6684) - build: merge v6.75.1 into develop [`#6690`](https://github.com/opengovsg/FormSG/pull/6690) - * feat: % rollout of new storage submission endpoint (#6665) [`#6688`](https://github.com/opengovsg/FormSG/pull/6688) +- chore: bump version to v6.76.0 [`389d2aa`](https://github.com/opengovsg/FormSG/commit/389d2aa0814798b4b44ff17a373e6c59ca4292dc) #### [v6.75.1](https://github.com/opengovsg/FormSG/compare/v6.75.0...v6.75.1) @@ -193,11 +201,16 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). > 18 July 2023 - revert: build(deps): bump winston-cloudwatch version to 6.2.0 [`#6542`](https://github.com/opengovsg/FormSG/pull/6542) +- chore: bump version to v6.66.0 [`b3a9818`](https://github.com/opengovsg/FormSG/commit/b3a9818762e334bc7126c029cdba63156bac85ed) #### [v6.66.0](https://github.com/opengovsg/FormSG/compare/v6.65.0...v6.66.0) -> 18 July 2023 +> 19 July 2023 +- fix: use proof-of-payment for payment receipt/invoice [`#6549`](https://github.com/opengovsg/FormSG/pull/6549) +- build(deps-dev): bump word-wrap from 1.2.3 to 1.2.4 in /frontend [`#6548`](https://github.com/opengovsg/FormSG/pull/6548) +- fix(deps): bump word-wrap from 1.2.3 to 1.2.4 [`#6547`](https://github.com/opengovsg/FormSG/pull/6547) +- build(deps): bump winston-cloudwatch to v6.2.0 [`#6545`](https://github.com/opengovsg/FormSG/pull/6545) - fix(deps): [Snyk] Security upgrade mongoose from 5.13.15 to 5.13.20 [`#6541`](https://github.com/opengovsg/FormSG/pull/6541) - feat: indicate if GST has been applied to a payment transaction [`#6538`](https://github.com/opengovsg/FormSG/pull/6538) - chore: reduce max payment limit [`#6543`](https://github.com/opengovsg/FormSG/pull/6543) @@ -209,7 +222,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - build: merge v6.65.0 into develop [`#6531`](https://github.com/opengovsg/FormSG/pull/6531) - build: release v6.65.0 [`#6528`](https://github.com/opengovsg/FormSG/pull/6528) - fix: add FE validation rule that email domains must be non empty [`#6529`](https://github.com/opengovsg/FormSG/pull/6529) -- chore: bump version to v6.66.0 [`b3a9818`](https://github.com/opengovsg/FormSG/commit/b3a9818762e334bc7126c029cdba63156bac85ed) +- chore: bump version to v6.66.0 [`0233ba8`](https://github.com/opengovsg/FormSG/commit/0233ba8018532d4978d13717fac065f81e2eb515) #### [v6.65.0](https://github.com/opengovsg/FormSG/compare/v6.64.0...v6.65.0) @@ -709,13 +722,13 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - fix: add staging-alt2 to deployment script [`#6019`](https://github.com/opengovsg/FormSG/pull/6019) - build: merge release 6.38.0 to develop [`#6017`](https://github.com/opengovsg/FormSG/pull/6017) - build: release v6.38.0 [`#6004`](https://github.com/opengovsg/FormSG/pull/6004) -- feat: more logging on fetch fallback [`#6008`](https://github.com/opengovsg/FormSG/pull/6008) - chore: bump version to v6.39.0 [`081515a`](https://github.com/opengovsg/FormSG/commit/081515a2521c950dac7261f4b6c1b1b423c3af16) #### [v6.38.0](https://github.com/opengovsg/FormSG/compare/v6.37.0...v6.38.0) -> 29 March 2023 +> 30 March 2023 +- feat: more logging on fetch fallback [`#6008`](https://github.com/opengovsg/FormSG/pull/6008) - feat: implement fetch API fallback for network error [`#5948`](https://github.com/opengovsg/FormSG/pull/5948) - fix: lowercase collaborator endpoint emails [`#5992`](https://github.com/opengovsg/FormSG/pull/5992) - chore(deps-dev): bump @typescript-eslint/parser from 5.56.0 to 5.57.0 in /shared [`#5995`](https://github.com/opengovsg/FormSG/pull/5995) @@ -724,7 +737,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - fix(deps): bump type-fest from 3.7.0 to 3.7.1 in /shared [`#5991`](https://github.com/opengovsg/FormSG/pull/5991) - build: merge v6.37.0 into develop [`#5989`](https://github.com/opengovsg/FormSG/pull/5989) - build: release v6.37.0 [`#5988`](https://github.com/opengovsg/FormSG/pull/5988) -- chore: bump version to v6.38.0 [`d199213`](https://github.com/opengovsg/FormSG/commit/d19921314cae6b79920cf5ec3fb4f396794816d6) #### [v6.37.0](https://github.com/opengovsg/FormSG/compare/v6.36.0...v6.37.0) diff --git a/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/FieldListDrawer/field-panels/PaymentsInputPanel/ProductModal.tsx b/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/FieldListDrawer/field-panels/PaymentsInputPanel/ProductModal.tsx index d72102def0..0776a52b65 100644 --- a/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/FieldListDrawer/field-panels/PaymentsInputPanel/ProductModal.tsx +++ b/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/FieldListDrawer/field-panels/PaymentsInputPanel/ProductModal.tsx @@ -41,6 +41,12 @@ const MIN_QTY_KEY = `min_qty` const MAX_QTY_KEY = `max_qty` const DISPLAY_AMOUNT_KEY = 'display_amount' const MULTI_QTY_KEY = 'multi_qty' + +const parseIntElseNull = (val: string) => { + const parsedInt = parseInt(val, 10) + return Number.isNaN(parsedInt) ? null : parsedInt +} + export const ProductModal = ({ onClose, onSaveProduct, @@ -125,28 +131,37 @@ export const ProductModal = ({ onClose() }) - const minQtyValidation: RegisterOptions = { - validate: (val) => { + const minQtyValidation: RegisterOptions = { + validate: (valStr: string) => { if (!getValues(MULTI_QTY_KEY)) return true - if (val <= 0) { + + const valNumber = parseIntElseNull(valStr) + if (!valNumber || valNumber <= 0) { return 'Enter a value greater than 0' } - if (val > getValues(MAX_QTY_KEY)) { + + const maxNumber = + parseIntElseNull(getValues(MAX_QTY_KEY) as unknown as string) || + Number.MAX_SAFE_INTEGER + + if (valNumber > maxNumber) { return 'Enter a value smaller than the maximum quantity' } return true }, } - const maxQtyValidation: RegisterOptions = { - validate: (val) => { + const maxQtyValidation: RegisterOptions = { + validate: (valStr: string) => { if (!getValues(MULTI_QTY_KEY)) return true - if (val <= 0) { + + const valNumber = parseIntElseNull(valStr) + if (!valNumber || valNumber <= 0) { return 'Enter a value greater than 0' } const amount = dollarsToCents(getValues(DISPLAY_AMOUNT_KEY) ?? '') - if (val * amount > maxPaymentAmountCents) { + if (valNumber * amount > maxPaymentAmountCents) { const maxQty = Math.floor(maxPaymentAmountCents / amount) if (maxQty <= 0) { return `Quantity limit could not be set because amount is above S${formatCurrency( @@ -155,7 +170,11 @@ export const ProductModal = ({ } return `The maximum quantity for this amount is ${maxQty}` } - if (val < getValues(MIN_QTY_KEY)) { + const minNumber = + parseIntElseNull(getValues(MIN_QTY_KEY) as unknown as string) || + Number.MIN_SAFE_INTEGER + + if (valNumber < minNumber) { return 'Enter a value greater than the minimum quantity' } return true diff --git a/package-lock.json b/package-lock.json index a4366ebfaf..2948edf654 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "FormSG", - "version": "6.76.0", + "version": "6.76.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "FormSG", - "version": "6.76.0", + "version": "6.76.1", "hasInstallScript": true, "dependencies": { "@aws-sdk/client-cloudwatch-logs": "^3.347.1", diff --git a/package.json b/package.json index d01e7e62c4..6b2ef28274 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "FormSG", "description": "Form Manager for Government", - "version": "6.76.0", + "version": "6.76.1", "homepage": "https://form.gov.sg", "authors": [ "FormSG "