@opencrvs/toolkit 2.0.0-rc.63d8130 → 2.0.0-rc.6427e1a

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,6 +85,58 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
85
85
  fields: z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>;
86
86
  }, z.core.$strip>;
87
87
  conditionals: z.ZodOptional<z.ZodNever>;
88
+ }, z.core.$strip>, z.ZodObject<{
89
+ label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
90
+ supportingCopy: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>>;
91
+ icon: z.ZodOptional<z.ZodString>;
92
+ conditionals: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
93
+ type: z.ZodLiteral<"SHOW">;
94
+ conditional: z.ZodAny;
95
+ }, z.core.$strip>, z.ZodObject<{
96
+ type: z.ZodLiteral<"ENABLE">;
97
+ conditional: z.ZodAny;
98
+ }, z.core.$strip>], "type">>>;
99
+ type: z.ZodLiteral<"ASSIGN">;
100
+ flags: z.ZodOptional<z.ZodNever>;
101
+ }, z.core.$strip>, z.ZodObject<{
102
+ label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
103
+ supportingCopy: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>>;
104
+ icon: z.ZodOptional<z.ZodString>;
105
+ conditionals: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
106
+ type: z.ZodLiteral<"SHOW">;
107
+ conditional: z.ZodAny;
108
+ }, z.core.$strip>, z.ZodObject<{
109
+ type: z.ZodLiteral<"ENABLE">;
110
+ conditional: z.ZodAny;
111
+ }, z.core.$strip>], "type">>>;
112
+ type: z.ZodLiteral<"UNASSIGN">;
113
+ flags: z.ZodOptional<z.ZodNever>;
114
+ }, z.core.$strip>, z.ZodObject<{
115
+ label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
116
+ flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
117
+ id: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
118
+ readonly INCOMPLETE: "incomplete";
119
+ readonly REJECTED: "rejected";
120
+ readonly CORRECTION_REQUESTED: "correction-requested";
121
+ readonly POTENTIAL_DUPLICATE: "potential-duplicate";
122
+ readonly EDIT_IN_PROGRESS: "edit-in-progress";
123
+ }>]>, z.ZodString]>;
124
+ operation: z.ZodEnum<{
125
+ add: "add";
126
+ remove: "remove";
127
+ }>;
128
+ conditional: z.ZodOptional<z.ZodAny>;
129
+ }, z.core.$strip>>>>;
130
+ supportingCopy: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>>;
131
+ icon: z.ZodOptional<z.ZodString>;
132
+ conditionals: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
133
+ type: z.ZodLiteral<"SHOW">;
134
+ conditional: z.ZodAny;
135
+ }, z.core.$strip>, z.ZodObject<{
136
+ type: z.ZodLiteral<"ENABLE">;
137
+ conditional: z.ZodAny;
138
+ }, z.core.$strip>], "type">>>;
139
+ type: z.ZodLiteral<"DELETE">;
88
140
  }, z.core.$strip>, z.ZodObject<{
89
141
  label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
90
142
  flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -111,7 +163,6 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
111
163
  conditional: z.ZodAny;
112
164
  }, z.core.$strip>], "type">>>;
113
165
  type: z.ZodLiteral<"NOTIFY">;
114
- form: z.ZodOptional<z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>>;
115
166
  }, z.core.$strip>, z.ZodObject<{
116
167
  label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
117
168
  flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -147,12 +198,83 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
147
198
  title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
148
199
  fields: z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>;
149
200
  }, z.core.$strip>;
150
- form: z.ZodOptional<z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>>;
151
201
  dialogCopy: z.ZodOptional<z.ZodObject<{
152
202
  notify: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
153
203
  declare: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
154
204
  register: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
155
205
  }, z.core.$strip>>;
