@opencrvs/mosip 1.7.0-alpha.24 → 1.7.0-alpha.25

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
@@ -162,7 +162,7 @@ export declare const verified: (event: string, sectionId: string, mapping: any,
162
162
  mapping: any;
163
163
  };
164
164
  type VerificationStatus = "verified" | "failed" | "authenticated";
165
- export declare const idVerificationBanner: (event: string, sectionId: string, status: VerificationStatus) => {
165
+ export declare const idVerificationBanner: (event: string, sectionId: string, status: VerificationStatus, conditionals?: any[]) => {
166
166
  name: string;
167
167
  type: string;
168
168
  fieldId: string;
@@ -175,10 +175,7 @@ export declare const idVerificationBanner: (event: string, sectionId: string, st
175
175
  defaultMessage: string;
176
176
  };
177
177
  validator: never[];
178
- conditionals: {
179
- action: string;
180
- expression: string;
181
- }[];
178
+ conditionals: any[];
182
179
  };
183
180
  export declare function esignetLoaderField({ event, section, fieldName, esignetCallbackFieldName, }: {
184
181
  event: "birth" | "death";
@@ -209,7 +206,7 @@ export declare const getInitialValueFromIDReader: (fieldNameInReader: string) =>
209
206
  expression: string;
210
207
  };
211
208
  export declare const idReaderFields: (event: "birth" | "death", section: "informant" | "mother" | "father" | "spouse" | "deceased", qrConfig: QRConfig, esignetConfig: ESignetConfig | undefined, verifiedCustomFieldMapping: any, conditionals?: any[]) => any[];
212
- export declare const idVerificationFields: (event: string, sectionId: string, mapping: any, esignetConfig?: ESignetConfig) => ({
209
+ export declare const idVerificationFields: (event: string, sectionId: string, mapping: any, conditionals?: any[], esignetConfig?: ESignetConfig) => ({
213
210
  name: string;
214
211
  fieldId: string;
215
212
  customQuestionMappingId: string;
@@ -238,9 +235,6 @@ export declare const idVerificationFields: (event: string, sectionId: string, ma
238
235
  defaultMessage: string;
239
236
  };
240
237
  validator: never[];
241
- conditionals: {
242
- action: string;
243
- expression: string;
244
- }[];
238
+ conditionals: any[];
245
239
  })[];
246
240
  export {};
package/build/forms.js CHANGED
@@ -177,7 +177,7 @@ exports.verified = verified;
177
177
  function capitalize(str) {
178
178
  return str.charAt(0).toUpperCase() + str.slice(1);
179
179
  }
180
- const idVerificationBanner = (event, sectionId, status) => {
180
+ const idVerificationBanner = (event, sectionId, status, conditionals = []) => {
181
181
  const fieldName = "verified";
182
182
  const fieldId = `${event}.${sectionId}.${sectionId}-view-group.${fieldName}`;
183
183
  return {
@@ -193,12 +193,12 @@ const idVerificationBanner = (event, sectionId, status) => {
193
193
  defaultMessage: "",
194
194
  },
195
195
  validator: [],
196
- conditionals: [
196
+ conditionals: conditionals.concat([
197
197
  {
198
198
  action: "hide",
199
199
  expression: `$form?.verified !== "${status}"`,
200
200
  },
201
- ],
201
+ ]),
202
202
  };
203
203
  };
204
204
  exports.idVerificationBanner = idVerificationBanner;
@@ -256,21 +256,21 @@ const idReaderFields = (event, section, qrConfig, esignetConfig, verifiedCustomF
256
256
  }
257
257
  return [
258
258
  ...fields,
259
- ...(0, exports.idVerificationFields)(event, section, verifiedCustomFieldMapping, esignetConfig),
259
+ ...(0, exports.idVerificationFields)(event, section, verifiedCustomFieldMapping, conditionals, esignetConfig),
260
260
  ];
261
261
  }
262
262
  return [
263
263
  ...fields,
264
- ...(0, exports.idVerificationFields)(event, section, verifiedCustomFieldMapping),
264
+ ...(0, exports.idVerificationFields)(event, section, verifiedCustomFieldMapping, conditionals),
265
265
  ];
266
266
  };
267
267
  exports.idReaderFields = idReaderFields;
268
- const idVerificationFields = (event, sectionId, mapping, esignetConfig) => {
268
+ const idVerificationFields = (event, sectionId, mapping, conditionals = [], esignetConfig) => {
269
269
  return [
270
270
  (0, exports.verified)(event, sectionId, mapping, esignetConfig),
271
- (0, exports.idVerificationBanner)(event, sectionId, "verified"),
272
- (0, exports.idVerificationBanner)(event, sectionId, "failed"),
273
- (0, exports.idVerificationBanner)(event, sectionId, "authenticated"),
271
+ (0, exports.idVerificationBanner)(event, sectionId, "verified", conditionals),
272
+ (0, exports.idVerificationBanner)(event, sectionId, "failed", conditionals),
273
+ (0, exports.idVerificationBanner)(event, sectionId, "authenticated", conditionals),
274
274
  ];
275
275
  };
276
276
  exports.idVerificationFields = idVerificationFields;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/mosip",
3
- "version": "1.7.0-alpha.24",
3
+ "version": "1.7.0-alpha.25",
4
4
  "license": "MPL-2.0",
5
5
  "main": "./build/index.js",
6
6
  "exports": {
package/src/forms.ts CHANGED
@@ -243,6 +243,7 @@ export const idVerificationBanner = (
243
243
  event: string,
244
244
  sectionId: string,
245
245
  status: VerificationStatus,
246
+ conditionals: any[] = [],
246
247
  ) => {
247
248
  const fieldName = "verified";
248
249
  const fieldId = `${event}.${sectionId}.${sectionId}-view-group.${fieldName}`;
@@ -259,12 +260,12 @@ export const idVerificationBanner = (
259
260
  defaultMessage: "",
260
261
  },
261
262
  validator: [],
262
- conditionals: [
263
+ conditionals: conditionals.concat([
263
264
  {
264
265
  action: "hide",
265
266
  expression: `$form?.verified !== "${status}"`,
266
267
  },
267
- ],
268
+ ]),
268
269
  };
269
270
  };
270
271
 
@@ -362,25 +363,32 @@ export const idReaderFields = (
362
363
  event,
363
364
  section,
364
365
  verifiedCustomFieldMapping,
366
+ conditionals,
365
367
  esignetConfig,
366
368
  ),
367
369
  ];
368
370
  }
369
371
  return [
370
372
  ...fields,
371
- ...idVerificationFields(event, section, verifiedCustomFieldMapping),
373
+ ...idVerificationFields(
374
+ event,
375
+ section,
376
+ verifiedCustomFieldMapping,
377
+ conditionals,
378
+ ),
372
379
  ];
373
380
  };
374
381
  export const idVerificationFields = (
375
382
  event: string,
376
383
  sectionId: string,
377
384
  mapping: any,
385
+ conditionals: any[] = [],
378
386
  esignetConfig?: ESignetConfig,
379
387
  ) => {
380
388
  return [
381
389
  verified(event, sectionId, mapping, esignetConfig),
382
- idVerificationBanner(event, sectionId, "verified"),
383
- idVerificationBanner(event, sectionId, "failed"),
384
- idVerificationBanner(event, sectionId, "authenticated"),
390
+ idVerificationBanner(event, sectionId, "verified", conditionals),
391
+ idVerificationBanner(event, sectionId, "failed", conditionals),
392
+ idVerificationBanner(event, sectionId, "authenticated", conditionals),
385
393
  ];
386
394
  };