@encatch/schema 1.0.1-beta.0 → 1.0.1-beta.2
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 +292 -87
- package/dist/esm/index.js.map +3 -3
- package/dist/types/index.d.ts +4 -4
- package/dist/types/schemas/api/fetch-feedback-schema.d.ts +1225 -240
- package/dist/types/schemas/api/submit-feedback-schema.d.ts +24 -0
- package/dist/types/schemas/fields/answer-schema.d.ts +8 -0
- package/dist/types/schemas/fields/app-props-schema.d.ts +579 -87
- package/dist/types/schemas/fields/field-schema.d.ts +1339 -192
- package/dist/types/schemas/fields/form-properties-schema.d.ts +587 -165
- package/dist/types/schemas/fields/other-screen-schema.d.ts +0 -39
- package/dist/types/schemas/fields/theme-schema.d.ts +25 -0
- package/dist/types/schemas/fields/translations-schema.d.ts +229 -46
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -11,7 +11,15 @@ var questionTypeSchema = z.enum([
|
|
|
11
11
|
"multiple_choice_multiple",
|
|
12
12
|
"short_answer",
|
|
13
13
|
"long_text",
|
|
14
|
-
"annotation"
|
|
14
|
+
"annotation",
|
|
15
|
+
"welcome",
|
|
16
|
+
"thank_you",
|
|
17
|
+
"message_panel",
|
|
18
|
+
"yes_no",
|
|
19
|
+
"rating_matrix",
|
|
20
|
+
"matrix_single_choice",
|
|
21
|
+
"matrix_multiple_choice",
|
|
22
|
+
"exit_form"
|
|
15
23
|
]).describe("Enumeration of all supported question types for form fields");
|
|
16
24
|
var QuestionTypes = {
|
|
17
25
|
RATING: "rating",
|
|
@@ -21,7 +29,15 @@ var QuestionTypes = {
|
|
|
21
29
|
MULTIPLE_CHOICE_MULTIPLE: "multiple_choice_multiple",
|
|
22
30
|
SHORT_ANSWER: "short_answer",
|
|
23
31
|
LONG_TEXT: "long_text",
|
|
24
|
-
ANNOTATION: "annotation"
|
|
32
|
+
ANNOTATION: "annotation",
|
|
33
|
+
WELCOME: "welcome",
|
|
34
|
+
THANK_YOU: "thank_you",
|
|
35
|
+
MESSAGE_PANEL: "message_panel",
|
|
36
|
+
YES_NO: "yes_no",
|
|
37
|
+
RATING_MATRIX: "rating_matrix",
|
|
38
|
+
MATRIX_SINGLE_CHOICE: "matrix_single_choice",
|
|
39
|
+
MATRIX_MULTIPLE_CHOICE: "matrix_multiple_choice",
|
|
40
|
+
EXIT_FORM: "exit_form"
|
|
25
41
|
};
|
|
26
42
|
var validationRuleTypeSchema = z.enum([
|
|
27
43
|
"required",
|
|
@@ -139,6 +155,11 @@ var MultipleChoiceMultipleDisplayStyles = {
|
|
|
139
155
|
LIST: "list",
|
|
140
156
|
CHIP: "chip"
|
|
141
157
|
};
|
|
158
|
+
var yesNoDisplayStyleSchema = z.enum(["horizontal", "vertical"]);
|
|
159
|
+
var YesNoDisplayStyles = {
|
|
160
|
+
HORIZONTAL: "horizontal",
|
|
161
|
+
VERTICAL: "vertical"
|
|
162
|
+
};
|
|
142
163
|
var choiceOrderOptionSchema = z.enum([
|
|
143
164
|
"randomize",
|
|
144
165
|
"flip",
|
|
@@ -160,19 +181,19 @@ var questionSchema = z.object({
|
|
|
160
181
|
),
|
|
161
182
|
title: z.string().min(1).max(200).describe("The main title/question text displayed to users"),
|
|
162
183
|
description: z.string().max(1e3).optional().describe("Optional detailed description or help text"),
|
|
163
|
-
descriptionMarkdown: z.string().max(5e3).optional().describe("Optional description in Markdown format"),
|
|
164
184
|
describe: z.string().max(2e3).optional().describe(
|
|
165
185
|
"LLM tool call description for better AI understanding and context"
|
|
166
186
|
),
|
|
167
187
|
required: z.boolean().default(false).describe("Whether this question must be answered"),
|
|
188
|
+
isHidden: z.boolean().default(false).describe("When true, the question is hidden from the form UI"),
|
|
168
189
|
errorMessage: z.string().max(500).optional().describe("Custom error message when validation fails"),
|
|
169
190
|
validations: z.array(validationRuleSchema).optional().default([]).describe("Array of validation rules to apply"),
|
|
170
191
|
visibility: z.array(visibilityConditionSchema).optional().default([]).describe("Conditions that control when this question is shown"),
|
|
171
|
-
isFixed: z.boolean().describe("Whether this question position is fixed or can be reordered"),
|
|
172
192
|
sectionId: z.string().optional().describe("ID of the section this question belongs to"),
|
|
173
193
|
status: questionStatusSchema.describe(
|
|
174
194
|
"Current status of the question (Draft, Published, etc.)"
|
|
175
|
-
)
|
|
195
|
+
),
|
|
196
|
+
textAlign: z.enum(["left", "center"]).optional().default("left").describe("Text alignment for the question title and description")
|
|
176
197
|
}).describe("Base schema for all question types with common properties");
|
|
177
198
|
var ratingQuestionSchema = questionSchema.extend({
|
|
178
199
|
type: z.literal("rating").describe("Must be exactly 'rating'"),
|
|
@@ -191,6 +212,136 @@ var annotationQuestionSchema = questionSchema.extend({
|
|
|
191
212
|
}).describe(
|
|
192
213
|
"Schema for annotation questions that provide additional context or instructions"
|
|
193
214
|
);
|
|
215
|
+
var welcomeQuestionSchema = questionSchema.extend({
|
|
216
|
+
type: z.literal("welcome").describe("Must be exactly 'welcome'"),
|
|
217
|
+
title: z.string().min(1).max(200).describe("The main heading displayed on the welcome screen"),
|
|
218
|
+
description: z.string().max(1e3).optional().describe("Optional sub-text body shown below the heading"),
|
|
219
|
+
buttonLabel: z.string().min(1).max(50).optional().describe("Label for the proceed/start button (e.g. 'Get Started', 'Begin')"),
|
|
220
|
+
imageUrl: z.string().url().optional().describe("Optional image URL displayed on the welcome screen")
|
|
221
|
+
}).describe("Schema for a welcome screen displayed at the start or inline within a form");
|
|
222
|
+
var thankYouQuestionSchema = questionSchema.extend({
|
|
223
|
+
type: z.literal("thank_you").describe("Must be exactly 'thank_you'"),
|
|
224
|
+
title: z.string().min(1).max(200).describe("The main heading displayed on the thank you screen"),
|
|
225
|
+
description: z.string().max(1e3).optional().describe(
|
|
226
|
+
"Optional thank you body text; rendered as Markdown where the form supports it"
|
|
227
|
+
),
|
|
228
|
+
buttonLabel: z.string().min(1).max(50).optional().describe("Label for the dismiss/done button (e.g. 'Done', 'Close')"),
|
|
229
|
+
imageUrl: z.string().url().optional().describe("Optional image URL displayed on the thank you screen")
|
|
230
|
+
}).describe(
|
|
231
|
+
"Schema for a thank you screen shown at the end or inline within a form"
|
|
232
|
+
);
|
|
233
|
+
var messagePanelQuestionSchema = questionSchema.extend({
|
|
234
|
+
type: z.literal("message_panel").describe("Must be exactly 'message_panel'"),
|
|
235
|
+
title: z.string().min(1).max(200).describe("The main heading displayed on the message panel"),
|
|
236
|
+
description: z.string().max(1e3).optional().describe("Optional body text shown below the heading"),
|
|
237
|
+
buttonLabel: z.string().min(1).max(50).optional().describe("Label for the continue button (e.g. 'Continue', 'Next')"),
|
|
238
|
+
imageUrl: z.string().url().optional().describe("Optional image URL displayed on the message panel")
|
|
239
|
+
}).describe(
|
|
240
|
+
"Schema for an inline message panel (informational); distinct from welcome for UI semantics and analytics"
|
|
241
|
+
);
|
|
242
|
+
var exitFormQuestionSchema = questionSchema.extend({
|
|
243
|
+
type: z.literal("exit_form").describe("Must be exactly 'exit_form'")
|
|
244
|
+
}).describe(
|
|
245
|
+
"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
|
+
);
|
|
247
|
+
var yesNoQuestionSchema = questionSchema.extend({
|
|
248
|
+
type: z.literal("yes_no").describe("Must be exactly 'yes_no'"),
|
|
249
|
+
yesLabel: z.string().min(1).max(50).optional().describe("Label for the Yes option (defaults to 'Yes' in the UI if omitted)"),
|
|
250
|
+
noLabel: z.string().min(1).max(50).optional().describe("Label for the No option (defaults to 'No' in the UI if omitted)"),
|
|
251
|
+
displayStyle: yesNoDisplayStyleSchema.optional().describe("Layout for the Yes/No controls (horizontal row or vertical stack)")
|
|
252
|
+
}).describe("Schema for yes/no questions with optional custom labels and layout");
|
|
253
|
+
var ratingMatrixDisplayStyleSchema = z.enum([
|
|
254
|
+
"radio",
|
|
255
|
+
"star",
|
|
256
|
+
"emoji",
|
|
257
|
+
"button"
|
|
258
|
+
]);
|
|
259
|
+
var RatingMatrixDisplayStyles = {
|
|
260
|
+
RADIO: "radio",
|
|
261
|
+
STAR: "star",
|
|
262
|
+
EMOJI: "emoji",
|
|
263
|
+
BUTTON: "button"
|
|
264
|
+
};
|
|
265
|
+
var ratingMatrixStatementSchema = z.object({
|
|
266
|
+
id: z.string().describe("Unique identifier for this statement (system time milliseconds)"),
|
|
267
|
+
value: z.string().min(1).max(100).describe("Internal value / export key for this statement"),
|
|
268
|
+
label: z.string().min(1).max(200).describe("Display text shown to users for this statement"),
|
|
269
|
+
describe: z.string().max(500).optional().describe("LLM tool call description for this statement")
|
|
270
|
+
}).describe("Schema for an individual statement (row) in a rating matrix");
|
|
271
|
+
var ratingMatrixScalePointSchema = z.object({
|
|
272
|
+
id: z.string().describe("Unique identifier for this scale point"),
|
|
273
|
+
value: z.union([z.number(), z.string()]).describe("Stored response value for this scale point (number or string)"),
|
|
274
|
+
label: z.string().min(1).max(200).describe("Display label shown for this scale point"),
|
|
275
|
+
describe: z.string().max(500).optional().describe("LLM tool call description for this scale point")
|
|
276
|
+
}).describe("Schema for a single point on a custom rating scale");
|
|
277
|
+
var ratingMatrixScaleSchema = z.discriminatedUnion("kind", [
|
|
278
|
+
// Likert: symmetric ordinal scale -2…+2, explicit scale points with labels
|
|
279
|
+
z.object({
|
|
280
|
+
kind: z.literal("likert").describe("Symmetric ordinal scale (-2 to +2)"),
|
|
281
|
+
scalePoints: z.array(ratingMatrixScalePointSchema).min(2).max(10).describe("Scale points with display labels for each column")
|
|
282
|
+
}),
|
|
283
|
+
// Numerical: 1…N points where N is 2, 3, 4, or 5, explicit scale points with labels
|
|
284
|
+
z.object({
|
|
285
|
+
kind: z.literal("numerical").describe("Numerical scale from 1 to N"),
|
|
286
|
+
scalePoints: z.array(ratingMatrixScalePointSchema).min(2).max(10).describe("Scale points with display labels for each column"),
|
|
287
|
+
pointCount: z.union([z.literal(2), z.literal(3), z.literal(4), z.literal(5)]).describe("Number of scale points (2, 3, 4, or 5)")
|
|
288
|
+
}),
|
|
289
|
+
// Custom: consumer defines each point's value and label
|
|
290
|
+
z.object({
|
|
291
|
+
kind: z.literal("custom").describe("Custom scale with user-defined points and values"),
|
|
292
|
+
scalePoints: z.array(ratingMatrixScalePointSchema).min(2).max(10).describe("Scale points with display labels for each column")
|
|
293
|
+
})
|
|
294
|
+
]).describe("Scale configuration for rating matrix questions");
|
|
295
|
+
var ratingMatrixQuestionSchema = questionSchema.extend({
|
|
296
|
+
type: z.literal("rating_matrix").describe("Must be exactly 'rating_matrix'"),
|
|
297
|
+
statements: z.array(ratingMatrixStatementSchema).min(1).max(10).describe("Statements (rows) users will rate on the shared scale (1-10)"),
|
|
298
|
+
scale: ratingMatrixScaleSchema.describe("Scale configuration shared across all statement rows"),
|
|
299
|
+
displayStyle: ratingMatrixDisplayStyleSchema.optional().describe(
|
|
300
|
+
"Visual representation of scale points per row (radio buttons, stars, emoji, or buttons)"
|
|
301
|
+
),
|
|
302
|
+
randomizeStatements: z.boolean().optional().default(false).describe("Whether to randomize the order of statements")
|
|
303
|
+
}).describe("Schema for rating matrix questions with multiple statements on a shared scale");
|
|
304
|
+
var matrixRowSchema = z.object({
|
|
305
|
+
id: z.string().describe("Unique identifier for this row (system time milliseconds)"),
|
|
306
|
+
value: z.string().min(1).max(100).describe("Internal value / export key for this row"),
|
|
307
|
+
label: z.string().min(1).max(200).describe("Display text shown to users for this row"),
|
|
308
|
+
describe: z.string().max(500).optional().describe("LLM tool call description for this row")
|
|
309
|
+
}).describe("Schema for an individual row in a matrix choice question");
|
|
310
|
+
var matrixColumnSchema = z.object({
|
|
311
|
+
id: z.string().describe("Unique identifier for this column (system time milliseconds)"),
|
|
312
|
+
value: z.string().min(1).max(100).describe("Internal value / export key for this column"),
|
|
313
|
+
label: z.string().min(1).max(200).describe("Display label shown for this column"),
|
|
314
|
+
describe: z.string().max(500).optional().describe("LLM tool call description for this column")
|
|
315
|
+
}).describe("Schema for an individual column in a matrix choice question");
|
|
316
|
+
var matrixSingleChoiceQuestionSchema = questionSchema.extend({
|
|
317
|
+
type: z.literal("matrix_single_choice").describe("Must be exactly 'matrix_single_choice'"),
|
|
318
|
+
rows: z.array(matrixRowSchema).min(1).max(20).describe("Row items (1-20 rows)"),
|
|
319
|
+
columns: z.array(matrixColumnSchema).min(2).max(10).describe("Column options shared across all rows (2-10 columns)"),
|
|
320
|
+
randomizeRows: z.boolean().optional().default(false).describe("Whether to randomize the order of rows"),
|
|
321
|
+
randomizeColumns: z.boolean().optional().default(false).describe("Whether to randomize the order of columns")
|
|
322
|
+
}).describe("Schema for matrix single-choice questions where one column is selected per row");
|
|
323
|
+
var matrixMultipleChoiceQuestionSchema = questionSchema.extend({
|
|
324
|
+
type: z.literal("matrix_multiple_choice").describe("Must be exactly 'matrix_multiple_choice'"),
|
|
325
|
+
rows: z.array(matrixRowSchema).min(1).max(20).describe("Row items (1-20 rows)"),
|
|
326
|
+
columns: z.array(matrixColumnSchema).min(2).max(10).describe("Column options shared across all rows (2-10 columns)"),
|
|
327
|
+
minSelectionsPerRow: z.number().int().min(0).optional().describe("Minimum number of columns a user must select per row"),
|
|
328
|
+
maxSelectionsPerRow: z.number().int().min(1).optional().describe("Maximum number of columns a user can select per row"),
|
|
329
|
+
randomizeRows: z.boolean().optional().default(false).describe("Whether to randomize the order of rows"),
|
|
330
|
+
randomizeColumns: z.boolean().optional().default(false).describe("Whether to randomize the order of columns")
|
|
331
|
+
}).refine(
|
|
332
|
+
(data) => {
|
|
333
|
+
if (data.minSelectionsPerRow !== void 0 && data.maxSelectionsPerRow !== void 0) {
|
|
334
|
+
return data.minSelectionsPerRow <= data.maxSelectionsPerRow;
|
|
335
|
+
}
|
|
336
|
+
return true;
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
message: "minSelectionsPerRow cannot be greater than maxSelectionsPerRow",
|
|
340
|
+
path: ["minSelectionsPerRow"]
|
|
341
|
+
}
|
|
342
|
+
).describe(
|
|
343
|
+
"Schema for matrix multiple-choice questions where one or more columns can be selected per row"
|
|
344
|
+
);
|
|
194
345
|
var questionOptionSchema = z.object({
|
|
195
346
|
id: z.string().describe("Unique identifier for this option (system time milliseconds)"),
|
|
196
347
|
value: z.string().min(1).max(100).describe("The internal value used for this option"),
|
|
@@ -392,6 +543,14 @@ var nestedDropdownQuestionSchema = questionSchema.extend({
|
|
|
392
543
|
var combinedQuestionSchema = z.discriminatedUnion("type", [
|
|
393
544
|
ratingQuestionSchema,
|
|
394
545
|
annotationQuestionSchema,
|
|
546
|
+
welcomeQuestionSchema,
|
|
547
|
+
thankYouQuestionSchema,
|
|
548
|
+
messagePanelQuestionSchema,
|
|
549
|
+
exitFormQuestionSchema,
|
|
550
|
+
yesNoQuestionSchema,
|
|
551
|
+
ratingMatrixQuestionSchema,
|
|
552
|
+
matrixSingleChoiceQuestionSchema,
|
|
553
|
+
matrixMultipleChoiceQuestionSchema,
|
|
395
554
|
multipleChoiceSingleQuestionSchema,
|
|
396
555
|
multipleChoiceMultipleQuestionSchema,
|
|
397
556
|
npsQuestionSchema,
|
|
@@ -421,6 +580,7 @@ var AnswerItemSchema = z2.object({
|
|
|
421
580
|
"single selected option ID (for single choice questions)"
|
|
422
581
|
),
|
|
423
582
|
rating: z2.number().optional().describe("Star rating value (e.g., 1-5)"),
|
|
583
|
+
yesNo: z2.boolean().optional().describe("Yes/no answer for yes_no questions (true = Yes, false = No)"),
|
|
424
584
|
multipleChoiceMultiple: z2.array(z2.string()).optional().describe("Array of selected option IDs for multiple choice questions"),
|
|
425
585
|
singleChoiceOther: z2.string().optional().describe(
|
|
426
586
|
'Free-text "other" answer for single choice questions when allowOther is enabled'
|
|
@@ -431,6 +591,15 @@ var AnswerItemSchema = z2.object({
|
|
|
431
591
|
annotation: AnnotationSchema.optional().describe(
|
|
432
592
|
"Annotation object containing file and marker details"
|
|
433
593
|
),
|
|
594
|
+
ratingMatrix: z2.record(z2.string(), z2.union([z2.number(), z2.string()])).optional().describe(
|
|
595
|
+
"Rating matrix answers keyed by statement value (export key), value is the selected scale value (number for likert/numerical, string for custom)"
|
|
596
|
+
),
|
|
597
|
+
matrixSingleChoice: z2.record(z2.string(), z2.string()).optional().describe(
|
|
598
|
+
"Matrix single-choice answers keyed by row value (export key), map value is the selected column option value"
|
|
599
|
+
),
|
|
600
|
+
matrixMultipleChoice: z2.record(z2.string(), z2.array(z2.string())).optional().describe(
|
|
601
|
+
"Matrix multiple-choice answers keyed by row value (export key), map value is array of selected column option values"
|
|
602
|
+
),
|
|
434
603
|
others: z2.string().optional().describe(
|
|
435
604
|
"For multiple choice questions and single choice questions, this is the value of the other option"
|
|
436
605
|
)
|
|
@@ -559,14 +728,12 @@ var translationEntrySchema = z4.string().min(1).describe("Translated text conten
|
|
|
559
728
|
var baseQuestionTranslationFieldsSchema = z4.object({
|
|
560
729
|
title: translationEntrySchema.describe("Question title translation"),
|
|
561
730
|
description: translationEntrySchema.optional().describe("Question description translation"),
|
|
562
|
-
descriptionMarkdown: translationEntrySchema.optional().describe("Question description Markdown translation"),
|
|
563
731
|
errorMessage: translationEntrySchema.optional().describe("Error message translation")
|
|
564
732
|
});
|
|
565
733
|
var BASE_QUESTION_TRANSLATION_KEYS = [
|
|
566
734
|
"type",
|
|
567
735
|
"title",
|
|
568
736
|
"description",
|
|
569
|
-
"descriptionMarkdown",
|
|
570
737
|
"errorMessage"
|
|
571
738
|
];
|
|
572
739
|
var ratingQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
|
|
@@ -636,6 +803,80 @@ var annotationQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.ex
|
|
|
636
803
|
annotationText: translationEntrySchema.optional().describe("Annotation display text translation"),
|
|
637
804
|
noAnnotationText: translationEntrySchema.optional().describe("No annotation display text translation")
|
|
638
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");
|
|
639
880
|
var questionTranslationSchema = z4.union([
|
|
640
881
|
ratingQuestionTranslationSchema,
|
|
641
882
|
singleChoiceQuestionTranslationSchema,
|
|
@@ -644,7 +885,14 @@ var questionTranslationSchema = z4.union([
|
|
|
644
885
|
shortAnswerQuestionTranslationSchema,
|
|
645
886
|
longAnswerQuestionTranslationSchema,
|
|
646
887
|
nestedSelectionQuestionTranslationSchema,
|
|
647
|
-
annotationQuestionTranslationSchema
|
|
888
|
+
annotationQuestionTranslationSchema,
|
|
889
|
+
welcomeQuestionTranslationSchema,
|
|
890
|
+
thankYouQuestionTranslationSchema,
|
|
891
|
+
messagePanelQuestionTranslationSchema,
|
|
892
|
+
yesNoQuestionTranslationSchema,
|
|
893
|
+
ratingMatrixQuestionTranslationSchema,
|
|
894
|
+
matrixSingleChoiceQuestionTranslationSchema,
|
|
895
|
+
matrixMultipleChoiceQuestionTranslationSchema
|
|
648
896
|
]).describe("Union of all question type translation schemas");
|
|
649
897
|
var languageCodeSchema = z4.string().min(2).max(10).describe("Language code (e.g., 'en', 'es', 'hi')");
|
|
650
898
|
var questionTranslationsByLanguageSchema = z4.record(languageCodeSchema, questionTranslationSchema).describe("Question translations keyed by language code");
|
|
@@ -743,33 +991,6 @@ __name(createTranslationProvider, "createTranslationProvider");
|
|
|
743
991
|
|
|
744
992
|
// src/schemas/fields/other-screen-schema.ts
|
|
745
993
|
import { z as z5 } from "zod";
|
|
746
|
-
var dismissBehaviorSchema = z5.enum(["fade", "manual"]).describe("How the end screen should be dismissed (fade out or manual dismissal)");
|
|
747
|
-
var DismissBehaviors = {
|
|
748
|
-
FADE: "fade",
|
|
749
|
-
MANUAL: "manual"
|
|
750
|
-
};
|
|
751
|
-
var WelcomeScreenFieldsSchema = z5.object({
|
|
752
|
-
title: z5.string().min(1).max(200).describe("The main title displayed on the welcome screen"),
|
|
753
|
-
description: z5.string().min(1).max(1e3).describe("Description text shown on the welcome screen"),
|
|
754
|
-
buttonLabel: z5.string().min(1).max(50).describe("Text displayed on the welcome screen button")
|
|
755
|
-
}).describe("Schema for welcome screen configuration fields");
|
|
756
|
-
var EndScreenFieldsSchema = z5.object({
|
|
757
|
-
title: z5.string().min(1).max(200).describe("The main title displayed on the end screen"),
|
|
758
|
-
message: z5.string().min(1).max(1e3).describe("Message text shown on the end screen"),
|
|
759
|
-
buttonLabel: z5.string().min(1).max(50).describe("Text displayed on the end screen button"),
|
|
760
|
-
dismissBehavior: dismissBehaviorSchema.describe("How the end screen should be dismissed (fade out or manual dismissal)"),
|
|
761
|
-
fadeDuration: z5.number().int().min(0).max(1e4).describe("Duration in milliseconds for fade dismissal (0-10000)")
|
|
762
|
-
}).describe("Schema for end screen configuration fields");
|
|
763
|
-
var WelcomeFieldsTranslationSchema = z5.object({
|
|
764
|
-
title: z5.string().min(1).max(200).describe("Translated title text for welcome screen"),
|
|
765
|
-
description: z5.string().min(1).max(1e3).describe("Translated description text for welcome screen"),
|
|
766
|
-
buttonLabel: z5.string().min(1).max(50).describe("Translated text for the welcome button label")
|
|
767
|
-
}).describe("Schema for welcome screen translation fields");
|
|
768
|
-
var EndFieldsTranslationSchema = z5.object({
|
|
769
|
-
buttonLabel: z5.string().min(1).max(50).describe("Translated text for the end button label"),
|
|
770
|
-
title: z5.string().min(1).max(200).describe("Translated title text for end screen"),
|
|
771
|
-
message: z5.string().min(1).max(1e3).describe("Translated message text for end screen")
|
|
772
|
-
}).describe("Schema for end screen translation fields");
|
|
773
994
|
var OtherFieldsSchema = z5.object({
|
|
774
995
|
pagination: z5.boolean().describe("Whether to show pagination for multi-page forms"),
|
|
775
996
|
questionNumber: z5.boolean().describe("Whether to display question numbers"),
|
|
@@ -784,9 +1005,8 @@ var OtherFieldsSchema = z5.object({
|
|
|
784
1005
|
}).describe("Schema for other form configuration fields");
|
|
785
1006
|
var LanguageFieldSchema = z5.object({
|
|
786
1007
|
value: z5.string().min(1).max(10).describe("Language code (e.g., 'en', 'es', 'fr')"),
|
|
787
|
-
label: z5.string().min(1).max(50).describe("Display name for the language (e.g., 'English', 'Spanish', 'French')")
|
|
788
|
-
|
|
789
|
-
}).describe("Schema for individual language field with value, label, and fixed status");
|
|
1008
|
+
label: z5.string().min(1).max(50).describe("Display name for the language (e.g., 'English', 'Spanish', 'French')")
|
|
1009
|
+
}).describe("Schema for individual language field with value and label");
|
|
790
1010
|
var LanguagesSchema = z5.array(LanguageFieldSchema).describe("Schema for array of available languages");
|
|
791
1011
|
var OtherFieldsTranslationSchema = z5.object({
|
|
792
1012
|
submitButtonLabel: z5.string().min(1).max(50).describe("Translated text for the submit button"),
|
|
@@ -834,6 +1054,7 @@ var ShareableModes = {
|
|
|
834
1054
|
DARK: "dark",
|
|
835
1055
|
SYSTEM: "system"
|
|
836
1056
|
};
|
|
1057
|
+
var previousButtonModeSchema = z6.enum(["never", "always", "auto"]).describe("Previous button visibility mode: never, always, or auto");
|
|
837
1058
|
var featureSettingsSchema = z6.object({
|
|
838
1059
|
darkOverlay: z6.boolean().describe("Whether to show a dark overlay behind the widget"),
|
|
839
1060
|
closeButton: z6.boolean().describe("Whether to display a close button on the widget"),
|
|
@@ -844,7 +1065,10 @@ var featureSettingsSchema = z6.object({
|
|
|
844
1065
|
customCss: z6.string().optional().describe("Custom CSS link to apply for the feedback form"),
|
|
845
1066
|
shareableMode: shareableModeSchema.optional().describe(
|
|
846
1067
|
"Display mode for the shareable: light, dark, or system preference"
|
|
847
|
-
)
|
|
1068
|
+
),
|
|
1069
|
+
allowMultipleQuestionsPerSection: z6.boolean().describe("Whether to allow multiple questions per section"),
|
|
1070
|
+
rtl: z6.boolean().describe("Whether right-to-left text direction is enabled"),
|
|
1071
|
+
previousButton: previousButtonModeSchema.describe("Previous button visibility mode: never, always, or auto")
|
|
848
1072
|
}).describe("Feature settings controlling widget UI behavior and appearance");
|
|
849
1073
|
var themeColorsSchema = z6.object({
|
|
850
1074
|
theme: z6.string().optional().describe("Theme for a single mode (shadcn variables JSON)")
|
|
@@ -958,34 +1182,6 @@ var otherConfigurationPropertiesSchema = z8.discriminatedUnion("isEnabled", [
|
|
|
958
1182
|
translations: z8.record(z8.string(), OtherFieldsTranslationSchema).describe("Translations for other configuration field labels and buttons keyed by language code")
|
|
959
1183
|
})
|
|
960
1184
|
]).describe("Schema for other configuration properties including fields and translations");
|
|
961
|
-
var welcomeScreenPropertiesSchema = z8.discriminatedUnion("isEnabled", [
|
|
962
|
-
// When welcome screen is disabled
|
|
963
|
-
z8.object({
|
|
964
|
-
isEnabled: z8.literal(false).describe("Whether welcome screen is enabled"),
|
|
965
|
-
welcomeFields: WelcomeScreenFieldsSchema.optional().describe("Welcome screen configuration fields including title, description, and button label"),
|
|
966
|
-
translations: z8.record(z8.string(), WelcomeFieldsTranslationSchema).optional().describe("Translations for welcome screen content keyed by language code")
|
|
967
|
-
}),
|
|
968
|
-
// When welcome screen is enabled
|
|
969
|
-
z8.object({
|
|
970
|
-
isEnabled: z8.literal(true).describe("Whether welcome screen is enabled"),
|
|
971
|
-
welcomeFields: WelcomeScreenFieldsSchema.describe("Welcome screen configuration fields including title, description, and button label"),
|
|
972
|
-
translations: z8.record(z8.string(), WelcomeFieldsTranslationSchema).describe("Translations for welcome screen content keyed by language code")
|
|
973
|
-
})
|
|
974
|
-
]).describe("Schema for welcome screen properties including fields and translations");
|
|
975
|
-
var endScreenPropertiesSchema = z8.discriminatedUnion("isEnabled", [
|
|
976
|
-
// When end screen is disabled
|
|
977
|
-
z8.object({
|
|
978
|
-
isEnabled: z8.literal(false).describe("Whether end screen is enabled"),
|
|
979
|
-
endFields: EndScreenFieldsSchema.optional().describe("End screen configuration fields including title, message, button label, and dismissal behavior"),
|
|
980
|
-
translations: z8.record(z8.string(), EndFieldsTranslationSchema).optional().describe("Translations for end screen content keyed by language code")
|
|
981
|
-
}),
|
|
982
|
-
// When end screen is enabled
|
|
983
|
-
z8.object({
|
|
984
|
-
isEnabled: z8.literal(true).describe("Whether end screen is enabled"),
|
|
985
|
-
endFields: EndScreenFieldsSchema.describe("End screen configuration fields including title, message, button label, and dismissal behavior"),
|
|
986
|
-
translations: z8.record(z8.string(), EndFieldsTranslationSchema).describe("Translations for end screen content keyed by language code")
|
|
987
|
-
})
|
|
988
|
-
]).describe("Schema for end screen properties including fields and translations");
|
|
989
1185
|
var appearancePropertiesSchema = z8.object({
|
|
990
1186
|
themeConfiguration: themeConfigurationSchema.describe("Theme configuration including colors, features, and positioning")
|
|
991
1187
|
}).describe("Schema for appearance properties including theme configuration");
|
|
@@ -1002,10 +1198,8 @@ var formPropertiesSchema = z8.object({
|
|
|
1002
1198
|
externalPublishingProperties: externalPublishingPropertiesSchema.describe("Properties controlling external sharing and publishing of feedback results"),
|
|
1003
1199
|
audienceTriggerProperties: audienceTriggerPropertiesSchema.describe("Properties defining audience targeting and trigger conditions for the feedback form"),
|
|
1004
1200
|
otherConfigurationProperties: otherConfigurationPropertiesSchema.describe("Additional configuration properties including form display options and translations"),
|
|
1005
|
-
welcomeScreenProperties: welcomeScreenPropertiesSchema.describe("Welcome screen configuration including content and translations"),
|
|
1006
|
-
endScreenProperties: endScreenPropertiesSchema.describe("End screen configuration including content, dismissal behavior, and translations"),
|
|
1007
1201
|
appearanceProperties: appearancePropertiesSchema.describe("Appearance configuration including themes, colors, and UI feature settings")
|
|
1008
|
-
}).describe("Complete schema for all feedback-level properties including scheduling, publishing, audience targeting, configuration,
|
|
1202
|
+
}).describe("Complete schema for all feedback-level properties including scheduling, publishing, audience targeting, configuration, and appearance");
|
|
1009
1203
|
|
|
1010
1204
|
// src/schemas/fields/other-properties-schema.ts
|
|
1011
1205
|
import { z as z9 } from "zod";
|
|
@@ -1133,7 +1327,10 @@ var feedbackConfigurationItemSchema = z12.object({
|
|
|
1133
1327
|
showBranding: z12.boolean().describe("Whether to show branding"),
|
|
1134
1328
|
customPosition: z12.boolean().describe("Whether custom position is enabled"),
|
|
1135
1329
|
customIconPosition: z12.boolean().describe("Whether custom icon position is enabled"),
|
|
1136
|
-
customCss: z12.string().nullable().optional().describe("Custom CSS link (optional)")
|
|
1330
|
+
customCss: z12.string().nullable().optional().describe("Custom CSS link (optional)"),
|
|
1331
|
+
allowMultipleQuestionsPerSection: z12.boolean().describe("Whether to allow multiple questions per section"),
|
|
1332
|
+
rtl: z12.boolean().describe("Whether right-to-left text direction is enabled"),
|
|
1333
|
+
previousButton: z12.enum(["never", "always", "auto"]).describe("Previous button visibility mode: never, always, or auto")
|
|
1137
1334
|
}).describe("Feature settings for the feedback form"),
|
|
1138
1335
|
selectedIconPosition: z12.string().describe("Selected position for the feedback icon"),
|
|
1139
1336
|
selectedPosition: z12.string().describe("Selected position for the feedback form")
|
|
@@ -1188,12 +1385,6 @@ var fetchFeedbackDetailsResponseSchema = z12.object({
|
|
|
1188
1385
|
otherConfigurationProperties: otherConfigurationPropertiesSchema.describe(
|
|
1189
1386
|
"Other configuration properties using existing schema"
|
|
1190
1387
|
),
|
|
1191
|
-
welcomeScreenProperties: welcomeScreenPropertiesSchema.describe(
|
|
1192
|
-
"Welcome screen properties using existing schema"
|
|
1193
|
-
),
|
|
1194
|
-
endScreenProperties: endScreenPropertiesSchema.describe(
|
|
1195
|
-
"End screen properties using existing schema"
|
|
1196
|
-
),
|
|
1197
1388
|
appearanceProperties: appearancePropertiesSchema.describe(
|
|
1198
1389
|
"Appearance properties including theme configuration"
|
|
1199
1390
|
)
|
|
@@ -1312,8 +1503,6 @@ var appPropsSchema = z14.object({
|
|
|
1312
1503
|
otherConfigurationProperties: otherConfigurationPropertiesSchema.describe(
|
|
1313
1504
|
"Other configuration properties including form display options and translations"
|
|
1314
1505
|
),
|
|
1315
|
-
welcomeScreenProperties: welcomeScreenPropertiesSchema.optional().describe("Welcome screen configuration (optional)"),
|
|
1316
|
-
endScreenProperties: endScreenPropertiesSchema.optional().describe("End screen configuration (optional)"),
|
|
1317
1506
|
translations: translationsSchema.optional().describe(
|
|
1318
1507
|
"Multi-language translations for questions and form content (optional)"
|
|
1319
1508
|
),
|
|
@@ -1345,9 +1534,6 @@ export {
|
|
|
1345
1534
|
ChoiceOrderOptions,
|
|
1346
1535
|
CurrentModes,
|
|
1347
1536
|
DeviceThemes,
|
|
1348
|
-
DismissBehaviors,
|
|
1349
|
-
EndFieldsTranslationSchema,
|
|
1350
|
-
EndScreenFieldsSchema,
|
|
1351
1537
|
LanguageFieldSchema,
|
|
1352
1538
|
LanguagesSchema,
|
|
1353
1539
|
MultipleChoiceDisplayStyles,
|
|
@@ -1359,6 +1545,7 @@ export {
|
|
|
1359
1545
|
QuestionStatuses,
|
|
1360
1546
|
QuestionTypes,
|
|
1361
1547
|
RatingDisplayStyles,
|
|
1548
|
+
RatingMatrixDisplayStyles,
|
|
1362
1549
|
RatingRepresentationSizes,
|
|
1363
1550
|
RecurringUnits,
|
|
1364
1551
|
ShareableModes,
|
|
@@ -1367,8 +1554,7 @@ export {
|
|
|
1367
1554
|
TranslationProvider,
|
|
1368
1555
|
ValidationRuleTypes,
|
|
1369
1556
|
VisibilityConditionOperators,
|
|
1370
|
-
|
|
1371
|
-
WelcomeScreenFieldsSchema,
|
|
1557
|
+
YesNoDisplayStyles,
|
|
1372
1558
|
YesNoValues,
|
|
1373
1559
|
annotationQuestionSchema,
|
|
1374
1560
|
annotationQuestionTranslationSchema,
|
|
@@ -1390,8 +1576,7 @@ export {
|
|
|
1390
1576
|
deviceInfoSchema,
|
|
1391
1577
|
deviceSessionInfoSchema,
|
|
1392
1578
|
deviceThemeSchema,
|
|
1393
|
-
|
|
1394
|
-
endScreenPropertiesSchema,
|
|
1579
|
+
exitFormQuestionSchema,
|
|
1395
1580
|
externalPublishingPropertiesSchema,
|
|
1396
1581
|
featureSettingsSchema,
|
|
1397
1582
|
feedbackConfigurationItemSchema,
|
|
@@ -1411,6 +1596,14 @@ export {
|
|
|
1411
1596
|
longAnswerQuestionTranslationSchema,
|
|
1412
1597
|
masterPropertiesSchema,
|
|
1413
1598
|
matchedTriggerPropertiesSchema,
|
|
1599
|
+
matrixColumnSchema,
|
|
1600
|
+
matrixMultipleChoiceQuestionSchema,
|
|
1601
|
+
matrixMultipleChoiceQuestionTranslationSchema,
|
|
1602
|
+
matrixRowSchema,
|
|
1603
|
+
matrixSingleChoiceQuestionSchema,
|
|
1604
|
+
matrixSingleChoiceQuestionTranslationSchema,
|
|
1605
|
+
messagePanelQuestionSchema,
|
|
1606
|
+
messagePanelQuestionTranslationSchema,
|
|
1414
1607
|
multipleChoiceDisplayStyleSchema,
|
|
1415
1608
|
multipleChoiceMultipleDisplayStyleSchema,
|
|
1416
1609
|
multipleChoiceMultipleQuestionSchema,
|
|
@@ -1438,6 +1631,12 @@ export {
|
|
|
1438
1631
|
questionTypeSchema,
|
|
1439
1632
|
questionnaireFieldsResponseSchema,
|
|
1440
1633
|
ratingDisplayStyleSchema,
|
|
1634
|
+
ratingMatrixDisplayStyleSchema,
|
|
1635
|
+
ratingMatrixQuestionSchema,
|
|
1636
|
+
ratingMatrixQuestionTranslationSchema,
|
|
1637
|
+
ratingMatrixScalePointSchema,
|
|
1638
|
+
ratingMatrixScaleSchema,
|
|
1639
|
+
ratingMatrixStatementSchema,
|
|
1441
1640
|
ratingQuestionSchema,
|
|
1442
1641
|
ratingQuestionTranslationSchema,
|
|
1443
1642
|
ratingRepresentationSizeSchema,
|
|
@@ -1454,6 +1653,8 @@ export {
|
|
|
1454
1653
|
singleChoiceQuestionTranslationSchema,
|
|
1455
1654
|
submitFeedbackSchema,
|
|
1456
1655
|
surveyTypeSchema,
|
|
1656
|
+
thankYouQuestionSchema,
|
|
1657
|
+
thankYouQuestionTranslationSchema,
|
|
1457
1658
|
themeColorsSchema,
|
|
1458
1659
|
themeConfigurationSchema,
|
|
1459
1660
|
themeModeSchema,
|
|
@@ -1469,8 +1670,12 @@ export {
|
|
|
1469
1670
|
validationRuleSchema,
|
|
1470
1671
|
validationRuleTypeSchema,
|
|
1471
1672
|
visibilityConditionSchema,
|
|
1472
|
-
|
|
1673
|
+
welcomeQuestionSchema,
|
|
1674
|
+
welcomeQuestionTranslationSchema,
|
|
1473
1675
|
whoSchema,
|
|
1676
|
+
yesNoDisplayStyleSchema,
|
|
1677
|
+
yesNoQuestionSchema,
|
|
1678
|
+
yesNoQuestionTranslationSchema,
|
|
1474
1679
|
yesNoSchema,
|
|
1475
1680
|
z15 as z
|
|
1476
1681
|
};
|