@opencrvs/toolkit 1.9.8-rc.d187100 → 1.9.8-rc.f0948d3

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.
@@ -2379,7 +2379,7 @@ var BaseField3 = import_zod24.z.object({
2379
2379
  label would be "Applicant Applicant's First Name", which is redundant and awkward.
2380
2380
 
2381
2381
  By setting searchCriteriaLabelPrefix to a translation config object, we can explicitly define the desired prefix
2382
- in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
2382
+ in the country-config > event.advancedSearch configuration. For example: event.declaration("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
2383
2383
  `
2384
2384
  ),
2385
2385
  conditionals: import_zod24.z.array(FieldConditional).default([]).optional().describe(
@@ -2643,9 +2643,9 @@ var EventConfig = import_zod27.z.object({
2643
2643
  )
2644
2644
  }).superRefine((event2, ctx) => {
2645
2645
  const allFields = findAllFields(event2);
2646
- const fieldIds = allFields.map((field3) => field3.id);
2646
+ const fieldIds = allFields.map((field2) => field2.id);
2647
2647
  const advancedSearchFields = event2.advancedSearch.flatMap(
2648
- (section) => section.fields.flatMap((field3) => field3.fieldId)
2648
+ (section) => section.fields.flatMap((field2) => field2.fieldId)
2649
2649
  );
2650
2650
  const advancedSearchFieldsSet = new Set(advancedSearchFields);
2651
2651
  if (advancedSearchFieldsSet.size !== advancedSearchFields.length) {
@@ -2660,7 +2660,7 @@ var EventConfig = import_zod27.z.object({
2660
2660
  // Check if the fieldId is not in the fieldIds array
2661
2661
  // and also not in the metadataFields array
2662
2662
  section.fields.filter(
2663
- (field3) => !(fieldIds.includes(field3.fieldId) || EventFieldId.options.includes(field3.fieldId) || field3.config.searchFields && field3.config.searchFields.length > 0 && field3.config.searchFields.every((sf) => fieldIds.includes(sf)))
2663
+ (field2) => !(fieldIds.includes(field2.fieldId) || EventFieldId.options.includes(field2.fieldId) || field2.config.searchFields && field2.config.searchFields.length > 0 && field2.config.searchFields.every((sf) => fieldIds.includes(sf)))
2664
2664
  )
2665
2665
  )
2666
2666
  );
@@ -2703,6 +2703,76 @@ var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
2703
2703
  // ../commons/src/events/WorkqueueConfig.ts
2704
2704
  var import_zod31 = require("zod");
2705
2705
 
2706
+ // ../commons/src/searchConfigs.ts
2707
+ function createSearchConfig(baseField) {
2708
+ return {
2709
+ /**
2710
+ * Creates a range configuration for the specified field.
2711
+ *
2712
+ * @returns An object containing the field ID and a configuration object with a type of 'range'.
2713
+ *
2714
+ * @example event('legalStatuses.REGISTERED.acceptedAt').range()
2715
+ * // {
2716
+ * // ...
2717
+ * // config: { type: 'range' }
2718
+ * // }
2719
+ */
2720
+ range: () => ({
2721
+ ...baseField,
2722
+ config: { type: "range" }
2723
+ }),
2724
+ /**
2725
+ * Creates a configuration for exact matching of the specified field.
2726
+ * @returns An object containing the field ID and a configuration object with a type of 'exact'.
2727
+ * @example event.declaration('dob').exact()
2728
+ * // {
2729
+ * // ...
2730
+ * // config: { type: 'exact' }
2731
+ * // }
2732
+ */
2733
+ exact: () => ({
2734
+ ...baseField,
2735
+ config: { type: "exact" }
2736
+ }),
2737
+ /**
2738
+ * Creates a configuration for fuzzy matching of the specified field.
2739
+ * @returns An object containing the field ID and a configuration object with a type of 'exact'.
2740
+ * @example event.declaration('name').fuzzy()
2741
+ * // {
2742
+ * // ...
2743
+ * // config: { type: 'fuzzy' }
2744
+ * // }
2745
+ */
2746
+ fuzzy: () => ({
2747
+ ...baseField,
2748
+ config: { type: "fuzzy" }
2749
+ }),
2750
+ /**
2751
+ * Creates a configuration for matching locations and the child locations
2752
+ * @returns An object containing the field ID and a configuration object with a type of 'within'.
2753
+ * @example event.declaration('createdAtLocation').within()
2754
+ * // {
2755
+ * // ...
2756
+ * // config: { type: 'within' }
2757
+ * // }
2758
+ */
2759
+ within: () => ({
2760
+ ...baseField,
2761
+ config: { type: "within" }
2762
+ })
2763
+ };
2764
+ }
2765
+
2766
+ // ../commons/src/field-config/field-configuration.ts
2767
+ function createFieldConfig(fieldId, options) {
2768
+ const baseField = {
2769
+ fieldId,
2770
+ fieldType: "field",
2771
+ ...options
2772
+ };
2773
+ return createSearchConfig(baseField);
2774
+ }
2775
+
2706
2776
  // ../commons/src/conditionals/conditionals.ts
2707
2777
  var objectHash = __toESM(require("object-hash"));
2708
2778
  function defineConditional(schema) {
@@ -2742,8 +2812,8 @@ function not(condition) {
2742
2812
  function never() {
2743
2813
  return not(alwaysTrue());
2744
2814
  }
2745
- function jsonFieldPath(field3) {
2746
- return [field3.$$field, ...field3.$$subfield].join("/");
2815
+ function jsonFieldPath(field2) {
2816
+ return [field2.$$field, ...field2.$$subfield].join("/");
2747
2817
  }
2748
2818
  function wrapToPath(condition, path) {
2749
2819
  if (path.length === 0) {
@@ -2826,39 +2896,39 @@ var user = Object.assign(userSerializer, {
2826
2896
  function isFieldReference(value) {
2827
2897
  return typeof value === "object" && value !== null && "$$field" in value;
2828
2898
  }
2829
- function getDateRangeToFieldReference(field3, comparedField, clause) {
2899
+ function getDateRangeToFieldReference(field2, comparedField, clause) {
2830
2900
  return {
2831
2901
  type: "object",
2832
2902
  properties: {
2833
- [field3.$$field]: wrapToPath(
2903
+ [field2.$$field]: wrapToPath(
2834
2904
  {
2835
2905
  type: "string",
2836
2906
  format: "date",
2837
2907
  [clause]: {
2838
- $data: `${field3.$$subfield.length + 1}/${jsonFieldPath(comparedField)}`
2908
+ $data: `${field2.$$subfield.length + 1}/${jsonFieldPath(comparedField)}`
2839
2909
  }
2840
2910
  },
2841
- field3.$$subfield
2911
+ field2.$$subfield
2842
2912
  ),
2843
2913
  [comparedField.$$field]: wrapToPath(
2844
2914
  { type: "string", format: "date" },
2845
2915
  comparedField.$$subfield
2846
2916
  )
2847
2917
  },
2848
- required: [field3.$$field]
2918
+ required: [field2.$$field]
2849
2919
  };
2850
2920
  }
2851
- function getDayRangeToFieldReference(field3, comparedField, days, clause) {
2921
+ function getDayRangeToFieldReference(field2, comparedField, days, clause) {
2852
2922
  return {
2853
2923
  type: "object",
2854
2924
  properties: {
2855
- [field3.$$field]: wrapToPath(
2925
+ [field2.$$field]: wrapToPath(
2856
2926
  {
2857
2927
  type: "string",
2858
2928
  format: "date",
2859
2929
  daysFromDate: {
2860
2930
  referenceDate: {
2861
- $data: `${field3.$$subfield.length + 1}/${jsonFieldPath(
2931
+ $data: `${field2.$$subfield.length + 1}/${jsonFieldPath(
2862
2932
  comparedField
2863
2933
  )}`
2864
2934
  },
@@ -2866,55 +2936,55 @@ function getDayRangeToFieldReference(field3, comparedField, days, clause) {
2866
2936
  days
2867
2937
  }
2868
2938
  },
2869
- field3.$$subfield
2939
+ field2.$$subfield
2870
2940
  ),
2871
2941
  [comparedField.$$field]: wrapToPath(
2872
2942
  { type: "string", format: "date" },
2873
2943
  comparedField.$$subfield
2874
2944
  )
2875
2945
  },
2876
- required: [field3.$$field]
2946
+ required: [field2.$$field]
2877
2947
  };
