@opencrvs/toolkit 1.8.1-rc.0377f8e → 1.8.1-rc.06c1a33

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.
@@ -61,6 +61,7 @@ __export(events_exports, {
61
61
  BIRTH_EVENT: () => BIRTH_EVENT,
62
62
  BaseActionInput: () => BaseActionInput,
63
63
  BearerTokenByUserType: () => BearerTokenByUserType,
64
+ ButtonFieldValue: () => ButtonFieldValue,
64
65
  CONFIG_GET_ALLOWED_SCOPES: () => CONFIG_GET_ALLOWED_SCOPES,
65
66
  CONFIG_SEARCH_ALLOWED_SCOPES: () => CONFIG_SEARCH_ALLOWED_SCOPES,
66
67
  CertificateConfig: () => CertificateConfig,
@@ -127,6 +128,8 @@ __export(events_exports, {
127
128
  GenericAddressUpdateValue: () => GenericAddressUpdateValue,
128
129
  GenericAddressValue: () => GenericAddressValue,
129
130
  GeographicalArea: () => GeographicalArea,
131
+ HttpFieldUpdateValue: () => HttpFieldUpdateValue,
132
+ HttpFieldValue: () => HttpFieldValue,
130
133
  ImageMimeType: () => ImageMimeType,
131
134
  InherentFlags: () => InherentFlags,
132
135
  LanguageConfig: () => LanguageConfig,
@@ -275,6 +278,7 @@ __export(events_exports, {
275
278
  isAddressFieldType: () => isAddressFieldType,
276
279
  isAdministrativeAreaFieldType: () => isAdministrativeAreaFieldType,
277
280
  isBulletListFieldType: () => isBulletListFieldType,
281
+ isButtonFieldType: () => isButtonFieldType,
278
282
  isCheckboxFieldType: () => isCheckboxFieldType,
279
283
  isConditionMet: () => isConditionMet,
280
284
  isCountryFieldType: () => isCountryFieldType,
@@ -292,6 +296,7 @@ __export(events_exports, {
292
296
  isFieldVisible: () => isFieldVisible,
293
297
  isFileFieldType: () => isFileFieldType,
294
298
  isFileFieldWithOptionType: () => isFileFieldWithOptionType,
299
+ isHttpFieldType: () => isHttpFieldType,
295
300
  isIdFieldType: () => isIdFieldType,
296
301
  isLocationFieldType: () => isLocationFieldType,
297
302
  isMetaAction: () => isMetaAction,
@@ -544,7 +549,9 @@ var FieldType = {
544
549
  FACILITY: "FACILITY",
545
550
  OFFICE: "OFFICE",
546
551
  SIGNATURE: "SIGNATURE",
547
- DATA: "DATA"
552
+ DATA: "DATA",
553
+ BUTTON: "BUTTON",
554
+ HTTP: "HTTP"
548
555
  };
549
556
  var fieldTypes = Object.values(FieldType);
550
557
  var compositeFieldTypes = [
@@ -660,6 +667,17 @@ var FileFieldValueWithOption = import_zod5.z.object({
660
667
  option: import_zod5.z.string()
661
668
  });
662
669
  var FileFieldWithOptionValue = import_zod5.z.array(FileFieldValueWithOption);
670
+ var HttpFieldValue = import_zod5.z.object({
671
+ loading: import_zod5.z.boolean(),
672
+ error: import_zod5.z.object({ statusCode: import_zod5.z.number().nullable(), message: import_zod5.z.string() }).nullable(),
673
+ data: import_zod5.z.any(),
674
+ trackingValue: import_zod5.z.string().optional().describe("If the tracking value changes, the field will be re-fetched")
675
+ });
676
+ var HttpFieldUpdateValue = import_zod5.z.object({
677
+ loading: import_zod5.z.boolean().nullish(),
678
+ error: import_zod5.z.object({ statusCode: import_zod5.z.number().nullable(), message: import_zod5.z.string() }).nullish(),
679
+ data: import_zod5.z.any().nullish()
680
+ }).or(import_zod5.z.null()).or(import_zod5.z.undefined());
663
681
 
664
682
  // ../commons/src/events/FieldValue.ts
665
683
  var TextValue = import_zod6.z.string();
@@ -684,6 +702,7 @@ var CheckboxFieldValue = import_zod6.z.boolean();
684
702
  var NumberFieldValue = import_zod6.z.number();
685
703
  var DataFieldValue = import_zod6.z.undefined();
686
704
  var SignatureFieldValue = import_zod6.z.string();
705
+ var ButtonFieldValue = import_zod6.z.number();
687
706
  var FieldValue = import_zod6.z.union([
688
707
  TextValue,
689
708
  DateValue,
@@ -699,7 +718,9 @@ var FieldValue = import_zod6.z.union([
699
718
  DataFieldValue,
700
719
  GenericAddressValue,
701
720
  NameFieldValue,
702
- NameFieldUpdateValue
721
+ NameFieldUpdateValue,
722
+ ButtonFieldValue,
723
+ HttpFieldValue
703
724
  ]);
704
725
  var FieldUpdateValue = import_zod6.z.union([
705
726
  TextValue,
@@ -715,7 +736,8 @@ var FieldUpdateValue = import_zod6.z.union([
715
736
  RuralAddressUpdateValue,
716
737
  DataFieldValue,
717
738
  GenericAddressUpdateValue,
718
- NameFieldUpdateValue
739
+ NameFieldUpdateValue,
740
+ HttpFieldUpdateValue
719
741
  ]);
720
742
 
721
743
  // ../commons/src/events/FieldConfig.ts
@@ -1025,6 +1047,29 @@ var DataField = BaseField.extend({
1025
1047
  data: import_zod7.z.array(DataEntry)
1026
1048
  })
1027
1049
  }).describe("Data field for displaying read-only data");
1050
+ var ButtonField = BaseField.extend({
1051
+ type: import_zod7.z.literal(FieldType.BUTTON),
1052
+ configuration: import_zod7.z.object({
1053
+ icon: import_zod7.z.string().optional().describe(
1054
+ "Icon for the button. You can find icons from OpenCRVS UI-Kit."
1055
+ ),
1056
+ loading: import_zod7.z.boolean().optional().describe("Whether the button is in a loading state and shows a spinner"),
1057
+ text: TranslationConfig.describe("Text to display on the button")
1058
+ })
1059
+ }).describe("Generic button without any built-in functionality");
1060
+ var HttpField = BaseField.extend({
1061
+ type: import_zod7.z.literal(FieldType.HTTP),
1062
+ defaultValue: HttpFieldValue.optional(),
1063
+ configuration: import_zod7.z.object({
1064
+ trigger: FieldReference,
1065
+ url: import_zod7.z.string().describe("URL to send the HTTP request to"),
1066
+ method: import_zod7.z.enum(["GET", "POST", "PUT", "DELETE"]),
1067
+ headers: import_zod7.z.record(import_zod7.z.string()).optional(),
1068
+ body: import_zod7.z.record(import_zod7.z.string()).optional(),
1069
+ params: import_zod7.z.record(import_zod7.z.string()).optional(),
1070
+ timeout: import_zod7.z.number().default(15e3).describe("Request timeout in milliseconds")
1071
+ })
1072
+ }).describe("HTTP request function triggered by a button click");
1028
1073
  var FieldConfig = import_zod7.z.discriminatedUnion("type", [
1029
1074
  Address,
1030
1075
  TextField,
@@ -1053,7 +1098,9 @@ var FieldConfig = import_zod7.z.discriminatedUnion("type", [
1053
1098
  SignatureField,
1054
1099
  EmailField,
1055
1100
  FileUploadWithOptions,
1056
- DataField
1101
+ DataField,
1102
+ ButtonField,
1103
+ HttpField
1057
1104
  ]).openapi({
1058
1105
  description: "Form field configuration",
1059
1106
  ref: "FieldConfig"
@@ -2137,6 +2184,12 @@ function mapFieldTypeToZod(type, required) {
2137
2184
  case FieldType.NAME:
2138
2185
  schema = required ? NameFieldValue : NameFieldUpdateValue;
2139
2186
  break;
2187
+ case FieldType.BUTTON:
2188
+ schema = ButtonFieldValue;
2189
+ break;
2190
+ case FieldType.HTTP:
2191
+ schema = HttpFieldUpdateValue;
2192
+ break;
2140
2193
  }
2141
2194
  return required ? schema : schema.nullish();
2142
2195
  }
@@ -2172,6 +2225,8 @@ function mapFieldTypeToEmptyValue(field2) {
2172
2225
  case FieldType.DATA:
2173
2226
  case FieldType.NAME:
2174
2227
  case FieldType.PHONE:
2228
+ case FieldType.BUTTON:
2229
+ case FieldType.HTTP:
2175
2230
  case FieldType.ID:
2176
2231
  return null;
2177
2232
  case FieldType.ADDRESS:
@@ -2283,8 +2338,14 @@ var isOfficeFieldType = (field2) => {
2283
2338
  var isDataFieldType = (field2) => {
2284
2339
  return field2.config.type === FieldType.DATA;
2285
2340
  };
2341
+ var isButtonFieldType = (field2) => {
2342
+ return field2.config.type === FieldType.BUTTON;
2343
+ };
2344
+ var isHttpFieldType = (field2) => {
2345
+ return field2.config.type === FieldType.HTTP;
2346
+ };
2286
2347
  var isNonInteractiveFieldType = (field2) => {
2287
- return field2.type === FieldType.DIVIDER || field2.type === FieldType.PAGE_HEADER || field2.type === FieldType.PARAGRAPH || field2.type === FieldType.BULLET_LIST || field2.type === FieldType.DATA;
2348
+ return field2.type === FieldType.DIVIDER || field2.type === FieldType.PAGE_HEADER || field2.type === FieldType.PARAGRAPH || field2.type === FieldType.BULLET_LIST || field2.type === FieldType.DATA || field2.type === FieldType.HTTP;
2288
2349
  };
2289
2350
 
2290
2351
  // ../commons/src/conditionals/validate.ts
@@ -5741,44 +5802,41 @@ var tennisClubMembershipEvent = defineConfig({
5741
5802
  },
5742
5803
  {
5743
5804
  id: "identity-check",
5744
- type: PageTypes.enum.FORM,
5805
+ type: PageTypes.enum.VERIFICATION,
5745
5806
  title: {
5746
- id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
5747
- defaultMessage: "Verify their identity",
5807
+ id: "v2.event.birth.action.correction.form.section.requester.identity.verify.title",
5808
+ defaultMessage: "Verify ID",
5748
5809
  description: "This is the title of the section"
5749
5810
  },
5750
- fields: [
5751
- {
5752
- id: "correction.identity-check.instructions",
5753
- type: "PAGE_HEADER",
5811
+ fields: [],
5812
+ actions: {
5813
+ verify: {
5754
5814
  label: {
5755
- id: "correction.corrector.identity.instruction",
5756
- defaultMessage: "Please verify the identity of the person making this request",
5757
- description: "The title for the corrector form"
5815
+ defaultMessage: "Verified",
5816
+ description: "This is the label for the verification button",
5817
+ id: "v2.event.birth.action.correction.form.verify"
5758
5818
  }
5759
5819
  },
5760
- {
5761
- id: "correction.identity-check.verified",
5762
- type: "RADIO_GROUP",
5820
+ cancel: {
5763
5821
  label: {
5764
- id: "correction.corrector.identity.verified.label",
5765
- defaultMessage: "Identity verified",
5766
- description: "The title for the corrector form"
5822
+ defaultMessage: "Identity does not match",
5823
+ description: "This is the label for the verification cancellation button",
5824
+ id: "v2.event.birth.action.correction.form.cancel"
5767
5825
  },
5768
- defaultValue: "",
5769
- required: true,
5770
- options: [
5771
- {
5772
- value: "VERIFIED",
5773
- label: {
5774
- id: "correction.corrector.identity.verified",
5775
- defaultMessage: "I have verified their identity",
5776
- description: "Label for verified option in corrector identity check page"
5777
- }
5826
+ confirmation: {
5827
+ title: {
5828
+ defaultMessage: "Correct without proof of ID?",
5829
+ description: "This is the title for the verification cancellation modal",
5830
+ id: "v2.event.birth.action.correction.form.cancel.confirmation.title"
5831
+ },
5832
+ body: {
5833
+ defaultMessage: "Please be aware that if you proceed, you will be responsible for making a change to this record without the necessary proof of identification",
5834
+ description: "This is the body for the verification cancellation modal",
5835
+ id: "v2.event.birth.action.correction.form.cancel.confirmation.body"
5778
5836
  }
5779
- ]
5837
+ }
5780
5838
  }
5781
- ]
5839
+ }
5782
5840
  },
5783
5841
  {
5784
5842
  id: "correction-request.supporting-documents",
@@ -6631,6 +6689,8 @@ function mapFieldTypeToMockValue(field2, i, rng) {
6631
6689
  return generateRandomName(rng);
6632
6690
  case FieldType.NUMBER:
6633
6691
  return 19;
6692
+ case FieldType.BUTTON:
6693
+ return 1;
6634
6694
  case FieldType.EMAIL:
6635
6695
  return "test@opencrvs.org";
6636
6696
  case FieldType.ADDRESS:
@@ -6666,6 +6726,7 @@ function mapFieldTypeToMockValue(field2, i, rng) {
6666
6726
  };
6667
6727
  case FieldType.FILE_WITH_OPTIONS:
6668
6728
  case FieldType.DATA:
6729
+ case FieldType.HTTP:
6669
6730
  return void 0;
6670
6731
  }
6671
6732
  }
@@ -6752,6 +6813,7 @@ function eventPayloadGenerator(rng) {
6752
6813
  annotation: {
6753
6814
  "correction.requester.relationship": "ANOTHER_AGENT",
6754
6815
  "correction.request.reason": "Child's name was incorrect",
6816
+ "identity-check": true,
6755
6817
  ...annotation
6756
6818
  },
6757
6819
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "1.8.1-rc.0377f8e",
3
+ "version": "1.8.1-rc.06c1a33",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "exports": {