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