diff --git a/CHANGELOG.md b/CHANGELOG.md index 12bd6efb60..e0c734779b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,35 @@ 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.70.0](https://github.com/opengovsg/FormSG/compare/v6.70.0...v6.70.0) + +- fix: supply empty object when snapshot script has not completely migrated [`#6622`](https://github.com/opengovsg/FormSG/pull/6622) + +#### [v6.70.0](https://github.com/opengovsg/FormSG/compare/v6.69.0...v6.70.0) + +> 15 August 2023 + +- feat: payment by products [`#6301`](https://github.com/opengovsg/FormSG/pull/6301) +- fix(deps): bump libphonenumber-js from 1.10.40 to 1.10.41 in /shared [`#6616`](https://github.com/opengovsg/FormSG/pull/6616) +- fix(deps): bump libphonenumber-js from 1.10.39 to 1.10.40 in /shared [`#6614`](https://github.com/opengovsg/FormSG/pull/6614) +- chore: Added react dev inspector [`#6611`](https://github.com/opengovsg/FormSG/pull/6611) +- feat: filter out API details from user object [`#6588`](https://github.com/opengovsg/FormSG/pull/6588) +- chore(deps-dev): bump @types/lodash from 4.14.196 to 4.14.197 in /shared [`#6612`](https://github.com/opengovsg/FormSG/pull/6612) +- fix(deps): bump type-fest from 4.1.0 to 4.2.0 in /shared [`#6610`](https://github.com/opengovsg/FormSG/pull/6610) +- fix(deps): bump import-in-the-middle from 1.3.4 to 1.4.2 [`#6609`](https://github.com/opengovsg/FormSG/pull/6609) +- docs: update feature section of README [`#6603`](https://github.com/opengovsg/FormSG/pull/6603) +- fix(deps): bump validator from 13.9.0 to 13.11.0 in /shared [`#6605`](https://github.com/opengovsg/FormSG/pull/6605) +- chore: remove angular deps [`#6602`](https://github.com/opengovsg/FormSG/pull/6602) +- chore: remove customMin and customMax virtuals [`#6596`](https://github.com/opengovsg/FormSG/pull/6596) +- build: merge v6.69.0 into develop [`#6601`](https://github.com/opengovsg/FormSG/pull/6601) +- fix(deps): bump libphonenumber-js from 1.10.38 to 1.10.39 in /shared [`#6594`](https://github.com/opengovsg/FormSG/pull/6594) +- build: release v6.69.0 [`#6600`](https://github.com/opengovsg/FormSG/pull/6600) +- chore: bump version to v6.70.0 [`b7e2760`](https://github.com/opengovsg/FormSG/commit/b7e276040e6d82560ff3fed7fca213ac118b83ee) + #### [v6.69.0](https://github.com/opengovsg/FormSG/compare/v6.68.0...v6.69.0) +> 7 August 2023 + - fix: updated payment view to follow colour theme [`#6598`](https://github.com/opengovsg/FormSG/pull/6598) - feat: toggle issue notification [`#6590`](https://github.com/opengovsg/FormSG/pull/6590) - feat: BE endpoint to allow storage submissions before encryption [`#6587`](https://github.com/opengovsg/FormSG/pull/6587) @@ -20,6 +47,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - chore(deps-dev): bump eslint-config-prettier from 8.8.0 to 8.9.0 in /shared [`#6576`](https://github.com/opengovsg/FormSG/pull/6576) - build: merge v6.68.0 into develop [`#6572`](https://github.com/opengovsg/FormSG/pull/6572) - build: release v6.68.0 [`#6571`](https://github.com/opengovsg/FormSG/pull/6571) +- chore: bump version to v6.69.0 [`096c5e8`](https://github.com/opengovsg/FormSG/commit/096c5e82c8aa665622d3a0e1ddc82e33d9a5ee37) #### [v6.68.0](https://github.com/opengovsg/FormSG/compare/v6.67.1...v6.68.0) @@ -136,14 +164,13 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - chore(deps-dev): bump @typescript-eslint/eslint-plugin from 5.60.0 to 5.60.1 in /shared [`#6487`](https://github.com/opengovsg/FormSG/pull/6487) - chore(deps-dev): bump @typescript-eslint/parser from 5.60.0 to 5.60.1 in /shared [`#6488`](https://github.com/opengovsg/FormSG/pull/6488) - build: release v6.62.0 [`#6484`](https://github.com/opengovsg/FormSG/pull/6484) -- fix: admin feedback capturing wrong local storage value [`#6485`](https://github.com/opengovsg/FormSG/pull/6485) -- chore: bump version to v6.62.0 [`b5ab2e0`](https://github.com/opengovsg/FormSG/commit/b5ab2e0d1615a5e9b0ed1829adcaf040ef700adc) - chore: bump version to v6.63.0 [`b474dc7`](https://github.com/opengovsg/FormSG/commit/b474dc76f426ddbb101ba73c50f16e507b51a437) #### [v6.62.0](https://github.com/opengovsg/FormSG/compare/v6.61.1...v6.62.0) > 26 June 2023 +- fix: admin feedback capturing wrong local storage value [`#6485`](https://github.com/opengovsg/FormSG/pull/6485) - fix: escape form title in payment invoice's html content [`#6482`](https://github.com/opengovsg/FormSG/pull/6482) - feat: admin feedback modal [`#6465`](https://github.com/opengovsg/FormSG/pull/6465) - fix: potential html script injection [`#6481`](https://github.com/opengovsg/FormSG/pull/6481) @@ -152,7 +179,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - chore: update issue feedback mail html [`#6478`](https://github.com/opengovsg/FormSG/pull/6478) - build: merge v6.61.0 into develop [`#6477`](https://github.com/opengovsg/FormSG/pull/6477) - fix: account for undefined response code when tracking webhook dd stats [`#6475`](https://github.com/opengovsg/FormSG/pull/6475) -- chore: bump version to v6.62.0 [`bafd12a`](https://github.com/opengovsg/FormSG/commit/bafd12a2bc228b606a24c0b65cd284a25d5f7521) +- chore: bump version to v6.62.0 [`b5ab2e0`](https://github.com/opengovsg/FormSG/commit/b5ab2e0d1615a5e9b0ed1829adcaf040ef700adc) #### [v6.61.1](https://github.com/opengovsg/FormSG/compare/v6.61.0...v6.61.1) @@ -438,23 +465,22 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - fix: only return previous payment id [`#6210`](https://github.com/opengovsg/FormSG/pull/6210) - build: merge release v6.45.0 to develop [`#6205`](https://github.com/opengovsg/FormSG/pull/6205) - build: release v6.45.0 [`#6200`](https://github.com/opengovsg/FormSG/pull/6200) -- chore: update payment guide in payment unsupported msg [`#6199`](https://github.com/opengovsg/FormSG/pull/6199) -- fix(deps): bump type-fest from 3.8.0 to 3.9.0 in /shared [`#6195`](https://github.com/opengovsg/FormSG/pull/6195) -- chore: bump version to v6.45.0 [`336f4c8`](https://github.com/opengovsg/FormSG/commit/336f4c8ad072d3b582a646e21010eac4b5119ee7) -- chore: bump version to v6.46.0 [`87fda0e`](https://github.com/opengovsg/FormSG/commit/87fda0e0ec4c937350ebd013a4a9762f4acee802) -- docs: fix CHANGELOG.md to have only 1 section for v6.45.0 [`4fe9d00`](https://github.com/opengovsg/FormSG/commit/4fe9d00234bed21f0943e26cc9d7c2db96afcdd3) +- chore: bump version to v6.46.0 [`767e7e5`](https://github.com/opengovsg/FormSG/commit/767e7e55c3e8f058963e890b1c249704d6db1459) #### [v6.45.0](https://github.com/opengovsg/FormSG/compare/v6.44.1...v6.45.0) > 26 April 2023 +- chore: update payment guide in payment unsupported msg [`#6199`](https://github.com/opengovsg/FormSG/pull/6199) +- fix(deps): bump type-fest from 3.8.0 to 3.9.0 in /shared [`#6195`](https://github.com/opengovsg/FormSG/pull/6195) - chore: update previous payment typing and hooks [`#6191`](https://github.com/opengovsg/FormSG/pull/6191) - chore: add missed out changelog for 6.44.1 [`#6197`](https://github.com/opengovsg/FormSG/pull/6197) - build: merge release v6.44.1 to develop [`#6196`](https://github.com/opengovsg/FormSG/pull/6196) - build: release v6.44.1 [`#6193`](https://github.com/opengovsg/FormSG/pull/6193) - perf: memoize field row containers [`#6189`](https://github.com/opengovsg/FormSG/pull/6189) - build: merge release v6.44.0 to develop [`#6187`](https://github.com/opengovsg/FormSG/pull/6187) -- chore: bump version to v6.45.0 [`df24b16`](https://github.com/opengovsg/FormSG/commit/df24b16f04ba595a53062a309deaf90225b3a2ad) +- chore: bump version to v6.45.0 [`336f4c8`](https://github.com/opengovsg/FormSG/commit/336f4c8ad072d3b582a646e21010eac4b5119ee7) +- docs: fix CHANGELOG.md to have only 1 section for v6.45.0 [`4fe9d00`](https://github.com/opengovsg/FormSG/commit/4fe9d00234bed21f0943e26cc9d7c2db96afcdd3) #### [v6.44.1](https://github.com/opengovsg/FormSG/compare/v6.44.0...v6.44.1) @@ -560,9 +586,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - fix(deps): bump type-fest from 3.7.2 to 3.8.0 in /shared [`#6064`](https://github.com/opengovsg/FormSG/pull/6064) - build: merge release v6.40.0 into develop [`#6072`](https://github.com/opengovsg/FormSG/pull/6072) - build: release v6.40.0 [`#6071`](https://github.com/opengovsg/FormSG/pull/6071) -- build: release v6.39.0 [`#6068`](https://github.com/opengovsg/FormSG/pull/6068) - chore: bump version to v6.41.0 [`5055b51`](https://github.com/opengovsg/FormSG/commit/5055b51c5505aab5e8f2a00907e2ee2a9f793e88) -- chore: bump version to v6.39.0 [`081515a`](https://github.com/opengovsg/FormSG/commit/081515a2521c950dac7261f4b6c1b1b423c3af16) #### [v6.40.0](https://github.com/opengovsg/FormSG/compare/v6.39.0...v6.40.0) @@ -570,6 +594,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - build: merge release v6.39.0 into develop [`#6070`](https://github.com/opengovsg/FormSG/pull/6070) - fix(AttachmentField): correctly clear attachment on upload error [`#6069`](https://github.com/opengovsg/FormSG/pull/6069) +- build: release v6.39.0 [`#6068`](https://github.com/opengovsg/FormSG/pull/6068) - chore: bump version to v6.40.0 [`d4441e2`](https://github.com/opengovsg/FormSG/commit/d4441e276a30b373d64dcc7838f1798049ccf105) #### [v6.39.0](https://github.com/opengovsg/FormSG/compare/v6.38.0...v6.39.0) @@ -637,7 +662,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - build: release v6.36.0 [`#5913`](https://github.com/opengovsg/FormSG/pull/5913) - chore: bump version to v6.37.0 [`b4d24eb`](https://github.com/opengovsg/FormSG/commit/b4d24eb14f8a80bff56d19e6fa23975d5661cce9) - chore: bump version to 6.36.1 [`faf75b5`](https://github.com/opengovsg/FormSG/commit/faf75b5a7d0d12745e9a0104c541fb66cca17258) -- chore: bump version to v6.36.0 [`d8d2b59`](https://github.com/opengovsg/FormSG/commit/d8d2b59db62d195916a8fcc3d84659dd20687de4) #### [v6.36.0](https://github.com/opengovsg/FormSG/compare/v6.35.0...v6.36.0) @@ -653,7 +677,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - chore(deps-dev): bump eslint-config-prettier from 8.6.0 to 8.7.0 in /shared [`#5895`](https://github.com/opengovsg/FormSG/pull/5895) - chore(deps-dev): bump eslint-plugin-simple-import-sort from 8.0.0 to 10.0.0 [`#5771`](https://github.com/opengovsg/FormSG/pull/5771) - chore(deps-dev): bump @typescript-eslint/parser from 5.54.0 to 5.54.1 in /shared [`#5892`](https://github.com/opengovsg/FormSG/pull/5892) -- chore: bump version to v6.36.0 [`a51adf1`](https://github.com/opengovsg/FormSG/commit/a51adf1a129ff473e62f38b6836e5282afc5b83f) +- chore: bump version to v6.36.0 [`d8d2b59`](https://github.com/opengovsg/FormSG/commit/d8d2b59db62d195916a8fcc3d84659dd20687de4) #### [v6.35.0](https://github.com/opengovsg/FormSG/compare/v6.34.0...v6.35.0) @@ -678,14 +702,13 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - chore: revert "feat: merge payment-mvp branch into develop" [`#5858`](https://github.com/opengovsg/FormSG/pull/5858) - build: merge release v6.33.0 into develop [`#5859`](https://github.com/opengovsg/FormSG/pull/5859) - build: release v6.33.0 [`#5853`](https://github.com/opengovsg/FormSG/pull/5853) -- feat: merge payment-mvp branch into develop [`#5851`](https://github.com/opengovsg/FormSG/pull/5851) -- chore: bump version to v6.33.0 [`6508dc0`](https://github.com/opengovsg/FormSG/commit/6508dc09bb519392afbc426c6b68257c4e83515d) - chore: bump version to v6.34.0 [`4624819`](https://github.com/opengovsg/FormSG/commit/46248191e9b5f69e7400ee9b03dd1decdae43e96) #### [v6.33.0](https://github.com/opengovsg/FormSG/compare/v6.32.0...v6.33.0) > 28 February 2023 +- feat: merge payment-mvp branch into develop [`#5851`](https://github.com/opengovsg/FormSG/pull/5851) - chore(deps-dev): bump @typescript-eslint/eslint-plugin from 5.52.0 to 5.54.0 in /shared [`#5847`](https://github.com/opengovsg/FormSG/pull/5847) - chore(deps-dev): bump @typescript-eslint/parser from 5.53.0 to 5.54.0 in /shared [`#5846`](https://github.com/opengovsg/FormSG/pull/5846) - fix(deps): bump libphonenumber-js from 1.10.20 to 1.10.21 in /shared [`#5841`](https://github.com/opengovsg/FormSG/pull/5841) @@ -694,7 +717,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - build: merge release v6.32.0 into develop [`#5833`](https://github.com/opengovsg/FormSG/pull/5833) - [Snyk] Security upgrade @aws-sdk/client-cloudwatch-logs from 3.241.0 to 3.276.0 [`#5835`](https://github.com/opengovsg/FormSG/pull/5835) - build: release v6.32.0 [`#5832`](https://github.com/opengovsg/FormSG/pull/5832) -- chore: bump version to v6.33.0 [`2e09f10`](https://github.com/opengovsg/FormSG/commit/2e09f1081a6c9f605f3e9ed179330b9b1b162d5e) +- chore: bump version to v6.33.0 [`6508dc0`](https://github.com/opengovsg/FormSG/commit/6508dc09bb519392afbc426c6b68257c4e83515d) #### [v6.32.0](https://github.com/opengovsg/FormSG/compare/v6.31.0...v6.32.0) @@ -818,14 +841,13 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - fix(deps): bump libphonenumber-js from 1.10.15 to 1.10.17 in /shared [`#5690`](https://github.com/opengovsg/FormSG/pull/5690) - fix(deps): bump type-fest from 3.5.0 to 3.5.1 in /shared [`#5687`](https://github.com/opengovsg/FormSG/pull/5687) - build: release v6.27.0 [`#5684`](https://github.com/opengovsg/FormSG/pull/5684) -- fix: add submission time to end page, returned from server [`#5672`](https://github.com/opengovsg/FormSG/pull/5672) -- chore: bump version to v6.27.0 [`86b31d4`](https://github.com/opengovsg/FormSG/commit/86b31d4bd6959171842112bd7d8227841cbcda66) - chore: bump version to v6.28.0 [`f982046`](https://github.com/opengovsg/FormSG/commit/f982046d76bfb3b2d8ceec36daaf23dde3ac165b) #### [v6.27.0](https://github.com/opengovsg/FormSG/compare/v6.26.0...v6.27.0) > 4 January 2023 +- fix: add submission time to end page, returned from server [`#5672`](https://github.com/opengovsg/FormSG/pull/5672) - chore: log formAuthType when redirecting user to sp/cp/myinfo/sgid [`#5682`](https://github.com/opengovsg/FormSG/pull/5682) - chore(deps-dev): bump @typescript-eslint/parser from 5.47.1 to 5.48.0 in /shared [`#5680`](https://github.com/opengovsg/FormSG/pull/5680) - chore(deps-dev): bump @typescript-eslint/eslint-plugin from 5.47.1 to 5.48.0 in /shared [`#5679`](https://github.com/opengovsg/FormSG/pull/5679) @@ -837,7 +859,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - build: backport v6.26.0 into develop [`#5669`](https://github.com/opengovsg/FormSG/pull/5669) - fix(deps): bump zod from 3.19.1 to 3.20.2 [`#5668`](https://github.com/opengovsg/FormSG/pull/5668) - build: release v6.26.0 [`#5666`](https://github.com/opengovsg/FormSG/pull/5666) -- chore: bump version to v6.27.0 [`3e2a28b`](https://github.com/opengovsg/FormSG/commit/3e2a28b6394b78e02eca138cfe781337cdee10b1) +- chore: bump version to v6.27.0 [`86b31d4`](https://github.com/opengovsg/FormSG/commit/86b31d4bd6959171842112bd7d8227841cbcda66) #### [v6.26.0](https://github.com/opengovsg/FormSG/compare/v6.25.0...v6.26.0) @@ -871,7 +893,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - build: merge release v6.25.0 into develop [`#5632`](https://github.com/opengovsg/FormSG/pull/5632) - build: release v6.25.0 [`#5630`](https://github.com/opengovsg/FormSG/pull/5630) - chore: bump version to v6.26.0 [`8a0b8e2`](https://github.com/opengovsg/FormSG/commit/8a0b8e2df75af8d9f59df5feee03f50211c4339d) -- chore: bump version to v6.25.0 [`8da99f6`](https://github.com/opengovsg/FormSG/commit/8da99f68dbb1ccbebda72ad95729aaf97e93a321) #### [v6.25.0](https://github.com/opengovsg/FormSG/compare/v6.24.1...v6.25.0) @@ -886,13 +907,20 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - build: merge release 6.24.1 into develop [`#5622`](https://github.com/opengovsg/FormSG/pull/5622) - build: Release v6.24.1 hotfix [`#5621`](https://github.com/opengovsg/FormSG/pull/5621) - build: merge release 6.24.0 into develop [`#5619`](https://github.com/opengovsg/FormSG/pull/5619) -- chore: bump version to v6.25.0 [`6080687`](https://github.com/opengovsg/FormSG/commit/6080687d7d8ee7ce343ac6602ae2853ffde20e62) +- chore: bump version to v6.25.0 [`8da99f6`](https://github.com/opengovsg/FormSG/commit/8da99f68dbb1ccbebda72ad95729aaf97e93a321) #### [v6.24.1](https://github.com/opengovsg/FormSG/compare/v6.24.0...v6.24.1) > 23 December 2022 - build: release v6.24.0 [`#5615`](https://github.com/opengovsg/FormSG/pull/5615) +- Revert "fix(deps): bump sqs-producer from 2.1.0 to 3.1.0 (#5590)" [`df3e488`](https://github.com/opengovsg/FormSG/commit/df3e488591c29d63c7c4853fe77b10ffb6f724b7) +- chore: bump version to v6.24.1 [`e2fd68c`](https://github.com/opengovsg/FormSG/commit/e2fd68cd0ca6ae62318ea33ffd03afdbe1594bd1) + +#### [v6.24.0](https://github.com/opengovsg/FormSG/compare/v6.23.3...v6.24.0) + +> 23 December 2022 + - feat: initialise datadog in head [`#5571`](https://github.com/opengovsg/FormSG/pull/5571) - build: merge 6.23.3 into develop [`#5614`](https://github.com/opengovsg/FormSG/pull/5614) - ci: separate e2e and backend ci flows [`#5483`](https://github.com/opengovsg/FormSG/pull/5483) @@ -902,15 +930,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - fix(deps): bump @sentry/browser from 7.21.1 to 7.28.0 [`#5607`](https://github.com/opengovsg/FormSG/pull/5607) - build: merge release 6.23.2 back to develop [`#5606`](https://github.com/opengovsg/FormSG/pull/5606) - chore(deps-dev): bump regenerator from 0.14.9 to 0.14.10 [`#5608`](https://github.com/opengovsg/FormSG/pull/5608) -- build: Release v6.23.2 hotfix [`#5602`](https://github.com/opengovsg/FormSG/pull/5602) - test: fix race condition in field schema test [`#5604`](https://github.com/opengovsg/FormSG/pull/5604) - fix: avoid using merge to set query after reordering fields [`#5605`](https://github.com/opengovsg/FormSG/pull/5605) - chore(deps-dev): bump @typescript-eslint/eslint-plugin from 5.46.1 to 5.47.0 in /shared [`#5592`](https://github.com/opengovsg/FormSG/pull/5592) - fix(deps): bump sqs-producer from 2.1.0 to 3.1.0 [`#5590`](https://github.com/opengovsg/FormSG/pull/5590) - feat: push static assets to s3 [`#5595`](https://github.com/opengovsg/FormSG/pull/5595) -- fix: return 404 for unmatched static assets [`#5579`](https://github.com/opengovsg/FormSG/pull/5579) -- test: fix selectors for tests [`#5597`](https://github.com/opengovsg/FormSG/pull/5597) -- feat: push static assets to s3 [`#5595`](https://github.com/opengovsg/FormSG/pull/5595) - fix(deps): bump @aws-sdk/client-cloudwatch-logs from 3.218.0 to 3.234.0 [`#5599`](https://github.com/opengovsg/FormSG/pull/5599) - fix: return 404 for unmatched static assets [`#5579`](https://github.com/opengovsg/FormSG/pull/5579) - chore: merge v6.23.1 to develop [`#5594`](https://github.com/opengovsg/FormSG/pull/5594) @@ -921,23 +945,14 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - fix(deps): bump libphonenumber-js from 1.10.14 to 1.10.15 [`#5553`](https://github.com/opengovsg/FormSG/pull/5553) - fix(deps): bump moment-timezone from 0.5.39 to 0.5.40 [`#5586`](https://github.com/opengovsg/FormSG/pull/5586) - chore(deps-dev): bump @playwright/test from 1.27.1 to 1.29.0 [`#5585`](https://github.com/opengovsg/FormSG/pull/5585) -- * fix: trim email input in frontend and backend [`#5581`](https://github.com/opengovsg/FormSG/pull/5581) -- fix(deps): bump formsg-javascript-sdk from 0.9.0 to 0.10.0 [`#5578`](https://github.com/opengovsg/FormSG/pull/5578) - fix(deps): bump zod from 3.19.1 to 3.20.2 in /shared [`#5562`](https://github.com/opengovsg/FormSG/pull/5562) - fix(deps): bump type-fest from 3.3.0 to 3.4.0 in /shared [`#5563`](https://github.com/opengovsg/FormSG/pull/5563) - fix(deps): bump formsg-javascript-sdk from 0.9.0 to 0.10.0 [`#5578`](https://github.com/opengovsg/FormSG/pull/5578) - fix: remove unecessary import [`#5576`](https://github.com/opengovsg/FormSG/pull/5576) -- Revert "fix(deps): bump sqs-producer from 2.1.0 to 3.1.0 (#5590)" [`df3e488`](https://github.com/opengovsg/FormSG/commit/df3e488591c29d63c7c4853fe77b10ffb6f724b7) -- chore: bump version to 6.23.2 [`1256707`](https://github.com/opengovsg/FormSG/commit/1256707db95a30486c2ccfc731d9ff6cbdb7dc40) -- chore: bump version to v6.24.0 [`13fa4f6`](https://github.com/opengovsg/FormSG/commit/13fa4f6eb7854ef91e632d8e316d180e57bb759b) - -#### [v6.24.0](https://github.com/opengovsg/FormSG/compare/v6.23.3...v6.24.0) - -> 16 December 2022 - - feat: upgrade axios to 1.2.1 [`#5568`](https://github.com/opengovsg/FormSG/pull/5568) - chore: merge v6.23.0 into develop [`#5574`](https://github.com/opengovsg/FormSG/pull/5574) -- chore: bump version to v6.24.0 [`ef21f76`](https://github.com/opengovsg/FormSG/commit/ef21f76703d53d73e61d36e913167be37e48cdf3) +- chore: bump version to v6.24.0 [`13fa4f6`](https://github.com/opengovsg/FormSG/commit/13fa4f6eb7854ef91e632d8e316d180e57bb759b) +- Revert "fix(deps): bump sqs-consumer from 5.7.0 to 6.1.0 (#5591)" [`088902d`](https://github.com/opengovsg/FormSG/commit/088902d74fe8fde365859342aaacc7b735a777a3) #### [v6.23.3](https://github.com/opengovsg/FormSG/compare/v6.23.2...v6.23.3) @@ -1028,6 +1043,13 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - chore: decommission SAML support for Singpass / Corppass [`#5469`](https://github.com/opengovsg/FormSG/pull/5469) - chore: update chromatic GA to only run in PRs [`#5488`](https://github.com/opengovsg/FormSG/pull/5488) - build: release v6.19.0 [`#5481`](https://github.com/opengovsg/FormSG/pull/5481) +- chore: bump version to v6.20.0 [`54131bd`](https://github.com/opengovsg/FormSG/commit/54131bd9c354fbb9aa478ca871817c34b1544aaa) +- Merge pull request #5490 from opengovsg/release-al2 [`bf0984e`](https://github.com/opengovsg/FormSG/commit/bf0984e8ae74382fd455c0821b16976793990932) + +#### [v6.19.0](https://github.com/opengovsg/FormSG/compare/v6.18.5...v6.19.0) + +> 29 November 2022 + - feat: add public form `/use-template` redirection to admin form template page [`#5486`](https://github.com/opengovsg/FormSG/pull/5486) - fix: remove form title special characters validation [`#5485`](https://github.com/opengovsg/FormSG/pull/5485) - chore: merge hotfix release v6.18.5 to develop [`#5480`](https://github.com/opengovsg/FormSG/pull/5480) @@ -1042,28 +1064,15 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - fix: extend MyInfo login expiry to match env var [`#5464`](https://github.com/opengovsg/FormSG/pull/5464) - chore: merge hotfix release v6.18.4 back to develop [`#5472`](https://github.com/opengovsg/FormSG/pull/5472) - feat: improve admin storage mode response printability [`#5460`](https://github.com/opengovsg/FormSG/pull/5460) -- fix: update field validators with more specific type guarantees [`#5468`](https://github.com/opengovsg/FormSG/pull/5468) -- build: hotfix release v6.18.4 [`#5470`](https://github.com/opengovsg/FormSG/pull/5470) -- fix: correctly perform logic validation on MyInfo prefilled fields [`#5467`](https://github.com/opengovsg/FormSG/pull/5467) -- fix: trim dropdown option answer in backend and in angularjs frontend [`#5466`](https://github.com/opengovsg/FormSG/pull/5466) - chore(deps-dev): bump @babel/preset-env from 7.19.4 to 7.20.2 [`#5463`](https://github.com/opengovsg/FormSG/pull/5463) - test: add email submission e2e tests [`#5162`](https://github.com/opengovsg/FormSG/pull/5162) - feat: allow special chars in form title [`#5436`](https://github.com/opengovsg/FormSG/pull/5436) -- fix: release v6.18.3 [`#5459`](https://github.com/opengovsg/FormSG/pull/5459) - chore(deps-dev): bump husky from 8.0.1 to 8.0.2 [`#5457`](https://github.com/opengovsg/FormSG/pull/5457) - fix(docker-compose): change ports from 5000 to 5001 [`#5455`](https://github.com/opengovsg/FormSG/pull/5455) - chore(deps-dev): bump @types/lodash from 4.14.189 to 4.14.190 in /shared [`#5454`](https://github.com/opengovsg/FormSG/pull/5454) - chore(deps-dev): bump @typescript-eslint/eslint-plugin from 5.43.0 to 5.44.0 [`#5453`](https://github.com/opengovsg/FormSG/pull/5453) - fix: update max dimension for image uploads [`#5451`](https://github.com/opengovsg/FormSG/pull/5451) - fix(deps): bump @sentry/browser from 7.17.3 to 7.20.1 [`#5449`](https://github.com/opengovsg/FormSG/pull/5449) -- chore: bump version to v6.20.0 [`54131bd`](https://github.com/opengovsg/FormSG/commit/54131bd9c354fbb9aa478ca871817c34b1544aaa) -- Merge pull request #5490 from opengovsg/release-al2 [`bf0984e`](https://github.com/opengovsg/FormSG/commit/bf0984e8ae74382fd455c0821b16976793990932) -- fix(deps): bump @aws-sdk/client-cloudwatch-logs to 3.216.0 [`ac812ec`](https://github.com/opengovsg/FormSG/commit/ac812ecdd14b11f9500e3d95aa75050be40d8e24) - -#### [v6.19.0](https://github.com/opengovsg/FormSG/compare/v6.18.5...v6.19.0) - -> 22 November 2022 - - fix: disable submission in template mode [`#5443`](https://github.com/opengovsg/FormSG/pull/5443) - fix(docker-compose): include US and SG SES env vars [`#5442`](https://github.com/opengovsg/FormSG/pull/5442) - feat: use-template for forms [`#5377`](https://github.com/opengovsg/FormSG/pull/5377) @@ -1082,7 +1091,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - fix(deps): bump aws-sdk from 2.1251.0 to 2.1255.0 [`#5415`](https://github.com/opengovsg/FormSG/pull/5415) - fix(deps): bump loader-utils from 1.4.0 to 1.4.2 [`#5416`](https://github.com/opengovsg/FormSG/pull/5416) - chore(deps-dev): bump eslint-plugin-jest from 27.1.3 to 27.1.5 [`#5414`](https://github.com/opengovsg/FormSG/pull/5414) -- chore: bump version to v6.19.0 [`04762a2`](https://github.com/opengovsg/FormSG/commit/04762a268542a70f3b9d10e1f8c7f273d32ac9bc) +- chore: bump version to v6.19.0 [`f245c66`](https://github.com/opengovsg/FormSG/commit/f245c66f1dbb133429101574889e55b479591061) - Merge pull request #5435 from opengovsg/release-al2 [`6023bac`](https://github.com/opengovsg/FormSG/commit/6023bac35189418bac8b1bb59cea53661df7fb76) #### [v6.18.5](https://github.com/opengovsg/FormSG/compare/v6.18.4...v6.18.5) diff --git a/README.md b/README.md index ce8f23e1a3..deb1d6fd7f 100755 --- a/README.md +++ b/README.md @@ -48,20 +48,13 @@ Notable features include: - 19 different form field types, including attachments, tables, email and mobile - Verified email and mobile phone fields via integrations with Twilio and AWS SES - Automatic emailing of submissions for forms built with Email Mode -- End-to-end encryption for forms built with Storage Mode +- Encryption for data collected on forms built with Storage Mode - (Singapore government agencies only) Citizen authentication with [SingPass](https://www.singpass.gov.sg/singpass/common/aboutus) - (Singapore government agencies only) Citizen authentication with [sgID](https://www.id.gov.sg/) - (Singapore government agencies only) Corporate authentication with [CorpPass](https://www.corppass.gov.sg/corppass/common/aboutus) - (Singapore government agencies only) Automatic prefill of verified data with [MyInfo](https://www.singpass.gov.sg/myinfo/common/aboutus) - Webhooks functionality via the official [FormSG JavaScript SDK](https://github.com/opengovsg/formsg-sdk) and contributor-supported [FormSG Ruby SDK](https://github.com/opengovsg/formsg-ruby-sdk) - -The current product roadmap includes: - -- (in progress) Frontend rewrite from [AngularJS](https://angularjs.org/) to [React](https://reactjs.org/) -- Enabling payments on forms -- Electronic signatures -- Notifications to form admins for Storage mode submissions -- Integration with vault.gov.sg +- Variable amount and Itemised payments on forms with [stripe](https://stripe.com) integration ## Local Development (Docker) diff --git a/__tests__/unit/backend/helpers/jest-db.ts b/__tests__/unit/backend/helpers/jest-db.ts index e3c24ac834..60e2946c8b 100644 --- a/__tests__/unit/backend/helpers/jest-db.ts +++ b/__tests__/unit/backend/helpers/jest-db.ts @@ -24,6 +24,7 @@ import { IPopulatedForm, ISubmissionSchema, IUserSchema, + UserApiToken, } from 'src/types' /** @@ -88,11 +89,13 @@ const insertUser = async ({ userId, mailDomain = 'test.gov.sg', mailName = 'test', + apiToken, }: { agencyId: ObjectID userId?: ObjectID mailName?: string mailDomain?: string + apiToken?: UserApiToken }): Promise => { const User = getUserModel(mongoose) @@ -100,6 +103,7 @@ const insertUser = async ({ email: `${mailName}@${mailDomain}`, _id: userId, agency: agencyId, + apiToken: apiToken, }) } @@ -116,6 +120,7 @@ const insertFormCollectionReqs = async ({ shortName = 'govtest', flags, betaFlags, + apiToken, }: { userId?: ObjectID mailName?: string @@ -123,6 +128,7 @@ const insertFormCollectionReqs = async ({ shortName?: string flags?: { lastSeenFeatureUpdateVersion: number } betaFlags?: IUserSchema['betaFlags'] + apiToken?: UserApiToken } = {}): Promise<{ agency: AgencyDocument user: IUserSchema @@ -137,6 +143,7 @@ const insertFormCollectionReqs = async ({ agency: agency._id, flags, betaFlags, + apiToken, }) return { agency, user } diff --git a/frontend/package-lock.json b/frontend/package-lock.json index aa2c03e612..f4760f8636 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "form-frontend", - "version": "6.69.0", + "version": "6.70.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "form-frontend", - "version": "6.69.0", + "version": "6.70.0", "hasInstallScript": true, "dependencies": { "@chakra-ui/react": "^1.8.6", diff --git a/frontend/package.json b/frontend/package.json index 612d3f1862..5788542e64 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "form-frontend", - "version": "6.69.0", + "version": "6.70.0", "homepage": ".", "private": true, "dependencies": { diff --git a/frontend/src/app/App.tsx b/frontend/src/app/App.tsx index ba403608f6..c7aefeecde 100644 --- a/frontend/src/app/App.tsx +++ b/frontend/src/app/App.tsx @@ -1,3 +1,5 @@ +import React from 'react' +import { Inspector, InspectParams } from 'react-dev-inspector' import { HelmetProvider } from 'react-helmet-async' import { QueryClient, QueryClientProvider } from 'react-query' import { ReactQueryDevtools } from 'react-query/devtools' @@ -40,18 +42,40 @@ datadogLogs.init({ sampleRate: 100, }) -export const App = (): JSX.Element => ( - - - - - - - - - - - - - -) +export const App = (): JSX.Element => { + const isDev = process.env.NODE_ENV === 'development' + + return ( + <> + {isDev && ( + { + if (!codeInfo?.absolutePath) return + const { absolutePath, lineNumber, columnNumber } = codeInfo + // you can change the url protocol if you are using in Web IDE + window.open( + `vscode://file/${absolutePath}:${lineNumber}:${columnNumber}`, + ) + }} + /> + )} + + + + + + + + + + + + + + + ) +} diff --git a/frontend/src/components/Dropdown/SingleSelect/SingleSelectProvider.tsx b/frontend/src/components/Dropdown/SingleSelect/SingleSelectProvider.tsx index 588cd6ff29..daf290ced4 100644 --- a/frontend/src/components/Dropdown/SingleSelect/SingleSelectProvider.tsx +++ b/frontend/src/components/Dropdown/SingleSelect/SingleSelectProvider.tsx @@ -38,6 +38,8 @@ export interface SingleSelectProviderProps< children: React.ReactNode /** Color scheme of component */ colorScheme?: ThemeColorScheme + /** Variant of component */ + variant?: 'clear' fullWidth?: boolean } export const SingleSelectProvider = ({ @@ -60,6 +62,7 @@ export const SingleSelectProvider = ({ inputAria, colorScheme, comboboxProps = {}, + variant, fullWidth = false, }: SingleSelectProviderProps): JSX.Element => { const { items, getItemByValue } = useItems({ rawItems }) @@ -222,6 +225,7 @@ export const SingleSelectProvider = ({ const styles = useMultiStyleConfig('SingleSelect', { isClearable, colorScheme, + variant, }) const virtualListHeight = useMemo(() => { diff --git a/frontend/src/components/Dropdown/components/SelectCombobox/SelectCombobox.tsx b/frontend/src/components/Dropdown/components/SelectCombobox/SelectCombobox.tsx index 636bad4377..8c31292123 100644 --- a/frontend/src/components/Dropdown/components/SelectCombobox/SelectCombobox.tsx +++ b/frontend/src/components/Dropdown/components/SelectCombobox/SelectCombobox.tsx @@ -64,6 +64,7 @@ export const SelectCombobox = forwardRef( align="center" zIndex={2} aria-hidden + sx={styles.inputStack} > {selectedItemMeta.icon ? ( data) } + +/** + * Updates the payments for the given form referenced by its id + * + * @param formId the id of the form to update payments for + * @param newPayments the new payment to replace with + * @returns the updated payment on success + */ +export const updateFormPaymentProducts = async ( + formId: string, + products: PaymentsProductUpdateDto, +): Promise => { + return ApiService.put( + `${ADMIN_FORM_ENDPOINT}/${formId}/payments/products`, + products, + ).then(({ data }) => data) +} diff --git a/frontend/src/features/admin-form/common/mutations.ts b/frontend/src/features/admin-form/common/mutations.ts index acdd7f3863..76a0bf8b70 100644 --- a/frontend/src/features/admin-form/common/mutations.ts +++ b/frontend/src/features/admin-form/common/mutations.ts @@ -8,6 +8,7 @@ import { EndPageUpdateDto, FormPermission, FormPermissionsDto, + PaymentsProductUpdateDto, PaymentsUpdateDto, StartPageUpdateDto, } from '~shared/types/form/form' @@ -35,6 +36,7 @@ import { useCollaboratorWizard } from './components/CollaboratorModal/Collaborat import { permissionsToRole } from './components/CollaboratorModal/utils' import { updateFormEndPage, + updateFormPaymentProducts, updateFormPayments, updateFormStartPage, } from './AdminFormPageService' @@ -422,10 +424,38 @@ export const useMutateFormPage = () => { }, ) + const paymentsProductMutation = useMutation( + (products: PaymentsProductUpdateDto) => + updateFormPaymentProducts(formId, products), + { + onSuccess: (newData) => { + toast.closeAll() + queryClient.setQueryData( + adminFormKeys.products(formId, newData), + (oldData) => + oldData + ? { + ...oldData, + payments_field: { + ...oldData.payments_field, + products: newData, + }, + } + : undefined, + ) + toast({ + description: 'Payments product was updated.', + }) + }, + onError: handleError, + }, + ) + return { startPageMutation, endPageMutation, paymentsMutation, + paymentsProductMutation, } } diff --git a/frontend/src/features/admin-form/common/queries.ts b/frontend/src/features/admin-form/common/queries.ts index 37d638b91f..75c000cfd5 100644 --- a/frontend/src/features/admin-form/common/queries.ts +++ b/frontend/src/features/admin-form/common/queries.ts @@ -2,6 +2,7 @@ import { useMemo } from 'react' import { useQuery, UseQueryOptions, UseQueryResult } from 'react-query' import { useParams } from 'react-router-dom' +import { Product } from '~shared/types' import { AdminFormDto, PreviewFormViewDto } from '~shared/types/form/form' import { ApiError } from '~typings/core' @@ -29,6 +30,8 @@ export const adminFormKeys = { [...adminFormKeys.id(id), 'previewForm'] as const, viewFormTemplate: (id: string) => [...adminFormKeys.id(id), 'viewFormTemplate'] as const, + products: (id: string, products: Product[]) => + [...adminFormKeys.id(id), 'products', ...products] as const, } /** diff --git a/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/FieldListDrawer/FieldListDrawer.tsx b/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/FieldListDrawer/FieldListDrawer.tsx index 0ae3b14746..2ce59474e9 100644 --- a/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/FieldListDrawer/FieldListDrawer.tsx +++ b/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/FieldListDrawer/FieldListDrawer.tsx @@ -19,6 +19,7 @@ import { useUser } from '~features/user/queries' import { useCreateTabForm } from '../../../builder-and-design/useCreateTabForm' import { CreatePageDrawerCloseButton } from '../../../common' +import { FieldListTabIndex } from '../../constants' import { BasicFieldPanel, @@ -36,6 +37,30 @@ export const FieldListDrawer = (): JSX.Element => { const displayPayments = user?.betaFlags?.payment || flags?.has(featureFlags.payment) + const tabsDataList = [ + { + header: 'Basic', + component: BasicFieldPanel, + isHidden: false, + isDisabled: isLoading, + key: FieldListTabIndex.Basic, + }, + { + header: 'MyInfo', + component: MyInfoFieldPanel, + isHidden: false, + isDisabled: isLoading, + key: FieldListTabIndex.MyInfo, + }, + { + header: 'Payments', + component: PaymentsInputPanel, + isHidden: !displayPayments, + isDisabled: isLoading, + key: FieldListTabIndex.Payments, + }, + ].filter((tab) => !tab.isHidden) + return ( { - Basic - MyInfo - {displayPayments && Payments} + {tabsDataList.map((tab) => ( + + {tab.header} + + ))} - - - - - - - {displayPayments && ( - - + {tabsDataList.map((tab) => ( + + - )} + ))} ) diff --git a/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/FieldListDrawer/field-panels/PaymentsInputPanel/PaymentsInputPanel.tsx b/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/FieldListDrawer/field-panels/PaymentsInputPanel/PaymentsInputPanel.tsx index f6a23afd8e..03bed399c2 100644 --- a/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/FieldListDrawer/field-panels/PaymentsInputPanel/PaymentsInputPanel.tsx +++ b/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/FieldListDrawer/field-panels/PaymentsInputPanel/PaymentsInputPanel.tsx @@ -1,13 +1,25 @@ import { useCallback, useEffect, useMemo } from 'react' import { + Control, Controller, - UnpackNestedValue, + FormState, useForm, + UseFormRegister, + UseFormSetValue, + UseFormWatch, useWatch, } from 'react-hook-form' import { Link as ReactLink } from 'react-router-dom' import { useDebounce } from 'react-use' -import { Box, FormControl, Link, Stack, Text } from '@chakra-ui/react' +import { + Box, + Divider, + FormControl, + Link, + Stack, + Text, + Textarea, +} from '@chakra-ui/react' import { cloneDeep } from 'lodash' import { @@ -16,24 +28,22 @@ import { PaymentChannel, PaymentType, } from '~shared/types' +import { centsToDollars, dollarsToCents } from '~shared/utils/payments' import { ADMINFORM_SETTINGS_PAYMENTS_SUBROUTE } from '~constants/routes' import { ADMIN_FEEDBACK_SESSION_KEY } from '~constants/sessionStorage' import { useSessionStorage } from '~hooks/useSessionStorage' -import { centsToDollars, dollarsToCents } from '~utils/payments' import { SingleSelect } from '~components/Dropdown' import FormErrorMessage from '~components/FormControl/FormErrorMessage' import FormLabel from '~components/FormControl/FormLabel' import InlineMessage from '~components/InlineMessage' import Input from '~components/Input' +import Toggle from '~components/Toggle' import { useMutateFormPage } from '~features/admin-form/common/mutations' import { useAdminForm } from '~features/admin-form/common/queries' -import { - CreatePageDrawerContentContainer, - useCreatePageSidebar, -} from '../../../../../common' +import { useCreatePageSidebar } from '../../../../../common' import { FieldListTabIndex } from '../../../../constants' import { setIsDirtySelector, @@ -42,6 +52,7 @@ import { import { FormFieldDrawerActions } from '../../../EditFieldDrawer/edit-fieldtype/common/FormFieldDrawerActions' import { dataSelector, + PaymentStore, resetDataSelector, setDataSelector, setToEditingPaymentSelector, @@ -50,6 +61,7 @@ import { } from '../usePaymentStore' import { FixedPaymentAmountField } from './FixedPaymentAmountField' +import { ProductServiceBox } from './ProductServiceBox' import { VariablePaymentAmountField } from './VariablePaymentAmountField' export type FormPaymentsInput = Omit< @@ -61,7 +73,146 @@ export type FormPaymentsInput = Omit< display_max_amount: string } -const PaymentInput = ({ +const PaymentInnerContainer = ({ + children, +}: { + children: React.ReactNode +}): JSX.Element => { + return {children} +} +const PaymentContainer = ({ + children, +}: { + children: React.ReactNode +}): JSX.Element => { + return ( + } + spacing="2rem" + > + {children} + + ) +} + +const ProductsPaymentSection = ({ + isDisabled, + isSelectionDisabled, + errors, + register, + setValue, + paymentsMutation, + watch, +}: { + isDisabled: boolean + isSelectionDisabled: boolean + errors: FormState['errors'] + register: UseFormRegister + setValue: UseFormSetValue + watch: UseFormWatch + paymentsMutation: ReturnType['paymentsMutation'] +}) => { + const watchMultiQtyEnabled = watch('products_meta.multi_product') + return ( + <> + + { + if (newProducts.length <= 1) { + setValue('products_meta.multi_product', false) + } + setValue('products', newProducts) + }} + /> + + + + + state + /> + + + + ) +} + +const PaymentTypeSelector = ({ + isEncryptMode, + control, + paymentsMutation, + showFixedPaymentSelection, +}: { + isEncryptMode: boolean + control: Control + paymentsMutation: ReturnType['paymentsMutation'] + showFixedPaymentSelection: boolean +}) => { + return ( + + + Payment type + ( + + )} + /> + + + ) +} + +const PaymentInputFields = ({ isDisabled, isEncryptMode, }: { @@ -99,6 +250,8 @@ const PaymentInput = ({ formState: { errors, dirtyFields }, control, handleSubmit, + setValue, + watch, } = useForm({ mode: 'onChange', defaultValues: { @@ -129,15 +282,16 @@ const PaymentInput = ({ min_amount: dollarsToCents(display_min_amount ?? '0'), max_amount: dollarsToCents(display_max_amount ?? '0'), amount_cents: dollarsToCents(display_amount ?? '0'), - }) + } as FormPaymentsField) }, [setData], ) const watchedInputs = useWatch({ - control: control, - }) as UnpackNestedValue + control, + }) as FormPaymentsInput + // trigger a re-render on children by failing the shallow comparator const clonedWatchedInputs = useMemo( () => cloneDeep(watchedInputs), [watchedInputs], @@ -146,7 +300,6 @@ const PaymentInput = ({ useDebounce(() => handlePaymentsChanges(clonedWatchedInputs), 300, [ Object.values(clonedWatchedInputs), ]) - const handleUpdatePayments = handleSubmit(() => { if (isDisabled || !paymentsData) { // do not mutate if payments is disabled or unavailable @@ -169,93 +322,123 @@ const PaymentInput = ({ ) }) + const isProducts = paymentsData?.payment_type === PaymentType.Products + const isFixed = paymentsData?.payment_type === PaymentType.Fixed + return ( - - - Payment type - ( - - )} - /> - - - - - Product/service name - - - {errors.name?.message} - - + + + {isProducts ? ( + - Description - - {errors.description?.message} - - - {paymentsData?.payment_type === PaymentType.Variable ? ( - ) : ( - )} - - + + + + + + ) +} + +const FixedAndVariablePaymentSection = ({ + paymentsMutation, + errors, + isDisabled, + register, + paymentsData, + control, + formInputValues, +}: { + formInputValues: FormPaymentsInput + control: Control + errors: FormState['errors'] + isDisabled: boolean + paymentsData: PaymentStore['data'] + paymentsMutation: ReturnType['paymentsMutation'] + register: UseFormRegister +}) => { + return ( + <> + + + + + Product/service name + + + {errors.name?.message} + + + + Description +