@opencrvs/toolkit 1.8.1-rc.7f85c6f → 1.8.1-rc.829977e

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 (32) hide show
  1. package/dist/commons/api/router.d.ts +409 -392
  2. package/dist/commons/conditionals/validate.d.ts +8 -0
  3. package/dist/commons/events/ActionConfig.d.ts +2004 -366
  4. package/dist/commons/events/ActionDocument.d.ts +1252 -716
  5. package/dist/commons/events/ActionInput.d.ts +626 -600
  6. package/dist/commons/events/AdvancedSearchConfig.d.ts +83 -65
  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 +695 -168
  11. package/dist/commons/events/EventDocument.d.ts +451 -432
  12. package/dist/commons/events/EventIndex.d.ts +184 -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 +288 -164
  20. package/dist/commons/events/defineConfig.d.ts +129 -30
  21. package/dist/commons/events/event.d.ts +13 -5
  22. package/dist/commons/events/field.d.ts +14 -0
  23. package/dist/commons/events/test.utils.d.ts +12 -12
  24. package/dist/commons/events/utils.d.ts +236 -60
  25. package/dist/conditionals/index.js +3 -2
  26. package/dist/events/index.js +145 -67
  27. package/package.json +1 -1
  28. package/tsconfig.json +1 -1
  29. package/dist/commons/conditionals/conditionals.test.d.ts +0 -2
  30. package/dist/commons/conditionals/validate-address.test.d.ts +0 -2
  31. package/dist/commons/conditionals/validate.test.d.ts +0 -2
  32. 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,
