@encatch/schema 1.1.0-beta.6 → 1.1.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -289,7 +289,8 @@ var questionTypeSchema = z2.enum([
289
289
  "rating_matrix",
290
290
  "matrix_single_choice",
291
291
  "matrix_multiple_choice",
292
- "exit_form"
292
+ "exit_form",
293
+ "consent"
293
294
  ]).describe("Enumeration of all supported question types for form fields");
294
295
  var QuestionTypes = {
295
296
  RATING: "rating",
@@ -307,7 +308,8 @@ var QuestionTypes = {
307
308
  RATING_MATRIX: "rating_matrix",
308
309
  MATRIX_SINGLE_CHOICE: "matrix_single_choice",
309
310
  MATRIX_MULTIPLE_CHOICE: "matrix_multiple_choice",
310
- EXIT_FORM: "exit_form"
311
+ EXIT_FORM: "exit_form",
312
+ CONSENT: "consent"
311
313
  };
312
314
  var validationRuleTypeSchema = z2.enum([
313
315
  "required",
@@ -456,6 +458,9 @@ var ChoiceOrderOptions = {
456
458
  };
457
459
  var questionSchema = z2.object({
458
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
+ ),
459
464
  type: questionTypeSchema.describe(
460
465
  "The type of question (rating, single_choice, etc.)"
461
466
  ),
@@ -530,6 +535,11 @@ var yesNoQuestionSchema = questionSchema.extend({
530
535
  noLabel: z2.string().min(1).max(50).optional().describe("Label for the No option (defaults to 'No' in the UI if omitted)"),
531
536
  displayStyle: yesNoDisplayStyleSchema.optional().describe("Layout for the Yes/No controls (horizontal row or vertical stack)")
532
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
+ );
533
543
  var ratingMatrixDisplayStyleSchema = z2.enum([
534
544
  "radio",
535
545
  "star",
@@ -828,6 +838,7 @@ var combinedQuestionSchema = z2.discriminatedUnion("type", [
828
838
  messagePanelQuestionSchema,
829
839
  exitFormQuestionSchema,
830
840
  yesNoQuestionSchema,
841
+ consentQuestionSchema,
831
842
  ratingMatrixQuestionSchema,
832
843
  matrixSingleChoiceQuestionSchema,
833
844
  matrixMultipleChoiceQuestionSchema,
@@ -861,6 +872,7 @@ var AnswerItemSchema = z3.object({
861
872
  ),
862
873
  rating: z3.number().optional().describe("Star rating value (e.g., 1-5)"),
863
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)"),
864
876
  multipleChoiceMultiple: z3.array(z3.string()).optional().describe("Array of selected option IDs for multiple choice questions"),
865
877
  singleChoiceOther: z3.string().optional().describe(
866
878
  'Free-text "other" answer for single choice questions when allowOther is enabled'
@@ -971,18 +983,26 @@ var ShareableModes = {
971
983
  SYSTEM: "system"
972
984
  };
973
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
+ };
974
991
  var featureSettingsSchema = z6.object({
975
- darkOverlay: z6.boolean().describe("Whether to show a dark overlay behind the widget"),
976
- closeButton: z6.boolean().describe("Whether to display a close button on the widget"),
977
- progressBar: z6.boolean().describe("Whether to show a progress bar indicating completion status"),
978
- 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"),
979
996
  customPosition: z6.boolean().describe("Whether custom positioning is enabled"),
980
997
  customCss: z6.string().optional().describe("Custom CSS link to apply for the feedback form"),
981
- shareableMode: shareableModeSchema.optional().describe(
998
+ shareableMode: shareableModeSchema.optional().default(ShareableModes.LIGHT).describe(
982
999
  "Display mode for the shareable: light, dark, or system preference"
983
1000
  ),
984
- rtl: z6.boolean().describe("Whether right-to-left text direction is enabled"),
985
- previousButton: previousButtonModeSchema.describe("Previous button visibility mode: never, always, or auto")
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")
986
1006
  }).describe("Feature settings controlling widget UI behavior and appearance");
987
1007
  var themeColorsSchema = z6.object({
988
1008
  theme: z6.string().optional().describe("Theme for a single mode (shadcn variables JSON)")
@@ -1241,6 +1261,9 @@ var feedbackConfigurationItemSchema = z12.object({
1241
1261
  customPosition: z12.boolean().describe("Whether custom position is enabled"),
1242
1262
  customIconPosition: z12.boolean().describe("Whether custom icon position is enabled"),
1243
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
+ ),
1244
1267
  rtl: z12.boolean().describe("Whether right-to-left text direction is enabled"),
1245
1268
  previousButton: z12.enum(["never", "always", "auto"]).describe("Previous button visibility mode: never, always, or auto")
1246
1269
  }).describe("Feature settings for the feedback form"),
@@ -1270,6 +1293,16 @@ var formConfigurationResponseSchema = z12.object({
1270
1293
  formTitle: z12.string().describe("Title of the feedback form"),
1271
1294
  formDescription: z12.string().describe("Description of the feedback form")
1272
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
+ );
1273
1306
  var questionnaireFieldsResponseSchema = z12.object({
1274
1307
  questions: z12.record(z12.string(), combinedQuestionSchema).describe("Collection of questions keyed by their string identifiers"),
1275
1308
  sections: z12.array(sectionSchema).describe(
@@ -1280,9 +1313,12 @@ var questionnaireFieldsResponseSchema = z12.object({
1280
1313
  ),
1281
1314
  selectedLanguages: LanguagesSchema.describe(
1282
1315
  "Array of languages selected for this questionnaire"
1283
- )
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)")
1284
1320
  }).describe(
1285
- "Questionnaire fields response including questions, sections, translations, and selected languages"
1321
+ "Questionnaire fields response including questions, sections, translations, selected languages, and optional logic jump configuration"
1286
1322
  );
1287
1323
  var fetchFeedbackDetailsResponseSchema = z12.object({
1288
1324
  feedbackConfigurationId: z12.string().uuid().describe("Unique identifier for the feedback configuration"),
@@ -1452,6 +1488,7 @@ export {
1452
1488
  OtherFieldsSchema,
1453
1489
  OtherFieldsTranslationSchema,
1454
1490
  Positions,
1491
+ PreviousButtonModes,
1455
1492
  PublicationStatuses,
1456
1493
  QuestionStatuses,
1457
1494
  QuestionTypes,
@@ -1477,6 +1514,7 @@ export {
1477
1514
  conditionalIfMetadataSchema,
1478
1515
  conditionalIfSchema,
1479
1516
  conditionalWhenSchema,
1517
+ consentQuestionSchema,
1480
1518
  createTranslationProvider,
1481
1519
  currentModeSchema,
1482
1520
  customEventFieldOperatorSchema,
@@ -1499,6 +1537,8 @@ export {
1499
1537
  formConfigSchema,
1500
1538
  formConfigurationResponseSchema,
1501
1539
  formPropertiesSchema,
1540
+ logicJumpRuleSchema,
1541
+ logicJumpRulesSchema,
1502
1542
  longAnswerQuestionSchema,
1503
1543
  longAnswerQuestionTranslationSchema,
1504
1544
  masterPropertiesSchema,
@@ -1527,6 +1567,7 @@ export {
1527
1567
  otherConfigurationPropertiesSchema,
1528
1568
  partialFeedbackSchema,
1529
1569
  positionSchema,
1570
+ previousButtonModeSchema,
1530
1571
  publicationStatusSchema,
1531
1572
  queryOutputSchema,
1532
1573
  questionCentricTranslationsSchema,