206
+ }, z.core.$strip>, z.ZodObject<{
207
+ flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
208
+ id: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
209
+ readonly INCOMPLETE: "incomplete";
210
+ readonly REJECTED: "rejected";
211
+ readonly CORRECTION_REQUESTED: "correction-requested";
212
+ readonly POTENTIAL_DUPLICATE: "potential-duplicate";
213
+ readonly EDIT_IN_PROGRESS: "edit-in-progress";
214
+ }>]>, z.ZodString]>;
215
+ operation: z.ZodEnum<{
216
+ add: "add";
217
+ remove: "remove";
218
+ }>;
219
+ conditional: z.ZodOptional<z.ZodAny>;
220
+ }, z.core.$strip>>>>;
221
+ type: z.ZodLiteral<"DUPLICATE_DETECTED">;
222
+ label: z.ZodOptional<z.ZodNever>;
223
+ supportingCopy: z.ZodOptional<z.ZodNever>;
224
+ icon: z.ZodOptional<z.ZodNever>;
225
+ conditionals: z.ZodOptional<z.ZodNever>;
226
+ }, z.core.$strip>, z.ZodObject<{
227
+ label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
228
+ flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
229
+ id: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
230
+ readonly INCOMPLETE: "incomplete";
231
+ readonly REJECTED: "rejected";
232
+ readonly CORRECTION_REQUESTED: "correction-requested";
233
+ readonly POTENTIAL_DUPLICATE: "potential-duplicate";
234
+ readonly EDIT_IN_PROGRESS: "edit-in-progress";
235
+ }>]>, z.ZodString]>;
236
+ operation: z.ZodEnum<{
237
+ add: "add";
238
+ remove: "remove";
239
+ }>;
240
+ conditional: z.ZodOptional<z.ZodAny>;
241
+ }, z.core.$strip>>>>;
242
+ supportingCopy: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>>;
243
+ icon: z.ZodOptional<z.ZodString>;
244
+ conditionals: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
245
+ type: z.ZodLiteral<"SHOW">;
246
+ conditional: z.ZodAny;
247
+ }, z.core.$strip>, z.ZodObject<{
248
+ type: z.ZodLiteral<"ENABLE">;
249
+ conditional: z.ZodAny;
250
+ }, z.core.$strip>], "type">>>;
251
+ type: z.ZodLiteral<"MARK_AS_DUPLICATE">;
252
+ }, z.core.$strip>, z.ZodObject<{
253
+ label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
254
+ flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
255
+ id: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
256
+ readonly INCOMPLETE: "incomplete";
257
+ readonly REJECTED: "rejected";
258
+ readonly CORRECTION_REQUESTED: "correction-requested";
259
+ readonly POTENTIAL_DUPLICATE: "potential-duplicate";
260
+ readonly EDIT_IN_PROGRESS: "edit-in-progress";
261
+ }>]>, z.ZodString]>;
262
+ operation: z.ZodEnum<{
263
+ add: "add";
264
+ remove: "remove";
265
+ }>;
266
+ conditional: z.ZodOptional<z.ZodAny>;
267
+ }, z.core.$strip>>>>;
268
+ supportingCopy: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>>;
269
+ icon: z.ZodOptional<z.ZodString>;
270
+ conditionals: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
271
+ type: z.ZodLiteral<"SHOW">;
272
+ conditional: z.ZodAny;
273
+ }, z.core.$strip>, z.ZodObject<{
274
+ type: z.ZodLiteral<"ENABLE">;
275
+ conditional: z.ZodAny;
276
+ }, z.core.$strip>], "type">>>;
277
+ type: z.ZodLiteral<"MARK_AS_NOT_DUPLICATE">;
156
278
  }, z.core.$strip>, z.ZodObject<{
157
279
  label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
158
280
  flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -179,7 +301,6 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
179
301
  conditional: z.ZodAny;
180
302
  }, z.core.$strip>], "type">>>;
181
303
  type: z.ZodLiteral<"REJECT">;
182
- form: z.ZodOptional<z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>>;
183
304
  }, z.core.$strip>, z.ZodObject<{
184
305
  label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
185
306
  flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -211,7 +332,6 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
211
332
  query: z.ZodType<import("./DeduplicationConfig").ClauseOutput, import("./DeduplicationConfig").ClauseInput, z.core.$ZodTypeInternals<import("./DeduplicationConfig").ClauseOutput, import("./DeduplicationConfig").ClauseInput>>;
212
333
  }, z.core.$strip>>;
