@opencrvs/toolkit 2.0.0-rc.fe577a4 → 2.0.0-rc.fea498b

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.
@@ -151,6 +151,7 @@ __export(events_exports, {
151
151
  FormPageConfig: () => FormPageConfig,
152
152
  Fuzzy: () => Fuzzy,
153
153
  GeographicalArea: () => GeographicalArea,
154
+ HiddenFieldTypes: () => HiddenFieldTypes,
154
155
  HiddenFieldValue: () => HiddenFieldValue,
155
156
  HttpFieldUpdateValue: () => HttpFieldUpdateValue,
156
157
  HttpFieldValue: () => HttpFieldValue,
@@ -712,18 +713,18 @@ var unflattenScope = (input) => {
712
713
  };
713
714
  var EncodedScope = z2.string().brand("EncodedScope");
714
715
  var decodedScopeCache = /* @__PURE__ */ new Map();
715
- var decodeScope = (query) => {
716
- if (decodedScopeCache.has(query)) {
717
- return decodedScopeCache.get(query);
716
+ var decodeScope = (encodedScope) => {
717
+ if (decodedScopeCache.has(encodedScope)) {
718
+ return decodedScopeCache.get(encodedScope);
718
719
  }
719
- const scope = qs.parse(query, {
720
+ const scope = qs.parse(encodedScope, {
720
721
  ignoreQueryPrefix: true,
721
722
  comma: true,
722
723
  allowDots: true
723
724
  });
724
725
  const unflattenedScope = unflattenScope(scope);
725
726
  const result = Scope.safeParse(unflattenedScope)?.data;
726
- decodedScopeCache.set(query, result);
727
+ decodedScopeCache.set(encodedScope, result);
727
728
  return result;
728
729
  };
729
730
  var DEFAULT_SCOPE_OPTIONS = {
@@ -1219,6 +1220,11 @@ var FieldTypesToHideInReview = [
1219
1220
  FieldType.ALPHA_PRINT_BUTTON,
1220
1221
  FieldType.ALPHA_HIDDEN
1221
1222
  ];
1223
+ var HiddenFieldTypes = [
1224
+ FieldType.HTTP,
1225
+ FieldType.QUERY_PARAM_READER,
1226
+ FieldType.ALPHA_HIDDEN
1227
+ ];
1222
1228
 
1223
1229
  // ../commons/src/events/FieldValue.ts
1224
1230
  var z12 = __toESM(require("zod/v4"));
@@ -1345,7 +1351,7 @@ function plainDateToLocalDate(date) {
1345
1351
  // ../commons/src/events/FieldValue.ts
1346
1352
  var TextValue = z12.string();
1347
1353
  var HiddenFieldValue = z12.string();
1348
- var NonEmptyTextValue = TextValue.min(1);
1354
+ var NonEmptyTextValue = z12.string().trim().min(1);
1349
1355
  var DateValue = z12.iso.date().describe("Date in the format YYYY-MM-DD");
1350
1356
  var AgeValue = z12.object({
1351
1357
  age: z12.number(),
@@ -2292,6 +2298,7 @@ var NumberField = BaseField.extend({
2292
2298
  configuration: import_v43.default.object({
2293
2299
  min: import_v43.default.number().optional().describe("Minimum value"),
2294
2300
  max: import_v43.default.number().optional().describe("Maximum value"),
2301
+ integer: import_v43.default.boolean().optional().describe("When true, only whole numbers are allowed"),
2295
2302
  prefix: TranslationConfig.optional(),
2296
2303
  postfix: TranslationConfig.optional()
2297
2304
  }).optional()
@@ -3215,6 +3222,14 @@ var ReadActionConfig = ActionConfigBase.extend(
3215
3222
  conditionals: z24.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
3216
3223
  }).shape
3217
3224
  );
3225
+ var NotifyConfig = DeclarationActionBase.extend(
3226
+ z24.object({
3227
+ type: z24.literal(ActionType.NOTIFY),
3228
+ review: DeclarationReviewConfig.describe(
3229
+ "Configuration of the review page fields."
3230
+ ).optional()
3231
+ }).shape
3232
+ );
3218
3233
  var DeclareConfig = DeclarationActionBase.extend(
3219
3234
  z24.object({
3220
3235
  type: z24.literal(ActionType.DECLARE),
@@ -3299,9 +3314,13 @@ var ActionConfig = z24.discriminatedUnion("type", [
3299
3314
  id: "ReadActionConfig",
3300
3315
  description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
3301
3316
  }),
3317
+ NotifyConfig.meta({
3318
+ id: "NotifyActionConfig",
3319
+ description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
3320
+ }),
3302
3321
  DeclareConfig.meta({
3303
3322
  id: "DeclareActionConfig",
3304
- description: "Configuration for the declare action. Includes review-page fields. Shared with the notify action (ActionType.NOTIFY)."
3323
+ description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
3305
3324
  }),
3306
3325
  RejectConfig.meta({
3307
3326
  id: "RejectActionConfig",
@@ -3480,6 +3499,9 @@ var BaseField3 = z28.object({
3480
3499
  ),
3481
3500
  validations: z28.array(ValidationConfig).optional().describe(
3482
3501
  `Option for overriding the field validations specifically for advanced search form.`
3502
+ ),
3503
+ allowedLocations: JurisdictionReference.optional().describe(
3504
+ `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.`
3483
3505
  )
3484
3506
  });
3485
3507
  var SearchQueryParams = z28.object({
@@ -3905,7 +3927,7 @@ var isHiddenFieldType = (field3) => {
3905
3927
  return field3.config.type === FieldType.ALPHA_HIDDEN;
3906
3928
  };
3907
3929
  var isNonInteractiveFieldType = (field3) => {
3908
- return field3.type === FieldType.DIVIDER || field3.type === FieldType.PAGE_HEADER || field3.type === FieldType.PARAGRAPH || field3.type === FieldType.HEADING || field3.type === FieldType.BULLET_LIST || field3.type === FieldType.DATA || field3.type === FieldType.ALPHA_PRINT_BUTTON || field3.type === FieldType.HTTP || field3.type === FieldType.LINK_BUTTON || field3.type === FieldType.QUERY_PARAM_READER || field3.type === FieldType.LOADER;
3930
+ return field3.type === FieldType.DIVIDER || field3.type === FieldType.PAGE_HEADER || field3.type === FieldType.PARAGRAPH || field3.type === FieldType.HEADING || field3.type === FieldType.BULLET_LIST || field3.type === FieldType.DATA || field3.type === FieldType.ALPHA_PRINT_BUTTON || field3.type === FieldType.LINK_BUTTON || field3.type === FieldType.LOADER;
3909
3931
  };
3910
3932
 
3911
3933
  // ../commons/src/conditionals/validate.ts
@@ -4467,13 +4489,13 @@ function getActionConfig({
4467
4489
  actionType,
4468
4490
  customActionType
4469
4491
  }) {
4492
+ if (actionType === ActionType.NOTIFY) {
4493
+ return eventConfiguration.actions.find((a) => a.type === ActionType.NOTIFY) ?? eventConfiguration.actions.find((a) => a.type === ActionType.DECLARE);
4494
+ }
4470
4495
  return eventConfiguration.actions.find((a) => {
4471
4496
  if (a.type === ActionType.CUSTOM && customActionType) {
4472
4497
  return a.customActionType === customActionType;
4473
4498
  }
4474
- if (actionType === ActionType.NOTIFY) {
4475
- return a.type === ActionType.DECLARE;
4476
- }
4477
4499
  if (actionType === ActionType.APPROVE_CORRECTION || actionType === ActionType.REJECT_CORRECTION) {
4478
4500
  return a.type === ActionType.REQUEST_CORRECTION;
4479
4501
  }
@@ -4510,7 +4532,7 @@ var getActionAnnotationFields = (actionConfig) => {
4510
4532
  if (actionConfig.type === ActionType.CUSTOM) {
4511
4533
  return actionConfig.form;
4512
4534
  }
4513
- if ("review" in actionConfig) {
4535
+ if ("review" in actionConfig && actionConfig.review != null) {
4514
4536
  return actionConfig.review.fields;
4515
4537
  }
4516
4538
  return [];
@@ -6482,6 +6504,8 @@ var updateActions = ActionTypes.extract([
6482
6504
  ActionType.ARCHIVE,
6483
6505
  ActionType.PRINT_CERTIFICATE,
6484
6506
  ActionType.REQUEST_CORRECTION,
6507
+ ActionType.APPROVE_CORRECTION,
6508
+ ActionType.REJECT_CORRECTION,
6485
6509
  ActionType.CUSTOM
6486
6510
  ]);
6487
6511
  function getActionUpdateMetadata(actions) {
@@ -6496,7 +6520,7 @@ function getActionUpdateMetadata(actions) {
6496
6520
  "createdAtLocation",
6497
6521
  "createdByRole"
6498
6522
  ];
6499
- return actions.filter(({ type }) => updateActions.safeParse(type).success).filter(({ status: status2 }) => status2 === ActionStatus.Accepted).reduce(
6523
+ return actions.filter(({ type }) => updateActions.safeParse(type).success).reduce(
6500
6524
  (_2, action) => {
6501
6525
  if (action.originalActionId) {
6502
6526
  const originalAction = actions.find(({ id }) => id === action.originalActionId) ?? action;
@@ -6523,9 +6547,6 @@ function getLegalStatuses(actions) {
6523
6547
  // ../commons/src/events/state/flags.ts
6524
6548
  var import_lodash3 = require("lodash");
6525
6549
  var import_date_fns3 = require("date-fns");
6526
- function isEditInProgress(actions) {
6527
- return actions.at(-1)?.type === ActionType.EDIT;
6528
- }
6529
6550
  function findPendingCorrectionAction(writeActions2) {
6530
6551
  let correctionRequestAction;
6531
6552
  for (let i = writeActions2.length - 1; i >= 0; i--) {
@@ -6540,29 +6561,6 @@ function findPendingCorrectionAction(writeActions2) {
6540
6561
  }
6541
6562
  return correctionRequestAction;
6542
6563
  }
6543
- function isCorrectionRequested(actions) {
6544
- return findPendingCorrectionAction(actions) !== void 0;
6545
- }
6546
- function isDeclarationIncomplete(actions) {
6547
- return getStatusFromActions(actions) === EventStatus.enum.NOTIFIED;
6548
- }
6549
- function isRejected(actions) {
6550
- const resettingActionTypes = [
6551
- ActionType.NOTIFY,
6552
- ActionType.DECLARE,
6553
- ActionType.EDIT,
6554
- ActionType.REGISTER
6555
- ];
6556
- return actions.reduce((prev, { type }) => {
6557
- if (type === ActionType.REJECT) {
6558
- return true;
6559
- }
6560
- if (resettingActionTypes.includes(type)) {
6561
- return false;
6562
- }
6563
- return prev;
6564
- }, false);
6565
- }
6566
6564
  function isPotentialDuplicate(actions) {
6567
6565
  return actions.reduce((prev, { type }) => {
6568
6566
  if (type === ActionType.DUPLICATE_DETECTED) {
@@ -6590,6 +6588,88 @@ function isFlagConditionMet(conditional, form, action) {
6590
6588
  }
6591
6589
  });
6592
6590
  }
6591
+ function actionConfigRemovesFlag(action, flagId, actionsUpToAndIncluding, event2, eventConfiguration) {
6592
+ if (!isActionConfigType(action.type)) {
6593
+ return false;
6594
+ }
6595
+ const actionConfig = getActionConfig({
6596
+ eventConfiguration,
6597
+ actionType: action.type,
6598
+ customActionType: "customActionType" in action ? action.customActionType : void 0
6599
+ });
6600
+ const removeOperations = (actionConfig?.flags ?? []).filter(
6601
+ ({ id, operation }) => id === flagId && operation === "remove"
6602
+ );
6603
+ if (removeOperations.length === 0) {
6604
+ return false;
6605
+ }
6606
+ const eventUpToThisAction = { ...event2, actions: actionsUpToAndIncluding };
6607
+ const declaration = aggregateActionDeclarations(eventUpToThisAction);
6608
+ const annotation = aggregateActionAnnotations(eventUpToThisAction);
6609
+ const form = { ...declaration, ...annotation };
6610
+ return removeOperations.some(
6611
+ ({ conditional }) => conditional ? isFlagConditionMet(conditional, form, action) : true
6612
+ );
6613
+ }
6614
+ var INHERENT_FLAG_RULES = [
6615
+ {
6616
+ flag: InherentFlags.CORRECTION_REQUESTED,
6617
+ setOn: [ActionType.REQUEST_CORRECTION],
6618
+ resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
6619
+ },
6620
+ {
6621
+ // INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
6622
+ // other status-changing action (see getStatusFromActions).
6623
+ flag: InherentFlags.INCOMPLETE,
6624
+ setOn: [ActionType.NOTIFY],
6625
+ resetOn: [
6626
+ ActionType.CREATE,
6627
+ ActionType.DECLARE,
6628
+ ActionType.REGISTER,
6629
+ ActionType.ARCHIVE
6630
+ ]
6631
+ },
6632
+ {
6633
+ flag: InherentFlags.REJECTED,
6634
+ setOn: [ActionType.REJECT],
6635
+ resetOn: [
6636
+ ActionType.NOTIFY,
6637
+ ActionType.DECLARE,
6638
+ ActionType.EDIT,
6639
+ ActionType.REGISTER
6640
+ ]
6641
+ },
6642
+ {
6643
+ flag: InherentFlags.POTENTIAL_DUPLICATE,
6644
+ setOn: [ActionType.DUPLICATE_DETECTED],
6645
+ resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
6646
+ },
6647
+ {
6648
+ flag: InherentFlags.EDIT_IN_PROGRESS,
6649
+ setOn: [ActionType.EDIT],
6650
+ resetOnAnyOtherAction: true
6651
+ }
6652
+ ];
6653
+ function resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration) {
6654
+ return acceptedActions.reduce((present, action, idx) => {
6655
+ if (rule.setOn.includes(action.type)) {
6656
+ return true;
6657
+ }
6658
+ if (rule.resetOnAnyOtherAction || (rule.resetOn ?? []).includes(action.type)) {
6659
+ return false;
6660
+ }
6661
+ if (actionConfigRemovesFlag(
6662
+ action,
6663
+ rule.flag,
6664
+ acceptedActions.slice(0, idx + 1),
6665
+ event2,
6666
+ eventConfiguration
6667
+ )) {
6668
+ return false;
6669
+ }
6670
+ return present;
6671
+ }, false);
6672
+ }
6593
6673
  function resolveEventCustomFlags(event2, eventConfiguration) {
6594
6674
  const actions = getAcceptedActions(event2).filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
6595
6675
  return actions.reduce((acc, action, idx) => {
@@ -6638,33 +6718,19 @@ function getActionStatusFlags(sortedActions) {
6638
6718
  return flag2;
6639
6719
  });
6640
6720
  }
6641
- function getInherentFlags(sortedActions) {
6721
+ function getInherentFlags(sortedActions, event2, eventConfiguration) {
6642
6722
  const acceptedActions = sortedActions.filter(
6643
6723
  ({ status: status2 }) => status2 === ActionStatus.Accepted
6644
6724
  );
6645
- const inherentFlags = [];
6646
- if (isCorrectionRequested(acceptedActions)) {
6647
- inherentFlags.push(InherentFlags.CORRECTION_REQUESTED);
6648
- }
6649
- if (isDeclarationIncomplete(acceptedActions)) {
6650
- inherentFlags.push(InherentFlags.INCOMPLETE);
6651
- }
6652
- if (isRejected(acceptedActions)) {
6653
- inherentFlags.push(InherentFlags.REJECTED);
6654
- }
6655
- if (isPotentialDuplicate(acceptedActions)) {
6656
- inherentFlags.push(InherentFlags.POTENTIAL_DUPLICATE);
6657
- }
6658
- if (isEditInProgress(acceptedActions)) {
6659
- inherentFlags.push(InherentFlags.EDIT_IN_PROGRESS);
6660
- }
6661
- return inherentFlags;
6725
+ return INHERENT_FLAG_RULES.filter(
6726
+ (rule) => resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration)
6727
+ ).map(({ flag: flag2 }) => flag2);
6662
6728
  }
6663
6729
  function getEventFlags(event2, config) {
6664
6730
  const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
6665
6731
  return [
6666
6732
  ...getActionStatusFlags(sortedActions),
6667
- ...getInherentFlags(sortedActions),
6733
+ ...getInherentFlags(sortedActions, event2, config),
6668
6734
  ...resolveEventCustomFlags(event2, config)
6669
6735
  ];
6670
6736
  }
@@ -7669,6 +7735,11 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
7669
7735
  id: "signature.upload.modal.title",
7670
7736
  defaultMessage: "Draw signature",
7671
7737
  description: "Title for the modal to draw signature"
7738
+ },
7739
+ // Zod applies the schema default at parse time, but this fixture bypasses
7740
+ // parsing — GeneratedInputField accesses configuration.maxFileSize directly.
7741
+ configuration: {
7742
+ maxFileSize: 5 * 1024 * 1024
7672
7743
  }
7673
7744
  }
7674
7745
  ]
@@ -10225,7 +10296,7 @@ function matchesJurisdictionFilter(locationIds, filter, user2) {
10225
10296
  return locationIds.some((id) => id === user2.primaryOfficeId);
10226
10297
  }
10227
10298
  if (filter === JurisdictionFilter.enum.administrativeArea) {
10228
- return user2.administrativeAreaId === null || locationIds.some((id) => id === user2.administrativeAreaId);
10299
+ return !user2.administrativeAreaId || locationIds.some((id) => id === user2.administrativeAreaId);
10229
10300
  }
10230
10301
  return true;
10231
10302
  }
@@ -10314,7 +10385,7 @@ function canAccessUserWithScope({
10314
10385
  }
10315
10386
  const hasAdministrativeAreaInHierarchy = userToAccess.administrativeHierarchy.some(
10316
10387
  (id) => user2.administrativeAreaId === id
10317
- ) || user2.administrativeAreaId === null;
10388
+ ) || !user2.administrativeAreaId;
10318
10389
  if (opts?.accessLevel === JurisdictionFilter.enum.administrativeArea && !hasAdministrativeAreaInHierarchy) {
10319
10390
  return false;
10320
10391
  }
@@ -10620,18 +10691,19 @@ var ACTION_FILTERS = {
10620
10691
  function filterActionsByFlags(actions, flags) {
10621
10692
  return actions.filter((action) => ACTION_FILTERS[action]?.(flags) ?? true);
10622
10693
  }
10694
+ var REJECTED_ACTIONS = [
10695
+ ActionType.READ,
10696
+ ActionType.NOTIFY,
10697
+ ActionType.CUSTOM,
10698
+ ActionType.EDIT,
10699
+ ActionType.ARCHIVE
10700
+ ];
10623
10701
  function getAvailableActionsWithoutFlagFilters(status2, flags) {
10624
10702
  if (flags.includes(InherentFlags.EDIT_IN_PROGRESS)) {
10625
10703
  return [ActionType.NOTIFY, ActionType.DECLARE, ActionType.REGISTER];
10626
10704
  }
10627
- if (flags.includes(InherentFlags.REJECTED)) {
10628
- return [
10629
- ActionType.READ,
10630
- ActionType.NOTIFY,
10631
- ActionType.CUSTOM,
10632
- ActionType.EDIT,
10633
- ActionType.ARCHIVE
10634
- ];
10705
+ if (flags.includes(InherentFlags.REJECTED) && status2 !== EventStatus.enum.ARCHIVED) {
10706
+ return REJECTED_ACTIONS;
10635
10707
  }
10636
10708
  return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status2];
10637
10709
  }
@@ -2395,18 +2395,18 @@ var encodeScope = (scope) => {
2395
2395
  });
2396
2396
  };
2397
2397
  var decodedScopeCache = /* @__PURE__ */ new Map();
2398
- var decodeScope = (query) => {
2399
- if (decodedScopeCache.has(query)) {
2400
- return decodedScopeCache.get(query);
2398
+ var decodeScope = (encodedScope) => {
2399
+ if (decodedScopeCache.has(encodedScope)) {
2400
+ return decodedScopeCache.get(encodedScope);
2401
2401
  }
2402
- const scope = qs.parse(query, {
2402
+ const scope = qs.parse(encodedScope, {
2403
2403
  ignoreQueryPrefix: true,
2404
2404
  comma: true,
2405
2405
  allowDots: true
2406
2406
  });
2407
2407
  const unflattenedScope = unflattenScope(scope);
2408
2408
  const result = Scope2.safeParse(unflattenedScope)?.data;
2409
- decodedScopeCache.set(query, result);
2409
+ decodedScopeCache.set(encodedScope, result);
2410
2410
  return result;
2411
2411
  };
2412
2412
  var DEFAULT_SCOPE_OPTIONS = {
@@ -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(),
@@ -1750,6 +1755,7 @@ var NumberField = BaseField.extend({
1750
1755
  configuration: import_v43.default.object({
1751
1756
  min: import_v43.default.number().optional().describe("Minimum value"),
1752
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"),
1753
1759
  prefix: TranslationConfig.optional(),
1754
1760
  postfix: TranslationConfig.optional()
1755
1761
  }).optional()
@@ -2673,6 +2679,14 @@ var ReadActionConfig = ActionConfigBase.extend(
2673
2679
  conditionals: z24.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
2674
2680
  }).shape
2675
2681
  );
2682
+ var NotifyConfig = DeclarationActionBase.extend(
2683
+ z24.object({
2684
+ type: z24.literal(ActionType.NOTIFY),
2685
+ review: DeclarationReviewConfig.describe(
2686
+ "Configuration of the review page fields."
2687
+ ).optional()
2688
+ }).shape
2689
+ );
2676
2690
  var DeclareConfig = DeclarationActionBase.extend(
2677
2691
  z24.object({
2678
2692
  type: z24.literal(ActionType.DECLARE),
@@ -2757,9 +2771,13 @@ var ActionConfig = z24.discriminatedUnion("type", [
2757
2771
  id: "ReadActionConfig",
2758
2772
  description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
2759
2773
  }),
2774
+ NotifyConfig.meta({
2775
+ id: "NotifyActionConfig",
2776
+ description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
2777
+ }),
2760
2778
  DeclareConfig.meta({
2761
2779
  id: "DeclareActionConfig",
2762
- description: "Configuration for the declare action. Includes review-page fields. Shared with the notify action (ActionType.NOTIFY)."
2780
+ description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
2763
2781
  }),
2764
2782
  RejectConfig.meta({
2765
2783
  id: "RejectActionConfig",
@@ -2938,6 +2956,9 @@ var BaseField3 = z28.object({
2938
2956
  ),
2939
2957
  validations: z28.array(ValidationConfig).optional().describe(
2940
2958
  `Option for overriding the field validations specifically for advanced search form.`
2959
+ ),
2960
+ allowedLocations: JurisdictionReference.optional().describe(
2961
+ `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.`
2941
2962
  )
2942
2963
  });
2943
2964
  var SearchQueryParams = z28.object({
@@ -3190,7 +3211,7 @@ var getActionAnnotationFields = (actionConfig) => {
3190
3211
  if (actionConfig.type === ActionType.CUSTOM) {
3191
3212
  return actionConfig.form;
3192
3213
  }
3193
- if ("review" in actionConfig) {
3214
+ if ("review" in actionConfig && actionConfig.review != null) {
3194
3215
  return actionConfig.review.fields;
3195
3216
  }
3196
3217
  return [];
@@ -4694,12 +4715,53 @@ var updateActions = ActionTypes.extract([
4694
4715
  ActionType.ARCHIVE,
4695
4716
  ActionType.PRINT_CERTIFICATE,
4696
4717
  ActionType.REQUEST_CORRECTION,
4718
+ ActionType.APPROVE_CORRECTION,
4719
+ ActionType.REJECT_CORRECTION,
4697
4720
  ActionType.CUSTOM
4698
4721
  ]);
4699
4722
 
4700
4723
  // ../commons/src/events/state/flags.ts
4701
4724
  var import_lodash3 = require("lodash");
4702
4725
  var import_date_fns3 = require("date-fns");
4726
+ var INHERENT_FLAG_RULES = [
4727
+ {
4728
+ flag: InherentFlags.CORRECTION_REQUESTED,
4729
+ setOn: [ActionType.REQUEST_CORRECTION],
4730
+ resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
4731
+ },
4732
+ {
4733
+ // INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
4734
+ // other status-changing action (see getStatusFromActions).
4735
+ flag: InherentFlags.INCOMPLETE,
4736
+ setOn: [ActionType.NOTIFY],
4737
+ resetOn: [
4738
+ ActionType.CREATE,
4739
+ ActionType.DECLARE,
4740
+ ActionType.REGISTER,
4741
+ ActionType.ARCHIVE
4742
+ ]
4743
+ },
4744
+ {
4745
+ flag: InherentFlags.REJECTED,
4746
+ setOn: [ActionType.REJECT],
4747
+ resetOn: [
4748
+ ActionType.NOTIFY,
4749
+ ActionType.DECLARE,
4750
+ ActionType.EDIT,
4751
+ ActionType.REGISTER
4752
+ ]
4753
+ },
4754
+ {
4755
+ flag: InherentFlags.POTENTIAL_DUPLICATE,
4756
+ setOn: [ActionType.DUPLICATE_DETECTED],
4757
+ resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
4758
+ },
4759
+ {
4760
+ flag: InherentFlags.EDIT_IN_PROGRESS,
4761
+ setOn: [ActionType.EDIT],
4762
+ resetOnAnyOtherAction: true
4763
+ }
4764
+ ];
4703
4765
 
4704
4766
  // ../commons/src/events/defineConfig.ts
4705
4767
  var IGNORED_EVENT_TYPES = [
@@ -5445,6 +5507,11 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
5445
5507
  id: "signature.upload.modal.title",
5446
5508
  defaultMessage: "Draw signature",
5447
5509
  description: "Title for the modal to draw signature"
5510
+ },
5511
+ // Zod applies the schema default at parse time, but this fixture bypasses
5512
+ // parsing — GeneratedInputField accesses configuration.maxFileSize directly.
5513
+ configuration: {
5514
+ maxFileSize: 5 * 1024 * 1024
5448
5515
  }
5449
5516
  }
5450
5517
  ]
@@ -7238,6 +7305,13 @@ var ACTION_FILTERS = {
7238
7305
  [ActionType.UNASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7239
7306
  [ActionType.CUSTOM]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
7240
7307
  };
7308
+ var REJECTED_ACTIONS = [
7309
+ ActionType.READ,
7310
+ ActionType.NOTIFY,
7311
+ ActionType.CUSTOM,
7312
+ ActionType.EDIT,
7313
+ ActionType.ARCHIVE
7314
+ ];
7241
7315
 
7242
7316
  // ../commons/src/events/FileUtils.ts
7243
7317
  var import_lodash7 = require("lodash");
@@ -580,14 +580,12 @@ export type EncodedScope = z.infer<typeof EncodedScope>;
580
580
  */
581
581
  export declare const encodeScope: (scope: Scope) => EncodedScope;
582
582
  /**
583
- * Converts a scope object into an encoded query string representation.
583
+ * Converts an encoded scope string into a scope object.
584
584
  *
585
- * @TODO scope param could be defined as EncodedScope instead of string.
586
- *
587
- * @param scope - The scope object to encode.
588
- * @returns The encoded scope as a branded string (`EncodedScope`).
585
+ * @param scope - The encoded scope string to decode.
586
+ * @returns The decoded scope object.
589
587
  */
590
- export declare const decodeScope: (query: EncodedScope) => {
588
+ export declare const decodeScope: (encodedScope: EncodedScope) => {
591
589
  type: "record.create" | "record.declare" | "record.notify";
592
590
  options?: {
593
591
  event?: string[] | undefined;
@@ -355,18 +355,18 @@ var encodeScope = (scope) => {
355
355
  });
356
356
  };
357
357
  var decodedScopeCache = /* @__PURE__ */ new Map();
358
- var decodeScope = (query) => {
359
- if (decodedScopeCache.has(query)) {
360
- return decodedScopeCache.get(query);
358
+ var decodeScope = (encodedScope) => {
359
+ if (decodedScopeCache.has(encodedScope)) {
360
+ return decodedScopeCache.get(encodedScope);
361
361
  }
362
- const scope = qs.parse(query, {
362
+ const scope = qs.parse(encodedScope, {
363
363
  ignoreQueryPrefix: true,
364
364
  comma: true,
365
365
  allowDots: true
366
366
  });
367
367
  const unflattenedScope = unflattenScope(scope);
368
368
  const result = Scope2.safeParse(unflattenedScope)?.data;
369
- decodedScopeCache.set(query, result);
369
+ decodedScopeCache.set(encodedScope, result);
370
370
  return result;
371
371
  };
372
372
  var DEFAULT_SCOPE_OPTIONS = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "2.0.0-rc.fe577a4",
3
+ "version": "2.0.0-rc.fea498b",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "bin": {