@opencrvs/toolkit 1.8.0-rc.f466807 → 1.8.0-rc.f7e8fb5

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.
@@ -51,7 +51,6 @@ __export(events_exports, {
51
51
  Clause: () => Clause,
52
52
  Conditional: () => Conditional,
53
53
  ConditionalType: () => ConditionalType,
54
- DataFieldValue: () => DataFieldValue,
55
54
  DateValue: () => DateValue,
56
55
  DeclareActionInput: () => DeclareActionInput,
57
56
  DeduplicationConfig: () => DeduplicationConfig,
@@ -77,13 +76,11 @@ __export(events_exports, {
77
76
  FileFieldWithOptionValue: () => FileFieldWithOptionValue,
78
77
  FormConfig: () => FormConfig,
79
78
  FormPage: () => FormPage,
80
- FormPageType: () => FormPageType,
81
79
  GeographicalArea: () => GeographicalArea,
82
80
  LanguageConfig: () => LanguageConfig,
83
81
  MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
84
82
  NotifyActionInput: () => NotifyActionInput,
85
83
  NumberFieldValue: () => NumberFieldValue,
86
- PageConfig: () => PageConfig,
87
84
  PrintCertificateActionInput: () => PrintCertificateActionInput,
88
85
  RegisterActionInput: () => RegisterActionInput,
89
86
  RejectCorrectionActionInput: () => RejectCorrectionActionInput,
@@ -100,8 +97,6 @@ __export(events_exports, {
100
97
  UrbanAddressUpdateValue: () => UrbanAddressUpdateValue,
101
98
  UrbanAddressValue: () => UrbanAddressValue,
102
99
  ValidateActionInput: () => ValidateActionInput,
103
- VerificationPage: () => VerificationPage,
104
- VerificationPageConfig: () => VerificationPageConfig,
105
100
  WorkqueueConfig: () => WorkqueueConfig,
106
101
  alwaysTrue: () => alwaysTrue,
107
102
  and: () => and,
@@ -113,8 +108,7 @@ __export(events_exports, {
113
108
  defineConditional: () => defineConditional,
114
109
  defineConfig: () => defineConfig,
115
110
  defineForm: () => defineForm,
116
- definePage: () => definePage,
117
- errorMessages: () => errorMessages,
111
+ defineFormPage: () => defineFormPage,
118
112
  event: () => event,
119
113
  eventMetadataLabelMap: () => eventMetadataLabelMap,
120
114
  eventPayloadGenerator: () => eventPayloadGenerator,
@@ -126,13 +120,11 @@ __export(events_exports, {
126
120
  findActiveActionForm: () => findActiveActionForm,
127
121
  findActiveActionFormFields: () => findActiveActionFormFields,
128
122
  findActiveActionFormPages: () => findActiveActionFormPages,
129
- findActiveActionVerificationPageIds: () => findActiveActionVerificationPageIds,
130
123
  findActiveDrafts: () => findActiveDrafts,
131
124
  findInputPageFields: () => findInputPageFields,
132
125
  findPageFields: () => findPageFields,
133
126
  generateActionDocument: () => generateActionDocument,
134
127
  generateActionInput: () => generateActionInput,
135
- generateActionMetadataInput: () => generateActionMetadataInput,
136
128
  generateEventDocument: () => generateEventDocument,
137
129
  generateEventDraftDocument: () => generateEventDraftDocument,
138
130
  generateTransactionId: () => generateTransactionId,
@@ -151,7 +143,6 @@ __export(events_exports, {
151
143
  isBulletListFieldType: () => isBulletListFieldType,
152
144
  isCheckboxFieldType: () => isCheckboxFieldType,
153
145
  isCountryFieldType: () => isCountryFieldType,
154
- isDataFieldType: () => isDataFieldType,
155
146
  isDateFieldType: () => isDateFieldType,
156
147
  isDividerFieldType: () => isDividerFieldType,
157
148
  isEmailFieldType: () => isEmailFieldType,
@@ -175,7 +166,6 @@ __export(events_exports, {
175
166
  isTextAreaFieldType: () => isTextAreaFieldType,
176
167
  isTextFieldType: () => isTextFieldType,
177
168
  isUndeclaredDraft: () => isUndeclaredDraft,
178
- mapFieldTypeToEmptyValue: () => mapFieldTypeToEmptyValue,
179
169
  mapFieldTypeToMockValue: () => mapFieldTypeToMockValue,
180
170
  mapFieldTypeToZod: () => mapFieldTypeToZod,
181
171
  not: () => not,
@@ -259,8 +249,7 @@ var FieldType = {
259
249
  ADMINISTRATIVE_AREA: "ADMINISTRATIVE_AREA",
260
250
  FACILITY: "FACILITY",
261
251
  OFFICE: "OFFICE",
262
- SIGNATURE: "SIGNATURE",
263
- DATA: "DATA"
252
+ SIGNATURE: "SIGNATURE"
264
253
  };
265
254
  var fieldTypes = Object.values(FieldType);
266
255
  var compositeFieldTypes = [
@@ -335,7 +324,6 @@ var DateValue = import_zod4.z.string().date().describe("Date in the format YYYY-
335
324
  var EmailValue = import_zod4.z.string().email();
336
325
  var CheckboxFieldValue = import_zod4.z.boolean();
337
326
  var NumberFieldValue = import_zod4.z.number();
338
- var DataFieldValue = import_zod4.z.undefined();
339
327
  var FieldValue = import_zod4.z.union([
340
328
  TextValue,
341
329
  DateValue,
@@ -344,8 +332,7 @@ var FieldValue = import_zod4.z.union([
344
332
  FileFieldValue,
345
333
  FileFieldWithOptionValue,
346
334
  UrbanAddressValue,
347
- RuralAddressValue,
348
- DataFieldValue
335
+ RuralAddressValue
349
336
  ]);
350
337
  var FieldUpdateValue = import_zod4.z.union([
351
338
  TextValue,
@@ -355,8 +342,7 @@ var FieldUpdateValue = import_zod4.z.union([
355
342
  FileFieldValue,
356
343
  FileFieldWithOptionValue,
357
344
  UrbanAddressUpdateValue,
358
- RuralAddressUpdateValue,
359
- DataFieldValue
345
+ RuralAddressUpdateValue
360
346
  ]);
361
347
 
362
348
  // ../commons/src/events/FieldConfig.ts
@@ -559,13 +545,6 @@ var Address = BaseField.extend({
559
545
  type: import_zod5.z.literal(FieldType.ADDRESS),
560
546
  defaultValue: AddressFieldValue.optional()
561
547
  }).describe("Address input field \u2013 a combination of location and text fields");
562
- var DataField = BaseField.extend({
563
- type: import_zod5.z.literal(FieldType.DATA),
564
- configuration: import_zod5.z.object({
565
- subtitle: TranslationConfig.optional(),
566
- data: import_zod5.z.array(import_zod5.z.object({ fieldId: import_zod5.z.string() }))
567
- })
568
- }).describe("Data field for displaying read-only data");
569
548
  var FieldConfig = import_zod5.z.discriminatedUnion("type", [
570
549
  Address,
571
550
  TextField,
@@ -587,43 +566,15 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
587
566
  Office,
588
567
  SignatureField,
589
568
  EmailField,
590
- FileUploadWithOptions,
591
- DataField
569
+ FileUploadWithOptions
592
570
  ]);
593
571
 
594
572
  // ../commons/src/events/FormConfig.ts
595
- var FormPageType = {
596
- FORM: "FORM",
597
- VERIFICATION: "VERIFICATION"
598
- };
599
573
  var FormPage = import_zod6.z.object({
600
574
  id: import_zod6.z.string().describe("Unique identifier for the page"),
601
575
  title: TranslationConfig.describe("Header title of the page"),
602
- fields: import_zod6.z.array(FieldConfig).describe("Fields to be rendered on the page"),
603
- type: import_zod6.z.literal(FormPageType.FORM).default(FormPageType.FORM)
604
- });
605
- var VerificationPageConfig = import_zod6.z.object({
606
- verify: import_zod6.z.object({ label: TranslationConfig }),
607
- cancel: import_zod6.z.object({
608
- label: TranslationConfig,
609
- confirmation: import_zod6.z.object({
610
- title: TranslationConfig,
611
- body: TranslationConfig
612
- })
613
- })
614
- }).describe("Actions available on the verification page");
615
- var VerificationPage = FormPage.extend({
616
- type: import_zod6.z.literal(FormPageType.VERIFICATION),
617
- actions: VerificationPageConfig
576
+ fields: import_zod6.z.array(FieldConfig).describe("Fields to be rendered on the page")
618
577
  });
619
- var PageConfig = import_zod6.z.preprocess(
620
- (pageConfig) => ({
621
- ...pageConfig,
622
- type: pageConfig.type ?? FormPageType.FORM
623
- // Default type to "FORM" if not provided
624
- }),
625
- import_zod6.z.discriminatedUnion("type", [FormPage, VerificationPage])
626
- );
627
578
  var FormConfig = import_zod6.z.object({
628
579
  label: TranslationConfig.describe("Human readable description of the form"),
629
580
  version: import_zod6.z.object({
@@ -635,7 +586,7 @@ var FormConfig = import_zod6.z.object({
635
586
  )
636
587
  }),
637
588
  active: import_zod6.z.boolean().default(false).describe("Whether the form is active"),
638
- pages: import_zod6.z.array(PageConfig),
589
+ pages: import_zod6.z.array(FormPage),
639
590
  review: import_zod6.z.object({
640
591
  title: TranslationConfig.describe(
641
592
  "Title of the form to show in review page"
@@ -721,8 +672,8 @@ var PrintCertificateActionConfig = ActionConfigBase.merge(
721
672
  var RequestCorrectionConfig = ActionConfigBase.merge(
722
673
  import_zod7.z.object({
723
674
  type: import_zod7.z.literal(ActionType.REQUEST_CORRECTION),
724
- onboardingForm: import_zod7.z.array(PageConfig),
725
- additionalDetailsForm: import_zod7.z.array(PageConfig)
675
+ onboardingForm: import_zod7.z.array(FormPage),
676
+ additionalDetailsForm: import_zod7.z.array(FormPage)
726
677
  })
727
678
  );
728
679
  var RejectCorrectionConfig = ActionConfigBase.merge(
@@ -1164,9 +1115,6 @@ function mapFieldTypeToZod(type, required) {
1164
1115
  case FieldType.ADDRESS:
1165
1116
  schema = AddressFieldUpdateValue;
1166
1117
  break;
1167
- case FieldType.DATA:
1168
- schema = DataFieldValue;
1169
- break;
1170
1118
  }
1171
1119
  return required ? schema : schema.nullish();
1172
1120
  }
@@ -1222,53 +1170,6 @@ function mapFieldTypeToMockValue(field2, i) {
1222
1170
  };
1223
1171
  case FieldType.FILE_WITH_OPTIONS:
1224
1172
  return null;
1225
- case FieldType.DATA:
1226
- return {};
1227
- }
1228
- }
1229
- function mapFieldTypeToEmptyValue(field2) {
1230
- switch (field2.type) {
1231
- case FieldType.DIVIDER:
1232
- case FieldType.TEXT:
1233
- case FieldType.TEXTAREA:
1234
- case FieldType.BULLET_LIST:
1235
- case FieldType.PAGE_HEADER:
1236
- case FieldType.LOCATION:
1237
- case FieldType.SELECT:
1238
- case FieldType.COUNTRY:
1239
- case FieldType.RADIO_GROUP:
1240
- case FieldType.SIGNATURE:
1241
- case FieldType.PARAGRAPH:
1242
- case FieldType.ADMINISTRATIVE_AREA:
1243
- case FieldType.FACILITY:
1244
- case FieldType.OFFICE:
1245
- case FieldType.NUMBER:
1246
- case FieldType.EMAIL:
1247
- case FieldType.DATE:
1248
- case FieldType.CHECKBOX:
1249
- case FieldType.DATA:
1250
- return null;
1251
- case FieldType.ADDRESS:
1252
- return {
1253
- country: null,
1254
- province: null,
1255
- district: null,
1256
- urbanOrRural: "URBAN",
1257
- // Default to urban needed for validation
1258
- town: null,
1259
- residentialArea: null,
1260
- street: null,
1261
- number: null,
1262
- zipCode: null
1263
- };
1264
- case FieldType.FILE:
1265
- return {
1266
- filename: "",
1267
- originalFilename: "",
1268
- type: ""
1269
- };
1270
- case FieldType.FILE_WITH_OPTIONS:
1271
- return [];
1272
1173
  }
1273
1174
  }
1274
1175
  var isParagraphFieldType = (field2) => {
@@ -1334,9 +1235,6 @@ var isFacilityFieldType = (field2) => {
1334
1235
  var isOfficeFieldType = (field2) => {
1335
1236
  return field2.config.type === FieldType.OFFICE;
1336
1237
  };
1337
- var isDataFieldType = (field2) => {
1338
- return field2.config.type === FieldType.DATA;
1339
- };
1340
1238
 
1341
1239
  // ../commons/src/conditionals/validate.ts
1342
1240
  var ajv = new import_ajv.default({
@@ -1373,66 +1271,49 @@ function isFieldVisible(field2, form) {
1373
1271
  function isFieldEnabled(field2, form) {
1374
1272
  return isFieldConditionMet(field2, form, ConditionalType.ENABLE);
1375
1273
  }
1376
- var errorMessages = {
1377
- hiddenField: {
1378
- id: "v2.error.hidden",
1379
- defaultMessage: "Hidden or disabled field should not receive a value",
1380
- description: "Error message when field is hidden or disabled, but a value was received"
1381
- },
1382
- invalidDate: {
1383
- defaultMessage: "Invalid date field",
1384
- description: "Error message when date field is invalid",
1385
- id: "v2.error.invalidDate"
1386
- },
1387
- invalidEmail: {
1388
- defaultMessage: "Invalid email address",
1389
- description: "Error message when email address is invalid",
1390
- id: "v2.error.invalidEmail"
1391
- },
1392
- requiredField: {
1393
- defaultMessage: "Required for registration",
1394
- description: "Error message when required field is missing",
1395
- id: "v2.error.required"
1396
- },
1397
- invalidInput: {
1398
- defaultMessage: "Invalid input",
1399
- description: "Error message when generic field is invalid",
1400
- id: "v2.error.invalid"
1401
- }
1402
- };
1403
- var createIntlError = (message) => ({
1404
- message: {
1405
- message
1406
- }
1407
- });
1408
1274
  var zodToIntlErrorMap = (issue, _ctx) => {
1409
- switch (issue.code) {
1410
- case "invalid_string": {
1411
- if (_ctx.data === "") {
1412
- return createIntlError(errorMessages.requiredField);
1413
- }
1414
- if (issue.validation === "date") {
1415
- return createIntlError(errorMessages.invalidDate);
1275
+ if (issue.code === "invalid_string" && issue.validation === "date") {
1276
+ return {
1277
+ message: {
1278
+ message: {
1279
+ defaultMessage: "Invalid date. Please use the format YYYY-MM-DD",
1280
+ description: "This is the error message for invalid date fields",
1281
+ id: "v2.error.invalidDate"
1282
+ }
1416
1283
  }
1417
- if (issue.validation === "email") {
1418
- return createIntlError(errorMessages.invalidEmail);
1284
+ };
1285
+ }
1286
+ if (issue.code === "invalid_string" && issue.validation === "email") {
1287
+ return {
1288
+ message: {
1289
+ message: {
1290
+ defaultMessage: "Invalid email address",
1291
+ description: "This is the error message for invalid email fields",
1292
+ id: "v2.error.invalidEmail"
1293
+ }
1419
1294
  }
1420
- break;
1421
- }
1422
- case "invalid_type": {
1423
- if (issue.expected !== issue.received && issue.received === "undefined") {
1424
- return createIntlError(errorMessages.requiredField);
1295
+ };
1296
+ }
1297
+ if (issue.code === "invalid_type" && issue.expected !== issue.received && issue.received === "undefined" || issue.code === "too_small" && issue.message === void 0) {
1298
+ return {
1299
+ message: {
1300
+ message: {
1301
+ defaultMessage: "Required for registration",
1302
+ description: "This is the error message for required fields",
1303
+ id: "v2.error.required"
1304
+ }
1425
1305
  }
1426
- break;
1427
- }
1428
- case "too_small": {
1429
- if (issue.message === void 0) {
1430
- return createIntlError(errorMessages.requiredField);
1306
+ };
1307
+ }
1308
+ return {
1309
+ message: {
1310
+ message: {
1311
+ defaultMessage: "Invalid input",
1312
+ description: "This is the error message for invalid field value",
1313
+ id: "v2.error.invalid"
1431
1314
  }
1432
- break;
1433
1315
  }
1434
- }
1435
- return createIntlError(errorMessages.invalidInput);
1316
+ };
1436
1317
  };
1437
1318
  function getFieldValidationErrors({
1438
1319
  field: field2,
@@ -1447,7 +1328,11 @@ function getFieldValidationErrors({
1447
1328
  return {
1448
1329
  errors: [
1449
1330
  {
1450
- message: errorMessages.hiddenField
1331
+ message: {
1332
+ id: "v2.error.hidden",
1333
+ defaultMessage: "Hidden or disabled field should not receive a value",
1334
+ description: "Error message when field is hidden or disabled, but a value was received"
1335
+ }
1451
1336
  }
1452
1337
  ]
1453
1338
  };
@@ -1465,8 +1350,8 @@ function getFieldValidationErrors({
1465
1350
  conditionalParameters
1466
1351
  });
1467
1352
  return {
1468
- // Assumes that custom validation errors are based on the field type, and extend the validation.
1469
- errors: [...fieldValidationResult, ...customValidationResults]
1353
+ // Assumes that custom validation errors are more important than field validation errors
1354
+ errors: [...customValidationResults, ...fieldValidationResult]
1470
1355
  };
1471
1356
  }
1472
1357
  function runCustomFieldValidations({
@@ -1574,7 +1459,7 @@ function validateWorkqueueConfig(workqueueConfigs) {
1574
1459
  );
1575
1460
  if (!rootWorkqueue) {
1576
1461
  throw new Error(
1577
- `Invalid workqueue configuration: workqueue not found with id: ${workqueue.id}`
1462
+ `Invalid workqueue configuration: workqueue not found with id: ${workqueue.id}`
1578
1463
  );
1579
1464
  }
1580
1465
  });
@@ -1660,13 +1545,6 @@ function createEmptyDraft(eventId, draftId, actionType) {
1660
1545
  }
1661
1546
  };
1662
1547
  }
1663
- function findActiveActionVerificationPageIds(configuration, action) {
1664
- const pages = findActiveActionFormPages(configuration, action);
1665
- if (!pages) {
1666
- return [];
1667
- }
1668
- return pages.filter((page) => page.type === FormPageType.VERIFICATION).map((page) => page.id);
1669
- }
1670
1548
 
1671
1549
  // ../commons/src/events/EventConfig.ts
1672
1550
  var EventConfig = import_zod18.z.object({
@@ -1708,7 +1586,7 @@ var EventConfig = import_zod18.z.object({
1708
1586
 
1709
1587
  // ../commons/src/events/EventConfigInput.ts
1710
1588
  var defineForm = (form) => FormConfig.parse(form);
1711
- var definePage = (formPage) => PageConfig.parse(formPage);
1589
+ var defineFormPage = (formPage) => FormPage.parse(formPage);
1712
1590
 
1713
1591
  // ../commons/src/events/Draft.ts
1714
1592
  var import_zod21 = require("zod");
@@ -3004,270 +2882,6 @@ var PRINT_CERTIFICATE_FORM = defineForm({
3004
2882
  type: "FILE"
3005
2883
  }
3006
2884
  ]
3007
- },
3008
- {
3009
- id: "collector.identity.verify",
3010
- type: FormPageType.VERIFICATION,
3011
- title: {
3012
- id: "event.birth.action.print.verifyIdentity",
3013
- defaultMessage: "Verify their identity",
3014
- description: "This is the title of the section"
3015
- },
3016
- fields: [
3017
- {
3018
- id: "collector.identity.verify.data.mother",
3019
- conditionals: [
3020
- {
3021
- type: ConditionalType.SHOW,
3022
- conditional: defineConditional({
3023
- type: "object",
3024
- properties: {
3025
- $form: {
3026
- type: "object",
3027
- properties: {
3028
- "informant.relation": {
3029
- oneOf: [
3030
- {
3031
- type: "string",
3032
- const: "MOTHER"
3033
- },
3034
- {
3035
- type: "boolean",
3036
- const: "MOTHER"
3037
- }
3038
- ],
3039
- const: "MOTHER"
3040
- }
3041
- },
3042
- required: ["informant.relation"]
3043
- }
3044
- },
3045
- required: ["$form"]
3046
- })
3047
- }
3048
- ],
3049
- label: {
3050
- id: "v2.event.birth.action.certificate.form.section.verifyIdentity.data.label",
3051
- defaultMessage: "",
3052
- description: "Title for the data section"
3053
- },
3054
- type: FieldType.DATA,
3055
- configuration: {
3056
- data: [
3057
- {
3058
- fieldId: "mother.idType"
3059
- },
3060
- {
3061
- fieldId: "mother.nid"
3062
- },
3063
- {
3064
- fieldId: "mother.firstname"
3065
- },
3066
- {
3067
- fieldId: "mother.surname"
3068
- },
3069
- {
3070
- fieldId: "mother.dob"
3071
- },
3072
- {
3073
- fieldId: "mother.nationality"
3074
- }
3075
- ]
3076
- }
3077
- },
3078
- {
3079
- id: "collector.identity.verify.data.father",
3080
- conditionals: [
3081
- {
3082
- type: ConditionalType.SHOW,
3083
- conditional: defineConditional({
3084
- type: "object",
3085
- properties: {
3086
- $form: {
3087
- type: "object",
3088
- properties: {
3089
- "informant.relation": {
3090
- oneOf: [
3091
- {
3092
- type: "string",
3093
- const: "FATHER"
3094
- },
3095
- {
3096
- type: "boolean",
3097
- const: "FATHER"
3098
- }
3099
- ],
3100
- const: "FATHER"
3101
- }
3102
- },
3103
- required: ["informant.relation"]
3104
- }
3105
- },
3106
- required: ["$form"]
3107
- })
3108
- }
3109
- ],
3110
- label: {
3111
- id: "v2.event.birth.action.certificate.form.section.verifyIdentity.data.label",
3112
- defaultMessage: "",
3113
- description: "Title for the data section"
3114
- },
3115
- type: FieldType.DATA,
3116
- configuration: {
3117
- data: [
3118
- {
3119
- fieldId: "father.idType"
3120
- },
3121
- {
3122
- fieldId: "father.nid"
3123
- },
3124
- {
3125
- fieldId: "father.firstname"
3126
- },
3127
- {
3128
- fieldId: "father.surname"
3129
- },
3130
- {
3131
- fieldId: "father.dob"
3132
- },
3133
- {
3134
- fieldId: "father.nationality"
3135
- }
3136
- ]
3137
- }
3138
- },
3139
- {
3140
- id: "collector.identity.verify.data.other",
3141
- conditionals: [
3142
- {
3143
- type: ConditionalType.SHOW,
3144
- conditional: defineConditional({
3145
- type: "object",
3146
- allOf: [
3147
- {
3148
- type: "object",
3149
- not: {
3150
- type: "object",
3151
- properties: {
3152
- $form: {
3153
- type: "object",
3154
- properties: {
3155
- "informant.relation": {
3156
- type: "string",
3157
- enum: ["MOTHER", "FATHER"]
3158
- }
3159
- },
3160
- required: ["informant.relation"]
3161
- }
3162
- },
3163
- required: ["$form"]
3164
- },
3165
- required: []
3166
- },
3167
- {
3168
- type: "object",
3169
- not: {
3170
- type: "object",
3171
- properties: {
3172
- $form: {
3173
- type: "object",
3174
- properties: {
3175
- "informant.relation": {
3176
- anyOf: [
3177
- {
3178
- const: "undefined"
3179
- },
3180
- {
3181
- const: false
3182
- },
3183
- {
3184
- const: null
3185
- },
3186
- {
3187
- const: ""
3188
- }
3189
- ]
3190
- }
3191
- },
3192
- anyOf: [
3193
- {
3194
- required: ["informant.relation"]
3195
- },
3196
- {
3197
- not: {
3198
- required: ["informant.relation"]
3199
- }
3200
- }
3201
- ]
3202
- }
3203
- },
3204
- required: ["$form"]
3205
- },
3206
- required: []
3207
- }
3208
- ],
3209
- required: []
3210
- })
3211
- }
3212
- ],
3213
- label: {
3214
- id: "v2.event.birth.action.certificate.form.section.verifyIdentity.data.label",
3215
- defaultMessage: "",
3216
- description: "Title for the data section"
3217
- },
3218
- type: FieldType.DATA,
3219
- configuration: {
3220
- data: [
3221
- {
3222
- fieldId: "informant.idType"
3223
- },
3224
- {
3225
- fieldId: "informant.nid"
3226
- },
3227
- {
3228
- fieldId: "informant.firstname"
3229
- },
3230
- {
3231
- fieldId: "informant.surname"
3232
- },
3233
- {
3234
- fieldId: "informant.dob"
3235
- },
3236
- {
3237
- fieldId: "informant.nationality"
3238
- }
3239
- ]
3240
- }
3241
- }
3242
- ],
3243
- actions: {
3244
- verify: {
3245
- label: {
3246
- id: "v2.event.birth.action.certificate.form.verify",
3247
- defaultMessage: "Verified",
3248
- description: "This is the label for the verification button"
3249
- }
3250
- },
3251
- cancel: {
3252
- label: {
3253
- id: "v2.event.birth.action.certificate.form.cancel",
3254
- defaultMessage: "Identity does not match",
3255
- description: "This is the label for the verification cancellation button"
3256
- },
3257
- confirmation: {
3258
- title: {
3259
- id: "v2.event.birth.action.certificate.form.cancel.confirmation.title",
3260
- defaultMessage: "Print without proof of ID?",
3261
- description: "This is the title for the verification cancellation modal"
3262
- },
3263
- body: {
3264
- id: "v2.event.birth.action.certificate.form.cancel.confirmation.body",
3265
- 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",
3266
- description: "This is the body for the verification cancellation modal"
3267
- }
3268
- }
3269
- }
3270
- }
3271
2885
  }
3272
2886
  ],
3273
2887
  review: {
@@ -3893,19 +3507,6 @@ function generateActionInput(configuration, action) {
3893
3507
  );
3894
3508
  return stripHiddenFields(fields, data);
3895
3509
  }
3896
- function generateActionMetadataInput(configuration, action) {
3897
- const verificationPageIds = findActiveActionVerificationPageIds(
3898
- configuration,
3899
- action
3900
- );
3901
- return verificationPageIds.reduce(
3902
- (acc, pageId) => ({
3903
- ...acc,
3904
- [pageId]: true
3905
- }),
3906
- {}
3907
- );
3908
- }
3909
3510
  var eventPayloadGenerator = {
3910
3511
  create: (input = {}) => ({
3911
3512
  transactionId: input.transactionId ?? getUUID(),
@@ -3958,7 +3559,7 @@ var eventPayloadGenerator = {
3958
3559
  archive: (eventId, input = {}, isDuplicate) => ({
3959
3560
  type: ActionType.ARCHIVE,
3960
3561
  transactionId: input.transactionId ?? getUUID(),
3961
- data: input.data ?? generateActionInput(tennisClubMembershipEvent, ActionType.ARCHIVE),
3562
+ data: input.data ?? {},
3962
3563
  metadata: { isDuplicate: isDuplicate ?? false },
3963
3564
  duplicates: [],
3964
3565
  eventId
@@ -3966,7 +3567,7 @@ var eventPayloadGenerator = {
3966
3567
  reject: (eventId, input = {}) => ({
3967
3568
  type: ActionType.REJECT,
3968
3569
  transactionId: input.transactionId ?? getUUID(),
3969
- data: input.data ?? generateActionInput(tennisClubMembershipEvent, ActionType.REJECT),
3570
+ data: input.data ?? {},
3970
3571
  duplicates: [],
3971
3572
  eventId
3972
3573
  }),
@@ -3983,10 +3584,6 @@ var eventPayloadGenerator = {
3983
3584
  tennisClubMembershipEvent,
3984
3585
  ActionType.PRINT_CERTIFICATE
3985
3586
  ),
3986
- metadata: input.metadata ?? generateActionMetadataInput(
3987
- tennisClubMembershipEvent,
3988
- ActionType.PRINT_CERTIFICATE
3989
- ),
3990
3587
  eventId
3991
3588
  }),
3992
3589
  correction: {
@@ -4029,8 +3626,6 @@ function generateActionDocument({
4029
3626
  defaults = {}
4030
3627
  }) {
4031
3628
  const actionBase = {
4032
- // Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
4033
- // @TODO: This should be fixed in the future.
4034
3629
  createdAt: new Date(Date.now() - 500).toISOString(),
4035
3630
  createdBy: getUUID(),
4036
3631
  id: getUUID(),
@@ -4086,12 +3681,8 @@ function generateEventDocument({
4086
3681
  actions: actions.map(
4087
3682
  (action) => generateActionDocument({ configuration, action })
4088
3683
  ),
4089
- // Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
4090
- // @TODO: This should be fixed in the future.
4091
3684
  createdAt: new Date(Date.now() - 1e3).toISOString(),
4092
3685
  id: getUUID(),
4093
- // Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
4094
- // @TODO: This should be fixed in the future.
4095
3686
  updatedAt: new Date(Date.now() - 1e3).toISOString()
4096
3687
  };
4097
3688
  }