213
334
  type: z.ZodLiteral<"REGISTER">;
214
- form: z.ZodOptional<z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>>;
215
335
  }, z.core.$strip>, z.ZodObject<{
216
336
  label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
217
337
  flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -324,6 +444,58 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
324
444
  }, z.core.$strip>;
325
445
  }, z.core.$strip>], "type">>;
326
446
  }, z.core.$strip>;
447
+ }, z.core.$strip>, z.ZodObject<{
448
+ label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
449
+ flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
450
+ id: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
451
+ readonly INCOMPLETE: "incomplete";
452
+ readonly REJECTED: "rejected";
453
+ readonly CORRECTION_REQUESTED: "correction-requested";
454
+ readonly POTENTIAL_DUPLICATE: "potential-duplicate";
455
+ readonly EDIT_IN_PROGRESS: "edit-in-progress";
456
+ }>]>, z.ZodString]>;
457
+ operation: z.ZodEnum<{
458
+ add: "add";
459
+ remove: "remove";
460
+ }>;
461
+ conditional: z.ZodOptional<z.ZodAny>;
462
+ }, z.core.$strip>>>>;
463
+ supportingCopy: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>>;
464
+ icon: z.ZodOptional<z.ZodString>;
465
+ conditionals: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
466
+ type: z.ZodLiteral<"SHOW">;
467
+ conditional: z.ZodAny;
468
+ }, z.core.$strip>, z.ZodObject<{
469
+ type: z.ZodLiteral<"ENABLE">;
470
+ conditional: z.ZodAny;
471
+ }, z.core.$strip>], "type">>>;
472
+ type: z.ZodLiteral<"APPROVE_CORRECTION">;
473
+ }, z.core.$strip>, z.ZodObject<{
474
+ label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
475
+ flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
476
+ id: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
477
+ readonly INCOMPLETE: "incomplete";
478
+ readonly REJECTED: "rejected";
479
+ readonly CORRECTION_REQUESTED: "correction-requested";
480
+ readonly POTENTIAL_DUPLICATE: "potential-duplicate";
481
+ readonly EDIT_IN_PROGRESS: "edit-in-progress";
482
+ }>]>, z.ZodString]>;
483
+ operation: z.ZodEnum<{
484
+ add: "add";
485
+ remove: "remove";
486
+ }>;
487
+ conditional: z.ZodOptional<z.ZodAny>;
488
+ }, z.core.$strip>>>>;
489
+ supportingCopy: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>>;
490
+ icon: z.ZodOptional<z.ZodString>;
491
+ conditionals: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
492
+ type: z.ZodLiteral<"SHOW">;
493
+ conditional: z.ZodAny;
494
+ }, z.core.$strip>, z.ZodObject<{
495
+ type: z.ZodLiteral<"ENABLE">;
496
+ conditional: z.ZodAny;
497
+ }, z.core.$strip>], "type">>>;
498
+ type: z.ZodLiteral<"REJECT_CORRECTION">;
327
499
  }, z.core.$strip>, z.ZodObject<{
328
500
  label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
329
501
  flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -381,7 +553,6 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
381
553
  conditional: z.ZodAny;
382
554
  }, z.core.$strip>], "type">>>;
383
555
  type: z.ZodLiteral<"ARCHIVE">;
384
- form: z.ZodOptional<z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>>;
385
556
  }, z.core.$strip>, z.ZodObject<{
386
557
  label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
387
558
  flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -458,7 +629,6 @@ export declare const DeclarationActionConfig: z.ZodDiscriminatedUnion<[z.ZodObje
458
629
  title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
459
630
  fields: z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>;
460
631
  }, z.core.$strip>;
461
- form: z.ZodOptional<z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>>;
462
632
  dialogCopy: z.ZodOptional<z.ZodObject<{
463
633
  notify: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
464
634
  declare: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
@@ -495,7 +665,6 @@ export declare const DeclarationActionConfig: z.ZodDiscriminatedUnion<[z.ZodObje
495
665
  query: z.ZodType<import("./DeduplicationConfig").ClauseOutput, import("./DeduplicationConfig").ClauseInput, z.core.$ZodTypeInternals<import("./DeduplicationConfig").ClauseOutput, import("./DeduplicationConfig").ClauseInput>>;
496
666
  }, z.core.$strip>>;
497
667
  type: z.ZodLiteral<"REGISTER">;
498
- form: z.ZodOptional<z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>>;
499
668
  }, z.core.$strip>], "type">;
