diff --git a/.github/workflows/chromatic.yml b/.github/workflows/chromatic.yml index bf2b5b244f..470e4b0295 100644 --- a/.github/workflows/chromatic.yml +++ b/.github/workflows/chromatic.yml @@ -24,8 +24,10 @@ jobs: outputs: frontend: ${{ steps.filter.outputs.frontend }} steps: - - uses: actions/checkout@v2 - - uses: dorny/paths-filter@v2 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: dorny/paths-filter@v3 id: filter with: filters: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74760dfb70..355c326d44 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,8 +14,10 @@ jobs: backend: ${{ steps.filter.outputs.backend }} frontend: ${{ steps.filter.outputs.frontend }} steps: - - uses: actions/checkout@v2 - - uses: dorny/paths-filter@v2 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: dorny/paths-filter@v3 id: filter with: filters: | @@ -33,7 +35,9 @@ jobs: install: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Use Node.js uses: actions/setup-node@v3 with: @@ -51,7 +55,9 @@ jobs: needs: install runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 - run: mkdir -p build-output/ - name: Use Node.js uses: actions/setup-node@v3 @@ -80,10 +86,12 @@ jobs: frontend_test: needs: [changes, install] - if: ${{ needs.changes.outputs.frontend == 'true' }} + # if: ${{ needs.changes.outputs.frontend == 'true' }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Use Node.js uses: actions/setup-node@v3 with: @@ -96,9 +104,16 @@ jobs: with: path: '**/node_modules' key: ${{ runner.OS }}-node-modules-${{ hashFiles('**/package-lock.json') }} + - name: Configure Datadog Test Visibility + uses: datadog/test-visibility-github-action@v1.0.5 + with: + languages: js + service-name: ${{ secrets.DD_SERVICE }} + api-key: ${{ secrets.DD_API_KEY }} - name: Run frontend test env: - NODE_OPTIONS: --max-old-space-size=4096 + DD_TAGS: layer:frontend + NODE_OPTIONS: --max-old-space-size=4096 -r ${{ env.DD_TRACE_PACKAGE }} AWS_SDK_JS_SUPPRESS_MAINTENANCE_MODE_MESSAGE: 1 run: npm run test:frontend @@ -107,7 +122,9 @@ jobs: if: ${{ needs.changes.outputs.frontend == 'true' }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Use Node.js uses: actions/setup-node@v3 with: @@ -124,7 +141,7 @@ jobs: backend_test: needs: [changes, install, build] - if: ${{ needs.changes.outputs.backend == 'true' }} + # if: ${{ needs.changes.outputs.backend == 'true' }} runs-on: ubuntu-latest steps: # prevent CI from failing when worker runs out of memory @@ -138,7 +155,9 @@ jobs: sudo mkswap /swapfile sudo swapon /swapfile sudo swapon --show - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 - uses: actions/download-artifact@v3 if: always() with: @@ -156,9 +175,16 @@ jobs: path: '**/node_modules' key: ${{ runner.OS }}-node-modules-${{ hashFiles('**/package-lock.json') }} - run: npm ci --prefix serverless/virus-scanner + - name: Configure Datadog Test Visibility + uses: datadog/test-visibility-github-action@v1.0.5 + with: + languages: js + service-name: ${{ secrets.DD_SERVICE }} + api-key: ${{ secrets.DD_API_KEY }} - run: npm run test:backend:ci env: - NODE_OPTIONS: '--max-old-space-size=4096' + DD_TAGS: layer:backend + NODE_OPTIONS: --max-old-space-size=4096 -r ${{ env.DD_TRACE_PACKAGE }} AWS_SDK_JS_SUPPRESS_MAINTENANCE_MODE_MESSAGE: 1 - name: Coveralls uses: coverallsapp/github-action@master @@ -170,7 +196,9 @@ jobs: if: ${{ needs.changes.outputs.backend == 'true' }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Use Node.js uses: actions/setup-node@v3 with: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 89ffa50aa7..62ce16cd9b 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -3,7 +3,7 @@ # # You may wish to alter this file to override the set of languages analyzed, # or to provide custom queries or build logic. -name: "CodeQL" +name: 'CodeQL' on: push: @@ -29,43 +29,43 @@ jobs: # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - # We must fetch at least the immediate parents so that if this is - # a pull request then we can checkout the head. - fetch-depth: 2 + - name: Checkout repository + uses: actions/checkout@v4 + with: + # We must fetch at least the immediate parents so that if this is + # a pull request then we can checkout the head. + fetch-depth: 2 - # If this run was triggered by a pull request event, then checkout - # the head of the pull request instead of the merge commit. - - run: git checkout HEAD^2 - if: ${{ github.event_name == 'pull_request' }} + # If this run was triggered by a pull request event, then checkout + # the head of the pull request instead of the merge commit. + - run: git checkout HEAD^2 + if: ${{ github.event_name == 'pull_request' }} - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 - # ℹ️ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl + # ℹ️ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl - # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language + # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language - #- run: | - # make bootstrap - # make release + #- run: | + # make bootstrap + # make release - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/deploy-eb.yml b/.github/workflows/deploy-eb.yml index c0c2626185..bdaf7d6800 100644 --- a/.github/workflows/deploy-eb.yml +++ b/.github/workflows/deploy-eb.yml @@ -34,7 +34,9 @@ jobs: BRANCH: ${{ needs.set_environment.outputs.current_env }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Setup secrets for datadog sourcemap deployment run: | echo "APP_VERSION=$(jq -r .version package.json)-$(echo ${GITHUB_REF##*/})-$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_ENV diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index fc1aa5608b..36c3e19cd7 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -10,6 +10,7 @@ jobs: runs-on: ubuntu-latest env: AWS_SDK_JS_SUPPRESS_MAINTENANCE_MODE_MESSAGE: 1 + DD_TAGS: layer:e2e steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 @@ -19,18 +20,30 @@ jobs: run: npm ci - name: Install Playwright Browsers run: npx playwright install --with-deps + - name: Configure Datadog Test Visibility + uses: datadog/test-visibility-github-action@v1.0.5 + with: + languages: js + service-name: ${{ secrets.DD_SERVICE }} + api-key: ${{ secrets.DD_API_KEY }} - name: Build env: - NODE_OPTIONS: '--max-old-space-size=4096 --openssl-legacy-provider' + NODE_OPTIONS: --max-old-space-size=4096 --openssl-legacy-provider -r ${{ env.DD_TRACE_PACKAGE }} REACT_APP_FORMSG_SDK_MODE: 'test' run: npm run build - name: Run Playwright tests (login) + env: + NODE_OPTIONS: -r ${{ env.DD_TRACE_PACKAGE }} run: npx playwright test __tests__/e2e/login.spec.ts timeout-minutes: 5 - name: Run Playwright tests (email-submission) + env: + NODE_OPTIONS: -r ${{ env.DD_TRACE_PACKAGE }} run: npx playwright test __tests__/e2e/email-submission.spec.ts timeout-minutes: 15 - name: Run Playwright tests (encrypt-submission) + env: + NODE_OPTIONS: -r ${{ env.DD_TRACE_PACKAGE }} run: npx playwright test __tests__/e2e/encrypt-submission.spec.ts timeout-minutes: 15 - uses: actions/upload-artifact@v3 diff --git a/CHANGELOG.md b/CHANGELOG.md index 257a95ba74..cec248b2b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,30 @@ 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.138.0](https://github.com/opengovsg/FormSG/compare/v6.137.0...v6.138.0) + +- fix: statsD default route not found [`#7551`](https://github.com/opengovsg/FormSG/pull/7551) +- feat(fe-quality): updating outdated links and copy content [`#7552`](https://github.com/opengovsg/FormSG/pull/7552) +- fix: mock statsD client during dev/test env [`#7550`](https://github.com/opengovsg/FormSG/pull/7550) +- fix(deps): bump libphonenumber-js from 1.11.4 to 1.11.5 in /shared [`#7547`](https://github.com/opengovsg/FormSG/pull/7547) +- chore(deps-dev): bump eslint-plugin-simple-import-sort from 12.1.0 to 12.1.1 [`#7544`](https://github.com/opengovsg/FormSG/pull/7544) +- chore(ci): pipe test coverage results to datadog [`#7542`](https://github.com/opengovsg/FormSG/pull/7542) +- fix(deps): bump type-fest from 4.22.1 to 4.23.0 in /shared [`#7541`](https://github.com/opengovsg/FormSG/pull/7541) +- fix(deps): bump type-fest from 4.22.0 to 4.22.1 in /shared [`#7540`](https://github.com/opengovsg/FormSG/pull/7540) +- chore: add simple fix to date format for sample form submission api [`#7539`](https://github.com/opengovsg/FormSG/pull/7539) +- fix(deps): bump type-fest from 4.21.0 to 4.22.0 in /shared [`#7536`](https://github.com/opengovsg/FormSG/pull/7536) +- chore(deps-dev): bump eslint-plugin-prettier from 5.1.3 to 5.2.1 in /shared [`#7535`](https://github.com/opengovsg/FormSG/pull/7535) +- build: merge release v6.137.0 to develop [`#7533`](https://github.com/opengovsg/FormSG/pull/7533) +- build: release v6.137.0 [`#7532`](https://github.com/opengovsg/FormSG/pull/7532) + #### [v6.137.0](https://github.com/opengovsg/FormSG/compare/v6.136.0...v6.137.0) +> 17 July 2024 + - chore(frontend): remove isSingleSubmission toggle for email mode form… [`#7530`](https://github.com/opengovsg/FormSG/pull/7530) - build: merge release v6.136.0 to develop [`#7531`](https://github.com/opengovsg/FormSG/pull/7531) - build: release v6.136.0 [`#7528`](https://github.com/opengovsg/FormSG/pull/7528) +- chore: bump version to v6.137.0 [`fd05950`](https://github.com/opengovsg/FormSG/commit/fd05950516c2324bf2fdaa65b2a8a2349d707d41) - chore(Frontend): remove isSingleSubmission toggle for email mode form that have not yet enabled it [`de48cc0`](https://github.com/opengovsg/FormSG/commit/de48cc018e9d15d1109a7d09845fcaf6734b35c1) #### [v6.136.0](https://github.com/opengovsg/FormSG/compare/v6.135.0...v6.136.0) @@ -161,20 +180,19 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - fix: add default values for postman env variables to docker compose [`#7424`](https://github.com/opengovsg/FormSG/pull/7424) - fix: email notifications with wrong submission id [`#7418`](https://github.com/opengovsg/FormSG/pull/7418) - build: release v6.128.0 [`#7419`](https://github.com/opengovsg/FormSG/pull/7419) -- fix(btn): form admin not fully resolved when retrieved from FormService [`#7420`](https://github.com/opengovsg/FormSG/pull/7420) - fix: fix issue where email notifs for storage forms have wrong submission id [`66b27ab`](https://github.com/opengovsg/FormSG/commit/66b27abcc08e7b71a10c80989e9626f963d4601c) -- chore: bump version to v6.128.0 [`8f91bf0`](https://github.com/opengovsg/FormSG/commit/8f91bf0cbe541487bc9cd2775dd4c3c135b13f70) - chore: bump version to v6.129.0 [`061dc4f`](https://github.com/opengovsg/FormSG/commit/061dc4fa0b106300764268f1b5f0671de75a7213) #### [v6.128.0](https://github.com/opengovsg/FormSG/compare/v6.127.1...v6.128.0) > 20 June 2024 +- fix(btn): form admin not fully resolved when retrieved from FormService [`#7420`](https://github.com/opengovsg/FormSG/pull/7420) - feat(btn): frm 1717 mop flow to postman [`#7342`](https://github.com/opengovsg/FormSG/pull/7342) - build: merge release v6.127.1 to develop [`#7416`](https://github.com/opengovsg/FormSG/pull/7416) - fix(deps): bump libphonenumber-js from 1.11.3 to 1.11.4 in /shared [`#7415`](https://github.com/opengovsg/FormSG/pull/7415) - hotfix: dupe form fail [`#7414`](https://github.com/opengovsg/FormSG/pull/7414) -- chore: bump version to v6.128.0 [`4b8cea2`](https://github.com/opengovsg/FormSG/commit/4b8cea2a46a258b96dc9b7be31b480481b8e30e8) +- chore: bump version to v6.128.0 [`8f91bf0`](https://github.com/opengovsg/FormSG/commit/8f91bf0cbe541487bc9cd2775dd4c3c135b13f70) #### [v6.127.1](https://github.com/opengovsg/FormSG/compare/v6.127.0...v6.127.1) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 4e14d9503c..3e1f008088 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "form-frontend", - "version": "6.137.0", + "version": "6.138.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "form-frontend", - "version": "6.137.0", + "version": "6.138.0", "hasInstallScript": true, "dependencies": { "@chakra-ui/react": "^1.8.6", diff --git a/frontend/package.json b/frontend/package.json index 3683962e04..98455cd9a9 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "form-frontend", - "version": "6.137.0", + "version": "6.138.0", "homepage": ".", "private": true, "dependencies": { diff --git a/frontend/src/constants/links.ts b/frontend/src/constants/links.ts index ca5798a74a..d187050c44 100644 --- a/frontend/src/constants/links.ts +++ b/frontend/src/constants/links.ts @@ -1,7 +1,7 @@ import { PRIVACY_POLICY_ROUTE, TOU_ROUTE } from './routes' export const CONTACT_US = 'https://go.gov.sg/formsg-support' -export const FEATURE_REQUEST = 'https://go.gov.sg/form-featurerequest' +export const FEATURE_REQUEST = 'https://go.gov.sg/formsg-featurerequest' export const REPORT_VULNERABILITY = 'https://go.gov.sg/report-vulnerability' export const OSS_README = 'https://go.gov.sg/formsg-thirdparty' @@ -10,18 +10,19 @@ export const SINGPASS_FAQ = 'https://www.singpass.gov.sg/main/html/faq.html' // FormSG guide links export const FORM_GUIDE = 'https://go.gov.sg/formsg-guides' export const GUIDE_WEBHOOKS = 'https://go.gov.sg/formsg-guide-webhooks' -export const GUIDE_EMAIL_MODE = 'https://go.gov.sg/formsg-guide-email-mode' export const GUIDE_STORAGE_MODE = 'https://go.gov.sg/formsg-guide-storage-mode' export const GUIDE_FORM_LOGIC = 'https://go.gov.sg/formsg-guide-logic' export const GUIDE_FORM_MRF = 'https://go.gov.sg/formsg-guide-mrf' export const GUIDE_MRF_MODE = 'http://go.gov.sg/formsg-mrf' +export const GUIDE_MYINFO_BUILDER_FIELD = + 'https://go.gov.sg/formsg-guide-singpass-myinfo' export const GUIDE_SPCP_ESRVCID = 'https://go.gov.sg/formsg-guide-singpass-myinfo' export const GUIDE_ENABLE_SPCP = 'https://go.gov.sg/formsg-guide-singpass-myinfo-enable' export const GUIDE_TWILIO = 'https://go.gov.sg/formsg-guide-verified-smses' export const GUIDE_ATTACHMENT_SIZE_LIMIT = - 'https://go.gov.sg/formsg-guide-attachment-size-increase' + 'https://go.gov.sg/formsg-guide-attachments' export const GUIDE_E2EE = 'https://go.gov.sg/formsg-guide-e2e' export const GUIDE_TRANSFER_OWNERSHIP = 'https://go.gov.sg/formsg-guide-transfer-ownership' @@ -38,7 +39,8 @@ export const GUIDE_PAYMENTS_INVOICE_DIFFERENCES = 'https://go.gov.sg/formsg-payments-invoice-differences' export const GUIDE_ENCRYPTION_BOUNDARY_SHIFT = 'https://guide.form.gov.sg/faq/faq/storage-mode-virus-scanning-and-content-validation' -export const ACCEPTED_FILETYPES_SPREADSHEET = 'https://go.gov.sg/formsg-cwl' +export const ACCEPTED_FILETYPES_SPREADSHEET = + 'https://go.gov.sg/formsg-guide-attachments' export const APP_FOOTER_LINKS = [ { label: 'Guide', href: FORM_GUIDE }, @@ -51,18 +53,6 @@ export const APP_FOOTER_LINKS = [ ] export const LANDING_PAGE_EXAMPLE_FORMS = [ - { - href: 'https://form.gov.sg/600c490b7c026600138d4ca9', - label: 'Register for COVID-19 Vaccination', - }, - { - href: 'https://form.gov.sg/5eb38e989bd7d80011066a02', - label: 'Daily Reporting Health Symptoms', - }, - { - href: 'https://form.gov.sg/6057667b248bbc0012ceda2f', - label: 'Gov.sg WhatsApp Subscription', - }, { href: 'https://form.gov.sg/6041e9f8bd47260012395250', label: 'Post-ICT Survey', @@ -78,7 +68,7 @@ export const LANDING_PAGE_EXAMPLE_FORMS = [ ] export const OGP_ALL_PRODUCTS = 'https://www.open.gov.sg/products/overview' -export const OGP_POSTMAN = 'https://postman.gov.sg' +export const OGP_POSTMAN = 'https://go.gov.sg/formsg-guide-postman' export const OGP_PLUMBER = 'https://plumber.gov.sg/' export const OGP_SGID = 'https://go.gov.sg/sgid-formsg' diff --git a/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/EditFieldDrawer/edit-fieldtype/EditMobile/EditMobile.tsx b/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/EditFieldDrawer/edit-fieldtype/EditMobile/EditMobile.tsx index f69f14182a..6f61eccbaa 100644 --- a/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/EditFieldDrawer/edit-fieldtype/EditMobile/EditMobile.tsx +++ b/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/EditFieldDrawer/edit-fieldtype/EditMobile/EditMobile.tsx @@ -91,7 +91,7 @@ export const EditMobile = ({ field }: EditMobileProps): JSX.Element => { diff --git a/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/FieldListDrawer/field-panels/MyInfoPanel.tsx b/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/FieldListDrawer/field-panels/MyInfoPanel.tsx index c85bdad2c7..d755c6eac0 100644 --- a/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/FieldListDrawer/field-panels/MyInfoPanel.tsx +++ b/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/FieldListDrawer/field-panels/MyInfoPanel.tsx @@ -12,7 +12,7 @@ import { MyInfoAttribute, } from '~shared/types' -import { GUIDE_EMAIL_MODE } from '~constants/links' +import { GUIDE_MYINFO_BUILDER_FIELD } from '~constants/links' import { ADMINFORM_SETTINGS_SINGPASS_SUBROUTE } from '~constants/routes' import InlineMessage from '~components/InlineMessage' import Link from '~components/Link' @@ -269,7 +269,7 @@ const MyInfoText = ({ return ( {`Only 30 MyInfo fields are allowed (${numMyInfoFields}/30). `} - + Learn more diff --git a/frontend/src/hooks/useMdComponents.tsx b/frontend/src/hooks/useMdComponents.tsx index 35f515cdfd..71332613cf 100644 --- a/frontend/src/hooks/useMdComponents.tsx +++ b/frontend/src/hooks/useMdComponents.tsx @@ -20,9 +20,13 @@ type MdComponentStyles = { */ text?: CSSObject /** - * If exists, will be used for styling text + * If exists, will be used for styling lists */ list?: CSSObject + /** + * If exists, will be used for styling ordered lists + */ + listItem?: CSSObject } type UseMdComponentsProps = { @@ -55,6 +59,15 @@ export const useMdComponents = ({ [styles.link], ) + const listItemStyle = useMemo( + () => ({ + sx: { + ...(styles.listItem ?? {}), + }, + }), + [styles.listItem], + ) + const listStyles = useMemo( () => ({ sx: { @@ -79,7 +92,7 @@ export const useMdComponents = ({ ), li: ({ node, ordered, ...props }) => ( - + ), a: ({ node, ...props }) => { const { href } = props @@ -91,7 +104,7 @@ export const useMdComponents = ({ p: ({ node, ...props }) => , ...overrides, }), - [linkStyles, overrides, textStyles, listStyles], + [linkStyles, overrides, textStyles, listStyles, listItemStyle], ) return mdComponents diff --git a/frontend/src/pages/Landing/Home/LandingPage.tsx b/frontend/src/pages/Landing/Home/LandingPage.tsx index 8103b781b8..c121485002 100644 --- a/frontend/src/pages/Landing/Home/LandingPage.tsx +++ b/frontend/src/pages/Landing/Home/LandingPage.tsx @@ -84,7 +84,12 @@ import { useLanding } from './queries' export const LandingPage = (): JSX.Element => { const { data } = useLanding() const isMobile = useIsMobile() - const mdComponents = useMdComponents() + const mdComponents = useMdComponents({ + styles: { + text: { whiteSpace: 'initial' }, + listItem: { marginBottom: '1rem' }, + }, + }) return ( <> @@ -452,7 +457,8 @@ export const LandingPage = (): JSX.Element => { - Download your responses as a CSV + Download your responses as a CSV and collect responses at your + email address diff --git a/jest.config.js b/jest.config.js index 3162c63121..9711cda9e9 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,3 +1,4 @@ +/** @type {import('jest').Config} */ module.exports = { preset: 'ts-jest', testMatch: ['**/?(*.)+(spec|test).[t]s?(x)'], diff --git a/package-lock.json b/package-lock.json index 8c04c3eef9..4aca1f0e37 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "FormSG", - "version": "6.137.0", + "version": "6.138.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "FormSG", - "version": "6.137.0", + "version": "6.138.0", "hasInstallScript": true, "dependencies": { "@aws-sdk/client-cloudwatch-logs": "^3.536.0", @@ -171,7 +171,7 @@ "eslint-plugin-jest": "^28.6.0", "eslint-plugin-playwright": "^1.6.0", "eslint-plugin-prettier": "^5.1.3", - "eslint-plugin-simple-import-sort": "^12.1.0", + "eslint-plugin-simple-import-sort": "^12.1.1", "eslint-plugin-typesafe": "^0.5.2", "form-data": "^4.0.0", "htmlhint": "^1.1.4", @@ -14811,9 +14811,9 @@ } }, "node_modules/eslint-plugin-simple-import-sort": { - "version": "12.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-12.1.0.tgz", - "integrity": "sha512-Y2fqAfC11TcG/WP3TrI1Gi3p3nc8XJyEOJYHyEPEGI/UAgNx6akxxlX74p7SbAQdLcgASKhj8M0GKvH3vq/+ig==", + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-12.1.1.tgz", + "integrity": "sha512-6nuzu4xwQtE3332Uz0to+TxDQYRLTKRESSc2hefVT48Zc8JthmN23Gx9lnYhu0FtkRSL1oxny3kJ2aveVhmOVA==", "dev": true, "peerDependencies": { "eslint": ">=5.0.0" diff --git a/package.json b/package.json index 6efce7eadc..d44d3bef6f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "FormSG", "description": "Form Manager for Government", - "version": "6.137.0", + "version": "6.138.0", "homepage": "https://form.gov.sg", "authors": [ "FormSG " @@ -217,7 +217,7 @@ "eslint-plugin-jest": "^28.6.0", "eslint-plugin-playwright": "^1.6.0", "eslint-plugin-prettier": "^5.1.3", - "eslint-plugin-simple-import-sort": "^12.1.0", + "eslint-plugin-simple-import-sort": "^12.1.1", "eslint-plugin-typesafe": "^0.5.2", "form-data": "^4.0.0", "htmlhint": "^1.1.4", diff --git a/shared/package-lock.json b/shared/package-lock.json index ce274ea1c2..d10f8b51d8 100644 --- a/shared/package-lock.json +++ b/shared/package-lock.json @@ -397,13 +397,13 @@ } }, "node_modules/eslint-plugin-prettier": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.1.3.tgz", - "integrity": "sha512-C9GCVAs4Eq7ZC/XFQHITLiHJxQngdtraXaM+LoUFoFp/lHNl2Zn8f3WQbe9HvTBBQ9YnKFB0/2Ajdqwo5D1EAw==", + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.1.tgz", + "integrity": "sha512-gH3iR3g4JfF+yYPaJYkN7jEl9QbweL/YfkoRlNnuIEHEz1vHVlCmWOS+eGGiRuzHQXdJFCOTxRgvju9b8VUmrw==", "dev": true, "dependencies": { "prettier-linter-helpers": "^1.0.0", - "synckit": "^0.8.6" + "synckit": "^0.9.1" }, "engines": { "node": "^14.18.0 || >=16.0.0" @@ -590,9 +590,9 @@ } }, "node_modules/libphonenumber-js": { - "version": "1.11.4", - "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.11.4.tgz", - "integrity": "sha512-F/R50HQuWWYcmU/esP5jrH5LiWYaN7DpN0a/99U8+mnGGtnx8kmRE+649dQh3v+CowXXZc8vpkf5AmYkO0AQ7Q==" + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.11.5.tgz", + "integrity": "sha512-TwHR5BZxGRODtAfz03szucAkjT5OArXr+94SMtAM2pYXIlQNVMrxvb6uSCbnaJJV6QXEyICk7+l6QPgn72WHhg==" }, "node_modules/lie": { "version": "3.3.0", @@ -826,9 +826,9 @@ } }, "node_modules/synckit": { - "version": "0.8.8", - "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.8.tgz", - "integrity": "sha512-HwOKAP7Wc5aRGYdKH+dw0PRRpbO841v2DENBtjnR5HFWoiNByAl7vrx3p0G/rCyYXQsrxqtX48TImFtPcIHSpQ==", + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.9.1.tgz", + "integrity": "sha512-7gr8p9TQP6RAHusBOSLs46F4564ZrjV8xFmw5zCmgmhGUcw2hxsShhJ6CEiHQMgPDwAQ1fWHPM0ypc4RMAig4A==", "dev": true, "dependencies": { "@pkgr/core": "^0.1.0", @@ -866,15 +866,15 @@ } }, "node_modules/tslib": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", + "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==", "dev": true }, "node_modules/type-fest": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.21.0.tgz", - "integrity": "sha512-ADn2w7hVPcK6w1I0uWnM//y1rLXZhzB9mr0a3OirzclKF1Wp6VzevUmzz/NRAWunOT6E8HrnpGY7xOfc6K57fA==", + "version": "4.23.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.23.0.tgz", + "integrity": "sha512-ZiBujro2ohr5+Z/hZWHESLz3g08BBdrdLMieYFULJO+tWc437sn8kQsWLJoZErY8alNhxre9K4p3GURAG11n+w==", "engines": { "node": ">=16" }, diff --git a/src/app/config/datadog-statsd-client.ts b/src/app/config/datadog-statsd-client.ts index 79cedb16ea..cb8f934845 100644 --- a/src/app/config/datadog-statsd-client.ts +++ b/src/app/config/datadog-statsd-client.ts @@ -1,3 +1,7 @@ import { StatsD } from 'hot-shots' -export const statsdClient = new StatsD({ useDefaultRoute: true }) +import config from './config' + +export const statsdClient = new StatsD({ + useDefaultRoute: !config.isDev, +}) diff --git a/src/app/modules/datadog/__mocks__/datadog.utils.ts b/src/app/modules/datadog/__mocks__/datadog.utils.ts new file mode 100644 index 0000000000..586d4b6964 --- /dev/null +++ b/src/app/modules/datadog/__mocks__/datadog.utils.ts @@ -0,0 +1,18 @@ +import { IPopulatedForm } from 'src/types' + +import { ApplicationError } from '../../core/core.errors' + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +export const setFormTags = (_form: IPopulatedForm) => { + return +} + +/** + * Sets the tags for the current active span. Should be called by a top-level + * controller. + * @param _error The error to set the tags for + */ +// eslint-disable-next-line @typescript-eslint/no-unused-vars +export const setErrorCode = (_error: ApplicationError) => { + return +} diff --git a/src/app/modules/form/form.service.ts b/src/app/modules/form/form.service.ts index c87cf9f476..0226e5b3ea 100644 --- a/src/app/modules/form/form.service.ts +++ b/src/app/modules/form/form.service.ts @@ -557,7 +557,7 @@ export const createSingleSampleSubmissionAnswer = (field: FormFieldDto) => { } case BasicField.Date: { const sampleValue = faker.date.anytime().toLocaleDateString('en-SG', { - day: 'numeric', + day: '2-digit', month: 'short', year: 'numeric', }) diff --git a/src/app/modules/submission/email-submission/__tests__/email-submission.controller.spec.ts b/src/app/modules/submission/email-submission/__tests__/email-submission.controller.spec.ts index 463ce5382c..8b966ba737 100644 --- a/src/app/modules/submission/email-submission/__tests__/email-submission.controller.spec.ts +++ b/src/app/modules/submission/email-submission/__tests__/email-submission.controller.spec.ts @@ -24,6 +24,7 @@ import { } from '../../submission.utils' import { submitEmailModeForm } from '../email-submission.controller' +jest.mock('src/app/modules/datadog/datadog.utils') jest.mock( 'src/app/modules/submission/email-submission/email-submission.service', ) diff --git a/src/app/modules/submission/encrypt-submission/__tests__/encrypt-submission.controller.spec.ts b/src/app/modules/submission/encrypt-submission/__tests__/encrypt-submission.controller.spec.ts index d616f3ae20..dc9452b219 100644 --- a/src/app/modules/submission/encrypt-submission/__tests__/encrypt-submission.controller.spec.ts +++ b/src/app/modules/submission/encrypt-submission/__tests__/encrypt-submission.controller.spec.ts @@ -29,6 +29,7 @@ import { SubmitEncryptModeFormHandlerRequest, } from '../encrypt-submission.types' +jest.mock('src/app/modules/datadog/datadog.utils') jest.mock('src/app/utils/pipeline-middleware', () => { const MockPipeline = jest.fn().mockImplementation(() => { return { diff --git a/src/app/modules/verification/__tests__/verification.controller.spec.ts b/src/app/modules/verification/__tests__/verification.controller.spec.ts index 8a73e15bf7..4bd9b7658b 100644 --- a/src/app/modules/verification/__tests__/verification.controller.spec.ts +++ b/src/app/modules/verification/__tests__/verification.controller.spec.ts @@ -74,6 +74,7 @@ import { const VerificationModel = getVerificationModel(mongoose) +jest.mock('src/app/modules/datadog/datadog.utils') jest.mock('../verification.service') const MockVerificationService = jest.mocked(VerificationService) jest.mock('src/app/utils/otp')