@opencrvs/toolkit 2.0.0-rc.3598fb7 → 2.0.0-rc.35b1e0f

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.
@@ -111,7 +111,6 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
111
111
  conditional: z.ZodAny;
112
112
  }, z.core.$strip>], "type">>>;
113
113
  type: z.ZodLiteral<"NOTIFY">;
114
- form: z.ZodOptional<z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>>;
115
114
  }, z.core.$strip>, z.ZodObject<{
116
115
  label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
117
116
  flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -147,7 +146,6 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
147
146
  title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
148
147
  fields: z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>;
149
148
  }, z.core.$strip>;
150
- form: z.ZodOptional<z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>>;
151
149
  dialogCopy: z.ZodOptional<z.ZodObject<{
152
150
  notify: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
153
151
  declare: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
@@ -179,7 +177,6 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
179
177
  conditional: z.ZodAny;
180
178
  }, z.core.$strip>], "type">>>;
181
179
  type: z.ZodLiteral<"REJECT">;
182
- form: z.ZodOptional<z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>>;
183
180
  }, z.core.$strip>, z.ZodObject<{
184
181
  label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
185
182
  flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -211,7 +208,6 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
211
208
  query: z.ZodType<import("./DeduplicationConfig").ClauseOutput, import("./DeduplicationConfig").ClauseInput, z.core.$ZodTypeInternals<import("./DeduplicationConfig").ClauseOutput, import("./DeduplicationConfig").ClauseInput>>;
212
209
  }, z.core.$strip>>;
213
210
  type: z.ZodLiteral<"REGISTER">;
214
- form: z.ZodOptional<z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>>;
215
211
  }, z.core.$strip>, z.ZodObject<{
216
212
  label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
217
213
  flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -381,7 +377,6 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
381
377
  conditional: z.ZodAny;
382
378
  }, z.core.$strip>], "type">>>;
383
379
  type: z.ZodLiteral<"ARCHIVE">;
384
- form: z.ZodOptional<z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>>;
385
380
  }, z.core.$strip>, z.ZodObject<{
386
381
  label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
387
382
  flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -458,7 +453,6 @@ export declare const DeclarationActionConfig: z.ZodDiscriminatedUnion<[z.ZodObje
458
453
  title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
459
454
  fields: z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>;
460
455
  }, z.core.$strip>;
461
- form: z.ZodOptional<z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>>;
462
456
  dialogCopy: z.ZodOptional<z.ZodObject<{
463
457
  notify: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
464
458
  declare: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
@@ -495,7 +489,6 @@ export declare const DeclarationActionConfig: z.ZodDiscriminatedUnion<[z.ZodObje
495
489
  query: z.ZodType<import("./DeduplicationConfig").ClauseOutput, import("./DeduplicationConfig").ClauseInput, z.core.$ZodTypeInternals<import("./DeduplicationConfig").ClauseOutput, import("./DeduplicationConfig").ClauseInput>>;
496
490
  }, z.core.$strip>>;
497
491
  type: z.ZodLiteral<"REGISTER">;
498
- form: z.ZodOptional<z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>>;
499
492
  }, z.core.$strip>], "type">;
500
493
  export type DeclarationActionConfig = z.infer<typeof DeclarationActionConfig>;
501
494
  export {};
@@ -50,14 +50,6 @@ export declare function getActionConfig({ eventConfiguration, actionType, custom
50
50
  customActionType?: string;
51
51
  }): ActionConfig | undefined;
52
52
  export declare function getCustomActionFields(eventConfiguration: EventConfig, customActionType: string): FieldConfig[];
