@opencrvs/toolkit 1.8.1-rc.cacd557 → 1.8.1-rc.d3d858d

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.
Files changed (31) hide show
  1. package/dist/commons/api/router.d.ts +391 -392
  2. package/dist/commons/conditionals/validate.d.ts +11 -2
  3. package/dist/commons/events/ActionConfig.d.ts +2004 -366
  4. package/dist/commons/events/ActionDocument.d.ts +736 -736
  5. package/dist/commons/events/ActionInput.d.ts +600 -600
  6. package/dist/commons/events/AdvancedSearchConfig.d.ts +49 -31
  7. package/dist/commons/events/CompositeFieldValue.d.ts +6 -6
  8. package/dist/commons/events/CountryConfigQueryInput.d.ts +88 -88
  9. package/dist/commons/events/Draft.d.ts +48 -48
  10. package/dist/commons/events/EventConfig.d.ts +673 -146
  11. package/dist/commons/events/EventDocument.d.ts +432 -432
  12. package/dist/commons/events/EventIndex.d.ts +62 -62
  13. package/dist/commons/events/EventMetadata.d.ts +9 -9
  14. package/dist/commons/events/FieldConfig.d.ts +254 -43
  15. package/dist/commons/events/FieldTypeMapping.d.ts +16 -16
  16. package/dist/commons/events/FieldValue.d.ts +12 -12
  17. package/dist/commons/events/FormConfig.d.ts +1032 -246
  18. package/dist/commons/events/PageConfig.d.ts +264 -46
  19. package/dist/commons/events/WorkqueueConfig.d.ts +199 -164
  20. package/dist/commons/events/defineConfig.d.ts +127 -28
  21. package/dist/commons/events/event.d.ts +61 -7
  22. package/dist/commons/events/test.utils.d.ts +12 -12
  23. package/dist/commons/events/utils.d.ts +234 -58
  24. package/dist/conditionals/index.js +3 -2
  25. package/dist/events/index.js +224 -89
  26. package/package.json +1 -1
  27. package/tsconfig.json +1 -1
  28. package/dist/commons/conditionals/conditionals.test.d.ts +0 -2
  29. package/dist/commons/conditionals/validate-address.test.d.ts +0 -2
  30. package/dist/commons/conditionals/validate.test.d.ts +0 -2
  31. package/dist/commons/events/utils.test.d.ts +0 -2
