@opencrvs/toolkit 2.0.0-rc.f6aaa31 → 2.0.0-rc.f712d2c

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.
@@ -655,8 +655,8 @@ var ActionConditional = z7.discriminatedUnion("type", [
655
655
  // Action can be shown to the user in the list but as disabled
656
656
  EnableConditional
657
657
  ]).meta({
658
- description: "Action conditional configuration",
659
- id: "ActionConditional"
658
+ id: "ActionConditional",
659
+ description: "Conditional gating whether an action is shown (SHOW) or enabled (ENABLE). When omitted from an action, the action is shown and enabled for everyone."
660
660
  });
661
661
  var DisplayOnReviewConditional = z7.object({
662
662
  type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
@@ -672,8 +672,8 @@ var FieldConditional = z7.discriminatedUnion("type", [
672
672
  // Field output can be shown / hidden on the review page
673
673
  DisplayOnReviewConditional
674
674
  ]).meta({
675
- description: "Field conditional configuration",
676
- id: "FieldConditional"
675
+ id: "FieldConditional",
676
+ description: "Conditional gating whether a form field is shown (SHOW), enabled (ENABLE), or displayed on the review page (DISPLAY_ON_REVIEW). When omitted, the field is shown and enabled for everyone, and is displayed on review whenever it has a value."
677
677
  });
678
678
 
679
679
  // ../commons/src/events/FieldType.ts
@@ -770,6 +770,11 @@ var FieldTypesToHideInReview = [
770
770
  FieldType.ALPHA_PRINT_BUTTON,
771
771
  FieldType.ALPHA_HIDDEN
772
772
  ];
773
+ var HiddenFieldTypes = [
774
+ FieldType.HTTP,
775
+ FieldType.QUERY_PARAM_READER,
776
+ FieldType.ALPHA_HIDDEN
777
+ ];
773
778
 
774
779
  // ../commons/src/events/FieldValue.ts
775
780
  var z12 = __toESM(require("zod/v4"));
@@ -888,7 +893,7 @@ var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date i
888
893
  // ../commons/src/events/FieldValue.ts
889
894
  var TextValue = z12.string();
890
895
  var HiddenFieldValue = z12.string();
891
- var NonEmptyTextValue = TextValue.min(1);
896
+ var NonEmptyTextValue = z12.string().trim().min(1);
892
897
  var DateValue = z12.iso.date().describe("Date in the format YYYY-MM-DD");
893
898
  var AgeValue = z12.object({
894
899
  age: z12.number(),
@@ -917,6 +922,7 @@ var DateRangeFieldValue = z12.object({
917
922
  var EmailValue = z12.email();
918
923
  var CheckboxFieldValue = z12.boolean();
919
924
  var NumberFieldValue = z12.number();
925
+ var SignatureFieldValue = FileFieldValue;
920
926
  var ButtonFieldValue = z12.number();
921
927
  var VerificationStatusValue = z12.enum([
922
928
  "verified",
@@ -1215,8 +1221,9 @@ var RequestedCorrectionAction = ActionBase.extend(
1215
1221
  var ApprovedCorrectionAction = ActionBase.extend(
1216
1222
  z14.object({
1217
1223
  type: z14.literal(ActionType.APPROVE_CORRECTION),
1218
- requestId: z14.string()
1224
+ requestId: z14.string(),
1219
1225
  // TODO move into 'content' property
1226
+ content: z14.object({ immediateCorrection: z14.boolean().optional() }).optional()
1220
1227
  }).shape
1221
1228
  );
1222
1229
  var RejectedCorrectionAction = ActionBase.extend(
@@ -1309,8 +1316,8 @@ var FlagConfig = z15.object({
1309
1316
  ),
1310
1317
  label: TranslationConfig.describe("Human readable label of the flag.")
1311
1318
  }).meta({
1312
- description: "Flag configuration",
1313
- id: "FlagConfig"
1319
+ id: "FlagConfig",
1320
+ description: "Configuration for a custom flag that can be added to or removed from records by event actions."
1314
1321
  });
1315
1322
  var ActionFlagConfig = z15.object({
1316
1323
  id: Flag,
@@ -1319,8 +1326,8 @@ var ActionFlagConfig = z15.object({
1319
1326
  "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
1320
1327
  )
1321
1328
  }).meta({
1322
- description: "Action flag configuration",
1323
- id: "ActionFlagConfig"
1329
+ id: "ActionFlagConfig",
1330
+ description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
1324
1331
  });
1325
1332
 
1326
1333
  // ../commons/src/events/EventMetadata.ts
@@ -1665,11 +1672,28 @@ var FieldReference = import_v43.default.object({
1665
1672
  $$field: FieldId.describe("Id of the field to reference"),
1666
1673
  $$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
1667
1674
  'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
1675
+ ),
1676
+ $$code: import_v43.default.string().optional().describe(
1677
+ "Serialised client-side function body. When present the expression is evaluated rather than dereferenced."
1668
1678
  )
1669
- }).describe("Reference to a field by its ID");
1679
+ }).describe(
1680
+ "Reference to a field value, with an optional client-side computation applied."
1681
+ );
1682
+ var ComputedDefaultValue = import_v43.default.object({
1683
+ $$code: import_v43.default.string().describe(
1684
+ "Serialised client-side function body. Receives (undefined, context) where context includes $now, $online, and system variables."
1685
+ )
1686
+ }).describe("A context-only computation used as a field default value.");
1670
1687
  var ValidationConfig = import_v43.default.object({
1671
- validator: Conditional,
1672
- message: TranslationConfig
1688
+ validator: Conditional.describe(
1689
+ "Conditional expression that must hold for the field value to be considered valid."
1690
+ ),
1691
+ message: TranslationConfig.describe(
1692
+ "Error message displayed when the validator does not hold."
1693
+ )
1694
+ }).meta({
1695
+ id: "ValidationConfig",
1696
+ description: "Validation rule applied to a form field. The validator is a conditional expression that must hold for the field value to be considered valid."
1673
1697
  });
1674
1698
  var requiredSchema = import_v43.default.union([
1675
1699
  import_v43.default.boolean(),
@@ -1700,7 +1724,7 @@ var BaseField = import_v43.default.object({
1700
1724
  "Indicates whether the field can be modified during record correction."
1701
1725
  ),
1702
1726
  value: FieldReference.or(import_v43.default.array(FieldReference)).optional().describe(
1703
- "Reference to the source field or fields. When a value is defined, it is copied from the parent field when changed. If multiple references are provided, the first truthy value is used."
1727
+ "Reference to the source field or fields. When a value is defined, it is copied from the parent field when changed. If multiple references are provided, the first truthy value is used. A FieldReference with $$code computes the value via a custom client-side function."
1704
1728
  ),
1705
1729
  analytics: import_v43.default.boolean().default(false).optional().describe(
1706
1730
  "Indicates whether the field is included in analytics. When enabled, its value becomes available in the analytics dashboard."
@@ -1714,7 +1738,7 @@ var Divider = BaseField.extend({
1714
1738
  });
1715
1739
  var TextField = BaseField.extend({
1716
1740
  type: import_v43.default.literal(FieldType.TEXT),
1717
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
1741
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
1718
1742
  configuration: import_v43.default.object({
1719
1743
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
1720
1744
  type: import_v43.default.enum(["text", "password"]).optional(),
@@ -1727,7 +1751,7 @@ var TextField = BaseField.extend({
1727
1751
  });
1728
1752
  var NumberField = BaseField.extend({
1729
1753
  type: import_v43.default.literal(FieldType.NUMBER),
1730
- defaultValue: NumberFieldValue.optional(),
1754
+ defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
1731
1755
  configuration: import_v43.default.object({
1732
1756
  min: import_v43.default.number().optional().describe("Minimum value"),
1733
1757
  max: import_v43.default.number().optional().describe("Maximum value"),
@@ -1740,7 +1764,7 @@ var NumberField = BaseField.extend({
1740
1764
  });
1741
1765
  var TextAreaField = BaseField.extend({
1742
1766
  type: import_v43.default.literal(FieldType.TEXTAREA),
1743
- defaultValue: NonEmptyTextValue.optional(),
1767
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1744
1768
  configuration: import_v43.default.object({
1745
1769
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
1746
1770
  rows: import_v43.default.number().optional().describe("Number of visible text lines"),
@@ -1774,7 +1798,7 @@ var SignatureField = BaseField.extend({
1774
1798
  signaturePromptLabel: TranslationConfig.describe(
1775
1799
  "Title of the signature modal"
1776
1800
  ),
1777
- defaultValue: FieldValue.optional(),
1801
+ defaultValue: SignatureFieldValue.or(ComputedDefaultValue).optional(),
1778
1802
  configuration: import_v43.default.object({
1779
1803
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1780
1804
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
@@ -1790,14 +1814,14 @@ var EmailField = BaseField.extend({
1790
1814
  configuration: import_v43.default.object({
1791
1815
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
1792
1816
  }).default({ maxLength: 255 }).optional(),
1793
- defaultValue: NonEmptyTextValue.optional()
1817
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional()
1794
1818
  }).meta({
1795
1819
  description: "An email input field",
1796
1820
  id: "EmailField"
1797
1821
  });
1798
1822
  var DateField = BaseField.extend({
1799
1823
  type: import_v43.default.literal(FieldType.DATE),
1800
- defaultValue: SerializedNowDateTime.or(PlainDate).optional().describe("Default date value(yyyy-MM-dd)"),
1824
+ defaultValue: SerializedNowDateTime.or(PlainDate).or(ComputedDefaultValue).optional().describe("Default date value(yyyy-MM-dd)"),
1801
1825
  configuration: import_v43.default.object({
1802
1826
  notice: TranslationConfig.describe(
1803
1827
  "Text to display above the date input"
@@ -1809,7 +1833,7 @@ var DateField = BaseField.extend({
1809
1833
  });
1810
1834
  var AgeField = BaseField.extend({
1811
1835
  type: import_v43.default.literal(FieldType.AGE),
1812
- defaultValue: NumberFieldValue.optional(),
1836
+ defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
1813
1837
  configuration: import_v43.default.object({
1814
1838
  asOfDate: FieldReference,
1815
1839
  prefix: TranslationConfig.optional(),
@@ -1821,7 +1845,7 @@ var AgeField = BaseField.extend({
1821
1845
  });
1822
1846
  var TimeField = BaseField.extend({
1823
1847
  type: import_v43.default.literal(FieldType.TIME),
1824
- defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
1848
+ defaultValue: SerializedNowDateTime.or(TimeValue).or(ComputedDefaultValue).optional().describe("Default time value (HH-mm)"),
1825
1849
  configuration: import_v43.default.object({
1826
1850
  use12HourFormat: import_v43.default.boolean().optional().describe("Whether to use 12-hour format"),
1827
1851
  notice: TranslationConfig.describe(
@@ -1834,7 +1858,7 @@ var TimeField = BaseField.extend({
1834
1858
  });
1835
1859
  var DateRangeField = BaseField.extend({
1836
1860
  type: import_v43.default.literal(FieldType.DATE_RANGE),
1837
- defaultValue: DateRangeFieldValue.optional(),
1861
+ defaultValue: DateRangeFieldValue.or(ComputedDefaultValue).optional(),
1838
1862
  configuration: import_v43.default.object({
1839
1863
  notice: TranslationConfig.describe(
1840
1864
  "Text to display above the date input"
@@ -1913,7 +1937,7 @@ var PageHeader = BaseField.extend({
1913
1937
  });
1914
1938
  var File = BaseField.extend({
1915
1939
  type: import_v43.default.literal(FieldType.FILE),
1916
- defaultValue: FileFieldValue.optional(),
1940
+ defaultValue: FileFieldValue.or(ComputedDefaultValue).optional(),
1917
1941
  configuration: import_v43.default.object({
1918
1942
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1919
1943
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
@@ -1940,7 +1964,7 @@ var SelectOption = import_v43.default.object({
1940
1964
  });
1941
1965
  var NumberWithUnitField = BaseField.extend({
1942
1966
  type: import_v43.default.literal(FieldType.NUMBER_WITH_UNIT),
1943
- defaultValue: NumberWithUnitFieldValue.optional(),
1967
+ defaultValue: NumberWithUnitFieldValue.or(ComputedDefaultValue).optional(),
1944
1968
  options: import_v43.default.array(SelectOption).describe("A list of options for the unit select"),
1945
1969
  configuration: import_v43.default.object({
1946
1970
  min: import_v43.default.number().optional().describe("Minimum value of the number field"),
@@ -1955,7 +1979,7 @@ var NumberWithUnitField = BaseField.extend({
1955
1979
  });
1956
1980
  var RadioGroup = BaseField.extend({
1957
1981
  type: import_v43.default.literal(FieldType.RADIO_GROUP),
1958
- defaultValue: TextValue.optional(),
1982
+ defaultValue: TextValue.or(ComputedDefaultValue).optional(),
1959
1983
  options: import_v43.default.array(SelectOption).describe("A list of options"),
1960
1984
  configuration: import_v43.default.object({
1961
1985
  styles: import_v43.default.object({
@@ -1980,7 +2004,7 @@ var BulletList = BaseField.extend({
1980
2004
  });
1981
2005
  var Select = BaseField.extend({
1982
2006
  type: import_v43.default.literal(FieldType.SELECT),
1983
- defaultValue: TextValue.optional(),
2007
+ defaultValue: TextValue.or(ComputedDefaultValue).optional(),
1984
2008
  options: import_v43.default.array(SelectOption).describe("A list of options"),
1985
2009
  noOptionsMessage: TranslationConfig.optional().describe(
1986
2010
  `
@@ -2002,7 +2026,7 @@ var SelectDateRangeOption = import_v43.default.object({
2002
2026
  });
2003
2027
  var SelectDateRangeField = BaseField.extend({
2004
2028
  type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
2005
- defaultValue: SelectDateRangeValue.optional(),
2029
+ defaultValue: SelectDateRangeValue.or(ComputedDefaultValue).optional(),
2006
2030
  options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
2007
2031
  }).meta({
2008
2032
  description: "A date range selection field",
@@ -2019,7 +2043,7 @@ var NameField = BaseField.extend({
2019
2043
  firstname: SerializedUserField.or(NonEmptyTextValue).optional(),
2020
2044
  middlename: SerializedUserField.or(NonEmptyTextValue).optional(),
2021
2045
  surname: SerializedUserField.or(NonEmptyTextValue).optional()
2022
- }).optional(),
2046
+ }).or(ComputedDefaultValue).optional(),
2023
2047
  configuration: import_v43.default.object({
2024
2048
  name: NameConfig.default({
2025
2049
  firstname: { required: true },
@@ -2043,14 +2067,14 @@ var NameField = BaseField.extend({
2043
2067
  id: "NameField"
2044
2068
  });
2045
2069
  var PhoneField = BaseField.extend({
2046
- defaultValue: NonEmptyTextValue.optional(),
2070
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2047
2071
  type: import_v43.default.literal(FieldType.PHONE)
2048
2072
  }).meta({
2049
2073
  description: "A field for entering a phone number",
2050
2074
  id: "PhoneField"
2051
2075
  });
2052
2076
  var IdField = BaseField.extend({
2053
- defaultValue: NonEmptyTextValue.optional(),
2077
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2054
2078
  type: import_v43.default.literal(FieldType.ID)
2055
2079
  }).meta({
2056
2080
  description: "A field for entering an ID",
@@ -2058,14 +2082,14 @@ var IdField = BaseField.extend({
2058
2082
  });
2059
2083
  var Checkbox = BaseField.extend({
2060
2084
  type: import_v43.default.literal(FieldType.CHECKBOX),
2061
- defaultValue: CheckboxFieldValue.default(false)
2085
+ defaultValue: CheckboxFieldValue.or(ComputedDefaultValue).default(false)
2062
2086
  }).meta({
2063
2087
  description: "A boolean checkbox field",
2064
2088
  id: "Checkbox"
2065
2089
  });
2066
2090
  var Country = BaseField.extend({
2067
2091
  type: import_v43.default.literal(FieldType.COUNTRY),
2068
- defaultValue: NonEmptyTextValue.optional(),
2092
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2069
2093
  optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
2070
2094
  "Conditionals for specific countries. Countries not listed are always shown and enabled."
2071
2095
  )
@@ -2083,7 +2107,7 @@ var AdministrativeAreas = import_v43.default.enum([
2083
2107
  ]);
2084
2108
  var AdministrativeAreaField = BaseField.extend({
2085
2109
  type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
2086
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
2110
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
2087
2111
  configuration: import_v43.default.object({
2088
2112
  partOf: FieldReference.optional().describe("Parent location"),
2089
2113
  type: AdministrativeAreas,
@@ -2095,7 +2119,7 @@ var AdministrativeAreaField = BaseField.extend({
2095
2119
  });
2096
2120
  var LocationInput = BaseField.extend({
2097
2121
  type: import_v43.default.literal(FieldType.LOCATION),
2098
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
2122
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
2099
2123
  configuration: import_v43.default.object({
2100
2124
  locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
2101
2125
  allowedLocations: AllowedLocations
@@ -2107,7 +2131,7 @@ var LocationInput = BaseField.extend({
2107
2131
  var FileUploadWithOptions = BaseField.extend({
2108
2132
  type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
2109
2133
  options: import_v43.default.array(SelectOption).describe("A list of options"),
2110
- defaultValue: FileFieldWithOptionValue.optional(),
2134
+ defaultValue: FileFieldWithOptionValue.or(ComputedDefaultValue).optional(),
2111
2135
  configuration: import_v43.default.object({
2112
2136
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
2113
2137
  maxImageSize: import_v43.default.object({
@@ -2123,12 +2147,12 @@ var FileUploadWithOptions = BaseField.extend({
2123
2147
  });
2124
2148
  var Facility = BaseField.extend({
2125
2149
  type: import_v43.default.literal(FieldType.FACILITY),
2126
- defaultValue: NonEmptyTextValue.optional(),
2150
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2127
2151
  configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
2128
2152
  }).describe("Input field for a facility");
2129
2153
  var Office = BaseField.extend({
2130
2154
  type: import_v43.default.literal(FieldType.OFFICE),
2131
- defaultValue: NonEmptyTextValue.optional(),
2155
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2132
2156
  configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
2133
2157
  }).describe("Input field for an office");
2134
2158
  var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
@@ -2164,7 +2188,7 @@ var Address = BaseField.extend({
2164
2188
  ).optional(),
2165
2189
  allowedLocations: AllowedLocations
2166
2190
  }).optional(),
2167
- defaultValue: DefaultAddressFieldValue.optional()
2191
+ defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
2168
2192
  }).meta({
2169
2193
  description: "Address input field \u2013 a combination of location and text fields",
2170
2194
  id: "Address"
@@ -2211,7 +2235,7 @@ var ButtonConfiguration = import_v43.default.object({
2211
2235
  });
2212
2236
  var ButtonField = BaseField.extend({
2213
2237
  type: import_v43.default.literal(FieldType.BUTTON),
2214
- defaultValue: ButtonFieldValue.optional(),
2238
+ defaultValue: ButtonFieldValue.or(ComputedDefaultValue).optional(),
2215
2239
  configuration: ButtonConfiguration
2216
2240
  }).meta({
2217
2241
  description: "A generic button that can be used to trigger an action",
@@ -2239,7 +2263,7 @@ var AlphaPrintButton = BaseField.extend({
2239
2263
  });
2240
2264
  var HttpField = BaseField.extend({
2241
2265
  type: import_v43.default.literal(FieldType.HTTP),
2242
- defaultValue: HttpFieldValue.optional(),
2266
+ defaultValue: HttpFieldValue.or(ComputedDefaultValue).optional(),
2243
2267
  configuration: import_v43.default.object({
2244
2268
  trigger: FieldReference.optional().describe(
2245
2269
  "Reference to the field that triggers the HTTP request when its value changes. If not provided, the HTTP request is triggered once on component mount."
@@ -2325,7 +2349,7 @@ var LinkButtonField = BaseField.extend({
2325
2349
  });
2326
2350
  var VerificationStatus = BaseField.extend({
2327
2351
  type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
2328
- defaultValue: VerificationStatusValue.optional(),
2352
+ defaultValue: VerificationStatusValue.or(ComputedDefaultValue).optional(),
2329
2353
  configuration: import_v43.default.object({
2330
2354
  status: TranslationConfig.describe("Text to display on the status pill."),
2331
2355
  description: TranslationConfig.describe(
@@ -2347,7 +2371,7 @@ var QueryParamReaderField = BaseField.extend({
2347
2371
  });
2348
2372
  var QrReaderField = BaseField.extend({
2349
2373
  type: import_v43.default.literal(FieldType.QR_READER),
2350
- defaultValue: QrReaderFieldValue.optional(),
2374
+ defaultValue: QrReaderFieldValue.or(ComputedDefaultValue).optional(),
2351
2375
  configuration: import_v43.default.object({
2352
2376
  validator: import_v43.default.any().meta({
2353
2377
  description: "JSON Schema to validate the scanned QR code data against before populating the form fields.",
@@ -2360,7 +2384,7 @@ var QrReaderField = BaseField.extend({
2360
2384
  });
2361
2385
  var IdReaderField = BaseField.extend({
2362
2386
  type: import_v43.default.literal(FieldType.ID_READER),
2363
- defaultValue: IdReaderFieldValue.optional(),
2387
+ defaultValue: IdReaderFieldValue.or(ComputedDefaultValue).optional(),
2364
2388
  methods: import_v43.default.array(
2365
2389
  import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
2366
2390
  )
@@ -2503,15 +2527,18 @@ var VerificationPageConfig = FormPageConfig.extend({
2503
2527
  actions: VerificationActionConfig
2504
2528
  });
2505
2529
  var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
2506
- description: "Page configuration",
2507
- id: "PageConfig"
2530
+ id: "PageConfig",
2531
+ description: "Configuration for a single page in a form. Either a form page with fields and a continue button, or a verification page with verify/cancel options."
2508
2532
  });
2509
2533
 
2510
2534
  // ../commons/src/events/FormConfig.ts
2511
2535
  var DeclarationFormConfig = z22.object({
2512
2536
  label: TranslationConfig.describe("Human readable description of the form"),
2513
2537
  pages: z22.array(FormPageConfig)
2514
- }).describe("Configuration of the declaration form.");
2538
+ }).meta({
2539
+ id: "DeclarationFormConfig",
2540
+ description: "Configuration of the declaration form."
2541
+ });
2515
2542
  var ActionFormConfig = z22.object({
2516
2543
  label: TranslationConfig.describe("Human readable description of the form"),
2517
2544
  pages: z22.array(PageConfig)
@@ -2611,6 +2638,9 @@ var DeduplicationConfig = z23.object({
2611
2638
  id: z23.string(),
2612
2639
  label: TranslationConfig,
2613
2640
  query: Clause
2641
+ }).meta({
2642
+ id: "DeduplicationConfig",
2643
+ description: "Configuration for duplicate detection on a declare or register action. The query is built from fuzzy / strict / date-range matchers combined with and/or/not."
2614
2644
  });
2615
2645
 
2616
2646
  // ../commons/src/events/ActionConfig.ts
@@ -2728,17 +2758,42 @@ var ActionConfig = z24.discriminatedUnion("type", [
2728
2758
  * OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
2729
2759
  * and treat them as "models" instead of duplicating the data structure in each endpoint.
2730
2760
  */
2731
- ReadActionConfig.meta({ id: "ReadActionConfig" }),
2732
- DeclareConfig.meta({ id: "DeclareActionConfig" }),
2733
- RejectConfig.meta({ id: "RejectActionConfig" }),
2734
- RegisterConfig.meta({ id: "RegisterActionConfig" }),
2761
+ ReadActionConfig.meta({
2762
+ id: "ReadActionConfig",
2763
+ description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
2764
+ }),
2765
+ DeclareConfig.meta({
2766
+ id: "DeclareActionConfig",
2767
+ description: "Configuration for the declare action. Includes review-page fields. Shared with the notify action (ActionType.NOTIFY)."
2768
+ }),
2769
+ RejectConfig.meta({
2770
+ id: "RejectActionConfig",
2771
+ description: "Configuration for rejecting a record before registration."
2772
+ }),
2773
+ RegisterConfig.meta({
2774
+ id: "RegisterActionConfig",
2775
+ description: "Configuration for registering a record."
2776
+ }),
2735
2777
  PrintCertificateActionConfig.meta({
2736
- id: "PrintCertificateActionConfig"
2778
+ id: "PrintCertificateActionConfig",
2779
+ description: "Configuration for printing a certificate of a registered record."
2780
+ }),
2781
+ RequestCorrectionConfig.meta({
2782
+ id: "RequestCorrectionActionConfig",
2783
+ description: "Configuration for requesting a correction on a registered record."
2784
+ }),
2785
+ EditActionConfig.meta({
2786
+ id: "EditActionConfig",
2787
+ description: "Configuration for editing a record before registration."
2788
+ }),
2789
+ ArchiveConfig.meta({
2790
+ id: "ArchiveActionConfig",
2791
+ description: "Configuration for archiving a record."
2737
2792
  }),
2738
- RequestCorrectionConfig.meta({ id: "RequestCorrectionActionConfig" }),
2739
- EditActionConfig.meta({ id: "EditActionConfig" }),
2740
- ArchiveConfig.meta({ id: "ArchiveActionConfig" }),
2741
- CustomActionConfig.meta({ id: "CustomActionConfig" })
2793
+ CustomActionConfig.meta({
2794
+ id: "CustomActionConfig",
2795
+ description: "Configuration for a country-defined custom action. An event may include any number of these."
2796
+ })
2742
2797
  ]).describe(
2743
2798
  "Configuration of an action available for an event. Data collected depends on the action type and is accessible through the annotation property in ActionDocument."
2744
2799
  ).meta({ id: "ActionConfig" });
@@ -2814,7 +2869,10 @@ var Field = BaseField2.extend({
2814
2869
  }).describe("Custom field defined for the summary view.");
2815
2870
  var SummaryConfig = z27.object({
2816
2871
  fields: z27.array(z27.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
2817
- }).describe("Configuration of the event summary section.");
2872
+ }).meta({
2873
+ id: "SummaryConfig",
2874
+ description: "Configuration of the event overview page. Defines which declaration fields appear in the record summary, optionally with custom labels, empty-value messages, and templated values."
2875
+ });
2818
2876
 
2819
2877
  // ../commons/src/events/AdvancedSearchConfig.ts
2820
2878
  var z28 = __toESM(require("zod/v4"));
@@ -2885,6 +2943,9 @@ var BaseField3 = z28.object({
2885
2943
  ),
2886
2944
  validations: z28.array(ValidationConfig).optional().describe(
2887
2945
  `Option for overriding the field validations specifically for advanced search form.`
2946
+ ),
2947
+ allowedLocations: JurisdictionReference.optional().describe(
2948
+ `Override the allowedLocations for a location field in advanced search. Use this when the declaration form's allowedLocations references a scope (e.g. record.create) that search-only users don't have \u2014 specify record.search scope instead.`
2888
2949
  )
2889
2950
  });
2890
2951
  var SearchQueryParams = z28.object({
@@ -2938,6 +2999,9 @@ var AdvancedSearchField = z28.discriminatedUnion("fieldType", [FieldConfigSchema
2938
2999
  var AdvancedSearchConfig = z28.object({
2939
3000
  title: TranslationConfig.describe("Advanced search tab title"),
2940
3001
  fields: z28.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
3002
+ }).meta({
3003
+ id: "AdvancedSearchConfig",
3004
+ description: "Configuration of one advanced search tab. Each tab has a title and a list of searchable fields \u2014 either declaration fields (via `field()`) or event metadata (via `event()`)."
2941
3005
  });
2942
3006
 
2943
3007
  // ../commons/src/events/utils.ts
@@ -2988,7 +3052,37 @@ function resolveDataPath(rootData, dataPath, instancePath) {
2988
3052
  }
2989
3053
  return current;
2990
3054
  }
3055
+ function todayISO() {
3056
+ return (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
3057
+ }
3058
+ var compiledFunctionCache = /* @__PURE__ */ new Map();
3059
+ function compileClientFunction(code) {
3060
+ let fn = compiledFunctionCache.get(code);
3061
+ if (!fn) {
3062
+ fn = new Function(`return (${code})`)();
3063
+ compiledFunctionCache.set(code, fn);
3064
+ }
3065
+ return fn;
3066
+ }
2991
3067
  (0, import_ajv_formats.default)(ajv);
3068
+ function buildClientFunctionContext(input) {
3069
+ return {
3070
+ $form: input.form,
3071
+ $now: todayISO(),
3072
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
3073
+ $online: isOnline(),
3074
+ $user: input.validatorContext?.user,
3075
+ $event: input.validatorContext?.event,
3076
+ $leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
3077
+ user: input.systemVariables?.user,
3078
+ $window: input.systemVariables?.$window,
3079
+ locations: input.locations,
3080
+ adminLevelIds: input.adminLevelIds
3081
+ };
3082
+ }
3083
+ function runClientFunction(code, data, context) {
3084
+ return compileClientFunction(code)(data, context);
3085
+ }
2992
3086
  ajv.addKeyword({
2993
3087
  keyword: "daysFromDate",
2994
3088
  type: "string",
@@ -3033,12 +3127,35 @@ ajv.addKeyword({
3033
3127
  $data: true,
3034
3128
  errors: true,
3035
3129
  // @ts-ignore -- Force type. We will move this away from AJV next. Parsing the array will take seconds and is only called by core.
3036
- validate(schema, data, _2, dataContext) {
3130
+ validate(_schema, data, _2, dataContext) {
3037
3131
  const locationIdInput = data;
3038
3132
  const locations = dataContext?.rootData.$leafAdminStructureLocationIds ?? [];
3039
3133
  return locations.some((location) => location.id === locationIdInput);
3040
3134
  }
3041
3135
  });
3136
+ ajv.addKeyword({
3137
+ keyword: "customClientValidator",
3138
+ schemaType: "object",
3139
+ errors: true,
3140
+ // @ts-expect-error -- AJV's public types don't expose `rootData`. All
3141
+ // `validate()` callers build root data via `buildClientFunctionContext`,
3142
+ // so the cast holds.
3143
+ validate(schema, data, _2, dataContext) {
3144
+ return Boolean(
3145
+ runClientFunction(
3146
+ schema.code,
3147
+ data,
3148
+ dataContext?.rootData ?? buildClientFunctionContext({ form: {} })
3149
+ )
3150
+ );
3151
+ }
3152
+ });
3153
+ function isOnline() {
3154
+ if (typeof window !== "undefined" && typeof navigator !== "undefined") {
3155
+ return navigator.onLine;
3156
+ }
3157
+ return true;
3158
+ }
3042
3159
 
3043
3160
  // ../commons/src/utils.ts
3044
3161
  var z32 = __toESM(require("zod/v4"));
@@ -3657,7 +3774,54 @@ function createFieldConditionals(fieldId) {
3657
3774
  }
3658
3775
  },
3659
3776
  required: [fieldId]
3660
- })
3777
+ }),
3778
+ /**
3779
+ * Custom client-side validator. The provided function is serialised and executed
3780
+ * just-in-time on the client only. External references (e.g. lodash) are not
3781
+ * available inside the function body — all logic must be self-contained.
3782
+ *
3783
+ * @example
3784
+ * field('nid').customClientValidator((value) => {
3785
+ * // LUHN check — all logic must be inline
3786
+ * const digits = String(value).split('').map(Number)
3787
+ * // ...
3788
+ * return isValid
3789
+ * })
3790
+ */
3791
+ customClientValidator(validationFn) {
3792
+ const code = validationFn.toString();
3793
+ return defineFormConditional({
3794
+ type: "object",
3795
+ properties: wrapToPath(
3796
+ { [fieldId]: { customClientValidator: { code } } },
3797
+ this.$$subfield
3798
+ ),
3799
+ required: [fieldId]
3800
+ });
3801
+ },
3802
+ /**
3803
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
3804
+ * that can be used as the `value` property or a DATA component entry.
3805
+ * The function receives the referenced field's value as the first argument and
3806
+ * the full form context as the second; its return value replaces the field reference.
3807
+ * The function is serialised and executed just-in-time on the client only.
3808
+ * External references (e.g. lodash) are not available inside the function body.
3809
+ *
3810
+ * For computing a default value without referencing a specific field, use
3811
+ * `evaluate(fn)` in the `defaultValue` property instead.
3812
+ *
3813
+ * @example
3814
+ * field('a').customClientEvaluation((aValue, ctx) =>
3815
+ * Number(aValue) + Number(ctx.$form.b)
3816
+ * )
3817
+ */
3818
+ customClientEvaluation(computationFn) {
3819
+ return {
3820
+ $$code: computationFn.toString(),
3821
+ $$field: fieldId,
3822
+ $$subfield: this.$$subfield
3823
+ };
3824
+ }
3661
3825
  };
3662
3826
  }
3663
3827
 
@@ -3830,8 +3994,9 @@ var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
3830
3994
  validateActionFlags(event2, ctx);
3831
3995
  validateActionOrder(event2, ctx);
3832
3996
  }).meta({
3833
- id: "EventConfig"
3834
- }).describe("Configuration defining an event type.");
3997
+ id: "EventConfig",
3998
+ description: "Configuration defining an event type registered in OpenCRVS (for example birth or death)."
3999
+ });
3835
4000
 
3836
4001
  // ../commons/src/events/EventConfigInput.ts
3837
4002
  var defineDeclarationForm = (form) => DeclarationFormConfig.parse(form);
@@ -4053,6 +4218,9 @@ var WorkqueueColumnValue = z34.object({
4053
4218
  var WorkqueueColumn = z34.object({
4054
4219
  label: TranslationConfig,
4055
4220
  value: WorkqueueColumnValue
4221
+ }).meta({
4222
+ id: "WorkqueueColumn",
4223
+ description: "Configuration for a single workqueue column. The value references an event metadata key (e.g. `dateOfEvent`, `status`, `trackingId`)."
4056
4224
  });
4057
4225
  function defineWorkqueuesColumns(workqueueColumns) {
4058
4226
  return workqueueColumns.map(
@@ -4258,8 +4426,8 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
4258
4426
  var WorkqueueConfigInput = WorkqueueConfig.extend({
4259
4427
  query: CountryConfigQueryInputType
4260
4428
  }).meta({
4261
- description: "Workqueue configuration",
4262
- id: "WorkqueueConfig"
4429
+ id: "WorkqueueConfig",
4430
+ description: "Configuration for a single workqueue. Defines the filter applied to the event index, the quick-action button, the columns shown on each row, and the message rendered when the queue is empty."
4263
4431
  });
4264
4432
  var WorkqueueCountInput = z37.array(
4265
4433
  z37.object({ slug: z37.string(), query: QueryType })
@@ -4301,7 +4469,9 @@ var BaseActionInput = z38.object({
4301
4469
  keepAssignment: z38.boolean().optional(),
4302
4470
  keepAssignmentIfAccepted: z38.boolean().optional(),
4303
4471
  keepAssignmentIfRejected: z38.boolean().optional(),
4304
- waitFor: z38.boolean().optional(),
4472
+ waitFor: z38.boolean().default(true).describe(
4473
+ "Whether action waits for the indexing before returning. Defaults to true. Setting this to to false completes faster but might lead to stale data in the client if the client tries to read the event immediately after performing the action. Use with care."
4474
+ ),
4305
4475
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
4306
4476
  // @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
4307
4477
  createdAtLocation: UUID.nullish().describe(
@@ -4419,7 +4589,8 @@ var RejectCorrectionActionInput = BaseActionInput.extend(
4419
4589
  var ApproveCorrectionActionInput = BaseActionInput.extend(
4420
4590
  z38.object({
4421
4591
  requestId: z38.string(),
4422
- type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
4592
+ type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION),
4593
+ content: z38.object({ immediateCorrection: z38.boolean().optional() }).optional()
4423
4594
  }).shape
4424
4595
  );
4425
4596
  var ReadActionInput = BaseActionInput.extend(
@@ -4481,7 +4652,7 @@ var Draft = z39.object({
4481
4652
  }).describe(
4482
4653
  "A temporary storage for an action. Stored with details of the event, creator and creation time."
4483
4654
  );
4484
- var DraftInput = BaseActionInput.extend({
4655
+ var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
4485
4656
  type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
4486
4657
  status: z39.enum([
4487
4658
  ActionStatus.Requested,
@@ -7075,10 +7246,380 @@ var ACTION_FILTERS = {
7075
7246
  [ActionType.UNASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7076
7247
  [ActionType.CUSTOM]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
7077
7248
  };
7249
+ var REJECTED_ACTIONS = [
7250
+ ActionType.READ,
7251
+ ActionType.NOTIFY,
7252
+ ActionType.CUSTOM,
7253
+ ActionType.EDIT,
7254
+ ActionType.ARCHIVE
7255
+ ];
7078
7256
 
7079
7257
  // ../commons/src/events/FileUtils.ts
7080
7258
  var import_lodash7 = require("lodash");
7081
7259
 
7260
+ // ../commons/src/events/mocks.test.utils.ts
7261
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7262
+ {
7263
+ id: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7264
+ name: "Central",
7265
+ parentId: null,
7266
+ validUntil: null,
7267
+ externalId: "ydyJb1RAy4U1"
7268
+ },
7269
+ {
7270
+ id: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7271
+ name: "Sulaka",
7272
+ parentId: null,
7273
+ validUntil: null,
7274
+ externalId: "pQ8nGxWmZ2Q3"
7275
+ },
7276
+ {
7277
+ id: "7ef2b9c7-5e6d-49f6-ae05-656207d0fc64",
7278
+ name: "Pualula",
7279
+ parentId: null,
7280
+ validUntil: null,
7281
+ externalId: "Aq91DweLmT8k"
7282
+ },
7283
+ {
7284
+ id: "6d1a59df-988c-4021-a846-ccbc021931a7",
7285
+ name: "Chuminga",
7286
+ parentId: null,
7287
+ validUntil: null,
7288
+ externalId: "Rw0fYNh2Xk9a"
7289
+ },
7290
+ {
7291
+ id: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7292
+ name: "Ibombo",
7293
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7294
+ validUntil: null,
7295
+ externalId: "k7DsP4vbN1Qe"
7296
+ },
7297
+ {
7298
+ id: "27160bbd-32d1-4625-812f-860226bfb92a",
7299
+ name: "Isango",
7300
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7301
+ validUntil: null,
7302
+ externalId: "Gm3Z9eQpHw4L"
7303
+ },
7304
+ {
7305
+ id: "967032fd-3f81-478a-826c-30cb8fe121bd",
7306
+ name: "Isamba",
7307
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7308
+ validUntil: null,
7309
+ externalId: "sT0xVu1KqJ7r"
7310
+ },
7311
+ {
7312
+ id: "89a33893-b17d-481d-a26d-6461e7ac1651",
7313
+ name: "Itambo",
7314
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7315
+ validUntil: null,
7316
+ externalId: "Nq6Bv2HpL9Te"
7317
+ },
7318
+ {
7319
+ id: "d42ab2fe-e7ed-470e-8b31-4fb27f9b8250",
7320
+ name: "Ezhi",
7321
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7322
+ validUntil: null,
7323
+ externalId: "xK8cQ0ZRy5Wd"
7324
+ },
7325
+ {
7326
+ id: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7327
+ name: "Ilanga",
7328
+ parentId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7329
+ validUntil: null,
7330
+ externalId: "Cq4Jm1XvN8Ls"
7331
+ },
7332
+ // Villages under Ibombo (62a0ccb4-880d-4f30-8882-f256007dfff9)
7333
+ {
7334
+ id: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7335
+ name: "Klow",
7336
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7337
+ validUntil: null,
7338
+ externalId: "IkYcYBUcyY2"
7339
+ },
7340
+ {
7341
+ id: "2e5f6a7b-8c9d-4a23-8fab-456789012345",
7342
+ name: "Mbondo",
7343
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7344
+ validUntil: null,
7345
+ externalId: "Qhvv5hvo3mY"
7346
+ },
7347
+ {
7348
+ id: "3f6a7b8c-9d0e-4b34-8abc-567890123456",
7349
+ name: "Ndara",
7350
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7351
+ validUntil: null,
7352
+ externalId: "crXh068O9TR"
7353
+ },
7354
+ {
7355
+ id: "4a7b8c9d-0e1f-4c45-abcd-678901234567",
7356
+ name: "Olani",
7357
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7358
+ validUntil: null,
7359
+ externalId: "r00It8Tvvp7"
7360
+ },
7361
+ {
7362
+ id: "5b8c9d0e-1f2a-4d56-bcde-789012345678",
7363
+ name: "Pemba",
7364
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7365
+ validUntil: null,
7366
+ externalId: "ZnUWsbONIaH"
7367
+ },
7368
+ {
7369
+ id: "6c9d0e1f-2a3b-4e67-8def-890123456789",
7370
+ name: "Quanza",
7371
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7372
+ validUntil: null,
7373
+ externalId: "fDZycvQTa7l"
7374
+ },
7375
+ {
7376
+ id: "7d0e1f2a-3b4c-4f78-8efa-901234567890",
7377
+ name: "Rivka",
7378
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7379
+ validUntil: null,
7380
+ externalId: "KqswxCGTELa"
7381
+ },
7382
+ // Villages under Isamba (967032fd-3f81-478a-826c-30cb8fe121bd)
7383
+ {
7384
+ id: "8e1f2a3b-4c5d-4089-8fab-012345678901",
7385
+ name: "Mbula",
7386
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7387
+ validUntil: null,
7388
+ externalId: "osEbKjRc9Kg"
7389
+ },
7390
+ {
7391
+ id: "9f2a3b4c-5d6e-4190-8abf-123456789012",
7392
+ name: "Ndoki",
7393
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7394
+ validUntil: null,
7395
+ externalId: "aq4daBUAGr3"
7396
+ },
7397
+ {
7398
+ id: "0a3b4c5d-6e7f-4201-abcd-234567890123",
7399
+ name: "Tsanga",
7400
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7401
+ validUntil: null,
7402
+ externalId: "cqis6Y8trbJ"
7403
+ },
7404
+ {
7405
+ id: "1b4c5d6e-7f8a-4312-bcde-345678901234",
7406
+ name: "Waziri",
7407
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7408
+ validUntil: null,
7409
+ externalId: "LMijHPyyx6d"
7410
+ },
7411
+ {
7412
+ id: "2c5d6e7f-8a9b-4423-8def-456789012345",
7413
+ name: "Zimbi",
7414
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7415
+ validUntil: null,
7416
+ externalId: "pcQYbPuKGZ7"
7417
+ },
7418
+ // Villages under Itambo (89a33893-b17d-481d-a26d-6461e7ac1651)
7419
+ {
7420
+ id: "3d6e7f8a-9b0c-4534-8efa-567890123456",
7421
+ name: "Felani",
7422
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7423
+ validUntil: null,
7424
+ externalId: "gSqpoCGdMXp"
7425
+ },
7426
+ {
7427
+ id: "4e7f8a9b-0c1d-4645-8fab-678901234567",
7428
+ name: "Goroma",
7429
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7430
+ validUntil: null,
7431
+ externalId: "KvAAIaNqVrp"
7432
+ },
7433
+ {
7434
+ id: "5f8a9b0c-1d2e-4756-8abc-789012345678",
7435
+ name: "Halifu",
7436
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7437
+ validUntil: null,
7438
+ externalId: "qe4UnEVt1hv"
7439
+ },
7440
+ {
7441
+ id: "6a9b0c1d-2e3f-4867-abcd-890123456789",
7442
+ name: "Jabari",
7443
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7444
+ validUntil: null,
7445
+ externalId: "yHH9Nz4rLOt"
7446
+ },
7447
+ {
7448
+ id: "7b0c1d2e-3f4a-4978-bcde-901234567890",
7449
+ name: "Kifani",
7450
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7451
+ validUntil: null,
7452
+ externalId: "eSWmXIGeu1I"
7453
+ },
7454
+ {
7455
+ id: "8c1d2e3f-4a5b-4089-8def-012345678901",
7456
+ name: "Lumela",
7457
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7458
+ validUntil: null,
7459
+ externalId: "bh0b3aI1uP3"
7460
+ }
7461
+ ];
7462
+ var V2_DEFAULT_MOCK_LOCATIONS = [
7463
+ {
7464
+ id: "6f6186ce-cd5f-4a5f-810a-2d99e7c4ba12",
7465
+ name: "Central Provincial Office",
7466
+ locationType: "CRVS_OFFICE",
7467
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7468
+ validUntil: null,
7469
+ externalId: "Xr3Df8WpK6Ys"
7470
+ },
7471
+ {
7472
+ id: "b1c2d3e4-f5a6-7890-bcde-f12345678901",
7473
+ name: "Central Health Post",
7474
+ locationType: "HEALTH_FACILITY",
7475
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7476
+ validUntil: null
7477
+ },
7478
+ {
7479
+ id: "028d2c85-ca31-426d-b5d1-2cef545a4902",
7480
+ name: "Ibombo District Office",
7481
+ locationType: "CRVS_OFFICE",
7482
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7483
+ validUntil: null,
7484
+ externalId: "Sm4Nw7GrD2Vy"
7485
+ },
7486
+ {
7487
+ id: "62a0ccb4-4f30-4f30-8882-f256007dff9f",
7488
+ name: "Isamba District Office",
7489
+ locationType: "CRVS_OFFICE",
7490
+ administrativeAreaId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7491
+ validUntil: null,
7492
+ externalId: "Vg1Bq5XeH9Lt"
7493
+ },
7494
+ {
7495
+ id: "954c93e1-13f7-4435-bb82-35e0e215e07d",
7496
+ name: "Isango District Office",
7497
+ locationType: "CRVS_OFFICE",
7498
+ administrativeAreaId: "27160bbd-32d1-4625-812f-860226bfb92a",
7499
+ validUntil: null,
7500
+ externalId: "Je7Lm2XqN9Vz"
7501
+ },
7502
+ {
7503
+ id: "2884f5b9-17b4-49ce-bf4d-f538228935df",
7504
+ name: "Sulaka Provincial Office",
7505
+ locationType: "CRVS_OFFICE",
7506
+ administrativeAreaId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7507
+ validUntil: null,
7508
+ externalId: "Ht2Wp9KcX5Qv"
7509
+ },
7510
+ {
7511
+ id: "030358c6-54af-44be-821b-8e4af963a49c",
7512
+ name: "Ilanga District Office",
7513
+ locationType: "CRVS_OFFICE",
7514
+ administrativeAreaId: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7515
+ validUntil: null,
7516
+ externalId: "Yp6Ds1WqN3Xz"
7517
+ },
7518
+ {
7519
+ id: "423d000f-101b-47c0-8b86-21a908067cee",
7520
+ name: "Chamakubi Health Post",
7521
+ locationType: "HEALTH_FACILITY",
7522
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7523
+ validUntil: null,
7524
+ externalId: "M1nFr8LbC2Qy"
7525
+ },
7526
+ {
7527
+ id: "4d3279be-d026-420c-88f7-f0a4ae986973",
7528
+ name: "Ibombo Rural Health Centre",
7529
+ locationType: "HEALTH_FACILITY",
7530
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7531
+ validUntil: null,
7532
+ externalId: "bT7pV6YrW0Xc"
7533
+ },
7534
+ {
7535
+ id: "190902f4-1d77-476a-8947-41145af1db7d",
7536
+ name: "Chikobo Rural Health Centre",
7537
+ locationType: "HEALTH_FACILITY",
7538
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7539
+ validUntil: null,
7540
+ externalId: "zE4qPn2SgJ5d"
7541
+ },
7542
+ {
7543
+ id: "f5ecbd9b-a01e-4a65-910e-70e86ab41b71",
7544
+ name: "Chilochabalenje Health Post",
7545
+ locationType: "HEALTH_FACILITY",
7546
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7547
+ validUntil: null,
7548
+ externalId: "H8vDs1MqR4Uf"
7549
+ },
7550
+ {
7551
+ id: "dbfc178f-7295-4b90-b28d-111c95b03127",
7552
+ name: "Chipeso Rural Health Centre",
7553
+ locationType: "HEALTH_FACILITY",
7554
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7555
+ validUntil: null,
7556
+ externalId: "Qw3uZ9KfX6Lm"
7557
+ },
7558
+ {
7559
+ id: "09862bfe-c7ac-46cd-987b-668681533c80",
7560
+ name: "Chisamba Rural Health Centre",
7561
+ locationType: "HEALTH_FACILITY",
7562
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7563
+ validUntil: null,
7564
+ externalId: "Yr0pCg8LdM2s"
7565
+ },
7566
+ {
7567
+ id: "834ce389-e95b-4fb0-96a0-33e9ab323059",
7568
+ name: "Chitanda Rural Health Centre",
7569
+ locationType: "HEALTH_FACILITY",
7570
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7571
+ validUntil: null,
7572
+ externalId: "tS9gJ4PwB1Qx"
7573
+ },
7574
+ {
7575
+ id: "0431c433-6062-4a4c-aee9-25271aec61ee",
7576
+ name: "Golden Valley Rural Health Centre",
7577
+ locationType: "HEALTH_FACILITY",
7578
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7579
+ validUntil: null,
7580
+ externalId: "Ld7Qm3XsA8Vr"
7581
+ },
7582
+ {
7583
+ id: "bc84d0b6-7ba7-480d-a339-5d9920d90eb2",
7584
+ name: "Ipongo Rural Health Centre",
7585
+ locationType: "HEALTH_FACILITY",
7586
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7587
+ validUntil: null,
7588
+ externalId: "kF2sW9DmH0Bt"
7589
+ },
7590
+ {
7591
+ id: "4cf1f53b-b730-41d2-8649-dff7eeed970d",
7592
+ name: "Itumbwe Health Post",
7593
+ locationType: "HEALTH_FACILITY",
7594
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7595
+ validUntil: null,
7596
+ externalId: "Ue5Xb3VaC7Pq"
7597
+ },
7598
+ {
7599
+ id: "4b3676cb-9355-4942-9eb9-2ce46acaf0e0",
7600
+ name: "Kabangalala Rural Health Centre",
7601
+ locationType: "HEALTH_FACILITY",
7602
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7603
+ validUntil: null,
7604
+ externalId: "Pz8Kc1TqH6Jn"
7605
+ },
7606
+ // Village offices
7607
+ {
7608
+ id: "1f4a5b6c-7d8e-4312-8abc-345678901234",
7609
+ name: "Klow Village Office",
7610
+ locationType: "CRVS_OFFICE",
7611
+ administrativeAreaId: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7612
+ validUntil: null,
7613
+ externalId: "PmAyxAJkxiJ"
7614
+ }
7615
+ ];
7616
+ var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
7617
+ V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, l])
7618
+ );
7619
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
7620
+ V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
7621
+ );
7622
+
7082
7623
  // ../commons/src/notification/UserNotifications.ts
7083
7624
  var z44 = __toESM(require("zod/v4"));
7084
7625
  var TriggerEvent = {