Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: release v6.121.0 #7326

Merged
merged 6 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,19 @@ 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.121.0](https://github.com/opengovsg/FormSG/compare/v6.120.0...v6.121.0)

- fix(mrf): input transformation types for decrypting radio others [`#7325`](https://github.com/opengovsg/FormSG/pull/7325)
- fix(mrf): attachment equality validation [`#7324`](https://github.com/opengovsg/FormSG/pull/7324)
- fix(deps): bump validator from 13.11.0 to 13.12.0 in /shared [`#7323`](https://github.com/opengovsg/FormSG/pull/7323)
- fix(deps): bump zod from 3.23.6 to 3.23.8 in /shared [`#7322`](https://github.com/opengovsg/FormSG/pull/7322)
- build: merge v6.120.0 into develop [`#7321`](https://github.com/opengovsg/FormSG/pull/7321)
- build: release v6.120.0 [`#7320`](https://github.com/opengovsg/FormSG/pull/7320)

#### [v6.120.0](https://github.com/opengovsg/FormSG/compare/v6.119.1...v6.120.0)

> 8 May 2024

- fix: added validation for empty attachments [`#7318`](https://github.com/opengovsg/FormSG/pull/7318)
- fix(deps): bump libphonenumber-js from 1.11.0 to 1.11.1 in /shared [`#7319`](https://github.com/opengovsg/FormSG/pull/7319)
- build: merge v6.119.1 into develop [`#7315`](https://github.com/opengovsg/FormSG/pull/7315)
Expand All @@ -16,6 +27,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- fix(deps): bump libphonenumber-js from 1.10.61 to 1.10.62 in /shared [`#7312`](https://github.com/opengovsg/FormSG/pull/7312)
- chore(deps-dev): bump @types/lodash from 4.17.0 to 4.17.1 in /shared [`#7311`](https://github.com/opengovsg/FormSG/pull/7311)
- fix(deps): bump zod from 3.23.5 to 3.23.6 in /shared [`#7310`](https://github.com/opengovsg/FormSG/pull/7310)
- chore: bump version to v6.120.0 [`94e5fdf`](https://github.com/opengovsg/FormSG/commit/94e5fdf05b8abb02947ffa86a0677349c442a634)

#### [v6.119.1](https://github.com/opengovsg/FormSG/compare/v6.119.0...v6.119.1)

Expand Down Expand Up @@ -53,6 +65,12 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- build: merge release v6.117.0 into develop [`#7284`](https://github.com/opengovsg/FormSG/pull/7284)
- build: release v6.117.0 [`#7266`](https://github.com/opengovsg/FormSG/pull/7266)
- fix(deps): bump zod from 3.23.0 to 3.23.4 in /shared [`#7283`](https://github.com/opengovsg/FormSG/pull/7283)
- chore: bump version to v6.118.0 [`6f415b1`](https://github.com/opengovsg/FormSG/commit/6f415b1be388afb78d7d7ae25e3c0cd779c9b6a4)

#### [v6.117.0](https://github.com/opengovsg/FormSG/compare/v6.116.0...v6.117.0)

> 23 April 2024

- feat(i18n): add common strings for translation [`#7256`](https://github.com/opengovsg/FormSG/pull/7256)
- fix(btn): remove admin sms toggle check [`#7275`](https://github.com/opengovsg/FormSG/pull/7275)
- feat: update localstack docker image [`#7271`](https://github.com/opengovsg/FormSG/pull/7271)
Expand All @@ -61,13 +79,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- fix(deps): bump type-fest from 4.15.0 to 4.16.0 in /shared [`#7274`](https://github.com/opengovsg/FormSG/pull/7274)
- fix(deps): bump zod from 3.22.5 to 3.23.0 in /shared [`#7273`](https://github.com/opengovsg/FormSG/pull/7273)
- fix(deps): bump libphonenumber-js from 1.10.60 to 1.10.61 in /shared [`#7272`](https://github.com/opengovsg/FormSG/pull/7272)
- chore: bump version to v6.117.0 [`6eb4aca`](https://github.com/opengovsg/FormSG/commit/6eb4aca28514e3286c23c0834f9962de291a7fbc)
- chore: bump version to v6.118.0 [`6f415b1`](https://github.com/opengovsg/FormSG/commit/6f415b1be388afb78d7d7ae25e3c0cd779c9b6a4)

#### [v6.117.0](https://github.com/opengovsg/FormSG/compare/v6.116.0...v6.117.0)

> 22 April 2024

- chore: add missing packages in package-lock [`#7270`](https://github.com/opengovsg/FormSG/pull/7270)
- build: release v6.116.0 to develop [`#7269`](https://github.com/opengovsg/FormSG/pull/7269)
- build: merge release v6.116.0 to develop [`#7263`](https://github.com/opengovsg/FormSG/pull/7263)
Expand All @@ -80,7 +91,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- chore: refactor to move endpage block to generic folder [`#7248`](https://github.com/opengovsg/FormSG/pull/7248)
- build: release v6.116.0 [`#7251`](https://github.com/opengovsg/FormSG/pull/7251)
- chore: reverting package-lock changes [`040b962`](https://github.com/opengovsg/FormSG/commit/040b96284ea317de22d9de6cf872fd4116f24c51)
- chore: bump version to v6.117.0 [`79b8da4`](https://github.com/opengovsg/FormSG/commit/79b8da4927f38239692e681998fa9263d4ae34f6)
- chore: bump version to v6.117.0 [`6eb4aca`](https://github.com/opengovsg/FormSG/commit/6eb4aca28514e3286c23c0834f9962de291a7fbc)

#### [v6.116.0](https://github.com/opengovsg/FormSG/compare/v6.115.0...v6.116.0)

Expand Down
4 changes: 2 additions & 2 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "form-frontend",
"version": "6.120.0",
"version": "6.121.0",
"homepage": ".",
"private": true,
"dependencies": {
Expand Down
19 changes: 8 additions & 11 deletions frontend/src/features/public-form/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const usePublicFormMutations = (
},
)

const useSubmitStorageModeFormMutation = (
const useSubmitMutationWithAttachmentVirusScanning = (
f: (
args: SubmitStorageFormClearArgs & {
fieldIdToQuarantineKeyMap: FieldIdToQuarantineKeyType[]
Expand Down Expand Up @@ -164,20 +164,17 @@ export const usePublicFormMutations = (
)
})

const submitStorageModeFormMutation = useSubmitStorageModeFormMutation(
submitStorageModeForm,
)
const submitStorageModeFormMutation =
useSubmitMutationWithAttachmentVirusScanning(submitStorageModeForm)

const submitStorageModeFormFetchMutation = useSubmitStorageModeFormMutation(
submitStorageModeFormWithFetch,
)
const submitStorageModeFormFetchMutation =
useSubmitMutationWithAttachmentVirusScanning(submitStorageModeFormWithFetch)

const submitMultirespondentFormMutation = useSubmitStorageModeFormMutation(
submitMultirespondentForm,
)
const submitMultirespondentFormMutation =
useSubmitMutationWithAttachmentVirusScanning(submitMultirespondentForm)

const updateMultirespondentSubmissionMutation =
useSubmitStorageModeFormMutation((args) =>
useSubmitMutationWithAttachmentVirusScanning((args) =>
updateMultirespondentSubmission({ ...args, submissionSecretKey }),
)

Expand Down
62 changes: 42 additions & 20 deletions frontend/src/features/public-form/utils/inputTransformation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ import { format, parse } from 'date-fns'
import { times } from 'lodash'

import { DATE_PARSE_FORMAT } from '~shared/constants/dates'
import {
AttachmentFieldResponseV3,
CheckboxFieldResponsesV3,
ChildrenCompoundFieldResponsesV3,
FieldResponseAnswerMapV3,
RadioFieldResponsesV3,
TableFieldResponsesV3,
VerifiableFieldResponsesV3,
YesNoFieldResponseV3,
} from '~shared/types'
import { BasicField, FormFieldDto } from '~shared/types/field'
import {
AttachmentResponse,
Expand Down Expand Up @@ -55,7 +65,7 @@ const transformToVerifiableOutput = <
F extends EmailFieldSchema | MobileFieldSchema,
>(
schema: F,
input?: VerifiableFieldValues,
input?: VerifiableFieldValues | VerifiableFieldResponsesV3,
): VerifiableAnswerOutput<F> => {
return {
...pickBaseOutputFromSchema(schema),
Expand Down Expand Up @@ -89,7 +99,7 @@ const transformToDateOutput = (

const transformToYesNoOutput = (
schema: YesNoFieldSchema,
input?: YesNoFieldValue,
input?: YesNoFieldValue | YesNoFieldResponseV3,
): SingleAnswerOutput<YesNoFieldSchema> => {
return {
...pickBaseOutputFromSchema(schema),
Expand All @@ -99,7 +109,7 @@ const transformToYesNoOutput = (

const transformToTableOutput = (
schema: TableFieldSchema,
input?: TableFieldValues,
input?: TableFieldValues | TableFieldResponsesV3,
): TableResponse => {
// Build table shape
// Set default input if undefined.
Expand Down Expand Up @@ -134,7 +144,7 @@ const transformToAttachmentOutput = (

const transformToCheckboxOutput = (
schema: CheckboxFieldSchema,
input?: CheckboxFieldValues,
input?: CheckboxFieldValues | CheckboxFieldResponsesV3,
): CheckboxResponse => {
let answerArray: string[] = []
if (input !== undefined && input.value) {
Expand All @@ -158,15 +168,20 @@ const transformToCheckboxOutput = (

const transformToRadioOutput = (
schema: RadioFieldSchema,
input?: RadioFieldValues,
input?: RadioFieldValues | RadioFieldResponsesV3,
): RadioResponse => {
let answer = ''
if (input !== undefined) {
answer = input.value
const isOthersInput = answer === RADIO_OTHERS_INPUT_VALUE
// Others is selected, so we need to use the input at othersInput for the answer instead.
if (isOthersInput) {
answer = `Others: ${input.othersInput}`
if ('value' in input) {
// RadioFieldValues, or value response in V3
answer = input.value
if (answer === RADIO_OTHERS_INPUT_VALUE && 'othersInput' in input) {
// Others is selected, so we need to use the input at othersInput for the answer instead.
answer = `Others: ${input.othersInput}`
}
} else {
// "Others" response in V3
answer = input.othersInput
}
}
return {
Expand All @@ -187,7 +202,7 @@ const transformToSectionOutput = (

const transformToChildOutput = (
schema: ChildrenCompoundFieldSchema,
input?: ChildrenCompoundFieldValues,
input?: ChildrenCompoundFieldValues | ChildrenCompoundFieldResponsesV3,
): ChildBirthRecordsResponse => {
const noOfChildrenSubFields = schema.childrenSubFields?.length ?? 1
let answerArray: string[][]
Expand All @@ -202,6 +217,10 @@ const transformToChildOutput = (
}
}

type FormFieldValueOrFieldResponseAnswerV3<T extends BasicField> =
| FormFieldValue<T>
| FieldResponseAnswerMapV3<T>

/**
* Transforms form inputs to their desire output shapes for sending to the server
* @param field schema to retrieve base field info
Expand All @@ -210,31 +229,34 @@ const transformToChildOutput = (
*/
export const transformInputsToOutputs = (
field: FormFieldDto,
input?: FormFieldValue,
input?: Exclude<
FormFieldValue | FieldResponseAnswerMapV3,
AttachmentFieldResponseV3
>,
): FieldResponse | null => {
switch (field.fieldType) {
case BasicField.Section:
return transformToSectionOutput(field)
case BasicField.Checkbox:
return transformToCheckboxOutput(
field,
input as FormFieldValue<typeof field.fieldType>,
input as FormFieldValueOrFieldResponseAnswerV3<typeof field.fieldType>,
)
case BasicField.Radio:
return transformToRadioOutput(
field,
input as FormFieldValue<typeof field.fieldType>,
input as FormFieldValueOrFieldResponseAnswerV3<typeof field.fieldType>,
)
case BasicField.Table:
return transformToTableOutput(
field,
input as FormFieldValue<typeof field.fieldType>,
input as FormFieldValueOrFieldResponseAnswerV3<typeof field.fieldType>,
)
case BasicField.Email:
case BasicField.Mobile:
return transformToVerifiableOutput(
field,
input as FormFieldValue<typeof field.fieldType>,
input as FormFieldValueOrFieldResponseAnswerV3<typeof field.fieldType>,
)
case BasicField.Attachment:
return transformToAttachmentOutput(
Expand All @@ -244,12 +266,12 @@ export const transformInputsToOutputs = (
case BasicField.Date:
return transformToDateOutput(
field,
input as FormFieldValue<typeof field.fieldType>,
input as FormFieldValueOrFieldResponseAnswerV3<typeof field.fieldType>,
)
case BasicField.YesNo:
return transformToYesNoOutput(
field,
input as FormFieldValue<typeof field.fieldType>,
input as FormFieldValueOrFieldResponseAnswerV3<typeof field.fieldType>,
)
case BasicField.Number:
case BasicField.Decimal:
Expand All @@ -263,7 +285,7 @@ export const transformInputsToOutputs = (
case BasicField.Uen:
return transformToSingleAnswerOutput(
field,
input as FormFieldValue<typeof field.fieldType>,
input as FormFieldValueOrFieldResponseAnswerV3<typeof field.fieldType>,
)
case BasicField.Statement:
case BasicField.Image:
Expand All @@ -272,7 +294,7 @@ export const transformInputsToOutputs = (
case BasicField.Children:
return transformToChildOutput(
field,
input as FormFieldValue<typeof field.fieldType>,
input as FormFieldValueOrFieldResponseAnswerV3<typeof field.fieldType>,
)
}
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "FormSG",
"description": "Form Manager for Government",
"version": "6.120.0",
"version": "6.121.0",
"homepage": "https://form.gov.sg",
"authors": [
"FormSG <formsg@data.gov.sg>"
Expand Down
24 changes: 12 additions & 12 deletions shared/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions shared/types/response-v3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,5 @@ export type ChildrenCompoundFieldResponsesV3 = {
export type AttachmentFieldResponseV3 = {
hasBeenScanned: boolean
answer: string
md5Hash?: string
}
Loading
Loading