@opencrvs/toolkit 1.8.0-rc.fca3e39 → 1.8.0-rc.fd071dc
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 +6911 -14585
- package/dist/commons/conditionals/conditionals.d.ts +25 -3
- package/dist/commons/conditionals/validate.d.ts +12 -11
- package/dist/commons/events/ActionConfig.d.ts +1123 -2056
- package/dist/commons/events/ActionDocument.d.ts +7441 -347
- package/dist/commons/events/ActionInput.d.ts +2169 -522
- package/dist/commons/events/ActionType.d.ts +24 -16
- package/dist/commons/events/Conditional.d.ts +21 -5
- package/dist/commons/events/Draft.d.ts +64 -52
- 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 +845 -454
- 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 +465 -73
- package/dist/commons/events/FieldType.d.ts +2 -1
- package/dist/commons/events/FieldTypeMapping.d.ts +23 -2
- package/dist/commons/events/FieldValue.d.ts +6 -4
- package/dist/commons/events/FormConfig.d.ts +633 -48
- package/dist/commons/events/PageConfig.d.ts +335 -0
- package/dist/commons/events/TemplateConfig.d.ts +5 -5
- package/dist/commons/events/User.d.ts +1 -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 +69 -286
- package/dist/commons/events/utils.d.ts +81 -83
- package/dist/conditionals/index.js +161 -93
- package/dist/events/index.js +1169 -756
- package/package.json +1 -1
package/dist/events/index.js
CHANGED
@@ -30,13 +30,17 @@ 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,
|
@@ -45,6 +49,8 @@ __export(events_exports, {
|
|
45
49
|
AdvancedSearchConfig: () => AdvancedSearchConfig,
|
46
50
|
ApproveCorrectionActionInput: () => ApproveCorrectionActionInput,
|
47
51
|
ArchiveActionInput: () => ArchiveActionInput,
|
52
|
+
AssignActionInput: () => AssignActionInput,
|
53
|
+
AsyncRejectActionDocument: () => AsyncRejectActionDocument,
|
48
54
|
BaseActionInput: () => BaseActionInput,
|
49
55
|
CertificateConfig: () => CertificateConfig,
|
50
56
|
CertificateTemplateConfig: () => CertificateTemplateConfig,
|
@@ -52,9 +58,18 @@ __export(events_exports, {
|
|
52
58
|
Clause: () => Clause,
|
53
59
|
Conditional: () => Conditional,
|
54
60
|
ConditionalType: () => ConditionalType,
|
61
|
+
ConfirmableActions: () => ConfirmableActions,
|
62
|
+
DataEntry: () => DataEntry,
|
63
|
+
DataFieldValue: () => DataFieldValue,
|
55
64
|
DateValue: () => DateValue,
|
65
|
+
DeclarationActionConfig: () => DeclarationActionConfig,
|
66
|
+
DeclarationActions: () => DeclarationActions,
|
67
|
+
DeclarationFormConfig: () => DeclarationFormConfig,
|
68
|
+
DeclarationReviewConfig: () => DeclarationReviewConfig,
|
69
|
+
DeclarationUpdateActions: () => DeclarationUpdateActions,
|
56
70
|
DeclareActionInput: () => DeclareActionInput,
|
57
71
|
DeduplicationConfig: () => DeduplicationConfig,
|
72
|
+
DisplayOnReviewConditional: () => DisplayOnReviewConditional,
|
58
73
|
Draft: () => Draft,
|
59
74
|
DraftInput: () => DraftInput,
|
60
75
|
EmailField: () => EmailField,
|
@@ -68,6 +83,7 @@ __export(events_exports, {
|
|
68
83
|
EventSearchIndex: () => EventSearchIndex,
|
69
84
|
EventStatus: () => EventStatus,
|
70
85
|
EventStatuses: () => EventStatuses,
|
86
|
+
FieldConditional: () => FieldConditional,
|
71
87
|
FieldConfig: () => FieldConfig,
|
72
88
|
FieldType: () => FieldType,
|
73
89
|
FieldUpdateValue: () => FieldUpdateValue,
|
@@ -76,16 +92,21 @@ __export(events_exports, {
|
|
76
92
|
FileFieldValueWithOption: () => FileFieldValueWithOption,
|
77
93
|
FileFieldWithOptionValue: () => FileFieldWithOptionValue,
|
78
94
|
FormConfig: () => FormConfig,
|
79
|
-
|
95
|
+
FormPageConfig: () => FormPageConfig,
|
80
96
|
GenericAddressUpdateValue: () => GenericAddressUpdateValue,
|
81
97
|
GenericAddressValue: () => GenericAddressValue,
|
82
98
|
GeographicalArea: () => GeographicalArea,
|
99
|
+
ImageMimeType: () => ImageMimeType,
|
83
100
|
LanguageConfig: () => LanguageConfig,
|
84
|
-
LatentActions: () => LatentActions,
|
85
101
|
MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
|
102
|
+
MimeType: () => MimeType,
|
86
103
|
NotifyActionInput: () => NotifyActionInput,
|
87
104
|
NumberFieldValue: () => NumberFieldValue,
|
105
|
+
PageConfig: () => PageConfig,
|
106
|
+
PageTypes: () => PageTypes,
|
88
107
|
PrintCertificateActionInput: () => PrintCertificateActionInput,
|
108
|
+
ReadActionInput: () => ReadActionInput,
|
109
|
+
RegisterAction: () => RegisterAction,
|
89
110
|
RegisterActionInput: () => RegisterActionInput,
|
90
111
|
RejectCorrectionActionInput: () => RejectCorrectionActionInput,
|
91
112
|
RejectDeclarationActionInput: () => RejectDeclarationActionInput,
|
@@ -98,21 +119,29 @@ __export(events_exports, {
|
|
98
119
|
SummaryConfig: () => SummaryConfig,
|
99
120
|
TextValue: () => TextValue,
|
100
121
|
TranslationConfig: () => TranslationConfig,
|
122
|
+
UnassignActionInput: () => UnassignActionInput,
|
101
123
|
UrbanAddressUpdateValue: () => UrbanAddressUpdateValue,
|
102
124
|
UrbanAddressValue: () => UrbanAddressValue,
|
103
125
|
ValidateActionInput: () => ValidateActionInput,
|
126
|
+
VerificationActionConfig: () => VerificationActionConfig,
|
127
|
+
VerificationPageConfig: () => VerificationPageConfig,
|
104
128
|
WorkqueueConfig: () => WorkqueueConfig,
|
105
129
|
alwaysTrue: () => alwaysTrue,
|
106
130
|
and: () => and,
|
131
|
+
annotationActions: () => annotationActions,
|
107
132
|
applyDraftsToEventIndex: () => applyDraftsToEventIndex,
|
108
133
|
compositeFieldTypes: () => compositeFieldTypes,
|
109
134
|
createEmptyDraft: () => createEmptyDraft,
|
110
135
|
createValidationSchema: () => createValidationSchema,
|
111
136
|
deepDropNulls: () => deepDropNulls,
|
137
|
+
deepMerge: () => deepMerge,
|
138
|
+
defineActionForm: () => defineActionForm,
|
112
139
|
defineConditional: () => defineConditional,
|
113
140
|
defineConfig: () => defineConfig,
|
114
|
-
|
141
|
+
defineDeclarationForm: () => defineDeclarationForm,
|
142
|
+
defineFormConditional: () => defineFormConditional,
|
115
143
|
defineFormPage: () => defineFormPage,
|
144
|
+
definePage: () => definePage,
|
116
145
|
errorMessages: () => errorMessages,
|
117
146
|
event: () => event,
|
118
147
|
eventMetadataLabelMap: () => eventMetadataLabelMap,
|
@@ -121,38 +150,42 @@ __export(events_exports, {
|
|
121
150
|
eventStatuses: () => eventStatuses,
|
122
151
|
field: () => field,
|
123
152
|
fieldTypes: () => fieldTypes,
|
124
|
-
findActiveActionFields: () => findActiveActionFields,
|
125
|
-
findActiveActionForm: () => findActiveActionForm,
|
126
|
-
findActiveActionFormFields: () => findActiveActionFormFields,
|
127
|
-
findActiveActionFormPages: () => findActiveActionFormPages,
|
128
153
|
findActiveDrafts: () => findActiveDrafts,
|
129
|
-
|
130
|
-
|
154
|
+
findAllFields: () => findAllFields,
|
155
|
+
findRecordActionPages: () => findRecordActionPages,
|
131
156
|
generateActionDocument: () => generateActionDocument,
|
132
157
|
generateActionInput: () => generateActionInput,
|
158
|
+
generateActionMetadataInput: () => generateActionMetadataInput,
|
133
159
|
generateEventDocument: () => generateEventDocument,
|
134
160
|
generateEventDraftDocument: () => generateEventDraftDocument,
|
135
161
|
generateTransactionId: () => generateTransactionId,
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
162
|
+
generateTranslationConfig: () => generateTranslationConfig,
|
163
|
+
getAcceptedActions: () => getAcceptedActions,
|
164
|
+
getActionAnnotation: () => getActionAnnotation,
|
165
|
+
getActionAnnotationFields: () => getActionAnnotationFields,
|
166
|
+
getActionReview: () => getActionReview,
|
167
|
+
getActionReviewFields: () => getActionReviewFields,
|
168
|
+
getAllAnnotationFields: () => getAllAnnotationFields,
|
169
|
+
getAnnotationFromDrafts: () => getAnnotationFromDrafts,
|
140
170
|
getCurrentEventState: () => getCurrentEventState,
|
141
171
|
getCurrentEventStateWithDrafts: () => getCurrentEventStateWithDrafts,
|
142
|
-
|
172
|
+
getDeclaration: () => getDeclaration,
|
173
|
+
getDeclarationFields: () => getDeclarationFields,
|
174
|
+
getDeclarationPages: () => getDeclarationPages,
|
143
175
|
getFieldValidationErrors: () => getFieldValidationErrors,
|
144
|
-
|
145
|
-
getMetadataForAction: () => getMetadataForAction,
|
176
|
+
getVisiblePagesFormFields: () => getVisiblePagesFormFields,
|
146
177
|
isAddressFieldType: () => isAddressFieldType,
|
147
178
|
isAdministrativeAreaFieldType: () => isAdministrativeAreaFieldType,
|
148
179
|
isBulletListFieldType: () => isBulletListFieldType,
|
149
180
|
isCheckboxFieldType: () => isCheckboxFieldType,
|
150
181
|
isCountryFieldType: () => isCountryFieldType,
|
182
|
+
isDataFieldType: () => isDataFieldType,
|
151
183
|
isDateFieldType: () => isDateFieldType,
|
152
184
|
isDividerFieldType: () => isDividerFieldType,
|
153
185
|
isEmailFieldType: () => isEmailFieldType,
|
154
186
|
isFacilityFieldType: () => isFacilityFieldType,
|
155
187
|
isFieldConfigDefaultValue: () => isFieldConfigDefaultValue,
|
188
|
+
isFieldDisplayedOnReview: () => isFieldDisplayedOnReview,
|
156
189
|
isFieldEnabled: () => isFieldEnabled,
|
157
190
|
isFieldValue: () => isFieldValue,
|
158
191
|
isFieldValueWithoutTemplates: () => isFieldValueWithoutTemplates,
|
@@ -163,6 +196,7 @@ __export(events_exports, {
|
|
163
196
|
isNumberFieldType: () => isNumberFieldType,
|
164
197
|
isOfficeFieldType: () => isOfficeFieldType,
|
165
198
|
isPageHeaderFieldType: () => isPageHeaderFieldType,
|
199
|
+
isPageVisible: () => isPageVisible,
|
166
200
|
isParagraphFieldType: () => isParagraphFieldType,
|
167
201
|
isRadioGroupFieldType: () => isRadioGroupFieldType,
|
168
202
|
isSelectFieldType: () => isSelectFieldType,
|
@@ -171,12 +205,13 @@ __export(events_exports, {
|
|
171
205
|
isTextAreaFieldType: () => isTextAreaFieldType,
|
172
206
|
isTextFieldType: () => isTextFieldType,
|
173
207
|
isUndeclaredDraft: () => isUndeclaredDraft,
|
208
|
+
isVerificationPage: () => isVerificationPage,
|
174
209
|
mapFieldTypeToEmptyValue: () => mapFieldTypeToEmptyValue,
|
175
210
|
mapFieldTypeToMockValue: () => mapFieldTypeToMockValue,
|
176
211
|
mapFieldTypeToZod: () => mapFieldTypeToZod,
|
212
|
+
never: () => never,
|
177
213
|
not: () => not,
|
178
214
|
or: () => or,
|
179
|
-
resolveLabelsFromKnownFields: () => resolveLabelsFromKnownFields,
|
180
215
|
stripHiddenFields: () => stripHiddenFields,
|
181
216
|
user: () => user,
|
182
217
|
validate: () => validate,
|
@@ -186,35 +221,52 @@ __export(events_exports, {
|
|
186
221
|
module.exports = __toCommonJS(events_exports);
|
187
222
|
|
188
223
|
// ../commons/src/events/ActionConfig.ts
|
189
|
-
var
|
224
|
+
var import_zod9 = require("zod");
|
190
225
|
|
191
226
|
// ../commons/src/events/Conditional.ts
|
192
227
|
var import_zod = require("zod");
|
193
|
-
|
194
|
-
|
195
|
-
|
228
|
+
var Conditional = import_zod.z.custom(
|
229
|
+
(val) => typeof val === "object" && val !== null
|
230
|
+
);
|
196
231
|
var ConditionalType = {
|
197
|
-
/** When 'SHOW' conditional is defined, the action is shown to the user only if the condition is met */
|
198
232
|
SHOW: "SHOW",
|
199
|
-
|
200
|
-
|
233
|
+
ENABLE: "ENABLE",
|
234
|
+
DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
|
201
235
|
};
|
202
236
|
var ShowConditional = import_zod.z.object({
|
203
237
|
type: import_zod.z.literal(ConditionalType.SHOW),
|
204
|
-
conditional: Conditional
|
205
|
-
})
|
238
|
+
conditional: Conditional
|
239
|
+
}).describe(
|
240
|
+
"If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
|
241
|
+
);
|
206
242
|
var EnableConditional = import_zod.z.object({
|
207
243
|
type: import_zod.z.literal(ConditionalType.ENABLE),
|
208
|
-
conditional: Conditional
|
209
|
-
})
|
244
|
+
conditional: Conditional
|
245
|
+
}).describe(
|
246
|
+
"If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
|
247
|
+
);
|
210
248
|
var ActionConditional = import_zod.z.discriminatedUnion("type", [
|
211
249
|
// Action can be shown / hidden
|
212
250
|
ShowConditional,
|
213
251
|
// Action can be shown to the user in the list but as disabled
|
214
252
|
EnableConditional
|
215
253
|
]);
|
254
|
+
var DisplayOnReviewConditional = import_zod.z.object({
|
255
|
+
type: import_zod.z.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
256
|
+
conditional: Conditional
|
257
|
+
}).describe(
|
258
|
+
"If 'DISPLAY_ON_REVIEW' conditional is defined, the component is shown on the review page only if both the 'DISPLAY_ON_REVIEW' and 'SHOW' conditions are met. This should only be used for fields within declaration forms, as they are the only ones with review pages."
|
259
|
+
);
|
260
|
+
var FieldConditional = import_zod.z.discriminatedUnion("type", [
|
261
|
+
// Field input can be shown / hidden
|
262
|
+
ShowConditional,
|
263
|
+
// Field input can be shown to the user but as disabled
|
264
|
+
EnableConditional,
|
265
|
+
// Field output can be shown / hidden on the review page
|
266
|
+
DisplayOnReviewConditional
|
267
|
+
]);
|
216
268
|
|
217
|
-
// ../commons/src/events/
|
269
|
+
// ../commons/src/events/PageConfig.ts
|
218
270
|
var import_zod6 = require("zod");
|
219
271
|
|
220
272
|
// ../commons/src/events/FieldConfig.ts
|
@@ -255,7 +307,8 @@ var FieldType = {
|
|
255
307
|
ADMINISTRATIVE_AREA: "ADMINISTRATIVE_AREA",
|
256
308
|
FACILITY: "FACILITY",
|
257
309
|
OFFICE: "OFFICE",
|
258
|
-
SIGNATURE: "SIGNATURE"
|
310
|
+
SIGNATURE: "SIGNATURE",
|
311
|
+
DATA: "DATA"
|
259
312
|
};
|
260
313
|
var fieldTypes = Object.values(FieldType);
|
261
314
|
var compositeFieldTypes = [
|
@@ -354,6 +407,7 @@ var DateValue = import_zod4.z.string().date().describe("Date in the format YYYY-
|
|
354
407
|
var EmailValue = import_zod4.z.string().email();
|
355
408
|
var CheckboxFieldValue = import_zod4.z.boolean();
|
356
409
|
var NumberFieldValue = import_zod4.z.number();
|
410
|
+
var DataFieldValue = import_zod4.z.undefined();
|
357
411
|
var FieldValue = import_zod4.z.union([
|
358
412
|
TextValue,
|
359
413
|
DateValue,
|
@@ -363,6 +417,7 @@ var FieldValue = import_zod4.z.union([
|
|
363
417
|
FileFieldWithOptionValue,
|
364
418
|
UrbanAddressValue,
|
365
419
|
RuralAddressValue,
|
420
|
+
DataFieldValue,
|
366
421
|
GenericAddressValue
|
367
422
|
]);
|
368
423
|
var FieldUpdateValue = import_zod4.z.union([
|
@@ -374,6 +429,7 @@ var FieldUpdateValue = import_zod4.z.union([
|
|
374
429
|
FileFieldWithOptionValue,
|
375
430
|
UrbanAddressUpdateValue,
|
376
431
|
RuralAddressUpdateValue,
|
432
|
+
DataFieldValue,
|
377
433
|
GenericAddressUpdateValue
|
378
434
|
]);
|
379
435
|
|
@@ -396,14 +452,14 @@ var BaseField = import_zod5.z.object({
|
|
396
452
|
]),
|
397
453
|
DependencyExpression
|
398
454
|
]).optional(),
|
399
|
-
conditionals: import_zod5.z.array(
|
455
|
+
conditionals: import_zod5.z.array(FieldConditional).default([]).optional(),
|
400
456
|
required: import_zod5.z.boolean().default(false).optional(),
|
401
457
|
disabled: import_zod5.z.boolean().default(false).optional(),
|
402
458
|
hidden: import_zod5.z.boolean().default(false).optional(),
|
403
459
|
placeholder: TranslationConfig.optional(),
|
404
460
|
validation: import_zod5.z.array(
|
405
461
|
import_zod5.z.object({
|
406
|
-
validator: Conditional
|
462
|
+
validator: Conditional,
|
407
463
|
message: TranslationConfig
|
408
464
|
})
|
409
465
|
).default([]).optional(),
|
@@ -445,15 +501,25 @@ var TextAreaField = BaseField.extend({
|
|
445
501
|
postfix: TranslationConfig.optional()
|
446
502
|
}).default({ rows: 4 }).optional()
|
447
503
|
}).describe("Multiline text input");
|
504
|
+
var ImageMimeType = import_zod5.z.enum([
|
505
|
+
"image/png",
|
506
|
+
"image/jpg",
|
507
|
+
"image/jpeg",
|
508
|
+
"image/svg+xml"
|
509
|
+
]);
|
510
|
+
var MimeType = ImageMimeType;
|
511
|
+
var DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
|
448
512
|
var SignatureField = BaseField.extend({
|
449
513
|
type: import_zod5.z.literal(FieldType.SIGNATURE),
|
450
514
|
signaturePromptLabel: TranslationConfig.describe(
|
451
515
|
"Title of the signature modal"
|
452
516
|
),
|
453
517
|
configuration: import_zod5.z.object({
|
454
|
-
|
455
|
-
|
456
|
-
}).default({
|
518
|
+
maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
519
|
+
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
520
|
+
}).default({
|
521
|
+
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
522
|
+
})
|
457
523
|
}).describe("Signature input field");
|
458
524
|
var EmailField = BaseField.extend({
|
459
525
|
type: import_zod5.z.literal(FieldType.EMAIL),
|
@@ -496,13 +562,17 @@ var PageHeader = BaseField.extend({
|
|
496
562
|
}).describe("A read-only header component for form pages");
|
497
563
|
var File = BaseField.extend({
|
498
564
|
type: import_zod5.z.literal(FieldType.FILE),
|
499
|
-
|
565
|
+
configuration: import_zod5.z.object({
|
566
|
+
maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
567
|
+
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
|
500
568
|
style: import_zod5.z.object({
|
501
|
-
|
569
|
+
width: import_zod5.z.enum(["full", "auto"]).optional().describe(
|
502
570
|
"Whether the file upload button should take the full width of the container or not"
|
503
571
|
)
|
504
|
-
})
|
505
|
-
}).
|
572
|
+
}).optional()
|
573
|
+
}).default({
|
574
|
+
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
575
|
+
})
|
506
576
|
}).describe("File upload");
|
507
577
|
var SelectOption = import_zod5.z.object({
|
508
578
|
value: import_zod5.z.string().describe("The value of the option"),
|
@@ -548,7 +618,7 @@ var AdministrativeAreas = import_zod5.z.enum([
|
|
548
618
|
]);
|
549
619
|
var AdministrativeAreaConfiguration = import_zod5.z.object({
|
550
620
|
partOf: import_zod5.z.object({
|
551
|
-
$
|
621
|
+
$declaration: import_zod5.z.string()
|
552
622
|
}).optional().describe("Parent location"),
|
553
623
|
type: AdministrativeAreas
|
554
624
|
}).describe("Administrative area options");
|
@@ -563,8 +633,14 @@ var Location = BaseField.extend({
|
|
563
633
|
}).describe("Input field for a location");
|
564
634
|
var FileUploadWithOptions = BaseField.extend({
|
565
635
|
type: import_zod5.z.literal(FieldType.FILE_WITH_OPTIONS),
|
566
|
-
options: import_zod5.z.array(SelectOption).describe("A list of options")
|
567
|
-
|
636
|
+
options: import_zod5.z.array(SelectOption).describe("A list of options"),
|
637
|
+
configuration: import_zod5.z.object({
|
638
|
+
maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
639
|
+
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
640
|
+
}).default({
|
641
|
+
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
642
|
+
})
|
643
|
+
});
|
568
644
|
var Facility = BaseField.extend({
|
569
645
|
type: import_zod5.z.literal(FieldType.FACILITY),
|
570
646
|
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
@@ -577,6 +653,22 @@ var Address = BaseField.extend({
|
|
577
653
|
type: import_zod5.z.literal(FieldType.ADDRESS),
|
578
654
|
defaultValue: AddressFieldValue.optional()
|
579
655
|
}).describe("Address input field \u2013 a combination of location and text fields");
|
656
|
+
var DataEntry = import_zod5.z.union([
|
657
|
+
import_zod5.z.object({
|
658
|
+
label: TranslationConfig,
|
659
|
+
value: import_zod5.z.string()
|
660
|
+
}),
|
661
|
+
import_zod5.z.object({
|
662
|
+
fieldId: import_zod5.z.string()
|
663
|
+
})
|
664
|
+
]);
|
665
|
+
var DataField = BaseField.extend({
|
666
|
+
type: import_zod5.z.literal(FieldType.DATA),
|
667
|
+
configuration: import_zod5.z.object({
|
668
|
+
subtitle: TranslationConfig.optional(),
|
669
|
+
data: import_zod5.z.array(DataEntry)
|
670
|
+
})
|
671
|
+
}).describe("Data field for displaying read-only data");
|
580
672
|
var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
581
673
|
Address,
|
582
674
|
TextField,
|
@@ -598,133 +690,204 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
|
598
690
|
Office,
|
599
691
|
SignatureField,
|
600
692
|
EmailField,
|
601
|
-
FileUploadWithOptions
|
693
|
+
FileUploadWithOptions,
|
694
|
+
DataField
|
695
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
602
696
|
]);
|
603
697
|
|
604
|
-
// ../commons/src/events/
|
605
|
-
var
|
698
|
+
// ../commons/src/events/PageConfig.ts
|
699
|
+
var PageTypes = import_zod6.z.enum(["FORM", "VERIFICATION"]);
|
700
|
+
var PageConfigBase = import_zod6.z.object({
|
606
701
|
id: import_zod6.z.string().describe("Unique identifier for the page"),
|
607
702
|
title: TranslationConfig.describe("Header title of the page"),
|
608
|
-
fields: import_zod6.z.array(FieldConfig).describe("Fields to be rendered on the page")
|
703
|
+
fields: import_zod6.z.array(FieldConfig).describe("Fields to be rendered on the page"),
|
704
|
+
conditional: Conditional.optional().describe(
|
705
|
+
"Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
|
706
|
+
)
|
609
707
|
});
|
610
|
-
var
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
label: TranslationConfig
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
pages: import_zod6.z.array(FormPage),
|
622
|
-
review: import_zod6.z.object({
|
623
|
-
title: TranslationConfig.describe(
|
624
|
-
"Title of the form to show in review page"
|
625
|
-
),
|
626
|
-
fields: import_zod6.z.array(FieldConfig).describe("Fields to be rendered on the review page for metadata")
|
708
|
+
var FormPageConfig = PageConfigBase.extend({
|
709
|
+
type: import_zod6.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
|
710
|
+
});
|
711
|
+
var VerificationActionConfig = import_zod6.z.object({
|
712
|
+
verify: import_zod6.z.object({ label: TranslationConfig }),
|
713
|
+
cancel: import_zod6.z.object({
|
714
|
+
label: TranslationConfig,
|
715
|
+
confirmation: import_zod6.z.object({
|
716
|
+
title: TranslationConfig,
|
717
|
+
body: TranslationConfig
|
718
|
+
})
|
627
719
|
})
|
720
|
+
}).describe("Actions available on the verification page");
|
721
|
+
var VerificationPageConfig = FormPageConfig.extend({
|
722
|
+
type: import_zod6.z.literal(PageTypes.enum.VERIFICATION),
|
723
|
+
actions: VerificationActionConfig
|
628
724
|
});
|
725
|
+
var PageConfig = import_zod6.z.discriminatedUnion("type", [
|
726
|
+
FormPageConfig,
|
727
|
+
VerificationPageConfig
|
728
|
+
]);
|
629
729
|
|
630
730
|
// ../commons/src/events/ActionType.ts
|
731
|
+
var import_zod7 = require("zod");
|
631
732
|
var ActionType = {
|
733
|
+
// Pre-declaration actions
|
734
|
+
DELETE: "DELETE",
|
632
735
|
CREATE: "CREATE",
|
633
|
-
ASSIGN: "ASSIGN",
|
634
|
-
UNASSIGN: "UNASSIGN",
|
635
|
-
REGISTER: "REGISTER",
|
636
|
-
VALIDATE: "VALIDATE",
|
637
|
-
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
638
|
-
REJECT_CORRECTION: "REJECT_CORRECTION",
|
639
|
-
APPROVE_CORRECTION: "APPROVE_CORRECTION",
|
640
|
-
DETECT_DUPLICATE: "DETECT_DUPLICATE",
|
641
736
|
NOTIFY: "NOTIFY",
|
737
|
+
// Declaration actions
|
642
738
|
DECLARE: "DECLARE",
|
643
|
-
|
644
|
-
|
645
|
-
|
739
|
+
VALIDATE: "VALIDATE",
|
740
|
+
REGISTER: "REGISTER",
|
741
|
+
// Declaration system actions. Non-configurable.
|
742
|
+
DETECT_DUPLICATE: "DETECT_DUPLICATE",
|
646
743
|
REJECT: "REJECT",
|
744
|
+
// REJECT_DECLARATION
|
647
745
|
MARKED_AS_DUPLICATE: "MARKED_AS_DUPLICATE",
|
648
|
-
|
746
|
+
// MARK_AS_DUPLICATE
|
747
|
+
ARCHIVE: "ARCHIVE",
|
748
|
+
// Record actions
|
749
|
+
PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
|
750
|
+
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
751
|
+
REJECT_CORRECTION: "REJECT_CORRECTION",
|
752
|
+
APPROVE_CORRECTION: "APPROVE_CORRECTION",
|
753
|
+
// General actions
|
754
|
+
READ: "READ",
|
755
|
+
ASSIGN: "ASSIGN",
|
756
|
+
UNASSIGN: "UNASSIGN"
|
649
757
|
};
|
650
|
-
var
|
758
|
+
var ConfirmableActions = [
|
759
|
+
ActionType.NOTIFY,
|
760
|
+
ActionType.DECLARE,
|
761
|
+
ActionType.VALIDATE,
|
762
|
+
ActionType.REGISTER,
|
763
|
+
ActionType.REJECT,
|
764
|
+
ActionType.ARCHIVE,
|
765
|
+
ActionType.PRINT_CERTIFICATE
|
766
|
+
];
|
767
|
+
var ActionTypes = import_zod7.z.enum([
|
768
|
+
"DELETE",
|
769
|
+
"CREATE",
|
770
|
+
"NOTIFY",
|
771
|
+
"DECLARE",
|
772
|
+
"VALIDATE",
|
773
|
+
"REGISTER",
|
774
|
+
"DETECT_DUPLICATE",
|
775
|
+
"REJECT",
|
776
|
+
"MARKED_AS_DUPLICATE",
|
777
|
+
"ARCHIVE",
|
778
|
+
"PRINT_CERTIFICATE",
|
779
|
+
"REQUEST_CORRECTION",
|
780
|
+
"REJECT_CORRECTION",
|
781
|
+
"APPROVE_CORRECTION",
|
782
|
+
"READ",
|
783
|
+
"ASSIGN",
|
784
|
+
"UNASSIGN"
|
785
|
+
]);
|
786
|
+
var declarationActionValues = [
|
787
|
+
ActionTypes.enum.DECLARE,
|
788
|
+
ActionTypes.enum.VALIDATE,
|
789
|
+
ActionTypes.enum.REGISTER
|
790
|
+
];
|
791
|
+
var DeclarationActions = ActionTypes.extract(declarationActionValues);
|
792
|
+
var declarationUpdateActionValues = [
|
793
|
+
...declarationActionValues,
|
794
|
+
ActionTypes.enum.REQUEST_CORRECTION
|
795
|
+
];
|
796
|
+
var DeclarationUpdateActions = ActionTypes.extract(
|
797
|
+
declarationUpdateActionValues
|
798
|
+
);
|
799
|
+
var annotationActions = ActionTypes.exclude(declarationActionValues);
|
800
|
+
|
801
|
+
// ../commons/src/events/FormConfig.ts
|
802
|
+
var import_zod8 = require("zod");
|
803
|
+
var DeclarationFormConfig = import_zod8.z.object({
|
804
|
+
label: TranslationConfig.describe("Human readable description of the form"),
|
805
|
+
pages: import_zod8.z.array(FormPageConfig)
|
806
|
+
}).describe("Configuration for a declaration form");
|
807
|
+
var ActionFormConfig = import_zod8.z.object({
|
808
|
+
label: TranslationConfig.describe("Human readable description of the form"),
|
809
|
+
pages: import_zod8.z.array(PageConfig)
|
810
|
+
});
|
811
|
+
var FormConfig = import_zod8.z.union([DeclarationFormConfig, ActionFormConfig]);
|
651
812
|
|
652
813
|
// ../commons/src/events/ActionConfig.ts
|
653
|
-
var ActionConditional2 =
|
814
|
+
var ActionConditional2 = import_zod9.z.discriminatedUnion("type", [
|
654
815
|
/** If conditional is defined, the action is shown to the user only if the condition is met */
|
655
816
|
ShowConditional,
|
656
817
|
/** If conditional is defined, the action is enabled only if the condition is met */
|
657
818
|
EnableConditional
|
658
819
|
]);
|
659
|
-
var
|
820
|
+
var DeclarationReviewConfig = import_zod9.z.object({
|
821
|
+
title: TranslationConfig.describe("Title of the review page"),
|
822
|
+
fields: import_zod9.z.array(FieldConfig).describe("Fields to be rendered on the review page for annotations.")
|
823
|
+
}).describe("Configuration for **declaration** review page.");
|
824
|
+
var ActionConfigBase = import_zod9.z.object({
|
660
825
|
label: TranslationConfig,
|
661
|
-
conditionals:
|
662
|
-
draft:
|
663
|
-
forms: import_zod7.z.array(FormConfig)
|
826
|
+
conditionals: import_zod9.z.array(ActionConditional2).optional().default([]),
|
827
|
+
draft: import_zod9.z.boolean().optional()
|
664
828
|
});
|
665
829
|
var DeclareConfig = ActionConfigBase.merge(
|
666
|
-
|
667
|
-
type:
|
830
|
+
import_zod9.z.object({
|
831
|
+
type: import_zod9.z.literal(ActionType.DECLARE),
|
832
|
+
review: DeclarationReviewConfig
|
668
833
|
})
|
669
834
|
);
|
670
835
|
var ValidateConfig = ActionConfigBase.merge(
|
671
|
-
|
672
|
-
type:
|
836
|
+
import_zod9.z.object({
|
837
|
+
type: import_zod9.z.literal(ActionType.VALIDATE),
|
838
|
+
review: DeclarationReviewConfig
|
839
|
+
})
|
840
|
+
);
|
841
|
+
var RegisterConfig = ActionConfigBase.merge(
|
842
|
+
import_zod9.z.object({
|
843
|
+
type: import_zod9.z.literal(ActionType.REGISTER),
|
844
|
+
review: DeclarationReviewConfig
|
673
845
|
})
|
674
846
|
);
|
675
847
|
var RejectDeclarationConfig = ActionConfigBase.merge(
|
676
|
-
|
677
|
-
type:
|
848
|
+
import_zod9.z.object({
|
849
|
+
type: import_zod9.z.literal(ActionType.REJECT)
|
678
850
|
})
|
679
851
|
);
|
680
852
|
var MarkedAsDuplicateConfig = ActionConfigBase.merge(
|
681
|
-
|
682
|
-
type:
|
853
|
+
import_zod9.z.object({
|
854
|
+
type: import_zod9.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
683
855
|
})
|
684
856
|
);
|
685
857
|
var ArchiveConfig = ActionConfigBase.merge(
|
686
|
-
|
687
|
-
type:
|
688
|
-
})
|
689
|
-
);
|
690
|
-
var RegisterConfig = ActionConfigBase.merge(
|
691
|
-
import_zod7.z.object({
|
692
|
-
type: import_zod7.z.literal(ActionType.REGISTER)
|
858
|
+
import_zod9.z.object({
|
859
|
+
type: import_zod9.z.literal(ActionType.ARCHIVE)
|
693
860
|
})
|
694
861
|
);
|
695
862
|
var DeleteConfig = ActionConfigBase.merge(
|
696
|
-
|
697
|
-
type:
|
863
|
+
import_zod9.z.object({
|
864
|
+
type: import_zod9.z.literal(ActionType.DELETE)
|
698
865
|
})
|
699
866
|
);
|
700
867
|
var PrintCertificateActionConfig = ActionConfigBase.merge(
|
701
|
-
|
702
|
-
type:
|
868
|
+
import_zod9.z.object({
|
869
|
+
type: import_zod9.z.literal(ActionType.PRINT_CERTIFICATE),
|
870
|
+
printForm: ActionFormConfig
|
703
871
|
})
|
704
872
|
);
|
705
873
|
var RequestCorrectionConfig = ActionConfigBase.merge(
|
706
|
-
|
707
|
-
type:
|
708
|
-
onboardingForm:
|
709
|
-
additionalDetailsForm:
|
874
|
+
import_zod9.z.object({
|
875
|
+
type: import_zod9.z.literal(ActionType.REQUEST_CORRECTION),
|
876
|
+
onboardingForm: import_zod9.z.array(PageConfig),
|
877
|
+
additionalDetailsForm: import_zod9.z.array(PageConfig)
|
710
878
|
})
|
711
879
|
);
|
712
880
|
var RejectCorrectionConfig = ActionConfigBase.merge(
|
713
|
-
|
714
|
-
type:
|
881
|
+
import_zod9.z.object({
|
882
|
+
type: import_zod9.z.literal(ActionType.REJECT_CORRECTION)
|
715
883
|
})
|
716
884
|
);
|
717
885
|
var ApproveCorrectionConfig = ActionConfigBase.merge(
|
718
|
-
|
719
|
-
type:
|
720
|
-
})
|
721
|
-
);
|
722
|
-
var CustomConfig = ActionConfigBase.merge(
|
723
|
-
import_zod7.z.object({
|
724
|
-
type: import_zod7.z.literal(ActionType.CUSTOM)
|
886
|
+
import_zod9.z.object({
|
887
|
+
type: import_zod9.z.literal(ActionType.APPROVE_CORRECTION)
|
725
888
|
})
|
726
889
|
);
|
727
|
-
var ActionConfig =
|
890
|
+
var ActionConfig = import_zod9.z.discriminatedUnion("type", [
|
728
891
|
DeclareConfig,
|
729
892
|
ValidateConfig,
|
730
893
|
RejectDeclarationConfig,
|
@@ -735,102 +898,108 @@ var ActionConfig = import_zod7.z.discriminatedUnion("type", [
|
|
735
898
|
PrintCertificateActionConfig,
|
736
899
|
RequestCorrectionConfig,
|
737
900
|
RejectCorrectionConfig,
|
738
|
-
ApproveCorrectionConfig
|
739
|
-
|
901
|
+
ApproveCorrectionConfig
|
902
|
+
]);
|
903
|
+
var DeclarationActionConfig = import_zod9.z.discriminatedUnion("type", [
|
904
|
+
DeclareConfig,
|
905
|
+
ValidateConfig,
|
906
|
+
RegisterConfig
|
740
907
|
]);
|
741
908
|
|
742
909
|
// ../commons/src/events/offline/CertificateConfig.ts
|
743
|
-
var
|
744
|
-
var FontFamily =
|
745
|
-
normal:
|
746
|
-
bold:
|
747
|
-
italics:
|
748
|
-
bolditalics:
|
910
|
+
var import_zod10 = require("zod");
|
911
|
+
var FontFamily = import_zod10.z.object({
|
912
|
+
normal: import_zod10.z.string(),
|
913
|
+
bold: import_zod10.z.string(),
|
914
|
+
italics: import_zod10.z.string(),
|
915
|
+
bolditalics: import_zod10.z.string()
|
749
916
|
});
|
750
|
-
var CertificateConfig =
|
751
|
-
id:
|
752
|
-
event:
|
917
|
+
var CertificateConfig = import_zod10.z.object({
|
918
|
+
id: import_zod10.z.string(),
|
919
|
+
event: import_zod10.z.string(),
|
753
920
|
label: TranslationConfig,
|
754
|
-
isDefault:
|
755
|
-
fee:
|
756
|
-
onTime:
|
757
|
-
late:
|
758
|
-
delayed:
|
921
|
+
isDefault: import_zod10.z.boolean(),
|
922
|
+
fee: import_zod10.z.object({
|
923
|
+
onTime: import_zod10.z.number(),
|
924
|
+
late: import_zod10.z.number(),
|
925
|
+
delayed: import_zod10.z.number()
|
759
926
|
}),
|
760
|
-
svgUrl:
|
761
|
-
fonts:
|
927
|
+
svgUrl: import_zod10.z.string(),
|
928
|
+
fonts: import_zod10.z.record(FontFamily).optional()
|
762
929
|
});
|
763
930
|
var CertificateTemplateConfig = CertificateConfig.extend({
|
764
|
-
hash:
|
765
|
-
svg:
|
931
|
+
hash: import_zod10.z.string().optional(),
|
932
|
+
svg: import_zod10.z.string()
|
766
933
|
});
|
767
934
|
|
768
935
|
// ../commons/src/events/offline/LanguageConfig.ts
|
769
|
-
var
|
770
|
-
var LanguageConfig =
|
771
|
-
lang:
|
936
|
+
var import_zod11 = require("zod");
|
937
|
+
var LanguageConfig = import_zod11.z.object({
|
938
|
+
lang: import_zod11.z.string(),
|
772
939
|
/**
|
773
940
|
* client.csv contents
|
774
941
|
*/
|
775
|
-
messages:
|
942
|
+
messages: import_zod11.z.record(import_zod11.z.string())
|
776
943
|
});
|
777
944
|
|
778
945
|
// ../commons/src/events/EventConfig.ts
|
779
|
-
var
|
946
|
+
var import_zod20 = require("zod");
|
780
947
|
|
781
948
|
// ../commons/src/events/DeduplicationConfig.ts
|
782
|
-
var
|
783
|
-
var FieldReference =
|
784
|
-
var Matcher =
|
785
|
-
fieldId:
|
786
|
-
options:
|
787
|
-
boost:
|
949
|
+
var import_zod12 = require("zod");
|
950
|
+
var FieldReference = import_zod12.z.string();
|
951
|
+
var Matcher = import_zod12.z.object({
|
952
|
+
fieldId: import_zod12.z.string(),
|
953
|
+
options: import_zod12.z.object({
|
954
|
+
boost: import_zod12.z.number().optional()
|
788
955
|
}).optional().default({})
|
789
956
|
});
|
790
957
|
var FuzzyMatcher = Matcher.extend({
|
791
|
-
type:
|
792
|
-
options:
|
958
|
+
type: import_zod12.z.literal("fuzzy"),
|
959
|
+
options: import_zod12.z.object({
|
793
960
|
/**
|
794
961
|
* Names of length 3 or less characters = 0 edits allowed
|
795
962
|
* Names of length 4 - 6 characters = 1 edit allowed
|
796
963
|
* Names of length >7 characters = 2 edits allowed
|
797
964
|
*/
|
798
|
-
fuzziness:
|
799
|
-
boost:
|
965
|
+
fuzziness: import_zod12.z.union([import_zod12.z.string(), import_zod12.z.number()]).optional().default("AUTO:4,7"),
|
966
|
+
boost: import_zod12.z.number().optional().default(1)
|
800
967
|
}).optional().default({})
|
801
968
|
});
|
802
969
|
var StrictMatcher = Matcher.extend({
|
803
|
-
type:
|
804
|
-
options:
|
805
|
-
boost:
|
970
|
+
type: import_zod12.z.literal("strict"),
|
971
|
+
options: import_zod12.z.object({
|
972
|
+
boost: import_zod12.z.number().optional().default(1)
|
806
973
|
}).optional().default({})
|
807
974
|
});
|
808
975
|
var DateRangeMatcher = Matcher.extend({
|
809
|
-
type:
|
810
|
-
options:
|
811
|
-
days:
|
976
|
+
type: import_zod12.z.literal("dateRange"),
|
977
|
+
options: import_zod12.z.object({
|
978
|
+
days: import_zod12.z.number(),
|
812
979
|
origin: FieldReference,
|
813
|
-
boost:
|
980
|
+
boost: import_zod12.z.number().optional().default(1)
|
814
981
|
})
|
815
982
|
});
|
816
983
|
var DateDistanceMatcher = Matcher.extend({
|
817
|
-
type:
|
818
|
-
options:
|
819
|
-
days:
|
984
|
+
type: import_zod12.z.literal("dateDistance"),
|
985
|
+
options: import_zod12.z.object({
|
986
|
+
days: import_zod12.z.number(),
|
820
987
|
origin: FieldReference,
|
821
|
-
boost:
|
988
|
+
boost: import_zod12.z.number().optional().default(1)
|
822
989
|
})
|
823
990
|
});
|
824
|
-
var And =
|
825
|
-
type:
|
826
|
-
|
991
|
+
var And = import_zod12.z.object({
|
992
|
+
type: import_zod12.z.literal("and"),
|
993
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
994
|
+
clauses: import_zod12.z.lazy(() => Clause.array())
|
827
995
|
});
|
828
|
-
var Or =
|
829
|
-
type:
|
830
|
-
|
996
|
+
var Or = import_zod12.z.object({
|
997
|
+
type: import_zod12.z.literal("or"),
|
998
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
999
|
+
clauses: import_zod12.z.lazy(() => Clause.array())
|
831
1000
|
});
|
832
|
-
var Clause =
|
833
|
-
() =>
|
1001
|
+
var Clause = import_zod12.z.lazy(
|
1002
|
+
() => import_zod12.z.discriminatedUnion("type", [
|
834
1003
|
And,
|
835
1004
|
Or,
|
836
1005
|
FuzzyMatcher,
|
@@ -839,37 +1008,37 @@ var Clause = import_zod10.z.lazy(
|
|
839
1008
|
DateDistanceMatcher
|
840
1009
|
])
|
841
1010
|
);
|
842
|
-
var DeduplicationConfig =
|
843
|
-
id:
|
1011
|
+
var DeduplicationConfig = import_zod12.z.object({
|
1012
|
+
id: import_zod12.z.string(),
|
844
1013
|
label: TranslationConfig,
|
845
1014
|
query: Clause
|
846
1015
|
});
|
847
1016
|
|
848
1017
|
// ../commons/src/events/SummaryConfig.ts
|
849
|
-
var
|
850
|
-
var Field =
|
851
|
-
id:
|
1018
|
+
var import_zod13 = require("zod");
|
1019
|
+
var Field = import_zod13.z.object({
|
1020
|
+
id: import_zod13.z.string().describe("Id of summary field"),
|
852
1021
|
value: TranslationConfig.describe(
|
853
1022
|
"Summary field value. Can utilise values defined in configuration and EventMetadata"
|
854
1023
|
),
|
855
1024
|
label: TranslationConfig,
|
856
1025
|
emptyValueMessage: TranslationConfig.optional()
|
857
1026
|
});
|
858
|
-
var Title =
|
859
|
-
id:
|
1027
|
+
var Title = import_zod13.z.object({
|
1028
|
+
id: import_zod13.z.string(),
|
860
1029
|
label: TranslationConfig.describe("Title content"),
|
861
1030
|
emptyValueMessage: TranslationConfig.optional()
|
862
1031
|
});
|
863
|
-
var SummaryConfig =
|
1032
|
+
var SummaryConfig = import_zod13.z.object({
|
864
1033
|
title: Title.describe("Title of summary view."),
|
865
|
-
fields:
|
1034
|
+
fields: import_zod13.z.array(Field).describe("Fields rendered in summary view.")
|
866
1035
|
}).describe("Configuration for summary in event.");
|
867
1036
|
|
868
1037
|
// ../commons/src/events/WorkqueueConfig.ts
|
869
|
-
var
|
1038
|
+
var import_zod15 = require("zod");
|
870
1039
|
|
871
1040
|
// ../commons/src/events/EventMetadata.ts
|
872
|
-
var
|
1041
|
+
var import_zod14 = require("zod");
|
873
1042
|
var EventStatus = {
|
874
1043
|
CREATED: "CREATED",
|
875
1044
|
NOTIFIED: "NOTIFIED",
|
@@ -881,18 +1050,19 @@ var EventStatus = {
|
|
881
1050
|
ARCHIVED: "ARCHIVED"
|
882
1051
|
};
|
883
1052
|
var eventStatuses = Object.values(EventStatus);
|
884
|
-
var EventStatuses =
|
885
|
-
var EventMetadata =
|
886
|
-
id:
|
887
|
-
type:
|
1053
|
+
var EventStatuses = import_zod14.z.nativeEnum(EventStatus);
|
1054
|
+
var EventMetadata = import_zod14.z.object({
|
1055
|
+
id: import_zod14.z.string(),
|
1056
|
+
type: import_zod14.z.string(),
|
888
1057
|
status: EventStatuses,
|
889
|
-
createdAt:
|
890
|
-
createdBy:
|
891
|
-
createdAtLocation:
|
892
|
-
modifiedAt:
|
893
|
-
assignedTo:
|
894
|
-
updatedBy:
|
895
|
-
trackingId:
|
1058
|
+
createdAt: import_zod14.z.string().datetime(),
|
1059
|
+
createdBy: import_zod14.z.string(),
|
1060
|
+
createdAtLocation: import_zod14.z.string(),
|
1061
|
+
modifiedAt: import_zod14.z.string().datetime(),
|
1062
|
+
assignedTo: import_zod14.z.string().nullish(),
|
1063
|
+
updatedBy: import_zod14.z.string(),
|
1064
|
+
trackingId: import_zod14.z.string(),
|
1065
|
+
registrationNumber: import_zod14.z.string().nullish()
|
896
1066
|
});
|
897
1067
|
var eventMetadataLabelMap = {
|
898
1068
|
"event.assignedTo": {
|
@@ -944,28 +1114,33 @@ var eventMetadataLabelMap = {
|
|
944
1114
|
id: "event.trackingId.label",
|
945
1115
|
defaultMessage: "Tracking ID",
|
946
1116
|
description: "Tracking ID"
|
1117
|
+
},
|
1118
|
+
"event.registrationNumber": {
|
1119
|
+
id: "event.registrationNumber.label",
|
1120
|
+
defaultMessage: "Registration Number",
|
1121
|
+
description: "Registration Number"
|
947
1122
|
}
|
948
1123
|
};
|
949
1124
|
|
950
1125
|
// ../commons/src/events/WorkqueueConfig.ts
|
951
|
-
var WorkqueueConfig =
|
952
|
-
id:
|
953
|
-
filters:
|
954
|
-
|
955
|
-
status:
|
1126
|
+
var WorkqueueConfig = import_zod15.z.object({
|
1127
|
+
id: import_zod15.z.string().describe("Unique identifier for workqueue."),
|
1128
|
+
filters: import_zod15.z.array(
|
1129
|
+
import_zod15.z.object({
|
1130
|
+
status: import_zod15.z.array(EventStatuses).describe("Defines which statusese are included in the workqueue.")
|
956
1131
|
})
|
957
1132
|
).describe("Filters to be applied to workqueue.")
|
958
1133
|
}).describe("Configuration for workqueue.");
|
959
1134
|
|
960
1135
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
961
|
-
var
|
962
|
-
var AdvancedSearchConfig =
|
1136
|
+
var import_zod16 = require("zod");
|
1137
|
+
var AdvancedSearchConfig = import_zod16.z.object({
|
963
1138
|
title: TranslationConfig.describe("Advanced search tab title"),
|
964
|
-
fields:
|
965
|
-
|
966
|
-
fieldId:
|
967
|
-
config:
|
968
|
-
type:
|
1139
|
+
fields: import_zod16.z.array(
|
1140
|
+
import_zod16.z.object({
|
1141
|
+
fieldId: import_zod16.z.string(),
|
1142
|
+
config: import_zod16.z.object({
|
1143
|
+
type: import_zod16.z.enum(["FUZZY", "EXACT", "RANGE"]).describe("Determines the type of field")
|
969
1144
|
}).optional().describe("Configuration options for the field")
|
970
1145
|
})
|
971
1146
|
).optional().default([]).describe("Advanced search fields.")
|
@@ -975,12 +1150,12 @@ var AdvancedSearchConfig = import_zod14.z.object({
|
|
975
1150
|
var import_lodash = require("lodash");
|
976
1151
|
|
977
1152
|
// ../commons/src/workqueues/WorkqueueConfig.ts
|
978
|
-
var
|
1153
|
+
var import_zod18 = require("zod");
|
979
1154
|
|
980
1155
|
// ../commons/src/workqueues/defaultColumns.ts
|
981
|
-
var
|
982
|
-
var WorkQueueColumnConfig =
|
983
|
-
id:
|
1156
|
+
var import_zod17 = require("zod");
|
1157
|
+
var WorkQueueColumnConfig = import_zod17.z.object({
|
1158
|
+
id: import_zod17.z.string(),
|
984
1159
|
label: TranslationConfig
|
985
1160
|
});
|
986
1161
|
var defaultColumns = {
|
@@ -1017,16 +1192,16 @@ var defaultColumns = {
|
|
1017
1192
|
}
|
1018
1193
|
}
|
1019
1194
|
};
|
1020
|
-
var DefaultColumnKeys =
|
1195
|
+
var DefaultColumnKeys = import_zod17.z.enum(
|
1021
1196
|
Object.keys(defaultColumns)
|
1022
1197
|
);
|
1023
1198
|
|
1024
1199
|
// ../commons/src/workqueues/WorkqueueConfig.ts
|
1025
|
-
var rootWorkqueueConfig =
|
1026
|
-
id:
|
1200
|
+
var rootWorkqueueConfig = import_zod18.z.object({
|
1201
|
+
id: import_zod18.z.string(),
|
1027
1202
|
title: TranslationConfig,
|
1028
|
-
columns:
|
1029
|
-
defaultColumns:
|
1203
|
+
columns: import_zod18.z.array(WorkQueueColumnConfig),
|
1204
|
+
defaultColumns: import_zod18.z.array(DefaultColumnKeys)
|
1030
1205
|
});
|
1031
1206
|
var defineWorkqueue = (config) => rootWorkqueueConfig.parse(config);
|
1032
1207
|
|
@@ -1106,7 +1281,7 @@ var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
1106
1281
|
var import_date_fns = require("date-fns");
|
1107
1282
|
|
1108
1283
|
// ../commons/src/events/FieldTypeMapping.ts
|
1109
|
-
var
|
1284
|
+
var import_zod19 = require("zod");
|
1110
1285
|
function mapFieldTypeToZod(type, required) {
|
1111
1286
|
let schema;
|
1112
1287
|
switch (type) {
|
@@ -1148,6 +1323,9 @@ function mapFieldTypeToZod(type, required) {
|
|
1148
1323
|
case FieldType.ADDRESS:
|
1149
1324
|
schema = AddressFieldUpdateValue;
|
1150
1325
|
break;
|
1326
|
+
case FieldType.DATA:
|
1327
|
+
schema = DataFieldValue;
|
1328
|
+
break;
|
1151
1329
|
}
|
1152
1330
|
return required ? schema : schema.nullish();
|
1153
1331
|
}
|
@@ -1156,7 +1334,7 @@ function createValidationSchema(config) {
|
|
1156
1334
|
for (const field2 of config) {
|
1157
1335
|
shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
|
1158
1336
|
}
|
1159
|
-
return
|
1337
|
+
return import_zod19.z.object(shape);
|
1160
1338
|
}
|
1161
1339
|
function mapFieldTypeToMockValue(field2, i) {
|
1162
1340
|
switch (field2.type) {
|
@@ -1204,6 +1382,8 @@ function mapFieldTypeToMockValue(field2, i) {
|
|
1204
1382
|
};
|
1205
1383
|
case FieldType.FILE_WITH_OPTIONS:
|
1206
1384
|
return null;
|
1385
|
+
case FieldType.DATA:
|
1386
|
+
return {};
|
1207
1387
|
}
|
1208
1388
|
}
|
1209
1389
|
function mapFieldTypeToEmptyValue(field2) {
|
@@ -1226,6 +1406,7 @@ function mapFieldTypeToEmptyValue(field2) {
|
|
1226
1406
|
case FieldType.EMAIL:
|
1227
1407
|
case FieldType.DATE:
|
1228
1408
|
case FieldType.CHECKBOX:
|
1409
|
+
case FieldType.DATA:
|
1229
1410
|
return null;
|
1230
1411
|
case FieldType.ADDRESS:
|
1231
1412
|
return {
|
@@ -1314,10 +1495,14 @@ var isFacilityFieldType = (field2) => {
|
|
1314
1495
|
var isOfficeFieldType = (field2) => {
|
1315
1496
|
return field2.config.type === FieldType.OFFICE;
|
1316
1497
|
};
|
1498
|
+
var isDataFieldType = (field2) => {
|
1499
|
+
return field2.config.type === FieldType.DATA;
|
1500
|
+
};
|
1317
1501
|
|
1318
1502
|
// ../commons/src/conditionals/validate.ts
|
1319
1503
|
var ajv = new import_ajv.default({
|
1320
|
-
$data: true
|
1504
|
+
$data: true,
|
1505
|
+
allowUnionTypes: true
|
1321
1506
|
});
|
1322
1507
|
(0, import_ajv_formats.default)(ajv);
|
1323
1508
|
function validate(schema, data) {
|
@@ -1350,6 +1535,9 @@ function isFieldVisible(field2, form) {
|
|
1350
1535
|
function isFieldEnabled(field2, form) {
|
1351
1536
|
return isFieldConditionMet(field2, form, ConditionalType.ENABLE);
|
1352
1537
|
}
|
1538
|
+
function isFieldDisplayedOnReview(field2, form) {
|
1539
|
+
return isFieldVisible(field2, form) && isFieldConditionMet(field2, form, ConditionalType.DISPLAY_ON_REVIEW);
|
1540
|
+
}
|
1353
1541
|
var errorMessages = {
|
1354
1542
|
hiddenField: {
|
1355
1543
|
id: "v2.error.hidden",
|
@@ -1377,12 +1565,14 @@ var errorMessages = {
|
|
1377
1565
|
id: "v2.error.invalid"
|
1378
1566
|
}
|
1379
1567
|
};
|
1380
|
-
|
1381
|
-
|
1382
|
-
message
|
1383
|
-
|
1384
|
-
}
|
1385
|
-
|
1568
|
+
function createIntlError(message) {
|
1569
|
+
return {
|
1570
|
+
message: {
|
1571
|
+
message
|
1572
|
+
}
|
1573
|
+
};
|
1574
|
+
}
|
1575
|
+
function zodToIntlErrorMap(issue, _ctx) {
|
1386
1576
|
switch (issue.code) {
|
1387
1577
|
case "invalid_string": {
|
1388
1578
|
if (_ctx.data === "") {
|
@@ -1420,7 +1610,28 @@ var zodToIntlErrorMap = (issue, _ctx) => {
|
|
1420
1610
|
}
|
1421
1611
|
}
|
1422
1612
|
return createIntlError(errorMessages.invalidInput);
|
1423
|
-
}
|
1613
|
+
}
|
1614
|
+
function runCustomFieldValidations({
|
1615
|
+
field: field2,
|
1616
|
+
conditionalParameters
|
1617
|
+
}) {
|
1618
|
+
return (field2.validation ?? []).filter((validation) => {
|
1619
|
+
return !validate(validation.validator, conditionalParameters);
|
1620
|
+
}).map((validation) => ({ message: validation.message }));
|
1621
|
+
}
|
1622
|
+
function validateFieldInput({
|
1623
|
+
field: field2,
|
1624
|
+
value
|
1625
|
+
}) {
|
1626
|
+
const rawError = mapFieldTypeToZod(field2.type, field2.required).safeParse(
|
1627
|
+
value,
|
1628
|
+
{
|
1629
|
+
// @ts-expect-error
|
1630
|
+
errorMap: zodToIntlErrorMap
|
1631
|
+
}
|
1632
|
+
);
|
1633
|
+
return rawError.error?.issues.map((issue) => issue.message) ?? [];
|
1634
|
+
}
|
1424
1635
|
function getFieldValidationErrors({
|
1425
1636
|
field: field2,
|
1426
1637
|
values
|
@@ -1456,28 +1667,16 @@ function getFieldValidationErrors({
|
|
1456
1667
|
errors: [...fieldValidationResult, ...customValidationResults]
|
1457
1668
|
};
|
1458
1669
|
}
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
return (
|
1464
|
-
return !validate(validation.validator, conditionalParameters);
|
1465
|
-
}).map((validation) => ({ message: validation.message }));
|
1466
|
-
}
|
1467
|
-
function validateFieldInput({
|
1468
|
-
field: field2,
|
1469
|
-
value
|
1470
|
-
}) {
|
1471
|
-
const rawError = mapFieldTypeToZod(field2.type, field2.required).safeParse(
|
1472
|
-
value,
|
1473
|
-
{
|
1474
|
-
// @ts-expect-error
|
1475
|
-
errorMap: zodToIntlErrorMap
|
1476
|
-
}
|
1477
|
-
);
|
1478
|
-
return rawError.error?.issues.map((issue) => issue.message) ?? [];
|
1670
|
+
|
1671
|
+
// ../commons/src/uuid.ts
|
1672
|
+
var import_uuid = require("uuid");
|
1673
|
+
function getUUID() {
|
1674
|
+
return (0, import_uuid.v4)();
|
1479
1675
|
}
|
1480
1676
|
|
1677
|
+
// ../commons/src/events/utils.ts
|
1678
|
+
var import_date_fns2 = require("date-fns");
|
1679
|
+
|
1481
1680
|
// ../commons/src/utils.ts
|
1482
1681
|
function getOrThrow(x, message) {
|
1483
1682
|
if (x === void 0 || x === null) {
|
@@ -1486,73 +1685,64 @@ function getOrThrow(x, message) {
|
|
1486
1685
|
return x;
|
1487
1686
|
}
|
1488
1687
|
|
1489
|
-
// ../commons/src/uuid.ts
|
1490
|
-
var import_uuid = require("uuid");
|
1491
|
-
function getUUID() {
|
1492
|
-
return (0, import_uuid.v4)();
|
1493
|
-
}
|
1494
|
-
|
1495
1688
|
// ../commons/src/events/utils.ts
|
1496
|
-
function
|
1497
|
-
return
|
1498
|
-
}
|
1499
|
-
|
1500
|
-
return (
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1689
|
+
function isDeclarationActionConfig(action) {
|
1690
|
+
return DeclarationActions.safeParse(action.type).success;
|
1691
|
+
}
|
1692
|
+
function getDeclarationFields(configuration) {
|
1693
|
+
return configuration.declaration.pages.flatMap(({ fields }) => fields);
|
1694
|
+
}
|
1695
|
+
function getDeclarationPages(configuration) {
|
1696
|
+
return configuration.declaration.pages;
|
1697
|
+
}
|
1698
|
+
function getDeclaration(configuration) {
|
1699
|
+
return configuration.declaration;
|
1700
|
+
}
|
1701
|
+
var getActionAnnotationFields = (actionConfig) => {
|
1702
|
+
if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
|
1703
|
+
return [
|
1704
|
+
...actionConfig.onboardingForm.flatMap(({ fields }) => fields),
|
1705
|
+
...actionConfig.additionalDetailsForm.flatMap(({ fields }) => fields)
|
1706
|
+
];
|
1707
|
+
}
|
1708
|
+
if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
|
1709
|
+
return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
|
1710
|
+
}
|
1711
|
+
if (isDeclarationActionConfig(actionConfig)) {
|
1712
|
+
return actionConfig.review.fields;
|
1713
|
+
}
|
1714
|
+
return [];
|
1509
1715
|
};
|
1510
|
-
var
|
1511
|
-
return (0, import_lodash.flattenDeep)(
|
1512
|
-
config.actions.map((action) => {
|
1513
|
-
if (action.type === ActionType.REQUEST_CORRECTION) {
|
1514
|
-
return [
|
1515
|
-
...action.forms.map(({ pages }) => pages.map(({ fields }) => fields)),
|
1516
|
-
...action.onboardingForm.flatMap(({ fields }) => fields),
|
1517
|
-
...action.additionalDetailsForm.flatMap(({ fields }) => fields)
|
1518
|
-
];
|
1519
|
-
}
|
1520
|
-
return action.forms.map(({ pages }) => pages.map(({ fields }) => fields));
|
1521
|
-
})
|
1522
|
-
);
|
1716
|
+
var getAllAnnotationFields = (config) => {
|
1717
|
+
return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
|
1523
1718
|
};
|
1524
|
-
var
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1528
|
-
return refFields.map((field2) => {
|
1529
|
-
if (field2.label) {
|
1530
|
-
return field2;
|
1531
|
-
}
|
1532
|
-
if (isMetadataField(field2.id)) {
|
1533
|
-
return {
|
1534
|
-
...field2,
|
1535
|
-
label: eventMetadataLabelMap[field2.id]
|
1536
|
-
};
|
1537
|
-
}
|
1538
|
-
const pageLabel = pageFields.find((pageField) => pageField.id === field2.id);
|
1539
|
-
if (!pageLabel) {
|
1540
|
-
throw new Error(`Referenced field ${field2.id} does not have a label`);
|
1541
|
-
}
|
1542
|
-
return {
|
1543
|
-
...field2,
|
1544
|
-
label: pageLabel.label
|
1545
|
-
};
|
1546
|
-
});
|
1547
|
-
};
|
1548
|
-
function getAllFields(configuration) {
|
1549
|
-
return configuration.actions.flatMap((action) => action.forms.filter((form) => form.active)).flatMap((form) => [
|
1550
|
-
...form.review.fields,
|
1551
|
-
...form.pages.flatMap((page) => page.fields)
|
1719
|
+
var findAllFields = (config) => {
|
1720
|
+
return (0, import_lodash.flattenDeep)([
|
1721
|
+
...getDeclarationFields(config),
|
1722
|
+
...getAllAnnotationFields(config)
|
1552
1723
|
]);
|
1724
|
+
};
|
1725
|
+
var findRecordActionPages = (config, actionType) => {
|
1726
|
+
const action = config.actions.find((a) => a.type === actionType);
|
1727
|
+
if (action?.type === ActionType.REQUEST_CORRECTION) {
|
1728
|
+
return [...action.onboardingForm, ...action.additionalDetailsForm];
|
1729
|
+
}
|
1730
|
+
if (action?.type === ActionType.PRINT_CERTIFICATE) {
|
1731
|
+
return action.printForm.pages;
|
1732
|
+
}
|
1733
|
+
return [];
|
1734
|
+
};
|
1735
|
+
function getActionReview(configuration, actionType) {
|
1736
|
+
const [actionConfig] = configuration.actions.filter(
|
1737
|
+
(a) => a.type === actionType
|
1738
|
+
);
|
1739
|
+
return getOrThrow(
|
1740
|
+
actionConfig.review,
|
1741
|
+
`No review config found for ${actionType}`
|
1742
|
+
);
|
1553
1743
|
}
|
1554
|
-
function
|
1555
|
-
return configuration
|
1744
|
+
function getActionReviewFields(configuration, actionType) {
|
1745
|
+
return getActionReview(configuration, actionType).fields;
|
1556
1746
|
}
|
1557
1747
|
function validateWorkqueueConfig(workqueueConfigs) {
|
1558
1748
|
workqueueConfigs.map((workqueue) => {
|
@@ -1566,71 +1756,38 @@ function validateWorkqueueConfig(workqueueConfigs) {
|
|
1566
1756
|
}
|
1567
1757
|
});
|
1568
1758
|
}
|
1569
|
-
|
1570
|
-
|
1571
|
-
|
1572
|
-
return form;
|
1573
|
-
};
|
1574
|
-
var findActiveActionFormPages = (configuration, action) => {
|
1575
|
-
return findActiveActionForm(configuration, action)?.pages;
|
1576
|
-
};
|
1577
|
-
var getFormFields = (formConfig) => {
|
1578
|
-
return formConfig.pages.flatMap((p) => p.fields);
|
1579
|
-
};
|
1580
|
-
var findActiveActionFormFields = (configuration, action) => {
|
1581
|
-
const form = findActiveActionForm(configuration, action);
|
1582
|
-
return form ? getFormFields(form) : void 0;
|
1583
|
-
};
|
1584
|
-
var findActiveActionFields = (configuration, action) => {
|
1585
|
-
const form = findActiveActionForm(configuration, action);
|
1586
|
-
const reviewFields = form?.review.fields;
|
1587
|
-
const formFields = form ? getFormFields(form) : void 0;
|
1588
|
-
const allFields = formFields ? formFields.concat(reviewFields ?? []) : reviewFields;
|
1589
|
-
return allFields;
|
1590
|
-
};
|
1591
|
-
var getActiveActionFormPages = (configuration, action) => {
|
1592
|
-
return getOrThrow(
|
1593
|
-
findActiveActionForm(configuration, action)?.pages,
|
1594
|
-
"Form configuration not found for type: " + configuration.id
|
1595
|
-
);
|
1596
|
-
};
|
1597
|
-
function getActiveActionFields(configuration, action) {
|
1598
|
-
if (LatentActions.some((latentAction) => latentAction === action)) {
|
1599
|
-
return getActiveActionFields(configuration, ActionType.DECLARE);
|
1600
|
-
}
|
1601
|
-
const fields = findActiveActionFields(configuration, action);
|
1602
|
-
if (!fields) {
|
1603
|
-
throw new Error(`No active field config found for action type ${action}`);
|
1604
|
-
}
|
1605
|
-
return fields;
|
1606
|
-
}
|
1607
|
-
function getEventConfiguration(eventConfigurations, type) {
|
1608
|
-
const config = eventConfigurations.find((config2) => config2.id === type);
|
1609
|
-
if (!config) {
|
1610
|
-
throw new Error(`Event configuration not found for type: ${type}`);
|
1759
|
+
function isPageVisible(page, formValues) {
|
1760
|
+
if (!page.conditional) {
|
1761
|
+
return true;
|
1611
1762
|
}
|
1612
|
-
return
|
1763
|
+
return validate(page.conditional, {
|
1764
|
+
$form: formValues,
|
1765
|
+
$now: (0, import_date_fns2.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" })
|
1766
|
+
});
|
1613
1767
|
}
|
1768
|
+
var getVisiblePagesFormFields = (formConfig, formData) => {
|
1769
|
+
return formConfig.pages.filter((p) => isPageVisible(p, formData)).flatMap((p) => p.fields);
|
1770
|
+
};
|
1614
1771
|
function isOptionalUncheckedCheckbox(field2, form) {
|
1615
1772
|
if (field2.type !== FieldType.CHECKBOX || field2.required) {
|
1616
1773
|
return false;
|
1617
1774
|
}
|
1618
1775
|
return !form[field2.id];
|
1619
1776
|
}
|
1620
|
-
function stripHiddenFields(fields,
|
1621
|
-
return (0, import_lodash.omitBy)(
|
1777
|
+
function stripHiddenFields(fields, declaration) {
|
1778
|
+
return (0, import_lodash.omitBy)(declaration, (_, fieldId) => {
|
1622
1779
|
const field2 = fields.find((f) => f.id === fieldId);
|
1623
1780
|
if (!field2) {
|
1624
1781
|
return true;
|
1625
1782
|
}
|
1626
|
-
if (isOptionalUncheckedCheckbox(field2,
|
1783
|
+
if (isOptionalUncheckedCheckbox(field2, declaration)) {
|
1627
1784
|
return true;
|
1628
1785
|
}
|
1629
|
-
return !isFieldVisible(field2,
|
1786
|
+
return !isFieldVisible(field2, declaration);
|
1630
1787
|
});
|
1631
1788
|
}
|
1632
1789
|
function findActiveDrafts(event2, drafts) {
|
1633
|
-
const actions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
1790
|
+
const actions = event2.actions.slice().filter(({ type }) => type !== ActionType.READ).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
1634
1791
|
const lastAction = actions[actions.length - 1];
|
1635
1792
|
return drafts.filter(({ createdAt }) => createdAt >= lastAction.createdAt).filter(({ eventId }) => eventId === event2.id);
|
1636
1793
|
}
|
@@ -1642,28 +1799,50 @@ function createEmptyDraft(eventId, draftId, actionType) {
|
|
1642
1799
|
transactionId: getUUID(),
|
1643
1800
|
action: {
|
1644
1801
|
type: actionType,
|
1645
|
-
|
1646
|
-
|
1802
|
+
declaration: {},
|
1803
|
+
annotation: {},
|
1647
1804
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
1648
1805
|
createdBy: "@todo",
|
1649
1806
|
createdAtLocation: "@todo"
|
1650
1807
|
}
|
1651
1808
|
};
|
1652
1809
|
}
|
1810
|
+
function isVerificationPage(page) {
|
1811
|
+
return page.type === PageTypes.enum.VERIFICATION;
|
1812
|
+
}
|
1813
|
+
function deepMerge(currentDocument, actionDocument) {
|
1814
|
+
return (0, import_lodash.mergeWith)(
|
1815
|
+
currentDocument,
|
1816
|
+
actionDocument,
|
1817
|
+
(previousValue, incomingValue) => {
|
1818
|
+
if (incomingValue === void 0) {
|
1819
|
+
return previousValue;
|
1820
|
+
}
|
1821
|
+
if ((0, import_lodash.isArray)(incomingValue)) {
|
1822
|
+
return incomingValue;
|
1823
|
+
}
|
1824
|
+
if ((0, import_lodash.isObject)(previousValue) && (0, import_lodash.isObject)(incomingValue)) {
|
1825
|
+
return void 0;
|
1826
|
+
}
|
1827
|
+
return incomingValue;
|
1828
|
+
}
|
1829
|
+
);
|
1830
|
+
}
|
1653
1831
|
|
1654
1832
|
// ../commons/src/events/EventConfig.ts
|
1655
|
-
var EventConfig =
|
1656
|
-
id:
|
1833
|
+
var EventConfig = import_zod20.z.object({
|
1834
|
+
id: import_zod20.z.string().describe(
|
1657
1835
|
'A machine-readable identifier for the event, e.g. "birth" or "death"'
|
1658
1836
|
),
|
1659
1837
|
summary: SummaryConfig,
|
1660
1838
|
label: TranslationConfig,
|
1661
|
-
actions:
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1839
|
+
actions: import_zod20.z.array(ActionConfig),
|
1840
|
+
declaration: DeclarationFormConfig,
|
1841
|
+
workqueues: import_zod20.z.array(WorkqueueConfig),
|
1842
|
+
deduplication: import_zod20.z.array(DeduplicationConfig).optional().default([]),
|
1843
|
+
advancedSearch: import_zod20.z.array(AdvancedSearchConfig).optional().default([])
|
1665
1844
|
}).superRefine((event2, ctx) => {
|
1666
|
-
const allFields =
|
1845
|
+
const allFields = findAllFields(event2);
|
1667
1846
|
const fieldIds = allFields.map((field2) => field2.id);
|
1668
1847
|
const advancedSearchFields = event2.advancedSearch.flatMap(
|
1669
1848
|
(section) => section.fields.flatMap((field2) => field2.fieldId)
|
@@ -1690,106 +1869,117 @@ var EventConfig = import_zod18.z.object({
|
|
1690
1869
|
});
|
1691
1870
|
|
1692
1871
|
// ../commons/src/events/EventConfigInput.ts
|
1693
|
-
var
|
1694
|
-
var
|
1872
|
+
var defineDeclarationForm = (form) => DeclarationFormConfig.parse(form);
|
1873
|
+
var defineActionForm = (actionForm) => ActionFormConfig.parse(actionForm);
|
1874
|
+
var definePage = (page) => PageConfig.parse(page);
|
1875
|
+
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
1695
1876
|
|
1696
1877
|
// ../commons/src/events/Draft.ts
|
1697
|
-
var
|
1878
|
+
var import_zod23 = require("zod");
|
1698
1879
|
|
1699
1880
|
// ../commons/src/events/ActionDocument.ts
|
1700
|
-
var
|
1701
|
-
var ActionUpdate =
|
1702
|
-
var
|
1703
|
-
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1881
|
+
var import_zod21 = require("zod");
|
1882
|
+
var ActionUpdate = import_zod21.z.record(import_zod21.z.string(), FieldUpdateValue);
|
1883
|
+
var ActionStatus = {
|
1884
|
+
Requested: "Requested",
|
1885
|
+
Accepted: "Accepted",
|
1886
|
+
Rejected: "Rejected"
|
1887
|
+
};
|
1888
|
+
var ActionBase = import_zod21.z.object({
|
1889
|
+
id: import_zod21.z.string(),
|
1890
|
+
createdAt: import_zod21.z.string().datetime(),
|
1891
|
+
createdBy: import_zod21.z.string(),
|
1892
|
+
declaration: ActionUpdate,
|
1893
|
+
annotation: ActionUpdate.optional(),
|
1894
|
+
createdAtLocation: import_zod21.z.string(),
|
1895
|
+
status: import_zod21.z.enum([
|
1896
|
+
ActionStatus.Requested,
|
1897
|
+
ActionStatus.Accepted,
|
1898
|
+
ActionStatus.Rejected
|
1899
|
+
]),
|
1900
|
+
// If the action is an asynchronous confirmation for another action, we will save the original action id here.
|
1901
|
+
originalActionId: import_zod21.z.string().optional()
|
1709
1902
|
});
|
1710
1903
|
var AssignedAction = ActionBase.merge(
|
1711
|
-
|
1712
|
-
type:
|
1713
|
-
assignedTo:
|
1904
|
+
import_zod21.z.object({
|
1905
|
+
type: import_zod21.z.literal(ActionType.ASSIGN),
|
1906
|
+
assignedTo: import_zod21.z.string()
|
1714
1907
|
})
|
1715
1908
|
);
|
1716
1909
|
var UnassignedAction = ActionBase.merge(
|
1717
|
-
|
1718
|
-
type:
|
1910
|
+
import_zod21.z.object({
|
1911
|
+
type: import_zod21.z.literal(ActionType.UNASSIGN)
|
1719
1912
|
})
|
1720
1913
|
);
|
1721
1914
|
var RegisterAction = ActionBase.merge(
|
1722
|
-
|
1723
|
-
type:
|
1724
|
-
|
1725
|
-
trackingId: import_zod19.z.string(),
|
1726
|
-
registrationNumber: import_zod19.z.string()
|
1727
|
-
})
|
1915
|
+
import_zod21.z.object({
|
1916
|
+
type: import_zod21.z.literal(ActionType.REGISTER),
|
1917
|
+
registrationNumber: import_zod21.z.string().optional()
|
1728
1918
|
})
|
1729
1919
|
);
|
1730
1920
|
var DeclareAction = ActionBase.merge(
|
1731
|
-
|
1732
|
-
type:
|
1921
|
+
import_zod21.z.object({
|
1922
|
+
type: import_zod21.z.literal(ActionType.DECLARE)
|
1733
1923
|
})
|
1734
1924
|
);
|
1735
1925
|
var ValidateAction = ActionBase.merge(
|
1736
|
-
|
1737
|
-
type:
|
1926
|
+
import_zod21.z.object({
|
1927
|
+
type: import_zod21.z.literal(ActionType.VALIDATE)
|
1738
1928
|
})
|
1739
1929
|
);
|
1740
1930
|
var RejectAction = ActionBase.merge(
|
1741
|
-
|
1742
|
-
type:
|
1931
|
+
import_zod21.z.object({
|
1932
|
+
type: import_zod21.z.literal(ActionType.REJECT)
|
1743
1933
|
})
|
1744
1934
|
);
|
1745
1935
|
var MarkAsDuplicateAction = ActionBase.merge(
|
1746
|
-
|
1747
|
-
type:
|
1936
|
+
import_zod21.z.object({
|
1937
|
+
type: import_zod21.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1748
1938
|
})
|
1749
1939
|
);
|
1750
1940
|
var ArchiveAction = ActionBase.merge(
|
1751
|
-
|
1752
|
-
type:
|
1941
|
+
import_zod21.z.object({
|
1942
|
+
type: import_zod21.z.literal(ActionType.ARCHIVE)
|
1753
1943
|
})
|
1754
1944
|
);
|
1755
1945
|
var CreatedAction = ActionBase.merge(
|
1756
|
-
|
1757
|
-
type:
|
1946
|
+
import_zod21.z.object({
|
1947
|
+
type: import_zod21.z.literal(ActionType.CREATE)
|
1758
1948
|
})
|
1759
1949
|
);
|
1760
1950
|
var NotifiedAction = ActionBase.merge(
|
1761
|
-
|
1762
|
-
type:
|
1951
|
+
import_zod21.z.object({
|
1952
|
+
type: import_zod21.z.literal(ActionType.NOTIFY)
|
1763
1953
|
})
|
1764
1954
|
);
|
1765
1955
|
var PrintCertificateAction = ActionBase.merge(
|
1766
|
-
|
1767
|
-
type:
|
1956
|
+
import_zod21.z.object({
|
1957
|
+
type: import_zod21.z.literal(ActionType.PRINT_CERTIFICATE)
|
1768
1958
|
})
|
1769
1959
|
);
|
1770
1960
|
var RequestedCorrectionAction = ActionBase.merge(
|
1771
|
-
|
1772
|
-
type:
|
1961
|
+
import_zod21.z.object({
|
1962
|
+
type: import_zod21.z.literal(ActionType.REQUEST_CORRECTION)
|
1773
1963
|
})
|
1774
1964
|
);
|
1775
1965
|
var ApprovedCorrectionAction = ActionBase.merge(
|
1776
|
-
|
1777
|
-
type:
|
1778
|
-
requestId:
|
1966
|
+
import_zod21.z.object({
|
1967
|
+
type: import_zod21.z.literal(ActionType.APPROVE_CORRECTION),
|
1968
|
+
requestId: import_zod21.z.string()
|
1779
1969
|
})
|
1780
1970
|
);
|
1781
1971
|
var RejectedCorrectionAction = ActionBase.merge(
|
1782
|
-
|
1783
|
-
type:
|
1784
|
-
requestId:
|
1972
|
+
import_zod21.z.object({
|
1973
|
+
type: import_zod21.z.literal(ActionType.REJECT_CORRECTION),
|
1974
|
+
requestId: import_zod21.z.string()
|
1785
1975
|
})
|
1786
1976
|
);
|
1787
|
-
var
|
1788
|
-
|
1789
|
-
type:
|
1977
|
+
var ReadAction = ActionBase.merge(
|
1978
|
+
import_zod21.z.object({
|
1979
|
+
type: import_zod21.z.literal(ActionType.READ)
|
1790
1980
|
})
|
1791
1981
|
);
|
1792
|
-
var ActionDocument =
|
1982
|
+
var ActionDocument = import_zod21.z.discriminatedUnion("type", [
|
1793
1983
|
CreatedAction,
|
1794
1984
|
ValidateAction,
|
1795
1985
|
RejectAction,
|
@@ -1804,108 +1994,124 @@ var ActionDocument = import_zod19.z.discriminatedUnion("type", [
|
|
1804
1994
|
RejectedCorrectionAction,
|
1805
1995
|
UnassignedAction,
|
1806
1996
|
PrintCertificateAction,
|
1807
|
-
|
1997
|
+
ReadAction
|
1808
1998
|
]);
|
1809
|
-
var
|
1810
|
-
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
|
1999
|
+
var AsyncRejectActionDocument = ActionBase.omit({
|
2000
|
+
declaration: true,
|
2001
|
+
annotation: true,
|
2002
|
+
createdBy: true,
|
2003
|
+
createdAtLocation: true
|
2004
|
+
}).merge(
|
2005
|
+
import_zod21.z.object({
|
2006
|
+
type: import_zod21.z.enum(ConfirmableActions),
|
2007
|
+
status: import_zod21.z.literal(ActionStatus.Rejected)
|
2008
|
+
})
|
2009
|
+
);
|
2010
|
+
var Action = import_zod21.z.union([ActionDocument, AsyncRejectActionDocument]);
|
2011
|
+
var ResolvedUser = import_zod21.z.object({
|
2012
|
+
id: import_zod21.z.string(),
|
2013
|
+
role: import_zod21.z.string(),
|
2014
|
+
name: import_zod21.z.array(
|
2015
|
+
import_zod21.z.object({
|
2016
|
+
use: import_zod21.z.string(),
|
2017
|
+
given: import_zod21.z.array(import_zod21.z.string()),
|
2018
|
+
family: import_zod21.z.string()
|
1817
2019
|
})
|
1818
2020
|
)
|
1819
2021
|
});
|
1820
2022
|
|
1821
2023
|
// ../commons/src/events/ActionInput.ts
|
1822
|
-
var
|
1823
|
-
var BaseActionInput =
|
1824
|
-
eventId:
|
1825
|
-
transactionId:
|
1826
|
-
|
1827
|
-
|
2024
|
+
var import_zod22 = require("zod");
|
2025
|
+
var BaseActionInput = import_zod22.z.object({
|
2026
|
+
eventId: import_zod22.z.string(),
|
2027
|
+
transactionId: import_zod22.z.string(),
|
2028
|
+
declaration: ActionUpdate.default({}),
|
2029
|
+
annotation: ActionUpdate.optional(),
|
2030
|
+
originalActionId: import_zod22.z.string().optional()
|
1828
2031
|
});
|
1829
2032
|
var CreateActionInput = BaseActionInput.merge(
|
1830
|
-
|
1831
|
-
type:
|
1832
|
-
createdAtLocation:
|
2033
|
+
import_zod22.z.object({
|
2034
|
+
type: import_zod22.z.literal(ActionType.CREATE).default(ActionType.CREATE),
|
2035
|
+
createdAtLocation: import_zod22.z.string()
|
1833
2036
|
})
|
1834
2037
|
);
|
1835
2038
|
var RegisterActionInput = BaseActionInput.merge(
|
1836
|
-
|
1837
|
-
type:
|
1838
|
-
|
1839
|
-
trackingId: import_zod20.z.string(),
|
1840
|
-
registrationNumber: import_zod20.z.string()
|
1841
|
-
})
|
2039
|
+
import_zod22.z.object({
|
2040
|
+
type: import_zod22.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
2041
|
+
registrationNumber: import_zod22.z.string().optional()
|
1842
2042
|
})
|
1843
2043
|
);
|
1844
2044
|
var ValidateActionInput = BaseActionInput.merge(
|
1845
|
-
|
1846
|
-
type:
|
1847
|
-
duplicates:
|
2045
|
+
import_zod22.z.object({
|
2046
|
+
type: import_zod22.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
|
2047
|
+
duplicates: import_zod22.z.array(import_zod22.z.string())
|
1848
2048
|
})
|
1849
2049
|
);
|
1850
2050
|
var NotifyActionInput = BaseActionInput.merge(
|
1851
|
-
|
1852
|
-
type:
|
2051
|
+
import_zod22.z.object({
|
2052
|
+
type: import_zod22.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
|
1853
2053
|
})
|
1854
2054
|
);
|
1855
2055
|
var DeclareActionInput = BaseActionInput.merge(
|
1856
|
-
|
1857
|
-
type:
|
2056
|
+
import_zod22.z.object({
|
2057
|
+
type: import_zod22.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
1858
2058
|
})
|
1859
2059
|
);
|
1860
2060
|
var PrintCertificateActionInput = BaseActionInput.merge(
|
1861
|
-
|
1862
|
-
type:
|
2061
|
+
import_zod22.z.object({
|
2062
|
+
type: import_zod22.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
|
1863
2063
|
})
|
1864
2064
|
);
|
1865
2065
|
var RejectDeclarationActionInput = BaseActionInput.merge(
|
1866
|
-
|
1867
|
-
type:
|
2066
|
+
import_zod22.z.object({
|
2067
|
+
type: import_zod22.z.literal(ActionType.REJECT).default(ActionType.REJECT)
|
1868
2068
|
})
|
1869
2069
|
);
|
1870
2070
|
var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
1871
|
-
|
1872
|
-
type:
|
2071
|
+
import_zod22.z.object({
|
2072
|
+
type: import_zod22.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
1873
2073
|
})
|
1874
2074
|
);
|
1875
2075
|
var ArchiveActionInput = BaseActionInput.merge(
|
1876
|
-
|
1877
|
-
type:
|
2076
|
+
import_zod22.z.object({
|
2077
|
+
type: import_zod22.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE)
|
1878
2078
|
})
|
1879
2079
|
);
|
1880
2080
|
var AssignActionInput = BaseActionInput.merge(
|
1881
|
-
|
1882
|
-
type:
|
1883
|
-
assignedTo:
|
2081
|
+
import_zod22.z.object({
|
2082
|
+
type: import_zod22.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
|
2083
|
+
assignedTo: import_zod22.z.string()
|
1884
2084
|
})
|
1885
2085
|
);
|
1886
2086
|
var UnassignActionInput = BaseActionInput.merge(
|
1887
|
-
|
1888
|
-
type:
|
2087
|
+
import_zod22.z.object({
|
2088
|
+
type: import_zod22.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
|
2089
|
+
assignedTo: import_zod22.z.literal(null).default(null)
|
1889
2090
|
})
|
1890
2091
|
);
|
1891
2092
|
var RequestCorrectionActionInput = BaseActionInput.merge(
|
1892
|
-
|
1893
|
-
type:
|
2093
|
+
import_zod22.z.object({
|
2094
|
+
type: import_zod22.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
1894
2095
|
})
|
1895
2096
|
);
|
1896
2097
|
var RejectCorrectionActionInput = BaseActionInput.merge(
|
1897
|
-
|
1898
|
-
requestId:
|
1899
|
-
type:
|
2098
|
+
import_zod22.z.object({
|
2099
|
+
requestId: import_zod22.z.string(),
|
2100
|
+
type: import_zod22.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
|
1900
2101
|
})
|
1901
2102
|
);
|
1902
2103
|
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
1903
|
-
|
1904
|
-
requestId:
|
1905
|
-
type:
|
2104
|
+
import_zod22.z.object({
|
2105
|
+
requestId: import_zod22.z.string(),
|
2106
|
+
type: import_zod22.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
1906
2107
|
})
|
1907
2108
|
);
|
1908
|
-
var
|
2109
|
+
var ReadActionInput = BaseActionInput.merge(
|
2110
|
+
import_zod22.z.object({
|
2111
|
+
type: import_zod22.z.literal(ActionType.READ).default(ActionType.READ)
|
2112
|
+
})
|
2113
|
+
);
|
2114
|
+
var ActionInput = import_zod22.z.discriminatedUnion("type", [
|
1909
2115
|
CreateActionInput,
|
1910
2116
|
ValidateActionInput,
|
1911
2117
|
RegisterActionInput,
|
@@ -1919,56 +2125,62 @@ var ActionInput = import_zod20.z.discriminatedUnion("type", [
|
|
1919
2125
|
PrintCertificateActionInput,
|
1920
2126
|
RequestCorrectionActionInput,
|
1921
2127
|
RejectCorrectionActionInput,
|
1922
|
-
ApproveCorrectionActionInput
|
2128
|
+
ApproveCorrectionActionInput,
|
2129
|
+
ReadActionInput
|
1923
2130
|
]);
|
1924
2131
|
|
1925
2132
|
// ../commons/src/events/Draft.ts
|
1926
|
-
var Draft =
|
1927
|
-
id:
|
1928
|
-
eventId:
|
1929
|
-
transactionId:
|
1930
|
-
createdAt:
|
2133
|
+
var Draft = import_zod23.z.object({
|
2134
|
+
id: import_zod23.z.string(),
|
2135
|
+
eventId: import_zod23.z.string(),
|
2136
|
+
transactionId: import_zod23.z.string(),
|
2137
|
+
createdAt: import_zod23.z.string().datetime(),
|
1931
2138
|
action: ActionBase.extend({
|
1932
|
-
type:
|
2139
|
+
type: ActionTypes
|
1933
2140
|
}).omit({ id: true })
|
1934
2141
|
});
|
1935
2142
|
var DraftInput = BaseActionInput.extend({
|
1936
|
-
type:
|
2143
|
+
type: ActionTypes
|
1937
2144
|
});
|
1938
2145
|
|
1939
2146
|
// ../commons/src/events/EventInput.ts
|
1940
|
-
var
|
1941
|
-
var EventInput =
|
1942
|
-
transactionId:
|
1943
|
-
type:
|
2147
|
+
var import_zod24 = require("zod");
|
2148
|
+
var EventInput = import_zod24.z.object({
|
2149
|
+
transactionId: import_zod24.z.string(),
|
2150
|
+
type: import_zod24.z.string()
|
1944
2151
|
});
|
1945
2152
|
|
1946
2153
|
// ../commons/src/events/EventDocument.ts
|
1947
|
-
var
|
1948
|
-
var EventDocument =
|
1949
|
-
id:
|
1950
|
-
type:
|
1951
|
-
createdAt:
|
1952
|
-
updatedAt:
|
1953
|
-
actions:
|
1954
|
-
trackingId:
|
2154
|
+
var import_zod25 = require("zod");
|
2155
|
+
var EventDocument = import_zod25.z.object({
|
2156
|
+
id: import_zod25.z.string(),
|
2157
|
+
type: import_zod25.z.string(),
|
2158
|
+
createdAt: import_zod25.z.string().datetime(),
|
2159
|
+
updatedAt: import_zod25.z.string().datetime(),
|
2160
|
+
actions: import_zod25.z.array(Action),
|
2161
|
+
trackingId: import_zod25.z.string()
|
1955
2162
|
});
|
1956
2163
|
|
1957
2164
|
// ../commons/src/events/EventIndex.ts
|
1958
|
-
var
|
2165
|
+
var import_zod26 = require("zod");
|
1959
2166
|
var EventIndex = EventMetadata.extend({
|
1960
|
-
|
2167
|
+
declaration: import_zod26.z.record(import_zod26.z.string(), import_zod26.z.any())
|
1961
2168
|
});
|
1962
|
-
var EventSearchIndex =
|
1963
|
-
|
1964
|
-
type:
|
2169
|
+
var EventSearchIndex = import_zod26.z.record(import_zod26.z.string(), import_zod26.z.any()).and(
|
2170
|
+
import_zod26.z.object({
|
2171
|
+
type: import_zod26.z.string()
|
1965
2172
|
// Ensures "type" (event-id) exists and is a string
|
1966
2173
|
})
|
1967
2174
|
);
|
1968
2175
|
|
1969
2176
|
// ../commons/src/events/state/index.ts
|
1970
|
-
var _ = __toESM(require("lodash"));
|
1971
2177
|
function getStatusFromActions(actions) {
|
2178
|
+
const hasRejectedAction = actions.some(
|
2179
|
+
(a) => a.status === ActionStatus.Rejected
|
2180
|
+
);
|
2181
|
+
if (hasRejectedAction) {
|
2182
|
+
return EventStatus.REJECTED;
|
2183
|
+
}
|
1972
2184
|
return actions.reduce((status, action) => {
|
1973
2185
|
if (action.type === ActionType.CREATE) {
|
1974
2186
|
return EventStatus.CREATED;
|
@@ -2005,7 +2217,7 @@ function getAssignedUserFromActions(actions) {
|
|
2005
2217
|
return user2;
|
2006
2218
|
}, null);
|
2007
2219
|
}
|
2008
|
-
function
|
2220
|
+
function aggregateActionDeclarations(actions) {
|
2009
2221
|
const excludedActions = [
|
2010
2222
|
ActionType.REQUEST_CORRECTION,
|
2011
2223
|
ActionType.PRINT_CERTIFICATE
|
@@ -2019,47 +2231,35 @@ function getData(actions) {
|
|
2019
2231
|
if (!requestAction) {
|
2020
2232
|
return status;
|
2021
2233
|
}
|
2022
|
-
return deepMerge(status, requestAction.
|
2234
|
+
return deepMerge(status, requestAction.declaration);
|
2023
2235
|
}
|
2024
|
-
return deepMerge(status, action.
|
2236
|
+
return deepMerge(status, action.declaration);
|
2025
2237
|
}, {});
|
2026
2238
|
}
|
2027
2239
|
function deepDropNulls(obj) {
|
2028
|
-
if (
|
2029
|
-
|
2030
|
-
|
2031
|
-
|
2032
|
-
|
2033
|
-
|
2034
|
-
|
2035
|
-
|
2036
|
-
[key]
|
2037
|
-
};
|
2038
|
-
}
|
2039
|
-
return acc;
|
2040
|
-
}, {});
|
2041
|
-
}
|
2042
|
-
function deepMerge(currentDocument, actionDocument) {
|
2043
|
-
return _.mergeWith(
|
2044
|
-
currentDocument,
|
2045
|
-
actionDocument,
|
2046
|
-
(previousValue, incomingValue) => {
|
2047
|
-
if (incomingValue === void 0) {
|
2048
|
-
return previousValue;
|
2049
|
-
}
|
2050
|
-
if (_.isArray(incomingValue)) {
|
2051
|
-
return incomingValue;
|
2052
|
-
}
|
2053
|
-
if (_.isObject(previousValue) && _.isObject(incomingValue)) {
|
2054
|
-
return void 0;
|
2240
|
+
if (Array.isArray(obj)) {
|
2241
|
+
return obj;
|
2242
|
+
}
|
2243
|
+
if (obj !== null && typeof obj === "object") {
|
2244
|
+
return Object.entries(obj).reduce((acc, [key, value]) => {
|
2245
|
+
const cleanedValue = deepDropNulls(value);
|
2246
|
+
if (cleanedValue !== null) {
|
2247
|
+
;
|
2248
|
+
acc[key] = cleanedValue;
|
2055
2249
|
}
|
2056
|
-
return
|
2057
|
-
}
|
2058
|
-
|
2250
|
+
return acc;
|
2251
|
+
}, {});
|
2252
|
+
}
|
2253
|
+
return obj;
|
2059
2254
|
}
|
2060
2255
|
function isUndeclaredDraft(status) {
|
2061
2256
|
return status === EventStatus.CREATED;
|
2062
2257
|
}
|
2258
|
+
function getAcceptedActions(event2) {
|
2259
|
+
return event2.actions.filter(
|
2260
|
+
(a) => a.status === ActionStatus.Accepted
|
2261
|
+
);
|
2262
|
+
}
|
2063
2263
|
function getCurrentEventState(event2) {
|
2064
2264
|
const creationAction = event2.actions.find(
|
2065
2265
|
(action) => action.type === ActionType.CREATE
|
@@ -2067,7 +2267,12 @@ function getCurrentEventState(event2) {
|
|
2067
2267
|
if (!creationAction) {
|
2068
2268
|
throw new Error(`Event ${event2.id} has no creation action`);
|
2069
2269
|
}
|
2070
|
-
const
|
2270
|
+
const activeActions = getAcceptedActions(event2);
|
2271
|
+
const latestAction = activeActions[activeActions.length - 1];
|
2272
|
+
const registrationAction = activeActions.find(
|
2273
|
+
(a) => a.type === ActionType.REGISTER && a.status === ActionStatus.Accepted
|
2274
|
+
);
|
2275
|
+
const registrationNumber = registrationAction?.registrationNumber ?? null;
|
2071
2276
|
return deepDropNulls({
|
2072
2277
|
id: event2.id,
|
2073
2278
|
type: event2.type,
|
@@ -2076,10 +2281,11 @@ function getCurrentEventState(event2) {
|
|
2076
2281
|
createdBy: creationAction.createdBy,
|
2077
2282
|
createdAtLocation: creationAction.createdAtLocation,
|
2078
2283
|
modifiedAt: latestAction.createdAt,
|
2079
|
-
assignedTo: getAssignedUserFromActions(
|
2284
|
+
assignedTo: getAssignedUserFromActions(activeActions),
|
2080
2285
|
updatedBy: latestAction.createdBy,
|
2081
|
-
|
2082
|
-
trackingId: event2.trackingId
|
2286
|
+
declaration: aggregateActionDeclarations(activeActions),
|
2287
|
+
trackingId: event2.trackingId,
|
2288
|
+
registrationNumber
|
2083
2289
|
});
|
2084
2290
|
}
|
2085
2291
|
function getCurrentEventStateWithDrafts(event2, drafts) {
|
@@ -2111,38 +2317,44 @@ function applyDraftsToEventIndex(eventIndex, drafts) {
|
|
2111
2317
|
}
|
2112
2318
|
return {
|
2113
2319
|
...eventIndex,
|
2114
|
-
|
2115
|
-
...eventIndex.
|
2116
|
-
...activeDrafts[activeDrafts.length - 1].
|
2320
|
+
declaration: {
|
2321
|
+
...eventIndex.declaration,
|
2322
|
+
...activeDrafts[activeDrafts.length - 1].declaration
|
2117
2323
|
}
|
2118
2324
|
};
|
2119
2325
|
}
|
2120
|
-
function
|
2326
|
+
function getAnnotationFromDrafts(drafts) {
|
2327
|
+
const actions = drafts.map((draft) => draft.action);
|
2328
|
+
const annotation = actions.reduce((ann, action) => {
|
2329
|
+
return deepMerge(ann, action.annotation ?? {});
|
2330
|
+
}, {});
|
2331
|
+
return deepDropNulls(annotation);
|
2332
|
+
}
|
2333
|
+
function getActionAnnotation({
|
2121
2334
|
event: event2,
|
2122
2335
|
actionType,
|
2123
2336
|
drafts
|
2124
2337
|
}) {
|
2125
|
-
const
|
2338
|
+
const activeActions = getAcceptedActions(event2);
|
2339
|
+
const action = activeActions.find(
|
2340
|
+
(activeAction) => actionType === activeAction.type
|
2341
|
+
);
|
2126
2342
|
const eventDrafts = drafts.filter((draft) => draft.eventId === event2.id);
|
2127
2343
|
const sorted = [
|
2128
2344
|
...action ? [action] : [],
|
2129
2345
|
...eventDrafts.map((draft) => draft.action)
|
2130
2346
|
].sort();
|
2131
|
-
const
|
2132
|
-
return deepMerge(
|
2347
|
+
const annotation = sorted.reduce((ann, sortedAction) => {
|
2348
|
+
return deepMerge(ann, sortedAction.annotation ?? {});
|
2133
2349
|
}, {});
|
2134
|
-
return deepDropNulls(
|
2350
|
+
return deepDropNulls(annotation);
|
2135
2351
|
}
|
2136
2352
|
|
2137
2353
|
// ../commons/src/events/defineConfig.ts
|
2138
2354
|
var defineConfig = (config) => {
|
2139
2355
|
validateWorkqueueConfig(config.workqueues);
|
2140
2356
|
const input = EventConfig.parse(config);
|
2141
|
-
|
2142
|
-
return EventConfig.parse({
|
2143
|
-
...input,
|
2144
|
-
pageFields
|
2145
|
-
});
|
2357
|
+
return input;
|
2146
2358
|
};
|
2147
2359
|
|
2148
2360
|
// ../commons/src/events/transactions.ts
|
@@ -2157,6 +2369,16 @@ var import_lodash2 = require("lodash");
|
|
2157
2369
|
function defineConditional(schema) {
|
2158
2370
|
return schema;
|
2159
2371
|
}
|
2372
|
+
function defineFormConditional(schema) {
|
2373
|
+
const schemaWithForm = {
|
2374
|
+
type: "object",
|
2375
|
+
properties: {
|
2376
|
+
$form: schema
|
2377
|
+
},
|
2378
|
+
required: ["$form"]
|
2379
|
+
};
|
2380
|
+
return defineConditional(schemaWithForm);
|
2381
|
+
}
|
2160
2382
|
function alwaysTrue() {
|
2161
2383
|
return {};
|
2162
2384
|
}
|
@@ -2181,6 +2403,9 @@ function not(condition) {
|
|
2181
2403
|
required: []
|
2182
2404
|
});
|
2183
2405
|
}
|
2406
|
+
function never() {
|
2407
|
+
return not(alwaysTrue());
|
2408
|
+
}
|
2184
2409
|
var user = {
|
2185
2410
|
hasScope: (scope) => defineConditional({
|
2186
2411
|
type: "object",
|
@@ -2228,69 +2453,120 @@ var event = {
|
|
2228
2453
|
required: ["$event"]
|
2229
2454
|
})
|
2230
2455
|
};
|
2456
|
+
function getDateFromNow(days) {
|
2457
|
+
return new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
|
2458
|
+
}
|
2459
|
+
function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
|
2460
|
+
return {
|
2461
|
+
type: "object",
|
2462
|
+
properties: {
|
2463
|
+
[fieldId]: {
|
2464
|
+
type: "string",
|
2465
|
+
format: "date",
|
2466
|
+
[clause]: { $data: `1/${comparedFieldId}` }
|
2467
|
+
},
|
2468
|
+
[comparedFieldId]: { type: "string", format: "date" }
|
2469
|
+
},
|
2470
|
+
required: [fieldId]
|
2471
|
+
};
|
2472
|
+
}
|
2473
|
+
function isFieldReference(value) {
|
2474
|
+
return typeof value === "object" && value !== null && "_fieldId" in value;
|
2475
|
+
}
|
2231
2476
|
function field(fieldId) {
|
2232
|
-
const getDateFromNow = (days) => new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
|
2233
2477
|
const getDateRange = (date, clause) => ({
|
2234
2478
|
type: "object",
|
2235
2479
|
properties: {
|
2236
|
-
|
2237
|
-
type: "
|
2238
|
-
|
2239
|
-
|
2240
|
-
type: "string",
|
2241
|
-
format: "date",
|
2242
|
-
[clause]: date
|
2243
|
-
}
|
2244
|
-
},
|
2245
|
-
required: [fieldId]
|
2480
|
+
[fieldId]: {
|
2481
|
+
type: "string",
|
2482
|
+
format: "date",
|
2483
|
+
[clause]: date
|
2246
2484
|
}
|
2247
2485
|
},
|
2248
|
-
required: [
|
2486
|
+
required: [fieldId]
|
2249
2487
|
});
|
2250
2488
|
return {
|
2489
|
+
/**
|
2490
|
+
* @private Internal property used for field reference tracking.
|
2491
|
+
*/
|
2492
|
+
_fieldId: fieldId,
|
2251
2493
|
isAfter: () => ({
|
2252
2494
|
days: (days) => ({
|
2253
|
-
inPast: () =>
|
2495
|
+
inPast: () => defineFormConditional(
|
2254
2496
|
getDateRange(getDateFromNow(days), "formatMinimum")
|
2255
2497
|
),
|
2256
|
-
inFuture: () =>
|
2498
|
+
inFuture: () => defineFormConditional(
|
2257
2499
|
getDateRange(getDateFromNow(-days), "formatMinimum")
|
2258
2500
|
)
|
2259
2501
|
}),
|
2260
|
-
date: (date) =>
|
2261
|
-
|
2502
|
+
date: (date) => {
|
2503
|
+
if (isFieldReference(date)) {
|
2504
|
+
const comparedFieldId = date._fieldId;
|
2505
|
+
return defineFormConditional(
|
2506
|
+
getDateRangeToFieldReference(
|
2507
|
+
fieldId,
|
2508
|
+
comparedFieldId,
|
2509
|
+
"formatMinimum"
|
2510
|
+
)
|
2511
|
+
);
|
2512
|
+
}
|
2513
|
+
return defineFormConditional(getDateRange(date, "formatMinimum"));
|
2514
|
+
},
|
2515
|
+
now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMinimum"))
|
2262
2516
|
}),
|
2263
2517
|
isBefore: () => ({
|
2264
2518
|
days: (days) => ({
|
2265
|
-
inPast: () =>
|
2519
|
+
inPast: () => defineFormConditional(
|
2266
2520
|
getDateRange(getDateFromNow(days), "formatMaximum")
|
2267
2521
|
),
|
2268
|
-
inFuture: () =>
|
2522
|
+
inFuture: () => defineFormConditional(
|
2269
2523
|
getDateRange(getDateFromNow(-days), "formatMaximum")
|
2270
2524
|
)
|
2271
2525
|
}),
|
2272
|
-
date: (date) =>
|
2273
|
-
|
2526
|
+
date: (date) => {
|
2527
|
+
if (isFieldReference(date)) {
|
2528
|
+
const comparedFieldId = date._fieldId;
|
2529
|
+
return defineFormConditional(
|
2530
|
+
getDateRangeToFieldReference(
|
2531
|
+
fieldId,
|
2532
|
+
comparedFieldId,
|
2533
|
+
"formatMaximum"
|
2534
|
+
)
|
2535
|
+
);
|
2536
|
+
}
|
2537
|
+
return defineFormConditional(getDateRange(date, "formatMaximum"));
|
2538
|
+
},
|
2539
|
+
now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMaximum"))
|
2274
2540
|
}),
|
2275
|
-
isEqualTo: (value) =>
|
2276
|
-
|
2277
|
-
|
2278
|
-
|
2541
|
+
isEqualTo: (value) => {
|
2542
|
+
if (isFieldReference(value)) {
|
2543
|
+
const comparedFieldId = value._fieldId;
|
2544
|
+
return defineFormConditional({
|
2279
2545
|
type: "object",
|
2280
2546
|
properties: {
|
2281
2547
|
[fieldId]: {
|
2282
|
-
|
2283
|
-
|
2284
|
-
|
2285
|
-
|
2286
|
-
const: value
|
2287
|
-
}
|
2548
|
+
type: ["string", "boolean"],
|
2549
|
+
const: { $data: `1/${comparedFieldId}` }
|
2550
|
+
},
|
2551
|
+
[comparedFieldId]: { type: ["string", "boolean"] }
|
2288
2552
|
},
|
2289
|
-
required: [fieldId]
|
2290
|
-
}
|
2291
|
-
}
|
2292
|
-
|
2293
|
-
|
2553
|
+
required: [fieldId, comparedFieldId]
|
2554
|
+
});
|
2555
|
+
}
|
2556
|
+
return defineFormConditional({
|
2557
|
+
type: "object",
|
2558
|
+
properties: {
|
2559
|
+
[fieldId]: {
|
2560
|
+
oneOf: [
|
2561
|
+
{ type: "string", const: value },
|
2562
|
+
{ type: "boolean", const: value }
|
2563
|
+
],
|
2564
|
+
const: value
|
2565
|
+
}
|
2566
|
+
},
|
2567
|
+
required: [fieldId]
|
2568
|
+
});
|
2569
|
+
},
|
2294
2570
|
/**
|
2295
2571
|
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
2296
2572
|
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|
@@ -2299,108 +2575,102 @@ function field(fieldId) {
|
|
2299
2575
|
* NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
|
2300
2576
|
*
|
2301
2577
|
*/
|
2302
|
-
isFalsy: () =>
|
2578
|
+
isFalsy: () => defineFormConditional({
|
2303
2579
|
type: "object",
|
2304
2580
|
properties: {
|
2305
|
-
|
2306
|
-
type: "object",
|
2307
|
-
properties: {
|
2308
|
-
[fieldId]: {
|
2309
|
-
anyOf: [
|
2310
|
-
{ const: "undefined" },
|
2311
|
-
{ const: false },
|
2312
|
-
{ const: null },
|
2313
|
-
{ const: "" }
|
2314
|
-
]
|
2315
|
-
}
|
2316
|
-
},
|
2581
|
+
[fieldId]: {
|
2317
2582
|
anyOf: [
|
2318
|
-
{
|
2319
|
-
|
2320
|
-
},
|
2321
|
-
{
|
2322
|
-
not: {
|
2323
|
-
required: [fieldId]
|
2324
|
-
}
|
2325
|
-
}
|
2583
|
+
{ const: "undefined" },
|
2584
|
+
{ const: false },
|
2585
|
+
{ const: null },
|
2586
|
+
{ const: "" }
|
2326
2587
|
]
|
2327
2588
|
}
|
2328
2589
|
},
|
2329
|
-
|
2330
|
-
|
2331
|
-
|
2332
|
-
|
2333
|
-
|
2334
|
-
$form: {
|
2335
|
-
type: "object",
|
2336
|
-
properties: {
|
2337
|
-
[fieldId]: {
|
2338
|
-
type: "string",
|
2339
|
-
enum: ["undefined"]
|
2340
|
-
}
|
2341
|
-
},
|
2590
|
+
anyOf: [
|
2591
|
+
{
|
2592
|
+
required: [fieldId]
|
2593
|
+
},
|
2594
|
+
{
|
2342
2595
|
not: {
|
2343
2596
|
required: [fieldId]
|
2344
2597
|
}
|
2345
2598
|
}
|
2599
|
+
]
|
2600
|
+
}),
|
2601
|
+
isUndefined: () => defineFormConditional({
|
2602
|
+
type: "object",
|
2603
|
+
properties: {
|
2604
|
+
[fieldId]: {
|
2605
|
+
type: "string",
|
2606
|
+
enum: ["undefined"]
|
2607
|
+
}
|
2346
2608
|
},
|
2347
|
-
|
2609
|
+
not: {
|
2610
|
+
required: [fieldId]
|
2611
|
+
}
|
2348
2612
|
}),
|
2349
|
-
inArray: (values) =>
|
2613
|
+
inArray: (values) => defineFormConditional({
|
2350
2614
|
type: "object",
|
2351
2615
|
properties: {
|
2352
|
-
|
2353
|
-
type: "
|
2354
|
-
|
2355
|
-
[fieldId]: {
|
2356
|
-
type: "string",
|
2357
|
-
enum: values
|
2358
|
-
}
|
2359
|
-
},
|
2360
|
-
required: [fieldId]
|
2616
|
+
[fieldId]: {
|
2617
|
+
type: "string",
|
2618
|
+
enum: values
|
2361
2619
|
}
|
2362
2620
|
},
|
2363
|
-
required: [
|
2621
|
+
required: [fieldId]
|
2364
2622
|
}),
|
2365
|
-
isValidEnglishName: () =>
|
2623
|
+
isValidEnglishName: () => defineFormConditional({
|
2366
2624
|
type: "object",
|
2367
2625
|
properties: {
|
2368
|
-
|
2369
|
-
type: "
|
2370
|
-
|
2371
|
-
|
2372
|
-
|
2373
|
-
|
2374
|
-
|
2375
|
-
|
2376
|
-
|
2377
|
-
|
2626
|
+
[fieldId]: {
|
2627
|
+
type: "string",
|
2628
|
+
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'._-]*)*$",
|
2629
|
+
description: "Name must contain only letters, numbers, and allowed special characters ('._-). No double spaces."
|
2630
|
+
}
|
2631
|
+
},
|
2632
|
+
required: [fieldId]
|
2633
|
+
}),
|
2634
|
+
/**
|
2635
|
+
* Checks if the field value matches a given regular expression pattern.
|
2636
|
+
* @param pattern - The regular expression pattern to match the field value against.
|
2637
|
+
* @returns A JSONSchema conditional that validates the field value against the pattern.
|
2638
|
+
*/
|
2639
|
+
matches: (pattern) => defineFormConditional({
|
2640
|
+
type: "object",
|
2641
|
+
properties: {
|
2642
|
+
[fieldId]: {
|
2643
|
+
type: "string",
|
2644
|
+
pattern
|
2645
|
+
}
|
2646
|
+
},
|
2647
|
+
required: [fieldId]
|
2648
|
+
}),
|
2649
|
+
isBetween: (min, max) => defineFormConditional({
|
2650
|
+
type: "object",
|
2651
|
+
properties: {
|
2652
|
+
[fieldId]: {
|
2653
|
+
type: "number",
|
2654
|
+
minimum: min,
|
2655
|
+
maximum: max
|
2378
2656
|
}
|
2379
2657
|
},
|
2380
|
-
required: [
|
2658
|
+
required: [fieldId]
|
2381
2659
|
})
|
2382
2660
|
};
|
2383
2661
|
}
|
2384
2662
|
|
2385
2663
|
// ../commons/src/fixtures/tennis-club-membership-event.ts
|
2386
|
-
var PRINT_CERTIFICATE_FORM =
|
2664
|
+
var PRINT_CERTIFICATE_FORM = defineActionForm({
|
2387
2665
|
label: {
|
2388
2666
|
id: "v2.event.tennis-club-membership.action.certificate.form.label",
|
2389
2667
|
defaultMessage: "Tennis club membership certificate collector",
|
2390
2668
|
description: "This is what this form is referred as in the system"
|
2391
2669
|
},
|
2392
|
-
version: {
|
2393
|
-
id: "1.0.0",
|
2394
|
-
label: {
|
2395
|
-
id: "v2.event.tennis-club-membership.action.certificate.form.version.1",
|
2396
|
-
defaultMessage: "Version 1",
|
2397
|
-
description: "This is the first version of the form"
|
2398
|
-
}
|
2399
|
-
},
|
2400
|
-
active: true,
|
2401
2670
|
pages: [
|
2402
2671
|
{
|
2403
2672
|
id: "collector",
|
2673
|
+
type: PageTypes.enum.FORM,
|
2404
2674
|
title: {
|
2405
2675
|
id: "v2.event.tennis-club-membership.action.certificate.form.section.who.title",
|
2406
2676
|
defaultMessage: "Print certified copy",
|
@@ -2415,7 +2685,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2415
2685
|
defaultMessage: "Requester",
|
2416
2686
|
description: "This is the label for the field"
|
2417
2687
|
},
|
2418
|
-
type:
|
2688
|
+
type: FieldType.SELECT,
|
2419
2689
|
options: [
|
2420
2690
|
{
|
2421
2691
|
value: "INFORMANT",
|
@@ -2492,7 +2762,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2492
2762
|
defaultMessage: "Select Type of ID",
|
2493
2763
|
description: "This is the label for selecting the type of ID"
|
2494
2764
|
},
|
2495
|
-
type:
|
2765
|
+
type: FieldType.SELECT,
|
2496
2766
|
options: [
|
2497
2767
|
{
|
2498
2768
|
value: "PASSPORT",
|
@@ -2593,7 +2863,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2593
2863
|
defaultMessage: "Passport Details",
|
2594
2864
|
description: "Field for entering Passport details"
|
2595
2865
|
},
|
2596
|
-
type:
|
2866
|
+
type: FieldType.TEXT
|
2597
2867
|
},
|
2598
2868
|
{
|
2599
2869
|
id: "collector.DRIVING_LICENSE.details",
|
@@ -2644,7 +2914,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2644
2914
|
defaultMessage: "Driving License Details",
|
2645
2915
|
description: "Field for entering Driving License details"
|
2646
2916
|
},
|
2647
|
-
type:
|
2917
|
+
type: FieldType.TEXT
|
2648
2918
|
},
|
2649
2919
|
{
|
2650
2920
|
id: "collector.REFUGEE_NUMBER.details",
|
@@ -2695,7 +2965,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2695
2965
|
defaultMessage: "Refugee Number Details",
|
2696
2966
|
description: "Field for entering Refugee Number details"
|
2697
2967
|
},
|
2698
|
-
type:
|
2968
|
+
type: FieldType.TEXT
|
2699
2969
|
},
|
2700
2970
|
{
|
2701
2971
|
id: "collector.ALIEN_NUMBER.details",
|
@@ -2746,7 +3016,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2746
3016
|
defaultMessage: "Alien Number Details",
|
2747
3017
|
description: "Field for entering Alien Number details"
|
2748
3018
|
},
|
2749
|
-
type:
|
3019
|
+
type: FieldType.TEXT
|
2750
3020
|
},
|
2751
3021
|
{
|
2752
3022
|
id: "collector.OTHER.idTypeOther",
|
@@ -2797,7 +3067,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2797
3067
|
defaultMessage: "Other ID Type (if applicable)",
|
2798
3068
|
description: 'Field for entering ID type if "Other" is selected'
|
2799
3069
|
},
|
2800
|
-
type:
|
3070
|
+
type: FieldType.TEXT
|
2801
3071
|
},
|
2802
3072
|
{
|
2803
3073
|
id: "collector.OTHER.firstName",
|
@@ -2848,7 +3118,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2848
3118
|
defaultMessage: "First Name",
|
2849
3119
|
description: "This is the label for the first name field"
|
2850
3120
|
},
|
2851
|
-
type:
|
3121
|
+
type: FieldType.TEXT
|
2852
3122
|
},
|
2853
3123
|
{
|
2854
3124
|
id: "collector.OTHER.lastName",
|
@@ -2899,7 +3169,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2899
3169
|
defaultMessage: "Last Name",
|
2900
3170
|
description: "This is the label for the last name field"
|
2901
3171
|
},
|
2902
|
-
type:
|
3172
|
+
type: FieldType.TEXT
|
2903
3173
|
},
|
2904
3174
|
{
|
2905
3175
|
id: "collector.OTHER.relationshipToMember",
|
@@ -2950,7 +3220,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2950
3220
|
defaultMessage: "Relationship to Member",
|
2951
3221
|
description: "This is the label for the relationship to member field"
|
2952
3222
|
},
|
2953
|
-
type:
|
3223
|
+
type: FieldType.TEXT
|
2954
3224
|
},
|
2955
3225
|
{
|
2956
3226
|
id: "collector.OTHER.signedAffidavit",
|
@@ -3001,66 +3271,88 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
3001
3271
|
defaultMessage: "Signed Affidavit (Optional)",
|
3002
3272
|
description: "This is the label for uploading a signed affidavit"
|
3003
3273
|
},
|
3004
|
-
type:
|
3274
|
+
type: FieldType.FILE
|
3005
3275
|
}
|
3006
3276
|
]
|
3007
|
-
}
|
3008
|
-
],
|
3009
|
-
review: {
|
3010
|
-
title: {
|
3011
|
-
id: "v2.event.tennis-club-membership.action.certificate.form.review.title",
|
3012
|
-
defaultMessage: "Member certificate collector for {firstname} {surname}",
|
3013
|
-
description: "Title of the form to show in review page"
|
3014
3277
|
},
|
3015
|
-
|
3016
|
-
|
3017
|
-
|
3018
|
-
|
3019
|
-
|
3020
|
-
|
3021
|
-
|
3022
|
-
|
3023
|
-
|
3024
|
-
|
3025
|
-
|
3026
|
-
|
3027
|
-
|
3028
|
-
|
3029
|
-
|
3030
|
-
|
3278
|
+
{
|
3279
|
+
id: "collector.identity.verify",
|
3280
|
+
type: PageTypes.enum.VERIFICATION,
|
3281
|
+
conditional: field("collector.requesterId").isEqualTo("INFORMANT"),
|
3282
|
+
title: {
|
3283
|
+
id: "event.tennis-club-membership.action.print.verifyIdentity",
|
3284
|
+
defaultMessage: "Verify their identity",
|
3285
|
+
description: "This is the title of the section"
|
3286
|
+
},
|
3287
|
+
fields: [],
|
3288
|
+
actions: {
|
3289
|
+
verify: {
|
3290
|
+
label: {
|
3291
|
+
defaultMessage: "Verified",
|
3292
|
+
description: "This is the label for the verification button",
|
3293
|
+
id: "v2.event.tennis-club-membership.action.certificate.form.verify"
|
3294
|
+
}
|
3295
|
+
},
|
3296
|
+
cancel: {
|
3297
|
+
label: {
|
3298
|
+
defaultMessage: "Identity does not match",
|
3299
|
+
description: "This is the label for the verification cancellation button",
|
3300
|
+
id: "v2.event.tennis-club-membership.action.certificate.form.cancel"
|
3301
|
+
},
|
3302
|
+
confirmation: {
|
3303
|
+
title: {
|
3304
|
+
defaultMessage: "Print without proof of ID?",
|
3305
|
+
description: "This is the title for the verification cancellation modal",
|
3306
|
+
id: "v2.event.tennis-club-membership.action.certificate.form.cancel.confirmation.title"
|
3307
|
+
},
|
3308
|
+
body: {
|
3309
|
+
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",
|
3310
|
+
description: "This is the body for the verification cancellation modal",
|
3311
|
+
id: "v2.event.tennis-club-membership.action.certificate.form.cancel.confirmation.body"
|
3312
|
+
}
|
3313
|
+
}
|
3314
|
+
}
|
3315
|
+
}
|
3031
3316
|
}
|
3317
|
+
]
|
3318
|
+
});
|
3319
|
+
var TENNIS_CLUB_DECLARATION_REVIEW = {
|
3320
|
+
title: {
|
3321
|
+
id: "v2.event.tennis-club-membership.action.declare.form.review.title",
|
3322
|
+
defaultMessage: "{applicant.firstname, select, __EMPTY__ {Member declaration} other {{applicant.surname, select, __EMPTY__ {Member declaration} other {Member declaration for {applicant.firstname} {applicant.surname}}}}}",
|
3323
|
+
description: "Title of the review page"
|
3032
3324
|
},
|
3033
|
-
|
3034
|
-
|
3035
|
-
id: "
|
3036
|
-
|
3037
|
-
|
3325
|
+
fields: [
|
3326
|
+
{
|
3327
|
+
id: "review.comment",
|
3328
|
+
type: FieldType.TEXTAREA,
|
3329
|
+
label: {
|
3330
|
+
defaultMessage: "Comment",
|
3331
|
+
id: "v2.event.birth.action.declare.form.review.comment.label",
|
3332
|
+
description: "Label for the comment field in the review section"
|
3333
|
+
}
|
3038
3334
|
},
|
3039
|
-
|
3040
|
-
|
3041
|
-
|
3042
|
-
|
3043
|
-
|
3044
|
-
|
3045
|
-
|
3046
|
-
description: "Label for the comment field in the review section"
|
3047
|
-
}
|
3335
|
+
{
|
3336
|
+
type: FieldType.SIGNATURE,
|
3337
|
+
id: "review.signature",
|
3338
|
+
label: {
|
3339
|
+
defaultMessage: "Signature of informant",
|
3340
|
+
id: "v2.event.birth.action.declare.form.review.signature.label",
|
3341
|
+
description: "Label for the signature field in the review section"
|
3048
3342
|
},
|
3049
|
-
{
|
3050
|
-
|
3051
|
-
|
3052
|
-
|
3053
|
-
defaultMessage: "Signature of informant",
|
3054
|
-
id: "v2.event.birth.action.declare.form.review.signature.label",
|
3055
|
-
description: "Label for the signature field in the review section"
|
3056
|
-
},
|
3057
|
-
signaturePromptLabel: {
|
3058
|
-
id: "v2.signature.upload.modal.title",
|
3059
|
-
defaultMessage: "Draw signature",
|
3060
|
-
description: "Title for the modal to draw signature"
|
3061
|
-
}
|
3343
|
+
signaturePromptLabel: {
|
3344
|
+
id: "v2.signature.upload.modal.title",
|
3345
|
+
defaultMessage: "Draw signature",
|
3346
|
+
description: "Title for the modal to draw signature"
|
3062
3347
|
}
|
3063
|
-
|
3348
|
+
}
|
3349
|
+
]
|
3350
|
+
};
|
3351
|
+
var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
3352
|
+
label: {
|
3353
|
+
id: "v2.event.tennis-club-membership.action.declare.form.label",
|
3354
|
+
defaultMessage: "Tennis club membership application",
|
3355
|
+
description: "This is what this form is referred as in the system"
|
3064
3356
|
},
|
3065
3357
|
pages: [
|
3066
3358
|
{
|
@@ -3073,7 +3365,7 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
3073
3365
|
fields: [
|
3074
3366
|
{
|
3075
3367
|
id: "applicant.firstname",
|
3076
|
-
type:
|
3368
|
+
type: FieldType.TEXT,
|
3077
3369
|
required: true,
|
3078
3370
|
conditionals: [],
|
3079
3371
|
label: {
|
@@ -3084,7 +3376,7 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
3084
3376
|
},
|
3085
3377
|
{
|
3086
3378
|
id: "applicant.surname",
|
3087
|
-
type:
|
3379
|
+
type: FieldType.TEXT,
|
3088
3380
|
required: true,
|
3089
3381
|
conditionals: [],
|
3090
3382
|
label: {
|
@@ -3127,7 +3419,7 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
3127
3419
|
},
|
3128
3420
|
{
|
3129
3421
|
id: "applicant.image",
|
3130
|
-
type:
|
3422
|
+
type: FieldType.FILE,
|
3131
3423
|
required: false,
|
3132
3424
|
label: {
|
3133
3425
|
defaultMessage: "Applicant's profile picture",
|
@@ -3148,6 +3440,27 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
3148
3440
|
}
|
3149
3441
|
]
|
3150
3442
|
},
|
3443
|
+
{
|
3444
|
+
id: "senior-pass",
|
3445
|
+
conditional: field("applicant.dob").isBefore().date("1950-01-01"),
|
3446
|
+
title: {
|
3447
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.senior-pass.title",
|
3448
|
+
defaultMessage: "Assign senior pass for applicant",
|
3449
|
+
description: "This is the title of the section"
|
3450
|
+
},
|
3451
|
+
fields: [
|
3452
|
+
{
|
3453
|
+
id: "senior-pass.id",
|
3454
|
+
type: FieldType.TEXT,
|
3455
|
+
required: true,
|
3456
|
+
label: {
|
3457
|
+
defaultMessage: "Senior pass ID",
|
3458
|
+
description: "This is the label for the field",
|
3459
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.senior-pass.field.id.label"
|
3460
|
+
}
|
3461
|
+
}
|
3462
|
+
]
|
3463
|
+
},
|
3151
3464
|
{
|
3152
3465
|
id: "recommender",
|
3153
3466
|
title: {
|
@@ -3169,7 +3482,7 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
3169
3482
|
},
|
3170
3483
|
{
|
3171
3484
|
id: "recommender.firstname",
|
3172
|
-
type:
|
3485
|
+
type: FieldType.TEXT,
|
3173
3486
|
required: true,
|
3174
3487
|
conditionals: [
|
3175
3488
|
{
|
@@ -3185,7 +3498,7 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
3185
3498
|
},
|
3186
3499
|
{
|
3187
3500
|
id: "recommender.surname",
|
3188
|
-
type:
|
3501
|
+
type: FieldType.TEXT,
|
3189
3502
|
required: true,
|
3190
3503
|
conditionals: [
|
3191
3504
|
{
|
@@ -3201,7 +3514,7 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
3201
3514
|
},
|
3202
3515
|
{
|
3203
3516
|
id: "recommender.id",
|
3204
|
-
type:
|
3517
|
+
type: FieldType.TEXT,
|
3205
3518
|
required: true,
|
3206
3519
|
conditionals: [
|
3207
3520
|
{
|
@@ -3309,7 +3622,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3309
3622
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
3310
3623
|
id: "event.tennis-club-membership.action.declare.label"
|
3311
3624
|
},
|
3312
|
-
|
3625
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
3313
3626
|
},
|
3314
3627
|
{
|
3315
3628
|
type: ActionType.VALIDATE,
|
@@ -3318,7 +3631,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3318
3631
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
3319
3632
|
id: "event.tennis-club-membership.action.validate.label"
|
3320
3633
|
},
|
3321
|
-
|
3634
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
3322
3635
|
},
|
3323
3636
|
{
|
3324
3637
|
type: ActionType.REGISTER,
|
@@ -3327,7 +3640,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3327
3640
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
3328
3641
|
id: "event.tennis-club-membership.action.register.label"
|
3329
3642
|
},
|
3330
|
-
|
3643
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
3331
3644
|
},
|
3332
3645
|
{
|
3333
3646
|
type: ActionType.REQUEST_CORRECTION,
|
@@ -3336,10 +3649,10 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3336
3649
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
3337
3650
|
id: "event.tennis-club-membership.action.correction.request.label"
|
3338
3651
|
},
|
3339
|
-
forms: [TENNIS_CLUB_FORM],
|
3340
3652
|
onboardingForm: [
|
3341
3653
|
{
|
3342
3654
|
id: "correction-requester",
|
3655
|
+
type: PageTypes.enum.FORM,
|
3343
3656
|
title: {
|
3344
3657
|
id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
|
3345
3658
|
defaultMessage: "Correction requester",
|
@@ -3403,6 +3716,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3403
3716
|
},
|
3404
3717
|
{
|
3405
3718
|
id: "identity-check",
|
3719
|
+
type: PageTypes.enum.FORM,
|
3406
3720
|
title: {
|
3407
3721
|
id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
|
3408
3722
|
defaultMessage: "Verify their identity",
|
@@ -3445,6 +3759,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3445
3759
|
additionalDetailsForm: [
|
3446
3760
|
{
|
3447
3761
|
id: "correction-request.supporting-documents",
|
3762
|
+
type: PageTypes.enum.FORM,
|
3448
3763
|
title: {
|
3449
3764
|
id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
|
3450
3765
|
defaultMessage: "Upload supporting documents",
|
@@ -3462,7 +3777,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3462
3777
|
},
|
3463
3778
|
{
|
3464
3779
|
id: "correction.supportingDocs",
|
3465
|
-
type:
|
3780
|
+
type: FieldType.FILE,
|
3466
3781
|
label: {
|
3467
3782
|
id: "correction.corrector.title",
|
3468
3783
|
defaultMessage: "Upload supporting documents",
|
@@ -3506,6 +3821,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3506
3821
|
},
|
3507
3822
|
{
|
3508
3823
|
id: "correction-request.additional-details",
|
3824
|
+
type: PageTypes.enum.FORM,
|
3509
3825
|
title: {
|
3510
3826
|
id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
|
3511
3827
|
defaultMessage: "Reason for correction",
|
@@ -3514,7 +3830,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3514
3830
|
fields: [
|
3515
3831
|
{
|
3516
3832
|
id: "correction.request.reason",
|
3517
|
-
type:
|
3833
|
+
type: FieldType.TEXT,
|
3518
3834
|
label: {
|
3519
3835
|
id: "correction.reason.title",
|
3520
3836
|
defaultMessage: "Reason for correction?",
|
@@ -3527,7 +3843,6 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3527
3843
|
},
|
3528
3844
|
{
|
3529
3845
|
type: ActionType.APPROVE_CORRECTION,
|
3530
|
-
forms: [TENNIS_CLUB_FORM],
|
3531
3846
|
label: {
|
3532
3847
|
defaultMessage: "Approve correction",
|
3533
3848
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
@@ -3541,7 +3856,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3541
3856
|
defaultMessage: "Print certificate",
|
3542
3857
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
3543
3858
|
},
|
3544
|
-
|
3859
|
+
printForm: PRINT_CERTIFICATE_FORM,
|
3545
3860
|
conditionals: [
|
3546
3861
|
{
|
3547
3862
|
type: "SHOW",
|
@@ -3588,8 +3903,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3588
3903
|
id: "v2.event.tennis-club-membership.action.archive.label",
|
3589
3904
|
defaultMessage: "Archive",
|
3590
3905
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
3591
|
-
}
|
3592
|
-
forms: [TENNIS_CLUB_FORM]
|
3906
|
+
}
|
3593
3907
|
},
|
3594
3908
|
{
|
3595
3909
|
type: ActionType.REJECT,
|
@@ -3597,8 +3911,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3597
3911
|
id: "v2.event.tennis-club-membership.action.reject.label",
|
3598
3912
|
defaultMessage: "Reject",
|
3599
3913
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
3600
|
-
}
|
3601
|
-
forms: [TENNIS_CLUB_FORM]
|
3914
|
+
}
|
3602
3915
|
}
|
3603
3916
|
],
|
3604
3917
|
advancedSearch: [
|
@@ -3614,20 +3927,52 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3614
3927
|
}
|
3615
3928
|
]
|
3616
3929
|
}
|
3617
|
-
]
|
3930
|
+
],
|
3931
|
+
declaration: TENNIS_CLUB_DECLARATION_FORM
|
3618
3932
|
});
|
3619
3933
|
|
3620
3934
|
// ../commons/src/events/test.utils.ts
|
3621
|
-
function
|
3622
|
-
|
3623
|
-
const data = fields.reduce(
|
3935
|
+
function fieldConfigsToActionAnnotation(fields) {
|
3936
|
+
return fields.reduce(
|
3624
3937
|
(acc, field2, i) => ({
|
3625
3938
|
...acc,
|
3626
3939
|
[field2.id]: mapFieldTypeToMockValue(field2, i)
|
3627
3940
|
}),
|
3628
3941
|
{}
|
3629
3942
|
);
|
3630
|
-
|
3943
|
+
}
|
3944
|
+
function generateActionInput(configuration, action) {
|
3945
|
+
const parsed = DeclarationUpdateActions.safeParse(action);
|
3946
|
+
if (parsed.success) {
|
3947
|
+
const fields = getDeclarationFields(configuration);
|
3948
|
+
const annotation = fieldConfigsToActionAnnotation(fields);
|
3949
|
+
return stripHiddenFields(fields, annotation);
|
3950
|
+
}
|
3951
|
+
console.warn(`${action} is not a declaration action. Setting data as {}.`);
|
3952
|
+
return {};
|
3953
|
+
}
|
3954
|
+
function generateActionMetadataInput(configuration, action) {
|
3955
|
+
const actionConfig = configuration.actions.find(
|
3956
|
+
(ac) => ac.type === action
|
3957
|
+
);
|
3958
|
+
const annotationFields = actionConfig ? getActionAnnotationFields(actionConfig) : [];
|
3959
|
+
const annotation = fieldConfigsToActionAnnotation(annotationFields);
|
3960
|
+
const visibleVerificationPageIds = findRecordActionPages(
|
3961
|
+
configuration,
|
3962
|
+
action
|
3963
|
+
).filter((page) => isVerificationPage(page)).filter((page) => isPageVisible(page, annotation)).map((page) => page.id);
|
3964
|
+
const visiblePageVerificationMap = visibleVerificationPageIds.reduce(
|
3965
|
+
(acc, pageId) => ({
|
3966
|
+
...acc,
|
3967
|
+
[pageId]: true
|
3968
|
+
}),
|
3969
|
+
{}
|
3970
|
+
);
|
3971
|
+
const fieldBasedPayload = stripHiddenFields(annotationFields, annotation);
|
3972
|
+
return {
|
3973
|
+
...fieldBasedPayload,
|
3974
|
+
...visiblePageVerificationMap
|
3975
|
+
};
|
3631
3976
|
}
|
3632
3977
|
var eventPayloadGenerator = {
|
3633
3978
|
create: (input = {}) => ({
|
@@ -3639,21 +3984,22 @@ var eventPayloadGenerator = {
|
|
3639
3984
|
type: input.type ?? "TENNIS_CLUB_MEMBERSHIP",
|
3640
3985
|
id
|
3641
3986
|
}),
|
3642
|
-
draft: (eventId, input = {}) => (0, import_lodash2.merge)(
|
3987
|
+
draft: ({ eventId, actionType }, input = {}) => (0, import_lodash2.merge)(
|
3643
3988
|
{
|
3644
3989
|
id: getUUID(),
|
3645
3990
|
eventId,
|
3646
3991
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
3647
3992
|
transactionId: getUUID(),
|
3648
3993
|
action: {
|
3649
|
-
type:
|
3650
|
-
|
3994
|
+
type: actionType,
|
3995
|
+
status: ActionStatus.Accepted,
|
3996
|
+
declaration: {
|
3651
3997
|
"applicant.firstname": "Max",
|
3652
3998
|
"applicant.surname": "McLaren",
|
3653
3999
|
"applicant.dob": "2020-01-02",
|
3654
4000
|
"recommender.none": true
|
3655
4001
|
},
|
3656
|
-
|
4002
|
+
annotation: {
|
3657
4003
|
"correction.requester.relationship": "ANOTHER_AGENT",
|
3658
4004
|
"correction.request.reason": "Child's name was incorrect"
|
3659
4005
|
},
|
@@ -3668,41 +4014,92 @@ var eventPayloadGenerator = {
|
|
3668
4014
|
declare: (eventId, input = {}) => ({
|
3669
4015
|
type: ActionType.DECLARE,
|
3670
4016
|
transactionId: input.transactionId ?? getUUID(),
|
3671
|
-
|
4017
|
+
declaration: input.declaration ?? generateActionInput(tennisClubMembershipEvent, ActionType.DECLARE),
|
4018
|
+
annotation: input.annotation ?? generateActionMetadataInput(
|
4019
|
+
tennisClubMembershipEvent,
|
4020
|
+
ActionType.DECLARE
|
4021
|
+
),
|
3672
4022
|
eventId
|
3673
4023
|
}),
|
4024
|
+
/**
|
4025
|
+
* Notify allows sending incomplete data. Think it as 'partial declare' for now.
|
4026
|
+
*/
|
4027
|
+
notify: (eventId, input = {}) => {
|
4028
|
+
let declaration = input.declaration;
|
4029
|
+
if (!declaration) {
|
4030
|
+
const partialDeclaration = (0, import_lodash2.omitBy)(
|
4031
|
+
generateActionInput(tennisClubMembershipEvent, ActionType.DECLARE),
|
4032
|
+
import_lodash2.isString
|
4033
|
+
);
|
4034
|
+
declaration = partialDeclaration;
|
4035
|
+
}
|
4036
|
+
return {
|
4037
|
+
type: ActionType.NOTIFY,
|
4038
|
+
transactionId: input.transactionId ?? getUUID(),
|
4039
|
+
declaration,
|
4040
|
+
eventId
|
4041
|
+
};
|
4042
|
+
},
|
3674
4043
|
validate: (eventId, input = {}) => ({
|
3675
4044
|
type: ActionType.VALIDATE,
|
3676
4045
|
transactionId: input.transactionId ?? getUUID(),
|
3677
|
-
|
4046
|
+
declaration: input.declaration ?? generateActionInput(tennisClubMembershipEvent, ActionType.VALIDATE),
|
4047
|
+
annotation: input.annotation ?? generateActionMetadataInput(
|
4048
|
+
tennisClubMembershipEvent,
|
4049
|
+
ActionType.VALIDATE
|
4050
|
+
),
|
3678
4051
|
duplicates: [],
|
3679
4052
|
eventId
|
3680
4053
|
}),
|
4054
|
+
assign: (eventId, input = {}) => ({
|
4055
|
+
type: ActionType.ASSIGN,
|
4056
|
+
transactionId: input.transactionId ?? getUUID(),
|
4057
|
+
declaration: {},
|
4058
|
+
assignedTo: input.assignedTo ?? getUUID(),
|
4059
|
+
eventId
|
4060
|
+
}),
|
4061
|
+
unassign: (eventId, input = {}) => ({
|
4062
|
+
type: ActionType.UNASSIGN,
|
4063
|
+
transactionId: input.transactionId ?? getUUID(),
|
4064
|
+
declaration: {},
|
4065
|
+
assignedTo: null,
|
4066
|
+
eventId
|
4067
|
+
}),
|
3681
4068
|
archive: (eventId, input = {}, isDuplicate) => ({
|
3682
4069
|
type: ActionType.ARCHIVE,
|
3683
4070
|
transactionId: input.transactionId ?? getUUID(),
|
3684
|
-
|
3685
|
-
|
4071
|
+
declaration: {},
|
4072
|
+
// @TODO: Check whether generator is needed?
|
4073
|
+
annotation: { isDuplicate: isDuplicate ?? false },
|
3686
4074
|
duplicates: [],
|
3687
4075
|
eventId
|
3688
4076
|
}),
|
3689
4077
|
reject: (eventId, input = {}) => ({
|
3690
4078
|
type: ActionType.REJECT,
|
3691
4079
|
transactionId: input.transactionId ?? getUUID(),
|
3692
|
-
|
4080
|
+
declaration: {},
|
4081
|
+
annotation: input.annotation ?? generateActionMetadataInput(
|
4082
|
+
tennisClubMembershipEvent,
|
4083
|
+
ActionType.REJECT
|
4084
|
+
),
|
3693
4085
|
duplicates: [],
|
3694
4086
|
eventId
|
3695
4087
|
}),
|
3696
4088
|
register: (eventId, input = {}) => ({
|
3697
4089
|
type: ActionType.REGISTER,
|
3698
4090
|
transactionId: input.transactionId ?? getUUID(),
|
3699
|
-
|
4091
|
+
declaration: input.declaration ?? generateActionInput(tennisClubMembershipEvent, ActionType.REGISTER),
|
4092
|
+
annotation: input.annotation ?? generateActionMetadataInput(
|
4093
|
+
tennisClubMembershipEvent,
|
4094
|
+
ActionType.REGISTER
|
4095
|
+
),
|
3700
4096
|
eventId
|
3701
4097
|
}),
|
3702
4098
|
printCertificate: (eventId, input = {}) => ({
|
3703
4099
|
type: ActionType.PRINT_CERTIFICATE,
|
3704
4100
|
transactionId: input.transactionId ?? getUUID(),
|
3705
|
-
|
4101
|
+
declaration: {},
|
4102
|
+
annotation: input.annotation ?? generateActionMetadataInput(
|
3706
4103
|
tennisClubMembershipEvent,
|
3707
4104
|
ActionType.PRINT_CERTIFICATE
|
3708
4105
|
),
|
@@ -3712,17 +4109,21 @@ var eventPayloadGenerator = {
|
|
3712
4109
|
request: (eventId, input = {}) => ({
|
3713
4110
|
type: ActionType.REQUEST_CORRECTION,
|
3714
4111
|
transactionId: input.transactionId ?? getUUID(),
|
3715
|
-
|
4112
|
+
declaration: input.declaration ?? generateActionInput(
|
4113
|
+
tennisClubMembershipEvent,
|
4114
|
+
ActionType.REQUEST_CORRECTION
|
4115
|
+
),
|
4116
|
+
annotation: input.annotation ?? generateActionMetadataInput(
|
3716
4117
|
tennisClubMembershipEvent,
|
3717
4118
|
ActionType.REQUEST_CORRECTION
|
3718
4119
|
),
|
3719
|
-
metadata: {},
|
3720
4120
|
eventId
|
3721
4121
|
}),
|
3722
4122
|
approve: (eventId, requestId, input = {}) => ({
|
3723
4123
|
type: ActionType.APPROVE_CORRECTION,
|
3724
4124
|
transactionId: input.transactionId ?? getUUID(),
|
3725
|
-
|
4125
|
+
declaration: {},
|
4126
|
+
annotation: input.annotation ?? generateActionMetadataInput(
|
3726
4127
|
tennisClubMembershipEvent,
|
3727
4128
|
ActionType.APPROVE_CORRECTION
|
3728
4129
|
),
|
@@ -3732,7 +4133,8 @@ var eventPayloadGenerator = {
|
|
3732
4133
|
reject: (eventId, requestId, input = {}) => ({
|
3733
4134
|
type: ActionType.REJECT_CORRECTION,
|
3734
4135
|
transactionId: input.transactionId ?? getUUID(),
|
3735
|
-
|
4136
|
+
declaration: {},
|
4137
|
+
annotation: input.annotation ?? generateActionMetadataInput(
|
3736
4138
|
tennisClubMembershipEvent,
|
3737
4139
|
ActionType.REJECT_CORRECTION
|
3738
4140
|
),
|
@@ -3754,11 +4156,16 @@ function generateActionDocument({
|
|
3754
4156
|
createdBy: getUUID(),
|
3755
4157
|
id: getUUID(),
|
3756
4158
|
createdAtLocation: "TODO",
|
3757
|
-
|
3758
|
-
|
3759
|
-
...defaults
|
4159
|
+
declaration: generateActionInput(configuration, action),
|
4160
|
+
annotation: {},
|
4161
|
+
...defaults,
|
4162
|
+
status: ActionStatus.Accepted
|
3760
4163
|
};
|
3761
4164
|
switch (action) {
|
4165
|
+
case ActionType.READ:
|
4166
|
+
return { ...actionBase, type: action };
|
4167
|
+
case ActionType.MARKED_AS_DUPLICATE:
|
4168
|
+
return { ...actionBase, type: action };
|
3762
4169
|
case ActionType.DECLARE:
|
3763
4170
|
return { ...actionBase, type: action };
|
3764
4171
|
case ActionType.UNASSIGN:
|
@@ -3783,14 +4190,13 @@ function generateActionDocument({
|
|
3783
4190
|
return { ...actionBase, requestId: getUUID(), type: action };
|
3784
4191
|
case ActionType.REJECT_CORRECTION:
|
3785
4192
|
return { ...actionBase, requestId: getUUID(), type: action };
|
3786
|
-
case ActionType.CUSTOM:
|
3787
|
-
return { ...actionBase, type: action };
|
3788
4193
|
case ActionType.REGISTER:
|
3789
4194
|
return {
|
3790
4195
|
...actionBase,
|
3791
|
-
type: action
|
3792
|
-
identifiers: { trackingId: getUUID(), registrationNumber: getUUID() }
|
4196
|
+
type: action
|
3793
4197
|
};
|
4198
|
+
case ActionType.DELETE:
|
4199
|
+
case ActionType.DETECT_DUPLICATE:
|
3794
4200
|
default:
|
3795
4201
|
throw new Error(`Unsupported action type: ${action}`);
|
3796
4202
|
}
|
@@ -3814,7 +4220,7 @@ function generateEventDocument({
|
|
3814
4220
|
updatedAt: new Date(Date.now() - 1e3).toISOString()
|
3815
4221
|
};
|
3816
4222
|
}
|
3817
|
-
function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE,
|
4223
|
+
function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE, declaration = {}) {
|
3818
4224
|
const action = generateActionDocument({
|
3819
4225
|
configuration: tennisClubMembershipEvent,
|
3820
4226
|
action: actionType
|
@@ -3824,9 +4230,9 @@ function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE, da
|
|
3824
4230
|
transactionId: getUUID(),
|
3825
4231
|
action: {
|
3826
4232
|
...action,
|
3827
|
-
|
3828
|
-
...action.
|
3829
|
-
...
|
4233
|
+
declaration: {
|
4234
|
+
...action.declaration,
|
4235
|
+
...declaration
|
3830
4236
|
}
|
3831
4237
|
},
|
3832
4238
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
@@ -3843,7 +4249,7 @@ var eventQueryDataGenerator = (overrides = {}) => ({
|
|
3843
4249
|
modifiedAt: overrides.modifiedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
3844
4250
|
assignedTo: overrides.assignedTo ?? null,
|
3845
4251
|
updatedBy: overrides.updatedBy ?? getUUID(),
|
3846
|
-
|
4252
|
+
declaration: overrides.declaration ?? {
|
3847
4253
|
"recommender.none": true,
|
3848
4254
|
"applicant.firstname": "Danny",
|
3849
4255
|
"applicant.surname": "Doe",
|
@@ -3851,6 +4257,11 @@ var eventQueryDataGenerator = (overrides = {}) => ({
|
|
3851
4257
|
},
|
3852
4258
|
trackingId: overrides.trackingId ?? "M3F8YQ"
|
3853
4259
|
});
|
4260
|
+
var generateTranslationConfig = (message) => ({
|
4261
|
+
defaultMessage: message,
|
4262
|
+
description: "Description for ${message}",
|
4263
|
+
id: message
|
4264
|
+
});
|
3854
4265
|
|
3855
4266
|
// ../commons/src/events/TemplateConfig.ts
|
3856
4267
|
function isTemplateVariable(value) {
|
@@ -3869,7 +4280,9 @@ function isFieldValueWithoutTemplates(value) {
|
|
3869
4280
|
return true;
|
3870
4281
|
}
|
3871
4282
|
function isFieldConfigDefaultValue(value) {
|
3872
|
-
if (!value)
|
4283
|
+
if (!value) {
|
4284
|
+
return false;
|
4285
|
+
}
|
3873
4286
|
if (isFieldValue(value)) {
|
3874
4287
|
return true;
|
3875
4288
|
}
|