@opencrvs/toolkit 1.9.7 → 1.9.8-rc.0b7ee3b

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.
@@ -85,7 +85,11 @@ export declare function isPageVisible(page: PageConfig, formValues: ActionUpdate
85
85
  * @returns {Partial<T>} A new object containing only the values for visible fields
86
86
  */
87
87
  export declare function omitHiddenFields<T extends EventState | ActionUpdate>(fields: FieldConfig[], formValues: T, validatorContext: ValidatorContext): Partial<T>;
88
- export declare function omitHiddenPaginatedFields<T extends EventState | ActionUpdate>(formConfig: FormConfig, values: T, validatorContext: ValidatorContext): Partial<Partial<T>>;
88
+ export declare function omitHiddenPaginatedFields<T extends EventState | ActionUpdate>({ formConfig, values, validatorContext }: {
89
+ formConfig: FormConfig;
90
+ values: T;
91
+ validatorContext: ValidatorContext;
92
+ }): Partial<Partial<T>>;
89
93
  /**
90
94
  *
91
95
  * @returns a draft for the event that has been created since the last non-read action.
@@ -3737,7 +3737,11 @@ function omitHiddenFields(fields, formValues, validatorContext) {
3737
3737
  }
3738
3738
  return fn(base);
3739
3739
  }
3740
- function omitHiddenPaginatedFields(formConfig, values, validatorContext) {
3740
+ function omitHiddenPaginatedFields({
3741
+ formConfig,
3742
+ values,
3743
+ validatorContext
3744
+ }) {
3741
3745
  const visibleFields = formConfig.pages.filter((p) => isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
3742
3746
  const hiddenFields = formConfig.pages.filter((p) => !isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
3743
3747
  const valuesExceptHiddenPage = (0, import_lodash.omitBy)(values, (_, fieldId) => {
@@ -8355,15 +8359,15 @@ function generateActionDeclarationInput(configuration, action, rng, overrides) {
8355
8359
  const fields = getDeclarationFields(configuration);
8356
8360
  const declarationConfig = getDeclaration(configuration);
8357
8361
  const declaration = fieldConfigsToActionPayload(fields, rng);
8358
- return omitHiddenPaginatedFields(
8359
- declarationConfig,
8360
- {
8362
+ return omitHiddenPaginatedFields({
8363
+ formConfig: declarationConfig,
8364
+ values: {
8361
8365
  ...declaration,
8362
8366
  ...overrides
8363
8367
  },
8364
- {}
8368
+ validatorContext: {}
8365
8369
  // Intentionally empty. Allow generating fields with custom conditionals.
8366
- );
8370
+ });
8367
8371
  }
8368
8372
  console.warn(`${action} is not a declaration action. Setting data as {}.`);
8369
8373
  return {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "1.9.7",
3
+ "version": "1.9.8-rc.0b7ee3b",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "exports": {