@opencrvs/toolkit 1.8.1-rc.020858b → 1.8.1-rc.0377f8e

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.
@@ -8,55 +8,6 @@ export declare function validate(schema: JSONSchema, data: ConditionalParameters
8
8
  export declare function isConditionMet(conditional: JSONSchema, values: Record<string, unknown>): boolean;
9
9
  export declare function areConditionsMet(conditions: FieldConditional[], values: Record<string, unknown>): boolean;
10
10
  export declare function isFieldVisible(field: FieldConfig, form: ActionUpdate | EventState): boolean;
11
- export declare function getOnlyVisibleFormValues(field: FieldConfig[], form: EventState): Record<string, string | number | boolean | {
12
- type: string;
13
- path: string;
14
- originalFilename: string;
15
- } | {
16
- country: string;
17
- district: string;
18
- addressType: "DOMESTIC";
19
- province: string;
20
- urbanOrRural: "URBAN";
21
- number?: string | undefined;
22
- town?: string | undefined;
23
- residentialArea?: string | undefined;
24
- street?: string | undefined;
25
- zipCode?: string | undefined;
26
- } | {
27
- country: string;
28
- district: string;
29
- addressType: "DOMESTIC";
30
- province: string;
31
- urbanOrRural: "RURAL";
32
- village?: string | undefined;
33
- } | {
34
- firstname: string;
35
- surname: string;
36
- middlename?: string | undefined;
37
- } | {
38
- firstname: string;
39
- surname: string;
40
- middlename?: string | null | undefined;
41
- } | {
42
- country: string;
43
- state: string;
44
- addressType: "INTERNATIONAL";
45
- district2: string;
46
- cityOrTown?: string | undefined;
47
- addressLine1?: string | undefined;
48
- addressLine2?: string | undefined;
49
- addressLine3?: string | undefined;
50
- postcodeOrZip?: string | undefined;
51
- } | {
52
- type: string;
53
- option: string;
54
- path: string;
55
- originalFilename: string;
56
- }[] | {
57
- start: string;
58
- end: string;
59
- } | null | undefined>;
60
11
  export declare function isFieldEnabled(field: FieldConfig, form: ActionUpdate | EventState): boolean;
61
12
  export declare function isFieldDisplayedOnReview(field: FieldConfig, form: ActionUpdate | EventState): boolean;
62
13
  export declare const errorMessages: {
@@ -265,7 +265,6 @@ __export(events_exports, {
265
265
  getDeclarationPages: () => getDeclarationPages,
266
266
  getEventConfigById: () => getEventConfigById,
267
267
  getMixedPath: () => getMixedPath,
268
- getOnlyVisibleFormValues: () => getOnlyVisibleFormValues,
269
268
  getPrintCertificatePages: () => getPrintCertificatePages,
270
269
  getRandomDate: () => getRandomDate,
271
270
  getRandomDatetime: () => getRandomDatetime,
@@ -2357,14 +2356,6 @@ function isFieldConditionMet(field2, form, conditionalType) {
2357
2356
  function isFieldVisible(field2, form) {
2358
2357
  return isFieldConditionMet(field2, form, ConditionalType.SHOW);
2359
2358
  }
2360
- function getOnlyVisibleFormValues(field2, form) {
2361
- return field2.reduce((acc, f) => {
2362
- if (isFieldVisible(f, form) && form[f.id] !== void 0) {
2363
- acc[f.id] = form[f.id];
2364
- }
2365
- return acc;
2366
- }, {});
2367
- }
2368
2359
  function isFieldEmptyAndNotRequired(field2, form) {
2369
2360
  const fieldValue = form[field2.id];
2370
2361
  return !field2.required && (fieldValue === void 0 || fieldValue === "");
@@ -4373,13 +4364,13 @@ function getAssignedUserSignatureFromActions(actions) {
4373
4364
  return signature;
4374
4365
  }, null);
4375
4366
  }
4376
- function aggregateActionDeclarations(actions, config) {
4367
+ function aggregateActionDeclarations(actions) {
4377
4368
  const excludedActions = [
4378
4369
  ActionType.REQUEST_CORRECTION,
4379
4370
  ActionType.PRINT_CERTIFICATE,
4380
4371
  ActionType.REJECT_CORRECTION
4381
4372
  ];
4382
- const aggregatedDeclaration = actions.reduce((declaration, action) => {
4373
+ return actions.reduce((declaration, action) => {
4383
4374
  if (excludedActions.some((excludedAction) => excludedAction === action.type)) {
4384
4375
  return declaration;
4385
4376
  }
@@ -4392,10 +4383,6 @@ function aggregateActionDeclarations(actions, config) {
4392
4383
  }
4393
4384
  return deepMerge(declaration, action.declaration);
4394
4385
  }, {});
4395
- return getOnlyVisibleFormValues(
4396
- config.declaration.pages.flatMap((x) => x.fields),
4397
- aggregatedDeclaration
4398
- );
4399
4386
  }
4400
4387
  function deepDropNulls(obj) {
4401
4388
  if (Array.isArray(obj)) {
@@ -4441,7 +4428,7 @@ function getCurrentEventState(event2, config) {
4441
4428
  );
4442
4429
  const requestActionMetadata = getActionUpdateMetadata(event2.actions);
4443
4430
  const acceptedActionMetadata = getActionUpdateMetadata(acceptedActions);
4444
- const declaration = aggregateActionDeclarations(acceptedActions, config);
4431
+ const declaration = aggregateActionDeclarations(acceptedActions);
4445
4432
  return deepDropNulls({
4446
4433
  id: event2.id,
4447
4434
  type: event2.type,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "1.8.1-rc.020858b",
3
+ "version": "1.8.1-rc.0377f8e",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "exports": {