@opencrvs/toolkit 2.0.0-rc.dadc4ee → 2.0.0-rc.daec947

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.
@@ -85,6 +85,32 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
85
85
  fields: z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>;
86
86
  }, z.core.$strip>;
87
87
  conditionals: z.ZodOptional<z.ZodNever>;
88
+ }, z.core.$strip>, z.ZodObject<{
89
+ label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
90
+ flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
91
+ id: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
92
+ readonly INCOMPLETE: "incomplete";
93
+ readonly REJECTED: "rejected";
94
+ readonly CORRECTION_REQUESTED: "correction-requested";
95
+ readonly POTENTIAL_DUPLICATE: "potential-duplicate";
96
+ readonly EDIT_IN_PROGRESS: "edit-in-progress";
97
+ }>]>, z.ZodString]>;
98
+ operation: z.ZodEnum<{
99
+ add: "add";
100
+ remove: "remove";
101
+ }>;
102
+ conditional: z.ZodOptional<z.ZodAny>;
103
+ }, z.core.$strip>>>>;
104
+ supportingCopy: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>>;
105
+ icon: z.ZodOptional<z.ZodString>;
106
+ conditionals: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
107
+ type: z.ZodLiteral<"SHOW">;
108
+ conditional: z.ZodAny;
109
+ }, z.core.$strip>, z.ZodObject<{
110
+ type: z.ZodLiteral<"ENABLE">;
111
+ conditional: z.ZodAny;
112
+ }, z.core.$strip>], "type">>>;
113
+ type: z.ZodLiteral<"NOTIFY">;
88
114
  }, z.core.$strip>, z.ZodObject<{
89
115
  label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
90
116
  flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -388,8 +414,8 @@ export declare const actionConfigTypes: Set<ActionConfigTypes>;
388
414
  *
389
415
  * These are not the same as the broader workflow `action.type` values.
390
416
  * `ActionConfigTypes` includes only the action kinds that can be defined
391
- * in the country configuration (e.g. DECLARE, VALIDATE, CUSTOM), and
392
- * excludes workflow-only types such as CREATE or NOTIFY.
417
+ * in the country configuration (e.g. NOTIFY, DECLARE, VALIDATE, CUSTOM), and
418
+ * excludes workflow-only types such as CREATE.
393
419
  */
394
420
  export type ActionConfigTypes = ActionConfig['type'];
395
421
  export declare const DeclarationActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -3222,6 +3222,11 @@ var ReadActionConfig = ActionConfigBase.extend(
3222
3222
  conditionals: z24.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
3223
3223
  }).shape
3224
3224
  );
