@opencrvs/toolkit 1.8.0-rc.faeb298 → 1.8.0-rc.fb261c5
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.
- package/dist/commons/api/router.d.ts +5489 -457
- package/dist/commons/conditionals/conditionals.d.ts +1 -0
- package/dist/commons/conditionals/validate-address.test.d.ts +2 -0
- package/dist/commons/conditionals/validate.d.ts +27 -0
- package/dist/commons/conditionals/validate.test.d.ts +2 -0
- package/dist/commons/events/ActionConfig.d.ts +4174 -1134
- package/dist/commons/events/ActionDocument.d.ts +2147 -71
- package/dist/commons/events/ActionInput.d.ts +3236 -116
- package/dist/commons/events/ActionType.d.ts +6 -1
- package/dist/commons/events/CompositeFieldValue.d.ts +152 -2
- package/dist/commons/events/Draft.d.ts +300 -12
- package/dist/commons/events/EventConfig.d.ts +340 -148
- package/dist/commons/events/EventConfigInput.d.ts +2 -2
- package/dist/commons/events/EventDocument.d.ts +2645 -125
- package/dist/commons/events/FieldConfig.d.ts +139 -59
- package/dist/commons/events/FieldTypeMapping.d.ts +136 -5
- package/dist/commons/events/FieldValue.d.ts +76 -2
- package/dist/commons/events/FormConfig.d.ts +133 -47
- package/dist/commons/events/defineConfig.d.ts +53 -25
- package/dist/commons/events/test.utils.d.ts +164 -16
- package/dist/commons/events/utils.d.ts +144 -4
- package/dist/conditionals/index.js +17 -0
- package/dist/events/index.js +418 -139
- package/package.json +1 -1
package/dist/events/index.js
CHANGED
@@ -40,9 +40,11 @@ __export(events_exports, {
|
|
40
40
|
ActionUpdate: () => ActionUpdate,
|
41
41
|
AddressFieldUpdateValue: () => AddressFieldUpdateValue,
|
42
42
|
AddressFieldValue: () => AddressFieldValue,
|
43
|
+
AddressType: () => AddressType,
|
44
|
+
AdministrativeAreas: () => AdministrativeAreas,
|
43
45
|
AdvancedSearchConfig: () => AdvancedSearchConfig,
|
44
46
|
ApproveCorrectionActionInput: () => ApproveCorrectionActionInput,
|
45
|
-
|
47
|
+
ArchiveActionInput: () => ArchiveActionInput,
|
46
48
|
BaseActionInput: () => BaseActionInput,
|
47
49
|
CertificateConfig: () => CertificateConfig,
|
48
50
|
CertificateTemplateConfig: () => CertificateTemplateConfig,
|
@@ -50,6 +52,7 @@ __export(events_exports, {
|
|
50
52
|
Clause: () => Clause,
|
51
53
|
Conditional: () => Conditional,
|
52
54
|
ConditionalType: () => ConditionalType,
|
55
|
+
DataFieldValue: () => DataFieldValue,
|
53
56
|
DateValue: () => DateValue,
|
54
57
|
DeclareActionInput: () => DeclareActionInput,
|
55
58
|
DeduplicationConfig: () => DeduplicationConfig,
|
@@ -75,14 +78,18 @@ __export(events_exports, {
|
|
75
78
|
FileFieldWithOptionValue: () => FileFieldWithOptionValue,
|
76
79
|
FormConfig: () => FormConfig,
|
77
80
|
FormPage: () => FormPage,
|
81
|
+
FormPageConfig: () => FormPageConfig,
|
82
|
+
FormPageType: () => FormPageType,
|
83
|
+
GenericAddressUpdateValue: () => GenericAddressUpdateValue,
|
84
|
+
GenericAddressValue: () => GenericAddressValue,
|
78
85
|
GeographicalArea: () => GeographicalArea,
|
86
|
+
ImageMimeType: () => ImageMimeType,
|
79
87
|
LanguageConfig: () => LanguageConfig,
|
88
|
+
LatentActions: () => LatentActions,
|
80
89
|
MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
|
90
|
+
MimeType: () => MimeType,
|
81
91
|
NotifyActionInput: () => NotifyActionInput,
|
82
92
|
NumberFieldValue: () => NumberFieldValue,
|
83
|
-
PageBase: () => PageBase,
|
84
|
-
PageConfig: () => PageConfig,
|
85
|
-
PageType: () => PageType,
|
86
93
|
PrintCertificateActionInput: () => PrintCertificateActionInput,
|
87
94
|
RegisterActionInput: () => RegisterActionInput,
|
88
95
|
RejectCorrectionActionInput: () => RejectCorrectionActionInput,
|
@@ -100,17 +107,20 @@ __export(events_exports, {
|
|
100
107
|
UrbanAddressValue: () => UrbanAddressValue,
|
101
108
|
ValidateActionInput: () => ValidateActionInput,
|
102
109
|
VerificationPage: () => VerificationPage,
|
110
|
+
VerificationPageConfig: () => VerificationPageConfig,
|
103
111
|
WorkqueueConfig: () => WorkqueueConfig,
|
104
112
|
alwaysTrue: () => alwaysTrue,
|
105
113
|
and: () => and,
|
106
114
|
applyDraftsToEventIndex: () => applyDraftsToEventIndex,
|
107
115
|
compositeFieldTypes: () => compositeFieldTypes,
|
116
|
+
createEmptyDraft: () => createEmptyDraft,
|
108
117
|
createValidationSchema: () => createValidationSchema,
|
109
118
|
deepDropNulls: () => deepDropNulls,
|
110
119
|
defineConditional: () => defineConditional,
|
111
120
|
defineConfig: () => defineConfig,
|
112
121
|
defineForm: () => defineForm,
|
113
|
-
|
122
|
+
defineFormPage: () => defineFormPage,
|
123
|
+
errorMessages: () => errorMessages,
|
114
124
|
event: () => event,
|
115
125
|
eventMetadataLabelMap: () => eventMetadataLabelMap,
|
116
126
|
eventPayloadGenerator: () => eventPayloadGenerator,
|
@@ -122,14 +132,19 @@ __export(events_exports, {
|
|
122
132
|
findActiveActionForm: () => findActiveActionForm,
|
123
133
|
findActiveActionFormFields: () => findActiveActionFormFields,
|
124
134
|
findActiveActionFormPages: () => findActiveActionFormPages,
|
135
|
+
findActiveActionVerificationPageIds: () => findActiveActionVerificationPageIds,
|
136
|
+
findActiveDrafts: () => findActiveDrafts,
|
125
137
|
findInputPageFields: () => findInputPageFields,
|
126
138
|
findPageFields: () => findPageFields,
|
127
139
|
generateActionDocument: () => generateActionDocument,
|
128
140
|
generateActionInput: () => generateActionInput,
|
141
|
+
generateActionMetadataInput: () => generateActionMetadataInput,
|
129
142
|
generateEventDocument: () => generateEventDocument,
|
130
143
|
generateEventDraftDocument: () => generateEventDraftDocument,
|
131
144
|
generateTransactionId: () => generateTransactionId,
|
145
|
+
generateTranslationConfig: () => generateTranslationConfig,
|
132
146
|
getActiveActionFields: () => getActiveActionFields,
|
147
|
+
getActiveActionFormPages: () => getActiveActionFormPages,
|
133
148
|
getAllFields: () => getAllFields,
|
134
149
|
getAllPages: () => getAllPages,
|
135
150
|
getCurrentEventState: () => getCurrentEventState,
|
@@ -167,6 +182,7 @@ __export(events_exports, {
|
|
167
182
|
isTextAreaFieldType: () => isTextAreaFieldType,
|
168
183
|
isTextFieldType: () => isTextFieldType,
|
169
184
|
isUndeclaredDraft: () => isUndeclaredDraft,
|
185
|
+
mapFieldTypeToEmptyValue: () => mapFieldTypeToEmptyValue,
|
170
186
|
mapFieldTypeToMockValue: () => mapFieldTypeToMockValue,
|
171
187
|
mapFieldTypeToZod: () => mapFieldTypeToZod,
|
172
188
|
not: () => not,
|
@@ -269,6 +285,10 @@ var GeographicalArea = {
|
|
269
285
|
URBAN: "URBAN",
|
270
286
|
RURAL: "RURAL"
|
271
287
|
};
|
288
|
+
var AddressType = {
|
289
|
+
DOMESTIC: "DOMESTIC",
|
290
|
+
INTERNATIONAL: "INTERNATIONAL"
|
291
|
+
};
|
272
292
|
var FileFieldValue = import_zod3.z.object({
|
273
293
|
filename: import_zod3.z.string(),
|
274
294
|
originalFilename: import_zod3.z.string(),
|
@@ -276,6 +296,7 @@ var FileFieldValue = import_zod3.z.object({
|
|
276
296
|
});
|
277
297
|
var AdminStructure = import_zod3.z.object({
|
278
298
|
country: import_zod3.z.string(),
|
299
|
+
addressType: import_zod3.z.literal(AddressType.DOMESTIC),
|
279
300
|
province: import_zod3.z.string(),
|
280
301
|
district: import_zod3.z.string()
|
281
302
|
});
|
@@ -303,14 +324,33 @@ var RuralAddressUpdateValue = AdminStructure.extend({
|
|
303
324
|
urbanOrRural: import_zod3.z.literal(GeographicalArea.RURAL),
|
304
325
|
village: import_zod3.z.string().nullish()
|
305
326
|
});
|
306
|
-
var
|
307
|
-
|
308
|
-
|
309
|
-
|
327
|
+
var GenericAddressValue = import_zod3.z.object({
|
328
|
+
country: import_zod3.z.string(),
|
329
|
+
addressType: import_zod3.z.literal(AddressType.INTERNATIONAL),
|
330
|
+
state: import_zod3.z.string(),
|
331
|
+
district2: import_zod3.z.string(),
|
332
|
+
cityOrTown: import_zod3.z.string().optional(),
|
333
|
+
addressLine1: import_zod3.z.string().optional(),
|
334
|
+
addressLine2: import_zod3.z.string().optional(),
|
335
|
+
addressLine3: import_zod3.z.string().optional(),
|
336
|
+
postcodeOrZip: import_zod3.z.string().optional()
|
337
|
+
});
|
338
|
+
var AddressFieldValue = import_zod3.z.discriminatedUnion("urbanOrRural", [UrbanAddressValue, RuralAddressValue]).or(GenericAddressValue);
|
339
|
+
var GenericAddressUpdateValue = import_zod3.z.object({
|
340
|
+
country: import_zod3.z.string(),
|
341
|
+
addressType: import_zod3.z.literal(AddressType.INTERNATIONAL),
|
342
|
+
state: import_zod3.z.string(),
|
343
|
+
district2: import_zod3.z.string(),
|
344
|
+
cityOrTown: import_zod3.z.string().nullish(),
|
345
|
+
addressLine1: import_zod3.z.string().nullish(),
|
346
|
+
addressLine2: import_zod3.z.string().nullish(),
|
347
|
+
addressLine3: import_zod3.z.string().nullish(),
|
348
|
+
postcodeOrZip: import_zod3.z.string().nullish()
|
349
|
+
});
|
310
350
|
var AddressFieldUpdateValue = import_zod3.z.discriminatedUnion("urbanOrRural", [
|
311
351
|
UrbanAddressUpdateValue,
|
312
352
|
RuralAddressUpdateValue
|
313
|
-
]);
|
353
|
+
]).or(GenericAddressUpdateValue);
|
314
354
|
var FileFieldValueWithOption = import_zod3.z.object({
|
315
355
|
filename: import_zod3.z.string(),
|
316
356
|
originalFilename: import_zod3.z.string(),
|
@@ -326,6 +366,7 @@ var DateValue = import_zod4.z.string().date().describe("Date in the format YYYY-
|
|
326
366
|
var EmailValue = import_zod4.z.string().email();
|
327
367
|
var CheckboxFieldValue = import_zod4.z.boolean();
|
328
368
|
var NumberFieldValue = import_zod4.z.number();
|
369
|
+
var DataFieldValue = import_zod4.z.undefined();
|
329
370
|
var FieldValue = import_zod4.z.union([
|
330
371
|
TextValue,
|
331
372
|
DateValue,
|
@@ -334,7 +375,9 @@ var FieldValue = import_zod4.z.union([
|
|
334
375
|
FileFieldValue,
|
335
376
|
FileFieldWithOptionValue,
|
336
377
|
UrbanAddressValue,
|
337
|
-
RuralAddressValue
|
378
|
+
RuralAddressValue,
|
379
|
+
DataFieldValue,
|
380
|
+
GenericAddressValue
|
338
381
|
]);
|
339
382
|
var FieldUpdateValue = import_zod4.z.union([
|
340
383
|
TextValue,
|
@@ -344,7 +387,9 @@ var FieldUpdateValue = import_zod4.z.union([
|
|
344
387
|
FileFieldValue,
|
345
388
|
FileFieldWithOptionValue,
|
346
389
|
UrbanAddressUpdateValue,
|
347
|
-
RuralAddressUpdateValue
|
390
|
+
RuralAddressUpdateValue,
|
391
|
+
DataFieldValue,
|
392
|
+
GenericAddressUpdateValue
|
348
393
|
]);
|
349
394
|
|
350
395
|
// ../commons/src/events/FieldConfig.ts
|
@@ -415,15 +460,25 @@ var TextAreaField = BaseField.extend({
|
|
415
460
|
postfix: TranslationConfig.optional()
|
416
461
|
}).default({ rows: 4 }).optional()
|
417
462
|
}).describe("Multiline text input");
|
463
|
+
var ImageMimeType = import_zod5.z.enum([
|
464
|
+
"image/png",
|
465
|
+
"image/jpg",
|
466
|
+
"image/jpeg",
|
467
|
+
"image/svg+xml"
|
468
|
+
]);
|
469
|
+
var MimeType = ImageMimeType;
|
470
|
+
var DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
|
418
471
|
var SignatureField = BaseField.extend({
|
419
472
|
type: import_zod5.z.literal(FieldType.SIGNATURE),
|
420
473
|
signaturePromptLabel: TranslationConfig.describe(
|
421
474
|
"Title of the signature modal"
|
422
475
|
),
|
423
476
|
configuration: import_zod5.z.object({
|
424
|
-
|
425
|
-
|
426
|
-
}).default({
|
477
|
+
maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
478
|
+
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
479
|
+
}).default({
|
480
|
+
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
481
|
+
})
|
427
482
|
}).describe("Signature input field");
|
428
483
|
var EmailField = BaseField.extend({
|
429
484
|
type: import_zod5.z.literal(FieldType.EMAIL),
|
@@ -466,13 +521,17 @@ var PageHeader = BaseField.extend({
|
|
466
521
|
}).describe("A read-only header component for form pages");
|
467
522
|
var File = BaseField.extend({
|
468
523
|
type: import_zod5.z.literal(FieldType.FILE),
|
469
|
-
|
524
|
+
configuration: import_zod5.z.object({
|
525
|
+
maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
526
|
+
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
|
470
527
|
style: import_zod5.z.object({
|
471
|
-
|
528
|
+
width: import_zod5.z.enum(["full", "auto"]).optional().describe(
|
472
529
|
"Whether the file upload button should take the full width of the container or not"
|
473
530
|
)
|
474
|
-
})
|
475
|
-
}).
|
531
|
+
}).optional()
|
532
|
+
}).default({
|
533
|
+
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
534
|
+
})
|
476
535
|
}).describe("File upload");
|
477
536
|
var SelectOption = import_zod5.z.object({
|
478
537
|
value: import_zod5.z.string().describe("The value of the option"),
|
@@ -511,11 +570,16 @@ var Country = BaseField.extend({
|
|
511
570
|
type: import_zod5.z.literal(FieldType.COUNTRY),
|
512
571
|
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
513
572
|
}).describe("Country select field");
|
573
|
+
var AdministrativeAreas = import_zod5.z.enum([
|
574
|
+
"ADMIN_STRUCTURE",
|
575
|
+
"HEALTH_FACILITY",
|
576
|
+
"CRVS_OFFICE"
|
577
|
+
]);
|
514
578
|
var AdministrativeAreaConfiguration = import_zod5.z.object({
|
515
579
|
partOf: import_zod5.z.object({
|
516
580
|
$data: import_zod5.z.string()
|
517
581
|
}).optional().describe("Parent location"),
|
518
|
-
type:
|
582
|
+
type: AdministrativeAreas
|
519
583
|
}).describe("Administrative area options");
|
520
584
|
var AdministrativeArea = BaseField.extend({
|
521
585
|
type: import_zod5.z.literal(FieldType.ADMINISTRATIVE_AREA),
|
@@ -528,8 +592,14 @@ var Location = BaseField.extend({
|
|
528
592
|
}).describe("Input field for a location");
|
529
593
|
var FileUploadWithOptions = BaseField.extend({
|
530
594
|
type: import_zod5.z.literal(FieldType.FILE_WITH_OPTIONS),
|
531
|
-
options: import_zod5.z.array(SelectOption).describe("A list of options")
|
532
|
-
|
595
|
+
options: import_zod5.z.array(SelectOption).describe("A list of options"),
|
596
|
+
configuration: import_zod5.z.object({
|
597
|
+
maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
598
|
+
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
599
|
+
}).default({
|
600
|
+
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
601
|
+
})
|
602
|
+
});
|
533
603
|
var Facility = BaseField.extend({
|
534
604
|
type: import_zod5.z.literal(FieldType.FACILITY),
|
535
605
|
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
@@ -542,15 +612,13 @@ var Address = BaseField.extend({
|
|
542
612
|
type: import_zod5.z.literal(FieldType.ADDRESS),
|
543
613
|
defaultValue: AddressFieldValue.optional()
|
544
614
|
}).describe("Address input field \u2013 a combination of location and text fields");
|
545
|
-
var
|
615
|
+
var DataField = BaseField.extend({
|
546
616
|
type: import_zod5.z.literal(FieldType.DATA),
|
547
617
|
configuration: import_zod5.z.object({
|
548
|
-
title: TranslationConfig.optional(),
|
549
618
|
subtitle: TranslationConfig.optional(),
|
550
619
|
data: import_zod5.z.array(import_zod5.z.object({ fieldId: import_zod5.z.string() }))
|
551
|
-
// todo cihan: can we make this type more specific?
|
552
620
|
})
|
553
|
-
});
|
621
|
+
}).describe("Data field for displaying read-only data");
|
554
622
|
var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
555
623
|
Address,
|
556
624
|
TextField,
|
@@ -573,41 +641,42 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
|
573
641
|
SignatureField,
|
574
642
|
EmailField,
|
575
643
|
FileUploadWithOptions,
|
576
|
-
|
644
|
+
DataField
|
577
645
|
]);
|
578
646
|
|
579
647
|
// ../commons/src/events/FormConfig.ts
|
580
|
-
var
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
var PageBase = import_zod6.z.object({
|
648
|
+
var FormPageType = {
|
649
|
+
FORM: "FORM",
|
650
|
+
VERIFICATION: "VERIFICATION"
|
651
|
+
};
|
652
|
+
var FormPage = import_zod6.z.object({
|
586
653
|
id: import_zod6.z.string().describe("Unique identifier for the page"),
|
587
654
|
title: TranslationConfig.describe("Header title of the page"),
|
588
655
|
fields: import_zod6.z.array(FieldConfig).describe("Fields to be rendered on the page"),
|
589
|
-
type: import_zod6.z.
|
590
|
-
});
|
591
|
-
var FormPage = PageBase.extend({
|
592
|
-
type: import_zod6.z.literal("FORM").optional()
|
656
|
+
type: import_zod6.z.literal(FormPageType.FORM).default(FormPageType.FORM)
|
593
657
|
});
|
594
|
-
var
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
title: TranslationConfig,
|
602
|
-
body: TranslationConfig
|
603
|
-
})
|
658
|
+
var VerificationPageConfig = import_zod6.z.object({
|
659
|
+
verify: import_zod6.z.object({ label: TranslationConfig }),
|
660
|
+
cancel: import_zod6.z.object({
|
661
|
+
label: TranslationConfig,
|
662
|
+
confirmation: import_zod6.z.object({
|
663
|
+
title: TranslationConfig,
|
664
|
+
body: TranslationConfig
|
604
665
|
})
|
605
|
-
})
|
666
|
+
})
|
667
|
+
}).describe("Actions available on the verification page");
|
668
|
+
var VerificationPage = FormPage.extend({
|
669
|
+
type: import_zod6.z.literal(FormPageType.VERIFICATION),
|
670
|
+
actions: VerificationPageConfig
|
606
671
|
});
|
607
|
-
var
|
608
|
-
|
609
|
-
|
610
|
-
|
672
|
+
var FormPageConfig = import_zod6.z.preprocess(
|
673
|
+
(pageConfig) => ({
|
674
|
+
...pageConfig,
|
675
|
+
type: pageConfig.type ?? FormPageType.FORM
|
676
|
+
// Default type to "FORM" if not provided
|
677
|
+
}),
|
678
|
+
import_zod6.z.discriminatedUnion("type", [FormPage, VerificationPage])
|
679
|
+
);
|
611
680
|
var FormConfig = import_zod6.z.object({
|
612
681
|
label: TranslationConfig.describe("Human readable description of the form"),
|
613
682
|
version: import_zod6.z.object({
|
@@ -619,7 +688,7 @@ var FormConfig = import_zod6.z.object({
|
|
619
688
|
)
|
620
689
|
}),
|
621
690
|
active: import_zod6.z.boolean().default(false).describe("Whether the form is active"),
|
622
|
-
pages: import_zod6.z.array(
|
691
|
+
pages: import_zod6.z.array(FormPageConfig),
|
623
692
|
review: import_zod6.z.object({
|
624
693
|
title: TranslationConfig.describe(
|
625
694
|
"Title of the form to show in review page"
|
@@ -646,8 +715,9 @@ var ActionType = {
|
|
646
715
|
CUSTOM: "CUSTOM",
|
647
716
|
REJECT: "REJECT",
|
648
717
|
MARKED_AS_DUPLICATE: "MARKED_AS_DUPLICATE",
|
649
|
-
|
718
|
+
ARCHIVE: "ARCHIVE"
|
650
719
|
};
|
720
|
+
var LatentActions = [ActionType.ARCHIVE, ActionType.REJECT];
|
651
721
|
|
652
722
|
// ../commons/src/events/ActionConfig.ts
|
653
723
|
var ActionConditional2 = import_zod7.z.discriminatedUnion("type", [
|
@@ -674,23 +744,17 @@ var ValidateConfig = ActionConfigBase.merge(
|
|
674
744
|
);
|
675
745
|
var RejectDeclarationConfig = ActionConfigBase.merge(
|
676
746
|
import_zod7.z.object({
|
677
|
-
type: import_zod7.z.literal(ActionType.REJECT)
|
678
|
-
comment: import_zod7.z.string(),
|
679
|
-
isDuplicate: import_zod7.z.boolean()
|
747
|
+
type: import_zod7.z.literal(ActionType.REJECT)
|
680
748
|
})
|
681
749
|
);
|
682
750
|
var MarkedAsDuplicateConfig = ActionConfigBase.merge(
|
683
751
|
import_zod7.z.object({
|
684
|
-
type: import_zod7.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
685
|
-
comment: import_zod7.z.string(),
|
686
|
-
duplicates: import_zod7.z.array(import_zod7.z.string()).describe("UUIDs of duplicate records")
|
752
|
+
type: import_zod7.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
687
753
|
})
|
688
754
|
);
|
689
|
-
var
|
755
|
+
var ArchiveConfig = ActionConfigBase.merge(
|
690
756
|
import_zod7.z.object({
|
691
|
-
type: import_zod7.z.literal(ActionType.
|
692
|
-
comment: import_zod7.z.string(),
|
693
|
-
isDuplicate: import_zod7.z.boolean()
|
757
|
+
type: import_zod7.z.literal(ActionType.ARCHIVE)
|
694
758
|
})
|
695
759
|
);
|
696
760
|
var RegisterConfig = ActionConfigBase.merge(
|
@@ -711,8 +775,8 @@ var PrintCertificateActionConfig = ActionConfigBase.merge(
|
|
711
775
|
var RequestCorrectionConfig = ActionConfigBase.merge(
|
712
776
|
import_zod7.z.object({
|
713
777
|
type: import_zod7.z.literal(ActionType.REQUEST_CORRECTION),
|
714
|
-
onboardingForm: import_zod7.z.array(
|
715
|
-
additionalDetailsForm: import_zod7.z.array(
|
778
|
+
onboardingForm: import_zod7.z.array(FormPageConfig),
|
779
|
+
additionalDetailsForm: import_zod7.z.array(FormPageConfig)
|
716
780
|
})
|
717
781
|
);
|
718
782
|
var RejectCorrectionConfig = ActionConfigBase.merge(
|
@@ -735,7 +799,7 @@ var ActionConfig = import_zod7.z.discriminatedUnion("type", [
|
|
735
799
|
ValidateConfig,
|
736
800
|
RejectDeclarationConfig,
|
737
801
|
MarkedAsDuplicateConfig,
|
738
|
-
|
802
|
+
ArchiveConfig,
|
739
803
|
RegisterConfig,
|
740
804
|
DeleteConfig,
|
741
805
|
PrintCertificateActionConfig,
|
@@ -1155,7 +1219,7 @@ function mapFieldTypeToZod(type, required) {
|
|
1155
1219
|
schema = AddressFieldUpdateValue;
|
1156
1220
|
break;
|
1157
1221
|
case FieldType.DATA:
|
1158
|
-
schema =
|
1222
|
+
schema = DataFieldValue;
|
1159
1223
|
break;
|
1160
1224
|
}
|
1161
1225
|
return required ? schema : schema.nullish();
|
@@ -1191,6 +1255,7 @@ function mapFieldTypeToMockValue(field2, i) {
|
|
1191
1255
|
case FieldType.ADDRESS:
|
1192
1256
|
return {
|
1193
1257
|
country: "FAR",
|
1258
|
+
addressType: AddressType.DOMESTIC,
|
1194
1259
|
province: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
1195
1260
|
district: "5ef450bc-712d-48ad-93f3-8da0fa453baa",
|
1196
1261
|
urbanOrRural: "URBAN",
|
@@ -1216,6 +1281,52 @@ function mapFieldTypeToMockValue(field2, i) {
|
|
1216
1281
|
return {};
|
1217
1282
|
}
|
1218
1283
|
}
|
1284
|
+
function mapFieldTypeToEmptyValue(field2) {
|
1285
|
+
switch (field2.type) {
|
1286
|
+
case FieldType.DIVIDER:
|
1287
|
+
case FieldType.TEXT:
|
1288
|
+
case FieldType.TEXTAREA:
|
1289
|
+
case FieldType.BULLET_LIST:
|
1290
|
+
case FieldType.PAGE_HEADER:
|
1291
|
+
case FieldType.LOCATION:
|
1292
|
+
case FieldType.SELECT:
|
1293
|
+
case FieldType.COUNTRY:
|
1294
|
+
case FieldType.RADIO_GROUP:
|
1295
|
+
case FieldType.SIGNATURE:
|
1296
|
+
case FieldType.PARAGRAPH:
|
1297
|
+
case FieldType.ADMINISTRATIVE_AREA:
|
1298
|
+
case FieldType.FACILITY:
|
1299
|
+
case FieldType.OFFICE:
|
1300
|
+
case FieldType.NUMBER:
|
1301
|
+
case FieldType.EMAIL:
|
1302
|
+
case FieldType.DATE:
|
1303
|
+
case FieldType.CHECKBOX:
|
1304
|
+
case FieldType.DATA:
|
1305
|
+
return null;
|
1306
|
+
case FieldType.ADDRESS:
|
1307
|
+
return {
|
1308
|
+
country: null,
|
1309
|
+
addressType: AddressType.DOMESTIC,
|
1310
|
+
province: null,
|
1311
|
+
district: null,
|
1312
|
+
urbanOrRural: "URBAN",
|
1313
|
+
// Default to urban needed for validation
|
1314
|
+
town: null,
|
1315
|
+
residentialArea: null,
|
1316
|
+
street: null,
|
1317
|
+
number: null,
|
1318
|
+
zipCode: null
|
1319
|
+
};
|
1320
|
+
case FieldType.FILE:
|
1321
|
+
return {
|
1322
|
+
filename: "",
|
1323
|
+
originalFilename: "",
|
1324
|
+
type: ""
|
1325
|
+
};
|
1326
|
+
case FieldType.FILE_WITH_OPTIONS:
|
1327
|
+
return [];
|
1328
|
+
}
|
1329
|
+
}
|
1219
1330
|
var isParagraphFieldType = (field2) => {
|
1220
1331
|
return field2.config.type === FieldType.PARAGRAPH;
|
1221
1332
|
};
|
@@ -1318,49 +1429,76 @@ function isFieldVisible(field2, form) {
|
|
1318
1429
|
function isFieldEnabled(field2, form) {
|
1319
1430
|
return isFieldConditionMet(field2, form, ConditionalType.ENABLE);
|
1320
1431
|
}
|
1432
|
+
var errorMessages = {
|
1433
|
+
hiddenField: {
|
1434
|
+
id: "v2.error.hidden",
|
1435
|
+
defaultMessage: "Hidden or disabled field should not receive a value",
|
1436
|
+
description: "Error message when field is hidden or disabled, but a value was received"
|
1437
|
+
},
|
1438
|
+
invalidDate: {
|
1439
|
+
defaultMessage: "Invalid date field",
|
1440
|
+
description: "Error message when date field is invalid",
|
1441
|
+
id: "v2.error.invalidDate"
|
1442
|
+
},
|
1443
|
+
invalidEmail: {
|
1444
|
+
defaultMessage: "Invalid email address",
|
1445
|
+
description: "Error message when email address is invalid",
|
1446
|
+
id: "v2.error.invalidEmail"
|
1447
|
+
},
|
1448
|
+
requiredField: {
|
1449
|
+
defaultMessage: "Required for registration",
|
1450
|
+
description: "Error message when required field is missing",
|
1451
|
+
id: "v2.error.required"
|
1452
|
+
},
|
1453
|
+
invalidInput: {
|
1454
|
+
defaultMessage: "Invalid input",
|
1455
|
+
description: "Error message when generic field is invalid",
|
1456
|
+
id: "v2.error.invalid"
|
1457
|
+
}
|
1458
|
+
};
|
1459
|
+
var createIntlError = (message) => ({
|
1460
|
+
message: {
|
1461
|
+
message
|
1462
|
+
}
|
1463
|
+
});
|
1321
1464
|
var zodToIntlErrorMap = (issue, _ctx) => {
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
defaultMessage: "Invalid date. Please use the format YYYY-MM-DD",
|
1327
|
-
description: "This is the error message for invalid date fields",
|
1328
|
-
id: "v2.error.invalidDate"
|
1329
|
-
}
|
1465
|
+
switch (issue.code) {
|
1466
|
+
case "invalid_string": {
|
1467
|
+
if (_ctx.data === "") {
|
1468
|
+
return createIntlError(errorMessages.requiredField);
|
1330
1469
|
}
|
1331
|
-
|
1332
|
-
|
1333
|
-
if (issue.code === "invalid_string" && issue.validation === "email") {
|
1334
|
-
return {
|
1335
|
-
message: {
|
1336
|
-
message: {
|
1337
|
-
defaultMessage: "Invalid email address",
|
1338
|
-
description: "This is the error message for invalid email fields",
|
1339
|
-
id: "v2.error.invalidEmail"
|
1340
|
-
}
|
1470
|
+
if (issue.validation === "date") {
|
1471
|
+
return createIntlError(errorMessages.invalidDate);
|
1341
1472
|
}
|
1342
|
-
|
1343
|
-
|
1344
|
-
if (issue.code === "invalid_type" && issue.expected !== issue.received && issue.received === "undefined" || issue.code === "too_small" && issue.message === void 0) {
|
1345
|
-
return {
|
1346
|
-
message: {
|
1347
|
-
message: {
|
1348
|
-
defaultMessage: "Required for registration",
|
1349
|
-
description: "This is the error message for required fields",
|
1350
|
-
id: "v2.error.required"
|
1351
|
-
}
|
1473
|
+
if (issue.validation === "email") {
|
1474
|
+
return createIntlError(errorMessages.invalidEmail);
|
1352
1475
|
}
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
defaultMessage: "Invalid input",
|
1359
|
-
description: "This is the error message for invalid field value",
|
1360
|
-
id: "v2.error.invalid"
|
1476
|
+
break;
|
1477
|
+
}
|
1478
|
+
case "invalid_type": {
|
1479
|
+
if (issue.expected !== issue.received && issue.received === "undefined") {
|
1480
|
+
return createIntlError(errorMessages.requiredField);
|
1361
1481
|
}
|
1482
|
+
break;
|
1362
1483
|
}
|
1363
|
-
|
1484
|
+
case "too_small": {
|
1485
|
+
if (issue.message === void 0) {
|
1486
|
+
return createIntlError(errorMessages.requiredField);
|
1487
|
+
}
|
1488
|
+
break;
|
1489
|
+
}
|
1490
|
+
case "invalid_union": {
|
1491
|
+
for (const { issues } of issue.unionErrors) {
|
1492
|
+
for (const e of issues) {
|
1493
|
+
if (zodToIntlErrorMap(e, _ctx).message.message.id !== "v2.error.required") {
|
1494
|
+
return createIntlError(errorMessages.invalidInput);
|
1495
|
+
}
|
1496
|
+
}
|
1497
|
+
}
|
1498
|
+
return createIntlError(errorMessages.requiredField);
|
1499
|
+
}
|
1500
|
+
}
|
1501
|
+
return createIntlError(errorMessages.invalidInput);
|
1364
1502
|
};
|
1365
1503
|
function getFieldValidationErrors({
|
1366
1504
|
field: field2,
|
@@ -1375,11 +1513,7 @@ function getFieldValidationErrors({
|
|
1375
1513
|
return {
|
1376
1514
|
errors: [
|
1377
1515
|
{
|
1378
|
-
message:
|
1379
|
-
id: "v2.error.hidden",
|
1380
|
-
defaultMessage: "Hidden or disabled field should not receive a value",
|
1381
|
-
description: "Error message when field is hidden or disabled, but a value was received"
|
1382
|
-
}
|
1516
|
+
message: errorMessages.hiddenField
|
1383
1517
|
}
|
1384
1518
|
]
|
1385
1519
|
};
|
@@ -1397,8 +1531,8 @@ function getFieldValidationErrors({
|
|
1397
1531
|
conditionalParameters
|
1398
1532
|
});
|
1399
1533
|
return {
|
1400
|
-
// Assumes that custom validation errors are
|
1401
|
-
errors: [...
|
1534
|
+
// Assumes that custom validation errors are based on the field type, and extend the validation.
|
1535
|
+
errors: [...fieldValidationResult, ...customValidationResults]
|
1402
1536
|
};
|
1403
1537
|
}
|
1404
1538
|
function runCustomFieldValidations({
|
@@ -1423,6 +1557,20 @@ function validateFieldInput({
|
|
1423
1557
|
return rawError.error?.issues.map((issue) => issue.message) ?? [];
|
1424
1558
|
}
|
1425
1559
|
|
1560
|
+
// ../commons/src/utils.ts
|
1561
|
+
function getOrThrow(x, message) {
|
1562
|
+
if (x === void 0 || x === null) {
|
1563
|
+
throw new Error(message);
|
1564
|
+
}
|
1565
|
+
return x;
|
1566
|
+
}
|
1567
|
+
|
1568
|
+
// ../commons/src/uuid.ts
|
1569
|
+
var import_uuid = require("uuid");
|
1570
|
+
function getUUID() {
|
1571
|
+
return (0, import_uuid.v4)();
|
1572
|
+
}
|
1573
|
+
|
1426
1574
|
// ../commons/src/events/utils.ts
|
1427
1575
|
function isMetadataField(field2) {
|
1428
1576
|
return field2 in eventMetadataLabelMap;
|
@@ -1492,7 +1640,7 @@ function validateWorkqueueConfig(workqueueConfigs) {
|
|
1492
1640
|
);
|
1493
1641
|
if (!rootWorkqueue) {
|
1494
1642
|
throw new Error(
|
1495
|
-
`Invalid workqueue configuration: workqueue not found with id:
|
1643
|
+
`Invalid workqueue configuration: workqueue not found with id: ${workqueue.id}`
|
1496
1644
|
);
|
1497
1645
|
}
|
1498
1646
|
});
|
@@ -1519,7 +1667,16 @@ var findActiveActionFields = (configuration, action) => {
|
|
1519
1667
|
const allFields = formFields ? formFields.concat(reviewFields ?? []) : reviewFields;
|
1520
1668
|
return allFields;
|
1521
1669
|
};
|
1670
|
+
var getActiveActionFormPages = (configuration, action) => {
|
1671
|
+
return getOrThrow(
|
1672
|
+
findActiveActionForm(configuration, action)?.pages,
|
1673
|
+
"Form configuration not found for type: " + configuration.id
|
1674
|
+
);
|
1675
|
+
};
|
1522
1676
|
function getActiveActionFields(configuration, action) {
|
1677
|
+
if (LatentActions.some((latentAction) => latentAction === action)) {
|
1678
|
+
return getActiveActionFields(configuration, ActionType.DECLARE);
|
1679
|
+
}
|
1523
1680
|
const fields = findActiveActionFields(configuration, action);
|
1524
1681
|
if (!fields) {
|
1525
1682
|
throw new Error(`No active field config found for action type ${action}`);
|
@@ -1551,6 +1708,34 @@ function stripHiddenFields(fields, data) {
|
|
1551
1708
|
return !isFieldVisible(field2, data);
|
1552
1709
|
});
|
1553
1710
|
}
|
1711
|
+
function findActiveDrafts(event2, drafts) {
|
1712
|
+
const actions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
1713
|
+
const lastAction = actions[actions.length - 1];
|
1714
|
+
return drafts.filter(({ createdAt }) => createdAt >= lastAction.createdAt).filter(({ eventId }) => eventId === event2.id);
|
1715
|
+
}
|
1716
|
+
function createEmptyDraft(eventId, draftId, actionType) {
|
1717
|
+
return {
|
1718
|
+
id: draftId,
|
1719
|
+
eventId,
|
1720
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
1721
|
+
transactionId: getUUID(),
|
1722
|
+
action: {
|
1723
|
+
type: actionType,
|
1724
|
+
data: {},
|
1725
|
+
metadata: {},
|
1726
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
1727
|
+
createdBy: "@todo",
|
1728
|
+
createdAtLocation: "@todo"
|
1729
|
+
}
|
1730
|
+
};
|
1731
|
+
}
|
1732
|
+
function findActiveActionVerificationPageIds(configuration, action) {
|
1733
|
+
const pages = findActiveActionFormPages(configuration, action);
|
1734
|
+
if (!pages) {
|
1735
|
+
return [];
|
1736
|
+
}
|
1737
|
+
return pages.filter((page) => page.type === FormPageType.VERIFICATION).map((page) => page.id);
|
1738
|
+
}
|
1554
1739
|
|
1555
1740
|
// ../commons/src/events/EventConfig.ts
|
1556
1741
|
var EventConfig = import_zod18.z.object({
|
@@ -1592,7 +1777,7 @@ var EventConfig = import_zod18.z.object({
|
|
1592
1777
|
|
1593
1778
|
// ../commons/src/events/EventConfigInput.ts
|
1594
1779
|
var defineForm = (form) => FormConfig.parse(form);
|
1595
|
-
var
|
1780
|
+
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
1596
1781
|
|
1597
1782
|
// ../commons/src/events/Draft.ts
|
1598
1783
|
var import_zod21 = require("zod");
|
@@ -1648,9 +1833,9 @@ var MarkAsDuplicateAction = ActionBase.merge(
|
|
1648
1833
|
type: import_zod19.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1649
1834
|
})
|
1650
1835
|
);
|
1651
|
-
var
|
1836
|
+
var ArchiveAction = ActionBase.merge(
|
1652
1837
|
import_zod19.z.object({
|
1653
|
-
type: import_zod19.z.literal(ActionType.
|
1838
|
+
type: import_zod19.z.literal(ActionType.ARCHIVE)
|
1654
1839
|
})
|
1655
1840
|
);
|
1656
1841
|
var CreatedAction = ActionBase.merge(
|
@@ -1695,7 +1880,7 @@ var ActionDocument = import_zod19.z.discriminatedUnion("type", [
|
|
1695
1880
|
ValidateAction,
|
1696
1881
|
RejectAction,
|
1697
1882
|
MarkAsDuplicateAction,
|
1698
|
-
|
1883
|
+
ArchiveAction,
|
1699
1884
|
NotifiedAction,
|
1700
1885
|
RegisterAction,
|
1701
1886
|
DeclareAction,
|
@@ -1773,9 +1958,9 @@ var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
|
1773
1958
|
type: import_zod20.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
1774
1959
|
})
|
1775
1960
|
);
|
1776
|
-
var
|
1961
|
+
var ArchiveActionInput = BaseActionInput.merge(
|
1777
1962
|
import_zod20.z.object({
|
1778
|
-
type: import_zod20.z.literal(ActionType.
|
1963
|
+
type: import_zod20.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE)
|
1779
1964
|
})
|
1780
1965
|
);
|
1781
1966
|
var AssignActionInput = BaseActionInput.merge(
|
@@ -1814,7 +1999,7 @@ var ActionInput = import_zod20.z.discriminatedUnion("type", [
|
|
1814
1999
|
DeclareActionInput,
|
1815
2000
|
RejectDeclarationActionInput,
|
1816
2001
|
MarkedAsDuplicateActionInput,
|
1817
|
-
|
2002
|
+
ArchiveActionInput,
|
1818
2003
|
AssignActionInput,
|
1819
2004
|
UnassignActionInput,
|
1820
2005
|
PrintCertificateActionInput,
|
@@ -1886,7 +2071,7 @@ function getStatusFromActions(actions) {
|
|
1886
2071
|
if (action.type === ActionType.REJECT) {
|
1887
2072
|
return EventStatus.REJECTED;
|
1888
2073
|
}
|
1889
|
-
if (action.type === ActionType.
|
2074
|
+
if (action.type === ActionType.ARCHIVE) {
|
1890
2075
|
return EventStatus.ARCHIVED;
|
1891
2076
|
}
|
1892
2077
|
if (action.type === ActionType.NOTIFY) {
|
@@ -1958,8 +2143,8 @@ function deepMerge(currentDocument, actionDocument) {
|
|
1958
2143
|
}
|
1959
2144
|
);
|
1960
2145
|
}
|
1961
|
-
function isUndeclaredDraft(
|
1962
|
-
return
|
2146
|
+
function isUndeclaredDraft(status) {
|
2147
|
+
return status === EventStatus.CREATED;
|
1963
2148
|
}
|
1964
2149
|
function getCurrentEventState(event2) {
|
1965
2150
|
const creationAction = event2.actions.find(
|
@@ -1984,9 +2169,8 @@ function getCurrentEventState(event2) {
|
|
1984
2169
|
});
|
1985
2170
|
}
|
1986
2171
|
function getCurrentEventStateWithDrafts(event2, drafts) {
|
1987
|
-
const actions = event2.actions.slice().sort();
|
1988
|
-
const
|
1989
|
-
const activeDrafts = drafts.filter(({ eventId }) => eventId === event2.id).filter(({ createdAt }) => createdAt > lastAction.createdAt).map((draft) => draft.action).flatMap((action) => {
|
2172
|
+
const actions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
2173
|
+
const activeDrafts = findActiveDrafts(event2, drafts).map((draft) => draft.action).flatMap((action) => {
|
1990
2174
|
if (action.type === ActionType.REQUEST_CORRECTION) {
|
1991
2175
|
return [
|
1992
2176
|
action,
|
@@ -2047,12 +2231,6 @@ var defineConfig = (config) => {
|
|
2047
2231
|
});
|
2048
2232
|
};
|
2049
2233
|
|
2050
|
-
// ../commons/src/uuid.ts
|
2051
|
-
var import_uuid = require("uuid");
|
2052
|
-
function getUUID() {
|
2053
|
-
return (0, import_uuid.v4)();
|
2054
|
-
}
|
2055
|
-
|
2056
2234
|
// ../commons/src/events/transactions.ts
|
2057
2235
|
function generateTransactionId() {
|
2058
2236
|
return getUUID();
|
@@ -2269,6 +2447,23 @@ function field(fieldId) {
|
|
2269
2447
|
}
|
2270
2448
|
},
|
2271
2449
|
required: ["$form"]
|
2450
|
+
}),
|
2451
|
+
isValidEnglishName: () => defineConditional({
|
2452
|
+
type: "object",
|
2453
|
+
properties: {
|
2454
|
+
$form: {
|
2455
|
+
type: "object",
|
2456
|
+
properties: {
|
2457
|
+
[fieldId]: {
|
2458
|
+
type: "string",
|
2459
|
+
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'._-]*)*$",
|
2460
|
+
description: "Name must contain only letters, numbers, and allowed special characters ('._-). No double spaces."
|
2461
|
+
}
|
2462
|
+
},
|
2463
|
+
required: [fieldId]
|
2464
|
+
}
|
2465
|
+
},
|
2466
|
+
required: ["$form"]
|
2272
2467
|
})
|
2273
2468
|
};
|
2274
2469
|
}
|
@@ -2895,6 +3090,44 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2895
3090
|
type: "FILE"
|
2896
3091
|
}
|
2897
3092
|
]
|
3093
|
+
},
|
3094
|
+
{
|
3095
|
+
id: "collector.identity.verify",
|
3096
|
+
type: FormPageType.VERIFICATION,
|
3097
|
+
title: {
|
3098
|
+
id: "event.tennis-club-membership.action.print.verifyIdentity",
|
3099
|
+
defaultMessage: "Verify their identity",
|
3100
|
+
description: "This is the title of the section"
|
3101
|
+
},
|
3102
|
+
fields: [],
|
3103
|
+
actions: {
|
3104
|
+
verify: {
|
3105
|
+
label: {
|
3106
|
+
defaultMessage: "Verified",
|
3107
|
+
description: "This is the label for the verification button",
|
3108
|
+
id: "v2.event.tennis-club-membership.action.certificate.form.verify"
|
3109
|
+
}
|
3110
|
+
},
|
3111
|
+
cancel: {
|
3112
|
+
label: {
|
3113
|
+
defaultMessage: "Identity does not match",
|
3114
|
+
description: "This is the label for the verification cancellation button",
|
3115
|
+
id: "v2.event.tennis-club-membership.action.certificate.form.cancel"
|
3116
|
+
},
|
3117
|
+
confirmation: {
|
3118
|
+
title: {
|
3119
|
+
defaultMessage: "Print without proof of ID?",
|
3120
|
+
description: "This is the title for the verification cancellation modal",
|
3121
|
+
id: "v2.event.tennis-club-membership.action.certificate.form.cancel.confirmation.title"
|
3122
|
+
},
|
3123
|
+
body: {
|
3124
|
+
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",
|
3125
|
+
description: "This is the body for the verification cancellation modal",
|
3126
|
+
id: "v2.event.tennis-club-membership.action.certificate.form.cancel.confirmation.body"
|
3127
|
+
}
|
3128
|
+
}
|
3129
|
+
}
|
3130
|
+
}
|
2898
3131
|
}
|
2899
3132
|
],
|
2900
3133
|
review: {
|
@@ -3472,6 +3705,24 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3472
3705
|
})
|
3473
3706
|
}
|
3474
3707
|
]
|
3708
|
+
},
|
3709
|
+
{
|
3710
|
+
type: ActionType.ARCHIVE,
|
3711
|
+
label: {
|
3712
|
+
id: "v2.event.tennis-club-membership.action.archive.label",
|
3713
|
+
defaultMessage: "Archive",
|
3714
|
+
description: "This is shown as the action name anywhere the user can trigger the action from"
|
3715
|
+
},
|
3716
|
+
forms: [TENNIS_CLUB_FORM]
|
3717
|
+
},
|
3718
|
+
{
|
3719
|
+
type: ActionType.REJECT,
|
3720
|
+
label: {
|
3721
|
+
id: "v2.event.tennis-club-membership.action.reject.label",
|
3722
|
+
defaultMessage: "Reject",
|
3723
|
+
description: "This is shown as the action name anywhere the user can trigger the action from"
|
3724
|
+
},
|
3725
|
+
forms: [TENNIS_CLUB_FORM]
|
3475
3726
|
}
|
3476
3727
|
],
|
3477
3728
|
advancedSearch: [
|
@@ -3502,6 +3753,19 @@ function generateActionInput(configuration, action) {
|
|
3502
3753
|
);
|
3503
3754
|
return stripHiddenFields(fields, data);
|
3504
3755
|
}
|
3756
|
+
function generateActionMetadataInput(configuration, action) {
|
3757
|
+
const verificationPageIds = findActiveActionVerificationPageIds(
|
3758
|
+
configuration,
|
3759
|
+
action
|
3760
|
+
);
|
3761
|
+
return verificationPageIds.reduce(
|
3762
|
+
(acc, pageId) => ({
|
3763
|
+
...acc,
|
3764
|
+
[pageId]: true
|
3765
|
+
}),
|
3766
|
+
{}
|
3767
|
+
);
|
3768
|
+
}
|
3505
3769
|
var eventPayloadGenerator = {
|
3506
3770
|
create: (input = {}) => ({
|
3507
3771
|
transactionId: input.transactionId ?? getUUID(),
|
@@ -3552,9 +3816,9 @@ var eventPayloadGenerator = {
|
|
3552
3816
|
eventId
|
3553
3817
|
}),
|
3554
3818
|
archive: (eventId, input = {}, isDuplicate) => ({
|
3555
|
-
type: ActionType.
|
3819
|
+
type: ActionType.ARCHIVE,
|
3556
3820
|
transactionId: input.transactionId ?? getUUID(),
|
3557
|
-
data: input.data ??
|
3821
|
+
data: input.data ?? generateActionInput(tennisClubMembershipEvent, ActionType.ARCHIVE),
|
3558
3822
|
metadata: { isDuplicate: isDuplicate ?? false },
|
3559
3823
|
duplicates: [],
|
3560
3824
|
eventId
|
@@ -3562,7 +3826,7 @@ var eventPayloadGenerator = {
|
|
3562
3826
|
reject: (eventId, input = {}) => ({
|
3563
3827
|
type: ActionType.REJECT,
|
3564
3828
|
transactionId: input.transactionId ?? getUUID(),
|
3565
|
-
data: input.data ??
|
3829
|
+
data: input.data ?? generateActionInput(tennisClubMembershipEvent, ActionType.REJECT),
|
3566
3830
|
duplicates: [],
|
3567
3831
|
eventId
|
3568
3832
|
}),
|
@@ -3579,6 +3843,10 @@ var eventPayloadGenerator = {
|
|
3579
3843
|
tennisClubMembershipEvent,
|
3580
3844
|
ActionType.PRINT_CERTIFICATE
|
3581
3845
|
),
|
3846
|
+
metadata: input.metadata ?? generateActionMetadataInput(
|
3847
|
+
tennisClubMembershipEvent,
|
3848
|
+
ActionType.PRINT_CERTIFICATE
|
3849
|
+
),
|
3582
3850
|
eventId
|
3583
3851
|
}),
|
3584
3852
|
correction: {
|
@@ -3621,7 +3889,9 @@ function generateActionDocument({
|
|
3621
3889
|
defaults = {}
|
3622
3890
|
}) {
|
3623
3891
|
const actionBase = {
|
3624
|
-
createdAt
|
3892
|
+
// Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
|
3893
|
+
// @TODO: This should be fixed in the future.
|
3894
|
+
createdAt: new Date(Date.now() - 500).toISOString(),
|
3625
3895
|
createdBy: getUUID(),
|
3626
3896
|
id: getUUID(),
|
3627
3897
|
createdAtLocation: "TODO",
|
@@ -3638,7 +3908,7 @@ function generateActionDocument({
|
|
3638
3908
|
return { ...actionBase, assignedTo: getUUID(), type: action };
|
3639
3909
|
case ActionType.VALIDATE:
|
3640
3910
|
return { ...actionBase, type: action };
|
3641
|
-
case ActionType.
|
3911
|
+
case ActionType.ARCHIVE:
|
3642
3912
|
return { ...actionBase, type: action };
|
3643
3913
|
case ActionType.REJECT:
|
3644
3914
|
return { ...actionBase, type: action };
|
@@ -3676,9 +3946,13 @@ function generateEventDocument({
|
|
3676
3946
|
actions: actions.map(
|
3677
3947
|
(action) => generateActionDocument({ configuration, action })
|
3678
3948
|
),
|
3679
|
-
createdAt
|
3949
|
+
// Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
|
3950
|
+
// @TODO: This should be fixed in the future.
|
3951
|
+
createdAt: new Date(Date.now() - 1e3).toISOString(),
|
3680
3952
|
id: getUUID(),
|
3681
|
-
|
3953
|
+
// Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
|
3954
|
+
// @TODO: This should be fixed in the future.
|
3955
|
+
updatedAt: new Date(Date.now() - 1e3).toISOString()
|
3682
3956
|
};
|
3683
3957
|
}
|
3684
3958
|
function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE, data = {}) {
|
@@ -3718,6 +3992,11 @@ var eventQueryDataGenerator = (overrides = {}) => ({
|
|
3718
3992
|
},
|
3719
3993
|
trackingId: overrides.trackingId ?? "M3F8YQ"
|
3720
3994
|
});
|
3995
|
+
var generateTranslationConfig = (message) => ({
|
3996
|
+
defaultMessage: message,
|
3997
|
+
description: "Description for ${message}",
|
3998
|
+
id: message
|
3999
|
+
});
|
3721
4000
|
|
3722
4001
|
// ../commons/src/events/TemplateConfig.ts
|
3723
4002
|
function isTemplateVariable(value) {
|