500
669
  export type DeclarationActionConfig = z.infer<typeof DeclarationActionConfig>;
501
670
  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,53 @@ 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)
3239
+ }).shape
3240
+ );
3241
+ var DuplicateDetectedConfig = ActionConfigBase.extend(
3242
+ z24.object({
3243
+ type: z24.literal(ActionType.DUPLICATE_DETECTED),
3244
+ label: z24.never().optional().describe(
3245
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no label."
3246
+ ),
3247
+ supportingCopy: z24.never().optional(),
3248
+ icon: z24.never().optional().describe(
3249
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no icon."
3250
+ ),
3251
+ conditionals: z24.never().optional().describe(
3252
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it cannot be disabled or hidden with conditionals."
3253
+ )
3254
+ }).shape
3255
+ );
3256
+ var MarkAsDuplicateConfig = ActionConfigBase.extend(
3257
+ z24.object({
3258
+ type: z24.literal(ActionType.MARK_AS_DUPLICATE)
3259
+ }).shape
3260
+ );
3261
+ var MarkAsNotDuplicateConfig = ActionConfigBase.extend(
3262
+ z24.object({
3263
+ type: z24.literal(ActionType.MARK_AS_NOT_DUPLICATE)
3264
+ }).shape
3265
+ );
3266
+ var AssignConfig = ActionConfigBase.extend(
3267
+ z24.object({
3268
+ type: z24.literal(ActionType.ASSIGN),
3269
+ flags: z24.never().optional().describe(
3270
+ "ASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
3271
+ )
3272
+ }).shape
3273
+ );
3274
+ var UnassignConfig = ActionConfigBase.extend(
3275
+ z24.object({
3276
+ type: z24.literal(ActionType.UNASSIGN),
3277
+ flags: z24.never().optional().describe(
3278
+ "UNASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
3279
+ )
3280
+ }).shape
3281
+ );
3282
+ var DeleteConfig = ActionConfigBase.extend(
3283
+ z24.object({
3284
+ type: z24.literal(ActionType.DELETE)
3244
3285
  }).shape
3245
3286
  );
