@opencrvs/toolkit 1.8.0-rc.fa72fdf → 1.8.0-rc.fb261c5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commons/api/router.d.ts +5701 -445
- package/dist/commons/conditionals/conditionals.d.ts +1 -0
- package/dist/commons/conditionals/validate-address.test.d.ts +2 -0
- package/dist/commons/events/ActionConfig.d.ts +4506 -238
- package/dist/commons/events/ActionDocument.d.ts +2144 -68
- package/dist/commons/events/ActionInput.d.ts +3224 -104
- package/dist/commons/events/ActionType.d.ts +5 -0
- package/dist/commons/events/CompositeFieldValue.d.ts +152 -2
- package/dist/commons/events/Draft.d.ts +300 -12
- package/dist/commons/events/EventConfig.d.ts +1732 -164
- package/dist/commons/events/EventConfigInput.d.ts +2 -2
- package/dist/commons/events/EventDocument.d.ts +2640 -120
- package/dist/commons/events/FieldConfig.d.ts +292 -40
- package/dist/commons/events/FieldType.d.ts +2 -1
- package/dist/commons/events/FieldTypeMapping.d.ts +124 -3
- package/dist/commons/events/FieldValue.d.ts +76 -2
- package/dist/commons/events/FormConfig.d.ts +367 -29
- package/dist/commons/events/defineConfig.d.ts +280 -28
- package/dist/commons/events/test.utils.d.ts +161 -13
- package/dist/commons/events/utils.d.ts +120 -11
- package/dist/conditionals/index.js +17 -0
- package/dist/events/index.js +232 -23
- package/package.json +1 -1
@@ -239,6 +239,23 @@ function field(fieldId) {
|
|
239
239
|
}
|
240
240
|
},
|
241
241
|
required: ["$form"]
|
242
|
+
}),
|
243
|
+
isValidEnglishName: () => defineConditional({
|
244
|
+
type: "object",
|
245
|
+
properties: {
|
246
|
+
$form: {
|
247
|
+
type: "object",
|
248
|
+
properties: {
|
249
|
+
[fieldId]: {
|
250
|
+
type: "string",
|
251
|
+
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'._-]*)*$",
|
252
|
+
description: "Name must contain only letters, numbers, and allowed special characters ('._-). No double spaces."
|
253
|
+
}
|
254
|
+
},
|
255
|
+
required: [fieldId]
|
256
|
+
}
|
257
|
+
},
|
258
|
+
required: ["$form"]
|
242
259
|
})
|
243
260
|
};
|
244
261
|
}
|
package/dist/events/index.js
CHANGED
@@ -40,6 +40,7 @@ __export(events_exports, {
|
|
40
40
|
ActionUpdate: () => ActionUpdate,
|
41
41
|
AddressFieldUpdateValue: () => AddressFieldUpdateValue,
|
42
42
|
AddressFieldValue: () => AddressFieldValue,
|
43
|
+
AddressType: () => AddressType,
|
43
44
|
AdministrativeAreas: () => AdministrativeAreas,
|
44
45
|
AdvancedSearchConfig: () => AdvancedSearchConfig,
|
45
46
|
ApproveCorrectionActionInput: () => ApproveCorrectionActionInput,
|
@@ -51,6 +52,7 @@ __export(events_exports, {
|
|
51
52
|
Clause: () => Clause,
|
52
53
|
Conditional: () => Conditional,
|
53
54
|
ConditionalType: () => ConditionalType,
|
55
|
+
DataFieldValue: () => DataFieldValue,
|
54
56
|
DateValue: () => DateValue,
|
55
57
|
DeclareActionInput: () => DeclareActionInput,
|
56
58
|
DeduplicationConfig: () => DeduplicationConfig,
|
@@ -76,9 +78,16 @@ __export(events_exports, {
|
|
76
78
|
FileFieldWithOptionValue: () => FileFieldWithOptionValue,
|
77
79
|
FormConfig: () => FormConfig,
|
78
80
|
FormPage: () => FormPage,
|
81
|
+
FormPageConfig: () => FormPageConfig,
|
82
|
+
FormPageType: () => FormPageType,
|
83
|
+
GenericAddressUpdateValue: () => GenericAddressUpdateValue,
|
84
|
+
GenericAddressValue: () => GenericAddressValue,
|
79
85
|
GeographicalArea: () => GeographicalArea,
|
86
|
+
ImageMimeType: () => ImageMimeType,
|
80
87
|
LanguageConfig: () => LanguageConfig,
|
88
|
+
LatentActions: () => LatentActions,
|
81
89
|
MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
|
90
|
+
MimeType: () => MimeType,
|
82
91
|
NotifyActionInput: () => NotifyActionInput,
|
83
92
|
NumberFieldValue: () => NumberFieldValue,
|
84
93
|
PrintCertificateActionInput: () => PrintCertificateActionInput,
|
@@ -97,6 +106,8 @@ __export(events_exports, {
|
|
97
106
|
UrbanAddressUpdateValue: () => UrbanAddressUpdateValue,
|
98
107
|
UrbanAddressValue: () => UrbanAddressValue,
|
99
108
|
ValidateActionInput: () => ValidateActionInput,
|
109
|
+
VerificationPage: () => VerificationPage,
|
110
|
+
VerificationPageConfig: () => VerificationPageConfig,
|
100
111
|
WorkqueueConfig: () => WorkqueueConfig,
|
101
112
|
alwaysTrue: () => alwaysTrue,
|
102
113
|
and: () => and,
|
@@ -121,14 +132,17 @@ __export(events_exports, {
|
|
121
132
|
findActiveActionForm: () => findActiveActionForm,
|
122
133
|
findActiveActionFormFields: () => findActiveActionFormFields,
|
123
134
|
findActiveActionFormPages: () => findActiveActionFormPages,
|
135
|
+
findActiveActionVerificationPageIds: () => findActiveActionVerificationPageIds,
|
124
136
|
findActiveDrafts: () => findActiveDrafts,
|
125
137
|
findInputPageFields: () => findInputPageFields,
|
126
138
|
findPageFields: () => findPageFields,
|
127
139
|
generateActionDocument: () => generateActionDocument,
|
128
140
|
generateActionInput: () => generateActionInput,
|
141
|
+
generateActionMetadataInput: () => generateActionMetadataInput,
|
129
142
|
generateEventDocument: () => generateEventDocument,
|
130
143
|
generateEventDraftDocument: () => generateEventDraftDocument,
|
131
144
|
generateTransactionId: () => generateTransactionId,
|
145
|
+
generateTranslationConfig: () => generateTranslationConfig,
|
132
146
|
getActiveActionFields: () => getActiveActionFields,
|
133
147
|
getActiveActionFormPages: () => getActiveActionFormPages,
|
134
148
|
getAllFields: () => getAllFields,
|
@@ -144,6 +158,7 @@ __export(events_exports, {
|
|
144
158
|
isBulletListFieldType: () => isBulletListFieldType,
|
145
159
|
isCheckboxFieldType: () => isCheckboxFieldType,
|
146
160
|
isCountryFieldType: () => isCountryFieldType,
|
161
|
+
isDataFieldType: () => isDataFieldType,
|
147
162
|
isDateFieldType: () => isDateFieldType,
|
148
163
|
isDividerFieldType: () => isDividerFieldType,
|
149
164
|
isEmailFieldType: () => isEmailFieldType,
|
@@ -251,7 +266,8 @@ var FieldType = {
|
|
251
266
|
ADMINISTRATIVE_AREA: "ADMINISTRATIVE_AREA",
|
252
267
|
FACILITY: "FACILITY",
|
253
268
|
OFFICE: "OFFICE",
|
254
|
-
SIGNATURE: "SIGNATURE"
|
269
|
+
SIGNATURE: "SIGNATURE",
|
270
|
+
DATA: "DATA"
|
255
271
|
};
|
256
272
|
var fieldTypes = Object.values(FieldType);
|
257
273
|
var compositeFieldTypes = [
|
@@ -269,6 +285,10 @@ var GeographicalArea = {
|
|
269
285
|
URBAN: "URBAN",
|
270
286
|
RURAL: "RURAL"
|
271
287
|
};
|
288
|
+
var AddressType = {
|
289
|
+
DOMESTIC: "DOMESTIC",
|
290
|
+
INTERNATIONAL: "INTERNATIONAL"
|
291
|
+
};
|
272
292
|
var FileFieldValue = import_zod3.z.object({
|
273
293
|
filename: import_zod3.z.string(),
|
274
294
|
originalFilename: import_zod3.z.string(),
|
@@ -276,6 +296,7 @@ var FileFieldValue = import_zod3.z.object({
|
|
276
296
|
});
|
277
297
|
var AdminStructure = import_zod3.z.object({
|
278
298
|
country: import_zod3.z.string(),
|
299
|
+
addressType: import_zod3.z.literal(AddressType.DOMESTIC),
|
279
300
|
province: import_zod3.z.string(),
|
280
301
|
district: import_zod3.z.string()
|
281
302
|
});
|
@@ -303,14 +324,33 @@ var RuralAddressUpdateValue = AdminStructure.extend({
|
|
303
324
|
urbanOrRural: import_zod3.z.literal(GeographicalArea.RURAL),
|
304
325
|
village: import_zod3.z.string().nullish()
|
305
326
|
});
|
306
|
-
var
|
307
|
-
|
308
|
-
|
309
|
-
|
327
|
+
var GenericAddressValue = import_zod3.z.object({
|
328
|
+
country: import_zod3.z.string(),
|
329
|
+
addressType: import_zod3.z.literal(AddressType.INTERNATIONAL),
|
330
|
+
state: import_zod3.z.string(),
|
331
|
+
district2: import_zod3.z.string(),
|
332
|
+
cityOrTown: import_zod3.z.string().optional(),
|
333
|
+
addressLine1: import_zod3.z.string().optional(),
|
334
|
+
addressLine2: import_zod3.z.string().optional(),
|
335
|
+
addressLine3: import_zod3.z.string().optional(),
|
336
|
+
postcodeOrZip: import_zod3.z.string().optional()
|
337
|
+
});
|
338
|
+
var AddressFieldValue = import_zod3.z.discriminatedUnion("urbanOrRural", [UrbanAddressValue, RuralAddressValue]).or(GenericAddressValue);
|
339
|
+
var GenericAddressUpdateValue = import_zod3.z.object({
|
340
|
+
country: import_zod3.z.string(),
|
341
|
+
addressType: import_zod3.z.literal(AddressType.INTERNATIONAL),
|
342
|
+
state: import_zod3.z.string(),
|
343
|
+
district2: import_zod3.z.string(),
|
344
|
+
cityOrTown: import_zod3.z.string().nullish(),
|
345
|
+
addressLine1: import_zod3.z.string().nullish(),
|
346
|
+
addressLine2: import_zod3.z.string().nullish(),
|
347
|
+
addressLine3: import_zod3.z.string().nullish(),
|
348
|
+
postcodeOrZip: import_zod3.z.string().nullish()
|
349
|
+
});
|
310
350
|
var AddressFieldUpdateValue = import_zod3.z.discriminatedUnion("urbanOrRural", [
|
311
351
|
UrbanAddressUpdateValue,
|
312
352
|
RuralAddressUpdateValue
|
313
|
-
]);
|
353
|
+
]).or(GenericAddressUpdateValue);
|
314
354
|
var FileFieldValueWithOption = import_zod3.z.object({
|
315
355
|
filename: import_zod3.z.string(),
|
316
356
|
originalFilename: import_zod3.z.string(),
|
@@ -326,6 +366,7 @@ var DateValue = import_zod4.z.string().date().describe("Date in the format YYYY-
|
|
326
366
|
var EmailValue = import_zod4.z.string().email();
|
327
367
|
var CheckboxFieldValue = import_zod4.z.boolean();
|
328
368
|
var NumberFieldValue = import_zod4.z.number();
|
369
|
+
var DataFieldValue = import_zod4.z.undefined();
|
329
370
|
var FieldValue = import_zod4.z.union([
|
330
371
|
TextValue,
|
331
372
|
DateValue,
|
@@ -334,7 +375,9 @@ var FieldValue = import_zod4.z.union([
|
|
334
375
|
FileFieldValue,
|
335
376
|
FileFieldWithOptionValue,
|
336
377
|
UrbanAddressValue,
|
337
|
-
RuralAddressValue
|
378
|
+
RuralAddressValue,
|
379
|
+
DataFieldValue,
|
380
|
+
GenericAddressValue
|
338
381
|
]);
|
339
382
|
var FieldUpdateValue = import_zod4.z.union([
|
340
383
|
TextValue,
|
@@ -344,7 +387,9 @@ var FieldUpdateValue = import_zod4.z.union([
|
|
344
387
|
FileFieldValue,
|
345
388
|
FileFieldWithOptionValue,
|
346
389
|
UrbanAddressUpdateValue,
|
347
|
-
RuralAddressUpdateValue
|
390
|
+
RuralAddressUpdateValue,
|
391
|
+
DataFieldValue,
|
392
|
+
GenericAddressUpdateValue
|
348
393
|
]);
|
349
394
|
|
350
395
|
// ../commons/src/events/FieldConfig.ts
|
@@ -415,15 +460,25 @@ var TextAreaField = BaseField.extend({
|
|
415
460
|
postfix: TranslationConfig.optional()
|
416
461
|
}).default({ rows: 4 }).optional()
|
417
462
|
}).describe("Multiline text input");
|
463
|
+
var ImageMimeType = import_zod5.z.enum([
|
464
|
+
"image/png",
|
465
|
+
"image/jpg",
|
466
|
+
"image/jpeg",
|
467
|
+
"image/svg+xml"
|
468
|
+
]);
|
469
|
+
var MimeType = ImageMimeType;
|
470
|
+
var DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
|
418
471
|
var SignatureField = BaseField.extend({
|
419
472
|
type: import_zod5.z.literal(FieldType.SIGNATURE),
|
420
473
|
signaturePromptLabel: TranslationConfig.describe(
|
421
474
|
"Title of the signature modal"
|
422
475
|
),
|
423
476
|
configuration: import_zod5.z.object({
|
424
|
-
|
425
|
-
|
426
|
-
}).default({
|
477
|
+
maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
478
|
+
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
479
|
+
}).default({
|
480
|
+
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
481
|
+
})
|
427
482
|
}).describe("Signature input field");
|
428
483
|
var EmailField = BaseField.extend({
|
429
484
|
type: import_zod5.z.literal(FieldType.EMAIL),
|
@@ -466,13 +521,17 @@ var PageHeader = BaseField.extend({
|
|
466
521
|
}).describe("A read-only header component for form pages");
|
467
522
|
var File = BaseField.extend({
|
468
523
|
type: import_zod5.z.literal(FieldType.FILE),
|
469
|
-
|
524
|
+
configuration: import_zod5.z.object({
|
525
|
+
maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
526
|
+
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
|
470
527
|
style: import_zod5.z.object({
|
471
|
-
|
528
|
+
width: import_zod5.z.enum(["full", "auto"]).optional().describe(
|
472
529
|
"Whether the file upload button should take the full width of the container or not"
|
473
530
|
)
|
474
|
-
})
|
475
|
-
}).
|
531
|
+
}).optional()
|
532
|
+
}).default({
|
533
|
+
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
534
|
+
})
|
476
535
|
}).describe("File upload");
|
477
536
|
var SelectOption = import_zod5.z.object({
|
478
537
|
value: import_zod5.z.string().describe("The value of the option"),
|
@@ -533,8 +592,14 @@ var Location = BaseField.extend({
|
|
533
592
|
}).describe("Input field for a location");
|
534
593
|
var FileUploadWithOptions = BaseField.extend({
|
535
594
|
type: import_zod5.z.literal(FieldType.FILE_WITH_OPTIONS),
|
536
|
-
options: import_zod5.z.array(SelectOption).describe("A list of options")
|
537
|
-
|
595
|
+
options: import_zod5.z.array(SelectOption).describe("A list of options"),
|
596
|
+
configuration: import_zod5.z.object({
|
597
|
+
maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
598
|
+
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
599
|
+
}).default({
|
600
|
+
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
601
|
+
})
|
602
|
+
});
|
538
603
|
var Facility = BaseField.extend({
|
539
604
|
type: import_zod5.z.literal(FieldType.FACILITY),
|
540
605
|
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
@@ -547,6 +612,13 @@ var Address = BaseField.extend({
|
|
547
612
|
type: import_zod5.z.literal(FieldType.ADDRESS),
|
548
613
|
defaultValue: AddressFieldValue.optional()
|
549
614
|
}).describe("Address input field \u2013 a combination of location and text fields");
|
615
|
+
var DataField = BaseField.extend({
|
616
|
+
type: import_zod5.z.literal(FieldType.DATA),
|
617
|
+
configuration: import_zod5.z.object({
|
618
|
+
subtitle: TranslationConfig.optional(),
|
619
|
+
data: import_zod5.z.array(import_zod5.z.object({ fieldId: import_zod5.z.string() }))
|
620
|
+
})
|
621
|
+
}).describe("Data field for displaying read-only data");
|
550
622
|
var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
551
623
|
Address,
|
552
624
|
TextField,
|
@@ -568,15 +640,43 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
|
568
640
|
Office,
|
569
641
|
SignatureField,
|
570
642
|
EmailField,
|
571
|
-
FileUploadWithOptions
|
643
|
+
FileUploadWithOptions,
|
644
|
+
DataField
|
572
645
|
]);
|
573
646
|
|
574
647
|
// ../commons/src/events/FormConfig.ts
|
648
|
+
var FormPageType = {
|
649
|
+
FORM: "FORM",
|
650
|
+
VERIFICATION: "VERIFICATION"
|
651
|
+
};
|
575
652
|
var FormPage = import_zod6.z.object({
|
576
653
|
id: import_zod6.z.string().describe("Unique identifier for the page"),
|
577
654
|
title: TranslationConfig.describe("Header title of the page"),
|
578
|
-
fields: import_zod6.z.array(FieldConfig).describe("Fields to be rendered on the page")
|
655
|
+
fields: import_zod6.z.array(FieldConfig).describe("Fields to be rendered on the page"),
|
656
|
+
type: import_zod6.z.literal(FormPageType.FORM).default(FormPageType.FORM)
|
579
657
|
});
|
658
|
+
var VerificationPageConfig = import_zod6.z.object({
|
659
|
+
verify: import_zod6.z.object({ label: TranslationConfig }),
|
660
|
+
cancel: import_zod6.z.object({
|
661
|
+
label: TranslationConfig,
|
662
|
+
confirmation: import_zod6.z.object({
|
663
|
+
title: TranslationConfig,
|
664
|
+
body: TranslationConfig
|
665
|
+
})
|
666
|
+
})
|
667
|
+
}).describe("Actions available on the verification page");
|
668
|
+
var VerificationPage = FormPage.extend({
|
669
|
+
type: import_zod6.z.literal(FormPageType.VERIFICATION),
|
670
|
+
actions: VerificationPageConfig
|
671
|
+
});
|
672
|
+
var FormPageConfig = import_zod6.z.preprocess(
|
673
|
+
(pageConfig) => ({
|
674
|
+
...pageConfig,
|
675
|
+
type: pageConfig.type ?? FormPageType.FORM
|
676
|
+
// Default type to "FORM" if not provided
|
677
|
+
}),
|
678
|
+
import_zod6.z.discriminatedUnion("type", [FormPage, VerificationPage])
|
679
|
+
);
|
580
680
|
var FormConfig = import_zod6.z.object({
|
581
681
|
label: TranslationConfig.describe("Human readable description of the form"),
|
582
682
|
version: import_zod6.z.object({
|
@@ -588,7 +688,7 @@ var FormConfig = import_zod6.z.object({
|
|
588
688
|
)
|
589
689
|
}),
|
590
690
|
active: import_zod6.z.boolean().default(false).describe("Whether the form is active"),
|
591
|
-
pages: import_zod6.z.array(
|
691
|
+
pages: import_zod6.z.array(FormPageConfig),
|
592
692
|
review: import_zod6.z.object({
|
593
693
|
title: TranslationConfig.describe(
|
594
694
|
"Title of the form to show in review page"
|
@@ -617,6 +717,7 @@ var ActionType = {
|
|
617
717
|
MARKED_AS_DUPLICATE: "MARKED_AS_DUPLICATE",
|
618
718
|
ARCHIVE: "ARCHIVE"
|
619
719
|
};
|
720
|
+
var LatentActions = [ActionType.ARCHIVE, ActionType.REJECT];
|
620
721
|
|
621
722
|
// ../commons/src/events/ActionConfig.ts
|
622
723
|
var ActionConditional2 = import_zod7.z.discriminatedUnion("type", [
|
@@ -674,8 +775,8 @@ var PrintCertificateActionConfig = ActionConfigBase.merge(
|
|
674
775
|
var RequestCorrectionConfig = ActionConfigBase.merge(
|
675
776
|
import_zod7.z.object({
|
676
777
|
type: import_zod7.z.literal(ActionType.REQUEST_CORRECTION),
|
677
|
-
onboardingForm: import_zod7.z.array(
|
678
|
-
additionalDetailsForm: import_zod7.z.array(
|
778
|
+
onboardingForm: import_zod7.z.array(FormPageConfig),
|
779
|
+
additionalDetailsForm: import_zod7.z.array(FormPageConfig)
|
679
780
|
})
|
680
781
|
);
|
681
782
|
var RejectCorrectionConfig = ActionConfigBase.merge(
|
@@ -1117,6 +1218,9 @@ function mapFieldTypeToZod(type, required) {
|
|
1117
1218
|
case FieldType.ADDRESS:
|
1118
1219
|
schema = AddressFieldUpdateValue;
|
1119
1220
|
break;
|
1221
|
+
case FieldType.DATA:
|
1222
|
+
schema = DataFieldValue;
|
1223
|
+
break;
|
1120
1224
|
}
|
1121
1225
|
return required ? schema : schema.nullish();
|
1122
1226
|
}
|
@@ -1151,6 +1255,7 @@ function mapFieldTypeToMockValue(field2, i) {
|
|
1151
1255
|
case FieldType.ADDRESS:
|
1152
1256
|
return {
|
1153
1257
|
country: "FAR",
|
1258
|
+
addressType: AddressType.DOMESTIC,
|
1154
1259
|
province: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
1155
1260
|
district: "5ef450bc-712d-48ad-93f3-8da0fa453baa",
|
1156
1261
|
urbanOrRural: "URBAN",
|
@@ -1172,6 +1277,8 @@ function mapFieldTypeToMockValue(field2, i) {
|
|
1172
1277
|
};
|
1173
1278
|
case FieldType.FILE_WITH_OPTIONS:
|
1174
1279
|
return null;
|
1280
|
+
case FieldType.DATA:
|
1281
|
+
return {};
|
1175
1282
|
}
|
1176
1283
|
}
|
1177
1284
|
function mapFieldTypeToEmptyValue(field2) {
|
@@ -1194,10 +1301,12 @@ function mapFieldTypeToEmptyValue(field2) {
|
|
1194
1301
|
case FieldType.EMAIL:
|
1195
1302
|
case FieldType.DATE:
|
1196
1303
|
case FieldType.CHECKBOX:
|
1304
|
+
case FieldType.DATA:
|
1197
1305
|
return null;
|
1198
1306
|
case FieldType.ADDRESS:
|
1199
1307
|
return {
|
1200
1308
|
country: null,
|
1309
|
+
addressType: AddressType.DOMESTIC,
|
1201
1310
|
province: null,
|
1202
1311
|
district: null,
|
1203
1312
|
urbanOrRural: "URBAN",
|
@@ -1281,6 +1390,9 @@ var isFacilityFieldType = (field2) => {
|
|
1281
1390
|
var isOfficeFieldType = (field2) => {
|
1282
1391
|
return field2.config.type === FieldType.OFFICE;
|
1283
1392
|
};
|
1393
|
+
var isDataFieldType = (field2) => {
|
1394
|
+
return field2.config.type === FieldType.DATA;
|
1395
|
+
};
|
1284
1396
|
|
1285
1397
|
// ../commons/src/conditionals/validate.ts
|
1286
1398
|
var ajv = new import_ajv.default({
|
@@ -1375,6 +1487,16 @@ var zodToIntlErrorMap = (issue, _ctx) => {
|
|
1375
1487
|
}
|
1376
1488
|
break;
|
1377
1489
|
}
|
1490
|
+
case "invalid_union": {
|
1491
|
+
for (const { issues } of issue.unionErrors) {
|
1492
|
+
for (const e of issues) {
|
1493
|
+
if (zodToIntlErrorMap(e, _ctx).message.message.id !== "v2.error.required") {
|
1494
|
+
return createIntlError(errorMessages.invalidInput);
|
1495
|
+
}
|
1496
|
+
}
|
1497
|
+
}
|
1498
|
+
return createIntlError(errorMessages.requiredField);
|
1499
|
+
}
|
1378
1500
|
}
|
1379
1501
|
return createIntlError(errorMessages.invalidInput);
|
1380
1502
|
};
|
@@ -1552,6 +1674,9 @@ var getActiveActionFormPages = (configuration, action) => {
|
|
1552
1674
|
);
|
1553
1675
|
};
|
1554
1676
|
function getActiveActionFields(configuration, action) {
|
1677
|
+
if (LatentActions.some((latentAction) => latentAction === action)) {
|
1678
|
+
return getActiveActionFields(configuration, ActionType.DECLARE);
|
1679
|
+
}
|
1555
1680
|
const fields = findActiveActionFields(configuration, action);
|
1556
1681
|
if (!fields) {
|
1557
1682
|
throw new Error(`No active field config found for action type ${action}`);
|
@@ -1604,6 +1729,13 @@ function createEmptyDraft(eventId, draftId, actionType) {
|
|
1604
1729
|
}
|
1605
1730
|
};
|
1606
1731
|
}
|
1732
|
+
function findActiveActionVerificationPageIds(configuration, action) {
|
1733
|
+
const pages = findActiveActionFormPages(configuration, action);
|
1734
|
+
if (!pages) {
|
1735
|
+
return [];
|
1736
|
+
}
|
1737
|
+
return pages.filter((page) => page.type === FormPageType.VERIFICATION).map((page) => page.id);
|
1738
|
+
}
|
1607
1739
|
|
1608
1740
|
// ../commons/src/events/EventConfig.ts
|
1609
1741
|
var EventConfig = import_zod18.z.object({
|
@@ -1645,7 +1777,7 @@ var EventConfig = import_zod18.z.object({
|
|
1645
1777
|
|
1646
1778
|
// ../commons/src/events/EventConfigInput.ts
|
1647
1779
|
var defineForm = (form) => FormConfig.parse(form);
|
1648
|
-
var defineFormPage = (formPage) =>
|
1780
|
+
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
1649
1781
|
|
1650
1782
|
// ../commons/src/events/Draft.ts
|
1651
1783
|
var import_zod21 = require("zod");
|
@@ -2315,6 +2447,23 @@ function field(fieldId) {
|
|
2315
2447
|
}
|
2316
2448
|
},
|
2317
2449
|
required: ["$form"]
|
2450
|
+
}),
|
2451
|
+
isValidEnglishName: () => defineConditional({
|
2452
|
+
type: "object",
|
2453
|
+
properties: {
|
2454
|
+
$form: {
|
2455
|
+
type: "object",
|
2456
|
+
properties: {
|
2457
|
+
[fieldId]: {
|
2458
|
+
type: "string",
|
2459
|
+
pattern: "^[\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*( [\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*)*$",
|
2460
|
+
description: "Name must contain only letters, numbers, and allowed special characters ('._-). No double spaces."
|
2461
|
+
}
|
2462
|
+
},
|
2463
|
+
required: [fieldId]
|
2464
|
+
}
|
2465
|
+
},
|
2466
|
+
required: ["$form"]
|
2318
2467
|
})
|
2319
2468
|
};
|
2320
2469
|
}
|
@@ -2941,6 +3090,44 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2941
3090
|
type: "FILE"
|
2942
3091
|
}
|
2943
3092
|
]
|
3093
|
+
},
|
3094
|
+
{
|
3095
|
+
id: "collector.identity.verify",
|
3096
|
+
type: FormPageType.VERIFICATION,
|
3097
|
+
title: {
|
3098
|
+
id: "event.tennis-club-membership.action.print.verifyIdentity",
|
3099
|
+
defaultMessage: "Verify their identity",
|
3100
|
+
description: "This is the title of the section"
|
3101
|
+
},
|
3102
|
+
fields: [],
|
3103
|
+
actions: {
|
3104
|
+
verify: {
|
3105
|
+
label: {
|
3106
|
+
defaultMessage: "Verified",
|
3107
|
+
description: "This is the label for the verification button",
|
3108
|
+
id: "v2.event.tennis-club-membership.action.certificate.form.verify"
|
3109
|
+
}
|
3110
|
+
},
|
3111
|
+
cancel: {
|
3112
|
+
label: {
|
3113
|
+
defaultMessage: "Identity does not match",
|
3114
|
+
description: "This is the label for the verification cancellation button",
|
3115
|
+
id: "v2.event.tennis-club-membership.action.certificate.form.cancel"
|
3116
|
+
},
|
3117
|
+
confirmation: {
|
3118
|
+
title: {
|
3119
|
+
defaultMessage: "Print without proof of ID?",
|
3120
|
+
description: "This is the title for the verification cancellation modal",
|
3121
|
+
id: "v2.event.tennis-club-membership.action.certificate.form.cancel.confirmation.title"
|
3122
|
+
},
|
3123
|
+
body: {
|
3124
|
+
defaultMessage: "Please be aware that if you proceed, you will be responsible for issuing a certificate without the necessary proof of ID from the collector",
|
3125
|
+
description: "This is the body for the verification cancellation modal",
|
3126
|
+
id: "v2.event.tennis-club-membership.action.certificate.form.cancel.confirmation.body"
|
3127
|
+
}
|
3128
|
+
}
|
3129
|
+
}
|
3130
|
+
}
|
2944
3131
|
}
|
2945
3132
|
],
|
2946
3133
|
review: {
|
@@ -3566,6 +3753,19 @@ function generateActionInput(configuration, action) {
|
|
3566
3753
|
);
|
3567
3754
|
return stripHiddenFields(fields, data);
|
3568
3755
|
}
|
3756
|
+
function generateActionMetadataInput(configuration, action) {
|
3757
|
+
const verificationPageIds = findActiveActionVerificationPageIds(
|
3758
|
+
configuration,
|
3759
|
+
action
|
3760
|
+
);
|
3761
|
+
return verificationPageIds.reduce(
|
3762
|
+
(acc, pageId) => ({
|
3763
|
+
...acc,
|
3764
|
+
[pageId]: true
|
3765
|
+
}),
|
3766
|
+
{}
|
3767
|
+
);
|
3768
|
+
}
|
3569
3769
|
var eventPayloadGenerator = {
|
3570
3770
|
create: (input = {}) => ({
|
3571
3771
|
transactionId: input.transactionId ?? getUUID(),
|
@@ -3643,6 +3843,10 @@ var eventPayloadGenerator = {
|
|
3643
3843
|
tennisClubMembershipEvent,
|
3644
3844
|
ActionType.PRINT_CERTIFICATE
|
3645
3845
|
),
|
3846
|
+
metadata: input.metadata ?? generateActionMetadataInput(
|
3847
|
+
tennisClubMembershipEvent,
|
3848
|
+
ActionType.PRINT_CERTIFICATE
|
3849
|
+
),
|
3646
3850
|
eventId
|
3647
3851
|
}),
|
3648
3852
|
correction: {
|
@@ -3788,6 +3992,11 @@ var eventQueryDataGenerator = (overrides = {}) => ({
|
|
3788
3992
|
},
|
3789
3993
|
trackingId: overrides.trackingId ?? "M3F8YQ"
|
3790
3994
|
});
|
3995
|
+
var generateTranslationConfig = (message) => ({
|
3996
|
+
defaultMessage: message,
|
3997
|
+
description: "Description for ${message}",
|
3998
|
+
id: message
|
3999
|
+
});
|
3791
4000
|
|
3792
4001
|
// ../commons/src/events/TemplateConfig.ts
|
3793
4002
|
function isTemplateVariable(value) {
|