@@ -139,6 +143,7 @@ __export(events_exports, {
139
143
  PageConfig: () => PageConfig,
140
144
  PageTypes: () => PageTypes,
141
145
  PrintCertificateActionInput: () => PrintCertificateActionInput,
146
+ PrintContent: () => PrintContent,
142
147
  QueryExpression: () => QueryExpression,
143
148
  QueryInput: () => QueryInput,
144
149
  QueryType: () => QueryType,
@@ -167,6 +172,7 @@ __export(events_exports, {
167
172
  TENNIS_CLUB_MEMBERSHIP: () => TENNIS_CLUB_MEMBERSHIP,
168
173
  TEST_SYSTEM_IANA_TIMEZONE: () => TEST_SYSTEM_IANA_TIMEZONE,
169
174
  TestUserRole: () => TestUserRole,
175
+ TextField: () => TextField,
170
176
  TextValue: () => TextValue,
171
177
  TimeValue: () => TimeValue,
172
178
  TranslationConfig: () => TranslationConfig,
@@ -178,7 +184,6 @@ __export(events_exports, {
178
184
  ValidationConfig: () => ValidationConfig,
179
185
  VerificationActionConfig: () => VerificationActionConfig,
180
186
  VerificationPageConfig: () => VerificationPageConfig,
181
- VisibleStatus: () => VisibleStatus,
182
187
  WRITE_ACTION_SCOPES: () => WRITE_ACTION_SCOPES,
183
188
  Within: () => Within,
184
189
  WorkqueueActionsWithDefault: () => WorkqueueActionsWithDefault,
@@ -320,6 +325,7 @@ __export(events_exports, {
320
325
  or: () => or,
321
326
  resolveDateOfEvent: () => resolveDateOfEvent,
322
327
  runFieldValidations: () => runFieldValidations,
328
+ runStructuralValidations: () => runStructuralValidations,
323
329
  timePeriodToDateRange: () => timePeriodToDateRange,
324
330
  user: () => user,
325
331
  validate: () => validate,
@@ -554,7 +560,7 @@ var import_zod6 = require("zod");
554
560
  var import_zod4 = require("zod");
555
561
  var import_zod_openapi3 = require("zod-openapi");
556
562
  (0, import_zod_openapi3.extendZodWithOpenApi)(import_zod4.z);
557
- var FullDocumentURL = import_zod4.z.string().brand("FullDocumentURL").describe(
563
+ var FullDocumentUrl = import_zod4.z.string().brand("FullDocumentUrl").describe(
558
564
  "A full url with protocol, host, bucket name, starting from the root of the S3 server, https://minio/bucket-name/document-id.jpg"
559
565
  );
560
566
  var FullDocumentPath = import_zod4.z.string().transform((val) => val.startsWith("/") ? val : `/${val}`).openapi({ effectType: "input", type: "string" }).describe(
@@ -606,13 +612,13 @@ var UrbanAddressUpdateValue = AdminStructure.extend({
606
612
  zipCode: import_zod5.z.string().nullish()
607
613
  });
608
614
  var NameFieldValue = import_zod5.z.object({
609
- firstname: import_zod5.z.string().min(1),
610
- surname: import_zod5.z.string().min(1),
615
+ firstname: import_zod5.z.string(),
616
+ surname: import_zod5.z.string(),
611
617
  middlename: import_zod5.z.string().optional()
612
618
  });
613
619
  var NameFieldUpdateValue = import_zod5.z.object({
614
- firstname: import_zod5.z.string().nullish(),
615
- surname: import_zod5.z.string().nullish(),
620
+ firstname: import_zod5.z.string(),
621
+ surname: import_zod5.z.string(),
616
622
  middlename: import_zod5.z.string().nullish()
617
623
  }).or(import_zod5.z.null()).or(import_zod5.z.undefined());
618
624
  var RuralAddressUpdateValue = AdminStructure.extend({
@@ -909,18 +915,32 @@ var SelectDateRangeField = BaseField.extend({
909
915
  defaultValue: SelectDateRangeValue.optional(),
910
916
  options: import_zod7.z.array(SelectDateRangeOption).describe("A list of options")
911
917
  }).describe("Select input with date range options");
918
+ var NameConfig = import_zod7.z.object({
919
+ firstname: import_zod7.z.object({ required: import_zod7.z.boolean() }).optional(),
920
+ middlename: import_zod7.z.object({ required: import_zod7.z.boolean() }).optional(),
921
+ surname: import_zod7.z.object({ required: import_zod7.z.boolean() }).optional()
922
+ });
912
923
  var NameField = BaseField.extend({
913
924
  type: import_zod7.z.literal(FieldType.NAME),
914
925
  defaultValue: import_zod7.z.object({
915
- firstname: NonEmptyTextValue,
916
- surname: NonEmptyTextValue
926
+ firstname: NonEmptyTextValue.optional(),
927
+ middlename: NonEmptyTextValue.optional(),
928
+ surname: NonEmptyTextValue.optional()
917
929
  }).optional(),
918
930
  configuration: import_zod7.z.object({
931
+ name: NameConfig.default({
932
+ firstname: { required: true },
933
+ surname: { required: true }
934
+ }).optional(),
919
935
  maxLength: import_zod7.z.number().optional().describe("Maximum length of the text"),
920
936
  prefix: TranslationConfig.optional(),
921
937
  postfix: TranslationConfig.optional(),
922
- includeMiddlename: import_zod7.z.boolean().default(false).optional().describe("To make middle name visible in Name form field"),
923
938
  searchMode: import_zod7.z.boolean().optional()
939
+ }).default({
940
+ name: {
941
+ firstname: { required: true },
942
+ surname: { required: true }
943
+ }
924
944
  }).optional()
925
945
  }).describe("Name input field");
926
946
  var PhoneField = BaseField.extend({
@@ -1340,7 +1360,7 @@ var SummaryConfig = import_zod14.z.object({
1340
1360
 
1341
1361
  // ../commons/src/events/AdvancedSearchConfig.ts
1342
1362
  var import_zod15 = require("zod");
1343
- var MatchType = import_zod15.z.enum(["fuzzy", "exact", "range"]);
1363
+ var MatchType = import_zod15.z.enum(["fuzzy", "exact", "range", "within"]);
1344
1364
  var BaseField3 = import_zod15.z.object({
1345
1365
  config: import_zod15.z.object({
1346
1366
  type: MatchType.describe("Determines the type of field")
@@ -1394,22 +1414,30 @@ var FieldConfigSchema = BaseField3.extend({
1394
1414
  fieldType: import_zod15.z.literal("field"),
1395
1415
  alternateFieldIds: import_zod15.z.array(import_zod15.z.string()).optional().describe(
1396
1416
  `Sometimes there might be need to search a value against multiple field of same FormField type. For example
1397
- search Country, Province, District against child.address.private and child.address.other. In such case, we
1417
+ search Country, Province, District against child.address.private and child.address.other. In such case, we
1398
1418
  add a one field as fieldId, and accomodate others in alternateFieldIds`
1399
1419
  ),
1400
- excludeInSearchQuery: import_zod15.z.boolean().default(false).optional().describe(`Sometimes there will be search fields which are used to
1401
- conditionally display another search field, but its not needed in search query. For example, child.placeOfBirth
1420
+ excludeInSearchQuery: import_zod15.z.boolean().default(false).optional().describe(`Sometimes there will be search fields which are used to
1421
+ conditionally display another search field, but its not needed in search query. For example, child.placeOfBirth
1402
1422
  is select field, which has 3 options, FACILITY, PRIVATE_HOME, OTHER. Upon selecting any of the option, pops up another field
1403
1423
  related to the selected option, whose value is required in the search query. But child.placeOfBirth itself is not needed in the query.
1404
1424
  In such case, populate this field (excludeInSearchQuery) with boolean true`)
1405
1425
  });
1406
- var EventFieldId = import_zod15.z.enum([
1426
+ var EventFieldIdInput = import_zod15.z.enum([
1407
1427
  "trackingId",
1408
1428
  "status",
1409
1429
  "legalStatuses.REGISTERED.acceptedAt",
1410
1430
  "legalStatuses.REGISTERED.createdAtLocation",
1411
1431
  "updatedAt"
1412
1432
  ]);
1433
+ var METADATA_FIELD_PREFIX = "event.";
1434
+ var EventFieldId = import_zod15.z.enum([
1435
+ `${METADATA_FIELD_PREFIX}trackingId`,
1436
+ `${METADATA_FIELD_PREFIX}status`,
1437
+ `${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
1438
+ `${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.createdAtLocation`,
1439
+ `${METADATA_FIELD_PREFIX}updatedAt`
1440
+ ]);
1413
1441
  var EventFieldConfigSchema = BaseField3.extend({
1414
1442
  fieldId: EventFieldId,
1415
1443
  fieldType: import_zod15.z.literal("event")
@@ -1902,11 +1930,15 @@ var ActionBase = import_zod19.z.object({
1902
1930
  originalActionId: UUID.optional().nullable().describe(
1903
1931
  "Reference to the original action that was asynchronously rejected or accepted by 3rd party integration."
1904
1932
  )
1933
+ // 'content' field reserved for additional data
1934
+ // Each action can define its own content specifc to the action
1935
+ // See PrintCertificateAction
1905
1936
  });
1906
1937
  var AssignedAction = ActionBase.merge(
1907
1938
  import_zod19.z.object({
1908
1939
  type: import_zod19.z.literal(ActionType.ASSIGN),
1909
1940
  assignedTo: import_zod19.z.string()
1941
+ // TODO move into 'content' property
1910
1942
  })
1911
1943
  );
1912
1944
  var UnassignedAction = ActionBase.merge(
@@ -1918,6 +1950,7 @@ var RegisterAction = ActionBase.merge(
1918
1950
  import_zod19.z.object({
1919
1951
  type: import_zod19.z.literal(ActionType.REGISTER),
1920
1952
  registrationNumber: import_zod19.z.string().optional()
1953
+ // TODO move into 'content' property
1921
1954
  })
1922
1955
  );
1923
1956
  var DeclareAction = ActionBase.merge(
@@ -1938,6 +1971,7 @@ var RejectAction = ActionBase.merge(
1938
1971
  import_zod19.z.object({
1939
1972
  type: import_zod19.z.literal(ActionType.REJECT),
1940
1973
  reason: RejectionReason
1974
+ // TODO move into 'content' property
1941
1975
  })
1942
1976
  );
1943
1977
  var MarkAsDuplicateAction = ActionBase.merge(
@@ -1949,6 +1983,7 @@ var ArchiveAction = ActionBase.merge(
1949
1983
  import_zod19.z.object({
1950
1984
  type: import_zod19.z.literal(ActionType.ARCHIVE),
1951
1985
  reason: RejectionReason
1986
+ // TODO move into 'content' property
1952
1987
  })
1953
1988
  );
1954
1989
  var CreatedAction = ActionBase.merge(
@@ -1961,9 +1996,13 @@ var NotifiedAction = ActionBase.merge(
1961
1996
  type: import_zod19.z.literal(ActionType.NOTIFY)
1962
1997
  })
1963
1998
  );
1999
+ var PrintContent = import_zod19.z.object({
2000
+ templateId: import_zod19.z.string().optional()
2001
+ });
1964
2002
  var PrintCertificateAction = ActionBase.merge(
1965
2003
  import_zod19.z.object({
1966
- type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE)
2004
+ type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE),
2005
+ content: PrintContent.optional().nullable()
1967
2006
  })
1968
2007
  );
1969
2008
  var RequestedCorrectionAction = ActionBase.merge(
@@ -1975,12 +2014,14 @@ var ApprovedCorrectionAction = ActionBase.merge(
1975
2014
  import_zod19.z.object({
1976
2015
  type: import_zod19.z.literal(ActionType.APPROVE_CORRECTION),
1977
2016
  requestId: import_zod19.z.string()
2017
+ // TODO move into 'content' property
1978
2018
  })
1979
2019
  );
1980
2020
  var RejectedCorrectionAction = ActionBase.merge(
1981
2021
  import_zod19.z.object({
1982
2022
  type: import_zod19.z.literal(ActionType.REJECT_CORRECTION),
1983
2023
  requestId: import_zod19.z.string(),
2024
+ // TODO move into 'content' property
1984
2025
  reason: RejectionReason
1985
2026
  })
1986
2027
  );
@@ -2420,6 +2461,23 @@ function validateFieldInput({
2420
2461
  const rawError = zodType.safeParse(value, { errorMap: zodToIntlErrorMap });
2421
2462
  return rawError.error?.issues.map((issue) => issue.message) ?? [];
2422
2463
  }
2464
+ function runStructuralValidations({
2465
+ field: field2,
2466
+ values
2467
+ }) {
2468
+ if (!isFieldVisible(field2, values) || isFieldEmptyAndNotRequired(field2, values)) {
2469
+ return {
2470
+ errors: []
2471
+ };
2472
+ }
2473
+ const fieldValidationResult = validateFieldInput({
2474
+ field: field2,
2475
+ value: values[field2.id]
2476
+ });
2477
+ return {
2478
+ errors: fieldValidationResult
2479
+ };
2480
+ }
2423
2481
  function runFieldValidations({
2424
2482
  field: field2,
2425
2483
  values
@@ -2705,16 +2763,16 @@ function timePeriodToDateRange(value) {
2705
2763
  let startDate;
2706
2764
  switch (value) {
2707
2765
  case "last7Days":
2708
- startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 6);
2766
+ startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 7);
2709
2767
  break;
2710
2768
  case "last30Days":
2711
- startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 29);
2769
+ startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 30);
2712
2770
  break;
2713
2771
  case "last90Days":
2714
- startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 89);
2772
+ startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 90);
2715
2773
  break;
2716
2774
  case "last365Days":
2717
- startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 364);
2775
+ startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 365);
2718
2776
  break;
2719
2777
  }
2720
2778
  return {
@@ -3081,8 +3139,9 @@ function createFieldConditionals(fieldId) {
3081
3139
  properties: {
3082
3140
  [fieldId]: {
3083
3141
  type: "string",
3084
- 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'._-]*)*$",
3085
- description: "Name must contain only letters, numbers, and allowed special characters ('._-). No double spaces."
3142
+ minLength: 1,
3143
+ 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'.-]*)*$",
3144
+ description: "Name must contain only letters, numbers, and allowed special characters ('.-). No double spaces."
3086
3145
  }
3087
3146
  }
3088
3147
  }),
@@ -3175,6 +3234,19 @@ function createSearchConfig(baseField) {
3175
3234
  fuzzy: () => ({
3176
3235
  ...baseField,
3177
3236
  config: { type: "fuzzy" }
3237
+ }),
3238
+ /**
3239
+ * Creates a configuration for matching locations and the child locations
3240
+ * @returns An object containing the field ID and a configuration object with a type of 'within'.
3241
+ * @example field('createdAtLocation').within()
3242
+ * // {
3243
+ * // ...
3244
+ * // config: { type: 'within' }
3245
+ * // }
3246
+ */
3247
+ within: () => ({
3248
+ ...baseField,
3249
+ config: { type: "within" }
3178
3250
  })
3179
3251
  };
3180
3252
  }
@@ -3182,7 +3254,7 @@ function createSearchConfig(baseField) {
3182
3254
  // ../commons/src/event-config/event-configuration.ts
3183
3255
  function createEventFieldConfig(fieldId) {
3184
3256
  const baseField = {
3185
- fieldId,
3257
+ fieldId: `${METADATA_FIELD_PREFIX}${fieldId}`,
3186
3258
  fieldType: "event"
3187
3259
  };
3188
3260
  return createSearchConfig(baseField);
@@ -3239,24 +3311,23 @@ var EventStatus = import_zod23.z.enum([
3239
3311
  "DECLARED",
3240
3312
  "VALIDATED",
3241
3313
  "REGISTERED",
3242
- "CERTIFIED",
3243
3314
  "ARCHIVED"
3244
3315
  ]);
3245
- var VisibleStatus = import_zod23.z.enum([...EventStatus.options, "REJECTED"]);
3246
3316
  var InherentFlags = {
3247
- PRINTED: "printed",
3317
+ PENDING_CERTIFICATION: "pending-certification",
3248
3318
  INCOMPLETE: "incomplete",
3249
3319
  REJECTED: "rejected",
3250
3320
  CORRECTION_REQUESTED: "correction-requested"
3251
3321
  };
3252
- var Flag = import_zod23.z.string().regex(
3322
+ var ActionFlag = import_zod23.z.string().regex(
3253
3323
  new RegExp(
3254
3324
  `^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
3255
3325
  ActionStatus
3256
3326
  ).join("|").toLowerCase()})$`
3257
3327
  ),
3258
3328
  "Flag must be in the format ActionType:ActionStatus (lowerCase)"
3259
- ).or(import_zod23.z.nativeEnum(InherentFlags));
3329
+ );
3330
+ var Flag = ActionFlag.or(import_zod23.z.nativeEnum(InherentFlags));
3260
3331
  var ZodDate = import_zod23.z.string().date();
3261
3332
  var ActionCreationMetadata = import_zod23.z.object({
3262
3333
  createdAt: import_zod23.z.string().datetime().describe("The timestamp when the action request was created."),
@@ -3524,6 +3595,9 @@ var QueryExpression = import_zod25.z.object({
3524
3595
  createdAt: import_zod25.z.optional(DateCondition),
3525
3596
  updatedAt: import_zod25.z.optional(DateCondition),
3526
3597
  "legalStatuses.REGISTERED.acceptedAt": import_zod25.z.optional(DateCondition),
3598
+ "legalStatuses.DECLARED.createdAtLocation": import_zod25.z.optional(
3599
+ import_zod25.z.union([Within, Exact])
3600
+ ),
3527
3601
  "legalStatuses.REGISTERED.createdAtLocation": import_zod25.z.optional(
3528
3602
  import_zod25.z.union([Within, Exact])
3529
3603
  ),
@@ -3769,7 +3843,8 @@ var WorkqueueConfig = import_zod28.z.object({
3769
3843
  })
3770
3844
  ),
3771
3845
  columns: import_zod28.z.array(WorkqueueColumn).default(mandatoryColumns),
3772
- icon: AvailableIcons
3846
+ icon: AvailableIcons,
3847
+ emptyMessage: TranslationConfig.optional()
3773
3848
  }).describe("Configuration for workqueue.");
3774
3849
  var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
3775
3850
  query: true,
@@ -3788,7 +3863,8 @@ var WorkqueueConfigInput = import_zod28.z.object({
3788
3863
  })
3789
3864
  ),
3790
3865
  columns: import_zod28.z.array(WorkqueueColumn).default(mandatoryColumns),
3791
- icon: AvailableIcons
3866
+ icon: AvailableIcons,
3867
+ emptyMessage: TranslationConfig.optional()
3792
3868
  });
3793
3869
  function defineWorkqueue(workqueueInput) {
3794
3870
  const queryInput = workqueueInput.query;
@@ -3877,7 +3953,8 @@ var DeclareActionInput = BaseActionInput.merge(
3877
3953
  );
3878
3954
  var PrintCertificateActionInput = BaseActionInput.merge(
3879
3955
  import_zod29.z.object({
3880
- type: import_zod29.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
3956
+ type: import_zod29.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
3957
+ content: PrintContent.optional()
3881
3958
  })
3882
3959
  );
3883
3960
  var RejectDeclarationActionInput = BaseActionInput.merge(
@@ -4089,16 +4166,19 @@ function getLegalStatuses(actions) {
4089
4166
  }
4090
4167
 
4091
4168
  // ../commons/src/events/state/flags.ts
4092
- function isCertificatePrinted(actions) {
4169
+ function isPendingCertification(actions) {
4170
+ if (getStatusFromActions(actions) !== EventStatus.enum.REGISTERED) {
4171
+ return false;
4172
+ }
4093
4173
  return actions.reduce((prev, { type }) => {
4094
4174
  if (type === ActionType.PRINT_CERTIFICATE) {
4095
- return true;
4175
+ return false;
4096
4176
  }
4097
4177
  if (type === ActionType.APPROVE_CORRECTION) {
4098
- return false;
4178
+ return true;
4099
4179
  }
4100
4180
  return prev;
4101
- }, false);
4181
+ }, true);
4102
4182
  }
4103
4183
  function isCorrectionRequested(actions) {
4104
4184
  return actions.reduce((prev, { type }) => {
@@ -4133,8 +4213,8 @@ function getFlagsFromActions(actions) {
4133
4213
  const flag = joinValues([type, status], ":").toLowerCase();
4134
4214
  return flag;
4135
4215
  });
4136
- if (isCertificatePrinted(sortedActions)) {
4137
- flags.push(InherentFlags.PRINTED);
4216
+ if (isPendingCertification(sortedActions)) {
4217
+ flags.push(InherentFlags.PENDING_CERTIFICATION);
4138
4218
  }
4139
4219
  if (isCorrectionRequested(sortedActions)) {
4140
4220
  flags.push(InherentFlags.CORRECTION_REQUESTED);
@@ -4165,7 +4245,6 @@ function getStatusFromActions(actions) {
4165
4245
  case ActionType.NOTIFY:
4166
4246
  return EventStatus.enum.NOTIFIED;
4167
4247
  case ActionType.PRINT_CERTIFICATE:
4168
- return EventStatus.enum.CERTIFIED;
4169
4248
  case ActionType.ASSIGN:
4170
4249
  case ActionType.UNASSIGN:
4171
4250
  case ActionType.REJECT:
@@ -5130,7 +5209,27 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
5130
5209
  defaultMessage: "Applicant's name",
5131
5210
  description: "This is the label for the field",
5132
5211
  id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.firstname.label"
5133
- }
5212
+ },
5213
+ configuration: {
5214
+ name: {
5215
+ firstname: { required: true },
5216
+ middlename: { required: false },
5217
+ surname: { required: true }
5218
+ }
5219
+ },
5220
+ validation: [
5221
+ {
5222
+ validator: field("applicant.name").object({
5223
+ firstname: field("firstname").isValidEnglishName(),
5224
+ surname: field("surname").isValidEnglishName()
5225
+ }),
5226
+ message: {
5227
+ defaultMessage: "Input contains invalid characters. Please use only letters (a-z, A-Z), numbers (0-9), hyphens (-), apostrophes(') and underscores (_)",
5228
+ description: "This is the error message for invalid name",
5229
+ id: "v2.error.invalidName"
5230
+ }
5231
+ }
5232
+ ]
5134
5233
  },
5135
5234
  {
5136
5235
  id: "applicant.email",
@@ -5352,22 +5451,6 @@ var statusOptions = [
5352
5451
  id: "v2.advancedSearch.form.recordStatusRegistered"
5353
5452
  }
5354
5453
  },
5355
- {
5356
- value: EventStatus.enum.CERTIFIED,
5357
- label: {
5358
- defaultMessage: "Certified",
5359
- description: "Option for form field: status of record",
5360
- id: "v2.advancedSearch.form.recordStatusCertified"
5361
- }
5362
- },
5363
- {
5364
- value: VisibleStatus.enum.REJECTED,
5365
- label: {
5366
- defaultMessage: "Rejected",
5367
- description: "Option for form field: status of record",
5368
- id: "v2.advancedSearch.form.recordStatusRejected"
5369
- }
5370
- },
5371
5454
  {
5372
5455
  value: EventStatus.enum.ARCHIVED,
5373
5456
  label: {
@@ -7219,14 +7302,6 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
7219
7302
  ActionType.REJECT_CORRECTION,
7220
7303
  ExclusiveActions.REVIEW_CORRECTION_REQUEST
7221
7304
  ],
7222
- [EventStatus.enum.CERTIFIED]: [
7223
- ActionType.READ,
7224
- ActionType.PRINT_CERTIFICATE,
7225
- ActionType.REQUEST_CORRECTION,
7226
- ActionType.APPROVE_CORRECTION,
7227
- ActionType.REJECT_CORRECTION,
7228
- ExclusiveActions.REVIEW_CORRECTION_REQUEST
7229
- ],
7230
7305
  [EventStatus.enum.ARCHIVED]: [
7231
7306
  ActionType.READ,
7232
7307
  ActionType.ASSIGN,
@@ -7234,9 +7309,12 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
7234
7309
  ]
7235
7310
  };
7236
7311
  var getAvailableActionsForEvent = (event2) => {
7237
- return event2.flags.includes(InherentFlags.REJECTED) ? [
7238
- ActionType.READ,
7239
- event2.status === EventStatus.Enum.VALIDATED ? ActionType.VALIDATE : ActionType.DECLARE,
7240
- ActionType.ARCHIVE
7241
- ] : AVAILABLE_ACTIONS_BY_EVENT_STATUS[event2.status];
7312
+ if (event2.flags.includes(InherentFlags.REJECTED)) {
7313
+ return [
7314
+ ActionType.READ,
7315
+ event2.status === EventStatus.Enum.VALIDATED ? ActionType.VALIDATE : ActionType.DECLARE,
7316
+ ActionType.ARCHIVE
7317
+ ];
7318
+ }
7319
+ return AVAILABLE_ACTIONS_BY_EVENT_STATUS[event2.status];
7242
7320
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "1.8.1-rc.7f85c6f",
3
+ "version": "1.8.1-rc.829977e",
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