@opencrvs/mosip 1.8.0-beta.7.dev → 1.8.0-beta.9.dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/forms.d.ts CHANGED
@@ -213,7 +213,12 @@ export declare const getInitialValueFromIDReader: (fieldNameInReader: string) =>
213
213
  dependsOn: string[];
214
214
  expression: string;
215
215
  };
216
- export declare const idReaderFields: (event: "birth" | "death", section: "informant" | "mother" | "father" | "spouse" | "deceased", qrConfig: QRConfig, esignetConfig: ESignetConfig | undefined, verifiedCustomFieldMapping: any, conditionals?: any[]) => any[];
216
+ type IDReaderParams = {
217
+ (event: "birth" | "death", section: "informant" | "mother" | "father" | "spouse" | "deceased", qrConfig: QRConfig, esignetConfig: ESignetConfig, verifiedCustomFieldMapping: any, conditionals?: any[]): any[];
218
+ (event: "birth" | "death", section: "informant" | "mother" | "father" | "spouse" | "deceased", qrConfig: QRConfig, esignetConfig: undefined, verifiedCustomFieldMapping: any, conditionals?: any[]): any[];
219
+ (event: "birth" | "death", section: "informant" | "mother" | "father" | "spouse" | "deceased", qrConfig: undefined, esignetConfig: ESignetConfig, verifiedCustomFieldMapping: any, conditionals?: any[]): any[];
220
+ };
221
+ export declare const idReaderFields: IDReaderParams;
217
222
  export declare const idVerificationFields: (event: string, sectionId: string, mapping: any, conditionals?: any[], esignetConfig?: ESignetConfig) => ({
218
223
  name: string;
219
224
  fieldId: string;
package/build/forms.js CHANGED
@@ -250,7 +250,10 @@ const getInitialValueFromIDReader = (fieldNameInReader) => ({
250
250
  });
251
251
  exports.getInitialValueFromIDReader = getInitialValueFromIDReader;
252
252
  const idReaderFields = (event, section, qrConfig, esignetConfig, verifiedCustomFieldMapping, conditionals = []) => {
253
- const readers = [(0, exports.qr)(qrConfig)];
253
+ const readers = [];
254
+ if (qrConfig) {
255
+ readers.push((0, exports.qr)(qrConfig));
256
+ }
254
257
  const fields = [
255
258
  (0, exports.idReader)(event, section, conditionals.concat({
256
259
  action: "hide",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/mosip",
3
- "version": "1.8.0-beta.7.dev",
3
+ "version": "1.8.0-beta.9.dev",
4
4
  "license": "MPL-2.0",
5
5
  "main": "./build/index.js",
6
6
  "exports": {
package/src/forms.ts CHANGED
@@ -331,15 +331,47 @@ export const getInitialValueFromIDReader = (fieldNameInReader: string) => ({
331
331
  expression: `$form?.idReader?.${fieldNameInReader} || $form?.esignetCallback?.data?.${fieldNameInReader} || ""`,
332
332
  });
333
333
 
334
- export const idReaderFields = (
334
+ // Define a type def so that a country implementor cannot
335
+ // provide both QR and E-Signet config undefined at the same time
336
+ type IDReaderParams = {
337
+ (
338
+ event: "birth" | "death",
339
+ section: "informant" | "mother" | "father" | "spouse" | "deceased",
340
+ qrConfig: QRConfig,
341
+ esignetConfig: ESignetConfig,
342
+ verifiedCustomFieldMapping: any,
343
+ conditionals?: any[],
344
+ ): any[];
345
+ (
346
+ event: "birth" | "death",
347
+ section: "informant" | "mother" | "father" | "spouse" | "deceased",
348
+ qrConfig: QRConfig,
349
+ esignetConfig: undefined,
350
+ verifiedCustomFieldMapping: any,
351
+ conditionals?: any[],
352
+ ): any[];
353
+ (
354
+ event: "birth" | "death",
355
+ section: "informant" | "mother" | "father" | "spouse" | "deceased",
356
+ qrConfig: undefined,
357
+ esignetConfig: ESignetConfig,
358
+ verifiedCustomFieldMapping: any,
359
+ conditionals?: any[],
360
+ ): any[];
361
+ };
362
+
363
+ export const idReaderFields: IDReaderParams = (
335
364
  event: "birth" | "death",
336
365
  section: "informant" | "mother" | "father" | "spouse" | "deceased",
337
- qrConfig: QRConfig,
366
+ qrConfig: QRConfig | undefined,
338
367
  esignetConfig: ESignetConfig | undefined,
339
368
  verifiedCustomFieldMapping: any,
340
369
  conditionals: any[] = [],
341
370
  ) => {
342
- const readers: any[] = [qr(qrConfig)];
371
+ const readers: any[] = [];
372
+ if (qrConfig) {
373
+ readers.push(qr(qrConfig));
374
+ }
343
375
  const fields: any[] = [
344
376
  idReader(
345
377
  event,