Skip to content

Commit

Permalink
chore: clean up existing mosip code
Browse files Browse the repository at this point in the history
  • Loading branch information
naftis committed Nov 6, 2024
1 parent 7741fb1 commit ff54fbd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 75 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 7 additions & 26 deletions src/form/birth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ import {
informantFirstNameConditionals,
informantFamilyNameConditionals,
informantBirthDateConditionals,
exactDateOfBirthUnknownConditional,
hideIfNidIntegrationEnabled
exactDateOfBirthUnknownConditional
} from '../common/default-validation-conditionals'
import {
documentsSection,
Expand Down Expand Up @@ -266,12 +265,12 @@ export const birthForm: ISerializedForm = {
getIDType(
'birth',
'informant',
hideIfNidIntegrationEnabled.concat(hideIfInformantMotherOrFather),
hideIfInformantMotherOrFather,
true
),
...getIDNumberFields(
'informant',
hideIfNidIntegrationEnabled.concat(hideIfInformantMotherOrFather),
hideIfInformantMotherOrFather,
true
),
// ADDRESS FIELDS WILL RENDER HERE
Expand Down Expand Up @@ -335,17 +334,8 @@ export const birthForm: ISerializedForm = {
certificateHandlebars.motherNationality,
detailsExist
), // Required field.
getIDType(
'birth',
'mother',
hideIfNidIntegrationEnabled.concat(detailsExist),
true
),
...getIDNumberFields(
'mother',
hideIfNidIntegrationEnabled.concat(detailsExist),
true
),
getIDType('birth', 'mother', detailsExist, true),
...getIDNumberFields('mother', detailsExist, true),
// ADDRESS FIELDS WILL RENDER HERE
divider('mother-address-seperator', detailsExist),
getMaritalStatus(certificateHandlebars.motherMaritalStatus, [
Expand Down Expand Up @@ -422,17 +412,8 @@ export const birthForm: ISerializedForm = {
certificateHandlebars.fatherNationality,
detailsExist
), // Required field.
getIDType(
'birth',
'father',
hideIfNidIntegrationEnabled.concat(detailsExist),
true
),
...getIDNumberFields(
'father',
hideIfNidIntegrationEnabled.concat(detailsExist),
true
),
getIDType('birth', 'father', detailsExist, true),
...getIDNumberFields('father', detailsExist, true),
// ADDRESS FIELDS WILL RENDER HERE
divider('father-address-seperator', detailsExist),
getMaritalStatus(certificateHandlebars.fatherMaritalStatus, [
Expand Down
28 changes: 0 additions & 28 deletions src/form/common/default-validation-conditionals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,6 @@ export const isValidChildBirthDate = [
}
] satisfies Validator[]

export const hideIfNidIntegrationDisabled = [
{
action: 'hide',
expression: `const nationalIdSystem =
offlineCountryConfig &&
offlineCountryConfig.systems.find(s => s.integratingSystemType === '${IntegratingSystemType.Mosip}');
!nationalIdSystem ||
!nationalIdSystem.settings.openIdProviderBaseUrl ||
!nationalIdSystem.settings.openIdProviderClientId ||
!nationalIdSystem.settings.openIdProviderClaims;
`
}
]

export const detailsExistConditional: Conditional[] = [
{
action: 'hide',
Expand Down Expand Up @@ -394,20 +380,6 @@ export function getNationalIDValidators(configCase: string): Validator[] {
}
}

export const hideIfNidIntegrationEnabled = [
{
action: 'hide',
expression: `const nationalIdSystem =
offlineCountryConfig &&
offlineCountryConfig.systems.find(s => s.integratingSystemType === '${IntegratingSystemType.Mosip}');
nationalIdSystem &&
nationalIdSystem.settings.openIdProviderBaseUrl &&
nationalIdSystem.settings.openIdProhideIfNidIntegrationDisabledviderClientId &&
nationalIdSystem.settings.openIdProviderClaims;
`
}
]

export const informantBirthDateConditionals = [
{
action: 'hide',
Expand Down
20 changes: 5 additions & 15 deletions src/form/death/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ import {
spouseBirthDateConditionals,
spouseFamilyNameConditionals,
spouseFirstNameConditionals,
hideIfInformantSpouse,
hideIfNidIntegrationEnabled
hideIfInformantSpouse
} from '../common/default-validation-conditionals'
import {
documentsSection,
Expand Down Expand Up @@ -291,17 +290,8 @@ export const deathForm = {
certificateHandlebars.informantNationality,
hideIfInformantSpouse
),
getIDType(
'death',
'informant',
hideIfNidIntegrationEnabled.concat(hideIfInformantSpouse),
true
),
...getIDNumberFields(
'informant',
hideIfNidIntegrationEnabled.concat(hideIfInformantSpouse),
true
),
getIDType('death', 'informant', hideIfInformantSpouse, true),
...getIDNumberFields('informant', hideIfInformantSpouse, true),
// ADDRESS FIELDS WILL RENDER HERE
divider('informant-address-separator', hideIfInformantSpouse),
registrationPhone,
Expand Down Expand Up @@ -419,7 +409,7 @@ export const deathForm = {
), // Required field.
getNationalID(
'iD',
hideIfNidIntegrationEnabled.concat(detailsExist),
detailsExist,
getNationalIDValidators('mother'),
certificateHandlebars.motherNID
),
Expand Down Expand Up @@ -492,7 +482,7 @@ export const deathForm = {
), // Required field.
getNationalID(
'iD',
hideIfNidIntegrationEnabled.concat(detailsExist),
detailsExist,
getNationalIDValidators('father'),
certificateHandlebars.fatherNID
),
Expand Down

0 comments on commit ff54fbd

Please sign in to comment.