From f56735b8eabfe2890121440098bcfb08f1dfd5b8 Mon Sep 17 00:00:00 2001 From: tahmidrahman-dsi Date: Wed, 13 Nov 2024 13:54:12 +0600 Subject: [PATCH 01/29] chore: qr code related changes --- src/form/birth/custom-fields.ts | 34 +++++++++++++++++++++++ src/form/birth/index.ts | 14 ++++++++-- src/form/common/common-required-fields.ts | 10 ++++--- src/form/types/types.ts | 6 ++++ 4 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 src/form/birth/custom-fields.ts diff --git a/src/form/birth/custom-fields.ts b/src/form/birth/custom-fields.ts new file mode 100644 index 000000000..27fb1bfb3 --- /dev/null +++ b/src/form/birth/custom-fields.ts @@ -0,0 +1,34 @@ +import { getCustomFieldMapping } from '@countryconfig/utils/mapping/field-mapping-utils' +import { formMessageDescriptors } from '../common/messages' +import { SerializedFormField } from '../types/types' + +/** + * + * @param event + * @param sectionId + * @returns hidden field to store QR scanned data + */ +export function getQRCodeField( + event: string, + sectionId: string +): SerializedFormField { + const fieldName: string = 'qrCode' + const fieldId: string = `${event}.${sectionId}.${sectionId}-view-group.${fieldName}` + return { + name: fieldName, + customQuestionMappingId: fieldId, + custom: true, + required: false, + type: 'HIDDEN', + label: { + id: 'form.field.label.empty', + description: 'empty string', + defaultMessage: '' + }, + initialValue: '', + validator: [], + mapping: getCustomFieldMapping(fieldId), + placeholder: formMessageDescriptors.formSelectPlaceholder, + conditionals: [] + } +} diff --git a/src/form/birth/index.ts b/src/form/birth/index.ts index 404a38ce7..0b2b7807d 100644 --- a/src/form/birth/index.ts +++ b/src/form/birth/index.ts @@ -79,6 +79,7 @@ import { getSectionMapping } from '@countryconfig/utils/mapping/section/birth/ma import { getCommonSectionMapping } from '@countryconfig/utils/mapping/field-mapping-utils' import { getReasonForLateRegistration } from '../custom-fields' import { getIDNumberFields, getIDType } from '../custom-fields' +import { getQRCodeField } from './custom-fields' // import { createCustomFieldExample } from '../custom-fields' // ======================= FORM CONFIGURATION ======================= @@ -176,15 +177,24 @@ export const birthForm: ISerializedForm = { fields: [ // COMMENT IN AND DUPLICATE AS REQUIRED IN ORDER TO CREATE A CUSTOM FIELD: createCustomFieldExample(), // createCustomFieldExample(), + getQRCodeField('birth', 'child'), getFirstNameField( 'childNameInEnglish', [], - certificateHandlebars.childFirstName + certificateHandlebars.childFirstName, + { + dependsOn: ['qrCode'], + expression: '$form.qrCode.firstName[0].value' + } ), // Required field. Names in Latin characters must be provided for international passport getFamilyNameField( 'childNameInEnglish', [], - certificateHandlebars.childFamilyName + certificateHandlebars.childFamilyName, + { + dependsOn: ['qrCode'], + expression: '$form.qrCode.familyName[0].value' + } ), // Required field. Names in Latin characters must be provided for international passport getGender(certificateHandlebars.childGender), // Required field. getBirthDate( diff --git a/src/form/common/common-required-fields.ts b/src/form/common/common-required-fields.ts index 7213712fd..8185ba028 100644 --- a/src/form/common/common-required-fields.ts +++ b/src/form/common/common-required-fields.ts @@ -48,7 +48,8 @@ export const getGender = (certificateHandlebar: string) => export const getFamilyNameField = ( previewGroup: string, conditionals: Conditional[], - certificateHandlebar: string + certificateHandlebar: string, + initialValue: string | { dependsOn: string[]; expression: string } = '' ) => ({ name: 'familyNameEng', // A field with this name MUST exist @@ -58,7 +59,7 @@ export const getFamilyNameField = ( label: formMessageDescriptors.familyName, maxLength: 32, required: true, - initialValue: '', + initialValue, validator: [ { operation: 'englishOnlyNameFormat' @@ -70,7 +71,8 @@ export const getFamilyNameField = ( export const getFirstNameField = ( previewGroup: string, conditionals: Conditional[], - certificateHandlebar: string + certificateHandlebar: string, + initialValue: string | { dependsOn: string[]; expression: string } = '' ) => ({ name: 'firstNamesEng', // A field with this name MUST exist @@ -84,7 +86,7 @@ export const getFirstNameField = ( conditionals, maxLength: 32, required: true, - initialValue: '', + initialValue, validator: [ { operation: 'englishOnlyNameFormat' diff --git a/src/form/types/types.ts b/src/form/types/types.ts index 09eba2449..695377f63 100644 --- a/src/form/types/types.ts +++ b/src/form/types/types.ts @@ -115,6 +115,7 @@ export const TEL = 'TEL' export const NUMBER = 'NUMBER' export const BIG_NUMBER = 'BIG_NUMBER' export const RADIO_GROUP = 'RADIO_GROUP' +export const HIDDEN = 'HIDDEN' export const INFORMATIVE_RADIO_GROUP = 'INFORMATIVE_RADIO_GROUP' export const CHECKBOX_GROUP = 'CHECKBOX_GROUP' export const CHECKBOX = 'CHECKBOX' @@ -524,6 +525,7 @@ export type IFormField = | IDividerField | IHeading3Field | ISignatureFormField + | IHiddenFormField export interface SelectComponentOption { value: string @@ -739,6 +741,10 @@ export type SerializedFormField = UnionOmit< mapping?: IFormFieldMapping } +interface IHiddenFormField extends IFormFieldBase { + type: typeof HIDDEN +} + export type IFormSectionQueryMapFunction = ( transFormedData: IFormData, queryData: any, From ec669067f9e50b6f1b76827239c0369964fc3b5e Mon Sep 17 00:00:00 2001 From: tahmidrahman-dsi Date: Wed, 13 Nov 2024 14:50:20 +0600 Subject: [PATCH 02/29] fix: handle optional values --- src/form/birth/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/form/birth/index.ts b/src/form/birth/index.ts index 0b2b7807d..8201c1c81 100644 --- a/src/form/birth/index.ts +++ b/src/form/birth/index.ts @@ -184,7 +184,7 @@ export const birthForm: ISerializedForm = { certificateHandlebars.childFirstName, { dependsOn: ['qrCode'], - expression: '$form.qrCode.firstName[0].value' + expression: '$form.qrCode?.firstName?.[0].value' } ), // Required field. Names in Latin characters must be provided for international passport getFamilyNameField( @@ -193,7 +193,7 @@ export const birthForm: ISerializedForm = { certificateHandlebars.childFamilyName, { dependsOn: ['qrCode'], - expression: '$form.qrCode.familyName[0].value' + expression: '$form.qrCode?.familyName?.[0].value' } ), // Required field. Names in Latin characters must be provided for international passport getGender(certificateHandlebars.childGender), // Required field. From 19f93e03ec58755ba1ba4299ad0dfae554ea6d2a Mon Sep 17 00:00:00 2001 From: tahmidrahman-dsi Date: Thu, 14 Nov 2024 18:15:19 +0600 Subject: [PATCH 03/29] chore: add qr scanner form field --- src/form/birth/custom-fields.ts | 26 ++++++++++++++++++++++++- src/form/birth/index.ts | 34 ++++++++++++++++++--------------- src/form/types/types.ts | 5 +++++ 3 files changed, 49 insertions(+), 16 deletions(-) diff --git a/src/form/birth/custom-fields.ts b/src/form/birth/custom-fields.ts index 27fb1bfb3..7c2c04d0a 100644 --- a/src/form/birth/custom-fields.ts +++ b/src/form/birth/custom-fields.ts @@ -1,6 +1,7 @@ import { getCustomFieldMapping } from '@countryconfig/utils/mapping/field-mapping-utils' import { formMessageDescriptors } from '../common/messages' import { SerializedFormField } from '../types/types' +import { genderOptions } from '../common/select-options' /** * @@ -19,7 +20,7 @@ export function getQRCodeField( customQuestionMappingId: fieldId, custom: true, required: false, - type: 'HIDDEN', + type: 'QR_SCANNER', label: { id: 'form.field.label.empty', description: 'empty string', @@ -32,3 +33,26 @@ export function getQRCodeField( conditionals: [] } } + +/** To bypass config validation */ +export function getGenderCustom( + event: string, + sectionId: string, + initialValue: { dependsOn: string[]; expression: string } | string = '' +) { + const fieldName: string = 'gender' + const fieldId: string = `${event}.${sectionId}.${sectionId}-view-group.${fieldName}` + return { + name: fieldName, + type: 'SELECT_WITH_OPTIONS', + customQuestionMappingId: fieldId, + custom: true, + label: formMessageDescriptors.sex, + required: false, + initialValue, + validator: [], + placeholder: formMessageDescriptors.formSelectPlaceholder, + mapping: getCustomFieldMapping(fieldId), + options: genderOptions + } satisfies SerializedFormField +} diff --git a/src/form/birth/index.ts b/src/form/birth/index.ts index 8201c1c81..fb36f8388 100644 --- a/src/form/birth/index.ts +++ b/src/form/birth/index.ts @@ -79,7 +79,7 @@ import { getSectionMapping } from '@countryconfig/utils/mapping/section/birth/ma import { getCommonSectionMapping } from '@countryconfig/utils/mapping/field-mapping-utils' import { getReasonForLateRegistration } from '../custom-fields' import { getIDNumberFields, getIDType } from '../custom-fields' -import { getQRCodeField } from './custom-fields' +import { getGenderCustom, getQRCodeField } from './custom-fields' // import { createCustomFieldExample } from '../custom-fields' // ======================= FORM CONFIGURATION ======================= @@ -177,24 +177,15 @@ export const birthForm: ISerializedForm = { fields: [ // COMMENT IN AND DUPLICATE AS REQUIRED IN ORDER TO CREATE A CUSTOM FIELD: createCustomFieldExample(), // createCustomFieldExample(), - getQRCodeField('birth', 'child'), getFirstNameField( 'childNameInEnglish', [], - certificateHandlebars.childFirstName, - { - dependsOn: ['qrCode'], - expression: '$form.qrCode?.firstName?.[0].value' - } + certificateHandlebars.childFirstName ), // Required field. Names in Latin characters must be provided for international passport getFamilyNameField( 'childNameInEnglish', [], - certificateHandlebars.childFamilyName, - { - dependsOn: ['qrCode'], - expression: '$form.qrCode?.familyName?.[0].value' - } + certificateHandlebars.childFamilyName ), // Required field. Names in Latin characters must be provided for international passport getGender(certificateHandlebars.childGender), // Required field. getBirthDate( @@ -229,20 +220,33 @@ export const birthForm: ISerializedForm = { fields: [ informantType, // Required field. otherInformantType(Event.Birth), // Required field. + getQRCodeField('birth', 'informant'), getFirstNameField( 'informantNameInEnglish', informantFirstNameConditionals.concat( hideIfInformantMotherOrFather ), - certificateHandlebars.informantFirstName - ), // Required field. + certificateHandlebars.informantFirstName, + { + dependsOn: ['qrCode'], + expression: '$form.qrCode?.firstName?.[0].value' + } + ), // Required field. In Farajaland, we have built the option to integrate with MOSIP. So we have different conditionals for each name to check MOSIP responses. You could always refactor firstNamesEng for a basic setup getFamilyNameField( 'informantNameInEnglish', informantFamilyNameConditionals.concat( hideIfInformantMotherOrFather ), - certificateHandlebars.informantFamilyName + certificateHandlebars.informantFamilyName, + { + dependsOn: ['qrCode'], + expression: '$form.qrCode?.lastName?.[0].value' + } ), // Required field. + getGenderCustom('birth', 'informant', { + dependsOn: ['qrCode'], + expression: '$form.qrCode?.gender?.[0].value?.toUpperCase()' + }), getBirthDate( 'informantBirthDate', informantBirthDateConditionals.concat( diff --git a/src/form/types/types.ts b/src/form/types/types.ts index 695377f63..d8e552f13 100644 --- a/src/form/types/types.ts +++ b/src/form/types/types.ts @@ -143,6 +143,7 @@ export const NID_VERIFICATION_BUTTON = 'NID_VERIFICATION_BUTTON' export const DIVIDER = 'DIVIDER' export const HEADING3 = 'HEADING3' export const SIGNATURE = 'SIGNATURE' +export const QR_SCANNER = 'QR_SCANNER' export enum RadioSize { LARGE = 'large', @@ -492,6 +493,9 @@ export interface ISignatureFormField extends IFormFieldBase { )[] } +export interface IQRScannerFormField extends IFormFieldBase { + type: typeof QR_SCANNER +} export type IFormField = | ITextFormField | ITelFormField @@ -526,6 +530,7 @@ export type IFormField = | IHeading3Field | ISignatureFormField | IHiddenFormField + | IQRScannerFormField export interface SelectComponentOption { value: string From be3e321c39710d17af5f023d1ed8259c532caa5e Mon Sep 17 00:00:00 2001 From: tahmidrahman-dsi Date: Thu, 14 Nov 2024 18:24:56 +0600 Subject: [PATCH 04/29] chore: some more changes --- src/form/birth/custom-fields.ts | 7 ++++--- src/form/birth/index.ts | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/form/birth/custom-fields.ts b/src/form/birth/custom-fields.ts index 7c2c04d0a..b4184098c 100644 --- a/src/form/birth/custom-fields.ts +++ b/src/form/birth/custom-fields.ts @@ -1,6 +1,6 @@ import { getCustomFieldMapping } from '@countryconfig/utils/mapping/field-mapping-utils' import { formMessageDescriptors } from '../common/messages' -import { SerializedFormField } from '../types/types' +import { Conditional, SerializedFormField } from '../types/types' import { genderOptions } from '../common/select-options' /** @@ -11,7 +11,8 @@ import { genderOptions } from '../common/select-options' */ export function getQRCodeField( event: string, - sectionId: string + sectionId: string, + conditionals: Conditional[] ): SerializedFormField { const fieldName: string = 'qrCode' const fieldId: string = `${event}.${sectionId}.${sectionId}-view-group.${fieldName}` @@ -30,7 +31,7 @@ export function getQRCodeField( validator: [], mapping: getCustomFieldMapping(fieldId), placeholder: formMessageDescriptors.formSelectPlaceholder, - conditionals: [] + conditionals } } diff --git a/src/form/birth/index.ts b/src/form/birth/index.ts index fb36f8388..69b641571 100644 --- a/src/form/birth/index.ts +++ b/src/form/birth/index.ts @@ -220,7 +220,18 @@ export const birthForm: ISerializedForm = { fields: [ informantType, // Required field. otherInformantType(Event.Birth), // Required field. - getQRCodeField('birth', 'informant'), + getQRCodeField( + 'birth', + 'informant', + informantFirstNameConditionals + .concat(hideIfInformantMotherOrFather) + .concat([ + { + action: 'disable', + expression: 'Boolean($form.qrCode)' + } + ]) + ), getFirstNameField( 'informantNameInEnglish', informantFirstNameConditionals.concat( @@ -245,7 +256,7 @@ export const birthForm: ISerializedForm = { ), // Required field. getGenderCustom('birth', 'informant', { dependsOn: ['qrCode'], - expression: '$form.qrCode?.gender?.[0].value?.toUpperCase()' + expression: '$form.qrCode?.gender?.[0].value?.toLowerCase()' }), getBirthDate( 'informantBirthDate', From 036b0f014bfeb2078b8d04f155b025dd0791b00d Mon Sep 17 00:00:00 2001 From: tahmidrahman-dsi Date: Tue, 19 Nov 2024 19:08:49 +0600 Subject: [PATCH 05/29] feat: qr code variants --- src/form/birth/custom-fields.ts | 14 +++++++------- src/form/birth/index.ts | 24 +++++++++++++++++++++++- src/form/types/types.ts | 1 + 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/form/birth/custom-fields.ts b/src/form/birth/custom-fields.ts index b4184098c..b428b85fd 100644 --- a/src/form/birth/custom-fields.ts +++ b/src/form/birth/custom-fields.ts @@ -2,6 +2,7 @@ import { getCustomFieldMapping } from '@countryconfig/utils/mapping/field-mappin import { formMessageDescriptors } from '../common/messages' import { Conditional, SerializedFormField } from '../types/types' import { genderOptions } from '../common/select-options' +import { MessageDescriptor } from 'react-intl' /** * @@ -12,9 +13,11 @@ import { genderOptions } from '../common/select-options' export function getQRCodeField( event: string, sectionId: string, - conditionals: Conditional[] + conditionals: Conditional[], + label: MessageDescriptor, + variant_Experimental: number ): SerializedFormField { - const fieldName: string = 'qrCode' + const fieldName: string = `qrCode${variant_Experimental}` const fieldId: string = `${event}.${sectionId}.${sectionId}-view-group.${fieldName}` return { name: fieldName, @@ -22,11 +25,8 @@ export function getQRCodeField( custom: true, required: false, type: 'QR_SCANNER', - label: { - id: 'form.field.label.empty', - description: 'empty string', - defaultMessage: '' - }, + variant_Experimental, + label, initialValue: '', validator: [], mapping: getCustomFieldMapping(fieldId), diff --git a/src/form/birth/index.ts b/src/form/birth/index.ts index 69b641571..2b4dc179b 100644 --- a/src/form/birth/index.ts +++ b/src/form/birth/index.ts @@ -230,7 +230,29 @@ export const birthForm: ISerializedForm = { action: 'disable', expression: 'Boolean($form.qrCode)' } - ]) + ]), + { + id: 'form.field.label.qrScanner.0', + defaultMessage: 'Scan QR code with Scanner 1' + }, + 1 + ), + getQRCodeField( + 'birth', + 'informant', + informantFirstNameConditionals + .concat(hideIfInformantMotherOrFather) + .concat([ + { + action: 'disable', + expression: 'Boolean($form.qrCode)' + } + ]), + { + id: 'form.field.label.qrScanner.1', + defaultMessage: 'Scan QR code with Scanner 2' + }, + 2 ), getFirstNameField( 'informantNameInEnglish', diff --git a/src/form/types/types.ts b/src/form/types/types.ts index d8e552f13..0339a40e2 100644 --- a/src/form/types/types.ts +++ b/src/form/types/types.ts @@ -495,6 +495,7 @@ export interface ISignatureFormField extends IFormFieldBase { export interface IQRScannerFormField extends IFormFieldBase { type: typeof QR_SCANNER + variant_Experimental: number } export type IFormField = | ITextFormField From 3fd40efef1debe7dd8276e5160d555372530097f Mon Sep 17 00:00:00 2001 From: tahmidrahman-dsi Date: Tue, 19 Nov 2024 19:12:46 +0600 Subject: [PATCH 06/29] fix: add form configuration changes --- src/form/birth/index.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/form/birth/index.ts b/src/form/birth/index.ts index 2b4dc179b..801d8142b 100644 --- a/src/form/birth/index.ts +++ b/src/form/birth/index.ts @@ -228,7 +228,7 @@ export const birthForm: ISerializedForm = { .concat([ { action: 'disable', - expression: 'Boolean($form.qrCode)' + expression: 'Boolean($form.qrCode1)' } ]), { @@ -245,7 +245,7 @@ export const birthForm: ISerializedForm = { .concat([ { action: 'disable', - expression: 'Boolean($form.qrCode)' + expression: 'Boolean($form.qrCode2)' } ]), { @@ -261,8 +261,9 @@ export const birthForm: ISerializedForm = { ), certificateHandlebars.informantFirstName, { - dependsOn: ['qrCode'], - expression: '$form.qrCode?.firstName?.[0].value' + dependsOn: ['qrCode1', 'qrCode2'], + expression: + '$form.qrCode1?.firstName?.[0].value || $form.qrCode2?.firstName?.[0].value' } ), // Required field. In Farajaland, we have built the option to integrate with MOSIP. So we have different conditionals for each name to check MOSIP responses. You could always refactor firstNamesEng for a basic setup getFamilyNameField( @@ -272,13 +273,15 @@ export const birthForm: ISerializedForm = { ), certificateHandlebars.informantFamilyName, { - dependsOn: ['qrCode'], - expression: '$form.qrCode?.lastName?.[0].value' + dependsOn: ['qrCode1', 'qrCode2'], + expression: + '$form.qrCode1?.lastName?.[0].value || $form.qrCode2?.lastName?.[0].value' } ), // Required field. getGenderCustom('birth', 'informant', { - dependsOn: ['qrCode'], - expression: '$form.qrCode?.gender?.[0].value?.toLowerCase()' + dependsOn: ['qrCode1', 'qrCode2'], + expression: + '$form.qrCode1?.gender?.[0].value?.toLowerCase() || $form.qrCode2?.gender?.[0].value?.toLowerCase()' }), getBirthDate( 'informantBirthDate', From 64bf13439e5bd7c1e4f7676f32405d811071e766 Mon Sep 17 00:00:00 2001 From: tahmidrahman-dsi Date: Wed, 11 Dec 2024 12:42:28 +0600 Subject: [PATCH 07/29] fix: add missing import --- src/form/death/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/form/death/index.ts b/src/form/death/index.ts index e88e55a62..a48711366 100644 --- a/src/form/death/index.ts +++ b/src/form/death/index.ts @@ -61,7 +61,8 @@ import { spouseBirthDateConditionals, spouseFamilyNameConditionals, spouseFirstNameConditionals, - hideIfInformantSpouse + hideIfInformantSpouse, + hideIfDeceasedAddressNotAvailable } from '../common/default-validation-conditionals' import { documentsSection, From 385bcfe90fb367ad361a6471c313a6375b357f85 Mon Sep 17 00:00:00 2001 From: tahmidrahman-dsi Date: Wed, 18 Dec 2024 18:47:07 +0600 Subject: [PATCH 08/29] chore(WIP): set an example of how id reader field can be incorporated --- src/form/birth/custom-fields.ts | 70 +++++++++++++++++++++++++++++---- src/form/birth/index.ts | 39 +++++++++--------- src/form/types/types.ts | 52 +++++++++++++++++++++--- 3 files changed, 129 insertions(+), 32 deletions(-) diff --git a/src/form/birth/custom-fields.ts b/src/form/birth/custom-fields.ts index b428b85fd..9afb3ca4e 100644 --- a/src/form/birth/custom-fields.ts +++ b/src/form/birth/custom-fields.ts @@ -10,28 +10,84 @@ import { MessageDescriptor } from 'react-intl' * @param sectionId * @returns hidden field to store QR scanned data */ -export function getQRCodeField( +export function getIDReaderField( event: string, sectionId: string, conditionals: Conditional[], - label: MessageDescriptor, - variant_Experimental: number + label: MessageDescriptor ): SerializedFormField { - const fieldName: string = `qrCode${variant_Experimental}` + const fieldName: string = 'informantIDReadeer' const fieldId: string = `${event}.${sectionId}.${sectionId}-view-group.${fieldName}` return { name: fieldName, customQuestionMappingId: fieldId, custom: true, required: false, - type: 'QR_SCANNER', - variant_Experimental, + type: 'ID_READER', label, initialValue: '', validator: [], mapping: getCustomFieldMapping(fieldId), placeholder: formMessageDescriptors.formSelectPlaceholder, - conditionals + conditionals, + dividerLabel: { + id: 'id.divider.label', + defaultMessage: 'Or' + }, + manualInputInstructionLabel: { + id: 'id.manualInputInstruction.label', + defaultMessage: 'Complete fields below' + }, + readers: [ + { + type: 'QR', + labels: { + button: { + id: 'id.qr.button.label', + defaultMessage: 'Scan ID QR code' + }, + scannerDialogSupportingCopy: { + id: 'id.qr.scanner.supportingCopy', + defaultMessage: + "Place the Notifier's ID card in front of the camera." + }, + tutorial: { + cameraCleanliness: { + id: 'id.qr.tutorial.cameraCleanliness', + defaultMessage: 'Ensure your camera is clean and functional.' + }, + distance: { + id: 'id.qr.tutorial.distance', + defaultMessage: + 'Hold the device steadily 6-12 inches away from the QR code.' + }, + lightBalance: { + id: 'id.qr.tutorial.lightBalance', + defaultMessage: + 'Ensure the QR code is well-lit and not damaged or blurry.' + } + } + } + }, + { + name: 'redirect', + validator: [], + type: 'REDIRECT', + label: { + id: 'redirect.id', + defaultMessage: 'E-signet' + }, + options: { + url: 'test', + callback: { + params: { + authorized: 'true' + }, + trigger: 'someHTTPField' + } + } + } + ] } } diff --git a/src/form/birth/index.ts b/src/form/birth/index.ts index 801d8142b..6c136e8c2 100644 --- a/src/form/birth/index.ts +++ b/src/form/birth/index.ts @@ -79,7 +79,7 @@ import { getSectionMapping } from '@countryconfig/utils/mapping/section/birth/ma import { getCommonSectionMapping } from '@countryconfig/utils/mapping/field-mapping-utils' import { getReasonForLateRegistration } from '../custom-fields' import { getIDNumberFields, getIDType } from '../custom-fields' -import { getGenderCustom, getQRCodeField } from './custom-fields' +import { getGenderCustom, getIDReaderField } from './custom-fields' // import { createCustomFieldExample } from '../custom-fields' // ======================= FORM CONFIGURATION ======================= @@ -220,7 +220,7 @@ export const birthForm: ISerializedForm = { fields: [ informantType, // Required field. otherInformantType(Event.Birth), // Required field. - getQRCodeField( + getIDReaderField( 'birth', 'informant', informantFirstNameConditionals @@ -234,26 +234,25 @@ export const birthForm: ISerializedForm = { { id: 'form.field.label.qrScanner.0', defaultMessage: 'Scan QR code with Scanner 1' - }, - 1 + } ), - getQRCodeField( - 'birth', - 'informant', - informantFirstNameConditionals - .concat(hideIfInformantMotherOrFather) - .concat([ - { - action: 'disable', - expression: 'Boolean($form.qrCode2)' - } - ]), - { - id: 'form.field.label.qrScanner.1', - defaultMessage: 'Scan QR code with Scanner 2' + { + name: 'someHTTPField', + type: 'HTTP', + custom: true, + label: { + id: 'messages.empty', + defaultMessage: ' ' }, - 2 - ), + validator: [], + options: { + url: 'someRoute', + headers: { + 'Content-type': 'application/json' + }, + method: 'GET' + } + }, getFirstNameField( 'informantNameInEnglish', informantFirstNameConditionals.concat( diff --git a/src/form/types/types.ts b/src/form/types/types.ts index 0339a40e2..c9238f9d5 100644 --- a/src/form/types/types.ts +++ b/src/form/types/types.ts @@ -143,7 +143,9 @@ export const NID_VERIFICATION_BUTTON = 'NID_VERIFICATION_BUTTON' export const DIVIDER = 'DIVIDER' export const HEADING3 = 'HEADING3' export const SIGNATURE = 'SIGNATURE' -export const QR_SCANNER = 'QR_SCANNER' +export const REDIRECT = 'REDIRECT' +export const ID_READER = 'ID_READER' +export const HTTP = 'HTTP' export enum RadioSize { LARGE = 'large', @@ -493,10 +495,48 @@ export interface ISignatureFormField extends IFormFieldBase { )[] } -export interface IQRScannerFormField extends IFormFieldBase { - type: typeof QR_SCANNER - variant_Experimental: number +export interface IHttpFormField extends IFormFieldBase { + type: typeof HTTP + options: { + url: string + method?: string + headers: Record + body?: Record + } +} + +export interface IRedirectFormField extends IFormFieldBase { + type: typeof REDIRECT + options: { + url: string + callback: { + trigger: string + params: Record + } + } +} + +export interface QRReaderType { + type: 'QR' + labels: { + button: MessageDescriptor + scannerDialogSupportingCopy: MessageDescriptor + tutorial: { + cameraCleanliness: MessageDescriptor + distance: MessageDescriptor + lightBalance: MessageDescriptor + } + } } + +type ReaderType = QRReaderType | IRedirectFormField +export interface IIDReaderFormField extends IFormFieldBase { + type: typeof ID_READER + dividerLabel: MessageDescriptor + manualInputInstructionLabel: MessageDescriptor + readers: [ReaderType, ...ReaderType[]] +} + export type IFormField = | ITextFormField | ITelFormField @@ -531,7 +571,9 @@ export type IFormField = | IHeading3Field | ISignatureFormField | IHiddenFormField - | IQRScannerFormField + | IIDReaderFormField + | IRedirectFormField + | IHttpFormField export interface SelectComponentOption { value: string From 43a1e5f284ec8df4af5c4ea6335fecbbe6d1970c Mon Sep 17 00:00:00 2001 From: tahmidrahman-dsi Date: Tue, 24 Dec 2024 15:41:44 +0600 Subject: [PATCH 09/29] chore: add translations --- src/form/birth/custom-fields.ts | 53 ++++++++++----------------------- src/form/birth/index.ts | 35 ++++------------------ src/form/death/index.ts | 3 +- src/form/types/types.ts | 13 +++----- src/translations/client.csv | 8 +++++ 5 files changed, 35 insertions(+), 77 deletions(-) diff --git a/src/form/birth/custom-fields.ts b/src/form/birth/custom-fields.ts index 9afb3ca4e..91b9a96d5 100644 --- a/src/form/birth/custom-fields.ts +++ b/src/form/birth/custom-fields.ts @@ -2,7 +2,6 @@ import { getCustomFieldMapping } from '@countryconfig/utils/mapping/field-mappin import { formMessageDescriptors } from '../common/messages' import { Conditional, SerializedFormField } from '../types/types' import { genderOptions } from '../common/select-options' -import { MessageDescriptor } from 'react-intl' /** * @@ -13,10 +12,9 @@ import { MessageDescriptor } from 'react-intl' export function getIDReaderField( event: string, sectionId: string, - conditionals: Conditional[], - label: MessageDescriptor + conditionals: Conditional[] ): SerializedFormField { - const fieldName: string = 'informantIDReadeer' + const fieldName: string = 'informantID' const fieldId: string = `${event}.${sectionId}.${sectionId}-view-group.${fieldName}` return { name: fieldName, @@ -24,61 +22,42 @@ export function getIDReaderField( custom: true, required: false, type: 'ID_READER', - label, + label: { + id: 'form.field.label.empty', + defaultMessage: '' + }, + hideInPreview: true, initialValue: '', validator: [], mapping: getCustomFieldMapping(fieldId), placeholder: formMessageDescriptors.formSelectPlaceholder, conditionals, dividerLabel: { - id: 'id.divider.label', + id: 'views.idReader.label.or', defaultMessage: 'Or' }, manualInputInstructionLabel: { - id: 'id.manualInputInstruction.label', + id: 'views.idReader.label.manualInput', defaultMessage: 'Complete fields below' }, readers: [ { - type: 'QR', - labels: { - button: { - id: 'id.qr.button.label', - defaultMessage: 'Scan ID QR code' - }, - scannerDialogSupportingCopy: { - id: 'id.qr.scanner.supportingCopy', - defaultMessage: - "Place the Notifier's ID card in front of the camera." - }, - tutorial: { - cameraCleanliness: { - id: 'id.qr.tutorial.cameraCleanliness', - defaultMessage: 'Ensure your camera is clean and functional.' - }, - distance: { - id: 'id.qr.tutorial.distance', - defaultMessage: - 'Hold the device steadily 6-12 inches away from the QR code.' - }, - lightBalance: { - id: 'id.qr.tutorial.lightBalance', - defaultMessage: - 'Ensure the QR code is well-lit and not damaged or blurry.' - } - } - } + type: 'QR' }, { name: 'redirect', validator: [], + icon: { + desktop: 'Globe', + mobile: 'Fingerprint' + }, type: 'REDIRECT', label: { - id: 'redirect.id', + id: 'views.idReader.label.eSignet', defaultMessage: 'E-signet' }, options: { - url: 'test', + url: 'https://docs.esignet.io/', callback: { params: { authorized: 'true' diff --git a/src/form/birth/index.ts b/src/form/birth/index.ts index 6c136e8c2..790af55b2 100644 --- a/src/form/birth/index.ts +++ b/src/form/birth/index.ts @@ -223,18 +223,9 @@ export const birthForm: ISerializedForm = { getIDReaderField( 'birth', 'informant', - informantFirstNameConditionals - .concat(hideIfInformantMotherOrFather) - .concat([ - { - action: 'disable', - expression: 'Boolean($form.qrCode1)' - } - ]), - { - id: 'form.field.label.qrScanner.0', - defaultMessage: 'Scan QR code with Scanner 1' - } + informantFirstNameConditionals.concat( + hideIfInformantMotherOrFather + ) ), { name: 'someHTTPField', @@ -258,30 +249,16 @@ export const birthForm: ISerializedForm = { informantFirstNameConditionals.concat( hideIfInformantMotherOrFather ), - certificateHandlebars.informantFirstName, - { - dependsOn: ['qrCode1', 'qrCode2'], - expression: - '$form.qrCode1?.firstName?.[0].value || $form.qrCode2?.firstName?.[0].value' - } + certificateHandlebars.informantFirstName ), // Required field. In Farajaland, we have built the option to integrate with MOSIP. So we have different conditionals for each name to check MOSIP responses. You could always refactor firstNamesEng for a basic setup getFamilyNameField( 'informantNameInEnglish', informantFamilyNameConditionals.concat( hideIfInformantMotherOrFather ), - certificateHandlebars.informantFamilyName, - { - dependsOn: ['qrCode1', 'qrCode2'], - expression: - '$form.qrCode1?.lastName?.[0].value || $form.qrCode2?.lastName?.[0].value' - } + certificateHandlebars.informantFamilyName ), // Required field. - getGenderCustom('birth', 'informant', { - dependsOn: ['qrCode1', 'qrCode2'], - expression: - '$form.qrCode1?.gender?.[0].value?.toLowerCase() || $form.qrCode2?.gender?.[0].value?.toLowerCase()' - }), + getGenderCustom('birth', 'informant'), getBirthDate( 'informantBirthDate', informantBirthDateConditionals.concat( diff --git a/src/form/death/index.ts b/src/form/death/index.ts index a48711366..e88e55a62 100644 --- a/src/form/death/index.ts +++ b/src/form/death/index.ts @@ -61,8 +61,7 @@ import { spouseBirthDateConditionals, spouseFamilyNameConditionals, spouseFirstNameConditionals, - hideIfInformantSpouse, - hideIfDeceasedAddressNotAvailable + hideIfInformantSpouse } from '../common/default-validation-conditionals' import { documentsSection, diff --git a/src/form/types/types.ts b/src/form/types/types.ts index c9238f9d5..758b361e6 100644 --- a/src/form/types/types.ts +++ b/src/form/types/types.ts @@ -507,6 +507,10 @@ export interface IHttpFormField extends IFormFieldBase { export interface IRedirectFormField extends IFormFieldBase { type: typeof REDIRECT + icon?: { + desktop: string + mobile: string + } options: { url: string callback: { @@ -518,15 +522,6 @@ export interface IRedirectFormField extends IFormFieldBase { export interface QRReaderType { type: 'QR' - labels: { - button: MessageDescriptor - scannerDialogSupportingCopy: MessageDescriptor - tutorial: { - cameraCleanliness: MessageDescriptor - distance: MessageDescriptor - lightBalance: MessageDescriptor - } - } } type ReaderType = QRReaderType | IRedirectFormField diff --git a/src/translations/client.csv b/src/translations/client.csv index bc9f86e13..efbf81730 100644 --- a/src/translations/client.csv +++ b/src/translations/client.csv @@ -2096,6 +2096,14 @@ verifyCertificate.successTitle,title for success alert,Valid QR code,Code QR val verifyCertificate.successUrl,title for success alert for url validation,URL Verification,Vérification des URL verifyCertificate.timeOut,message when time out after few minute,You been timed out,Délais expirée verifyCertificate.toastMessage,Message for the toast when time spend 1 minute,"After verifying the certificate, please close the browser window","Après avoir vérifié le certificat, veuillez fermer la fenêtre du navigateur." +views.idReader.label.eSignet,E-signet button label,E-Signet,E-Signet +views.idReader.label.manualInput,Label that shows below the divider on the id reader component,Complete fields below,Complétez les champs ci-dessous +views.idReader.label.or,Label that shows on the divider,Or,Ou +views.qrReader.button,Button to scan QR code,Scan QR code,Scan QR code +views.qrReader.scannerDialogSupportingCopy,Supporting copy for the scanner dialog,Place the Notifier's ID card in front of the camera.,Place the Notifier's ID card in front of the camera. +views.qrReader.tutorial.cameraCleanliness,Camera cleanliness tutorial,Ensure your camera is clean and functional.,Ensure your camera is clean and functional. +views.qrReader.tutorial.distance,Distance tutorial,Hold the device steadily 6-12 inches away from the QR code.,Hold the device steadily 6-12 inches away from the QR code. +views.qrReader.tutorial.lightBalance,Light balance tutorial,Ensure the QR code is well-lit and not damaged or blurry.,Ensure the QR code is well-lit and not damaged or blurry. wq.noRecords.draft,No records messages for empty draft tab,No records in progress,Aucun enregistrement en cours wq.noRecords.externalValidation,No records messages for empty external validation tab,No records in external validation,Aucun enregistrement dans la validation externe wq.noRecords.fieldAgents,No records messages for empty field agents tab,No records from field agents,Aucun enregistrement des agents de terrain From 6b79627855e27edd3f602c866bc4353be151ca79 Mon Sep 17 00:00:00 2001 From: tahmidrahman-dsi Date: Tue, 24 Dec 2024 15:56:33 +0600 Subject: [PATCH 10/29] fix: conditionals --- src/form/birth/custom-fields.ts | 4 +- src/form/birth/index.ts | 60 ++++++++++++++++++----- src/form/common/common-required-fields.ts | 5 +- 3 files changed, 53 insertions(+), 16 deletions(-) diff --git a/src/form/birth/custom-fields.ts b/src/form/birth/custom-fields.ts index 91b9a96d5..0b980d4d2 100644 --- a/src/form/birth/custom-fields.ts +++ b/src/form/birth/custom-fields.ts @@ -14,7 +14,7 @@ export function getIDReaderField( sectionId: string, conditionals: Conditional[] ): SerializedFormField { - const fieldName: string = 'informantID' + const fieldName: string = 'idReader' const fieldId: string = `${event}.${sectionId}.${sectionId}-view-group.${fieldName}` return { name: fieldName, @@ -74,6 +74,7 @@ export function getIDReaderField( export function getGenderCustom( event: string, sectionId: string, + conditionals: Conditional[], initialValue: { dependsOn: string[]; expression: string } | string = '' ) { const fieldName: string = 'gender' @@ -86,6 +87,7 @@ export function getGenderCustom( label: formMessageDescriptors.sex, required: false, initialValue, + conditionals, validator: [], placeholder: formMessageDescriptors.formSelectPlaceholder, mapping: getCustomFieldMapping(fieldId), diff --git a/src/form/birth/index.ts b/src/form/birth/index.ts index 790af55b2..015da3f80 100644 --- a/src/form/birth/index.ts +++ b/src/form/birth/index.ts @@ -246,24 +246,54 @@ export const birthForm: ISerializedForm = { }, getFirstNameField( 'informantNameInEnglish', - informantFirstNameConditionals.concat( - hideIfInformantMotherOrFather - ), - certificateHandlebars.informantFirstName + informantFirstNameConditionals + .concat(hideIfInformantMotherOrFather) + .concat({ + action: 'disable', + expression: '$form?.idReader?.firstName' + }), + certificateHandlebars.informantFirstName, + { + dependsOn: ['idReader'], + expression: '$form?.idReader?.firstName' + } ), // Required field. In Farajaland, we have built the option to integrate with MOSIP. So we have different conditionals for each name to check MOSIP responses. You could always refactor firstNamesEng for a basic setup getFamilyNameField( 'informantNameInEnglish', - informantFamilyNameConditionals.concat( - hideIfInformantMotherOrFather - ), - certificateHandlebars.informantFamilyName + informantFamilyNameConditionals + .concat(hideIfInformantMotherOrFather) + .concat({ + action: 'disable', + expression: '$form?.idReader?.familyName' + }), + certificateHandlebars.informantFamilyName, + { + dependsOn: ['idReader'], + expression: '$form?.idReader?.familyName' + } ), // Required field. - getGenderCustom('birth', 'informant'), + getGenderCustom( + 'birth', + 'informant', + [ + { + action: 'disable', + expression: '$form?.idReader?.gender' + } + ], + { + dependsOn: ['idReader'], + expression: '$form?.idReader?.gender' + } + ), getBirthDate( 'informantBirthDate', - informantBirthDateConditionals.concat( - hideIfInformantMotherOrFather - ), + informantBirthDateConditionals + .concat(hideIfInformantMotherOrFather) + .concat({ + action: 'disable', + expression: '$form?.idReader?.birthDate' + }), [ { operation: 'dateFormatIsCorrect', @@ -274,7 +304,11 @@ export const birthForm: ISerializedForm = { parameters: [] } ], - certificateHandlebars.informantBirthDate + certificateHandlebars.informantBirthDate, + { + dependsOn: ['idReader'], + expression: '$form?.idReader?.birthDate' + } ), // Required field. exactDateOfBirthUnknown(hideIfInformantMotherOrFather), getAgeOfIndividualInYears( diff --git a/src/form/common/common-required-fields.ts b/src/form/common/common-required-fields.ts index 8185ba028..0de61988f 100644 --- a/src/form/common/common-required-fields.ts +++ b/src/form/common/common-required-fields.ts @@ -20,14 +20,15 @@ export const getBirthDate = ( fieldName: string, conditionals: Conditional[], validator: any[], - certificateHandlebar: string + certificateHandlebar: string, + initialValue: string | { dependsOn: string[]; expression: string } = '' ): SerializedFormField => ({ name: fieldName, // A field with this name MUST exist type: 'DATE', label: formMessageDescriptors.dateOfBirth, required: true, conditionals, - initialValue: '', + initialValue, validator, mapping: getFieldMapping('birthDate', certificateHandlebar) }) From 3ffe6b3b467be0ed43df47ff0e802a84c4e6e945 Mon Sep 17 00:00:00 2001 From: tahmidrahman-dsi Date: Mon, 6 Jan 2025 18:45:25 +0600 Subject: [PATCH 11/29] fix: update yarn-lock --- yarn.lock | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/yarn.lock b/yarn.lock index 52f0521d0..3b59f55aa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -797,10 +797,12 @@ dependencies: "@hapi/hapi" "^20.0.1" -"@opencrvs/toolkit@^0.0.5": - version "0.0.5" - resolved "https://registry.yarnpkg.com/@opencrvs/toolkit/-/toolkit-0.0.5.tgz#dbd3395b561c1eb3527b8cfc28b6e1dd301671f3" - integrity sha512-Ex45aFUJ1iQwpYGMHhxVbhpuQFqVlmdSkNXz1phkM7KAzNtngL2KGIJCc6TFv4GKOHU/lLEfmGyrhIDCKlA7fQ== +"@opencrvs/toolkit@0.0.6-events": + version "0.0.6-events" + resolved "https://registry.yarnpkg.com/@opencrvs/toolkit/-/toolkit-0.0.6-events.tgz#48327b3e322bc82ae60ec13fc855e2e23300b298" + integrity sha512-wh4qaPJktG4Dnh+zFFbDv5b/oZ+bTSzQYRfOzLGS1KNqG7h2j6iZfvmSBtyL0rb/SrpIHcI+9eoqLfwg8cjfyQ== + dependencies: + ajv "^8.17.1" "@rollup/rollup-android-arm-eabi@4.24.0": version "4.24.0" @@ -1409,6 +1411,16 @@ ajv@^6.10.0, ajv@^6.12.4: json-schema-traverse "^0.4.1" uri-js "^4.2.2" +ajv@^8.17.1: + version "8.17.1" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.17.1.tgz#37d9a5c776af6bc92d7f4f9510eba4c0a60d11a6" + integrity sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g== + dependencies: + fast-deep-equal "^3.1.3" + fast-uri "^3.0.1" + json-schema-traverse "^1.0.0" + require-from-string "^2.0.2" + ansi-escapes@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" @@ -2539,6 +2551,11 @@ fast-safe-stringify@^2.1.1: resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz#c406a83b6e70d9e35ce3b30a81141df30aeba884" integrity sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA== +fast-uri@^3.0.1: + version "3.0.5" + resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.0.5.tgz#19f5f9691d0dab9b85861a7bb5d98fca961da9cd" + integrity sha512-5JnBCWpFlMo0a3ciDy/JckMzzv1U9coZrIhedq+HXxxUfDTAiS0LA8OKVao4G9BxmCVck/jtA5r3KAtRWEyD8Q== + fastq@^1.6.0: version "1.13.0" resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.13.0.tgz#616760f88a7526bdfc596b7cab8c18938c36b98c" @@ -3338,6 +3355,11 @@ json-schema-traverse@^0.4.1: resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== +json-schema-traverse@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" + integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== + json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" @@ -4368,6 +4390,11 @@ repeat-string@^1.6.1: resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" integrity sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w== +require-from-string@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" + integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== + resolve-from@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-3.0.0.tgz#b22c7af7d9d6881bc8b6e653335eebcb0a188748" From d3a6bd6de4c97ff8b61aa2a6fe1b4caf48216e1e Mon Sep 17 00:00:00 2001 From: tahmidrahman-dsi Date: Mon, 6 Jan 2025 19:40:38 +0600 Subject: [PATCH 12/29] chore(wip): changes --- src/form/birth/index.ts | 82 +++++++++++++++++++++++------------------ src/form/types/types.ts | 8 ++++ 2 files changed, 55 insertions(+), 35 deletions(-) diff --git a/src/form/birth/index.ts b/src/form/birth/index.ts index 4d3a93b07..bb7a70a12 100644 --- a/src/form/birth/index.ts +++ b/src/form/birth/index.ts @@ -223,9 +223,12 @@ export const birthForm: ISerializedForm = { getIDReaderField( 'birth', 'informant', - informantFirstNameConditionals.concat( - hideIfInformantMotherOrFather - ) + informantFirstNameConditionals + .concat(hideIfInformantMotherOrFather) + .concat({ + action: 'hide', + expression: '!!$form?.verified' + }) ), { name: 'someHTTPField', @@ -244,14 +247,39 @@ export const birthForm: ISerializedForm = { method: 'GET' } }, + { + name: 'verified', + type: 'HIDDEN', + custom: true, + label: { + id: 'messages.empty', + defaultMessage: '' + }, + validator: [] + }, + { + name: 'idPending', + type: 'ID_VERIFICATION_BANNER', + custom: true, + bannerType: 'pending', + idFieldName: 'idReader', + label: { + id: 'messages.empty', + defaultMessage: '' + }, + validator: [], + conditionals: [ + { + action: 'hide', + expression: '$form?.verified !== "pending"' + } + ] + }, getFirstNameField( 'informantNameInEnglish', - informantFirstNameConditionals - .concat(hideIfInformantMotherOrFather) - .concat({ - action: 'disable', - expression: '$form?.idReader?.firstName' - }), + informantFirstNameConditionals.concat( + hideIfInformantMotherOrFather + ), certificateHandlebars.informantFirstName, { dependsOn: ['idReader'], @@ -260,40 +288,24 @@ export const birthForm: ISerializedForm = { ), // Required field. In Farajaland, we have built the option to integrate with MOSIP. So we have different conditionals for each name to check MOSIP responses. You could always refactor firstNamesEng for a basic setup getFamilyNameField( 'informantNameInEnglish', - informantFamilyNameConditionals - .concat(hideIfInformantMotherOrFather) - .concat({ - action: 'disable', - expression: '$form?.idReader?.familyName' - }), + informantFamilyNameConditionals.concat( + hideIfInformantMotherOrFather + ), certificateHandlebars.informantFamilyName, { dependsOn: ['idReader'], expression: '$form?.idReader?.familyName' } ), // Required field. - getGenderCustom( - 'birth', - 'informant', - [ - { - action: 'disable', - expression: '$form?.idReader?.gender' - } - ], - { - dependsOn: ['idReader'], - expression: '$form?.idReader?.gender' - } - ), + getGenderCustom('birth', 'informant', [], { + dependsOn: ['idReader'], + expression: '$form?.idReader?.gender' + }), getBirthDate( 'informantBirthDate', - informantBirthDateConditionals - .concat(hideIfInformantMotherOrFather) - .concat({ - action: 'disable', - expression: '$form?.idReader?.birthDate' - }), + informantBirthDateConditionals.concat( + hideIfInformantMotherOrFather + ), [ { operation: 'dateFormatIsCorrect', diff --git a/src/form/types/types.ts b/src/form/types/types.ts index 60daf59d5..31393e0c9 100644 --- a/src/form/types/types.ts +++ b/src/form/types/types.ts @@ -146,6 +146,7 @@ export const SIGNATURE = 'SIGNATURE' export const REDIRECT = 'REDIRECT' export const ID_READER = 'ID_READER' export const HTTP = 'HTTP' +export const ID_VERIFICATION_BANNER = 'ID_VERIFICATION_BANNER' export enum RadioSize { LARGE = 'large', @@ -532,6 +533,12 @@ export interface IIDReaderFormField extends IFormFieldBase { readers: [ReaderType, ...ReaderType[]] } +export type BannerType = 'pending' | 'verified' | 'failed' +export interface IBannerFormField extends IFormFieldBase { + type: typeof ID_VERIFICATION_BANNER + bannerType: BannerType + idFieldName: string +} export type IFormField = | ITextFormField | ITelFormField @@ -569,6 +576,7 @@ export type IFormField = | IIDReaderFormField | IRedirectFormField | IHttpFormField + | IBannerFormField export interface SelectComponentOption { value: string From 89ed652ce33d6b6b0bc8296de6f43eee1dd6fcc3 Mon Sep 17 00:00:00 2001 From: tahmidrahman-dsi Date: Tue, 7 Jan 2025 12:50:50 +0600 Subject: [PATCH 13/29] fix: update form config defining pending logic --- src/form/birth/index.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/form/birth/index.ts b/src/form/birth/index.ts index bb7a70a12..aad010f07 100644 --- a/src/form/birth/index.ts +++ b/src/form/birth/index.ts @@ -255,6 +255,10 @@ export const birthForm: ISerializedForm = { id: 'messages.empty', defaultMessage: '' }, + initialValue: { + dependsOn: ['idReader'], + expression: 'Boolean($form?.idReader)? "pending":""' + }, validator: [] }, { @@ -283,7 +287,7 @@ export const birthForm: ISerializedForm = { certificateHandlebars.informantFirstName, { dependsOn: ['idReader'], - expression: '$form?.idReader?.firstName' + expression: '$form?.idReader?.firstName || ""' } ), // Required field. In Farajaland, we have built the option to integrate with MOSIP. So we have different conditionals for each name to check MOSIP responses. You could always refactor firstNamesEng for a basic setup getFamilyNameField( @@ -294,12 +298,12 @@ export const birthForm: ISerializedForm = { certificateHandlebars.informantFamilyName, { dependsOn: ['idReader'], - expression: '$form?.idReader?.familyName' + expression: '$form?.idReader?.familyName || ""' } ), // Required field. getGenderCustom('birth', 'informant', [], { dependsOn: ['idReader'], - expression: '$form?.idReader?.gender' + expression: '$form?.idReader?.gender || ""' }), getBirthDate( 'informantBirthDate', @@ -319,7 +323,7 @@ export const birthForm: ISerializedForm = { certificateHandlebars.informantBirthDate, { dependsOn: ['idReader'], - expression: '$form?.idReader?.birthDate' + expression: '$form?.idReader?.birthDate || ""' } ), // Required field. exactDateOfBirthUnknown(hideIfInformantMotherOrFather), From e5d3432fd68982a6e7a72defb6fd4d6b1ecdeb40 Mon Sep 17 00:00:00 2001 From: tahmidrahman-dsi Date: Tue, 7 Jan 2025 16:02:23 +0600 Subject: [PATCH 14/29] refactor: rename REDIRECT to LINK_BUTTON --- src/form/birth/custom-fields.ts | 4 ++-- src/form/types/types.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/form/birth/custom-fields.ts b/src/form/birth/custom-fields.ts index 0b980d4d2..56b015070 100644 --- a/src/form/birth/custom-fields.ts +++ b/src/form/birth/custom-fields.ts @@ -45,13 +45,13 @@ export function getIDReaderField( type: 'QR' }, { - name: 'redirect', + name: 'eSignetLink', validator: [], icon: { desktop: 'Globe', mobile: 'Fingerprint' }, - type: 'REDIRECT', + type: 'LINK_BUTTON', label: { id: 'views.idReader.label.eSignet', defaultMessage: 'E-signet' diff --git a/src/form/types/types.ts b/src/form/types/types.ts index 31393e0c9..75afc02ad 100644 --- a/src/form/types/types.ts +++ b/src/form/types/types.ts @@ -143,7 +143,7 @@ export const NID_VERIFICATION_BUTTON = 'NID_VERIFICATION_BUTTON' export const DIVIDER = 'DIVIDER' export const HEADING3 = 'HEADING3' export const SIGNATURE = 'SIGNATURE' -export const REDIRECT = 'REDIRECT' +export const LINK_BUTTON = 'LINK_BUTTON' export const ID_READER = 'ID_READER' export const HTTP = 'HTTP' export const ID_VERIFICATION_BANNER = 'ID_VERIFICATION_BANNER' @@ -507,7 +507,7 @@ export interface IHttpFormField extends IFormFieldBase { } export interface IRedirectFormField extends IFormFieldBase { - type: typeof REDIRECT + type: typeof LINK_BUTTON icon?: { desktop: string mobile: string From a67dde281e2f67578950e1c923f6b936fc9615c7 Mon Sep 17 00:00:00 2001 From: tahmidrahman-dsi Date: Wed, 8 Jan 2025 15:29:17 +0600 Subject: [PATCH 15/29] chore: implement e-signet links --- infrastructure/docker-compose.deploy.yml | 4 + .../docker-compose.development-deploy.yml | 4 + infrastructure/docker-compose.qa-deploy.yml | 4 + .../docker-compose.staging-deploy.yml | 4 + package.json | 2 +- src/constants.ts | 6 ++ src/environment.ts | 6 +- src/form/birth/index.ts | 89 ++++++++----------- yarn.lock | 10 +-- 9 files changed, 68 insertions(+), 61 deletions(-) diff --git a/infrastructure/docker-compose.deploy.yml b/infrastructure/docker-compose.deploy.yml index 21899170a..47dc1df46 100644 --- a/infrastructure/docker-compose.deploy.yml +++ b/infrastructure/docker-compose.deploy.yml @@ -581,6 +581,10 @@ services: - INFOBIP_API_KEY=${INFOBIP_API_KEY:-} - INFOBIP_SENDER_ID=${INFOBIP_SENDER_ID:-} - DOMAIN={{hostname}} + - E_SIGNET_AUTH_URL=${E_SIGNET_AUTH_URL} + - OPENID_PROVIDER_CLIENT_ID=${OPENID_PROVIDER_CLIENT_ID} + - OPENID_PROVIDER_CLAIMS=${OPENID_PROVIDER_CLAIMS} + - OIDP_USER_INFO_URL=${OIDP_USER_INFO_URL} networks: - overlay_net logging: diff --git a/infrastructure/docker-compose.development-deploy.yml b/infrastructure/docker-compose.development-deploy.yml index 10450eb28..0e1c2b4a0 100644 --- a/infrastructure/docker-compose.development-deploy.yml +++ b/infrastructure/docker-compose.development-deploy.yml @@ -28,6 +28,10 @@ services: - SMTP_USERNAME=${SMTP_USERNAME} - SMTP_PASSWORD=${SMTP_PASSWORD} - SMTP_SECURE=${SMTP_SECURE} + - E_SIGNET_AUTH_URL=${E_SIGNET_AUTH_URL} + - OPENID_PROVIDER_CLIENT_ID=${OPENID_PROVIDER_CLIENT_ID} + - OPENID_PROVIDER_CLAIMS=${OPENID_PROVIDER_CLAIMS} + - OIDP_USER_INFO_URL=${OIDP_USER_INFO_URL} deploy: replicas: 1 networks: diff --git a/infrastructure/docker-compose.qa-deploy.yml b/infrastructure/docker-compose.qa-deploy.yml index 68a315434..a053df26e 100644 --- a/infrastructure/docker-compose.qa-deploy.yml +++ b/infrastructure/docker-compose.qa-deploy.yml @@ -57,6 +57,10 @@ services: - SMTP_USERNAME=${SMTP_USERNAME} - SMTP_PASSWORD=${SMTP_PASSWORD} - SMTP_SECURE=${SMTP_SECURE} + - E_SIGNET_AUTH_URL=${E_SIGNET_AUTH_URL} + - OPENID_PROVIDER_CLIENT_ID=${OPENID_PROVIDER_CLIENT_ID} + - OPENID_PROVIDER_CLAIMS=${OPENID_PROVIDER_CLAIMS} + - OIDP_USER_INFO_URL=${OIDP_USER_INFO_URL} deploy: replicas: 1 networks: diff --git a/infrastructure/docker-compose.staging-deploy.yml b/infrastructure/docker-compose.staging-deploy.yml index dab5ee159..a121ef36f 100644 --- a/infrastructure/docker-compose.staging-deploy.yml +++ b/infrastructure/docker-compose.staging-deploy.yml @@ -107,6 +107,10 @@ services: - SMTP_USERNAME=${SMTP_USERNAME} - SMTP_PASSWORD=${SMTP_PASSWORD} - SMTP_SECURE=${SMTP_SECURE} + - E_SIGNET_AUTH_URL=${E_SIGNET_AUTH_URL} + - OPENID_PROVIDER_CLIENT_ID=${OPENID_PROVIDER_CLIENT_ID} + - OPENID_PROVIDER_CLAIMS=${OPENID_PROVIDER_CLAIMS} + - OIDP_USER_INFO_URL=${OIDP_USER_INFO_URL} deploy: replicas: 1 diff --git a/package.json b/package.json index c98aa4ac6..56252ffc1 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "@hapi/boom": "^9.1.1", "@hapi/hapi": "^20.0.1", "@hapi/inert": "^6.0.3", - "@opencrvs/mosip": "^1.7.0-alpha.2", + "@opencrvs/mosip": "^1.7.0-alpha.4", "@opencrvs/toolkit": "0.0.6-events", "@types/chalk": "^2.2.0", "@types/csv2json": "^1.4.0", diff --git a/src/constants.ts b/src/constants.ts index fecca17fc..93bdf5c7f 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -30,3 +30,9 @@ export const CHECK_INVALID_TOKEN = env.CHECK_INVALID_TOKEN export const PRODUCTION = env.isProd export const QA_ENV = env.QA_ENV + +// e-signet +export const E_SIGNET_AUTH_URL = env.E_SIGNET_AUTH_URL +export const OPENID_PROVIDER_CLIENT_ID = env.OPENID_PROVIDER_CLIENT_ID +export const OPENID_PROVIDER_CLAIMS = env.OPENID_PROVIDER_CLAIMS +export const OIDP_USER_INFO_URL = env.OIDP_USER_INFO_URL diff --git a/src/environment.ts b/src/environment.ts index 1a084ab61..a4a5f1bdd 100644 --- a/src/environment.ts +++ b/src/environment.ts @@ -30,5 +30,9 @@ export const env = cleanEnv(process.env, { CONFIRM_REGISTRATION_URL: url({ devDefault: 'http://localhost:5050/confirm/registration' }), - QA_ENV: bool({ default: false }) + QA_ENV: bool({ default: false }), + E_SIGNET_AUTH_URL: url({ devDefault: '' }), + OPENID_PROVIDER_CLIENT_ID: str({ devDefault: '' }), + OPENID_PROVIDER_CLAIMS: str({ devDefault: '' }), + OIDP_USER_INFO_URL: url({ devDefault: '' }) }) diff --git a/src/form/birth/index.ts b/src/form/birth/index.ts index aad010f07..c4bffece2 100644 --- a/src/form/birth/index.ts +++ b/src/form/birth/index.ts @@ -9,7 +9,7 @@ * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. */ -import { Event, ISerializedForm } from '../types/types' +import { Event, ISerializedForm, SerializedFormField } from '../types/types' import { formMessageDescriptors } from '../common/messages' import { informantType } from './required-fields' import { @@ -79,7 +79,20 @@ import { getSectionMapping } from '@countryconfig/utils/mapping/section/birth/ma import { getCommonSectionMapping } from '@countryconfig/utils/mapping/field-mapping-utils' import { getReasonForLateRegistration } from '../custom-fields' import { getIDNumberFields, getIDType } from '../custom-fields' -import { getGenderCustom, getIDReaderField } from './custom-fields' +import { + esignet, + esignetCallback, + idReader, + idVerificationFields, + qr +} from '@opencrvs/mosip' +import { getGenderCustom } from './custom-fields' +import { + E_SIGNET_AUTH_URL, + OIDP_USER_INFO_URL, + OPENID_PROVIDER_CLAIMS, + OPENID_PROVIDER_CLIENT_ID +} from '@countryconfig/constants' // import { createCustomFieldExample } from '../custom-fields' // ======================= FORM CONFIGURATION ======================= @@ -220,7 +233,7 @@ export const birthForm: ISerializedForm = { fields: [ informantType, // Required field. otherInformantType(Event.Birth), // Required field. - getIDReaderField( + idReader( 'birth', 'informant', informantFirstNameConditionals @@ -228,57 +241,27 @@ export const birthForm: ISerializedForm = { .concat({ action: 'hide', expression: '!!$form?.verified' - }) - ), - { - name: 'someHTTPField', - type: 'HTTP', - custom: true, - label: { - id: 'messages.empty', - defaultMessage: ' ' - }, - validator: [], - options: { - url: 'someRoute', - headers: { - 'Content-type': 'application/json' - }, - method: 'GET' - } - }, - { - name: 'verified', - type: 'HIDDEN', - custom: true, - label: { - id: 'messages.empty', - defaultMessage: '' - }, - initialValue: { - dependsOn: ['idReader'], - expression: 'Boolean($form?.idReader)? "pending":""' - }, - validator: [] - }, - { - name: 'idPending', - type: 'ID_VERIFICATION_BANNER', - custom: true, - bannerType: 'pending', - idFieldName: 'idReader', - label: { - id: 'messages.empty', - defaultMessage: '' - }, - validator: [], - conditionals: [ - { - action: 'hide', - expression: '$form?.verified !== "pending"' - } + }), + [ + qr(), + esignet( + E_SIGNET_AUTH_URL, + OPENID_PROVIDER_CLIENT_ID, + OPENID_PROVIDER_CLAIMS, + 'esignet', + 'esignetCallback' + ) ] - }, + ) as SerializedFormField, + esignetCallback({ + fieldName: 'esignetCallback', + getOIDPUserInfoUrl: OIDP_USER_INFO_URL, + openIdProviderClientId: OPENID_PROVIDER_CLIENT_ID + }) as SerializedFormField, + ...(idVerificationFields( + 'birth', + 'informant' + ) as SerializedFormField[]), getFirstNameField( 'informantNameInEnglish', informantFirstNameConditionals.concat( diff --git a/yarn.lock b/yarn.lock index 3b59f55aa..4dd2bfa11 100644 --- a/yarn.lock +++ b/yarn.lock @@ -790,12 +790,10 @@ dependencies: "@octokit/openapi-types" "^18.0.0" -"@opencrvs/mosip@^1.7.0-alpha.2": - version "1.7.0-alpha.2" - resolved "https://registry.yarnpkg.com/@opencrvs/mosip/-/mosip-1.7.0-alpha.2.tgz#b3de70d993607142d739c7ada0c021b0d0f32b46" - integrity sha512-UiZUxuUiNGP/9CuQh1yPtmXmZTRAFiY4jQI2qlihCXZ8A0JbdXut2g3Dw3dRNvA9SvUnix1uuQpmWU/tAePWJA== - dependencies: - "@hapi/hapi" "^20.0.1" +"@opencrvs/mosip@^1.7.0-alpha.4": + version "1.7.0-alpha.4" + resolved "https://registry.yarnpkg.com/@opencrvs/mosip/-/mosip-1.7.0-alpha.4.tgz#82bd22e6dfbebfced533343774825da9ec194289" + integrity sha512-INdAXQWpdZ4y04MDhZd5cYl4pTl1FvrQfyWn4P8nqukAh/JpW8UtZE98zoIJ7/wS331zO6Lj5w0th+baGgQu/A== "@opencrvs/toolkit@0.0.6-events": version "0.0.6-events" From d15f9aca3e11ffa86c0ccbeccf51ecc7d7a140a7 Mon Sep 17 00:00:00 2001 From: tahmidrahman-dsi Date: Thu, 9 Jan 2025 13:04:36 +0600 Subject: [PATCH 16/29] fix: remove unused custom field --- src/form/birth/custom-fields.ts | 60 --------------------------------- 1 file changed, 60 deletions(-) diff --git a/src/form/birth/custom-fields.ts b/src/form/birth/custom-fields.ts index 56b015070..c296c696f 100644 --- a/src/form/birth/custom-fields.ts +++ b/src/form/birth/custom-fields.ts @@ -9,66 +9,6 @@ import { genderOptions } from '../common/select-options' * @param sectionId * @returns hidden field to store QR scanned data */ -export function getIDReaderField( - event: string, - sectionId: string, - conditionals: Conditional[] -): SerializedFormField { - const fieldName: string = 'idReader' - const fieldId: string = `${event}.${sectionId}.${sectionId}-view-group.${fieldName}` - return { - name: fieldName, - customQuestionMappingId: fieldId, - custom: true, - required: false, - type: 'ID_READER', - label: { - id: 'form.field.label.empty', - defaultMessage: '' - }, - hideInPreview: true, - initialValue: '', - validator: [], - mapping: getCustomFieldMapping(fieldId), - placeholder: formMessageDescriptors.formSelectPlaceholder, - conditionals, - dividerLabel: { - id: 'views.idReader.label.or', - defaultMessage: 'Or' - }, - manualInputInstructionLabel: { - id: 'views.idReader.label.manualInput', - defaultMessage: 'Complete fields below' - }, - readers: [ - { - type: 'QR' - }, - { - name: 'eSignetLink', - validator: [], - icon: { - desktop: 'Globe', - mobile: 'Fingerprint' - }, - type: 'LINK_BUTTON', - label: { - id: 'views.idReader.label.eSignet', - defaultMessage: 'E-signet' - }, - options: { - url: 'https://docs.esignet.io/', - callback: { - params: { - authorized: 'true' - }, - trigger: 'someHTTPField' - } - } - } - ] - } -} /** To bypass config validation */ export function getGenderCustom( From f8996f44d3b9c0c6ce17d4ef237b0a84e712d910 Mon Sep 17 00:00:00 2001 From: tahmidrahman-dsi Date: Thu, 9 Jan 2025 19:34:56 +0600 Subject: [PATCH 17/29] fix: improve naming --- src/form/types/types.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/form/types/types.ts b/src/form/types/types.ts index 75afc02ad..8f18ea234 100644 --- a/src/form/types/types.ts +++ b/src/form/types/types.ts @@ -503,10 +503,11 @@ export interface IHttpFormField extends IFormFieldBase { method?: string headers: Record body?: Record + params?: Record } } -export interface IRedirectFormField extends IFormFieldBase { +export interface ILinkButtonFormField extends IFormFieldBase { type: typeof LINK_BUTTON icon?: { desktop: string @@ -525,7 +526,7 @@ export interface QRReaderType { type: 'QR' } -type ReaderType = QRReaderType | IRedirectFormField +type ReaderType = QRReaderType | ILinkButtonFormField export interface IIDReaderFormField extends IFormFieldBase { type: typeof ID_READER dividerLabel: MessageDescriptor @@ -534,7 +535,7 @@ export interface IIDReaderFormField extends IFormFieldBase { } export type BannerType = 'pending' | 'verified' | 'failed' -export interface IBannerFormField extends IFormFieldBase { +export interface IIDVerificationBannerFormField extends IFormFieldBase { type: typeof ID_VERIFICATION_BANNER bannerType: BannerType idFieldName: string @@ -574,9 +575,9 @@ export type IFormField = | ISignatureFormField | IHiddenFormField | IIDReaderFormField - | IRedirectFormField + | ILinkButtonFormField | IHttpFormField - | IBannerFormField + | IIDVerificationBannerFormField export interface SelectComponentOption { value: string From cb8d2860abf1ea477a015327f705af6a6a9de457 Mon Sep 17 00:00:00 2001 From: tahmidrahman-dsi Date: Fri, 10 Jan 2025 16:27:06 +0600 Subject: [PATCH 18/29] chore: add hidden form field type --- src/form/types/types.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/form/types/types.ts b/src/form/types/types.ts index 8f18ea234..c57c10c2b 100644 --- a/src/form/types/types.ts +++ b/src/form/types/types.ts @@ -143,6 +143,7 @@ export const NID_VERIFICATION_BUTTON = 'NID_VERIFICATION_BUTTON' export const DIVIDER = 'DIVIDER' export const HEADING3 = 'HEADING3' export const SIGNATURE = 'SIGNATURE' +export const HIDDEN = 'HIDDEN' export const LINK_BUTTON = 'LINK_BUTTON' export const ID_READER = 'ID_READER' export const HTTP = 'HTTP' @@ -496,6 +497,10 @@ export interface ISignatureFormField extends IFormFieldBase { )[] } +export interface IHiddenFormField extends IFormFieldBase { + type: typeof HIDDEN +} + export interface IHttpFormField extends IFormFieldBase { type: typeof HTTP options: { From 0fb71a357f1d6ddde40674cda493f290b2e1d66e Mon Sep 17 00:00:00 2001 From: euanmillar Date: Fri, 10 Jan 2025 12:32:31 +0000 Subject: [PATCH 19/29] Adjust field definitions and add env var for server package --- infrastructure/docker-compose.deploy.yml | 1 + src/form/birth/index.ts | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/infrastructure/docker-compose.deploy.yml b/infrastructure/docker-compose.deploy.yml index 47dc1df46..b2b6a1a51 100644 --- a/infrastructure/docker-compose.deploy.yml +++ b/infrastructure/docker-compose.deploy.yml @@ -585,6 +585,7 @@ services: - OPENID_PROVIDER_CLIENT_ID=${OPENID_PROVIDER_CLIENT_ID} - OPENID_PROVIDER_CLAIMS=${OPENID_PROVIDER_CLAIMS} - OIDP_USER_INFO_URL=${OIDP_USER_INFO_URL} + - LOCALE=en networks: - overlay_net logging: diff --git a/src/form/birth/index.ts b/src/form/birth/index.ts index c4bffece2..141ba9be1 100644 --- a/src/form/birth/index.ts +++ b/src/form/birth/index.ts @@ -245,6 +245,8 @@ export const birthForm: ISerializedForm = { [ qr(), esignet( + 'birth', + 'informant', E_SIGNET_AUTH_URL, OPENID_PROVIDER_CLIENT_ID, OPENID_PROVIDER_CLAIMS, @@ -269,8 +271,9 @@ export const birthForm: ISerializedForm = { ), certificateHandlebars.informantFirstName, { - dependsOn: ['idReader'], - expression: '$form?.idReader?.firstName || ""' + dependsOn: ['idReader', 'esignetCallback'], + expression: + '$form?.idReader?.firstName || "$form?.esignetCallback?.data?.firstName"' } ), // Required field. In Farajaland, we have built the option to integrate with MOSIP. So we have different conditionals for each name to check MOSIP responses. You could always refactor firstNamesEng for a basic setup getFamilyNameField( @@ -280,13 +283,15 @@ export const birthForm: ISerializedForm = { ), certificateHandlebars.informantFamilyName, { - dependsOn: ['idReader'], - expression: '$form?.idReader?.familyName || ""' + dependsOn: ['idReader', 'esignetCallback'], + expression: + '$form?.idReader?.familyName || "$form?.esignetCallback?.data?.familyName"' } ), // Required field. getGenderCustom('birth', 'informant', [], { - dependsOn: ['idReader'], - expression: '$form?.idReader?.gender || ""' + dependsOn: ['idReader', 'esignetCallback'], + expression: + '$form?.idReader?.gender || "$form?.esignetCallback?.data?.gender"' }), getBirthDate( 'informantBirthDate', @@ -305,8 +310,9 @@ export const birthForm: ISerializedForm = { ], certificateHandlebars.informantBirthDate, { - dependsOn: ['idReader'], - expression: '$form?.idReader?.birthDate || ""' + dependsOn: ['idReader', 'esignetCallback'], + expression: + '$form?.idReader?.birthDate || "$form?.esignetCallback?.data?.birthDate"' } ), // Required field. exactDateOfBirthUnknown(hideIfInformantMotherOrFather), From f6de85988e2f4e673e01aaedd7bc63e87d951750 Mon Sep 17 00:00:00 2001 From: euanmillar Date: Fri, 10 Jan 2025 12:35:40 +0000 Subject: [PATCH 20/29] bump package number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 56252ffc1..a75027331 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "@hapi/boom": "^9.1.1", "@hapi/hapi": "^20.0.1", "@hapi/inert": "^6.0.3", - "@opencrvs/mosip": "^1.7.0-alpha.4", + "@opencrvs/mosip": "^1.7.0-alpha.5", "@opencrvs/toolkit": "0.0.6-events", "@types/chalk": "^2.2.0", "@types/csv2json": "^1.4.0", From 974535cd85794ff66d86a3dc84c13f52171af09e Mon Sep 17 00:00:00 2001 From: tahmidrahman-dsi Date: Mon, 13 Jan 2025 16:43:37 +0600 Subject: [PATCH 21/29] fix: typo --- src/form/types/types.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/form/types/types.ts b/src/form/types/types.ts index c57c10c2b..3adceacb6 100644 --- a/src/form/types/types.ts +++ b/src/form/types/types.ts @@ -143,7 +143,6 @@ export const NID_VERIFICATION_BUTTON = 'NID_VERIFICATION_BUTTON' export const DIVIDER = 'DIVIDER' export const HEADING3 = 'HEADING3' export const SIGNATURE = 'SIGNATURE' -export const HIDDEN = 'HIDDEN' export const LINK_BUTTON = 'LINK_BUTTON' export const ID_READER = 'ID_READER' export const HTTP = 'HTTP' @@ -497,10 +496,6 @@ export interface ISignatureFormField extends IFormFieldBase { )[] } -export interface IHiddenFormField extends IFormFieldBase { - type: typeof HIDDEN -} - export interface IHttpFormField extends IFormFieldBase { type: typeof HTTP options: { @@ -798,7 +793,7 @@ export type SerializedFormField = UnionOmit< mapping?: IFormFieldMapping } -interface IHiddenFormField extends IFormFieldBase { +export interface IHiddenFormField extends IFormFieldBase { type: typeof HIDDEN } From 7cb991dd2843e3c687b46a6fb6d5a971887c9195 Mon Sep 17 00:00:00 2001 From: euanmillar Date: Mon, 13 Jan 2025 13:18:17 +0000 Subject: [PATCH 22/29] Ensure redirectUri is populated --- package.json | 2 +- src/form/birth/index.ts | 2 ++ yarn.lock | 8 ++++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index a75027331..6ec4197eb 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "@hapi/boom": "^9.1.1", "@hapi/hapi": "^20.0.1", "@hapi/inert": "^6.0.3", - "@opencrvs/mosip": "^1.7.0-alpha.5", + "@opencrvs/mosip": "^1.7.0-alpha.6", "@opencrvs/toolkit": "0.0.6-events", "@types/chalk": "^2.2.0", "@types/csv2json": "^1.4.0", diff --git a/src/form/birth/index.ts b/src/form/birth/index.ts index 141ba9be1..f955361ab 100644 --- a/src/form/birth/index.ts +++ b/src/form/birth/index.ts @@ -257,6 +257,8 @@ export const birthForm: ISerializedForm = { ) as SerializedFormField, esignetCallback({ fieldName: 'esignetCallback', + event: 'birth', + sectionId: 'informant', getOIDPUserInfoUrl: OIDP_USER_INFO_URL, openIdProviderClientId: OPENID_PROVIDER_CLIENT_ID }) as SerializedFormField, diff --git a/yarn.lock b/yarn.lock index 4dd2bfa11..77fda849d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -790,10 +790,10 @@ dependencies: "@octokit/openapi-types" "^18.0.0" -"@opencrvs/mosip@^1.7.0-alpha.4": - version "1.7.0-alpha.4" - resolved "https://registry.yarnpkg.com/@opencrvs/mosip/-/mosip-1.7.0-alpha.4.tgz#82bd22e6dfbebfced533343774825da9ec194289" - integrity sha512-INdAXQWpdZ4y04MDhZd5cYl4pTl1FvrQfyWn4P8nqukAh/JpW8UtZE98zoIJ7/wS331zO6Lj5w0th+baGgQu/A== +"@opencrvs/mosip@^1.7.0-alpha.6": + version "1.7.0-alpha.6" + resolved "https://registry.yarnpkg.com/@opencrvs/mosip/-/mosip-1.7.0-alpha.6.tgz#b763a972e871e1d3c62ef71281c3ce481ec9573e" + integrity sha512-OEaBASV/77ikC7AB80HIk3E1er7blZZ0wszrNn+wycvlyaN+/itHBqFEB3prBiERHmP0yPbcVx+tz+1PnmuEpQ== "@opencrvs/toolkit@0.0.6-events": version "0.0.6-events" From a44b3c99ebb9e830b04a2ee11ebe39b6ac67089b Mon Sep 17 00:00:00 2001 From: tahmidrahman-dsi Date: Tue, 14 Jan 2025 17:06:05 +0600 Subject: [PATCH 23/29] chore: update mosip images tags --- infrastructure/docker-compose.deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/infrastructure/docker-compose.deploy.yml b/infrastructure/docker-compose.deploy.yml index b2b6a1a51..ce6ec7854 100644 --- a/infrastructure/docker-compose.deploy.yml +++ b/infrastructure/docker-compose.deploy.yml @@ -1024,7 +1024,7 @@ services: - node.labels.data1 == true mosip-api: - image: ghcr.io/opencrvs/mosip:f4fbde3 + image: ghcr.io/opencrvs/mosip:653cf94 environment: - NODE_ENV=production - MOSIP_BIRTH_WEBHOOK_URL=http://mosip-mock:20240/webhooks/opencrvs/birth @@ -1043,7 +1043,7 @@ services: tag: 'mosip-api' mosip-mock: - image: ghcr.io/opencrvs/mosip-mock:f4fbde3 + image: ghcr.io/opencrvs/mosip-mock:653cf94 environment: - NODE_ENV=production - OPENCRVS_MOSIP_SERVER_URL=http://mosip-api:2024/webhooks/mosip From 7ba86ffe0231227e19c9c0a6fa8e2014cf6c1d0d Mon Sep 17 00:00:00 2001 From: tahmidrahman-dsi Date: Tue, 14 Jan 2025 18:39:55 +0600 Subject: [PATCH 24/29] refactor: rename variable esignet auth url --- infrastructure/docker-compose.deploy.yml | 2 +- infrastructure/docker-compose.development-deploy.yml | 2 +- infrastructure/docker-compose.qa-deploy.yml | 2 +- infrastructure/docker-compose.staging-deploy.yml | 2 +- src/constants.ts | 2 +- src/environment.ts | 2 +- src/form/birth/index.ts | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/infrastructure/docker-compose.deploy.yml b/infrastructure/docker-compose.deploy.yml index ce6ec7854..6b9d10ac8 100644 --- a/infrastructure/docker-compose.deploy.yml +++ b/infrastructure/docker-compose.deploy.yml @@ -581,7 +581,7 @@ services: - INFOBIP_API_KEY=${INFOBIP_API_KEY:-} - INFOBIP_SENDER_ID=${INFOBIP_SENDER_ID:-} - DOMAIN={{hostname}} - - E_SIGNET_AUTH_URL=${E_SIGNET_AUTH_URL} + - ESIGNET_AUTH_URL=${ESIGNET_AUTH_URL} - OPENID_PROVIDER_CLIENT_ID=${OPENID_PROVIDER_CLIENT_ID} - OPENID_PROVIDER_CLAIMS=${OPENID_PROVIDER_CLAIMS} - OIDP_USER_INFO_URL=${OIDP_USER_INFO_URL} diff --git a/infrastructure/docker-compose.development-deploy.yml b/infrastructure/docker-compose.development-deploy.yml index 0e1c2b4a0..0675aaa23 100644 --- a/infrastructure/docker-compose.development-deploy.yml +++ b/infrastructure/docker-compose.development-deploy.yml @@ -28,7 +28,7 @@ services: - SMTP_USERNAME=${SMTP_USERNAME} - SMTP_PASSWORD=${SMTP_PASSWORD} - SMTP_SECURE=${SMTP_SECURE} - - E_SIGNET_AUTH_URL=${E_SIGNET_AUTH_URL} + - ESIGNET_AUTH_URL=${ESIGNET_AUTH_URL} - OPENID_PROVIDER_CLIENT_ID=${OPENID_PROVIDER_CLIENT_ID} - OPENID_PROVIDER_CLAIMS=${OPENID_PROVIDER_CLAIMS} - OIDP_USER_INFO_URL=${OIDP_USER_INFO_URL} diff --git a/infrastructure/docker-compose.qa-deploy.yml b/infrastructure/docker-compose.qa-deploy.yml index a053df26e..1225c07b4 100644 --- a/infrastructure/docker-compose.qa-deploy.yml +++ b/infrastructure/docker-compose.qa-deploy.yml @@ -57,7 +57,7 @@ services: - SMTP_USERNAME=${SMTP_USERNAME} - SMTP_PASSWORD=${SMTP_PASSWORD} - SMTP_SECURE=${SMTP_SECURE} - - E_SIGNET_AUTH_URL=${E_SIGNET_AUTH_URL} + - ESIGNET_AUTH_URL=${ESIGNET_AUTH_URL} - OPENID_PROVIDER_CLIENT_ID=${OPENID_PROVIDER_CLIENT_ID} - OPENID_PROVIDER_CLAIMS=${OPENID_PROVIDER_CLAIMS} - OIDP_USER_INFO_URL=${OIDP_USER_INFO_URL} diff --git a/infrastructure/docker-compose.staging-deploy.yml b/infrastructure/docker-compose.staging-deploy.yml index a121ef36f..73f709884 100644 --- a/infrastructure/docker-compose.staging-deploy.yml +++ b/infrastructure/docker-compose.staging-deploy.yml @@ -107,7 +107,7 @@ services: - SMTP_USERNAME=${SMTP_USERNAME} - SMTP_PASSWORD=${SMTP_PASSWORD} - SMTP_SECURE=${SMTP_SECURE} - - E_SIGNET_AUTH_URL=${E_SIGNET_AUTH_URL} + - ESIGNET_AUTH_URL=${ESIGNET_AUTH_URL} - OPENID_PROVIDER_CLIENT_ID=${OPENID_PROVIDER_CLIENT_ID} - OPENID_PROVIDER_CLAIMS=${OPENID_PROVIDER_CLAIMS} - OIDP_USER_INFO_URL=${OIDP_USER_INFO_URL} diff --git a/src/constants.ts b/src/constants.ts index 93bdf5c7f..9893bfc86 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -32,7 +32,7 @@ export const PRODUCTION = env.isProd export const QA_ENV = env.QA_ENV // e-signet -export const E_SIGNET_AUTH_URL = env.E_SIGNET_AUTH_URL +export const ESIGNET_AUTH_URL = env.ESIGNET_AUTH_URL export const OPENID_PROVIDER_CLIENT_ID = env.OPENID_PROVIDER_CLIENT_ID export const OPENID_PROVIDER_CLAIMS = env.OPENID_PROVIDER_CLAIMS export const OIDP_USER_INFO_URL = env.OIDP_USER_INFO_URL diff --git a/src/environment.ts b/src/environment.ts index a4a5f1bdd..608a81687 100644 --- a/src/environment.ts +++ b/src/environment.ts @@ -31,7 +31,7 @@ export const env = cleanEnv(process.env, { devDefault: 'http://localhost:5050/confirm/registration' }), QA_ENV: bool({ default: false }), - E_SIGNET_AUTH_URL: url({ devDefault: '' }), + ESIGNET_AUTH_URL: url({ devDefault: '' }), OPENID_PROVIDER_CLIENT_ID: str({ devDefault: '' }), OPENID_PROVIDER_CLAIMS: str({ devDefault: '' }), OIDP_USER_INFO_URL: url({ devDefault: '' }) diff --git a/src/form/birth/index.ts b/src/form/birth/index.ts index f955361ab..2064830ca 100644 --- a/src/form/birth/index.ts +++ b/src/form/birth/index.ts @@ -88,7 +88,7 @@ import { } from '@opencrvs/mosip' import { getGenderCustom } from './custom-fields' import { - E_SIGNET_AUTH_URL, + ESIGNET_AUTH_URL, OIDP_USER_INFO_URL, OPENID_PROVIDER_CLAIMS, OPENID_PROVIDER_CLIENT_ID @@ -247,7 +247,7 @@ export const birthForm: ISerializedForm = { esignet( 'birth', 'informant', - E_SIGNET_AUTH_URL, + ESIGNET_AUTH_URL, OPENID_PROVIDER_CLIENT_ID, OPENID_PROVIDER_CLAIMS, 'esignet', From c5469a9d300978b54486c878705cf6d4e1ca8a62 Mon Sep 17 00:00:00 2001 From: tahmidrahman-dsi Date: Tue, 14 Jan 2025 18:45:40 +0600 Subject: [PATCH 25/29] fix: env vars --- infrastructure/docker-compose.deploy.yml | 8 ++++---- infrastructure/docker-compose.development-deploy.yml | 8 ++++---- infrastructure/docker-compose.qa-deploy.yml | 8 ++++---- infrastructure/docker-compose.staging-deploy.yml | 8 ++++---- src/constants.ts | 4 ++-- src/environment.ts | 4 ++-- src/form/birth/index.ts | 8 ++++---- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/infrastructure/docker-compose.deploy.yml b/infrastructure/docker-compose.deploy.yml index 6b9d10ac8..6ea6c59ae 100644 --- a/infrastructure/docker-compose.deploy.yml +++ b/infrastructure/docker-compose.deploy.yml @@ -581,10 +581,10 @@ services: - INFOBIP_API_KEY=${INFOBIP_API_KEY:-} - INFOBIP_SENDER_ID=${INFOBIP_SENDER_ID:-} - DOMAIN={{hostname}} - - ESIGNET_AUTH_URL=${ESIGNET_AUTH_URL} - - OPENID_PROVIDER_CLIENT_ID=${OPENID_PROVIDER_CLIENT_ID} - - OPENID_PROVIDER_CLAIMS=${OPENID_PROVIDER_CLAIMS} - - OIDP_USER_INFO_URL=${OIDP_USER_INFO_URL} + - ESIGNET_TOKEN_URL=${ESIGNET_TOKEN_URL:-} + - OPENID_PROVIDER_CLIENT_ID=${OPENID_PROVIDER_CLIENT_ID:-} + - OPENID_PROVIDER_CLAIMS=${OPENID_PROVIDER_CLAIMS:-} + - ESIGNET_USERINFO_URL=${ESIGNET_USERINFO_URL:-} - LOCALE=en networks: - overlay_net diff --git a/infrastructure/docker-compose.development-deploy.yml b/infrastructure/docker-compose.development-deploy.yml index 0675aaa23..574fe0023 100644 --- a/infrastructure/docker-compose.development-deploy.yml +++ b/infrastructure/docker-compose.development-deploy.yml @@ -28,10 +28,10 @@ services: - SMTP_USERNAME=${SMTP_USERNAME} - SMTP_PASSWORD=${SMTP_PASSWORD} - SMTP_SECURE=${SMTP_SECURE} - - ESIGNET_AUTH_URL=${ESIGNET_AUTH_URL} - - OPENID_PROVIDER_CLIENT_ID=${OPENID_PROVIDER_CLIENT_ID} - - OPENID_PROVIDER_CLAIMS=${OPENID_PROVIDER_CLAIMS} - - OIDP_USER_INFO_URL=${OIDP_USER_INFO_URL} + - ESIGNET_TOKEN_URL=${ESIGNET_TOKEN_URL:-} + - OPENID_PROVIDER_CLIENT_ID=${OPENID_PROVIDER_CLIENT_ID:-} + - OPENID_PROVIDER_CLAIMS=${OPENID_PROVIDER_CLAIMS:-} + - ESIGNET_USERINFO_URL=${ESIGNET_USERINFO_URL:-} deploy: replicas: 1 networks: diff --git a/infrastructure/docker-compose.qa-deploy.yml b/infrastructure/docker-compose.qa-deploy.yml index 1225c07b4..561960c01 100644 --- a/infrastructure/docker-compose.qa-deploy.yml +++ b/infrastructure/docker-compose.qa-deploy.yml @@ -57,10 +57,10 @@ services: - SMTP_USERNAME=${SMTP_USERNAME} - SMTP_PASSWORD=${SMTP_PASSWORD} - SMTP_SECURE=${SMTP_SECURE} - - ESIGNET_AUTH_URL=${ESIGNET_AUTH_URL} - - OPENID_PROVIDER_CLIENT_ID=${OPENID_PROVIDER_CLIENT_ID} - - OPENID_PROVIDER_CLAIMS=${OPENID_PROVIDER_CLAIMS} - - OIDP_USER_INFO_URL=${OIDP_USER_INFO_URL} + - ESIGNET_TOKEN_URL=${ESIGNET_TOKEN_URL:-} + - OPENID_PROVIDER_CLIENT_ID=${OPENID_PROVIDER_CLIENT_ID:-} + - OPENID_PROVIDER_CLAIMS=${OPENID_PROVIDER_CLAIMS:-} + - ESIGNET_USERINFO_URL=${ESIGNET_USERINFO_URL:-} deploy: replicas: 1 networks: diff --git a/infrastructure/docker-compose.staging-deploy.yml b/infrastructure/docker-compose.staging-deploy.yml index 73f709884..99cb9b3a4 100644 --- a/infrastructure/docker-compose.staging-deploy.yml +++ b/infrastructure/docker-compose.staging-deploy.yml @@ -107,10 +107,10 @@ services: - SMTP_USERNAME=${SMTP_USERNAME} - SMTP_PASSWORD=${SMTP_PASSWORD} - SMTP_SECURE=${SMTP_SECURE} - - ESIGNET_AUTH_URL=${ESIGNET_AUTH_URL} - - OPENID_PROVIDER_CLIENT_ID=${OPENID_PROVIDER_CLIENT_ID} - - OPENID_PROVIDER_CLAIMS=${OPENID_PROVIDER_CLAIMS} - - OIDP_USER_INFO_URL=${OIDP_USER_INFO_URL} + - ESIGNET_TOKEN_URL=${ESIGNET_TOKEN_URL:-} + - OPENID_PROVIDER_CLIENT_ID=${OPENID_PROVIDER_CLIENT_ID:-} + - OPENID_PROVIDER_CLAIMS=${OPENID_PROVIDER_CLAIMS:-} + - ESIGNET_USERINFO_URL=${ESIGNET_USERINFO_URL:-} deploy: replicas: 1 diff --git a/src/constants.ts b/src/constants.ts index 9893bfc86..ad48df188 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -32,7 +32,7 @@ export const PRODUCTION = env.isProd export const QA_ENV = env.QA_ENV // e-signet -export const ESIGNET_AUTH_URL = env.ESIGNET_AUTH_URL +export const ESIGNET_TOKEN_URL = env.ESIGNET_TOKEN_URL export const OPENID_PROVIDER_CLIENT_ID = env.OPENID_PROVIDER_CLIENT_ID export const OPENID_PROVIDER_CLAIMS = env.OPENID_PROVIDER_CLAIMS -export const OIDP_USER_INFO_URL = env.OIDP_USER_INFO_URL +export const ESIGNET_USERINFO_URL = env.ESIGNET_USERINFO_URL diff --git a/src/environment.ts b/src/environment.ts index 608a81687..701aff0f5 100644 --- a/src/environment.ts +++ b/src/environment.ts @@ -31,8 +31,8 @@ export const env = cleanEnv(process.env, { devDefault: 'http://localhost:5050/confirm/registration' }), QA_ENV: bool({ default: false }), - ESIGNET_AUTH_URL: url({ devDefault: '' }), + ESIGNET_TOKEN_URL: url({ devDefault: '' }), OPENID_PROVIDER_CLIENT_ID: str({ devDefault: '' }), OPENID_PROVIDER_CLAIMS: str({ devDefault: '' }), - OIDP_USER_INFO_URL: url({ devDefault: '' }) + ESIGNET_USERINFO_URL: url({ devDefault: '' }) }) diff --git a/src/form/birth/index.ts b/src/form/birth/index.ts index 2064830ca..981ee7247 100644 --- a/src/form/birth/index.ts +++ b/src/form/birth/index.ts @@ -88,8 +88,8 @@ import { } from '@opencrvs/mosip' import { getGenderCustom } from './custom-fields' import { - ESIGNET_AUTH_URL, - OIDP_USER_INFO_URL, + ESIGNET_TOKEN_URL, + ESIGNET_USERINFO_URL, OPENID_PROVIDER_CLAIMS, OPENID_PROVIDER_CLIENT_ID } from '@countryconfig/constants' @@ -247,7 +247,7 @@ export const birthForm: ISerializedForm = { esignet( 'birth', 'informant', - ESIGNET_AUTH_URL, + ESIGNET_TOKEN_URL, OPENID_PROVIDER_CLIENT_ID, OPENID_PROVIDER_CLAIMS, 'esignet', @@ -259,7 +259,7 @@ export const birthForm: ISerializedForm = { fieldName: 'esignetCallback', event: 'birth', sectionId: 'informant', - getOIDPUserInfoUrl: OIDP_USER_INFO_URL, + getOIDPUserInfoUrl: ESIGNET_USERINFO_URL, openIdProviderClientId: OPENID_PROVIDER_CLIENT_ID }) as SerializedFormField, ...(idVerificationFields( From 352a962c333d3d80c2bd8fbb3123ebe18fb142e7 Mon Sep 17 00:00:00 2001 From: tahmidrahman-dsi Date: Wed, 15 Jan 2025 19:00:52 +0600 Subject: [PATCH 26/29] chore: upgrade @opencrvs/mosip --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 6ec4197eb..1f90d4924 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "@hapi/boom": "^9.1.1", "@hapi/hapi": "^20.0.1", "@hapi/inert": "^6.0.3", - "@opencrvs/mosip": "^1.7.0-alpha.6", + "@opencrvs/mosip": "^1.7.0-alpha.7", "@opencrvs/toolkit": "0.0.6-events", "@types/chalk": "^2.2.0", "@types/csv2json": "^1.4.0", diff --git a/yarn.lock b/yarn.lock index 77fda849d..8ee00ad92 100644 --- a/yarn.lock +++ b/yarn.lock @@ -790,10 +790,10 @@ dependencies: "@octokit/openapi-types" "^18.0.0" -"@opencrvs/mosip@^1.7.0-alpha.6": - version "1.7.0-alpha.6" - resolved "https://registry.yarnpkg.com/@opencrvs/mosip/-/mosip-1.7.0-alpha.6.tgz#b763a972e871e1d3c62ef71281c3ce481ec9573e" - integrity sha512-OEaBASV/77ikC7AB80HIk3E1er7blZZ0wszrNn+wycvlyaN+/itHBqFEB3prBiERHmP0yPbcVx+tz+1PnmuEpQ== +"@opencrvs/mosip@^1.7.0-alpha.7": + version "1.7.0-alpha.7" + resolved "https://registry.yarnpkg.com/@opencrvs/mosip/-/mosip-1.7.0-alpha.7.tgz#1e12e121b5826bb3c39112b41e399ec460368d3c" + integrity sha512-khmgqvyYppgddF/c/ckUe4WtFBsUDp//bEy853PsExPMSCV7lBbi9gYl46FTeazPuS44aWMt1LlV7R4+gKR5+A== "@opencrvs/toolkit@0.0.6-events": version "0.0.6-events" From a36bebcebc216bbf09394a8b305c6cc1d923e60c Mon Sep 17 00:00:00 2001 From: tahmidrahman-dsi Date: Thu, 16 Jan 2025 13:11:02 +0600 Subject: [PATCH 27/29] chore: upgrade mosip dep version --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 1f90d4924..86d0ba489 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "@hapi/boom": "^9.1.1", "@hapi/hapi": "^20.0.1", "@hapi/inert": "^6.0.3", - "@opencrvs/mosip": "^1.7.0-alpha.7", + "@opencrvs/mosip": "^1.7.0-alpha.8", "@opencrvs/toolkit": "0.0.6-events", "@types/chalk": "^2.2.0", "@types/csv2json": "^1.4.0", diff --git a/yarn.lock b/yarn.lock index 8ee00ad92..288bfedb2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -790,10 +790,10 @@ dependencies: "@octokit/openapi-types" "^18.0.0" -"@opencrvs/mosip@^1.7.0-alpha.7": - version "1.7.0-alpha.7" - resolved "https://registry.yarnpkg.com/@opencrvs/mosip/-/mosip-1.7.0-alpha.7.tgz#1e12e121b5826bb3c39112b41e399ec460368d3c" - integrity sha512-khmgqvyYppgddF/c/ckUe4WtFBsUDp//bEy853PsExPMSCV7lBbi9gYl46FTeazPuS44aWMt1LlV7R4+gKR5+A== +"@opencrvs/mosip@^1.7.0-alpha.8": + version "1.7.0-alpha.8" + resolved "https://registry.yarnpkg.com/@opencrvs/mosip/-/mosip-1.7.0-alpha.8.tgz#cbddedda9c7f12a99935675e04b157a345182b84" + integrity sha512-uQnxlaiHBnnqsb+EA+KwZmgl2Xpmuxnu7OvVLwM89GCvTyB3XO36WdawZmfDlQxP+v3Ejuiwp4LLJiX4vDtFUQ== "@opencrvs/toolkit@0.0.6-events": version "0.0.6-events" From 36f61aa1ee7e65bf37b03c0e4e3ef61b5d9d76c4 Mon Sep 17 00:00:00 2001 From: tahmidrahman-dsi Date: Thu, 16 Jan 2025 18:52:51 +0600 Subject: [PATCH 28/29] chore: update form field condition --- src/form/birth/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/form/birth/index.ts b/src/form/birth/index.ts index 981ee7247..a8f67835a 100644 --- a/src/form/birth/index.ts +++ b/src/form/birth/index.ts @@ -275,7 +275,7 @@ export const birthForm: ISerializedForm = { { dependsOn: ['idReader', 'esignetCallback'], expression: - '$form?.idReader?.firstName || "$form?.esignetCallback?.data?.firstName"' + '$form?.idReader?.firstName || $form?.esignetCallback?.data?.firstName || ""' } ), // Required field. In Farajaland, we have built the option to integrate with MOSIP. So we have different conditionals for each name to check MOSIP responses. You could always refactor firstNamesEng for a basic setup getFamilyNameField( @@ -287,13 +287,13 @@ export const birthForm: ISerializedForm = { { dependsOn: ['idReader', 'esignetCallback'], expression: - '$form?.idReader?.familyName || "$form?.esignetCallback?.data?.familyName"' + '$form?.idReader?.familyName || $form?.esignetCallback?.data?.familyName || ""' } ), // Required field. getGenderCustom('birth', 'informant', [], { dependsOn: ['idReader', 'esignetCallback'], expression: - '$form?.idReader?.gender || "$form?.esignetCallback?.data?.gender"' + '$form?.idReader?.gender || $form?.esignetCallback?.data?.gender || ""' }), getBirthDate( 'informantBirthDate', @@ -314,7 +314,7 @@ export const birthForm: ISerializedForm = { { dependsOn: ['idReader', 'esignetCallback'], expression: - '$form?.idReader?.birthDate || "$form?.esignetCallback?.data?.birthDate"' + '$form?.idReader?.birthDate || $form?.esignetCallback?.data?.birthDate || ""' } ), // Required field. exactDateOfBirthUnknown(hideIfInformantMotherOrFather), From f1dc222b3494fd2632ab060d7706071b5db275c2 Mon Sep 17 00:00:00 2001 From: tahmidrahman-dsi Date: Thu, 16 Jan 2025 19:02:56 +0600 Subject: [PATCH 29/29] chore: update mosip dependency --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 86d0ba489..41e7faada 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "@hapi/boom": "^9.1.1", "@hapi/hapi": "^20.0.1", "@hapi/inert": "^6.0.3", - "@opencrvs/mosip": "^1.7.0-alpha.8", + "@opencrvs/mosip": "^1.7.0-alpha.10", "@opencrvs/toolkit": "0.0.6-events", "@types/chalk": "^2.2.0", "@types/csv2json": "^1.4.0",