@opencrvs/toolkit 1.8.0-rc.fa72fdf → 1.8.0-rc.faacbde

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.
@@ -35,11 +35,14 @@ __export(events_exports, {
35
35
  ActionConfig: () => ActionConfig,
36
36
  ActionConfigBase: () => ActionConfigBase,
37
37
  ActionDocument: () => ActionDocument,
38
+ ActionFormConfig: () => ActionFormConfig,
38
39
  ActionInput: () => ActionInput,
39
40
  ActionType: () => ActionType,
41
+ ActionTypes: () => ActionTypes,
40
42
  ActionUpdate: () => ActionUpdate,
41
43
  AddressFieldUpdateValue: () => AddressFieldUpdateValue,
42
44
  AddressFieldValue: () => AddressFieldValue,
45
+ AddressType: () => AddressType,
43
46
  AdministrativeAreas: () => AdministrativeAreas,
44
47
  AdvancedSearchConfig: () => AdvancedSearchConfig,
45
48
  ApproveCorrectionActionInput: () => ApproveCorrectionActionInput,
@@ -51,7 +54,14 @@ __export(events_exports, {
51
54
  Clause: () => Clause,
52
55
  Conditional: () => Conditional,
53
56
  ConditionalType: () => ConditionalType,
57
+ DataEntry: () => DataEntry,
58
+ DataFieldValue: () => DataFieldValue,
54
59
  DateValue: () => DateValue,
60
+ DeclarationActionConfig: () => DeclarationActionConfig,
61
+ DeclarationActions: () => DeclarationActions,
62
+ DeclarationFormConfig: () => DeclarationFormConfig,
63
+ DeclarationReviewConfig: () => DeclarationReviewConfig,
64
+ DeclarationUpdateActions: () => DeclarationUpdateActions,
55
65
  DeclareActionInput: () => DeclareActionInput,
56
66
  DeduplicationConfig: () => DeduplicationConfig,
57
67
  Draft: () => Draft,
@@ -75,13 +85,21 @@ __export(events_exports, {
75
85
  FileFieldValueWithOption: () => FileFieldValueWithOption,
76
86
  FileFieldWithOptionValue: () => FileFieldWithOptionValue,
77
87
  FormConfig: () => FormConfig,
78
- FormPage: () => FormPage,
88
+ FormPageConfig: () => FormPageConfig,
89
+ GenericAddressUpdateValue: () => GenericAddressUpdateValue,
90
+ GenericAddressValue: () => GenericAddressValue,
79
91
  GeographicalArea: () => GeographicalArea,
92
+ ImageMimeType: () => ImageMimeType,
80
93
  LanguageConfig: () => LanguageConfig,
81
94
  MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
95
+ MimeType: () => MimeType,
82
96
  NotifyActionInput: () => NotifyActionInput,
83
97
  NumberFieldValue: () => NumberFieldValue,
98
+ PageConfig: () => PageConfig,
99
+ PageConfigBase: () => PageConfigBase,
100
+ PageTypes: () => PageTypes,
84
101
  PrintCertificateActionInput: () => PrintCertificateActionInput,
102
+ ReadActionInput: () => ReadActionInput,
85
103
  RegisterActionInput: () => RegisterActionInput,
86
104
  RejectCorrectionActionInput: () => RejectCorrectionActionInput,
87
105
  RejectDeclarationActionInput: () => RejectDeclarationActionInput,
@@ -97,18 +115,23 @@ __export(events_exports, {
97
115
  UrbanAddressUpdateValue: () => UrbanAddressUpdateValue,
98
116
  UrbanAddressValue: () => UrbanAddressValue,
99
117
  ValidateActionInput: () => ValidateActionInput,
118
+ VerificationActionConfig: () => VerificationActionConfig,
119
+ VerificationPageConfig: () => VerificationPageConfig,
100
120
  WorkqueueConfig: () => WorkqueueConfig,
101
121
  alwaysTrue: () => alwaysTrue,
102
122
  and: () => and,
123
+ annotationActions: () => annotationActions,
103
124
  applyDraftsToEventIndex: () => applyDraftsToEventIndex,
104
125
  compositeFieldTypes: () => compositeFieldTypes,
105
126
  createEmptyDraft: () => createEmptyDraft,
106
127
  createValidationSchema: () => createValidationSchema,
107
128
  deepDropNulls: () => deepDropNulls,
129
+ defineActionForm: () => defineActionForm,
108
130
  defineConditional: () => defineConditional,
109
131
  defineConfig: () => defineConfig,
110
- defineForm: () => defineForm,
132
+ defineDeclarationForm: () => defineDeclarationForm,
111
133
  defineFormPage: () => defineFormPage,
134
+ definePage: () => definePage,
112
135
  errorMessages: () => errorMessages,
113
136
  event: () => event,
114
137
  eventMetadataLabelMap: () => eventMetadataLabelMap,
@@ -117,33 +140,34 @@ __export(events_exports, {
117
140
  eventStatuses: () => eventStatuses,
118
141
  field: () => field,
119
142
  fieldTypes: () => fieldTypes,
120
- findActiveActionFields: () => findActiveActionFields,
121
- findActiveActionForm: () => findActiveActionForm,
122
- findActiveActionFormFields: () => findActiveActionFormFields,
123
- findActiveActionFormPages: () => findActiveActionFormPages,
124
143
  findActiveDrafts: () => findActiveDrafts,
125
- findInputPageFields: () => findInputPageFields,
126
- findPageFields: () => findPageFields,
144
+ findAllFields: () => findAllFields,
145
+ findRecordActionPages: () => findRecordActionPages,
127
146
  generateActionDocument: () => generateActionDocument,
128
147
  generateActionInput: () => generateActionInput,
148
+ generateActionMetadataInput: () => generateActionMetadataInput,
129
149
  generateEventDocument: () => generateEventDocument,
130
150
  generateEventDraftDocument: () => generateEventDraftDocument,
131
151
  generateTransactionId: () => generateTransactionId,
132
- getActiveActionFields: () => getActiveActionFields,
133
- getActiveActionFormPages: () => getActiveActionFormPages,
134
- getAllFields: () => getAllFields,
135
- getAllPages: () => getAllPages,
152
+ generateTranslationConfig: () => generateTranslationConfig,
153
+ getActionAnnotation: () => getActionAnnotation,
154
+ getActionAnnotationFields: () => getActionAnnotationFields,
155
+ getActionReview: () => getActionReview,
156
+ getActionReviewFields: () => getActionReviewFields,
157
+ getAllAnnotationFields: () => getAllAnnotationFields,
136
158
  getCurrentEventState: () => getCurrentEventState,
137
159
  getCurrentEventStateWithDrafts: () => getCurrentEventStateWithDrafts,
138
- getEventConfiguration: () => getEventConfiguration,
160
+ getDeclaration: () => getDeclaration,
161
+ getDeclarationFields: () => getDeclarationFields,
162
+ getDeclarationPages: () => getDeclarationPages,
139
163
  getFieldValidationErrors: () => getFieldValidationErrors,
140
- getFormFields: () => getFormFields,
141
- getMetadataForAction: () => getMetadataForAction,
164
+ getVisiblePagesFormFields: () => getVisiblePagesFormFields,
142
165
  isAddressFieldType: () => isAddressFieldType,
143
166
  isAdministrativeAreaFieldType: () => isAdministrativeAreaFieldType,
144
167
  isBulletListFieldType: () => isBulletListFieldType,
145
168
  isCheckboxFieldType: () => isCheckboxFieldType,
146
169
  isCountryFieldType: () => isCountryFieldType,
170
+ isDataFieldType: () => isDataFieldType,
147
171
  isDateFieldType: () => isDateFieldType,
148
172
  isDividerFieldType: () => isDividerFieldType,
149
173
  isEmailFieldType: () => isEmailFieldType,
@@ -159,6 +183,7 @@ __export(events_exports, {
159
183
  isNumberFieldType: () => isNumberFieldType,
160
184
  isOfficeFieldType: () => isOfficeFieldType,
161
185
  isPageHeaderFieldType: () => isPageHeaderFieldType,
186
+ isPageVisible: () => isPageVisible,
162
187
  isParagraphFieldType: () => isParagraphFieldType,
163
188
  isRadioGroupFieldType: () => isRadioGroupFieldType,
164
189
  isSelectFieldType: () => isSelectFieldType,
@@ -167,12 +192,12 @@ __export(events_exports, {
167
192
  isTextAreaFieldType: () => isTextAreaFieldType,
168
193
  isTextFieldType: () => isTextFieldType,
169
194
  isUndeclaredDraft: () => isUndeclaredDraft,
195
+ isVerificationPage: () => isVerificationPage,
170
196
  mapFieldTypeToEmptyValue: () => mapFieldTypeToEmptyValue,
171
197
  mapFieldTypeToMockValue: () => mapFieldTypeToMockValue,
172
198
  mapFieldTypeToZod: () => mapFieldTypeToZod,
173
199
  not: () => not,
174
200
  or: () => or,
175
- resolveLabelsFromKnownFields: () => resolveLabelsFromKnownFields,
176
201
  stripHiddenFields: () => stripHiddenFields,
177
202
  user: () => user,
178
203
  validate: () => validate,
@@ -182,7 +207,7 @@ __export(events_exports, {
182
207
  module.exports = __toCommonJS(events_exports);
183
208
 
184
209
  // ../commons/src/events/ActionConfig.ts
185
- var import_zod7 = require("zod");
210
+ var import_zod9 = require("zod");
186
211
 
187
212
  // ../commons/src/events/Conditional.ts
188
213
  var import_zod = require("zod");
@@ -210,7 +235,7 @@ var ActionConditional = import_zod.z.discriminatedUnion("type", [
210
235
  EnableConditional
211
236
  ]);
212
237
 
213
- // ../commons/src/events/FormConfig.ts
238
+ // ../commons/src/events/PageConfig.ts
214
239
  var import_zod6 = require("zod");
215
240
 
216
241
  // ../commons/src/events/FieldConfig.ts
@@ -251,7 +276,8 @@ var FieldType = {
251
276
  ADMINISTRATIVE_AREA: "ADMINISTRATIVE_AREA",
252
277
  FACILITY: "FACILITY",
253
278
  OFFICE: "OFFICE",
254
- SIGNATURE: "SIGNATURE"
279
+ SIGNATURE: "SIGNATURE",
280
+ DATA: "DATA"
255
281
  };
256
282
  var fieldTypes = Object.values(FieldType);
257
283
  var compositeFieldTypes = [
@@ -269,6 +295,10 @@ var GeographicalArea = {
269
295
  URBAN: "URBAN",
270
296
  RURAL: "RURAL"
271
297
  };
298
+ var AddressType = {
299
+ DOMESTIC: "DOMESTIC",
300
+ INTERNATIONAL: "INTERNATIONAL"
301
+ };
272
302
  var FileFieldValue = import_zod3.z.object({
273
303
  filename: import_zod3.z.string(),
274
304
  originalFilename: import_zod3.z.string(),
@@ -276,6 +306,7 @@ var FileFieldValue = import_zod3.z.object({
276
306
  });
277
307
  var AdminStructure = import_zod3.z.object({
278
308
  country: import_zod3.z.string(),
309
+ addressType: import_zod3.z.literal(AddressType.DOMESTIC),
279
310
  province: import_zod3.z.string(),
280
311
  district: import_zod3.z.string()
281
312
  });
@@ -303,14 +334,33 @@ var RuralAddressUpdateValue = AdminStructure.extend({
303
334
  urbanOrRural: import_zod3.z.literal(GeographicalArea.RURAL),
304
335
  village: import_zod3.z.string().nullish()
305
336
  });
306
- var AddressFieldValue = import_zod3.z.discriminatedUnion("urbanOrRural", [
307
- UrbanAddressValue,
308
- RuralAddressValue
309
- ]);
337
+ var GenericAddressValue = import_zod3.z.object({
338
+ country: import_zod3.z.string(),
339
+ addressType: import_zod3.z.literal(AddressType.INTERNATIONAL),
340
+ state: import_zod3.z.string(),
341
+ district2: import_zod3.z.string(),
342
+ cityOrTown: import_zod3.z.string().optional(),
343
+ addressLine1: import_zod3.z.string().optional(),
344
+ addressLine2: import_zod3.z.string().optional(),
345
+ addressLine3: import_zod3.z.string().optional(),
346
+ postcodeOrZip: import_zod3.z.string().optional()
347
+ });
348
+ var AddressFieldValue = import_zod3.z.discriminatedUnion("urbanOrRural", [UrbanAddressValue, RuralAddressValue]).or(GenericAddressValue);
349
+ var GenericAddressUpdateValue = import_zod3.z.object({
350
+ country: import_zod3.z.string(),
351
+ addressType: import_zod3.z.literal(AddressType.INTERNATIONAL),
352
+ state: import_zod3.z.string(),
353
+ district2: import_zod3.z.string(),
354
+ cityOrTown: import_zod3.z.string().nullish(),
355
+ addressLine1: import_zod3.z.string().nullish(),
356
+ addressLine2: import_zod3.z.string().nullish(),
357
+ addressLine3: import_zod3.z.string().nullish(),
358
+ postcodeOrZip: import_zod3.z.string().nullish()
359
+ });
310
360
  var AddressFieldUpdateValue = import_zod3.z.discriminatedUnion("urbanOrRural", [
311
361
  UrbanAddressUpdateValue,
312
362
  RuralAddressUpdateValue
313
- ]);
363
+ ]).or(GenericAddressUpdateValue);
314
364
  var FileFieldValueWithOption = import_zod3.z.object({
315
365
  filename: import_zod3.z.string(),
316
366
  originalFilename: import_zod3.z.string(),
@@ -326,6 +376,7 @@ var DateValue = import_zod4.z.string().date().describe("Date in the format YYYY-
326
376
  var EmailValue = import_zod4.z.string().email();
327
377
  var CheckboxFieldValue = import_zod4.z.boolean();
328
378
  var NumberFieldValue = import_zod4.z.number();
379
+ var DataFieldValue = import_zod4.z.undefined();
329
380
  var FieldValue = import_zod4.z.union([
330
381
  TextValue,
331
382
  DateValue,
@@ -334,7 +385,9 @@ var FieldValue = import_zod4.z.union([
334
385
  FileFieldValue,
335
386
  FileFieldWithOptionValue,
336
387
  UrbanAddressValue,
337
- RuralAddressValue
388
+ RuralAddressValue,
389
+ DataFieldValue,
390
+ GenericAddressValue
338
391
  ]);
339
392
  var FieldUpdateValue = import_zod4.z.union([
340
393
  TextValue,
@@ -344,7 +397,9 @@ var FieldUpdateValue = import_zod4.z.union([
344
397
  FileFieldValue,
345
398
  FileFieldWithOptionValue,
346
399
  UrbanAddressUpdateValue,
347
- RuralAddressUpdateValue
400
+ RuralAddressUpdateValue,
401
+ DataFieldValue,
402
+ GenericAddressUpdateValue
348
403
  ]);
349
404
 
350
405
  // ../commons/src/events/FieldConfig.ts
@@ -415,15 +470,25 @@ var TextAreaField = BaseField.extend({
415
470
  postfix: TranslationConfig.optional()
416
471
  }).default({ rows: 4 }).optional()
417
472
  }).describe("Multiline text input");
473
+ var ImageMimeType = import_zod5.z.enum([
474
+ "image/png",
475
+ "image/jpg",
476
+ "image/jpeg",
477
+ "image/svg+xml"
478
+ ]);
479
+ var MimeType = ImageMimeType;
480
+ var DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
418
481
  var SignatureField = BaseField.extend({
419
482
  type: import_zod5.z.literal(FieldType.SIGNATURE),
420
483
  signaturePromptLabel: TranslationConfig.describe(
421
484
  "Title of the signature modal"
422
485
  ),
423
486
  configuration: import_zod5.z.object({
424
- maxSizeMb: import_zod5.z.number().optional().describe("Maximum file size in MB"),
425
- allowedFileFormats: import_zod5.z.array(import_zod5.z.string()).optional().describe("List of allowed file formats for the signature")
426
- }).default({}).optional()
487
+ maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
488
+ acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
489
+ }).default({
490
+ maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
491
+ })
427
492
  }).describe("Signature input field");
428
493
  var EmailField = BaseField.extend({
429
494
  type: import_zod5.z.literal(FieldType.EMAIL),
@@ -466,13 +531,17 @@ var PageHeader = BaseField.extend({
466
531
  }).describe("A read-only header component for form pages");
467
532
  var File = BaseField.extend({
468
533
  type: import_zod5.z.literal(FieldType.FILE),
469
- options: import_zod5.z.object({
534
+ configuration: import_zod5.z.object({
535
+ maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
536
+ acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
470
537
  style: import_zod5.z.object({
471
- fullWidth: import_zod5.z.boolean().describe(
538
+ width: import_zod5.z.enum(["full", "auto"]).optional().describe(
472
539
  "Whether the file upload button should take the full width of the container or not"
473
540
  )
474
- })
475
- }).optional()
541
+ }).optional()
542
+ }).default({
543
+ maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
544
+ })
476
545
  }).describe("File upload");
477
546
  var SelectOption = import_zod5.z.object({
478
547
  value: import_zod5.z.string().describe("The value of the option"),
@@ -518,7 +587,7 @@ var AdministrativeAreas = import_zod5.z.enum([
518
587
  ]);
519
588
  var AdministrativeAreaConfiguration = import_zod5.z.object({
520
589
  partOf: import_zod5.z.object({
521
- $data: import_zod5.z.string()
590
+ $declaration: import_zod5.z.string()
522
591
  }).optional().describe("Parent location"),
523
592
  type: AdministrativeAreas
524
593
  }).describe("Administrative area options");
@@ -533,8 +602,14 @@ var Location = BaseField.extend({
533
602
  }).describe("Input field for a location");
534
603
  var FileUploadWithOptions = BaseField.extend({
535
604
  type: import_zod5.z.literal(FieldType.FILE_WITH_OPTIONS),
536
- options: import_zod5.z.array(SelectOption).describe("A list of options")
537
- }).describe("Select input");
605
+ options: import_zod5.z.array(SelectOption).describe("A list of options"),
606
+ configuration: import_zod5.z.object({
607
+ maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
608
+ acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
609
+ }).default({
610
+ maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
611
+ })
612
+ });
538
613
  var Facility = BaseField.extend({
539
614
  type: import_zod5.z.literal(FieldType.FACILITY),
540
615
  defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
@@ -547,6 +622,22 @@ var Address = BaseField.extend({
547
622
  type: import_zod5.z.literal(FieldType.ADDRESS),
548
623
  defaultValue: AddressFieldValue.optional()
549
624
  }).describe("Address input field \u2013 a combination of location and text fields");
625
+ var DataEntry = import_zod5.z.union([
626
+ import_zod5.z.object({
627
+ label: TranslationConfig,
628
+ value: import_zod5.z.string()
629
+ }),
630
+ import_zod5.z.object({
631
+ fieldId: import_zod5.z.string()
632
+ })
633
+ ]);
634
+ var DataField = BaseField.extend({
635
+ type: import_zod5.z.literal(FieldType.DATA),
636
+ configuration: import_zod5.z.object({
637
+ subtitle: TranslationConfig.optional(),
638
+ data: import_zod5.z.array(DataEntry)
639
+ })
640
+ }).describe("Data field for displaying read-only data");
550
641
  var FieldConfig = import_zod5.z.discriminatedUnion("type", [
551
642
  Address,
552
643
  TextField,
@@ -568,132 +659,194 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
568
659
  Office,
569
660
  SignatureField,
570
661
  EmailField,
571
- FileUploadWithOptions
662
+ FileUploadWithOptions,
663
+ DataField
572
664
  ]);
573
665
 
574
- // ../commons/src/events/FormConfig.ts
575
- var FormPage = import_zod6.z.object({
666
+ // ../commons/src/events/PageConfig.ts
667
+ var PageTypes = import_zod6.z.enum(["FORM", "VERIFICATION"]);
668
+ var PageConfigBase = import_zod6.z.object({
576
669
  id: import_zod6.z.string().describe("Unique identifier for the page"),
577
670
  title: TranslationConfig.describe("Header title of the page"),
578
- fields: import_zod6.z.array(FieldConfig).describe("Fields to be rendered on the page")
671
+ fields: import_zod6.z.array(FieldConfig).describe("Fields to be rendered on the page"),
672
+ conditional: Conditional().optional().describe(
673
+ "Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
674
+ )
579
675
  });
580
- var FormConfig = import_zod6.z.object({
581
- label: TranslationConfig.describe("Human readable description of the form"),
582
- version: import_zod6.z.object({
583
- id: import_zod6.z.string().describe(
584
- "Form version. Semantic versioning recommended. Example: 0.0.1"
585
- ),
586
- label: TranslationConfig.describe(
587
- "Human readable description of the version"
588
- )
589
- }),
590
- active: import_zod6.z.boolean().default(false).describe("Whether the form is active"),
591
- pages: import_zod6.z.array(FormPage),
592
- review: import_zod6.z.object({
593
- title: TranslationConfig.describe(
594
- "Title of the form to show in review page"
595
- ),
596
- fields: import_zod6.z.array(FieldConfig).describe("Fields to be rendered on the review page for metadata")
676
+ var FormPageConfig = PageConfigBase.extend({
677
+ type: import_zod6.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
678
+ });
679
+ var VerificationActionConfig = import_zod6.z.object({
680
+ verify: import_zod6.z.object({ label: TranslationConfig }),
681
+ cancel: import_zod6.z.object({
682
+ label: TranslationConfig,
683
+ confirmation: import_zod6.z.object({
684
+ title: TranslationConfig,
685
+ body: TranslationConfig
686
+ })
597
687
  })
688
+ }).describe("Actions available on the verification page");
689
+ var VerificationPageConfig = FormPageConfig.extend({
690
+ type: import_zod6.z.literal(PageTypes.enum.VERIFICATION),
691
+ actions: VerificationActionConfig
598
692
  });
693
+ var PageConfig = import_zod6.z.discriminatedUnion("type", [
694
+ FormPageConfig,
695
+ VerificationPageConfig
696
+ ]);
599
697
 
600
698
  // ../commons/src/events/ActionType.ts
699
+ var import_zod7 = require("zod");
601
700
  var ActionType = {
701
+ // Pre-declaration actions
702
+ DELETE: "DELETE",
602
703
  CREATE: "CREATE",
603
- ASSIGN: "ASSIGN",
604
- UNASSIGN: "UNASSIGN",
605
- REGISTER: "REGISTER",
606
- VALIDATE: "VALIDATE",
607
- REQUEST_CORRECTION: "REQUEST_CORRECTION",
608
- REJECT_CORRECTION: "REJECT_CORRECTION",
609
- APPROVE_CORRECTION: "APPROVE_CORRECTION",
610
- DETECT_DUPLICATE: "DETECT_DUPLICATE",
611
704
  NOTIFY: "NOTIFY",
705
+ // Declaration actions
612
706
  DECLARE: "DECLARE",
613
- DELETE: "DELETE",
614
- PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
615
- CUSTOM: "CUSTOM",
707
+ VALIDATE: "VALIDATE",
708
+ REGISTER: "REGISTER",
709
+ // Declaration system actions. Non-configurable.
710
+ DETECT_DUPLICATE: "DETECT_DUPLICATE",
616
711
  REJECT: "REJECT",
712
+ // REJECT_DECLARATION
617
713
  MARKED_AS_DUPLICATE: "MARKED_AS_DUPLICATE",
618
- ARCHIVE: "ARCHIVE"
714
+ // MARK_AS_DUPLICATE
715
+ ARCHIVE: "ARCHIVE",
716
+ // Record actions
717
+ PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
718
+ REQUEST_CORRECTION: "REQUEST_CORRECTION",
719
+ REJECT_CORRECTION: "REJECT_CORRECTION",
720
+ APPROVE_CORRECTION: "APPROVE_CORRECTION",
721
+ // General actions
722
+ READ: "READ",
723
+ ASSIGN: "ASSIGN",
724
+ UNASSIGN: "UNASSIGN"
619
725
  };
726
+ var ActionTypes = import_zod7.z.enum([
727
+ "DELETE",
728
+ "CREATE",
729
+ "NOTIFY",
730
+ "DECLARE",
731
+ "VALIDATE",
732
+ "REGISTER",
733
+ "DETECT_DUPLICATE",
734
+ "REJECT",
735
+ "MARKED_AS_DUPLICATE",
736
+ "ARCHIVE",
737
+ "PRINT_CERTIFICATE",
738
+ "REQUEST_CORRECTION",
739
+ "REJECT_CORRECTION",
740
+ "APPROVE_CORRECTION",
741
+ "READ",
742
+ "ASSIGN",
743
+ "UNASSIGN"
744
+ ]);
745
+ var declarationActionValues = [
746
+ ActionTypes.enum.DECLARE,
747
+ ActionTypes.enum.VALIDATE,
748
+ ActionTypes.enum.REGISTER
749
+ ];
750
+ var DeclarationActions = ActionTypes.extract(declarationActionValues);
751
+ var declarationUpdateActionValues = [
752
+ ...declarationActionValues,
753
+ ActionTypes.enum.REQUEST_CORRECTION
754
+ ];
755
+ var DeclarationUpdateActions = ActionTypes.extract(
756
+ declarationUpdateActionValues
757
+ );
758
+ var annotationActions = ActionTypes.exclude(declarationActionValues);
759
+
760
+ // ../commons/src/events/FormConfig.ts
761
+ var import_zod8 = require("zod");
762
+ var DeclarationFormConfig = import_zod8.z.object({
763
+ label: TranslationConfig.describe("Human readable description of the form"),
764
+ pages: import_zod8.z.array(FormPageConfig)
765
+ }).describe("Configuration for a declaration form");
766
+ var ActionFormConfig = import_zod8.z.object({
767
+ label: TranslationConfig.describe("Human readable description of the form"),
768
+ pages: import_zod8.z.array(PageConfig)
769
+ });
770
+ var FormConfig = import_zod8.z.union([DeclarationFormConfig, ActionFormConfig]);
620
771
 
621
772
  // ../commons/src/events/ActionConfig.ts
622
- var ActionConditional2 = import_zod7.z.discriminatedUnion("type", [
773
+ var ActionConditional2 = import_zod9.z.discriminatedUnion("type", [
623
774
  /** If conditional is defined, the action is shown to the user only if the condition is met */
624
775
  ShowConditional,
625
776
  /** If conditional is defined, the action is enabled only if the condition is met */
626
777
  EnableConditional
627
778
  ]);
628
- var ActionConfigBase = import_zod7.z.object({
779
+ var DeclarationReviewConfig = import_zod9.z.object({
780
+ title: TranslationConfig.describe("Title of the review page"),
781
+ fields: import_zod9.z.array(FieldConfig).describe("Fields to be rendered on the review page for annotations.")
782
+ }).describe("Configuration for **declaration** review page.");
783
+ var ActionConfigBase = import_zod9.z.object({
629
784
  label: TranslationConfig,
630
- conditionals: import_zod7.z.array(ActionConditional2).optional().default([]),
631
- draft: import_zod7.z.boolean().optional(),
632
- forms: import_zod7.z.array(FormConfig)
785
+ conditionals: import_zod9.z.array(ActionConditional2).optional().default([]),
786
+ draft: import_zod9.z.boolean().optional()
633
787
  });
634
788
  var DeclareConfig = ActionConfigBase.merge(
635
- import_zod7.z.object({
636
- type: import_zod7.z.literal(ActionType.DECLARE)
789
+ import_zod9.z.object({
790
+ type: import_zod9.z.literal(ActionType.DECLARE),
791
+ review: DeclarationReviewConfig
637
792
  })
638
793
  );
639
794
  var ValidateConfig = ActionConfigBase.merge(
640
- import_zod7.z.object({
641
- type: import_zod7.z.literal(ActionType.VALIDATE)
795
+ import_zod9.z.object({
796
+ type: import_zod9.z.literal(ActionType.VALIDATE),
797
+ review: DeclarationReviewConfig
798
+ })
799
+ );
800
+ var RegisterConfig = ActionConfigBase.merge(
801
+ import_zod9.z.object({
802
+ type: import_zod9.z.literal(ActionType.REGISTER),
803
+ review: DeclarationReviewConfig
642
804
  })
643
805
  );
644
806
  var RejectDeclarationConfig = ActionConfigBase.merge(
645
- import_zod7.z.object({
646
- type: import_zod7.z.literal(ActionType.REJECT)
807
+ import_zod9.z.object({
808
+ type: import_zod9.z.literal(ActionType.REJECT)
647
809
  })
648
810
  );
649
811
  var MarkedAsDuplicateConfig = ActionConfigBase.merge(
650
- import_zod7.z.object({
651
- type: import_zod7.z.literal(ActionType.MARKED_AS_DUPLICATE)
812
+ import_zod9.z.object({
813
+ type: import_zod9.z.literal(ActionType.MARKED_AS_DUPLICATE)
652
814
  })
653
815
  );
654
816
  var ArchiveConfig = ActionConfigBase.merge(
655
- import_zod7.z.object({
656
- type: import_zod7.z.literal(ActionType.ARCHIVE)
657
- })
658
- );
659
- var RegisterConfig = ActionConfigBase.merge(
660
- import_zod7.z.object({
661
- type: import_zod7.z.literal(ActionType.REGISTER)
817
+ import_zod9.z.object({
818
+ type: import_zod9.z.literal(ActionType.ARCHIVE)
662
819
  })
663
820
  );
664
821
  var DeleteConfig = ActionConfigBase.merge(
665
- import_zod7.z.object({
666
- type: import_zod7.z.literal(ActionType.DELETE)
822
+ import_zod9.z.object({
823
+ type: import_zod9.z.literal(ActionType.DELETE)
667
824
  })
668
825
  );
669
826
  var PrintCertificateActionConfig = ActionConfigBase.merge(
670
- import_zod7.z.object({
671
- type: import_zod7.z.literal(ActionType.PRINT_CERTIFICATE)
827
+ import_zod9.z.object({
828
+ type: import_zod9.z.literal(ActionType.PRINT_CERTIFICATE),
829
+ printForm: ActionFormConfig
672
830
  })
673
831
  );
674
832
  var RequestCorrectionConfig = ActionConfigBase.merge(
675
- import_zod7.z.object({
676
- type: import_zod7.z.literal(ActionType.REQUEST_CORRECTION),
677
- onboardingForm: import_zod7.z.array(FormPage),
678
- additionalDetailsForm: import_zod7.z.array(FormPage)
833
+ import_zod9.z.object({
834
+ type: import_zod9.z.literal(ActionType.REQUEST_CORRECTION),
835
+ onboardingForm: import_zod9.z.array(PageConfig),
836
+ additionalDetailsForm: import_zod9.z.array(PageConfig)
679
837
  })
680
838
  );
681
839
  var RejectCorrectionConfig = ActionConfigBase.merge(
682
- import_zod7.z.object({
683
- type: import_zod7.z.literal(ActionType.REJECT_CORRECTION)
840
+ import_zod9.z.object({
841
+ type: import_zod9.z.literal(ActionType.REJECT_CORRECTION)
684
842
  })
685
843
  );
686
844
  var ApproveCorrectionConfig = ActionConfigBase.merge(
687
- import_zod7.z.object({
688
- type: import_zod7.z.literal(ActionType.APPROVE_CORRECTION)
689
- })
690
- );
691
- var CustomConfig = ActionConfigBase.merge(
692
- import_zod7.z.object({
693
- type: import_zod7.z.literal(ActionType.CUSTOM)
845
+ import_zod9.z.object({
846
+ type: import_zod9.z.literal(ActionType.APPROVE_CORRECTION)
694
847
  })
695
848
  );
696
- var ActionConfig = import_zod7.z.discriminatedUnion("type", [
849
+ var ActionConfig = import_zod9.z.discriminatedUnion("type", [
697
850
  DeclareConfig,
698
851
  ValidateConfig,
699
852
  RejectDeclarationConfig,
@@ -704,102 +857,106 @@ var ActionConfig = import_zod7.z.discriminatedUnion("type", [
704
857
  PrintCertificateActionConfig,
705
858
  RequestCorrectionConfig,
706
859
  RejectCorrectionConfig,
707
- ApproveCorrectionConfig,
708
- CustomConfig
860
+ ApproveCorrectionConfig
861
+ ]);
862
+ var DeclarationActionConfig = import_zod9.z.discriminatedUnion("type", [
863
+ DeclareConfig,
864
+ ValidateConfig,
865
+ RegisterConfig
709
866
  ]);
710
867
 
711
868
  // ../commons/src/events/offline/CertificateConfig.ts
712
- var import_zod8 = require("zod");
713
- var FontFamily = import_zod8.z.object({
714
- normal: import_zod8.z.string(),
715
- bold: import_zod8.z.string(),
716
- italics: import_zod8.z.string(),
717
- bolditalics: import_zod8.z.string()
869
+ var import_zod10 = require("zod");
870
+ var FontFamily = import_zod10.z.object({
871
+ normal: import_zod10.z.string(),
872
+ bold: import_zod10.z.string(),
873
+ italics: import_zod10.z.string(),
874
+ bolditalics: import_zod10.z.string()
718
875
  });
719
- var CertificateConfig = import_zod8.z.object({
720
- id: import_zod8.z.string(),
721
- event: import_zod8.z.string(),
876
+ var CertificateConfig = import_zod10.z.object({
877
+ id: import_zod10.z.string(),
878
+ event: import_zod10.z.string(),
722
879
  label: TranslationConfig,
723
- isDefault: import_zod8.z.boolean(),
724
- fee: import_zod8.z.object({
725
- onTime: import_zod8.z.number(),
726
- late: import_zod8.z.number(),
727
- delayed: import_zod8.z.number()
880
+ isDefault: import_zod10.z.boolean(),
881
+ fee: import_zod10.z.object({
882
+ onTime: import_zod10.z.number(),
883
+ late: import_zod10.z.number(),
884
+ delayed: import_zod10.z.number()
728
885
  }),
729
- svgUrl: import_zod8.z.string(),
730
- fonts: import_zod8.z.record(FontFamily).optional()
886
+ svgUrl: import_zod10.z.string(),
887
+ fonts: import_zod10.z.record(FontFamily).optional()
731
888
  });
732
889
  var CertificateTemplateConfig = CertificateConfig.extend({
733
- hash: import_zod8.z.string().optional(),
734
- svg: import_zod8.z.string()
890
+ hash: import_zod10.z.string().optional(),
891
+ svg: import_zod10.z.string()
735
892
  });
736
893
 
737
894
  // ../commons/src/events/offline/LanguageConfig.ts
738
- var import_zod9 = require("zod");
739
- var LanguageConfig = import_zod9.z.object({
740
- lang: import_zod9.z.string(),
895
+ var import_zod11 = require("zod");
896
+ var LanguageConfig = import_zod11.z.object({
897
+ lang: import_zod11.z.string(),
741
898
  /**
742
899
  * client.csv contents
743
900
  */
744
- messages: import_zod9.z.record(import_zod9.z.string())
901
+ messages: import_zod11.z.record(import_zod11.z.string())
745
902
  });
746
903
 
747
904
  // ../commons/src/events/EventConfig.ts
748
- var import_zod18 = require("zod");
905
+ var import_zod20 = require("zod");
749
906
 
750
907
  // ../commons/src/events/DeduplicationConfig.ts
751
- var import_zod10 = require("zod");
752
- var FieldReference = import_zod10.z.string();
753
- var Matcher = import_zod10.z.object({
754
- fieldId: import_zod10.z.string(),
755
- options: import_zod10.z.object({
756
- boost: import_zod10.z.number().optional()
908
+ var import_zod12 = require("zod");
909
+ var FieldReference = import_zod12.z.string();
910
+ var Matcher = import_zod12.z.object({
911
+ fieldId: import_zod12.z.string(),
912
+ options: import_zod12.z.object({
913
+ boost: import_zod12.z.number().optional()
757
914
  }).optional().default({})
758
915
  });
759
916
  var FuzzyMatcher = Matcher.extend({
760
- type: import_zod10.z.literal("fuzzy"),
761
- options: import_zod10.z.object({
917
+ type: import_zod12.z.literal("fuzzy"),
918
+ options: import_zod12.z.object({
762
919
  /**
763
920
  * Names of length 3 or less characters = 0 edits allowed
764
921
  * Names of length 4 - 6 characters = 1 edit allowed
765
922
  * Names of length >7 characters = 2 edits allowed
766
923
  */
767
- fuzziness: import_zod10.z.union([import_zod10.z.string(), import_zod10.z.number()]).optional().default("AUTO:4,7"),
768
- boost: import_zod10.z.number().optional().default(1)
924
+ fuzziness: import_zod12.z.union([import_zod12.z.string(), import_zod12.z.number()]).optional().default("AUTO:4,7"),
925
+ boost: import_zod12.z.number().optional().default(1)
769
926
  }).optional().default({})
770
927
  });
771
928
  var StrictMatcher = Matcher.extend({
772
- type: import_zod10.z.literal("strict"),
773
- options: import_zod10.z.object({
774
- boost: import_zod10.z.number().optional().default(1)
929
+ type: import_zod12.z.literal("strict"),
930
+ options: import_zod12.z.object({
931
+ boost: import_zod12.z.number().optional().default(1)
775
932
  }).optional().default({})
776
933
  });
777
934
  var DateRangeMatcher = Matcher.extend({
778
- type: import_zod10.z.literal("dateRange"),
779
- options: import_zod10.z.object({
780
- days: import_zod10.z.number(),
935
+ type: import_zod12.z.literal("dateRange"),
936
+ options: import_zod12.z.object({
937
+ days: import_zod12.z.number(),
781
938
  origin: FieldReference,
782
- boost: import_zod10.z.number().optional().default(1)
939
+ boost: import_zod12.z.number().optional().default(1)
783
940
  })
784
941
  });
785
942
  var DateDistanceMatcher = Matcher.extend({
786
- type: import_zod10.z.literal("dateDistance"),
787
- options: import_zod10.z.object({
788
- days: import_zod10.z.number(),
943
+ type: import_zod12.z.literal("dateDistance"),
944
+ options: import_zod12.z.object({
945
+ days: import_zod12.z.number(),
789
946
  origin: FieldReference,
790
- boost: import_zod10.z.number().optional().default(1)
947
+ boost: import_zod12.z.number().optional().default(1)
791
948
  })
792
949
  });
793
- var And = import_zod10.z.object({
794
- type: import_zod10.z.literal("and"),
795
- clauses: import_zod10.z.lazy(() => Clause.array())
950
+ var And = import_zod12.z.object({
951
+ type: import_zod12.z.literal("and"),
952
+ clauses: import_zod12.z.lazy(() => Clause.array())
796
953
  });
797
- var Or = import_zod10.z.object({
798
- type: import_zod10.z.literal("or"),
799
- clauses: import_zod10.z.lazy(() => Clause.array())
954
+ var Or = import_zod12.z.object({
955
+ type: import_zod12.z.literal("or"),
956
+ clauses: import_zod12.z.lazy(() => Clause.array())
800
957
  });
801
- var Clause = import_zod10.z.lazy(
802
- () => import_zod10.z.discriminatedUnion("type", [
958
+ var Clause = import_zod12.z.lazy(
959
+ () => import_zod12.z.discriminatedUnion("type", [
803
960
  And,
804
961
  Or,
805
962
  FuzzyMatcher,
@@ -808,37 +965,37 @@ var Clause = import_zod10.z.lazy(
808
965
  DateDistanceMatcher
809
966
  ])
810
967
  );
811
- var DeduplicationConfig = import_zod10.z.object({
812
- id: import_zod10.z.string(),
968
+ var DeduplicationConfig = import_zod12.z.object({
969
+ id: import_zod12.z.string(),
813
970
  label: TranslationConfig,
814
971
  query: Clause
815
972
  });
816
973
 
817
974
  // ../commons/src/events/SummaryConfig.ts
818
- var import_zod11 = require("zod");
819
- var Field = import_zod11.z.object({
820
- id: import_zod11.z.string().describe("Id of summary field"),
975
+ var import_zod13 = require("zod");
976
+ var Field = import_zod13.z.object({
977
+ id: import_zod13.z.string().describe("Id of summary field"),
821
978
  value: TranslationConfig.describe(
822
979
  "Summary field value. Can utilise values defined in configuration and EventMetadata"
823
980
  ),
824
981
  label: TranslationConfig,
825
982
  emptyValueMessage: TranslationConfig.optional()
826
983
  });
827
- var Title = import_zod11.z.object({
828
- id: import_zod11.z.string(),
984
+ var Title = import_zod13.z.object({
985
+ id: import_zod13.z.string(),
829
986
  label: TranslationConfig.describe("Title content"),
830
987
  emptyValueMessage: TranslationConfig.optional()
831
988
  });
832
- var SummaryConfig = import_zod11.z.object({
989
+ var SummaryConfig = import_zod13.z.object({
833
990
  title: Title.describe("Title of summary view."),
834
- fields: import_zod11.z.array(Field).describe("Fields rendered in summary view.")
991
+ fields: import_zod13.z.array(Field).describe("Fields rendered in summary view.")
835
992
  }).describe("Configuration for summary in event.");
836
993
 
837
994
  // ../commons/src/events/WorkqueueConfig.ts
838
- var import_zod13 = require("zod");
995
+ var import_zod15 = require("zod");
839
996
 
840
997
  // ../commons/src/events/EventMetadata.ts
841
- var import_zod12 = require("zod");
998
+ var import_zod14 = require("zod");
842
999
  var EventStatus = {
843
1000
  CREATED: "CREATED",
844
1001
  NOTIFIED: "NOTIFIED",
@@ -850,18 +1007,18 @@ var EventStatus = {
850
1007
  ARCHIVED: "ARCHIVED"
851
1008
  };
852
1009
  var eventStatuses = Object.values(EventStatus);
853
- var EventStatuses = import_zod12.z.nativeEnum(EventStatus);
854
- var EventMetadata = import_zod12.z.object({
855
- id: import_zod12.z.string(),
856
- type: import_zod12.z.string(),
1010
+ var EventStatuses = import_zod14.z.nativeEnum(EventStatus);
1011
+ var EventMetadata = import_zod14.z.object({
1012
+ id: import_zod14.z.string(),
1013
+ type: import_zod14.z.string(),
857
1014
  status: EventStatuses,
858
- createdAt: import_zod12.z.string().datetime(),
859
- createdBy: import_zod12.z.string(),
860
- createdAtLocation: import_zod12.z.string(),
861
- modifiedAt: import_zod12.z.string().datetime(),
862
- assignedTo: import_zod12.z.string().nullish(),
863
- updatedBy: import_zod12.z.string(),
864
- trackingId: import_zod12.z.string()
1015
+ createdAt: import_zod14.z.string().datetime(),
1016
+ createdBy: import_zod14.z.string(),
1017
+ createdAtLocation: import_zod14.z.string(),
1018
+ modifiedAt: import_zod14.z.string().datetime(),
1019
+ assignedTo: import_zod14.z.string().nullish(),
1020
+ updatedBy: import_zod14.z.string(),
1021
+ trackingId: import_zod14.z.string()
865
1022
  });
866
1023
  var eventMetadataLabelMap = {
867
1024
  "event.assignedTo": {
@@ -917,24 +1074,24 @@ var eventMetadataLabelMap = {
917
1074
  };
918
1075
 
919
1076
  // ../commons/src/events/WorkqueueConfig.ts
920
- var WorkqueueConfig = import_zod13.z.object({
921
- id: import_zod13.z.string().describe("Unique identifier for workqueue."),
922
- filters: import_zod13.z.array(
923
- import_zod13.z.object({
924
- status: import_zod13.z.array(EventStatuses).describe("Defines which statusese are included in the workqueue.")
1077
+ var WorkqueueConfig = import_zod15.z.object({
1078
+ id: import_zod15.z.string().describe("Unique identifier for workqueue."),
1079
+ filters: import_zod15.z.array(
1080
+ import_zod15.z.object({
1081
+ status: import_zod15.z.array(EventStatuses).describe("Defines which statusese are included in the workqueue.")
925
1082
  })
926
1083
  ).describe("Filters to be applied to workqueue.")
927
1084
  }).describe("Configuration for workqueue.");
928
1085
 
929
1086
  // ../commons/src/events/AdvancedSearchConfig.ts
930
- var import_zod14 = require("zod");
931
- var AdvancedSearchConfig = import_zod14.z.object({
1087
+ var import_zod16 = require("zod");
1088
+ var AdvancedSearchConfig = import_zod16.z.object({
932
1089
  title: TranslationConfig.describe("Advanced search tab title"),
933
- fields: import_zod14.z.array(
934
- import_zod14.z.object({
935
- fieldId: import_zod14.z.string(),
936
- config: import_zod14.z.object({
937
- type: import_zod14.z.enum(["FUZZY", "EXACT", "RANGE"]).describe("Determines the type of field")
1090
+ fields: import_zod16.z.array(
1091
+ import_zod16.z.object({
1092
+ fieldId: import_zod16.z.string(),
1093
+ config: import_zod16.z.object({
1094
+ type: import_zod16.z.enum(["FUZZY", "EXACT", "RANGE"]).describe("Determines the type of field")
938
1095
  }).optional().describe("Configuration options for the field")
939
1096
  })
940
1097
  ).optional().default([]).describe("Advanced search fields.")
@@ -944,12 +1101,12 @@ var AdvancedSearchConfig = import_zod14.z.object({
944
1101
  var import_lodash = require("lodash");
945
1102
 
946
1103
  // ../commons/src/workqueues/WorkqueueConfig.ts
947
- var import_zod16 = require("zod");
1104
+ var import_zod18 = require("zod");
948
1105
 
949
1106
  // ../commons/src/workqueues/defaultColumns.ts
950
- var import_zod15 = require("zod");
951
- var WorkQueueColumnConfig = import_zod15.z.object({
952
- id: import_zod15.z.string(),
1107
+ var import_zod17 = require("zod");
1108
+ var WorkQueueColumnConfig = import_zod17.z.object({
1109
+ id: import_zod17.z.string(),
953
1110
  label: TranslationConfig
954
1111
  });
955
1112
  var defaultColumns = {
@@ -986,16 +1143,16 @@ var defaultColumns = {
986
1143
  }
987
1144
  }
988
1145
  };
989
- var DefaultColumnKeys = import_zod15.z.enum(
1146
+ var DefaultColumnKeys = import_zod17.z.enum(
990
1147
  Object.keys(defaultColumns)
991
1148
  );
992
1149
 
993
1150
  // ../commons/src/workqueues/WorkqueueConfig.ts
994
- var rootWorkqueueConfig = import_zod16.z.object({
995
- id: import_zod16.z.string(),
1151
+ var rootWorkqueueConfig = import_zod18.z.object({
1152
+ id: import_zod18.z.string(),
996
1153
  title: TranslationConfig,
997
- columns: import_zod16.z.array(WorkQueueColumnConfig),
998
- defaultColumns: import_zod16.z.array(DefaultColumnKeys)
1154
+ columns: import_zod18.z.array(WorkQueueColumnConfig),
1155
+ defaultColumns: import_zod18.z.array(DefaultColumnKeys)
999
1156
  });
1000
1157
  var defineWorkqueue = (config) => rootWorkqueueConfig.parse(config);
1001
1158
 
@@ -1075,7 +1232,7 @@ var import_ajv_formats = __toESM(require("ajv-formats"));
1075
1232
  var import_date_fns = require("date-fns");
1076
1233
 
1077
1234
  // ../commons/src/events/FieldTypeMapping.ts
1078
- var import_zod17 = require("zod");
1235
+ var import_zod19 = require("zod");
1079
1236
  function mapFieldTypeToZod(type, required) {
1080
1237
  let schema;
1081
1238
  switch (type) {
@@ -1117,6 +1274,9 @@ function mapFieldTypeToZod(type, required) {
1117
1274
  case FieldType.ADDRESS:
1118
1275
  schema = AddressFieldUpdateValue;
1119
1276
  break;
1277
+ case FieldType.DATA:
1278
+ schema = DataFieldValue;
1279
+ break;
1120
1280
  }
1121
1281
  return required ? schema : schema.nullish();
1122
1282
  }
@@ -1125,7 +1285,7 @@ function createValidationSchema(config) {
1125
1285
  for (const field2 of config) {
1126
1286
  shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
1127
1287
  }
1128
- return import_zod17.z.object(shape);
1288
+ return import_zod19.z.object(shape);
1129
1289
  }
1130
1290
  function mapFieldTypeToMockValue(field2, i) {
1131
1291
  switch (field2.type) {
@@ -1151,6 +1311,7 @@ function mapFieldTypeToMockValue(field2, i) {
1151
1311
  case FieldType.ADDRESS:
1152
1312
  return {
1153
1313
  country: "FAR",
1314
+ addressType: AddressType.DOMESTIC,
1154
1315
  province: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
1155
1316
  district: "5ef450bc-712d-48ad-93f3-8da0fa453baa",
1156
1317
  urbanOrRural: "URBAN",
@@ -1172,6 +1333,8 @@ function mapFieldTypeToMockValue(field2, i) {
1172
1333
  };
1173
1334
  case FieldType.FILE_WITH_OPTIONS:
1174
1335
  return null;
1336
+ case FieldType.DATA:
1337
+ return {};
1175
1338
  }
1176
1339
  }
1177
1340
  function mapFieldTypeToEmptyValue(field2) {
@@ -1194,10 +1357,12 @@ function mapFieldTypeToEmptyValue(field2) {
1194
1357
  case FieldType.EMAIL:
1195
1358
  case FieldType.DATE:
1196
1359
  case FieldType.CHECKBOX:
1360
+ case FieldType.DATA:
1197
1361
  return null;
1198
1362
  case FieldType.ADDRESS:
1199
1363
  return {
1200
1364
  country: null,
1365
+ addressType: AddressType.DOMESTIC,
1201
1366
  province: null,
1202
1367
  district: null,
1203
1368
  urbanOrRural: "URBAN",
@@ -1281,6 +1446,9 @@ var isFacilityFieldType = (field2) => {
1281
1446
  var isOfficeFieldType = (field2) => {
1282
1447
  return field2.config.type === FieldType.OFFICE;
1283
1448
  };
1449
+ var isDataFieldType = (field2) => {
1450
+ return field2.config.type === FieldType.DATA;
1451
+ };
1284
1452
 
1285
1453
  // ../commons/src/conditionals/validate.ts
1286
1454
  var ajv = new import_ajv.default({
@@ -1375,6 +1543,16 @@ var zodToIntlErrorMap = (issue, _ctx) => {
1375
1543
  }
1376
1544
  break;
1377
1545
  }
1546
+ case "invalid_union": {
1547
+ for (const { issues } of issue.unionErrors) {
1548
+ for (const e of issues) {
1549
+ if (zodToIntlErrorMap(e, _ctx).message.message.id !== "v2.error.required") {
1550
+ return createIntlError(errorMessages.invalidInput);
1551
+ }
1552
+ }
1553
+ }
1554
+ return createIntlError(errorMessages.requiredField);
1555
+ }
1378
1556
  }
1379
1557
  return createIntlError(errorMessages.invalidInput);
1380
1558
  };
@@ -1435,6 +1613,15 @@ function validateFieldInput({
1435
1613
  return rawError.error?.issues.map((issue) => issue.message) ?? [];
1436
1614
  }
1437
1615
 
1616
+ // ../commons/src/uuid.ts
1617
+ var import_uuid = require("uuid");
1618
+ function getUUID() {
1619
+ return (0, import_uuid.v4)();
1620
+ }
1621
+
1622
+ // ../commons/src/events/utils.ts
1623
+ var import_date_fns2 = require("date-fns");
1624
+
1438
1625
  // ../commons/src/utils.ts
1439
1626
  function getOrThrow(x, message) {
1440
1627
  if (x === void 0 || x === null) {
@@ -1443,73 +1630,64 @@ function getOrThrow(x, message) {
1443
1630
  return x;
1444
1631
  }
1445
1632
 
1446
- // ../commons/src/uuid.ts
1447
- var import_uuid = require("uuid");
1448
- function getUUID() {
1449
- return (0, import_uuid.v4)();
1450
- }
1451
-
1452
1633
  // ../commons/src/events/utils.ts
1453
- function isMetadataField(field2) {
1454
- return field2 in eventMetadataLabelMap;
1455
- }
1456
- var findInputPageFields = (config) => {
1457
- return (0, import_lodash.flattenDeep)(
1458
- config.actions.map(
1459
- ({ forms }) => forms.map(
1460
- ({ pages }) => pages.map(
1461
- ({ fields }) => fields.map(({ id, label }) => ({ id, label }))
1462
- )
1463
- )
1464
- )
1465
- );
1634
+ var findAllFields = (config) => {
1635
+ return (0, import_lodash.flattenDeep)([
1636
+ ...getDeclarationFields(config),
1637
+ ...getAllAnnotationFields(config)
1638
+ ]);
1466
1639
  };
1467
- var findPageFields = (config) => {
1468
- return (0, import_lodash.flattenDeep)(
1469
- config.actions.map((action) => {
1470
- if (action.type === ActionType.REQUEST_CORRECTION) {
1471
- return [
1472
- ...action.forms.map(({ pages }) => pages.map(({ fields }) => fields)),
1473
- ...action.onboardingForm.flatMap(({ fields }) => fields),
1474
- ...action.additionalDetailsForm.flatMap(({ fields }) => fields)
1475
- ];
1476
- }
1477
- return action.forms.map(({ pages }) => pages.map(({ fields }) => fields));
1478
- })
1479
- );
1640
+ var getAllAnnotationFields = (config) => {
1641
+ return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
1480
1642
  };
1481
- var resolveLabelsFromKnownFields = ({
1482
- pageFields,
1483
- refFields
1484
- }) => {
1485
- return refFields.map((field2) => {
1486
- if (field2.label) {
1487
- return field2;
1488
- }
1489
- if (isMetadataField(field2.id)) {
1490
- return {
1491
- ...field2,
1492
- label: eventMetadataLabelMap[field2.id]
1493
- };
1494
- }
1495
- const pageLabel = pageFields.find((pageField) => pageField.id === field2.id);
1496
- if (!pageLabel) {
1497
- throw new Error(`Referenced field ${field2.id} does not have a label`);
1498
- }
1499
- return {
1500
- ...field2,
1501
- label: pageLabel.label
1502
- };
1503
- });
1643
+ var getActionAnnotationFields = (actionConfig) => {
1644
+ if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
1645
+ return [
1646
+ ...actionConfig.onboardingForm.flatMap(({ fields }) => fields),
1647
+ ...actionConfig.additionalDetailsForm.flatMap(({ fields }) => fields)
1648
+ ];
1649
+ }
1650
+ if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
1651
+ return actionConfig?.printForm.pages.flatMap(({ fields }) => fields) ?? [];
1652
+ }
1653
+ if (isDeclarationActionConfig(actionConfig)) {
1654
+ return actionConfig?.review.fields ?? [];
1655
+ }
1656
+ return [];
1504
1657
  };
1505
- function getAllFields(configuration) {
1506
- return configuration.actions.flatMap((action) => action.forms.filter((form) => form.active)).flatMap((form) => [
1507
- ...form.review.fields,
1508
- ...form.pages.flatMap((page) => page.fields)
1509
- ]);
1658
+ var findRecordActionPages = (config, actionType) => {
1659
+ const action = config.actions.find((a) => a.type === actionType);
1660
+ if (action?.type === ActionType.REQUEST_CORRECTION) {
1661
+ return [...action.onboardingForm, ...action.additionalDetailsForm];
1662
+ }
1663
+ if (action?.type === ActionType.PRINT_CERTIFICATE) {
1664
+ return action.printForm.pages;
1665
+ }
1666
+ return [];
1667
+ };
1668
+ function isDeclarationActionConfig(action) {
1669
+ return DeclarationActions.safeParse(action.type).success;
1670
+ }
1671
+ function getDeclarationFields(configuration) {
1672
+ return configuration.declaration.pages.flatMap(({ fields }) => fields);
1673
+ }
1674
+ function getDeclarationPages(configuration) {
1675
+ return configuration.declaration.pages;
1676
+ }
1677
+ function getDeclaration(configuration) {
1678
+ return configuration.declaration;
1510
1679
  }
1511
- function getAllPages(configuration) {
1512
- return configuration.actions.flatMap((action) => action.forms.filter((form) => form.active)).flatMap((form) => form.pages);
1680
+ function getActionReviewFields(configuration, actionType) {
1681
+ return getActionReview(configuration, actionType).fields;
1682
+ }
1683
+ function getActionReview(configuration, actionType) {
1684
+ const [actionConfig] = configuration.actions.filter(
1685
+ (a) => a.type === actionType
1686
+ );
1687
+ return getOrThrow(
1688
+ actionConfig?.review,
1689
+ `No review config found for ${actionType}`
1690
+ );
1513
1691
  }
1514
1692
  function validateWorkqueueConfig(workqueueConfigs) {
1515
1693
  workqueueConfigs.map((workqueue) => {
@@ -1523,68 +1701,39 @@ function validateWorkqueueConfig(workqueueConfigs) {
1523
1701
  }
1524
1702
  });
1525
1703
  }
1526
- var findActiveActionForm = (configuration, action) => {
1527
- const actionConfig = configuration.actions.find((a) => a.type === action);
1528
- const form = actionConfig?.forms.find((f) => f.active);
1529
- return form;
1530
- };
1531
- var findActiveActionFormPages = (configuration, action) => {
1532
- return findActiveActionForm(configuration, action)?.pages;
1533
- };
1534
- var getFormFields = (formConfig) => {
1535
- return formConfig.pages.flatMap((p) => p.fields);
1536
- };
1537
- var findActiveActionFormFields = (configuration, action) => {
1538
- const form = findActiveActionForm(configuration, action);
1539
- return form ? getFormFields(form) : void 0;
1540
- };
1541
- var findActiveActionFields = (configuration, action) => {
1542
- const form = findActiveActionForm(configuration, action);
1543
- const reviewFields = form?.review.fields;
1544
- const formFields = form ? getFormFields(form) : void 0;
1545
- const allFields = formFields ? formFields.concat(reviewFields ?? []) : reviewFields;
1546
- return allFields;
1547
- };
1548
- var getActiveActionFormPages = (configuration, action) => {
1549
- return getOrThrow(
1550
- findActiveActionForm(configuration, action)?.pages,
1551
- "Form configuration not found for type: " + configuration.id
1552
- );
1553
- };
1554
- function getActiveActionFields(configuration, action) {
1555
- const fields = findActiveActionFields(configuration, action);
1556
- if (!fields) {
1557
- throw new Error(`No active field config found for action type ${action}`);
1558
- }
1559
- return fields;
1560
- }
1561
- function getEventConfiguration(eventConfigurations, type) {
1562
- const config = eventConfigurations.find((config2) => config2.id === type);
1563
- if (!config) {
1564
- throw new Error(`Event configuration not found for type: ${type}`);
1704
+ function isPageVisible(page, formValues) {
1705
+ if (!page.conditional) {
1706
+ return true;
1565
1707
  }
1566
- return config;
1708
+ return validate(page.conditional, {
1709
+ $form: formValues,
1710
+ $now: (0, import_date_fns2.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" })
1711
+ });
1567
1712
  }
1713
+ var getVisiblePagesFormFields = (formConfig, formData) => {
1714
+ return formConfig.pages.filter((p) => isPageVisible(p, formData)).flatMap((p) => p.fields);
1715
+ };
1568
1716
  function isOptionalUncheckedCheckbox(field2, form) {
1569
1717
  if (field2.type !== FieldType.CHECKBOX || field2.required) {
1570
1718
  return false;
1571
1719
  }
1572
1720
  return !form[field2.id];
1573
1721
  }
1574
- function stripHiddenFields(fields, data) {
1575
- return (0, import_lodash.omitBy)(data, (_2, fieldId) => {
1722
+ function stripHiddenFields(fields, declaration) {
1723
+ return (0, import_lodash.omitBy)(declaration, (_2, fieldId) => {
1576
1724
  const field2 = fields.find((f) => f.id === fieldId);
1577
1725
  if (!field2) {
1578
1726
  return true;
1579
1727
  }
1580
- if (isOptionalUncheckedCheckbox(field2, data)) {
1728
+ if (isOptionalUncheckedCheckbox(field2, declaration)) {
1581
1729
  return true;
1582
1730
  }
1583
- return !isFieldVisible(field2, data);
1731
+ return !isFieldVisible(field2, declaration);
1584
1732
  });
1585
1733
  }
1586
1734
  function findActiveDrafts(event2, drafts) {
1587
- const actions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
1735
+ const actions = event2.actions.slice().filter(({ type }) => type !== ActionType.READ).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
1736
+ console.log("actions", event2.actions);
1588
1737
  const lastAction = actions[actions.length - 1];
1589
1738
  return drafts.filter(({ createdAt }) => createdAt >= lastAction.createdAt).filter(({ eventId }) => eventId === event2.id);
1590
1739
  }
@@ -1596,28 +1745,32 @@ function createEmptyDraft(eventId, draftId, actionType) {
1596
1745
  transactionId: getUUID(),
1597
1746
  action: {
1598
1747
  type: actionType,
1599
- data: {},
1600
- metadata: {},
1748
+ declaration: {},
1749
+ annotation: {},
1601
1750
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
1602
1751
  createdBy: "@todo",
1603
1752
  createdAtLocation: "@todo"
1604
1753
  }
1605
1754
  };
1606
1755
  }
1756
+ function isVerificationPage(page) {
1757
+ return page.type === PageTypes.enum.VERIFICATION;
1758
+ }
1607
1759
 
1608
1760
  // ../commons/src/events/EventConfig.ts
1609
- var EventConfig = import_zod18.z.object({
1610
- id: import_zod18.z.string().describe(
1761
+ var EventConfig = import_zod20.z.object({
1762
+ id: import_zod20.z.string().describe(
1611
1763
  'A machine-readable identifier for the event, e.g. "birth" or "death"'
1612
1764
  ),
1613
1765
  summary: SummaryConfig,
1614
1766
  label: TranslationConfig,
1615
- actions: import_zod18.z.array(ActionConfig),
1616
- workqueues: import_zod18.z.array(WorkqueueConfig),
1617
- deduplication: import_zod18.z.array(DeduplicationConfig).optional().default([]),
1618
- advancedSearch: import_zod18.z.array(AdvancedSearchConfig).optional().default([])
1767
+ actions: import_zod20.z.array(ActionConfig),
1768
+ declaration: DeclarationFormConfig,
1769
+ workqueues: import_zod20.z.array(WorkqueueConfig),
1770
+ deduplication: import_zod20.z.array(DeduplicationConfig).optional().default([]),
1771
+ advancedSearch: import_zod20.z.array(AdvancedSearchConfig).optional().default([])
1619
1772
  }).superRefine((event2, ctx) => {
1620
- const allFields = findPageFields(event2);
1773
+ const allFields = findAllFields(event2);
1621
1774
  const fieldIds = allFields.map((field2) => field2.id);
1622
1775
  const advancedSearchFields = event2.advancedSearch.flatMap(
1623
1776
  (section) => section.fields.flatMap((field2) => field2.fieldId)
@@ -1644,106 +1797,108 @@ var EventConfig = import_zod18.z.object({
1644
1797
  });
1645
1798
 
1646
1799
  // ../commons/src/events/EventConfigInput.ts
1647
- var defineForm = (form) => FormConfig.parse(form);
1648
- var defineFormPage = (formPage) => FormPage.parse(formPage);
1800
+ var defineDeclarationForm = (form) => DeclarationFormConfig.parse(form);
1801
+ var defineActionForm = (actionForm) => ActionFormConfig.parse(actionForm);
1802
+ var definePage = (page) => PageConfig.parse(page);
1803
+ var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
1649
1804
 
1650
1805
  // ../commons/src/events/Draft.ts
1651
- var import_zod21 = require("zod");
1806
+ var import_zod23 = require("zod");
1652
1807
 
1653
1808
  // ../commons/src/events/ActionDocument.ts
1654
- var import_zod19 = require("zod");
1655
- var ActionUpdate = import_zod19.z.record(import_zod19.z.string(), FieldUpdateValue);
1656
- var ActionBase = import_zod19.z.object({
1657
- id: import_zod19.z.string(),
1658
- createdAt: import_zod19.z.string().datetime(),
1659
- createdBy: import_zod19.z.string(),
1660
- data: ActionUpdate,
1661
- metadata: ActionUpdate.optional(),
1662
- createdAtLocation: import_zod19.z.string()
1809
+ var import_zod21 = require("zod");
1810
+ var ActionUpdate = import_zod21.z.record(import_zod21.z.string(), FieldUpdateValue);
1811
+ var ActionBase = import_zod21.z.object({
1812
+ id: import_zod21.z.string(),
1813
+ createdAt: import_zod21.z.string().datetime(),
1814
+ createdBy: import_zod21.z.string(),
1815
+ declaration: ActionUpdate,
1816
+ annotation: ActionUpdate.optional(),
1817
+ createdAtLocation: import_zod21.z.string()
1663
1818
  });
1664
1819
  var AssignedAction = ActionBase.merge(
1665
- import_zod19.z.object({
1666
- type: import_zod19.z.literal(ActionType.ASSIGN),
1667
- assignedTo: import_zod19.z.string()
1820
+ import_zod21.z.object({
1821
+ type: import_zod21.z.literal(ActionType.ASSIGN),
1822
+ assignedTo: import_zod21.z.string()
1668
1823
  })
1669
1824
  );
1670
1825
  var UnassignedAction = ActionBase.merge(
1671
- import_zod19.z.object({
1672
- type: import_zod19.z.literal(ActionType.UNASSIGN)
1826
+ import_zod21.z.object({
1827
+ type: import_zod21.z.literal(ActionType.UNASSIGN)
1673
1828
  })
1674
1829
  );
1675
1830
  var RegisterAction = ActionBase.merge(
1676
- import_zod19.z.object({
1677
- type: import_zod19.z.literal(ActionType.REGISTER),
1678
- identifiers: import_zod19.z.object({
1679
- trackingId: import_zod19.z.string(),
1680
- registrationNumber: import_zod19.z.string()
1831
+ import_zod21.z.object({
1832
+ type: import_zod21.z.literal(ActionType.REGISTER),
1833
+ identifiers: import_zod21.z.object({
1834
+ trackingId: import_zod21.z.string(),
1835
+ registrationNumber: import_zod21.z.string()
1681
1836
  })
1682
1837
  })
1683
1838
  );
1684
1839
  var DeclareAction = ActionBase.merge(
1685
- import_zod19.z.object({
1686
- type: import_zod19.z.literal(ActionType.DECLARE)
1840
+ import_zod21.z.object({
1841
+ type: import_zod21.z.literal(ActionType.DECLARE)
1687
1842
  })
1688
1843
  );
1689
1844
  var ValidateAction = ActionBase.merge(
1690
- import_zod19.z.object({
1691
- type: import_zod19.z.literal(ActionType.VALIDATE)
1845
+ import_zod21.z.object({
1846
+ type: import_zod21.z.literal(ActionType.VALIDATE)
1692
1847
  })
1693
1848
  );
1694
1849
  var RejectAction = ActionBase.merge(
1695
- import_zod19.z.object({
1696
- type: import_zod19.z.literal(ActionType.REJECT)
1850
+ import_zod21.z.object({
1851
+ type: import_zod21.z.literal(ActionType.REJECT)
1697
1852
  })
1698
1853
  );
1699
1854
  var MarkAsDuplicateAction = ActionBase.merge(
1700
- import_zod19.z.object({
1701
- type: import_zod19.z.literal(ActionType.MARKED_AS_DUPLICATE)
1855
+ import_zod21.z.object({
1856
+ type: import_zod21.z.literal(ActionType.MARKED_AS_DUPLICATE)
1702
1857
  })
1703
1858
  );
1704
1859
  var ArchiveAction = ActionBase.merge(
1705
- import_zod19.z.object({
1706
- type: import_zod19.z.literal(ActionType.ARCHIVE)
1860
+ import_zod21.z.object({
1861
+ type: import_zod21.z.literal(ActionType.ARCHIVE)
1707
1862
  })
1708
1863
  );
1709
1864
  var CreatedAction = ActionBase.merge(
1710
- import_zod19.z.object({
1711
- type: import_zod19.z.literal(ActionType.CREATE)
1865
+ import_zod21.z.object({
1866
+ type: import_zod21.z.literal(ActionType.CREATE)
1712
1867
  })
1713
1868
  );
1714
1869
  var NotifiedAction = ActionBase.merge(
1715
- import_zod19.z.object({
1716
- type: import_zod19.z.literal(ActionType.NOTIFY)
1870
+ import_zod21.z.object({
1871
+ type: import_zod21.z.literal(ActionType.NOTIFY)
1717
1872
  })
1718
1873
  );
1719
1874
  var PrintCertificateAction = ActionBase.merge(
1720
- import_zod19.z.object({
1721
- type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE)
1875
+ import_zod21.z.object({
1876
+ type: import_zod21.z.literal(ActionType.PRINT_CERTIFICATE)
1722
1877
  })
1723
1878
  );
1724
1879
  var RequestedCorrectionAction = ActionBase.merge(
1725
- import_zod19.z.object({
1726
- type: import_zod19.z.literal(ActionType.REQUEST_CORRECTION)
1880
+ import_zod21.z.object({
1881
+ type: import_zod21.z.literal(ActionType.REQUEST_CORRECTION)
1727
1882
  })
1728
1883
  );
1729
1884
  var ApprovedCorrectionAction = ActionBase.merge(
1730
- import_zod19.z.object({
1731
- type: import_zod19.z.literal(ActionType.APPROVE_CORRECTION),
1732
- requestId: import_zod19.z.string()
1885
+ import_zod21.z.object({
1886
+ type: import_zod21.z.literal(ActionType.APPROVE_CORRECTION),
1887
+ requestId: import_zod21.z.string()
1733
1888
  })
1734
1889
  );
1735
1890
  var RejectedCorrectionAction = ActionBase.merge(
1736
- import_zod19.z.object({
1737
- type: import_zod19.z.literal(ActionType.REJECT_CORRECTION),
1738
- requestId: import_zod19.z.string()
1891
+ import_zod21.z.object({
1892
+ type: import_zod21.z.literal(ActionType.REJECT_CORRECTION),
1893
+ requestId: import_zod21.z.string()
1739
1894
  })
1740
1895
  );
1741
- var CustomAction = ActionBase.merge(
1742
- import_zod19.z.object({
1743
- type: import_zod19.z.literal(ActionType.CUSTOM)
1896
+ var ReadAction = ActionBase.merge(
1897
+ import_zod21.z.object({
1898
+ type: import_zod21.z.literal(ActionType.READ)
1744
1899
  })
1745
1900
  );
1746
- var ActionDocument = import_zod19.z.discriminatedUnion("type", [
1901
+ var ActionDocument = import_zod21.z.discriminatedUnion("type", [
1747
1902
  CreatedAction,
1748
1903
  ValidateAction,
1749
1904
  RejectAction,
@@ -1758,108 +1913,113 @@ var ActionDocument = import_zod19.z.discriminatedUnion("type", [
1758
1913
  RejectedCorrectionAction,
1759
1914
  UnassignedAction,
1760
1915
  PrintCertificateAction,
1761
- CustomAction
1916
+ ReadAction
1762
1917
  ]);
1763
- var ResolvedUser = import_zod19.z.object({
1764
- id: import_zod19.z.string(),
1765
- role: import_zod19.z.string(),
1766
- name: import_zod19.z.array(
1767
- import_zod19.z.object({
1768
- use: import_zod19.z.string(),
1769
- given: import_zod19.z.array(import_zod19.z.string()),
1770
- family: import_zod19.z.string()
1918
+ var ResolvedUser = import_zod21.z.object({
1919
+ id: import_zod21.z.string(),
1920
+ role: import_zod21.z.string(),
1921
+ name: import_zod21.z.array(
1922
+ import_zod21.z.object({
1923
+ use: import_zod21.z.string(),
1924
+ given: import_zod21.z.array(import_zod21.z.string()),
1925
+ family: import_zod21.z.string()
1771
1926
  })
1772
1927
  )
1773
1928
  });
1774
1929
 
1775
1930
  // ../commons/src/events/ActionInput.ts
1776
- var import_zod20 = require("zod");
1777
- var BaseActionInput = import_zod20.z.object({
1778
- eventId: import_zod20.z.string(),
1779
- transactionId: import_zod20.z.string(),
1780
- data: ActionUpdate,
1781
- metadata: ActionUpdate.optional()
1931
+ var import_zod22 = require("zod");
1932
+ var BaseActionInput = import_zod22.z.object({
1933
+ eventId: import_zod22.z.string(),
1934
+ transactionId: import_zod22.z.string(),
1935
+ declaration: ActionUpdate,
1936
+ annotation: ActionUpdate.optional()
1782
1937
  });
1783
1938
  var CreateActionInput = BaseActionInput.merge(
1784
- import_zod20.z.object({
1785
- type: import_zod20.z.literal(ActionType.CREATE).default(ActionType.CREATE),
1786
- createdAtLocation: import_zod20.z.string()
1939
+ import_zod22.z.object({
1940
+ type: import_zod22.z.literal(ActionType.CREATE).default(ActionType.CREATE),
1941
+ createdAtLocation: import_zod22.z.string()
1787
1942
  })
1788
1943
  );
1789
1944
  var RegisterActionInput = BaseActionInput.merge(
1790
- import_zod20.z.object({
1791
- type: import_zod20.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
1792
- identifiers: import_zod20.z.object({
1793
- trackingId: import_zod20.z.string(),
1794
- registrationNumber: import_zod20.z.string()
1945
+ import_zod22.z.object({
1946
+ type: import_zod22.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
1947
+ identifiers: import_zod22.z.object({
1948
+ trackingId: import_zod22.z.string(),
1949
+ registrationNumber: import_zod22.z.string()
1795
1950
  })
1796
1951
  })
1797
1952
  );
1798
1953
  var ValidateActionInput = BaseActionInput.merge(
1799
- import_zod20.z.object({
1800
- type: import_zod20.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
1801
- duplicates: import_zod20.z.array(import_zod20.z.string())
1954
+ import_zod22.z.object({
1955
+ type: import_zod22.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
1956
+ duplicates: import_zod22.z.array(import_zod22.z.string())
1802
1957
  })
1803
1958
  );
1804
1959
  var NotifyActionInput = BaseActionInput.merge(
1805
- import_zod20.z.object({
1806
- type: import_zod20.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
1960
+ import_zod22.z.object({
1961
+ type: import_zod22.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
1807
1962
  })
1808
1963
  );
1809
1964
  var DeclareActionInput = BaseActionInput.merge(
1810
- import_zod20.z.object({
1811
- type: import_zod20.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
1965
+ import_zod22.z.object({
1966
+ type: import_zod22.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
1812
1967
  })
1813
1968
  );
1814
1969
  var PrintCertificateActionInput = BaseActionInput.merge(
1815
- import_zod20.z.object({
1816
- type: import_zod20.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
1970
+ import_zod22.z.object({
1971
+ type: import_zod22.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
1817
1972
  })
1818
1973
  );
1819
1974
  var RejectDeclarationActionInput = BaseActionInput.merge(
1820
- import_zod20.z.object({
1821
- type: import_zod20.z.literal(ActionType.REJECT).default(ActionType.REJECT)
1975
+ import_zod22.z.object({
1976
+ type: import_zod22.z.literal(ActionType.REJECT).default(ActionType.REJECT)
1822
1977
  })
1823
1978
  );
1824
1979
  var MarkedAsDuplicateActionInput = BaseActionInput.merge(
1825
- import_zod20.z.object({
1826
- type: import_zod20.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
1980
+ import_zod22.z.object({
1981
+ type: import_zod22.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
1827
1982
  })
1828
1983
  );
1829
1984
  var ArchiveActionInput = BaseActionInput.merge(
1830
- import_zod20.z.object({
1831
- type: import_zod20.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE)
1985
+ import_zod22.z.object({
1986
+ type: import_zod22.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE)
1832
1987
  })
1833
1988
  );
1834
1989
  var AssignActionInput = BaseActionInput.merge(
1835
- import_zod20.z.object({
1836
- type: import_zod20.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
1837
- assignedTo: import_zod20.z.string()
1990
+ import_zod22.z.object({
1991
+ type: import_zod22.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
1992
+ assignedTo: import_zod22.z.string()
1838
1993
  })
1839
1994
  );
1840
1995
  var UnassignActionInput = BaseActionInput.merge(
1841
- import_zod20.z.object({
1842
- type: import_zod20.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN)
1996
+ import_zod22.z.object({
1997
+ type: import_zod22.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN)
1843
1998
  })
1844
1999
  );
1845
2000
  var RequestCorrectionActionInput = BaseActionInput.merge(
1846
- import_zod20.z.object({
1847
- type: import_zod20.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
2001
+ import_zod22.z.object({
2002
+ type: import_zod22.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
1848
2003
  })
1849
2004
  );
1850
2005
  var RejectCorrectionActionInput = BaseActionInput.merge(
1851
- import_zod20.z.object({
1852
- requestId: import_zod20.z.string(),
1853
- type: import_zod20.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
2006
+ import_zod22.z.object({
2007
+ requestId: import_zod22.z.string(),
2008
+ type: import_zod22.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
1854
2009
  })
1855
2010
  );
1856
2011
  var ApproveCorrectionActionInput = BaseActionInput.merge(
1857
- import_zod20.z.object({
1858
- requestId: import_zod20.z.string(),
1859
- type: import_zod20.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
2012
+ import_zod22.z.object({
2013
+ requestId: import_zod22.z.string(),
2014
+ type: import_zod22.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
1860
2015
  })
1861
2016
  );
1862
- var ActionInput = import_zod20.z.discriminatedUnion("type", [
2017
+ var ReadActionInput = BaseActionInput.merge(
2018
+ import_zod22.z.object({
2019
+ type: import_zod22.z.literal(ActionType.READ).default(ActionType.READ)
2020
+ })
2021
+ );
2022
+ var ActionInput = import_zod22.z.discriminatedUnion("type", [
1863
2023
  CreateActionInput,
1864
2024
  ValidateActionInput,
1865
2025
  RegisterActionInput,
@@ -1873,49 +2033,50 @@ var ActionInput = import_zod20.z.discriminatedUnion("type", [
1873
2033
  PrintCertificateActionInput,
1874
2034
  RequestCorrectionActionInput,
1875
2035
  RejectCorrectionActionInput,
1876
- ApproveCorrectionActionInput
2036
+ ApproveCorrectionActionInput,
2037
+ ReadActionInput
1877
2038
  ]);
1878
2039
 
1879
2040
  // ../commons/src/events/Draft.ts
1880
- var Draft = import_zod21.z.object({
1881
- id: import_zod21.z.string(),
1882
- eventId: import_zod21.z.string(),
1883
- transactionId: import_zod21.z.string(),
1884
- createdAt: import_zod21.z.string().datetime(),
2041
+ var Draft = import_zod23.z.object({
2042
+ id: import_zod23.z.string(),
2043
+ eventId: import_zod23.z.string(),
2044
+ transactionId: import_zod23.z.string(),
2045
+ createdAt: import_zod23.z.string().datetime(),
1885
2046
  action: ActionBase.extend({
1886
- type: import_zod21.z.enum(Object.values(ActionType))
2047
+ type: ActionTypes
1887
2048
  }).omit({ id: true })
1888
2049
  });
1889
2050
  var DraftInput = BaseActionInput.extend({
1890
- type: import_zod21.z.enum(Object.values(ActionType))
2051
+ type: ActionTypes
1891
2052
  });
1892
2053
 
1893
2054
  // ../commons/src/events/EventInput.ts
1894
- var import_zod22 = require("zod");
1895
- var EventInput = import_zod22.z.object({
1896
- transactionId: import_zod22.z.string(),
1897
- type: import_zod22.z.string()
2055
+ var import_zod24 = require("zod");
2056
+ var EventInput = import_zod24.z.object({
2057
+ transactionId: import_zod24.z.string(),
2058
+ type: import_zod24.z.string()
1898
2059
  });
1899
2060
 
1900
2061
  // ../commons/src/events/EventDocument.ts
1901
- var import_zod23 = require("zod");
1902
- var EventDocument = import_zod23.z.object({
1903
- id: import_zod23.z.string(),
1904
- type: import_zod23.z.string(),
1905
- createdAt: import_zod23.z.string().datetime(),
1906
- updatedAt: import_zod23.z.string().datetime(),
1907
- actions: import_zod23.z.array(ActionDocument),
1908
- trackingId: import_zod23.z.string()
2062
+ var import_zod25 = require("zod");
2063
+ var EventDocument = import_zod25.z.object({
2064
+ id: import_zod25.z.string(),
2065
+ type: import_zod25.z.string(),
2066
+ createdAt: import_zod25.z.string().datetime(),
2067
+ updatedAt: import_zod25.z.string().datetime(),
2068
+ actions: import_zod25.z.array(ActionDocument),
2069
+ trackingId: import_zod25.z.string()
1909
2070
  });
1910
2071
 
1911
2072
  // ../commons/src/events/EventIndex.ts
1912
- var import_zod24 = require("zod");
2073
+ var import_zod26 = require("zod");
1913
2074
  var EventIndex = EventMetadata.extend({
1914
- data: import_zod24.z.record(import_zod24.z.string(), import_zod24.z.any())
2075
+ declaration: import_zod26.z.record(import_zod26.z.string(), import_zod26.z.any())
1915
2076
  });
1916
- var EventSearchIndex = import_zod24.z.record(import_zod24.z.string(), import_zod24.z.any()).and(
1917
- import_zod24.z.object({
1918
- type: import_zod24.z.string()
2077
+ var EventSearchIndex = import_zod26.z.record(import_zod26.z.string(), import_zod26.z.any()).and(
2078
+ import_zod26.z.object({
2079
+ type: import_zod26.z.string()
1919
2080
  // Ensures "type" (event-id) exists and is a string
1920
2081
  })
1921
2082
  );
@@ -1959,7 +2120,7 @@ function getAssignedUserFromActions(actions) {
1959
2120
  return user2;
1960
2121
  }, null);
1961
2122
  }
1962
- function getData(actions) {
2123
+ function aggregateActionDeclarations(actions) {
1963
2124
  const excludedActions = [
1964
2125
  ActionType.REQUEST_CORRECTION,
1965
2126
  ActionType.PRINT_CERTIFICATE
@@ -1973,9 +2134,9 @@ function getData(actions) {
1973
2134
  if (!requestAction) {
1974
2135
  return status;
1975
2136
  }
1976
- return deepMerge(status, requestAction.data);
2137
+ return deepMerge(status, requestAction.declaration);
1977
2138
  }
1978
- return deepMerge(status, action.data);
2139
+ return deepMerge(status, action.declaration);
1979
2140
  }, {});
1980
2141
  }
1981
2142
  function deepDropNulls(obj) {
@@ -2032,7 +2193,7 @@ function getCurrentEventState(event2) {
2032
2193
  modifiedAt: latestAction.createdAt,
2033
2194
  assignedTo: getAssignedUserFromActions(event2.actions),
2034
2195
  updatedBy: latestAction.createdBy,
2035
- data: getData(event2.actions),
2196
+ declaration: aggregateActionDeclarations(event2.actions),
2036
2197
  trackingId: event2.trackingId
2037
2198
  });
2038
2199
  }
@@ -2065,13 +2226,13 @@ function applyDraftsToEventIndex(eventIndex, drafts) {
2065
2226
  }
2066
2227
  return {
2067
2228
  ...eventIndex,
2068
- data: {
2069
- ...eventIndex.data,
2070
- ...activeDrafts[activeDrafts.length - 1].data
2229
+ declaration: {
2230
+ ...eventIndex.declaration,
2231
+ ...activeDrafts[activeDrafts.length - 1].declaration
2071
2232
  }
2072
2233
  };
2073
2234
  }
2074
- function getMetadataForAction({
2235
+ function getActionAnnotation({
2075
2236
  event: event2,
2076
2237
  actionType,
2077
2238
  drafts
@@ -2082,21 +2243,17 @@ function getMetadataForAction({
2082
2243
  ...action ? [action] : [],
2083
2244
  ...eventDrafts.map((draft) => draft.action)
2084
2245
  ].sort();
2085
- const metadata = sorted.reduce((metadata2, action2) => {
2086
- return deepMerge(metadata2, action2.metadata ?? {});
2246
+ const annotation = sorted.reduce((annotation2, action2) => {
2247
+ return deepMerge(annotation2, action2.annotation ?? {});
2087
2248
  }, {});
2088
- return deepDropNulls(metadata);
2249
+ return deepDropNulls(annotation);
2089
2250
  }
2090
2251
 
2091
2252
  // ../commons/src/events/defineConfig.ts
2092
2253
  var defineConfig = (config) => {
2093
2254
  validateWorkqueueConfig(config.workqueues);
2094
2255
  const input = EventConfig.parse(config);
2095
- const pageFields = findInputPageFields(input);
2096
- return EventConfig.parse({
2097
- ...input,
2098
- pageFields
2099
- });
2256
+ return input;
2100
2257
  };
2101
2258
 
2102
2259
  // ../commons/src/events/transactions.ts
@@ -2315,29 +2472,76 @@ function field(fieldId) {
2315
2472
  }
2316
2473
  },
2317
2474
  required: ["$form"]
2475
+ }),
2476
+ isValidEnglishName: () => defineConditional({
2477
+ type: "object",
2478
+ properties: {
2479
+ $form: {
2480
+ type: "object",
2481
+ properties: {
2482
+ [fieldId]: {
2483
+ type: "string",
2484
+ pattern: "^[\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*( [\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*)*$",
2485
+ description: "Name must contain only letters, numbers, and allowed special characters ('._-). No double spaces."
2486
+ }
2487
+ },
2488
+ required: [fieldId]
2489
+ }
2490
+ },
2491
+ required: ["$form"]
2492
+ }),
2493
+ /**
2494
+ * Checks if the field value matches a given regular expression pattern.
2495
+ * @param pattern - The regular expression pattern to match the field value against.
2496
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
2497
+ */
2498
+ matches: (pattern) => defineConditional({
2499
+ type: "object",
2500
+ properties: {
2501
+ $form: {
2502
+ type: "object",
2503
+ properties: {
2504
+ [fieldId]: {
2505
+ type: "string",
2506
+ pattern
2507
+ }
2508
+ },
2509
+ required: [fieldId]
2510
+ }
2511
+ },
2512
+ required: ["$form"]
2513
+ }),
2514
+ isBetween: (min, max) => defineConditional({
2515
+ type: "object",
2516
+ properties: {
2517
+ $form: {
2518
+ type: "object",
2519
+ properties: {
2520
+ [fieldId]: {
2521
+ type: "number",
2522
+ minimum: min,
2523
+ maximum: max
2524
+ }
2525
+ },
2526
+ required: [fieldId]
2527
+ }
2528
+ },
2529
+ required: ["$form"]
2318
2530
  })
2319
2531
  };
2320
2532
  }
2321
2533
 
2322
2534
  // ../commons/src/fixtures/tennis-club-membership-event.ts
2323
- var PRINT_CERTIFICATE_FORM = defineForm({
2535
+ var PRINT_CERTIFICATE_FORM = defineActionForm({
2324
2536
  label: {
2325
2537
  id: "v2.event.tennis-club-membership.action.certificate.form.label",
2326
2538
  defaultMessage: "Tennis club membership certificate collector",
2327
2539
  description: "This is what this form is referred as in the system"
2328
2540
  },
2329
- version: {
2330
- id: "1.0.0",
2331
- label: {
2332
- id: "v2.event.tennis-club-membership.action.certificate.form.version.1",
2333
- defaultMessage: "Version 1",
2334
- description: "This is the first version of the form"
2335
- }
2336
- },
2337
- active: true,
2338
2541
  pages: [
2339
2542
  {
2340
2543
  id: "collector",
2544
+ type: PageTypes.enum.FORM,
2341
2545
  title: {
2342
2546
  id: "v2.event.tennis-club-membership.action.certificate.form.section.who.title",
2343
2547
  defaultMessage: "Print certified copy",
@@ -2352,7 +2556,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
2352
2556
  defaultMessage: "Requester",
2353
2557
  description: "This is the label for the field"
2354
2558
  },
2355
- type: "SELECT",
2559
+ type: FieldType.SELECT,
2356
2560
  options: [
2357
2561
  {
2358
2562
  value: "INFORMANT",
@@ -2429,7 +2633,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
2429
2633
  defaultMessage: "Select Type of ID",
2430
2634
  description: "This is the label for selecting the type of ID"
2431
2635
  },
2432
- type: "SELECT",
2636
+ type: FieldType.SELECT,
2433
2637
  options: [
2434
2638
  {
2435
2639
  value: "PASSPORT",
@@ -2530,7 +2734,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
2530
2734
  defaultMessage: "Passport Details",
2531
2735
  description: "Field for entering Passport details"
2532
2736
  },
2533
- type: "TEXT"
2737
+ type: FieldType.TEXT
2534
2738
  },
2535
2739
  {
2536
2740
  id: "collector.DRIVING_LICENSE.details",
@@ -2581,7 +2785,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
2581
2785
  defaultMessage: "Driving License Details",
2582
2786
  description: "Field for entering Driving License details"
2583
2787
  },
2584
- type: "TEXT"
2788
+ type: FieldType.TEXT
2585
2789
  },
2586
2790
  {
2587
2791
  id: "collector.REFUGEE_NUMBER.details",
@@ -2632,7 +2836,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
2632
2836
  defaultMessage: "Refugee Number Details",
2633
2837
  description: "Field for entering Refugee Number details"
2634
2838
  },
2635
- type: "TEXT"
2839
+ type: FieldType.TEXT
2636
2840
  },
2637
2841
  {
2638
2842
  id: "collector.ALIEN_NUMBER.details",
@@ -2683,7 +2887,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
2683
2887
  defaultMessage: "Alien Number Details",
2684
2888
  description: "Field for entering Alien Number details"
2685
2889
  },
2686
- type: "TEXT"
2890
+ type: FieldType.TEXT
2687
2891
  },
2688
2892
  {
2689
2893
  id: "collector.OTHER.idTypeOther",
@@ -2734,7 +2938,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
2734
2938
  defaultMessage: "Other ID Type (if applicable)",
2735
2939
  description: 'Field for entering ID type if "Other" is selected'
2736
2940
  },
2737
- type: "TEXT"
2941
+ type: FieldType.TEXT
2738
2942
  },
2739
2943
  {
2740
2944
  id: "collector.OTHER.firstName",
@@ -2785,7 +2989,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
2785
2989
  defaultMessage: "First Name",
2786
2990
  description: "This is the label for the first name field"
2787
2991
  },
2788
- type: "TEXT"
2992
+ type: FieldType.TEXT
2789
2993
  },
2790
2994
  {
2791
2995
  id: "collector.OTHER.lastName",
@@ -2836,7 +3040,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
2836
3040
  defaultMessage: "Last Name",
2837
3041
  description: "This is the label for the last name field"
2838
3042
  },
2839
- type: "TEXT"
3043
+ type: FieldType.TEXT
2840
3044
  },
2841
3045
  {
2842
3046
  id: "collector.OTHER.relationshipToMember",
@@ -2887,7 +3091,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
2887
3091
  defaultMessage: "Relationship to Member",
2888
3092
  description: "This is the label for the relationship to member field"
2889
3093
  },
2890
- type: "TEXT"
3094
+ type: FieldType.TEXT
2891
3095
  },
2892
3096
  {
2893
3097
  id: "collector.OTHER.signedAffidavit",
@@ -2938,66 +3142,88 @@ var PRINT_CERTIFICATE_FORM = defineForm({
2938
3142
  defaultMessage: "Signed Affidavit (Optional)",
2939
3143
  description: "This is the label for uploading a signed affidavit"
2940
3144
  },
2941
- type: "FILE"
3145
+ type: FieldType.FILE
2942
3146
  }
2943
3147
  ]
2944
- }
2945
- ],
2946
- review: {
2947
- title: {
2948
- id: "v2.event.tennis-club-membership.action.certificate.form.review.title",
2949
- defaultMessage: "Member certificate collector for {firstname} {surname}",
2950
- description: "Title of the form to show in review page"
2951
3148
  },
2952
- fields: []
2953
- }
2954
- });
2955
- var TENNIS_CLUB_FORM = defineForm({
2956
- label: {
2957
- id: "v2.event.tennis-club-membership.action.declare.form.label",
2958
- defaultMessage: "Tennis club membership application",
2959
- description: "This is what this form is referred as in the system"
2960
- },
2961
- active: true,
2962
- version: {
2963
- id: "1.0.0",
2964
- label: {
2965
- id: "v2.event.tennis-club-membership.action.declare.form.version.1",
2966
- defaultMessage: "Version 1",
2967
- description: "This is the first version of the form"
3149
+ {
3150
+ id: "collector.identity.verify",
3151
+ type: PageTypes.enum.VERIFICATION,
3152
+ conditional: field("collector.requesterId").isEqualTo("INFORMANT"),
3153
+ title: {
3154
+ id: "event.tennis-club-membership.action.print.verifyIdentity",
3155
+ defaultMessage: "Verify their identity",
3156
+ description: "This is the title of the section"
3157
+ },
3158
+ fields: [],
3159
+ actions: {
3160
+ verify: {
3161
+ label: {
3162
+ defaultMessage: "Verified",
3163
+ description: "This is the label for the verification button",
3164
+ id: "v2.event.tennis-club-membership.action.certificate.form.verify"
3165
+ }
3166
+ },
3167
+ cancel: {
3168
+ label: {
3169
+ defaultMessage: "Identity does not match",
3170
+ description: "This is the label for the verification cancellation button",
3171
+ id: "v2.event.tennis-club-membership.action.certificate.form.cancel"
3172
+ },
3173
+ confirmation: {
3174
+ title: {
3175
+ defaultMessage: "Print without proof of ID?",
3176
+ description: "This is the title for the verification cancellation modal",
3177
+ id: "v2.event.tennis-club-membership.action.certificate.form.cancel.confirmation.title"
3178
+ },
3179
+ body: {
3180
+ defaultMessage: "Please be aware that if you proceed, you will be responsible for issuing a certificate without the necessary proof of ID from the collector",
3181
+ description: "This is the body for the verification cancellation modal",
3182
+ id: "v2.event.tennis-club-membership.action.certificate.form.cancel.confirmation.body"
3183
+ }
3184
+ }
3185
+ }
3186
+ }
2968
3187
  }
3188
+ ]
3189
+ });
3190
+ var TENNIS_CLUB_DECLARATION_REVIEW = {
3191
+ title: {
3192
+ id: "v2.event.tennis-club-membership.action.declare.form.review.title",
3193
+ defaultMessage: "{applicant.firstname, select, __EMPTY__ {Member declaration} other {{applicant.surname, select, __EMPTY__ {Member declaration} other {Member declaration for {applicant.firstname} {applicant.surname}}}}}",
3194
+ description: "Title of the review page"
2969
3195
  },
2970
- review: {
2971
- title: {
2972
- id: "v2.event.tennis-club-membership.action.declare.form.review.title",
2973
- defaultMessage: "{applicant.firstname, select, __EMPTY__ {Member declaration} other {{applicant.surname, select, __EMPTY__ {Member declaration} other {Member declaration for {applicant.firstname} {applicant.surname}}}}}",
2974
- description: "Title of the form to show in review page"
3196
+ fields: [
3197
+ {
3198
+ id: "review.comment",
3199
+ type: FieldType.TEXTAREA,
3200
+ label: {
3201
+ defaultMessage: "Comment",
3202
+ id: "v2.event.birth.action.declare.form.review.comment.label",
3203
+ description: "Label for the comment field in the review section"
3204
+ }
2975
3205
  },
2976
- fields: [
2977
- {
2978
- id: "review.comment",
2979
- type: "TEXTAREA",
2980
- label: {
2981
- defaultMessage: "Comment",
2982
- id: "v2.event.birth.action.declare.form.review.comment.label",
2983
- description: "Label for the comment field in the review section"
2984
- }
3206
+ {
3207
+ type: FieldType.SIGNATURE,
3208
+ id: "review.signature",
3209
+ label: {
3210
+ defaultMessage: "Signature of informant",
3211
+ id: "v2.event.birth.action.declare.form.review.signature.label",
3212
+ description: "Label for the signature field in the review section"
2985
3213
  },
2986
- {
2987
- type: "SIGNATURE",
2988
- id: "review.signature",
2989
- label: {
2990
- defaultMessage: "Signature of informant",
2991
- id: "v2.event.birth.action.declare.form.review.signature.label",
2992
- description: "Label for the signature field in the review section"
2993
- },
2994
- signaturePromptLabel: {
2995
- id: "v2.signature.upload.modal.title",
2996
- defaultMessage: "Draw signature",
2997
- description: "Title for the modal to draw signature"
2998
- }
3214
+ signaturePromptLabel: {
3215
+ id: "v2.signature.upload.modal.title",
3216
+ defaultMessage: "Draw signature",
3217
+ description: "Title for the modal to draw signature"
2999
3218
  }
3000
- ]
3219
+ }
3220
+ ]
3221
+ };
3222
+ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
3223
+ label: {
3224
+ id: "v2.event.tennis-club-membership.action.declare.form.label",
3225
+ defaultMessage: "Tennis club membership application",
3226
+ description: "This is what this form is referred as in the system"
3001
3227
  },
3002
3228
  pages: [
3003
3229
  {
@@ -3010,7 +3236,7 @@ var TENNIS_CLUB_FORM = defineForm({
3010
3236
  fields: [
3011
3237
  {
3012
3238
  id: "applicant.firstname",
3013
- type: "TEXT",
3239
+ type: FieldType.TEXT,
3014
3240
  required: true,
3015
3241
  conditionals: [],
3016
3242
  label: {
@@ -3021,7 +3247,7 @@ var TENNIS_CLUB_FORM = defineForm({
3021
3247
  },
3022
3248
  {
3023
3249
  id: "applicant.surname",
3024
- type: "TEXT",
3250
+ type: FieldType.TEXT,
3025
3251
  required: true,
3026
3252
  conditionals: [],
3027
3253
  label: {
@@ -3064,7 +3290,7 @@ var TENNIS_CLUB_FORM = defineForm({
3064
3290
  },
3065
3291
  {
3066
3292
  id: "applicant.image",
3067
- type: "FILE",
3293
+ type: FieldType.FILE,
3068
3294
  required: false,
3069
3295
  label: {
3070
3296
  defaultMessage: "Applicant's profile picture",
@@ -3085,6 +3311,27 @@ var TENNIS_CLUB_FORM = defineForm({
3085
3311
  }
3086
3312
  ]
3087
3313
  },
3314
+ {
3315
+ id: "senior-pass",
3316
+ conditional: field("applicant.dob").isBefore().date("1950-01-01"),
3317
+ title: {
3318
+ id: "v2.event.tennis-club-membership.action.declare.form.section.senior-pass.title",
3319
+ defaultMessage: "Assign senior pass for applicant",
3320
+ description: "This is the title of the section"
3321
+ },
3322
+ fields: [
3323
+ {
3324
+ id: "senior-pass.id",
3325
+ type: FieldType.TEXT,
3326
+ required: true,
3327
+ label: {
3328
+ defaultMessage: "Senior pass ID",
3329
+ description: "This is the label for the field",
3330
+ id: "v2.event.tennis-club-membership.action.declare.form.section.senior-pass.field.id.label"
3331
+ }
3332
+ }
3333
+ ]
3334
+ },
3088
3335
  {
3089
3336
  id: "recommender",
3090
3337
  title: {
@@ -3106,7 +3353,7 @@ var TENNIS_CLUB_FORM = defineForm({
3106
3353
  },
3107
3354
  {
3108
3355
  id: "recommender.firstname",
3109
- type: "TEXT",
3356
+ type: FieldType.TEXT,
3110
3357
  required: true,
3111
3358
  conditionals: [
3112
3359
  {
@@ -3122,7 +3369,7 @@ var TENNIS_CLUB_FORM = defineForm({
3122
3369
  },
3123
3370
  {
3124
3371
  id: "recommender.surname",
3125
- type: "TEXT",
3372
+ type: FieldType.TEXT,
3126
3373
  required: true,
3127
3374
  conditionals: [
3128
3375
  {
@@ -3138,7 +3385,7 @@ var TENNIS_CLUB_FORM = defineForm({
3138
3385
  },
3139
3386
  {
3140
3387
  id: "recommender.id",
3141
- type: "TEXT",
3388
+ type: FieldType.TEXT,
3142
3389
  required: true,
3143
3390
  conditionals: [
3144
3391
  {
@@ -3246,7 +3493,7 @@ var tennisClubMembershipEvent = defineConfig({
3246
3493
  description: "This is shown as the action name anywhere the user can trigger the action from",
3247
3494
  id: "event.tennis-club-membership.action.declare.label"
3248
3495
  },
3249
- forms: [TENNIS_CLUB_FORM]
3496
+ review: TENNIS_CLUB_DECLARATION_REVIEW
3250
3497
  },
3251
3498
  {
3252
3499
  type: ActionType.VALIDATE,
@@ -3255,7 +3502,7 @@ var tennisClubMembershipEvent = defineConfig({
3255
3502
  description: "This is shown as the action name anywhere the user can trigger the action from",
3256
3503
  id: "event.tennis-club-membership.action.validate.label"
3257
3504
  },
3258
- forms: [TENNIS_CLUB_FORM]
3505
+ review: TENNIS_CLUB_DECLARATION_REVIEW
3259
3506
  },
3260
3507
  {
3261
3508
  type: ActionType.REGISTER,
@@ -3264,7 +3511,7 @@ var tennisClubMembershipEvent = defineConfig({
3264
3511
  description: "This is shown as the action name anywhere the user can trigger the action from",
3265
3512
  id: "event.tennis-club-membership.action.register.label"
3266
3513
  },
3267
- forms: [TENNIS_CLUB_FORM]
3514
+ review: TENNIS_CLUB_DECLARATION_REVIEW
3268
3515
  },
3269
3516
  {
3270
3517
  type: ActionType.REQUEST_CORRECTION,
@@ -3273,10 +3520,10 @@ var tennisClubMembershipEvent = defineConfig({
3273
3520
  description: "This is shown as the action name anywhere the user can trigger the action from",
3274
3521
  id: "event.tennis-club-membership.action.correction.request.label"
3275
3522
  },
3276
- forms: [TENNIS_CLUB_FORM],
3277
3523
  onboardingForm: [
3278
3524
  {
3279
3525
  id: "correction-requester",
3526
+ type: PageTypes.enum.FORM,
3280
3527
  title: {
3281
3528
  id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
3282
3529
  defaultMessage: "Correction requester",
@@ -3340,6 +3587,7 @@ var tennisClubMembershipEvent = defineConfig({
3340
3587
  },
3341
3588
  {
3342
3589
  id: "identity-check",
3590
+ type: PageTypes.enum.FORM,
3343
3591
  title: {
3344
3592
  id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
3345
3593
  defaultMessage: "Verify their identity",
@@ -3382,6 +3630,7 @@ var tennisClubMembershipEvent = defineConfig({
3382
3630
  additionalDetailsForm: [
3383
3631
  {
3384
3632
  id: "correction-request.supporting-documents",
3633
+ type: PageTypes.enum.FORM,
3385
3634
  title: {
3386
3635
  id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
3387
3636
  defaultMessage: "Upload supporting documents",
@@ -3399,7 +3648,7 @@ var tennisClubMembershipEvent = defineConfig({
3399
3648
  },
3400
3649
  {
3401
3650
  id: "correction.supportingDocs",
3402
- type: "FILE",
3651
+ type: FieldType.FILE,
3403
3652
  label: {
3404
3653
  id: "correction.corrector.title",
3405
3654
  defaultMessage: "Upload supporting documents",
@@ -3443,6 +3692,7 @@ var tennisClubMembershipEvent = defineConfig({
3443
3692
  },
3444
3693
  {
3445
3694
  id: "correction-request.additional-details",
3695
+ type: PageTypes.enum.FORM,
3446
3696
  title: {
3447
3697
  id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
3448
3698
  defaultMessage: "Reason for correction",
@@ -3451,7 +3701,7 @@ var tennisClubMembershipEvent = defineConfig({
3451
3701
  fields: [
3452
3702
  {
3453
3703
  id: "correction.request.reason",
3454
- type: "TEXT",
3704
+ type: FieldType.TEXT,
3455
3705
  label: {
3456
3706
  id: "correction.reason.title",
3457
3707
  defaultMessage: "Reason for correction?",
@@ -3464,7 +3714,6 @@ var tennisClubMembershipEvent = defineConfig({
3464
3714
  },
3465
3715
  {
3466
3716
  type: ActionType.APPROVE_CORRECTION,
3467
- forms: [TENNIS_CLUB_FORM],
3468
3717
  label: {
3469
3718
  defaultMessage: "Approve correction",
3470
3719
  description: "This is shown as the action name anywhere the user can trigger the action from",
@@ -3478,7 +3727,7 @@ var tennisClubMembershipEvent = defineConfig({
3478
3727
  defaultMessage: "Print certificate",
3479
3728
  description: "This is shown as the action name anywhere the user can trigger the action from"
3480
3729
  },
3481
- forms: [PRINT_CERTIFICATE_FORM],
3730
+ printForm: PRINT_CERTIFICATE_FORM,
3482
3731
  conditionals: [
3483
3732
  {
3484
3733
  type: "SHOW",
@@ -3525,8 +3774,7 @@ var tennisClubMembershipEvent = defineConfig({
3525
3774
  id: "v2.event.tennis-club-membership.action.archive.label",
3526
3775
  defaultMessage: "Archive",
3527
3776
  description: "This is shown as the action name anywhere the user can trigger the action from"
3528
- },
3529
- forms: [TENNIS_CLUB_FORM]
3777
+ }
3530
3778
  },
3531
3779
  {
3532
3780
  type: ActionType.REJECT,
@@ -3534,8 +3782,7 @@ var tennisClubMembershipEvent = defineConfig({
3534
3782
  id: "v2.event.tennis-club-membership.action.reject.label",
3535
3783
  defaultMessage: "Reject",
3536
3784
  description: "This is shown as the action name anywhere the user can trigger the action from"
3537
- },
3538
- forms: [TENNIS_CLUB_FORM]
3785
+ }
3539
3786
  }
3540
3787
  ],
3541
3788
  advancedSearch: [
@@ -3551,20 +3798,49 @@ var tennisClubMembershipEvent = defineConfig({
3551
3798
  }
3552
3799
  ]
3553
3800
  }
3554
- ]
3801
+ ],
3802
+ declaration: TENNIS_CLUB_DECLARATION_FORM
3555
3803
  });
3556
3804
 
3557
3805
  // ../commons/src/events/test.utils.ts
3558
- function generateActionInput(configuration, action) {
3559
- const fields = findActiveActionFormFields(configuration, action) ?? [];
3560
- const data = fields.reduce(
3806
+ function fieldConfigsToActionAnnotation(fields) {
3807
+ return fields.reduce(
3561
3808
  (acc, field2, i) => ({
3562
3809
  ...acc,
3563
3810
  [field2.id]: mapFieldTypeToMockValue(field2, i)
3564
3811
  }),
3565
3812
  {}
3566
3813
  );
3567
- return stripHiddenFields(fields, data);
3814
+ }
3815
+ function generateActionInput(configuration, action) {
3816
+ const parsed = DeclarationUpdateActions.safeParse(action);
3817
+ if (parsed.success) {
3818
+ const fields = getDeclarationFields(configuration);
3819
+ const annotation = fieldConfigsToActionAnnotation(fields);
3820
+ return stripHiddenFields(fields, annotation);
3821
+ }
3822
+ console.warn(`${action} is not a declaration action. Setting data as {}.`);
3823
+ return {};
3824
+ }
3825
+ function generateActionMetadataInput(configuration, action) {
3826
+ const actionConfig = configuration.actions.find(
3827
+ (actionConfig2) => actionConfig2.type === action
3828
+ );
3829
+ const annotationFields = actionConfig ? getActionAnnotationFields(actionConfig) : [];
3830
+ const annotation = fieldConfigsToActionAnnotation(annotationFields);
3831
+ const visibleVerificationPageIds = (findRecordActionPages(configuration, action) ?? []).filter((page) => isVerificationPage(page)).filter((page) => isPageVisible(page, annotation)).map((page) => page.id) ?? [];
3832
+ const visiblePageVerificationMap = visibleVerificationPageIds.reduce(
3833
+ (acc, pageId) => ({
3834
+ ...acc,
3835
+ [pageId]: true
3836
+ }),
3837
+ {}
3838
+ );
3839
+ const fieldBasedPayload = stripHiddenFields(annotationFields, annotation);
3840
+ return {
3841
+ ...fieldBasedPayload,
3842
+ ...visiblePageVerificationMap
3843
+ };
3568
3844
  }
3569
3845
  var eventPayloadGenerator = {
3570
3846
  create: (input = {}) => ({
@@ -3584,13 +3860,13 @@ var eventPayloadGenerator = {
3584
3860
  transactionId: getUUID(),
3585
3861
  action: {
3586
3862
  type: ActionType.REQUEST_CORRECTION,
3587
- data: {
3863
+ declaration: {
3588
3864
  "applicant.firstname": "Max",
3589
3865
  "applicant.surname": "McLaren",
3590
3866
  "applicant.dob": "2020-01-02",
3591
3867
  "recommender.none": true
3592
3868
  },
3593
- metadata: {
3869
+ annotation: {
3594
3870
  "correction.requester.relationship": "ANOTHER_AGENT",
3595
3871
  "correction.request.reason": "Child's name was incorrect"
3596
3872
  },
@@ -3605,41 +3881,78 @@ var eventPayloadGenerator = {
3605
3881
  declare: (eventId, input = {}) => ({
3606
3882
  type: ActionType.DECLARE,
3607
3883
  transactionId: input.transactionId ?? getUUID(),
3608
- data: input.data ?? generateActionInput(tennisClubMembershipEvent, ActionType.DECLARE),
3884
+ declaration: input.declaration ?? generateActionInput(tennisClubMembershipEvent, ActionType.DECLARE),
3885
+ annotation: input.annotation ?? generateActionMetadataInput(
3886
+ tennisClubMembershipEvent,
3887
+ ActionType.DECLARE
3888
+ ),
3609
3889
  eventId
3610
3890
  }),
3891
+ /**
3892
+ * Notify allows sending incomplete data. Think it as 'partial declare' for now.
3893
+ */
3894
+ notify: (eventId, input = {}) => {
3895
+ let declaration = input.declaration;
3896
+ if (!declaration) {
3897
+ const partialDeclaration = (0, import_lodash2.omitBy)(
3898
+ generateActionInput(tennisClubMembershipEvent, ActionType.DECLARE),
3899
+ import_lodash2.isString
3900
+ );
3901
+ declaration = partialDeclaration;
3902
+ }
3903
+ return {
3904
+ type: ActionType.NOTIFY,
3905
+ transactionId: input.transactionId ?? getUUID(),
3906
+ declaration,
3907
+ eventId
3908
+ };
3909
+ },
3611
3910
  validate: (eventId, input = {}) => ({
3612
3911
  type: ActionType.VALIDATE,
3613
3912
  transactionId: input.transactionId ?? getUUID(),
3614
- data: input.data ?? generateActionInput(tennisClubMembershipEvent, ActionType.VALIDATE),
3913
+ declaration: input.declaration ?? generateActionInput(tennisClubMembershipEvent, ActionType.VALIDATE),
3914
+ annotation: input.annotation ?? generateActionMetadataInput(
3915
+ tennisClubMembershipEvent,
3916
+ ActionType.VALIDATE
3917
+ ),
3615
3918
  duplicates: [],
3616
3919
  eventId
3617
3920
  }),
3618
3921
  archive: (eventId, input = {}, isDuplicate) => ({
3619
3922
  type: ActionType.ARCHIVE,
3620
3923
  transactionId: input.transactionId ?? getUUID(),
3621
- data: input.data ?? generateActionInput(tennisClubMembershipEvent, ActionType.ARCHIVE),
3622
- metadata: { isDuplicate: isDuplicate ?? false },
3924
+ declaration: {},
3925
+ // @TODO: Check whether generator is needed?
3926
+ annotation: { isDuplicate: isDuplicate ?? false },
3623
3927
  duplicates: [],
3624
3928
  eventId
3625
3929
  }),
3626
3930
  reject: (eventId, input = {}) => ({
3627
3931
  type: ActionType.REJECT,
3628
3932
  transactionId: input.transactionId ?? getUUID(),
3629
- data: input.data ?? generateActionInput(tennisClubMembershipEvent, ActionType.REJECT),
3933
+ declaration: {},
3934
+ annotation: input.annotation ?? generateActionMetadataInput(
3935
+ tennisClubMembershipEvent,
3936
+ ActionType.REJECT
3937
+ ),
3630
3938
  duplicates: [],
3631
3939
  eventId
3632
3940
  }),
3633
3941
  register: (eventId, input = {}) => ({
3634
3942
  type: ActionType.REGISTER,
3635
3943
  transactionId: input.transactionId ?? getUUID(),
3636
- data: input.data ?? generateActionInput(tennisClubMembershipEvent, ActionType.REGISTER),
3944
+ declaration: input.declaration ?? generateActionInput(tennisClubMembershipEvent, ActionType.REGISTER),
3945
+ annotation: input.annotation ?? generateActionMetadataInput(
3946
+ tennisClubMembershipEvent,
3947
+ ActionType.REGISTER
3948
+ ),
3637
3949
  eventId
3638
3950
  }),
3639
3951
  printCertificate: (eventId, input = {}) => ({
3640
3952
  type: ActionType.PRINT_CERTIFICATE,
3641
3953
  transactionId: input.transactionId ?? getUUID(),
3642
- data: input.data ?? generateActionInput(
3954
+ declaration: {},
3955
+ annotation: input.annotation ?? generateActionMetadataInput(
3643
3956
  tennisClubMembershipEvent,
3644
3957
  ActionType.PRINT_CERTIFICATE
3645
3958
  ),
@@ -3649,17 +3962,21 @@ var eventPayloadGenerator = {
3649
3962
  request: (eventId, input = {}) => ({
3650
3963
  type: ActionType.REQUEST_CORRECTION,
3651
3964
  transactionId: input.transactionId ?? getUUID(),
3652
- data: input.data ?? generateActionInput(
3965
+ declaration: input.declaration ?? generateActionInput(
3966
+ tennisClubMembershipEvent,
3967
+ ActionType.REQUEST_CORRECTION
3968
+ ),
3969
+ annotation: input.annotation ?? generateActionMetadataInput(
3653
3970
  tennisClubMembershipEvent,
3654
3971
  ActionType.REQUEST_CORRECTION
3655
3972
  ),
3656
- metadata: {},
3657
3973
  eventId
3658
3974
  }),
3659
3975
  approve: (eventId, requestId, input = {}) => ({
3660
3976
  type: ActionType.APPROVE_CORRECTION,
3661
3977
  transactionId: input.transactionId ?? getUUID(),
3662
- data: input.data ?? generateActionInput(
3978
+ declaration: {},
3979
+ annotation: input.annotation ?? generateActionMetadataInput(
3663
3980
  tennisClubMembershipEvent,
3664
3981
  ActionType.APPROVE_CORRECTION
3665
3982
  ),
@@ -3669,7 +3986,8 @@ var eventPayloadGenerator = {
3669
3986
  reject: (eventId, requestId, input = {}) => ({
3670
3987
  type: ActionType.REJECT_CORRECTION,
3671
3988
  transactionId: input.transactionId ?? getUUID(),
3672
- data: input.data ?? generateActionInput(
3989
+ declaration: {},
3990
+ annotation: input.annotation ?? generateActionMetadataInput(
3673
3991
  tennisClubMembershipEvent,
3674
3992
  ActionType.REJECT_CORRECTION
3675
3993
  ),
@@ -3691,8 +4009,8 @@ function generateActionDocument({
3691
4009
  createdBy: getUUID(),
3692
4010
  id: getUUID(),
3693
4011
  createdAtLocation: "TODO",
3694
- data: generateActionInput(configuration, action),
3695
- metadata: {},
4012
+ declaration: generateActionInput(configuration, action),
4013
+ annotation: {},
3696
4014
  ...defaults
3697
4015
  };
3698
4016
  switch (action) {
@@ -3720,8 +4038,6 @@ function generateActionDocument({
3720
4038
  return { ...actionBase, requestId: getUUID(), type: action };
3721
4039
  case ActionType.REJECT_CORRECTION:
3722
4040
  return { ...actionBase, requestId: getUUID(), type: action };
3723
- case ActionType.CUSTOM:
3724
- return { ...actionBase, type: action };
3725
4041
  case ActionType.REGISTER:
3726
4042
  return {
3727
4043
  ...actionBase,
@@ -3751,7 +4067,7 @@ function generateEventDocument({
3751
4067
  updatedAt: new Date(Date.now() - 1e3).toISOString()
3752
4068
  };
3753
4069
  }
3754
- function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE, data = {}) {
4070
+ function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE, declaration = {}) {
3755
4071
  const action = generateActionDocument({
3756
4072
  configuration: tennisClubMembershipEvent,
3757
4073
  action: actionType
@@ -3761,9 +4077,9 @@ function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE, da
3761
4077
  transactionId: getUUID(),
3762
4078
  action: {
3763
4079
  ...action,
3764
- data: {
3765
- ...action.data,
3766
- ...data
4080
+ declaration: {
4081
+ ...action.declaration,
4082
+ ...declaration
3767
4083
  }
3768
4084
  },
3769
4085
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -3780,7 +4096,7 @@ var eventQueryDataGenerator = (overrides = {}) => ({
3780
4096
  modifiedAt: overrides.modifiedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
3781
4097
  assignedTo: overrides.assignedTo ?? null,
3782
4098
  updatedBy: overrides.updatedBy ?? getUUID(),
3783
- data: overrides.data ?? {
4099
+ declaration: overrides.declaration ?? {
3784
4100
  "recommender.none": true,
3785
4101
  "applicant.firstname": "Danny",
3786
4102
  "applicant.surname": "Doe",
@@ -3788,6 +4104,11 @@ var eventQueryDataGenerator = (overrides = {}) => ({
3788
4104
  },
3789
4105
  trackingId: overrides.trackingId ?? "M3F8YQ"
3790
4106
  });
4107
+ var generateTranslationConfig = (message) => ({
4108
+ defaultMessage: message,
4109
+ description: "Description for ${message}",
4110
+ id: message
4111
+ });
3791
4112
 
3792
4113
  // ../commons/src/events/TemplateConfig.ts
3793
4114
  function isTemplateVariable(value) {