@opencrvs/toolkit 1.8.0-rc.fca3e39 → 1.8.0-rc.fcf46fc
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 +6922 -14585
- package/dist/commons/conditionals/conditionals.d.ts +25 -3
- package/dist/commons/conditionals/validate.d.ts +14 -17
- package/dist/commons/events/ActionConfig.d.ts +1123 -2056
- package/dist/commons/events/ActionDocument.d.ts +7447 -347
- package/dist/commons/events/ActionInput.d.ts +2259 -522
- package/dist/commons/events/ActionType.d.ts +26 -16
- package/dist/commons/events/Conditional.d.ts +21 -5
- package/dist/commons/events/Draft.d.ts +67 -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 +850 -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/defineConfig.d.ts +91 -216
- package/dist/commons/events/index.d.ts +2 -1
- package/dist/commons/events/test.utils.d.ts +70 -287
- package/dist/commons/events/utils.d.ts +89 -83
- package/dist/commons/events/utils.test.d.ts +2 -0
- package/dist/conditionals/index.js +161 -93
- package/dist/events/index.js +1264 -781
- 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
|
+
findLastAssignmentAction: () => findLastAssignmentAction,
|
156
|
+
findRecordActionPages: () => findRecordActionPages,
|
157
|
+
generateActionAnnotationInput: () => generateActionAnnotationInput,
|
158
|
+
generateActionDeclarationInput: () => generateActionDeclarationInput,
|
131
159
|
generateActionDocument: () => generateActionDocument,
|
132
|
-
generateActionInput: () => generateActionInput,
|
133
160
|
generateEventDocument: () => generateEventDocument,
|
134
161
|
generateEventDraftDocument: () => generateEventDraftDocument,
|
135
162
|
generateTransactionId: () => generateTransactionId,
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
163
|
+
generateTranslationConfig: () => generateTranslationConfig,
|
164
|
+
getAcceptedActions: () => getAcceptedActions,
|
165
|
+
getActionAnnotation: () => getActionAnnotation,
|
166
|
+
getActionAnnotationFields: () => getActionAnnotationFields,
|
167
|
+
getActionReview: () => getActionReview,
|
168
|
+
getActionReviewFields: () => getActionReviewFields,
|
169
|
+
getAllAnnotationFields: () => getAllAnnotationFields,
|
170
|
+
getAnnotationFromDrafts: () => getAnnotationFromDrafts,
|
140
171
|
getCurrentEventState: () => getCurrentEventState,
|
141
172
|
getCurrentEventStateWithDrafts: () => getCurrentEventStateWithDrafts,
|
142
|
-
|
173
|
+
getDeclaration: () => getDeclaration,
|
174
|
+
getDeclarationFields: () => getDeclarationFields,
|
175
|
+
getDeclarationPages: () => getDeclarationPages,
|
143
176
|
getFieldValidationErrors: () => getFieldValidationErrors,
|
144
|
-
getFormFields: () => getFormFields,
|
145
|
-
getMetadataForAction: () => getMetadataForAction,
|
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,50 +205,71 @@ __export(events_exports, {
|
|
171
205
|
isTextAreaFieldType: () => isTextAreaFieldType,
|
172
206
|
isTextFieldType: () => isTextFieldType,
|
173
207
|
isUndeclaredDraft: () => isUndeclaredDraft,
|
208
|
+
isVerificationPage: () => isVerificationPage,
|
209
|
+
isWriteAction: () => isWriteAction,
|
174
210
|
mapFieldTypeToEmptyValue: () => mapFieldTypeToEmptyValue,
|
175
211
|
mapFieldTypeToMockValue: () => mapFieldTypeToMockValue,
|
176
212
|
mapFieldTypeToZod: () => mapFieldTypeToZod,
|
213
|
+
never: () => never,
|
177
214
|
not: () => not,
|
215
|
+
omitHiddenFields: () => omitHiddenFields,
|
216
|
+
omitHiddenPaginatedFields: () => omitHiddenPaginatedFields,
|
178
217
|
or: () => or,
|
179
|
-
resolveLabelsFromKnownFields: () => resolveLabelsFromKnownFields,
|
180
|
-
stripHiddenFields: () => stripHiddenFields,
|
181
218
|
user: () => user,
|
182
219
|
validate: () => validate,
|
183
220
|
validateFieldInput: () => validateFieldInput,
|
184
|
-
validateWorkqueueConfig: () => validateWorkqueueConfig
|
221
|
+
validateWorkqueueConfig: () => validateWorkqueueConfig,
|
222
|
+
writeActions: () => writeActions
|
185
223
|
});
|
186
224
|
module.exports = __toCommonJS(events_exports);
|
187
225
|
|
188
226
|
// ../commons/src/events/ActionConfig.ts
|
189
|
-
var
|
227
|
+
var import_zod9 = require("zod");
|
190
228
|
|
191
229
|
// ../commons/src/events/Conditional.ts
|
192
230
|
var import_zod = require("zod");
|
193
|
-
|
194
|
-
|
195
|
-
|
231
|
+
var Conditional = import_zod.z.custom(
|
232
|
+
(val) => typeof val === "object" && val !== null
|
233
|
+
);
|
196
234
|
var ConditionalType = {
|
197
|
-
/** When 'SHOW' conditional is defined, the action is shown to the user only if the condition is met */
|
198
235
|
SHOW: "SHOW",
|
199
|
-
|
200
|
-
|
236
|
+
ENABLE: "ENABLE",
|
237
|
+
DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
|
201
238
|
};
|
202
239
|
var ShowConditional = import_zod.z.object({
|
203
240
|
type: import_zod.z.literal(ConditionalType.SHOW),
|
204
|
-
conditional: Conditional
|
205
|
-
})
|
241
|
+
conditional: Conditional
|
242
|
+
}).describe(
|
243
|
+
"If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
|
244
|
+
);
|
206
245
|
var EnableConditional = import_zod.z.object({
|
207
246
|
type: import_zod.z.literal(ConditionalType.ENABLE),
|
208
|
-
conditional: Conditional
|
209
|
-
})
|
247
|
+
conditional: Conditional
|
248
|
+
}).describe(
|
249
|
+
"If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
|
250
|
+
);
|
210
251
|
var ActionConditional = import_zod.z.discriminatedUnion("type", [
|
211
252
|
// Action can be shown / hidden
|
212
253
|
ShowConditional,
|
213
254
|
// Action can be shown to the user in the list but as disabled
|
214
255
|
EnableConditional
|
215
256
|
]);
|
257
|
+
var DisplayOnReviewConditional = import_zod.z.object({
|
258
|
+
type: import_zod.z.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
259
|
+
conditional: Conditional
|
260
|
+
}).describe(
|
261
|
+
"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."
|
262
|
+
);
|
263
|
+
var FieldConditional = import_zod.z.discriminatedUnion("type", [
|
264
|
+
// Field input can be shown / hidden
|
265
|
+
ShowConditional,
|
266
|
+
// Field input can be shown to the user but as disabled
|
267
|
+
EnableConditional,
|
268
|
+
// Field output can be shown / hidden on the review page
|
269
|
+
DisplayOnReviewConditional
|
270
|
+
]);
|
216
271
|
|
217
|
-
// ../commons/src/events/
|
272
|
+
// ../commons/src/events/PageConfig.ts
|
218
273
|
var import_zod6 = require("zod");
|
219
274
|
|
220
275
|
// ../commons/src/events/FieldConfig.ts
|
@@ -255,7 +310,8 @@ var FieldType = {
|
|
255
310
|
ADMINISTRATIVE_AREA: "ADMINISTRATIVE_AREA",
|
256
311
|
FACILITY: "FACILITY",
|
257
312
|
OFFICE: "OFFICE",
|
258
|
-
SIGNATURE: "SIGNATURE"
|
313
|
+
SIGNATURE: "SIGNATURE",
|
314
|
+
DATA: "DATA"
|
259
315
|
};
|
260
316
|
var fieldTypes = Object.values(FieldType);
|
261
317
|
var compositeFieldTypes = [
|
@@ -354,6 +410,7 @@ var DateValue = import_zod4.z.string().date().describe("Date in the format YYYY-
|
|
354
410
|
var EmailValue = import_zod4.z.string().email();
|
355
411
|
var CheckboxFieldValue = import_zod4.z.boolean();
|
356
412
|
var NumberFieldValue = import_zod4.z.number();
|
413
|
+
var DataFieldValue = import_zod4.z.undefined();
|
357
414
|
var FieldValue = import_zod4.z.union([
|
358
415
|
TextValue,
|
359
416
|
DateValue,
|
@@ -363,6 +420,7 @@ var FieldValue = import_zod4.z.union([
|
|
363
420
|
FileFieldWithOptionValue,
|
364
421
|
UrbanAddressValue,
|
365
422
|
RuralAddressValue,
|
423
|
+
DataFieldValue,
|
366
424
|
GenericAddressValue
|
367
425
|
]);
|
368
426
|
var FieldUpdateValue = import_zod4.z.union([
|
@@ -374,6 +432,7 @@ var FieldUpdateValue = import_zod4.z.union([
|
|
374
432
|
FileFieldWithOptionValue,
|
375
433
|
UrbanAddressUpdateValue,
|
376
434
|
RuralAddressUpdateValue,
|
435
|
+
DataFieldValue,
|
377
436
|
GenericAddressUpdateValue
|
378
437
|
]);
|
379
438
|
|
@@ -396,14 +455,14 @@ var BaseField = import_zod5.z.object({
|
|
396
455
|
]),
|
397
456
|
DependencyExpression
|
398
457
|
]).optional(),
|
399
|
-
conditionals: import_zod5.z.array(
|
458
|
+
conditionals: import_zod5.z.array(FieldConditional).default([]).optional(),
|
400
459
|
required: import_zod5.z.boolean().default(false).optional(),
|
401
460
|
disabled: import_zod5.z.boolean().default(false).optional(),
|
402
461
|
hidden: import_zod5.z.boolean().default(false).optional(),
|
403
462
|
placeholder: TranslationConfig.optional(),
|
404
463
|
validation: import_zod5.z.array(
|
405
464
|
import_zod5.z.object({
|
406
|
-
validator: Conditional
|
465
|
+
validator: Conditional,
|
407
466
|
message: TranslationConfig
|
408
467
|
})
|
409
468
|
).default([]).optional(),
|
@@ -445,15 +504,25 @@ var TextAreaField = BaseField.extend({
|
|
445
504
|
postfix: TranslationConfig.optional()
|
446
505
|
}).default({ rows: 4 }).optional()
|
447
506
|
}).describe("Multiline text input");
|
507
|
+
var ImageMimeType = import_zod5.z.enum([
|
508
|
+
"image/png",
|
509
|
+
"image/jpg",
|
510
|
+
"image/jpeg",
|
511
|
+
"image/svg+xml"
|
512
|
+
]);
|
513
|
+
var MimeType = ImageMimeType;
|
514
|
+
var DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
|
448
515
|
var SignatureField = BaseField.extend({
|
449
516
|
type: import_zod5.z.literal(FieldType.SIGNATURE),
|
450
517
|
signaturePromptLabel: TranslationConfig.describe(
|
451
518
|
"Title of the signature modal"
|
452
519
|
),
|
453
520
|
configuration: import_zod5.z.object({
|
454
|
-
|
455
|
-
|
456
|
-
}).default({
|
521
|
+
maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
522
|
+
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
523
|
+
}).default({
|
524
|
+
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
525
|
+
})
|
457
526
|
}).describe("Signature input field");
|
458
527
|
var EmailField = BaseField.extend({
|
459
528
|
type: import_zod5.z.literal(FieldType.EMAIL),
|
@@ -496,13 +565,17 @@ var PageHeader = BaseField.extend({
|
|
496
565
|
}).describe("A read-only header component for form pages");
|
497
566
|
var File = BaseField.extend({
|
498
567
|
type: import_zod5.z.literal(FieldType.FILE),
|
499
|
-
|
568
|
+
configuration: import_zod5.z.object({
|
569
|
+
maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
570
|
+
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
|
500
571
|
style: import_zod5.z.object({
|
501
|
-
|
572
|
+
width: import_zod5.z.enum(["full", "auto"]).optional().describe(
|
502
573
|
"Whether the file upload button should take the full width of the container or not"
|
503
574
|
)
|
504
|
-
})
|
505
|
-
}).
|
575
|
+
}).optional()
|
576
|
+
}).default({
|
577
|
+
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
578
|
+
})
|
506
579
|
}).describe("File upload");
|
507
580
|
var SelectOption = import_zod5.z.object({
|
508
581
|
value: import_zod5.z.string().describe("The value of the option"),
|
@@ -548,7 +621,7 @@ var AdministrativeAreas = import_zod5.z.enum([
|
|
548
621
|
]);
|
549
622
|
var AdministrativeAreaConfiguration = import_zod5.z.object({
|
550
623
|
partOf: import_zod5.z.object({
|
551
|
-
$
|
624
|
+
$declaration: import_zod5.z.string()
|
552
625
|
}).optional().describe("Parent location"),
|
553
626
|
type: AdministrativeAreas
|
554
627
|
}).describe("Administrative area options");
|
@@ -563,8 +636,14 @@ var Location = BaseField.extend({
|
|
563
636
|
}).describe("Input field for a location");
|
564
637
|
var FileUploadWithOptions = BaseField.extend({
|
565
638
|
type: import_zod5.z.literal(FieldType.FILE_WITH_OPTIONS),
|
566
|
-
options: import_zod5.z.array(SelectOption).describe("A list of options")
|
567
|
-
|
639
|
+
options: import_zod5.z.array(SelectOption).describe("A list of options"),
|
640
|
+
configuration: import_zod5.z.object({
|
641
|
+
maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
642
|
+
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
643
|
+
}).default({
|
644
|
+
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
645
|
+
})
|
646
|
+
});
|
568
647
|
var Facility = BaseField.extend({
|
569
648
|
type: import_zod5.z.literal(FieldType.FACILITY),
|
570
649
|
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
@@ -577,6 +656,22 @@ var Address = BaseField.extend({
|
|
577
656
|
type: import_zod5.z.literal(FieldType.ADDRESS),
|
578
657
|
defaultValue: AddressFieldValue.optional()
|
579
658
|
}).describe("Address input field \u2013 a combination of location and text fields");
|
659
|
+
var DataEntry = import_zod5.z.union([
|
660
|
+
import_zod5.z.object({
|
661
|
+
label: TranslationConfig,
|
662
|
+
value: import_zod5.z.string()
|
663
|
+
}),
|
664
|
+
import_zod5.z.object({
|
665
|
+
fieldId: import_zod5.z.string()
|
666
|
+
})
|
667
|
+
]);
|
668
|
+
var DataField = BaseField.extend({
|
669
|
+
type: import_zod5.z.literal(FieldType.DATA),
|
670
|
+
configuration: import_zod5.z.object({
|
671
|
+
subtitle: TranslationConfig.optional(),
|
672
|
+
data: import_zod5.z.array(DataEntry)
|
673
|
+
})
|
674
|
+
}).describe("Data field for displaying read-only data");
|
580
675
|
var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
581
676
|
Address,
|
582
677
|
TextField,
|
@@ -598,133 +693,210 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
|
598
693
|
Office,
|
599
694
|
SignatureField,
|
600
695
|
EmailField,
|
601
|
-
FileUploadWithOptions
|
696
|
+
FileUploadWithOptions,
|
697
|
+
DataField
|
698
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
602
699
|
]);
|
603
700
|
|
604
|
-
// ../commons/src/events/
|
605
|
-
var
|
701
|
+
// ../commons/src/events/PageConfig.ts
|
702
|
+
var PageTypes = import_zod6.z.enum(["FORM", "VERIFICATION"]);
|
703
|
+
var PageConfigBase = import_zod6.z.object({
|
606
704
|
id: import_zod6.z.string().describe("Unique identifier for the page"),
|
607
705
|
title: TranslationConfig.describe("Header title of the page"),
|
608
|
-
fields: import_zod6.z.array(FieldConfig).describe("Fields to be rendered on the page")
|
706
|
+
fields: import_zod6.z.array(FieldConfig).describe("Fields to be rendered on the page"),
|
707
|
+
conditional: Conditional.optional().describe(
|
708
|
+
"Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
|
709
|
+
)
|
609
710
|
});
|
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")
|
711
|
+
var FormPageConfig = PageConfigBase.extend({
|
712
|
+
type: import_zod6.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
|
713
|
+
});
|
714
|
+
var VerificationActionConfig = import_zod6.z.object({
|
715
|
+
verify: import_zod6.z.object({ label: TranslationConfig }),
|
716
|
+
cancel: import_zod6.z.object({
|
717
|
+
label: TranslationConfig,
|
718
|
+
confirmation: import_zod6.z.object({
|
719
|
+
title: TranslationConfig,
|
720
|
+
body: TranslationConfig
|
721
|
+
})
|
627
722
|
})
|
723
|
+
}).describe("Actions available on the verification page");
|
724
|
+
var VerificationPageConfig = FormPageConfig.extend({
|
725
|
+
type: import_zod6.z.literal(PageTypes.enum.VERIFICATION),
|
726
|
+
actions: VerificationActionConfig
|
628
727
|
});
|
728
|
+
var PageConfig = import_zod6.z.discriminatedUnion("type", [
|
729
|
+
FormPageConfig,
|
730
|
+
VerificationPageConfig
|
731
|
+
]);
|
629
732
|
|
630
733
|
// ../commons/src/events/ActionType.ts
|
734
|
+
var import_zod7 = require("zod");
|
631
735
|
var ActionType = {
|
736
|
+
// Pre-declaration actions
|
737
|
+
DELETE: "DELETE",
|
632
738
|
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
739
|
NOTIFY: "NOTIFY",
|
740
|
+
// Declaration actions
|
642
741
|
DECLARE: "DECLARE",
|
643
|
-
|
644
|
-
|
645
|
-
|
742
|
+
VALIDATE: "VALIDATE",
|
743
|
+
REGISTER: "REGISTER",
|
744
|
+
// Declaration system actions. Non-configurable.
|
745
|
+
DETECT_DUPLICATE: "DETECT_DUPLICATE",
|
646
746
|
REJECT: "REJECT",
|
747
|
+
// REJECT_DECLARATION
|
647
748
|
MARKED_AS_DUPLICATE: "MARKED_AS_DUPLICATE",
|
648
|
-
|
749
|
+
// MARK_AS_DUPLICATE
|
750
|
+
ARCHIVE: "ARCHIVE",
|
751
|
+
// Record actions
|
752
|
+
PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
|
753
|
+
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
754
|
+
REJECT_CORRECTION: "REJECT_CORRECTION",
|
755
|
+
APPROVE_CORRECTION: "APPROVE_CORRECTION",
|
756
|
+
// General actions
|
757
|
+
READ: "READ",
|
758
|
+
ASSIGN: "ASSIGN",
|
759
|
+
UNASSIGN: "UNASSIGN"
|
649
760
|
};
|
650
|
-
var
|
761
|
+
var ConfirmableActions = [
|
762
|
+
ActionType.NOTIFY,
|
763
|
+
ActionType.DECLARE,
|
764
|
+
ActionType.VALIDATE,
|
765
|
+
ActionType.REGISTER,
|
766
|
+
ActionType.REJECT,
|
767
|
+
ActionType.ARCHIVE,
|
768
|
+
ActionType.PRINT_CERTIFICATE
|
769
|
+
];
|
770
|
+
var ActionTypes = import_zod7.z.enum([
|
771
|
+
"DELETE",
|
772
|
+
"CREATE",
|
773
|
+
"NOTIFY",
|
774
|
+
"DECLARE",
|
775
|
+
"VALIDATE",
|
776
|
+
"REGISTER",
|
777
|
+
"DETECT_DUPLICATE",
|
778
|
+
"REJECT",
|
779
|
+
"MARKED_AS_DUPLICATE",
|
780
|
+
"ARCHIVE",
|
781
|
+
"PRINT_CERTIFICATE",
|
782
|
+
"REQUEST_CORRECTION",
|
783
|
+
"REJECT_CORRECTION",
|
784
|
+
"APPROVE_CORRECTION",
|
785
|
+
"READ",
|
786
|
+
"ASSIGN",
|
787
|
+
"UNASSIGN"
|
788
|
+
]);
|
789
|
+
var declarationActionValues = [
|
790
|
+
ActionTypes.enum.DECLARE,
|
791
|
+
ActionTypes.enum.VALIDATE,
|
792
|
+
ActionTypes.enum.REGISTER
|
793
|
+
];
|
794
|
+
var DeclarationActions = ActionTypes.extract(declarationActionValues);
|
795
|
+
var declarationUpdateActionValues = [
|
796
|
+
...declarationActionValues,
|
797
|
+
ActionTypes.enum.REQUEST_CORRECTION
|
798
|
+
];
|
799
|
+
var DeclarationUpdateActions = ActionTypes.extract(
|
800
|
+
declarationUpdateActionValues
|
801
|
+
);
|
802
|
+
var annotationActions = ActionTypes.exclude(declarationActionValues);
|
803
|
+
var writeActions = ActionTypes.exclude([
|
804
|
+
ActionType.CREATE,
|
805
|
+
ActionType.READ,
|
806
|
+
ActionType.ASSIGN,
|
807
|
+
ActionType.UNASSIGN
|
808
|
+
]);
|
809
|
+
|
810
|
+
// ../commons/src/events/FormConfig.ts
|
811
|
+
var import_zod8 = require("zod");
|
812
|
+
var DeclarationFormConfig = import_zod8.z.object({
|
813
|
+
label: TranslationConfig.describe("Human readable description of the form"),
|
814
|
+
pages: import_zod8.z.array(FormPageConfig)
|
815
|
+
}).describe("Configuration for a declaration form");
|
816
|
+
var ActionFormConfig = import_zod8.z.object({
|
817
|
+
label: TranslationConfig.describe("Human readable description of the form"),
|
818
|
+
pages: import_zod8.z.array(PageConfig)
|
819
|
+
});
|
820
|
+
var FormConfig = import_zod8.z.union([DeclarationFormConfig, ActionFormConfig]);
|
651
821
|
|
652
822
|
// ../commons/src/events/ActionConfig.ts
|
653
|
-
var ActionConditional2 =
|
823
|
+
var ActionConditional2 = import_zod9.z.discriminatedUnion("type", [
|
654
824
|
/** If conditional is defined, the action is shown to the user only if the condition is met */
|
655
825
|
ShowConditional,
|
656
826
|
/** If conditional is defined, the action is enabled only if the condition is met */
|
657
827
|
EnableConditional
|
658
828
|
]);
|
659
|
-
var
|
829
|
+
var DeclarationReviewConfig = import_zod9.z.object({
|
830
|
+
title: TranslationConfig.describe("Title of the review page"),
|
831
|
+
fields: import_zod9.z.array(FieldConfig).describe("Fields to be rendered on the review page for annotations.")
|
832
|
+
}).describe("Configuration for **declaration** review page.");
|
833
|
+
var ActionConfigBase = import_zod9.z.object({
|
660
834
|
label: TranslationConfig,
|
661
|
-
conditionals:
|
662
|
-
draft:
|
663
|
-
forms: import_zod7.z.array(FormConfig)
|
835
|
+
conditionals: import_zod9.z.array(ActionConditional2).optional().default([]),
|
836
|
+
draft: import_zod9.z.boolean().optional()
|
664
837
|
});
|
665
838
|
var DeclareConfig = ActionConfigBase.merge(
|
666
|
-
|
667
|
-
type:
|
839
|
+
import_zod9.z.object({
|
840
|
+
type: import_zod9.z.literal(ActionType.DECLARE),
|
841
|
+
review: DeclarationReviewConfig
|
668
842
|
})
|
669
843
|
);
|
670
844
|
var ValidateConfig = ActionConfigBase.merge(
|
671
|
-
|
672
|
-
type:
|
845
|
+
import_zod9.z.object({
|
846
|
+
type: import_zod9.z.literal(ActionType.VALIDATE),
|
847
|
+
review: DeclarationReviewConfig
|
848
|
+
})
|
849
|
+
);
|
850
|
+
var RegisterConfig = ActionConfigBase.merge(
|
851
|
+
import_zod9.z.object({
|
852
|
+
type: import_zod9.z.literal(ActionType.REGISTER),
|
853
|
+
review: DeclarationReviewConfig
|
673
854
|
})
|
674
855
|
);
|
675
856
|
var RejectDeclarationConfig = ActionConfigBase.merge(
|
676
|
-
|
677
|
-
type:
|
857
|
+
import_zod9.z.object({
|
858
|
+
type: import_zod9.z.literal(ActionType.REJECT)
|
678
859
|
})
|
679
860
|
);
|
680
861
|
var MarkedAsDuplicateConfig = ActionConfigBase.merge(
|
681
|
-
|
682
|
-
type:
|
862
|
+
import_zod9.z.object({
|
863
|
+
type: import_zod9.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
683
864
|
})
|
684
865
|
);
|
685
866
|
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)
|
867
|
+
import_zod9.z.object({
|
868
|
+
type: import_zod9.z.literal(ActionType.ARCHIVE)
|
693
869
|
})
|
694
870
|
);
|
695
871
|
var DeleteConfig = ActionConfigBase.merge(
|
696
|
-
|
697
|
-
type:
|
872
|
+
import_zod9.z.object({
|
873
|
+
type: import_zod9.z.literal(ActionType.DELETE)
|
698
874
|
})
|
699
875
|
);
|
700
876
|
var PrintCertificateActionConfig = ActionConfigBase.merge(
|
701
|
-
|
702
|
-
type:
|
877
|
+
import_zod9.z.object({
|
878
|
+
type: import_zod9.z.literal(ActionType.PRINT_CERTIFICATE),
|
879
|
+
printForm: ActionFormConfig
|
703
880
|
})
|
704
881
|
);
|
705
882
|
var RequestCorrectionConfig = ActionConfigBase.merge(
|
706
|
-
|
707
|
-
type:
|
708
|
-
onboardingForm:
|
709
|
-
additionalDetailsForm:
|
883
|
+
import_zod9.z.object({
|
884
|
+
type: import_zod9.z.literal(ActionType.REQUEST_CORRECTION),
|
885
|
+
onboardingForm: import_zod9.z.array(PageConfig),
|
886
|
+
additionalDetailsForm: import_zod9.z.array(PageConfig)
|
710
887
|
})
|
711
888
|
);
|
712
889
|
var RejectCorrectionConfig = ActionConfigBase.merge(
|
713
|
-
|
714
|
-
type:
|
890
|
+
import_zod9.z.object({
|
891
|
+
type: import_zod9.z.literal(ActionType.REJECT_CORRECTION)
|
715
892
|
})
|
716
893
|
);
|
717
894
|
var ApproveCorrectionConfig = ActionConfigBase.merge(
|
718
|
-
|
719
|
-
type:
|
895
|
+
import_zod9.z.object({
|
896
|
+
type: import_zod9.z.literal(ActionType.APPROVE_CORRECTION)
|
720
897
|
})
|
721
898
|
);
|
722
|
-
var
|
723
|
-
import_zod7.z.object({
|
724
|
-
type: import_zod7.z.literal(ActionType.CUSTOM)
|
725
|
-
})
|
726
|
-
);
|
727
|
-
var ActionConfig = import_zod7.z.discriminatedUnion("type", [
|
899
|
+
var ActionConfig = import_zod9.z.discriminatedUnion("type", [
|
728
900
|
DeclareConfig,
|
729
901
|
ValidateConfig,
|
730
902
|
RejectDeclarationConfig,
|
@@ -735,102 +907,108 @@ var ActionConfig = import_zod7.z.discriminatedUnion("type", [
|
|
735
907
|
PrintCertificateActionConfig,
|
736
908
|
RequestCorrectionConfig,
|
737
909
|
RejectCorrectionConfig,
|
738
|
-
ApproveCorrectionConfig
|
739
|
-
|
910
|
+
ApproveCorrectionConfig
|
911
|
+
]);
|
912
|
+
var DeclarationActionConfig = import_zod9.z.discriminatedUnion("type", [
|
913
|
+
DeclareConfig,
|
914
|
+
ValidateConfig,
|
915
|
+
RegisterConfig
|
740
916
|
]);
|
741
917
|
|
742
918
|
// ../commons/src/events/offline/CertificateConfig.ts
|
743
|
-
var
|
744
|
-
var FontFamily =
|
745
|
-
normal:
|
746
|
-
bold:
|
747
|
-
italics:
|
748
|
-
bolditalics:
|
919
|
+
var import_zod10 = require("zod");
|
920
|
+
var FontFamily = import_zod10.z.object({
|
921
|
+
normal: import_zod10.z.string(),
|
922
|
+
bold: import_zod10.z.string(),
|
923
|
+
italics: import_zod10.z.string(),
|
924
|
+
bolditalics: import_zod10.z.string()
|
749
925
|
});
|
750
|
-
var CertificateConfig =
|
751
|
-
id:
|
752
|
-
event:
|
926
|
+
var CertificateConfig = import_zod10.z.object({
|
927
|
+
id: import_zod10.z.string(),
|
928
|
+
event: import_zod10.z.string(),
|
753
929
|
label: TranslationConfig,
|
754
|
-
isDefault:
|
755
|
-
fee:
|
756
|
-
onTime:
|
757
|
-
late:
|
758
|
-
delayed:
|
930
|
+
isDefault: import_zod10.z.boolean(),
|
931
|
+
fee: import_zod10.z.object({
|
932
|
+
onTime: import_zod10.z.number(),
|
933
|
+
late: import_zod10.z.number(),
|
934
|
+
delayed: import_zod10.z.number()
|
759
935
|
}),
|
760
|
-
svgUrl:
|
761
|
-
fonts:
|
936
|
+
svgUrl: import_zod10.z.string(),
|
937
|
+
fonts: import_zod10.z.record(FontFamily).optional()
|
762
938
|
});
|
763
939
|
var CertificateTemplateConfig = CertificateConfig.extend({
|
764
|
-
hash:
|
765
|
-
svg:
|
940
|
+
hash: import_zod10.z.string().optional(),
|
941
|
+
svg: import_zod10.z.string()
|
766
942
|
});
|
767
943
|
|
768
944
|
// ../commons/src/events/offline/LanguageConfig.ts
|
769
|
-
var
|
770
|
-
var LanguageConfig =
|
771
|
-
lang:
|
945
|
+
var import_zod11 = require("zod");
|
946
|
+
var LanguageConfig = import_zod11.z.object({
|
947
|
+
lang: import_zod11.z.string(),
|
772
948
|
/**
|
773
949
|
* client.csv contents
|
774
950
|
*/
|
775
|
-
messages:
|
951
|
+
messages: import_zod11.z.record(import_zod11.z.string())
|
776
952
|
});
|
777
953
|
|
778
954
|
// ../commons/src/events/EventConfig.ts
|
779
|
-
var
|
955
|
+
var import_zod20 = require("zod");
|
780
956
|
|
781
957
|
// ../commons/src/events/DeduplicationConfig.ts
|
782
|
-
var
|
783
|
-
var FieldReference =
|
784
|
-
var Matcher =
|
785
|
-
fieldId:
|
786
|
-
options:
|
787
|
-
boost:
|
958
|
+
var import_zod12 = require("zod");
|
959
|
+
var FieldReference = import_zod12.z.string();
|
960
|
+
var Matcher = import_zod12.z.object({
|
961
|
+
fieldId: import_zod12.z.string(),
|
962
|
+
options: import_zod12.z.object({
|
963
|
+
boost: import_zod12.z.number().optional()
|
788
964
|
}).optional().default({})
|
789
965
|
});
|
790
966
|
var FuzzyMatcher = Matcher.extend({
|
791
|
-
type:
|
792
|
-
options:
|
967
|
+
type: import_zod12.z.literal("fuzzy"),
|
968
|
+
options: import_zod12.z.object({
|
793
969
|
/**
|
794
970
|
* Names of length 3 or less characters = 0 edits allowed
|
795
971
|
* Names of length 4 - 6 characters = 1 edit allowed
|
796
972
|
* Names of length >7 characters = 2 edits allowed
|
797
973
|
*/
|
798
|
-
fuzziness:
|
799
|
-
boost:
|
974
|
+
fuzziness: import_zod12.z.union([import_zod12.z.string(), import_zod12.z.number()]).optional().default("AUTO:4,7"),
|
975
|
+
boost: import_zod12.z.number().optional().default(1)
|
800
976
|
}).optional().default({})
|
801
977
|
});
|
802
978
|
var StrictMatcher = Matcher.extend({
|
803
|
-
type:
|
804
|
-
options:
|
805
|
-
boost:
|
979
|
+
type: import_zod12.z.literal("strict"),
|
980
|
+
options: import_zod12.z.object({
|
981
|
+
boost: import_zod12.z.number().optional().default(1)
|
806
982
|
}).optional().default({})
|
807
983
|
});
|
808
984
|
var DateRangeMatcher = Matcher.extend({
|
809
|
-
type:
|
810
|
-
options:
|
811
|
-
days:
|
985
|
+
type: import_zod12.z.literal("dateRange"),
|
986
|
+
options: import_zod12.z.object({
|
987
|
+
days: import_zod12.z.number(),
|
812
988
|
origin: FieldReference,
|
813
|
-
boost:
|
989
|
+
boost: import_zod12.z.number().optional().default(1)
|
814
990
|
})
|
815
991
|
});
|
816
992
|
var DateDistanceMatcher = Matcher.extend({
|
817
|
-
type:
|
818
|
-
options:
|
819
|
-
days:
|
993
|
+
type: import_zod12.z.literal("dateDistance"),
|
994
|
+
options: import_zod12.z.object({
|
995
|
+
days: import_zod12.z.number(),
|
820
996
|
origin: FieldReference,
|
821
|
-
boost:
|
997
|
+
boost: import_zod12.z.number().optional().default(1)
|
822
998
|
})
|
823
999
|
});
|
824
|
-
var And =
|
825
|
-
type:
|
826
|
-
|
1000
|
+
var And = import_zod12.z.object({
|
1001
|
+
type: import_zod12.z.literal("and"),
|
1002
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
1003
|
+
clauses: import_zod12.z.lazy(() => Clause.array())
|
827
1004
|
});
|
828
|
-
var Or =
|
829
|
-
type:
|
830
|
-
|
1005
|
+
var Or = import_zod12.z.object({
|
1006
|
+
type: import_zod12.z.literal("or"),
|
1007
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
1008
|
+
clauses: import_zod12.z.lazy(() => Clause.array())
|
831
1009
|
});
|
832
|
-
var Clause =
|
833
|
-
() =>
|
1010
|
+
var Clause = import_zod12.z.lazy(
|
1011
|
+
() => import_zod12.z.discriminatedUnion("type", [
|
834
1012
|
And,
|
835
1013
|
Or,
|
836
1014
|
FuzzyMatcher,
|
@@ -839,37 +1017,37 @@ var Clause = import_zod10.z.lazy(
|
|
839
1017
|
DateDistanceMatcher
|
840
1018
|
])
|
841
1019
|
);
|
842
|
-
var DeduplicationConfig =
|
843
|
-
id:
|
1020
|
+
var DeduplicationConfig = import_zod12.z.object({
|
1021
|
+
id: import_zod12.z.string(),
|
844
1022
|
label: TranslationConfig,
|
845
1023
|
query: Clause
|
846
1024
|
});
|
847
1025
|
|
848
1026
|
// ../commons/src/events/SummaryConfig.ts
|
849
|
-
var
|
850
|
-
var Field =
|
851
|
-
id:
|
1027
|
+
var import_zod13 = require("zod");
|
1028
|
+
var Field = import_zod13.z.object({
|
1029
|
+
id: import_zod13.z.string().describe("Id of summary field"),
|
852
1030
|
value: TranslationConfig.describe(
|
853
1031
|
"Summary field value. Can utilise values defined in configuration and EventMetadata"
|
854
1032
|
),
|
855
1033
|
label: TranslationConfig,
|
856
1034
|
emptyValueMessage: TranslationConfig.optional()
|
857
1035
|
});
|
858
|
-
var Title =
|
859
|
-
id:
|
1036
|
+
var Title = import_zod13.z.object({
|
1037
|
+
id: import_zod13.z.string(),
|
860
1038
|
label: TranslationConfig.describe("Title content"),
|
861
1039
|
emptyValueMessage: TranslationConfig.optional()
|
862
1040
|
});
|
863
|
-
var SummaryConfig =
|
1041
|
+
var SummaryConfig = import_zod13.z.object({
|
864
1042
|
title: Title.describe("Title of summary view."),
|
865
|
-
fields:
|
1043
|
+
fields: import_zod13.z.array(Field).describe("Fields rendered in summary view.")
|
866
1044
|
}).describe("Configuration for summary in event.");
|
867
1045
|
|
868
1046
|
// ../commons/src/events/WorkqueueConfig.ts
|
869
|
-
var
|
1047
|
+
var import_zod15 = require("zod");
|
870
1048
|
|
871
1049
|
// ../commons/src/events/EventMetadata.ts
|
872
|
-
var
|
1050
|
+
var import_zod14 = require("zod");
|
873
1051
|
var EventStatus = {
|
874
1052
|
CREATED: "CREATED",
|
875
1053
|
NOTIFIED: "NOTIFIED",
|
@@ -881,18 +1059,19 @@ var EventStatus = {
|
|
881
1059
|
ARCHIVED: "ARCHIVED"
|
882
1060
|
};
|
883
1061
|
var eventStatuses = Object.values(EventStatus);
|
884
|
-
var EventStatuses =
|
885
|
-
var EventMetadata =
|
886
|
-
id:
|
887
|
-
type:
|
1062
|
+
var EventStatuses = import_zod14.z.nativeEnum(EventStatus);
|
1063
|
+
var EventMetadata = import_zod14.z.object({
|
1064
|
+
id: import_zod14.z.string(),
|
1065
|
+
type: import_zod14.z.string(),
|
888
1066
|
status: EventStatuses,
|
889
|
-
createdAt:
|
890
|
-
createdBy:
|
891
|
-
createdAtLocation:
|
892
|
-
modifiedAt:
|
893
|
-
assignedTo:
|
894
|
-
updatedBy:
|
895
|
-
trackingId:
|
1067
|
+
createdAt: import_zod14.z.string().datetime(),
|
1068
|
+
createdBy: import_zod14.z.string(),
|
1069
|
+
createdAtLocation: import_zod14.z.string(),
|
1070
|
+
modifiedAt: import_zod14.z.string().datetime(),
|
1071
|
+
assignedTo: import_zod14.z.string().nullish(),
|
1072
|
+
updatedBy: import_zod14.z.string(),
|
1073
|
+
trackingId: import_zod14.z.string(),
|
1074
|
+
registrationNumber: import_zod14.z.string().nullish()
|
896
1075
|
});
|
897
1076
|
var eventMetadataLabelMap = {
|
898
1077
|
"event.assignedTo": {
|
@@ -944,28 +1123,33 @@ var eventMetadataLabelMap = {
|
|
944
1123
|
id: "event.trackingId.label",
|
945
1124
|
defaultMessage: "Tracking ID",
|
946
1125
|
description: "Tracking ID"
|
1126
|
+
},
|
1127
|
+
"event.registrationNumber": {
|
1128
|
+
id: "event.registrationNumber.label",
|
1129
|
+
defaultMessage: "Registration Number",
|
1130
|
+
description: "Registration Number"
|
947
1131
|
}
|
948
1132
|
};
|
949
1133
|
|
950
1134
|
// ../commons/src/events/WorkqueueConfig.ts
|
951
|
-
var WorkqueueConfig =
|
952
|
-
id:
|
953
|
-
filters:
|
954
|
-
|
955
|
-
status:
|
1135
|
+
var WorkqueueConfig = import_zod15.z.object({
|
1136
|
+
id: import_zod15.z.string().describe("Unique identifier for workqueue."),
|
1137
|
+
filters: import_zod15.z.array(
|
1138
|
+
import_zod15.z.object({
|
1139
|
+
status: import_zod15.z.array(EventStatuses).describe("Defines which statusese are included in the workqueue.")
|
956
1140
|
})
|
957
1141
|
).describe("Filters to be applied to workqueue.")
|
958
1142
|
}).describe("Configuration for workqueue.");
|
959
1143
|
|
960
1144
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
961
|
-
var
|
962
|
-
var AdvancedSearchConfig =
|
1145
|
+
var import_zod16 = require("zod");
|
1146
|
+
var AdvancedSearchConfig = import_zod16.z.object({
|
963
1147
|
title: TranslationConfig.describe("Advanced search tab title"),
|
964
|
-
fields:
|
965
|
-
|
966
|
-
fieldId:
|
967
|
-
config:
|
968
|
-
type:
|
1148
|
+
fields: import_zod16.z.array(
|
1149
|
+
import_zod16.z.object({
|
1150
|
+
fieldId: import_zod16.z.string(),
|
1151
|
+
config: import_zod16.z.object({
|
1152
|
+
type: import_zod16.z.enum(["FUZZY", "EXACT", "RANGE"]).describe("Determines the type of field")
|
969
1153
|
}).optional().describe("Configuration options for the field")
|
970
1154
|
})
|
971
1155
|
).optional().default([]).describe("Advanced search fields.")
|
@@ -975,12 +1159,12 @@ var AdvancedSearchConfig = import_zod14.z.object({
|
|
975
1159
|
var import_lodash = require("lodash");
|
976
1160
|
|
977
1161
|
// ../commons/src/workqueues/WorkqueueConfig.ts
|
978
|
-
var
|
1162
|
+
var import_zod18 = require("zod");
|
979
1163
|
|
980
1164
|
// ../commons/src/workqueues/defaultColumns.ts
|
981
|
-
var
|
982
|
-
var WorkQueueColumnConfig =
|
983
|
-
id:
|
1165
|
+
var import_zod17 = require("zod");
|
1166
|
+
var WorkQueueColumnConfig = import_zod17.z.object({
|
1167
|
+
id: import_zod17.z.string(),
|
984
1168
|
label: TranslationConfig
|
985
1169
|
});
|
986
1170
|
var defaultColumns = {
|
@@ -1017,16 +1201,16 @@ var defaultColumns = {
|
|
1017
1201
|
}
|
1018
1202
|
}
|
1019
1203
|
};
|
1020
|
-
var DefaultColumnKeys =
|
1204
|
+
var DefaultColumnKeys = import_zod17.z.enum(
|
1021
1205
|
Object.keys(defaultColumns)
|
1022
1206
|
);
|
1023
1207
|
|
1024
1208
|
// ../commons/src/workqueues/WorkqueueConfig.ts
|
1025
|
-
var rootWorkqueueConfig =
|
1026
|
-
id:
|
1209
|
+
var rootWorkqueueConfig = import_zod18.z.object({
|
1210
|
+
id: import_zod18.z.string(),
|
1027
1211
|
title: TranslationConfig,
|
1028
|
-
columns:
|
1029
|
-
defaultColumns:
|
1212
|
+
columns: import_zod18.z.array(WorkQueueColumnConfig),
|
1213
|
+
defaultColumns: import_zod18.z.array(DefaultColumnKeys)
|
1030
1214
|
});
|
1031
1215
|
var defineWorkqueue = (config) => rootWorkqueueConfig.parse(config);
|
1032
1216
|
|
@@ -1106,7 +1290,7 @@ var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
1106
1290
|
var import_date_fns = require("date-fns");
|
1107
1291
|
|
1108
1292
|
// ../commons/src/events/FieldTypeMapping.ts
|
1109
|
-
var
|
1293
|
+
var import_zod19 = require("zod");
|
1110
1294
|
function mapFieldTypeToZod(type, required) {
|
1111
1295
|
let schema;
|
1112
1296
|
switch (type) {
|
@@ -1148,6 +1332,9 @@ function mapFieldTypeToZod(type, required) {
|
|
1148
1332
|
case FieldType.ADDRESS:
|
1149
1333
|
schema = AddressFieldUpdateValue;
|
1150
1334
|
break;
|
1335
|
+
case FieldType.DATA:
|
1336
|
+
schema = DataFieldValue;
|
1337
|
+
break;
|
1151
1338
|
}
|
1152
1339
|
return required ? schema : schema.nullish();
|
1153
1340
|
}
|
@@ -1156,7 +1343,7 @@ function createValidationSchema(config) {
|
|
1156
1343
|
for (const field2 of config) {
|
1157
1344
|
shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
|
1158
1345
|
}
|
1159
|
-
return
|
1346
|
+
return import_zod19.z.object(shape);
|
1160
1347
|
}
|
1161
1348
|
function mapFieldTypeToMockValue(field2, i) {
|
1162
1349
|
switch (field2.type) {
|
@@ -1204,6 +1391,8 @@ function mapFieldTypeToMockValue(field2, i) {
|
|
1204
1391
|
};
|
1205
1392
|
case FieldType.FILE_WITH_OPTIONS:
|
1206
1393
|
return null;
|
1394
|
+
case FieldType.DATA:
|
1395
|
+
return {};
|
1207
1396
|
}
|
1208
1397
|
}
|
1209
1398
|
function mapFieldTypeToEmptyValue(field2) {
|
@@ -1226,6 +1415,7 @@ function mapFieldTypeToEmptyValue(field2) {
|
|
1226
1415
|
case FieldType.EMAIL:
|
1227
1416
|
case FieldType.DATE:
|
1228
1417
|
case FieldType.CHECKBOX:
|
1418
|
+
case FieldType.DATA:
|
1229
1419
|
return null;
|
1230
1420
|
case FieldType.ADDRESS:
|
1231
1421
|
return {
|
@@ -1314,10 +1504,14 @@ var isFacilityFieldType = (field2) => {
|
|
1314
1504
|
var isOfficeFieldType = (field2) => {
|
1315
1505
|
return field2.config.type === FieldType.OFFICE;
|
1316
1506
|
};
|
1507
|
+
var isDataFieldType = (field2) => {
|
1508
|
+
return field2.config.type === FieldType.DATA;
|
1509
|
+
};
|
1317
1510
|
|
1318
1511
|
// ../commons/src/conditionals/validate.ts
|
1319
1512
|
var ajv = new import_ajv.default({
|
1320
|
-
$data: true
|
1513
|
+
$data: true,
|
1514
|
+
allowUnionTypes: true
|
1321
1515
|
});
|
1322
1516
|
(0, import_ajv_formats.default)(ajv);
|
1323
1517
|
function validate(schema, data) {
|
@@ -1350,6 +1544,9 @@ function isFieldVisible(field2, form) {
|
|
1350
1544
|
function isFieldEnabled(field2, form) {
|
1351
1545
|
return isFieldConditionMet(field2, form, ConditionalType.ENABLE);
|
1352
1546
|
}
|
1547
|
+
function isFieldDisplayedOnReview(field2, form) {
|
1548
|
+
return isFieldVisible(field2, form) && isFieldConditionMet(field2, form, ConditionalType.DISPLAY_ON_REVIEW);
|
1549
|
+
}
|
1353
1550
|
var errorMessages = {
|
1354
1551
|
hiddenField: {
|
1355
1552
|
id: "v2.error.hidden",
|
@@ -1377,12 +1574,14 @@ var errorMessages = {
|
|
1377
1574
|
id: "v2.error.invalid"
|
1378
1575
|
}
|
1379
1576
|
};
|
1380
|
-
|
1381
|
-
|
1382
|
-
message
|
1383
|
-
|
1384
|
-
}
|
1385
|
-
|
1577
|
+
function createIntlError(message) {
|
1578
|
+
return {
|
1579
|
+
message: {
|
1580
|
+
message
|
1581
|
+
}
|
1582
|
+
};
|
1583
|
+
}
|
1584
|
+
function zodToIntlErrorMap(issue, _ctx) {
|
1386
1585
|
switch (issue.code) {
|
1387
1586
|
case "invalid_string": {
|
1388
1587
|
if (_ctx.data === "") {
|
@@ -1420,8 +1619,29 @@ var zodToIntlErrorMap = (issue, _ctx) => {
|
|
1420
1619
|
}
|
1421
1620
|
}
|
1422
1621
|
return createIntlError(errorMessages.invalidInput);
|
1423
|
-
}
|
1424
|
-
function
|
1622
|
+
}
|
1623
|
+
function runCustomFieldValidations({
|
1624
|
+
field: field2,
|
1625
|
+
conditionalParameters
|
1626
|
+
}) {
|
1627
|
+
return (field2.validation ?? []).filter((validation) => {
|
1628
|
+
return !validate(validation.validator, conditionalParameters);
|
1629
|
+
}).map((validation) => ({ message: validation.message }));
|
1630
|
+
}
|
1631
|
+
function validateFieldInput({
|
1632
|
+
field: field2,
|
1633
|
+
value
|
1634
|
+
}) {
|
1635
|
+
const rawError = mapFieldTypeToZod(field2.type, field2.required).safeParse(
|
1636
|
+
value,
|
1637
|
+
{
|
1638
|
+
// @ts-expect-error
|
1639
|
+
errorMap: zodToIntlErrorMap
|
1640
|
+
}
|
1641
|
+
);
|
1642
|
+
return rawError.error?.issues.map((issue) => issue.message) ?? [];
|
1643
|
+
}
|
1644
|
+
function runFieldValidations({
|
1425
1645
|
field: field2,
|
1426
1646
|
values
|
1427
1647
|
}) {
|
@@ -1429,6 +1649,23 @@ function getFieldValidationErrors({
|
|
1429
1649
|
$form: values,
|
1430
1650
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" })
|
1431
1651
|
};
|
1652
|
+
const fieldValidationResult = validateFieldInput({
|
1653
|
+
field: field2,
|
1654
|
+
value: values[field2.id]
|
1655
|
+
});
|
1656
|
+
const customValidationResults = runCustomFieldValidations({
|
1657
|
+
field: field2,
|
1658
|
+
conditionalParameters
|
1659
|
+
});
|
1660
|
+
return {
|
1661
|
+
// Assumes that custom validation errors are based on the field type, and extend the validation.
|
1662
|
+
errors: [...fieldValidationResult, ...customValidationResults]
|
1663
|
+
};
|
1664
|
+
}
|
1665
|
+
function getFieldValidationErrors({
|
1666
|
+
field: field2,
|
1667
|
+
values
|
1668
|
+
}) {
|
1432
1669
|
if (!isFieldVisible(field2, values) || !isFieldEnabled(field2, values)) {
|
1433
1670
|
if (values[field2.id]) {
|
1434
1671
|
return {
|
@@ -1443,41 +1680,21 @@ function getFieldValidationErrors({
|
|
1443
1680
|
errors: []
|
1444
1681
|
};
|
1445
1682
|
}
|
1446
|
-
|
1683
|
+
return runFieldValidations({
|
1447
1684
|
field: field2,
|
1448
|
-
|
1685
|
+
values
|
1449
1686
|
});
|
1450
|
-
const customValidationResults = runCustomFieldValidations({
|
1451
|
-
field: field2,
|
1452
|
-
conditionalParameters
|
1453
|
-
});
|
1454
|
-
return {
|
1455
|
-
// Assumes that custom validation errors are based on the field type, and extend the validation.
|
1456
|
-
errors: [...fieldValidationResult, ...customValidationResults]
|
1457
|
-
};
|
1458
|
-
}
|
1459
|
-
function runCustomFieldValidations({
|
1460
|
-
field: field2,
|
1461
|
-
conditionalParameters
|
1462
|
-
}) {
|
1463
|
-
return (field2.validation ?? []).filter((validation) => {
|
1464
|
-
return !validate(validation.validator, conditionalParameters);
|
1465
|
-
}).map((validation) => ({ message: validation.message }));
|
1466
1687
|
}
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
value,
|
1473
|
-
{
|
1474
|
-
// @ts-expect-error
|
1475
|
-
errorMap: zodToIntlErrorMap
|
1476
|
-
}
|
1477
|
-
);
|
1478
|
-
return rawError.error?.issues.map((issue) => issue.message) ?? [];
|
1688
|
+
|
1689
|
+
// ../commons/src/uuid.ts
|
1690
|
+
var import_uuid = require("uuid");
|
1691
|
+
function getUUID() {
|
1692
|
+
return (0, import_uuid.v4)();
|
1479
1693
|
}
|
1480
1694
|
|
1695
|
+
// ../commons/src/events/utils.ts
|
1696
|
+
var import_date_fns2 = require("date-fns");
|
1697
|
+
|
1481
1698
|
// ../commons/src/utils.ts
|
1482
1699
|
function getOrThrow(x, message) {
|
1483
1700
|
if (x === void 0 || x === null) {
|
@@ -1486,73 +1703,64 @@ function getOrThrow(x, message) {
|
|
1486
1703
|
return x;
|
1487
1704
|
}
|
1488
1705
|
|
1489
|
-
// ../commons/src/uuid.ts
|
1490
|
-
var import_uuid = require("uuid");
|
1491
|
-
function getUUID() {
|
1492
|
-
return (0, import_uuid.v4)();
|
1493
|
-
}
|
1494
|
-
|
1495
1706
|
// ../commons/src/events/utils.ts
|
1496
|
-
function
|
1497
|
-
return
|
1498
|
-
}
|
1499
|
-
|
1500
|
-
return (
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
);
|
1707
|
+
function isDeclarationActionConfig(action) {
|
1708
|
+
return DeclarationActions.safeParse(action.type).success;
|
1709
|
+
}
|
1710
|
+
function getDeclarationFields(configuration) {
|
1711
|
+
return configuration.declaration.pages.flatMap(({ fields }) => fields);
|
1712
|
+
}
|
1713
|
+
function getDeclarationPages(configuration) {
|
1714
|
+
return configuration.declaration.pages;
|
1715
|
+
}
|
1716
|
+
function getDeclaration(configuration) {
|
1717
|
+
return configuration.declaration;
|
1718
|
+
}
|
1719
|
+
var getActionAnnotationFields = (actionConfig) => {
|
1720
|
+
if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
|
1721
|
+
return [
|
1722
|
+
...actionConfig.onboardingForm.flatMap(({ fields }) => fields),
|
1723
|
+
...actionConfig.additionalDetailsForm.flatMap(({ fields }) => fields)
|
1724
|
+
];
|
1725
|
+
}
|
1726
|
+
if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
|
1727
|
+
return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
|
1728
|
+
}
|
1729
|
+
if (isDeclarationActionConfig(actionConfig)) {
|
1730
|
+
return actionConfig.review.fields;
|
1731
|
+
}
|
1732
|
+
return [];
|
1523
1733
|
};
|
1524
|
-
var
|
1525
|
-
|
1526
|
-
refFields
|
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
|
-
});
|
1734
|
+
var getAllAnnotationFields = (config) => {
|
1735
|
+
return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
|
1547
1736
|
};
|
1548
|
-
|
1549
|
-
return
|
1550
|
-
...
|
1551
|
-
...
|
1737
|
+
var findAllFields = (config) => {
|
1738
|
+
return (0, import_lodash.flattenDeep)([
|
1739
|
+
...getDeclarationFields(config),
|
1740
|
+
...getAllAnnotationFields(config)
|
1552
1741
|
]);
|
1742
|
+
};
|
1743
|
+
var findRecordActionPages = (config, actionType) => {
|
1744
|
+
const action = config.actions.find((a) => a.type === actionType);
|
1745
|
+
if (action?.type === ActionType.REQUEST_CORRECTION) {
|
1746
|
+
return [...action.onboardingForm, ...action.additionalDetailsForm];
|
1747
|
+
}
|
1748
|
+
if (action?.type === ActionType.PRINT_CERTIFICATE) {
|
1749
|
+
return action.printForm.pages;
|
1750
|
+
}
|
1751
|
+
return [];
|
1752
|
+
};
|
1753
|
+
function getActionReview(configuration, actionType) {
|
1754
|
+
const [actionConfig] = configuration.actions.filter(
|
1755
|
+
(a) => a.type === actionType
|
1756
|
+
);
|
1757
|
+
return getOrThrow(
|
1758
|
+
actionConfig.review,
|
1759
|
+
`No review config found for ${actionType}`
|
1760
|
+
);
|
1553
1761
|
}
|
1554
|
-
function
|
1555
|
-
return configuration
|
1762
|
+
function getActionReviewFields(configuration, actionType) {
|
1763
|
+
return getActionReview(configuration, actionType).fields;
|
1556
1764
|
}
|
1557
1765
|
function validateWorkqueueConfig(workqueueConfigs) {
|
1558
1766
|
workqueueConfigs.map((workqueue) => {
|
@@ -1566,71 +1774,30 @@ function validateWorkqueueConfig(workqueueConfigs) {
|
|
1566
1774
|
}
|
1567
1775
|
});
|
1568
1776
|
}
|
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}`);
|
1611
|
-
}
|
1612
|
-
return config;
|
1613
|
-
}
|
1614
|
-
function isOptionalUncheckedCheckbox(field2, form) {
|
1615
|
-
if (field2.type !== FieldType.CHECKBOX || field2.required) {
|
1616
|
-
return false;
|
1777
|
+
function isPageVisible(page, formValues) {
|
1778
|
+
if (!page.conditional) {
|
1779
|
+
return true;
|
1617
1780
|
}
|
1618
|
-
return
|
1781
|
+
return validate(page.conditional, {
|
1782
|
+
$form: formValues,
|
1783
|
+
$now: (0, import_date_fns2.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" })
|
1784
|
+
});
|
1619
1785
|
}
|
1620
|
-
function
|
1621
|
-
return (0, import_lodash.omitBy)(
|
1786
|
+
function omitHiddenFields(fields, values) {
|
1787
|
+
return (0, import_lodash.omitBy)(values, (_, fieldId) => {
|
1622
1788
|
const field2 = fields.find((f) => f.id === fieldId);
|
1623
1789
|
if (!field2) {
|
1624
1790
|
return true;
|
1625
1791
|
}
|
1626
|
-
|
1627
|
-
return true;
|
1628
|
-
}
|
1629
|
-
return !isFieldVisible(field2, data);
|
1792
|
+
return !isFieldVisible(field2, values);
|
1630
1793
|
});
|
1631
1794
|
}
|
1795
|
+
function omitHiddenPaginatedFields(formConfig, declaration) {
|
1796
|
+
const visiblePagesFormFields = formConfig.pages.filter((p) => isPageVisible(p, declaration)).flatMap((p) => p.fields);
|
1797
|
+
return omitHiddenFields(visiblePagesFormFields, declaration);
|
1798
|
+
}
|
1632
1799
|
function findActiveDrafts(event2, drafts) {
|
1633
|
-
const actions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
1800
|
+
const actions = event2.actions.slice().filter(({ type }) => type !== ActionType.READ).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
1634
1801
|
const lastAction = actions[actions.length - 1];
|
1635
1802
|
return drafts.filter(({ createdAt }) => createdAt >= lastAction.createdAt).filter(({ eventId }) => eventId === event2.id);
|
1636
1803
|
}
|
@@ -1642,28 +1809,58 @@ function createEmptyDraft(eventId, draftId, actionType) {
|
|
1642
1809
|
transactionId: getUUID(),
|
1643
1810
|
action: {
|
1644
1811
|
type: actionType,
|
1645
|
-
|
1646
|
-
|
1812
|
+
declaration: {},
|
1813
|
+
annotation: {},
|
1647
1814
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
1648
1815
|
createdBy: "@todo",
|
1649
1816
|
createdAtLocation: "@todo"
|
1650
1817
|
}
|
1651
1818
|
};
|
1652
1819
|
}
|
1820
|
+
function isVerificationPage(page) {
|
1821
|
+
return page.type === PageTypes.enum.VERIFICATION;
|
1822
|
+
}
|
1823
|
+
function deepMerge(currentDocument, actionDocument) {
|
1824
|
+
return (0, import_lodash.mergeWith)(
|
1825
|
+
currentDocument,
|
1826
|
+
actionDocument,
|
1827
|
+
(previousValue, incomingValue) => {
|
1828
|
+
if (incomingValue === void 0) {
|
1829
|
+
return previousValue;
|
1830
|
+
}
|
1831
|
+
if ((0, import_lodash.isArray)(incomingValue)) {
|
1832
|
+
return incomingValue;
|
1833
|
+
}
|
1834
|
+
if ((0, import_lodash.isObject)(previousValue) && (0, import_lodash.isObject)(incomingValue)) {
|
1835
|
+
return void 0;
|
1836
|
+
}
|
1837
|
+
return incomingValue;
|
1838
|
+
}
|
1839
|
+
);
|
1840
|
+
}
|
1841
|
+
function findLastAssignmentAction(actions) {
|
1842
|
+
return actions.filter(
|
1843
|
+
({ type }) => type === ActionType.ASSIGN || type === ActionType.UNASSIGN
|
1844
|
+
).reduce((latestAction, action) => !latestAction || action.createdAt > latestAction.createdAt ? action : latestAction, void 0);
|
1845
|
+
}
|
1846
|
+
function isWriteAction(actionType) {
|
1847
|
+
return writeActions.safeParse(actionType).success;
|
1848
|
+
}
|
1653
1849
|
|
1654
1850
|
// ../commons/src/events/EventConfig.ts
|
1655
|
-
var EventConfig =
|
1656
|
-
id:
|
1851
|
+
var EventConfig = import_zod20.z.object({
|
1852
|
+
id: import_zod20.z.string().describe(
|
1657
1853
|
'A machine-readable identifier for the event, e.g. "birth" or "death"'
|
1658
1854
|
),
|
1659
1855
|
summary: SummaryConfig,
|
1660
1856
|
label: TranslationConfig,
|
1661
|
-
actions:
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1857
|
+
actions: import_zod20.z.array(ActionConfig),
|
1858
|
+
declaration: DeclarationFormConfig,
|
1859
|
+
workqueues: import_zod20.z.array(WorkqueueConfig),
|
1860
|
+
deduplication: import_zod20.z.array(DeduplicationConfig).optional().default([]),
|
1861
|
+
advancedSearch: import_zod20.z.array(AdvancedSearchConfig).optional().default([])
|
1665
1862
|
}).superRefine((event2, ctx) => {
|
1666
|
-
const allFields =
|
1863
|
+
const allFields = findAllFields(event2);
|
1667
1864
|
const fieldIds = allFields.map((field2) => field2.id);
|
1668
1865
|
const advancedSearchFields = event2.advancedSearch.flatMap(
|
1669
1866
|
(section) => section.fields.flatMap((field2) => field2.fieldId)
|
@@ -1690,106 +1887,118 @@ var EventConfig = import_zod18.z.object({
|
|
1690
1887
|
});
|
1691
1888
|
|
1692
1889
|
// ../commons/src/events/EventConfigInput.ts
|
1693
|
-
var
|
1694
|
-
var
|
1890
|
+
var defineDeclarationForm = (form) => DeclarationFormConfig.parse(form);
|
1891
|
+
var defineActionForm = (actionForm) => ActionFormConfig.parse(actionForm);
|
1892
|
+
var definePage = (page) => PageConfig.parse(page);
|
1893
|
+
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
1695
1894
|
|
1696
1895
|
// ../commons/src/events/Draft.ts
|
1697
|
-
var
|
1896
|
+
var import_zod23 = require("zod");
|
1698
1897
|
|
1699
1898
|
// ../commons/src/events/ActionDocument.ts
|
1700
|
-
var
|
1701
|
-
var ActionUpdate =
|
1702
|
-
var
|
1703
|
-
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1899
|
+
var import_zod21 = require("zod");
|
1900
|
+
var ActionUpdate = import_zod21.z.record(import_zod21.z.string(), FieldUpdateValue);
|
1901
|
+
var ActionStatus = {
|
1902
|
+
Requested: "Requested",
|
1903
|
+
Accepted: "Accepted",
|
1904
|
+
Rejected: "Rejected"
|
1905
|
+
};
|
1906
|
+
var ActionBase = import_zod21.z.object({
|
1907
|
+
id: import_zod21.z.string(),
|
1908
|
+
createdAt: import_zod21.z.string().datetime(),
|
1909
|
+
createdBy: import_zod21.z.string(),
|
1910
|
+
declaration: ActionUpdate,
|
1911
|
+
annotation: ActionUpdate.optional(),
|
1912
|
+
createdAtLocation: import_zod21.z.string(),
|
1913
|
+
status: import_zod21.z.enum([
|
1914
|
+
ActionStatus.Requested,
|
1915
|
+
ActionStatus.Accepted,
|
1916
|
+
ActionStatus.Rejected
|
1917
|
+
]),
|
1918
|
+
// If the action is an asynchronous confirmation for another action, we will save the original action id here.
|
1919
|
+
originalActionId: import_zod21.z.string().optional()
|
1709
1920
|
});
|
1710
1921
|
var AssignedAction = ActionBase.merge(
|
1711
|
-
|
1712
|
-
type:
|
1713
|
-
assignedTo:
|
1922
|
+
import_zod21.z.object({
|
1923
|
+
type: import_zod21.z.literal(ActionType.ASSIGN),
|
1924
|
+
assignedTo: import_zod21.z.string()
|
1714
1925
|
})
|
1715
1926
|
);
|
1716
1927
|
var UnassignedAction = ActionBase.merge(
|
1717
|
-
|
1718
|
-
type:
|
1928
|
+
import_zod21.z.object({
|
1929
|
+
type: import_zod21.z.literal(ActionType.UNASSIGN),
|
1930
|
+
assignedTo: import_zod21.z.literal(null).default(null)
|
1719
1931
|
})
|
1720
1932
|
);
|
1721
1933
|
var RegisterAction = ActionBase.merge(
|
1722
|
-
|
1723
|
-
type:
|
1724
|
-
|
1725
|
-
trackingId: import_zod19.z.string(),
|
1726
|
-
registrationNumber: import_zod19.z.string()
|
1727
|
-
})
|
1934
|
+
import_zod21.z.object({
|
1935
|
+
type: import_zod21.z.literal(ActionType.REGISTER),
|
1936
|
+
registrationNumber: import_zod21.z.string().optional()
|
1728
1937
|
})
|
1729
1938
|
);
|
1730
1939
|
var DeclareAction = ActionBase.merge(
|
1731
|
-
|
1732
|
-
type:
|
1940
|
+
import_zod21.z.object({
|
1941
|
+
type: import_zod21.z.literal(ActionType.DECLARE)
|
1733
1942
|
})
|
1734
1943
|
);
|
1735
1944
|
var ValidateAction = ActionBase.merge(
|
1736
|
-
|
1737
|
-
type:
|
1945
|
+
import_zod21.z.object({
|
1946
|
+
type: import_zod21.z.literal(ActionType.VALIDATE)
|
1738
1947
|
})
|
1739
1948
|
);
|
1740
1949
|
var RejectAction = ActionBase.merge(
|
1741
|
-
|
1742
|
-
type:
|
1950
|
+
import_zod21.z.object({
|
1951
|
+
type: import_zod21.z.literal(ActionType.REJECT)
|
1743
1952
|
})
|
1744
1953
|
);
|
1745
1954
|
var MarkAsDuplicateAction = ActionBase.merge(
|
1746
|
-
|
1747
|
-
type:
|
1955
|
+
import_zod21.z.object({
|
1956
|
+
type: import_zod21.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1748
1957
|
})
|
1749
1958
|
);
|
1750
1959
|
var ArchiveAction = ActionBase.merge(
|
1751
|
-
|
1752
|
-
type:
|
1960
|
+
import_zod21.z.object({
|
1961
|
+
type: import_zod21.z.literal(ActionType.ARCHIVE)
|
1753
1962
|
})
|
1754
1963
|
);
|
1755
1964
|
var CreatedAction = ActionBase.merge(
|
1756
|
-
|
1757
|
-
type:
|
1965
|
+
import_zod21.z.object({
|
1966
|
+
type: import_zod21.z.literal(ActionType.CREATE)
|
1758
1967
|
})
|
1759
1968
|
);
|
1760
1969
|
var NotifiedAction = ActionBase.merge(
|
1761
|
-
|
1762
|
-
type:
|
1970
|
+
import_zod21.z.object({
|
1971
|
+
type: import_zod21.z.literal(ActionType.NOTIFY)
|
1763
1972
|
})
|
1764
1973
|
);
|
1765
1974
|
var PrintCertificateAction = ActionBase.merge(
|
1766
|
-
|
1767
|
-
type:
|
1975
|
+
import_zod21.z.object({
|
1976
|
+
type: import_zod21.z.literal(ActionType.PRINT_CERTIFICATE)
|
1768
1977
|
})
|
1769
1978
|
);
|
1770
1979
|
var RequestedCorrectionAction = ActionBase.merge(
|
1771
|
-
|
1772
|
-
type:
|
1980
|
+
import_zod21.z.object({
|
1981
|
+
type: import_zod21.z.literal(ActionType.REQUEST_CORRECTION)
|
1773
1982
|
})
|
1774
1983
|
);
|
1775
1984
|
var ApprovedCorrectionAction = ActionBase.merge(
|
1776
|
-
|
1777
|
-
type:
|
1778
|
-
requestId:
|
1985
|
+
import_zod21.z.object({
|
1986
|
+
type: import_zod21.z.literal(ActionType.APPROVE_CORRECTION),
|
1987
|
+
requestId: import_zod21.z.string()
|
1779
1988
|
})
|
1780
1989
|
);
|
1781
1990
|
var RejectedCorrectionAction = ActionBase.merge(
|
1782
|
-
|
1783
|
-
type:
|
1784
|
-
requestId:
|
1991
|
+
import_zod21.z.object({
|
1992
|
+
type: import_zod21.z.literal(ActionType.REJECT_CORRECTION),
|
1993
|
+
requestId: import_zod21.z.string()
|
1785
1994
|
})
|
1786
1995
|
);
|
1787
|
-
var
|
1788
|
-
|
1789
|
-
type:
|
1996
|
+
var ReadAction = ActionBase.merge(
|
1997
|
+
import_zod21.z.object({
|
1998
|
+
type: import_zod21.z.literal(ActionType.READ)
|
1790
1999
|
})
|
1791
2000
|
);
|
1792
|
-
var ActionDocument =
|
2001
|
+
var ActionDocument = import_zod21.z.discriminatedUnion("type", [
|
1793
2002
|
CreatedAction,
|
1794
2003
|
ValidateAction,
|
1795
2004
|
RejectAction,
|
@@ -1804,108 +2013,125 @@ var ActionDocument = import_zod19.z.discriminatedUnion("type", [
|
|
1804
2013
|
RejectedCorrectionAction,
|
1805
2014
|
UnassignedAction,
|
1806
2015
|
PrintCertificateAction,
|
1807
|
-
|
2016
|
+
ReadAction
|
1808
2017
|
]);
|
1809
|
-
var
|
1810
|
-
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
|
2018
|
+
var AsyncRejectActionDocument = ActionBase.omit({
|
2019
|
+
declaration: true,
|
2020
|
+
annotation: true,
|
2021
|
+
createdBy: true,
|
2022
|
+
createdAtLocation: true
|
2023
|
+
}).merge(
|
2024
|
+
import_zod21.z.object({
|
2025
|
+
type: import_zod21.z.enum(ConfirmableActions),
|
2026
|
+
status: import_zod21.z.literal(ActionStatus.Rejected)
|
2027
|
+
})
|
2028
|
+
);
|
2029
|
+
var Action = import_zod21.z.union([ActionDocument, AsyncRejectActionDocument]);
|
2030
|
+
var ResolvedUser = import_zod21.z.object({
|
2031
|
+
id: import_zod21.z.string(),
|
2032
|
+
role: import_zod21.z.string(),
|
2033
|
+
name: import_zod21.z.array(
|
2034
|
+
import_zod21.z.object({
|
2035
|
+
use: import_zod21.z.string(),
|
2036
|
+
given: import_zod21.z.array(import_zod21.z.string()),
|
2037
|
+
family: import_zod21.z.string()
|
1817
2038
|
})
|
1818
2039
|
)
|
1819
2040
|
});
|
1820
2041
|
|
1821
2042
|
// ../commons/src/events/ActionInput.ts
|
1822
|
-
var
|
1823
|
-
var BaseActionInput =
|
1824
|
-
eventId:
|
1825
|
-
transactionId:
|
1826
|
-
|
1827
|
-
|
2043
|
+
var import_zod22 = require("zod");
|
2044
|
+
var BaseActionInput = import_zod22.z.object({
|
2045
|
+
eventId: import_zod22.z.string(),
|
2046
|
+
transactionId: import_zod22.z.string(),
|
2047
|
+
declaration: ActionUpdate.default({}),
|
2048
|
+
annotation: ActionUpdate.optional(),
|
2049
|
+
originalActionId: import_zod22.z.string().optional(),
|
2050
|
+
keepAssignment: import_zod22.z.boolean().optional()
|
1828
2051
|
});
|
1829
2052
|
var CreateActionInput = BaseActionInput.merge(
|
1830
|
-
|
1831
|
-
type:
|
1832
|
-
createdAtLocation:
|
2053
|
+
import_zod22.z.object({
|
2054
|
+
type: import_zod22.z.literal(ActionType.CREATE).default(ActionType.CREATE),
|
2055
|
+
createdAtLocation: import_zod22.z.string()
|
1833
2056
|
})
|
1834
2057
|
);
|
1835
2058
|
var RegisterActionInput = BaseActionInput.merge(
|
1836
|
-
|
1837
|
-
type:
|
1838
|
-
|
1839
|
-
trackingId: import_zod20.z.string(),
|
1840
|
-
registrationNumber: import_zod20.z.string()
|
1841
|
-
})
|
2059
|
+
import_zod22.z.object({
|
2060
|
+
type: import_zod22.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
2061
|
+
registrationNumber: import_zod22.z.string().optional()
|
1842
2062
|
})
|
1843
2063
|
);
|
1844
2064
|
var ValidateActionInput = BaseActionInput.merge(
|
1845
|
-
|
1846
|
-
type:
|
1847
|
-
duplicates:
|
2065
|
+
import_zod22.z.object({
|
2066
|
+
type: import_zod22.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
|
2067
|
+
duplicates: import_zod22.z.array(import_zod22.z.string())
|
1848
2068
|
})
|
1849
2069
|
);
|
1850
2070
|
var NotifyActionInput = BaseActionInput.merge(
|
1851
|
-
|
1852
|
-
type:
|
2071
|
+
import_zod22.z.object({
|
2072
|
+
type: import_zod22.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
|
1853
2073
|
})
|
1854
2074
|
);
|
1855
2075
|
var DeclareActionInput = BaseActionInput.merge(
|
1856
|
-
|
1857
|
-
type:
|
2076
|
+
import_zod22.z.object({
|
2077
|
+
type: import_zod22.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
1858
2078
|
})
|
1859
2079
|
);
|
1860
2080
|
var PrintCertificateActionInput = BaseActionInput.merge(
|
1861
|
-
|
1862
|
-
type:
|
2081
|
+
import_zod22.z.object({
|
2082
|
+
type: import_zod22.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
|
1863
2083
|
})
|
1864
2084
|
);
|
1865
2085
|
var RejectDeclarationActionInput = BaseActionInput.merge(
|
1866
|
-
|
1867
|
-
type:
|
2086
|
+
import_zod22.z.object({
|
2087
|
+
type: import_zod22.z.literal(ActionType.REJECT).default(ActionType.REJECT)
|
1868
2088
|
})
|
1869
2089
|
);
|
1870
2090
|
var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
1871
|
-
|
1872
|
-
type:
|
2091
|
+
import_zod22.z.object({
|
2092
|
+
type: import_zod22.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
1873
2093
|
})
|
1874
2094
|
);
|
1875
2095
|
var ArchiveActionInput = BaseActionInput.merge(
|
1876
|
-
|
1877
|
-
type:
|
2096
|
+
import_zod22.z.object({
|
2097
|
+
type: import_zod22.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE)
|
1878
2098
|
})
|
1879
2099
|
);
|
1880
2100
|
var AssignActionInput = BaseActionInput.merge(
|
1881
|
-
|
1882
|
-
type:
|
1883
|
-
assignedTo:
|
2101
|
+
import_zod22.z.object({
|
2102
|
+
type: import_zod22.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
|
2103
|
+
assignedTo: import_zod22.z.string()
|
1884
2104
|
})
|
1885
2105
|
);
|
1886
2106
|
var UnassignActionInput = BaseActionInput.merge(
|
1887
|
-
|
1888
|
-
type:
|
2107
|
+
import_zod22.z.object({
|
2108
|
+
type: import_zod22.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
|
2109
|
+
assignedTo: import_zod22.z.literal(null).default(null)
|
1889
2110
|
})
|
1890
2111
|
);
|
1891
2112
|
var RequestCorrectionActionInput = BaseActionInput.merge(
|
1892
|
-
|
1893
|
-
type:
|
2113
|
+
import_zod22.z.object({
|
2114
|
+
type: import_zod22.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
1894
2115
|
})
|
1895
2116
|
);
|
1896
2117
|
var RejectCorrectionActionInput = BaseActionInput.merge(
|
1897
|
-
|
1898
|
-
requestId:
|
1899
|
-
type:
|
2118
|
+
import_zod22.z.object({
|
2119
|
+
requestId: import_zod22.z.string(),
|
2120
|
+
type: import_zod22.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
|
1900
2121
|
})
|
1901
2122
|
);
|
1902
2123
|
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
1903
|
-
|
1904
|
-
requestId:
|
1905
|
-
type:
|
2124
|
+
import_zod22.z.object({
|
2125
|
+
requestId: import_zod22.z.string(),
|
2126
|
+
type: import_zod22.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
1906
2127
|
})
|
1907
2128
|
);
|
1908
|
-
var
|
2129
|
+
var ReadActionInput = BaseActionInput.merge(
|
2130
|
+
import_zod22.z.object({
|
2131
|
+
type: import_zod22.z.literal(ActionType.READ).default(ActionType.READ)
|
2132
|
+
})
|
2133
|
+
);
|
2134
|
+
var ActionInput = import_zod22.z.discriminatedUnion("type", [
|
1909
2135
|
CreateActionInput,
|
1910
2136
|
ValidateActionInput,
|
1911
2137
|
RegisterActionInput,
|
@@ -1919,56 +2145,62 @@ var ActionInput = import_zod20.z.discriminatedUnion("type", [
|
|
1919
2145
|
PrintCertificateActionInput,
|
1920
2146
|
RequestCorrectionActionInput,
|
1921
2147
|
RejectCorrectionActionInput,
|
1922
|
-
ApproveCorrectionActionInput
|
2148
|
+
ApproveCorrectionActionInput,
|
2149
|
+
ReadActionInput
|
1923
2150
|
]);
|
1924
2151
|
|
1925
2152
|
// ../commons/src/events/Draft.ts
|
1926
|
-
var Draft =
|
1927
|
-
id:
|
1928
|
-
eventId:
|
1929
|
-
transactionId:
|
1930
|
-
createdAt:
|
2153
|
+
var Draft = import_zod23.z.object({
|
2154
|
+
id: import_zod23.z.string(),
|
2155
|
+
eventId: import_zod23.z.string(),
|
2156
|
+
transactionId: import_zod23.z.string(),
|
2157
|
+
createdAt: import_zod23.z.string().datetime(),
|
1931
2158
|
action: ActionBase.extend({
|
1932
|
-
type:
|
2159
|
+
type: ActionTypes
|
1933
2160
|
}).omit({ id: true })
|
1934
2161
|
});
|
1935
2162
|
var DraftInput = BaseActionInput.extend({
|
1936
|
-
type:
|
2163
|
+
type: ActionTypes
|
1937
2164
|
});
|
1938
2165
|
|
1939
2166
|
// ../commons/src/events/EventInput.ts
|
1940
|
-
var
|
1941
|
-
var EventInput =
|
1942
|
-
transactionId:
|
1943
|
-
type:
|
2167
|
+
var import_zod24 = require("zod");
|
2168
|
+
var EventInput = import_zod24.z.object({
|
2169
|
+
transactionId: import_zod24.z.string(),
|
2170
|
+
type: import_zod24.z.string()
|
1944
2171
|
});
|
1945
2172
|
|
1946
2173
|
// ../commons/src/events/EventDocument.ts
|
1947
|
-
var
|
1948
|
-
var EventDocument =
|
1949
|
-
id:
|
1950
|
-
type:
|
1951
|
-
createdAt:
|
1952
|
-
updatedAt:
|
1953
|
-
actions:
|
1954
|
-
trackingId:
|
2174
|
+
var import_zod25 = require("zod");
|
2175
|
+
var EventDocument = import_zod25.z.object({
|
2176
|
+
id: import_zod25.z.string(),
|
2177
|
+
type: import_zod25.z.string(),
|
2178
|
+
createdAt: import_zod25.z.string().datetime(),
|
2179
|
+
updatedAt: import_zod25.z.string().datetime(),
|
2180
|
+
actions: import_zod25.z.array(Action),
|
2181
|
+
trackingId: import_zod25.z.string()
|
1955
2182
|
});
|
1956
2183
|
|
1957
2184
|
// ../commons/src/events/EventIndex.ts
|
1958
|
-
var
|
2185
|
+
var import_zod26 = require("zod");
|
1959
2186
|
var EventIndex = EventMetadata.extend({
|
1960
|
-
|
2187
|
+
declaration: import_zod26.z.record(import_zod26.z.string(), import_zod26.z.any())
|
1961
2188
|
});
|
1962
|
-
var EventSearchIndex =
|
1963
|
-
|
1964
|
-
type:
|
2189
|
+
var EventSearchIndex = import_zod26.z.record(import_zod26.z.string(), import_zod26.z.any()).and(
|
2190
|
+
import_zod26.z.object({
|
2191
|
+
type: import_zod26.z.string()
|
1965
2192
|
// Ensures "type" (event-id) exists and is a string
|
1966
2193
|
})
|
1967
2194
|
);
|
1968
2195
|
|
1969
2196
|
// ../commons/src/events/state/index.ts
|
1970
|
-
var _ = __toESM(require("lodash"));
|
1971
2197
|
function getStatusFromActions(actions) {
|
2198
|
+
const hasRejectedAction = actions.some(
|
2199
|
+
(a) => a.status === ActionStatus.Rejected
|
2200
|
+
);
|
2201
|
+
if (hasRejectedAction) {
|
2202
|
+
return EventStatus.REJECTED;
|
2203
|
+
}
|
1972
2204
|
return actions.reduce((status, action) => {
|
1973
2205
|
if (action.type === ActionType.CREATE) {
|
1974
2206
|
return EventStatus.CREATED;
|
@@ -2005,7 +2237,7 @@ function getAssignedUserFromActions(actions) {
|
|
2005
2237
|
return user2;
|
2006
2238
|
}, null);
|
2007
2239
|
}
|
2008
|
-
function
|
2240
|
+
function aggregateActionDeclarations(actions) {
|
2009
2241
|
const excludedActions = [
|
2010
2242
|
ActionType.REQUEST_CORRECTION,
|
2011
2243
|
ActionType.PRINT_CERTIFICATE
|
@@ -2019,47 +2251,35 @@ function getData(actions) {
|
|
2019
2251
|
if (!requestAction) {
|
2020
2252
|
return status;
|
2021
2253
|
}
|
2022
|
-
return deepMerge(status, requestAction.
|
2254
|
+
return deepMerge(status, requestAction.declaration);
|
2023
2255
|
}
|
2024
|
-
return deepMerge(status, action.
|
2256
|
+
return deepMerge(status, action.declaration);
|
2025
2257
|
}, {});
|
2026
2258
|
}
|
2027
2259
|
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;
|
2260
|
+
if (Array.isArray(obj)) {
|
2261
|
+
return obj.map(deepDropNulls);
|
2262
|
+
}
|
2263
|
+
if (obj !== null && typeof obj === "object") {
|
2264
|
+
return Object.entries(obj).reduce((acc, [key, value]) => {
|
2265
|
+
const cleanedValue = deepDropNulls(value);
|
2266
|
+
if (cleanedValue !== null) {
|
2267
|
+
;
|
2268
|
+
acc[key] = cleanedValue;
|
2055
2269
|
}
|
2056
|
-
return
|
2057
|
-
}
|
2058
|
-
|
2270
|
+
return acc;
|
2271
|
+
}, {});
|
2272
|
+
}
|
2273
|
+
return obj;
|
2059
2274
|
}
|
2060
2275
|
function isUndeclaredDraft(status) {
|
2061
2276
|
return status === EventStatus.CREATED;
|
2062
2277
|
}
|
2278
|
+
function getAcceptedActions(event2) {
|
2279
|
+
return event2.actions.filter(
|
2280
|
+
(a) => a.status === ActionStatus.Accepted
|
2281
|
+
);
|
2282
|
+
}
|
2063
2283
|
function getCurrentEventState(event2) {
|
2064
2284
|
const creationAction = event2.actions.find(
|
2065
2285
|
(action) => action.type === ActionType.CREATE
|
@@ -2067,7 +2287,12 @@ function getCurrentEventState(event2) {
|
|
2067
2287
|
if (!creationAction) {
|
2068
2288
|
throw new Error(`Event ${event2.id} has no creation action`);
|
2069
2289
|
}
|
2070
|
-
const
|
2290
|
+
const activeActions = getAcceptedActions(event2);
|
2291
|
+
const latestAction = activeActions[activeActions.length - 1];
|
2292
|
+
const registrationAction = activeActions.find(
|
2293
|
+
(a) => a.type === ActionType.REGISTER && a.status === ActionStatus.Accepted
|
2294
|
+
);
|
2295
|
+
const registrationNumber = registrationAction?.registrationNumber ?? null;
|
2071
2296
|
return deepDropNulls({
|
2072
2297
|
id: event2.id,
|
2073
2298
|
type: event2.type,
|
@@ -2076,10 +2301,11 @@ function getCurrentEventState(event2) {
|
|
2076
2301
|
createdBy: creationAction.createdBy,
|
2077
2302
|
createdAtLocation: creationAction.createdAtLocation,
|
2078
2303
|
modifiedAt: latestAction.createdAt,
|
2079
|
-
assignedTo: getAssignedUserFromActions(
|
2304
|
+
assignedTo: getAssignedUserFromActions(activeActions),
|
2080
2305
|
updatedBy: latestAction.createdBy,
|
2081
|
-
|
2082
|
-
trackingId: event2.trackingId
|
2306
|
+
declaration: aggregateActionDeclarations(activeActions),
|
2307
|
+
trackingId: event2.trackingId,
|
2308
|
+
registrationNumber
|
2083
2309
|
});
|
2084
2310
|
}
|
2085
2311
|
function getCurrentEventStateWithDrafts(event2, drafts) {
|
@@ -2111,38 +2337,44 @@ function applyDraftsToEventIndex(eventIndex, drafts) {
|
|
2111
2337
|
}
|
2112
2338
|
return {
|
2113
2339
|
...eventIndex,
|
2114
|
-
|
2115
|
-
...eventIndex.
|
2116
|
-
...activeDrafts[activeDrafts.length - 1].
|
2340
|
+
declaration: {
|
2341
|
+
...eventIndex.declaration,
|
2342
|
+
...activeDrafts[activeDrafts.length - 1].declaration
|
2117
2343
|
}
|
2118
2344
|
};
|
2119
2345
|
}
|
2120
|
-
function
|
2346
|
+
function getAnnotationFromDrafts(drafts) {
|
2347
|
+
const actions = drafts.map((draft) => draft.action);
|
2348
|
+
const annotation = actions.reduce((ann, action) => {
|
2349
|
+
return deepMerge(ann, action.annotation ?? {});
|
2350
|
+
}, {});
|
2351
|
+
return deepDropNulls(annotation);
|
2352
|
+
}
|
2353
|
+
function getActionAnnotation({
|
2121
2354
|
event: event2,
|
2122
2355
|
actionType,
|
2123
2356
|
drafts
|
2124
2357
|
}) {
|
2125
|
-
const
|
2358
|
+
const activeActions = getAcceptedActions(event2);
|
2359
|
+
const action = activeActions.find(
|
2360
|
+
(activeAction) => actionType === activeAction.type
|
2361
|
+
);
|
2126
2362
|
const eventDrafts = drafts.filter((draft) => draft.eventId === event2.id);
|
2127
2363
|
const sorted = [
|
2128
2364
|
...action ? [action] : [],
|
2129
2365
|
...eventDrafts.map((draft) => draft.action)
|
2130
2366
|
].sort();
|
2131
|
-
const
|
2132
|
-
return deepMerge(
|
2367
|
+
const annotation = sorted.reduce((ann, sortedAction) => {
|
2368
|
+
return deepMerge(ann, sortedAction.annotation ?? {});
|
2133
2369
|
}, {});
|
2134
|
-
return deepDropNulls(
|
2370
|
+
return deepDropNulls(annotation);
|
2135
2371
|
}
|
2136
2372
|
|
2137
2373
|
// ../commons/src/events/defineConfig.ts
|
2138
2374
|
var defineConfig = (config) => {
|
2139
2375
|
validateWorkqueueConfig(config.workqueues);
|
2140
2376
|
const input = EventConfig.parse(config);
|
2141
|
-
|
2142
|
-
return EventConfig.parse({
|
2143
|
-
...input,
|
2144
|
-
pageFields
|
2145
|
-
});
|
2377
|
+
return input;
|
2146
2378
|
};
|
2147
2379
|
|
2148
2380
|
// ../commons/src/events/transactions.ts
|
@@ -2157,6 +2389,16 @@ var import_lodash2 = require("lodash");
|
|
2157
2389
|
function defineConditional(schema) {
|
2158
2390
|
return schema;
|
2159
2391
|
}
|
2392
|
+
function defineFormConditional(schema) {
|
2393
|
+
const schemaWithForm = {
|
2394
|
+
type: "object",
|
2395
|
+
properties: {
|
2396
|
+
$form: schema
|
2397
|
+
},
|
2398
|
+
required: ["$form"]
|
2399
|
+
};
|
2400
|
+
return defineConditional(schemaWithForm);
|
2401
|
+
}
|
2160
2402
|
function alwaysTrue() {
|
2161
2403
|
return {};
|
2162
2404
|
}
|
@@ -2181,6 +2423,9 @@ function not(condition) {
|
|
2181
2423
|
required: []
|
2182
2424
|
});
|
2183
2425
|
}
|
2426
|
+
function never() {
|
2427
|
+
return not(alwaysTrue());
|
2428
|
+
}
|
2184
2429
|
var user = {
|
2185
2430
|
hasScope: (scope) => defineConditional({
|
2186
2431
|
type: "object",
|
@@ -2228,69 +2473,120 @@ var event = {
|
|
2228
2473
|
required: ["$event"]
|
2229
2474
|
})
|
2230
2475
|
};
|
2476
|
+
function getDateFromNow(days) {
|
2477
|
+
return new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
|
2478
|
+
}
|
2479
|
+
function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
|
2480
|
+
return {
|
2481
|
+
type: "object",
|
2482
|
+
properties: {
|
2483
|
+
[fieldId]: {
|
2484
|
+
type: "string",
|
2485
|
+
format: "date",
|
2486
|
+
[clause]: { $data: `1/${comparedFieldId}` }
|
2487
|
+
},
|
2488
|
+
[comparedFieldId]: { type: "string", format: "date" }
|
2489
|
+
},
|
2490
|
+
required: [fieldId]
|
2491
|
+
};
|
2492
|
+
}
|
2493
|
+
function isFieldReference(value) {
|
2494
|
+
return typeof value === "object" && value !== null && "_fieldId" in value;
|
2495
|
+
}
|
2231
2496
|
function field(fieldId) {
|
2232
|
-
const getDateFromNow = (days) => new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
|
2233
2497
|
const getDateRange = (date, clause) => ({
|
2234
2498
|
type: "object",
|
2235
2499
|
properties: {
|
2236
|
-
|
2237
|
-
type: "
|
2238
|
-
|
2239
|
-
|
2240
|
-
type: "string",
|
2241
|
-
format: "date",
|
2242
|
-
[clause]: date
|
2243
|
-
}
|
2244
|
-
},
|
2245
|
-
required: [fieldId]
|
2500
|
+
[fieldId]: {
|
2501
|
+
type: "string",
|
2502
|
+
format: "date",
|
2503
|
+
[clause]: date
|
2246
2504
|
}
|
2247
2505
|
},
|
2248
|
-
required: [
|
2506
|
+
required: [fieldId]
|
2249
2507
|
});
|
2250
2508
|
return {
|
2509
|
+
/**
|
2510
|
+
* @private Internal property used for field reference tracking.
|
2511
|
+
*/
|
2512
|
+
_fieldId: fieldId,
|
2251
2513
|
isAfter: () => ({
|
2252
2514
|
days: (days) => ({
|
2253
|
-
inPast: () =>
|
2515
|
+
inPast: () => defineFormConditional(
|
2254
2516
|
getDateRange(getDateFromNow(days), "formatMinimum")
|
2255
2517
|
),
|
2256
|
-
inFuture: () =>
|
2518
|
+
inFuture: () => defineFormConditional(
|
2257
2519
|
getDateRange(getDateFromNow(-days), "formatMinimum")
|
2258
2520
|
)
|
2259
2521
|
}),
|
2260
|
-
date: (date) =>
|
2261
|
-
|
2522
|
+
date: (date) => {
|
2523
|
+
if (isFieldReference(date)) {
|
2524
|
+
const comparedFieldId = date._fieldId;
|
2525
|
+
return defineFormConditional(
|
2526
|
+
getDateRangeToFieldReference(
|
2527
|
+
fieldId,
|
2528
|
+
comparedFieldId,
|
2529
|
+
"formatMinimum"
|
2530
|
+
)
|
2531
|
+
);
|
2532
|
+
}
|
2533
|
+
return defineFormConditional(getDateRange(date, "formatMinimum"));
|
2534
|
+
},
|
2535
|
+
now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMinimum"))
|
2262
2536
|
}),
|
2263
2537
|
isBefore: () => ({
|
2264
2538
|
days: (days) => ({
|
2265
|
-
inPast: () =>
|
2539
|
+
inPast: () => defineFormConditional(
|
2266
2540
|
getDateRange(getDateFromNow(days), "formatMaximum")
|
2267
2541
|
),
|
2268
|
-
inFuture: () =>
|
2542
|
+
inFuture: () => defineFormConditional(
|
2269
2543
|
getDateRange(getDateFromNow(-days), "formatMaximum")
|
2270
2544
|
)
|
2271
2545
|
}),
|
2272
|
-
date: (date) =>
|
2273
|
-
|
2546
|
+
date: (date) => {
|
2547
|
+
if (isFieldReference(date)) {
|
2548
|
+
const comparedFieldId = date._fieldId;
|
2549
|
+
return defineFormConditional(
|
2550
|
+
getDateRangeToFieldReference(
|
2551
|
+
fieldId,
|
2552
|
+
comparedFieldId,
|
2553
|
+
"formatMaximum"
|
2554
|
+
)
|
2555
|
+
);
|
2556
|
+
}
|
2557
|
+
return defineFormConditional(getDateRange(date, "formatMaximum"));
|
2558
|
+
},
|
2559
|
+
now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMaximum"))
|
2274
2560
|
}),
|
2275
|
-
isEqualTo: (value) =>
|
2276
|
-
|
2277
|
-
|
2278
|
-
|
2561
|
+
isEqualTo: (value) => {
|
2562
|
+
if (isFieldReference(value)) {
|
2563
|
+
const comparedFieldId = value._fieldId;
|
2564
|
+
return defineFormConditional({
|
2279
2565
|
type: "object",
|
2280
2566
|
properties: {
|
2281
2567
|
[fieldId]: {
|
2282
|
-
|
2283
|
-
|
2284
|
-
|
2285
|
-
|
2286
|
-
const: value
|
2287
|
-
}
|
2568
|
+
type: ["string", "boolean"],
|
2569
|
+
const: { $data: `1/${comparedFieldId}` }
|
2570
|
+
},
|
2571
|
+
[comparedFieldId]: { type: ["string", "boolean"] }
|
2288
2572
|
},
|
2289
|
-
required: [fieldId]
|
2290
|
-
}
|
2291
|
-
}
|
2292
|
-
|
2293
|
-
|
2573
|
+
required: [fieldId, comparedFieldId]
|
2574
|
+
});
|
2575
|
+
}
|
2576
|
+
return defineFormConditional({
|
2577
|
+
type: "object",
|
2578
|
+
properties: {
|
2579
|
+
[fieldId]: {
|
2580
|
+
oneOf: [
|
2581
|
+
{ type: "string", const: value },
|
2582
|
+
{ type: "boolean", const: value }
|
2583
|
+
],
|
2584
|
+
const: value
|
2585
|
+
}
|
2586
|
+
},
|
2587
|
+
required: [fieldId]
|
2588
|
+
});
|
2589
|
+
},
|
2294
2590
|
/**
|
2295
2591
|
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
2296
2592
|
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|
@@ -2299,108 +2595,102 @@ function field(fieldId) {
|
|
2299
2595
|
* NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
|
2300
2596
|
*
|
2301
2597
|
*/
|
2302
|
-
isFalsy: () =>
|
2598
|
+
isFalsy: () => defineFormConditional({
|
2303
2599
|
type: "object",
|
2304
2600
|
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
|
-
},
|
2601
|
+
[fieldId]: {
|
2317
2602
|
anyOf: [
|
2318
|
-
{
|
2319
|
-
|
2320
|
-
},
|
2321
|
-
{
|
2322
|
-
not: {
|
2323
|
-
required: [fieldId]
|
2324
|
-
}
|
2325
|
-
}
|
2603
|
+
{ const: "undefined" },
|
2604
|
+
{ const: false },
|
2605
|
+
{ const: null },
|
2606
|
+
{ const: "" }
|
2326
2607
|
]
|
2327
2608
|
}
|
2328
2609
|
},
|
2329
|
-
|
2330
|
-
|
2331
|
-
|
2332
|
-
|
2333
|
-
|
2334
|
-
$form: {
|
2335
|
-
type: "object",
|
2336
|
-
properties: {
|
2337
|
-
[fieldId]: {
|
2338
|
-
type: "string",
|
2339
|
-
enum: ["undefined"]
|
2340
|
-
}
|
2341
|
-
},
|
2610
|
+
anyOf: [
|
2611
|
+
{
|
2612
|
+
required: [fieldId]
|
2613
|
+
},
|
2614
|
+
{
|
2342
2615
|
not: {
|
2343
2616
|
required: [fieldId]
|
2344
2617
|
}
|
2345
2618
|
}
|
2619
|
+
]
|
2620
|
+
}),
|
2621
|
+
isUndefined: () => defineFormConditional({
|
2622
|
+
type: "object",
|
2623
|
+
properties: {
|
2624
|
+
[fieldId]: {
|
2625
|
+
type: "string",
|
2626
|
+
enum: ["undefined"]
|
2627
|
+
}
|
2346
2628
|
},
|
2347
|
-
|
2629
|
+
not: {
|
2630
|
+
required: [fieldId]
|
2631
|
+
}
|
2348
2632
|
}),
|
2349
|
-
inArray: (values) =>
|
2633
|
+
inArray: (values) => defineFormConditional({
|
2350
2634
|
type: "object",
|
2351
2635
|
properties: {
|
2352
|
-
|
2353
|
-
type: "
|
2354
|
-
|
2355
|
-
[fieldId]: {
|
2356
|
-
type: "string",
|
2357
|
-
enum: values
|
2358
|
-
}
|
2359
|
-
},
|
2360
|
-
required: [fieldId]
|
2636
|
+
[fieldId]: {
|
2637
|
+
type: "string",
|
2638
|
+
enum: values
|
2361
2639
|
}
|
2362
2640
|
},
|
2363
|
-
required: [
|
2641
|
+
required: [fieldId]
|
2364
2642
|
}),
|
2365
|
-
isValidEnglishName: () =>
|
2643
|
+
isValidEnglishName: () => defineFormConditional({
|
2366
2644
|
type: "object",
|
2367
2645
|
properties: {
|
2368
|
-
|
2369
|
-
type: "
|
2370
|
-
|
2371
|
-
|
2372
|
-
|
2373
|
-
|
2374
|
-
|
2375
|
-
|
2376
|
-
|
2377
|
-
|
2646
|
+
[fieldId]: {
|
2647
|
+
type: "string",
|
2648
|
+
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'._-]*)*$",
|
2649
|
+
description: "Name must contain only letters, numbers, and allowed special characters ('._-). No double spaces."
|
2650
|
+
}
|
2651
|
+
},
|
2652
|
+
required: [fieldId]
|
2653
|
+
}),
|
2654
|
+
/**
|
2655
|
+
* Checks if the field value matches a given regular expression pattern.
|
2656
|
+
* @param pattern - The regular expression pattern to match the field value against.
|
2657
|
+
* @returns A JSONSchema conditional that validates the field value against the pattern.
|
2658
|
+
*/
|
2659
|
+
matches: (pattern) => defineFormConditional({
|
2660
|
+
type: "object",
|
2661
|
+
properties: {
|
2662
|
+
[fieldId]: {
|
2663
|
+
type: "string",
|
2664
|
+
pattern
|
2665
|
+
}
|
2666
|
+
},
|
2667
|
+
required: [fieldId]
|
2668
|
+
}),
|
2669
|
+
isBetween: (min, max) => defineFormConditional({
|
2670
|
+
type: "object",
|
2671
|
+
properties: {
|
2672
|
+
[fieldId]: {
|
2673
|
+
type: "number",
|
2674
|
+
minimum: min,
|
2675
|
+
maximum: max
|
2378
2676
|
}
|
2379
2677
|
},
|
2380
|
-
required: [
|
2678
|
+
required: [fieldId]
|
2381
2679
|
})
|
2382
2680
|
};
|
2383
2681
|
}
|
2384
2682
|
|
2385
2683
|
// ../commons/src/fixtures/tennis-club-membership-event.ts
|
2386
|
-
var PRINT_CERTIFICATE_FORM =
|
2684
|
+
var PRINT_CERTIFICATE_FORM = defineActionForm({
|
2387
2685
|
label: {
|
2388
2686
|
id: "v2.event.tennis-club-membership.action.certificate.form.label",
|
2389
2687
|
defaultMessage: "Tennis club membership certificate collector",
|
2390
2688
|
description: "This is what this form is referred as in the system"
|
2391
2689
|
},
|
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
2690
|
pages: [
|
2402
2691
|
{
|
2403
2692
|
id: "collector",
|
2693
|
+
type: PageTypes.enum.FORM,
|
2404
2694
|
title: {
|
2405
2695
|
id: "v2.event.tennis-club-membership.action.certificate.form.section.who.title",
|
2406
2696
|
defaultMessage: "Print certified copy",
|
@@ -2415,7 +2705,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2415
2705
|
defaultMessage: "Requester",
|
2416
2706
|
description: "This is the label for the field"
|
2417
2707
|
},
|
2418
|
-
type:
|
2708
|
+
type: FieldType.SELECT,
|
2419
2709
|
options: [
|
2420
2710
|
{
|
2421
2711
|
value: "INFORMANT",
|
@@ -2492,7 +2782,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2492
2782
|
defaultMessage: "Select Type of ID",
|
2493
2783
|
description: "This is the label for selecting the type of ID"
|
2494
2784
|
},
|
2495
|
-
type:
|
2785
|
+
type: FieldType.SELECT,
|
2496
2786
|
options: [
|
2497
2787
|
{
|
2498
2788
|
value: "PASSPORT",
|
@@ -2593,7 +2883,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2593
2883
|
defaultMessage: "Passport Details",
|
2594
2884
|
description: "Field for entering Passport details"
|
2595
2885
|
},
|
2596
|
-
type:
|
2886
|
+
type: FieldType.TEXT
|
2597
2887
|
},
|
2598
2888
|
{
|
2599
2889
|
id: "collector.DRIVING_LICENSE.details",
|
@@ -2644,7 +2934,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2644
2934
|
defaultMessage: "Driving License Details",
|
2645
2935
|
description: "Field for entering Driving License details"
|
2646
2936
|
},
|
2647
|
-
type:
|
2937
|
+
type: FieldType.TEXT
|
2648
2938
|
},
|
2649
2939
|
{
|
2650
2940
|
id: "collector.REFUGEE_NUMBER.details",
|
@@ -2695,7 +2985,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2695
2985
|
defaultMessage: "Refugee Number Details",
|
2696
2986
|
description: "Field for entering Refugee Number details"
|
2697
2987
|
},
|
2698
|
-
type:
|
2988
|
+
type: FieldType.TEXT
|
2699
2989
|
},
|
2700
2990
|
{
|
2701
2991
|
id: "collector.ALIEN_NUMBER.details",
|
@@ -2746,7 +3036,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2746
3036
|
defaultMessage: "Alien Number Details",
|
2747
3037
|
description: "Field for entering Alien Number details"
|
2748
3038
|
},
|
2749
|
-
type:
|
3039
|
+
type: FieldType.TEXT
|
2750
3040
|
},
|
2751
3041
|
{
|
2752
3042
|
id: "collector.OTHER.idTypeOther",
|
@@ -2797,7 +3087,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2797
3087
|
defaultMessage: "Other ID Type (if applicable)",
|
2798
3088
|
description: 'Field for entering ID type if "Other" is selected'
|
2799
3089
|
},
|
2800
|
-
type:
|
3090
|
+
type: FieldType.TEXT
|
2801
3091
|
},
|
2802
3092
|
{
|
2803
3093
|
id: "collector.OTHER.firstName",
|
@@ -2848,7 +3138,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2848
3138
|
defaultMessage: "First Name",
|
2849
3139
|
description: "This is the label for the first name field"
|
2850
3140
|
},
|
2851
|
-
type:
|
3141
|
+
type: FieldType.TEXT
|
2852
3142
|
},
|
2853
3143
|
{
|
2854
3144
|
id: "collector.OTHER.lastName",
|
@@ -2899,7 +3189,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2899
3189
|
defaultMessage: "Last Name",
|
2900
3190
|
description: "This is the label for the last name field"
|
2901
3191
|
},
|
2902
|
-
type:
|
3192
|
+
type: FieldType.TEXT
|
2903
3193
|
},
|
2904
3194
|
{
|
2905
3195
|
id: "collector.OTHER.relationshipToMember",
|
@@ -2950,7 +3240,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2950
3240
|
defaultMessage: "Relationship to Member",
|
2951
3241
|
description: "This is the label for the relationship to member field"
|
2952
3242
|
},
|
2953
|
-
type:
|
3243
|
+
type: FieldType.TEXT
|
2954
3244
|
},
|
2955
3245
|
{
|
2956
3246
|
id: "collector.OTHER.signedAffidavit",
|
@@ -3001,66 +3291,88 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
3001
3291
|
defaultMessage: "Signed Affidavit (Optional)",
|
3002
3292
|
description: "This is the label for uploading a signed affidavit"
|
3003
3293
|
},
|
3004
|
-
type:
|
3294
|
+
type: FieldType.FILE
|
3005
3295
|
}
|
3006
3296
|
]
|
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
3297
|
},
|
3015
|
-
|
3016
|
-
|
3017
|
-
|
3018
|
-
|
3019
|
-
|
3020
|
-
|
3021
|
-
|
3022
|
-
|
3023
|
-
|
3024
|
-
|
3025
|
-
|
3026
|
-
|
3027
|
-
|
3028
|
-
|
3029
|
-
|
3030
|
-
|
3298
|
+
{
|
3299
|
+
id: "collector.identity.verify",
|
3300
|
+
type: PageTypes.enum.VERIFICATION,
|
3301
|
+
conditional: field("collector.requesterId").isEqualTo("INFORMANT"),
|
3302
|
+
title: {
|
3303
|
+
id: "event.tennis-club-membership.action.print.verifyIdentity",
|
3304
|
+
defaultMessage: "Verify their identity",
|
3305
|
+
description: "This is the title of the section"
|
3306
|
+
},
|
3307
|
+
fields: [],
|
3308
|
+
actions: {
|
3309
|
+
verify: {
|
3310
|
+
label: {
|
3311
|
+
defaultMessage: "Verified",
|
3312
|
+
description: "This is the label for the verification button",
|
3313
|
+
id: "v2.event.tennis-club-membership.action.certificate.form.verify"
|
3314
|
+
}
|
3315
|
+
},
|
3316
|
+
cancel: {
|
3317
|
+
label: {
|
3318
|
+
defaultMessage: "Identity does not match",
|
3319
|
+
description: "This is the label for the verification cancellation button",
|
3320
|
+
id: "v2.event.tennis-club-membership.action.certificate.form.cancel"
|
3321
|
+
},
|
3322
|
+
confirmation: {
|
3323
|
+
title: {
|
3324
|
+
defaultMessage: "Print without proof of ID?",
|
3325
|
+
description: "This is the title for the verification cancellation modal",
|
3326
|
+
id: "v2.event.tennis-club-membership.action.certificate.form.cancel.confirmation.title"
|
3327
|
+
},
|
3328
|
+
body: {
|
3329
|
+
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",
|
3330
|
+
description: "This is the body for the verification cancellation modal",
|
3331
|
+
id: "v2.event.tennis-club-membership.action.certificate.form.cancel.confirmation.body"
|
3332
|
+
}
|
3333
|
+
}
|
3334
|
+
}
|
3335
|
+
}
|
3031
3336
|
}
|
3337
|
+
]
|
3338
|
+
});
|
3339
|
+
var TENNIS_CLUB_DECLARATION_REVIEW = {
|
3340
|
+
title: {
|
3341
|
+
id: "v2.event.tennis-club-membership.action.declare.form.review.title",
|
3342
|
+
defaultMessage: "{applicant.firstname, select, __EMPTY__ {Member declaration} other {{applicant.surname, select, __EMPTY__ {Member declaration} other {Member declaration for {applicant.firstname} {applicant.surname}}}}}",
|
3343
|
+
description: "Title of the review page"
|
3032
3344
|
},
|
3033
|
-
|
3034
|
-
|
3035
|
-
id: "
|
3036
|
-
|
3037
|
-
|
3345
|
+
fields: [
|
3346
|
+
{
|
3347
|
+
id: "review.comment",
|
3348
|
+
type: FieldType.TEXTAREA,
|
3349
|
+
label: {
|
3350
|
+
defaultMessage: "Comment",
|
3351
|
+
id: "v2.event.birth.action.declare.form.review.comment.label",
|
3352
|
+
description: "Label for the comment field in the review section"
|
3353
|
+
}
|
3038
3354
|
},
|
3039
|
-
|
3040
|
-
|
3041
|
-
|
3042
|
-
|
3043
|
-
|
3044
|
-
|
3045
|
-
|
3046
|
-
description: "Label for the comment field in the review section"
|
3047
|
-
}
|
3355
|
+
{
|
3356
|
+
type: FieldType.SIGNATURE,
|
3357
|
+
id: "review.signature",
|
3358
|
+
label: {
|
3359
|
+
defaultMessage: "Signature of informant",
|
3360
|
+
id: "v2.event.birth.action.declare.form.review.signature.label",
|
3361
|
+
description: "Label for the signature field in the review section"
|
3048
3362
|
},
|
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
|
-
}
|
3363
|
+
signaturePromptLabel: {
|
3364
|
+
id: "v2.signature.upload.modal.title",
|
3365
|
+
defaultMessage: "Draw signature",
|
3366
|
+
description: "Title for the modal to draw signature"
|
3062
3367
|
}
|
3063
|
-
|
3368
|
+
}
|
3369
|
+
]
|
3370
|
+
};
|
3371
|
+
var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
3372
|
+
label: {
|
3373
|
+
id: "v2.event.tennis-club-membership.action.declare.form.label",
|
3374
|
+
defaultMessage: "Tennis club membership application",
|
3375
|
+
description: "This is what this form is referred as in the system"
|
3064
3376
|
},
|
3065
3377
|
pages: [
|
3066
3378
|
{
|
@@ -3073,7 +3385,7 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
3073
3385
|
fields: [
|
3074
3386
|
{
|
3075
3387
|
id: "applicant.firstname",
|
3076
|
-
type:
|
3388
|
+
type: FieldType.TEXT,
|
3077
3389
|
required: true,
|
3078
3390
|
conditionals: [],
|
3079
3391
|
label: {
|
@@ -3084,7 +3396,7 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
3084
3396
|
},
|
3085
3397
|
{
|
3086
3398
|
id: "applicant.surname",
|
3087
|
-
type:
|
3399
|
+
type: FieldType.TEXT,
|
3088
3400
|
required: true,
|
3089
3401
|
conditionals: [],
|
3090
3402
|
label: {
|
@@ -3106,9 +3418,8 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
3106
3418
|
},
|
3107
3419
|
{
|
3108
3420
|
id: "applicant.dob",
|
3109
|
-
type:
|
3421
|
+
type: FieldType.DATE,
|
3110
3422
|
required: true,
|
3111
|
-
conditionals: [],
|
3112
3423
|
validation: [
|
3113
3424
|
{
|
3114
3425
|
message: {
|
@@ -3119,15 +3430,53 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
3119
3430
|
validator: field("applicant.dob").isBefore().now()
|
3120
3431
|
}
|
3121
3432
|
],
|
3433
|
+
conditionals: [
|
3434
|
+
{
|
3435
|
+
type: ConditionalType.SHOW,
|
3436
|
+
conditional: field("applicant.dobUnknown").isFalsy()
|
3437
|
+
}
|
3438
|
+
],
|
3122
3439
|
label: {
|
3123
3440
|
defaultMessage: "Applicant's date of birth",
|
3124
3441
|
description: "This is the label for the field",
|
3125
3442
|
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.dob.label"
|
3126
3443
|
}
|
3127
3444
|
},
|
3445
|
+
{
|
3446
|
+
id: "applicant.dobUnknown",
|
3447
|
+
type: FieldType.CHECKBOX,
|
3448
|
+
required: false,
|
3449
|
+
label: {
|
3450
|
+
defaultMessage: "Exact date of birth unknown",
|
3451
|
+
description: "This is the label for the field",
|
3452
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.dobUnknown.label"
|
3453
|
+
},
|
3454
|
+
conditionals: [
|
3455
|
+
{
|
3456
|
+
type: ConditionalType.DISPLAY_ON_REVIEW,
|
3457
|
+
conditional: never()
|
3458
|
+
}
|
3459
|
+
]
|
3460
|
+
},
|
3461
|
+
{
|
3462
|
+
id: "applicant.age",
|
3463
|
+
type: FieldType.NUMBER,
|
3464
|
+
required: true,
|
3465
|
+
label: {
|
3466
|
+
defaultMessage: "Age of tennis-member",
|
3467
|
+
description: "This is the label for the field",
|
3468
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.age.label"
|
3469
|
+
},
|
3470
|
+
conditionals: [
|
3471
|
+
{
|
3472
|
+
type: ConditionalType.SHOW,
|
3473
|
+
conditional: field("applicant.dobUnknown").isEqualTo(true)
|
3474
|
+
}
|
3475
|
+
]
|
3476
|
+
},
|
3128
3477
|
{
|
3129
3478
|
id: "applicant.image",
|
3130
|
-
type:
|
3479
|
+
type: FieldType.FILE,
|
3131
3480
|
required: false,
|
3132
3481
|
label: {
|
3133
3482
|
defaultMessage: "Applicant's profile picture",
|
@@ -3148,6 +3497,27 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
3148
3497
|
}
|
3149
3498
|
]
|
3150
3499
|
},
|
3500
|
+
{
|
3501
|
+
id: "senior-pass",
|
3502
|
+
conditional: field("applicant.dob").isBefore().date("1950-01-01"),
|
3503
|
+
title: {
|
3504
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.senior-pass.title",
|
3505
|
+
defaultMessage: "Assign senior pass for applicant",
|
3506
|
+
description: "This is the title of the section"
|
3507
|
+
},
|
3508
|
+
fields: [
|
3509
|
+
{
|
3510
|
+
id: "senior-pass.id",
|
3511
|
+
type: FieldType.TEXT,
|
3512
|
+
required: true,
|
3513
|
+
label: {
|
3514
|
+
defaultMessage: "Senior pass ID",
|
3515
|
+
description: "This is the label for the field",
|
3516
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.senior-pass.field.id.label"
|
3517
|
+
}
|
3518
|
+
}
|
3519
|
+
]
|
3520
|
+
},
|
3151
3521
|
{
|
3152
3522
|
id: "recommender",
|
3153
3523
|
title: {
|
@@ -3169,7 +3539,7 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
3169
3539
|
},
|
3170
3540
|
{
|
3171
3541
|
id: "recommender.firstname",
|
3172
|
-
type:
|
3542
|
+
type: FieldType.TEXT,
|
3173
3543
|
required: true,
|
3174
3544
|
conditionals: [
|
3175
3545
|
{
|
@@ -3185,7 +3555,7 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
3185
3555
|
},
|
3186
3556
|
{
|
3187
3557
|
id: "recommender.surname",
|
3188
|
-
type:
|
3558
|
+
type: FieldType.TEXT,
|
3189
3559
|
required: true,
|
3190
3560
|
conditionals: [
|
3191
3561
|
{
|
@@ -3201,7 +3571,7 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
3201
3571
|
},
|
3202
3572
|
{
|
3203
3573
|
id: "recommender.id",
|
3204
|
-
type:
|
3574
|
+
type: FieldType.TEXT,
|
3205
3575
|
required: true,
|
3206
3576
|
conditionals: [
|
3207
3577
|
{
|
@@ -3309,7 +3679,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3309
3679
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
3310
3680
|
id: "event.tennis-club-membership.action.declare.label"
|
3311
3681
|
},
|
3312
|
-
|
3682
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
3313
3683
|
},
|
3314
3684
|
{
|
3315
3685
|
type: ActionType.VALIDATE,
|
@@ -3318,7 +3688,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3318
3688
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
3319
3689
|
id: "event.tennis-club-membership.action.validate.label"
|
3320
3690
|
},
|
3321
|
-
|
3691
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
3322
3692
|
},
|
3323
3693
|
{
|
3324
3694
|
type: ActionType.REGISTER,
|
@@ -3327,7 +3697,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3327
3697
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
3328
3698
|
id: "event.tennis-club-membership.action.register.label"
|
3329
3699
|
},
|
3330
|
-
|
3700
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
3331
3701
|
},
|
3332
3702
|
{
|
3333
3703
|
type: ActionType.REQUEST_CORRECTION,
|
@@ -3336,10 +3706,10 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3336
3706
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
3337
3707
|
id: "event.tennis-club-membership.action.correction.request.label"
|
3338
3708
|
},
|
3339
|
-
forms: [TENNIS_CLUB_FORM],
|
3340
3709
|
onboardingForm: [
|
3341
3710
|
{
|
3342
3711
|
id: "correction-requester",
|
3712
|
+
type: PageTypes.enum.FORM,
|
3343
3713
|
title: {
|
3344
3714
|
id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
|
3345
3715
|
defaultMessage: "Correction requester",
|
@@ -3403,6 +3773,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3403
3773
|
},
|
3404
3774
|
{
|
3405
3775
|
id: "identity-check",
|
3776
|
+
type: PageTypes.enum.FORM,
|
3406
3777
|
title: {
|
3407
3778
|
id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
|
3408
3779
|
defaultMessage: "Verify their identity",
|
@@ -3445,6 +3816,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3445
3816
|
additionalDetailsForm: [
|
3446
3817
|
{
|
3447
3818
|
id: "correction-request.supporting-documents",
|
3819
|
+
type: PageTypes.enum.FORM,
|
3448
3820
|
title: {
|
3449
3821
|
id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
|
3450
3822
|
defaultMessage: "Upload supporting documents",
|
@@ -3462,7 +3834,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3462
3834
|
},
|
3463
3835
|
{
|
3464
3836
|
id: "correction.supportingDocs",
|
3465
|
-
type:
|
3837
|
+
type: FieldType.FILE,
|
3466
3838
|
label: {
|
3467
3839
|
id: "correction.corrector.title",
|
3468
3840
|
defaultMessage: "Upload supporting documents",
|
@@ -3506,6 +3878,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3506
3878
|
},
|
3507
3879
|
{
|
3508
3880
|
id: "correction-request.additional-details",
|
3881
|
+
type: PageTypes.enum.FORM,
|
3509
3882
|
title: {
|
3510
3883
|
id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
|
3511
3884
|
defaultMessage: "Reason for correction",
|
@@ -3514,7 +3887,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3514
3887
|
fields: [
|
3515
3888
|
{
|
3516
3889
|
id: "correction.request.reason",
|
3517
|
-
type:
|
3890
|
+
type: FieldType.TEXT,
|
3518
3891
|
label: {
|
3519
3892
|
id: "correction.reason.title",
|
3520
3893
|
defaultMessage: "Reason for correction?",
|
@@ -3527,7 +3900,6 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3527
3900
|
},
|
3528
3901
|
{
|
3529
3902
|
type: ActionType.APPROVE_CORRECTION,
|
3530
|
-
forms: [TENNIS_CLUB_FORM],
|
3531
3903
|
label: {
|
3532
3904
|
defaultMessage: "Approve correction",
|
3533
3905
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
@@ -3541,7 +3913,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3541
3913
|
defaultMessage: "Print certificate",
|
3542
3914
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
3543
3915
|
},
|
3544
|
-
|
3916
|
+
printForm: PRINT_CERTIFICATE_FORM,
|
3545
3917
|
conditionals: [
|
3546
3918
|
{
|
3547
3919
|
type: "SHOW",
|
@@ -3588,8 +3960,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3588
3960
|
id: "v2.event.tennis-club-membership.action.archive.label",
|
3589
3961
|
defaultMessage: "Archive",
|
3590
3962
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
3591
|
-
}
|
3592
|
-
forms: [TENNIS_CLUB_FORM]
|
3963
|
+
}
|
3593
3964
|
},
|
3594
3965
|
{
|
3595
3966
|
type: ActionType.REJECT,
|
@@ -3597,8 +3968,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3597
3968
|
id: "v2.event.tennis-club-membership.action.reject.label",
|
3598
3969
|
defaultMessage: "Reject",
|
3599
3970
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
3600
|
-
}
|
3601
|
-
forms: [TENNIS_CLUB_FORM]
|
3971
|
+
}
|
3602
3972
|
}
|
3603
3973
|
],
|
3604
3974
|
advancedSearch: [
|
@@ -3614,20 +3984,53 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3614
3984
|
}
|
3615
3985
|
]
|
3616
3986
|
}
|
3617
|
-
]
|
3987
|
+
],
|
3988
|
+
declaration: TENNIS_CLUB_DECLARATION_FORM
|
3618
3989
|
});
|
3619
3990
|
|
3620
3991
|
// ../commons/src/events/test.utils.ts
|
3621
|
-
function
|
3622
|
-
|
3623
|
-
const data = fields.reduce(
|
3992
|
+
function fieldConfigsToActionPayload(fields) {
|
3993
|
+
return fields.reduce(
|
3624
3994
|
(acc, field2, i) => ({
|
3625
3995
|
...acc,
|
3626
3996
|
[field2.id]: mapFieldTypeToMockValue(field2, i)
|
3627
3997
|
}),
|
3628
3998
|
{}
|
3629
3999
|
);
|
3630
|
-
|
4000
|
+
}
|
4001
|
+
function generateActionDeclarationInput(configuration, action) {
|
4002
|
+
const parsed = DeclarationUpdateActions.safeParse(action);
|
4003
|
+
if (parsed.success) {
|
4004
|
+
const fields = getDeclarationFields(configuration);
|
4005
|
+
const declarationConfig = getDeclaration(configuration);
|
4006
|
+
const declaration = fieldConfigsToActionPayload(fields);
|
4007
|
+
return omitHiddenPaginatedFields(declarationConfig, declaration);
|
4008
|
+
}
|
4009
|
+
console.warn(`${action} is not a declaration action. Setting data as {}.`);
|
4010
|
+
return {};
|
4011
|
+
}
|
4012
|
+
function generateActionAnnotationInput(configuration, action) {
|
4013
|
+
const actionConfig = configuration.actions.find(
|
4014
|
+
(ac) => ac.type === action
|
4015
|
+
);
|
4016
|
+
const annotationFields = actionConfig ? getActionAnnotationFields(actionConfig) : [];
|
4017
|
+
const annotation = fieldConfigsToActionPayload(annotationFields);
|
4018
|
+
const visibleVerificationPageIds = findRecordActionPages(
|
4019
|
+
configuration,
|
4020
|
+
action
|
4021
|
+
).filter((page) => isVerificationPage(page)).filter((page) => isPageVisible(page, annotation)).map((page) => page.id);
|
4022
|
+
const visiblePageVerificationMap = visibleVerificationPageIds.reduce(
|
4023
|
+
(acc, pageId) => ({
|
4024
|
+
...acc,
|
4025
|
+
[pageId]: true
|
4026
|
+
}),
|
4027
|
+
{}
|
4028
|
+
);
|
4029
|
+
const fieldBasedPayload = omitHiddenFields(annotationFields, annotation);
|
4030
|
+
return {
|
4031
|
+
...fieldBasedPayload,
|
4032
|
+
...visiblePageVerificationMap
|
4033
|
+
};
|
3631
4034
|
}
|
3632
4035
|
var eventPayloadGenerator = {
|
3633
4036
|
create: (input = {}) => ({
|
@@ -3639,21 +4042,22 @@ var eventPayloadGenerator = {
|
|
3639
4042
|
type: input.type ?? "TENNIS_CLUB_MEMBERSHIP",
|
3640
4043
|
id
|
3641
4044
|
}),
|
3642
|
-
draft: (eventId, input = {}) => (0, import_lodash2.merge)(
|
4045
|
+
draft: ({ eventId, actionType }, input = {}) => (0, import_lodash2.merge)(
|
3643
4046
|
{
|
3644
4047
|
id: getUUID(),
|
3645
4048
|
eventId,
|
3646
4049
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
3647
4050
|
transactionId: getUUID(),
|
3648
4051
|
action: {
|
3649
|
-
type:
|
3650
|
-
|
4052
|
+
type: actionType,
|
4053
|
+
status: ActionStatus.Accepted,
|
4054
|
+
declaration: {
|
3651
4055
|
"applicant.firstname": "Max",
|
3652
4056
|
"applicant.surname": "McLaren",
|
3653
4057
|
"applicant.dob": "2020-01-02",
|
3654
4058
|
"recommender.none": true
|
3655
4059
|
},
|
3656
|
-
|
4060
|
+
annotation: {
|
3657
4061
|
"correction.requester.relationship": "ANOTHER_AGENT",
|
3658
4062
|
"correction.request.reason": "Child's name was incorrect"
|
3659
4063
|
},
|
@@ -3668,41 +4072,104 @@ var eventPayloadGenerator = {
|
|
3668
4072
|
declare: (eventId, input = {}) => ({
|
3669
4073
|
type: ActionType.DECLARE,
|
3670
4074
|
transactionId: input.transactionId ?? getUUID(),
|
3671
|
-
|
4075
|
+
declaration: input.declaration ?? generateActionDeclarationInput(
|
4076
|
+
tennisClubMembershipEvent,
|
4077
|
+
ActionType.DECLARE
|
4078
|
+
),
|
4079
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
4080
|
+
tennisClubMembershipEvent,
|
4081
|
+
ActionType.DECLARE
|
4082
|
+
),
|
3672
4083
|
eventId
|
3673
4084
|
}),
|
4085
|
+
/**
|
4086
|
+
* Notify allows sending incomplete data. Think it as 'partial declare' for now.
|
4087
|
+
*/
|
4088
|
+
notify: (eventId, input = {}) => {
|
4089
|
+
let declaration = input.declaration;
|
4090
|
+
if (!declaration) {
|
4091
|
+
const partialDeclaration = (0, import_lodash2.omitBy)(
|
4092
|
+
generateActionDeclarationInput(
|
4093
|
+
tennisClubMembershipEvent,
|
4094
|
+
ActionType.DECLARE
|
4095
|
+
),
|
4096
|
+
import_lodash2.isString
|
4097
|
+
);
|
4098
|
+
declaration = partialDeclaration;
|
4099
|
+
}
|
4100
|
+
return {
|
4101
|
+
type: ActionType.NOTIFY,
|
4102
|
+
transactionId: input.transactionId ?? getUUID(),
|
4103
|
+
declaration,
|
4104
|
+
eventId
|
4105
|
+
};
|
4106
|
+
},
|
3674
4107
|
validate: (eventId, input = {}) => ({
|
3675
4108
|
type: ActionType.VALIDATE,
|
3676
4109
|
transactionId: input.transactionId ?? getUUID(),
|
3677
|
-
|
4110
|
+
declaration: input.declaration ?? generateActionDeclarationInput(
|
4111
|
+
tennisClubMembershipEvent,
|
4112
|
+
ActionType.VALIDATE
|
4113
|
+
),
|
4114
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
4115
|
+
tennisClubMembershipEvent,
|
4116
|
+
ActionType.VALIDATE
|
4117
|
+
),
|
3678
4118
|
duplicates: [],
|
3679
4119
|
eventId
|
3680
4120
|
}),
|
4121
|
+
assign: (eventId, input = {}) => ({
|
4122
|
+
type: ActionType.ASSIGN,
|
4123
|
+
transactionId: input.transactionId ?? getUUID(),
|
4124
|
+
declaration: {},
|
4125
|
+
assignedTo: input.assignedTo ?? getUUID(),
|
4126
|
+
eventId
|
4127
|
+
}),
|
4128
|
+
unassign: (eventId, input = {}) => ({
|
4129
|
+
type: ActionType.UNASSIGN,
|
4130
|
+
transactionId: input.transactionId ?? getUUID(),
|
4131
|
+
declaration: {},
|
4132
|
+
assignedTo: null,
|
4133
|
+
eventId
|
4134
|
+
}),
|
3681
4135
|
archive: (eventId, input = {}, isDuplicate) => ({
|
3682
4136
|
type: ActionType.ARCHIVE,
|
3683
4137
|
transactionId: input.transactionId ?? getUUID(),
|
3684
|
-
|
3685
|
-
|
4138
|
+
declaration: {},
|
4139
|
+
// @TODO: Check whether generator is needed?
|
4140
|
+
annotation: { isDuplicate: isDuplicate ?? false },
|
3686
4141
|
duplicates: [],
|
3687
4142
|
eventId
|
3688
4143
|
}),
|
3689
4144
|
reject: (eventId, input = {}) => ({
|
3690
4145
|
type: ActionType.REJECT,
|
3691
4146
|
transactionId: input.transactionId ?? getUUID(),
|
3692
|
-
|
4147
|
+
declaration: {},
|
4148
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
4149
|
+
tennisClubMembershipEvent,
|
4150
|
+
ActionType.REJECT
|
4151
|
+
),
|
3693
4152
|
duplicates: [],
|
3694
4153
|
eventId
|
3695
4154
|
}),
|
3696
4155
|
register: (eventId, input = {}) => ({
|
3697
4156
|
type: ActionType.REGISTER,
|
3698
4157
|
transactionId: input.transactionId ?? getUUID(),
|
3699
|
-
|
4158
|
+
declaration: input.declaration ?? generateActionDeclarationInput(
|
4159
|
+
tennisClubMembershipEvent,
|
4160
|
+
ActionType.REGISTER
|
4161
|
+
),
|
4162
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
4163
|
+
tennisClubMembershipEvent,
|
4164
|
+
ActionType.REGISTER
|
4165
|
+
),
|
3700
4166
|
eventId
|
3701
4167
|
}),
|
3702
4168
|
printCertificate: (eventId, input = {}) => ({
|
3703
4169
|
type: ActionType.PRINT_CERTIFICATE,
|
3704
4170
|
transactionId: input.transactionId ?? getUUID(),
|
3705
|
-
|
4171
|
+
declaration: {},
|
4172
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
3706
4173
|
tennisClubMembershipEvent,
|
3707
4174
|
ActionType.PRINT_CERTIFICATE
|
3708
4175
|
),
|
@@ -3712,17 +4179,21 @@ var eventPayloadGenerator = {
|
|
3712
4179
|
request: (eventId, input = {}) => ({
|
3713
4180
|
type: ActionType.REQUEST_CORRECTION,
|
3714
4181
|
transactionId: input.transactionId ?? getUUID(),
|
3715
|
-
|
4182
|
+
declaration: input.declaration ?? generateActionDeclarationInput(
|
4183
|
+
tennisClubMembershipEvent,
|
4184
|
+
ActionType.REQUEST_CORRECTION
|
4185
|
+
),
|
4186
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
3716
4187
|
tennisClubMembershipEvent,
|
3717
4188
|
ActionType.REQUEST_CORRECTION
|
3718
4189
|
),
|
3719
|
-
metadata: {},
|
3720
4190
|
eventId
|
3721
4191
|
}),
|
3722
4192
|
approve: (eventId, requestId, input = {}) => ({
|
3723
4193
|
type: ActionType.APPROVE_CORRECTION,
|
3724
4194
|
transactionId: input.transactionId ?? getUUID(),
|
3725
|
-
|
4195
|
+
declaration: {},
|
4196
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
3726
4197
|
tennisClubMembershipEvent,
|
3727
4198
|
ActionType.APPROVE_CORRECTION
|
3728
4199
|
),
|
@@ -3732,7 +4203,8 @@ var eventPayloadGenerator = {
|
|
3732
4203
|
reject: (eventId, requestId, input = {}) => ({
|
3733
4204
|
type: ActionType.REJECT_CORRECTION,
|
3734
4205
|
transactionId: input.transactionId ?? getUUID(),
|
3735
|
-
|
4206
|
+
declaration: {},
|
4207
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
3736
4208
|
tennisClubMembershipEvent,
|
3737
4209
|
ActionType.REJECT_CORRECTION
|
3738
4210
|
),
|
@@ -3754,15 +4226,20 @@ function generateActionDocument({
|
|
3754
4226
|
createdBy: getUUID(),
|
3755
4227
|
id: getUUID(),
|
3756
4228
|
createdAtLocation: "TODO",
|
3757
|
-
|
3758
|
-
|
3759
|
-
...defaults
|
4229
|
+
declaration: generateActionDeclarationInput(configuration, action),
|
4230
|
+
annotation: {},
|
4231
|
+
...defaults,
|
4232
|
+
status: ActionStatus.Accepted
|
3760
4233
|
};
|
3761
4234
|
switch (action) {
|
4235
|
+
case ActionType.READ:
|
4236
|
+
return { ...actionBase, type: action };
|
4237
|
+
case ActionType.MARKED_AS_DUPLICATE:
|
4238
|
+
return { ...actionBase, type: action };
|
3762
4239
|
case ActionType.DECLARE:
|
3763
4240
|
return { ...actionBase, type: action };
|
3764
4241
|
case ActionType.UNASSIGN:
|
3765
|
-
return { ...actionBase, type: action };
|
4242
|
+
return { ...actionBase, type: action, assignedTo: null };
|
3766
4243
|
case ActionType.ASSIGN:
|
3767
4244
|
return { ...actionBase, assignedTo: getUUID(), type: action };
|
3768
4245
|
case ActionType.VALIDATE:
|
@@ -3783,14 +4260,13 @@ function generateActionDocument({
|
|
3783
4260
|
return { ...actionBase, requestId: getUUID(), type: action };
|
3784
4261
|
case ActionType.REJECT_CORRECTION:
|
3785
4262
|
return { ...actionBase, requestId: getUUID(), type: action };
|
3786
|
-
case ActionType.CUSTOM:
|
3787
|
-
return { ...actionBase, type: action };
|
3788
4263
|
case ActionType.REGISTER:
|
3789
4264
|
return {
|
3790
4265
|
...actionBase,
|
3791
|
-
type: action
|
3792
|
-
identifiers: { trackingId: getUUID(), registrationNumber: getUUID() }
|
4266
|
+
type: action
|
3793
4267
|
};
|
4268
|
+
case ActionType.DELETE:
|
4269
|
+
case ActionType.DETECT_DUPLICATE:
|
3794
4270
|
default:
|
3795
4271
|
throw new Error(`Unsupported action type: ${action}`);
|
3796
4272
|
}
|
@@ -3814,7 +4290,7 @@ function generateEventDocument({
|
|
3814
4290
|
updatedAt: new Date(Date.now() - 1e3).toISOString()
|
3815
4291
|
};
|
3816
4292
|
}
|
3817
|
-
function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE,
|
4293
|
+
function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE, declaration = {}) {
|
3818
4294
|
const action = generateActionDocument({
|
3819
4295
|
configuration: tennisClubMembershipEvent,
|
3820
4296
|
action: actionType
|
@@ -3824,9 +4300,9 @@ function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE, da
|
|
3824
4300
|
transactionId: getUUID(),
|
3825
4301
|
action: {
|
3826
4302
|
...action,
|
3827
|
-
|
3828
|
-
...action.
|
3829
|
-
...
|
4303
|
+
declaration: {
|
4304
|
+
...action.declaration,
|
4305
|
+
...declaration
|
3830
4306
|
}
|
3831
4307
|
},
|
3832
4308
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
@@ -3843,7 +4319,7 @@ var eventQueryDataGenerator = (overrides = {}) => ({
|
|
3843
4319
|
modifiedAt: overrides.modifiedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
3844
4320
|
assignedTo: overrides.assignedTo ?? null,
|
3845
4321
|
updatedBy: overrides.updatedBy ?? getUUID(),
|
3846
|
-
|
4322
|
+
declaration: overrides.declaration ?? {
|
3847
4323
|
"recommender.none": true,
|
3848
4324
|
"applicant.firstname": "Danny",
|
3849
4325
|
"applicant.surname": "Doe",
|
@@ -3851,6 +4327,11 @@ var eventQueryDataGenerator = (overrides = {}) => ({
|
|
3851
4327
|
},
|
3852
4328
|
trackingId: overrides.trackingId ?? "M3F8YQ"
|
3853
4329
|
});
|
4330
|
+
var generateTranslationConfig = (message) => ({
|
4331
|
+
defaultMessage: message,
|
4332
|
+
description: "Description for ${message}",
|
4333
|
+
id: message
|
4334
|
+
});
|
3854
4335
|
|
3855
4336
|
// ../commons/src/events/TemplateConfig.ts
|
3856
4337
|
function isTemplateVariable(value) {
|
@@ -3869,7 +4350,9 @@ function isFieldValueWithoutTemplates(value) {
|
|
3869
4350
|
return true;
|
3870
4351
|
}
|
3871
4352
|
function isFieldConfigDefaultValue(value) {
|
3872
|
-
if (!value)
|
4353
|
+
if (!value) {
|
4354
|
+
return false;
|
4355
|
+
}
|
3873
4356
|
if (isFieldValue(value)) {
|
3874
4357
|
return true;
|
3875
4358
|
}
|