@encatch/schema 1.0.1-beta.2 → 1.0.1-beta.3

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
@@ -2,8 +2,277 @@ var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
 
4
4
  // src/schemas/fields/field-schema.ts
5
+ import { z as z2 } from "zod";
6
+
7
+ // src/schemas/fields/translations-schema.ts
5
8
  import { z } from "zod";
6
- var questionTypeSchema = z.enum([
9
+ var translationEntrySchema = z.string().min(1).describe("Translated text content");
10
+ var baseQuestionTranslationFieldsSchema = z.object({
11
+ title: translationEntrySchema.describe("Question title translation"),
12
+ description: translationEntrySchema.optional().describe("Question description translation"),
13
+ errorMessage: translationEntrySchema.optional().describe("Error message translation")
14
+ });
15
+ var BASE_QUESTION_TRANSLATION_KEYS = [
16
+ "type",
17
+ "title",
18
+ "description",
19
+ "errorMessage"
20
+ ];
21
+ var ratingQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
22
+ type: z.literal("rating").describe("Question type identifier"),
23
+ minLabel: translationEntrySchema.optional().describe("Minimum rating label translation"),
24
+ maxLabel: translationEntrySchema.optional().describe("Maximum rating label translation")
25
+ }).describe("Translation schema for rating questions");
26
+ var singleChoiceQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
27
+ type: z.literal("single_choice").describe("Question type identifier"),
28
+ placeholder: translationEntrySchema.optional().describe("Input placeholder translation")
29
+ }).catchall(translationEntrySchema).refine(
30
+ (data) => {
31
+ const additionalKeys = Object.keys(data).filter(
32
+ (key) => ![...BASE_QUESTION_TRANSLATION_KEYS, "placeholder"].includes(key)
33
+ );
34
+ return additionalKeys.every((key) => /^option\..+\.(label|value)$/.test(key));
35
+ },
36
+ { message: "Additional keys must follow the pattern 'option.{id}.{label|value}'" }
37
+ ).describe("Translation schema for single choice questions");
38
+ var multipleChoiceQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
39
+ type: z.literal("multiple_choice_multiple").describe("Question type identifier"),
40
+ placeholder: translationEntrySchema.optional().describe("Input placeholder translation")
41
+ }).catchall(translationEntrySchema).refine(
42
+ (data) => {
43
+ const additionalKeys = Object.keys(data).filter(
44
+ (key) => ![...BASE_QUESTION_TRANSLATION_KEYS, "placeholder"].includes(key)
45
+ );
46
+ return additionalKeys.every((key) => /^option\..+\.(label|value)$/.test(key));
47
+ },
48
+ { message: "Additional keys must follow the pattern 'option.{id}.{label|value}'" }
49
+ ).describe("Translation schema for multiple choice questions");
50
+ var npsQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
51
+ type: z.literal("nps").describe("Question type identifier"),
52
+ minLabel: translationEntrySchema.optional().describe("Minimum NPS label (0) translation"),
53
+ maxLabel: translationEntrySchema.optional().describe("Maximum NPS label (10) translation")
54
+ }).catchall(translationEntrySchema).refine(
55
+ (data) => {
56
+ const additionalKeys = Object.keys(data).filter(
57
+ (key) => ![...BASE_QUESTION_TRANSLATION_KEYS, "minLabel", "maxLabel"].includes(key)
58
+ );
59
+ return additionalKeys.every((key) => /^scaleLabel\.\d+$/.test(key));
60
+ },
61
+ { message: "Additional keys must follow the pattern 'scaleLabel.{number}'" }
62
+ ).describe("Translation schema for NPS questions");
63
+ var shortAnswerQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
64
+ type: z.literal("short_answer").describe("Question type identifier"),
65
+ placeholder: translationEntrySchema.optional().describe("Input placeholder translation")
66
+ }).describe("Translation schema for short answer questions");
67
+ var longAnswerQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
68
+ type: z.literal("long_text").describe("Question type identifier"),
69
+ placeholder: translationEntrySchema.optional().describe("Textarea placeholder translation")
70
+ }).describe("Translation schema for long answer questions");
71
+ var nestedSelectionQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
72
+ type: z.literal("nested_selection").describe("Question type identifier"),
73
+ placeholder: translationEntrySchema.optional().describe("Dropdown placeholder translation")
74
+ }).catchall(translationEntrySchema).refine(
75
+ (data) => {
76
+ const additionalKeys = Object.keys(data).filter(
77
+ (key) => ![...BASE_QUESTION_TRANSLATION_KEYS, "placeholder"].includes(key)
78
+ );
79
+ return additionalKeys.every((key) => /^nestedOption\..+\.(label|hint)$/.test(key));
80
+ },
81
+ { message: "Additional keys must follow the pattern 'nestedOption.{id}.{label|hint}'" }
82
+ ).describe("Translation schema for nested selection questions");
83
+ var annotationQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
84
+ type: z.literal("annotation").describe("Question type identifier"),
85
+ annotationText: translationEntrySchema.optional().describe("Annotation display text translation"),
86
+ noAnnotationText: translationEntrySchema.optional().describe("No annotation display text translation")
87
+ }).describe("Translation schema for annotation questions");
88
+ var welcomeQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
89
+ type: z.literal("welcome").describe("Question type identifier"),
90
+ buttonLabel: translationEntrySchema.optional().describe("Translated proceed/start button label")
91
+ }).describe("Translation schema for welcome screen questions");
92
+ var thankYouQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
93
+ type: z.literal("thank_you").describe("Question type identifier"),
94
+ buttonLabel: translationEntrySchema.optional().describe(
95
+ "Translated dismiss/done button label"
96
+ )
97
+ }).describe("Translation schema for thank you screen questions");
98
+ var messagePanelQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
99
+ type: z.literal("message_panel").describe("Question type identifier"),
100
+ buttonLabel: translationEntrySchema.optional().describe(
101
+ "Translated continue/button label"
102
+ )
103
+ }).describe("Translation schema for message panel questions");
104
+ var yesNoQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
105
+ type: z.literal("yes_no").describe("Question type identifier"),
106
+ yesLabel: translationEntrySchema.optional().describe("Translated Yes label"),
107
+ noLabel: translationEntrySchema.optional().describe("Translated No label")
108
+ }).describe("Translation schema for yes/no questions");
109
+ var ratingMatrixQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
110
+ type: z.literal("rating_matrix").describe("Question type identifier"),
111
+ minLabel: translationEntrySchema.optional().describe(
112
+ "Translated scale minimum end label (for likert and numerical kinds)"
113
+ ),
114
+ maxLabel: translationEntrySchema.optional().describe(
115
+ "Translated scale maximum end label (for likert and numerical kinds)"
116
+ )
117
+ }).catchall(translationEntrySchema).refine(
118
+ (data) => {
119
+ const additionalKeys = Object.keys(data).filter(
120
+ (key) => ![...BASE_QUESTION_TRANSLATION_KEYS, "minLabel", "maxLabel"].includes(
121
+ key
122
+ )
123
+ );
124
+ return additionalKeys.every(
125
+ (key) => /^statement\..+\.label$/.test(key) || /^scalePoint\..+\.label$/.test(key)
126
+ );
127
+ },
128
+ {
129
+ message: "Additional keys must follow 'statement.{id}.label' or 'scalePoint.{id}.label'"
130
+ }
131
+ ).describe("Translation schema for rating matrix questions");
132
+ var matrixSingleChoiceQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
133
+ type: z.literal("matrix_single_choice").describe("Question type identifier")
134
+ }).catchall(translationEntrySchema).refine(
135
+ (data) => {
136
+ const additionalKeys = Object.keys(data).filter(
137
+ (key) => !BASE_QUESTION_TRANSLATION_KEYS.includes(key)
138
+ );
139
+ return additionalKeys.every(
140
+ (key) => /^row\..+\.label$/.test(key) || /^column\..+\.label$/.test(key)
141
+ );
142
+ },
143
+ {
144
+ message: "Additional keys must follow 'row.{id}.label' or 'column.{id}.label'"
145
+ }
146
+ ).describe("Translation schema for matrix single-choice questions");
147
+ var matrixMultipleChoiceQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
148
+ type: z.literal("matrix_multiple_choice").describe("Question type identifier")
149
+ }).catchall(translationEntrySchema).refine(
150
+ (data) => {
151
+ const additionalKeys = Object.keys(data).filter(
152
+ (key) => !BASE_QUESTION_TRANSLATION_KEYS.includes(key)
153
+ );
154
+ return additionalKeys.every(
155
+ (key) => /^row\..+\.label$/.test(key) || /^column\..+\.label$/.test(key)
156
+ );
157
+ },
158
+ {
159
+ message: "Additional keys must follow 'row.{id}.label' or 'column.{id}.label'"
160
+ }
161
+ ).describe("Translation schema for matrix multiple-choice questions");
162
+ var questionTranslationSchema = z.union([
163
+ ratingQuestionTranslationSchema,
164
+ singleChoiceQuestionTranslationSchema,
165
+ multipleChoiceQuestionTranslationSchema,
166
+ npsQuestionTranslationSchema,
167
+ shortAnswerQuestionTranslationSchema,
168
+ longAnswerQuestionTranslationSchema,
169
+ nestedSelectionQuestionTranslationSchema,
170
+ annotationQuestionTranslationSchema,
171
+ welcomeQuestionTranslationSchema,
172
+ thankYouQuestionTranslationSchema,
173
+ messagePanelQuestionTranslationSchema,
174
+ yesNoQuestionTranslationSchema,
175
+ ratingMatrixQuestionTranslationSchema,
176
+ matrixSingleChoiceQuestionTranslationSchema,
177
+ matrixMultipleChoiceQuestionTranslationSchema
178
+ ]).describe("Union of all question type translation schemas");
179
+ var languageCodeSchema = z.string().min(2).max(10).describe("Language code (e.g., 'en', 'es', 'hi')");
180
+ var questionTranslationsByLanguageSchema = z.record(languageCodeSchema, questionTranslationSchema).describe("Question translations keyed by language code");
181
+ var questionCentricTranslationsSchema = z.record(z.string().uuid(), questionTranslationsByLanguageSchema).describe("Question-centric translations keyed by question ID, then by language code");
182
+ var translationsSchema = questionCentricTranslationsSchema.describe("Question-centric translations at root level");
183
+ var _TranslationProvider = class _TranslationProvider {
184
+ constructor(translations, defaultLanguage = "en") {
185
+ this.translations = translations;
186
+ this.defaultLanguage = defaultLanguage;
187
+ }
188
+ /**
189
+ * Get translations for a specific question in a specific language
190
+ */
191
+ getQuestionTranslations(questionId, languageCode) {
192
+ const questionTranslations = this.translations[questionId];
193
+ if (!questionTranslations) return null;
194
+ let translation = questionTranslations[languageCode];
195
+ if (!translation) {
196
+ translation = questionTranslations[this.defaultLanguage];
197
+ }
198
+ return translation || null;
199
+ }
200
+ /**
201
+ * Get a specific translation text by field path
202
+ */
203
+ getTranslationText(questionId, languageCode, fieldPath) {
204
+ const questionTranslation = this.getQuestionTranslations(questionId, languageCode);
205
+ if (!questionTranslation) return null;
206
+ if (fieldPath in questionTranslation) {
207
+ const value = questionTranslation[fieldPath];
208
+ return typeof value === "string" ? value : null;
209
+ }
210
+ return null;
211
+ }
212
+ /**
213
+ * Get all available languages for a specific question
214
+ */
215
+ getQuestionLanguages(questionId) {
216
+ const questionTranslations = this.translations[questionId];
217
+ if (!questionTranslations) return [];
218
+ return Object.keys(questionTranslations);
219
+ }
220
+ /**
221
+ * Get all available languages across all questions
222
+ */
223
+ getAvailableLanguages() {
224
+ const allLanguages = /* @__PURE__ */ new Set();
225
+ Object.values(this.translations).forEach((questionTranslations) => {
226
+ Object.keys(questionTranslations).forEach((langCode) => {
227
+ allLanguages.add(langCode);
228
+ });
229
+ });
230
+ return Array.from(allLanguages);
231
+ }
232
+ /**
233
+ * Check if a language is supported for a specific question
234
+ */
235
+ isLanguageSupportedForQuestion(questionId, languageCode) {
236
+ const questionTranslations = this.translations[questionId];
237
+ if (!questionTranslations) return false;
238
+ return languageCode in questionTranslations;
239
+ }
240
+ /**
241
+ * Check if a language is supported across all questions
242
+ */
243
+ isLanguageSupported(languageCode) {
244
+ return this.getAvailableLanguages().includes(languageCode);
245
+ }
246
+ /**
247
+ * Get the default language
248
+ */
249
+ getDefaultLanguage() {
250
+ return this.defaultLanguage;
251
+ }
252
+ /**
253
+ * Get all questions that have translations
254
+ */
255
+ getQuestionIds() {
256
+ return Object.keys(this.translations);
257
+ }
258
+ /**
259
+ * Get question type for a specific question
260
+ */
261
+ getQuestionType(questionId, languageCode) {
262
+ const langCode = languageCode || this.defaultLanguage;
263
+ const translation = this.getQuestionTranslations(questionId, langCode);
264
+ return translation?.type || null;
265
+ }
266
+ };
267
+ __name(_TranslationProvider, "TranslationProvider");
268
+ var TranslationProvider = _TranslationProvider;
269
+ function createTranslationProvider(translations, defaultLanguage = "en") {
270
+ return new TranslationProvider(translations, defaultLanguage);
271
+ }
272
+ __name(createTranslationProvider, "createTranslationProvider");
273
+
274
+ // src/schemas/fields/field-schema.ts
275
+ var questionTypeSchema = z2.enum([
7
276
  "rating",
8
277
  "single_choice",
9
278
  "nps",
@@ -39,7 +308,7 @@ var QuestionTypes = {
39
308
  MATRIX_MULTIPLE_CHOICE: "matrix_multiple_choice",
40
309
  EXIT_FORM: "exit_form"
41
310
  };
42
- var validationRuleTypeSchema = z.enum([
311
+ var validationRuleTypeSchema = z2.enum([
43
312
  "required",
44
313
  "min",
45
314
  "max",
@@ -61,13 +330,13 @@ var ValidationRuleTypes = {
61
330
  URL: "url",
62
331
  CUSTOM: "custom"
63
332
  };
64
- var validationRuleSchema = z.object({
333
+ var validationRuleSchema = z2.object({
65
334
  type: validationRuleTypeSchema.describe("Type of validation rule to apply"),
66
- value: z.union([z.string(), z.number(), z.boolean()]).optional().describe("Value for the validation rule (string, number, or boolean)"),
67
- message: z.string().optional().describe("Custom error message when validation fails"),
68
- describe: z.string().max(500).optional().describe("LLM tool call description for this validation rule")
335
+ value: z2.union([z2.string(), z2.number(), z2.boolean()]).optional().describe("Value for the validation rule (string, number, or boolean)"),
336
+ message: z2.string().optional().describe("Custom error message when validation fails"),
337
+ describe: z2.string().max(500).optional().describe("LLM tool call description for this validation rule")
69
338
  }).describe("Schema defining validation rules for question responses");
70
- var visibilityConditionOperatorSchema = z.enum([
339
+ var visibilityConditionOperatorSchema = z2.enum([
71
340
  "equals",
72
341
  "not_equals",
73
342
  "contains",
@@ -87,27 +356,48 @@ var VisibilityConditionOperators = {
87
356
  IS_EMPTY: "is_empty",
88
357
  IS_NOT_EMPTY: "is_not_empty"
89
358
  };
90
- var visibilityConditionSchema = z.object({
91
- field: z.string().describe("ID of the field to check against"),
359
+ var visibilityConditionSchema = z2.object({
360
+ field: z2.string().describe("ID of the field to check against"),
92
361
  operator: visibilityConditionOperatorSchema.describe("Comparison operator for the condition"),
93
- value: z.union([z.string(), z.number(), z.boolean()]).optional().describe("Value to compare against (string, number, or boolean)"),
94
- describe: z.string().max(500).optional().describe("LLM tool call description for this visibility condition")
362
+ value: z2.union([z2.string(), z2.number(), z2.boolean()]).optional().describe("Value to compare against (string, number, or boolean)"),
363
+ describe: z2.string().max(500).optional().describe("LLM tool call description for this visibility condition")
95
364
  }).describe(
96
365
  "Schema defining conditions that control when questions are visible"
97
366
  );
98
- var sectionSchema = z.object({
99
- id: z.string().describe("Unique identifier for the section"),
100
- title: z.string().min(1).max(200).describe("Display title for the section"),
101
- questionIds: z.array(z.string()).min(1).describe("Array of question IDs that belong to this section")
367
+ var sectionSchema = z2.object({
368
+ id: z2.string().describe("Unique identifier for the section"),
369
+ title: z2.string().min(1).max(200).describe("Display title for the section"),
370
+ titleTranslations: z2.record(
371
+ languageCodeSchema,
372
+ z2.string().min(1).max(200)
373
+ ).optional().describe("Localized section titles keyed by language code"),
374
+ description: z2.string().max(1e3).optional().describe("Optional detailed description or help text for the section"),
375
+ descriptionTranslations: z2.record(
376
+ languageCodeSchema,
377
+ z2.string().min(1).max(1e3)
378
+ ).optional().describe("Localized section descriptions keyed by language code"),
379
+ showTitle: z2.boolean().default(true).describe("Whether to show the section title in the UI"),
380
+ showDescription: z2.boolean().default(true).describe("Whether to show the section description in the UI"),
381
+ nextButtonLabel: z2.string().min(1).max(50).optional().describe("Label for the next button when navigating from this section"),
382
+ nextButtonLabelTranslations: z2.record(
383
+ languageCodeSchema,
384
+ z2.string().min(1).max(50)
385
+ ).optional().describe(
386
+ "Localized next-button labels for this section keyed by language code"
387
+ ),
388
+ inAppSingleQuestion: z2.boolean().default(false).describe(
389
+ "When true, the native app shows one question at a time within this section"
390
+ ),
391
+ questionIds: z2.array(z2.string()).min(1).describe("Array of question IDs that belong to this section")
102
392
  }).describe("Schema defining sections that organize questions into logical groups");
103
- var questionStatusSchema = z.enum(["D", "P", "A", "S"]);
393
+ var questionStatusSchema = z2.enum(["D", "P", "A", "S"]);
104
394
  var QuestionStatuses = {
105
395
  DRAFT: "D",
106
396
  PUBLISHED: "P",
107
397
  ARCHIVED: "A",
108
398
  SUSPENDED: "S"
109
399
  };
110
- var ratingDisplayStyleSchema = z.enum([
400
+ var ratingDisplayStyleSchema = z2.enum([
111
401
  "star",
112
402
  "heart",
113
403
  "thumbs-up",
@@ -123,7 +413,7 @@ var RatingDisplayStyles = {
123
413
  EMOJI: "emoji",
124
414
  EMOJI_EXP: "emoji_exp"
125
415
  };
126
- var ratingRepresentationSizeSchema = z.enum([
416
+ var ratingRepresentationSizeSchema = z2.enum([
127
417
  "small",
128
418
  "medium",
129
419
  "large"
@@ -133,7 +423,7 @@ var RatingRepresentationSizes = {
133
423
  MEDIUM: "medium",
134
424
  LARGE: "large"
135
425
  };
136
- var multipleChoiceDisplayStyleSchema = z.enum([
426
+ var multipleChoiceDisplayStyleSchema = z2.enum([
137
427
  "radio",
138
428
  "list",
139
429
  "chip",
@@ -145,7 +435,7 @@ var MultipleChoiceDisplayStyles = {
145
435
  CHIP: "chip",
146
436
  DROPDOWN: "dropdown"
147
437
  };
148
- var multipleChoiceMultipleDisplayStyleSchema = z.enum([
438
+ var multipleChoiceMultipleDisplayStyleSchema = z2.enum([
149
439
  "checkbox",
150
440
  "list",
151
441
  "chip"
@@ -155,12 +445,12 @@ var MultipleChoiceMultipleDisplayStyles = {
155
445
  LIST: "list",
156
446
  CHIP: "chip"
157
447
  };
158
- var yesNoDisplayStyleSchema = z.enum(["horizontal", "vertical"]);
448
+ var yesNoDisplayStyleSchema = z2.enum(["horizontal", "vertical"]);
159
449
  var YesNoDisplayStyles = {
160
450
  HORIZONTAL: "horizontal",
161
451
  VERTICAL: "vertical"
162
452
  };
163
- var choiceOrderOptionSchema = z.enum([
453
+ var choiceOrderOptionSchema = z2.enum([
164
454
  "randomize",
165
455
  "flip",
166
456
  "rotate",
@@ -174,83 +464,83 @@ var ChoiceOrderOptions = {
174
464
  ASCENDING: "ascending",
175
465
  NONE: "none"
176
466
  };
177
- var questionSchema = z.object({
178
- id: z.string().describe("Unique identifier for the question"),
467
+ var questionSchema = z2.object({
468
+ id: z2.string().describe("Unique identifier for the question"),
179
469
  type: questionTypeSchema.describe(
180
470
  "The type of question (rating, single_choice, etc.)"
181
471
  ),
182
- title: z.string().min(1).max(200).describe("The main title/question text displayed to users"),
183
- description: z.string().max(1e3).optional().describe("Optional detailed description or help text"),
184
- describe: z.string().max(2e3).optional().describe(
472
+ title: z2.string().min(1).max(200).describe("The main title/question text displayed to users"),
473
+ description: z2.string().max(1e3).optional().describe("Optional detailed description or help text"),
474
+ describe: z2.string().max(2e3).optional().describe(
185
475
  "LLM tool call description for better AI understanding and context"
186
476
  ),
187
- required: z.boolean().default(false).describe("Whether this question must be answered"),
188
- isHidden: z.boolean().default(false).describe("When true, the question is hidden from the form UI"),
189
- errorMessage: z.string().max(500).optional().describe("Custom error message when validation fails"),
190
- validations: z.array(validationRuleSchema).optional().default([]).describe("Array of validation rules to apply"),
191
- visibility: z.array(visibilityConditionSchema).optional().default([]).describe("Conditions that control when this question is shown"),
192
- sectionId: z.string().optional().describe("ID of the section this question belongs to"),
477
+ required: z2.boolean().default(false).describe("Whether this question must be answered"),
478
+ isHidden: z2.boolean().default(false).describe("When true, the question is hidden from the form UI"),
479
+ errorMessage: z2.string().max(500).optional().describe("Custom error message when validation fails"),
480
+ validations: z2.array(validationRuleSchema).optional().default([]).describe("Array of validation rules to apply"),
481
+ visibility: z2.array(visibilityConditionSchema).optional().default([]).describe("Conditions that control when this question is shown"),
482
+ sectionId: z2.string().optional().describe("ID of the section this question belongs to"),
193
483
  status: questionStatusSchema.describe(
194
484
  "Current status of the question (Draft, Published, etc.)"
195
485
  ),
196
- textAlign: z.enum(["left", "center"]).optional().default("left").describe("Text alignment for the question title and description")
486
+ textAlign: z2.enum(["left", "center"]).optional().default("left").describe("Text alignment for the question title and description")
197
487
  }).describe("Base schema for all question types with common properties");
198
488
  var ratingQuestionSchema = questionSchema.extend({
199
- type: z.literal("rating").describe("Must be exactly 'rating'"),
200
- showLabels: z.boolean().optional().describe("Whether to show min/max labels"),
201
- minLabel: z.string().max(100).optional().describe("Label for the minimum rating value"),
202
- maxLabel: z.string().max(100).optional().describe("Label for the maximum rating value"),
489
+ type: z2.literal("rating").describe("Must be exactly 'rating'"),
490
+ showLabels: z2.boolean().optional().describe("Whether to show min/max labels"),
491
+ minLabel: z2.string().max(100).optional().describe("Label for the minimum rating value"),
492
+ maxLabel: z2.string().max(100).optional().describe("Label for the maximum rating value"),
203
493
  displayStyle: ratingDisplayStyleSchema.optional().describe("Visual style for rating display"),
204
- numberOfRatings: z.number().int().min(1).max(10).describe("Number of rating options (1-10)"),
494
+ numberOfRatings: z2.number().int().min(1).max(10).describe("Number of rating options (1-10)"),
205
495
  representationSize: ratingRepresentationSizeSchema.optional().describe("Size of rating visual elements"),
206
- color: z.string().regex(/^#[0-9A-F]{6}$/i, "Must be a valid hex color").optional().describe("Hex color for rating elements")
496
+ color: z2.string().regex(/^#[0-9A-F]{6}$/i, "Must be a valid hex color").optional().describe("Hex color for rating elements")
207
497
  }).describe("Schema for rating questions with customizable display options");
208
498
  var annotationQuestionSchema = questionSchema.extend({
209
- type: z.literal("annotation").describe("Must be exactly 'annotation'"),
210
- annotationText: z.string().max(1e3).optional().describe("Text to display when annotation is provided"),
211
- noAnnotationText: z.string().max(500).optional().describe("Text to display when no annotation is provided")
499
+ type: z2.literal("annotation").describe("Must be exactly 'annotation'"),
500
+ annotationText: z2.string().max(1e3).optional().describe("Text to display when annotation is provided"),
501
+ noAnnotationText: z2.string().max(500).optional().describe("Text to display when no annotation is provided")
212
502
  }).describe(
213
503
  "Schema for annotation questions that provide additional context or instructions"
214
504
  );
215
505
  var welcomeQuestionSchema = questionSchema.extend({
216
- type: z.literal("welcome").describe("Must be exactly 'welcome'"),
217
- title: z.string().min(1).max(200).describe("The main heading displayed on the welcome screen"),
218
- description: z.string().max(1e3).optional().describe("Optional sub-text body shown below the heading"),
219
- buttonLabel: z.string().min(1).max(50).optional().describe("Label for the proceed/start button (e.g. 'Get Started', 'Begin')"),
220
- imageUrl: z.string().url().optional().describe("Optional image URL displayed on the welcome screen")
506
+ type: z2.literal("welcome").describe("Must be exactly 'welcome'"),
507
+ title: z2.string().min(1).max(200).describe("The main heading displayed on the welcome screen"),
508
+ description: z2.string().max(1e3).optional().describe("Optional sub-text body shown below the heading"),
509
+ buttonLabel: z2.string().min(1).max(50).optional().describe("Label for the proceed/start button (e.g. 'Get Started', 'Begin')"),
510
+ imageUrl: z2.string().url().optional().describe("Optional image URL displayed on the welcome screen")
221
511
  }).describe("Schema for a welcome screen displayed at the start or inline within a form");
222
512
  var thankYouQuestionSchema = questionSchema.extend({
223
- type: z.literal("thank_you").describe("Must be exactly 'thank_you'"),
224
- title: z.string().min(1).max(200).describe("The main heading displayed on the thank you screen"),
225
- description: z.string().max(1e3).optional().describe(
513
+ type: z2.literal("thank_you").describe("Must be exactly 'thank_you'"),
514
+ title: z2.string().min(1).max(200).describe("The main heading displayed on the thank you screen"),
515
+ description: z2.string().max(1e3).optional().describe(
226
516
  "Optional thank you body text; rendered as Markdown where the form supports it"
227
517
  ),
228
- buttonLabel: z.string().min(1).max(50).optional().describe("Label for the dismiss/done button (e.g. 'Done', 'Close')"),
229
- imageUrl: z.string().url().optional().describe("Optional image URL displayed on the thank you screen")
518
+ buttonLabel: z2.string().min(1).max(50).optional().describe("Label for the dismiss/done button (e.g. 'Done', 'Close')"),
519
+ imageUrl: z2.string().url().optional().describe("Optional image URL displayed on the thank you screen")
230
520
  }).describe(
231
521
  "Schema for a thank you screen shown at the end or inline within a form"
232
522
  );
233
523
  var messagePanelQuestionSchema = questionSchema.extend({
234
- type: z.literal("message_panel").describe("Must be exactly 'message_panel'"),
235
- title: z.string().min(1).max(200).describe("The main heading displayed on the message panel"),
236
- description: z.string().max(1e3).optional().describe("Optional body text shown below the heading"),
237
- buttonLabel: z.string().min(1).max(50).optional().describe("Label for the continue button (e.g. 'Continue', 'Next')"),
238
- imageUrl: z.string().url().optional().describe("Optional image URL displayed on the message panel")
524
+ type: z2.literal("message_panel").describe("Must be exactly 'message_panel'"),
525
+ title: z2.string().min(1).max(200).describe("The main heading displayed on the message panel"),
526
+ description: z2.string().max(1e3).optional().describe("Optional body text shown below the heading"),
527
+ buttonLabel: z2.string().min(1).max(50).optional().describe("Label for the continue button (e.g. 'Continue', 'Next')"),
528
+ imageUrl: z2.string().url().optional().describe("Optional image URL displayed on the message panel")
239
529
  }).describe(
240
530
  "Schema for an inline message panel (informational); distinct from welcome for UI semantics and analytics"
241
531
  );
242
532
  var exitFormQuestionSchema = questionSchema.extend({
243
- type: z.literal("exit_form").describe("Must be exactly 'exit_form'")
533
+ type: z2.literal("exit_form").describe("Must be exactly 'exit_form'")
244
534
  }).describe(
245
535
  "Schema for an exit marker that silently ends the survey; carries no UI and captures no answer \u2014 intended for branch logic paths that should terminate without showing a thank-you screen"
246
536
  );
247
537
  var yesNoQuestionSchema = questionSchema.extend({
248
- type: z.literal("yes_no").describe("Must be exactly 'yes_no'"),
249
- yesLabel: z.string().min(1).max(50).optional().describe("Label for the Yes option (defaults to 'Yes' in the UI if omitted)"),
250
- noLabel: z.string().min(1).max(50).optional().describe("Label for the No option (defaults to 'No' in the UI if omitted)"),
538
+ type: z2.literal("yes_no").describe("Must be exactly 'yes_no'"),
539
+ yesLabel: z2.string().min(1).max(50).optional().describe("Label for the Yes option (defaults to 'Yes' in the UI if omitted)"),
540
+ noLabel: z2.string().min(1).max(50).optional().describe("Label for the No option (defaults to 'No' in the UI if omitted)"),
251
541
  displayStyle: yesNoDisplayStyleSchema.optional().describe("Layout for the Yes/No controls (horizontal row or vertical stack)")
252
542
  }).describe("Schema for yes/no questions with optional custom labels and layout");
253
- var ratingMatrixDisplayStyleSchema = z.enum([
543
+ var ratingMatrixDisplayStyleSchema = z2.enum([
254
544
  "radio",
255
545
  "star",
256
546
  "emoji",
@@ -262,72 +552,72 @@ var RatingMatrixDisplayStyles = {
262
552
  EMOJI: "emoji",
263
553
  BUTTON: "button"
264
554
  };
265
- var ratingMatrixStatementSchema = z.object({
266
- id: z.string().describe("Unique identifier for this statement (system time milliseconds)"),
267
- value: z.string().min(1).max(100).describe("Internal value / export key for this statement"),
268
- label: z.string().min(1).max(200).describe("Display text shown to users for this statement"),
269
- describe: z.string().max(500).optional().describe("LLM tool call description for this statement")
555
+ var ratingMatrixStatementSchema = z2.object({
556
+ id: z2.string().describe("Unique identifier for this statement (system time milliseconds)"),
557
+ value: z2.string().min(1).max(100).describe("Internal value / export key for this statement"),
558
+ label: z2.string().min(1).max(200).describe("Display text shown to users for this statement"),
559
+ describe: z2.string().max(500).optional().describe("LLM tool call description for this statement")
270
560
  }).describe("Schema for an individual statement (row) in a rating matrix");
271
- var ratingMatrixScalePointSchema = z.object({
272
- id: z.string().describe("Unique identifier for this scale point"),
273
- value: z.union([z.number(), z.string()]).describe("Stored response value for this scale point (number or string)"),
274
- label: z.string().min(1).max(200).describe("Display label shown for this scale point"),
275
- describe: z.string().max(500).optional().describe("LLM tool call description for this scale point")
561
+ var ratingMatrixScalePointSchema = z2.object({
562
+ id: z2.string().describe("Unique identifier for this scale point"),
563
+ value: z2.union([z2.number(), z2.string()]).describe("Stored response value for this scale point (number or string)"),
564
+ label: z2.string().min(1).max(200).describe("Display label shown for this scale point"),
565
+ describe: z2.string().max(500).optional().describe("LLM tool call description for this scale point")
276
566
  }).describe("Schema for a single point on a custom rating scale");
277
- var ratingMatrixScaleSchema = z.discriminatedUnion("kind", [
567
+ var ratingMatrixScaleSchema = z2.discriminatedUnion("kind", [
278
568
  // Likert: symmetric ordinal scale -2…+2, explicit scale points with labels
279
- z.object({
280
- kind: z.literal("likert").describe("Symmetric ordinal scale (-2 to +2)"),
281
- scalePoints: z.array(ratingMatrixScalePointSchema).min(2).max(10).describe("Scale points with display labels for each column")
569
+ z2.object({
570
+ kind: z2.literal("likert").describe("Symmetric ordinal scale (-2 to +2)"),
571
+ scalePoints: z2.array(ratingMatrixScalePointSchema).min(2).max(10).describe("Scale points with display labels for each column")
282
572
  }),
283
573
  // Numerical: 1…N points where N is 2, 3, 4, or 5, explicit scale points with labels
284
- z.object({
285
- kind: z.literal("numerical").describe("Numerical scale from 1 to N"),
286
- scalePoints: z.array(ratingMatrixScalePointSchema).min(2).max(10).describe("Scale points with display labels for each column"),
287
- pointCount: z.union([z.literal(2), z.literal(3), z.literal(4), z.literal(5)]).describe("Number of scale points (2, 3, 4, or 5)")
574
+ z2.object({
575
+ kind: z2.literal("numerical").describe("Numerical scale from 1 to N"),
576
+ scalePoints: z2.array(ratingMatrixScalePointSchema).min(2).max(10).describe("Scale points with display labels for each column"),
577
+ pointCount: z2.union([z2.literal(2), z2.literal(3), z2.literal(4), z2.literal(5)]).describe("Number of scale points (2, 3, 4, or 5)")
288
578
  }),
289
579
  // Custom: consumer defines each point's value and label
290
- z.object({
291
- kind: z.literal("custom").describe("Custom scale with user-defined points and values"),
292
- scalePoints: z.array(ratingMatrixScalePointSchema).min(2).max(10).describe("Scale points with display labels for each column")
580
+ z2.object({
581
+ kind: z2.literal("custom").describe("Custom scale with user-defined points and values"),
582
+ scalePoints: z2.array(ratingMatrixScalePointSchema).min(2).max(10).describe("Scale points with display labels for each column")
293
583
  })
294
584
  ]).describe("Scale configuration for rating matrix questions");
295
585
  var ratingMatrixQuestionSchema = questionSchema.extend({
296
- type: z.literal("rating_matrix").describe("Must be exactly 'rating_matrix'"),
297
- statements: z.array(ratingMatrixStatementSchema).min(1).max(10).describe("Statements (rows) users will rate on the shared scale (1-10)"),
586
+ type: z2.literal("rating_matrix").describe("Must be exactly 'rating_matrix'"),
587
+ statements: z2.array(ratingMatrixStatementSchema).min(1).max(10).describe("Statements (rows) users will rate on the shared scale (1-10)"),
298
588
  scale: ratingMatrixScaleSchema.describe("Scale configuration shared across all statement rows"),
299
589
  displayStyle: ratingMatrixDisplayStyleSchema.optional().describe(
300
590
  "Visual representation of scale points per row (radio buttons, stars, emoji, or buttons)"
301
591
  ),
302
- randomizeStatements: z.boolean().optional().default(false).describe("Whether to randomize the order of statements")
592
+ randomizeStatements: z2.boolean().optional().default(false).describe("Whether to randomize the order of statements")
303
593
  }).describe("Schema for rating matrix questions with multiple statements on a shared scale");
304
- var matrixRowSchema = z.object({
305
- id: z.string().describe("Unique identifier for this row (system time milliseconds)"),
306
- value: z.string().min(1).max(100).describe("Internal value / export key for this row"),
307
- label: z.string().min(1).max(200).describe("Display text shown to users for this row"),
308
- describe: z.string().max(500).optional().describe("LLM tool call description for this row")
594
+ var matrixRowSchema = z2.object({
595
+ id: z2.string().describe("Unique identifier for this row (system time milliseconds)"),
596
+ value: z2.string().min(1).max(100).describe("Internal value / export key for this row"),
597
+ label: z2.string().min(1).max(200).describe("Display text shown to users for this row"),
598
+ describe: z2.string().max(500).optional().describe("LLM tool call description for this row")
309
599
  }).describe("Schema for an individual row in a matrix choice question");
310
- var matrixColumnSchema = z.object({
311
- id: z.string().describe("Unique identifier for this column (system time milliseconds)"),
312
- value: z.string().min(1).max(100).describe("Internal value / export key for this column"),
313
- label: z.string().min(1).max(200).describe("Display label shown for this column"),
314
- describe: z.string().max(500).optional().describe("LLM tool call description for this column")
600
+ var matrixColumnSchema = z2.object({
601
+ id: z2.string().describe("Unique identifier for this column (system time milliseconds)"),
602
+ value: z2.string().min(1).max(100).describe("Internal value / export key for this column"),
603
+ label: z2.string().min(1).max(200).describe("Display label shown for this column"),
604
+ describe: z2.string().max(500).optional().describe("LLM tool call description for this column")
315
605
  }).describe("Schema for an individual column in a matrix choice question");
316
606
  var matrixSingleChoiceQuestionSchema = questionSchema.extend({
317
- type: z.literal("matrix_single_choice").describe("Must be exactly 'matrix_single_choice'"),
318
- rows: z.array(matrixRowSchema).min(1).max(20).describe("Row items (1-20 rows)"),
319
- columns: z.array(matrixColumnSchema).min(2).max(10).describe("Column options shared across all rows (2-10 columns)"),
320
- randomizeRows: z.boolean().optional().default(false).describe("Whether to randomize the order of rows"),
321
- randomizeColumns: z.boolean().optional().default(false).describe("Whether to randomize the order of columns")
607
+ type: z2.literal("matrix_single_choice").describe("Must be exactly 'matrix_single_choice'"),
608
+ rows: z2.array(matrixRowSchema).min(1).max(20).describe("Row items (1-20 rows)"),
609
+ columns: z2.array(matrixColumnSchema).min(2).max(10).describe("Column options shared across all rows (2-10 columns)"),
610
+ randomizeRows: z2.boolean().optional().default(false).describe("Whether to randomize the order of rows"),
611
+ randomizeColumns: z2.boolean().optional().default(false).describe("Whether to randomize the order of columns")
322
612
  }).describe("Schema for matrix single-choice questions where one column is selected per row");
323
613
  var matrixMultipleChoiceQuestionSchema = questionSchema.extend({
324
- type: z.literal("matrix_multiple_choice").describe("Must be exactly 'matrix_multiple_choice'"),
325
- rows: z.array(matrixRowSchema).min(1).max(20).describe("Row items (1-20 rows)"),
326
- columns: z.array(matrixColumnSchema).min(2).max(10).describe("Column options shared across all rows (2-10 columns)"),
327
- minSelectionsPerRow: z.number().int().min(0).optional().describe("Minimum number of columns a user must select per row"),
328
- maxSelectionsPerRow: z.number().int().min(1).optional().describe("Maximum number of columns a user can select per row"),
329
- randomizeRows: z.boolean().optional().default(false).describe("Whether to randomize the order of rows"),
330
- randomizeColumns: z.boolean().optional().default(false).describe("Whether to randomize the order of columns")
614
+ type: z2.literal("matrix_multiple_choice").describe("Must be exactly 'matrix_multiple_choice'"),
615
+ rows: z2.array(matrixRowSchema).min(1).max(20).describe("Row items (1-20 rows)"),
616
+ columns: z2.array(matrixColumnSchema).min(2).max(10).describe("Column options shared across all rows (2-10 columns)"),
617
+ minSelectionsPerRow: z2.number().int().min(0).optional().describe("Minimum number of columns a user must select per row"),
618
+ maxSelectionsPerRow: z2.number().int().min(1).optional().describe("Maximum number of columns a user can select per row"),
619
+ randomizeRows: z2.boolean().optional().default(false).describe("Whether to randomize the order of rows"),
620
+ randomizeColumns: z2.boolean().optional().default(false).describe("Whether to randomize the order of columns")
331
621
  }).refine(
332
622
  (data) => {
333
623
  if (data.minSelectionsPerRow !== void 0 && data.maxSelectionsPerRow !== void 0) {
@@ -342,53 +632,53 @@ var matrixMultipleChoiceQuestionSchema = questionSchema.extend({
342
632
  ).describe(
343
633
  "Schema for matrix multiple-choice questions where one or more columns can be selected per row"
344
634
  );
345
- var questionOptionSchema = z.object({
346
- id: z.string().describe("Unique identifier for this option (system time milliseconds)"),
347
- value: z.string().min(1).max(100).describe("The internal value used for this option"),
348
- label: z.string().min(1).max(200).describe("The display text shown to users for this option"),
349
- describe: z.string().max(500).optional().describe(
635
+ var questionOptionSchema = z2.object({
636
+ id: z2.string().describe("Unique identifier for this option (system time milliseconds)"),
637
+ value: z2.string().min(1).max(100).describe("The internal value used for this option"),
638
+ label: z2.string().min(1).max(200).describe("The display text shown to users for this option"),
639
+ describe: z2.string().max(500).optional().describe(
350
640
  "LLM tool call description providing context about this option"
351
641
  ),
352
- imageUrl: z.string().url().optional().describe("Optional image URL to display with this option")
642
+ imageUrl: z2.string().url().optional().describe("Optional image URL to display with this option")
353
643
  }).describe("Schema for individual options in choice-based questions");
354
- var nestedOptionSchema = z.lazy(
355
- () => z.object({
356
- id: z.string().describe("Unique identifier for this nested option (system time milliseconds)"),
357
- value: z.string().min(1).max(100).describe("The internal value used for this nested option"),
358
- label: z.string().min(1).max(200).describe("The display text shown for this nested option"),
359
- describe: z.string().max(500).optional().describe("LLM tool call description for this nested option context"),
360
- imageUrl: z.string().url().optional().describe("Optional image URL for this nested option"),
361
- hint: z.string().max(500).optional().describe(
644
+ var nestedOptionSchema = z2.lazy(
645
+ () => z2.object({
646
+ id: z2.string().describe("Unique identifier for this nested option (system time milliseconds)"),
647
+ value: z2.string().min(1).max(100).describe("The internal value used for this nested option"),
648
+ label: z2.string().min(1).max(200).describe("The display text shown for this nested option"),
649
+ describe: z2.string().max(500).optional().describe("LLM tool call description for this nested option context"),
650
+ imageUrl: z2.string().url().optional().describe("Optional image URL for this nested option"),
651
+ hint: z2.string().max(500).optional().describe(
362
652
  "Optional hint text to help users understand this nested option"
363
653
  ),
364
- children: z.array(nestedOptionSchema).optional().default([]).describe("Array of child options for hierarchical structure")
654
+ children: z2.array(nestedOptionSchema).optional().default([]).describe("Array of child options for hierarchical structure")
365
655
  }).describe("Schema for nested options with hierarchical structure support")
366
656
  );
367
657
  var multipleChoiceSingleQuestionSchema = questionSchema.extend({
368
- type: z.literal("single_choice").describe("Must be exactly 'single_choice'"),
658
+ type: z2.literal("single_choice").describe("Must be exactly 'single_choice'"),
369
659
  displayStyle: multipleChoiceDisplayStyleSchema.optional().describe("Visual style for displaying options"),
370
- allowOther: z.boolean().optional().default(false).describe('Whether to allow a custom "other" option'),
371
- otherTextConfig: z.object({
372
- minChars: z.number().int().min(0).optional().describe("Minimum number of characters required for the other text"),
373
- maxChars: z.number().int().min(1).optional().describe("Maximum number of characters allowed for the other text"),
374
- placeholder: z.string().max(200).optional().describe("Placeholder text for the other text input")
660
+ allowOther: z2.boolean().optional().default(false).describe('Whether to allow a custom "other" option'),
661
+ otherTextConfig: z2.object({
662
+ minChars: z2.number().int().min(0).optional().describe("Minimum number of characters required for the other text"),
663
+ maxChars: z2.number().int().min(1).optional().describe("Maximum number of characters allowed for the other text"),
664
+ placeholder: z2.string().max(200).optional().describe("Placeholder text for the other text input")
375
665
  }).optional().describe('Configuration for the custom "other" text input'),
376
- randomizeOptions: z.boolean().optional().default(false).describe("Whether to randomize the order of options"),
377
- options: z.array(questionOptionSchema).min(1).max(50).describe("Array of options for user selection (1-50 options)")
666
+ randomizeOptions: z2.boolean().optional().default(false).describe("Whether to randomize the order of options"),
667
+ options: z2.array(questionOptionSchema).min(1).max(50).describe("Array of options for user selection (1-50 options)")
378
668
  }).describe("Schema for single-choice multiple selection questions");
379
669
  var multipleChoiceMultipleQuestionSchema = questionSchema.extend({
380
- type: z.literal("multiple_choice_multiple").describe("Must be exactly 'multiple_choice_multiple'"),
670
+ type: z2.literal("multiple_choice_multiple").describe("Must be exactly 'multiple_choice_multiple'"),
381
671
  displayStyle: multipleChoiceMultipleDisplayStyleSchema.optional().describe("Visual style for displaying multiple options"),
382
- allowOther: z.boolean().optional().default(false).describe('Whether to allow a custom "other" option'),
383
- otherTextConfig: z.object({
384
- minChars: z.number().int().min(0).optional().describe("Minimum number of characters required for the other text"),
385
- maxChars: z.number().int().min(1).optional().describe("Maximum number of characters allowed for the other text"),
386
- placeholder: z.string().max(200).optional().describe("Placeholder text for the other text input")
672
+ allowOther: z2.boolean().optional().default(false).describe('Whether to allow a custom "other" option'),
673
+ otherTextConfig: z2.object({
674
+ minChars: z2.number().int().min(0).optional().describe("Minimum number of characters required for the other text"),
675
+ maxChars: z2.number().int().min(1).optional().describe("Maximum number of characters allowed for the other text"),
676
+ placeholder: z2.string().max(200).optional().describe("Placeholder text for the other text input")
387
677
  }).optional().describe('Configuration for the custom "other" text input'),
388
- minSelections: z.number().int().min(0).optional().describe("Minimum number of options that must be selected"),
389
- maxSelections: z.number().int().min(1).optional().describe("Maximum number of options that can be selected"),
390
- randomizeOptions: z.boolean().optional().default(false).describe("Whether to randomize the order of options"),
391
- options: z.array(questionOptionSchema).min(1).max(50).describe("Array of options for user selection (1-50 options)")
678
+ minSelections: z2.number().int().min(0).optional().describe("Minimum number of options that must be selected"),
679
+ maxSelections: z2.number().int().min(1).optional().describe("Maximum number of options that can be selected"),
680
+ randomizeOptions: z2.boolean().optional().default(false).describe("Whether to randomize the order of options"),
681
+ options: z2.array(questionOptionSchema).min(1).max(50).describe("Array of options for user selection (1-50 options)")
392
682
  }).refine(
393
683
  (data) => {
394
684
  if (data.minSelections !== void 0 && data.maxSelections !== void 0) {
@@ -405,13 +695,13 @@ var multipleChoiceMultipleQuestionSchema = questionSchema.extend({
405
695
  "Schema for multiple-choice questions allowing multiple selections"
406
696
  );
407
697
  var npsQuestionSchema = questionSchema.extend({
408
- type: z.literal("nps").describe("Must be exactly 'nps'"),
409
- min: z.literal(0).describe("NPS always starts at 0"),
410
- max: z.literal(10).describe("NPS always ends at 10"),
411
- minLabel: z.string().max(100).optional().describe("Label for the minimum NPS value (0)"),
412
- maxLabel: z.string().max(100).optional().describe("Label for the maximum NPS value (10)"),
413
- scaleLabels: z.record(z.string().regex(/^\d+$/), z.string().max(50)).optional().describe("Custom labels for specific NPS values (0-10)"),
414
- prepopulatedValue: z.number().int().min(0).max(10).optional().describe("Default value to pre-select (0-10)")
698
+ type: z2.literal("nps").describe("Must be exactly 'nps'"),
699
+ min: z2.literal(0).describe("NPS always starts at 0"),
700
+ max: z2.literal(10).describe("NPS always ends at 10"),
701
+ minLabel: z2.string().max(100).optional().describe("Label for the minimum NPS value (0)"),
702
+ maxLabel: z2.string().max(100).optional().describe("Label for the maximum NPS value (10)"),
703
+ scaleLabels: z2.record(z2.string().regex(/^\d+$/), z2.string().max(50)).optional().describe("Custom labels for specific NPS values (0-10)"),
704
+ prepopulatedValue: z2.number().int().min(0).max(10).optional().describe("Default value to pre-select (0-10)")
415
705
  }).refine(
416
706
  (data) => {
417
707
  if (data.scaleLabels) {
@@ -429,16 +719,16 @@ var npsQuestionSchema = questionSchema.extend({
429
719
  }
430
720
  ).describe("Schema for Net Promoter Score questions with 0-10 scale");
431
721
  var shortAnswerQuestionSchema = questionSchema.extend({
432
- type: z.literal("short_answer").describe("Must be exactly 'short_answer'"),
433
- maxCharacters: z.number().int().min(1).max(1e4).optional().describe("Maximum number of characters allowed"),
434
- minCharacters: z.number().int().min(0).optional().describe("Minimum number of characters required"),
435
- placeholder: z.string().max(200).optional().describe("Placeholder text shown in the input field"),
436
- enableRegexValidation: z.boolean().optional().default(false).describe("Whether to enable regex pattern validation"),
437
- regexPattern: z.string().optional().describe("Regular expression pattern for validation"),
438
- enableEnhanceWithAi: z.boolean().optional().default(false).describe("Whether to enable AI enhancement features"),
439
- promptTemplate: z.string().max(2e3).optional().describe("Template for AI enhancement prompts"),
440
- maxTokenAllowed: z.number().int().min(1).max(1e4).optional().describe("Maximum tokens allowed for AI processing"),
441
- minCharactersToEnhance: z.number().int().min(1).optional().describe("Minimum characters needed to trigger AI enhancement")
722
+ type: z2.literal("short_answer").describe("Must be exactly 'short_answer'"),
723
+ maxCharacters: z2.number().int().min(1).max(1e4).optional().describe("Maximum number of characters allowed"),
724
+ minCharacters: z2.number().int().min(0).optional().describe("Minimum number of characters required"),
725
+ placeholder: z2.string().max(200).optional().describe("Placeholder text shown in the input field"),
726
+ enableRegexValidation: z2.boolean().optional().default(false).describe("Whether to enable regex pattern validation"),
727
+ regexPattern: z2.string().optional().describe("Regular expression pattern for validation"),
728
+ enableEnhanceWithAi: z2.boolean().optional().default(false).describe("Whether to enable AI enhancement features"),
729
+ promptTemplate: z2.string().max(2e3).optional().describe("Template for AI enhancement prompts"),
730
+ maxTokenAllowed: z2.number().int().min(1).max(1e4).optional().describe("Maximum tokens allowed for AI processing"),
731
+ minCharactersToEnhance: z2.number().int().min(1).optional().describe("Minimum characters needed to trigger AI enhancement")
442
732
  }).refine(
443
733
  (data) => {
444
734
  if (data.minCharacters !== void 0 && data.maxCharacters !== void 0) {
@@ -474,19 +764,19 @@ var shortAnswerQuestionSchema = questionSchema.extend({
474
764
  }
475
765
  ).describe("Schema for short answer questions with optional AI enhancement");
476
766
  var longAnswerQuestionSchema = questionSchema.extend({
477
- type: z.literal("long_text").describe("Must be exactly 'long_text'"),
478
- maxCharacters: z.number().int().min(1).max(5e4).optional().describe(
767
+ type: z2.literal("long_text").describe("Must be exactly 'long_text'"),
768
+ maxCharacters: z2.number().int().min(1).max(5e4).optional().describe(
479
769
  "Maximum number of characters allowed (higher limit for long text)"
480
770
  ),
481
- minCharacters: z.number().int().min(0).optional().describe("Minimum number of characters required"),
482
- rows: z.number().int().min(1).max(20).optional().describe("Number of textarea rows to display (1-20)"),
483
- placeholder: z.string().max(500).optional().describe("Placeholder text for the textarea (longer for long text)"),
484
- enableEnhanceWithAi: z.boolean().optional().default(false).describe("Whether to enable AI enhancement features"),
485
- promptTemplate: z.string().max(2e3).optional().describe("Template for AI enhancement prompts"),
486
- maxTokenAllowed: z.number().int().min(1).max(25e3).optional().describe(
771
+ minCharacters: z2.number().int().min(0).optional().describe("Minimum number of characters required"),
772
+ rows: z2.number().int().min(1).max(20).optional().describe("Number of textarea rows to display (1-20)"),
773
+ placeholder: z2.string().max(500).optional().describe("Placeholder text for the textarea (longer for long text)"),
774
+ enableEnhanceWithAi: z2.boolean().optional().default(false).describe("Whether to enable AI enhancement features"),
775
+ promptTemplate: z2.string().max(2e3).optional().describe("Template for AI enhancement prompts"),
776
+ maxTokenAllowed: z2.number().int().min(1).max(25e3).optional().describe(
487
777
  "Maximum tokens allowed for AI processing (higher for long text)"
488
778
  ),
489
- minCharactersToEnhance: z.number().int().min(1).optional().describe("Minimum characters needed to trigger AI enhancement")
779
+ minCharactersToEnhance: z2.number().int().min(1).optional().describe("Minimum characters needed to trigger AI enhancement")
490
780
  }).refine(
491
781
  (data) => {
492
782
  if (data.minCharacters !== void 0 && data.maxCharacters !== void 0) {
@@ -513,19 +803,19 @@ var longAnswerQuestionSchema = questionSchema.extend({
513
803
  "Schema for long answer questions with rich text support and AI enhancement"
514
804
  );
515
805
  var nestedDropdownQuestionSchema = questionSchema.extend({
516
- type: z.literal("nested_selection").describe("Must be exactly 'nested_selection'"),
517
- placeholder: z.string().max(200).optional().describe("Placeholder text for the nested dropdown"),
518
- options: z.array(nestedOptionSchema).min(1).max(100).describe(
806
+ type: z2.literal("nested_selection").describe("Must be exactly 'nested_selection'"),
807
+ placeholder: z2.string().max(200).optional().describe("Placeholder text for the nested dropdown"),
808
+ options: z2.array(nestedOptionSchema).min(1).max(100).describe(
519
809
  "Array of nested options for hierarchical selection (1-100 options)"
520
810
  ),
521
- displayStyle: z.literal("list").describe("Fixed display style for nested dropdowns"),
811
+ displayStyle: z2.literal("list").describe("Fixed display style for nested dropdowns"),
522
812
  choiceOrderOption: choiceOrderOptionSchema.optional().default("none").describe("How to order the nested choices"),
523
- preserveLastChoices: z.number().int().min(0).max(10).optional().describe("Number of choice levels to preserve (0-10)"),
524
- prepopulatedValue: z.string().max(1e3).optional().describe("Default value to pre-populate"),
525
- allowOther: z.boolean().optional().default(false).describe('Whether to allow custom "other" options'),
526
- otherColumnName: z.string().max(100).optional().describe('Column name for storing custom "other" values'),
527
- maxDepth: z.number().int().min(1).max(10).optional().describe("Maximum nesting depth allowed (1-10)"),
528
- cascadeLabels: z.boolean().optional().default(false).describe("Whether to cascade labels from parent options")
813
+ preserveLastChoices: z2.number().int().min(0).max(10).optional().describe("Number of choice levels to preserve (0-10)"),
814
+ prepopulatedValue: z2.string().max(1e3).optional().describe("Default value to pre-populate"),
815
+ allowOther: z2.boolean().optional().default(false).describe('Whether to allow custom "other" options'),
816
+ otherColumnName: z2.string().max(100).optional().describe('Column name for storing custom "other" values'),
817
+ maxDepth: z2.number().int().min(1).max(10).optional().describe("Maximum nesting depth allowed (1-10)"),
818
+ cascadeLabels: z2.boolean().optional().default(false).describe("Whether to cascade labels from parent options")
529
819
  }).refine(
530
820
  (data) => {
531
821
  if (data.allowOther && !data.otherColumnName) {
@@ -540,7 +830,7 @@ var nestedDropdownQuestionSchema = questionSchema.extend({
540
830
  ).describe(
541
831
  "Schema for nested dropdown questions with hierarchical option structure"
542
832
  );
543
- var combinedQuestionSchema = z.discriminatedUnion("type", [
833
+ var combinedQuestionSchema = z2.discriminatedUnion("type", [
544
834
  ratingQuestionSchema,
545
835
  annotationQuestionSchema,
546
836
  welcomeQuestionSchema,
@@ -560,47 +850,47 @@ var combinedQuestionSchema = z.discriminatedUnion("type", [
560
850
  ]);
561
851
 
562
852
  // src/schemas/fields/answer-schema.ts
563
- import { z as z2 } from "zod";
564
- var AnnotationMarkerSchema = z2.object({
565
- markerNo: z2.string(),
566
- timeline: z2.string(),
567
- comment: z2.string()
853
+ import { z as z3 } from "zod";
854
+ var AnnotationMarkerSchema = z3.object({
855
+ markerNo: z3.string(),
856
+ timeline: z3.string(),
857
+ comment: z3.string()
568
858
  });
569
- var AnnotationSchema = z2.object({
570
- fileType: z2.string(),
571
- fileName: z2.string(),
572
- markers: z2.array(AnnotationMarkerSchema)
859
+ var AnnotationSchema = z3.object({
860
+ fileType: z3.string(),
861
+ fileName: z3.string(),
862
+ markers: z3.array(AnnotationMarkerSchema)
573
863
  });
574
- var AnswerItemSchema = z2.object({
575
- nps: z2.number().optional().describe("Net Promoter Score value (e.g., 0-10)"),
576
- nestedSelection: z2.array(z2.string()).optional().describe("Array of selected nested option IDs"),
577
- longText: z2.string().optional().describe("Long text answer, e.g., paragraph or essay"),
578
- shortAnswer: z2.string().optional().describe("Short text answer, e.g., single sentence or word"),
579
- singleChoice: z2.string().optional().describe(
864
+ var AnswerItemSchema = z3.object({
865
+ nps: z3.number().optional().describe("Net Promoter Score value (e.g., 0-10)"),
866
+ nestedSelection: z3.array(z3.string()).optional().describe("Array of selected nested option IDs"),
867
+ longText: z3.string().optional().describe("Long text answer, e.g., paragraph or essay"),
868
+ shortAnswer: z3.string().optional().describe("Short text answer, e.g., single sentence or word"),
869
+ singleChoice: z3.string().optional().describe(
580
870
  "single selected option ID (for single choice questions)"
581
871
  ),
582
- rating: z2.number().optional().describe("Star rating value (e.g., 1-5)"),
583
- yesNo: z2.boolean().optional().describe("Yes/no answer for yes_no questions (true = Yes, false = No)"),
584
- multipleChoiceMultiple: z2.array(z2.string()).optional().describe("Array of selected option IDs for multiple choice questions"),
585
- singleChoiceOther: z2.string().optional().describe(
872
+ rating: z3.number().optional().describe("Star rating value (e.g., 1-5)"),
873
+ yesNo: z3.boolean().optional().describe("Yes/no answer for yes_no questions (true = Yes, false = No)"),
874
+ multipleChoiceMultiple: z3.array(z3.string()).optional().describe("Array of selected option IDs for multiple choice questions"),
875
+ singleChoiceOther: z3.string().optional().describe(
586
876
  'Free-text "other" answer for single choice questions when allowOther is enabled'
587
877
  ),
588
- multipleChoiceOther: z2.string().optional().describe(
878
+ multipleChoiceOther: z3.string().optional().describe(
589
879
  'Free-text "other" answer for multiple choice questions when allowOther is enabled'
590
880
  ),
591
881
  annotation: AnnotationSchema.optional().describe(
592
882
  "Annotation object containing file and marker details"
593
883
  ),
594
- ratingMatrix: z2.record(z2.string(), z2.union([z2.number(), z2.string()])).optional().describe(
884
+ ratingMatrix: z3.record(z3.string(), z3.union([z3.number(), z3.string()])).optional().describe(
595
885
  "Rating matrix answers keyed by statement value (export key), value is the selected scale value (number for likert/numerical, string for custom)"
596
886
  ),
597
- matrixSingleChoice: z2.record(z2.string(), z2.string()).optional().describe(
887
+ matrixSingleChoice: z3.record(z3.string(), z3.string()).optional().describe(
598
888
  "Matrix single-choice answers keyed by row value (export key), map value is the selected column option value"
599
889
  ),
600
- matrixMultipleChoice: z2.record(z2.string(), z2.array(z2.string())).optional().describe(
890
+ matrixMultipleChoice: z3.record(z3.string(), z3.array(z3.string())).optional().describe(
601
891
  "Matrix multiple-choice answers keyed by row value (export key), map value is array of selected column option values"
602
892
  ),
603
- others: z2.string().optional().describe(
893
+ others: z3.string().optional().describe(
604
894
  "For multiple choice questions and single choice questions, this is the value of the other option"
605
895
  )
606
896
  }).describe(
@@ -609,386 +899,27 @@ var AnswerItemSchema = z2.object({
609
899
  var AnswerSchema = AnswerItemSchema;
610
900
 
611
901
  // src/schemas/fields/form-schema.ts
612
- import { z as z3 } from "zod";
613
- var surveyTypeSchema = z3.enum(["R", "S"]).describe("Enumeration of feedback types: R=Recurring, O=One-time");
614
- var SurveyTypes = {
615
- RECURRING: "R",
616
- ONE_TIME: "S"
617
- };
618
- var yesNoSchema = z3.enum(["Y", "N"]).describe("Yes/No enumeration using Y/N values");
619
- var YesNoValues = {
620
- YES: "Y",
621
- NO: "N"
622
- };
623
- var recurringUnitSchema = z3.enum(["minutes", "hours", "days", "weeks", "months", "years"]).describe("Time units for recurring feedback schedules");
624
- var RecurringUnits = {
625
- MINUTES: "minutes",
626
- HOURS: "hours",
627
- DAYS: "days",
628
- WEEKS: "weeks",
629
- MONTHS: "months",
630
- YEARS: "years"
631
- };
632
- var frequencyAndSchedulingPropertiesSchema = z3.object({
633
- surveyType: surveyTypeSchema.describe("Type of feedback: R for recurring, O for one-time"),
634
- showOnce: yesNoSchema.describe("Whether the feedback should be shown only once per user"),
635
- stopWhenResponsesCount: z3.string().regex(/^\d+$/, "Must be a valid number string").describe("Stop feedback when this number of responses is reached (as string)"),
636
- recurringValue: z3.string().regex(/^\d+$/, "Must be a valid number string").describe("Value for recurring schedule (e.g., every 15 days)"),
637
- recurringUnit: recurringUnitSchema.describe("Time unit for recurring schedule"),
638
- startDate: z3.string().regex(
639
- /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(\+|\-)\d{2}:\d{2}$/,
640
- "Must be a valid ISO date string with timezone"
641
- ).describe("Start date and time for the feedback in ISO format"),
642
- stopDate: z3.string().regex(
643
- /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(\+|\-)\d{2}:\d{2}$/,
644
- "Must be a valid ISO date string with timezone"
645
- ).describe("Stop date and time for the feedback in ISO format")
646
- }).refine(
647
- (data) => {
648
- if (data.surveyType === "S" && data.showOnce === "N") {
649
- return false;
650
- }
651
- return true;
652
- },
653
- {
654
- message: "One-time feedback must have showOnce set to 'Y'",
655
- path: ["showOnce"]
656
- }
657
- ).refine(
658
- (data) => {
659
- if (data.surveyType === "R") {
660
- const value = parseInt(data.recurringValue);
661
- return value > 0;
662
- }
663
- return true;
664
- },
665
- {
666
- message: "Recurring feedback must have a positive recurring value",
667
- path: ["recurringValue"]
668
- }
669
- ).refine(
670
- (data) => {
671
- const start = new Date(data.startDate);
672
- const stop = new Date(data.stopDate);
673
- return stop > start;
674
- },
675
- {
676
- message: "Stop date must be after start date",
677
- path: ["stopDate"]
678
- }
679
- ).describe("Schema defining frequency and scheduling properties for feedback");
680
- var externalPublishingPropertiesSchema = z3.object({
681
- isShareable: z3.boolean().describe("Whether the feedback results can be shared externally"),
682
- isEmailShareable: z3.boolean().describe("Whether the feedback can be shared via email")
902
+ import { z as z4 } from "zod";
903
+ var externalPublishingPropertiesSchema = z4.object({
904
+ isShareable: z4.boolean().describe("Whether the feedback results can be shared externally"),
905
+ isEmailShareable: z4.boolean().describe("Whether the feedback can be shared via email")
683
906
  }).describe("Schema defining external publishing and sharing properties for feedback");
684
- var publicationStatusSchema = z3.enum(["P", "D", "A", "S"]).describe("Publication status: P=Published, D=Draft, A=Archived, S=Stopped");
907
+ var publicationStatusSchema = z4.enum(["P", "D", "A", "S"]).describe("Publication status: P=Published, D=Draft, A=Archived, S=Stopped");
685
908
  var PublicationStatuses = {
686
909
  PUBLISHED: "P",
687
910
  DRAFT: "D",
688
911
  ARCHIVED: "A",
689
912
  STOPPED: "S"
690
913
  };
691
- var feedbackConfigurationSchema = z3.object({
692
- formTitle: z3.string().describe("Title of the feedback form"),
693
- formDescription: z3.string().describe("Description of the feedback form"),
694
- // duration: durationSchema
695
- // .refine(
696
- // (data) => {
697
- // // Validate ISO format for this specific use case
698
- // const isoRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(\+|\-)\d{2}:\d{2}$/;
699
- // return isoRegex.test(data.from) && isoRegex.test(data.to);
700
- // },
701
- // {
702
- // message: "Duration dates must be in valid ISO format with timezone",
703
- // path: ["from"],
704
- // }
705
- // )
706
- // .refine(
707
- // (data) => {
708
- // // End date should be after start date
709
- // const start = new Date(data.from);
710
- // const end = new Date(data.to);
711
- // return end > start;
712
- // },
713
- // {
714
- // message: "End date must be after start date",
715
- // path: ["to"],
716
- // }
717
- // )
718
- // .describe("Duration period for the feedback"),
914
+ var feedbackConfigurationSchema = z4.object({
915
+ formTitle: z4.string().describe("Title of the feedback form"),
916
+ formDescription: z4.string().describe("Description of the feedback form"),
719
917
  isPublished: publicationStatusSchema.describe("Publication status of the feedback form")
720
918
  }).describe("Schema defining feedback configuration properties");
721
919
 
722
920
  // src/schemas/fields/form-properties-schema.ts
723
921
  import { z as z8 } from "zod";
724
922
 
725
- // src/schemas/fields/translations-schema.ts
726
- import { z as z4 } from "zod";
727
- var translationEntrySchema = z4.string().min(1).describe("Translated text content");
728
- var baseQuestionTranslationFieldsSchema = z4.object({
729
- title: translationEntrySchema.describe("Question title translation"),
730
- description: translationEntrySchema.optional().describe("Question description translation"),
731
- errorMessage: translationEntrySchema.optional().describe("Error message translation")
732
- });
733
- var BASE_QUESTION_TRANSLATION_KEYS = [
734
- "type",
735
- "title",
736
- "description",
737
- "errorMessage"
738
- ];
739
- var ratingQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
740
- type: z4.literal("rating").describe("Question type identifier"),
741
- minLabel: translationEntrySchema.optional().describe("Minimum rating label translation"),
742
- maxLabel: translationEntrySchema.optional().describe("Maximum rating label translation")
743
- }).describe("Translation schema for rating questions");
744
- var singleChoiceQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
745
- type: z4.literal("single_choice").describe("Question type identifier"),
746
- placeholder: translationEntrySchema.optional().describe("Input placeholder translation")
747
- }).catchall(translationEntrySchema).refine(
748
- (data) => {
749
- const additionalKeys = Object.keys(data).filter(
750
- (key) => ![...BASE_QUESTION_TRANSLATION_KEYS, "placeholder"].includes(key)
751
- );
752
- return additionalKeys.every((key) => /^option\..+\.(label|value)$/.test(key));
753
- },
754
- { message: "Additional keys must follow the pattern 'option.{id}.{label|value}'" }
755
- ).describe("Translation schema for single choice questions");
756
- var multipleChoiceQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
757
- type: z4.literal("multiple_choice_multiple").describe("Question type identifier"),
758
- placeholder: translationEntrySchema.optional().describe("Input placeholder translation")
759
- }).catchall(translationEntrySchema).refine(
760
- (data) => {
761
- const additionalKeys = Object.keys(data).filter(
762
- (key) => ![...BASE_QUESTION_TRANSLATION_KEYS, "placeholder"].includes(key)
763
- );
764
- return additionalKeys.every((key) => /^option\..+\.(label|value)$/.test(key));
765
- },
766
- { message: "Additional keys must follow the pattern 'option.{id}.{label|value}'" }
767
- ).describe("Translation schema for multiple choice questions");
768
- var npsQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
769
- type: z4.literal("nps").describe("Question type identifier"),
770
- minLabel: translationEntrySchema.optional().describe("Minimum NPS label (0) translation"),
771
- maxLabel: translationEntrySchema.optional().describe("Maximum NPS label (10) translation")
772
- }).catchall(translationEntrySchema).refine(
773
- (data) => {
774
- const additionalKeys = Object.keys(data).filter(
775
- (key) => ![...BASE_QUESTION_TRANSLATION_KEYS, "minLabel", "maxLabel"].includes(key)
776
- );
777
- return additionalKeys.every((key) => /^scaleLabel\.\d+$/.test(key));
778
- },
779
- { message: "Additional keys must follow the pattern 'scaleLabel.{number}'" }
780
- ).describe("Translation schema for NPS questions");
781
- var shortAnswerQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
782
- type: z4.literal("short_answer").describe("Question type identifier"),
783
- placeholder: translationEntrySchema.optional().describe("Input placeholder translation")
784
- }).describe("Translation schema for short answer questions");
785
- var longAnswerQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
786
- type: z4.literal("long_text").describe("Question type identifier"),
787
- placeholder: translationEntrySchema.optional().describe("Textarea placeholder translation")
788
- }).describe("Translation schema for long answer questions");
789
- var nestedSelectionQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
790
- type: z4.literal("nested_selection").describe("Question type identifier"),
791
- placeholder: translationEntrySchema.optional().describe("Dropdown placeholder translation")
792
- }).catchall(translationEntrySchema).refine(
793
- (data) => {
794
- const additionalKeys = Object.keys(data).filter(
795
- (key) => ![...BASE_QUESTION_TRANSLATION_KEYS, "placeholder"].includes(key)
796
- );
797
- return additionalKeys.every((key) => /^nestedOption\..+\.(label|hint)$/.test(key));
798
- },
799
- { message: "Additional keys must follow the pattern 'nestedOption.{id}.{label|hint}'" }
800
- ).describe("Translation schema for nested selection questions");
801
- var annotationQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
802
- type: z4.literal("annotation").describe("Question type identifier"),
803
- annotationText: translationEntrySchema.optional().describe("Annotation display text translation"),
804
- noAnnotationText: translationEntrySchema.optional().describe("No annotation display text translation")
805
- }).describe("Translation schema for annotation questions");
806
- var welcomeQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
807
- type: z4.literal("welcome").describe("Question type identifier"),
808
- buttonLabel: translationEntrySchema.optional().describe("Translated proceed/start button label")
809
- }).describe("Translation schema for welcome screen questions");
810
- var thankYouQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
811
- type: z4.literal("thank_you").describe("Question type identifier"),
812
- buttonLabel: translationEntrySchema.optional().describe(
813
- "Translated dismiss/done button label"
814
- )
815
- }).describe("Translation schema for thank you screen questions");
816
- var messagePanelQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
817
- type: z4.literal("message_panel").describe("Question type identifier"),
818
- buttonLabel: translationEntrySchema.optional().describe(
819
- "Translated continue/button label"
820
- )
821
- }).describe("Translation schema for message panel questions");
822
- var yesNoQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
823
- type: z4.literal("yes_no").describe("Question type identifier"),
824
- yesLabel: translationEntrySchema.optional().describe("Translated Yes label"),
825
- noLabel: translationEntrySchema.optional().describe("Translated No label")
826
- }).describe("Translation schema for yes/no questions");
827
- var ratingMatrixQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
828
- type: z4.literal("rating_matrix").describe("Question type identifier"),
829
- minLabel: translationEntrySchema.optional().describe(
830
- "Translated scale minimum end label (for likert and numerical kinds)"
831
- ),
832
- maxLabel: translationEntrySchema.optional().describe(
833
- "Translated scale maximum end label (for likert and numerical kinds)"
834
- )
835
- }).catchall(translationEntrySchema).refine(
836
- (data) => {
837
- const additionalKeys = Object.keys(data).filter(
838
- (key) => ![...BASE_QUESTION_TRANSLATION_KEYS, "minLabel", "maxLabel"].includes(
839
- key
840
- )
841
- );
842
- return additionalKeys.every(
843
- (key) => /^statement\..+\.label$/.test(key) || /^scalePoint\..+\.label$/.test(key)
844
- );
845
- },
846
- {
847
- message: "Additional keys must follow 'statement.{id}.label' or 'scalePoint.{id}.label'"
848
- }
849
- ).describe("Translation schema for rating matrix questions");
850
- var matrixSingleChoiceQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
851
- type: z4.literal("matrix_single_choice").describe("Question type identifier")
852
- }).catchall(translationEntrySchema).refine(
853
- (data) => {
854
- const additionalKeys = Object.keys(data).filter(
855
- (key) => !BASE_QUESTION_TRANSLATION_KEYS.includes(key)
856
- );
857
- return additionalKeys.every(
858
- (key) => /^row\..+\.label$/.test(key) || /^column\..+\.label$/.test(key)
859
- );
860
- },
861
- {
862
- message: "Additional keys must follow 'row.{id}.label' or 'column.{id}.label'"
863
- }
864
- ).describe("Translation schema for matrix single-choice questions");
865
- var matrixMultipleChoiceQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
866
- type: z4.literal("matrix_multiple_choice").describe("Question type identifier")
867
- }).catchall(translationEntrySchema).refine(
868
- (data) => {
869
- const additionalKeys = Object.keys(data).filter(
870
- (key) => !BASE_QUESTION_TRANSLATION_KEYS.includes(key)
871
- );
872
- return additionalKeys.every(
873
- (key) => /^row\..+\.label$/.test(key) || /^column\..+\.label$/.test(key)
874
- );
875
- },
876
- {
877
- message: "Additional keys must follow 'row.{id}.label' or 'column.{id}.label'"
878
- }
879
- ).describe("Translation schema for matrix multiple-choice questions");
880
- var questionTranslationSchema = z4.union([
881
- ratingQuestionTranslationSchema,
882
- singleChoiceQuestionTranslationSchema,
883
- multipleChoiceQuestionTranslationSchema,
884
- npsQuestionTranslationSchema,
885
- shortAnswerQuestionTranslationSchema,
886
- longAnswerQuestionTranslationSchema,
887
- nestedSelectionQuestionTranslationSchema,
888
- annotationQuestionTranslationSchema,
889
- welcomeQuestionTranslationSchema,
890
- thankYouQuestionTranslationSchema,
891
- messagePanelQuestionTranslationSchema,
892
- yesNoQuestionTranslationSchema,
893
- ratingMatrixQuestionTranslationSchema,
894
- matrixSingleChoiceQuestionTranslationSchema,
895
- matrixMultipleChoiceQuestionTranslationSchema
896
- ]).describe("Union of all question type translation schemas");
897
- var languageCodeSchema = z4.string().min(2).max(10).describe("Language code (e.g., 'en', 'es', 'hi')");
898
- var questionTranslationsByLanguageSchema = z4.record(languageCodeSchema, questionTranslationSchema).describe("Question translations keyed by language code");
899
- var questionCentricTranslationsSchema = z4.record(z4.string().uuid(), questionTranslationsByLanguageSchema).describe("Question-centric translations keyed by question ID, then by language code");
900
- var translationsSchema = questionCentricTranslationsSchema.describe("Question-centric translations at root level");
901
- var _TranslationProvider = class _TranslationProvider {
902
- constructor(translations, defaultLanguage = "en") {
903
- this.translations = translations;
904
- this.defaultLanguage = defaultLanguage;
905
- }
906
- /**
907
- * Get translations for a specific question in a specific language
908
- */
909
- getQuestionTranslations(questionId, languageCode) {
910
- const questionTranslations = this.translations[questionId];
911
- if (!questionTranslations) return null;
912
- let translation = questionTranslations[languageCode];
913
- if (!translation) {
914
- translation = questionTranslations[this.defaultLanguage];
915
- }
916
- return translation || null;
917
- }
918
- /**
919
- * Get a specific translation text by field path
920
- */
921
- getTranslationText(questionId, languageCode, fieldPath) {
922
- const questionTranslation = this.getQuestionTranslations(questionId, languageCode);
923
- if (!questionTranslation) return null;
924
- if (fieldPath in questionTranslation) {
925
- const value = questionTranslation[fieldPath];
926
- return typeof value === "string" ? value : null;
927
- }
928
- return null;
929
- }
930
- /**
931
- * Get all available languages for a specific question
932
- */
933
- getQuestionLanguages(questionId) {
934
- const questionTranslations = this.translations[questionId];
935
- if (!questionTranslations) return [];
936
- return Object.keys(questionTranslations);
937
- }
938
- /**
939
- * Get all available languages across all questions
940
- */
941
- getAvailableLanguages() {
942
- const allLanguages = /* @__PURE__ */ new Set();
943
- Object.values(this.translations).forEach((questionTranslations) => {
944
- Object.keys(questionTranslations).forEach((langCode) => {
945
- allLanguages.add(langCode);
946
- });
947
- });
948
- return Array.from(allLanguages);
949
- }
950
- /**
951
- * Check if a language is supported for a specific question
952
- */
953
- isLanguageSupportedForQuestion(questionId, languageCode) {
954
- const questionTranslations = this.translations[questionId];
955
- if (!questionTranslations) return false;
956
- return languageCode in questionTranslations;
957
- }
958
- /**
959
- * Check if a language is supported across all questions
960
- */
961
- isLanguageSupported(languageCode) {
962
- return this.getAvailableLanguages().includes(languageCode);
963
- }
964
- /**
965
- * Get the default language
966
- */
967
- getDefaultLanguage() {
968
- return this.defaultLanguage;
969
- }
970
- /**
971
- * Get all questions that have translations
972
- */
973
- getQuestionIds() {
974
- return Object.keys(this.translations);
975
- }
976
- /**
977
- * Get question type for a specific question
978
- */
979
- getQuestionType(questionId, languageCode) {
980
- const langCode = languageCode || this.defaultLanguage;
981
- const translation = this.getQuestionTranslations(questionId, langCode);
982
- return translation?.type || null;
983
- }
984
- };
985
- __name(_TranslationProvider, "TranslationProvider");
986
- var TranslationProvider = _TranslationProvider;
987
- function createTranslationProvider(translations, defaultLanguage = "en") {
988
- return new TranslationProvider(translations, defaultLanguage);
989
- }
990
- __name(createTranslationProvider, "createTranslationProvider");
991
-
992
923
  // src/schemas/fields/other-screen-schema.ts
993
924
  import { z as z5 } from "zod";
994
925
  var OtherFieldsSchema = z5.object({
@@ -1061,12 +992,10 @@ var featureSettingsSchema = z6.object({
1061
992
  progressBar: z6.boolean().describe("Whether to show a progress bar indicating completion status"),
1062
993
  showBranding: z6.boolean().describe("Whether to display branding elements on the widget"),
1063
994
  customPosition: z6.boolean().describe("Whether custom positioning is enabled"),
1064
- customIconPosition: z6.boolean().describe("Whether custom icon positioning is enabled"),
1065
995
  customCss: z6.string().optional().describe("Custom CSS link to apply for the feedback form"),
1066
996
  shareableMode: shareableModeSchema.optional().describe(
1067
997
  "Display mode for the shareable: light, dark, or system preference"
1068
998
  ),
1069
- allowMultipleQuestionsPerSection: z6.boolean().describe("Whether to allow multiple questions per section"),
1070
999
  rtl: z6.boolean().describe("Whether right-to-left text direction is enabled"),
1071
1000
  previousButton: previousButtonModeSchema.describe("Previous button visibility mode: never, always, or auto")
1072
1001
  }).describe("Feature settings controlling widget UI behavior and appearance");
@@ -1194,12 +1123,11 @@ var formPropertiesSchema = z8.object({
1194
1123
  selectedLanguages: LanguagesSchema.describe("Array of languages selected for this questionnaire"),
1195
1124
  translations: translationsSchema.describe("Multi-language translations for questions and form content")
1196
1125
  }).describe("Fields defining the questionnaire structure, questions, sections, selected languages, and translations"),
1197
- frequencyAndSchedulingProperties: frequencyAndSchedulingPropertiesSchema.describe("Properties controlling when and how often the feedback is shown"),
1198
1126
  externalPublishingProperties: externalPublishingPropertiesSchema.describe("Properties controlling external sharing and publishing of feedback results"),
1199
1127
  audienceTriggerProperties: audienceTriggerPropertiesSchema.describe("Properties defining audience targeting and trigger conditions for the feedback form"),
1200
1128
  otherConfigurationProperties: otherConfigurationPropertiesSchema.describe("Additional configuration properties including form display options and translations"),
1201
1129
  appearanceProperties: appearancePropertiesSchema.describe("Appearance configuration including themes, colors, and UI feature settings")
1202
- }).describe("Complete schema for all feedback-level properties including scheduling, publishing, audience targeting, configuration, and appearance");
1130
+ }).describe("Complete schema for all feedback-level properties including publishing, audience targeting, configuration, and appearance");
1203
1131
 
1204
1132
  // src/schemas/fields/other-properties-schema.ts
1205
1133
  import { z as z9 } from "zod";
@@ -1328,14 +1256,12 @@ var feedbackConfigurationItemSchema = z12.object({
1328
1256
  customPosition: z12.boolean().describe("Whether custom position is enabled"),
1329
1257
  customIconPosition: z12.boolean().describe("Whether custom icon position is enabled"),
1330
1258
  customCss: z12.string().nullable().optional().describe("Custom CSS link (optional)"),
1331
- allowMultipleQuestionsPerSection: z12.boolean().describe("Whether to allow multiple questions per section"),
1332
1259
  rtl: z12.boolean().describe("Whether right-to-left text direction is enabled"),
1333
1260
  previousButton: z12.enum(["never", "always", "auto"]).describe("Previous button visibility mode: never, always, or auto")
1334
1261
  }).describe("Feature settings for the feedback form"),
1335
1262
  selectedIconPosition: z12.string().describe("Selected position for the feedback icon"),
1336
1263
  selectedPosition: z12.string().describe("Selected position for the feedback form")
1337
- }).describe("Appearance properties for the feedback form"),
1338
- frequencyAndScheduling: frequencyAndSchedulingPropertiesSchema.optional().describe("Frequency and scheduling properties for the feedback (optional)")
1264
+ }).describe("Appearance properties for the feedback form")
1339
1265
  }).describe("Individual feedback configuration item in the list");
1340
1266
  var fetchFormConfigSchema = z12.object({
1341
1267
  feedbackConfigurationId: z12.string().uuid().describe("Unique identifier for the feedback configuration"),
@@ -1547,15 +1473,12 @@ export {
1547
1473
  RatingDisplayStyles,
1548
1474
  RatingMatrixDisplayStyles,
1549
1475
  RatingRepresentationSizes,
1550
- RecurringUnits,
1551
1476
  ShareableModes,
1552
- SurveyTypes,
1553
1477
  ThemeModes,
1554
1478
  TranslationProvider,
1555
1479
  ValidationRuleTypes,
1556
1480
  VisibilityConditionOperators,
1557
1481
  YesNoDisplayStyles,
1558
- YesNoValues,
1559
1482
  annotationQuestionSchema,
1560
1483
  annotationQuestionTranslationSchema,
1561
1484
  appPropsSchema,
@@ -1591,7 +1514,6 @@ export {
1591
1514
  formConfigSchema,
1592
1515
  formConfigurationResponseSchema,
1593
1516
  formPropertiesSchema,
1594
- frequencyAndSchedulingPropertiesSchema,
1595
1517
  longAnswerQuestionSchema,
1596
1518
  longAnswerQuestionTranslationSchema,
1597
1519
  masterPropertiesSchema,
@@ -1640,7 +1562,6 @@ export {
1640
1562
  ratingQuestionSchema,
1641
1563
  ratingQuestionTranslationSchema,
1642
1564
  ratingRepresentationSizeSchema,
1643
- recurringUnitSchema,
1644
1565
  refineTextDataSchema,
1645
1566
  refineTextParamsSchema,
1646
1567
  refineTextResponseSchema,
@@ -1652,7 +1573,6 @@ export {
1652
1573
  shortAnswerQuestionTranslationSchema,
1653
1574
  singleChoiceQuestionTranslationSchema,
1654
1575
  submitFeedbackSchema,
1655
- surveyTypeSchema,
1656
1576
  thankYouQuestionSchema,
1657
1577
  thankYouQuestionTranslationSchema,
1658
1578
  themeColorsSchema,
@@ -1676,7 +1596,6 @@ export {
1676
1596
  yesNoDisplayStyleSchema,
1677
1597
  yesNoQuestionSchema,
1678
1598
  yesNoQuestionTranslationSchema,
1679
- yesNoSchema,
1680
1599
  z15 as z
1681
1600
  };
1682
1601
  //# sourceMappingURL=index.js.map