3246
3287
  var DeclareConfig = DeclarationActionBase.extend(
@@ -3249,7 +3290,6 @@ var DeclareConfig = DeclarationActionBase.extend(
3249
3290
  review: DeclarationReviewConfig.describe(
3250
3291
  "Configuration of the review page fields."
3251
3292
  ),
3252
- form: actionConfirmationForm,
3253
3293
  dialogCopy: z24.object({
3254
3294
  notify: TranslationConfig.describe(
3255
3295
  "Confirmation text for the notify action"
@@ -3265,8 +3305,7 @@ var DeclareConfig = DeclarationActionBase.extend(
3265
3305
  );
3266
3306
  var ArchiveConfig = ActionConfigBase.extend(
3267
3307
  z24.object({
3268
- type: z24.literal(ActionType.ARCHIVE),
3269
- form: actionConfirmationForm
3308
+ type: z24.literal(ActionType.ARCHIVE)
3270
3309
  }).shape
3271
3310
  );
3272
3311
  var EditActionConfig = ActionConfigBase.extend(
@@ -3287,14 +3326,12 @@ var EditActionConfig = ActionConfigBase.extend(
3287
3326
  );
3288
3327
  var RejectConfig = ActionConfigBase.extend(
3289
3328
  z24.object({
3290
- type: z24.literal(ActionType.REJECT),
3291
- form: actionConfirmationForm
3329
+ type: z24.literal(ActionType.REJECT)
3292
3330
  }).shape
3293
3331
  );
3294
3332
  var RegisterConfig = DeclarationActionBase.extend(
3295
3333
  z24.object({
3296
- type: z24.literal(ActionType.REGISTER),
3297
- form: actionConfirmationForm
3334
+ type: z24.literal(ActionType.REGISTER)
3298
3335
  }).shape
3299
3336
  );
3300
3337
  var PrintCertificateActionConfig = ActionConfigBase.extend(
@@ -3309,7 +3346,17 @@ var RequestCorrectionConfig = ActionConfigBase.extend(
3309
3346
  correctionForm: ActionFormConfig
3310
3347
  }).shape
3311
3348
  );
3312
- var CustomActionConfig = ActionConfigBase.merge(
3349
+ var ApproveCorrectionConfig = ActionConfigBase.extend(
3350
+ z24.object({
3351
+ type: z24.literal(ActionType.APPROVE_CORRECTION)
3352
+ }).shape
3353
+ );
3354
+ var RejectCorrectionConfig = ActionConfigBase.extend(
3355
+ z24.object({
3356
+ type: z24.literal(ActionType.REJECT_CORRECTION)
3357
+ }).shape
3358
+ );
3359
+ var CustomActionConfig = ActionConfigBase.extend(
3313
3360
  z24.object({
3314
3361
  type: z24.literal(ActionType.CUSTOM),
3315
3362
  customActionType: z24.string().describe("Type identifier of the custom action."),
@@ -3320,7 +3367,7 @@ var CustomActionConfig = ActionConfigBase.merge(
3320
3367
  auditHistoryLabel: TranslationConfig.describe(
3321
3368
  'The label to show in audit history for this action. For example "Approved".'
3322
3369
  )
3323
- })
3370
+ }).shape
3324
3371
  );
3325
3372
  var ActionConfig = z24.discriminatedUnion("type", [
3326
3373
  /*
@@ -3331,6 +3378,18 @@ var ActionConfig = z24.discriminatedUnion("type", [
3331
3378
  id: "ReadActionConfig",
3332
3379
  description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
3333
3380
  }),
3381
+ AssignConfig.meta({
3382
+ id: "AssignActionConfig",
3383
+ description: "Configuration for assigning a record to the current user."
3384
+ }),
3385
+ UnassignConfig.meta({
3386
+ id: "UnassignActionConfig",
3387
+ description: "Configuration for unassigning a record from its current assignee."
3388
+ }),
3389
+ DeleteConfig.meta({
3390
+ id: "DeleteActionConfig",
3391
+ description: "Configuration for deleting a draft record."
3392
+ }),
3334
3393
  NotifyConfig.meta({
3335
3394
  id: "NotifyActionConfig",
3336
3395
  description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
@@ -3339,6 +3398,18 @@ var ActionConfig = z24.discriminatedUnion("type", [
3339
3398
  id: "DeclareActionConfig",
3340
3399
  description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
3341
3400
  }),
3401
+ DuplicateDetectedConfig.meta({
3402
+ id: "DuplicateDetectedActionConfig",
3403
+ description: "Configuration for the system-generated duplicate-detection action. Never shown as a button, so it only supports flags \u2014 not label, icon, or conditionals."
3404
+ }),
3405
+ MarkAsDuplicateConfig.meta({
3406
+ id: "MarkAsDuplicateActionConfig",
3407
+ description: "Configuration for marking a record as a duplicate."
3408
+ }),
3409
+ MarkAsNotDuplicateConfig.meta({
3410
+ id: "MarkAsNotDuplicateActionConfig",
3411
+ description: "Configuration for marking a record as not a duplicate, after it was previously flagged as one."
3412
+ }),
3342
3413
  RejectConfig.meta({
3343
3414
  id: "RejectActionConfig",
3344
3415
  description: "Configuration for rejecting a record before registration."
@@ -3355,6 +3426,14 @@ var ActionConfig = z24.discriminatedUnion("type", [
3355
3426
  id: "RequestCorrectionActionConfig",
3356
3427
  description: "Configuration for requesting a correction on a registered record."
3357
3428
  }),
3429
+ ApproveCorrectionConfig.meta({
3430
+ id: "ApproveCorrectionActionConfig",
3431
+ description: "Configuration for approving a requested correction."
3432
+ }),
3433
+ RejectCorrectionConfig.meta({
3434
+ id: "RejectCorrectionActionConfig",
3435
+ description: "Configuration for rejecting a requested correction."
3436
+ }),
3358
3437
  EditActionConfig.meta({
3359
3438
  id: "EditActionConfig",
3360
3439
  description: "Configuration for editing a record before registration."
@@ -4513,9 +4592,6 @@ function getActionConfig({
4513
4592
  if (a.type === ActionType.CUSTOM && customActionType) {
4514
4593
  return a.customActionType === customActionType;
4515
4594
  }
4516
- if (actionType === ActionType.APPROVE_CORRECTION || actionType === ActionType.REJECT_CORRECTION) {
4517
- return a.type === ActionType.REQUEST_CORRECTION;
4518
- }
4519
4595
  return a.type === actionType;
4520
4596
  });
4521
4597
  }
@@ -4525,19 +4601,7 @@ function getCustomActionFields(eventConfiguration, customActionType) {
4525
4601
  customActionType,
4526
4602
  actionType: ActionType.CUSTOM
4527
4603
  });
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) {
4604
+ if (!actionConfig || !("form" in actionConfig)) {
4541
4605
  return [];
4542
4606
  }
4543
4607
  return actionConfig.form;
@@ -4558,9 +4622,13 @@ var getActionAnnotationFields = (actionConfig) => {
4558
4622
  if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
4559
4623
  return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
4560
4624
  }
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];
4625
+ if (actionConfig.type === ActionType.CUSTOM) {
4626
+ return actionConfig.form;
4627
+ }
4628
+ if ("review" in actionConfig && actionConfig.review != null) {
4629
+ return actionConfig.review.fields;
4630
+ }
4631
+ return [];
4564
4632
  };
4565
4633
  function getAllAnnotationFields(config) {
4566
4634
  return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
@@ -5677,7 +5745,7 @@ function validateActionFlags(event2, ctx) {
5677
5745
  const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
5678
5746
  const configuredFlagIds = event2.flags.map((flag2) => flag2.id);
5679
5747
  const actionFlagIds = event2.actions.flatMap(
5680
- (action) => action.flags.map((flag2) => flag2.id)
5748
+ (action) => (action.flags ?? []).map((flag2) => flag2.id)
5681
5749
  );
5682
5750
  for (const actionFlagId of actionFlagIds) {
5683
5751
  const isConfigured = configuredFlagIds.includes(actionFlagId);
@@ -6720,7 +6788,7 @@ function resolveEventCustomFlags(event2, eventConfiguration) {
6720
6788
  const declaration = aggregateActionDeclarations(eventUpToThisAction);
6721
6789
  const annotation = aggregateActionAnnotations(eventUpToThisAction);
6722
6790
  const form = { ...declaration, ...annotation };
6723
- const flagsWithMetConditions = actionConfig.flags.filter(
6791
+ const flagsWithMetConditions = (actionConfig.flags ?? []).filter(
6724
6792
  ({ conditional }) => (
6725
6793
  // If conditional is not provided, the flag is resolved
6726
6794
  conditional ? isFlagConditionMet(conditional, form, action) : true
@@ -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,53 @@ 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)
2696
+ }).shape
2697
+ );
2698
+ var DuplicateDetectedConfig = ActionConfigBase.extend(
2699
+ z24.object({
2700
+ type: z24.literal(ActionType.DUPLICATE_DETECTED),
2701
+ label: z24.never().optional().describe(
2702
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no label."
2703
+ ),
2704
+ supportingCopy: z24.never().optional(),
2705
+ icon: z24.never().optional().describe(
2706
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no icon."
2707
+ ),
2708
+ conditionals: z24.never().optional().describe(
2709
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it cannot be disabled or hidden with conditionals."
2710
+ )
2711
+ }).shape
2712
+ );
2713
+ var MarkAsDuplicateConfig = ActionConfigBase.extend(
2714
+ z24.object({
2715
+ type: z24.literal(ActionType.MARK_AS_DUPLICATE)
2716
+ }).shape
2717
+ );
2718
+ var MarkAsNotDuplicateConfig = ActionConfigBase.extend(
2719
+ z24.object({
2720
+ type: z24.literal(ActionType.MARK_AS_NOT_DUPLICATE)
2721
+ }).shape
2722
+ );
2723
+ var AssignConfig = ActionConfigBase.extend(
2724
+ z24.object({
2725
+ type: z24.literal(ActionType.ASSIGN),
2726
+ flags: z24.never().optional().describe(
2727
+ "ASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
2728
+ )
2729
+ }).shape
2730
+ );
2731
+ var UnassignConfig = ActionConfigBase.extend(
2732
+ z24.object({
2733
+ type: z24.literal(ActionType.UNASSIGN),
2734
+ flags: z24.never().optional().describe(
2735
+ "UNASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
2736
+ )
2737
+ }).shape
2738
+ );
2739
+ var DeleteConfig = ActionConfigBase.extend(
2740
+ z24.object({
2741
+ type: z24.literal(ActionType.DELETE)
2700
2742
  }).shape
2701
2743
  );
2702
2744
  var DeclareConfig = DeclarationActionBase.extend(
@@ -2705,7 +2747,6 @@ var DeclareConfig = DeclarationActionBase.extend(
2705
2747
  review: DeclarationReviewConfig.describe(
2706
2748
  "Configuration of the review page fields."
2707
2749
  ),
2708
- form: actionConfirmationForm,
2709
2750
  dialogCopy: z24.object({
2710
2751
  notify: TranslationConfig.describe(
2711
2752
  "Confirmation text for the notify action"
@@ -2721,8 +2762,7 @@ var DeclareConfig = DeclarationActionBase.extend(
2721
2762
  );
2722
2763
  var ArchiveConfig = ActionConfigBase.extend(
2723
2764
  z24.object({
2724
- type: z24.literal(ActionType.ARCHIVE),
2725
- form: actionConfirmationForm
2765
+ type: z24.literal(ActionType.ARCHIVE)
2726
2766
  }).shape
2727
2767
  );
2728
2768
  var EditActionConfig = ActionConfigBase.extend(
@@ -2743,14 +2783,12 @@ var EditActionConfig = ActionConfigBase.extend(
2743
2783
  );
2744
2784
  var RejectConfig = ActionConfigBase.extend(
2745
2785
  z24.object({
2746
- type: z24.literal(ActionType.REJECT),
2747
- form: actionConfirmationForm
2786
+ type: z24.literal(ActionType.REJECT)
2748
2787
  }).shape
2749
2788
  );
2750
2789
  var RegisterConfig = DeclarationActionBase.extend(
2751
2790
  z24.object({
2752
- type: z24.literal(ActionType.REGISTER),
2753
- form: actionConfirmationForm
2791
+ type: z24.literal(ActionType.REGISTER)
2754
2792
  }).shape
2755
2793
  );
2756
2794
  var PrintCertificateActionConfig = ActionConfigBase.extend(
@@ -2765,7 +2803,17 @@ var RequestCorrectionConfig = ActionConfigBase.extend(
2765
2803
  correctionForm: ActionFormConfig
2766
2804
  }).shape
2767
2805
  );
2768
- var CustomActionConfig = ActionConfigBase.merge(
2806
+ var ApproveCorrectionConfig = ActionConfigBase.extend(
2807
+ z24.object({
2808
+ type: z24.literal(ActionType.APPROVE_CORRECTION)
2809
+ }).shape
2810
+ );
2811
+ var RejectCorrectionConfig = ActionConfigBase.extend(
2812
+ z24.object({
2813
+ type: z24.literal(ActionType.REJECT_CORRECTION)
2814
+ }).shape
2815
+ );
2816
+ var CustomActionConfig = ActionConfigBase.extend(
2769
2817
  z24.object({
2770
2818
  type: z24.literal(ActionType.CUSTOM),
2771
2819
  customActionType: z24.string().describe("Type identifier of the custom action."),
@@ -2776,7 +2824,7 @@ var CustomActionConfig = ActionConfigBase.merge(
2776
2824
  auditHistoryLabel: TranslationConfig.describe(
2777
2825
  'The label to show in audit history for this action. For example "Approved".'
2778
2826
  )
2779
- })
2827
+ }).shape
2780
2828
  );
2781
2829
  var ActionConfig = z24.discriminatedUnion("type", [
2782
2830
  /*
@@ -2787,6 +2835,18 @@ var ActionConfig = z24.discriminatedUnion("type", [
2787
2835
  id: "ReadActionConfig",
2788
2836
  description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
2789
2837
  }),
2838
+ AssignConfig.meta({
2839
+ id: "AssignActionConfig",
2840
+ description: "Configuration for assigning a record to the current user."
2841
+ }),
2842
+ UnassignConfig.meta({
2843
+ id: "UnassignActionConfig",
2844
+ description: "Configuration for unassigning a record from its current assignee."
2845
+ }),
2846
+ DeleteConfig.meta({
2847
+ id: "DeleteActionConfig",
2848
+ description: "Configuration for deleting a draft record."
2849
+ }),
2790
2850
  NotifyConfig.meta({
2791
2851
  id: "NotifyActionConfig",
2792
2852
  description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
@@ -2795,6 +2855,18 @@ var ActionConfig = z24.discriminatedUnion("type", [
2795
2855
  id: "DeclareActionConfig",
2796
2856
  description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
2797
2857
  }),
2858
+ DuplicateDetectedConfig.meta({
2859
+ id: "DuplicateDetectedActionConfig",
2860
+ description: "Configuration for the system-generated duplicate-detection action. Never shown as a button, so it only supports flags \u2014 not label, icon, or conditionals."
2861
+ }),
2862
+ MarkAsDuplicateConfig.meta({
2863
+ id: "MarkAsDuplicateActionConfig",
2864
+ description: "Configuration for marking a record as a duplicate."
2865
+ }),
2866
+ MarkAsNotDuplicateConfig.meta({
2867
+ id: "MarkAsNotDuplicateActionConfig",
2868
+ description: "Configuration for marking a record as not a duplicate, after it was previously flagged as one."
2869
+ }),
2798
2870
  RejectConfig.meta({
2799
2871
  id: "RejectActionConfig",
2800
2872
  description: "Configuration for rejecting a record before registration."
@@ -2811,6 +2883,14 @@ var ActionConfig = z24.discriminatedUnion("type", [
2811
2883
  id: "RequestCorrectionActionConfig",
2812
2884
  description: "Configuration for requesting a correction on a registered record."
2813
2885
  }),
2886
+ ApproveCorrectionConfig.meta({
2887
+ id: "ApproveCorrectionActionConfig",
2888
+ description: "Configuration for approving a requested correction."
2889
+ }),
2890
+ RejectCorrectionConfig.meta({
2891
+ id: "RejectCorrectionActionConfig",
2892
+ description: "Configuration for rejecting a requested correction."
2893
+ }),
2814
2894
  EditActionConfig.meta({
2815
2895
  id: "EditActionConfig",
2816
2896
  description: "Configuration for editing a record before registration."
@@ -3224,9 +3304,13 @@ var getActionAnnotationFields = (actionConfig) => {
3224
3304
  if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
3225
3305
  return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
3226
3306
  }
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];
3307
+ if (actionConfig.type === ActionType.CUSTOM) {
3308
+ return actionConfig.form;
3309
+ }
3310
+ if ("review" in actionConfig && actionConfig.review != null) {
3311
+ return actionConfig.review.fields;
3312
+ }
3313
+ return [];
3230
3314
  };
3231
3315
  function getAllAnnotationFields(config) {
3232
3316
  return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
@@ -3934,7 +4018,7 @@ function validateActionFlags(event2, ctx) {
3934
4018
  const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
3935
4019
  const configuredFlagIds = event2.flags.map((flag) => flag.id);
3936
4020
  const actionFlagIds = event2.actions.flatMap(
3937
- (action) => action.flags.map((flag) => flag.id)
4021
+ (action) => (action.flags ?? []).map((flag) => flag.id)
3938
4022
  );
3939
4023
  for (const actionFlagId of actionFlagIds) {
3940
4024
  const isConfigured = configuredFlagIds.includes(actionFlagId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "2.0.0-rc.63d8130",
3
+ "version": "2.0.0-rc.6427e1a",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "bin": {