@opencrvs/toolkit 2.0.0-rc.b2f052c → 2.0.0-rc.b3014dd

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.
@@ -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"));
@@ -1478,7 +1483,8 @@ var Range = import_v4.z.object({
1478
1483
  });
1479
1484
  var ContainsFlags = import_v4.z.object({
1480
1485
  anyOf: import_v4.z.array(Flag).optional(),
1481
- noneOf: import_v4.z.array(Flag).optional()
1486
+ noneOf: import_v4.z.array(Flag).optional(),
1487
+ allOf: import_v4.z.array(Flag).optional()
1482
1488
  }).meta({
1483
1489
  id: "ContainsFlags"
1484
1490
  });
@@ -1750,6 +1756,7 @@ var NumberField = BaseField.extend({
1750
1756
  configuration: import_v43.default.object({
1751
1757
  min: import_v43.default.number().optional().describe("Minimum value"),
1752
1758
  max: import_v43.default.number().optional().describe("Maximum value"),
1759
+ integer: import_v43.default.boolean().optional().describe("When true, only whole numbers are allowed"),
1753
1760
  prefix: TranslationConfig.optional(),
1754
1761
  postfix: TranslationConfig.optional()
1755
1762
  }).optional()
@@ -2673,6 +2680,43 @@ var ReadActionConfig = ActionConfigBase.extend(
2673
2680
  conditionals: z24.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
2674
2681
  }).shape
2675
2682
  );
