@encatch/schema 0.1.14 → 0.1.16

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.
package/dist/esm/index.js CHANGED
@@ -14,14 +14,14 @@ var questionTypeSchema = z.enum([
14
14
  "annotation"
15
15
  ]).describe("Enumeration of all supported question types for form fields");
16
16
  var QuestionTypes = {
17
- RATING: questionTypeSchema.options[0],
18
- SINGLE_CHOICE: questionTypeSchema.options[1],
19
- NPS: questionTypeSchema.options[2],
20
- NESTED_SELECTION: questionTypeSchema.options[3],
21
- MULTIPLE_CHOICE_MULTIPLE: questionTypeSchema.options[4],
22
- SHORT_ANSWER: questionTypeSchema.options[5],
23
- LONG_TEXT: questionTypeSchema.options[6],
24
- ANNOTATION: questionTypeSchema.options[7]
17
+ RATING: "rating",
18
+ SINGLE_CHOICE: "single_choice",
19
+ NPS: "nps",
20
+ NESTED_SELECTION: "nested_selection",
21
+ MULTIPLE_CHOICE_MULTIPLE: "multiple_choice_multiple",
22
+ SHORT_ANSWER: "short_answer",
23
+ LONG_TEXT: "long_text",
24
+ ANNOTATION: "annotation"
25
25
  };
