File tree Expand file tree Collapse file tree 3 files changed +20
-16
lines changed
frontend/src/features/admin-form/settings/components Expand file tree Collapse file tree 3 files changed +20
-16
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import { useMutateFormSettings } from '../../mutations'
1818import { FORM_SINGPASS_AUTHTYPES } from './constants'
1919import { EsrvcIdBox } from './EsrvcIdBox'
2020import { pickBy } from 'lodash'
21+ import { isEsrvcidRequired } from '../utils'
2122
2223export interface SingpassAuthOptionsRadioProps {
2324 settings : FormSettings
@@ -26,21 +27,6 @@ export interface SingpassAuthOptionsRadioProps {
2627
2728type RadioOptionsType = [ FormAuthType , string ] [ ]
2829
29- /**
30- * Only CorpPass requires esrvcid as other options will use FormSG's
31- * supplied value to increase Singpass Myinfo adoption
32- * @param authType
33- * @returns
34- */
35- const isEsrvcidRequired = ( authType : FormAuthType ) => {
36- switch ( authType ) {
37- case FormAuthType . CP :
38- return true
39- default :
40- return false
41- }
42- }
43-
4430const COLLAPSED_FORM_SINGPASS_AUTHTYPES = pickBy (
4531 FORM_SINGPASS_AUTHTYPES ,
4632 ( _ , key ) =>
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import { useAdminFormSettings } from '../queries'
2020
2121import { EmailModeConvertModal } from './EmailModeConvertModal'
2222import { SecretKeyActivationModal } from './SecretKeyActivationModal'
23+ import { isEsrvcidRequired } from './utils'
2324
2425export const FormStatusToggle = ( ) : JSX . Element => {
2526 const { t } = useTranslation ( )
@@ -41,7 +42,7 @@ export const FormStatusToggle = (): JSX.Element => {
4142 if ( status === FormStatus . Public ) return
4243
4344 // Prevent form activation if form has authType but no esrvcId.
44- if ( authType && [ FormAuthType . CP ] . includes ( authType ) && ! esrvcId ) {
45+ if ( authType && isEsrvcidRequired ( authType ) && ! esrvcId ) {
4546 return t (
4647 'features.adminForm.settings.general.status.supplySingpassEServiceId' ,
4748 )
Original file line number Diff line number Diff line change 1+ import { FormAuthType } from '~shared/types'
2+
3+ /**
4+ * Only CorpPass requires esrvcid as other options will use FormSG's
5+ * supplied value to increase Singpass Myinfo adoption
6+ * @param authType
7+ * @returns
8+ */
9+
10+ export const isEsrvcidRequired = ( authType : FormAuthType ) => {
11+ switch ( authType ) {
12+ case FormAuthType . CP :
13+ return true
14+ default :
15+ return false
16+ }
17+ }
You can’t perform that action at this time.
0 commit comments