2683
+ var NotifyConfig = ActionConfigBase.extend(
2684
+ z24.object({
2685
+ type: z24.literal(ActionType.NOTIFY)
2686
+ }).shape
2687
+ );
2688
+ var DuplicateDetectedConfig = z24.object({
2689
+ type: z24.literal(ActionType.DUPLICATE_DETECTED),
2690
+ flags: ActionConfigBase.shape.flags,
2691
+ conditionals: z24.never().optional().describe(
2692
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it cannot be disabled or hidden with conditionals."
2693
+ )
2694
+ });
2695
+ var MarkAsDuplicateConfig = ActionConfigBase.extend(
2696
+ z24.object({
2697
+ type: z24.literal(ActionType.MARK_AS_DUPLICATE)
2698
+ }).shape
2699
+ );
2700
+ var MarkAsNotDuplicateConfig = ActionConfigBase.extend(
2701
+ z24.object({
2702
+ type: z24.literal(ActionType.MARK_AS_NOT_DUPLICATE)
2703
+ }).shape
2704
+ );
2705
+ var AssignConfig = ActionConfigBase.extend(
2706
+ z24.object({
2707
+ type: z24.literal(ActionType.ASSIGN)
2708
+ }).shape
2709
+ );
2710
+ var UnassignConfig = ActionConfigBase.extend(
2711
+ z24.object({
2712
+ type: z24.literal(ActionType.UNASSIGN)
2713
+ }).shape
2714
+ );
2715
+ var DeleteConfig = ActionConfigBase.extend(
2716
+ z24.object({
2717
+ type: z24.literal(ActionType.DELETE)
2718
+ }).shape
2719
+ );
2676
2720
  var DeclareConfig = DeclarationActionBase.extend(
2677
2721
  z24.object({
2678
2722
  type: z24.literal(ActionType.DECLARE),
@@ -2735,6 +2779,16 @@ var RequestCorrectionConfig = ActionConfigBase.extend(
2735
2779
  correctionForm: ActionFormConfig
2736
2780
  }).shape
2737
2781
  );
2782
+ var ApproveCorrectionConfig = ActionConfigBase.extend(
2783
+ z24.object({
2784
+ type: z24.literal(ActionType.APPROVE_CORRECTION)
2785
+ }).shape
2786
+ );
2787
+ var RejectCorrectionConfig = ActionConfigBase.extend(
2788
+ z24.object({
2789
+ type: z24.literal(ActionType.REJECT_CORRECTION)
2790
+ }).shape
2791
+ );
2738
2792
  var CustomActionConfig = ActionConfigBase.merge(
2739
2793
  z24.object({
2740
2794
  type: z24.literal(ActionType.CUSTOM),
@@ -2757,9 +2811,37 @@ var ActionConfig = z24.discriminatedUnion("type", [
2757
2811
  id: "ReadActionConfig",
2758
2812
  description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
2759
2813
  }),
2814
+ AssignConfig.meta({
2815
+ id: "AssignActionConfig",
2816
+ description: "Configuration for assigning a record to the current user."
2817
+ }),
2818
+ UnassignConfig.meta({
2819
+ id: "UnassignActionConfig",
2820
+ description: "Configuration for unassigning a record from its current assignee."
2821
+ }),
2822
+ DeleteConfig.meta({
2823
+ id: "DeleteActionConfig",
2824
+ description: "Configuration for deleting a draft record."
2825
+ }),
2826
+ NotifyConfig.meta({
2827
+ id: "NotifyActionConfig",
2828
+ description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
2829
+ }),
2760
2830
  DeclareConfig.meta({
2761
2831
  id: "DeclareActionConfig",
2762
- description: "Configuration for the declare action. Includes review-page fields. Shared with the notify action (ActionType.NOTIFY)."
2832
+ description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
2833
+ }),
2834
+ DuplicateDetectedConfig.meta({
2835
+ id: "DuplicateDetectedActionConfig",
2836
+ description: "Configuration for the system-generated duplicate-detection action. Never shown as a button, so it only supports flags \u2014 not label, icon, or conditionals."
2837
+ }),
2838
+ MarkAsDuplicateConfig.meta({
2839
+ id: "MarkAsDuplicateActionConfig",
2840
+ description: "Configuration for marking a record as a duplicate."
2841
+ }),
2842
+ MarkAsNotDuplicateConfig.meta({
2843
+ id: "MarkAsNotDuplicateActionConfig",
2844
+ description: "Configuration for marking a record as not a duplicate, after it was previously flagged as one."
2763
2845
  }),
2764
2846
  RejectConfig.meta({
2765
2847
  id: "RejectActionConfig",
@@ -2777,6 +2859,14 @@ var ActionConfig = z24.discriminatedUnion("type", [
2777
2859
  id: "RequestCorrectionActionConfig",
2778
2860
  description: "Configuration for requesting a correction on a registered record."
2779
2861
  }),
2862
+ ApproveCorrectionConfig.meta({
2863
+ id: "ApproveCorrectionActionConfig",
2864
+ description: "Configuration for approving a requested correction."
2865
+ }),
2866
+ RejectCorrectionConfig.meta({
2867
+ id: "RejectCorrectionActionConfig",
2868
+ description: "Configuration for rejecting a requested correction."
2869
+ }),
2780
2870
  EditActionConfig.meta({
2781
2871
  id: "EditActionConfig",
2782
2872
  description: "Configuration for editing a record before registration."
@@ -3193,7 +3283,7 @@ var getActionAnnotationFields = (actionConfig) => {
3193
3283
  if (actionConfig.type === ActionType.CUSTOM) {
3194
3284
  return actionConfig.form;
3195
3285
  }
3196
- if ("review" in actionConfig) {
3286
+ if ("review" in actionConfig && actionConfig.review != null) {
3197
3287
  return actionConfig.review.fields;
3198
3288
  }
3199
3289
  return [];
@@ -4697,12 +4787,53 @@ var updateActions = ActionTypes.extract([
4697
4787
  ActionType.ARCHIVE,
4698
4788
  ActionType.PRINT_CERTIFICATE,
4699
4789
  ActionType.REQUEST_CORRECTION,
4790
+ ActionType.APPROVE_CORRECTION,
4791
+ ActionType.REJECT_CORRECTION,
4700
4792
  ActionType.CUSTOM
4701
4793
  ]);
4702
4794
 
4703
4795
  // ../commons/src/events/state/flags.ts
4704
4796
  var import_lodash3 = require("lodash");
4705
4797
  var import_date_fns3 = require("date-fns");
4798
+ var INHERENT_FLAG_RULES = [
4799
+ {
4800
+ flag: InherentFlags.CORRECTION_REQUESTED,
4801
+ setOn: [ActionType.REQUEST_CORRECTION],
4802
+ resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
4803
+ },
4804
+ {
4805
+ // INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
4806
+ // other status-changing action (see getStatusFromActions).
4807
+ flag: InherentFlags.INCOMPLETE,
4808
+ setOn: [ActionType.NOTIFY],
4809
+ resetOn: [
4810
+ ActionType.CREATE,
4811
+ ActionType.DECLARE,
4812
+ ActionType.REGISTER,
4813
+ ActionType.ARCHIVE
4814
+ ]
4815
+ },
4816
+ {
4817
+ flag: InherentFlags.REJECTED,
4818
+ setOn: [ActionType.REJECT],
4819
+ resetOn: [
4820
+ ActionType.NOTIFY,
4821
+ ActionType.DECLARE,
4822
+ ActionType.EDIT,
4823
+ ActionType.REGISTER
4824
+ ]
4825
+ },
4826
+ {
4827
+ flag: InherentFlags.POTENTIAL_DUPLICATE,
4828
+ setOn: [ActionType.DUPLICATE_DETECTED],
4829
+ resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
4830
+ },
4831
+ {
4832
+ flag: InherentFlags.EDIT_IN_PROGRESS,
4833
+ setOn: [ActionType.EDIT],
4834
+ resetOnAnyOtherAction: true
4835
+ }
4836
+ ];
4706
4837
 
4707
4838
  // ../commons/src/events/defineConfig.ts
4708
4839
  var IGNORED_EVENT_TYPES = [
@@ -5448,6 +5579,11 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
5448
5579
  id: "signature.upload.modal.title",
5449
5580
  defaultMessage: "Draw signature",
5450
5581
  description: "Title for the modal to draw signature"
5582
+ },
5583
+ // Zod applies the schema default at parse time, but this fixture bypasses
5584
+ // parsing — GeneratedInputField accesses configuration.maxFileSize directly.
5585
+ configuration: {
5586
+ maxFileSize: 5 * 1024 * 1024
5451
5587
  }
5452
5588
  }
5453
5589
  ]
@@ -6004,6 +6140,20 @@ var tennisClubMembershipEvent = defineConfig({
6004
6140
  },
6005
6141
  review: TENNIS_CLUB_DECLARATION_REVIEW
6006
6142
  },
6143
+ {
6144
+ type: ActionType.NOTIFY,
6145
+ label: {
6146
+ defaultMessage: "Notify health worker",
6147
+ description: "This is shown as the action name anywhere the user can trigger the action from",
6148
+ id: "event.tennis-club-membership.action.notify.label"
6149
+ },
6150
+ flags: [
6151
+ {
6152
+ id: "health-worker-notified",
6153
+ operation: "add"
6154
+ }
6155
+ ]
6156
+ },
6007
6157
  {
6008
6158
  type: ActionType.REJECT,
6009
6159
  label: {
@@ -6246,6 +6396,17 @@ var tennisClubMembershipEvent = defineConfig({
6246
6396
  }
6247
6397
  }
6248
6398
  ],
6399
+ flags: [
6400
+ {
6401
+ id: "health-worker-notified",
6402
+ requiresAction: false,
6403
+ label: {
6404
+ id: "event.tennis-club-membership.flag.health-worker-notified.label",
6405
+ defaultMessage: "Health worker notified",
6406
+ description: "Label for the health-worker-notified flag"
6407
+ }
6408
+ }
6409
+ ],
6249
6410
  advancedSearch: [
6250
6411
  {
6251
6412
  title: {
@@ -7241,6 +7402,13 @@ var ACTION_FILTERS = {
7241
7402
  [ActionType.UNASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7242
7403
  [ActionType.CUSTOM]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
7243
7404
  };
7405
+ var REJECTED_ACTIONS = [
7406
+ ActionType.READ,
7407
+ ActionType.NOTIFY,
7408
+ ActionType.CUSTOM,
7409
+ ActionType.EDIT,
7410
+ ActionType.ARCHIVE
7411
+ ];
7244
7412
 
7245
7413
  // ../commons/src/events/FileUtils.ts
7246
7414
  var import_lodash7 = require("lodash");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "2.0.0-rc.b2f052c",
3
+ "version": "2.0.0-rc.b3014dd",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "bin": {