@encatch/schema 0.1.16 → 0.1.18

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
@@ -325,7 +325,8 @@ var longAnswerQuestionSchema = questionSchema.extend({
325
325
  maxEnhancements: z.number().int().min(1).max(10).optional().describe("Maximum number of AI enhancements allowed"),
326
326
  maxTokenAllowed: z.number().int().min(1).max(25e3).optional().describe(
327
327
  "Maximum tokens allowed for AI processing (higher for long text)"
328
- )
328
+ ),
329
+ minCharactersToEnhance: z.number().int().min(1).optional().describe("Minimum characters needed to trigger AI enhancement")
329
330
  }).refine(
330
331
  (data) => {
331
332
  if (data.minCharacters !== void 0 && data.maxCharacters !== void 0) {
@@ -550,31 +551,35 @@ var PublicationStatuses = {
550
551
  DRAFT: "D",
551
552
  ARCHIVED: "A"
552
553
  };
554
+ var durationSchema = z3.object({
555
+ from: z3.string().describe("Start date and time for the duration (ISO format or custom format)"),
556
+ to: z3.string().describe("End date and time for the duration (ISO format or custom format)")
557
+ }).describe("Duration range for when something is active");
553
558
  var feedbackConfigurationSchema = z3.object({
554
559
  form_title: z3.string().describe("Title of the feedback form"),
555
560
  form_description: z3.string().describe("Description of the feedback form"),
556
- duration: z3.object({
557
- from: z3.string().regex(
558
- /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(\+|\-)\d{2}:\d{2}$/,
559
- "Must be a valid ISO date string with timezone"
560
- ).describe("Start date and time for the feedback duration"),
561
- to: z3.string().regex(
562
- /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(\+|\-)\d{2}:\d{2}$/,
563
- "Must be a valid ISO date string with timezone"
564
- ).describe("End date and time for the feedback duration")
565
- }).describe("Duration period for the feedback"),
561
+ duration: durationSchema.refine(
562
+ (data) => {
563
+ const isoRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(\+|\-)\d{2}:\d{2}$/;
564
+ return isoRegex.test(data.from) && isoRegex.test(data.to);
565
+ },
566
+ {
567
+ message: "Duration dates must be in valid ISO format with timezone",
568
+ path: ["from"]
569
+ }
570
+ ).refine(
571
+ (data) => {
572
+ const start = new Date(data.from);
573
+ const end = new Date(data.to);
574
+ return end > start;
575
+ },
576
+ {
577
+ message: "End date must be after start date",
578
+ path: ["to"]
579
+ }
580
+ ).describe("Duration period for the feedback"),
566
581
  is_published: publicationStatusSchema.describe("Publication status of the feedback form")
567
- }).refine(
568
- (data) => {
569
- const start = new Date(data.duration.from);
570
- const end = new Date(data.duration.to);
571
- return end > start;
572
- },
573
- {
574
- message: "End date must be after start date",
575
- path: ["duration", "to"]
576
- }
577
- ).describe("Schema defining feedback configuration properties");
582
+ }).describe("Schema defining feedback configuration properties");
578
583
 
579
584
  // src/schemas/fields/form-properties-schema.ts
580
585
  import { z as z8 } from "zod";
@@ -989,13 +994,176 @@ var masterPropertiesSchema = z9.object({
989
994
  feedback_interval_duration: z9.number().int().positive().describe("Duration in seconds for feedback interval between two auto triggered feedbacks")
990
995
  }).describe("Master properties configuration for global survey settings");
991
996
 
992
- // src/index.ts
997
+ // src/schemas/api/other-schema.ts
993
998
  import { z as z10 } from "zod";
999
+ var deviceThemeSchema = z10.enum(["light", "dark", "system"]).describe("Enumeration of supported theme modes");
1000
+ var DeviceThemes = {
1001
+ LIGHT: "light",
1002
+ DARK: "dark",
1003
+ SYSTEM: "system"
1004
+ };
1005
+ var deviceInfoSchema = z10.object({
1006
+ deviceType: z10.string().describe("Type of device being used"),
1007
+ timezone: z10.string().describe("Device timezone (e.g., 'Asia/Calcutta')"),
1008
+ theme: deviceThemeSchema.describe("Current theme mode preference"),
1009
+ os: z10.string().describe("Operating system running on the device"),
1010
+ osVersion: z10.string().describe("Version of the operating system"),
1011
+ appVersion: z10.string().describe("Version of the application"),
1012
+ app: z10.string().describe("Browser or application being used"),
1013
+ language: z10.string().describe("Language preference (e.g., 'en-GB')")
1014
+ }).describe("Device information collected from the client");
1015
+ var sessionInfoSchema = z10.object({
1016
+ sessionId: z10.string().uuid().describe("Unique session identifier")
1017
+ }).describe("Session information for tracking user sessions");
1018
+ var deviceSessionInfoSchema = z10.object({
1019
+ deviceInfo: deviceInfoSchema.describe("Device information"),
1020
+ sessionInfo: sessionInfoSchema.describe("Session information")
1021
+ }).describe("Combined device and session information");
1022
+ var userPropertiesSchema = z10.object({
1023
+ $counter: z10.record(z10.string(), z10.number().int()).describe("Counter properties for user tracking (can be positive or negative)").optional(),
1024
+ $set: z10.record(z10.string(), z10.any()).describe("Properties to set for the user").optional(),
1025
+ $setOnce: z10.record(z10.string(), z10.any()).describe("Properties to set once for the user (won't overwrite existing values)").optional(),
1026
+ $unset: z10.array(z10.string()).describe("Array of property names to unset/remove from the user").optional()
1027
+ }).passthrough().describe("User properties including counters, set operations, and other dynamic data");
1028
+ var userInfoSchema = z10.object({
1029
+ userName: z10.string().email().describe("User's email address as username"),
1030
+ properties: userPropertiesSchema.describe("User properties and counters")
1031
+ }).describe("User information including identification and properties");
1032
+
1033
+ // src/schemas/api/submit-feedback-schema.ts
1034
+ import { z as z11 } from "zod";
1035
+ var userActionSchema = z11.enum(["V", "S"]).describe("User action: V for view, S for submit");
1036
+ var UserActions = {
1037
+ VIEW: "V",
1038
+ SUBMIT: "S"
1039
+ };
1040
+ var formConfigSchema = z11.object({
1041
+ feedbackIdentifier: z11.string().uuid().describe("Unique identifier for the feedback instance"),
1042
+ feedbackConfigurationId: z11.string().uuid().describe("Unique identifier for the feedback configuration"),
1043
+ completionTimeInSeconds: z11.number().int().min(0).describe("Time taken to complete the feedback in seconds"),
1044
+ userAction: userActionSchema.describe("Action performed by the user"),
1045
+ responseLanguageCode: z11.string().length(2).describe("Language code for the response (e.g., 'en', 'es')")
1046
+ }).describe("Configuration information for the feedback form");
1047
+ var questionResponseSchema = z11.object({
1048
+ questionId: z11.string().uuid().describe("Unique identifier for the question"),
1049
+ answer: AnswerSchema.describe("The answer provided for this question"),
1050
+ type: z11.string().describe("Type of the question (e.g., 'rating', 'single_choice')")
1051
+ }).describe("Response to a specific question in the feedback form");
1052
+ var responseSchema = z11.object({
1053
+ questions: z11.array(questionResponseSchema).min(1).describe("Array of question responses")
1054
+ }).describe("User responses to feedback questions");
1055
+ var matchedTriggerPropertiesSchema = z11.object({
1056
+ customEventName: z11.string().nullable().describe("Custom event name that triggered the feedback"),
1057
+ currentPath: z11.string().describe("Current page path where feedback was triggered"),
1058
+ eventType: z11.string().describe("Type of event that triggered the feedback")
1059
+ }).passthrough().describe("Properties of the trigger that matched for this feedback");
1060
+ var baseSubmitFeedbackSchema = z11.object({
1061
+ formConfig: formConfigSchema.describe("Form configuration information"),
1062
+ deviceInfo: deviceInfoSchema.describe("Device information"),
1063
+ sessionInfo: sessionInfoSchema.describe("Session information"),
1064
+ userInfo: userInfoSchema.optional().describe("User information (optional)"),
1065
+ matchedTriggerProperties: matchedTriggerPropertiesSchema.describe(
1066
+ "Properties of the matched trigger"
1067
+ )
1068
+ }).describe("Base submit feedback request schema");
1069
+ var viewFeedbackSchema = baseSubmitFeedbackSchema.extend({
1070
+ formConfig: formConfigSchema.extend({
1071
+ userAction: z11.literal("V").describe("Action performed by the user (view)")
1072
+ })
1073
+ }).strict().describe("View feedback request schema (no response required)");
1074
+ var submitFeedbackSchema = baseSubmitFeedbackSchema.extend({
1075
+ formConfig: formConfigSchema.extend({
1076
+ userAction: z11.literal("S").describe("Action performed by the user (submit)")
1077
+ }),
1078
+ response: responseSchema.describe("User responses (required for submit)")
1079
+ }).strict().describe("Submit feedback request schema (response required)");
1080
+ var feedbackRequestSchema = z11.union([
1081
+ viewFeedbackSchema,
1082
+ submitFeedbackSchema
1083
+ ]).describe("Union schema for both view and submit feedback requests");
1084
+
1085
+ // src/schemas/api/fetch-feedback-schema.ts
1086
+ import { z as z12 } from "zod";
1087
+ var feedbackConfigurationItemSchema = z12.object({
1088
+ feedbackConfigurationId: z12.string().uuid().describe("Unique identifier for the feedback configuration"),
1089
+ feedbackTitle: z12.string().describe("Title of the feedback configuration"),
1090
+ duration: durationSchema.describe("Active duration for this feedback configuration"),
1091
+ triggerProperties: audienceTriggerPropertiesSchema.describe("Trigger properties including auto/manual settings and audience segments"),
1092
+ appearanceProperties: z12.object({
1093
+ themes: z12.object({
1094
+ light: z12.object({
1095
+ brandColor: z12.string().describe("Brand color for light theme"),
1096
+ overlayColor: z12.string().describe("Overlay color for light theme"),
1097
+ textColor: z12.string().describe("Text color for light theme"),
1098
+ backgroundColor: z12.string().describe("Background color for light theme")
1099
+ }).describe("Light theme colors"),
1100
+ dark: z12.object({
1101
+ brandColor: z12.string().describe("Brand color for dark theme"),
1102
+ overlayColor: z12.string().describe("Overlay color for dark theme"),
1103
+ textColor: z12.string().describe("Text color for dark theme"),
1104
+ backgroundColor: z12.string().describe("Background color for dark theme")
1105
+ }).describe("Dark theme colors")
1106
+ }).nullable().optional().describe("Theme configuration (optional)"),
1107
+ featureSettings: z12.object({
1108
+ darkOverlay: z12.boolean().describe("Whether to show dark overlay"),
1109
+ closeButton: z12.boolean().describe("Whether to show close button"),
1110
+ progressBar: z12.boolean().describe("Whether to show progress bar"),
1111
+ showBranding: z12.boolean().describe("Whether to show branding"),
1112
+ customPosition: z12.boolean().describe("Whether custom position is enabled"),
1113
+ customIconPosition: z12.boolean().describe("Whether custom icon position is enabled"),
1114
+ customCss: z12.string().nullable().optional().describe("Custom CSS link (optional)")
1115
+ }).describe("Feature settings for the feedback form"),
1116
+ selectedIconPosition: z12.string().describe("Selected position for the feedback icon"),
1117
+ selectedPosition: z12.string().describe("Selected position for the feedback form")
1118
+ }).describe("Appearance properties for the feedback form")
1119
+ }).describe("Individual feedback configuration item in the list");
1120
+ var fetchFormConfigSchema = z12.object({
1121
+ feedbackConfigurationId: z12.string().uuid().describe("Unique identifier for the feedback configuration"),
1122
+ responseLanguageCode: z12.string().length(2).describe("Language code for the response (e.g., 'en', 'es')")
1123
+ }).describe("Form configuration for fetching feedback details");
1124
+ var fetchConfigurationListSchema = z12.object({
1125
+ deviceInfo: deviceInfoSchema.describe("Device information"),
1126
+ sessionInfo: sessionInfoSchema.describe("Session information"),
1127
+ userInfo: userInfoSchema.optional().describe("User information (optional)")
1128
+ }).strict().describe("Request schema for fetching available feedback configurations");
1129
+ var fetchFeedbackDetailsSchema = z12.object({
1130
+ formConfig: fetchFormConfigSchema.describe("Form configuration for the specific feedback"),
1131
+ deviceInfo: deviceInfoSchema.describe("Device information"),
1132
+ sessionInfo: sessionInfoSchema.describe("Session information"),
1133
+ userInfo: userInfoSchema.optional().describe("User information (optional)")
1134
+ }).strict().describe("Request schema for fetching specific feedback form details");
1135
+ var formConfigurationResponseSchema = z12.object({
1136
+ formTitle: z12.string().describe("Title of the feedback form"),
1137
+ formDescription: z12.string().describe("Description of the feedback form")
1138
+ }).describe("Form configuration response with title and description");
1139
+ var questionnaireFieldsResponseSchema = z12.object({
1140
+ questions: z12.record(z12.string(), combinedQuestionSchema).describe("Collection of questions keyed by their string identifiers"),
1141
+ sections: z12.array(sectionSchema).describe("Array of sections that organize questions into logical groups"),
1142
+ translations: z12.record(z12.string(), z12.any()).describe("Translations object (can be empty or contain language-specific translations)"),
1143
+ selectedLanguages: LanguagesSchema.describe("Array of languages selected for this questionnaire")
1144
+ }).describe("Questionnaire fields response including questions, sections, translations, and selected languages");
1145
+ var fetchFeedbackDetailsResponseSchema = z12.object({
1146
+ feedbackConfigurationId: z12.string().uuid().describe("Unique identifier for the feedback configuration"),
1147
+ feedbackIdentifier: z12.string().uuid().describe("Unique identifier for this specific feedback instance"),
1148
+ formConfiguration: formConfigurationResponseSchema.describe("Form configuration with title and description"),
1149
+ questionnaireFields: questionnaireFieldsResponseSchema.describe("Questionnaire structure including questions, sections, translations, and languages"),
1150
+ otherConfigurationProperties: otherConfigurationPropertiesSchema.describe("Other configuration properties using existing schema"),
1151
+ welcomeScreenProperties: welcomeScreenPropertiesSchema.describe("Welcome screen properties using existing schema"),
1152
+ endScreenProperties: endScreenPropertiesSchema.describe("End screen properties using existing schema")
1153
+ }).strict().describe("Complete response schema for fetchFeedbackDetails API using existing field schemas");
1154
+ var fetchConfigurationListResponseSchema = z12.object({
1155
+ masterProperties: masterPropertiesSchema.describe("Master properties for global survey settings"),
1156
+ feedbackConfiguration: z12.array(feedbackConfigurationItemSchema).describe("Array of available feedback configurations")
1157
+ }).strict().describe("Response schema for fetchConfigurationList API");
1158
+
1159
+ // src/index.ts
1160
+ import { z as z13 } from "zod";
994
1161
  export {
995
1162
  AnswerSchema,
996
1163
  ChoiceAnswerSchema,
997
1164
  ChoiceOrderOptions,
998
1165
  ContinuousSumAnswerSchema,
1166
+ DeviceThemes,
999
1167
  DismissBehaviors,
1000
1168
  EndFieldsTranslationSchema,
1001
1169
  EndScreenFieldsSchema,
@@ -1020,6 +1188,7 @@ export {
1020
1188
  TextAnswerSchema,
1021
1189
  ThemeModes,
1022
1190
  TranslationProvider,
1191
+ UserActions,
1023
1192
  ValidationRuleTypes,
1024
1193
  VisibilityConditionOperators,
1025
1194
  WelcomeFieldsTranslationSchema,
@@ -1030,6 +1199,7 @@ export {
1030
1199
  appearancePropertiesSchema,
1031
1200
  audienceSegmentSchema,
1032
1201
  audienceTriggerPropertiesSchema,
1202
+ baseSubmitFeedbackSchema,
1033
1203
  categorySpecificFiltersSchema,
1034
1204
  choiceOrderOptionSchema,
1035
1205
  combinedQuestionSchema,
@@ -1039,18 +1209,32 @@ export {
1039
1209
  createTranslationProvider,
1040
1210
  customEventFieldOperatorSchema,
1041
1211
  customEventFieldSchema,
1212
+ deviceInfoSchema,
1213
+ deviceSessionInfoSchema,
1214
+ deviceThemeSchema,
1042
1215
  dismissBehaviorSchema,
1216
+ durationSchema,
1043
1217
  endScreenPropertiesSchema,
1044
1218
  externalPublishingPropertiesSchema,
1045
1219
  featureSettingsSchema,
1220
+ feedbackConfigurationItemSchema,
1046
1221
  feedbackConfigurationSchema,
1222
+ feedbackRequestSchema,
1223
+ fetchConfigurationListResponseSchema,
1224
+ fetchConfigurationListSchema,
1225
+ fetchFeedbackDetailsResponseSchema,
1226
+ fetchFeedbackDetailsSchema,
1227
+ fetchFormConfigSchema,
1047
1228
  filterConditionSchema,
1229
+ formConfigSchema,
1230
+ formConfigurationResponseSchema,
1048
1231
  formPropertiesSchema,
1049
1232
  frequencyAndSchedulingPropertiesSchema,
1050
1233
  languageTranslationsSchema,
1051
1234
  longAnswerQuestionSchema,
1052
1235
  longAnswerTranslationsSchema,
1053
1236
  masterPropertiesSchema,
1237
+ matchedTriggerPropertiesSchema,
1054
1238
  multipleChoiceDisplayStyleSchema,
1055
1239
  multipleChoiceMultipleDisplayStyleSchema,
1056
1240
  multipleChoiceMultipleQuestionSchema,
@@ -1066,19 +1250,24 @@ export {
1066
1250
  publicationStatusSchema,
1067
1251
  queryOutputSchema,
1068
1252
  questionOptionSchema,
1253
+ questionResponseSchema,
1069
1254
  questionSchema,
1070
1255
  questionStatusSchema,
1071
1256
  questionTranslationsSchema,
1072
1257
  questionTypeSchema,
1258
+ questionnaireFieldsResponseSchema,
1073
1259
  ratingDisplayStyleSchema,
1074
1260
  ratingQuestionSchema,
1075
1261
  ratingRepresentationSizeSchema,
1076
1262
  ratingTranslationsSchema,
1077
1263
  recurringUnitSchema,
1264
+ responseSchema,
1078
1265
  sectionSchema,
1266
+ sessionInfoSchema,
1079
1267
  shortAnswerQuestionSchema,
1080
1268
  shortAnswerTranslationsSchema,
1081
1269
  singleChoiceTranslationsSchema,
1270
+ submitFeedbackSchema,
1082
1271
  surveyTypeSchema,
1083
1272
  themeColorsSchema,
1084
1273
  themeConfigurationSchema,
@@ -1087,12 +1276,16 @@ export {
1087
1276
  translationEntrySchema,
1088
1277
  translationsSchema,
1089
1278
  triggerActionSchema,
1279
+ userActionSchema,
1280
+ userInfoSchema,
1281
+ userPropertiesSchema,
1090
1282
  validationRuleSchema,
1091
1283
  validationRuleTypeSchema,
1284
+ viewFeedbackSchema,
1092
1285
  visibilityConditionSchema,
1093
1286
  welcomeScreenPropertiesSchema,
1094
1287
  whoSchema,
1095
1288
  yesNoSchema,
1096
- z10 as z
1289
+ z13 as z
1097
1290
  };
1098
1291
  //# sourceMappingURL=index.js.map