@opencrvs/toolkit 2.0.0-rc.4844c26 → 2.0.0-rc.484c28e

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,10 +1751,11 @@ 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"),
1758
+ integer: import_v43.default.boolean().optional().describe("When true, only whole numbers are allowed"),
1734
1759
  prefix: TranslationConfig.optional(),
1735
1760
  postfix: TranslationConfig.optional()
1736
1761
  }).optional()
@@ -1740,7 +1765,7 @@ var NumberField = BaseField.extend({
1740
1765
  });
1741
1766
  var TextAreaField = BaseField.extend({
1742
1767
  type: import_v43.default.literal(FieldType.TEXTAREA),
1743
- defaultValue: NonEmptyTextValue.optional(),
1768
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1744
1769
  configuration: import_v43.default.object({
1745
1770
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
1746
1771
  rows: import_v43.default.number().optional().describe("Number of visible text lines"),
@@ -1774,7 +1799,7 @@ var SignatureField = BaseField.extend({
1774
1799
  signaturePromptLabel: TranslationConfig.describe(
1775
1800
  "Title of the signature modal"
1776
1801
  ),
1777
- defaultValue: FieldValue.optional(),
1802
+ defaultValue: SignatureFieldValue.or(ComputedDefaultValue).optional(),
1778
1803
  configuration: import_v43.default.object({
1779
1804
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1780
1805
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
@@ -1790,14 +1815,14 @@ var EmailField = BaseField.extend({
1790
1815
  configuration: import_v43.default.object({
1791
1816
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
1792
1817
  }).default({ maxLength: 255 }).optional(),
1793
- defaultValue: NonEmptyTextValue.optional()
1818
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional()
1794
1819
  }).meta({
1795
1820
  description: "An email input field",
1796
1821
  id: "EmailField"
1797
1822
  });
1798
1823
  var DateField = BaseField.extend({
1799
1824
  type: import_v43.default.literal(FieldType.DATE),
1800
- defaultValue: SerializedNowDateTime.or(PlainDate).optional().describe("Default date value(yyyy-MM-dd)"),
1825
+ defaultValue: SerializedNowDateTime.or(PlainDate).or(ComputedDefaultValue).optional().describe("Default date value(yyyy-MM-dd)"),
1801
1826
  configuration: import_v43.default.object({
1802
1827
  notice: TranslationConfig.describe(
1803
1828
  "Text to display above the date input"
@@ -1809,7 +1834,7 @@ var DateField = BaseField.extend({
1809
1834
  });
1810
1835
  var AgeField = BaseField.extend({
1811
1836
  type: import_v43.default.literal(FieldType.AGE),
1812
- defaultValue: NumberFieldValue.optional(),
1837
+ defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
1813
1838
  configuration: import_v43.default.object({
1814
1839
  asOfDate: FieldReference,
1815
1840
  prefix: TranslationConfig.optional(),
@@ -1821,7 +1846,7 @@ var AgeField = BaseField.extend({
1821
1846
  });
1822
1847
  var TimeField = BaseField.extend({
1823
1848
  type: import_v43.default.literal(FieldType.TIME),
1824
- defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
1849
+ defaultValue: SerializedNowDateTime.or(TimeValue).or(ComputedDefaultValue).optional().describe("Default time value (HH-mm)"),
1825
1850
  configuration: import_v43.default.object({
1826
1851
  use12HourFormat: import_v43.default.boolean().optional().describe("Whether to use 12-hour format"),
1827
1852
  notice: TranslationConfig.describe(
@@ -1834,7 +1859,7 @@ var TimeField = BaseField.extend({
1834
1859
  });
1835
1860
  var DateRangeField = BaseField.extend({
1836
1861
  type: import_v43.default.literal(FieldType.DATE_RANGE),
1837
- defaultValue: DateRangeFieldValue.optional(),
1862
+ defaultValue: DateRangeFieldValue.or(ComputedDefaultValue).optional(),
1838
1863
  configuration: import_v43.default.object({
1839
1864
  notice: TranslationConfig.describe(
1840
1865
  "Text to display above the date input"
@@ -1913,7 +1938,7 @@ var PageHeader = BaseField.extend({
1913
1938
  });
1914
1939
  var File = BaseField.extend({
1915
1940
  type: import_v43.default.literal(FieldType.FILE),
1916
- defaultValue: FileFieldValue.optional(),
1941
+ defaultValue: FileFieldValue.or(ComputedDefaultValue).optional(),
1917
1942
  configuration: import_v43.default.object({
1918
1943
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1919
1944
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
@@ -1940,7 +1965,7 @@ var SelectOption = import_v43.default.object({
1940
1965
  });
1941
1966
  var NumberWithUnitField = BaseField.extend({
1942
1967
  type: import_v43.default.literal(FieldType.NUMBER_WITH_UNIT),
1943
- defaultValue: NumberWithUnitFieldValue.optional(),
1968
+ defaultValue: NumberWithUnitFieldValue.or(ComputedDefaultValue).optional(),
1944
1969
  options: import_v43.default.array(SelectOption).describe("A list of options for the unit select"),
1945
1970
  configuration: import_v43.default.object({
1946
1971
  min: import_v43.default.number().optional().describe("Minimum value of the number field"),
@@ -1955,7 +1980,7 @@ var NumberWithUnitField = BaseField.extend({
1955
1980
  });
1956
1981
  var RadioGroup = BaseField.extend({
1957
1982
  type: import_v43.default.literal(FieldType.RADIO_GROUP),
1958
- defaultValue: TextValue.optional(),
1983
+ defaultValue: TextValue.or(ComputedDefaultValue).optional(),
1959
1984
  options: import_v43.default.array(SelectOption).describe("A list of options"),
1960
1985
  configuration: import_v43.default.object({
1961
1986
  styles: import_v43.default.object({
@@ -1980,7 +2005,7 @@ var BulletList = BaseField.extend({
1980
2005
  });
1981
2006
  var Select = BaseField.extend({
1982
2007
  type: import_v43.default.literal(FieldType.SELECT),
1983
- defaultValue: TextValue.optional(),
2008
+ defaultValue: TextValue.or(ComputedDefaultValue).optional(),
1984
2009
  options: import_v43.default.array(SelectOption).describe("A list of options"),
1985
2010
  noOptionsMessage: TranslationConfig.optional().describe(
1986
2011
  `
@@ -2002,7 +2027,7 @@ var SelectDateRangeOption = import_v43.default.object({
2002
2027
  });
2003
2028
  var SelectDateRangeField = BaseField.extend({
2004
2029
  type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
2005
- defaultValue: SelectDateRangeValue.optional(),
2030
+ defaultValue: SelectDateRangeValue.or(ComputedDefaultValue).optional(),
2006
2031
  options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
2007
2032
  }).meta({
2008
2033
  description: "A date range selection field",
@@ -2019,7 +2044,7 @@ var NameField = BaseField.extend({
2019
2044
  firstname: SerializedUserField.or(NonEmptyTextValue).optional(),
2020
2045
  middlename: SerializedUserField.or(NonEmptyTextValue).optional(),
2021
2046
  surname: SerializedUserField.or(NonEmptyTextValue).optional()
2022
- }).optional(),
2047
+ }).or(ComputedDefaultValue).optional(),
2023
2048
  configuration: import_v43.default.object({
2024
2049
  name: NameConfig.default({
2025
2050
  firstname: { required: true },
@@ -2043,14 +2068,14 @@ var NameField = BaseField.extend({
2043
2068
  id: "NameField"
2044
2069
  });
2045
2070
  var PhoneField = BaseField.extend({
2046
- defaultValue: NonEmptyTextValue.optional(),
2071
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2047
2072
  type: import_v43.default.literal(FieldType.PHONE)
2048
2073
  }).meta({
2049
2074
  description: "A field for entering a phone number",
2050
2075
  id: "PhoneField"
2051
2076
  });
2052
2077
  var IdField = BaseField.extend({
2053
- defaultValue: NonEmptyTextValue.optional(),
2078
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2054
2079
  type: import_v43.default.literal(FieldType.ID)
2055
2080
  }).meta({
2056
2081
  description: "A field for entering an ID",
@@ -2058,14 +2083,14 @@ var IdField = BaseField.extend({
2058
2083
  });
2059
2084
  var Checkbox = BaseField.extend({
2060
2085
  type: import_v43.default.literal(FieldType.CHECKBOX),
2061
- defaultValue: CheckboxFieldValue.default(false)
2086
+ defaultValue: CheckboxFieldValue.or(ComputedDefaultValue).default(false)
2062
2087
  }).meta({
2063
2088
  description: "A boolean checkbox field",
2064
2089
  id: "Checkbox"
2065
2090
  });
2066
2091
  var Country = BaseField.extend({
2067
2092
  type: import_v43.default.literal(FieldType.COUNTRY),
2068
- defaultValue: NonEmptyTextValue.optional(),
2093
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2069
2094
  optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
2070
2095
  "Conditionals for specific countries. Countries not listed are always shown and enabled."
2071
2096
  )
@@ -2083,7 +2108,7 @@ var AdministrativeAreas = import_v43.default.enum([
2083
2108
  ]);
2084
2109
  var AdministrativeAreaField = BaseField.extend({
2085
2110
  type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
2086
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
2111
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
2087
2112
  configuration: import_v43.default.object({
2088
2113
  partOf: FieldReference.optional().describe("Parent location"),
2089
2114
  type: AdministrativeAreas,
@@ -2095,7 +2120,7 @@ var AdministrativeAreaField = BaseField.extend({
2095
2120
  });
2096
2121
  var LocationInput = BaseField.extend({
2097
2122
  type: import_v43.default.literal(FieldType.LOCATION),
2098
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
2123
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
2099
2124
  configuration: import_v43.default.object({
2100
2125
  locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
2101
2126
  allowedLocations: AllowedLocations
@@ -2107,7 +2132,7 @@ var LocationInput = BaseField.extend({
2107
2132
  var FileUploadWithOptions = BaseField.extend({
2108
2133
  type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
2109
2134
  options: import_v43.default.array(SelectOption).describe("A list of options"),
2110
- defaultValue: FileFieldWithOptionValue.optional(),
2135
+ defaultValue: FileFieldWithOptionValue.or(ComputedDefaultValue).optional(),
2111
2136
  configuration: import_v43.default.object({
2112
2137
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
2113
2138
  maxImageSize: import_v43.default.object({
@@ -2123,12 +2148,12 @@ var FileUploadWithOptions = BaseField.extend({
2123
2148
  });
2124
2149
  var Facility = BaseField.extend({
2125
2150
  type: import_v43.default.literal(FieldType.FACILITY),
2126
- defaultValue: NonEmptyTextValue.optional(),
2151
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2127
2152
  configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
2128
2153
  }).describe("Input field for a facility");
2129
2154
  var Office = BaseField.extend({
2130
2155
  type: import_v43.default.literal(FieldType.OFFICE),
2131
- defaultValue: NonEmptyTextValue.optional(),
2156
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2132
2157
  configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
2133
2158
  }).describe("Input field for an office");
2134
2159
  var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
@@ -2164,7 +2189,7 @@ var Address = BaseField.extend({
2164
2189
  ).optional(),
2165
2190
  allowedLocations: AllowedLocations
2166
2191
  }).optional(),
2167
- defaultValue: DefaultAddressFieldValue.optional()
2192
+ defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
2168
2193
  }).meta({
2169
2194
  description: "Address input field \u2013 a combination of location and text fields",
2170
2195
  id: "Address"
@@ -2211,7 +2236,7 @@ var ButtonConfiguration = import_v43.default.object({
2211
2236
  });
2212
2237
  var ButtonField = BaseField.extend({
2213
2238
  type: import_v43.default.literal(FieldType.BUTTON),
2214
- defaultValue: ButtonFieldValue.optional(),
2239
+ defaultValue: ButtonFieldValue.or(ComputedDefaultValue).optional(),
2215
2240
  configuration: ButtonConfiguration
2216
2241
  }).meta({
2217
2242
  description: "A generic button that can be used to trigger an action",
@@ -2239,7 +2264,7 @@ var AlphaPrintButton = BaseField.extend({
2239
2264
  });
2240
2265
  var HttpField = BaseField.extend({
2241
2266
  type: import_v43.default.literal(FieldType.HTTP),
2242
- defaultValue: HttpFieldValue.optional(),
2267
+ defaultValue: HttpFieldValue.or(ComputedDefaultValue).optional(),
2243
2268
  configuration: import_v43.default.object({
2244
2269
  trigger: FieldReference.optional().describe(
2245
2270
  "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 +2350,7 @@ var LinkButtonField = BaseField.extend({
2325
2350
  });
2326
2351
  var VerificationStatus = BaseField.extend({
2327
2352
  type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
2328
- defaultValue: VerificationStatusValue.optional(),
2353
+ defaultValue: VerificationStatusValue.or(ComputedDefaultValue).optional(),
2329
2354
  configuration: import_v43.default.object({
2330
2355
  status: TranslationConfig.describe("Text to display on the status pill."),
2331
2356
  description: TranslationConfig.describe(
@@ -2347,7 +2372,7 @@ var QueryParamReaderField = BaseField.extend({
2347
2372
  });
2348
2373
  var QrReaderField = BaseField.extend({
2349
2374
  type: import_v43.default.literal(FieldType.QR_READER),
2350
- defaultValue: QrReaderFieldValue.optional(),
2375
+ defaultValue: QrReaderFieldValue.or(ComputedDefaultValue).optional(),
2351
2376
  configuration: import_v43.default.object({
2352
2377
  validator: import_v43.default.any().meta({
2353
2378
  description: "JSON Schema to validate the scanned QR code data against before populating the form fields.",
@@ -2360,7 +2385,7 @@ var QrReaderField = BaseField.extend({
2360
2385
  });
2361
2386
  var IdReaderField = BaseField.extend({
2362
2387
  type: import_v43.default.literal(FieldType.ID_READER),
2363
- defaultValue: IdReaderFieldValue.optional(),
2388
+ defaultValue: IdReaderFieldValue.or(ComputedDefaultValue).optional(),
2364
2389
  methods: import_v43.default.array(
2365
2390
  import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
2366
2391
  )
@@ -2503,15 +2528,18 @@ var VerificationPageConfig = FormPageConfig.extend({
2503
2528
  actions: VerificationActionConfig
2504
2529
  });
2505
2530
  var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
2506
- description: "Page configuration",
2507
- id: "PageConfig"
2531
+ id: "PageConfig",
2532
+ 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
2533
  });
2509
2534
 
2510
2535
  // ../commons/src/events/FormConfig.ts
2511
2536
  var DeclarationFormConfig = z22.object({
2512
2537
  label: TranslationConfig.describe("Human readable description of the form"),
2513
2538
  pages: z22.array(FormPageConfig)
2514
- }).describe("Configuration of the declaration form.");
2539
+ }).meta({
2540
+ id: "DeclarationFormConfig",
2541
+ description: "Configuration of the declaration form."
2542
+ });
2515
2543
  var ActionFormConfig = z22.object({
2516
2544
  label: TranslationConfig.describe("Human readable description of the form"),
2517
2545
  pages: z22.array(PageConfig)
@@ -2611,6 +2639,9 @@ var DeduplicationConfig = z23.object({
2611
2639
  id: z23.string(),
2612
2640
  label: TranslationConfig,
2613
2641
  query: Clause
2642
+ }).meta({
2643
+ id: "DeduplicationConfig",
2644
+ 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
2645
  });
2615
2646
 
2616
2647
  // ../commons/src/events/ActionConfig.ts
@@ -2730,36 +2761,39 @@ var ActionConfig = z24.discriminatedUnion("type", [
2730
2761
  */
2731
2762
  ReadActionConfig.meta({
2732
2763
  id: "ReadActionConfig",
2733
- description: "Record-tab content displayed on the event overview page."
2764
+ description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
2734
2765
  }),
2735
2766
  DeclareConfig.meta({
2736
2767
  id: "DeclareActionConfig",
2737
- description: "Submitting a new declaration (includes review fields). This config is also shared with ActionType.NOTIFY."
2768
+ description: "Configuration for the declare action. Includes review-page fields. Shared with the notify action (ActionType.NOTIFY)."
2738
2769
  }),
2739
2770
  RejectConfig.meta({
2740
2771
  id: "RejectActionConfig",
2741
- description: "Rejecting a record before registration"
2772
+ description: "Configuration for rejecting a record before registration."
2742
2773
  }),
2743
2774
  RegisterConfig.meta({
2744
2775
  id: "RegisterActionConfig",
2745
- description: "Registering a record"
2776
+ description: "Configuration for registering a record."
2746
2777
  }),
2747
2778
  PrintCertificateActionConfig.meta({
2748
2779
  id: "PrintCertificateActionConfig",
2749
- description: "Printing a certificate"
2780
+ description: "Configuration for printing a certificate of a registered record."
2781
+ }),
2782
+ RequestCorrectionConfig.meta({
2783
+ id: "RequestCorrectionActionConfig",
2784
+ description: "Configuration for requesting a correction on a registered record."
2750
2785
  }),
2751
- RequestCorrectionConfig.meta({ id: "RequestCorrectionActionConfig" }),
2752
2786
  EditActionConfig.meta({
2753
2787
  id: "EditActionConfig",
2754
- description: "Editing a record before registration"
2788
+ description: "Configuration for editing a record before registration."
2755
2789
  }),
2756
2790
  ArchiveConfig.meta({
2757
2791
  id: "ArchiveActionConfig",
2758
- description: "Archiving a record"
2792
+ description: "Configuration for archiving a record."
2759
2793
  }),
2760
2794
  CustomActionConfig.meta({
2761
2795
  id: "CustomActionConfig",
2762
- description: "Custom action configuration"
2796
+ description: "Configuration for a country-defined custom action. An event may include any number of these."
2763
2797
  })
2764
2798
  ]).describe(
2765
2799
  "Configuration of an action available for an event. Data collected depends on the action type and is accessible through the annotation property in ActionDocument."
@@ -2836,7 +2870,10 @@ var Field = BaseField2.extend({
2836
2870
  }).describe("Custom field defined for the summary view.");
2837
2871
  var SummaryConfig = z27.object({
2838
2872
  fields: z27.array(z27.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
2839
- }).describe("Configuration of the event summary section.");
2873
+ }).meta({
2874
+ id: "SummaryConfig",
2875
+ 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."
2876
+ });
2840
2877
 
2841
2878
  // ../commons/src/events/AdvancedSearchConfig.ts
2842
2879
  var z28 = __toESM(require("zod/v4"));
@@ -2907,6 +2944,9 @@ var BaseField3 = z28.object({
2907
2944
  ),
2908
2945
  validations: z28.array(ValidationConfig).optional().describe(
2909
2946
  `Option for overriding the field validations specifically for advanced search form.`
2947
+ ),
2948
+ allowedLocations: JurisdictionReference.optional().describe(
2949
+ `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.`
2910
2950
  )
2911
2951
  });
2912
2952
  var SearchQueryParams = z28.object({
@@ -2960,6 +3000,9 @@ var AdvancedSearchField = z28.discriminatedUnion("fieldType", [FieldConfigSchema
2960
3000
  var AdvancedSearchConfig = z28.object({
2961
3001
  title: TranslationConfig.describe("Advanced search tab title"),
2962
3002
  fields: z28.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
3003
+ }).meta({
3004
+ id: "AdvancedSearchConfig",
3005
+ 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()`)."
2963
3006
  });
2964
3007
 
2965
3008
  // ../commons/src/events/utils.ts
@@ -3010,7 +3053,37 @@ function resolveDataPath(rootData, dataPath, instancePath) {
3010
3053
  }
3011
3054
  return current;
3012
3055
  }
3056
+ function todayISO() {
3057
+ return (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
3058
+ }
3059
+ var compiledFunctionCache = /* @__PURE__ */ new Map();
3060
+ function compileClientFunction(code) {
3061
+ let fn = compiledFunctionCache.get(code);
3062
+ if (!fn) {
3063
+ fn = new Function(`return (${code})`)();
3064
+ compiledFunctionCache.set(code, fn);
3065
+ }
3066
+ return fn;
3067
+ }
3013
3068
  (0, import_ajv_formats.default)(ajv);
3069
+ function buildClientFunctionContext(input) {
3070
+ return {
3071
+ $form: input.form,
3072
+ $now: todayISO(),
3073
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
3074
+ $online: isOnline(),
3075
+ $user: input.validatorContext?.user,
3076
+ $event: input.validatorContext?.event,
3077
+ $leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
3078
+ user: input.systemVariables?.user,
3079
+ $window: input.systemVariables?.$window,
3080
+ locations: input.locations,
3081
+ adminLevelIds: input.adminLevelIds
3082
+ };
3083
+ }
3084
+ function runClientFunction(code, data, context) {
3085
+ return compileClientFunction(code)(data, context);
3086
+ }
3014
3087
  ajv.addKeyword({
3015
3088
  keyword: "daysFromDate",
3016
3089
  type: "string",
@@ -3055,12 +3128,35 @@ ajv.addKeyword({
3055
3128
  $data: true,
3056
3129
  errors: true,
3057
3130
  // @ts-ignore -- Force type. We will move this away from AJV next. Parsing the array will take seconds and is only called by core.
3058
- validate(schema, data, _2, dataContext) {
3131
+ validate(_schema, data, _2, dataContext) {
3059
3132
  const locationIdInput = data;
3060
3133
  const locations = dataContext?.rootData.$leafAdminStructureLocationIds ?? [];
3061
3134
  return locations.some((location) => location.id === locationIdInput);
3062
3135
  }
3063
3136
  });
3137
+ ajv.addKeyword({
3138
+ keyword: "customClientValidator",
3139
+ schemaType: "object",
3140
+ errors: true,
3141
+ // @ts-expect-error -- AJV's public types don't expose `rootData`. All
3142
+ // `validate()` callers build root data via `buildClientFunctionContext`,
3143
+ // so the cast holds.
3144
+ validate(schema, data, _2, dataContext) {
3145
+ return Boolean(
3146
+ runClientFunction(
3147
+ schema.code,
3148
+ data,
3149
+ dataContext?.rootData ?? buildClientFunctionContext({ form: {} })
3150
+ )
3151
+ );
3152
+ }
3153
+ });
3154
+ function isOnline() {
3155
+ if (typeof window !== "undefined" && typeof navigator !== "undefined") {
3156
+ return navigator.onLine;
3157
+ }
3158
+ return true;
3159
+ }
3064
3160
 
3065
3161
  // ../commons/src/utils.ts
3066
3162
  var z32 = __toESM(require("zod/v4"));
@@ -3679,7 +3775,54 @@ function createFieldConditionals(fieldId) {
3679
3775
  }
3680
3776
  },
3681
3777
  required: [fieldId]
3682
- })
3778
+ }),
3779
+ /**
3780
+ * Custom client-side validator. The provided function is serialised and executed
3781
+ * just-in-time on the client only. External references (e.g. lodash) are not
3782
+ * available inside the function body — all logic must be self-contained.
3783
+ *
3784
+ * @example
3785
+ * field('nid').customClientValidator((value) => {
3786
+ * // LUHN check — all logic must be inline
3787
+ * const digits = String(value).split('').map(Number)
3788
+ * // ...
3789
+ * return isValid
3790
+ * })
3791
+ */
3792
+ customClientValidator(validationFn) {
3793
+ const code = validationFn.toString();
3794
+ return defineFormConditional({
3795
+ type: "object",
3796
+ properties: wrapToPath(
3797
+ { [fieldId]: { customClientValidator: { code } } },
3798
+ this.$$subfield
3799
+ ),
3800
+ required: [fieldId]
3801
+ });
3802
+ },
3803
+ /**
3804
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
3805
+ * that can be used as the `value` property or a DATA component entry.
3806
+ * The function receives the referenced field's value as the first argument and
3807
+ * the full form context as the second; its return value replaces the field reference.
3808
+ * The function is serialised and executed just-in-time on the client only.
3809
+ * External references (e.g. lodash) are not available inside the function body.
3810
+ *
3811
+ * For computing a default value without referencing a specific field, use
3812
+ * `evaluate(fn)` in the `defaultValue` property instead.
3813
+ *
3814
+ * @example
3815
+ * field('a').customClientEvaluation((aValue, ctx) =>
3816
+ * Number(aValue) + Number(ctx.$form.b)
3817
+ * )
3818
+ */
3819
+ customClientEvaluation(computationFn) {
3820
+ return {
3821
+ $$code: computationFn.toString(),
3822
+ $$field: fieldId,
3823
+ $$subfield: this.$$subfield
3824
+ };
3825
+ }
3683
3826
  };
3684
3827
  }
3685
3828
 
@@ -3852,8 +3995,9 @@ var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
3852
3995
  validateActionFlags(event2, ctx);
3853
3996
  validateActionOrder(event2, ctx);
3854
3997
  }).meta({
3855
- id: "EventConfig"
3856
- }).describe("Configuration defining an event type.");
3998
+ id: "EventConfig",
3999
+ description: "Configuration defining an event type registered in OpenCRVS (for example birth or death)."
4000
+ });
3857
4001
 
3858
4002
  // ../commons/src/events/EventConfigInput.ts
3859
4003
  var defineDeclarationForm = (form) => DeclarationFormConfig.parse(form);
@@ -4075,6 +4219,9 @@ var WorkqueueColumnValue = z34.object({
4075
4219
  var WorkqueueColumn = z34.object({
4076
4220
  label: TranslationConfig,
4077
4221
  value: WorkqueueColumnValue
4222
+ }).meta({
4223
+ id: "WorkqueueColumn",
4224
+ description: "Configuration for a single workqueue column. The value references an event metadata key (e.g. `dateOfEvent`, `status`, `trackingId`)."
4078
4225
  });
4079
4226
  function defineWorkqueuesColumns(workqueueColumns) {
4080
4227
  return workqueueColumns.map(
@@ -4280,8 +4427,8 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
4280
4427
  var WorkqueueConfigInput = WorkqueueConfig.extend({
4281
4428
  query: CountryConfigQueryInputType
4282
4429
  }).meta({
4283
- description: "Workqueue configuration",
4284
- id: "WorkqueueConfig"
4430
+ id: "WorkqueueConfig",
4431
+ 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."
4285
4432
  });
4286
4433
  var WorkqueueCountInput = z37.array(
4287
4434
  z37.object({ slug: z37.string(), query: QueryType })
@@ -4323,7 +4470,9 @@ var BaseActionInput = z38.object({
4323
4470
  keepAssignment: z38.boolean().optional(),
4324
4471
  keepAssignmentIfAccepted: z38.boolean().optional(),
4325
4472
  keepAssignmentIfRejected: z38.boolean().optional(),
4326
- waitFor: z38.boolean().optional(),
4473
+ waitFor: z38.boolean().default(true).describe(
4474
+ "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."
4475
+ ),
4327
4476
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
4328
4477
  // @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
4329
4478
  createdAtLocation: UUID.nullish().describe(
@@ -4441,7 +4590,8 @@ var RejectCorrectionActionInput = BaseActionInput.extend(
4441
4590
  var ApproveCorrectionActionInput = BaseActionInput.extend(
4442
4591
  z38.object({
4443
4592
  requestId: z38.string(),
4444
- type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
4593
+ type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION),
4594
+ content: z38.object({ immediateCorrection: z38.boolean().optional() }).optional()
4445
4595
  }).shape
4446
4596
  );
4447
4597
  var ReadActionInput = BaseActionInput.extend(
@@ -4503,7 +4653,7 @@ var Draft = z39.object({
4503
4653
  }).describe(
4504
4654
  "A temporary storage for an action. Stored with details of the event, creator and creation time."
4505
4655
  );
4506
- var DraftInput = BaseActionInput.extend({
4656
+ var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
4507
4657
  type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
4508
4658
  status: z39.enum([
4509
4659
  ActionStatus.Requested,
@@ -7097,10 +7247,380 @@ var ACTION_FILTERS = {
7097
7247
  [ActionType.UNASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7098
7248
  [ActionType.CUSTOM]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
7099
7249
  };
7250
+ var REJECTED_ACTIONS = [
7251
+ ActionType.READ,
7252
+ ActionType.NOTIFY,
7253
+ ActionType.CUSTOM,
7254
+ ActionType.EDIT,
7255
+ ActionType.ARCHIVE
7256
+ ];
7100
7257
 
7101
7258
  // ../commons/src/events/FileUtils.ts
7102
7259
  var import_lodash7 = require("lodash");
7103
7260
 
7261
+ // ../commons/src/events/mocks.test.utils.ts
7262
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7263
+ {
7264
+ id: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7265
+ name: "Central",
7266
+ parentId: null,
7267
+ validUntil: null,
7268
+ externalId: "ydyJb1RAy4U1"
7269
+ },
7270
+ {
7271
+ id: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7272
+ name: "Sulaka",
7273
+ parentId: null,
7274
+ validUntil: null,
7275
+ externalId: "pQ8nGxWmZ2Q3"
7276
+ },
7277
+ {
7278
+ id: "7ef2b9c7-5e6d-49f6-ae05-656207d0fc64",
7279
+ name: "Pualula",
7280
+ parentId: null,
7281
+ validUntil: null,
7282
+ externalId: "Aq91DweLmT8k"
7283
+ },
7284
+ {
7285
+ id: "6d1a59df-988c-4021-a846-ccbc021931a7",
7286
+ name: "Chuminga",
7287
+ parentId: null,
7288
+ validUntil: null,
7289
+ externalId: "Rw0fYNh2Xk9a"
7290
+ },
7291
+ {
7292
+ id: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7293
+ name: "Ibombo",
7294
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7295
+ validUntil: null,
7296
+ externalId: "k7DsP4vbN1Qe"
7297
+ },
7298
+ {
7299
+ id: "27160bbd-32d1-4625-812f-860226bfb92a",
7300
+ name: "Isango",
7301
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7302
+ validUntil: null,
7303
+ externalId: "Gm3Z9eQpHw4L"
7304
+ },
7305
+ {
7306
+ id: "967032fd-3f81-478a-826c-30cb8fe121bd",
7307
+ name: "Isamba",
7308
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7309
+ validUntil: null,
7310
+ externalId: "sT0xVu1KqJ7r"
7311
+ },
7312
+ {
7313
+ id: "89a33893-b17d-481d-a26d-6461e7ac1651",
7314
+ name: "Itambo",
7315
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7316
+ validUntil: null,
7317
+ externalId: "Nq6Bv2HpL9Te"
7318
+ },
7319
+ {
7320
+ id: "d42ab2fe-e7ed-470e-8b31-4fb27f9b8250",
7321
+ name: "Ezhi",
7322
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7323
+ validUntil: null,
7324
+ externalId: "xK8cQ0ZRy5Wd"
7325
+ },
7326
+ {
7327
+ id: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7328
+ name: "Ilanga",
7329
+ parentId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7330
+ validUntil: null,
7331
+ externalId: "Cq4Jm1XvN8Ls"
7332
+ },
7333
+ // Villages under Ibombo (62a0ccb4-880d-4f30-8882-f256007dfff9)
7334
+ {
7335
+ id: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7336
+ name: "Klow",
7337
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7338
+ validUntil: null,
7339
+ externalId: "IkYcYBUcyY2"
7340
+ },
7341
+ {
7342
+ id: "2e5f6a7b-8c9d-4a23-8fab-456789012345",
7343
+ name: "Mbondo",
7344
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7345
+ validUntil: null,
7346
+ externalId: "Qhvv5hvo3mY"
7347
+ },
7348
+ {
7349
+ id: "3f6a7b8c-9d0e-4b34-8abc-567890123456",
7350
+ name: "Ndara",
7351
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7352
+ validUntil: null,
7353
+ externalId: "crXh068O9TR"
7354
+ },
7355
+ {
7356
+ id: "4a7b8c9d-0e1f-4c45-abcd-678901234567",
7357
+ name: "Olani",
7358
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7359
+ validUntil: null,
7360
+ externalId: "r00It8Tvvp7"
7361
+ },
7362
+ {
7363
+ id: "5b8c9d0e-1f2a-4d56-bcde-789012345678",
7364
+ name: "Pemba",
7365
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7366
+ validUntil: null,
7367
+ externalId: "ZnUWsbONIaH"
7368
+ },
7369
+ {
7370
+ id: "6c9d0e1f-2a3b-4e67-8def-890123456789",
7371
+ name: "Quanza",
7372
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7373
+ validUntil: null,
7374
+ externalId: "fDZycvQTa7l"
7375
+ },
7376
+ {
7377
+ id: "7d0e1f2a-3b4c-4f78-8efa-901234567890",
7378
+ name: "Rivka",
7379
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7380
+ validUntil: null,
7381
+ externalId: "KqswxCGTELa"
7382
+ },
7383
+ // Villages under Isamba (967032fd-3f81-478a-826c-30cb8fe121bd)
7384
+ {
7385
+ id: "8e1f2a3b-4c5d-4089-8fab-012345678901",
7386
+ name: "Mbula",
7387
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7388
+ validUntil: null,
7389
+ externalId: "osEbKjRc9Kg"
7390
+ },
7391
+ {
7392
+ id: "9f2a3b4c-5d6e-4190-8abf-123456789012",
7393
+ name: "Ndoki",
7394
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7395
+ validUntil: null,
7396
+ externalId: "aq4daBUAGr3"
7397
+ },
7398
+ {
7399
+ id: "0a3b4c5d-6e7f-4201-abcd-234567890123",
7400
+ name: "Tsanga",
7401
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7402
+ validUntil: null,
7403
+ externalId: "cqis6Y8trbJ"
7404
+ },
7405
+ {
7406
+ id: "1b4c5d6e-7f8a-4312-bcde-345678901234",
7407
+ name: "Waziri",
7408
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7409
+ validUntil: null,
7410
+ externalId: "LMijHPyyx6d"
7411
+ },
7412
+ {
7413
+ id: "2c5d6e7f-8a9b-4423-8def-456789012345",
7414
+ name: "Zimbi",
7415
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7416
+ validUntil: null,
7417
+ externalId: "pcQYbPuKGZ7"
7418
+ },
7419
+ // Villages under Itambo (89a33893-b17d-481d-a26d-6461e7ac1651)
7420
+ {
7421
+ id: "3d6e7f8a-9b0c-4534-8efa-567890123456",
7422
+ name: "Felani",
7423
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7424
+ validUntil: null,
7425
+ externalId: "gSqpoCGdMXp"
7426
+ },
7427
+ {
7428
+ id: "4e7f8a9b-0c1d-4645-8fab-678901234567",
7429
+ name: "Goroma",
7430
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7431
+ validUntil: null,
7432
+ externalId: "KvAAIaNqVrp"
7433
+ },
7434
+ {
7435
+ id: "5f8a9b0c-1d2e-4756-8abc-789012345678",
7436
+ name: "Halifu",
7437
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7438
+ validUntil: null,
7439
+ externalId: "qe4UnEVt1hv"
7440
+ },
7441
+ {
7442
+ id: "6a9b0c1d-2e3f-4867-abcd-890123456789",
7443
+ name: "Jabari",
7444
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7445
+ validUntil: null,
7446
+ externalId: "yHH9Nz4rLOt"
7447
+ },
7448
+ {
7449
+ id: "7b0c1d2e-3f4a-4978-bcde-901234567890",
7450
+ name: "Kifani",
7451
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7452
+ validUntil: null,
7453
+ externalId: "eSWmXIGeu1I"
7454
+ },
7455
+ {
7456
+ id: "8c1d2e3f-4a5b-4089-8def-012345678901",
7457
+ name: "Lumela",
7458
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7459
+ validUntil: null,
7460
+ externalId: "bh0b3aI1uP3"
7461
+ }
7462
+ ];
7463
+ var V2_DEFAULT_MOCK_LOCATIONS = [
7464
+ {
7465
+ id: "6f6186ce-cd5f-4a5f-810a-2d99e7c4ba12",
7466
+ name: "Central Provincial Office",
7467
+ locationType: "CRVS_OFFICE",
7468
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7469
+ validUntil: null,
7470
+ externalId: "Xr3Df8WpK6Ys"
7471
+ },
7472
+ {
7473
+ id: "b1c2d3e4-f5a6-7890-bcde-f12345678901",
7474
+ name: "Central Health Post",
7475
+ locationType: "HEALTH_FACILITY",
7476
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7477
+ validUntil: null
7478
+ },
7479
+ {
7480
+ id: "028d2c85-ca31-426d-b5d1-2cef545a4902",
7481
+ name: "Ibombo District Office",
7482
+ locationType: "CRVS_OFFICE",
7483
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7484
+ validUntil: null,
7485
+ externalId: "Sm4Nw7GrD2Vy"
7486
+ },
7487
+ {
7488
+ id: "62a0ccb4-4f30-4f30-8882-f256007dff9f",
7489
+ name: "Isamba District Office",
7490
+ locationType: "CRVS_OFFICE",
7491
+ administrativeAreaId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7492
+ validUntil: null,
7493
+ externalId: "Vg1Bq5XeH9Lt"
7494
+ },
7495
+ {
7496
+ id: "954c93e1-13f7-4435-bb82-35e0e215e07d",
7497
+ name: "Isango District Office",
7498
+ locationType: "CRVS_OFFICE",
7499
+ administrativeAreaId: "27160bbd-32d1-4625-812f-860226bfb92a",
7500
+ validUntil: null,
7501
+ externalId: "Je7Lm2XqN9Vz"
7502
+ },
7503
+ {
7504
+ id: "2884f5b9-17b4-49ce-bf4d-f538228935df",
7505
+ name: "Sulaka Provincial Office",
7506
+ locationType: "CRVS_OFFICE",
7507
+ administrativeAreaId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7508
+ validUntil: null,
7509
+ externalId: "Ht2Wp9KcX5Qv"
7510
+ },
7511
+ {
7512
+ id: "030358c6-54af-44be-821b-8e4af963a49c",
7513
+ name: "Ilanga District Office",
7514
+ locationType: "CRVS_OFFICE",
7515
+ administrativeAreaId: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7516
+ validUntil: null,
7517
+ externalId: "Yp6Ds1WqN3Xz"
7518
+ },
7519
+ {
7520
+ id: "423d000f-101b-47c0-8b86-21a908067cee",
7521
+ name: "Chamakubi Health Post",
7522
+ locationType: "HEALTH_FACILITY",
7523
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7524
+ validUntil: null,
7525
+ externalId: "M1nFr8LbC2Qy"
7526
+ },
7527
+ {
7528
+ id: "4d3279be-d026-420c-88f7-f0a4ae986973",
7529
+ name: "Ibombo Rural Health Centre",
7530
+ locationType: "HEALTH_FACILITY",
7531
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7532
+ validUntil: null,
7533
+ externalId: "bT7pV6YrW0Xc"
7534
+ },
7535
+ {
7536
+ id: "190902f4-1d77-476a-8947-41145af1db7d",
7537
+ name: "Chikobo Rural Health Centre",
7538
+ locationType: "HEALTH_FACILITY",
7539
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7540
+ validUntil: null,
7541
+ externalId: "zE4qPn2SgJ5d"
7542
+ },
7543
+ {
7544
+ id: "f5ecbd9b-a01e-4a65-910e-70e86ab41b71",
7545
+ name: "Chilochabalenje Health Post",
7546
+ locationType: "HEALTH_FACILITY",
7547
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7548
+ validUntil: null,
7549
+ externalId: "H8vDs1MqR4Uf"
7550
+ },
7551
+ {
7552
+ id: "dbfc178f-7295-4b90-b28d-111c95b03127",
7553
+ name: "Chipeso Rural Health Centre",
7554
+ locationType: "HEALTH_FACILITY",
7555
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7556
+ validUntil: null,
7557
+ externalId: "Qw3uZ9KfX6Lm"
7558
+ },
7559
+ {
7560
+ id: "09862bfe-c7ac-46cd-987b-668681533c80",
7561
+ name: "Chisamba Rural Health Centre",
7562
+ locationType: "HEALTH_FACILITY",
7563
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7564
+ validUntil: null,
7565
+ externalId: "Yr0pCg8LdM2s"
7566
+ },
7567
+ {
7568
+ id: "834ce389-e95b-4fb0-96a0-33e9ab323059",
7569
+ name: "Chitanda Rural Health Centre",
7570
+ locationType: "HEALTH_FACILITY",
7571
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7572
+ validUntil: null,
7573
+ externalId: "tS9gJ4PwB1Qx"
7574
+ },
7575
+ {
7576
+ id: "0431c433-6062-4a4c-aee9-25271aec61ee",
7577
+ name: "Golden Valley Rural Health Centre",
7578
+ locationType: "HEALTH_FACILITY",
7579
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7580
+ validUntil: null,
7581
+ externalId: "Ld7Qm3XsA8Vr"
7582
+ },
7583
+ {
7584
+ id: "bc84d0b6-7ba7-480d-a339-5d9920d90eb2",
7585
+ name: "Ipongo Rural Health Centre",
7586
+ locationType: "HEALTH_FACILITY",
7587
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7588
+ validUntil: null,
7589
+ externalId: "kF2sW9DmH0Bt"
7590
+ },
7591
+ {
7592
+ id: "4cf1f53b-b730-41d2-8649-dff7eeed970d",
7593
+ name: "Itumbwe Health Post",
7594
+ locationType: "HEALTH_FACILITY",
7595
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7596
+ validUntil: null,
7597
+ externalId: "Ue5Xb3VaC7Pq"
7598
+ },
7599
+ {
7600
+ id: "4b3676cb-9355-4942-9eb9-2ce46acaf0e0",
7601
+ name: "Kabangalala Rural Health Centre",
7602
+ locationType: "HEALTH_FACILITY",
7603
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7604
+ validUntil: null,
7605
+ externalId: "Pz8Kc1TqH6Jn"
7606
+ },
7607
+ // Village offices
7608
+ {
7609
+ id: "1f4a5b6c-7d8e-4312-8abc-345678901234",
7610
+ name: "Klow Village Office",
7611
+ locationType: "CRVS_OFFICE",
7612
+ administrativeAreaId: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7613
+ validUntil: null,
7614
+ externalId: "PmAyxAJkxiJ"
7615
+ }
7616
+ ];
7617
+ var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
7618
+ V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, l])
7619
+ );
7620
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
7621
+ V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
7622
+ );
7623
+
7104
7624
  // ../commons/src/notification/UserNotifications.ts
7105
7625
  var z44 = __toESM(require("zod/v4"));
7106
7626
  var TriggerEvent = {