@encatch/schema 1.1.0-beta.5 → 1.1.0-beta.7
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 +57 -31
- package/dist/esm/index.js.map +3 -3
- package/dist/types/index.d.ts +3 -3
- package/dist/types/schemas/api/fetch-feedback-schema.d.ts +172 -25
- 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 +79 -25
- package/dist/types/schemas/fields/field-schema.d.ts +145 -7
- package/dist/types/schemas/fields/form-properties-schema.d.ts +89 -44
- package/dist/types/schemas/fields/other-screen-schema.d.ts +0 -5
- package/dist/types/schemas/fields/theme-schema.d.ts +20 -18
- package/dist/types/schemas/fields/translations-schema.d.ts +0 -15
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -88,20 +88,13 @@ var annotationQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.ex
|
|
|
88
88
|
noAnnotationText: translationEntrySchema.optional().describe("No annotation display text translation")
|
|
89
89
|
}).describe("Translation schema for annotation questions");
|
|
90
90
|
var welcomeQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
|
|
91
|
-
type: z.literal("welcome").describe("Question type identifier")
|
|
92
|
-
buttonLabel: translationEntrySchema.optional().describe("Translated proceed/start button label")
|
|
91
|
+
type: z.literal("welcome").describe("Question type identifier")
|
|
93
92
|
}).describe("Translation schema for welcome screen questions");
|
|
94
93
|
var thankYouQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
|
|
95
|
-
type: z.literal("thank_you").describe("Question type identifier")
|
|
96
|
-
buttonLabel: translationEntrySchema.optional().describe(
|
|
97
|
-
"Translated dismiss/done button label"
|
|
98
|
-
)
|
|
94
|
+
type: z.literal("thank_you").describe("Question type identifier")
|
|
99
95
|
}).describe("Translation schema for thank you screen questions");
|
|
100
96
|
var messagePanelQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
|
|
101
|
-
type: z.literal("message_panel").describe("Question type identifier")
|
|
102
|
-
buttonLabel: translationEntrySchema.optional().describe(
|
|
103
|
-
"Translated continue/button label"
|
|
104
|
-
)
|
|
97
|
+
type: z.literal("message_panel").describe("Question type identifier")
|
|
105
98
|
}).describe("Translation schema for message panel questions");
|
|
106
99
|
var yesNoQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
|
|
107
100
|
type: z.literal("yes_no").describe("Question type identifier"),
|
|
@@ -296,7 +289,8 @@ var questionTypeSchema = z2.enum([
|
|
|
296
289
|
"rating_matrix",
|
|
297
290
|
"matrix_single_choice",
|
|
298
291
|
"matrix_multiple_choice",
|
|
299
|
-
"exit_form"
|
|
292
|
+
"exit_form",
|
|
293
|
+
"consent"
|
|
300
294
|
]).describe("Enumeration of all supported question types for form fields");
|
|
301
295
|
var QuestionTypes = {
|
|
302
296
|
RATING: "rating",
|
|
@@ -314,7 +308,8 @@ var QuestionTypes = {
|
|
|
314
308
|
RATING_MATRIX: "rating_matrix",
|
|
315
309
|
MATRIX_SINGLE_CHOICE: "matrix_single_choice",
|
|
316
310
|
MATRIX_MULTIPLE_CHOICE: "matrix_multiple_choice",
|
|
317
|
-
EXIT_FORM: "exit_form"
|
|
311
|
+
EXIT_FORM: "exit_form",
|
|
312
|
+
CONSENT: "consent"
|
|
318
313
|
};
|
|
319
314
|
var validationRuleTypeSchema = z2.enum([
|
|
320
315
|
"required",
|
|
@@ -463,6 +458,9 @@ var ChoiceOrderOptions = {
|
|
|
463
458
|
};
|
|
464
459
|
var questionSchema = z2.object({
|
|
465
460
|
id: z2.string().describe("Unique identifier for the question"),
|
|
461
|
+
slug: z2.string().min(1).max(128).optional().describe(
|
|
462
|
+
"Optional stable identifier for the question (e.g. URLs, analytics, or integrations)"
|
|
463
|
+
),
|
|
466
464
|
type: questionTypeSchema.describe(
|
|
467
465
|
"The type of question (rating, single_choice, etc.)"
|
|
468
466
|
),
|
|
@@ -506,7 +504,6 @@ var welcomeQuestionSchema = questionSchema.extend({
|
|
|
506
504
|
type: z2.literal("welcome").describe("Must be exactly 'welcome'"),
|
|
507
505
|
title: z2.string().min(1).max(200).describe("The main heading displayed on the welcome screen"),
|
|
508
506
|
description: z2.string().max(1e3).optional().describe("Optional sub-text body shown below the heading"),
|
|
509
|
-
buttonLabel: z2.string().min(1).max(50).optional().describe("Label for the proceed/start button (e.g. 'Get Started', 'Begin')"),
|
|
510
507
|
imageUrl: z2.string().url().optional().describe("Optional image URL displayed on the welcome screen")
|
|
511
508
|
}).describe("Schema for a welcome screen displayed at the start or inline within a form");
|
|
512
509
|
var thankYouQuestionSchema = questionSchema.extend({
|
|
@@ -515,7 +512,6 @@ var thankYouQuestionSchema = questionSchema.extend({
|
|
|
515
512
|
description: z2.string().max(1e3).optional().describe(
|
|
516
513
|
"Optional thank you body text; rendered as Markdown where the form supports it"
|
|
517
514
|
),
|
|
518
|
-
buttonLabel: z2.string().min(1).max(50).optional().describe("Label for the dismiss/done button (e.g. 'Done', 'Close')"),
|
|
519
515
|
imageUrl: z2.string().url().optional().describe("Optional image URL displayed on the thank you screen")
|
|
520
516
|
}).describe(
|
|
521
517
|
"Schema for a thank you screen shown at the end or inline within a form"
|
|
@@ -524,7 +520,6 @@ var messagePanelQuestionSchema = questionSchema.extend({
|
|
|
524
520
|
type: z2.literal("message_panel").describe("Must be exactly 'message_panel'"),
|
|
525
521
|
title: z2.string().min(1).max(200).describe("The main heading displayed on the message panel"),
|
|
526
522
|
description: z2.string().max(1e3).optional().describe("Optional body text shown below the heading"),
|
|
527
|
-
buttonLabel: z2.string().min(1).max(50).optional().describe("Label for the continue button (e.g. 'Continue', 'Next')"),
|
|
528
523
|
imageUrl: z2.string().url().optional().describe("Optional image URL displayed on the message panel")
|
|
529
524
|
}).describe(
|
|
530
525
|
"Schema for an inline message panel (informational); distinct from welcome for UI semantics and analytics"
|
|
@@ -540,6 +535,11 @@ var yesNoQuestionSchema = questionSchema.extend({
|
|
|
540
535
|
noLabel: z2.string().min(1).max(50).optional().describe("Label for the No option (defaults to 'No' in the UI if omitted)"),
|
|
541
536
|
displayStyle: yesNoDisplayStyleSchema.optional().describe("Layout for the Yes/No controls (horizontal row or vertical stack)")
|
|
542
537
|
}).describe("Schema for yes/no questions with optional custom labels and layout");
|
|
538
|
+
var consentQuestionSchema = questionSchema.extend({
|
|
539
|
+
type: z2.literal("consent").describe("Must be exactly 'consent'")
|
|
540
|
+
}).describe(
|
|
541
|
+
"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)"
|
|
542
|
+
);
|
|
543
543
|
var ratingMatrixDisplayStyleSchema = z2.enum([
|
|
544
544
|
"radio",
|
|
545
545
|
"star",
|
|
@@ -838,6 +838,7 @@ var combinedQuestionSchema = z2.discriminatedUnion("type", [
|
|
|
838
838
|
messagePanelQuestionSchema,
|
|
839
839
|
exitFormQuestionSchema,
|
|
840
840
|
yesNoQuestionSchema,
|
|
841
|
+
consentQuestionSchema,
|
|
841
842
|
ratingMatrixQuestionSchema,
|
|
842
843
|
matrixSingleChoiceQuestionSchema,
|
|
843
844
|
matrixMultipleChoiceQuestionSchema,
|
|
@@ -871,6 +872,7 @@ var AnswerItemSchema = z3.object({
|
|
|
871
872
|
),
|
|
872
873
|
rating: z3.number().optional().describe("Star rating value (e.g., 1-5)"),
|
|
873
874
|
yesNo: z3.boolean().optional().describe("Yes/no answer for yes_no questions (true = Yes, false = No)"),
|
|
875
|
+
consent: z3.boolean().optional().describe("Consent answer for consent questions (true = checked/agreed, false = unchecked)"),
|
|
874
876
|
multipleChoiceMultiple: z3.array(z3.string()).optional().describe("Array of selected option IDs for multiple choice questions"),
|
|
875
877
|
singleChoiceOther: z3.string().optional().describe(
|
|
876
878
|
'Free-text "other" answer for single choice questions when allowOther is enabled'
|
|
@@ -923,13 +925,9 @@ import { z as z8 } from "zod";
|
|
|
923
925
|
// src/schemas/fields/other-screen-schema.ts
|
|
924
926
|
import { z as z5 } from "zod";
|
|
925
927
|
var OtherFieldsSchema = z5.object({
|
|
926
|
-
pagination: z5.boolean().describe("Whether to show pagination for multi-page forms"),
|
|
927
928
|
questionNumber: z5.boolean().describe("Whether to display question numbers"),
|
|
928
|
-
pageTitle: z5.boolean().describe("Whether to show page titles in multi-page forms"),
|
|
929
|
-
blockerFeedback: z5.boolean().describe("Whether to show blocker feedback for validation errors"),
|
|
930
929
|
submitButtonLabel: z5.string().min(1).max(50).describe("Text for the submit button"),
|
|
931
930
|
previousButtonLabel: z5.string().min(1).max(50).describe("Text for the previous button in pagination"),
|
|
932
|
-
nextButtonLabel: z5.string().min(1).max(50).describe("Text for the next button in pagination"),
|
|
933
931
|
aiEnhancementSuccessMessage: z5.string().min(1).max(100).describe("Message shown when AI enhancement is successful (max 100 characters)"),
|
|
934
932
|
aiEnhancementCooldownErrorMessage: z5.string().min(1).max(100).describe("Message shown when AI enhancement is on cooldown (max 100 characters)"),
|
|
935
933
|
aiEnhancementMaxReachedErrorMessage: z5.string().min(1).max(100).describe("Message shown when maximum AI enhancements reached (max 100 characters)")
|
|
@@ -942,7 +940,6 @@ var LanguagesSchema = z5.array(LanguageFieldSchema).describe("Schema for array o
|
|
|
942
940
|
var OtherFieldsTranslationSchema = z5.object({
|
|
943
941
|
submitButtonLabel: z5.string().min(1).max(50).describe("Translated text for the submit button"),
|
|
944
942
|
previousButtonLabel: z5.string().min(1).max(50).describe("Translated text for the previous button in pagination"),
|
|
945
|
-
nextButtonLabel: z5.string().min(1).max(50).describe("Translated text for the next button in pagination"),
|
|
946
943
|
aiEnhancementSuccessMessage: z5.string().min(1).max(100).describe("Translated message shown when AI enhancement is successful (max 100 characters)"),
|
|
947
944
|
aiEnhancementCooldownErrorMessage: z5.string().min(1).max(100).describe("Translated message shown when AI enhancement is on cooldown (max 100 characters)"),
|
|
948
945
|
aiEnhancementMaxReachedErrorMessage: z5.string().min(1).max(100).describe("Translated message shown when maximum AI enhancements reached (max 100 characters)")
|
|
@@ -986,18 +983,26 @@ var ShareableModes = {
|
|
|
986
983
|
SYSTEM: "system"
|
|
987
984
|
};
|
|
988
985
|
var previousButtonModeSchema = z6.enum(["never", "always", "auto"]).describe("Previous button visibility mode: never, always, or auto");
|
|
986
|
+
var PreviousButtonModes = {
|
|
987
|
+
NEVER: "never",
|
|
988
|
+
ALWAYS: "always",
|
|
989
|
+
AUTO: "auto"
|
|
990
|
+
};
|
|
989
991
|
var featureSettingsSchema = z6.object({
|
|
990
|
-
darkOverlay: z6.boolean().describe("Whether to show a dark overlay behind the widget"),
|
|
991
|
-
closeButton: z6.boolean().describe("Whether to display a close button on the widget"),
|
|
992
|
-
progressBar: z6.boolean().describe("Whether to show a progress bar indicating completion status"),
|
|
993
|
-
showBranding: z6.boolean().describe("Whether to display branding elements on the widget"),
|
|
992
|
+
darkOverlay: z6.boolean().default(false).describe("Whether to show a dark overlay behind the widget"),
|
|
993
|
+
closeButton: z6.boolean().default(true).describe("Whether to display a close button on the widget"),
|
|
994
|
+
progressBar: z6.boolean().default(true).describe("Whether to show a progress bar indicating completion status"),
|
|
995
|
+
showBranding: z6.boolean().default(true).describe("Whether to display branding elements on the widget"),
|
|
994
996
|
customPosition: z6.boolean().describe("Whether custom positioning is enabled"),
|
|
995
997
|
customCss: z6.string().optional().describe("Custom CSS link to apply for the feedback form"),
|
|
996
|
-
shareableMode: shareableModeSchema.optional().describe(
|
|
998
|
+
shareableMode: shareableModeSchema.optional().default(ShareableModes.LIGHT).describe(
|
|
997
999
|
"Display mode for the shareable: light, dark, or system preference"
|
|
998
1000
|
),
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
+
enableShareableKeyboardNavigation: z6.boolean().default(false).describe(
|
|
1002
|
+
"Whether keyboard navigation is enabled for the shareable widget experience"
|
|
1003
|
+
),
|
|
1004
|
+
rtl: z6.boolean().default(false).describe("Whether right-to-left text direction is enabled"),
|
|
1005
|
+
previousButton: previousButtonModeSchema.default(PreviousButtonModes.ALWAYS).describe("Previous button visibility mode: never, always, or auto")
|
|
1001
1006
|
}).describe("Feature settings controlling widget UI behavior and appearance");
|
|
1002
1007
|
var themeColorsSchema = z6.object({
|
|
1003
1008
|
theme: z6.string().optional().describe("Theme for a single mode (shadcn variables JSON)")
|
|
@@ -1101,13 +1106,13 @@ var otherConfigurationPropertiesSchema = z8.discriminatedUnion("isEnabled", [
|
|
|
1101
1106
|
// When other configuration is disabled
|
|
1102
1107
|
z8.object({
|
|
1103
1108
|
isEnabled: z8.literal(false).describe("Whether other configuration properties are enabled"),
|
|
1104
|
-
otherFields: OtherFieldsSchema.describe("Other form configuration fields including
|
|
1109
|
+
otherFields: OtherFieldsSchema.describe("Other form configuration fields including buttons and display options"),
|
|
1105
1110
|
translations: z8.record(z8.string(), OtherFieldsTranslationSchema).optional().describe("Translations for other configuration field labels and buttons keyed by language code")
|
|
1106
1111
|
}),
|
|
1107
1112
|
// When other configuration is enabled
|
|
1108
1113
|
z8.object({
|
|
1109
1114
|
isEnabled: z8.literal(true).describe("Whether other configuration properties are enabled"),
|
|
1110
|
-
otherFields: OtherFieldsSchema.describe("Other form configuration fields including
|
|
1115
|
+
otherFields: OtherFieldsSchema.describe("Other form configuration fields including buttons and display options"),
|
|
1111
1116
|
translations: z8.record(z8.string(), OtherFieldsTranslationSchema).describe("Translations for other configuration field labels and buttons keyed by language code")
|
|
1112
1117
|
})
|
|
1113
1118
|
]).describe("Schema for other configuration properties including fields and translations");
|
|
@@ -1256,6 +1261,9 @@ var feedbackConfigurationItemSchema = z12.object({
|
|
|
1256
1261
|
customPosition: z12.boolean().describe("Whether custom position is enabled"),
|
|
1257
1262
|
customIconPosition: z12.boolean().describe("Whether custom icon position is enabled"),
|
|
1258
1263
|
customCss: z12.string().nullable().optional().describe("Custom CSS link (optional)"),
|
|
1264
|
+
enableShareableKeyboardNavigation: z12.boolean().default(false).describe(
|
|
1265
|
+
"Whether keyboard navigation is enabled for the shareable widget experience"
|
|
1266
|
+
),
|
|
1259
1267
|
rtl: z12.boolean().describe("Whether right-to-left text direction is enabled"),
|
|
1260
1268
|
previousButton: z12.enum(["never", "always", "auto"]).describe("Previous button visibility mode: never, always, or auto")
|
|
1261
1269
|
}).describe("Feature settings for the feedback form"),
|
|
@@ -1285,6 +1293,16 @@ var formConfigurationResponseSchema = z12.object({
|
|
|
1285
1293
|
formTitle: z12.string().describe("Title of the feedback form"),
|
|
1286
1294
|
formDescription: z12.string().describe("Description of the feedback form")
|
|
1287
1295
|
}).describe("Form configuration response with title and description");
|
|
1296
|
+
var logicJumpRuleSchema = z12.object({
|
|
1297
|
+
jsonLogic: z12.record(z12.string(), z12.unknown()).describe("JSON Logic expression to evaluate"),
|
|
1298
|
+
targetQuestionId: z12.string().describe("Question ID to navigate to when this rule matches")
|
|
1299
|
+
}).describe("A single logic jump rule mapping a condition to a target question");
|
|
1300
|
+
var logicJumpRulesSchema = z12.record(
|
|
1301
|
+
z12.string(),
|
|
1302
|
+
z12.array(logicJumpRuleSchema)
|
|
1303
|
+
).describe(
|
|
1304
|
+
"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."
|
|
1305
|
+
);
|
|
1288
1306
|
var questionnaireFieldsResponseSchema = z12.object({
|
|
1289
1307
|
questions: z12.record(z12.string(), combinedQuestionSchema).describe("Collection of questions keyed by their string identifiers"),
|
|
1290
1308
|
sections: z12.array(sectionSchema).describe(
|
|
@@ -1295,9 +1313,12 @@ var questionnaireFieldsResponseSchema = z12.object({
|
|
|
1295
1313
|
),
|
|
1296
1314
|
selectedLanguages: LanguagesSchema.describe(
|
|
1297
1315
|
"Array of languages selected for this questionnaire"
|
|
1298
|
-
)
|
|
1316
|
+
),
|
|
1317
|
+
isLogicJumpsEnabled: z12.boolean().optional().default(false).describe("When true, form navigation follows logicJumpRules instead of linear section order"),
|
|
1318
|
+
logicJumpRules: logicJumpRulesSchema.optional().describe("Conditional navigation rules evaluated per question to determine the next question to show"),
|
|
1319
|
+
contextVariables: z12.array(z12.string()).optional().describe("List of context variable keys expected by the form (informational)")
|
|
1299
1320
|
}).describe(
|
|
1300
|
-
"Questionnaire fields response including questions, sections, translations, and
|
|
1321
|
+
"Questionnaire fields response including questions, sections, translations, selected languages, and optional logic jump configuration"
|
|
1301
1322
|
);
|
|
1302
1323
|
var fetchFeedbackDetailsResponseSchema = z12.object({
|
|
1303
1324
|
feedbackConfigurationId: z12.string().uuid().describe("Unique identifier for the feedback configuration"),
|
|
@@ -1467,6 +1488,7 @@ export {
|
|
|
1467
1488
|
OtherFieldsSchema,
|
|
1468
1489
|
OtherFieldsTranslationSchema,
|
|
1469
1490
|
Positions,
|
|
1491
|
+
PreviousButtonModes,
|
|
1470
1492
|
PublicationStatuses,
|
|
1471
1493
|
QuestionStatuses,
|
|
1472
1494
|
QuestionTypes,
|
|
@@ -1492,6 +1514,7 @@ export {
|
|
|
1492
1514
|
conditionalIfMetadataSchema,
|
|
1493
1515
|
conditionalIfSchema,
|
|
1494
1516
|
conditionalWhenSchema,
|
|
1517
|
+
consentQuestionSchema,
|
|
1495
1518
|
createTranslationProvider,
|
|
1496
1519
|
currentModeSchema,
|
|
1497
1520
|
customEventFieldOperatorSchema,
|
|
@@ -1514,6 +1537,8 @@ export {
|
|
|
1514
1537
|
formConfigSchema,
|
|
1515
1538
|
formConfigurationResponseSchema,
|
|
1516
1539
|
formPropertiesSchema,
|
|
1540
|
+
logicJumpRuleSchema,
|
|
1541
|
+
logicJumpRulesSchema,
|
|
1517
1542
|
longAnswerQuestionSchema,
|
|
1518
1543
|
longAnswerQuestionTranslationSchema,
|
|
1519
1544
|
masterPropertiesSchema,
|
|
@@ -1542,6 +1567,7 @@ export {
|
|
|
1542
1567
|
otherConfigurationPropertiesSchema,
|
|
1543
1568
|
partialFeedbackSchema,
|
|
1544
1569
|
positionSchema,
|
|
1570
|
+
previousButtonModeSchema,
|
|
1545
1571
|
publicationStatusSchema,
|
|
1546
1572
|
queryOutputSchema,
|
|
1547
1573
|
questionCentricTranslationsSchema,
|