diff --git a/CHANGELOG.md b/CHANGELOG.md index 733e5bcb0f..f5f5bc8762 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,24 @@ 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.66.0](https://github.com/opengovsg/FormSG/compare/v6.65.0...v6.66.0) + +- 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) +- fix: updating csp to fix bypass [`#6535`](https://github.com/opengovsg/FormSG/pull/6535) +- build(deps): bump winston-cloudwatch version to "6.2.0" [`#6542`](https://github.com/opengovsg/FormSG/pull/6542) +- feat: add description to form issue modal [`#6536`](https://github.com/opengovsg/FormSG/pull/6536) +- fix: presub remove additional underscore [`#6533`](https://github.com/opengovsg/FormSG/pull/6533) +- feat: presub-change-icon-to-help [`#6532`](https://github.com/opengovsg/FormSG/pull/6532) +- 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) + #### [v6.65.0](https://github.com/opengovsg/FormSG/compare/v6.64.0...v6.65.0) +> 11 July 2023 + - fix: issue report icon for mobile [`#6527`](https://github.com/opengovsg/FormSG/pull/6527) - feat: Create issue feedback UI on public form interface [`#6452`](https://github.com/opengovsg/FormSG/pull/6452) - chore: variable payments UI review changes [`#6524`](https://github.com/opengovsg/FormSG/pull/6524) @@ -26,6 +42,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - build: release v6.64.0 [`#6509`](https://github.com/opengovsg/FormSG/pull/6509) - chore: fix typo maxmium -> maximum [`#6510`](https://github.com/opengovsg/FormSG/pull/6510) - feat: deep link myinfo settings message in builder [`#6503`](https://github.com/opengovsg/FormSG/pull/6503) +- chore: bump version to v6.65.0 [`3ca3ca7`](https://github.com/opengovsg/FormSG/commit/3ca3ca76a7d347953ea5b4153de4575c2f4be3c0) #### [v6.64.0](https://github.com/opengovsg/FormSG/compare/v6.63.0...v6.64.0) @@ -352,7 +369,7 @@ 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: bump version to v6.46.0 [`767e7e5`](https://github.com/opengovsg/FormSG/commit/767e7e55c3e8f058963e890b1c249704d6db1459) +- chore: bump version to v6.46.0 [`87fda0e`](https://github.com/opengovsg/FormSG/commit/87fda0e0ec4c937350ebd013a4a9762f4acee802) #### [v6.45.0](https://github.com/opengovsg/FormSG/compare/v6.44.1...v6.45.0) @@ -515,7 +532,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - 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) -#### [v6.37.0](https://github.com/opengovsg/FormSG/compare/v6.36.1...v6.37.0) +#### [v6.37.0](https://github.com/opengovsg/FormSG/compare/v6.36.0...v6.37.0) > 24 March 2023 @@ -545,17 +562,10 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - chore(deps-dev): bump @typescript-eslint/parser from 5.54.1 to 5.55.0 in /shared [`#5922`](https://github.com/opengovsg/FormSG/pull/5922) - test(e2e/email): add form auth tests [`#5876`](https://github.com/opengovsg/FormSG/pull/5876) - build: merge v6.36.0 into develop [`#5914`](https://github.com/opengovsg/FormSG/pull/5914) +- 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) -#### [v6.36.1](https://github.com/opengovsg/FormSG/compare/v6.36.0...v6.36.1) - -> 17 March 2023 - -- build: release v6.36.0 [`#5913`](https://github.com/opengovsg/FormSG/pull/5913) -- chore: bump version to 6.36.1 [`7bc8b06`](https://github.com/opengovsg/FormSG/commit/7bc8b0669b29565be1d7a8b4cb8b76801a9a44ba) -- fix: trim dropdown options for logic check [`25e197a`](https://github.com/opengovsg/FormSG/commit/25e197a22eecec527b2b284aee0b95ccb1cd3797) - #### [v6.36.0](https://github.com/opengovsg/FormSG/compare/v6.35.0...v6.36.0) > 9 March 2023 diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 777a7261ba..3c94369445 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "form-frontend", - "version": "6.65.0", + "version": "6.66.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "form-frontend", - "version": "6.65.0", + "version": "6.66.0", "hasInstallScript": true, "dependencies": { "@chakra-ui/react": "^1.8.6", diff --git a/frontend/package.json b/frontend/package.json index da97e2c36d..14a19eb5e7 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "form-frontend", - "version": "6.65.0", + "version": "6.66.0", "homepage": ".", "private": true, "dependencies": { diff --git a/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/FieldListDrawer/field-panels/PaymentsInputPanel/VariablePaymentAmountField.tsx b/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/FieldListDrawer/field-panels/PaymentsInputPanel/VariablePaymentAmountField.tsx index ee4742b1e9..bce9785704 100644 --- a/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/FieldListDrawer/field-panels/PaymentsInputPanel/VariablePaymentAmountField.tsx +++ b/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/FieldListDrawer/field-panels/PaymentsInputPanel/VariablePaymentAmountField.tsx @@ -32,23 +32,27 @@ export const VariablePaymentAmountField = ({ minPaymentAmountCents = Number.MIN_SAFE_INTEGER, } = {}, } = useEnv() + + const minAmountInDollars = `S${formatCurrency( + Number(centsToDollars(minPaymentAmountCents)), + )}` + const maxAmountInDollars = `S${formatCurrency( + Number(centsToDollars(maxPaymentAmountCents)), + )}` + const minAmountValidation: RegisterOptions< FormPaymentsInput, typeof MIN_FIELD_KEY > = usePaymentFieldValidation({ lesserThanCents: dollarsToCents(input[MAX_FIELD_KEY] || ''), - msgWhenEmpty: `The minimum amount is S${formatCurrency( - Number(centsToDollars(minPaymentAmountCents)), - )}`, + msgWhenEmpty: `The minimum amount is ${minAmountInDollars}`, }) const maxAmountValidation: RegisterOptions< FormPaymentsInput, typeof MAX_FIELD_KEY > = usePaymentFieldValidation({ greaterThanCents: dollarsToCents(input[MIN_FIELD_KEY] || ''), - msgWhenEmpty: `The maximum amount is S${formatCurrency( - Number(centsToDollars(maxPaymentAmountCents)), - )}`, + msgWhenEmpty: `The maximum amount is ${maxAmountInDollars}`, }) return ( )} @@ -97,7 +101,7 @@ export const VariablePaymentAmountField = ({ flex={1} step={0} inputMode="decimal" - placeholder="S$1,000,000" + placeholder={maxAmountInDollars} {...field} /> )} diff --git a/frontend/src/features/admin-form/settings/SettingsService.ts b/frontend/src/features/admin-form/settings/SettingsService.ts index 2ddb570426..5b8f6b8729 100644 --- a/frontend/src/features/admin-form/settings/SettingsService.ts +++ b/frontend/src/features/admin-form/settings/SettingsService.ts @@ -119,6 +119,15 @@ export const updateBusinessInfo: UpdateStorageFormFn<'business'> = async ( return updateFormSettings(formId, { business: newBusinessField }) } +export const updateGstEnabledFlag = async ( + formId: string, + gstEnabledFlag: StorageFormSettings['payments_field']['gst_enabled'], +) => { + return updateFormSettings(formId, { + payments_field: { gst_enabled: gstEnabledFlag }, + }) +} + /** * Internal function that calls the PATCH API. * @param formId the id of the form to update diff --git a/frontend/src/features/admin-form/settings/components/PaymentSettingsSection/BusinessInfoSection.tsx b/frontend/src/features/admin-form/settings/components/PaymentSettingsSection/BusinessInfoSection.tsx index 575a7ce078..b03a9bceec 100644 --- a/frontend/src/features/admin-form/settings/components/PaymentSettingsSection/BusinessInfoSection.tsx +++ b/frontend/src/features/admin-form/settings/components/PaymentSettingsSection/BusinessInfoSection.tsx @@ -88,26 +88,18 @@ const BusinessInfoBlock = ({ } return ( <> + {settings.payments_field.gst_enabled ? ( + + GST Registration Number + + + ) : null} - - GST Registration Number - - - - - - Business Address - + Business Address { + const { data: settings, isLoading: isLoadingSettings } = + useAdminFormSettings() + + const hasGST = useMemo( + () => + settings && + settings.responseMode === FormResponseMode.Encrypt && + settings?.payments_field.gst_enabled, + [settings], + ) + + const { mutateGST } = useMutateFormSettings() + + const handleToggleGST = useCallback(() => { + if ( + !settings || + isLoadingSettings || + mutateGST.isLoading || + settings.responseMode !== FormResponseMode.Encrypt + ) { + return + } + const nextHasGst = !settings.payments_field.gst_enabled + return mutateGST.mutate(nextHasGst) + }, [isLoadingSettings, mutateGST, settings]) + + return ( + + handleToggleGST()} + /> + + ) +} diff --git a/frontend/src/features/admin-form/settings/components/PaymentSettingsSection/PaymentSettingsSection.tsx b/frontend/src/features/admin-form/settings/components/PaymentSettingsSection/PaymentSettingsSection.tsx index 71e1746f09..4a503f48e9 100644 --- a/frontend/src/features/admin-form/settings/components/PaymentSettingsSection/PaymentSettingsSection.tsx +++ b/frontend/src/features/admin-form/settings/components/PaymentSettingsSection/PaymentSettingsSection.tsx @@ -24,6 +24,7 @@ import { useEnv } from '~features/env/queries' import { useAdminFormPayments, useAdminFormSettings } from '../../queries' import { BusinessInfoSection } from './BusinessInfoSection' +import { GstToggleSection } from './GstToggleSection' import { usePaymentGuideLink } from './queries' import { StripeConnectButton, @@ -231,6 +232,7 @@ export const PaymentSettingsSection = (): JSX.Element => { {hasPaymentCapabilities && ( <> + )} diff --git a/frontend/src/features/admin-form/settings/mutations.ts b/frontend/src/features/admin-form/settings/mutations.ts index fe985ee436..ce03163b7e 100644 --- a/frontend/src/features/admin-form/settings/mutations.ts +++ b/frontend/src/features/admin-form/settings/mutations.ts @@ -37,6 +37,7 @@ import { updateFormTitle, updateFormWebhookRetries, updateFormWebhookUrl, + updateGstEnabledFlag, updateTwilioCredentials, } from './SettingsService' @@ -303,6 +304,20 @@ export const useMutateFormSettings = () => { }, ) + const mutateGST = useMutation( + (gstEnabledFlag: StorageFormSettings['payments_field']['gst_enabled']) => + updateGstEnabledFlag(formId, gstEnabledFlag), + { + onSuccess: (newData) => { + handleSuccess({ + newData, + toastDescription: `GST setting has been updated.`, + }) + }, + onError: handleError, + }, + ) + return { mutateWebhookRetries, mutateFormWebhookUrl, @@ -315,6 +330,7 @@ export const useMutateFormSettings = () => { mutateFormAuthType, mutateFormEsrvcId, mutateFormBusiness, + mutateGST, } } diff --git a/frontend/src/features/public-form/components/FormIssueFeedback/FormIssueFeedbackButton.tsx b/frontend/src/features/public-form/components/FormIssueFeedback/FormIssueFeedbackButton.tsx index ed608c7666..ac4d16c17d 100644 --- a/frontend/src/features/public-form/components/FormIssueFeedback/FormIssueFeedbackButton.tsx +++ b/frontend/src/features/public-form/components/FormIssueFeedback/FormIssueFeedbackButton.tsx @@ -1,4 +1,4 @@ -import { BiMessage } from 'react-icons/bi' +import { BiQuestionMark } from 'react-icons/bi' import { Flex, useDisclosure } from '@chakra-ui/react' import { noPrintCss } from '~utils/noPrintCss' @@ -26,7 +26,7 @@ export const FormIssueFeedbackButton = (): JSX.Element | null => { variant="outline" cursor="pointer" aria-label="issue feedback" - icon={} + icon={} onClick={onOpen} /> diff --git a/frontend/src/features/public-form/components/FormIssueFeedback/FormIssueFeedbackModal.tsx b/frontend/src/features/public-form/components/FormIssueFeedback/FormIssueFeedbackModal.tsx index 31b269cb67..e4c9849e43 100644 --- a/frontend/src/features/public-form/components/FormIssueFeedback/FormIssueFeedbackModal.tsx +++ b/frontend/src/features/public-form/components/FormIssueFeedback/FormIssueFeedbackModal.tsx @@ -98,17 +98,23 @@ export const FormIssueFeedbackModal = ({ pr="4rem" > - Have trouble filling out this form? + Report an issue + + Fill this in only{' '} + + if you are experiencing issues and are unable to submit this + form + + . If you would like to provide feedback, you can do so after + submitting the form. + - - Please describe the issue you encountered. + + Please describe the issue you encountered