3225
+ var NotifyConfig = ActionConfigBase.extend(
3226
+ z24.object({
3227
+ type: z24.literal(ActionType.NOTIFY)
3228
+ }).shape
3229
+ );
3225
3230
  var DeclareConfig = DeclarationActionBase.extend(
3226
3231
  z24.object({
3227
3232
  type: z24.literal(ActionType.DECLARE),
@@ -3306,9 +3311,13 @@ var ActionConfig = z24.discriminatedUnion("type", [
3306
3311
  id: "ReadActionConfig",
3307
3312
  description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
3308
3313
  }),
3314
+ NotifyConfig.meta({
3315
+ id: "NotifyActionConfig",
3316
+ description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
3317
+ }),
3309
3318
  DeclareConfig.meta({
3310
3319
  id: "DeclareActionConfig",
3311
- description: "Configuration for the declare action. Includes review-page fields. Shared with the notify action (ActionType.NOTIFY)."
3320
+ description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
3312
3321
  }),
3313
3322
  RejectConfig.meta({
3314
3323
  id: "RejectActionConfig",
@@ -4477,13 +4486,13 @@ function getActionConfig({
4477
4486
  actionType,
4478
4487
  customActionType
4479
4488
  }) {
4489
+ if (actionType === ActionType.NOTIFY) {
4490
+ return eventConfiguration.actions.find((a) => a.type === ActionType.NOTIFY) ?? eventConfiguration.actions.find((a) => a.type === ActionType.DECLARE);
4491
+ }
4480
4492
  return eventConfiguration.actions.find((a) => {
4481
4493
  if (a.type === ActionType.CUSTOM && customActionType) {
4482
4494
  return a.customActionType === customActionType;
4483
4495
  }
4484
- if (actionType === ActionType.NOTIFY) {
4485
- return a.type === ActionType.DECLARE;
4486
- }
4487
4496
  if (actionType === ActionType.APPROVE_CORRECTION || actionType === ActionType.REJECT_CORRECTION) {
4488
4497
  return a.type === ActionType.REQUEST_CORRECTION;
4489
4498
  }
@@ -4520,7 +4529,7 @@ var getActionAnnotationFields = (actionConfig) => {
4520
4529
  if (actionConfig.type === ActionType.CUSTOM) {
4521
4530
  return actionConfig.form;
4522
4531
  }
4523
- if ("review" in actionConfig) {
4532
+ if ("review" in actionConfig && actionConfig.review != null) {
4524
4533
  return actionConfig.review.fields;
4525
4534
  }
4526
4535
  return [];
@@ -8284,6 +8293,20 @@ var tennisClubMembershipEvent = defineConfig({
8284
8293
  },
8285
8294
  review: TENNIS_CLUB_DECLARATION_REVIEW
8286
8295
  },
8296
+ {
8297
+ type: ActionType.NOTIFY,
8298
+ label: {
8299
+ defaultMessage: "Notify health worker",
8300
+ description: "This is shown as the action name anywhere the user can trigger the action from",
8301
+ id: "event.tennis-club-membership.action.notify.label"
8302
+ },
8303
+ flags: [
8304
+ {
8305
+ id: "health-worker-notified",
8306
+ operation: "add"
8307
+ }
8308
+ ]
8309
+ },
8287
8310
  {
8288
8311
  type: ActionType.REJECT,
8289
8312
  label: {
@@ -8526,6 +8549,17 @@ var tennisClubMembershipEvent = defineConfig({
8526
8549
  }
8527
8550
  }
8528
8551
  ],
8552
+ flags: [
8553
+ {
8554
+ id: "health-worker-notified",
8555
+ requiresAction: false,
8556
+ label: {
8557
+ id: "event.tennis-club-membership.flag.health-worker-notified.label",
8558
+ defaultMessage: "Health worker notified",
8559
+ description: "Label for the health-worker-notified flag"
8560
+ }
8561
+ }
8562
+ ],
8529
8563
  advancedSearch: [
8530
8564
  {
8531
8565
  title: {
@@ -2679,6 +2679,11 @@ var ReadActionConfig = ActionConfigBase.extend(
2679
2679
  conditionals: z24.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
2680
2680
  }).shape
2681
2681
  );
2682
+ var NotifyConfig = ActionConfigBase.extend(
2683
+ z24.object({
2684
+ type: z24.literal(ActionType.NOTIFY)
2685
+ }).shape
2686
+ );
2682
2687
  var DeclareConfig = DeclarationActionBase.extend(
2683
2688
  z24.object({
2684
2689
  type: z24.literal(ActionType.DECLARE),
@@ -2763,9 +2768,13 @@ var ActionConfig = z24.discriminatedUnion("type", [
2763
2768
  id: "ReadActionConfig",
2764
2769
  description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
2765
2770
  }),
2771
+ NotifyConfig.meta({
2772
+ id: "NotifyActionConfig",
2773
+ description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
2774
+ }),
2766
2775
  DeclareConfig.meta({
2767
2776
  id: "DeclareActionConfig",
2768
- description: "Configuration for the declare action. Includes review-page fields. Shared with the notify action (ActionType.NOTIFY)."
2777
+ description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
2769
2778
  }),
2770
2779
  RejectConfig.meta({
2771
2780
  id: "RejectActionConfig",
@@ -3199,7 +3208,7 @@ var getActionAnnotationFields = (actionConfig) => {
3199
3208
  if (actionConfig.type === ActionType.CUSTOM) {
3200
3209
  return actionConfig.form;
3201
3210
  }
3202
- if ("review" in actionConfig) {
3211
+ if ("review" in actionConfig && actionConfig.review != null) {
3203
3212
  return actionConfig.review.fields;
3204
3213
  }
3205
3214
  return [];
@@ -6056,6 +6065,20 @@ var tennisClubMembershipEvent = defineConfig({
6056
6065
  },
6057
6066
  review: TENNIS_CLUB_DECLARATION_REVIEW
6058
6067
  },
6068
+ {
6069
+ type: ActionType.NOTIFY,
6070
+ label: {
6071
+ defaultMessage: "Notify health worker",
6072
+ description: "This is shown as the action name anywhere the user can trigger the action from",
6073
+ id: "event.tennis-club-membership.action.notify.label"
6074
+ },
6075
+ flags: [
6076
+ {
6077
+ id: "health-worker-notified",
6078
+ operation: "add"
6079
+ }
6080
+ ]
6081
+ },
6059
6082
  {
6060
6083
  type: ActionType.REJECT,
6061
6084
  label: {
@@ -6298,6 +6321,17 @@ var tennisClubMembershipEvent = defineConfig({
6298
6321
  }
6299
6322
  }
6300
6323
  ],
6324
+ flags: [
6325
+ {
6326
+ id: "health-worker-notified",
6327
+ requiresAction: false,
6328
+ label: {
6329
+ id: "event.tennis-club-membership.flag.health-worker-notified.label",
6330
+ defaultMessage: "Health worker notified",
6331
+ description: "Label for the health-worker-notified flag"
6332
+ }
6333
+ }
6334
+ ],
6301
6335
  advancedSearch: [
6302
6336
  {
6303
6337
  title: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "2.0.0-rc.dadc4ee",
3
+ "version": "2.0.0-rc.daec947",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "bin": {