@opencrvs/toolkit 1.8.0-rc.f7e8fb5 → 1.8.0-rc.f876361
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/README.md +1 -1
- package/dist/commons/api/router.d.ts +5260 -10679
- package/dist/commons/conditionals/conditionals.d.ts +17 -1
- 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 +1123 -2056
- package/dist/commons/events/ActionDocument.d.ts +9482 -312
- package/dist/commons/events/ActionInput.d.ts +4321 -359
- package/dist/commons/events/ActionType.d.ts +24 -11
- package/dist/commons/events/CompositeFieldValue.d.ts +152 -2
- package/dist/commons/events/Draft.d.ts +342 -46
- package/dist/commons/events/EventConfig.d.ts +551 -1206
- package/dist/commons/events/EventConfigInput.d.ts +6 -3
- package/dist/commons/events/EventDocument.d.ts +3335 -424
- package/dist/commons/events/EventIndex.d.ts +6 -3
- package/dist/commons/events/EventMetadata.d.ts +3 -0
- package/dist/commons/events/FieldConfig.d.ts +366 -52
- package/dist/commons/events/FieldType.d.ts +2 -1
- package/dist/commons/events/FieldTypeMapping.d.ts +154 -3
- package/dist/commons/events/FieldValue.d.ts +76 -2
- package/dist/commons/events/FormConfig.d.ts +633 -48
- package/dist/commons/events/PageConfig.d.ts +359 -0
- package/dist/commons/events/defineConfig.d.ts +91 -216
- package/dist/commons/events/index.d.ts +2 -1
- package/dist/commons/events/test.utils.d.ts +159 -140
- package/dist/commons/events/utils.d.ts +115 -82
- package/dist/conditionals/index.js +120 -15
- package/dist/events/index.js +1166 -671
- package/package.json +1 -1
package/dist/events/index.js
CHANGED
@@ -30,20 +30,26 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
30
30
|
// src/events/index.ts
|
31
31
|
var events_exports = {};
|
32
32
|
__export(events_exports, {
|
33
|
+
Action: () => Action,
|
33
34
|
ActionBase: () => ActionBase,
|
34
35
|
ActionConditional: () => ActionConditional,
|
35
36
|
ActionConfig: () => ActionConfig,
|
36
37
|
ActionConfigBase: () => ActionConfigBase,
|
37
38
|
ActionDocument: () => ActionDocument,
|
39
|
+
ActionFormConfig: () => ActionFormConfig,
|
38
40
|
ActionInput: () => ActionInput,
|
41
|
+
ActionStatus: () => ActionStatus,
|
39
42
|
ActionType: () => ActionType,
|
43
|
+
ActionTypes: () => ActionTypes,
|
40
44
|
ActionUpdate: () => ActionUpdate,
|
41
45
|
AddressFieldUpdateValue: () => AddressFieldUpdateValue,
|
42
46
|
AddressFieldValue: () => AddressFieldValue,
|
47
|
+
AddressType: () => AddressType,
|
43
48
|
AdministrativeAreas: () => AdministrativeAreas,
|
44
49
|
AdvancedSearchConfig: () => AdvancedSearchConfig,
|
45
50
|
ApproveCorrectionActionInput: () => ApproveCorrectionActionInput,
|
46
51
|
ArchiveActionInput: () => ArchiveActionInput,
|
52
|
+
AsyncRejectActionDocument: () => AsyncRejectActionDocument,
|
47
53
|
BaseActionInput: () => BaseActionInput,
|
48
54
|
CertificateConfig: () => CertificateConfig,
|
49
55
|
CertificateTemplateConfig: () => CertificateTemplateConfig,
|
@@ -51,7 +57,15 @@ __export(events_exports, {
|
|
51
57
|
Clause: () => Clause,
|
52
58
|
Conditional: () => Conditional,
|
53
59
|
ConditionalType: () => ConditionalType,
|
60
|
+
ConfirmableActions: () => ConfirmableActions,
|
61
|
+
DataEntry: () => DataEntry,
|
62
|
+
DataFieldValue: () => DataFieldValue,
|
54
63
|
DateValue: () => DateValue,
|
64
|
+
DeclarationActionConfig: () => DeclarationActionConfig,
|
65
|
+
DeclarationActions: () => DeclarationActions,
|
66
|
+
DeclarationFormConfig: () => DeclarationFormConfig,
|
67
|
+
DeclarationReviewConfig: () => DeclarationReviewConfig,
|
68
|
+
DeclarationUpdateActions: () => DeclarationUpdateActions,
|
55
69
|
DeclareActionInput: () => DeclareActionInput,
|
56
70
|
DeduplicationConfig: () => DeduplicationConfig,
|
57
71
|
Draft: () => Draft,
|
@@ -75,13 +89,22 @@ __export(events_exports, {
|
|
75
89
|
FileFieldValueWithOption: () => FileFieldValueWithOption,
|
76
90
|
FileFieldWithOptionValue: () => FileFieldWithOptionValue,
|
77
91
|
FormConfig: () => FormConfig,
|
78
|
-
|
92
|
+
FormPageConfig: () => FormPageConfig,
|
93
|
+
GenericAddressUpdateValue: () => GenericAddressUpdateValue,
|
94
|
+
GenericAddressValue: () => GenericAddressValue,
|
79
95
|
GeographicalArea: () => GeographicalArea,
|
96
|
+
ImageMimeType: () => ImageMimeType,
|
80
97
|
LanguageConfig: () => LanguageConfig,
|
81
98
|
MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
|
99
|
+
MimeType: () => MimeType,
|
82
100
|
NotifyActionInput: () => NotifyActionInput,
|
83
101
|
NumberFieldValue: () => NumberFieldValue,
|
102
|
+
PageConfig: () => PageConfig,
|
103
|
+
PageConfigBase: () => PageConfigBase,
|
104
|
+
PageTypes: () => PageTypes,
|
84
105
|
PrintCertificateActionInput: () => PrintCertificateActionInput,
|
106
|
+
ReadActionInput: () => ReadActionInput,
|
107
|
+
RegisterAction: () => RegisterAction,
|
85
108
|
RegisterActionInput: () => RegisterActionInput,
|
86
109
|
RejectCorrectionActionInput: () => RejectCorrectionActionInput,
|
87
110
|
RejectDeclarationActionInput: () => RejectDeclarationActionInput,
|
@@ -97,18 +120,25 @@ __export(events_exports, {
|
|
97
120
|
UrbanAddressUpdateValue: () => UrbanAddressUpdateValue,
|
98
121
|
UrbanAddressValue: () => UrbanAddressValue,
|
99
122
|
ValidateActionInput: () => ValidateActionInput,
|
123
|
+
VerificationActionConfig: () => VerificationActionConfig,
|
124
|
+
VerificationPageConfig: () => VerificationPageConfig,
|
100
125
|
WorkqueueConfig: () => WorkqueueConfig,
|
101
126
|
alwaysTrue: () => alwaysTrue,
|
102
127
|
and: () => and,
|
128
|
+
annotationActions: () => annotationActions,
|
103
129
|
applyDraftsToEventIndex: () => applyDraftsToEventIndex,
|
104
130
|
compositeFieldTypes: () => compositeFieldTypes,
|
105
131
|
createEmptyDraft: () => createEmptyDraft,
|
106
132
|
createValidationSchema: () => createValidationSchema,
|
107
133
|
deepDropNulls: () => deepDropNulls,
|
134
|
+
deepMerge: () => deepMerge,
|
135
|
+
defineActionForm: () => defineActionForm,
|
108
136
|
defineConditional: () => defineConditional,
|
109
137
|
defineConfig: () => defineConfig,
|
110
|
-
|
138
|
+
defineDeclarationForm: () => defineDeclarationForm,
|
111
139
|
defineFormPage: () => defineFormPage,
|
140
|
+
definePage: () => definePage,
|
141
|
+
errorMessages: () => errorMessages,
|
112
142
|
event: () => event,
|
113
143
|
eventMetadataLabelMap: () => eventMetadataLabelMap,
|
114
144
|
eventPayloadGenerator: () => eventPayloadGenerator,
|
@@ -116,33 +146,35 @@ __export(events_exports, {
|
|
116
146
|
eventStatuses: () => eventStatuses,
|
117
147
|
field: () => field,
|
118
148
|
fieldTypes: () => fieldTypes,
|
119
|
-
findActiveActionFields: () => findActiveActionFields,
|
120
|
-
findActiveActionForm: () => findActiveActionForm,
|
121
|
-
findActiveActionFormFields: () => findActiveActionFormFields,
|
122
|
-
findActiveActionFormPages: () => findActiveActionFormPages,
|
123
149
|
findActiveDrafts: () => findActiveDrafts,
|
124
|
-
|
125
|
-
|
150
|
+
findAllFields: () => findAllFields,
|
151
|
+
findRecordActionPages: () => findRecordActionPages,
|
126
152
|
generateActionDocument: () => generateActionDocument,
|
127
153
|
generateActionInput: () => generateActionInput,
|
154
|
+
generateActionMetadataInput: () => generateActionMetadataInput,
|
128
155
|
generateEventDocument: () => generateEventDocument,
|
129
156
|
generateEventDraftDocument: () => generateEventDraftDocument,
|
130
157
|
generateTransactionId: () => generateTransactionId,
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
158
|
+
generateTranslationConfig: () => generateTranslationConfig,
|
159
|
+
getAcceptedActions: () => getAcceptedActions,
|
160
|
+
getActionAnnotation: () => getActionAnnotation,
|
161
|
+
getActionAnnotationFields: () => getActionAnnotationFields,
|
162
|
+
getActionReview: () => getActionReview,
|
163
|
+
getActionReviewFields: () => getActionReviewFields,
|
164
|
+
getAllAnnotationFields: () => getAllAnnotationFields,
|
135
165
|
getCurrentEventState: () => getCurrentEventState,
|
136
166
|
getCurrentEventStateWithDrafts: () => getCurrentEventStateWithDrafts,
|
137
|
-
|
167
|
+
getDeclaration: () => getDeclaration,
|
168
|
+
getDeclarationFields: () => getDeclarationFields,
|
169
|
+
getDeclarationPages: () => getDeclarationPages,
|
138
170
|
getFieldValidationErrors: () => getFieldValidationErrors,
|
139
|
-
|
140
|
-
getMetadataForAction: () => getMetadataForAction,
|
171
|
+
getVisiblePagesFormFields: () => getVisiblePagesFormFields,
|
141
172
|
isAddressFieldType: () => isAddressFieldType,
|
142
173
|
isAdministrativeAreaFieldType: () => isAdministrativeAreaFieldType,
|
143
174
|
isBulletListFieldType: () => isBulletListFieldType,
|
144
175
|
isCheckboxFieldType: () => isCheckboxFieldType,
|
145
176
|
isCountryFieldType: () => isCountryFieldType,
|
177
|
+
isDataFieldType: () => isDataFieldType,
|
146
178
|
isDateFieldType: () => isDateFieldType,
|
147
179
|
isDividerFieldType: () => isDividerFieldType,
|
148
180
|
isEmailFieldType: () => isEmailFieldType,
|
@@ -158,6 +190,7 @@ __export(events_exports, {
|
|
158
190
|
isNumberFieldType: () => isNumberFieldType,
|
159
191
|
isOfficeFieldType: () => isOfficeFieldType,
|
160
192
|
isPageHeaderFieldType: () => isPageHeaderFieldType,
|
193
|
+
isPageVisible: () => isPageVisible,
|
161
194
|
isParagraphFieldType: () => isParagraphFieldType,
|
162
195
|
isRadioGroupFieldType: () => isRadioGroupFieldType,
|
163
196
|
isSelectFieldType: () => isSelectFieldType,
|
@@ -166,11 +199,12 @@ __export(events_exports, {
|
|
166
199
|
isTextAreaFieldType: () => isTextAreaFieldType,
|
167
200
|
isTextFieldType: () => isTextFieldType,
|
168
201
|
isUndeclaredDraft: () => isUndeclaredDraft,
|
202
|
+
isVerificationPage: () => isVerificationPage,
|
203
|
+
mapFieldTypeToEmptyValue: () => mapFieldTypeToEmptyValue,
|
169
204
|
mapFieldTypeToMockValue: () => mapFieldTypeToMockValue,
|
170
205
|
mapFieldTypeToZod: () => mapFieldTypeToZod,
|
171
206
|
not: () => not,
|
172
207
|
or: () => or,
|
173
|
-
resolveLabelsFromKnownFields: () => resolveLabelsFromKnownFields,
|
174
208
|
stripHiddenFields: () => stripHiddenFields,
|
175
209
|
user: () => user,
|
176
210
|
validate: () => validate,
|
@@ -180,7 +214,7 @@ __export(events_exports, {
|
|
180
214
|
module.exports = __toCommonJS(events_exports);
|
181
215
|
|
182
216
|
// ../commons/src/events/ActionConfig.ts
|
183
|
-
var
|
217
|
+
var import_zod9 = require("zod");
|
184
218
|
|
185
219
|
// ../commons/src/events/Conditional.ts
|
186
220
|
var import_zod = require("zod");
|
@@ -208,7 +242,7 @@ var ActionConditional = import_zod.z.discriminatedUnion("type", [
|
|
208
242
|
EnableConditional
|
209
243
|
]);
|
210
244
|
|
211
|
-
// ../commons/src/events/
|
245
|
+
// ../commons/src/events/PageConfig.ts
|
212
246
|
var import_zod6 = require("zod");
|
213
247
|
|
214
248
|
// ../commons/src/events/FieldConfig.ts
|
@@ -249,7 +283,8 @@ var FieldType = {
|
|
249
283
|
ADMINISTRATIVE_AREA: "ADMINISTRATIVE_AREA",
|
250
284
|
FACILITY: "FACILITY",
|
251
285
|
OFFICE: "OFFICE",
|
252
|
-
SIGNATURE: "SIGNATURE"
|
286
|
+
SIGNATURE: "SIGNATURE",
|
287
|
+
DATA: "DATA"
|
253
288
|
};
|
254
289
|
var fieldTypes = Object.values(FieldType);
|
255
290
|
var compositeFieldTypes = [
|
@@ -267,6 +302,10 @@ var GeographicalArea = {
|
|
267
302
|
URBAN: "URBAN",
|
268
303
|
RURAL: "RURAL"
|
269
304
|
};
|
305
|
+
var AddressType = {
|
306
|
+
DOMESTIC: "DOMESTIC",
|
307
|
+
INTERNATIONAL: "INTERNATIONAL"
|
308
|
+
};
|
270
309
|
var FileFieldValue = import_zod3.z.object({
|
271
310
|
filename: import_zod3.z.string(),
|
272
311
|
originalFilename: import_zod3.z.string(),
|
@@ -274,6 +313,7 @@ var FileFieldValue = import_zod3.z.object({
|
|
274
313
|
});
|
275
314
|
var AdminStructure = import_zod3.z.object({
|
276
315
|
country: import_zod3.z.string(),
|
316
|
+
addressType: import_zod3.z.literal(AddressType.DOMESTIC),
|
277
317
|
province: import_zod3.z.string(),
|
278
318
|
district: import_zod3.z.string()
|
279
319
|
});
|
@@ -301,14 +341,33 @@ var RuralAddressUpdateValue = AdminStructure.extend({
|
|
301
341
|
urbanOrRural: import_zod3.z.literal(GeographicalArea.RURAL),
|
302
342
|
village: import_zod3.z.string().nullish()
|
303
343
|
});
|
304
|
-
var
|
305
|
-
|
306
|
-
|
307
|
-
|
344
|
+
var GenericAddressValue = import_zod3.z.object({
|
345
|
+
country: import_zod3.z.string(),
|
346
|
+
addressType: import_zod3.z.literal(AddressType.INTERNATIONAL),
|
347
|
+
state: import_zod3.z.string(),
|
348
|
+
district2: import_zod3.z.string(),
|
349
|
+
cityOrTown: import_zod3.z.string().optional(),
|
350
|
+
addressLine1: import_zod3.z.string().optional(),
|
351
|
+
addressLine2: import_zod3.z.string().optional(),
|
352
|
+
addressLine3: import_zod3.z.string().optional(),
|
353
|
+
postcodeOrZip: import_zod3.z.string().optional()
|
354
|
+
});
|
355
|
+
var AddressFieldValue = import_zod3.z.discriminatedUnion("urbanOrRural", [UrbanAddressValue, RuralAddressValue]).or(GenericAddressValue);
|
356
|
+
var GenericAddressUpdateValue = import_zod3.z.object({
|
357
|
+
country: import_zod3.z.string(),
|
358
|
+
addressType: import_zod3.z.literal(AddressType.INTERNATIONAL),
|
359
|
+
state: import_zod3.z.string(),
|
360
|
+
district2: import_zod3.z.string(),
|
361
|
+
cityOrTown: import_zod3.z.string().nullish(),
|
362
|
+
addressLine1: import_zod3.z.string().nullish(),
|
363
|
+
addressLine2: import_zod3.z.string().nullish(),
|
364
|
+
addressLine3: import_zod3.z.string().nullish(),
|
365
|
+
postcodeOrZip: import_zod3.z.string().nullish()
|
366
|
+
});
|
308
367
|
var AddressFieldUpdateValue = import_zod3.z.discriminatedUnion("urbanOrRural", [
|
309
368
|
UrbanAddressUpdateValue,
|
310
369
|
RuralAddressUpdateValue
|
311
|
-
]);
|
370
|
+
]).or(GenericAddressUpdateValue);
|
312
371
|
var FileFieldValueWithOption = import_zod3.z.object({
|
313
372
|
filename: import_zod3.z.string(),
|
314
373
|
originalFilename: import_zod3.z.string(),
|
@@ -324,6 +383,7 @@ var DateValue = import_zod4.z.string().date().describe("Date in the format YYYY-
|
|
324
383
|
var EmailValue = import_zod4.z.string().email();
|
325
384
|
var CheckboxFieldValue = import_zod4.z.boolean();
|
326
385
|
var NumberFieldValue = import_zod4.z.number();
|
386
|
+
var DataFieldValue = import_zod4.z.undefined();
|
327
387
|
var FieldValue = import_zod4.z.union([
|
328
388
|
TextValue,
|
329
389
|
DateValue,
|
@@ -332,7 +392,9 @@ var FieldValue = import_zod4.z.union([
|
|
332
392
|
FileFieldValue,
|
333
393
|
FileFieldWithOptionValue,
|
334
394
|
UrbanAddressValue,
|
335
|
-
RuralAddressValue
|
395
|
+
RuralAddressValue,
|
396
|
+
DataFieldValue,
|
397
|
+
GenericAddressValue
|
336
398
|
]);
|
337
399
|
var FieldUpdateValue = import_zod4.z.union([
|
338
400
|
TextValue,
|
@@ -342,7 +404,9 @@ var FieldUpdateValue = import_zod4.z.union([
|
|
342
404
|
FileFieldValue,
|
343
405
|
FileFieldWithOptionValue,
|
344
406
|
UrbanAddressUpdateValue,
|
345
|
-
RuralAddressUpdateValue
|
407
|
+
RuralAddressUpdateValue,
|
408
|
+
DataFieldValue,
|
409
|
+
GenericAddressUpdateValue
|
346
410
|
]);
|
347
411
|
|
348
412
|
// ../commons/src/events/FieldConfig.ts
|
@@ -413,15 +477,25 @@ var TextAreaField = BaseField.extend({
|
|
413
477
|
postfix: TranslationConfig.optional()
|
414
478
|
}).default({ rows: 4 }).optional()
|
415
479
|
}).describe("Multiline text input");
|
480
|
+
var ImageMimeType = import_zod5.z.enum([
|
481
|
+
"image/png",
|
482
|
+
"image/jpg",
|
483
|
+
"image/jpeg",
|
484
|
+
"image/svg+xml"
|
485
|
+
]);
|
486
|
+
var MimeType = ImageMimeType;
|
487
|
+
var DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
|
416
488
|
var SignatureField = BaseField.extend({
|
417
489
|
type: import_zod5.z.literal(FieldType.SIGNATURE),
|
418
490
|
signaturePromptLabel: TranslationConfig.describe(
|
419
491
|
"Title of the signature modal"
|
420
492
|
),
|
421
493
|
configuration: import_zod5.z.object({
|
422
|
-
|
423
|
-
|
424
|
-
}).default({
|
494
|
+
maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
495
|
+
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
496
|
+
}).default({
|
497
|
+
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
498
|
+
})
|
425
499
|
}).describe("Signature input field");
|
426
500
|
var EmailField = BaseField.extend({
|
427
501
|
type: import_zod5.z.literal(FieldType.EMAIL),
|
@@ -464,13 +538,17 @@ var PageHeader = BaseField.extend({
|
|
464
538
|
}).describe("A read-only header component for form pages");
|
465
539
|
var File = BaseField.extend({
|
466
540
|
type: import_zod5.z.literal(FieldType.FILE),
|
467
|
-
|
541
|
+
configuration: import_zod5.z.object({
|
542
|
+
maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
543
|
+
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
|
468
544
|
style: import_zod5.z.object({
|
469
|
-
|
545
|
+
width: import_zod5.z.enum(["full", "auto"]).optional().describe(
|
470
546
|
"Whether the file upload button should take the full width of the container or not"
|
471
547
|
)
|
472
|
-
})
|
473
|
-
}).
|
548
|
+
}).optional()
|
549
|
+
}).default({
|
550
|
+
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
551
|
+
})
|
474
552
|
}).describe("File upload");
|
475
553
|
var SelectOption = import_zod5.z.object({
|
476
554
|
value: import_zod5.z.string().describe("The value of the option"),
|
@@ -516,7 +594,7 @@ var AdministrativeAreas = import_zod5.z.enum([
|
|
516
594
|
]);
|
517
595
|
var AdministrativeAreaConfiguration = import_zod5.z.object({
|
518
596
|
partOf: import_zod5.z.object({
|
519
|
-
$
|
597
|
+
$declaration: import_zod5.z.string()
|
520
598
|
}).optional().describe("Parent location"),
|
521
599
|
type: AdministrativeAreas
|
522
600
|
}).describe("Administrative area options");
|
@@ -531,8 +609,14 @@ var Location = BaseField.extend({
|
|
531
609
|
}).describe("Input field for a location");
|
532
610
|
var FileUploadWithOptions = BaseField.extend({
|
533
611
|
type: import_zod5.z.literal(FieldType.FILE_WITH_OPTIONS),
|
534
|
-
options: import_zod5.z.array(SelectOption).describe("A list of options")
|
535
|
-
|
612
|
+
options: import_zod5.z.array(SelectOption).describe("A list of options"),
|
613
|
+
configuration: import_zod5.z.object({
|
614
|
+
maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
615
|
+
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
616
|
+
}).default({
|
617
|
+
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
618
|
+
})
|
619
|
+
});
|
536
620
|
var Facility = BaseField.extend({
|
537
621
|
type: import_zod5.z.literal(FieldType.FACILITY),
|
538
622
|
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
@@ -545,6 +629,22 @@ var Address = BaseField.extend({
|
|
545
629
|
type: import_zod5.z.literal(FieldType.ADDRESS),
|
546
630
|
defaultValue: AddressFieldValue.optional()
|
547
631
|
}).describe("Address input field \u2013 a combination of location and text fields");
|
632
|
+
var DataEntry = import_zod5.z.union([
|
633
|
+
import_zod5.z.object({
|
634
|
+
label: TranslationConfig,
|
635
|
+
value: import_zod5.z.string()
|
636
|
+
}),
|
637
|
+
import_zod5.z.object({
|
638
|
+
fieldId: import_zod5.z.string()
|
639
|
+
})
|
640
|
+
]);
|
641
|
+
var DataField = BaseField.extend({
|
642
|
+
type: import_zod5.z.literal(FieldType.DATA),
|
643
|
+
configuration: import_zod5.z.object({
|
644
|
+
subtitle: TranslationConfig.optional(),
|
645
|
+
data: import_zod5.z.array(DataEntry)
|
646
|
+
})
|
647
|
+
}).describe("Data field for displaying read-only data");
|
548
648
|
var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
549
649
|
Address,
|
550
650
|
TextField,
|
@@ -566,132 +666,203 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
|
566
666
|
Office,
|
567
667
|
SignatureField,
|
568
668
|
EmailField,
|
569
|
-
FileUploadWithOptions
|
669
|
+
FileUploadWithOptions,
|
670
|
+
DataField
|
570
671
|
]);
|
571
672
|
|
572
|
-
// ../commons/src/events/
|
573
|
-
var
|
673
|
+
// ../commons/src/events/PageConfig.ts
|
674
|
+
var PageTypes = import_zod6.z.enum(["FORM", "VERIFICATION"]);
|
675
|
+
var PageConfigBase = import_zod6.z.object({
|
574
676
|
id: import_zod6.z.string().describe("Unique identifier for the page"),
|
575
677
|
title: TranslationConfig.describe("Header title of the page"),
|
576
|
-
fields: import_zod6.z.array(FieldConfig).describe("Fields to be rendered on the page")
|
678
|
+
fields: import_zod6.z.array(FieldConfig).describe("Fields to be rendered on the page"),
|
679
|
+
conditional: Conditional().optional().describe(
|
680
|
+
"Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
|
681
|
+
)
|
577
682
|
});
|
578
|
-
var
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
label: TranslationConfig
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
pages: import_zod6.z.array(FormPage),
|
590
|
-
review: import_zod6.z.object({
|
591
|
-
title: TranslationConfig.describe(
|
592
|
-
"Title of the form to show in review page"
|
593
|
-
),
|
594
|
-
fields: import_zod6.z.array(FieldConfig).describe("Fields to be rendered on the review page for metadata")
|
683
|
+
var FormPageConfig = PageConfigBase.extend({
|
684
|
+
type: import_zod6.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
|
685
|
+
});
|
686
|
+
var VerificationActionConfig = import_zod6.z.object({
|
687
|
+
verify: import_zod6.z.object({ label: TranslationConfig }),
|
688
|
+
cancel: import_zod6.z.object({
|
689
|
+
label: TranslationConfig,
|
690
|
+
confirmation: import_zod6.z.object({
|
691
|
+
title: TranslationConfig,
|
692
|
+
body: TranslationConfig
|
693
|
+
})
|
595
694
|
})
|
695
|
+
}).describe("Actions available on the verification page");
|
696
|
+
var VerificationPageConfig = FormPageConfig.extend({
|
697
|
+
type: import_zod6.z.literal(PageTypes.enum.VERIFICATION),
|
698
|
+
actions: VerificationActionConfig
|
596
699
|
});
|
700
|
+
var PageConfig = import_zod6.z.discriminatedUnion("type", [
|
701
|
+
FormPageConfig,
|
702
|
+
VerificationPageConfig
|
703
|
+
]);
|
597
704
|
|
598
705
|
// ../commons/src/events/ActionType.ts
|
706
|
+
var import_zod7 = require("zod");
|
599
707
|
var ActionType = {
|
708
|
+
// Pre-declaration actions
|
709
|
+
DELETE: "DELETE",
|
600
710
|
CREATE: "CREATE",
|
601
|
-
ASSIGN: "ASSIGN",
|
602
|
-
UNASSIGN: "UNASSIGN",
|
603
|
-
REGISTER: "REGISTER",
|
604
|
-
VALIDATE: "VALIDATE",
|
605
|
-
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
606
|
-
REJECT_CORRECTION: "REJECT_CORRECTION",
|
607
|
-
APPROVE_CORRECTION: "APPROVE_CORRECTION",
|
608
|
-
DETECT_DUPLICATE: "DETECT_DUPLICATE",
|
609
711
|
NOTIFY: "NOTIFY",
|
712
|
+
// Declaration actions
|
610
713
|
DECLARE: "DECLARE",
|
611
|
-
|
612
|
-
|
613
|
-
|
714
|
+
VALIDATE: "VALIDATE",
|
715
|
+
REGISTER: "REGISTER",
|
716
|
+
// Declaration system actions. Non-configurable.
|
717
|
+
DETECT_DUPLICATE: "DETECT_DUPLICATE",
|
614
718
|
REJECT: "REJECT",
|
719
|
+
// REJECT_DECLARATION
|
615
720
|
MARKED_AS_DUPLICATE: "MARKED_AS_DUPLICATE",
|
616
|
-
|
721
|
+
// MARK_AS_DUPLICATE
|
722
|
+
ARCHIVE: "ARCHIVE",
|
723
|
+
// Record actions
|
724
|
+
PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
|
725
|
+
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
726
|
+
REJECT_CORRECTION: "REJECT_CORRECTION",
|
727
|
+
APPROVE_CORRECTION: "APPROVE_CORRECTION",
|
728
|
+
// General actions
|
729
|
+
READ: "READ",
|
730
|
+
ASSIGN: "ASSIGN",
|
731
|
+
UNASSIGN: "UNASSIGN"
|
617
732
|
};
|
733
|
+
var ConfirmableActions = [
|
734
|
+
ActionType.NOTIFY,
|
735
|
+
ActionType.DECLARE,
|
736
|
+
ActionType.VALIDATE,
|
737
|
+
ActionType.REGISTER,
|
738
|
+
ActionType.REJECT,
|
739
|
+
ActionType.ARCHIVE,
|
740
|
+
ActionType.PRINT_CERTIFICATE
|
741
|
+
];
|
742
|
+
var ActionTypes = import_zod7.z.enum([
|
743
|
+
"DELETE",
|
744
|
+
"CREATE",
|
745
|
+
"NOTIFY",
|
746
|
+
"DECLARE",
|
747
|
+
"VALIDATE",
|
748
|
+
"REGISTER",
|
749
|
+
"DETECT_DUPLICATE",
|
750
|
+
"REJECT",
|
751
|
+
"MARKED_AS_DUPLICATE",
|
752
|
+
"ARCHIVE",
|
753
|
+
"PRINT_CERTIFICATE",
|
754
|
+
"REQUEST_CORRECTION",
|
755
|
+
"REJECT_CORRECTION",
|
756
|
+
"APPROVE_CORRECTION",
|
757
|
+
"READ",
|
758
|
+
"ASSIGN",
|
759
|
+
"UNASSIGN"
|
760
|
+
]);
|
761
|
+
var declarationActionValues = [
|
762
|
+
ActionTypes.enum.DECLARE,
|
763
|
+
ActionTypes.enum.VALIDATE,
|
764
|
+
ActionTypes.enum.REGISTER
|
765
|
+
];
|
766
|
+
var DeclarationActions = ActionTypes.extract(declarationActionValues);
|
767
|
+
var declarationUpdateActionValues = [
|
768
|
+
...declarationActionValues,
|
769
|
+
ActionTypes.enum.REQUEST_CORRECTION
|
770
|
+
];
|
771
|
+
var DeclarationUpdateActions = ActionTypes.extract(
|
772
|
+
declarationUpdateActionValues
|
773
|
+
);
|
774
|
+
var annotationActions = ActionTypes.exclude(declarationActionValues);
|
775
|
+
|
776
|
+
// ../commons/src/events/FormConfig.ts
|
777
|
+
var import_zod8 = require("zod");
|
778
|
+
var DeclarationFormConfig = import_zod8.z.object({
|
779
|
+
label: TranslationConfig.describe("Human readable description of the form"),
|
780
|
+
pages: import_zod8.z.array(FormPageConfig)
|
781
|
+
}).describe("Configuration for a declaration form");
|
782
|
+
var ActionFormConfig = import_zod8.z.object({
|
783
|
+
label: TranslationConfig.describe("Human readable description of the form"),
|
784
|
+
pages: import_zod8.z.array(PageConfig)
|
785
|
+
});
|
786
|
+
var FormConfig = import_zod8.z.union([DeclarationFormConfig, ActionFormConfig]);
|
618
787
|
|
619
788
|
// ../commons/src/events/ActionConfig.ts
|
620
|
-
var ActionConditional2 =
|
789
|
+
var ActionConditional2 = import_zod9.z.discriminatedUnion("type", [
|
621
790
|
/** If conditional is defined, the action is shown to the user only if the condition is met */
|
622
791
|
ShowConditional,
|
623
792
|
/** If conditional is defined, the action is enabled only if the condition is met */
|
624
793
|
EnableConditional
|
625
794
|
]);
|
626
|
-
var
|
795
|
+
var DeclarationReviewConfig = import_zod9.z.object({
|
796
|
+
title: TranslationConfig.describe("Title of the review page"),
|
797
|
+
fields: import_zod9.z.array(FieldConfig).describe("Fields to be rendered on the review page for annotations.")
|
798
|
+
}).describe("Configuration for **declaration** review page.");
|
799
|
+
var ActionConfigBase = import_zod9.z.object({
|
627
800
|
label: TranslationConfig,
|
628
|
-
conditionals:
|
629
|
-
draft:
|
630
|
-
forms: import_zod7.z.array(FormConfig)
|
801
|
+
conditionals: import_zod9.z.array(ActionConditional2).optional().default([]),
|
802
|
+
draft: import_zod9.z.boolean().optional()
|
631
803
|
});
|
632
804
|
var DeclareConfig = ActionConfigBase.merge(
|
633
|
-
|
634
|
-
type:
|
805
|
+
import_zod9.z.object({
|
806
|
+
type: import_zod9.z.literal(ActionType.DECLARE),
|
807
|
+
review: DeclarationReviewConfig
|
635
808
|
})
|
636
809
|
);
|
637
810
|
var ValidateConfig = ActionConfigBase.merge(
|
638
|
-
|
639
|
-
type:
|
811
|
+
import_zod9.z.object({
|
812
|
+
type: import_zod9.z.literal(ActionType.VALIDATE),
|
813
|
+
review: DeclarationReviewConfig
|
814
|
+
})
|
815
|
+
);
|
816
|
+
var RegisterConfig = ActionConfigBase.merge(
|
817
|
+
import_zod9.z.object({
|
818
|
+
type: import_zod9.z.literal(ActionType.REGISTER),
|
819
|
+
review: DeclarationReviewConfig
|
640
820
|
})
|
641
821
|
);
|
642
822
|
var RejectDeclarationConfig = ActionConfigBase.merge(
|
643
|
-
|
644
|
-
type:
|
823
|
+
import_zod9.z.object({
|
824
|
+
type: import_zod9.z.literal(ActionType.REJECT)
|
645
825
|
})
|
646
826
|
);
|
647
827
|
var MarkedAsDuplicateConfig = ActionConfigBase.merge(
|
648
|
-
|
649
|
-
type:
|
828
|
+
import_zod9.z.object({
|
829
|
+
type: import_zod9.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
650
830
|
})
|
651
831
|
);
|
652
832
|
var ArchiveConfig = ActionConfigBase.merge(
|
653
|
-
|
654
|
-
type:
|
655
|
-
})
|
656
|
-
);
|
657
|
-
var RegisterConfig = ActionConfigBase.merge(
|
658
|
-
import_zod7.z.object({
|
659
|
-
type: import_zod7.z.literal(ActionType.REGISTER)
|
833
|
+
import_zod9.z.object({
|
834
|
+
type: import_zod9.z.literal(ActionType.ARCHIVE)
|
660
835
|
})
|
661
836
|
);
|
662
837
|
var DeleteConfig = ActionConfigBase.merge(
|
663
|
-
|
664
|
-
type:
|
838
|
+
import_zod9.z.object({
|
839
|
+
type: import_zod9.z.literal(ActionType.DELETE)
|
665
840
|
})
|
666
841
|
);
|
667
842
|
var PrintCertificateActionConfig = ActionConfigBase.merge(
|
668
|
-
|
669
|
-
type:
|
843
|
+
import_zod9.z.object({
|
844
|
+
type: import_zod9.z.literal(ActionType.PRINT_CERTIFICATE),
|
845
|
+
printForm: ActionFormConfig
|
670
846
|
})
|
671
847
|
);
|
672
848
|
var RequestCorrectionConfig = ActionConfigBase.merge(
|
673
|
-
|
674
|
-
type:
|
675
|
-
onboardingForm:
|
676
|
-
additionalDetailsForm:
|
849
|
+
import_zod9.z.object({
|
850
|
+
type: import_zod9.z.literal(ActionType.REQUEST_CORRECTION),
|
851
|
+
onboardingForm: import_zod9.z.array(PageConfig),
|
852
|
+
additionalDetailsForm: import_zod9.z.array(PageConfig)
|
677
853
|
})
|
678
854
|
);
|
679
855
|
var RejectCorrectionConfig = ActionConfigBase.merge(
|
680
|
-
|
681
|
-
type:
|
856
|
+
import_zod9.z.object({
|
857
|
+
type: import_zod9.z.literal(ActionType.REJECT_CORRECTION)
|
682
858
|
})
|
683
859
|
);
|
684
860
|
var ApproveCorrectionConfig = ActionConfigBase.merge(
|
685
|
-
|
686
|
-
type:
|
687
|
-
})
|
688
|
-
);
|
689
|
-
var CustomConfig = ActionConfigBase.merge(
|
690
|
-
import_zod7.z.object({
|
691
|
-
type: import_zod7.z.literal(ActionType.CUSTOM)
|
861
|
+
import_zod9.z.object({
|
862
|
+
type: import_zod9.z.literal(ActionType.APPROVE_CORRECTION)
|
692
863
|
})
|
693
864
|
);
|
694
|
-
var ActionConfig =
|
865
|
+
var ActionConfig = import_zod9.z.discriminatedUnion("type", [
|
695
866
|
DeclareConfig,
|
696
867
|
ValidateConfig,
|
697
868
|
RejectDeclarationConfig,
|
@@ -702,102 +873,106 @@ var ActionConfig = import_zod7.z.discriminatedUnion("type", [
|
|
702
873
|
PrintCertificateActionConfig,
|
703
874
|
RequestCorrectionConfig,
|
704
875
|
RejectCorrectionConfig,
|
705
|
-
ApproveCorrectionConfig
|
706
|
-
|
876
|
+
ApproveCorrectionConfig
|
877
|
+
]);
|
878
|
+
var DeclarationActionConfig = import_zod9.z.discriminatedUnion("type", [
|
879
|
+
DeclareConfig,
|
880
|
+
ValidateConfig,
|
881
|
+
RegisterConfig
|
707
882
|
]);
|
708
883
|
|
709
884
|
// ../commons/src/events/offline/CertificateConfig.ts
|
710
|
-
var
|
711
|
-
var FontFamily =
|
712
|
-
normal:
|
713
|
-
bold:
|
714
|
-
italics:
|
715
|
-
bolditalics:
|
885
|
+
var import_zod10 = require("zod");
|
886
|
+
var FontFamily = import_zod10.z.object({
|
887
|
+
normal: import_zod10.z.string(),
|
888
|
+
bold: import_zod10.z.string(),
|
889
|
+
italics: import_zod10.z.string(),
|
890
|
+
bolditalics: import_zod10.z.string()
|
716
891
|
});
|
717
|
-
var CertificateConfig =
|
718
|
-
id:
|
719
|
-
event:
|
892
|
+
var CertificateConfig = import_zod10.z.object({
|
893
|
+
id: import_zod10.z.string(),
|
894
|
+
event: import_zod10.z.string(),
|
720
895
|
label: TranslationConfig,
|
721
|
-
isDefault:
|
722
|
-
fee:
|
723
|
-
onTime:
|
724
|
-
late:
|
725
|
-
delayed:
|
896
|
+
isDefault: import_zod10.z.boolean(),
|
897
|
+
fee: import_zod10.z.object({
|
898
|
+
onTime: import_zod10.z.number(),
|
899
|
+
late: import_zod10.z.number(),
|
900
|
+
delayed: import_zod10.z.number()
|
726
901
|
}),
|
727
|
-
svgUrl:
|
728
|
-
fonts:
|
902
|
+
svgUrl: import_zod10.z.string(),
|
903
|
+
fonts: import_zod10.z.record(FontFamily).optional()
|
729
904
|
});
|
730
905
|
var CertificateTemplateConfig = CertificateConfig.extend({
|
731
|
-
hash:
|
732
|
-
svg:
|
906
|
+
hash: import_zod10.z.string().optional(),
|
907
|
+
svg: import_zod10.z.string()
|
733
908
|
});
|
734
909
|
|
735
910
|
// ../commons/src/events/offline/LanguageConfig.ts
|
736
|
-
var
|
737
|
-
var LanguageConfig =
|
738
|
-
lang:
|
911
|
+
var import_zod11 = require("zod");
|
912
|
+
var LanguageConfig = import_zod11.z.object({
|
913
|
+
lang: import_zod11.z.string(),
|
739
914
|
/**
|
740
915
|
* client.csv contents
|
741
916
|
*/
|
742
|
-
messages:
|
917
|
+
messages: import_zod11.z.record(import_zod11.z.string())
|
743
918
|
});
|
744
919
|
|
745
920
|
// ../commons/src/events/EventConfig.ts
|
746
|
-
var
|
921
|
+
var import_zod20 = require("zod");
|
747
922
|
|
748
923
|
// ../commons/src/events/DeduplicationConfig.ts
|
749
|
-
var
|
750
|
-
var FieldReference =
|
751
|
-
var Matcher =
|
752
|
-
fieldId:
|
753
|
-
options:
|
754
|
-
boost:
|
924
|
+
var import_zod12 = require("zod");
|
925
|
+
var FieldReference = import_zod12.z.string();
|
926
|
+
var Matcher = import_zod12.z.object({
|
927
|
+
fieldId: import_zod12.z.string(),
|
928
|
+
options: import_zod12.z.object({
|
929
|
+
boost: import_zod12.z.number().optional()
|
755
930
|
}).optional().default({})
|
756
931
|
});
|
757
932
|
var FuzzyMatcher = Matcher.extend({
|
758
|
-
type:
|
759
|
-
options:
|
933
|
+
type: import_zod12.z.literal("fuzzy"),
|
934
|
+
options: import_zod12.z.object({
|
760
935
|
/**
|
761
936
|
* Names of length 3 or less characters = 0 edits allowed
|
762
937
|
* Names of length 4 - 6 characters = 1 edit allowed
|
763
938
|
* Names of length >7 characters = 2 edits allowed
|
764
939
|
*/
|
765
|
-
fuzziness:
|
766
|
-
boost:
|
940
|
+
fuzziness: import_zod12.z.union([import_zod12.z.string(), import_zod12.z.number()]).optional().default("AUTO:4,7"),
|
941
|
+
boost: import_zod12.z.number().optional().default(1)
|
767
942
|
}).optional().default({})
|
768
943
|
});
|
769
944
|
var StrictMatcher = Matcher.extend({
|
770
|
-
type:
|
771
|
-
options:
|
772
|
-
boost:
|
945
|
+
type: import_zod12.z.literal("strict"),
|
946
|
+
options: import_zod12.z.object({
|
947
|
+
boost: import_zod12.z.number().optional().default(1)
|
773
948
|
}).optional().default({})
|
774
949
|
});
|
775
950
|
var DateRangeMatcher = Matcher.extend({
|
776
|
-
type:
|
777
|
-
options:
|
778
|
-
days:
|
951
|
+
type: import_zod12.z.literal("dateRange"),
|
952
|
+
options: import_zod12.z.object({
|
953
|
+
days: import_zod12.z.number(),
|
779
954
|
origin: FieldReference,
|
780
|
-
boost:
|
955
|
+
boost: import_zod12.z.number().optional().default(1)
|
781
956
|
})
|
782
957
|
});
|
783
958
|
var DateDistanceMatcher = Matcher.extend({
|
784
|
-
type:
|
785
|
-
options:
|
786
|
-
days:
|
959
|
+
type: import_zod12.z.literal("dateDistance"),
|
960
|
+
options: import_zod12.z.object({
|
961
|
+
days: import_zod12.z.number(),
|
787
962
|
origin: FieldReference,
|
788
|
-
boost:
|
963
|
+
boost: import_zod12.z.number().optional().default(1)
|
789
964
|
})
|
790
965
|
});
|
791
|
-
var And =
|
792
|
-
type:
|
793
|
-
clauses:
|
966
|
+
var And = import_zod12.z.object({
|
967
|
+
type: import_zod12.z.literal("and"),
|
968
|
+
clauses: import_zod12.z.lazy(() => Clause.array())
|
794
969
|
});
|
795
|
-
var Or =
|
796
|
-
type:
|
797
|
-
clauses:
|
970
|
+
var Or = import_zod12.z.object({
|
971
|
+
type: import_zod12.z.literal("or"),
|
972
|
+
clauses: import_zod12.z.lazy(() => Clause.array())
|
798
973
|
});
|
799
|
-
var Clause =
|
800
|
-
() =>
|
974
|
+
var Clause = import_zod12.z.lazy(
|
975
|
+
() => import_zod12.z.discriminatedUnion("type", [
|
801
976
|
And,
|
802
977
|
Or,
|
803
978
|
FuzzyMatcher,
|
@@ -806,37 +981,37 @@ var Clause = import_zod10.z.lazy(
|
|
806
981
|
DateDistanceMatcher
|
807
982
|
])
|
808
983
|
);
|
809
|
-
var DeduplicationConfig =
|
810
|
-
id:
|
984
|
+
var DeduplicationConfig = import_zod12.z.object({
|
985
|
+
id: import_zod12.z.string(),
|
811
986
|
label: TranslationConfig,
|
812
987
|
query: Clause
|
813
988
|
});
|
814
989
|
|
815
990
|
// ../commons/src/events/SummaryConfig.ts
|
816
|
-
var
|
817
|
-
var Field =
|
818
|
-
id:
|
991
|
+
var import_zod13 = require("zod");
|
992
|
+
var Field = import_zod13.z.object({
|
993
|
+
id: import_zod13.z.string().describe("Id of summary field"),
|
819
994
|
value: TranslationConfig.describe(
|
820
995
|
"Summary field value. Can utilise values defined in configuration and EventMetadata"
|
821
996
|
),
|
822
997
|
label: TranslationConfig,
|
823
998
|
emptyValueMessage: TranslationConfig.optional()
|
824
999
|
});
|
825
|
-
var Title =
|
826
|
-
id:
|
1000
|
+
var Title = import_zod13.z.object({
|
1001
|
+
id: import_zod13.z.string(),
|
827
1002
|
label: TranslationConfig.describe("Title content"),
|
828
1003
|
emptyValueMessage: TranslationConfig.optional()
|
829
1004
|
});
|
830
|
-
var SummaryConfig =
|
1005
|
+
var SummaryConfig = import_zod13.z.object({
|
831
1006
|
title: Title.describe("Title of summary view."),
|
832
|
-
fields:
|
1007
|
+
fields: import_zod13.z.array(Field).describe("Fields rendered in summary view.")
|
833
1008
|
}).describe("Configuration for summary in event.");
|
834
1009
|
|
835
1010
|
// ../commons/src/events/WorkqueueConfig.ts
|
836
|
-
var
|
1011
|
+
var import_zod15 = require("zod");
|
837
1012
|
|
838
1013
|
// ../commons/src/events/EventMetadata.ts
|
839
|
-
var
|
1014
|
+
var import_zod14 = require("zod");
|
840
1015
|
var EventStatus = {
|
841
1016
|
CREATED: "CREATED",
|
842
1017
|
NOTIFIED: "NOTIFIED",
|
@@ -848,18 +1023,19 @@ var EventStatus = {
|
|
848
1023
|
ARCHIVED: "ARCHIVED"
|
849
1024
|
};
|
850
1025
|
var eventStatuses = Object.values(EventStatus);
|
851
|
-
var EventStatuses =
|
852
|
-
var EventMetadata =
|
853
|
-
id:
|
854
|
-
type:
|
1026
|
+
var EventStatuses = import_zod14.z.nativeEnum(EventStatus);
|
1027
|
+
var EventMetadata = import_zod14.z.object({
|
1028
|
+
id: import_zod14.z.string(),
|
1029
|
+
type: import_zod14.z.string(),
|
855
1030
|
status: EventStatuses,
|
856
|
-
createdAt:
|
857
|
-
createdBy:
|
858
|
-
createdAtLocation:
|
859
|
-
modifiedAt:
|
860
|
-
assignedTo:
|
861
|
-
updatedBy:
|
862
|
-
trackingId:
|
1031
|
+
createdAt: import_zod14.z.string().datetime(),
|
1032
|
+
createdBy: import_zod14.z.string(),
|
1033
|
+
createdAtLocation: import_zod14.z.string(),
|
1034
|
+
modifiedAt: import_zod14.z.string().datetime(),
|
1035
|
+
assignedTo: import_zod14.z.string().nullish(),
|
1036
|
+
updatedBy: import_zod14.z.string(),
|
1037
|
+
trackingId: import_zod14.z.string(),
|
1038
|
+
registrationNumber: import_zod14.z.string().nullish()
|
863
1039
|
});
|
864
1040
|
var eventMetadataLabelMap = {
|
865
1041
|
"event.assignedTo": {
|
@@ -911,28 +1087,33 @@ var eventMetadataLabelMap = {
|
|
911
1087
|
id: "event.trackingId.label",
|
912
1088
|
defaultMessage: "Tracking ID",
|
913
1089
|
description: "Tracking ID"
|
1090
|
+
},
|
1091
|
+
"event.registrationNumber": {
|
1092
|
+
id: "event.registrationNumber.label",
|
1093
|
+
defaultMessage: "Registration Number",
|
1094
|
+
description: "Registration Number"
|
914
1095
|
}
|
915
1096
|
};
|
916
1097
|
|
917
1098
|
// ../commons/src/events/WorkqueueConfig.ts
|
918
|
-
var WorkqueueConfig =
|
919
|
-
id:
|
920
|
-
filters:
|
921
|
-
|
922
|
-
status:
|
1099
|
+
var WorkqueueConfig = import_zod15.z.object({
|
1100
|
+
id: import_zod15.z.string().describe("Unique identifier for workqueue."),
|
1101
|
+
filters: import_zod15.z.array(
|
1102
|
+
import_zod15.z.object({
|
1103
|
+
status: import_zod15.z.array(EventStatuses).describe("Defines which statusese are included in the workqueue.")
|
923
1104
|
})
|
924
1105
|
).describe("Filters to be applied to workqueue.")
|
925
1106
|
}).describe("Configuration for workqueue.");
|
926
1107
|
|
927
1108
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
928
|
-
var
|
929
|
-
var AdvancedSearchConfig =
|
1109
|
+
var import_zod16 = require("zod");
|
1110
|
+
var AdvancedSearchConfig = import_zod16.z.object({
|
930
1111
|
title: TranslationConfig.describe("Advanced search tab title"),
|
931
|
-
fields:
|
932
|
-
|
933
|
-
fieldId:
|
934
|
-
config:
|
935
|
-
type:
|
1112
|
+
fields: import_zod16.z.array(
|
1113
|
+
import_zod16.z.object({
|
1114
|
+
fieldId: import_zod16.z.string(),
|
1115
|
+
config: import_zod16.z.object({
|
1116
|
+
type: import_zod16.z.enum(["FUZZY", "EXACT", "RANGE"]).describe("Determines the type of field")
|
936
1117
|
}).optional().describe("Configuration options for the field")
|
937
1118
|
})
|
938
1119
|
).optional().default([]).describe("Advanced search fields.")
|
@@ -942,12 +1123,12 @@ var AdvancedSearchConfig = import_zod14.z.object({
|
|
942
1123
|
var import_lodash = require("lodash");
|
943
1124
|
|
944
1125
|
// ../commons/src/workqueues/WorkqueueConfig.ts
|
945
|
-
var
|
1126
|
+
var import_zod18 = require("zod");
|
946
1127
|
|
947
1128
|
// ../commons/src/workqueues/defaultColumns.ts
|
948
|
-
var
|
949
|
-
var WorkQueueColumnConfig =
|
950
|
-
id:
|
1129
|
+
var import_zod17 = require("zod");
|
1130
|
+
var WorkQueueColumnConfig = import_zod17.z.object({
|
1131
|
+
id: import_zod17.z.string(),
|
951
1132
|
label: TranslationConfig
|
952
1133
|
});
|
953
1134
|
var defaultColumns = {
|
@@ -984,16 +1165,16 @@ var defaultColumns = {
|
|
984
1165
|
}
|
985
1166
|
}
|
986
1167
|
};
|
987
|
-
var DefaultColumnKeys =
|
1168
|
+
var DefaultColumnKeys = import_zod17.z.enum(
|
988
1169
|
Object.keys(defaultColumns)
|
989
1170
|
);
|
990
1171
|
|
991
1172
|
// ../commons/src/workqueues/WorkqueueConfig.ts
|
992
|
-
var rootWorkqueueConfig =
|
993
|
-
id:
|
1173
|
+
var rootWorkqueueConfig = import_zod18.z.object({
|
1174
|
+
id: import_zod18.z.string(),
|
994
1175
|
title: TranslationConfig,
|
995
|
-
columns:
|
996
|
-
defaultColumns:
|
1176
|
+
columns: import_zod18.z.array(WorkQueueColumnConfig),
|
1177
|
+
defaultColumns: import_zod18.z.array(DefaultColumnKeys)
|
997
1178
|
});
|
998
1179
|
var defineWorkqueue = (config) => rootWorkqueueConfig.parse(config);
|
999
1180
|
|
@@ -1073,7 +1254,7 @@ var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
1073
1254
|
var import_date_fns = require("date-fns");
|
1074
1255
|
|
1075
1256
|
// ../commons/src/events/FieldTypeMapping.ts
|
1076
|
-
var
|
1257
|
+
var import_zod19 = require("zod");
|
1077
1258
|
function mapFieldTypeToZod(type, required) {
|
1078
1259
|
let schema;
|
1079
1260
|
switch (type) {
|
@@ -1115,6 +1296,9 @@ function mapFieldTypeToZod(type, required) {
|
|
1115
1296
|
case FieldType.ADDRESS:
|
1116
1297
|
schema = AddressFieldUpdateValue;
|
1117
1298
|
break;
|
1299
|
+
case FieldType.DATA:
|
1300
|
+
schema = DataFieldValue;
|
1301
|
+
break;
|
1118
1302
|
}
|
1119
1303
|
return required ? schema : schema.nullish();
|
1120
1304
|
}
|
@@ -1123,7 +1307,7 @@ function createValidationSchema(config) {
|
|
1123
1307
|
for (const field2 of config) {
|
1124
1308
|
shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
|
1125
1309
|
}
|
1126
|
-
return
|
1310
|
+
return import_zod19.z.object(shape);
|
1127
1311
|
}
|
1128
1312
|
function mapFieldTypeToMockValue(field2, i) {
|
1129
1313
|
switch (field2.type) {
|
@@ -1149,6 +1333,7 @@ function mapFieldTypeToMockValue(field2, i) {
|
|
1149
1333
|
case FieldType.ADDRESS:
|
1150
1334
|
return {
|
1151
1335
|
country: "FAR",
|
1336
|
+
addressType: AddressType.DOMESTIC,
|
1152
1337
|
province: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
1153
1338
|
district: "5ef450bc-712d-48ad-93f3-8da0fa453baa",
|
1154
1339
|
urbanOrRural: "URBAN",
|
@@ -1170,6 +1355,54 @@ function mapFieldTypeToMockValue(field2, i) {
|
|
1170
1355
|
};
|
1171
1356
|
case FieldType.FILE_WITH_OPTIONS:
|
1172
1357
|
return null;
|
1358
|
+
case FieldType.DATA:
|
1359
|
+
return {};
|
1360
|
+
}
|
1361
|
+
}
|
1362
|
+
function mapFieldTypeToEmptyValue(field2) {
|
1363
|
+
switch (field2.type) {
|
1364
|
+
case FieldType.DIVIDER:
|
1365
|
+
case FieldType.TEXT:
|
1366
|
+
case FieldType.TEXTAREA:
|
1367
|
+
case FieldType.BULLET_LIST:
|
1368
|
+
case FieldType.PAGE_HEADER:
|
1369
|
+
case FieldType.LOCATION:
|
1370
|
+
case FieldType.SELECT:
|
1371
|
+
case FieldType.COUNTRY:
|
1372
|
+
case FieldType.RADIO_GROUP:
|
1373
|
+
case FieldType.SIGNATURE:
|
1374
|
+
case FieldType.PARAGRAPH:
|
1375
|
+
case FieldType.ADMINISTRATIVE_AREA:
|
1376
|
+
case FieldType.FACILITY:
|
1377
|
+
case FieldType.OFFICE:
|
1378
|
+
case FieldType.NUMBER:
|
1379
|
+
case FieldType.EMAIL:
|
1380
|
+
case FieldType.DATE:
|
1381
|
+
case FieldType.CHECKBOX:
|
1382
|
+
case FieldType.DATA:
|
1383
|
+
return null;
|
1384
|
+
case FieldType.ADDRESS:
|
1385
|
+
return {
|
1386
|
+
country: null,
|
1387
|
+
addressType: AddressType.DOMESTIC,
|
1388
|
+
province: null,
|
1389
|
+
district: null,
|
1390
|
+
urbanOrRural: "URBAN",
|
1391
|
+
// Default to urban needed for validation
|
1392
|
+
town: null,
|
1393
|
+
residentialArea: null,
|
1394
|
+
street: null,
|
1395
|
+
number: null,
|
1396
|
+
zipCode: null
|
1397
|
+
};
|
1398
|
+
case FieldType.FILE:
|
1399
|
+
return {
|
1400
|
+
filename: "",
|
1401
|
+
originalFilename: "",
|
1402
|
+
type: ""
|
1403
|
+
};
|
1404
|
+
case FieldType.FILE_WITH_OPTIONS:
|
1405
|
+
return [];
|
1173
1406
|
}
|
1174
1407
|
}
|
1175
1408
|
var isParagraphFieldType = (field2) => {
|
@@ -1235,10 +1468,14 @@ var isFacilityFieldType = (field2) => {
|
|
1235
1468
|
var isOfficeFieldType = (field2) => {
|
1236
1469
|
return field2.config.type === FieldType.OFFICE;
|
1237
1470
|
};
|
1471
|
+
var isDataFieldType = (field2) => {
|
1472
|
+
return field2.config.type === FieldType.DATA;
|
1473
|
+
};
|
1238
1474
|
|
1239
1475
|
// ../commons/src/conditionals/validate.ts
|
1240
1476
|
var ajv = new import_ajv.default({
|
1241
|
-
$data: true
|
1477
|
+
$data: true,
|
1478
|
+
allowUnionTypes: true
|
1242
1479
|
});
|
1243
1480
|
(0, import_ajv_formats.default)(ajv);
|
1244
1481
|
function validate(schema, data) {
|
@@ -1271,49 +1508,76 @@ function isFieldVisible(field2, form) {
|
|
1271
1508
|
function isFieldEnabled(field2, form) {
|
1272
1509
|
return isFieldConditionMet(field2, form, ConditionalType.ENABLE);
|
1273
1510
|
}
|
1511
|
+
var errorMessages = {
|
1512
|
+
hiddenField: {
|
1513
|
+
id: "v2.error.hidden",
|
1514
|
+
defaultMessage: "Hidden or disabled field should not receive a value",
|
1515
|
+
description: "Error message when field is hidden or disabled, but a value was received"
|
1516
|
+
},
|
1517
|
+
invalidDate: {
|
1518
|
+
defaultMessage: "Invalid date field",
|
1519
|
+
description: "Error message when date field is invalid",
|
1520
|
+
id: "v2.error.invalidDate"
|
1521
|
+
},
|
1522
|
+
invalidEmail: {
|
1523
|
+
defaultMessage: "Invalid email address",
|
1524
|
+
description: "Error message when email address is invalid",
|
1525
|
+
id: "v2.error.invalidEmail"
|
1526
|
+
},
|
1527
|
+
requiredField: {
|
1528
|
+
defaultMessage: "Required for registration",
|
1529
|
+
description: "Error message when required field is missing",
|
1530
|
+
id: "v2.error.required"
|
1531
|
+
},
|
1532
|
+
invalidInput: {
|
1533
|
+
defaultMessage: "Invalid input",
|
1534
|
+
description: "Error message when generic field is invalid",
|
1535
|
+
id: "v2.error.invalid"
|
1536
|
+
}
|
1537
|
+
};
|
1538
|
+
var createIntlError = (message) => ({
|
1539
|
+
message: {
|
1540
|
+
message
|
1541
|
+
}
|
1542
|
+
});
|
1274
1543
|
var zodToIntlErrorMap = (issue, _ctx) => {
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
defaultMessage: "Invalid date. Please use the format YYYY-MM-DD",
|
1280
|
-
description: "This is the error message for invalid date fields",
|
1281
|
-
id: "v2.error.invalidDate"
|
1282
|
-
}
|
1544
|
+
switch (issue.code) {
|
1545
|
+
case "invalid_string": {
|
1546
|
+
if (_ctx.data === "") {
|
1547
|
+
return createIntlError(errorMessages.requiredField);
|
1283
1548
|
}
|
1284
|
-
|
1285
|
-
|
1286
|
-
if (issue.code === "invalid_string" && issue.validation === "email") {
|
1287
|
-
return {
|
1288
|
-
message: {
|
1289
|
-
message: {
|
1290
|
-
defaultMessage: "Invalid email address",
|
1291
|
-
description: "This is the error message for invalid email fields",
|
1292
|
-
id: "v2.error.invalidEmail"
|
1293
|
-
}
|
1549
|
+
if (issue.validation === "date") {
|
1550
|
+
return createIntlError(errorMessages.invalidDate);
|
1294
1551
|
}
|
1295
|
-
|
1296
|
-
|
1297
|
-
if (issue.code === "invalid_type" && issue.expected !== issue.received && issue.received === "undefined" || issue.code === "too_small" && issue.message === void 0) {
|
1298
|
-
return {
|
1299
|
-
message: {
|
1300
|
-
message: {
|
1301
|
-
defaultMessage: "Required for registration",
|
1302
|
-
description: "This is the error message for required fields",
|
1303
|
-
id: "v2.error.required"
|
1304
|
-
}
|
1552
|
+
if (issue.validation === "email") {
|
1553
|
+
return createIntlError(errorMessages.invalidEmail);
|
1305
1554
|
}
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1311
|
-
defaultMessage: "Invalid input",
|
1312
|
-
description: "This is the error message for invalid field value",
|
1313
|
-
id: "v2.error.invalid"
|
1555
|
+
break;
|
1556
|
+
}
|
1557
|
+
case "invalid_type": {
|
1558
|
+
if (issue.expected !== issue.received && issue.received === "undefined") {
|
1559
|
+
return createIntlError(errorMessages.requiredField);
|
1314
1560
|
}
|
1561
|
+
break;
|
1315
1562
|
}
|
1316
|
-
|
1563
|
+
case "too_small": {
|
1564
|
+
if (issue.message === void 0) {
|
1565
|
+
return createIntlError(errorMessages.requiredField);
|
1566
|
+
}
|
1567
|
+
break;
|
1568
|
+
}
|
1569
|
+
case "invalid_union": {
|
1570
|
+
for (const { issues } of issue.unionErrors) {
|
1571
|
+
for (const e of issues) {
|
1572
|
+
if (zodToIntlErrorMap(e, _ctx).message.message.id !== "v2.error.required") {
|
1573
|
+
return createIntlError(errorMessages.invalidInput);
|
1574
|
+
}
|
1575
|
+
}
|
1576
|
+
}
|
1577
|
+
return createIntlError(errorMessages.requiredField);
|
1578
|
+
}
|
1579
|
+
}
|
1580
|
+
return createIntlError(errorMessages.invalidInput);
|
1317
1581
|
};
|
1318
1582
|
function getFieldValidationErrors({
|
1319
1583
|
field: field2,
|
@@ -1328,11 +1592,7 @@ function getFieldValidationErrors({
|
|
1328
1592
|
return {
|
1329
1593
|
errors: [
|
1330
1594
|
{
|
1331
|
-
message:
|
1332
|
-
id: "v2.error.hidden",
|
1333
|
-
defaultMessage: "Hidden or disabled field should not receive a value",
|
1334
|
-
description: "Error message when field is hidden or disabled, but a value was received"
|
1335
|
-
}
|
1595
|
+
message: errorMessages.hiddenField
|
1336
1596
|
}
|
1337
1597
|
]
|
1338
1598
|
};
|
@@ -1350,8 +1610,8 @@ function getFieldValidationErrors({
|
|
1350
1610
|
conditionalParameters
|
1351
1611
|
});
|
1352
1612
|
return {
|
1353
|
-
// Assumes that custom validation errors are
|
1354
|
-
errors: [...
|
1613
|
+
// Assumes that custom validation errors are based on the field type, and extend the validation.
|
1614
|
+
errors: [...fieldValidationResult, ...customValidationResults]
|
1355
1615
|
};
|
1356
1616
|
}
|
1357
1617
|
function runCustomFieldValidations({
|
@@ -1376,6 +1636,15 @@ function validateFieldInput({
|
|
1376
1636
|
return rawError.error?.issues.map((issue) => issue.message) ?? [];
|
1377
1637
|
}
|
1378
1638
|
|
1639
|
+
// ../commons/src/uuid.ts
|
1640
|
+
var import_uuid = require("uuid");
|
1641
|
+
function getUUID() {
|
1642
|
+
return (0, import_uuid.v4)();
|
1643
|
+
}
|
1644
|
+
|
1645
|
+
// ../commons/src/events/utils.ts
|
1646
|
+
var import_date_fns2 = require("date-fns");
|
1647
|
+
|
1379
1648
|
// ../commons/src/utils.ts
|
1380
1649
|
function getOrThrow(x, message) {
|
1381
1650
|
if (x === void 0 || x === null) {
|
@@ -1384,73 +1653,64 @@ function getOrThrow(x, message) {
|
|
1384
1653
|
return x;
|
1385
1654
|
}
|
1386
1655
|
|
1387
|
-
// ../commons/src/uuid.ts
|
1388
|
-
var import_uuid = require("uuid");
|
1389
|
-
function getUUID() {
|
1390
|
-
return (0, import_uuid.v4)();
|
1391
|
-
}
|
1392
|
-
|
1393
1656
|
// ../commons/src/events/utils.ts
|
1394
|
-
|
1395
|
-
return
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
config.actions.map(
|
1400
|
-
({ forms }) => forms.map(
|
1401
|
-
({ pages }) => pages.map(
|
1402
|
-
({ fields }) => fields.map(({ id, label }) => ({ id, label }))
|
1403
|
-
)
|
1404
|
-
)
|
1405
|
-
)
|
1406
|
-
);
|
1657
|
+
var findAllFields = (config) => {
|
1658
|
+
return (0, import_lodash.flattenDeep)([
|
1659
|
+
...getDeclarationFields(config),
|
1660
|
+
...getAllAnnotationFields(config)
|
1661
|
+
]);
|
1407
1662
|
};
|
1408
|
-
var
|
1409
|
-
return (0, import_lodash.flattenDeep)(
|
1410
|
-
config.actions.map((action) => {
|
1411
|
-
if (action.type === ActionType.REQUEST_CORRECTION) {
|
1412
|
-
return [
|
1413
|
-
...action.forms.map(({ pages }) => pages.map(({ fields }) => fields)),
|
1414
|
-
...action.onboardingForm.flatMap(({ fields }) => fields),
|
1415
|
-
...action.additionalDetailsForm.flatMap(({ fields }) => fields)
|
1416
|
-
];
|
1417
|
-
}
|
1418
|
-
return action.forms.map(({ pages }) => pages.map(({ fields }) => fields));
|
1419
|
-
})
|
1420
|
-
);
|
1663
|
+
var getAllAnnotationFields = (config) => {
|
1664
|
+
return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
|
1421
1665
|
};
|
1422
|
-
var
|
1423
|
-
|
1424
|
-
|
1425
|
-
}) =>
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1436
|
-
const pageLabel = pageFields.find((pageField) => pageField.id === field2.id);
|
1437
|
-
if (!pageLabel) {
|
1438
|
-
throw new Error(`Referenced field ${field2.id} does not have a label`);
|
1439
|
-
}
|
1440
|
-
return {
|
1441
|
-
...field2,
|
1442
|
-
label: pageLabel.label
|
1443
|
-
};
|
1444
|
-
});
|
1666
|
+
var getActionAnnotationFields = (actionConfig) => {
|
1667
|
+
if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
|
1668
|
+
return [
|
1669
|
+
...actionConfig.onboardingForm.flatMap(({ fields }) => fields),
|
1670
|
+
...actionConfig.additionalDetailsForm.flatMap(({ fields }) => fields)
|
1671
|
+
];
|
1672
|
+
}
|
1673
|
+
if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
|
1674
|
+
return actionConfig?.printForm.pages.flatMap(({ fields }) => fields) ?? [];
|
1675
|
+
}
|
1676
|
+
if (isDeclarationActionConfig(actionConfig)) {
|
1677
|
+
return actionConfig?.review.fields ?? [];
|
1678
|
+
}
|
1679
|
+
return [];
|
1445
1680
|
};
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
...
|
1450
|
-
|
1681
|
+
var findRecordActionPages = (config, actionType) => {
|
1682
|
+
const action = config.actions.find((a) => a.type === actionType);
|
1683
|
+
if (action?.type === ActionType.REQUEST_CORRECTION) {
|
1684
|
+
return [...action.onboardingForm, ...action.additionalDetailsForm];
|
1685
|
+
}
|
1686
|
+
if (action?.type === ActionType.PRINT_CERTIFICATE) {
|
1687
|
+
return action.printForm.pages;
|
1688
|
+
}
|
1689
|
+
return [];
|
1690
|
+
};
|
1691
|
+
function isDeclarationActionConfig(action) {
|
1692
|
+
return DeclarationActions.safeParse(action.type).success;
|
1693
|
+
}
|
1694
|
+
function getDeclarationFields(configuration) {
|
1695
|
+
return configuration.declaration.pages.flatMap(({ fields }) => fields);
|
1696
|
+
}
|
1697
|
+
function getDeclarationPages(configuration) {
|
1698
|
+
return configuration.declaration.pages;
|
1451
1699
|
}
|
1452
|
-
function
|
1453
|
-
return configuration.
|
1700
|
+
function getDeclaration(configuration) {
|
1701
|
+
return configuration.declaration;
|
1702
|
+
}
|
1703
|
+
function getActionReviewFields(configuration, actionType) {
|
1704
|
+
return getActionReview(configuration, actionType).fields;
|
1705
|
+
}
|
1706
|
+
function getActionReview(configuration, actionType) {
|
1707
|
+
const [actionConfig] = configuration.actions.filter(
|
1708
|
+
(a) => a.type === actionType
|
1709
|
+
);
|
1710
|
+
return getOrThrow(
|
1711
|
+
actionConfig?.review,
|
1712
|
+
`No review config found for ${actionType}`
|
1713
|
+
);
|
1454
1714
|
}
|
1455
1715
|
function validateWorkqueueConfig(workqueueConfigs) {
|
1456
1716
|
workqueueConfigs.map((workqueue) => {
|
@@ -1459,73 +1719,43 @@ function validateWorkqueueConfig(workqueueConfigs) {
|
|
1459
1719
|
);
|
1460
1720
|
if (!rootWorkqueue) {
|
1461
1721
|
throw new Error(
|
1462
|
-
`Invalid workqueue configuration: workqueue not found with id:
|
1722
|
+
`Invalid workqueue configuration: workqueue not found with id: ${workqueue.id}`
|
1463
1723
|
);
|
1464
1724
|
}
|
1465
1725
|
});
|
1466
1726
|
}
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
return form;
|
1471
|
-
};
|
1472
|
-
var findActiveActionFormPages = (configuration, action) => {
|
1473
|
-
return findActiveActionForm(configuration, action)?.pages;
|
1474
|
-
};
|
1475
|
-
var getFormFields = (formConfig) => {
|
1476
|
-
return formConfig.pages.flatMap((p) => p.fields);
|
1477
|
-
};
|
1478
|
-
var findActiveActionFormFields = (configuration, action) => {
|
1479
|
-
const form = findActiveActionForm(configuration, action);
|
1480
|
-
return form ? getFormFields(form) : void 0;
|
1481
|
-
};
|
1482
|
-
var findActiveActionFields = (configuration, action) => {
|
1483
|
-
const form = findActiveActionForm(configuration, action);
|
1484
|
-
const reviewFields = form?.review.fields;
|
1485
|
-
const formFields = form ? getFormFields(form) : void 0;
|
1486
|
-
const allFields = formFields ? formFields.concat(reviewFields ?? []) : reviewFields;
|
1487
|
-
return allFields;
|
1488
|
-
};
|
1489
|
-
var getActiveActionFormPages = (configuration, action) => {
|
1490
|
-
return getOrThrow(
|
1491
|
-
findActiveActionForm(configuration, action)?.pages,
|
1492
|
-
"Form configuration not found for type: " + configuration.id
|
1493
|
-
);
|
1494
|
-
};
|
1495
|
-
function getActiveActionFields(configuration, action) {
|
1496
|
-
const fields = findActiveActionFields(configuration, action);
|
1497
|
-
if (!fields) {
|
1498
|
-
throw new Error(`No active field config found for action type ${action}`);
|
1499
|
-
}
|
1500
|
-
return fields;
|
1501
|
-
}
|
1502
|
-
function getEventConfiguration(eventConfigurations, type) {
|
1503
|
-
const config = eventConfigurations.find((config2) => config2.id === type);
|
1504
|
-
if (!config) {
|
1505
|
-
throw new Error(`Event configuration not found for type: ${type}`);
|
1727
|
+
function isPageVisible(page, formValues) {
|
1728
|
+
if (!page.conditional) {
|
1729
|
+
return true;
|
1506
1730
|
}
|
1507
|
-
return
|
1731
|
+
return validate(page.conditional, {
|
1732
|
+
$form: formValues,
|
1733
|
+
$now: (0, import_date_fns2.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" })
|
1734
|
+
});
|
1508
1735
|
}
|
1736
|
+
var getVisiblePagesFormFields = (formConfig, formData) => {
|
1737
|
+
return formConfig.pages.filter((p) => isPageVisible(p, formData)).flatMap((p) => p.fields);
|
1738
|
+
};
|
1509
1739
|
function isOptionalUncheckedCheckbox(field2, form) {
|
1510
1740
|
if (field2.type !== FieldType.CHECKBOX || field2.required) {
|
1511
1741
|
return false;
|
1512
1742
|
}
|
1513
1743
|
return !form[field2.id];
|
1514
1744
|
}
|
1515
|
-
function stripHiddenFields(fields,
|
1516
|
-
return (0, import_lodash.omitBy)(
|
1745
|
+
function stripHiddenFields(fields, declaration) {
|
1746
|
+
return (0, import_lodash.omitBy)(declaration, (_2, fieldId) => {
|
1517
1747
|
const field2 = fields.find((f) => f.id === fieldId);
|
1518
1748
|
if (!field2) {
|
1519
1749
|
return true;
|
1520
1750
|
}
|
1521
|
-
if (isOptionalUncheckedCheckbox(field2,
|
1751
|
+
if (isOptionalUncheckedCheckbox(field2, declaration)) {
|
1522
1752
|
return true;
|
1523
1753
|
}
|
1524
|
-
return !isFieldVisible(field2,
|
1754
|
+
return !isFieldVisible(field2, declaration);
|
1525
1755
|
});
|
1526
1756
|
}
|
1527
1757
|
function findActiveDrafts(event2, drafts) {
|
1528
|
-
const actions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
1758
|
+
const actions = event2.actions.slice().filter(({ type }) => type !== ActionType.READ).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
1529
1759
|
const lastAction = actions[actions.length - 1];
|
1530
1760
|
return drafts.filter(({ createdAt }) => createdAt >= lastAction.createdAt).filter(({ eventId }) => eventId === event2.id);
|
1531
1761
|
}
|
@@ -1537,28 +1767,50 @@ function createEmptyDraft(eventId, draftId, actionType) {
|
|
1537
1767
|
transactionId: getUUID(),
|
1538
1768
|
action: {
|
1539
1769
|
type: actionType,
|
1540
|
-
|
1541
|
-
|
1770
|
+
declaration: {},
|
1771
|
+
annotation: {},
|
1542
1772
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
1543
1773
|
createdBy: "@todo",
|
1544
1774
|
createdAtLocation: "@todo"
|
1545
1775
|
}
|
1546
1776
|
};
|
1547
1777
|
}
|
1778
|
+
function isVerificationPage(page) {
|
1779
|
+
return page.type === PageTypes.enum.VERIFICATION;
|
1780
|
+
}
|
1781
|
+
function deepMerge(currentDocument, actionDocument) {
|
1782
|
+
return (0, import_lodash.mergeWith)(
|
1783
|
+
currentDocument,
|
1784
|
+
actionDocument,
|
1785
|
+
(previousValue, incomingValue) => {
|
1786
|
+
if (incomingValue === void 0) {
|
1787
|
+
return previousValue;
|
1788
|
+
}
|
1789
|
+
if ((0, import_lodash.isArray)(incomingValue)) {
|
1790
|
+
return incomingValue;
|
1791
|
+
}
|
1792
|
+
if ((0, import_lodash.isObject)(previousValue) && (0, import_lodash.isObject)(incomingValue)) {
|
1793
|
+
return void 0;
|
1794
|
+
}
|
1795
|
+
return incomingValue;
|
1796
|
+
}
|
1797
|
+
);
|
1798
|
+
}
|
1548
1799
|
|
1549
1800
|
// ../commons/src/events/EventConfig.ts
|
1550
|
-
var EventConfig =
|
1551
|
-
id:
|
1801
|
+
var EventConfig = import_zod20.z.object({
|
1802
|
+
id: import_zod20.z.string().describe(
|
1552
1803
|
'A machine-readable identifier for the event, e.g. "birth" or "death"'
|
1553
1804
|
),
|
1554
1805
|
summary: SummaryConfig,
|
1555
1806
|
label: TranslationConfig,
|
1556
|
-
actions:
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1807
|
+
actions: import_zod20.z.array(ActionConfig),
|
1808
|
+
declaration: DeclarationFormConfig,
|
1809
|
+
workqueues: import_zod20.z.array(WorkqueueConfig),
|
1810
|
+
deduplication: import_zod20.z.array(DeduplicationConfig).optional().default([]),
|
1811
|
+
advancedSearch: import_zod20.z.array(AdvancedSearchConfig).optional().default([])
|
1560
1812
|
}).superRefine((event2, ctx) => {
|
1561
|
-
const allFields =
|
1813
|
+
const allFields = findAllFields(event2);
|
1562
1814
|
const fieldIds = allFields.map((field2) => field2.id);
|
1563
1815
|
const advancedSearchFields = event2.advancedSearch.flatMap(
|
1564
1816
|
(section) => section.fields.flatMap((field2) => field2.fieldId)
|
@@ -1585,106 +1837,117 @@ var EventConfig = import_zod18.z.object({
|
|
1585
1837
|
});
|
1586
1838
|
|
1587
1839
|
// ../commons/src/events/EventConfigInput.ts
|
1588
|
-
var
|
1589
|
-
var
|
1840
|
+
var defineDeclarationForm = (form) => DeclarationFormConfig.parse(form);
|
1841
|
+
var defineActionForm = (actionForm) => ActionFormConfig.parse(actionForm);
|
1842
|
+
var definePage = (page) => PageConfig.parse(page);
|
1843
|
+
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
1590
1844
|
|
1591
1845
|
// ../commons/src/events/Draft.ts
|
1592
|
-
var
|
1846
|
+
var import_zod23 = require("zod");
|
1593
1847
|
|
1594
1848
|
// ../commons/src/events/ActionDocument.ts
|
1595
|
-
var
|
1596
|
-
var ActionUpdate =
|
1597
|
-
var
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
|
1849
|
+
var import_zod21 = require("zod");
|
1850
|
+
var ActionUpdate = import_zod21.z.record(import_zod21.z.string(), FieldUpdateValue);
|
1851
|
+
var ActionStatus = {
|
1852
|
+
Requested: "Requested",
|
1853
|
+
Accepted: "Accepted",
|
1854
|
+
Rejected: "Rejected"
|
1855
|
+
};
|
1856
|
+
var ActionBase = import_zod21.z.object({
|
1857
|
+
id: import_zod21.z.string(),
|
1858
|
+
createdAt: import_zod21.z.string().datetime(),
|
1859
|
+
createdBy: import_zod21.z.string(),
|
1860
|
+
declaration: ActionUpdate,
|
1861
|
+
annotation: ActionUpdate.optional(),
|
1862
|
+
createdAtLocation: import_zod21.z.string(),
|
1863
|
+
status: import_zod21.z.enum([
|
1864
|
+
ActionStatus.Requested,
|
1865
|
+
ActionStatus.Accepted,
|
1866
|
+
ActionStatus.Rejected
|
1867
|
+
]),
|
1868
|
+
// If the action is an asynchronous confirmation for another action, we will save the original action id here.
|
1869
|
+
originalActionId: import_zod21.z.string().optional()
|
1604
1870
|
});
|
1605
1871
|
var AssignedAction = ActionBase.merge(
|
1606
|
-
|
1607
|
-
type:
|
1608
|
-
assignedTo:
|
1872
|
+
import_zod21.z.object({
|
1873
|
+
type: import_zod21.z.literal(ActionType.ASSIGN),
|
1874
|
+
assignedTo: import_zod21.z.string()
|
1609
1875
|
})
|
1610
1876
|
);
|
1611
1877
|
var UnassignedAction = ActionBase.merge(
|
1612
|
-
|
1613
|
-
type:
|
1878
|
+
import_zod21.z.object({
|
1879
|
+
type: import_zod21.z.literal(ActionType.UNASSIGN)
|
1614
1880
|
})
|
1615
1881
|
);
|
1616
1882
|
var RegisterAction = ActionBase.merge(
|
1617
|
-
|
1618
|
-
type:
|
1619
|
-
|
1620
|
-
trackingId: import_zod19.z.string(),
|
1621
|
-
registrationNumber: import_zod19.z.string()
|
1622
|
-
})
|
1883
|
+
import_zod21.z.object({
|
1884
|
+
type: import_zod21.z.literal(ActionType.REGISTER),
|
1885
|
+
registrationNumber: import_zod21.z.string().optional()
|
1623
1886
|
})
|
1624
1887
|
);
|
1625
1888
|
var DeclareAction = ActionBase.merge(
|
1626
|
-
|
1627
|
-
type:
|
1889
|
+
import_zod21.z.object({
|
1890
|
+
type: import_zod21.z.literal(ActionType.DECLARE)
|
1628
1891
|
})
|
1629
1892
|
);
|
1630
1893
|
var ValidateAction = ActionBase.merge(
|
1631
|
-
|
1632
|
-
type:
|
1894
|
+
import_zod21.z.object({
|
1895
|
+
type: import_zod21.z.literal(ActionType.VALIDATE)
|
1633
1896
|
})
|
1634
1897
|
);
|
1635
1898
|
var RejectAction = ActionBase.merge(
|
1636
|
-
|
1637
|
-
type:
|
1899
|
+
import_zod21.z.object({
|
1900
|
+
type: import_zod21.z.literal(ActionType.REJECT)
|
1638
1901
|
})
|
1639
1902
|
);
|
1640
1903
|
var MarkAsDuplicateAction = ActionBase.merge(
|
1641
|
-
|
1642
|
-
type:
|
1904
|
+
import_zod21.z.object({
|
1905
|
+
type: import_zod21.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1643
1906
|
})
|
1644
1907
|
);
|
1645
1908
|
var ArchiveAction = ActionBase.merge(
|
1646
|
-
|
1647
|
-
type:
|
1909
|
+
import_zod21.z.object({
|
1910
|
+
type: import_zod21.z.literal(ActionType.ARCHIVE)
|
1648
1911
|
})
|
1649
1912
|
);
|
1650
1913
|
var CreatedAction = ActionBase.merge(
|
1651
|
-
|
1652
|
-
type:
|
1914
|
+
import_zod21.z.object({
|
1915
|
+
type: import_zod21.z.literal(ActionType.CREATE)
|
1653
1916
|
})
|
1654
1917
|
);
|
1655
1918
|
var NotifiedAction = ActionBase.merge(
|
1656
|
-
|
1657
|
-
type:
|
1919
|
+
import_zod21.z.object({
|
1920
|
+
type: import_zod21.z.literal(ActionType.NOTIFY)
|
1658
1921
|
})
|
1659
1922
|
);
|
1660
1923
|
var PrintCertificateAction = ActionBase.merge(
|
1661
|
-
|
1662
|
-
type:
|
1924
|
+
import_zod21.z.object({
|
1925
|
+
type: import_zod21.z.literal(ActionType.PRINT_CERTIFICATE)
|
1663
1926
|
})
|
1664
1927
|
);
|
1665
1928
|
var RequestedCorrectionAction = ActionBase.merge(
|
1666
|
-
|
1667
|
-
type:
|
1929
|
+
import_zod21.z.object({
|
1930
|
+
type: import_zod21.z.literal(ActionType.REQUEST_CORRECTION)
|
1668
1931
|
})
|
1669
1932
|
);
|
1670
1933
|
var ApprovedCorrectionAction = ActionBase.merge(
|
1671
|
-
|
1672
|
-
type:
|
1673
|
-
requestId:
|
1934
|
+
import_zod21.z.object({
|
1935
|
+
type: import_zod21.z.literal(ActionType.APPROVE_CORRECTION),
|
1936
|
+
requestId: import_zod21.z.string()
|
1674
1937
|
})
|
1675
1938
|
);
|
1676
1939
|
var RejectedCorrectionAction = ActionBase.merge(
|
1677
|
-
|
1678
|
-
type:
|
1679
|
-
requestId:
|
1940
|
+
import_zod21.z.object({
|
1941
|
+
type: import_zod21.z.literal(ActionType.REJECT_CORRECTION),
|
1942
|
+
requestId: import_zod21.z.string()
|
1680
1943
|
})
|
1681
1944
|
);
|
1682
|
-
var
|
1683
|
-
|
1684
|
-
type:
|
1945
|
+
var ReadAction = ActionBase.merge(
|
1946
|
+
import_zod21.z.object({
|
1947
|
+
type: import_zod21.z.literal(ActionType.READ)
|
1685
1948
|
})
|
1686
1949
|
);
|
1687
|
-
var ActionDocument =
|
1950
|
+
var ActionDocument = import_zod21.z.discriminatedUnion("type", [
|
1688
1951
|
CreatedAction,
|
1689
1952
|
ValidateAction,
|
1690
1953
|
RejectAction,
|
@@ -1699,108 +1962,123 @@ var ActionDocument = import_zod19.z.discriminatedUnion("type", [
|
|
1699
1962
|
RejectedCorrectionAction,
|
1700
1963
|
UnassignedAction,
|
1701
1964
|
PrintCertificateAction,
|
1702
|
-
|
1965
|
+
ReadAction
|
1703
1966
|
]);
|
1704
|
-
var
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1967
|
+
var AsyncRejectActionDocument = ActionBase.omit({
|
1968
|
+
declaration: true,
|
1969
|
+
annotation: true,
|
1970
|
+
createdBy: true,
|
1971
|
+
createdAtLocation: true
|
1972
|
+
}).merge(
|
1973
|
+
import_zod21.z.object({
|
1974
|
+
type: import_zod21.z.enum(ConfirmableActions),
|
1975
|
+
status: import_zod21.z.literal(ActionStatus.Rejected)
|
1976
|
+
})
|
1977
|
+
);
|
1978
|
+
var Action = import_zod21.z.union([ActionDocument, AsyncRejectActionDocument]);
|
1979
|
+
var ResolvedUser = import_zod21.z.object({
|
1980
|
+
id: import_zod21.z.string(),
|
1981
|
+
role: import_zod21.z.string(),
|
1982
|
+
name: import_zod21.z.array(
|
1983
|
+
import_zod21.z.object({
|
1984
|
+
use: import_zod21.z.string(),
|
1985
|
+
given: import_zod21.z.array(import_zod21.z.string()),
|
1986
|
+
family: import_zod21.z.string()
|
1712
1987
|
})
|
1713
1988
|
)
|
1714
1989
|
});
|
1715
1990
|
|
1716
1991
|
// ../commons/src/events/ActionInput.ts
|
1717
|
-
var
|
1718
|
-
var BaseActionInput =
|
1719
|
-
eventId:
|
1720
|
-
transactionId:
|
1721
|
-
|
1722
|
-
|
1992
|
+
var import_zod22 = require("zod");
|
1993
|
+
var BaseActionInput = import_zod22.z.object({
|
1994
|
+
eventId: import_zod22.z.string(),
|
1995
|
+
transactionId: import_zod22.z.string(),
|
1996
|
+
declaration: ActionUpdate,
|
1997
|
+
annotation: ActionUpdate.optional(),
|
1998
|
+
originalActionId: import_zod22.z.string().optional()
|
1723
1999
|
});
|
1724
2000
|
var CreateActionInput = BaseActionInput.merge(
|
1725
|
-
|
1726
|
-
type:
|
1727
|
-
createdAtLocation:
|
2001
|
+
import_zod22.z.object({
|
2002
|
+
type: import_zod22.z.literal(ActionType.CREATE).default(ActionType.CREATE),
|
2003
|
+
createdAtLocation: import_zod22.z.string()
|
1728
2004
|
})
|
1729
2005
|
);
|
1730
2006
|
var RegisterActionInput = BaseActionInput.merge(
|
1731
|
-
|
1732
|
-
type:
|
1733
|
-
|
1734
|
-
trackingId: import_zod20.z.string(),
|
1735
|
-
registrationNumber: import_zod20.z.string()
|
1736
|
-
})
|
2007
|
+
import_zod22.z.object({
|
2008
|
+
type: import_zod22.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
2009
|
+
registrationNumber: import_zod22.z.string().optional()
|
1737
2010
|
})
|
1738
2011
|
);
|
1739
2012
|
var ValidateActionInput = BaseActionInput.merge(
|
1740
|
-
|
1741
|
-
type:
|
1742
|
-
duplicates:
|
2013
|
+
import_zod22.z.object({
|
2014
|
+
type: import_zod22.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
|
2015
|
+
duplicates: import_zod22.z.array(import_zod22.z.string())
|
1743
2016
|
})
|
1744
2017
|
);
|
1745
2018
|
var NotifyActionInput = BaseActionInput.merge(
|
1746
|
-
|
1747
|
-
type:
|
2019
|
+
import_zod22.z.object({
|
2020
|
+
type: import_zod22.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
|
1748
2021
|
})
|
1749
2022
|
);
|
1750
2023
|
var DeclareActionInput = BaseActionInput.merge(
|
1751
|
-
|
1752
|
-
type:
|
2024
|
+
import_zod22.z.object({
|
2025
|
+
type: import_zod22.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
1753
2026
|
})
|
1754
2027
|
);
|
1755
2028
|
var PrintCertificateActionInput = BaseActionInput.merge(
|
1756
|
-
|
1757
|
-
type:
|
2029
|
+
import_zod22.z.object({
|
2030
|
+
type: import_zod22.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
|
1758
2031
|
})
|
1759
2032
|
);
|
1760
2033
|
var RejectDeclarationActionInput = BaseActionInput.merge(
|
1761
|
-
|
1762
|
-
type:
|
2034
|
+
import_zod22.z.object({
|
2035
|
+
type: import_zod22.z.literal(ActionType.REJECT).default(ActionType.REJECT)
|
1763
2036
|
})
|
1764
2037
|
);
|
1765
2038
|
var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
1766
|
-
|
1767
|
-
type:
|
2039
|
+
import_zod22.z.object({
|
2040
|
+
type: import_zod22.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
1768
2041
|
})
|
1769
2042
|
);
|
1770
2043
|
var ArchiveActionInput = BaseActionInput.merge(
|
1771
|
-
|
1772
|
-
type:
|
2044
|
+
import_zod22.z.object({
|
2045
|
+
type: import_zod22.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE)
|
1773
2046
|
})
|
1774
2047
|
);
|
1775
2048
|
var AssignActionInput = BaseActionInput.merge(
|
1776
|
-
|
1777
|
-
type:
|
1778
|
-
assignedTo:
|
2049
|
+
import_zod22.z.object({
|
2050
|
+
type: import_zod22.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
|
2051
|
+
assignedTo: import_zod22.z.string()
|
1779
2052
|
})
|
1780
2053
|
);
|
1781
2054
|
var UnassignActionInput = BaseActionInput.merge(
|
1782
|
-
|
1783
|
-
type:
|
2055
|
+
import_zod22.z.object({
|
2056
|
+
type: import_zod22.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN)
|
1784
2057
|
})
|
1785
2058
|
);
|
1786
2059
|
var RequestCorrectionActionInput = BaseActionInput.merge(
|
1787
|
-
|
1788
|
-
type:
|
2060
|
+
import_zod22.z.object({
|
2061
|
+
type: import_zod22.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
1789
2062
|
})
|
1790
2063
|
);
|
1791
2064
|
var RejectCorrectionActionInput = BaseActionInput.merge(
|
1792
|
-
|
1793
|
-
requestId:
|
1794
|
-
type:
|
2065
|
+
import_zod22.z.object({
|
2066
|
+
requestId: import_zod22.z.string(),
|
2067
|
+
type: import_zod22.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
|
1795
2068
|
})
|
1796
2069
|
);
|
1797
2070
|
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
1798
|
-
|
1799
|
-
requestId:
|
1800
|
-
type:
|
2071
|
+
import_zod22.z.object({
|
2072
|
+
requestId: import_zod22.z.string(),
|
2073
|
+
type: import_zod22.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
2074
|
+
})
|
2075
|
+
);
|
2076
|
+
var ReadActionInput = BaseActionInput.merge(
|
2077
|
+
import_zod22.z.object({
|
2078
|
+
type: import_zod22.z.literal(ActionType.READ).default(ActionType.READ)
|
1801
2079
|
})
|
1802
2080
|
);
|
1803
|
-
var ActionInput =
|
2081
|
+
var ActionInput = import_zod22.z.discriminatedUnion("type", [
|
1804
2082
|
CreateActionInput,
|
1805
2083
|
ValidateActionInput,
|
1806
2084
|
RegisterActionInput,
|
@@ -1814,49 +2092,50 @@ var ActionInput = import_zod20.z.discriminatedUnion("type", [
|
|
1814
2092
|
PrintCertificateActionInput,
|
1815
2093
|
RequestCorrectionActionInput,
|
1816
2094
|
RejectCorrectionActionInput,
|
1817
|
-
ApproveCorrectionActionInput
|
2095
|
+
ApproveCorrectionActionInput,
|
2096
|
+
ReadActionInput
|
1818
2097
|
]);
|
1819
2098
|
|
1820
2099
|
// ../commons/src/events/Draft.ts
|
1821
|
-
var Draft =
|
1822
|
-
id:
|
1823
|
-
eventId:
|
1824
|
-
transactionId:
|
1825
|
-
createdAt:
|
2100
|
+
var Draft = import_zod23.z.object({
|
2101
|
+
id: import_zod23.z.string(),
|
2102
|
+
eventId: import_zod23.z.string(),
|
2103
|
+
transactionId: import_zod23.z.string(),
|
2104
|
+
createdAt: import_zod23.z.string().datetime(),
|
1826
2105
|
action: ActionBase.extend({
|
1827
|
-
type:
|
1828
|
-
}).omit({ id: true })
|
2106
|
+
type: ActionTypes
|
2107
|
+
}).omit({ id: true, status: true })
|
1829
2108
|
});
|
1830
2109
|
var DraftInput = BaseActionInput.extend({
|
1831
|
-
type:
|
2110
|
+
type: ActionTypes
|
1832
2111
|
});
|
1833
2112
|
|
1834
2113
|
// ../commons/src/events/EventInput.ts
|
1835
|
-
var
|
1836
|
-
var EventInput =
|
1837
|
-
transactionId:
|
1838
|
-
type:
|
2114
|
+
var import_zod24 = require("zod");
|
2115
|
+
var EventInput = import_zod24.z.object({
|
2116
|
+
transactionId: import_zod24.z.string(),
|
2117
|
+
type: import_zod24.z.string()
|
1839
2118
|
});
|
1840
2119
|
|
1841
2120
|
// ../commons/src/events/EventDocument.ts
|
1842
|
-
var
|
1843
|
-
var EventDocument =
|
1844
|
-
id:
|
1845
|
-
type:
|
1846
|
-
createdAt:
|
1847
|
-
updatedAt:
|
1848
|
-
actions:
|
1849
|
-
trackingId:
|
2121
|
+
var import_zod25 = require("zod");
|
2122
|
+
var EventDocument = import_zod25.z.object({
|
2123
|
+
id: import_zod25.z.string(),
|
2124
|
+
type: import_zod25.z.string(),
|
2125
|
+
createdAt: import_zod25.z.string().datetime(),
|
2126
|
+
updatedAt: import_zod25.z.string().datetime(),
|
2127
|
+
actions: import_zod25.z.array(Action),
|
2128
|
+
trackingId: import_zod25.z.string()
|
1850
2129
|
});
|
1851
2130
|
|
1852
2131
|
// ../commons/src/events/EventIndex.ts
|
1853
|
-
var
|
2132
|
+
var import_zod26 = require("zod");
|
1854
2133
|
var EventIndex = EventMetadata.extend({
|
1855
|
-
|
2134
|
+
declaration: import_zod26.z.record(import_zod26.z.string(), import_zod26.z.any())
|
1856
2135
|
});
|
1857
|
-
var EventSearchIndex =
|
1858
|
-
|
1859
|
-
type:
|
2136
|
+
var EventSearchIndex = import_zod26.z.record(import_zod26.z.string(), import_zod26.z.any()).and(
|
2137
|
+
import_zod26.z.object({
|
2138
|
+
type: import_zod26.z.string()
|
1860
2139
|
// Ensures "type" (event-id) exists and is a string
|
1861
2140
|
})
|
1862
2141
|
);
|
@@ -1864,6 +2143,12 @@ var EventSearchIndex = import_zod24.z.record(import_zod24.z.string(), import_zod
|
|
1864
2143
|
// ../commons/src/events/state/index.ts
|
1865
2144
|
var _ = __toESM(require("lodash"));
|
1866
2145
|
function getStatusFromActions(actions) {
|
2146
|
+
const hasRejectedAction = actions.some(
|
2147
|
+
(a) => a.status === ActionStatus.Rejected
|
2148
|
+
);
|
2149
|
+
if (hasRejectedAction) {
|
2150
|
+
return EventStatus.REJECTED;
|
2151
|
+
}
|
1867
2152
|
return actions.reduce((status, action) => {
|
1868
2153
|
if (action.type === ActionType.CREATE) {
|
1869
2154
|
return EventStatus.CREATED;
|
@@ -1900,7 +2185,7 @@ function getAssignedUserFromActions(actions) {
|
|
1900
2185
|
return user2;
|
1901
2186
|
}, null);
|
1902
2187
|
}
|
1903
|
-
function
|
2188
|
+
function aggregateActionDeclarations(actions) {
|
1904
2189
|
const excludedActions = [
|
1905
2190
|
ActionType.REQUEST_CORRECTION,
|
1906
2191
|
ActionType.PRINT_CERTIFICATE
|
@@ -1914,9 +2199,9 @@ function getData(actions) {
|
|
1914
2199
|
if (!requestAction) {
|
1915
2200
|
return status;
|
1916
2201
|
}
|
1917
|
-
return deepMerge(status, requestAction.
|
2202
|
+
return deepMerge(status, requestAction.declaration);
|
1918
2203
|
}
|
1919
|
-
return deepMerge(status, action.
|
2204
|
+
return deepMerge(status, action.declaration);
|
1920
2205
|
}, {});
|
1921
2206
|
}
|
1922
2207
|
function deepDropNulls(obj) {
|
@@ -1934,27 +2219,14 @@ function deepDropNulls(obj) {
|
|
1934
2219
|
return acc;
|
1935
2220
|
}, {});
|
1936
2221
|
}
|
1937
|
-
function deepMerge(currentDocument, actionDocument) {
|
1938
|
-
return _.mergeWith(
|
1939
|
-
currentDocument,
|
1940
|
-
actionDocument,
|
1941
|
-
(previousValue, incomingValue) => {
|
1942
|
-
if (incomingValue === void 0) {
|
1943
|
-
return previousValue;
|
1944
|
-
}
|
1945
|
-
if (_.isArray(incomingValue)) {
|
1946
|
-
return incomingValue;
|
1947
|
-
}
|
1948
|
-
if (_.isObject(previousValue) && _.isObject(incomingValue)) {
|
1949
|
-
return void 0;
|
1950
|
-
}
|
1951
|
-
return incomingValue;
|
1952
|
-
}
|
1953
|
-
);
|
1954
|
-
}
|
1955
2222
|
function isUndeclaredDraft(status) {
|
1956
2223
|
return status === EventStatus.CREATED;
|
1957
2224
|
}
|
2225
|
+
function getAcceptedActions(event2) {
|
2226
|
+
return event2.actions.filter(
|
2227
|
+
(a) => !a.status || a.status === ActionStatus.Accepted
|
2228
|
+
);
|
2229
|
+
}
|
1958
2230
|
function getCurrentEventState(event2) {
|
1959
2231
|
const creationAction = event2.actions.find(
|
1960
2232
|
(action) => action.type === ActionType.CREATE
|
@@ -1962,7 +2234,12 @@ function getCurrentEventState(event2) {
|
|
1962
2234
|
if (!creationAction) {
|
1963
2235
|
throw new Error(`Event ${event2.id} has no creation action`);
|
1964
2236
|
}
|
1965
|
-
const
|
2237
|
+
const activeActions = getAcceptedActions(event2);
|
2238
|
+
const latestAction = activeActions[activeActions.length - 1];
|
2239
|
+
const registrationAction = activeActions.find(
|
2240
|
+
(a) => a.type === ActionType.REGISTER && a.status === ActionStatus.Accepted
|
2241
|
+
);
|
2242
|
+
const registrationNumber = registrationAction?.registrationNumber ?? null;
|
1966
2243
|
return deepDropNulls({
|
1967
2244
|
id: event2.id,
|
1968
2245
|
type: event2.type,
|
@@ -1971,10 +2248,11 @@ function getCurrentEventState(event2) {
|
|
1971
2248
|
createdBy: creationAction.createdBy,
|
1972
2249
|
createdAtLocation: creationAction.createdAtLocation,
|
1973
2250
|
modifiedAt: latestAction.createdAt,
|
1974
|
-
assignedTo: getAssignedUserFromActions(
|
2251
|
+
assignedTo: getAssignedUserFromActions(activeActions),
|
1975
2252
|
updatedBy: latestAction.createdBy,
|
1976
|
-
|
1977
|
-
trackingId: event2.trackingId
|
2253
|
+
declaration: aggregateActionDeclarations(activeActions),
|
2254
|
+
trackingId: event2.trackingId,
|
2255
|
+
registrationNumber
|
1978
2256
|
});
|
1979
2257
|
}
|
1980
2258
|
function getCurrentEventStateWithDrafts(event2, drafts) {
|
@@ -2006,38 +2284,35 @@ function applyDraftsToEventIndex(eventIndex, drafts) {
|
|
2006
2284
|
}
|
2007
2285
|
return {
|
2008
2286
|
...eventIndex,
|
2009
|
-
|
2010
|
-
...eventIndex.
|
2011
|
-
...activeDrafts[activeDrafts.length - 1].
|
2287
|
+
declaration: {
|
2288
|
+
...eventIndex.declaration,
|
2289
|
+
...activeDrafts[activeDrafts.length - 1].declaration
|
2012
2290
|
}
|
2013
2291
|
};
|
2014
2292
|
}
|
2015
|
-
function
|
2293
|
+
function getActionAnnotation({
|
2016
2294
|
event: event2,
|
2017
2295
|
actionType,
|
2018
2296
|
drafts
|
2019
2297
|
}) {
|
2020
|
-
const
|
2298
|
+
const activeActions = getAcceptedActions(event2);
|
2299
|
+
const action = activeActions.find((action2) => actionType === action2.type);
|
2021
2300
|
const eventDrafts = drafts.filter((draft) => draft.eventId === event2.id);
|
2022
2301
|
const sorted = [
|
2023
2302
|
...action ? [action] : [],
|
2024
2303
|
...eventDrafts.map((draft) => draft.action)
|
2025
2304
|
].sort();
|
2026
|
-
const
|
2027
|
-
return deepMerge(
|
2305
|
+
const annotation = sorted.reduce((annotation2, action2) => {
|
2306
|
+
return deepMerge(annotation2, action2.annotation ?? {});
|
2028
2307
|
}, {});
|
2029
|
-
return deepDropNulls(
|
2308
|
+
return deepDropNulls(annotation);
|
2030
2309
|
}
|
2031
2310
|
|
2032
2311
|
// ../commons/src/events/defineConfig.ts
|
2033
2312
|
var defineConfig = (config) => {
|
2034
2313
|
validateWorkqueueConfig(config.workqueues);
|
2035
2314
|
const input = EventConfig.parse(config);
|
2036
|
-
|
2037
|
-
return EventConfig.parse({
|
2038
|
-
...input,
|
2039
|
-
pageFields
|
2040
|
-
});
|
2315
|
+
return input;
|
2041
2316
|
};
|
2042
2317
|
|
2043
2318
|
// ../commons/src/events/transactions.ts
|
@@ -2143,6 +2418,10 @@ function field(fieldId) {
|
|
2143
2418
|
required: ["$form"]
|
2144
2419
|
});
|
2145
2420
|
return {
|
2421
|
+
/**
|
2422
|
+
* @private Internal property used for field reference tracking.
|
2423
|
+
*/
|
2424
|
+
_returning: fieldId,
|
2146
2425
|
isAfter: () => ({
|
2147
2426
|
days: (days) => ({
|
2148
2427
|
inPast: () => defineConditional(
|
@@ -2167,25 +2446,54 @@ function field(fieldId) {
|
|
2167
2446
|
date: (date) => defineConditional(getDateRange(date, "formatMaximum")),
|
2168
2447
|
now: () => defineConditional(getDateRange(getDateFromNow(0), "formatMaximum"))
|
2169
2448
|
}),
|
2170
|
-
|
2171
|
-
|
2172
|
-
|
2173
|
-
|
2449
|
+
// TODO CIHAN: typing
|
2450
|
+
isEqualTo: (value) => {
|
2451
|
+
if (typeof value === "object" && value._returning) {
|
2452
|
+
const comparedFieldId = value._returning;
|
2453
|
+
return defineConditional({
|
2174
2454
|
type: "object",
|
2175
2455
|
properties: {
|
2176
|
-
|
2177
|
-
|
2178
|
-
|
2179
|
-
{ type: "
|
2180
|
-
|
2181
|
-
|
2456
|
+
$form: {
|
2457
|
+
type: "object",
|
2458
|
+
properties: {
|
2459
|
+
[fieldId]: { type: ["string", "boolean"] },
|
2460
|
+
[comparedFieldId]: { type: ["string", "boolean"] }
|
2461
|
+
},
|
2462
|
+
required: [fieldId, comparedFieldId],
|
2463
|
+
allOf: [
|
2464
|
+
{
|
2465
|
+
properties: {
|
2466
|
+
[fieldId]: {
|
2467
|
+
const: { $data: `1/${comparedFieldId}` }
|
2468
|
+
}
|
2469
|
+
}
|
2470
|
+
}
|
2471
|
+
]
|
2182
2472
|
}
|
2183
2473
|
},
|
2184
|
-
required: [
|
2185
|
-
}
|
2186
|
-
}
|
2187
|
-
|
2188
|
-
|
2474
|
+
required: ["$form"]
|
2475
|
+
});
|
2476
|
+
}
|
2477
|
+
return defineConditional({
|
2478
|
+
type: "object",
|
2479
|
+
properties: {
|
2480
|
+
$form: {
|
2481
|
+
type: "object",
|
2482
|
+
properties: {
|
2483
|
+
[fieldId]: {
|
2484
|
+
oneOf: [
|
2485
|
+
{ type: "string", const: value },
|
2486
|
+
{ type: "boolean", const: value }
|
2487
|
+
],
|
2488
|
+
const: value
|
2489
|
+
}
|
2490
|
+
},
|
2491
|
+
required: [fieldId]
|
2492
|
+
}
|
2493
|
+
},
|
2494
|
+
required: ["$form"]
|
2495
|
+
});
|
2496
|
+
},
|
2189
2497
|
/**
|
2190
2498
|
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
2191
2499
|
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|
@@ -2256,29 +2564,93 @@ function field(fieldId) {
|
|
2256
2564
|
}
|
2257
2565
|
},
|
2258
2566
|
required: ["$form"]
|
2567
|
+
}),
|
2568
|
+
isValidEnglishName: () => defineConditional({
|
2569
|
+
type: "object",
|
2570
|
+
properties: {
|
2571
|
+
$form: {
|
2572
|
+
type: "object",
|
2573
|
+
properties: {
|
2574
|
+
[fieldId]: {
|
2575
|
+
type: "string",
|
2576
|
+
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'._-]*)*$",
|
2577
|
+
description: "Name must contain only letters, numbers, and allowed special characters ('._-). No double spaces."
|
2578
|
+
}
|
2579
|
+
},
|
2580
|
+
required: [fieldId]
|
2581
|
+
}
|
2582
|
+
},
|
2583
|
+
required: ["$form"]
|
2584
|
+
}),
|
2585
|
+
isValidNationalId: () => defineConditional({
|
2586
|
+
type: "object",
|
2587
|
+
properties: {
|
2588
|
+
$form: {
|
2589
|
+
type: "object",
|
2590
|
+
properties: {
|
2591
|
+
[fieldId]: {
|
2592
|
+
type: "string",
|
2593
|
+
pattern: "^[0-9]{9}$",
|
2594
|
+
description: "The National ID can only be numeric and must be 9 digits long."
|
2595
|
+
}
|
2596
|
+
},
|
2597
|
+
required: [fieldId]
|
2598
|
+
}
|
2599
|
+
},
|
2600
|
+
required: ["$form"]
|
2601
|
+
}),
|
2602
|
+
/**
|
2603
|
+
* Checks if the field value matches a given regular expression pattern.
|
2604
|
+
* @param pattern - The regular expression pattern to match the field value against.
|
2605
|
+
* @returns A JSONSchema conditional that validates the field value against the pattern.
|
2606
|
+
*/
|
2607
|
+
matches: (pattern) => defineConditional({
|
2608
|
+
type: "object",
|
2609
|
+
properties: {
|
2610
|
+
$form: {
|
2611
|
+
type: "object",
|
2612
|
+
properties: {
|
2613
|
+
[fieldId]: {
|
2614
|
+
type: "string",
|
2615
|
+
pattern
|
2616
|
+
}
|
2617
|
+
},
|
2618
|
+
required: [fieldId]
|
2619
|
+
}
|
2620
|
+
},
|
2621
|
+
required: ["$form"]
|
2622
|
+
}),
|
2623
|
+
isBetween: (min, max) => defineConditional({
|
2624
|
+
type: "object",
|
2625
|
+
properties: {
|
2626
|
+
$form: {
|
2627
|
+
type: "object",
|
2628
|
+
properties: {
|
2629
|
+
[fieldId]: {
|
2630
|
+
type: "number",
|
2631
|
+
minimum: min,
|
2632
|
+
maximum: max
|
2633
|
+
}
|
2634
|
+
},
|
2635
|
+
required: [fieldId]
|
2636
|
+
}
|
2637
|
+
},
|
2638
|
+
required: ["$form"]
|
2259
2639
|
})
|
2260
2640
|
};
|
2261
2641
|
}
|
2262
2642
|
|
2263
2643
|
// ../commons/src/fixtures/tennis-club-membership-event.ts
|
2264
|
-
var PRINT_CERTIFICATE_FORM =
|
2644
|
+
var PRINT_CERTIFICATE_FORM = defineActionForm({
|
2265
2645
|
label: {
|
2266
2646
|
id: "v2.event.tennis-club-membership.action.certificate.form.label",
|
2267
2647
|
defaultMessage: "Tennis club membership certificate collector",
|
2268
2648
|
description: "This is what this form is referred as in the system"
|
2269
2649
|
},
|
2270
|
-
version: {
|
2271
|
-
id: "1.0.0",
|
2272
|
-
label: {
|
2273
|
-
id: "v2.event.tennis-club-membership.action.certificate.form.version.1",
|
2274
|
-
defaultMessage: "Version 1",
|
2275
|
-
description: "This is the first version of the form"
|
2276
|
-
}
|
2277
|
-
},
|
2278
|
-
active: true,
|
2279
2650
|
pages: [
|
2280
2651
|
{
|
2281
2652
|
id: "collector",
|
2653
|
+
type: PageTypes.enum.FORM,
|
2282
2654
|
title: {
|
2283
2655
|
id: "v2.event.tennis-club-membership.action.certificate.form.section.who.title",
|
2284
2656
|
defaultMessage: "Print certified copy",
|
@@ -2293,7 +2665,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2293
2665
|
defaultMessage: "Requester",
|
2294
2666
|
description: "This is the label for the field"
|
2295
2667
|
},
|
2296
|
-
type:
|
2668
|
+
type: FieldType.SELECT,
|
2297
2669
|
options: [
|
2298
2670
|
{
|
2299
2671
|
value: "INFORMANT",
|
@@ -2370,7 +2742,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2370
2742
|
defaultMessage: "Select Type of ID",
|
2371
2743
|
description: "This is the label for selecting the type of ID"
|
2372
2744
|
},
|
2373
|
-
type:
|
2745
|
+
type: FieldType.SELECT,
|
2374
2746
|
options: [
|
2375
2747
|
{
|
2376
2748
|
value: "PASSPORT",
|
@@ -2471,7 +2843,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2471
2843
|
defaultMessage: "Passport Details",
|
2472
2844
|
description: "Field for entering Passport details"
|
2473
2845
|
},
|
2474
|
-
type:
|
2846
|
+
type: FieldType.TEXT
|
2475
2847
|
},
|
2476
2848
|
{
|
2477
2849
|
id: "collector.DRIVING_LICENSE.details",
|
@@ -2522,7 +2894,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2522
2894
|
defaultMessage: "Driving License Details",
|
2523
2895
|
description: "Field for entering Driving License details"
|
2524
2896
|
},
|
2525
|
-
type:
|
2897
|
+
type: FieldType.TEXT
|
2526
2898
|
},
|
2527
2899
|
{
|
2528
2900
|
id: "collector.REFUGEE_NUMBER.details",
|
@@ -2573,7 +2945,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2573
2945
|
defaultMessage: "Refugee Number Details",
|
2574
2946
|
description: "Field for entering Refugee Number details"
|
2575
2947
|
},
|
2576
|
-
type:
|
2948
|
+
type: FieldType.TEXT
|
2577
2949
|
},
|
2578
2950
|
{
|
2579
2951
|
id: "collector.ALIEN_NUMBER.details",
|
@@ -2624,7 +2996,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2624
2996
|
defaultMessage: "Alien Number Details",
|
2625
2997
|
description: "Field for entering Alien Number details"
|
2626
2998
|
},
|
2627
|
-
type:
|
2999
|
+
type: FieldType.TEXT
|
2628
3000
|
},
|
2629
3001
|
{
|
2630
3002
|
id: "collector.OTHER.idTypeOther",
|
@@ -2675,7 +3047,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2675
3047
|
defaultMessage: "Other ID Type (if applicable)",
|
2676
3048
|
description: 'Field for entering ID type if "Other" is selected'
|
2677
3049
|
},
|
2678
|
-
type:
|
3050
|
+
type: FieldType.TEXT
|
2679
3051
|
},
|
2680
3052
|
{
|
2681
3053
|
id: "collector.OTHER.firstName",
|
@@ -2726,7 +3098,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2726
3098
|
defaultMessage: "First Name",
|
2727
3099
|
description: "This is the label for the first name field"
|
2728
3100
|
},
|
2729
|
-
type:
|
3101
|
+
type: FieldType.TEXT
|
2730
3102
|
},
|
2731
3103
|
{
|
2732
3104
|
id: "collector.OTHER.lastName",
|
@@ -2777,7 +3149,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2777
3149
|
defaultMessage: "Last Name",
|
2778
3150
|
description: "This is the label for the last name field"
|
2779
3151
|
},
|
2780
|
-
type:
|
3152
|
+
type: FieldType.TEXT
|
2781
3153
|
},
|
2782
3154
|
{
|
2783
3155
|
id: "collector.OTHER.relationshipToMember",
|
@@ -2828,7 +3200,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2828
3200
|
defaultMessage: "Relationship to Member",
|
2829
3201
|
description: "This is the label for the relationship to member field"
|
2830
3202
|
},
|
2831
|
-
type:
|
3203
|
+
type: FieldType.TEXT
|
2832
3204
|
},
|
2833
3205
|
{
|
2834
3206
|
id: "collector.OTHER.signedAffidavit",
|
@@ -2879,66 +3251,88 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2879
3251
|
defaultMessage: "Signed Affidavit (Optional)",
|
2880
3252
|
description: "This is the label for uploading a signed affidavit"
|
2881
3253
|
},
|
2882
|
-
type:
|
3254
|
+
type: FieldType.FILE
|
2883
3255
|
}
|
2884
3256
|
]
|
2885
|
-
}
|
2886
|
-
],
|
2887
|
-
review: {
|
2888
|
-
title: {
|
2889
|
-
id: "v2.event.tennis-club-membership.action.certificate.form.review.title",
|
2890
|
-
defaultMessage: "Member certificate collector for {firstname} {surname}",
|
2891
|
-
description: "Title of the form to show in review page"
|
2892
3257
|
},
|
2893
|
-
|
2894
|
-
|
2895
|
-
|
2896
|
-
|
2897
|
-
|
2898
|
-
|
2899
|
-
|
2900
|
-
|
2901
|
-
|
2902
|
-
|
2903
|
-
|
2904
|
-
|
2905
|
-
|
2906
|
-
|
2907
|
-
|
2908
|
-
|
3258
|
+
{
|
3259
|
+
id: "collector.identity.verify",
|
3260
|
+
type: PageTypes.enum.VERIFICATION,
|
3261
|
+
conditional: field("collector.requesterId").isEqualTo("INFORMANT"),
|
3262
|
+
title: {
|
3263
|
+
id: "event.tennis-club-membership.action.print.verifyIdentity",
|
3264
|
+
defaultMessage: "Verify their identity",
|
3265
|
+
description: "This is the title of the section"
|
3266
|
+
},
|
3267
|
+
fields: [],
|
3268
|
+
actions: {
|
3269
|
+
verify: {
|
3270
|
+
label: {
|
3271
|
+
defaultMessage: "Verified",
|
3272
|
+
description: "This is the label for the verification button",
|
3273
|
+
id: "v2.event.tennis-club-membership.action.certificate.form.verify"
|
3274
|
+
}
|
3275
|
+
},
|
3276
|
+
cancel: {
|
3277
|
+
label: {
|
3278
|
+
defaultMessage: "Identity does not match",
|
3279
|
+
description: "This is the label for the verification cancellation button",
|
3280
|
+
id: "v2.event.tennis-club-membership.action.certificate.form.cancel"
|
3281
|
+
},
|
3282
|
+
confirmation: {
|
3283
|
+
title: {
|
3284
|
+
defaultMessage: "Print without proof of ID?",
|
3285
|
+
description: "This is the title for the verification cancellation modal",
|
3286
|
+
id: "v2.event.tennis-club-membership.action.certificate.form.cancel.confirmation.title"
|
3287
|
+
},
|
3288
|
+
body: {
|
3289
|
+
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",
|
3290
|
+
description: "This is the body for the verification cancellation modal",
|
3291
|
+
id: "v2.event.tennis-club-membership.action.certificate.form.cancel.confirmation.body"
|
3292
|
+
}
|
3293
|
+
}
|
3294
|
+
}
|
3295
|
+
}
|
2909
3296
|
}
|
3297
|
+
]
|
3298
|
+
});
|
3299
|
+
var TENNIS_CLUB_DECLARATION_REVIEW = {
|
3300
|
+
title: {
|
3301
|
+
id: "v2.event.tennis-club-membership.action.declare.form.review.title",
|
3302
|
+
defaultMessage: "{applicant.firstname, select, __EMPTY__ {Member declaration} other {{applicant.surname, select, __EMPTY__ {Member declaration} other {Member declaration for {applicant.firstname} {applicant.surname}}}}}",
|
3303
|
+
description: "Title of the review page"
|
2910
3304
|
},
|
2911
|
-
|
2912
|
-
|
2913
|
-
id: "
|
2914
|
-
|
2915
|
-
|
3305
|
+
fields: [
|
3306
|
+
{
|
3307
|
+
id: "review.comment",
|
3308
|
+
type: FieldType.TEXTAREA,
|
3309
|
+
label: {
|
3310
|
+
defaultMessage: "Comment",
|
3311
|
+
id: "v2.event.birth.action.declare.form.review.comment.label",
|
3312
|
+
description: "Label for the comment field in the review section"
|
3313
|
+
}
|
2916
3314
|
},
|
2917
|
-
|
2918
|
-
|
2919
|
-
|
2920
|
-
|
2921
|
-
|
2922
|
-
|
2923
|
-
|
2924
|
-
description: "Label for the comment field in the review section"
|
2925
|
-
}
|
3315
|
+
{
|
3316
|
+
type: FieldType.SIGNATURE,
|
3317
|
+
id: "review.signature",
|
3318
|
+
label: {
|
3319
|
+
defaultMessage: "Signature of informant",
|
3320
|
+
id: "v2.event.birth.action.declare.form.review.signature.label",
|
3321
|
+
description: "Label for the signature field in the review section"
|
2926
3322
|
},
|
2927
|
-
{
|
2928
|
-
|
2929
|
-
|
2930
|
-
|
2931
|
-
defaultMessage: "Signature of informant",
|
2932
|
-
id: "v2.event.birth.action.declare.form.review.signature.label",
|
2933
|
-
description: "Label for the signature field in the review section"
|
2934
|
-
},
|
2935
|
-
signaturePromptLabel: {
|
2936
|
-
id: "v2.signature.upload.modal.title",
|
2937
|
-
defaultMessage: "Draw signature",
|
2938
|
-
description: "Title for the modal to draw signature"
|
2939
|
-
}
|
3323
|
+
signaturePromptLabel: {
|
3324
|
+
id: "v2.signature.upload.modal.title",
|
3325
|
+
defaultMessage: "Draw signature",
|
3326
|
+
description: "Title for the modal to draw signature"
|
2940
3327
|
}
|
2941
|
-
|
3328
|
+
}
|
3329
|
+
]
|
3330
|
+
};
|
3331
|
+
var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
3332
|
+
label: {
|
3333
|
+
id: "v2.event.tennis-club-membership.action.declare.form.label",
|
3334
|
+
defaultMessage: "Tennis club membership application",
|
3335
|
+
description: "This is what this form is referred as in the system"
|
2942
3336
|
},
|
2943
3337
|
pages: [
|
2944
3338
|
{
|
@@ -2951,7 +3345,7 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
2951
3345
|
fields: [
|
2952
3346
|
{
|
2953
3347
|
id: "applicant.firstname",
|
2954
|
-
type:
|
3348
|
+
type: FieldType.TEXT,
|
2955
3349
|
required: true,
|
2956
3350
|
conditionals: [],
|
2957
3351
|
label: {
|
@@ -2962,7 +3356,7 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
2962
3356
|
},
|
2963
3357
|
{
|
2964
3358
|
id: "applicant.surname",
|
2965
|
-
type:
|
3359
|
+
type: FieldType.TEXT,
|
2966
3360
|
required: true,
|
2967
3361
|
conditionals: [],
|
2968
3362
|
label: {
|
@@ -3005,7 +3399,7 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
3005
3399
|
},
|
3006
3400
|
{
|
3007
3401
|
id: "applicant.image",
|
3008
|
-
type:
|
3402
|
+
type: FieldType.FILE,
|
3009
3403
|
required: false,
|
3010
3404
|
label: {
|
3011
3405
|
defaultMessage: "Applicant's profile picture",
|
@@ -3026,6 +3420,27 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
3026
3420
|
}
|
3027
3421
|
]
|
3028
3422
|
},
|
3423
|
+
{
|
3424
|
+
id: "senior-pass",
|
3425
|
+
conditional: field("applicant.dob").isBefore().date("1950-01-01"),
|
3426
|
+
title: {
|
3427
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.senior-pass.title",
|
3428
|
+
defaultMessage: "Assign senior pass for applicant",
|
3429
|
+
description: "This is the title of the section"
|
3430
|
+
},
|
3431
|
+
fields: [
|
3432
|
+
{
|
3433
|
+
id: "senior-pass.id",
|
3434
|
+
type: FieldType.TEXT,
|
3435
|
+
required: true,
|
3436
|
+
label: {
|
3437
|
+
defaultMessage: "Senior pass ID",
|
3438
|
+
description: "This is the label for the field",
|
3439
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.senior-pass.field.id.label"
|
3440
|
+
}
|
3441
|
+
}
|
3442
|
+
]
|
3443
|
+
},
|
3029
3444
|
{
|
3030
3445
|
id: "recommender",
|
3031
3446
|
title: {
|
@@ -3047,7 +3462,7 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
3047
3462
|
},
|
3048
3463
|
{
|
3049
3464
|
id: "recommender.firstname",
|
3050
|
-
type:
|
3465
|
+
type: FieldType.TEXT,
|
3051
3466
|
required: true,
|
3052
3467
|
conditionals: [
|
3053
3468
|
{
|
@@ -3063,7 +3478,7 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
3063
3478
|
},
|
3064
3479
|
{
|
3065
3480
|
id: "recommender.surname",
|
3066
|
-
type:
|
3481
|
+
type: FieldType.TEXT,
|
3067
3482
|
required: true,
|
3068
3483
|
conditionals: [
|
3069
3484
|
{
|
@@ -3079,7 +3494,7 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
3079
3494
|
},
|
3080
3495
|
{
|
3081
3496
|
id: "recommender.id",
|
3082
|
-
type:
|
3497
|
+
type: FieldType.TEXT,
|
3083
3498
|
required: true,
|
3084
3499
|
conditionals: [
|
3085
3500
|
{
|
@@ -3187,7 +3602,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3187
3602
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
3188
3603
|
id: "event.tennis-club-membership.action.declare.label"
|
3189
3604
|
},
|
3190
|
-
|
3605
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
3191
3606
|
},
|
3192
3607
|
{
|
3193
3608
|
type: ActionType.VALIDATE,
|
@@ -3196,7 +3611,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3196
3611
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
3197
3612
|
id: "event.tennis-club-membership.action.validate.label"
|
3198
3613
|
},
|
3199
|
-
|
3614
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
3200
3615
|
},
|
3201
3616
|
{
|
3202
3617
|
type: ActionType.REGISTER,
|
@@ -3205,7 +3620,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3205
3620
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
3206
3621
|
id: "event.tennis-club-membership.action.register.label"
|
3207
3622
|
},
|
3208
|
-
|
3623
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
3209
3624
|
},
|
3210
3625
|
{
|
3211
3626
|
type: ActionType.REQUEST_CORRECTION,
|
@@ -3214,10 +3629,10 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3214
3629
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
3215
3630
|
id: "event.tennis-club-membership.action.correction.request.label"
|
3216
3631
|
},
|
3217
|
-
forms: [TENNIS_CLUB_FORM],
|
3218
3632
|
onboardingForm: [
|
3219
3633
|
{
|
3220
3634
|
id: "correction-requester",
|
3635
|
+
type: PageTypes.enum.FORM,
|
3221
3636
|
title: {
|
3222
3637
|
id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
|
3223
3638
|
defaultMessage: "Correction requester",
|
@@ -3281,6 +3696,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3281
3696
|
},
|
3282
3697
|
{
|
3283
3698
|
id: "identity-check",
|
3699
|
+
type: PageTypes.enum.FORM,
|
3284
3700
|
title: {
|
3285
3701
|
id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
|
3286
3702
|
defaultMessage: "Verify their identity",
|
@@ -3323,6 +3739,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3323
3739
|
additionalDetailsForm: [
|
3324
3740
|
{
|
3325
3741
|
id: "correction-request.supporting-documents",
|
3742
|
+
type: PageTypes.enum.FORM,
|
3326
3743
|
title: {
|
3327
3744
|
id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
|
3328
3745
|
defaultMessage: "Upload supporting documents",
|
@@ -3340,7 +3757,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3340
3757
|
},
|
3341
3758
|
{
|
3342
3759
|
id: "correction.supportingDocs",
|
3343
|
-
type:
|
3760
|
+
type: FieldType.FILE,
|
3344
3761
|
label: {
|
3345
3762
|
id: "correction.corrector.title",
|
3346
3763
|
defaultMessage: "Upload supporting documents",
|
@@ -3384,6 +3801,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3384
3801
|
},
|
3385
3802
|
{
|
3386
3803
|
id: "correction-request.additional-details",
|
3804
|
+
type: PageTypes.enum.FORM,
|
3387
3805
|
title: {
|
3388
3806
|
id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
|
3389
3807
|
defaultMessage: "Reason for correction",
|
@@ -3392,7 +3810,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3392
3810
|
fields: [
|
3393
3811
|
{
|
3394
3812
|
id: "correction.request.reason",
|
3395
|
-
type:
|
3813
|
+
type: FieldType.TEXT,
|
3396
3814
|
label: {
|
3397
3815
|
id: "correction.reason.title",
|
3398
3816
|
defaultMessage: "Reason for correction?",
|
@@ -3405,7 +3823,6 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3405
3823
|
},
|
3406
3824
|
{
|
3407
3825
|
type: ActionType.APPROVE_CORRECTION,
|
3408
|
-
forms: [TENNIS_CLUB_FORM],
|
3409
3826
|
label: {
|
3410
3827
|
defaultMessage: "Approve correction",
|
3411
3828
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
@@ -3419,7 +3836,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3419
3836
|
defaultMessage: "Print certificate",
|
3420
3837
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
3421
3838
|
},
|
3422
|
-
|
3839
|
+
printForm: PRINT_CERTIFICATE_FORM,
|
3423
3840
|
conditionals: [
|
3424
3841
|
{
|
3425
3842
|
type: "SHOW",
|
@@ -3466,8 +3883,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3466
3883
|
id: "v2.event.tennis-club-membership.action.archive.label",
|
3467
3884
|
defaultMessage: "Archive",
|
3468
3885
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
3469
|
-
}
|
3470
|
-
forms: [TENNIS_CLUB_FORM]
|
3886
|
+
}
|
3471
3887
|
},
|
3472
3888
|
{
|
3473
3889
|
type: ActionType.REJECT,
|
@@ -3475,8 +3891,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3475
3891
|
id: "v2.event.tennis-club-membership.action.reject.label",
|
3476
3892
|
defaultMessage: "Reject",
|
3477
3893
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
3478
|
-
}
|
3479
|
-
forms: [TENNIS_CLUB_FORM]
|
3894
|
+
}
|
3480
3895
|
}
|
3481
3896
|
],
|
3482
3897
|
advancedSearch: [
|
@@ -3492,20 +3907,49 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3492
3907
|
}
|
3493
3908
|
]
|
3494
3909
|
}
|
3495
|
-
]
|
3910
|
+
],
|
3911
|
+
declaration: TENNIS_CLUB_DECLARATION_FORM
|
3496
3912
|
});
|
3497
3913
|
|
3498
3914
|
// ../commons/src/events/test.utils.ts
|
3499
|
-
function
|
3500
|
-
|
3501
|
-
const data = fields.reduce(
|
3915
|
+
function fieldConfigsToActionAnnotation(fields) {
|
3916
|
+
return fields.reduce(
|
3502
3917
|
(acc, field2, i) => ({
|
3503
3918
|
...acc,
|
3504
3919
|
[field2.id]: mapFieldTypeToMockValue(field2, i)
|
3505
3920
|
}),
|
3506
3921
|
{}
|
3507
3922
|
);
|
3508
|
-
|
3923
|
+
}
|
3924
|
+
function generateActionInput(configuration, action) {
|
3925
|
+
const parsed = DeclarationUpdateActions.safeParse(action);
|
3926
|
+
if (parsed.success) {
|
3927
|
+
const fields = getDeclarationFields(configuration);
|
3928
|
+
const annotation = fieldConfigsToActionAnnotation(fields);
|
3929
|
+
return stripHiddenFields(fields, annotation);
|
3930
|
+
}
|
3931
|
+
console.warn(`${action} is not a declaration action. Setting data as {}.`);
|
3932
|
+
return {};
|
3933
|
+
}
|
3934
|
+
function generateActionMetadataInput(configuration, action) {
|
3935
|
+
const actionConfig = configuration.actions.find(
|
3936
|
+
(actionConfig2) => actionConfig2.type === action
|
3937
|
+
);
|
3938
|
+
const annotationFields = actionConfig ? getActionAnnotationFields(actionConfig) : [];
|
3939
|
+
const annotation = fieldConfigsToActionAnnotation(annotationFields);
|
3940
|
+
const visibleVerificationPageIds = (findRecordActionPages(configuration, action) ?? []).filter((page) => isVerificationPage(page)).filter((page) => isPageVisible(page, annotation)).map((page) => page.id) ?? [];
|
3941
|
+
const visiblePageVerificationMap = visibleVerificationPageIds.reduce(
|
3942
|
+
(acc, pageId) => ({
|
3943
|
+
...acc,
|
3944
|
+
[pageId]: true
|
3945
|
+
}),
|
3946
|
+
{}
|
3947
|
+
);
|
3948
|
+
const fieldBasedPayload = stripHiddenFields(annotationFields, annotation);
|
3949
|
+
return {
|
3950
|
+
...fieldBasedPayload,
|
3951
|
+
...visiblePageVerificationMap
|
3952
|
+
};
|
3509
3953
|
}
|
3510
3954
|
var eventPayloadGenerator = {
|
3511
3955
|
create: (input = {}) => ({
|
@@ -3525,13 +3969,13 @@ var eventPayloadGenerator = {
|
|
3525
3969
|
transactionId: getUUID(),
|
3526
3970
|
action: {
|
3527
3971
|
type: ActionType.REQUEST_CORRECTION,
|
3528
|
-
|
3972
|
+
declaration: {
|
3529
3973
|
"applicant.firstname": "Max",
|
3530
3974
|
"applicant.surname": "McLaren",
|
3531
3975
|
"applicant.dob": "2020-01-02",
|
3532
3976
|
"recommender.none": true
|
3533
3977
|
},
|
3534
|
-
|
3978
|
+
annotation: {
|
3535
3979
|
"correction.requester.relationship": "ANOTHER_AGENT",
|
3536
3980
|
"correction.request.reason": "Child's name was incorrect"
|
3537
3981
|
},
|
@@ -3546,41 +3990,78 @@ var eventPayloadGenerator = {
|
|
3546
3990
|
declare: (eventId, input = {}) => ({
|
3547
3991
|
type: ActionType.DECLARE,
|
3548
3992
|
transactionId: input.transactionId ?? getUUID(),
|
3549
|
-
|
3993
|
+
declaration: input.declaration ?? generateActionInput(tennisClubMembershipEvent, ActionType.DECLARE),
|
3994
|
+
annotation: input.annotation ?? generateActionMetadataInput(
|
3995
|
+
tennisClubMembershipEvent,
|
3996
|
+
ActionType.DECLARE
|
3997
|
+
),
|
3550
3998
|
eventId
|
3551
3999
|
}),
|
4000
|
+
/**
|
4001
|
+
* Notify allows sending incomplete data. Think it as 'partial declare' for now.
|
4002
|
+
*/
|
4003
|
+
notify: (eventId, input = {}) => {
|
4004
|
+
let declaration = input.declaration;
|
4005
|
+
if (!declaration) {
|
4006
|
+
const partialDeclaration = (0, import_lodash2.omitBy)(
|
4007
|
+
generateActionInput(tennisClubMembershipEvent, ActionType.DECLARE),
|
4008
|
+
import_lodash2.isString
|
4009
|
+
);
|
4010
|
+
declaration = partialDeclaration;
|
4011
|
+
}
|
4012
|
+
return {
|
4013
|
+
type: ActionType.NOTIFY,
|
4014
|
+
transactionId: input.transactionId ?? getUUID(),
|
4015
|
+
declaration,
|
4016
|
+
eventId
|
4017
|
+
};
|
4018
|
+
},
|
3552
4019
|
validate: (eventId, input = {}) => ({
|
3553
4020
|
type: ActionType.VALIDATE,
|
3554
4021
|
transactionId: input.transactionId ?? getUUID(),
|
3555
|
-
|
4022
|
+
declaration: input.declaration ?? generateActionInput(tennisClubMembershipEvent, ActionType.VALIDATE),
|
4023
|
+
annotation: input.annotation ?? generateActionMetadataInput(
|
4024
|
+
tennisClubMembershipEvent,
|
4025
|
+
ActionType.VALIDATE
|
4026
|
+
),
|
3556
4027
|
duplicates: [],
|
3557
4028
|
eventId
|
3558
4029
|
}),
|
3559
4030
|
archive: (eventId, input = {}, isDuplicate) => ({
|
3560
4031
|
type: ActionType.ARCHIVE,
|
3561
4032
|
transactionId: input.transactionId ?? getUUID(),
|
3562
|
-
|
3563
|
-
|
4033
|
+
declaration: {},
|
4034
|
+
// @TODO: Check whether generator is needed?
|
4035
|
+
annotation: { isDuplicate: isDuplicate ?? false },
|
3564
4036
|
duplicates: [],
|
3565
4037
|
eventId
|
3566
4038
|
}),
|
3567
4039
|
reject: (eventId, input = {}) => ({
|
3568
4040
|
type: ActionType.REJECT,
|
3569
4041
|
transactionId: input.transactionId ?? getUUID(),
|
3570
|
-
|
4042
|
+
declaration: {},
|
4043
|
+
annotation: input.annotation ?? generateActionMetadataInput(
|
4044
|
+
tennisClubMembershipEvent,
|
4045
|
+
ActionType.REJECT
|
4046
|
+
),
|
3571
4047
|
duplicates: [],
|
3572
4048
|
eventId
|
3573
4049
|
}),
|
3574
4050
|
register: (eventId, input = {}) => ({
|
3575
4051
|
type: ActionType.REGISTER,
|
3576
4052
|
transactionId: input.transactionId ?? getUUID(),
|
3577
|
-
|
4053
|
+
declaration: input.declaration ?? generateActionInput(tennisClubMembershipEvent, ActionType.REGISTER),
|
4054
|
+
annotation: input.annotation ?? generateActionMetadataInput(
|
4055
|
+
tennisClubMembershipEvent,
|
4056
|
+
ActionType.REGISTER
|
4057
|
+
),
|
3578
4058
|
eventId
|
3579
4059
|
}),
|
3580
4060
|
printCertificate: (eventId, input = {}) => ({
|
3581
4061
|
type: ActionType.PRINT_CERTIFICATE,
|
3582
4062
|
transactionId: input.transactionId ?? getUUID(),
|
3583
|
-
|
4063
|
+
declaration: {},
|
4064
|
+
annotation: input.annotation ?? generateActionMetadataInput(
|
3584
4065
|
tennisClubMembershipEvent,
|
3585
4066
|
ActionType.PRINT_CERTIFICATE
|
3586
4067
|
),
|
@@ -3590,17 +4071,21 @@ var eventPayloadGenerator = {
|
|
3590
4071
|
request: (eventId, input = {}) => ({
|
3591
4072
|
type: ActionType.REQUEST_CORRECTION,
|
3592
4073
|
transactionId: input.transactionId ?? getUUID(),
|
3593
|
-
|
4074
|
+
declaration: input.declaration ?? generateActionInput(
|
4075
|
+
tennisClubMembershipEvent,
|
4076
|
+
ActionType.REQUEST_CORRECTION
|
4077
|
+
),
|
4078
|
+
annotation: input.annotation ?? generateActionMetadataInput(
|
3594
4079
|
tennisClubMembershipEvent,
|
3595
4080
|
ActionType.REQUEST_CORRECTION
|
3596
4081
|
),
|
3597
|
-
metadata: {},
|
3598
4082
|
eventId
|
3599
4083
|
}),
|
3600
4084
|
approve: (eventId, requestId, input = {}) => ({
|
3601
4085
|
type: ActionType.APPROVE_CORRECTION,
|
3602
4086
|
transactionId: input.transactionId ?? getUUID(),
|
3603
|
-
|
4087
|
+
declaration: {},
|
4088
|
+
annotation: input.annotation ?? generateActionMetadataInput(
|
3604
4089
|
tennisClubMembershipEvent,
|
3605
4090
|
ActionType.APPROVE_CORRECTION
|
3606
4091
|
),
|
@@ -3610,7 +4095,8 @@ var eventPayloadGenerator = {
|
|
3610
4095
|
reject: (eventId, requestId, input = {}) => ({
|
3611
4096
|
type: ActionType.REJECT_CORRECTION,
|
3612
4097
|
transactionId: input.transactionId ?? getUUID(),
|
3613
|
-
|
4098
|
+
declaration: {},
|
4099
|
+
annotation: input.annotation ?? generateActionMetadataInput(
|
3614
4100
|
tennisClubMembershipEvent,
|
3615
4101
|
ActionType.REJECT_CORRECTION
|
3616
4102
|
),
|
@@ -3626,13 +4112,16 @@ function generateActionDocument({
|
|
3626
4112
|
defaults = {}
|
3627
4113
|
}) {
|
3628
4114
|
const actionBase = {
|
4115
|
+
// Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
|
4116
|
+
// @TODO: This should be fixed in the future.
|
3629
4117
|
createdAt: new Date(Date.now() - 500).toISOString(),
|
3630
4118
|
createdBy: getUUID(),
|
3631
4119
|
id: getUUID(),
|
3632
4120
|
createdAtLocation: "TODO",
|
3633
|
-
|
3634
|
-
|
3635
|
-
...defaults
|
4121
|
+
declaration: generateActionInput(configuration, action),
|
4122
|
+
annotation: {},
|
4123
|
+
...defaults,
|
4124
|
+
status: ActionStatus.Accepted
|
3636
4125
|
};
|
3637
4126
|
switch (action) {
|
3638
4127
|
case ActionType.DECLARE:
|
@@ -3659,13 +4148,10 @@ function generateActionDocument({
|
|
3659
4148
|
return { ...actionBase, requestId: getUUID(), type: action };
|
3660
4149
|
case ActionType.REJECT_CORRECTION:
|
3661
4150
|
return { ...actionBase, requestId: getUUID(), type: action };
|
3662
|
-
case ActionType.CUSTOM:
|
3663
|
-
return { ...actionBase, type: action };
|
3664
4151
|
case ActionType.REGISTER:
|
3665
4152
|
return {
|
3666
4153
|
...actionBase,
|
3667
|
-
type: action
|
3668
|
-
identifiers: { trackingId: getUUID(), registrationNumber: getUUID() }
|
4154
|
+
type: action
|
3669
4155
|
};
|
3670
4156
|
default:
|
3671
4157
|
throw new Error(`Unsupported action type: ${action}`);
|
@@ -3681,12 +4167,16 @@ function generateEventDocument({
|
|
3681
4167
|
actions: actions.map(
|
3682
4168
|
(action) => generateActionDocument({ configuration, action })
|
3683
4169
|
),
|
4170
|
+
// Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
|
4171
|
+
// @TODO: This should be fixed in the future.
|
3684
4172
|
createdAt: new Date(Date.now() - 1e3).toISOString(),
|
3685
4173
|
id: getUUID(),
|
4174
|
+
// Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
|
4175
|
+
// @TODO: This should be fixed in the future.
|
3686
4176
|
updatedAt: new Date(Date.now() - 1e3).toISOString()
|
3687
4177
|
};
|
3688
4178
|
}
|
3689
|
-
function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE,
|
4179
|
+
function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE, declaration = {}) {
|
3690
4180
|
const action = generateActionDocument({
|
3691
4181
|
configuration: tennisClubMembershipEvent,
|
3692
4182
|
action: actionType
|
@@ -3696,9 +4186,9 @@ function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE, da
|
|
3696
4186
|
transactionId: getUUID(),
|
3697
4187
|
action: {
|
3698
4188
|
...action,
|
3699
|
-
|
3700
|
-
...action.
|
3701
|
-
...
|
4189
|
+
declaration: {
|
4190
|
+
...action.declaration,
|
4191
|
+
...declaration
|
3702
4192
|
}
|
3703
4193
|
},
|
3704
4194
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
@@ -3715,7 +4205,7 @@ var eventQueryDataGenerator = (overrides = {}) => ({
|
|
3715
4205
|
modifiedAt: overrides.modifiedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
3716
4206
|
assignedTo: overrides.assignedTo ?? null,
|
3717
4207
|
updatedBy: overrides.updatedBy ?? getUUID(),
|
3718
|
-
|
4208
|
+
declaration: overrides.declaration ?? {
|
3719
4209
|
"recommender.none": true,
|
3720
4210
|
"applicant.firstname": "Danny",
|
3721
4211
|
"applicant.surname": "Doe",
|
@@ -3723,6 +4213,11 @@ var eventQueryDataGenerator = (overrides = {}) => ({
|
|
3723
4213
|
},
|
3724
4214
|
trackingId: overrides.trackingId ?? "M3F8YQ"
|
3725
4215
|
});
|
4216
|
+
var generateTranslationConfig = (message) => ({
|
4217
|
+
defaultMessage: message,
|
4218
|
+
description: "Description for ${message}",
|
4219
|
+
id: message
|
4220
|
+
});
|
3726
4221
|
|
3727
4222
|
// ../commons/src/events/TemplateConfig.ts
|
3728
4223
|
function isTemplateVariable(value) {
|