@@ -40,6 +40,7 @@ __export(events_exports, {
40
40
  ActionConfigBase: () => ActionConfigBase,
41
41
  ActionCreationMetadata: () => ActionCreationMetadata,
42
42
  ActionDocument: () => ActionDocument,
43
+ ActionFlag: () => ActionFlag,
43
44
  ActionFormConfig: () => ActionFormConfig,
44
45
  ActionInput: () => ActionInput,
45
46
  ActionStatus: () => ActionStatus,
@@ -95,6 +96,7 @@ __export(events_exports, {
95
96
  EventDocument: () => EventDocument,
96
97
  EventFieldConfigSchema: () => EventFieldConfigSchema,
97
98
  EventFieldId: () => EventFieldId,
99
+ EventFieldIdInput: () => EventFieldIdInput,
98
100
  EventIndex: () => EventIndex,
99
101
  EventInput: () => EventInput,
100
102
  EventMetadata: () => EventMetadata,
@@ -129,8 +131,10 @@ __export(events_exports, {
129
131
  InherentFlags: () => InherentFlags,
130
132
  LanguageConfig: () => LanguageConfig,
131
133
  LegalStatuses: () => LegalStatuses,
134
+ METADATA_FIELD_PREFIX: () => METADATA_FIELD_PREFIX,
132
135
  MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
133
136
  MimeType: () => MimeType,
137
+ NameConfig: () => NameConfig,
134
138
  NameFieldUpdateValue: () => NameFieldUpdateValue,
135
139
  NameFieldValue: () => NameFieldValue,
136
140
  NonEmptyTextValue: () => NonEmptyTextValue,
@@ -168,6 +172,7 @@ __export(events_exports, {
168
172
  TENNIS_CLUB_MEMBERSHIP: () => TENNIS_CLUB_MEMBERSHIP,
169
173
  TEST_SYSTEM_IANA_TIMEZONE: () => TEST_SYSTEM_IANA_TIMEZONE,
170
174
  TestUserRole: () => TestUserRole,
175
+ TextField: () => TextField,
171
176
  TextValue: () => TextValue,
172
177
  TimeValue: () => TimeValue,
173
178
  TranslationConfig: () => TranslationConfig,
@@ -179,7 +184,6 @@ __export(events_exports, {
179
184
  ValidationConfig: () => ValidationConfig,
180
185
  VerificationActionConfig: () => VerificationActionConfig,
181
186
  VerificationPageConfig: () => VerificationPageConfig,
182
- VisibleStatus: () => VisibleStatus,
183
187
  WRITE_ACTION_SCOPES: () => WRITE_ACTION_SCOPES,
184
188
  Within: () => Within,
185
189
  WorkqueueActionsWithDefault: () => WorkqueueActionsWithDefault,
@@ -198,6 +202,7 @@ __export(events_exports, {
198
202
  annotationActions: () => annotationActions,
199
203
  applyDeclarationToEventIndex: () => applyDeclarationToEventIndex,
200
204
  applyDraftsToEventIndex: () => applyDraftsToEventIndex,
205
+ areCertificateConditionsMet: () => areCertificateConditionsMet,
201
206
  areConditionsMet: () => areConditionsMet,
202
207
  compositeFieldTypes: () => compositeFieldTypes,
203
208
  createEmptyDraft: () => createEmptyDraft,
@@ -321,6 +326,7 @@ __export(events_exports, {
321
326
  or: () => or,
322
327
  resolveDateOfEvent: () => resolveDateOfEvent,
323
328
  runFieldValidations: () => runFieldValidations,
329
+ runStructuralValidations: () => runStructuralValidations,
324
330
  timePeriodToDateRange: () => timePeriodToDateRange,
325
331
  user: () => user,
326
332
  validate: () => validate,
@@ -555,7 +561,7 @@ var import_zod6 = require("zod");
555
561
  var import_zod4 = require("zod");
556
562
  var import_zod_openapi3 = require("zod-openapi");
557
563
  (0, import_zod_openapi3.extendZodWithOpenApi)(import_zod4.z);
558
- var FullDocumentURL = import_zod4.z.string().brand("FullDocumentURL").describe(
564
+ var FullDocumentUrl = import_zod4.z.string().brand("FullDocumentUrl").describe(
559
565
  "A full url with protocol, host, bucket name, starting from the root of the S3 server, https://minio/bucket-name/document-id.jpg"
560
566
  );
561
567
  var FullDocumentPath = import_zod4.z.string().transform((val) => val.startsWith("/") ? val : `/${val}`).openapi({ effectType: "input", type: "string" }).describe(
@@ -607,13 +613,13 @@ var UrbanAddressUpdateValue = AdminStructure.extend({
607
613
  zipCode: import_zod5.z.string().nullish()
608
614
  });
609
615
  var NameFieldValue = import_zod5.z.object({
610
- firstname: import_zod5.z.string().min(1),
611
- surname: import_zod5.z.string().min(1),
616
+ firstname: import_zod5.z.string(),
617
+ surname: import_zod5.z.string(),
612
618
  middlename: import_zod5.z.string().optional()
613
619
  });
614
620
  var NameFieldUpdateValue = import_zod5.z.object({
615
- firstname: import_zod5.z.string().nullish(),
616
- surname: import_zod5.z.string().nullish(),
621
+ firstname: import_zod5.z.string(),
622
+ surname: import_zod5.z.string(),
617
623
  middlename: import_zod5.z.string().nullish()
618
624
  }).or(import_zod5.z.null()).or(import_zod5.z.undefined());
619
625
  var RuralAddressUpdateValue = AdminStructure.extend({
@@ -910,18 +916,32 @@ var SelectDateRangeField = BaseField.extend({
910
916
  defaultValue: SelectDateRangeValue.optional(),
911
917
  options: import_zod7.z.array(SelectDateRangeOption).describe("A list of options")
912
918
  }).describe("Select input with date range options");
919
+ var NameConfig = import_zod7.z.object({
920
+ firstname: import_zod7.z.object({ required: import_zod7.z.boolean() }).optional(),
921
+ middlename: import_zod7.z.object({ required: import_zod7.z.boolean() }).optional(),
922
+ surname: import_zod7.z.object({ required: import_zod7.z.boolean() }).optional()
923
+ });
913
924
  var NameField = BaseField.extend({
914
925
  type: import_zod7.z.literal(FieldType.NAME),
915
926
  defaultValue: import_zod7.z.object({
916
- firstname: NonEmptyTextValue,
917
- surname: NonEmptyTextValue
927
+ firstname: NonEmptyTextValue.optional(),
928
+ middlename: NonEmptyTextValue.optional(),
929
+ surname: NonEmptyTextValue.optional()
918
930
  }).optional(),
919
931
  configuration: import_zod7.z.object({
932
+ name: NameConfig.default({
933
+ firstname: { required: true },
934
+ surname: { required: true }
935
+ }).optional(),
920
936
  maxLength: import_zod7.z.number().optional().describe("Maximum length of the text"),
921
937
  prefix: TranslationConfig.optional(),
922
938
  postfix: TranslationConfig.optional(),
923
- includeMiddlename: import_zod7.z.boolean().default(false).optional().describe("To make middle name visible in Name form field"),
924
939
  searchMode: import_zod7.z.boolean().optional()
940
+ }).default({
941
+ name: {
942
+ firstname: { required: true },
943
+ surname: { required: true }
944
+ }
925
945
  }).optional()
926
946
  }).describe("Name input field");
927
947
  var PhoneField = BaseField.extend({
@@ -1223,7 +1243,8 @@ var CertificateConfig = import_zod11.z.object({
1223
1243
  delayed: import_zod11.z.number()
1224
1244
  }),
1225
1245
  svgUrl: import_zod11.z.string(),
1226
- fonts: import_zod11.z.record(FontFamily).optional()
1246
+ fonts: import_zod11.z.record(FontFamily).optional(),
1247
+ conditionals: import_zod11.z.array(ShowConditional).optional()
1227
1248
  });
1228
1249
  var CertificateTemplateConfig = CertificateConfig.extend({
1229
1250
  hash: import_zod11.z.string().optional(),
@@ -1395,22 +1416,30 @@ var FieldConfigSchema = BaseField3.extend({
1395
1416
  fieldType: import_zod15.z.literal("field"),
1396
1417
  alternateFieldIds: import_zod15.z.array(import_zod15.z.string()).optional().describe(
1397
1418
  `Sometimes there might be need to search a value against multiple field of same FormField type. For example
1398
- search Country, Province, District against child.address.private and child.address.other. In such case, we
1419
+ search Country, Province, District against child.address.private and child.address.other. In such case, we
1399
1420
  add a one field as fieldId, and accomodate others in alternateFieldIds`
1400
1421
  ),
1401
- excludeInSearchQuery: import_zod15.z.boolean().default(false).optional().describe(`Sometimes there will be search fields which are used to
1402
- conditionally display another search field, but its not needed in search query. For example, child.placeOfBirth
1422
+ excludeInSearchQuery: import_zod15.z.boolean().default(false).optional().describe(`Sometimes there will be search fields which are used to
1423
+ conditionally display another search field, but its not needed in search query. For example, child.placeOfBirth
1403
1424
  is select field, which has 3 options, FACILITY, PRIVATE_HOME, OTHER. Upon selecting any of the option, pops up another field
1404
1425
  related to the selected option, whose value is required in the search query. But child.placeOfBirth itself is not needed in the query.
1405
1426
  In such case, populate this field (excludeInSearchQuery) with boolean true`)
1406
1427
  });
1407
- var EventFieldId = import_zod15.z.enum([
1428
+ var EventFieldIdInput = import_zod15.z.enum([
1408
1429
  "trackingId",
1409
1430
  "status",
1410
1431
  "legalStatuses.REGISTERED.acceptedAt",
1411
1432
  "legalStatuses.REGISTERED.createdAtLocation",
1412
1433
  "updatedAt"
1413
1434
  ]);
1435
+ var METADATA_FIELD_PREFIX = "event.";
1436
+ var EventFieldId = import_zod15.z.enum([
1437
+ `${METADATA_FIELD_PREFIX}trackingId`,
1438
+ `${METADATA_FIELD_PREFIX}status`,
1439
+ `${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
1440
+ `${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.createdAtLocation`,
1441
+ `${METADATA_FIELD_PREFIX}updatedAt`
1442
+ ]);
1414
1443
  var EventFieldConfigSchema = BaseField3.extend({
1415
1444
  fieldId: EventFieldId,
1416
1445
  fieldType: import_zod15.z.literal("event")
@@ -2045,7 +2074,7 @@ var ResolvedUser = import_zod19.z.object({
2045
2074
  });
2046
2075
 
2047
2076
  // ../commons/src/conditionals/validate.ts
2048
- var import_ajv = __toESM(require("ajv"));
2077
+ var import__ = __toESM(require("ajv/dist/2019"));
2049
2078
  var import_ajv_formats = __toESM(require("ajv-formats"));
2050
2079
  var import_date_fns = require("date-fns");
2051
2080
 
@@ -2259,9 +2288,11 @@ var isNonInteractiveFieldType = (field2) => {
2259
2288
  };
2260
2289
 
2261
2290
  // ../commons/src/conditionals/validate.ts
2262
- var ajv = new import_ajv.default({
2291
+ var ajv = new import__.default({
2263
2292
  $data: true,
2264
- allowUnionTypes: true
2293
+ allowUnionTypes: true,
2294
+ strict: false
2295
+ // Allow minContains and other newer features
2265
2296
  });
2266
2297
  (0, import_ajv_formats.default)(ajv);
2267
2298
  ajv.addKeyword({
@@ -2434,6 +2465,23 @@ function validateFieldInput({
2434
2465
  const rawError = zodType.safeParse(value, { errorMap: zodToIntlErrorMap });
2435
2466
  return rawError.error?.issues.map((issue) => issue.message) ?? [];
2436
2467
  }
2468
+ function runStructuralValidations({
2469
+ field: field2,
2470
+ values
2471
+ }) {
2472
+ if (!isFieldVisible(field2, values) || isFieldEmptyAndNotRequired(field2, values)) {
2473
+ return {
2474
+ errors: []
2475
+ };
2476
+ }
2477
+ const fieldValidationResult = validateFieldInput({
2478
+ field: field2,
2479
+ value: values[field2.id]
2480
+ });
2481
+ return {
2482
+ errors: fieldValidationResult
2483
+ };
2484
+ }
2437
2485
  function runFieldValidations({
2438
2486
  field: field2,
2439
2487
  values
@@ -2499,6 +2547,11 @@ function getValidatorsForField(fieldId, validations) {
2499
2547
  };
2500
2548
  }).filter((x) => x !== null);
2501
2549
  }
2550
+ function areCertificateConditionsMet(conditions, values) {
2551
+ return conditions.every((condition) => {
2552
+ return ajv.validate(condition.conditional, values);
2553
+ });
2554
+ }
2502
2555
 
2503
2556
  // ../commons/src/utils.ts
2504
2557
  function getOrThrow(x, message) {
@@ -2719,16 +2772,16 @@ function timePeriodToDateRange(value) {
2719
2772
  let startDate;
2720
2773
  switch (value) {
2721
2774
  case "last7Days":
2722
- startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 6);
2775
+ startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 7);
2723
2776
  break;
2724
2777
  case "last30Days":
2725
- startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 29);
2778
+ startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 30);
2726
2779
  break;
2727
2780
  case "last90Days":
2728
- startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 89);
2781
+ startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 90);
2729
2782
  break;
2730
2783
  case "last365Days":
2731
- startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 364);
2784
+ startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 365);
2732
2785
  break;
2733
2786
  }
2734
2787
  return {
@@ -3095,8 +3148,9 @@ function createFieldConditionals(fieldId) {
3095
3148
  properties: {
3096
3149
  [fieldId]: {
3097
3150
  type: "string",
3098
- 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'._-]*)*$",
3099
- description: "Name must contain only letters, numbers, and allowed special characters ('._-). No double spaces."
3151
+ minLength: 1,
3152
+ 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'.-]*)*$",
3153
+ description: "Name must contain only letters, numbers, and allowed special characters ('.-). No double spaces."
3100
3154
  }
3101
3155
  }
3102
3156
  }),
@@ -3209,7 +3263,7 @@ function createSearchConfig(baseField) {
3209
3263
  // ../commons/src/event-config/event-configuration.ts
3210
3264
  function createEventFieldConfig(fieldId) {
3211
3265
  const baseField = {
3212
- fieldId,
3266
+ fieldId: `${METADATA_FIELD_PREFIX}${fieldId}`,
3213
3267
  fieldType: "event"
3214
3268
  };
3215
3269
  return createSearchConfig(baseField);
@@ -3222,32 +3276,107 @@ function eventFn(fieldId) {
3222
3276
  var event = Object.assign(eventFn, {
3223
3277
  /**
3224
3278
  * Checks if the event contains a specific action type.
3279
+ * Can be used directly as a conditional or chained with additional methods.
3225
3280
  * @param action - The action type to check for.
3226
3281
  */
3227
- hasAction: (action) => defineConditional({
3228
- type: "object",
3229
- properties: {
3230
- $event: {
3282
+ hasAction: (action) => {
3283
+ const basicConditional = defineConditional({
3284
+ type: "object",
3285
+ properties: {
3286
+ $event: {
3287
+ type: "object",
3288
+ properties: {
3289
+ actions: {
3290
+ type: "array",
3291
+ contains: {
3292
+ type: "object",
3293
+ properties: {
3294
+ type: {
3295
+ const: action
3296
+ }
3297
+ },
3298
+ required: ["type"]
3299
+ }
3300
+ }
3301
+ },
3302
+ required: ["actions"]
3303
+ }
3304
+ },
3305
+ required: ["$event"]
3306
+ });
3307
+ const buildActionConstraints = (additionalFields) => {
3308
+ const actionProperties = {
3309
+ type: { const: action }
3310
+ };
3311
+ const requiredFields = ["type"];
3312
+ if (additionalFields) {
3313
+ Object.entries(additionalFields).forEach(([key, value]) => {
3314
+ actionProperties[key] = { const: value };
3315
+ requiredFields.push(key);
3316
+ });
3317
+ }
3318
+ return { actionProperties, requiredFields };
3319
+ };
3320
+ const createCountConditional = (countType, count, additionalFields) => {
3321
+ const { actionProperties, requiredFields } = buildActionConstraints(additionalFields);
3322
+ return defineConditional({
3231
3323
  type: "object",
3232
3324
  properties: {
3233
- actions: {
3234
- type: "array",
3235
- contains: {
3236
- type: "object",
3237
- properties: {
3238
- type: {
3239
- const: action
3240
- }
3241
- },
3242
- required: ["type"]
3243
- }
3325
+ $event: {
3326
+ type: "object",
3327
+ properties: {
3328
+ actions: {
3329
+ type: "array",
3330
+ contains: {
3331
+ type: "object",
3332
+ properties: actionProperties,
3333
+ required: requiredFields
3334
+ },
3335
+ [countType]: count
3336
+ }
3337
+ },
3338
+ required: ["actions"]
3244
3339
  }
3245
3340
  },
3246
- required: ["actions"]
3247
- }
3248
- },
3249
- required: ["$event"]
3250
- }),
3341
+ required: ["$event"]
3342
+ });
3343
+ };
3344
+ const withMinMax = (additionalFields) => {
3345
+ return {
3346
+ /**
3347
+ * Creates a conditional that checks if the event contains a specific action type
3348
+ * with a minimum count of occurrences.
3349
+ *
3350
+ * @param minCount - The minimum number of actions required.
3351
+ */
3352
+ minCount: (minCount) => createCountConditional("minContains", minCount, additionalFields),
3353
+ /**
3354
+ * Builds a conditional that sets a maximum count for the number of actions.
3355
+ * This is useful for limiting the number of actions of a specific type in a single event.
3356
+ */
3357
+ maxCount: (maxCount) => createCountConditional("maxContains", maxCount, additionalFields)
3358
+ };
3359
+ };
3360
+ const chainableMethods = {
3361
+ /**
3362
+ * Adds additional field constraints to the action matching.
3363
+ *
3364
+ * @param fields - Object containing additional fields to match on the action.
3365
+ */
3366
+ withFields: (fields) => withMinMax(fields),
3367
+ /**
3368
+ * Adds template ID constraint to the action matching.
3369
+ * This is a convenience method that adds content.templateId to the fields.
3370
+ *
3371
+ * @param id - The template ID to match against.
3372
+ */
3373
+ withTemplate: (id) => withMinMax({
3374
+ content: { templateId: id }
3375
+ }),
3376
+ ...withMinMax()
3377
+ };
3378
+ return { ...basicConditional, ...chainableMethods };
3379
+ },
3251
3380
  field(field2) {
3252
3381
  return {
3253
3382
  $event: field2
@@ -3266,24 +3395,23 @@ var EventStatus = import_zod23.z.enum([
3266
3395
  "DECLARED",
3267
3396
  "VALIDATED",
3268
3397
  "REGISTERED",
3269
- "CERTIFIED",
3270
3398
  "ARCHIVED"
3271
3399
  ]);
3272
- var VisibleStatus = import_zod23.z.enum([...EventStatus.options, "REJECTED"]);
3273
3400
  var InherentFlags = {
3274
- PRINTED: "printed",
3401
+ PENDING_CERTIFICATION: "pending-certification",
3275
3402
  INCOMPLETE: "incomplete",
3276
3403
  REJECTED: "rejected",
3277
3404
  CORRECTION_REQUESTED: "correction-requested"
3278
3405
  };
3279
- var Flag = import_zod23.z.string().regex(
3406
+ var ActionFlag = import_zod23.z.string().regex(
3280
3407
  new RegExp(
3281
3408
  `^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
3282
3409
  ActionStatus
3283
3410
  ).join("|").toLowerCase()})$`
3284
3411
  ),
3285
3412
  "Flag must be in the format ActionType:ActionStatus (lowerCase)"
3286
- ).or(import_zod23.z.nativeEnum(InherentFlags));
3413
+ );
3414
+ var Flag = ActionFlag.or(import_zod23.z.nativeEnum(InherentFlags));
3287
3415
  var ZodDate = import_zod23.z.string().date();
3288
3416
  var ActionCreationMetadata = import_zod23.z.object({
3289
3417
  createdAt: import_zod23.z.string().datetime().describe("The timestamp when the action request was created."),
@@ -3799,7 +3927,8 @@ var WorkqueueConfig = import_zod28.z.object({
3799
3927
  })
3800
3928
  ),
3801
3929
  columns: import_zod28.z.array(WorkqueueColumn).default(mandatoryColumns),
3802
- icon: AvailableIcons
3930
+ icon: AvailableIcons,
3931
+ emptyMessage: TranslationConfig.optional()
3803
3932
  }).describe("Configuration for workqueue.");
3804
3933
  var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
3805
3934
  query: true,
@@ -3818,7 +3947,8 @@ var WorkqueueConfigInput = import_zod28.z.object({
3818
3947
  })
3819
3948
  ),
3820
3949
  columns: import_zod28.z.array(WorkqueueColumn).default(mandatoryColumns),
3821
- icon: AvailableIcons
3950
+ icon: AvailableIcons,
3951
+ emptyMessage: TranslationConfig.optional()
3822
3952
  });
3823
3953
  function defineWorkqueue(workqueueInput) {
3824
3954
  const queryInput = workqueueInput.query;
@@ -4120,16 +4250,19 @@ function getLegalStatuses(actions) {
4120
4250
  }
4121
4251
 
4122
4252
  // ../commons/src/events/state/flags.ts
4123
- function isCertificatePrinted(actions) {
4253
+ function isPendingCertification(actions) {
4254
+ if (getStatusFromActions(actions) !== EventStatus.enum.REGISTERED) {
4255
+ return false;
4256
+ }
4124
4257
  return actions.reduce((prev, { type }) => {
4125
4258
  if (type === ActionType.PRINT_CERTIFICATE) {
4126
- return true;
4259
+ return false;
4127
4260
  }
4128
4261
  if (type === ActionType.APPROVE_CORRECTION) {
4129
- return false;
4262
+ return true;
4130
4263
  }
4131
4264
  return prev;
4132
- }, false);
4265
+ }, true);
4133
4266
  }
4134
4267
  function isCorrectionRequested(actions) {
4135
4268
  return actions.reduce((prev, { type }) => {
@@ -4164,8 +4297,8 @@ function getFlagsFromActions(actions) {
4164
4297
  const flag = joinValues([type, status], ":").toLowerCase();
4165
4298
  return flag;
4166
4299
  });
4167
- if (isCertificatePrinted(sortedActions)) {
4168
- flags.push(InherentFlags.PRINTED);
4300
+ if (isPendingCertification(sortedActions)) {
4301
+ flags.push(InherentFlags.PENDING_CERTIFICATION);
4169
4302
  }
4170
4303
  if (isCorrectionRequested(sortedActions)) {
4171
4304
  flags.push(InherentFlags.CORRECTION_REQUESTED);
@@ -4196,7 +4329,6 @@ function getStatusFromActions(actions) {
4196
4329
  case ActionType.NOTIFY:
4197
4330
  return EventStatus.enum.NOTIFIED;
4198
4331
  case ActionType.PRINT_CERTIFICATE:
4199
- return EventStatus.enum.CERTIFIED;
4200
4332
  case ActionType.ASSIGN:
4201
4333
  case ActionType.UNASSIGN:
4202
4334
  case ActionType.REJECT:
@@ -5161,7 +5293,27 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
5161
5293
  defaultMessage: "Applicant's name",
5162
5294
  description: "This is the label for the field",
5163
5295
  id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.firstname.label"
5164
- }
5296
+ },
5297
+ configuration: {
5298
+ name: {
5299
+ firstname: { required: true },
5300
+ middlename: { required: false },
5301
+ surname: { required: true }
5302
+ }
5303
+ },
5304
+ validation: [
5305
+ {
5306
+ validator: field("applicant.name").object({
5307
+ firstname: field("firstname").isValidEnglishName(),
5308
+ surname: field("surname").isValidEnglishName()
5309
+ }),
5310
+ message: {
5311
+ defaultMessage: "Input contains invalid characters. Please use only letters (a-z, A-Z), numbers (0-9), hyphens (-), apostrophes(') and underscores (_)",
5312
+ description: "This is the error message for invalid name",
5313
+ id: "v2.error.invalidName"
5314
+ }
5315
+ }
5316
+ ]
5165
5317
  },
5166
5318
  {
5167
5319
  id: "applicant.email",
@@ -5383,22 +5535,6 @@ var statusOptions = [
5383
5535
  id: "v2.advancedSearch.form.recordStatusRegistered"
5384
5536
  }
5385
5537
  },
5386
- {
5387
- value: EventStatus.enum.CERTIFIED,
5388
- label: {
5389
- defaultMessage: "Certified",
5390
- description: "Option for form field: status of record",
5391
- id: "v2.advancedSearch.form.recordStatusCertified"
5392
- }
5393
- },
5394
- {
5395
- value: VisibleStatus.enum.REJECTED,
5396
- label: {
5397
- defaultMessage: "Rejected",
5398
- description: "Option for form field: status of record",
5399
- id: "v2.advancedSearch.form.recordStatusRejected"
5400
- }
5401
- },
5402
5538
  {
5403
5539
  value: EventStatus.enum.ARCHIVED,
5404
5540
  label: {
@@ -6850,7 +6986,11 @@ function generateActionDocument({
6850
6986
  case ActionType.NOTIFY:
6851
6987
  return { ...actionBase, type: action };
6852
6988
  case ActionType.PRINT_CERTIFICATE:
6853
- return { ...actionBase, type: action };
6989
+ return {
6990
+ ...actionBase,
6991
+ type: action,
6992
+ content: defaults.content
6993
+ };
6854
6994
  case ActionType.REQUEST_CORRECTION:
6855
6995
  return { ...actionBase, type: action };
6856
6996
  case ActionType.APPROVE_CORRECTION:
@@ -7250,14 +7390,6 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
7250
7390
  ActionType.REJECT_CORRECTION,
7251
7391
  ExclusiveActions.REVIEW_CORRECTION_REQUEST
7252
7392
  ],
7253
- [EventStatus.enum.CERTIFIED]: [
7254
- ActionType.READ,
7255
- ActionType.PRINT_CERTIFICATE,
7256
- ActionType.REQUEST_CORRECTION,
7257
- ActionType.APPROVE_CORRECTION,
7258
- ActionType.REJECT_CORRECTION,
7259
- ExclusiveActions.REVIEW_CORRECTION_REQUEST
7260
- ],
7261
7393
  [EventStatus.enum.ARCHIVED]: [
7262
7394
  ActionType.READ,
7263
7395
  ActionType.ASSIGN,
@@ -7265,9 +7397,12 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
7265
7397
  ]
7266
7398
  };
7267
7399
  var getAvailableActionsForEvent = (event2) => {
7268
- return event2.flags.includes(InherentFlags.REJECTED) ? [
7269
- ActionType.READ,
7270
- event2.status === EventStatus.Enum.VALIDATED ? ActionType.VALIDATE : ActionType.DECLARE,
7271
- ActionType.ARCHIVE
7272
- ] : AVAILABLE_ACTIONS_BY_EVENT_STATUS[event2.status];
7400
+ if (event2.flags.includes(InherentFlags.REJECTED)) {
7401
+ return [
7402
+ ActionType.READ,
7403
+ event2.status === EventStatus.Enum.VALIDATED ? ActionType.VALIDATE : ActionType.DECLARE,
7404
+ ActionType.ARCHIVE
7405
+ ];
7406
+ }
7407
+ return AVAILABLE_ACTIONS_BY_EVENT_STATUS[event2.status];
7273
7408
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "1.8.1-rc.cacd557",
3
+ "version": "1.8.1-rc.d3d858d",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "exports": {
package/tsconfig.json CHANGED
@@ -19,7 +19,7 @@
19
19
  "@opencrvs/commons/events": ["../commons/src/events/index.ts"]
20
20
  }
21
21
  },
22
- "references": [{ "path": "../commons" }],
22
+ "references": [{ "path": "../commons/tsconfig-commonjs.json" }],
23
23
  "include": ["src/**/*.ts"],
24
24
  "exclude": ["**/node_modules/**", "dist"]
25
25
  }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=conditionals.test.d.ts.map
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=validate-address.test.d.ts.map
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=validate.test.d.ts.map
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=utils.test.d.ts.map