Skip to content

Commit

Permalink
Merge pull request #7816 from opengovsg/release_v6.155.0
Browse files Browse the repository at this point in the history
build: release v6.155.0
  • Loading branch information
KenLSM authored Oct 29, 2024
2 parents f51eb49 + a88b028 commit 1064a2c
Show file tree
Hide file tree
Showing 34 changed files with 600 additions and 258 deletions.
12 changes: 12 additions & 0 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.155.0](https://github.com/opengovsg/FormSG/compare/v6.154.0...v6.155.0)

- feat: move step1 email field to settings [`#7794`](https://github.com/opengovsg/FormSG/pull/7794)
- chore: remove legacy routes [`#7810`](https://github.com/opengovsg/FormSG/pull/7810)
- feat(singpass): singpass jwks config [`#7809`](https://github.com/opengovsg/FormSG/pull/7809)
- build: merge release v6.154.0 to develop [`#7808`](https://github.com/opengovsg/FormSG/pull/7808)
- * chore: fix typo on runner tag (#7799) [`#7806`](https://github.com/opengovsg/FormSG/pull/7806)
- fix(config): default S3 endpoint with region [`#7807`](https://github.com/opengovsg/FormSG/pull/7807)

#### [v6.154.0](https://github.com/opengovsg/FormSG/compare/v6.153.0...v6.154.0)

> 28 October 2024

- feat(myinfo): update callback referral link [`#7560`](https://github.com/opengovsg/FormSG/pull/7560)
- chore(deps-dev): bump @types/promise-retry from 1.1.3 to 1.1.6 [`#7796`](https://github.com/opengovsg/FormSG/pull/7796)
- chore(deps-dev): bump @types/lodash from 4.17.10 to 4.17.12 in /shared [`#7798`](https://github.com/opengovsg/FormSG/pull/7798)
Expand All @@ -14,6 +25,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- chore(deps-dev): bump @typescript-eslint/parser from 8.10.0 to 8.11.0 in /shared [`#7802`](https://github.com/opengovsg/FormSG/pull/7802)
- chore: fix typo on runner tag [`#7799`](https://github.com/opengovsg/FormSG/pull/7799)
- build: release v6.153.0 [`#7795`](https://github.com/opengovsg/FormSG/pull/7795)
- chore: bump version to v6.154.0 [`61d5116`](https://github.com/opengovsg/FormSG/commit/61d5116b043e9f1e4801ad89227784a206573d6b)

#### [v6.153.0](https://github.com/opengovsg/FormSG/compare/v6.152.0...v6.153.0)

Expand Down
2 changes: 1 addition & 1 deletion __tests__/setup/.test-env
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ INTRANET_IP_LIST_PATH=__tests__/setup/mock-intranet-ips.txt
MOCKPASS_NRIC=S9812379B
MOCKPASS_UID=S8979373D # Not used by mockpass but keep in sync with MOCKPASS_UEN for Corppass tests
MOCKPASS_UEN=123456789A
SP_RP_JWKS_ENDPOINT=http://localhost:5000/singpass/.well-known/jwks.json
SP_RP_JWKS_ENDPOINT=http://localhost:5000/sp/.well-known/jwks.json
CP_RP_JWKS_ENDPOINT=http://localhost:5000/api/v3/corppass/.well-known/jwks.json

# Payment env vars
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ services:
- MOCKPASS_NRIC=S6005038D
- MOCKPASS_UEN=123456789A
- SHOW_LOGIN_PAGE=true
- SP_RP_JWKS_ENDPOINT=http://localhost:5000/singpass/.well-known/jwks.json
- SP_RP_JWKS_ENDPOINT=http://localhost:5000/sp/.well-known/jwks.json
- CP_RP_JWKS_ENDPOINT=http://localhost:5000/api/v3/corppass/.well-known/jwks.json
network_mode: 'service:backend' # reuse backend service's network stack so that it can resolve localhost:5156 to mockpass:5156

Expand Down
2 changes: 1 addition & 1 deletion docs/DEPLOYMENT_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ Note that MyInfo is currently not supported for storage mode forms and enabling
| `SP_OIDC_NDI_JWKS_ENDPOINT` | NDI's Singpass OIDC JWKS Endpoint |
| `SP_OIDC_RP_CLIENT_ID` | The Relying Party's Singpass Client ID as registered with NDI |
| `SP_OIDC_RP_REDIRECT_URL` | The Relying Party's Singpass Redirect URL |
| `SP_OIDC_RP_JWKS_PUBLIC_PATH` | Path to the Relying Party's Public Json Web Key Set used for Singpass-related communication with NDI. This will be hosted at /singpass/.well-known/jwks.json endpoint. |
| `SP_OIDC_RP_JWKS_PUBLIC_PATH` | Path to the Relying Party's Public Json Web Key Set used for Singpass-related communication with NDI. This will be hosted at /sp/.well-known/jwks.json endpoint. |
| `SP_OIDC_RP_JWKS_SECRET_PATH` | Path to the Relying Party's Secret Json Web Key Set used for Singpass-related communication with NDI |
| `CP_OIDC_NDI_DISCOVERY_ENDPOINT` | NDI's Corppass OIDC Discovery Endpoint |
| `CP_OIDC_NDI_JWKS_ENDPOINT` | NDI's Corppass OIDC JWKS Endpoint |
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.154.0",
"version": "6.155.0",
"homepage": ".",
"type": "module",
"private": true,
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/Dropdown/SelectContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ interface SelectContextReturn<Item extends ComboboxItem = ComboboxItem>
virtualListRef: RefObject<VirtuosoHandle>
/** Height to assign to virtual list */
virtualListHeight: number
onBlur?: () => void
}

export const SelectContext = createContext<SelectContextReturn | undefined>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ export interface SingleSelectProviderProps<
value: string
/** Controlled selected item onChange handler */
onChange: (value: string) => void
onBlur?: () => void
/** Function based on which items in dropdown are filtered. Default filter filters by fuzzy match. */
filter?(items: Item[], value: string): Item[]
filter?: (items: Item[], value: string) => Item[]
/** Initial dropdown opened state. */
initialIsOpen?: boolean
/** Props to override default useComboboxProps, if any. */
Expand All @@ -45,6 +46,7 @@ export interface SingleSelectProviderProps<
export const SingleSelectProvider = ({
items: rawItems,
value,
onBlur,
onChange,
name,
filter = defaultFilter,
Expand Down Expand Up @@ -272,6 +274,7 @@ export const SingleSelectProvider = ({
virtualListRef,
virtualListHeight,
fullWidth,
onBlur,
}}
>
{children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const SelectCombobox = forwardRef<HTMLInputElement>(
isOpen,
resetInputValue,
inputRef,
onBlur,
} = useSelectContext()

const mergedInputRef = useMergeRefs(inputRef, ref)
Expand All @@ -51,7 +52,7 @@ export const SelectCombobox = forwardRef<HTMLInputElement>(
}, [isDisabled, isReadOnly, toggleMenu])

return (
<Flex>
<Flex onBlur={onBlur}>
<InputGroup
pos="relative"
display="grid"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,30 +152,6 @@ const workflow_step_2_with_all_fields_deleted: FormWorkflowStepDto = {
edit: ['deleted_object_id_1', 'deleted_object_id_2'],
}

const workflow_step_1_with_respondent: FormWorkflowStepDto = {
_id: '61e6857c9c794b0012f1c6g1',
workflow_type: WorkflowType.Dynamic,
field: form_field_5._id,
edit: [
form_field_1._id,
form_field_2._id,
form_field_5._id,
form_field_6._id,
],
}

const workflow_step_1_with_deleted_respondent: FormWorkflowStepDto = {
_id: '61e6857c9c794b0012f1c6g9',
workflow_type: WorkflowType.Dynamic,
field: 'invalid_object_id',
edit: [
form_field_1._id,
form_field_2._id,
form_field_5._id,
form_field_6._id,
],
}

const workflow_step_3_with_approval: FormWorkflowStepDto = {
_id: '61e6857c9c794b0012f1c6g2',
workflow_type: WorkflowType.Dynamic,
Expand Down Expand Up @@ -231,12 +207,16 @@ MobileWithWorkflow.parameters = {
chromatic: { viewports: [viewports.xs] },
}

export const Step1Respondent = Template.bind({})
Step1Respondent.parameters = {
export const Step1 = Template.bind({})
Step1.parameters = {
msw: buildMswRoutes({
...FORM_WITH_WORKFLOW,
workflow: [workflow_step_1_with_respondent],
workflow: [workflow_step_1],
}),
documentation: {
storyDescription:
'Step 1 of a workflow should not show any respondent selected',
},
}

export const Step3Approval = Template.bind({})
Expand All @@ -247,14 +227,6 @@ Step3Approval.parameters = {
}),
}

export const Step1RespondentDeleted = Template.bind({})
Step1RespondentDeleted.parameters = {
msw: buildMswRoutes({
...FORM_WITH_WORKFLOW,
workflow: [workflow_step_1_with_deleted_respondent],
}),
}

export const Step3ApprovalFieldDeleted = Template.bind({})
Step3ApprovalFieldDeleted.parameters = {
msw: buildMswRoutes({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,36 +203,6 @@ export const DeletedApprovalFieldSelected = {
},
}

export const DeletedStep1RespondentSelected = {
args: {
stepNumber: 0,
defaultValues: {
workflow_type: WorkflowType.Dynamic,
field: 'deleted_objectId',
edit: [form_field_3._id],
},
},
parameters: {
docs: {
description: {
component:
'When submit is clicked, no validation error should occur since email field is set to empty string',
},
},
},
}

export const Step1RespondentSelected = {
args: {
stepNumber: 0,
defaultValues: {
workflow_type: WorkflowType.Dynamic,
field: form_field_3._id,
edit: [form_field_3._id],
},
},
}

export const Step3AllSelectedValid = {
args: {
stepNumber: 2,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useCallback } from 'react'
import { Controller, UseFormReturn } from 'react-hook-form'
import { As, FormControl, Stack, Text } from '@chakra-ui/react'
import { get } from 'lodash'
Expand Down Expand Up @@ -202,18 +201,12 @@ export const RespondentBlock = ({
stepNumber,
isLoading,
formMethods,
user,
}: RespondentBlockProps): JSX.Element => {
const {
formState: { errors },
watch,
setValue,
control,
} = formMethods

// TODO: (MRF-email-notif) Remove isTest check when MRF email notifications is out of beta
const isTest = import.meta.env.STORYBOOK_NODE_ENV === 'test'

const { emailFormFields = [] } = useAdminFormWorkflow()

const emailFieldItems = emailFormFields.map(
Expand All @@ -223,22 +216,6 @@ export const RespondentBlock = ({
icon: BASICFIELD_TO_DRAWER_META[fieldType].icon,
}),
)
const emailFieldIds = emailFormFields.map(({ _id }) => _id)

const getValueIfNotDeleted = useCallback(
// Why: When the Yes/No field has been deleted, the approval_field is still set to the
// invalid form field id but cannot be seen or cleared in the SingleSelect component
// since no matching Yes/No item can be found.
// Hence, we clear the approval_field to allow the user to re-select a new valid value.
(value: string) => {
if (!isLoading && value && !emailFieldIds.includes(value)) {
setValue('field', '')
return ''
}
return value
},
[isLoading, setValue, emailFieldIds],
)

const selectedWorkflowType = watch('workflow_type')

Expand All @@ -247,47 +224,10 @@ export const RespondentBlock = ({
return (
<EditStepBlockContainer>
{isFirstStep ? (
<>
{/* TODO: (MRF-email-notif) Remove isTest and betaFlag check when MRF email
notifications is out of beta */}
{isTest || user?.betaFlags?.mrfEmailNotifications ? (
<FormControl isInvalid={!!errors.field}>
<FormLabel style={textStyles.h4}>
Select email field for notifications to be sent to this
respondent
</FormLabel>
<Controller
name="field"
rules={{
validate: (selectedValue) => {
return (
!selectedValue ||
!emailFieldItems ||
emailFieldItems.some(
({ value: fieldValue }) => fieldValue === selectedValue,
) ||
'Field is not an email field'
)
},
}}
control={control}
render={({ field: { value = '', ...rest } }) => (
<SingleSelect
isDisabled={isLoading}
placeholder="Select an email field from your form"
items={emailFieldItems}
value={getValueIfNotDeleted(value)}
isClearable
{...rest}
/>
)}
/>
<FormErrorMessage>{errors.field?.message}</FormErrorMessage>
</FormControl>
) : (
<Text>Anyone you share the form link with</Text>
)}
</>
<Stack spacing="0.5rem">
<Text style={textStyles.h4}>Respondent in this step</Text>
<Text>Anyone who has access to your form</Text>
</Stack>
) : (
<FormControl
isReadOnly={isLoading}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,6 @@ interface RespondentBadgeProps {
step: FormWorkflowStepDto
idToFieldMap: Dictionary<FormFieldWithQuestionNo<FormField>>
}
const FirstStepRespondentBadge = ({
step,
idToFieldMap,
}: RespondentBadgeProps): JSX.Element | null => {
if (
step.workflow_type === WorkflowType.Static ||
(step.workflow_type === WorkflowType.Dynamic && !step.field)
) {
return (
<FieldLogicBadge
defaults={{
variant: 'info',
message: 'No email field included in this step',
}}
/>
)
}
return <FieldLogicBadge field={idToFieldMap[step.field]} />
}

const SubsequentStepRespondentBadges = ({
step,
Expand Down Expand Up @@ -179,14 +160,7 @@ export const InactiveStepBlock = ({
{/* TODO: (MRF-email-notif) Remove isTest and betaFlag check when MRF email
notifications is out of beta */}
{isFirstStep ? (
isTest || user?.betaFlags?.mrfEmailNotifications ? (
<FirstStepRespondentBadge
step={step}
idToFieldMap={idToFieldMap}
/>
) : (
<Text>Anyone you share the form link with</Text>
)
<Text>Anyone who has access to your form</Text>
) : (
<Flex
flexDir={{ base: 'column', md: 'row' }}
Expand Down
Loading

0 comments on commit 1064a2c

Please sign in to comment.