2878
2948
  }
2879
- function defineComparison(field3, value, keyword) {
2949
+ function defineComparison(field2, value, keyword) {
2880
2950
  if (isFieldReference(value)) {
2881
2951
  const comparedField = value;
2882
2952
  return defineFormConditional({
2883
2953
  type: "object",
2884
2954
  properties: {
2885
- [field3.$$field]: wrapToPath(
2955
+ [field2.$$field]: wrapToPath(
2886
2956
  {
2887
2957
  type: ["number"],
2888
2958
  [keyword]: {
2889
- $data: `${field3.$$subfield.length + 1}/${jsonFieldPath(comparedField)}`
2959
+ $data: `${field2.$$subfield.length + 1}/${jsonFieldPath(comparedField)}`
2890
2960
  }
2891
2961
  },
2892
- field3.$$subfield
2962
+ field2.$$subfield
2893
2963
  ),
2894
2964
  [comparedField.$$field]: wrapToPath(
2895
2965
  { type: "number" },
2896
2966
  comparedField.$$subfield
2897
2967
  )
2898
2968
  },
2899
- required: [field3.$$field]
2969
+ required: [field2.$$field]
2900
2970
  });
2901
2971
  }
2902
2972
  return defineFormConditional({
2903
2973
  type: "object",
2904
2974
  properties: {
2905
- [field3.$$field]: wrapToPath(
2975
+ [field2.$$field]: wrapToPath(
2906
2976
  { type: "number", [keyword]: value },
2907
- field3.$$subfield
2977
+ field2.$$subfield
2908
2978
  )
2909
2979
  },
2910
- required: [field3.$$field]
2980
+ required: [field2.$$field]
2911
2981
  });
2912
2982
  }
2913
2983
  function createFieldConditionals(fieldId) {
2914
- const getDayRange = (field3, days, clause, referenceDate) => ({
2984
+ const getDayRange = (field2, days, clause, referenceDate) => ({
2915
2985
  type: "object",
2916
2986
  properties: {
2917
- [field3.$$field]: wrapToPath(
2987
+ [field2.$$field]: wrapToPath(
2918
2988
  {
2919
2989
  type: "string",
2920
2990
  format: "date",
@@ -2924,24 +2994,24 @@ function createFieldConditionals(fieldId) {
2924
2994
  referenceDate
2925
2995
  }
2926
2996
  },
2927
- field3.$$subfield
2997
+ field2.$$subfield
2928
2998
  )
2929
2999
  },
2930
- required: [field3.$$field]
3000
+ required: [field2.$$field]
2931
3001
  });
2932
- const getDateRange = (field3, date, clause) => ({
3002
+ const getDateRange = (field2, date, clause) => ({
2933
3003
  type: "object",
2934
3004
  properties: {
2935
- [field3.$$field]: wrapToPath(
3005
+ [field2.$$field]: wrapToPath(
2936
3006
  {
2937
3007
  type: "string",
2938
3008
  format: "date",
2939
3009
  [clause]: date
2940
3010
  },
2941
- field3.$$subfield
3011
+ field2.$$subfield
2942
3012
  )
2943
3013
  },
2944
- required: [field3.$$field]
3014
+ required: [field2.$$field]
2945
3015
  });
2946
3016
  return {
2947
3017
  /**
@@ -3090,7 +3160,7 @@ function createFieldConditionals(fieldId) {
3090
3160
  },
3091
3161
  /**
3092
3162
  * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
3093
- * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
3163
+ * @example event.declaration('recommender.none').isFalsy() vs not(event.declaration('recommender.none').isEqualTo(true))
3094
3164
  * @returns whether the field is falsy (undefined, false, null, empty string)
3095
3165
  *
3096
3166
  * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
@@ -3238,11 +3308,11 @@ function createFieldConditionals(fieldId) {
3238
3308
  getId: () => ({ fieldId }),
3239
3309
  /**
3240
3310
  * @deprecated
3241
- * use field(fieldId).get(nestedProperty) instead
3311
+ * use event.declaration(fieldId).get(nestedProperty) instead
3242
3312
  * with 'and' combinator e.g.
3243
3313
  * and(
3244
- * field('child.name').get('firstname').isEqualTo('John'),
3245
- * field('child.name').get('surname').isEqualTo('Doe')
3314
+ * event.declaration('child.name').get('firstname').isEqualTo('John'),
3315
+ * event.declaration('child.name').get('surname').isEqualTo('Doe')
3246
3316
  * )
3247
3317
  */
3248
3318
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -3264,66 +3334,6 @@ function createFieldConditionals(fieldId) {
3264
3334
  };
3265
3335
  }
3266
3336
 
3267
- // ../commons/src/searchConfigs.ts
3268
- function createSearchConfig(baseField) {
3269
- return {
3270
- /**
3271
- * Creates a range configuration for the specified field.
3272
- *
3273
- * @returns An object containing the field ID and a configuration object with a type of 'range'.
3274
- *
3275
- * @example event('legalStatuses.REGISTERED.acceptedAt').range()
3276
- * // {
3277
- * // ...
3278
- * // config: { type: 'range' }
3279
- * // }
3280
- */
3281
- range: () => ({
3282
- ...baseField,
3283
- config: { type: "range" }
3284
- }),
3285
- /**
3286
- * Creates a configuration for exact matching of the specified field.
3287
- * @returns An object containing the field ID and a configuration object with a type of 'exact'.
3288
- * @example field('dob').exact()
3289
- * // {
3290
- * // ...
3291
- * // config: { type: 'exact' }
3292
- * // }
3293
- */
3294
- exact: () => ({
3295
- ...baseField,
3296
- config: { type: "exact" }
3297
- }),
3298
- /**
3299
- * Creates a configuration for fuzzy matching of the specified field.
3300
- * @returns An object containing the field ID and a configuration object with a type of 'exact'.
3301
- * @example field('name').fuzzy()
3302
- * // {
3303
- * // ...
3304
- * // config: { type: 'fuzzy' }
3305
- * // }
3306
- */
3307
- fuzzy: () => ({
3308
- ...baseField,
3309
- config: { type: "fuzzy" }
3310
- }),
3311
- /**
3312
- * Creates a configuration for matching locations and the child locations
3313
- * @returns An object containing the field ID and a configuration object with a type of 'within'.
3314
- * @example field('createdAtLocation').within()
3315
- * // {
3316
- * // ...
3317
- * // config: { type: 'within' }
3318
- * // }
3319
- */
3320
- within: () => ({
3321
- ...baseField,
3322
- config: { type: "within" }
3323
- })
3324
- };
3325
- }
3326
-
3327
3337
  // ../commons/src/event-config/event-configuration.ts
3328
3338
  function createEventFieldConfig(fieldId) {
3329
3339
  const baseField = {
@@ -3441,9 +3451,30 @@ var event = Object.assign(eventFn, {
3441
3451
  };
3442
3452
  return { ...basicConditional, ...chainableMethods };
3443
3453
  },
3444
- field(field3) {
3454
+ field(field2) {
3445
3455
  return {
3446
- $event: field3
3456
+ $event: field2
3457
+ };
3458
+ },
3459
+ /**
3460
+ * Creates a function that acts like a callable + static method container.
3461
+ * @param fieldId - The ID of the event metadata field to create a search config for.
3462
+ * @example
3463
+ * event('status') // → returns search config
3464
+ * event.hasAction('CLICKED') // → returns conditional
3465
+ */
3466
+ metadata(fieldId) {
3467
+ return createEventFieldConfig(fieldId);
3468
+ },
3469
+ /**
3470
+ * Entry point for defining conditional logic or configuration for a form field.
3471
+ * @param fieldId - The ID of the field to define rules or config for.
3472
+ * @returns An object combining conditional methods and configuration builders.
3473
+ */
3474
+ declaration(fieldId, options = {}) {
3475
+ return {
3476
+ ...createFieldConditionals(fieldId),
3477
+ ...createFieldConfig(fieldId, options)
3447
3478
  };
3448
3479
  }
3449
3480
  });
@@ -3943,24 +3974,6 @@ var defineConfig = (config) => {
3943
3974
  var import_lodash4 = require("lodash");
3944
3975
  var import_date_fns4 = require("date-fns");
3945
3976
 
3946
- // ../commons/src/field-config/field-configuration.ts
3947
- function createFieldConfig(fieldId, options) {
3948
- const baseField = {
3949
- fieldId,
3950
- fieldType: "field",
3951
- ...options
3952
- };
3953
- return createSearchConfig(baseField);
3954
- }
3955
-
3956
- // ../commons/src/events/field.ts
3957
- function field(fieldId, options = {}) {
3958
- return {
3959
- ...createFieldConditionals(fieldId),
3960
- ...createFieldConfig(fieldId, options)
3961
- };
3962
- }
3963
-
3964
3977
  // ../commons/src/fixtures/forms.ts
3965
3978
  var import_date_fns3 = require("date-fns");
3966
3979
  var PRINT_CERTIFICATE_FORM = defineActionForm({
@@ -4582,7 +4595,7 @@ var PRINT_CERTIFICATE_FORM = defineActionForm({
4582
4595
  id: "collector.identity.verify",
4583
4596
  type: PageTypes.enum.VERIFICATION,
4584
4597
  requireCompletionToContinue: true,
4585
- conditional: field("collector.requesterId").isEqualTo("INFORMANT"),
4598
+ conditional: event.declaration("collector.requesterId").isEqualTo("INFORMANT"),
4586
4599
  title: {
4587
4600
  id: "event.tennis-club-membership.action.print.verifyIdentity",
4588
4601
  defaultMessage: "Verify their identity",
@@ -4654,14 +4667,14 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
4654
4667
  };
4655
4668
  function isInternationalAddress() {
4656
4669
  return and(
4657
- not(field("country").isUndefined()),
4658
- field("addressType").isEqualTo(AddressType.INTERNATIONAL)
4670
+ not(event.declaration("country").isUndefined()),
4671
+ event.declaration("addressType").isEqualTo(AddressType.INTERNATIONAL)
4659
4672
  );
4660
4673
  }
4661
4674
  function isDomesticAddress() {
4662
4675
  return and(
4663
- not(field("country").isUndefined()),
4664
- field("addressType").isEqualTo(AddressType.DOMESTIC)
4676
+ not(event.declaration("country").isUndefined()),
4677
+ event.declaration("addressType").isEqualTo(AddressType.DOMESTIC)
4665
4678
  );
4666
4679
  }
4667
4680
  var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
@@ -4699,9 +4712,9 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
4699
4712
  },
4700
4713
  validation: [
4701
4714
  {
4702
- validator: field("applicant.name").object({
4703
- firstname: field("firstname").isValidEnglishName(),
4704
- surname: field("surname").isValidEnglishName()
4715
+ validator: event.declaration("applicant.name").object({
4716
+ firstname: event.declaration("firstname").isValidEnglishName(),
4717
+ surname: event.declaration("surname").isValidEnglishName()
4705
4718
  }),
4706
4719
  message: {
4707
4720
  defaultMessage: "Input contains invalid characters. Please use only letters (a-z, A-Z), numbers (0-9), hyphens (-), apostrophes(') and underscores (_)",
@@ -4735,13 +4748,13 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
4735
4748
  description: "This is the error message for invalid date",
4736
4749
  id: "event.tennis-club-membership.action.declare.form.section.who.field.dob.error"
4737
4750
  },
4738
- validator: field("applicant.dob").isBefore().now()
4751
+ validator: event.declaration("applicant.dob").isBefore().now()
4739
4752
  }
4740
4753
  ],
4741
4754
  conditionals: [
4742
4755
  {
4743
4756
  type: ConditionalType.SHOW,
4744
- conditional: field("applicant.dobUnknown").isFalsy()
4757
+ conditional: event.declaration("applicant.dobUnknown").isFalsy()
4745
4758
  }
4746
4759
  ],
4747
4760
  label: {
@@ -4779,7 +4792,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
4779
4792
  conditionals: [
4780
4793
  {
4781
4794
  type: ConditionalType.SHOW,
4782
- conditional: field("applicant.dobUnknown").isEqualTo(true)
4795
+ conditional: event.declaration("applicant.dobUnknown").isEqualTo(true)
4783
4796
  }
4784
4797
  ]
4785
4798
  },
@@ -4812,7 +4825,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
4812
4825
  description: "Error message when generic field is invalid",
4813
4826
  id: "error.invalid"
4814
4827
  },
4815
- validator: field("applicant.address").isValidAdministrativeLeafLevel()
4828
+ validator: event.declaration("applicant.address").isValidAdministrativeLeafLevel()
4816
4829
  }
4817
4830
  ],
4818
4831
  configuration: {
@@ -4820,7 +4833,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
4820
4833
  {
4821
4834
  id: "town",
4822
4835
  required: false,
4823
- parent: field("country"),
4836
+ parent: event.declaration("country"),
4824
4837
  label: {
4825
4838
  id: "field.address.town.label",
4826
4839
  defaultMessage: "Town",
@@ -4831,7 +4844,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
4831
4844
  type: ConditionalType.SHOW,
4832
4845
  conditional: and(
4833
4846
  isDomesticAddress(),
4834
- not(field("district").isUndefined())
4847
+ not(event.declaration("district").isUndefined())
4835
4848
  )
4836
4849
  }
4837
4850
  ],
@@ -4840,7 +4853,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
4840
4853
  {
4841
4854
  id: "residentialArea",
4842
4855
  required: false,
4843
- parent: field("country"),
4856
+ parent: event.declaration("country"),
4844
4857
  label: {
4845
4858
  id: "field.address.residentialArea.label",
4846
4859
  defaultMessage: "Residential Area",
@@ -4851,7 +4864,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
4851
4864
  type: ConditionalType.SHOW,
4852
4865
  conditional: and(
4853
4866
  isDomesticAddress(),
4854
- not(field("district").isUndefined())
4867
+ not(event.declaration("district").isUndefined())
4855
4868
  )
4856
4869
  }
4857
4870
  ],
@@ -4860,7 +4873,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
4860
4873
  {
4861
4874
  id: "street",
4862
4875
  required: false,
4863
- parent: field("country"),
4876
+ parent: event.declaration("country"),
4864
4877
  label: {
4865
4878
  id: "field.address.street.label",
4866
4879
  defaultMessage: "Street",
@@ -4871,7 +4884,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
4871
4884
  type: ConditionalType.SHOW,
4872
4885
  conditional: and(
4873
4886
  isDomesticAddress(),
4874
- not(field("district").isUndefined())
4887
+ not(event.declaration("district").isUndefined())
4875
4888
  )
4876
4889
  }
4877
4890
  ],
@@ -4880,7 +4893,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
4880
4893
  {
4881
4894
  id: "number",
4882
4895
  required: false,
4883
- parent: field("country"),
4896
+ parent: event.declaration("country"),
4884
4897
  label: {
4885
4898
  id: "field.address.number.label",
4886
4899
  defaultMessage: "Number",
@@ -4891,7 +4904,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
4891
4904
  type: ConditionalType.SHOW,
4892
4905
  conditional: and(
4893
4906
  isDomesticAddress(),
4894
- not(field("district").isUndefined())
4907
+ not(event.declaration("district").isUndefined())
4895
4908
  )
4896
4909
  }
4897
4910
  ],
@@ -4900,7 +4913,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
4900
4913
  {
4901
4914
  id: "zipCode",
4902
4915
  required: false,
4903
- parent: field("country"),
4916
+ parent: event.declaration("country"),
4904
4917
  label: {
4905
4918
  id: "field.address.postcodeOrZip.label",
4906
4919
  defaultMessage: "Postcode / Zip",
@@ -4911,7 +4924,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
4911
4924
  type: ConditionalType.SHOW,
4912
4925
  conditional: and(
4913
4926
  isDomesticAddress(),
4914
- not(field("district").isUndefined())
4927
+ not(event.declaration("district").isUndefined())
4915
4928
  )
4916
4929
  }
4917
4930
  ],
@@ -4925,7 +4938,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
4925
4938
  conditional: isInternationalAddress()
4926
4939
  }
4927
4940
  ],
4928
- parent: field("country"),
4941
+ parent: event.declaration("country"),
4929
4942
  required: true,
4930
4943
  label: {
4931
4944
  id: "field.address.state.label",
@@ -4936,7 +4949,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
4936
4949
  },
4937
4950
  {
4938
4951
  id: "district2",
4939
- parent: field("country"),
4952
+ parent: event.declaration("country"),
4940
4953
  conditionals: [
4941
4954
  {
4942
4955
  type: ConditionalType.SHOW,
@@ -4953,7 +4966,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
4953
4966
  },
4954
4967
  {
4955
4968
  id: "cityOrTown",
4956
- parent: field("country"),
4969
+ parent: event.declaration("country"),
4957
4970
  conditionals: [
4958
4971
  {
4959
4972
  type: ConditionalType.SHOW,
@@ -4970,7 +4983,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
4970
4983
  },
4971
4984
  {
4972
4985
  id: "addressLine1",
4973
- parent: field("country"),
4986
+ parent: event.declaration("country"),
4974
4987
  conditionals: [
4975
4988
  {
4976
4989
  type: ConditionalType.SHOW,
@@ -4987,7 +5000,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
4987
5000
  },
4988
5001
  {
4989
5002
  id: "addressLine2",
4990
- parent: field("country"),
5003
+ parent: event.declaration("country"),
4991
5004
  conditionals: [
4992
5005
  {
4993
5006
  type: ConditionalType.SHOW,
@@ -5004,7 +5017,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
5004
5017
  },
5005
5018
  {
5006
5019
  id: "addressLine3",
5007
- parent: field("country"),
5020
+ parent: event.declaration("country"),
5008
5021
  conditionals: [
5009
5022
  {
5010
5023
  type: ConditionalType.SHOW,
@@ -5021,7 +5034,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
5021
5034
  },
5022
5035
  {
5023
5036
  id: "postcodeOrZip",
5024
- parent: field("country"),
5037
+ parent: event.declaration("country"),
5025
5038
  conditionals: [
5026
5039
  {
5027
5040
  type: ConditionalType.SHOW,
@@ -5060,7 +5073,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
5060
5073
  },
5061
5074
  {
5062
5075
  id: "senior-pass",
5063
- conditional: field("applicant.dob").isBefore().date("1950-01-01"),
5076
+ conditional: event.declaration("applicant.dob").isBefore().date("1950-01-01"),
5064
5077
  title: {
5065
5078
  id: "event.tennis-club-membership.action.declare.form.section.senior-pass.title",
5066
5079
  defaultMessage: "Assign senior pass for applicant",
@@ -5081,7 +5094,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
5081
5094
  id: "senior-pass.recommender",
5082
5095
  type: "CHECKBOX",
5083
5096
  required: true,
5084
- parent: field("recommender.none"),
5097
+ parent: event.declaration("recommender.none"),
5085
5098
  defaultValue: false,
5086
5099
  conditionals: [],
5087
5100
  label: {
@@ -5119,7 +5132,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
5119
5132
  conditionals: [
5120
5133
  {
5121
5134
  type: ConditionalType.SHOW,
5122
- conditional: field("recommender.none").isFalsy()
5135
+ conditional: event.declaration("recommender.none").isFalsy()
5123
5136
  }
5124
5137
  ],
5125
5138
  label: {
@@ -5135,7 +5148,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
5135
5148
  conditionals: [
5136
5149
  {
5137
5150
  type: ConditionalType.SHOW,
5138
- conditional: field("recommender.none").isFalsy()
5151
+ conditional: event.declaration("recommender.none").isFalsy()
5139
5152
  }
5140
5153
  ],
5141
5154
  label: {
@@ -5568,10 +5581,10 @@ var tennisClubMembershipEvent = defineConfig({
5568
5581
  id: "advancedSearch.form.registrationDetails"
5569
5582
  },
5570
5583
  fields: [
5571
- event("legalStatuses.REGISTERED.createdAtLocation").exact(),
5572
- event("legalStatuses.REGISTERED.acceptedAt").range(),
5573
- event("status").exact(),
5574
- event("updatedAt").range()
5584
+ event.metadata("legalStatuses.REGISTERED.createdAtLocation").exact(),
5585
+ event.metadata("legalStatuses.REGISTERED.acceptedAt").range(),
5586
+ event.metadata("status").exact(),
5587
+ event.metadata("updatedAt").range()
5575
5588
  ]
5576
5589
  },
5577
5590
  {
@@ -5581,9 +5594,9 @@ var tennisClubMembershipEvent = defineConfig({
5581
5594
  id: "event.tennis-club-membership.search.applicants"
5582
5595
  },
5583
5596
  fields: [
5584
- field("applicant.name").fuzzy(),
5585
- field("applicant.dob").range(),
5586
- field("applicant.email").exact()
5597
+ event.declaration("applicant.name").fuzzy(),
5598
+ event.declaration("applicant.dob").range(),
5599
+ event.declaration("applicant.email").exact()
5587
5600
  ]
5588
5601
  },
5589
5602
  {
@@ -5592,7 +5605,7 @@ var tennisClubMembershipEvent = defineConfig({
5592
5605
  description: "Recommender details search field section title",
5593
5606
  id: "event.tennis-club-membership.search.recommender"
5594
5607
  },
5595
- fields: [field("recommender.name").fuzzy()]
5608
+ fields: [event.declaration("recommender.name").fuzzy()]
5596
5609
  }
5597
5610
  ],
5598
5611
  declaration: TENNIS_CLUB_DECLARATION_FORM
@@ -5927,10 +5940,10 @@ var footballClubMembershipEvent = defineConfig({
5927
5940
  id: "advancedSearch.form.registrationDetails"
5928
5941
  },
5929
5942
  fields: [
5930
- event("legalStatuses.REGISTERED.createdAtLocation").exact(),
5931
- event("legalStatuses.REGISTERED.acceptedAt").range(),
5932
- event("status").exact(),
5933
- event("updatedAt").range()
5943
+ event.metadata("legalStatuses.REGISTERED.createdAtLocation").exact(),
5944
+ event.metadata("legalStatuses.REGISTERED.acceptedAt").range(),
5945
+ event.metadata("status").exact(),
5946
+ event.metadata("updatedAt").range()
5934
5947
  ]
5935
5948
  },
5936
5949
  {
@@ -5940,9 +5953,9 @@ var footballClubMembershipEvent = defineConfig({
5940
5953
  id: "event.football-club-membership.search.applicants"
5941
5954
  },
5942
5955
  fields: [
5943
- field("applicant.name").fuzzy(),
5944
- field("applicant.dob").range(),
5945
- field("applicant.email").exact()
5956
+ event.declaration("applicant.name").fuzzy(),
5957
+ event.declaration("applicant.dob").range(),
5958
+ event.declaration("applicant.email").exact()
5946
5959
  ]
5947
5960
  },
5948
5961
  {
@@ -5951,7 +5964,7 @@ var footballClubMembershipEvent = defineConfig({
5951
5964
  description: "Recommender details search field section title",
5952
5965
  id: "event.football-club-membership.search.recommender"
5953
5966
  },
5954
- fields: [field("recommender.name").fuzzy()]
5967
+ fields: [event.declaration("recommender.name").fuzzy()]
5955
5968
  }
5956
5969
  ],
5957
5970
  declaration: TENNIS_CLUB_DECLARATION_FORM
@@ -6073,7 +6086,9 @@ var mother = defineFormPage({
6073
6086
  conditionals: [
6074
6087
  {
6075
6088
  type: "SHOW",
6076
- conditional: not(field("mother.dobUnknown").isEqualTo(true))
6089
+ conditional: not(
6090
+ event.declaration("mother.dobUnknown").isEqualTo(true)
6091
+ )
6077
6092
  }
6078
6093
  ]
6079
6094
  },
@@ -6090,12 +6105,12 @@ var mother = defineFormPage({
6090
6105
  analytics: true,
6091
6106
  label: generateTranslationConfig("Age of mother"),
6092
6107
  configuration: {
6093
- asOfDate: field("child.dob")
6108
+ asOfDate: event.declaration("child.dob")
6094
6109
  },
6095
6110
  conditionals: [
6096
6111
  {
6097
6112
  type: "SHOW",
6098
- conditional: field("mother.dobUnknown").isEqualTo(true)
6113
+ conditional: event.declaration("mother.dobUnknown").isEqualTo(true)
6099
6114
  }
6100
6115
  ]
6101
6116
  },
@@ -6233,7 +6248,7 @@ var PRINT_DIGITAL_ID_CERTIFICATE_FORM = defineActionForm({
6233
6248
  id: "event.digital-identity.certificate.fetch.label"
6234
6249
  },
6235
6250
  configuration: {
6236
- trigger: field("identity.http-button"),
6251
+ trigger: event.declaration("identity.http-button"),
6237
6252
  url: "/api/digital-identity/certificate",
6238
6253
  timeout: 5e3,
6239
6254
  method: "POST",
@@ -6257,15 +6272,15 @@ var PRINT_DIGITAL_ID_CERTIFICATE_FORM = defineActionForm({
6257
6272
  {
6258
6273
  type: ConditionalType.ENABLE,
6259
6274
  conditional: and(
6260
- field("identity.http-fetch").isUndefined(),
6275
+ event.declaration("identity.http-fetch").isUndefined(),
6261
6276
  user.isOnline()
6262
6277
  )
6263
6278
  },
6264
6279
  {
6265
6280
  type: ConditionalType.SHOW,
6266
6281
  conditional: and(
6267
- field("identity.http-fetch").get("loading").isFalsy(),
6268
- field("identity.http-fetch").get("data").isFalsy()
6282
+ event.declaration("identity.http-fetch").get("loading").isFalsy(),
6283
+ event.declaration("identity.http-fetch").get("data").isFalsy()
6269
6284
  )
6270
6285
  }
6271
6286
  ],
@@ -6293,7 +6308,7 @@ var PRINT_DIGITAL_ID_CERTIFICATE_FORM = defineActionForm({
6293
6308
  },
6294
6309
  {
6295
6310
  type: ConditionalType.SHOW,
6296
- conditional: field("identity.http-fetch").get("loading").isEqualTo(true)
6311
+ conditional: event.declaration("identity.http-fetch").get("loading").isEqualTo(true)
6297
6312
  }
6298
6313
  ],
6299
6314
  configuration: {
@@ -6320,7 +6335,9 @@ var PRINT_DIGITAL_ID_CERTIFICATE_FORM = defineActionForm({
6320
6335
  },
6321
6336
  {
6322
6337
  type: ConditionalType.SHOW,
6323
- conditional: not(field("identity.certificateId").isFalsy())
6338
+ conditional: not(
6339
+ event.declaration("identity.certificateId").isFalsy()
6340
+ )
6324
6341
  }
6325
6342
  ],
6326
6343
  configuration: {
@@ -6335,7 +6352,7 @@ var PRINT_DIGITAL_ID_CERTIFICATE_FORM = defineActionForm({
6335
6352
  {
6336
6353
  id: "identity.certificateId",
6337
6354
  type: FieldType.TEXT,
6338
- parent: field("identity.http-fetch"),
6355
+ parent: event.declaration("identity.http-fetch"),
6339
6356
  label: {
6340
6357
  defaultMessage: "Certificate ID",
6341
6358
  description: "Issued digital identity certificate identifier",
@@ -6347,7 +6364,7 @@ var PRINT_DIGITAL_ID_CERTIFICATE_FORM = defineActionForm({
6347
6364
  conditional: never()
6348
6365
  }
6349
6366
  ],
6350
- value: field("identity.http-fetch").get("data.certificateId")
6367
+ value: event.declaration("identity.http-fetch").get("data.certificateId")
6351
6368
  }
6352
6369
  ]
6353
6370
  }