@encatch/schema 1.0.1-beta.2 → 1.1.0-beta.10
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 +562 -608
- package/dist/esm/index.js.map +4 -4
- package/dist/types/index.d.ts +5 -5
- package/dist/types/schemas/api/fetch-feedback-schema.d.ts +320 -135
- package/dist/types/schemas/api/submit-feedback-schema.d.ts +6 -0
- package/dist/types/schemas/fields/answer-schema.d.ts +2 -0
- package/dist/types/schemas/fields/app-props-schema.d.ts +174 -58
- package/dist/types/schemas/fields/field-schema.d.ts +296 -80
- package/dist/types/schemas/fields/form-properties-schema.d.ts +184 -101
- package/dist/types/schemas/fields/form-schema.d.ts +0 -58
- package/dist/types/schemas/fields/other-screen-schema.d.ts +0 -5
- package/dist/types/schemas/fields/theme-schema.d.ts +20 -22
- package/dist/types/schemas/fields/translations-schema.d.ts +121 -16
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -2,8 +2,282 @@ 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
|
|
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
|
+
nextButtonLabel: translationEntrySchema.max(50).optional().describe("Next button label translation when advancing past this question")
|
|
15
|
+
});
|
|
16
|
+
var BASE_QUESTION_TRANSLATION_KEYS = [
|
|
17
|
+
"type",
|
|
18
|
+
"title",
|
|
19
|
+
"description",
|
|
20
|
+
"errorMessage",
|
|
21
|
+
"nextButtonLabel"
|
|
22
|
+
];
|
|
23
|
+
var ratingQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
|
|
24
|
+
type: z.literal("rating").describe("Question type identifier"),
|
|
25
|
+
minLabel: translationEntrySchema.optional().describe("Minimum rating label translation"),
|
|
26
|
+
maxLabel: translationEntrySchema.optional().describe("Maximum rating label translation")
|
|
27
|
+
}).describe("Translation schema for rating questions");
|
|
28
|
+
var singleChoiceQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
|
|
29
|
+
type: z.literal("single_choice").describe("Question type identifier"),
|
|
30
|
+
placeholder: translationEntrySchema.optional().describe("Input placeholder translation")
|
|
31
|
+
}).catchall(translationEntrySchema).refine(
|
|
32
|
+
(data) => {
|
|
33
|
+
const additionalKeys = Object.keys(data).filter(
|
|
34
|
+
(key) => ![...BASE_QUESTION_TRANSLATION_KEYS, "placeholder"].includes(key)
|
|
35
|
+
);
|
|
36
|
+
return additionalKeys.every((key) => /^option\..+\.(label|value)$/.test(key));
|
|
37
|
+
},
|
|
38
|
+
{ message: "Additional keys must follow the pattern 'option.{id}.{label|value}'" }
|
|
39
|
+
).describe("Translation schema for single choice questions");
|
|
40
|
+
var multipleChoiceQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
|
|
41
|
+
type: z.literal("multiple_choice_multiple").describe("Question type identifier"),
|
|
42
|
+
placeholder: translationEntrySchema.optional().describe("Input placeholder translation")
|
|
43
|
+
}).catchall(translationEntrySchema).refine(
|
|
44
|
+
(data) => {
|
|
45
|
+
const additionalKeys = Object.keys(data).filter(
|
|
46
|
+
(key) => ![...BASE_QUESTION_TRANSLATION_KEYS, "placeholder"].includes(key)
|
|
47
|
+
);
|
|
48
|
+
return additionalKeys.every((key) => /^option\..+\.(label|value)$/.test(key));
|
|
49
|
+
},
|
|
50
|
+
{ message: "Additional keys must follow the pattern 'option.{id}.{label|value}'" }
|
|
51
|
+
).describe("Translation schema for multiple choice questions");
|
|
52
|
+
var npsQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
|
|
53
|
+
type: z.literal("nps").describe("Question type identifier"),
|
|
54
|
+
minLabel: translationEntrySchema.optional().describe("Minimum NPS label (0) translation"),
|
|
55
|
+
maxLabel: translationEntrySchema.optional().describe("Maximum NPS label (10) translation")
|
|
56
|
+
}).catchall(translationEntrySchema).refine(
|
|
57
|
+
(data) => {
|
|
58
|
+
const additionalKeys = Object.keys(data).filter(
|
|
59
|
+
(key) => ![...BASE_QUESTION_TRANSLATION_KEYS, "minLabel", "maxLabel"].includes(key)
|
|
60
|
+
);
|
|
61
|
+
return additionalKeys.every((key) => /^scaleLabel\.\d+$/.test(key));
|
|
62
|
+
},
|
|
63
|
+
{ message: "Additional keys must follow the pattern 'scaleLabel.{number}'" }
|
|
64
|
+
).describe("Translation schema for NPS questions");
|
|
65
|
+
var shortAnswerQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
|
|
66
|
+
type: z.literal("short_answer").describe("Question type identifier"),
|
|
67
|
+
placeholder: translationEntrySchema.optional().describe("Input placeholder translation")
|
|
68
|
+
}).describe("Translation schema for short answer questions");
|
|
69
|
+
var longAnswerQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
|
|
70
|
+
type: z.literal("long_text").describe("Question type identifier"),
|
|
71
|
+
placeholder: translationEntrySchema.optional().describe("Textarea placeholder translation")
|
|
72
|
+
}).describe("Translation schema for long answer questions");
|
|
73
|
+
var nestedSelectionQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
|
|
74
|
+
type: z.literal("nested_selection").describe("Question type identifier"),
|
|
75
|
+
placeholder: translationEntrySchema.optional().describe("Dropdown placeholder translation")
|
|
76
|
+
}).catchall(translationEntrySchema).refine(
|
|
77
|
+
(data) => {
|
|
78
|
+
const additionalKeys = Object.keys(data).filter(
|
|
79
|
+
(key) => ![...BASE_QUESTION_TRANSLATION_KEYS, "placeholder"].includes(key)
|
|
80
|
+
);
|
|
81
|
+
return additionalKeys.every((key) => /^nestedOption\..+\.(label|hint)$/.test(key));
|
|
82
|
+
},
|
|
83
|
+
{ message: "Additional keys must follow the pattern 'nestedOption.{id}.{label|hint}'" }
|
|
84
|
+
).describe("Translation schema for nested selection questions");
|
|
85
|
+
var annotationQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
|
|
86
|
+
type: z.literal("annotation").describe("Question type identifier"),
|
|
87
|
+
annotationText: translationEntrySchema.optional().describe("Annotation display text translation"),
|
|
88
|
+
noAnnotationText: translationEntrySchema.optional().describe("No annotation display text translation")
|
|
89
|
+
}).describe("Translation schema for annotation questions");
|
|
90
|
+
var welcomeQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
|
|
91
|
+
type: z.literal("welcome").describe("Question type identifier")
|
|
92
|
+
}).describe("Translation schema for welcome screen questions");
|
|
93
|
+
var thankYouQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
|
|
94
|
+
type: z.literal("thank_you").describe("Question type identifier")
|
|
95
|
+
}).describe("Translation schema for thank you screen questions");
|
|
96
|
+
var messagePanelQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
|
|
97
|
+
type: z.literal("message_panel").describe("Question type identifier")
|
|
98
|
+
}).describe("Translation schema for message panel questions");
|
|
99
|
+
var consentQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
|
|
100
|
+
type: z.literal("consent").describe("Question type identifier")
|
|
101
|
+
}).describe("Translation schema for consent questions; description carries the translated checkbox label (markdown supported)");
|
|
102
|
+
var yesNoQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
|
|
103
|
+
type: z.literal("yes_no").describe("Question type identifier"),
|
|
104
|
+
yesLabel: translationEntrySchema.optional().describe("Translated Yes label"),
|
|
105
|
+
noLabel: translationEntrySchema.optional().describe("Translated No label")
|
|
106
|
+
}).describe("Translation schema for yes/no questions");
|
|
107
|
+
var ratingMatrixQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
|
|
108
|
+
type: z.literal("rating_matrix").describe("Question type identifier"),
|
|
109
|
+
minLabel: translationEntrySchema.optional().describe(
|
|
110
|
+
"Translated scale minimum end label (for likert and numerical kinds)"
|
|
111
|
+
),
|
|
112
|
+
maxLabel: translationEntrySchema.optional().describe(
|
|
113
|
+
"Translated scale maximum end label (for likert and numerical kinds)"
|
|
114
|
+
)
|
|
115
|
+
}).catchall(translationEntrySchema).refine(
|
|
116
|
+
(data) => {
|
|
117
|
+
const additionalKeys = Object.keys(data).filter(
|
|
118
|
+
(key) => ![...BASE_QUESTION_TRANSLATION_KEYS, "minLabel", "maxLabel"].includes(
|
|
119
|
+
key
|
|
120
|
+
)
|
|
121
|
+
);
|
|
122
|
+
return additionalKeys.every(
|
|
123
|
+
(key) => /^statement\..+\.label$/.test(key) || /^scalePoint\..+\.label$/.test(key)
|
|
124
|
+
);
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
message: "Additional keys must follow 'statement.{id}.label' or 'scalePoint.{id}.label'"
|
|
128
|
+
}
|
|
129
|
+
).describe("Translation schema for rating matrix questions");
|
|
130
|
+
var matrixSingleChoiceQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
|
|
131
|
+
type: z.literal("matrix_single_choice").describe("Question type identifier")
|
|
132
|
+
}).catchall(translationEntrySchema).refine(
|
|
133
|
+
(data) => {
|
|
134
|
+
const additionalKeys = Object.keys(data).filter(
|
|
135
|
+
(key) => !BASE_QUESTION_TRANSLATION_KEYS.includes(key)
|
|
136
|
+
);
|
|
137
|
+
return additionalKeys.every(
|
|
138
|
+
(key) => /^row\..+\.label$/.test(key) || /^column\..+\.label$/.test(key)
|
|
139
|
+
);
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
message: "Additional keys must follow 'row.{id}.label' or 'column.{id}.label'"
|
|
143
|
+
}
|
|
144
|
+
).describe("Translation schema for matrix single-choice questions");
|
|
145
|
+
var matrixMultipleChoiceQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
|
|
146
|
+
type: z.literal("matrix_multiple_choice").describe("Question type identifier")
|
|
147
|
+
}).catchall(translationEntrySchema).refine(
|
|
148
|
+
(data) => {
|
|
149
|
+
const additionalKeys = Object.keys(data).filter(
|
|
150
|
+
(key) => !BASE_QUESTION_TRANSLATION_KEYS.includes(key)
|
|
151
|
+
);
|
|
152
|
+
return additionalKeys.every(
|
|
153
|
+
(key) => /^row\..+\.label$/.test(key) || /^column\..+\.label$/.test(key)
|
|
154
|
+
);
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
message: "Additional keys must follow 'row.{id}.label' or 'column.{id}.label'"
|
|
158
|
+
}
|
|
159
|
+
).describe("Translation schema for matrix multiple-choice questions");
|
|
160
|
+
var questionTranslationSchema = z.union([
|
|
161
|
+
ratingQuestionTranslationSchema,
|
|
162
|
+
singleChoiceQuestionTranslationSchema,
|
|
163
|
+
multipleChoiceQuestionTranslationSchema,
|
|
164
|
+
npsQuestionTranslationSchema,
|
|
165
|
+
shortAnswerQuestionTranslationSchema,
|
|
166
|
+
longAnswerQuestionTranslationSchema,
|
|
167
|
+
nestedSelectionQuestionTranslationSchema,
|
|
168
|
+
annotationQuestionTranslationSchema,
|
|
169
|
+
welcomeQuestionTranslationSchema,
|
|
170
|
+
thankYouQuestionTranslationSchema,
|
|
171
|
+
messagePanelQuestionTranslationSchema,
|
|
172
|
+
yesNoQuestionTranslationSchema,
|
|
173
|
+
consentQuestionTranslationSchema,
|
|
174
|
+
ratingMatrixQuestionTranslationSchema,
|
|
175
|
+
matrixSingleChoiceQuestionTranslationSchema,
|
|
176
|
+
matrixMultipleChoiceQuestionTranslationSchema
|
|
177
|
+
]).describe("Union of all question type translation schemas");
|
|
178
|
+
var languageCodeSchema = z.string().min(2).max(10).describe("Language code (e.g., 'en', 'es', 'hi')");
|
|
179
|
+
var sectionTranslationSchema = z.object({
|
|
180
|
+
title: translationEntrySchema.max(200).describe("Section title translation"),
|
|
181
|
+
description: translationEntrySchema.max(1e3).optional().describe("Section description translation"),
|
|
182
|
+
nextButtonLabel: translationEntrySchema.max(50).optional().describe("Next button label translation for this section")
|
|
183
|
+
}).describe("Translation payload for a section in a single language");
|
|
184
|
+
var sectionTranslationsByLanguageSchema = z.record(languageCodeSchema, sectionTranslationSchema).describe("Section translations keyed by language code");
|
|
185
|
+
var questionTranslationsByLanguageSchema = z.record(languageCodeSchema, questionTranslationSchema).describe("Question translations keyed by language code");
|
|
186
|
+
var questionCentricTranslationsSchema = z.record(z.string().uuid(), questionTranslationsByLanguageSchema).describe("Question-centric translations keyed by question ID, then by language code");
|
|
187
|
+
var translationsSchema = questionCentricTranslationsSchema.describe("Question-centric translations at root level");
|
|
188
|
+
var _TranslationProvider = class _TranslationProvider {
|
|
189
|
+
constructor(translations, defaultLanguage = "en") {
|
|
190
|
+
this.translations = translations;
|
|
191
|
+
this.defaultLanguage = defaultLanguage;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Get translations for a specific question in a specific language
|
|
195
|
+
*/
|
|
196
|
+
getQuestionTranslations(questionId, languageCode) {
|
|
197
|
+
const questionTranslations = this.translations[questionId];
|
|
198
|
+
if (!questionTranslations) return null;
|
|
199
|
+
let translation = questionTranslations[languageCode];
|
|
200
|
+
if (!translation) {
|
|
201
|
+
translation = questionTranslations[this.defaultLanguage];
|
|
202
|
+
}
|
|
203
|
+
return translation || null;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Get a specific translation text by field path
|
|
207
|
+
*/
|
|
208
|
+
getTranslationText(questionId, languageCode, fieldPath) {
|
|
209
|
+
const questionTranslation = this.getQuestionTranslations(questionId, languageCode);
|
|
210
|
+
if (!questionTranslation) return null;
|
|
211
|
+
if (fieldPath in questionTranslation) {
|
|
212
|
+
const value = questionTranslation[fieldPath];
|
|
213
|
+
return typeof value === "string" ? value : null;
|
|
214
|
+
}
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Get all available languages for a specific question
|
|
219
|
+
*/
|
|
220
|
+
getQuestionLanguages(questionId) {
|
|
221
|
+
const questionTranslations = this.translations[questionId];
|
|
222
|
+
if (!questionTranslations) return [];
|
|
223
|
+
return Object.keys(questionTranslations);
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Get all available languages across all questions
|
|
227
|
+
*/
|
|
228
|
+
getAvailableLanguages() {
|
|
229
|
+
const allLanguages = /* @__PURE__ */ new Set();
|
|
230
|
+
Object.values(this.translations).forEach((questionTranslations) => {
|
|
231
|
+
Object.keys(questionTranslations).forEach((langCode) => {
|
|
232
|
+
allLanguages.add(langCode);
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
return Array.from(allLanguages);
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Check if a language is supported for a specific question
|
|
239
|
+
*/
|
|
240
|
+
isLanguageSupportedForQuestion(questionId, languageCode) {
|
|
241
|
+
const questionTranslations = this.translations[questionId];
|
|
242
|
+
if (!questionTranslations) return false;
|
|
243
|
+
return languageCode in questionTranslations;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Check if a language is supported across all questions
|
|
247
|
+
*/
|
|
248
|
+
isLanguageSupported(languageCode) {
|
|
249
|
+
return this.getAvailableLanguages().includes(languageCode);
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Get the default language
|
|
253
|
+
*/
|
|
254
|
+
getDefaultLanguage() {
|
|
255
|
+
return this.defaultLanguage;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Get all questions that have translations
|
|
259
|
+
*/
|
|
260
|
+
getQuestionIds() {
|
|
261
|
+
return Object.keys(this.translations);
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Get question type for a specific question
|
|
265
|
+
*/
|
|
266
|
+
getQuestionType(questionId, languageCode) {
|
|
267
|
+
const langCode = languageCode || this.defaultLanguage;
|
|
268
|
+
const translation = this.getQuestionTranslations(questionId, langCode);
|
|
269
|
+
return translation?.type || null;
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
__name(_TranslationProvider, "TranslationProvider");
|
|
273
|
+
var TranslationProvider = _TranslationProvider;
|
|
274
|
+
function createTranslationProvider(translations, defaultLanguage = "en") {
|
|
275
|
+
return new TranslationProvider(translations, defaultLanguage);
|
|
276
|
+
}
|
|
277
|
+
__name(createTranslationProvider, "createTranslationProvider");
|
|
278
|
+
|
|
279
|
+
// src/schemas/fields/field-schema.ts
|
|
280
|
+
var questionTypeSchema = z2.enum([
|
|
7
281
|
"rating",
|
|
8
282
|
"single_choice",
|
|
9
283
|
"nps",
|
|
@@ -19,7 +293,8 @@ var questionTypeSchema = z.enum([
|
|
|
19
293
|
"rating_matrix",
|
|
20
294
|
"matrix_single_choice",
|
|
21
295
|
"matrix_multiple_choice",
|
|
22
|
-
"exit_form"
|
|
296
|
+
"exit_form",
|
|
297
|
+
"consent"
|
|
23
298
|
]).describe("Enumeration of all supported question types for form fields");
|
|
24
299
|
var QuestionTypes = {
|
|
25
300
|
RATING: "rating",
|
|
@@ -37,9 +312,10 @@ var QuestionTypes = {
|
|
|
37
312
|
RATING_MATRIX: "rating_matrix",
|
|
38
313
|
MATRIX_SINGLE_CHOICE: "matrix_single_choice",
|
|
39
314
|
MATRIX_MULTIPLE_CHOICE: "matrix_multiple_choice",
|
|
40
|
-
EXIT_FORM: "exit_form"
|
|
315
|
+
EXIT_FORM: "exit_form",
|
|
316
|
+
CONSENT: "consent"
|
|
41
317
|
};
|
|
42
|
-
var validationRuleTypeSchema =
|
|
318
|
+
var validationRuleTypeSchema = z2.enum([
|
|
43
319
|
"required",
|
|
44
320
|
"min",
|
|
45
321
|
"max",
|
|
@@ -61,13 +337,13 @@ var ValidationRuleTypes = {
|
|
|
61
337
|
URL: "url",
|
|
62
338
|
CUSTOM: "custom"
|
|
63
339
|
};
|
|
64
|
-
var validationRuleSchema =
|
|
340
|
+
var validationRuleSchema = z2.object({
|
|
65
341
|
type: validationRuleTypeSchema.describe("Type of validation rule to apply"),
|
|
66
|
-
value:
|
|
67
|
-
message:
|
|
68
|
-
describe:
|
|
342
|
+
value: z2.union([z2.string(), z2.number(), z2.boolean()]).optional().describe("Value for the validation rule (string, number, or boolean)"),
|
|
343
|
+
message: z2.string().optional().describe("Custom error message when validation fails"),
|
|
344
|
+
describe: z2.string().max(500).optional().describe("LLM tool call description for this validation rule")
|
|
69
345
|
}).describe("Schema defining validation rules for question responses");
|
|
70
|
-
var visibilityConditionOperatorSchema =
|
|
346
|
+
var visibilityConditionOperatorSchema = z2.enum([
|
|
71
347
|
"equals",
|
|
72
348
|
"not_equals",
|
|
73
349
|
"contains",
|
|
@@ -87,27 +363,37 @@ var VisibilityConditionOperators = {
|
|
|
87
363
|
IS_EMPTY: "is_empty",
|
|
88
364
|
IS_NOT_EMPTY: "is_not_empty"
|
|
89
365
|
};
|
|
90
|
-
var visibilityConditionSchema =
|
|
91
|
-
field:
|
|
366
|
+
var visibilityConditionSchema = z2.object({
|
|
367
|
+
field: z2.string().describe("ID of the field to check against"),
|
|
92
368
|
operator: visibilityConditionOperatorSchema.describe("Comparison operator for the condition"),
|
|
93
|
-
value:
|
|
94
|
-
describe:
|
|
369
|
+
value: z2.union([z2.string(), z2.number(), z2.boolean()]).optional().describe("Value to compare against (string, number, or boolean)"),
|
|
370
|
+
describe: z2.string().max(500).optional().describe("LLM tool call description for this visibility condition")
|
|
95
371
|
}).describe(
|
|
96
372
|
"Schema defining conditions that control when questions are visible"
|
|
97
373
|
);
|
|
98
|
-
var sectionSchema =
|
|
99
|
-
id:
|
|
100
|
-
title:
|
|
101
|
-
|
|
374
|
+
var sectionSchema = z2.object({
|
|
375
|
+
id: z2.string().describe("Unique identifier for the section"),
|
|
376
|
+
title: z2.string().min(1).max(200).describe("Display title for the section"),
|
|
377
|
+
description: z2.string().max(1e3).optional().describe("Optional detailed description or help text for the section"),
|
|
378
|
+
showTitle: z2.boolean().default(true).describe("Whether to show the section title in the UI"),
|
|
379
|
+
showDescription: z2.boolean().default(true).describe("Whether to show the section description in the UI"),
|
|
380
|
+
nextButtonLabel: z2.string().min(1).max(50).optional().describe("Label for the next button when navigating from this section"),
|
|
381
|
+
translations: sectionTranslationsByLanguageSchema.optional().describe(
|
|
382
|
+
"Per-language section copy (title, optional description and nextButtonLabel), keyed by language code"
|
|
383
|
+
),
|
|
384
|
+
inAppSingleQuestion: z2.boolean().default(false).describe(
|
|
385
|
+
"When true, the native app shows one question at a time within this section"
|
|
386
|
+
),
|
|
387
|
+
questionIds: z2.array(z2.string()).min(1).describe("Array of question IDs that belong to this section")
|
|
102
388
|
}).describe("Schema defining sections that organize questions into logical groups");
|
|
103
|
-
var questionStatusSchema =
|
|
389
|
+
var questionStatusSchema = z2.enum(["D", "P", "A", "S"]);
|
|
104
390
|
var QuestionStatuses = {
|
|
105
391
|
DRAFT: "D",
|
|
106
392
|
PUBLISHED: "P",
|
|
107
393
|
ARCHIVED: "A",
|
|
108
394
|
SUSPENDED: "S"
|
|
109
395
|
};
|
|
110
|
-
var ratingDisplayStyleSchema =
|
|
396
|
+
var ratingDisplayStyleSchema = z2.enum([
|
|
111
397
|
"star",
|
|
112
398
|
"heart",
|
|
113
399
|
"thumbs-up",
|
|
@@ -123,7 +409,7 @@ var RatingDisplayStyles = {
|
|
|
123
409
|
EMOJI: "emoji",
|
|
124
410
|
EMOJI_EXP: "emoji_exp"
|
|
125
411
|
};
|
|
126
|
-
var ratingRepresentationSizeSchema =
|
|
412
|
+
var ratingRepresentationSizeSchema = z2.enum([
|
|
127
413
|
"small",
|
|
128
414
|
"medium",
|
|
129
415
|
"large"
|
|
@@ -133,7 +419,7 @@ var RatingRepresentationSizes = {
|
|
|
133
419
|
MEDIUM: "medium",
|
|
134
420
|
LARGE: "large"
|
|
135
421
|
};
|
|
136
|
-
var multipleChoiceDisplayStyleSchema =
|
|
422
|
+
var multipleChoiceDisplayStyleSchema = z2.enum([
|
|
137
423
|
"radio",
|
|
138
424
|
"list",
|
|
139
425
|
"chip",
|
|
@@ -145,7 +431,7 @@ var MultipleChoiceDisplayStyles = {
|
|
|
145
431
|
CHIP: "chip",
|
|
146
432
|
DROPDOWN: "dropdown"
|
|
147
433
|
};
|
|
148
|
-
var multipleChoiceMultipleDisplayStyleSchema =
|
|
434
|
+
var multipleChoiceMultipleDisplayStyleSchema = z2.enum([
|
|
149
435
|
"checkbox",
|
|
150
436
|
"list",
|
|
151
437
|
"chip"
|
|
@@ -155,12 +441,12 @@ var MultipleChoiceMultipleDisplayStyles = {
|
|
|
155
441
|
LIST: "list",
|
|
156
442
|
CHIP: "chip"
|
|
157
443
|
};
|
|
158
|
-
var yesNoDisplayStyleSchema =
|
|
444
|
+
var yesNoDisplayStyleSchema = z2.enum(["horizontal", "vertical"]);
|
|
159
445
|
var YesNoDisplayStyles = {
|
|
160
446
|
HORIZONTAL: "horizontal",
|
|
161
447
|
VERTICAL: "vertical"
|
|
162
448
|
};
|
|
163
|
-
var choiceOrderOptionSchema =
|
|
449
|
+
var choiceOrderOptionSchema = z2.enum([
|
|
164
450
|
"randomize",
|
|
165
451
|
"flip",
|
|
166
452
|
"rotate",
|
|
@@ -174,83 +460,93 @@ var ChoiceOrderOptions = {
|
|
|
174
460
|
ASCENDING: "ascending",
|
|
175
461
|
NONE: "none"
|
|
176
462
|
};
|
|
177
|
-
var questionSchema =
|
|
178
|
-
id:
|
|
463
|
+
var questionSchema = z2.object({
|
|
464
|
+
id: z2.string().describe("Unique identifier for the question"),
|
|
465
|
+
slug: z2.string().min(1).max(128).optional().describe(
|
|
466
|
+
"Optional stable identifier for the question (e.g. URLs, analytics, or integrations)"
|
|
467
|
+
),
|
|
179
468
|
type: questionTypeSchema.describe(
|
|
180
469
|
"The type of question (rating, single_choice, etc.)"
|
|
181
470
|
),
|
|
182
|
-
title:
|
|
183
|
-
description:
|
|
184
|
-
describe:
|
|
471
|
+
title: z2.string().min(1).max(200).describe("The main title/question text displayed to users"),
|
|
472
|
+
description: z2.string().max(1e3).optional().describe("Optional detailed description or help text"),
|
|
473
|
+
describe: z2.string().max(2e3).optional().describe(
|
|
185
474
|
"LLM tool call description for better AI understanding and context"
|
|
186
475
|
),
|
|
187
|
-
required:
|
|
188
|
-
isHidden:
|
|
189
|
-
errorMessage:
|
|
190
|
-
validations:
|
|
191
|
-
visibility:
|
|
192
|
-
sectionId:
|
|
476
|
+
required: z2.boolean().default(false).describe("Whether this question must be answered"),
|
|
477
|
+
isHidden: z2.boolean().default(false).describe("When true, the question is hidden from the form UI"),
|
|
478
|
+
errorMessage: z2.string().max(500).optional().describe("Custom error message when validation fails"),
|
|
479
|
+
validations: z2.array(validationRuleSchema).optional().default([]).describe("Array of validation rules to apply"),
|
|
480
|
+
visibility: z2.array(visibilityConditionSchema).optional().default([]).describe("Conditions that control when this question is shown"),
|
|
481
|
+
sectionId: z2.string().optional().describe("ID of the section this question belongs to"),
|
|
193
482
|
status: questionStatusSchema.describe(
|
|
194
483
|
"Current status of the question (Draft, Published, etc.)"
|
|
195
484
|
),
|
|
196
|
-
textAlign:
|
|
485
|
+
textAlign: z2.enum(["left", "center", "justify"]).optional().default("left").describe(
|
|
486
|
+
"Text alignment for the question title and description; `justify` is intended for consent questions (full-width justified consent body markdown)"
|
|
487
|
+
),
|
|
488
|
+
nextButtonLabel: z2.string().min(1).max(50).optional().describe(
|
|
489
|
+
"Label for the next button when advancing past this question (overrides section or form defaults when set)"
|
|
490
|
+
)
|
|
197
491
|
}).describe("Base schema for all question types with common properties");
|
|
198
492
|
var ratingQuestionSchema = questionSchema.extend({
|
|
199
|
-
type:
|
|
200
|
-
showLabels:
|
|
201
|
-
minLabel:
|
|
202
|
-
maxLabel:
|
|
493
|
+
type: z2.literal("rating").describe("Must be exactly 'rating'"),
|
|
494
|
+
showLabels: z2.boolean().optional().describe("Whether to show min/max labels"),
|
|
495
|
+
minLabel: z2.string().max(100).optional().describe("Label for the minimum rating value"),
|
|
496
|
+
maxLabel: z2.string().max(100).optional().describe("Label for the maximum rating value"),
|
|
203
497
|
displayStyle: ratingDisplayStyleSchema.optional().describe("Visual style for rating display"),
|
|
204
|
-
numberOfRatings:
|
|
498
|
+
numberOfRatings: z2.number().int().min(1).max(10).describe("Number of rating options (1-10)"),
|
|
205
499
|
representationSize: ratingRepresentationSizeSchema.optional().describe("Size of rating visual elements"),
|
|
206
|
-
color:
|
|
500
|
+
color: z2.string().regex(/^#[0-9A-F]{6}$/i, "Must be a valid hex color").optional().describe("Hex color for rating elements")
|
|
207
501
|
}).describe("Schema for rating questions with customizable display options");
|
|
208
502
|
var annotationQuestionSchema = questionSchema.extend({
|
|
209
|
-
type:
|
|
210
|
-
annotationText:
|
|
211
|
-
noAnnotationText:
|
|
503
|
+
type: z2.literal("annotation").describe("Must be exactly 'annotation'"),
|
|
504
|
+
annotationText: z2.string().max(1e3).optional().describe("Text to display when annotation is provided"),
|
|
505
|
+
noAnnotationText: z2.string().max(500).optional().describe("Text to display when no annotation is provided")
|
|
212
506
|
}).describe(
|
|
213
507
|
"Schema for annotation questions that provide additional context or instructions"
|
|
214
508
|
);
|
|
215
509
|
var welcomeQuestionSchema = questionSchema.extend({
|
|
216
|
-
type:
|
|
217
|
-
title:
|
|
218
|
-
description:
|
|
219
|
-
|
|
220
|
-
imageUrl: z.string().url().optional().describe("Optional image URL displayed on the welcome screen")
|
|
510
|
+
type: z2.literal("welcome").describe("Must be exactly 'welcome'"),
|
|
511
|
+
title: z2.string().min(1).max(200).describe("The main heading displayed on the welcome screen"),
|
|
512
|
+
description: z2.string().max(1e3).optional().describe("Optional sub-text body shown below the heading"),
|
|
513
|
+
imageUrl: z2.string().url().optional().describe("Optional image URL displayed on the welcome screen")
|
|
221
514
|
}).describe("Schema for a welcome screen displayed at the start or inline within a form");
|
|
222
515
|
var thankYouQuestionSchema = questionSchema.extend({
|
|
223
|
-
type:
|
|
224
|
-
title:
|
|
225
|
-
description:
|
|
516
|
+
type: z2.literal("thank_you").describe("Must be exactly 'thank_you'"),
|
|
517
|
+
title: z2.string().min(1).max(200).describe("The main heading displayed on the thank you screen"),
|
|
518
|
+
description: z2.string().max(1e3).optional().describe(
|
|
226
519
|
"Optional thank you body text; rendered as Markdown where the form supports it"
|
|
227
520
|
),
|
|
228
|
-
|
|
229
|
-
imageUrl: z.string().url().optional().describe("Optional image URL displayed on the thank you screen")
|
|
521
|
+
imageUrl: z2.string().url().optional().describe("Optional image URL displayed on the thank you screen")
|
|
230
522
|
}).describe(
|
|
231
523
|
"Schema for a thank you screen shown at the end or inline within a form"
|
|
232
524
|
);
|
|
233
525
|
var messagePanelQuestionSchema = questionSchema.extend({
|
|
234
|
-
type:
|
|
235
|
-
title:
|
|
236
|
-
description:
|
|
237
|
-
|
|
238
|
-
imageUrl: z.string().url().optional().describe("Optional image URL displayed on the message panel")
|
|
526
|
+
type: z2.literal("message_panel").describe("Must be exactly 'message_panel'"),
|
|
527
|
+
title: z2.string().min(1).max(200).describe("The main heading displayed on the message panel"),
|
|
528
|
+
description: z2.string().max(1e3).optional().describe("Optional body text shown below the heading"),
|
|
529
|
+
imageUrl: z2.string().url().optional().describe("Optional image URL displayed on the message panel")
|
|
239
530
|
}).describe(
|
|
240
531
|
"Schema for an inline message panel (informational); distinct from welcome for UI semantics and analytics"
|
|
241
532
|
);
|
|
242
533
|
var exitFormQuestionSchema = questionSchema.extend({
|
|
243
|
-
type:
|
|
534
|
+
type: z2.literal("exit_form").describe("Must be exactly 'exit_form'")
|
|
244
535
|
}).describe(
|
|
245
536
|
"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
537
|
);
|
|
247
538
|
var yesNoQuestionSchema = questionSchema.extend({
|
|
248
|
-
type:
|
|
249
|
-
yesLabel:
|
|
250
|
-
noLabel:
|
|
539
|
+
type: z2.literal("yes_no").describe("Must be exactly 'yes_no'"),
|
|
540
|
+
yesLabel: z2.string().min(1).max(50).optional().describe("Label for the Yes option (defaults to 'Yes' in the UI if omitted)"),
|
|
541
|
+
noLabel: z2.string().min(1).max(50).optional().describe("Label for the No option (defaults to 'No' in the UI if omitted)"),
|
|
251
542
|
displayStyle: yesNoDisplayStyleSchema.optional().describe("Layout for the Yes/No controls (horizontal row or vertical stack)")
|
|
252
543
|
}).describe("Schema for yes/no questions with optional custom labels and layout");
|
|
253
|
-
var
|
|
544
|
+
var consentQuestionSchema = questionSchema.extend({
|
|
545
|
+
type: z2.literal("consent").describe("Must be exactly 'consent'")
|
|
546
|
+
}).describe(
|
|
547
|
+
"Schema for a single-checkbox consent question; use description (rendered as markdown) for the checkbox label text and any policy/terms links; answer is boolean (true = checked)"
|
|
548
|
+
);
|
|
549
|
+
var ratingMatrixDisplayStyleSchema = z2.enum([
|
|
254
550
|
"radio",
|
|
255
551
|
"star",
|
|
256
552
|
"emoji",
|
|
@@ -262,72 +558,72 @@ var RatingMatrixDisplayStyles = {
|
|
|
262
558
|
EMOJI: "emoji",
|
|
263
559
|
BUTTON: "button"
|
|
264
560
|
};
|
|
265
|
-
var ratingMatrixStatementSchema =
|
|
266
|
-
id:
|
|
267
|
-
value:
|
|
268
|
-
label:
|
|
269
|
-
describe:
|
|
561
|
+
var ratingMatrixStatementSchema = z2.object({
|
|
562
|
+
id: z2.string().describe("Unique identifier for this statement (system time milliseconds)"),
|
|
563
|
+
value: z2.string().min(1).max(100).describe("Internal value / export key for this statement"),
|
|
564
|
+
label: z2.string().min(1).max(200).describe("Display text shown to users for this statement"),
|
|
565
|
+
describe: z2.string().max(500).optional().describe("LLM tool call description for this statement")
|
|
270
566
|
}).describe("Schema for an individual statement (row) in a rating matrix");
|
|
271
|
-
var ratingMatrixScalePointSchema =
|
|
272
|
-
id:
|
|
273
|
-
value:
|
|
274
|
-
label:
|
|
275
|
-
describe:
|
|
567
|
+
var ratingMatrixScalePointSchema = z2.object({
|
|
568
|
+
id: z2.string().describe("Unique identifier for this scale point"),
|
|
569
|
+
value: z2.union([z2.number(), z2.string()]).describe("Stored response value for this scale point (number or string)"),
|
|
570
|
+
label: z2.string().min(1).max(200).describe("Display label shown for this scale point"),
|
|
571
|
+
describe: z2.string().max(500).optional().describe("LLM tool call description for this scale point")
|
|
276
572
|
}).describe("Schema for a single point on a custom rating scale");
|
|
277
|
-
var ratingMatrixScaleSchema =
|
|
573
|
+
var ratingMatrixScaleSchema = z2.discriminatedUnion("kind", [
|
|
278
574
|
// Likert: symmetric ordinal scale -2…+2, explicit scale points with labels
|
|
279
|
-
|
|
280
|
-
kind:
|
|
281
|
-
scalePoints:
|
|
575
|
+
z2.object({
|
|
576
|
+
kind: z2.literal("likert").describe("Symmetric ordinal scale (-2 to +2)"),
|
|
577
|
+
scalePoints: z2.array(ratingMatrixScalePointSchema).min(2).max(10).describe("Scale points with display labels for each column")
|
|
282
578
|
}),
|
|
283
579
|
// Numerical: 1…N points where N is 2, 3, 4, or 5, explicit scale points with labels
|
|
284
|
-
|
|
285
|
-
kind:
|
|
286
|
-
scalePoints:
|
|
287
|
-
pointCount:
|
|
580
|
+
z2.object({
|
|
581
|
+
kind: z2.literal("numerical").describe("Numerical scale from 1 to N"),
|
|
582
|
+
scalePoints: z2.array(ratingMatrixScalePointSchema).min(2).max(10).describe("Scale points with display labels for each column"),
|
|
583
|
+
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
584
|
}),
|
|
289
585
|
// Custom: consumer defines each point's value and label
|
|
290
|
-
|
|
291
|
-
kind:
|
|
292
|
-
scalePoints:
|
|
586
|
+
z2.object({
|
|
587
|
+
kind: z2.literal("custom").describe("Custom scale with user-defined points and values"),
|
|
588
|
+
scalePoints: z2.array(ratingMatrixScalePointSchema).min(2).max(10).describe("Scale points with display labels for each column")
|
|
293
589
|
})
|
|
294
590
|
]).describe("Scale configuration for rating matrix questions");
|
|
295
591
|
var ratingMatrixQuestionSchema = questionSchema.extend({
|
|
296
|
-
type:
|
|
297
|
-
statements:
|
|
592
|
+
type: z2.literal("rating_matrix").describe("Must be exactly 'rating_matrix'"),
|
|
593
|
+
statements: z2.array(ratingMatrixStatementSchema).min(1).max(10).describe("Statements (rows) users will rate on the shared scale (1-10)"),
|
|
298
594
|
scale: ratingMatrixScaleSchema.describe("Scale configuration shared across all statement rows"),
|
|
299
595
|
displayStyle: ratingMatrixDisplayStyleSchema.optional().describe(
|
|
300
596
|
"Visual representation of scale points per row (radio buttons, stars, emoji, or buttons)"
|
|
301
597
|
),
|
|
302
|
-
randomizeStatements:
|
|
598
|
+
randomizeStatements: z2.boolean().optional().default(false).describe("Whether to randomize the order of statements")
|
|
303
599
|
}).describe("Schema for rating matrix questions with multiple statements on a shared scale");
|
|
304
|
-
var matrixRowSchema =
|
|
305
|
-
id:
|
|
306
|
-
value:
|
|
307
|
-
label:
|
|
308
|
-
describe:
|
|
600
|
+
var matrixRowSchema = z2.object({
|
|
601
|
+
id: z2.string().describe("Unique identifier for this row (system time milliseconds)"),
|
|
602
|
+
value: z2.string().min(1).max(100).describe("Internal value / export key for this row"),
|
|
603
|
+
label: z2.string().min(1).max(200).describe("Display text shown to users for this row"),
|
|
604
|
+
describe: z2.string().max(500).optional().describe("LLM tool call description for this row")
|
|
309
605
|
}).describe("Schema for an individual row in a matrix choice question");
|
|
310
|
-
var matrixColumnSchema =
|
|
311
|
-
id:
|
|
312
|
-
value:
|
|
313
|
-
label:
|
|
314
|
-
describe:
|
|
606
|
+
var matrixColumnSchema = z2.object({
|
|
607
|
+
id: z2.string().describe("Unique identifier for this column (system time milliseconds)"),
|
|
608
|
+
value: z2.string().min(1).max(100).describe("Internal value / export key for this column"),
|
|
609
|
+
label: z2.string().min(1).max(200).describe("Display label shown for this column"),
|
|
610
|
+
describe: z2.string().max(500).optional().describe("LLM tool call description for this column")
|
|
315
611
|
}).describe("Schema for an individual column in a matrix choice question");
|
|
316
612
|
var matrixSingleChoiceQuestionSchema = questionSchema.extend({
|
|
317
|
-
type:
|
|
318
|
-
rows:
|
|
319
|
-
columns:
|
|
320
|
-
randomizeRows:
|
|
321
|
-
randomizeColumns:
|
|
613
|
+
type: z2.literal("matrix_single_choice").describe("Must be exactly 'matrix_single_choice'"),
|
|
614
|
+
rows: z2.array(matrixRowSchema).min(1).max(20).describe("Row items (1-20 rows)"),
|
|
615
|
+
columns: z2.array(matrixColumnSchema).min(2).max(10).describe("Column options shared across all rows (2-10 columns)"),
|
|
616
|
+
randomizeRows: z2.boolean().optional().default(false).describe("Whether to randomize the order of rows"),
|
|
617
|
+
randomizeColumns: z2.boolean().optional().default(false).describe("Whether to randomize the order of columns")
|
|
322
618
|
}).describe("Schema for matrix single-choice questions where one column is selected per row");
|
|
323
619
|
var matrixMultipleChoiceQuestionSchema = questionSchema.extend({
|
|
324
|
-
type:
|
|
325
|
-
rows:
|
|
326
|
-
columns:
|
|
327
|
-
minSelectionsPerRow:
|
|
328
|
-
maxSelectionsPerRow:
|
|
329
|
-
randomizeRows:
|
|
330
|
-
randomizeColumns:
|
|
620
|
+
type: z2.literal("matrix_multiple_choice").describe("Must be exactly 'matrix_multiple_choice'"),
|
|
621
|
+
rows: z2.array(matrixRowSchema).min(1).max(20).describe("Row items (1-20 rows)"),
|
|
622
|
+
columns: z2.array(matrixColumnSchema).min(2).max(10).describe("Column options shared across all rows (2-10 columns)"),
|
|
623
|
+
minSelectionsPerRow: z2.number().int().min(0).optional().describe("Minimum number of columns a user must select per row"),
|
|
624
|
+
maxSelectionsPerRow: z2.number().int().min(1).optional().describe("Maximum number of columns a user can select per row"),
|
|
625
|
+
randomizeRows: z2.boolean().optional().default(false).describe("Whether to randomize the order of rows"),
|
|
626
|
+
randomizeColumns: z2.boolean().optional().default(false).describe("Whether to randomize the order of columns")
|
|
331
627
|
}).refine(
|
|
332
628
|
(data) => {
|
|
333
629
|
if (data.minSelectionsPerRow !== void 0 && data.maxSelectionsPerRow !== void 0) {
|
|
@@ -342,53 +638,53 @@ var matrixMultipleChoiceQuestionSchema = questionSchema.extend({
|
|
|
342
638
|
).describe(
|
|
343
639
|
"Schema for matrix multiple-choice questions where one or more columns can be selected per row"
|
|
344
640
|
);
|
|
345
|
-
var questionOptionSchema =
|
|
346
|
-
id:
|
|
347
|
-
value:
|
|
348
|
-
label:
|
|
349
|
-
describe:
|
|
641
|
+
var questionOptionSchema = z2.object({
|
|
642
|
+
id: z2.string().describe("Unique identifier for this option (system time milliseconds)"),
|
|
643
|
+
value: z2.string().min(1).max(100).describe("The internal value used for this option"),
|
|
644
|
+
label: z2.string().min(1).max(200).describe("The display text shown to users for this option"),
|
|
645
|
+
describe: z2.string().max(500).optional().describe(
|
|
350
646
|
"LLM tool call description providing context about this option"
|
|
351
647
|
),
|
|
352
|
-
imageUrl:
|
|
648
|
+
imageUrl: z2.string().url().optional().describe("Optional image URL to display with this option")
|
|
353
649
|
}).describe("Schema for individual options in choice-based questions");
|
|
354
|
-
var nestedOptionSchema =
|
|
355
|
-
() =>
|
|
356
|
-
id:
|
|
357
|
-
value:
|
|
358
|
-
label:
|
|
359
|
-
describe:
|
|
360
|
-
imageUrl:
|
|
361
|
-
hint:
|
|
650
|
+
var nestedOptionSchema = z2.lazy(
|
|
651
|
+
() => z2.object({
|
|
652
|
+
id: z2.string().describe("Unique identifier for this nested option (system time milliseconds)"),
|
|
653
|
+
value: z2.string().min(1).max(100).describe("The internal value used for this nested option"),
|
|
654
|
+
label: z2.string().min(1).max(200).describe("The display text shown for this nested option"),
|
|
655
|
+
describe: z2.string().max(500).optional().describe("LLM tool call description for this nested option context"),
|
|
656
|
+
imageUrl: z2.string().url().optional().describe("Optional image URL for this nested option"),
|
|
657
|
+
hint: z2.string().max(500).optional().describe(
|
|
362
658
|
"Optional hint text to help users understand this nested option"
|
|
363
659
|
),
|
|
364
|
-
children:
|
|
660
|
+
children: z2.array(nestedOptionSchema).optional().default([]).describe("Array of child options for hierarchical structure")
|
|
365
661
|
}).describe("Schema for nested options with hierarchical structure support")
|
|
366
662
|
);
|
|
367
663
|
var multipleChoiceSingleQuestionSchema = questionSchema.extend({
|
|
368
|
-
type:
|
|
664
|
+
type: z2.literal("single_choice").describe("Must be exactly 'single_choice'"),
|
|
369
665
|
displayStyle: multipleChoiceDisplayStyleSchema.optional().describe("Visual style for displaying options"),
|
|
370
|
-
allowOther:
|
|
371
|
-
otherTextConfig:
|
|
372
|
-
minChars:
|
|
373
|
-
maxChars:
|
|
374
|
-
placeholder:
|
|
666
|
+
allowOther: z2.boolean().optional().default(false).describe('Whether to allow a custom "other" option'),
|
|
667
|
+
otherTextConfig: z2.object({
|
|
668
|
+
minChars: z2.number().int().min(0).optional().describe("Minimum number of characters required for the other text"),
|
|
669
|
+
maxChars: z2.number().int().min(1).optional().describe("Maximum number of characters allowed for the other text"),
|
|
670
|
+
placeholder: z2.string().max(200).optional().describe("Placeholder text for the other text input")
|
|
375
671
|
}).optional().describe('Configuration for the custom "other" text input'),
|
|
376
|
-
randomizeOptions:
|
|
377
|
-
options:
|
|
672
|
+
randomizeOptions: z2.boolean().optional().default(false).describe("Whether to randomize the order of options"),
|
|
673
|
+
options: z2.array(questionOptionSchema).min(1).max(50).describe("Array of options for user selection (1-50 options)")
|
|
378
674
|
}).describe("Schema for single-choice multiple selection questions");
|
|
379
675
|
var multipleChoiceMultipleQuestionSchema = questionSchema.extend({
|
|
380
|
-
type:
|
|
676
|
+
type: z2.literal("multiple_choice_multiple").describe("Must be exactly 'multiple_choice_multiple'"),
|
|
381
677
|
displayStyle: multipleChoiceMultipleDisplayStyleSchema.optional().describe("Visual style for displaying multiple options"),
|
|
382
|
-
allowOther:
|
|
383
|
-
otherTextConfig:
|
|
384
|
-
minChars:
|
|
385
|
-
maxChars:
|
|
386
|
-
placeholder:
|
|
678
|
+
allowOther: z2.boolean().optional().default(false).describe('Whether to allow a custom "other" option'),
|
|
679
|
+
otherTextConfig: z2.object({
|
|
680
|
+
minChars: z2.number().int().min(0).optional().describe("Minimum number of characters required for the other text"),
|
|
681
|
+
maxChars: z2.number().int().min(1).optional().describe("Maximum number of characters allowed for the other text"),
|
|
682
|
+
placeholder: z2.string().max(200).optional().describe("Placeholder text for the other text input")
|
|
387
683
|
}).optional().describe('Configuration for the custom "other" text input'),
|
|
388
|
-
minSelections:
|
|
389
|
-
maxSelections:
|
|
390
|
-
randomizeOptions:
|
|
391
|
-
options:
|
|
684
|
+
minSelections: z2.number().int().min(0).optional().describe("Minimum number of options that must be selected"),
|
|
685
|
+
maxSelections: z2.number().int().min(1).optional().describe("Maximum number of options that can be selected"),
|
|
686
|
+
randomizeOptions: z2.boolean().optional().default(false).describe("Whether to randomize the order of options"),
|
|
687
|
+
options: z2.array(questionOptionSchema).min(1).max(50).describe("Array of options for user selection (1-50 options)")
|
|
392
688
|
}).refine(
|
|
393
689
|
(data) => {
|
|
394
690
|
if (data.minSelections !== void 0 && data.maxSelections !== void 0) {
|
|
@@ -405,13 +701,13 @@ var multipleChoiceMultipleQuestionSchema = questionSchema.extend({
|
|
|
405
701
|
"Schema for multiple-choice questions allowing multiple selections"
|
|
406
702
|
);
|
|
407
703
|
var npsQuestionSchema = questionSchema.extend({
|
|
408
|
-
type:
|
|
409
|
-
min:
|
|
410
|
-
max:
|
|
411
|
-
minLabel:
|
|
412
|
-
maxLabel:
|
|
413
|
-
scaleLabels:
|
|
414
|
-
prepopulatedValue:
|
|
704
|
+
type: z2.literal("nps").describe("Must be exactly 'nps'"),
|
|
705
|
+
min: z2.literal(0).describe("NPS always starts at 0"),
|
|
706
|
+
max: z2.literal(10).describe("NPS always ends at 10"),
|
|
707
|
+
minLabel: z2.string().max(100).optional().describe("Label for the minimum NPS value (0)"),
|
|
708
|
+
maxLabel: z2.string().max(100).optional().describe("Label for the maximum NPS value (10)"),
|
|
709
|
+
scaleLabels: z2.record(z2.string().regex(/^\d+$/), z2.string().max(50)).optional().describe("Custom labels for specific NPS values (0-10)"),
|
|
710
|
+
prepopulatedValue: z2.number().int().min(0).max(10).optional().describe("Default value to pre-select (0-10)")
|
|
415
711
|
}).refine(
|
|
416
712
|
(data) => {
|
|
417
713
|
if (data.scaleLabels) {
|
|
@@ -429,16 +725,16 @@ var npsQuestionSchema = questionSchema.extend({
|
|
|
429
725
|
}
|
|
430
726
|
).describe("Schema for Net Promoter Score questions with 0-10 scale");
|
|
431
727
|
var shortAnswerQuestionSchema = questionSchema.extend({
|
|
432
|
-
type:
|
|
433
|
-
maxCharacters:
|
|
434
|
-
minCharacters:
|
|
435
|
-
placeholder:
|
|
436
|
-
enableRegexValidation:
|
|
437
|
-
regexPattern:
|
|
438
|
-
enableEnhanceWithAi:
|
|
439
|
-
promptTemplate:
|
|
440
|
-
maxTokenAllowed:
|
|
441
|
-
minCharactersToEnhance:
|
|
728
|
+
type: z2.literal("short_answer").describe("Must be exactly 'short_answer'"),
|
|
729
|
+
maxCharacters: z2.number().int().min(1).max(1e4).optional().describe("Maximum number of characters allowed"),
|
|
730
|
+
minCharacters: z2.number().int().min(0).optional().describe("Minimum number of characters required"),
|
|
731
|
+
placeholder: z2.string().max(200).optional().describe("Placeholder text shown in the input field"),
|
|
732
|
+
enableRegexValidation: z2.boolean().optional().default(false).describe("Whether to enable regex pattern validation"),
|
|
733
|
+
regexPattern: z2.string().optional().describe("Regular expression pattern for validation"),
|
|
734
|
+
enableEnhanceWithAi: z2.boolean().optional().default(false).describe("Whether to enable AI enhancement features"),
|
|
735
|
+
promptTemplate: z2.string().max(2e3).optional().describe("Template for AI enhancement prompts"),
|
|
736
|
+
maxTokenAllowed: z2.number().int().min(1).max(1e4).optional().describe("Maximum tokens allowed for AI processing"),
|
|
737
|
+
minCharactersToEnhance: z2.number().int().min(1).optional().describe("Minimum characters needed to trigger AI enhancement")
|
|
442
738
|
}).refine(
|
|
443
739
|
(data) => {
|
|
444
740
|
if (data.minCharacters !== void 0 && data.maxCharacters !== void 0) {
|
|
@@ -474,19 +770,19 @@ var shortAnswerQuestionSchema = questionSchema.extend({
|
|
|
474
770
|
}
|
|
475
771
|
).describe("Schema for short answer questions with optional AI enhancement");
|
|
476
772
|
var longAnswerQuestionSchema = questionSchema.extend({
|
|
477
|
-
type:
|
|
478
|
-
maxCharacters:
|
|
773
|
+
type: z2.literal("long_text").describe("Must be exactly 'long_text'"),
|
|
774
|
+
maxCharacters: z2.number().int().min(1).max(5e4).optional().describe(
|
|
479
775
|
"Maximum number of characters allowed (higher limit for long text)"
|
|
480
776
|
),
|
|
481
|
-
minCharacters:
|
|
482
|
-
rows:
|
|
483
|
-
placeholder:
|
|
484
|
-
enableEnhanceWithAi:
|
|
485
|
-
promptTemplate:
|
|
486
|
-
maxTokenAllowed:
|
|
777
|
+
minCharacters: z2.number().int().min(0).optional().describe("Minimum number of characters required"),
|
|
778
|
+
rows: z2.number().int().min(1).max(20).optional().describe("Number of textarea rows to display (1-20)"),
|
|
779
|
+
placeholder: z2.string().max(500).optional().describe("Placeholder text for the textarea (longer for long text)"),
|
|
780
|
+
enableEnhanceWithAi: z2.boolean().optional().default(false).describe("Whether to enable AI enhancement features"),
|
|
781
|
+
promptTemplate: z2.string().max(2e3).optional().describe("Template for AI enhancement prompts"),
|
|
782
|
+
maxTokenAllowed: z2.number().int().min(1).max(25e3).optional().describe(
|
|
487
783
|
"Maximum tokens allowed for AI processing (higher for long text)"
|
|
488
784
|
),
|
|
489
|
-
minCharactersToEnhance:
|
|
785
|
+
minCharactersToEnhance: z2.number().int().min(1).optional().describe("Minimum characters needed to trigger AI enhancement")
|
|
490
786
|
}).refine(
|
|
491
787
|
(data) => {
|
|
492
788
|
if (data.minCharacters !== void 0 && data.maxCharacters !== void 0) {
|
|
@@ -513,19 +809,19 @@ var longAnswerQuestionSchema = questionSchema.extend({
|
|
|
513
809
|
"Schema for long answer questions with rich text support and AI enhancement"
|
|
514
810
|
);
|
|
515
811
|
var nestedDropdownQuestionSchema = questionSchema.extend({
|
|
516
|
-
type:
|
|
517
|
-
placeholder:
|
|
518
|
-
options:
|
|
812
|
+
type: z2.literal("nested_selection").describe("Must be exactly 'nested_selection'"),
|
|
813
|
+
placeholder: z2.string().max(200).optional().describe("Placeholder text for the nested dropdown"),
|
|
814
|
+
options: z2.array(nestedOptionSchema).min(1).max(100).describe(
|
|
519
815
|
"Array of nested options for hierarchical selection (1-100 options)"
|
|
520
816
|
),
|
|
521
|
-
displayStyle:
|
|
817
|
+
displayStyle: z2.literal("list").describe("Fixed display style for nested dropdowns"),
|
|
522
818
|
choiceOrderOption: choiceOrderOptionSchema.optional().default("none").describe("How to order the nested choices"),
|
|
523
|
-
preserveLastChoices:
|
|
524
|
-
prepopulatedValue:
|
|
525
|
-
allowOther:
|
|
526
|
-
otherColumnName:
|
|
527
|
-
maxDepth:
|
|
528
|
-
cascadeLabels:
|
|
819
|
+
preserveLastChoices: z2.number().int().min(0).max(10).optional().describe("Number of choice levels to preserve (0-10)"),
|
|
820
|
+
prepopulatedValue: z2.string().max(1e3).optional().describe("Default value to pre-populate"),
|
|
821
|
+
allowOther: z2.boolean().optional().default(false).describe('Whether to allow custom "other" options'),
|
|
822
|
+
otherColumnName: z2.string().max(100).optional().describe('Column name for storing custom "other" values'),
|
|
823
|
+
maxDepth: z2.number().int().min(1).max(10).optional().describe("Maximum nesting depth allowed (1-10)"),
|
|
824
|
+
cascadeLabels: z2.boolean().optional().default(false).describe("Whether to cascade labels from parent options")
|
|
529
825
|
}).refine(
|
|
530
826
|
(data) => {
|
|
531
827
|
if (data.allowOther && !data.otherColumnName) {
|
|
@@ -540,7 +836,7 @@ var nestedDropdownQuestionSchema = questionSchema.extend({
|
|
|
540
836
|
).describe(
|
|
541
837
|
"Schema for nested dropdown questions with hierarchical option structure"
|
|
542
838
|
);
|
|
543
|
-
var combinedQuestionSchema =
|
|
839
|
+
var combinedQuestionSchema = z2.discriminatedUnion("type", [
|
|
544
840
|
ratingQuestionSchema,
|
|
545
841
|
annotationQuestionSchema,
|
|
546
842
|
welcomeQuestionSchema,
|
|
@@ -548,6 +844,7 @@ var combinedQuestionSchema = z.discriminatedUnion("type", [
|
|
|
548
844
|
messagePanelQuestionSchema,
|
|
549
845
|
exitFormQuestionSchema,
|
|
550
846
|
yesNoQuestionSchema,
|
|
847
|
+
consentQuestionSchema,
|
|
551
848
|
ratingMatrixQuestionSchema,
|
|
552
849
|
matrixSingleChoiceQuestionSchema,
|
|
553
850
|
matrixMultipleChoiceQuestionSchema,
|
|
@@ -560,47 +857,48 @@ var combinedQuestionSchema = z.discriminatedUnion("type", [
|
|
|
560
857
|
]);
|
|
561
858
|
|
|
562
859
|
// src/schemas/fields/answer-schema.ts
|
|
563
|
-
import { z as
|
|
564
|
-
var AnnotationMarkerSchema =
|
|
565
|
-
markerNo:
|
|
566
|
-
timeline:
|
|
567
|
-
comment:
|
|
860
|
+
import { z as z3 } from "zod";
|
|
861
|
+
var AnnotationMarkerSchema = z3.object({
|
|
862
|
+
markerNo: z3.string(),
|
|
863
|
+
timeline: z3.string(),
|
|
864
|
+
comment: z3.string()
|
|
568
865
|
});
|
|
569
|
-
var AnnotationSchema =
|
|
570
|
-
fileType:
|
|
571
|
-
fileName:
|
|
572
|
-
markers:
|
|
866
|
+
var AnnotationSchema = z3.object({
|
|
867
|
+
fileType: z3.string(),
|
|
868
|
+
fileName: z3.string(),
|
|
869
|
+
markers: z3.array(AnnotationMarkerSchema)
|
|
573
870
|
});
|
|
574
|
-
var AnswerItemSchema =
|
|
575
|
-
nps:
|
|
576
|
-
nestedSelection:
|
|
577
|
-
longText:
|
|
578
|
-
shortAnswer:
|
|
579
|
-
singleChoice:
|
|
871
|
+
var AnswerItemSchema = z3.object({
|
|
872
|
+
nps: z3.number().optional().describe("Net Promoter Score value (e.g., 0-10)"),
|
|
873
|
+
nestedSelection: z3.array(z3.string()).optional().describe("Array of selected nested option IDs"),
|
|
874
|
+
longText: z3.string().optional().describe("Long text answer, e.g., paragraph or essay"),
|
|
875
|
+
shortAnswer: z3.string().optional().describe("Short text answer, e.g., single sentence or word"),
|
|
876
|
+
singleChoice: z3.string().optional().describe(
|
|
580
877
|
"single selected option ID (for single choice questions)"
|
|
581
878
|
),
|
|
582
|
-
rating:
|
|
583
|
-
yesNo:
|
|
584
|
-
|
|
585
|
-
|
|
879
|
+
rating: z3.number().optional().describe("Star rating value (e.g., 1-5)"),
|
|
880
|
+
yesNo: z3.boolean().optional().describe("Yes/no answer for yes_no questions (true = Yes, false = No)"),
|
|
881
|
+
consent: z3.boolean().optional().describe("Consent answer for consent questions (true = checked/agreed, false = unchecked)"),
|
|
882
|
+
multipleChoiceMultiple: z3.array(z3.string()).optional().describe("Array of selected option IDs for multiple choice questions"),
|
|
883
|
+
singleChoiceOther: z3.string().optional().describe(
|
|
586
884
|
'Free-text "other" answer for single choice questions when allowOther is enabled'
|
|
587
885
|
),
|
|
588
|
-
multipleChoiceOther:
|
|
886
|
+
multipleChoiceOther: z3.string().optional().describe(
|
|
589
887
|
'Free-text "other" answer for multiple choice questions when allowOther is enabled'
|
|
590
888
|
),
|
|
591
889
|
annotation: AnnotationSchema.optional().describe(
|
|
592
890
|
"Annotation object containing file and marker details"
|
|
593
891
|
),
|
|
594
|
-
ratingMatrix:
|
|
892
|
+
ratingMatrix: z3.record(z3.string(), z3.union([z3.number(), z3.string()])).optional().describe(
|
|
595
893
|
"Rating matrix answers keyed by statement value (export key), value is the selected scale value (number for likert/numerical, string for custom)"
|
|
596
894
|
),
|
|
597
|
-
matrixSingleChoice:
|
|
895
|
+
matrixSingleChoice: z3.record(z3.string(), z3.string()).optional().describe(
|
|
598
896
|
"Matrix single-choice answers keyed by row value (export key), map value is the selected column option value"
|
|
599
897
|
),
|
|
600
|
-
matrixMultipleChoice:
|
|
898
|
+
matrixMultipleChoice: z3.record(z3.string(), z3.array(z3.string())).optional().describe(
|
|
601
899
|
"Matrix multiple-choice answers keyed by row value (export key), map value is array of selected column option values"
|
|
602
900
|
),
|
|
603
|
-
others:
|
|
901
|
+
others: z3.string().optional().describe(
|
|
604
902
|
"For multiple choice questions and single choice questions, this is the value of the other option"
|
|
605
903
|
)
|
|
606
904
|
}).describe(
|
|
@@ -609,396 +907,33 @@ var AnswerItemSchema = z2.object({
|
|
|
609
907
|
var AnswerSchema = AnswerItemSchema;
|
|
610
908
|
|
|
611
909
|
// src/schemas/fields/form-schema.ts
|
|
612
|
-
import { z as
|
|
613
|
-
var
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
910
|
+
import { z as z4 } from "zod";
|
|
911
|
+
var externalPublishingPropertiesSchema = z4.object({
|
|
912
|
+
isShareable: z4.boolean().describe("Whether the feedback results can be shared externally"),
|
|
913
|
+
isEmailShareable: z4.boolean().describe("Whether the feedback can be shared via email")
|
|
914
|
+
}).describe("Schema defining external publishing and sharing properties for feedback");
|
|
915
|
+
var publicationStatusSchema = z4.enum(["P", "D", "A", "S"]).describe("Publication status: P=Published, D=Draft, A=Archived, S=Stopped");
|
|
916
|
+
var PublicationStatuses = {
|
|
917
|
+
PUBLISHED: "P",
|
|
918
|
+
DRAFT: "D",
|
|
919
|
+
ARCHIVED: "A",
|
|
920
|
+
STOPPED: "S"
|
|
617
921
|
};
|
|
618
|
-
var
|
|
619
|
-
|
|
620
|
-
|
|
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")
|
|
683
|
-
}).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");
|
|
685
|
-
var PublicationStatuses = {
|
|
686
|
-
PUBLISHED: "P",
|
|
687
|
-
DRAFT: "D",
|
|
688
|
-
ARCHIVED: "A",
|
|
689
|
-
STOPPED: "S"
|
|
690
|
-
};
|
|
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"),
|
|
922
|
+
var feedbackConfigurationSchema = z4.object({
|
|
923
|
+
formTitle: z4.string().describe("Title of the feedback form"),
|
|
924
|
+
formDescription: z4.string().describe("Description of the feedback form"),
|
|
719
925
|
isPublished: publicationStatusSchema.describe("Publication status of the feedback form")
|
|
720
926
|
}).describe("Schema defining feedback configuration properties");
|
|
721
927
|
|
|
722
928
|
// src/schemas/fields/form-properties-schema.ts
|
|
723
929
|
import { z as z8 } from "zod";
|
|
724
930
|
|
|
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
931
|
// src/schemas/fields/other-screen-schema.ts
|
|
993
932
|
import { z as z5 } from "zod";
|
|
994
933
|
var OtherFieldsSchema = z5.object({
|
|
995
|
-
pagination: z5.boolean().describe("Whether to show pagination for multi-page forms"),
|
|
996
934
|
questionNumber: z5.boolean().describe("Whether to display question numbers"),
|
|
997
|
-
pageTitle: z5.boolean().describe("Whether to show page titles in multi-page forms"),
|
|
998
|
-
blockerFeedback: z5.boolean().describe("Whether to show blocker feedback for validation errors"),
|
|
999
935
|
submitButtonLabel: z5.string().min(1).max(50).describe("Text for the submit button"),
|
|
1000
936
|
previousButtonLabel: z5.string().min(1).max(50).describe("Text for the previous button in pagination"),
|
|
1001
|
-
nextButtonLabel: z5.string().min(1).max(50).describe("Text for the next button in pagination"),
|
|
1002
937
|
aiEnhancementSuccessMessage: z5.string().min(1).max(100).describe("Message shown when AI enhancement is successful (max 100 characters)"),
|
|
1003
938
|
aiEnhancementCooldownErrorMessage: z5.string().min(1).max(100).describe("Message shown when AI enhancement is on cooldown (max 100 characters)"),
|
|
1004
939
|
aiEnhancementMaxReachedErrorMessage: z5.string().min(1).max(100).describe("Message shown when maximum AI enhancements reached (max 100 characters)")
|
|
@@ -1011,7 +946,6 @@ var LanguagesSchema = z5.array(LanguageFieldSchema).describe("Schema for array o
|
|
|
1011
946
|
var OtherFieldsTranslationSchema = z5.object({
|
|
1012
947
|
submitButtonLabel: z5.string().min(1).max(50).describe("Translated text for the submit button"),
|
|
1013
948
|
previousButtonLabel: z5.string().min(1).max(50).describe("Translated text for the previous button in pagination"),
|
|
1014
|
-
nextButtonLabel: z5.string().min(1).max(50).describe("Translated text for the next button in pagination"),
|
|
1015
949
|
aiEnhancementSuccessMessage: z5.string().min(1).max(100).describe("Translated message shown when AI enhancement is successful (max 100 characters)"),
|
|
1016
950
|
aiEnhancementCooldownErrorMessage: z5.string().min(1).max(100).describe("Translated message shown when AI enhancement is on cooldown (max 100 characters)"),
|
|
1017
951
|
aiEnhancementMaxReachedErrorMessage: z5.string().min(1).max(100).describe("Translated message shown when maximum AI enhancements reached (max 100 characters)")
|
|
@@ -1055,20 +989,26 @@ var ShareableModes = {
|
|
|
1055
989
|
SYSTEM: "system"
|
|
1056
990
|
};
|
|
1057
991
|
var previousButtonModeSchema = z6.enum(["never", "always", "auto"]).describe("Previous button visibility mode: never, always, or auto");
|
|
992
|
+
var PreviousButtonModes = {
|
|
993
|
+
NEVER: "never",
|
|
994
|
+
ALWAYS: "always",
|
|
995
|
+
AUTO: "auto"
|
|
996
|
+
};
|
|
1058
997
|
var featureSettingsSchema = z6.object({
|
|
1059
|
-
darkOverlay: z6.boolean().describe("Whether to show a dark overlay behind the widget"),
|
|
1060
|
-
closeButton: z6.boolean().describe("Whether to display a close button on the widget"),
|
|
1061
|
-
progressBar: z6.boolean().describe("Whether to show a progress bar indicating completion status"),
|
|
1062
|
-
showBranding: z6.boolean().describe("Whether to display branding elements on the widget"),
|
|
998
|
+
darkOverlay: z6.boolean().default(false).describe("Whether to show a dark overlay behind the widget"),
|
|
999
|
+
closeButton: z6.boolean().default(true).describe("Whether to display a close button on the widget"),
|
|
1000
|
+
progressBar: z6.boolean().default(true).describe("Whether to show a progress bar indicating completion status"),
|
|
1001
|
+
showBranding: z6.boolean().default(true).describe("Whether to display branding elements on the widget"),
|
|
1063
1002
|
customPosition: z6.boolean().describe("Whether custom positioning is enabled"),
|
|
1064
|
-
customIconPosition: z6.boolean().describe("Whether custom icon positioning is enabled"),
|
|
1065
1003
|
customCss: z6.string().optional().describe("Custom CSS link to apply for the feedback form"),
|
|
1066
|
-
shareableMode: shareableModeSchema.optional().describe(
|
|
1004
|
+
shareableMode: shareableModeSchema.optional().default(ShareableModes.LIGHT).describe(
|
|
1067
1005
|
"Display mode for the shareable: light, dark, or system preference"
|
|
1068
1006
|
),
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1007
|
+
enableShareableKeyboardNavigation: z6.boolean().default(false).describe(
|
|
1008
|
+
"Whether keyboard navigation is enabled for the shareable widget experience"
|
|
1009
|
+
),
|
|
1010
|
+
rtl: z6.boolean().default(false).describe("Whether right-to-left text direction is enabled"),
|
|
1011
|
+
previousButton: previousButtonModeSchema.default(PreviousButtonModes.ALWAYS).describe("Previous button visibility mode: never, always, or auto")
|
|
1072
1012
|
}).describe("Feature settings controlling widget UI behavior and appearance");
|
|
1073
1013
|
var themeColorsSchema = z6.object({
|
|
1074
1014
|
theme: z6.string().optional().describe("Theme for a single mode (shadcn variables JSON)")
|
|
@@ -1172,13 +1112,13 @@ var otherConfigurationPropertiesSchema = z8.discriminatedUnion("isEnabled", [
|
|
|
1172
1112
|
// When other configuration is disabled
|
|
1173
1113
|
z8.object({
|
|
1174
1114
|
isEnabled: z8.literal(false).describe("Whether other configuration properties are enabled"),
|
|
1175
|
-
otherFields: OtherFieldsSchema.describe("Other form configuration fields including
|
|
1115
|
+
otherFields: OtherFieldsSchema.describe("Other form configuration fields including buttons and display options"),
|
|
1176
1116
|
translations: z8.record(z8.string(), OtherFieldsTranslationSchema).optional().describe("Translations for other configuration field labels and buttons keyed by language code")
|
|
1177
1117
|
}),
|
|
1178
1118
|
// When other configuration is enabled
|
|
1179
1119
|
z8.object({
|
|
1180
1120
|
isEnabled: z8.literal(true).describe("Whether other configuration properties are enabled"),
|
|
1181
|
-
otherFields: OtherFieldsSchema.describe("Other form configuration fields including
|
|
1121
|
+
otherFields: OtherFieldsSchema.describe("Other form configuration fields including buttons and display options"),
|
|
1182
1122
|
translations: z8.record(z8.string(), OtherFieldsTranslationSchema).describe("Translations for other configuration field labels and buttons keyed by language code")
|
|
1183
1123
|
})
|
|
1184
1124
|
]).describe("Schema for other configuration properties including fields and translations");
|
|
@@ -1194,12 +1134,11 @@ var formPropertiesSchema = z8.object({
|
|
|
1194
1134
|
selectedLanguages: LanguagesSchema.describe("Array of languages selected for this questionnaire"),
|
|
1195
1135
|
translations: translationsSchema.describe("Multi-language translations for questions and form content")
|
|
1196
1136
|
}).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
1137
|
externalPublishingProperties: externalPublishingPropertiesSchema.describe("Properties controlling external sharing and publishing of feedback results"),
|
|
1199
1138
|
audienceTriggerProperties: audienceTriggerPropertiesSchema.describe("Properties defining audience targeting and trigger conditions for the feedback form"),
|
|
1200
1139
|
otherConfigurationProperties: otherConfigurationPropertiesSchema.describe("Additional configuration properties including form display options and translations"),
|
|
1201
1140
|
appearanceProperties: appearancePropertiesSchema.describe("Appearance configuration including themes, colors, and UI feature settings")
|
|
1202
|
-
}).describe("Complete schema for all feedback-level properties including
|
|
1141
|
+
}).describe("Complete schema for all feedback-level properties including publishing, audience targeting, configuration, and appearance");
|
|
1203
1142
|
|
|
1204
1143
|
// src/schemas/fields/other-properties-schema.ts
|
|
1205
1144
|
import { z as z9 } from "zod";
|
|
@@ -1328,14 +1267,15 @@ var feedbackConfigurationItemSchema = z12.object({
|
|
|
1328
1267
|
customPosition: z12.boolean().describe("Whether custom position is enabled"),
|
|
1329
1268
|
customIconPosition: z12.boolean().describe("Whether custom icon position is enabled"),
|
|
1330
1269
|
customCss: z12.string().nullable().optional().describe("Custom CSS link (optional)"),
|
|
1331
|
-
|
|
1270
|
+
enableShareableKeyboardNavigation: z12.boolean().default(false).describe(
|
|
1271
|
+
"Whether keyboard navigation is enabled for the shareable widget experience"
|
|
1272
|
+
),
|
|
1332
1273
|
rtl: z12.boolean().describe("Whether right-to-left text direction is enabled"),
|
|
1333
1274
|
previousButton: z12.enum(["never", "always", "auto"]).describe("Previous button visibility mode: never, always, or auto")
|
|
1334
1275
|
}).describe("Feature settings for the feedback form"),
|
|
1335
1276
|
selectedIconPosition: z12.string().describe("Selected position for the feedback icon"),
|
|
1336
1277
|
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)")
|
|
1278
|
+
}).describe("Appearance properties for the feedback form")
|
|
1339
1279
|
}).describe("Individual feedback configuration item in the list");
|
|
1340
1280
|
var fetchFormConfigSchema = z12.object({
|
|
1341
1281
|
feedbackConfigurationId: z12.string().uuid().describe("Unique identifier for the feedback configuration"),
|
|
@@ -1359,6 +1299,16 @@ var formConfigurationResponseSchema = z12.object({
|
|
|
1359
1299
|
formTitle: z12.string().describe("Title of the feedback form"),
|
|
1360
1300
|
formDescription: z12.string().describe("Description of the feedback form")
|
|
1361
1301
|
}).describe("Form configuration response with title and description");
|
|
1302
|
+
var logicJumpRuleSchema = z12.object({
|
|
1303
|
+
jsonLogic: z12.record(z12.string(), z12.unknown()).describe("JSON Logic expression to evaluate"),
|
|
1304
|
+
targetQuestionId: z12.string().describe("Question ID to navigate to when this rule matches")
|
|
1305
|
+
}).describe("A single logic jump rule mapping a condition to a target question");
|
|
1306
|
+
var logicJumpRulesSchema = z12.record(
|
|
1307
|
+
z12.string(),
|
|
1308
|
+
z12.array(logicJumpRuleSchema)
|
|
1309
|
+
).describe(
|
|
1310
|
+
"Logic jump rules keyed by question ID (or '__workflow_start__'). Each entry is an ordered array of rules evaluated top-down; the first matching rule wins."
|
|
1311
|
+
);
|
|
1362
1312
|
var questionnaireFieldsResponseSchema = z12.object({
|
|
1363
1313
|
questions: z12.record(z12.string(), combinedQuestionSchema).describe("Collection of questions keyed by their string identifiers"),
|
|
1364
1314
|
sections: z12.array(sectionSchema).describe(
|
|
@@ -1369,9 +1319,12 @@ var questionnaireFieldsResponseSchema = z12.object({
|
|
|
1369
1319
|
),
|
|
1370
1320
|
selectedLanguages: LanguagesSchema.describe(
|
|
1371
1321
|
"Array of languages selected for this questionnaire"
|
|
1372
|
-
)
|
|
1322
|
+
),
|
|
1323
|
+
isLogicJumpsEnabled: z12.boolean().optional().default(false).describe("When true, form navigation follows logicJumpRules instead of linear section order"),
|
|
1324
|
+
logicJumpRules: logicJumpRulesSchema.optional().describe("Conditional navigation rules evaluated per question to determine the next question to show"),
|
|
1325
|
+
contextVariables: z12.array(z12.string()).optional().describe("List of context variable keys expected by the form (informational)")
|
|
1373
1326
|
}).describe(
|
|
1374
|
-
"Questionnaire fields response including questions, sections, translations, and
|
|
1327
|
+
"Questionnaire fields response including questions, sections, translations, selected languages, and optional logic jump configuration"
|
|
1375
1328
|
);
|
|
1376
1329
|
var fetchFeedbackDetailsResponseSchema = z12.object({
|
|
1377
1330
|
feedbackConfigurationId: z12.string().uuid().describe("Unique identifier for the feedback configuration"),
|
|
@@ -1541,21 +1494,19 @@ export {
|
|
|
1541
1494
|
OtherFieldsSchema,
|
|
1542
1495
|
OtherFieldsTranslationSchema,
|
|
1543
1496
|
Positions,
|
|
1497
|
+
PreviousButtonModes,
|
|
1544
1498
|
PublicationStatuses,
|
|
1545
1499
|
QuestionStatuses,
|
|
1546
1500
|
QuestionTypes,
|
|
1547
1501
|
RatingDisplayStyles,
|
|
1548
1502
|
RatingMatrixDisplayStyles,
|
|
1549
1503
|
RatingRepresentationSizes,
|
|
1550
|
-
RecurringUnits,
|
|
1551
1504
|
ShareableModes,
|
|
1552
|
-
SurveyTypes,
|
|
1553
1505
|
ThemeModes,
|
|
1554
1506
|
TranslationProvider,
|
|
1555
1507
|
ValidationRuleTypes,
|
|
1556
1508
|
VisibilityConditionOperators,
|
|
1557
1509
|
YesNoDisplayStyles,
|
|
1558
|
-
YesNoValues,
|
|
1559
1510
|
annotationQuestionSchema,
|
|
1560
1511
|
annotationQuestionTranslationSchema,
|
|
1561
1512
|
appPropsSchema,
|
|
@@ -1569,6 +1520,8 @@ export {
|
|
|
1569
1520
|
conditionalIfMetadataSchema,
|
|
1570
1521
|
conditionalIfSchema,
|
|
1571
1522
|
conditionalWhenSchema,
|
|
1523
|
+
consentQuestionSchema,
|
|
1524
|
+
consentQuestionTranslationSchema,
|
|
1572
1525
|
createTranslationProvider,
|
|
1573
1526
|
currentModeSchema,
|
|
1574
1527
|
customEventFieldOperatorSchema,
|
|
@@ -1591,7 +1544,8 @@ export {
|
|
|
1591
1544
|
formConfigSchema,
|
|
1592
1545
|
formConfigurationResponseSchema,
|
|
1593
1546
|
formPropertiesSchema,
|
|
1594
|
-
|
|
1547
|
+
logicJumpRuleSchema,
|
|
1548
|
+
logicJumpRulesSchema,
|
|
1595
1549
|
longAnswerQuestionSchema,
|
|
1596
1550
|
longAnswerQuestionTranslationSchema,
|
|
1597
1551
|
masterPropertiesSchema,
|
|
@@ -1620,6 +1574,7 @@ export {
|
|
|
1620
1574
|
otherConfigurationPropertiesSchema,
|
|
1621
1575
|
partialFeedbackSchema,
|
|
1622
1576
|
positionSchema,
|
|
1577
|
+
previousButtonModeSchema,
|
|
1623
1578
|
publicationStatusSchema,
|
|
1624
1579
|
queryOutputSchema,
|
|
1625
1580
|
questionCentricTranslationsSchema,
|
|
@@ -1640,19 +1595,19 @@ export {
|
|
|
1640
1595
|
ratingQuestionSchema,
|
|
1641
1596
|
ratingQuestionTranslationSchema,
|
|
1642
1597
|
ratingRepresentationSizeSchema,
|
|
1643
|
-
recurringUnitSchema,
|
|
1644
1598
|
refineTextDataSchema,
|
|
1645
1599
|
refineTextParamsSchema,
|
|
1646
1600
|
refineTextResponseSchema,
|
|
1647
1601
|
responseSchema,
|
|
1648
1602
|
sectionSchema,
|
|
1603
|
+
sectionTranslationSchema,
|
|
1604
|
+
sectionTranslationsByLanguageSchema,
|
|
1649
1605
|
sessionInfoSchema,
|
|
1650
1606
|
shareableModeSchema,
|
|
1651
1607
|
shortAnswerQuestionSchema,
|
|
1652
1608
|
shortAnswerQuestionTranslationSchema,
|
|
1653
1609
|
singleChoiceQuestionTranslationSchema,
|
|
1654
1610
|
submitFeedbackSchema,
|
|
1655
|
-
surveyTypeSchema,
|
|
1656
1611
|
thankYouQuestionSchema,
|
|
1657
1612
|
thankYouQuestionTranslationSchema,
|
|
1658
1613
|
themeColorsSchema,
|
|
@@ -1676,7 +1631,6 @@ export {
|
|
|
1676
1631
|
yesNoDisplayStyleSchema,
|
|
1677
1632
|
yesNoQuestionSchema,
|
|
1678
1633
|
yesNoQuestionTranslationSchema,
|
|
1679
|
-
yesNoSchema,
|
|
1680
1634
|
z15 as z
|
|
1681
1635
|
};
|
|
1682
1636
|
//# sourceMappingURL=index.js.map
|