53
- /**
54
- * Returns the fields configured for an action's confirmation dialog.
55
- *
56
- * Unlike review fields and supporting copy, NOTIFY does NOT fall back to the
57
- * DECLARE config here: dialog fields always come from the action's own
58
- * configuration entry.
59
- */
60
- export declare function getActionFormFields(eventConfiguration: EventConfig, actionType: ActionType, customActionType?: string): FieldConfig[];
61
53
  export declare function getPrintCertificatePages(configuration: EventConfig): ({
62
54
  id: string;
63
55
  title: {
@@ -312,7 +312,6 @@ __export(events_exports, {
312
312
  getActionAnnotation: () => getActionAnnotation,
313
313
  getActionAnnotationFields: () => getActionAnnotationFields,
314
314
  getActionConfig: () => getActionConfig,
315
- getActionFormFields: () => getActionFormFields,
316
315
  getActionReview: () => getActionReview,
317
316
  getActionReviewFields: () => getActionReviewFields,
318
317
  getAdministrativeAreaHierarchy: () => getAdministrativeAreaHierarchy,
@@ -3225,9 +3224,6 @@ var ActionConfigBase = z24.object({
3225
3224
  var DeclarationActionBase = ActionConfigBase.extend({
3226
3225
  deduplication: DeduplicationConfig.optional()
3227
3226
  });
3228
- var actionConfirmationForm = z24.array(FieldConfig).optional().describe(
3229
- "Fields rendered on the action confirmation dialog. Submitted values are stored in the action annotation and shown in the audit history."
3230
- );
3231
3227
  var ReadActionConfig = ActionConfigBase.extend(
3232
3228
  z24.object({
3233
3229
  type: z24.literal(ActionType.READ),
@@ -3239,8 +3235,7 @@ var ReadActionConfig = ActionConfigBase.extend(
3239
3235
  );
3240
3236
  var NotifyConfig = ActionConfigBase.extend(
3241
3237
  z24.object({
3242
- type: z24.literal(ActionType.NOTIFY),
3243
- form: actionConfirmationForm
3238
+ type: z24.literal(ActionType.NOTIFY)
3244
3239
  }).shape
3245
3240
  );
3246
3241
  var DeclareConfig = DeclarationActionBase.extend(
@@ -3249,7 +3244,6 @@ var DeclareConfig = DeclarationActionBase.extend(
3249
3244
  review: DeclarationReviewConfig.describe(
3250
3245
  "Configuration of the review page fields."
3251
3246
  ),
3252
- form: actionConfirmationForm,
3253
3247
  dialogCopy: z24.object({
3254
3248
  notify: TranslationConfig.describe(
3255
3249
  "Confirmation text for the notify action"
@@ -3265,8 +3259,7 @@ var DeclareConfig = DeclarationActionBase.extend(
3265
3259
  );
3266
3260
  var ArchiveConfig = ActionConfigBase.extend(
3267
3261
  z24.object({
3268
- type: z24.literal(ActionType.ARCHIVE),
3269
- form: actionConfirmationForm
3262
+ type: z24.literal(ActionType.ARCHIVE)
3270
3263
  }).shape
3271
3264
  );
3272
3265
  var EditActionConfig = ActionConfigBase.extend(
@@ -3287,14 +3280,12 @@ var EditActionConfig = ActionConfigBase.extend(
3287
3280
  );
3288
3281
  var RejectConfig = ActionConfigBase.extend(
3289
3282
  z24.object({
3290
- type: z24.literal(ActionType.REJECT),
3291
- form: actionConfirmationForm
3283
+ type: z24.literal(ActionType.REJECT)
3292
3284
  }).shape
3293
3285
  );
3294
3286
  var RegisterConfig = DeclarationActionBase.extend(
3295
3287
  z24.object({
3296
- type: z24.literal(ActionType.REGISTER),
3297
- form: actionConfirmationForm
3288
+ type: z24.literal(ActionType.REGISTER)
3298
3289
  }).shape
3299
3290
  );
3300
3291
  var PrintCertificateActionConfig = ActionConfigBase.extend(
@@ -4525,19 +4516,7 @@ function getCustomActionFields(eventConfiguration, customActionType) {
4525
4516
  customActionType,
4526
4517
  actionType: ActionType.CUSTOM
4527
4518
  });
4528
- if (!actionConfig || actionConfig.type !== ActionType.CUSTOM) {
4529
- return [];
4530
- }
4531
- return actionConfig.form;
4532
- }
4533
- function getActionFormFields(eventConfiguration, actionType, customActionType) {
4534
- const actionConfig = eventConfiguration.actions.find((a) => {
4535
- if (a.type === ActionType.CUSTOM && customActionType) {
4536
- return a.customActionType === customActionType;
4537
- }
4538
- return a.type === actionType;
4539
- });
4540
- if (!actionConfig || !("form" in actionConfig) || actionConfig.form == null) {
4519
+ if (!actionConfig || !("form" in actionConfig)) {
4541
4520
  return [];
4542
4521
  }
4543
4522
  return actionConfig.form;
@@ -4558,9 +4537,13 @@ var getActionAnnotationFields = (actionConfig) => {
4558
4537
  if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
4559
4538
  return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
4560
4539
  }
4561
- const reviewFields = "review" in actionConfig && actionConfig.review != null ? actionConfig.review.fields : [];
4562
- const formFields = "form" in actionConfig && actionConfig.form != null ? actionConfig.form : [];
4563
- return [...reviewFields, ...formFields];
4540
+ if (actionConfig.type === ActionType.CUSTOM) {
4541
+ return actionConfig.form;
4542
+ }
4543
+ if ("review" in actionConfig && actionConfig.review != null) {
4544
+ return actionConfig.review.fields;
4545
+ }
4546
+ return [];
4564
4547
  };
4565
4548
  function getAllAnnotationFields(config) {
4566
4549
  return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
@@ -2681,9 +2681,6 @@ var ActionConfigBase = z24.object({
2681
2681
  var DeclarationActionBase = ActionConfigBase.extend({
2682
2682
  deduplication: DeduplicationConfig.optional()
2683
2683
  });
2684
- var actionConfirmationForm = z24.array(FieldConfig).optional().describe(
2685
- "Fields rendered on the action confirmation dialog. Submitted values are stored in the action annotation and shown in the audit history."
2686
- );
2687
2684
  var ReadActionConfig = ActionConfigBase.extend(
2688
2685
  z24.object({
2689
2686
  type: z24.literal(ActionType.READ),
@@ -2695,8 +2692,7 @@ var ReadActionConfig = ActionConfigBase.extend(
2695
2692
  );
2696
2693
  var NotifyConfig = ActionConfigBase.extend(
2697
2694
  z24.object({
2698
- type: z24.literal(ActionType.NOTIFY),
2699
- form: actionConfirmationForm
2695
+ type: z24.literal(ActionType.NOTIFY)
2700
2696
  }).shape
2701
2697
  );
2702
2698
  var DeclareConfig = DeclarationActionBase.extend(
@@ -2705,7 +2701,6 @@ var DeclareConfig = DeclarationActionBase.extend(
2705
2701
  review: DeclarationReviewConfig.describe(
2706
2702
  "Configuration of the review page fields."
2707
2703
  ),
2708
- form: actionConfirmationForm,
2709
2704
  dialogCopy: z24.object({
2710
2705
  notify: TranslationConfig.describe(
2711
2706
  "Confirmation text for the notify action"
@@ -2721,8 +2716,7 @@ var DeclareConfig = DeclarationActionBase.extend(
2721
2716
  );
2722
2717
  var ArchiveConfig = ActionConfigBase.extend(
2723
2718
  z24.object({
2724
- type: z24.literal(ActionType.ARCHIVE),
2725
- form: actionConfirmationForm
2719
+ type: z24.literal(ActionType.ARCHIVE)
2726
2720
  }).shape
2727
2721
  );
2728
2722
  var EditActionConfig = ActionConfigBase.extend(
@@ -2743,14 +2737,12 @@ var EditActionConfig = ActionConfigBase.extend(
2743
2737
  );
2744
2738
  var RejectConfig = ActionConfigBase.extend(
2745
2739
  z24.object({
2746
- type: z24.literal(ActionType.REJECT),
2747
- form: actionConfirmationForm
2740
+ type: z24.literal(ActionType.REJECT)
2748
2741
  }).shape
2749
2742
  );
2750
2743
  var RegisterConfig = DeclarationActionBase.extend(
2751
2744
  z24.object({
2752
- type: z24.literal(ActionType.REGISTER),
2753
- form: actionConfirmationForm
2745
+ type: z24.literal(ActionType.REGISTER)
2754
2746
  }).shape
2755
2747
  );
2756
2748
  var PrintCertificateActionConfig = ActionConfigBase.extend(
@@ -3224,9 +3216,13 @@ var getActionAnnotationFields = (actionConfig) => {
3224
3216
  if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
3225
3217
  return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
3226
3218
  }
3227
- const reviewFields = "review" in actionConfig && actionConfig.review != null ? actionConfig.review.fields : [];
3228
- const formFields = "form" in actionConfig && actionConfig.form != null ? actionConfig.form : [];
3229
- return [...reviewFields, ...formFields];
3219
+ if (actionConfig.type === ActionType.CUSTOM) {
3220
+ return actionConfig.form;
3221
+ }
3222
+ if ("review" in actionConfig && actionConfig.review != null) {
3223
+ return actionConfig.review.fields;
3224
+ }
3225
+ return [];
3230
3226
  };
3231
3227
  function getAllAnnotationFields(config) {
3232
3228
  return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "2.0.0-rc.3598fb7",
3
+ "version": "2.0.0-rc.35b1e0f",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "bin": {