26
26
  var validationRuleTypeSchema = z.enum([
27
27
  "required",
@@ -35,15 +35,15 @@ var validationRuleTypeSchema = z.enum([
35
35
  "custom"
36
36
  ]).describe("Enumeration of all supported validation rule types");
37
37
  var ValidationRuleTypes = {
38
- REQUIRED: validationRuleTypeSchema.options[0],
39
- MIN: validationRuleTypeSchema.options[1],
40
- MAX: validationRuleTypeSchema.options[2],
41
- MIN_LENGTH: validationRuleTypeSchema.options[3],
42
- MAX_LENGTH: validationRuleTypeSchema.options[4],
43
- PATTERN: validationRuleTypeSchema.options[5],
44
- EMAIL: validationRuleTypeSchema.options[6],
45
- URL: validationRuleTypeSchema.options[7],
46
- CUSTOM: validationRuleTypeSchema.options[8]
38
+ REQUIRED: "required",
39
+ MIN: "min",
40
+ MAX: "max",
41
+ MIN_LENGTH: "minLength",
42
+ MAX_LENGTH: "maxLength",
43
+ PATTERN: "pattern",
44
+ EMAIL: "email",
45
+ URL: "url",
46
+ CUSTOM: "custom"
47
47
  };
48
48
  var validationRuleSchema = z.object({
49
49
  type: validationRuleTypeSchema.describe("Type of validation rule to apply"),
@@ -62,14 +62,14 @@ var visibilityConditionOperatorSchema = z.enum([
62
62
  "is_not_empty"
63
63
  ]).describe("Enumeration of all supported visibility condition operators");
64
64
  var VisibilityConditionOperators = {
65
- EQUALS: visibilityConditionOperatorSchema.options[0],
66
- NOT_EQUALS: visibilityConditionOperatorSchema.options[1],
67
- CONTAINS: visibilityConditionOperatorSchema.options[2],
68
- NOT_CONTAINS: visibilityConditionOperatorSchema.options[3],
69
- GREATER_THAN: visibilityConditionOperatorSchema.options[4],
70
- LESS_THAN: visibilityConditionOperatorSchema.options[5],
71
- IS_EMPTY: visibilityConditionOperatorSchema.options[6],
72
- IS_NOT_EMPTY: visibilityConditionOperatorSchema.options[7]
65
+ EQUALS: "equals",
66
+ NOT_EQUALS: "not_equals",
67
+ CONTAINS: "contains",
68
+ NOT_CONTAINS: "not_contains",
69
+ GREATER_THAN: "greater_than",
70
+ LESS_THAN: "less_than",
71
+ IS_EMPTY: "is_empty",
72
+ IS_NOT_EMPTY: "is_not_empty"
73
73
  };
74
74
  var visibilityConditionSchema = z.object({
75
75
  field: z.string().describe("ID of the field to check against"),
@@ -86,10 +86,10 @@ var sectionSchema = z.object({
86
86
  }).describe("Schema defining sections that organize questions into logical groups");
87
87
  var questionStatusSchema = z.enum(["D", "P", "A", "S"]);
88
88
  var QuestionStatuses = {
89
- DRAFT: questionStatusSchema.options[0],
90
- PUBLISHED: questionStatusSchema.options[1],
91
- ARCHIVED: questionStatusSchema.options[2],
92
- SUSPENDED: questionStatusSchema.options[3]
89
+ DRAFT: "D",
90
+ PUBLISHED: "P",
91
+ ARCHIVED: "A",
92
+ SUSPENDED: "S"
93
93
  };
94
94
  var ratingDisplayStyleSchema = z.enum([
95
95
  "star",
@@ -100,12 +100,12 @@ var ratingDisplayStyleSchema = z.enum([
100
100
  "emoji-exp"
101
101
  ]);
102
102
  var RatingDisplayStyles = {
103
- STAR: ratingDisplayStyleSchema.options[0],
104
- HEART: ratingDisplayStyleSchema.options[1],
105
- THUMBS_UP: ratingDisplayStyleSchema.options[2],
106
- DIAMOND: ratingDisplayStyleSchema.options[3],
107
- EMOJI: ratingDisplayStyleSchema.options[4],
108
- EMOJI_EXP: ratingDisplayStyleSchema.options[5]
103
+ STAR: "star",
104
+ HEART: "heart",
105
+ THUMBS_UP: "thumbs_up",
106
+ DIAMOND: "diamond",
107
+ EMOJI: "emoji",
108
+ EMOJI_EXP: "emoji_exp"
109
109
  };
110
110
  var ratingRepresentationSizeSchema = z.enum([
111
111
  "small",
@@ -113,9 +113,9 @@ var ratingRepresentationSizeSchema = z.enum([
113
113
  "large"
114
114
  ]);
115
115
  var RatingRepresentationSizes = {
116
- SMALL: ratingRepresentationSizeSchema.options[0],
117
- MEDIUM: ratingRepresentationSizeSchema.options[1],
118
- LARGE: ratingRepresentationSizeSchema.options[2]
116
+ SMALL: "small",
117
+ MEDIUM: "medium",
118
+ LARGE: "large"
119
119
  };
120
120
  var multipleChoiceDisplayStyleSchema = z.enum([
121
121
  "radio",
@@ -124,10 +124,10 @@ var multipleChoiceDisplayStyleSchema = z.enum([
124
124
  "dropdown"
125
125
  ]);
126
126
  var MultipleChoiceDisplayStyles = {
127
- RADIO: multipleChoiceDisplayStyleSchema.options[0],
128
- LIST: multipleChoiceDisplayStyleSchema.options[1],
129
- CHIP: multipleChoiceDisplayStyleSchema.options[2],
130
- DROPDOWN: multipleChoiceDisplayStyleSchema.options[3]
127
+ RADIO: "radio",
128
+ LIST: "list",
129
+ CHIP: "chip",
130
+ DROPDOWN: "dropdown"
131
131
  };
132
132
  var multipleChoiceMultipleDisplayStyleSchema = z.enum([
133
133
  "checkbox",
@@ -135,9 +135,9 @@ var multipleChoiceMultipleDisplayStyleSchema = z.enum([
135
135
  "chip"
136
136
  ]);
137
137
  var MultipleChoiceMultipleDisplayStyles = {
138
- CHECKBOX: multipleChoiceMultipleDisplayStyleSchema.options[0],
139
- LIST: multipleChoiceMultipleDisplayStyleSchema.options[1],
140
- CHIP: multipleChoiceMultipleDisplayStyleSchema.options[2]
138
+ CHECKBOX: "checkbox",
139
+ LIST: "list",
140
+ CHIP: "chip"
141
141
  };
142
142
  var choiceOrderOptionSchema = z.enum([
143
143
  "randomize",
@@ -147,11 +147,11 @@ var choiceOrderOptionSchema = z.enum([
147
147
  "none"
148
148
  ]);
149
149
  var ChoiceOrderOptions = {
150
- RANDOMIZE: choiceOrderOptionSchema.options[0],
151
- FLIP: choiceOrderOptionSchema.options[1],
152
- ROTATE: choiceOrderOptionSchema.options[2],
153
- ASCENDING: choiceOrderOptionSchema.options[3],
154
- NONE: choiceOrderOptionSchema.options[4]
150
+ RANDOMIZE: "randomize",
151
+ FLIP: "flip",
152
+ ROTATE: "rotate",
153
+ ASCENDING: "ascending",
154
+ NONE: "none"
155
155
  };
156
156
  var questionSchema = z.object({
157
157
  id: z.string().describe("Unique identifier for the question"),
@@ -475,22 +475,22 @@ var AnswerSchema = z2.discriminatedUnion("type", [
475
475
  import { z as z3 } from "zod";
476
476
  var surveyTypeSchema = z3.enum(["R", "O"]).describe("Enumeration of feedback types: R=Recurring, O=One-time");
477
477
  var SurveyTypes = {
478
- RECURRING: surveyTypeSchema.options[0],
479
- ONE_TIME: surveyTypeSchema.options[1]
478
+ RECURRING: "R",
479
+ ONE_TIME: "O"
480
480
  };
481
481
  var yesNoSchema = z3.enum(["Y", "N"]).describe("Yes/No enumeration using Y/N values");
482
482
  var YesNoValues = {
483
- YES: yesNoSchema.options[0],
484
- NO: yesNoSchema.options[1]
483
+ YES: "Y",
484
+ NO: "N"
485
485
  };
486
486
  var recurringUnitSchema = z3.enum(["minutes", "hours", "days", "weeks", "months", "years"]).describe("Time units for recurring feedback schedules");
487
487
  var RecurringUnits = {
488
- MINUTES: recurringUnitSchema.options[0],
489
- HOURS: recurringUnitSchema.options[1],
490
- DAYS: recurringUnitSchema.options[2],
491
- WEEKS: recurringUnitSchema.options[3],
492
- MONTHS: recurringUnitSchema.options[4],
493
- YEARS: recurringUnitSchema.options[5]
488
+ MINUTES: "minutes",
489
+ HOURS: "hours",
490
+ DAYS: "days",
491
+ WEEKS: "weeks",
492
+ MONTHS: "months",
493
+ YEARS: "years"
494
494
  };
495
495
  var frequencyAndSchedulingPropertiesSchema = z3.object({
496
496
  surveyType: surveyTypeSchema.describe("Type of feedback: R for recurring, O for one-time"),
@@ -546,9 +546,9 @@ var externalPublishingPropertiesSchema = z3.object({
546
546
  }).describe("Schema defining external publishing and sharing properties for feedback");
547
547
  var publicationStatusSchema = z3.enum(["P", "D", "A"]).describe("Publication status: P=Published, D=Draft, A=Archived");
548
548
  var PublicationStatuses = {
549
- PUBLISHED: publicationStatusSchema.options[0],
550
- DRAFT: publicationStatusSchema.options[1],
551
- ARCHIVED: publicationStatusSchema.options[2]
549
+ PUBLISHED: "P",
550
+ DRAFT: "D",
551
+ ARCHIVED: "A"
552
552
  };
553
553
  var feedbackConfigurationSchema = z3.object({
554
554
  form_title: z3.string().describe("Title of the feedback form"),
@@ -737,8 +737,8 @@ __name(createTranslationProvider, "createTranslationProvider");
737
737
  import { z as z5 } from "zod";
738
738
  var dismissBehaviorSchema = z5.enum(["fade", "manual"]).describe("How the end screen should be dismissed (fade out or manual dismissal)");
739
739
  var DismissBehaviors = {
740
- FADE: dismissBehaviorSchema.options[0],
741
- MANUAL: dismissBehaviorSchema.options[1]
740
+ FADE: "fade",
741
+ MANUAL: "manual"
742
742
  };
743
743
  var WelcomeScreenFieldsSchema = z5.object({
744
744
  title: z5.string().min(1).max(200).describe("The main title displayed on the welcome screen"),
@@ -797,20 +797,20 @@ var positionSchema = z6.enum([
797
797
  "bottom-right"
798
798
  ]).describe("Available positions for widget placement");
799
799
  var Positions = {
800
- TOP_LEFT: positionSchema.options[0],
801
- TOP_CENTER: positionSchema.options[1],
802
- TOP_RIGHT: positionSchema.options[2],
803
- MIDDLE_LEFT: positionSchema.options[3],
804
- MIDDLE_CENTER: positionSchema.options[4],
805
- MIDDLE_RIGHT: positionSchema.options[5],
806
- BOTTOM_LEFT: positionSchema.options[6],
807
- BOTTOM_CENTER: positionSchema.options[7],
808
- BOTTOM_RIGHT: positionSchema.options[8]
800
+ TOP_LEFT: "top-left",
801
+ TOP_CENTER: "top-center",
802
+ TOP_RIGHT: "top-right",
803
+ MIDDLE_LEFT: "middle-left",
804
+ MIDDLE_CENTER: "middle-center",
805
+ MIDDLE_RIGHT: "middle-right",
806
+ BOTTOM_LEFT: "bottom-left",
807
+ BOTTOM_CENTER: "bottom-center",
808
+ BOTTOM_RIGHT: "bottom-right"
809
809
  };
810
810
  var themeModeSchema = z6.enum(["light", "dark"]).describe("Available theme modes for the widget");
811
811
  var ThemeModes = {
812
- LIGHT: themeModeSchema.options[0],
813
- DARK: themeModeSchema.options[1]
812
+ LIGHT: "light",
813
+ DARK: "dark"
814
814
  };
815
815
  var featureSettingsSchema = z6.object({
816
816
  darkOverlay: z6.boolean().describe("Whether to show a dark overlay behind the widget"),
@@ -843,6 +843,19 @@ var themeConfigurationSchema = z6.object({
843
843
 
844
844
  // src/schemas/fields/auto-trigger-schema.ts
845
845
  import { z as z7 } from "zod";
846
+ var customEventFieldOperatorSchema = z7.object({
847
+ name: z7.string().describe("The operator name (e.g., '=', '!=', 'contains', 'beginsWith', 'matches')"),
848
+ label: z7.string().describe("Human-readable label for the operator (e.g., 'equals', 'not equals', 'contains')")
849
+ }).describe("Schema defining an operator for custom event fields");
850
+ var customEventFieldSchema = z7.object({
851
+ name: z7.string().describe("The field name (e.g., 'event_name', 'add_to_cart', 'cart_item_number')"),
852
+ label: z7.string().describe("Human-readable label for the field"),
853
+ placeholder: z7.string().describe("Placeholder text for input fields"),
854
+ operators: z7.array(customEventFieldOperatorSchema).min(1).describe("Array of available operators for this field")
855
+ }).describe("Schema defining a custom event field with its operators");
856
+ var conditionalIfMetadataSchema = z7.object({
857
+ customEventFields: z7.array(customEventFieldSchema).optional().describe("Array of custom event fields with their operators and labels")
858
+ }).describe("Schema defining metadata for conditional if clauses");
846
859
  var queryOutputSchema = z7.object({
847
860
  query: z7.string().describe("The structured query definition as a JSON string"),
848
861
  naturalLanguage: z7.string().describe("Human-readable description of the query conditions"),
@@ -852,7 +865,8 @@ var queryOutputSchema = z7.object({
852
865
  var conditionalIfSchema = z7.object({
853
866
  id: z7.string().describe("Unique identifier for this condition"),
854
867
  event: z7.string().describe("The event that triggers evaluation of this condition (e.g., 'pageLoad', 'pageView', 'scroll', 'custom')"),
855
- queryOutput: queryOutputSchema.describe("The query conditions to evaluate when the event occurs")
868
+ queryOutput: queryOutputSchema.describe("The query conditions to evaluate when the event occurs"),
869
+ metadata: conditionalIfMetadataSchema.optional().describe("Optional metadata containing custom event fields and their configurations")
856
870
  }).describe("Schema defining the 'if' condition for auto-trigger logic");
857
871
  var triggerActionSchema = z7.object({
858
872
  triggerType: z7.string().describe("The type of action to perform (e.g., 'delay', 'scroll', 'immediately')"),
@@ -1019,9 +1033,12 @@ export {
1019
1033
  categorySpecificFiltersSchema,
1020
1034
  choiceOrderOptionSchema,
1021
1035
  combinedQuestionSchema,
1036
+ conditionalIfMetadataSchema,
1022
1037
  conditionalIfSchema,
1023
1038
  conditionalWhenSchema,
1024
1039
  createTranslationProvider,
1040
+ customEventFieldOperatorSchema,
1041
+ customEventFieldSchema,
1025
1042
  dismissBehaviorSchema,
1026
1043
  endScreenPropertiesSchema,
1027
1044
  externalPublishingPropertiesSchema,