@encatch/schema 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -2,7 +2,131 @@ 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 z3 } from "zod";
5
+ import { z as z4 } from "zod";
6
+
7
+ // src/helpers/csat-emoji-helper.ts
8
+ var CSAT_DEFAULT_EMOJIS_BY_SCALE = {
9
+ 2: ["\u{1F621}", "\u{1F604}"],
10
+ 3: ["\u{1F621}", "\u{1F610}", "\u{1F604}"],
11
+ 4: ["\u{1F621}", "\u{1F615}", "\u{1F642}", "\u{1F604}"],
12
+ 5: ["\u{1F621}", "\u{1F615}", "\u{1F610}", "\u{1F642}", "\u{1F604}"]
13
+ };
14
+ var CSAT_EMOJI_CATEGORIES = [
15
+ {
16
+ id: "unhappy",
17
+ label: "Unhappy",
18
+ emojis: ["\u{1F621}", "\u{1F620}", "\u{1F624}", "\u{1F61E}", "\u{1F615}", "\u{1F61F}", "\u{1F622}", "\u{1F62D}", "\u{1F630}", "\u{1F628}"]
19
+ },
20
+ {
21
+ id: "neutral",
22
+ label: "Neutral",
23
+ emojis: ["\u{1F610}", "\u{1F611}", "\u{1F643}", "\u{1F636}", "\u{1F972}"]
24
+ },
25
+ {
26
+ id: "happy",
27
+ label: "Happy",
28
+ emojis: ["\u{1F642}", "\u{1F60A}", "\u{1F604}", "\u{1F601}", "\u{1F606}", "\u{1F929}", "\u{1F60D}", "\u{1F970}", "\u{1F60E}"]
29
+ },
30
+ {
31
+ id: "gestures",
32
+ label: "Gestures",
33
+ emojis: ["\u{1F44D}", "\u{1F44E}", "\u{1F44F}", "\u{1F64C}", "\u{1F91D}", "\u270C\uFE0F"]
34
+ },
35
+ {
36
+ id: "hearts",
37
+ label: "Hearts",
38
+ emojis: ["\u2764\uFE0F", "\u{1F9E1}", "\u{1F49B}", "\u{1F49A}", "\u{1F499}", "\u{1F49C}", "\u{1F494}"]
39
+ },
40
+ {
41
+ id: "symbols",
42
+ label: "Symbols",
43
+ emojis: ["\u2B50", "\u{1F31F}", "\u{1F4AF}", "\u2705", "\u274C", "\u26A0\uFE0F"]
44
+ },
45
+ {
46
+ id: "celebration",
47
+ label: "Celebration",
48
+ emojis: ["\u{1F389}", "\u{1F973}", "\u{1F38A}", "\u{1F3C6}", "\u{1F525}"]
49
+ }
50
+ ];
51
+ var CSAT_EMOJI_PALETTE = [
52
+ ...new Set(CSAT_EMOJI_CATEGORIES.flatMap((category) => category.emojis))
53
+ ];
54
+ var PALETTE_SET = new Set(CSAT_EMOJI_PALETTE);
55
+ function isCsatEmojiPaletteItem(value) {
56
+ return PALETTE_SET.has(value);
57
+ }
58
+ __name(isCsatEmojiPaletteItem, "isCsatEmojiPaletteItem");
59
+ function getDefaultOverrideEmojiForScale(scale) {
60
+ const normalizedScale = [2, 3, 4, 5].includes(scale) ? scale : 5;
61
+ const defaults = CSAT_DEFAULT_EMOJIS_BY_SCALE[normalizedScale] ?? CSAT_DEFAULT_EMOJIS_BY_SCALE[5];
62
+ return defaults.map(
63
+ (emoji) => isCsatEmojiPaletteItem(emoji) ? emoji : CSAT_EMOJI_PALETTE[0] ?? "\u{1F610}"
64
+ );
65
+ }
66
+ __name(getDefaultOverrideEmojiForScale, "getDefaultOverrideEmojiForScale");
67
+ function parseOverrideEmoji(overrideEmoji) {
68
+ if (overrideEmoji == null || overrideEmoji.trim() === "") return null;
69
+ try {
70
+ const parsed = JSON.parse(overrideEmoji);
71
+ if (!Array.isArray(parsed)) return null;
72
+ if (!parsed.every((item) => typeof item === "string")) return null;
73
+ return parsed;
74
+ } catch {
75
+ return null;
76
+ }
77
+ }
78
+ __name(parseOverrideEmoji, "parseOverrideEmoji");
79
+ function serializeOverrideEmoji(emojis) {
80
+ return JSON.stringify([...emojis]);
81
+ }
82
+ __name(serializeOverrideEmoji, "serializeOverrideEmoji");
83
+ function validateOverrideEmojiForScale(overrideEmoji, scale) {
84
+ if (overrideEmoji == null || overrideEmoji.trim() === "") {
85
+ return { valid: true, emojis: null };
86
+ }
87
+ const emojis = parseOverrideEmoji(overrideEmoji);
88
+ if (!emojis) {
89
+ return { valid: false, emojis: null, error: "overrideEmoji must be a valid JSON array of strings" };
90
+ }
91
+ if (emojis.length !== scale) {
92
+ return {
93
+ valid: false,
94
+ emojis: null,
95
+ error: `overrideEmoji must contain exactly ${scale} emoji(s) for a ${scale}-point scale`
96
+ };
97
+ }
98
+ for (const emoji of emojis) {
99
+ if (!isCsatEmojiPaletteItem(emoji)) {
100
+ return {
101
+ valid: false,
102
+ emojis: null,
103
+ error: `Emoji "${emoji}" is not in the allowed CSAT palette`
104
+ };
105
+ }
106
+ }
107
+ return { valid: true, emojis };
108
+ }
109
+ __name(validateOverrideEmojiForScale, "validateOverrideEmojiForScale");
110
+ function resolveCsatEmojis(scale, overrideEmoji) {
111
+ const normalizedScale = [2, 3, 4, 5].includes(scale) ? scale : 5;
112
+ const { emojis } = validateOverrideEmojiForScale(overrideEmoji, normalizedScale);
113
+ if (emojis) return emojis;
114
+ return [...CSAT_DEFAULT_EMOJIS_BY_SCALE[normalizedScale] ?? CSAT_DEFAULT_EMOJIS_BY_SCALE[5]];
115
+ }
116
+ __name(resolveCsatEmojis, "resolveCsatEmojis");
117
+ function getCsatEmojiForPoint(point, scale, overrideEmoji) {
118
+ const emojis = resolveCsatEmojis(scale, overrideEmoji);
119
+ return emojis[point - 1] ?? emojis[emojis.length - 1] ?? "\u{1F610}";
120
+ }
121
+ __name(getCsatEmojiForPoint, "getCsatEmojiForPoint");
122
+ function trimOverrideEmojiForScale(overrideEmoji, newScale) {
123
+ const parsed = parseOverrideEmoji(overrideEmoji);
124
+ if (!parsed) return void 0;
125
+ const trimmed = parsed.slice(0, newScale);
126
+ if (trimmed.length === 0) return void 0;
127
+ return serializeOverrideEmoji(trimmed);
128
+ }
129
+ __name(trimOverrideEmojiForScale, "trimOverrideEmojiForScale");
6
130
 
7
131
  // src/schemas/fields/translations-schema.ts
8
132
  import { z } from "zod";
@@ -96,7 +220,18 @@ var videoAudioQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.ex
96
220
  videoIdleHint: z.string().max(200).optional().describe("Translated video idle overlay hint"),
97
221
  photoEmptyHint: z.string().max(200).optional().describe("Translated empty photo area hint"),
98
222
  photoUseCameraButtonLabel: z.string().max(80).optional().describe("Translated Use camera button"),
99
- photoUploadImageButtonLabel: z.string().max(80).optional().describe("Translated Upload image button")
223
+ photoUploadImageButtonLabel: z.string().max(80).optional().describe("Translated Upload image button"),
224
+ capturePhotoButtonLabel: z.string().max(80).optional().describe("Translated Capture photo button"),
225
+ cancelButtonLabel: z.string().max(80).optional().describe("Translated Cancel button in live photo mode"),
226
+ uploadPhotoButtonLabel: z.string().max(80).optional().describe("Translated Upload Photo button"),
227
+ replaceButtonLabel: z.string().max(80).optional().describe("Translated Replace button"),
228
+ removeButtonLabel: z.string().max(80).optional().describe("Translated Remove button"),
229
+ stopRecordingButtonLabel: z.string().max(80).optional().describe("Translated Stop recording button"),
230
+ playButtonLabel: z.string().max(80).optional().describe("Translated Play button"),
231
+ pauseButtonLabel: z.string().max(80).optional().describe("Translated Pause button"),
232
+ uploadButtonLabel: z.string().max(80).optional().describe("Translated Upload button on preview"),
233
+ rerecordButtonLabel: z.string().max(80).optional().describe("Translated Re-record button"),
234
+ dismissErrorButtonLabel: z.string().max(80).optional().describe("Translated dismiss error control label")
100
235
  }).describe("Translation schema for video/audio/photo/text questions");
101
236
  var dateQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
102
237
  type: z.literal("date").describe("Question type identifier"),
@@ -114,7 +249,11 @@ var signatureQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.ext
114
249
  modeTabLabelUpload: z.string().max(80).optional().describe("Translated Upload tab label"),
115
250
  drawCanvasHint: z.string().max(200).optional().describe("Translated empty-canvas hint"),
116
251
  uploadZonePrimary: z.string().max(200).optional().describe("Translated idle upload prompt"),
117
- uploadZoneDrag: z.string().max(120).optional().describe("Translated drag-over upload prompt")
252
+ uploadZoneDrag: z.string().max(120).optional().describe("Translated drag-over upload prompt"),
253
+ uploadSignatureButtonLabel: z.string().max(80).optional().describe("Translated Upload Signature button"),
254
+ uploadButtonLabel: z.string().max(80).optional().describe("Translated Upload button in upload mode"),
255
+ removeButtonLabel: z.string().max(80).optional().describe("Translated Remove button"),
256
+ dismissErrorButtonLabel: z.string().max(80).optional().describe("Translated dismiss error control label")
118
257
  }).describe("Translation schema for signature questions");
119
258
  var schedulerQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
120
259
  type: z.literal("scheduler").describe("Question type identifier"),
@@ -438,8 +577,217 @@ var completionCtaSchema = z2.object({
438
577
  "Optional completion CTA configuration for thank_you and exit_form questions; controls what happens after form submission \u2014 redirect, in-app navigation, or dismiss \u2014 with separate settings per rendering surface (inApp / link)"
439
578
  );
440
579
 
580
+ // src/schemas/fields/answer-schema.ts
581
+ import { z as z3 } from "zod";
582
+ var AnnotationMarkerSchema = z3.object({
583
+ markerNo: z3.string(),
584
+ timeline: z3.string(),
585
+ comment: z3.string()
586
+ });
587
+ var AnnotationSchema = z3.object({
588
+ fileType: z3.string(),
589
+ fileName: z3.string(),
590
+ markers: z3.array(AnnotationMarkerSchema)
591
+ });
592
+ var SignatureAnswerSchema = z3.object({
593
+ mode: z3.enum(["type", "draw", "upload"]).describe("The signing method the respondent used"),
594
+ fileUrl: z3.string().optional().describe(
595
+ "Secure URL to the signature artifact for draw and upload modes"
596
+ ),
597
+ typedName: z3.string().optional().describe("The name the respondent typed for type mode")
598
+ }).describe("Answer for a signature question");
599
+ var FileUploadAnswerItemSchema = z3.object({
600
+ fileUrl: z3.string().describe("Secure URL to the uploaded file"),
601
+ fileName: z3.string().describe("Original filename as provided by the respondent"),
602
+ fileSizeMb: z3.number().describe("File size in megabytes"),
603
+ mimeType: z3.string().optional().describe(
604
+ "MIME type of the uploaded file (e.g. 'application/pdf', 'image/jpeg')"
605
+ )
606
+ }).describe("Metadata for a single uploaded file");
607
+ var FileUploadAnswerSchema = z3.array(FileUploadAnswerItemSchema).describe(
608
+ "Answer for a file upload question; array supports single and multiple file uploads"
609
+ );
610
+ var PhoneNumberAnswerSchema = z3.object({
611
+ countryCode: z3.string().describe(
612
+ "Dialing country code including the + prefix (e.g. '+1', '+91')"
613
+ ),
614
+ number: z3.string().describe("Local phone number without the country code"),
615
+ e164: z3.string().optional().describe("Full phone number in E.164 format (e.g. '+14155552671')")
616
+ }).describe("Answer for a phone number question");
617
+ var AddressAnswerSchema = z3.object({
618
+ addressLine1: z3.string().optional().describe("Primary street address line"),
619
+ addressLine2: z3.string().optional().describe("Secondary address line (apartment, suite, etc.)"),
620
+ city: z3.string().optional().describe("City or town"),
621
+ stateProvince: z3.string().optional().describe("State, region, or province"),
622
+ postalCode: z3.string().optional().describe("ZIP or postal code"),
623
+ country: z3.string().optional().describe("Country name or ISO 3166-1 alpha-2 code")
624
+ }).describe("Answer for an address question");
625
+ var VideoAudioAnswerSchema = z3.object({
626
+ mode: z3.enum(["video", "audio", "photo", "text"]).describe("The answer mode the respondent chose"),
627
+ fileUrl: z3.string().optional().describe(
628
+ "Secure URL or temporary data URL to the recorded, captured, or uploaded video, audio, or image file"
629
+ ),
630
+ text: z3.string().optional().describe("Written answer for text mode"),
631
+ durationSeconds: z3.number().optional().describe(
632
+ "Actual recording length in seconds for video and audio modes (not used for photo)"
633
+ ),
634
+ transcriptText: z3.string().optional().describe("Auto-generated transcript for video and audio recordings")
635
+ }).describe("Answer for a video and audio question");
636
+ var QnaWithAiPairSchema = z3.object({
637
+ question: z3.string().describe("The question the respondent asked"),
638
+ answer: z3.string().describe("The AI-generated answer based on the knowledge base")
639
+ }).describe("A single Q&A exchange between the respondent and the AI");
640
+ var QnaWithAiAnswerSchema = z3.array(QnaWithAiPairSchema).describe(
641
+ "Answer for a qna_with_ai question; ordered transcript of Q&A pairs from the session"
642
+ );
643
+ var SchedulerAnswerSchema = z3.discriminatedUnion("provider", [
644
+ z3.object({
645
+ provider: z3.literal("google_calendar").describe("The calendar integration used to make the booking"),
646
+ bookedAt: z3.string().describe(
647
+ "Unix timestamp in seconds as a string when the respondent confirmed the booking"
648
+ )
649
+ }),
650
+ z3.object({
651
+ provider: z3.literal("calendly").describe("The calendar integration used to make the booking"),
652
+ slotStart: z3.string().describe(
653
+ "ISO 8601 datetime of the booked slot start (e.g. '2026-05-15T14:00:00Z')"
654
+ ),
655
+ slotEnd: z3.string().describe(
656
+ "ISO 8601 datetime of the booked slot end (e.g. '2026-05-15T14:30:00Z')"
657
+ ),
658
+ eventId: z3.string().optional().describe("Calendly event UUID"),
659
+ bookedAt: z3.string().describe(
660
+ "Unix timestamp in seconds as a string when the respondent completed the booking"
661
+ )
662
+ })
663
+ ]).describe("Answer for a scheduler question");
664
+ var PaymentsUpiAnswerSchema = z3.object({
665
+ transactionId: z3.string().describe(
666
+ "Respondent-entered UPI transaction ID / UTR; self-reported and not verified by Encatch"
667
+ ),
668
+ encatchPaymentReference: z3.string().describe(
669
+ "Opaque Encatch-generated reconciliation reference included in the UPI intent"
670
+ ),
671
+ amount: z3.string().trim().refine((s) => {
672
+ const n = Number(s);
673
+ return Number.isFinite(n) && n > 0;
674
+ }, { message: "Amount must be a positive numeric value" }).describe(
675
+ "INR amount shown to the respondent when the payment instruction was generated, as a decimal string (legacy numeric values are accepted when parsing)"
676
+ ),
677
+ currency: z3.literal("INR").describe("Currency for UPI payments"),
678
+ payeeVpa: z3.string().describe("UPI VPA shown to the respondent"),
679
+ payeeName: z3.string().optional().describe("Payee display name shown to the respondent"),
680
+ sourceEmail: z3.string().optional().describe("Email address resolved from the configured source email question"),
681
+ upiIntentUri: z3.string().optional().describe("Generated UPI intent URI shown to the respondent"),
682
+ selfReported: z3.literal(true).describe(
683
+ "Always true: Encatch records this answer but does not verify the payment"
684
+ )
685
+ }).describe("Answer for a payments_upi question");
686
+ var AnswerItemSchema = z3.object({
687
+ nps: z3.number().optional().describe("Net Promoter Score value (e.g., 0-10)"),
688
+ nestedSelection: z3.array(z3.string()).optional().describe("Array of selected nested option IDs"),
689
+ longText: z3.string().optional().describe("Long text answer, e.g., paragraph or essay"),
690
+ shortAnswer: z3.string().optional().describe("Short text answer, e.g., single sentence or word"),
691
+ singleChoice: z3.string().optional().describe("Single selected option value for single choice questions"),
692
+ rating: z3.number().optional().describe("Star rating value (e.g., 1-5)"),
693
+ yesNo: z3.boolean().optional().describe("Yes/no answer for yes_no questions (true = Yes, false = No)"),
694
+ consent: z3.boolean().optional().describe(
695
+ "Consent answer for consent questions (true = checked/agreed, false = unchecked)"
696
+ ),
697
+ multipleChoiceMultiple: z3.array(z3.string()).optional().describe(
698
+ "Array of selected option values for multiple choice questions"
699
+ ),
700
+ singleChoiceOther: z3.string().optional().describe(
701
+ 'Free-text "other" answer for single choice questions when allowOther is enabled'
702
+ ),
703
+ multipleChoiceOther: z3.string().optional().describe(
704
+ 'Free-text "other" answer for multiple choice questions when allowOther is enabled'
705
+ ),
706
+ annotation: AnnotationSchema.optional().describe(
707
+ "Annotation object containing file and marker details"
708
+ ),
709
+ ratingMatrix: z3.record(z3.string(), z3.union([z3.number(), z3.string()])).optional().describe(
710
+ "Rating matrix answers keyed by statement value (export key), value is the selected scale value (number for likert/numerical, string for custom)"
711
+ ),
712
+ matrixSingleChoice: z3.record(z3.string(), z3.string()).optional().describe(
713
+ "Matrix single-choice answers keyed by row value (export key), map value is the selected column option value"
714
+ ),
715
+ matrixMultipleChoice: z3.record(z3.string(), z3.array(z3.string())).optional().describe(
716
+ "Matrix multiple-choice answers keyed by row value (export key), map value is array of selected column option values"
717
+ ),
718
+ others: z3.string().optional().describe(
719
+ "For multiple choice questions and single choice questions, this is the value of the other option"
720
+ ),
721
+ // Date question
722
+ date: z3.string().optional().describe(
723
+ "Answer for a date question; ISO 8601 format (YYYY-MM-DD or YYYY-MM-DDTHH:MM)"
724
+ ),
725
+ // CSAT question
726
+ csat: z3.number().optional().describe(
727
+ "Answer for a CSAT question; industry-standard value: 1 (lowest/worst) to N (highest/best) where N is the scale size (2\u20135)"
728
+ ),
729
+ // Opinion scale question
730
+ opinionScale: z3.number().optional().describe(
731
+ "Answer for an opinion scale question; the selected numeric value on the scale"
732
+ ),
733
+ // Ranking question — ordered array of option values; index 0 = rank 1
734
+ ranking: z3.array(z3.string()).optional().describe(
735
+ "Answer for a ranking question; ordered array of option values where index 0 is rank 1"
736
+ ),
737
+ // Picture choice — always an array of selected option values (single selection = one-element array)
738
+ pictureChoice: z3.array(z3.string()).optional().describe(
739
+ "Answer for a picture choice question; array of selected option values (single selection produces a one-element array)"
740
+ ),
741
+ pictureChoiceOther: z3.string().optional().describe(
742
+ 'Free-text "other" answer for picture choice questions when allowOther is enabled'
743
+ ),
744
+ // Signature question
745
+ signature: SignatureAnswerSchema.optional().describe(
746
+ "Answer for a signature question"
747
+ ),
748
+ // File upload question
749
+ fileUpload: FileUploadAnswerSchema.optional().describe(
750
+ "Answer for a file upload question; array supports single and multiple file uploads"
751
+ ),
752
+ // Email question
753
+ email: z3.string().optional().describe("Answer for an email question; the submitted email address"),
754
+ // Number question
755
+ number: z3.string().optional().describe(
756
+ "Answer for a number question; the submitted numeric value as a string"
757
+ ),
758
+ // Website question
759
+ website: z3.string().optional().describe("Answer for a website question; the submitted URL"),
760
+ // Phone number question
761
+ phoneNumber: PhoneNumberAnswerSchema.optional().describe(
762
+ "Answer for a phone number question"
763
+ ),
764
+ // Address question
765
+ address: AddressAnswerSchema.optional().describe(
766
+ "Answer for an address question"
767
+ ),
768
+ // Video and audio question
769
+ videoAudio: VideoAudioAnswerSchema.optional().describe(
770
+ "Answer for a video and audio question"
771
+ ),
772
+ // Scheduler question
773
+ scheduler: SchedulerAnswerSchema.optional().describe(
774
+ "Answer for a scheduler question"
775
+ ),
776
+ // Q&A with AI question
777
+ qnaWithAi: QnaWithAiAnswerSchema.optional().describe(
778
+ "Answer for a qna_with_ai question; ordered transcript of Q&A pairs from the session"
779
+ ),
780
+ // Payments UPI question
781
+ paymentsUpi: PaymentsUpiAnswerSchema.optional().describe(
782
+ "Answer for a payments_upi question; self-reported UPI transaction reference"
783
+ )
784
+ }).describe(
785
+ "Flexible answer item supporting various question types and custom fields"
786
+ );
787
+ var AnswerSchema = AnswerItemSchema;
788
+
441
789
  // src/schemas/fields/field-schema.ts
442
- var questionTypeSchema = z3.enum([
790
+ var questionTypeSchema = z4.enum([
443
791
  "rating",
444
792
  "single_choice",
445
793
  "nps",
@@ -509,7 +857,7 @@ var QuestionTypes = {
509
857
  QNA_WITH_AI: "qna_with_ai",
510
858
  PAYMENTS_UPI: "payments_upi"
511
859
  };
512
- var validationRuleTypeSchema = z3.enum([
860
+ var validationRuleTypeSchema = z4.enum([
513
861
  "required",
514
862
  "min",
515
863
  "max",
@@ -531,13 +879,13 @@ var ValidationRuleTypes = {
531
879
  URL: "url",
532
880
  CUSTOM: "custom"
533
881
  };
534
- var validationRuleSchema = z3.object({
882
+ var validationRuleSchema = z4.object({
535
883
  type: validationRuleTypeSchema.describe("Type of validation rule to apply"),
536
- value: z3.union([z3.string(), z3.number(), z3.boolean()]).optional().describe("Value for the validation rule (string, number, or boolean)"),
537
- message: z3.string().optional().describe("Custom error message when validation fails"),
538
- describe: z3.string().max(500).optional().describe("LLM tool call description for this validation rule")
884
+ value: z4.union([z4.string(), z4.number(), z4.boolean()]).optional().describe("Value for the validation rule (string, number, or boolean)"),
885
+ message: z4.string().optional().describe("Custom error message when validation fails"),
886
+ describe: z4.string().max(500).optional().describe("LLM tool call description for this validation rule")
539
887
  }).describe("Schema defining validation rules for question responses");
540
- var visibilityConditionOperatorSchema = z3.enum([
888
+ var visibilityConditionOperatorSchema = z4.enum([
541
889
  "equals",
542
890
  "not_equals",
543
891
  "contains",
@@ -557,44 +905,44 @@ var VisibilityConditionOperators = {
557
905
  IS_EMPTY: "is_empty",
558
906
  IS_NOT_EMPTY: "is_not_empty"
559
907
  };
560
- var visibilityConditionSchema = z3.object({
561
- field: z3.string().describe("ID of the field to check against"),
908
+ var visibilityConditionSchema = z4.object({
909
+ field: z4.string().describe("ID of the field to check against"),
562
910
  operator: visibilityConditionOperatorSchema.describe(
563
911
  "Comparison operator for the condition"
564
912
  ),
565
- value: z3.union([z3.string(), z3.number(), z3.boolean()]).optional().describe("Value to compare against (string, number, or boolean)"),
566
- describe: z3.string().max(500).optional().describe("LLM tool call description for this visibility condition")
913
+ value: z4.union([z4.string(), z4.number(), z4.boolean()]).optional().describe("Value to compare against (string, number, or boolean)"),
914
+ describe: z4.string().max(500).optional().describe("LLM tool call description for this visibility condition")
567
915
  }).describe(
568
916
  "Schema defining conditions that control when questions are visible"
569
917
  );
570
- var sectionSchema = z3.object({
571
- id: z3.string().describe("Unique identifier for the section"),
572
- title: z3.string().min(1).max(200).describe("Display title for the section"),
573
- description: z3.string().max(1e3).optional().describe("Optional detailed description or help text for the section"),
574
- showTitle: z3.boolean().default(true).describe("Whether to show the section title in the UI"),
575
- showDescription: z3.boolean().default(true).describe("Whether to show the section description in the UI"),
576
- nextButtonLabel: z3.string().min(1).max(50).optional().describe("Label for the next button when navigating from this section"),
918
+ var sectionSchema = z4.object({
919
+ id: z4.string().describe("Unique identifier for the section"),
920
+ title: z4.string().min(1).max(200).describe("Display title for the section"),
921
+ description: z4.string().max(1e3).optional().describe("Optional detailed description or help text for the section"),
922
+ showTitle: z4.boolean().default(true).describe("Whether to show the section title in the UI"),
923
+ showDescription: z4.boolean().default(true).describe("Whether to show the section description in the UI"),
924
+ nextButtonLabel: z4.string().min(1).max(50).optional().describe("Label for the next button when navigating from this section"),
577
925
  translations: sectionTranslationsByLanguageSchema.optional().describe(
578
926
  "Per-language section copy (title, optional description and nextButtonLabel), keyed by language code"
579
927
  ),
580
- inAppSingleQuestion: z3.boolean().default(false).describe(
928
+ inAppSingleQuestion: z4.boolean().default(false).describe(
581
929
  "When true, the native app shows one question at a time within this section"
582
930
  ),
583
- isPreviousAllowed: z3.boolean().default(false).optional().describe(
931
+ isPreviousAllowed: z4.boolean().default(false).optional().describe(
584
932
  "When the global previousButton mode is 'auto', controls whether the Previous button is shown for this section. Defaults to false (hidden)."
585
933
  ),
586
- questionIds: z3.array(z3.string()).min(1).describe("Array of question IDs that belong to this section")
934
+ questionIds: z4.array(z4.string()).min(1).describe("Array of question IDs that belong to this section")
587
935
  }).describe(
588
936
  "Schema defining sections that organize questions into logical groups"
589
937
  );
590
- var questionStatusSchema = z3.enum(["D", "P", "A", "S"]);
938
+ var questionStatusSchema = z4.enum(["D", "P", "A", "S"]);
591
939
  var QuestionStatuses = {
592
940
  DRAFT: "D",
593
941
  PUBLISHED: "P",
594
942
  ARCHIVED: "A",
595
943
  SUSPENDED: "S"
596
944
  };
597
- var ratingDisplayStyleSchema = z3.enum([
945
+ var ratingDisplayStyleSchema = z4.enum([
598
946
  "star",
599
947
  "heart",
600
948
  "thumbs-up",
@@ -610,7 +958,7 @@ var RatingDisplayStyles = {
610
958
  EMOJI: "emoji",
611
959
  EMOJI_EXP: "emoji_exp"
612
960
  };
613
- var ratingRepresentationSizeSchema = z3.enum([
961
+ var ratingRepresentationSizeSchema = z4.enum([
614
962
  "small",
615
963
  "medium",
616
964
  "large"
@@ -620,7 +968,7 @@ var RatingRepresentationSizes = {
620
968
  MEDIUM: "medium",
621
969
  LARGE: "large"
622
970
  };
623
- var multipleChoiceDisplayStyleSchema = z3.enum([
971
+ var multipleChoiceDisplayStyleSchema = z4.enum([
624
972
  "radio",
625
973
  "list",
626
974
  "chip",
@@ -634,7 +982,7 @@ var MultipleChoiceDisplayStyles = {
634
982
  DROPDOWN: "dropdown",
635
983
  AUTOSUGGEST: "autosuggest"
636
984
  };
637
- var multipleChoiceMultipleDisplayStyleSchema = z3.enum([
985
+ var multipleChoiceMultipleDisplayStyleSchema = z4.enum([
638
986
  "checkbox",
639
987
  "list",
640
988
  "chip",
@@ -646,12 +994,12 @@ var MultipleChoiceMultipleDisplayStyles = {
646
994
  CHIP: "chip",
647
995
  AUTOSUGGEST: "autosuggest"
648
996
  };
649
- var yesNoDisplayStyleSchema = z3.enum(["horizontal", "vertical"]);
997
+ var yesNoDisplayStyleSchema = z4.enum(["horizontal", "vertical"]);
650
998
  var YesNoDisplayStyles = {
651
999
  HORIZONTAL: "horizontal",
652
1000
  VERTICAL: "vertical"
653
1001
  };
654
- var choiceOrderOptionSchema = z3.enum([
1002
+ var choiceOrderOptionSchema = z4.enum([
655
1003
  "randomize",
656
1004
  "flip",
657
1005
  "rotate",
@@ -665,74 +1013,74 @@ var ChoiceOrderOptions = {
665
1013
  ASCENDING: "ascending",
666
1014
  NONE: "none"
667
1015
  };
668
- var questionSchema = z3.object({
669
- id: z3.string().describe("Unique identifier for the question"),
670
- slug: z3.string().min(1).max(128).optional().describe(
1016
+ var questionSchema = z4.object({
1017
+ id: z4.string().describe("Unique identifier for the question"),
1018
+ slug: z4.string().min(1).max(128).optional().describe(
671
1019
  "Optional stable identifier for the question (e.g. URLs, analytics, or integrations)"
672
1020
  ),
673
1021
  type: questionTypeSchema.describe(
674
1022
  "The type of question (rating, single_choice, etc.)"
675
1023
  ),
676
- title: z3.string().min(1).max(200).describe("The main title/question text displayed to users"),
677
- description: z3.string().max(1e3).optional().describe("Optional detailed description or help text"),
678
- describe: z3.string().max(2e3).optional().describe(
1024
+ title: z4.string().min(1).max(200).describe("The main title/question text displayed to users"),
1025
+ description: z4.string().max(1e3).optional().describe("Optional detailed description or help text"),
1026
+ describe: z4.string().max(2e3).optional().describe(
679
1027
  "LLM tool call description for better AI understanding and context"
680
1028
  ),
681
- required: z3.boolean().default(false).describe("Whether this question must be answered"),
682
- isHidden: z3.boolean().default(false).describe("When true, the question is hidden from the form UI"),
683
- errorMessage: z3.string().max(500).optional().describe("Custom error message when validation fails"),
684
- validations: z3.array(validationRuleSchema).optional().default([]).describe("Array of validation rules to apply"),
685
- visibility: z3.array(visibilityConditionSchema).optional().default([]).describe("Conditions that control when this question is shown"),
686
- sectionId: z3.string().optional().describe("ID of the section this question belongs to"),
1029
+ required: z4.boolean().default(false).describe("Whether this question must be answered"),
1030
+ isHidden: z4.boolean().default(false).describe("When true, the question is hidden from the form UI"),
1031
+ errorMessage: z4.string().max(500).optional().describe("Custom error message when validation fails"),
1032
+ validations: z4.array(validationRuleSchema).optional().default([]).describe("Array of validation rules to apply"),
1033
+ visibility: z4.array(visibilityConditionSchema).optional().default([]).describe("Conditions that control when this question is shown"),
1034
+ sectionId: z4.string().optional().describe("ID of the section this question belongs to"),
687
1035
  status: questionStatusSchema.describe(
688
1036
  "Current status of the question (Draft, Published, etc.)"
689
1037
  ),
690
- textAlign: z3.enum(["left", "center", "justify"]).optional().default("left").describe(
1038
+ textAlign: z4.enum(["left", "center", "justify"]).optional().default("left").describe(
691
1039
  "Text alignment for the question title and description; `justify` is intended for consent questions (full-width justified consent body markdown)"
692
1040
  ),
693
- nextButtonLabel: z3.string().min(1).max(50).default("Next").describe(
1041
+ nextButtonLabel: z4.string().min(1).max(50).default("Next").describe(
694
1042
  "Label for the next button when advancing past this question (overrides section or form defaults when set)"
695
1043
  ),
696
- showQuestionTitle: z3.boolean().default(true).describe("Whether to display the question title; defaults to true"),
697
- questionMediaUrl: z3.string().url().optional().describe(
1044
+ showQuestionTitle: z4.boolean().default(true).describe("Whether to display the question title; defaults to true"),
1045
+ questionMediaUrl: z4.string().url().optional().describe(
698
1046
  "Optional URL for media (image or video) displayed alongside the question"
699
1047
  ),
700
- questionMediaType: z3.enum(["image", "video", "youtube", "vimeo"]).optional().describe(
1048
+ questionMediaType: z4.enum(["image", "video", "youtube", "vimeo"]).optional().describe(
701
1049
  "Type of media referenced by questionMediaUrl; one of 'image', 'video', 'youtube', or 'vimeo'"
702
1050
  )
703
1051
  }).describe("Base schema for all question types with common properties");
704
1052
  var ratingQuestionSchema = questionSchema.extend({
705
- type: z3.literal("rating").describe("Must be exactly 'rating'"),
706
- showLabels: z3.boolean().optional().describe("Whether to show min/max labels"),
707
- minLabel: z3.string().max(100).optional().describe("Label for the minimum rating value"),
708
- maxLabel: z3.string().max(100).optional().describe("Label for the maximum rating value"),
1053
+ type: z4.literal("rating").describe("Must be exactly 'rating'"),
1054
+ showLabels: z4.boolean().optional().describe("Whether to show min/max labels"),
1055
+ minLabel: z4.string().max(100).optional().describe("Label for the minimum rating value"),
1056
+ maxLabel: z4.string().max(100).optional().describe("Label for the maximum rating value"),
709
1057
  displayStyle: ratingDisplayStyleSchema.optional().describe("Visual style for rating display"),
710
- numberOfRatings: z3.number().int().min(1).max(10).describe("Number of rating options (1-10)"),
1058
+ numberOfRatings: z4.number().int().min(1).max(10).describe("Number of rating options (1-10)"),
711
1059
  representationSize: ratingRepresentationSizeSchema.optional().describe("Size of rating visual elements"),
712
- color: z3.string().regex(/^#[0-9A-F]{6}$/i, "Must be a valid hex color").optional().describe("Hex color for rating elements")
1060
+ color: z4.string().regex(/^#[0-9A-F]{6}$/i, "Must be a valid hex color").optional().describe("Hex color for rating elements")
713
1061
  }).describe("Schema for rating questions with customizable display options");
714
1062
  var annotationQuestionSchema = questionSchema.extend({
715
- type: z3.literal("annotation").describe("Must be exactly 'annotation'"),
716
- annotationText: z3.string().max(1e3).optional().describe("Text to display when annotation is provided"),
717
- noAnnotationText: z3.string().max(500).optional().describe("Text to display when no annotation is provided")
1063
+ type: z4.literal("annotation").describe("Must be exactly 'annotation'"),
1064
+ annotationText: z4.string().max(1e3).optional().describe("Text to display when annotation is provided"),
1065
+ noAnnotationText: z4.string().max(500).optional().describe("Text to display when no annotation is provided")
718
1066
  }).describe(
719
1067
  "Schema for annotation questions that provide additional context or instructions"
720
1068
  );
721
1069
  var welcomeQuestionSchema = questionSchema.extend({
722
- type: z3.literal("welcome").describe("Must be exactly 'welcome'"),
723
- title: z3.string().min(1).max(200).describe("The main heading displayed on the welcome screen"),
724
- description: z3.string().max(1e3).optional().describe("Optional sub-text body shown below the heading"),
725
- imageUrl: z3.string().url().optional().describe("Optional image URL displayed on the welcome screen")
1070
+ type: z4.literal("welcome").describe("Must be exactly 'welcome'"),
1071
+ title: z4.string().min(1).max(200).describe("The main heading displayed on the welcome screen"),
1072
+ description: z4.string().max(1e3).optional().describe("Optional sub-text body shown below the heading"),
1073
+ imageUrl: z4.string().url().optional().describe("Optional image URL displayed on the welcome screen")
726
1074
  }).describe(
727
1075
  "Schema for a welcome screen displayed at the start or inline within a form"
728
1076
  );
729
1077
  var thankYouQuestionSchema = questionSchema.extend({
730
- type: z3.literal("thank_you").describe("Must be exactly 'thank_you'"),
731
- title: z3.string().min(1).max(200).describe("The main heading displayed on the thank you screen"),
732
- description: z3.string().max(1e3).optional().describe(
1078
+ type: z4.literal("thank_you").describe("Must be exactly 'thank_you'"),
1079
+ title: z4.string().min(1).max(200).describe("The main heading displayed on the thank you screen"),
1080
+ description: z4.string().max(1e3).optional().describe(
733
1081
  "Optional thank you body text; rendered as Markdown where the form supports it"
734
1082
  ),
735
- imageUrl: z3.string().url().optional().describe("Optional image URL displayed on the thank you screen"),
1083
+ imageUrl: z4.string().url().optional().describe("Optional image URL displayed on the thank you screen"),
736
1084
  completionCta: completionCtaSchema.optional().describe(
737
1085
  "Optional CTA shown after submission; supports primary + optional secondary buttons with per-surface action routing (inApp / link), and optional auto-trigger timer; when absent the engine falls back to nextButtonLabel as a single dismiss button"
738
1086
  )
@@ -740,15 +1088,15 @@ var thankYouQuestionSchema = questionSchema.extend({
740
1088
  "Schema for a thank you screen shown at the end or inline within a form"
741
1089
  );
742
1090
  var messagePanelQuestionSchema = questionSchema.extend({
743
- type: z3.literal("message_panel").describe("Must be exactly 'message_panel'"),
744
- title: z3.string().min(1).max(200).describe("The main heading displayed on the message panel"),
745
- description: z3.string().max(1e3).optional().describe("Optional body text shown below the heading"),
746
- imageUrl: z3.string().url().optional().describe("Optional image URL displayed on the message panel")
1091
+ type: z4.literal("message_panel").describe("Must be exactly 'message_panel'"),
1092
+ title: z4.string().min(1).max(200).describe("The main heading displayed on the message panel"),
1093
+ description: z4.string().max(1e3).optional().describe("Optional body text shown below the heading"),
1094
+ imageUrl: z4.string().url().optional().describe("Optional image URL displayed on the message panel")
747
1095
  }).describe(
748
1096
  "Schema for an inline message panel (informational); distinct from welcome for UI semantics and analytics"
749
1097
  );
750
1098
  var exitFormQuestionSchema = questionSchema.extend({
751
- type: z3.literal("exit_form").describe("Must be exactly 'exit_form'"),
1099
+ type: z4.literal("exit_form").describe("Must be exactly 'exit_form'"),
752
1100
  completionCta: completionCtaSchema.optional().describe(
753
1101
  "Optional silent completion action fired when the exit_form terminal is reached; no UI is shown \u2014 use redirect_internal / redirect_external for silent redirects or app_navigate for host routing; autoTriggerDelayMs defaults to 0 (immediate) when a configured action is present"
754
1102
  )
@@ -756,11 +1104,11 @@ var exitFormQuestionSchema = questionSchema.extend({
756
1104
  "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"
757
1105
  );
758
1106
  var yesNoQuestionSchema = questionSchema.extend({
759
- type: z3.literal("yes_no").describe("Must be exactly 'yes_no'"),
760
- yesLabel: z3.string().min(1).max(50).optional().describe(
1107
+ type: z4.literal("yes_no").describe("Must be exactly 'yes_no'"),
1108
+ yesLabel: z4.string().min(1).max(50).optional().describe(
761
1109
  "Label for the Yes option (defaults to 'Yes' in the UI if omitted)"
762
1110
  ),
763
- noLabel: z3.string().min(1).max(50).optional().describe(
1111
+ noLabel: z4.string().min(1).max(50).optional().describe(
764
1112
  "Label for the No option (defaults to 'No' in the UI if omitted)"
765
1113
  ),
766
1114
  displayStyle: yesNoDisplayStyleSchema.optional().describe(
@@ -770,11 +1118,11 @@ var yesNoQuestionSchema = questionSchema.extend({
770
1118
  "Schema for yes/no questions with optional custom labels and layout"
771
1119
  );
772
1120
  var consentQuestionSchema = questionSchema.extend({
773
- type: z3.literal("consent").describe("Must be exactly 'consent'")
1121
+ type: z4.literal("consent").describe("Must be exactly 'consent'")
774
1122
  }).describe(
775
1123
  "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)"
776
1124
  );
777
- var ratingMatrixDisplayStyleSchema = z3.enum([
1125
+ var ratingMatrixDisplayStyleSchema = z4.enum([
778
1126
  "radio",
779
1127
  "star",
780
1128
  "emoji",
@@ -786,82 +1134,82 @@ var RatingMatrixDisplayStyles = {
786
1134
  EMOJI: "emoji",
787
1135
  BUTTON: "button"
788
1136
  };
789
- var ratingMatrixStatementSchema = z3.object({
790
- id: z3.string().describe(
1137
+ var ratingMatrixStatementSchema = z4.object({
1138
+ id: z4.string().describe(
791
1139
  "Unique identifier for this statement (system time milliseconds)"
792
1140
  ),
793
- value: z3.string().min(1).max(100).describe("Internal value / export key for this statement"),
794
- label: z3.string().min(1).max(200).describe("Display text shown to users for this statement"),
795
- describe: z3.string().max(500).optional().describe("LLM tool call description for this statement")
1141
+ value: z4.string().min(1).max(100).describe("Internal value / export key for this statement"),
1142
+ label: z4.string().min(1).max(200).describe("Display text shown to users for this statement"),
1143
+ describe: z4.string().max(500).optional().describe("LLM tool call description for this statement")
796
1144
  }).describe("Schema for an individual statement (row) in a rating matrix");
797
- var ratingMatrixScalePointSchema = z3.object({
798
- id: z3.string().describe("Unique identifier for this scale point"),
799
- value: z3.union([z3.number(), z3.string()]).describe(
1145
+ var ratingMatrixScalePointSchema = z4.object({
1146
+ id: z4.string().describe("Unique identifier for this scale point"),
1147
+ value: z4.union([z4.number(), z4.string()]).describe(
800
1148
  "Stored response value for this scale point (number or string)"
801
1149
  ),
802
- label: z3.string().min(1).max(200).describe("Display label shown for this scale point"),
803
- describe: z3.string().max(500).optional().describe("LLM tool call description for this scale point")
1150
+ label: z4.string().min(1).max(200).describe("Display label shown for this scale point"),
1151
+ describe: z4.string().max(500).optional().describe("LLM tool call description for this scale point")
804
1152
  }).describe("Schema for a single point on a custom rating scale");
805
- var ratingMatrixScaleSchema = z3.discriminatedUnion("kind", [
1153
+ var ratingMatrixScaleSchema = z4.discriminatedUnion("kind", [
806
1154
  // Likert: symmetric ordinal scale -2…+2, explicit scale points with labels
807
- z3.object({
808
- kind: z3.literal("likert").describe("Symmetric ordinal scale (-2 to +2)"),
809
- scalePoints: z3.array(ratingMatrixScalePointSchema).min(2).max(10).describe("Scale points with display labels for each column")
1155
+ z4.object({
1156
+ kind: z4.literal("likert").describe("Symmetric ordinal scale (-2 to +2)"),
1157
+ scalePoints: z4.array(ratingMatrixScalePointSchema).min(2).max(10).describe("Scale points with display labels for each column")
810
1158
  }),
811
1159
  // Numerical: 1…N points where N is 2, 3, 4, or 5, explicit scale points with labels
812
- z3.object({
813
- kind: z3.literal("numerical").describe("Numerical scale from 1 to N"),
814
- scalePoints: z3.array(ratingMatrixScalePointSchema).min(2).max(10).describe("Scale points with display labels for each column"),
815
- pointCount: z3.union([z3.literal(2), z3.literal(3), z3.literal(4), z3.literal(5)]).describe("Number of scale points (2, 3, 4, or 5)")
1160
+ z4.object({
1161
+ kind: z4.literal("numerical").describe("Numerical scale from 1 to N"),
1162
+ scalePoints: z4.array(ratingMatrixScalePointSchema).min(2).max(10).describe("Scale points with display labels for each column"),
1163
+ pointCount: z4.union([z4.literal(2), z4.literal(3), z4.literal(4), z4.literal(5)]).describe("Number of scale points (2, 3, 4, or 5)")
816
1164
  }),
817
1165
  // Custom: consumer defines each point's value and label
818
- z3.object({
819
- kind: z3.literal("custom").describe("Custom scale with user-defined points and values"),
820
- scalePoints: z3.array(ratingMatrixScalePointSchema).min(2).max(10).describe("Scale points with display labels for each column")
1166
+ z4.object({
1167
+ kind: z4.literal("custom").describe("Custom scale with user-defined points and values"),
1168
+ scalePoints: z4.array(ratingMatrixScalePointSchema).min(2).max(10).describe("Scale points with display labels for each column")
821
1169
  })
822
1170
  ]).describe("Scale configuration for rating matrix questions");
823
1171
  var ratingMatrixQuestionSchema = questionSchema.extend({
824
- type: z3.literal("rating_matrix").describe("Must be exactly 'rating_matrix'"),
825
- statements: z3.array(ratingMatrixStatementSchema).min(1).max(10).describe("Statements (rows) users will rate on the shared scale (1-10)"),
1172
+ type: z4.literal("rating_matrix").describe("Must be exactly 'rating_matrix'"),
1173
+ statements: z4.array(ratingMatrixStatementSchema).min(1).max(10).describe("Statements (rows) users will rate on the shared scale (1-10)"),
826
1174
  scale: ratingMatrixScaleSchema.describe(
827
1175
  "Scale configuration shared across all statement rows"
828
1176
  ),
829
1177
  displayStyle: ratingMatrixDisplayStyleSchema.optional().describe(
830
1178
  "Visual representation of scale points per row (radio buttons, stars, emoji, or buttons)"
831
1179
  ),
832
- randomizeStatements: z3.boolean().optional().default(false).describe("Whether to randomize the order of statements")
1180
+ randomizeStatements: z4.boolean().optional().default(false).describe("Whether to randomize the order of statements")
833
1181
  }).describe(
834
1182
  "Schema for rating matrix questions with multiple statements on a shared scale"
835
1183
  );
836
- var matrixRowSchema = z3.object({
837
- id: z3.string().describe("Unique identifier for this row (system time milliseconds)"),
838
- value: z3.string().min(1).max(100).describe("Internal value / export key for this row"),
839
- label: z3.string().min(1).max(200).describe("Display text shown to users for this row"),
840
- describe: z3.string().max(500).optional().describe("LLM tool call description for this row")
1184
+ var matrixRowSchema = z4.object({
1185
+ id: z4.string().describe("Unique identifier for this row (system time milliseconds)"),
1186
+ value: z4.string().min(1).max(100).describe("Internal value / export key for this row"),
1187
+ label: z4.string().min(1).max(200).describe("Display text shown to users for this row"),
1188
+ describe: z4.string().max(500).optional().describe("LLM tool call description for this row")
841
1189
  }).describe("Schema for an individual row in a matrix choice question");
842
- var matrixColumnSchema = z3.object({
843
- id: z3.string().describe("Unique identifier for this column (system time milliseconds)"),
844
- value: z3.string().min(1).max(100).describe("Internal value / export key for this column"),
845
- label: z3.string().min(1).max(200).describe("Display label shown for this column"),
846
- describe: z3.string().max(500).optional().describe("LLM tool call description for this column")
1190
+ var matrixColumnSchema = z4.object({
1191
+ id: z4.string().describe("Unique identifier for this column (system time milliseconds)"),
1192
+ value: z4.string().min(1).max(100).describe("Internal value / export key for this column"),
1193
+ label: z4.string().min(1).max(200).describe("Display label shown for this column"),
1194
+ describe: z4.string().max(500).optional().describe("LLM tool call description for this column")
847
1195
  }).describe("Schema for an individual column in a matrix choice question");
848
1196
  var matrixSingleChoiceQuestionSchema = questionSchema.extend({
849
- type: z3.literal("matrix_single_choice").describe("Must be exactly 'matrix_single_choice'"),
850
- rows: z3.array(matrixRowSchema).min(1).max(20).describe("Row items (1-20 rows)"),
851
- columns: z3.array(matrixColumnSchema).min(2).max(10).describe("Column options shared across all rows (2-10 columns)"),
852
- randomizeRows: z3.boolean().optional().default(false).describe("Whether to randomize the order of rows"),
853
- randomizeColumns: z3.boolean().optional().default(false).describe("Whether to randomize the order of columns")
1197
+ type: z4.literal("matrix_single_choice").describe("Must be exactly 'matrix_single_choice'"),
1198
+ rows: z4.array(matrixRowSchema).min(1).max(20).describe("Row items (1-20 rows)"),
1199
+ columns: z4.array(matrixColumnSchema).min(2).max(10).describe("Column options shared across all rows (2-10 columns)"),
1200
+ randomizeRows: z4.boolean().optional().default(false).describe("Whether to randomize the order of rows"),
1201
+ randomizeColumns: z4.boolean().optional().default(false).describe("Whether to randomize the order of columns")
854
1202
  }).describe(
855
1203
  "Schema for matrix single-choice questions where one column is selected per row"
856
1204
  );
857
1205
  var matrixMultipleChoiceQuestionSchema = questionSchema.extend({
858
- type: z3.literal("matrix_multiple_choice").describe("Must be exactly 'matrix_multiple_choice'"),
859
- rows: z3.array(matrixRowSchema).min(1).max(20).describe("Row items (1-20 rows)"),
860
- columns: z3.array(matrixColumnSchema).min(2).max(10).describe("Column options shared across all rows (2-10 columns)"),
861
- minSelectionsPerRow: z3.number().int().min(0).optional().describe("Minimum number of columns a user must select per row"),
862
- maxSelectionsPerRow: z3.number().int().min(1).optional().describe("Maximum number of columns a user can select per row"),
863
- randomizeRows: z3.boolean().optional().default(false).describe("Whether to randomize the order of rows"),
864
- randomizeColumns: z3.boolean().optional().default(false).describe("Whether to randomize the order of columns")
1206
+ type: z4.literal("matrix_multiple_choice").describe("Must be exactly 'matrix_multiple_choice'"),
1207
+ rows: z4.array(matrixRowSchema).min(1).max(20).describe("Row items (1-20 rows)"),
1208
+ columns: z4.array(matrixColumnSchema).min(2).max(10).describe("Column options shared across all rows (2-10 columns)"),
1209
+ minSelectionsPerRow: z4.number().int().min(0).optional().describe("Minimum number of columns a user must select per row"),
1210
+ maxSelectionsPerRow: z4.number().int().min(1).optional().describe("Maximum number of columns a user can select per row"),
1211
+ randomizeRows: z4.boolean().optional().default(false).describe("Whether to randomize the order of rows"),
1212
+ randomizeColumns: z4.boolean().optional().default(false).describe("Whether to randomize the order of columns")
865
1213
  }).refine(
866
1214
  (data) => {
867
1215
  if (data.minSelectionsPerRow !== void 0 && data.maxSelectionsPerRow !== void 0) {
@@ -876,64 +1224,64 @@ var matrixMultipleChoiceQuestionSchema = questionSchema.extend({
876
1224
  ).describe(
877
1225
  "Schema for matrix multiple-choice questions where one or more columns can be selected per row"
878
1226
  );
879
- var questionOptionSchema = z3.object({
880
- id: z3.string().describe("Unique identifier for this option (system time milliseconds)"),
881
- value: z3.string().min(1).max(100).describe("The internal value used for this option"),
882
- label: z3.string().min(1).max(200).describe("The display text shown to users for this option"),
883
- hint: z3.string().max(300).optional().describe(
1227
+ var questionOptionSchema = z4.object({
1228
+ id: z4.string().describe("Unique identifier for this option (system time milliseconds)"),
1229
+ value: z4.string().min(1).max(100).describe("The internal value used for this option"),
1230
+ label: z4.string().min(1).max(200).describe("The display text shown to users for this option"),
1231
+ hint: z4.string().max(300).optional().describe(
884
1232
  "Optional short description shown below the option label to help respondents understand what they are selecting or ranking"
885
1233
  ),
886
- describe: z3.string().max(500).optional().describe(
1234
+ describe: z4.string().max(500).optional().describe(
887
1235
  "LLM tool call description providing context about this option"
888
1236
  ),
889
- imageUrl: z3.string().url().optional().describe("Optional image URL to display with this option")
1237
+ imageUrl: z4.string().url().optional().describe("Optional image URL to display with this option")
890
1238
  }).describe("Schema for individual options in choice-based questions");
891
- var nestedOptionSchema = z3.lazy(
892
- () => z3.object({
893
- id: z3.string().describe(
1239
+ var nestedOptionSchema = z4.lazy(
1240
+ () => z4.object({
1241
+ id: z4.string().describe(
894
1242
  "Unique identifier for this nested option (system time milliseconds)"
895
1243
  ),
896
- value: z3.string().min(1).max(100).describe("The internal value used for this nested option"),
897
- label: z3.string().min(1).max(200).describe("The display text shown for this nested option"),
898
- describe: z3.string().max(500).optional().describe("LLM tool call description for this nested option context"),
899
- imageUrl: z3.string().url().optional().describe("Optional image URL for this nested option"),
900
- hint: z3.string().max(500).optional().describe(
1244
+ value: z4.string().min(1).max(100).describe("The internal value used for this nested option"),
1245
+ label: z4.string().min(1).max(200).describe("The display text shown for this nested option"),
1246
+ describe: z4.string().max(500).optional().describe("LLM tool call description for this nested option context"),
1247
+ imageUrl: z4.string().url().optional().describe("Optional image URL for this nested option"),
1248
+ hint: z4.string().max(500).optional().describe(
901
1249
  "Optional hint text to help users understand this nested option"
902
1250
  ),
903
- children: z3.array(nestedOptionSchema).optional().default([]).describe("Array of child options for hierarchical structure")
1251
+ children: z4.array(nestedOptionSchema).optional().default([]).describe("Array of child options for hierarchical structure")
904
1252
  }).describe("Schema for nested options with hierarchical structure support")
905
1253
  );
906
1254
  var multipleChoiceSingleQuestionSchema = questionSchema.extend({
907
- type: z3.literal("single_choice").describe("Must be exactly 'single_choice'"),
1255
+ type: z4.literal("single_choice").describe("Must be exactly 'single_choice'"),
908
1256
  displayStyle: multipleChoiceDisplayStyleSchema.optional().describe("Visual style for displaying options"),
909
- allowOther: z3.boolean().optional().default(false).describe('Whether to allow a custom "other" option'),
910
- otherTextConfig: z3.object({
911
- minChars: z3.number().int().min(0).optional().describe("Minimum number of characters required for the other text"),
912
- maxChars: z3.number().int().min(1).optional().describe("Maximum number of characters allowed for the other text"),
913
- placeholder: z3.string().max(200).optional().describe("Placeholder text for the other text input"),
914
- showLimitIndicatorThreshold: z3.number().int().min(0).optional().describe(
1257
+ allowOther: z4.boolean().optional().default(false).describe('Whether to allow a custom "other" option'),
1258
+ otherTextConfig: z4.object({
1259
+ minChars: z4.number().int().min(0).optional().describe("Minimum number of characters required for the other text"),
1260
+ maxChars: z4.number().int().min(1).optional().describe("Maximum number of characters allowed for the other text"),
1261
+ placeholder: z4.string().max(200).optional().describe("Placeholder text for the other text input"),
1262
+ showLimitIndicatorThreshold: z4.number().int().min(0).optional().describe(
915
1263
  "Show the character limit indicator (e.g. '12/100') once the user has typed this many characters; 0 = show immediately, absent = never show"
916
1264
  )
917
1265
  }).optional().describe('Configuration for the custom "other" text input'),
918
- randomizeOptions: z3.boolean().optional().default(false).describe("Whether to randomize the order of options"),
919
- options: z3.array(questionOptionSchema).min(1).max(50).describe("Array of options for user selection (1-50 options)")
1266
+ randomizeOptions: z4.boolean().optional().default(false).describe("Whether to randomize the order of options"),
1267
+ options: z4.array(questionOptionSchema).min(1).max(50).describe("Array of options for user selection (1-50 options)")
920
1268
  }).describe("Schema for single-choice multiple selection questions");
921
1269
  var multipleChoiceMultipleQuestionSchema = questionSchema.extend({
922
- type: z3.literal("multiple_choice_multiple").describe("Must be exactly 'multiple_choice_multiple'"),
1270
+ type: z4.literal("multiple_choice_multiple").describe("Must be exactly 'multiple_choice_multiple'"),
923
1271
  displayStyle: multipleChoiceMultipleDisplayStyleSchema.optional().describe("Visual style for displaying multiple options"),
924
- allowOther: z3.boolean().optional().default(false).describe('Whether to allow a custom "other" option'),
925
- otherTextConfig: z3.object({
926
- minChars: z3.number().int().min(0).optional().describe("Minimum number of characters required for the other text"),
927
- maxChars: z3.number().int().min(1).optional().describe("Maximum number of characters allowed for the other text"),
928
- placeholder: z3.string().max(200).optional().describe("Placeholder text for the other text input"),
929
- showLimitIndicatorThreshold: z3.number().int().min(0).optional().describe(
1272
+ allowOther: z4.boolean().optional().default(false).describe('Whether to allow a custom "other" option'),
1273
+ otherTextConfig: z4.object({
1274
+ minChars: z4.number().int().min(0).optional().describe("Minimum number of characters required for the other text"),
1275
+ maxChars: z4.number().int().min(1).optional().describe("Maximum number of characters allowed for the other text"),
1276
+ placeholder: z4.string().max(200).optional().describe("Placeholder text for the other text input"),
1277
+ showLimitIndicatorThreshold: z4.number().int().min(0).optional().describe(
930
1278
  "Show the character limit indicator (e.g. '12/100') once the user has typed this many characters; 0 = show immediately, absent = never show"
931
1279
  )
932
1280
  }).optional().describe('Configuration for the custom "other" text input'),
933
- minSelections: z3.number().int().min(0).optional().describe("Minimum number of options that must be selected"),
934
- maxSelections: z3.number().int().min(1).optional().describe("Maximum number of options that can be selected"),
935
- randomizeOptions: z3.boolean().optional().default(false).describe("Whether to randomize the order of options"),
936
- options: z3.array(questionOptionSchema).min(1).max(50).describe("Array of options for user selection (1-50 options)")
1281
+ minSelections: z4.number().int().min(0).optional().describe("Minimum number of options that must be selected"),
1282
+ maxSelections: z4.number().int().min(1).optional().describe("Maximum number of options that can be selected"),
1283
+ randomizeOptions: z4.boolean().optional().default(false).describe("Whether to randomize the order of options"),
1284
+ options: z4.array(questionOptionSchema).min(1).max(50).describe("Array of options for user selection (1-50 options)")
937
1285
  }).refine(
938
1286
  (data) => {
939
1287
  if (data.minSelections !== void 0 && data.maxSelections !== void 0) {
@@ -950,20 +1298,20 @@ var multipleChoiceMultipleQuestionSchema = questionSchema.extend({
950
1298
  "Schema for multiple-choice questions allowing multiple selections"
951
1299
  );
952
1300
  var npsQuestionSchema = questionSchema.extend({
953
- type: z3.literal("nps").describe("Must be exactly 'nps'"),
954
- min: z3.literal(0).describe("NPS always starts at 0"),
955
- max: z3.literal(10).describe("NPS always ends at 10"),
956
- minLabel: z3.string().max(100).optional().describe("Label for the minimum NPS value (0)"),
957
- maxLabel: z3.string().max(100).optional().describe("Label for the maximum NPS value (10)"),
958
- scaleLabels: z3.record(z3.string().regex(/^\d+$/), z3.string().max(50)).optional().describe("Custom labels for specific NPS values (0-10)"),
959
- prepopulatedValue: z3.number().int().min(0).max(10).optional().describe("Default value to pre-select (0-10)"),
960
- detractorColor: z3.string().max(50).optional().describe(
1301
+ type: z4.literal("nps").describe("Must be exactly 'nps'"),
1302
+ min: z4.literal(0).describe("NPS always starts at 0"),
1303
+ max: z4.literal(10).describe("NPS always ends at 10"),
1304
+ minLabel: z4.string().max(100).optional().describe("Label for the minimum NPS value (0)"),
1305
+ maxLabel: z4.string().max(100).optional().describe("Label for the maximum NPS value (10)"),
1306
+ scaleLabels: z4.record(z4.string().regex(/^\d+$/), z4.string().max(50)).optional().describe("Custom labels for specific NPS values (0-10)"),
1307
+ prepopulatedValue: z4.number().int().min(0).max(10).optional().describe("Default value to pre-select (0-10)"),
1308
+ detractorColor: z4.string().max(50).optional().describe(
961
1309
  "Color applied to detractor scores (0\u20136); accepts any valid CSS color value (hex, rgb, hsl, named)"
962
1310
  ),
963
- passiveColor: z3.string().max(50).optional().describe(
1311
+ passiveColor: z4.string().max(50).optional().describe(
964
1312
  "Color applied to passive scores (7\u20138); accepts any valid CSS color value"
965
1313
  ),
966
- promoterColor: z3.string().max(50).optional().describe(
1314
+ promoterColor: z4.string().max(50).optional().describe(
967
1315
  "Color applied to promoter scores (9\u201310); accepts any valid CSS color value"
968
1316
  )
969
1317
  }).refine(
@@ -983,19 +1331,19 @@ var npsQuestionSchema = questionSchema.extend({
983
1331
  }
984
1332
  ).describe("Schema for Net Promoter Score questions with 0-10 scale");
985
1333
  var shortAnswerQuestionSchema = questionSchema.extend({
986
- type: z3.literal("short_answer").describe("Must be exactly 'short_answer'"),
987
- maxCharacters: z3.number().int().min(1).max(1e4).optional().describe("Maximum number of characters allowed"),
988
- minCharacters: z3.number().int().min(0).optional().describe("Minimum number of characters required"),
989
- showLimitIndicatorThreshold: z3.number().int().min(0).optional().describe(
1334
+ type: z4.literal("short_answer").describe("Must be exactly 'short_answer'"),
1335
+ maxCharacters: z4.number().int().min(1).max(1e4).optional().describe("Maximum number of characters allowed"),
1336
+ minCharacters: z4.number().int().min(0).optional().describe("Minimum number of characters required"),
1337
+ showLimitIndicatorThreshold: z4.number().int().min(0).optional().describe(
990
1338
  "Show the character limit indicator (e.g. '12/100') once the user has typed this many characters; 0 = show immediately, absent = never show"
991
1339
  ),
992
- placeholder: z3.string().max(200).optional().describe("Placeholder text shown in the input field"),
993
- enableRegexValidation: z3.boolean().optional().default(false).describe("Whether to enable regex pattern validation"),
994
- regexPattern: z3.string().optional().describe("Regular expression pattern for validation"),
995
- enableEnhanceWithAi: z3.boolean().optional().default(false).describe("Whether to enable AI enhancement features"),
996
- promptTemplate: z3.string().max(2e3).optional().describe("Template for AI enhancement prompts"),
997
- maxTokenAllowed: z3.number().int().min(1).max(1e4).optional().describe("Maximum tokens allowed for AI processing"),
998
- minCharactersToEnhance: z3.number().int().min(1).optional().describe("Minimum characters needed to trigger AI enhancement")
1340
+ placeholder: z4.string().max(200).optional().describe("Placeholder text shown in the input field"),
1341
+ enableRegexValidation: z4.boolean().optional().default(false).describe("Whether to enable regex pattern validation"),
1342
+ regexPattern: z4.string().optional().describe("Regular expression pattern for validation"),
1343
+ enableEnhanceWithAi: z4.boolean().optional().default(false).describe("Whether to enable AI enhancement features"),
1344
+ promptTemplate: z4.string().max(2e3).optional().describe("Template for AI enhancement prompts"),
1345
+ maxTokenAllowed: z4.number().int().min(1).max(1e4).optional().describe("Maximum tokens allowed for AI processing"),
1346
+ minCharactersToEnhance: z4.number().int().min(1).optional().describe("Minimum characters needed to trigger AI enhancement")
999
1347
  }).refine(
1000
1348
  (data) => {
1001
1349
  if (data.minCharacters !== void 0 && data.maxCharacters !== void 0) {
@@ -1031,22 +1379,22 @@ var shortAnswerQuestionSchema = questionSchema.extend({
1031
1379
  }
1032
1380
  ).describe("Schema for short answer questions with optional AI enhancement");
1033
1381
  var longAnswerQuestionSchema = questionSchema.extend({
1034
- type: z3.literal("long_text").describe("Must be exactly 'long_text'"),
1035
- maxCharacters: z3.number().int().min(1).max(5e4).optional().describe(
1382
+ type: z4.literal("long_text").describe("Must be exactly 'long_text'"),
1383
+ maxCharacters: z4.number().int().min(1).max(5e4).optional().describe(
1036
1384
  "Maximum number of characters allowed (higher limit for long text)"
1037
1385
  ),
1038
- minCharacters: z3.number().int().min(0).optional().describe("Minimum number of characters required"),
1039
- showLimitIndicatorThreshold: z3.number().int().min(0).optional().describe(
1386
+ minCharacters: z4.number().int().min(0).optional().describe("Minimum number of characters required"),
1387
+ showLimitIndicatorThreshold: z4.number().int().min(0).optional().describe(
1040
1388
  "Show the character limit indicator (e.g. '12/100') once the user has typed this many characters; 0 = show immediately, absent = never show"
1041
1389
  ),
1042
- rows: z3.number().int().min(1).max(20).optional().describe("Number of textarea rows to display (1-20)"),
1043
- placeholder: z3.string().max(500).optional().describe("Placeholder text for the textarea (longer for long text)"),
1044
- enableEnhanceWithAi: z3.boolean().optional().default(false).describe("Whether to enable AI enhancement features"),
1045
- promptTemplate: z3.string().max(2e3).optional().describe("Template for AI enhancement prompts"),
1046
- maxTokenAllowed: z3.number().int().min(1).max(25e3).optional().describe(
1390
+ rows: z4.number().int().min(1).max(20).optional().describe("Number of textarea rows to display (1-20)"),
1391
+ placeholder: z4.string().max(500).optional().describe("Placeholder text for the textarea (longer for long text)"),
1392
+ enableEnhanceWithAi: z4.boolean().optional().default(false).describe("Whether to enable AI enhancement features"),
1393
+ promptTemplate: z4.string().max(2e3).optional().describe("Template for AI enhancement prompts"),
1394
+ maxTokenAllowed: z4.number().int().min(1).max(25e3).optional().describe(
1047
1395
  "Maximum tokens allowed for AI processing (higher for long text)"
1048
1396
  ),
1049
- minCharactersToEnhance: z3.number().int().min(1).optional().describe("Minimum characters needed to trigger AI enhancement")
1397
+ minCharactersToEnhance: z4.number().int().min(1).optional().describe("Minimum characters needed to trigger AI enhancement")
1050
1398
  }).refine(
1051
1399
  (data) => {
1052
1400
  if (data.minCharacters !== void 0 && data.maxCharacters !== void 0) {
@@ -1073,19 +1421,19 @@ var longAnswerQuestionSchema = questionSchema.extend({
1073
1421
  "Schema for long answer questions with rich text support and AI enhancement"
1074
1422
  );
1075
1423
  var nestedDropdownQuestionSchema = questionSchema.extend({
1076
- type: z3.literal("nested_selection").describe("Must be exactly 'nested_selection'"),
1077
- placeholder: z3.string().max(200).optional().describe("Placeholder text for the nested dropdown"),
1078
- options: z3.array(nestedOptionSchema).min(1).max(100).describe(
1424
+ type: z4.literal("nested_selection").describe("Must be exactly 'nested_selection'"),
1425
+ placeholder: z4.string().max(200).optional().describe("Placeholder text for the nested dropdown"),
1426
+ options: z4.array(nestedOptionSchema).min(1).max(100).describe(
1079
1427
  "Array of nested options for hierarchical selection (1-100 options)"
1080
1428
  ),
1081
- displayStyle: z3.literal("list").describe("Fixed display style for nested dropdowns"),
1429
+ displayStyle: z4.literal("list").describe("Fixed display style for nested dropdowns"),
1082
1430
  choiceOrderOption: choiceOrderOptionSchema.optional().default("none").describe("How to order the nested choices"),
1083
- preserveLastChoices: z3.number().int().min(0).max(10).optional().describe("Number of choice levels to preserve (0-10)"),
1084
- prepopulatedValue: z3.string().max(1e3).optional().describe("Default value to pre-populate"),
1085
- allowOther: z3.boolean().optional().default(false).describe('Whether to allow custom "other" options'),
1086
- otherColumnName: z3.string().max(100).optional().describe('Column name for storing custom "other" values'),
1087
- maxDepth: z3.number().int().min(1).max(10).optional().describe("Maximum nesting depth allowed (1-10)"),
1088
- cascadeLabels: z3.boolean().optional().default(false).describe("Whether to cascade labels from parent options")
1431
+ preserveLastChoices: z4.number().int().min(0).max(10).optional().describe("Number of choice levels to preserve (0-10)"),
1432
+ prepopulatedValue: z4.string().max(1e3).optional().describe("Default value to pre-populate"),
1433
+ allowOther: z4.boolean().optional().default(false).describe('Whether to allow custom "other" options'),
1434
+ otherColumnName: z4.string().max(100).optional().describe('Column name for storing custom "other" values'),
1435
+ maxDepth: z4.number().int().min(1).max(10).optional().describe("Maximum nesting depth allowed (1-10)"),
1436
+ cascadeLabels: z4.boolean().optional().default(false).describe("Whether to cascade labels from parent options")
1089
1437
  }).refine(
1090
1438
  (data) => {
1091
1439
  if (data.allowOther && !data.otherColumnName) {
@@ -1100,7 +1448,7 @@ var nestedDropdownQuestionSchema = questionSchema.extend({
1100
1448
  ).describe(
1101
1449
  "Schema for nested dropdown questions with hierarchical option structure"
1102
1450
  );
1103
- var dateFormatSchema = z3.enum([
1451
+ var dateFormatSchema = z4.enum([
1104
1452
  "MM/DD/YYYY",
1105
1453
  "DD/MM/YYYY",
1106
1454
  "YYYY/MM/DD"
@@ -1110,40 +1458,40 @@ var DateFormats = {
1110
1458
  DD_MM_YYYY: "DD/MM/YYYY",
1111
1459
  YYYY_MM_DD: "YYYY/MM/DD"
1112
1460
  };
1113
- var dateSeparatorSchema = z3.enum(["/", "-", "."]);
1461
+ var dateSeparatorSchema = z4.enum(["/", "-", "."]);
1114
1462
  var DateSeparators = {
1115
1463
  SLASH: "/",
1116
1464
  DASH: "-",
1117
1465
  DOT: "."
1118
1466
  };
1119
1467
  var dateQuestionSchema = questionSchema.extend({
1120
- type: z3.literal("date").describe("Must be exactly 'date'"),
1468
+ type: z4.literal("date").describe("Must be exactly 'date'"),
1121
1469
  format: dateFormatSchema.optional().default("DD/MM/YYYY").describe("Order of day, month, and year segments in the input"),
1122
1470
  separator: dateSeparatorSchema.optional().default("/").describe("Character used to separate day, month, and year segments"),
1123
- includeTime: z3.boolean().optional().default(false).describe("Whether to also collect a time (HH:MM) alongside the date"),
1124
- minDate: z3.string().optional().describe(
1471
+ includeTime: z4.boolean().optional().default(false).describe("Whether to also collect a time (HH:MM) alongside the date"),
1472
+ minDate: z4.string().optional().describe(
1125
1473
  "Earliest allowed date in ISO 8601 format (YYYY-MM-DD); when absent no lower bound is enforced"
1126
1474
  ),
1127
- maxDate: z3.string().optional().describe(
1475
+ maxDate: z4.string().optional().describe(
1128
1476
  "Latest allowed date in ISO 8601 format (YYYY-MM-DD); when absent no upper bound is enforced"
1129
1477
  ),
1130
- placeholder: z3.string().max(50).optional().describe("Placeholder text shown in the date input"),
1131
- segmentLabelDD: z3.string().max(40).optional().describe(
1478
+ placeholder: z4.string().max(50).optional().describe("Placeholder text shown in the date input"),
1479
+ segmentLabelDD: z4.string().max(40).optional().describe(
1132
1480
  "Visible label above the day segment; when absent a locale default is used"
1133
1481
  ),
1134
- segmentLabelMM: z3.string().max(40).optional().describe("Visible label above the month segment"),
1135
- segmentLabelYYYY: z3.string().max(40).optional().describe("Visible label above the year segment"),
1136
- prepopulatedValue: z3.string().optional().describe(
1482
+ segmentLabelMM: z4.string().max(40).optional().describe("Visible label above the month segment"),
1483
+ segmentLabelYYYY: z4.string().max(40).optional().describe("Visible label above the year segment"),
1484
+ prepopulatedValue: z4.string().optional().describe(
1137
1485
  "Default date value in ISO 8601 format (YYYY-MM-DD) to pre-fill the input"
1138
1486
  )
1139
1487
  }).describe(
1140
1488
  "Schema for a date question that collects a structured date (and optionally time) from the respondent"
1141
1489
  );
1142
- var csatScaleSchema = z3.union([
1143
- z3.literal(2),
1144
- z3.literal(3),
1145
- z3.literal(4),
1146
- z3.literal(5)
1490
+ var csatScaleSchema = z4.union([
1491
+ z4.literal(2),
1492
+ z4.literal(3),
1493
+ z4.literal(4),
1494
+ z4.literal(5)
1147
1495
  ]);
1148
1496
  var CsatScales = {
1149
1497
  TWO: 2,
@@ -1151,56 +1499,102 @@ var CsatScales = {
1151
1499
  FOUR: 4,
1152
1500
  FIVE: 5
1153
1501
  };
1154
- var csatDisplayStyleSchema = z3.enum(["emoji", "text"]);
1502
+ var csatDisplayStyleSchema = z4.enum(["emoji", "text"]);
1155
1503
  var CsatDisplayStyles = {
1156
1504
  EMOJI: "emoji",
1157
1505
  TEXT: "text"
1158
1506
  };
1159
1507
  var csatQuestionSchema = questionSchema.extend({
1160
- type: z3.literal("csat").describe("Must be exactly 'csat'"),
1508
+ type: z4.literal("csat").describe("Must be exactly 'csat'"),
1161
1509
  scale: csatScaleSchema.optional().default(5).describe(
1162
1510
  "Number of response points (2\u20135); 2 and 4 have no neutral option, default is 5"
1163
1511
  ),
1164
1512
  displayStyle: csatDisplayStyleSchema.optional().default("emoji").describe(
1165
1513
  "How response options are rendered \u2014 emoji faces (default) or text buttons"
1166
1514
  ),
1167
- multicolor: z3.boolean().optional().default(false).describe(
1515
+ multicolor: z4.boolean().optional().default(false).describe(
1168
1516
  "Whether to apply distinct colors to negative, neutral, and positive segments"
1169
1517
  ),
1170
- negativeColor: z3.string().max(50).optional().describe(
1518
+ negativeColor: z4.string().max(50).optional().describe(
1171
1519
  "Color for negative response options (lower half of scale); any valid CSS color; used when multicolor is true"
1172
1520
  ),
1173
- neutralColor: z3.string().max(50).optional().describe(
1521
+ neutralColor: z4.string().max(50).optional().describe(
1174
1522
  "Color for the neutral midpoint option (odd scales only: scale 3 = value 2, scale 5 = value 3); any valid CSS color; used when multicolor is true"
1175
1523
  ),
1176
- positiveColor: z3.string().max(50).optional().describe(
1524
+ positiveColor: z4.string().max(50).optional().describe(
1177
1525
  "Color for positive response options (upper half of scale); any valid CSS color; used when multicolor is true"
1178
1526
  ),
1179
- showLabels: z3.boolean().optional().default(false).describe(
1527
+ showLabels: z4.boolean().optional().default(false).describe(
1180
1528
  "Whether to render per-point labels below each response option"
1181
1529
  ),
1182
- scaleLabels: z3.record(z3.string(), z3.string().max(100)).optional().describe(
1530
+ scaleLabels: z4.record(z4.string(), z4.string().max(100)).optional().describe(
1183
1531
  "Per-point label text keyed by value string ('1'\u2013'5'); keys must match the chosen scale size"
1532
+ ),
1533
+ overrideEmoji: z4.string().max(500).optional().describe(
1534
+ "JSON string array of emoji characters ordered low\u2192high (index 0 = point 1); length must match scale when set; values must be from the allowed CSAT emoji palette"
1184
1535
  )
1536
+ }).superRefine((data, ctx) => {
1537
+ if (data.overrideEmoji == null || data.overrideEmoji.trim() === "") {
1538
+ return;
1539
+ }
1540
+ const scale = data.scale ?? 5;
1541
+ let parsed;
1542
+ try {
1543
+ parsed = JSON.parse(data.overrideEmoji);
1544
+ } catch {
1545
+ ctx.addIssue({
1546
+ code: z4.ZodIssueCode.custom,
1547
+ message: "overrideEmoji must be a valid JSON array of strings",
1548
+ path: ["overrideEmoji"]
1549
+ });
1550
+ return;
1551
+ }
1552
+ if (!Array.isArray(parsed) || !parsed.every((item) => typeof item === "string")) {
1553
+ ctx.addIssue({
1554
+ code: z4.ZodIssueCode.custom,
1555
+ message: "overrideEmoji must be a JSON array of strings",
1556
+ path: ["overrideEmoji"]
1557
+ });
1558
+ return;
1559
+ }
1560
+ if (parsed.length !== scale) {
1561
+ ctx.addIssue({
1562
+ code: z4.ZodIssueCode.custom,
1563
+ message: `overrideEmoji must contain exactly ${scale} emoji(s) for a ${scale}-point scale`,
1564
+ path: ["overrideEmoji"]
1565
+ });
1566
+ return;
1567
+ }
1568
+ const allowed = new Set(CSAT_EMOJI_PALETTE);
1569
+ for (const emoji of parsed) {
1570
+ if (!allowed.has(emoji)) {
1571
+ ctx.addIssue({
1572
+ code: z4.ZodIssueCode.custom,
1573
+ message: `Emoji "${emoji}" is not in the allowed CSAT palette`,
1574
+ path: ["overrideEmoji"]
1575
+ });
1576
+ return;
1577
+ }
1578
+ }
1185
1579
  }).describe(
1186
1580
  "Schema for a CSAT (Customer Satisfaction Score) question using an industry-standard 1-to-N positive scale (N = 2\u20135)"
1187
1581
  );
1188
1582
  var opinionScaleQuestionSchema = questionSchema.extend({
1189
- type: z3.literal("opinion_scale").describe("Must be exactly 'opinion_scale'"),
1190
- startValue: z3.union([z3.literal(0), z3.literal(1)]).optional().default(0).describe("Starting value of the scale \u2014 0 (default) or 1"),
1191
- steps: z3.number().int().min(5).max(11).optional().default(11).describe(
1583
+ type: z4.literal("opinion_scale").describe("Must be exactly 'opinion_scale'"),
1584
+ startValue: z4.union([z4.literal(0), z4.literal(1)]).optional().default(0).describe("Starting value of the scale \u2014 0 (default) or 1"),
1585
+ steps: z4.number().int().min(5).max(11).optional().default(11).describe(
1192
1586
  "Number of points on the scale (5\u201311); default 11 gives a 0\u201310 or 1\u201311 range depending on startValue"
1193
1587
  ),
1194
- minLabel: z3.string().max(100).optional().describe(
1588
+ minLabel: z4.string().max(100).optional().describe(
1195
1589
  "Optional label anchoring the low end of the scale (e.g. 'Not at all likely')"
1196
1590
  ),
1197
- maxLabel: z3.string().max(100).optional().describe(
1591
+ maxLabel: z4.string().max(100).optional().describe(
1198
1592
  "Optional label anchoring the high end of the scale (e.g. 'Extremely likely')"
1199
1593
  )
1200
1594
  }).describe(
1201
1595
  "Schema for an opinion scale question \u2014 a horizontal numeric button scale with configurable range and optional end labels"
1202
1596
  );
1203
- var rankingDisplayStyleSchema = z3.enum([
1597
+ var rankingDisplayStyleSchema = z4.enum([
1204
1598
  "drag_drop",
1205
1599
  "dropdown",
1206
1600
  "up_down"
@@ -1211,18 +1605,21 @@ var RankingDisplayStyles = {
1211
1605
  UP_DOWN: "up_down"
1212
1606
  };
1213
1607
  var rankingQuestionSchema = questionSchema.extend({
1214
- type: z3.literal("ranking").describe("Must be exactly 'ranking'"),
1215
- options: z3.array(questionOptionSchema).min(2).max(30).describe(
1608
+ type: z4.literal("ranking").describe("Must be exactly 'ranking'"),
1609
+ options: z4.array(questionOptionSchema).min(2).max(30).describe(
1216
1610
  "List of items to rank (2\u201330 items); each item supports an optional hint for clarification"
1217
1611
  ),
1218
- randomizeOptions: z3.boolean().optional().default(false).describe(
1612
+ randomizeOptions: z4.boolean().optional().default(false).describe(
1219
1613
  "Whether to shuffle item order per respondent to avoid position bias"
1220
1614
  ),
1221
1615
  displayStyle: rankingDisplayStyleSchema.optional().default("drag_drop").describe(
1222
1616
  "Interaction mode \u2014 drag_drop (default) for drag-and-drop reordering, dropdown for selecting a rank number per item, up_down for arrow button reordering"
1223
1617
  ),
1224
- maxRank: z3.number().int().min(1).optional().describe(
1618
+ maxRank: z4.number().int().min(1).optional().describe(
1225
1619
  "Maximum number of items the respondent must rank (e.g. 3 = 'rank your top 3'); when absent all items must be ranked"
1620
+ ),
1621
+ prepopulatedValue: z4.array(z4.string()).optional().describe(
1622
+ "Default ranked order as option value strings (index 0 = rank 1)"
1226
1623
  )
1227
1624
  }).refine(
1228
1625
  (data) => data.maxRank === void 0 || data.maxRank <= data.options.length,
@@ -1230,34 +1627,53 @@ var rankingQuestionSchema = questionSchema.extend({
1230
1627
  message: "maxRank cannot exceed the number of options",
1231
1628
  path: ["maxRank"]
1232
1629
  }
1630
+ ).refine(
1631
+ (data) => {
1632
+ if (!data.prepopulatedValue?.length) return true;
1633
+ const optionValues = new Set(data.options.map((o) => o.value));
1634
+ return data.prepopulatedValue.every((v) => optionValues.has(v));
1635
+ },
1636
+ {
1637
+ message: "Prepopulated value must use valid option values",
1638
+ path: ["prepopulatedValue"]
1639
+ }
1640
+ ).refine(
1641
+ (data) => {
1642
+ if (!data.prepopulatedValue?.length || data.maxRank === void 0) return true;
1643
+ return data.prepopulatedValue.length <= data.maxRank;
1644
+ },
1645
+ {
1646
+ message: "Prepopulated value cannot exceed maxRank",
1647
+ path: ["prepopulatedValue"]
1648
+ }
1233
1649
  ).describe(
1234
1650
  "Schema for a ranking question where respondents order items by preference"
1235
1651
  );
1236
1652
  var pictureChoiceQuestionSchema = questionSchema.extend({
1237
- type: z3.literal("picture_choice").describe("Must be exactly 'picture_choice'"),
1238
- options: z3.array(questionOptionSchema).min(1).max(50).describe(
1653
+ type: z4.literal("picture_choice").describe("Must be exactly 'picture_choice'"),
1654
+ options: z4.array(questionOptionSchema).min(1).max(50).describe(
1239
1655
  "Array of options; each should include an imageUrl for the picture to display"
1240
1656
  ),
1241
- multiple: z3.boolean().optional().default(false).describe(
1657
+ multiple: z4.boolean().optional().default(false).describe(
1242
1658
  "When true respondents may select more than one image; when false (default) only one image can be selected"
1243
1659
  ),
1244
- minSelections: z3.number().int().min(1).optional().describe(
1660
+ minSelections: z4.number().int().min(1).optional().describe(
1245
1661
  "Minimum number of images the respondent must select (only applies when multiple is true)"
1246
1662
  ),
1247
- maxSelections: z3.number().int().min(1).optional().describe(
1663
+ maxSelections: z4.number().int().min(1).optional().describe(
1248
1664
  "Maximum number of images the respondent may select (only applies when multiple is true)"
1249
1665
  ),
1250
- supersize: z3.boolean().optional().default(false).describe("Whether to display images at an enlarged size"),
1251
- showLabels: z3.boolean().optional().default(true).describe("Whether to show the text label below each image"),
1252
- randomizeOptions: z3.boolean().optional().default(false).describe(
1666
+ supersize: z4.boolean().optional().default(false).describe("Whether to display images at an enlarged size"),
1667
+ showLabels: z4.boolean().optional().default(true).describe("Whether to show the text label below each image"),
1668
+ randomizeOptions: z4.boolean().optional().default(false).describe(
1253
1669
  "Whether to shuffle image order per respondent to avoid position bias"
1254
1670
  ),
1255
- allowOther: z3.boolean().optional().default(false).describe('Whether to include a free-text "other" option'),
1256
- otherTextConfig: z3.object({
1257
- minChars: z3.number().int().min(0).optional().describe("Minimum number of characters required for the other text"),
1258
- maxChars: z3.number().int().min(1).optional().describe("Maximum number of characters allowed for the other text"),
1259
- placeholder: z3.string().max(200).optional().describe("Placeholder text for the other text input"),
1260
- showLimitIndicatorThreshold: z3.number().int().min(0).optional().describe(
1671
+ allowOther: z4.boolean().optional().default(false).describe('Whether to include a free-text "other" option'),
1672
+ otherTextConfig: z4.object({
1673
+ minChars: z4.number().int().min(0).optional().describe("Minimum number of characters required for the other text"),
1674
+ maxChars: z4.number().int().min(1).optional().describe("Maximum number of characters allowed for the other text"),
1675
+ placeholder: z4.string().max(200).optional().describe("Placeholder text for the other text input"),
1676
+ showLimitIndicatorThreshold: z4.number().int().min(0).optional().describe(
1261
1677
  "Show the character limit indicator once the user has typed this many characters; 0 = show immediately, absent = never show"
1262
1678
  )
1263
1679
  }).optional().describe('Configuration for the custom "other" text input')
@@ -1275,111 +1691,115 @@ var pictureChoiceQuestionSchema = questionSchema.extend({
1275
1691
  ).describe(
1276
1692
  "Schema for a picture choice question where respondents select from image-based options"
1277
1693
  );
1278
- var signatureModeSchema = z3.enum(["type", "draw", "upload"]);
1694
+ var signatureModeSchema = z4.enum(["type", "draw", "upload"]);
1279
1695
  var SignatureModes = {
1280
1696
  TYPE: "type",
1281
1697
  DRAW: "draw",
1282
1698
  UPLOAD: "upload"
1283
1699
  };
1284
1700
  var signatureQuestionSchema = questionSchema.extend({
1285
- type: z3.literal("signature").describe("Must be exactly 'signature'"),
1286
- allowedModes: z3.array(signatureModeSchema).min(1).optional().describe(
1701
+ type: z4.literal("signature").describe("Must be exactly 'signature'"),
1702
+ allowedModes: z4.array(signatureModeSchema).min(1).optional().describe(
1287
1703
  "Which signing methods the respondent can choose from (type, draw, upload); when absent all three are enabled"
1288
1704
  ),
1289
1705
  defaultMode: signatureModeSchema.optional().describe(
1290
1706
  "Which signing tab is pre-selected when the question is first shown; when absent the platform chooses"
1291
1707
  ),
1292
- collectSignerEmail: z3.boolean().optional().default(true).describe(
1708
+ collectSignerEmail: z4.boolean().optional().default(true).describe(
1293
1709
  "Whether to auto-collect the signer's email so a signed PDF copy can be sent to them; set to false if the form already collects an email via signerEmailFieldId or another question"
1294
1710
  ),
1295
- signerEmailFieldId: z3.string().optional().describe(
1711
+ signerEmailFieldId: z4.string().optional().describe(
1296
1712
  "ID of an existing email question in the form whose value will be used as the signer's email address, instead of auto-appending a new email prompt"
1297
1713
  ),
1298
- penColor: z3.string().max(50).optional().describe(
1714
+ penColor: z4.string().max(50).optional().describe(
1299
1715
  "Stroke color for the draw canvas; any valid CSS color; when absent the theme foreground color is used"
1300
1716
  ),
1301
- penWidth: z3.number().int().min(1).max(20).optional().describe(
1717
+ penWidth: z4.number().int().min(1).max(20).optional().describe(
1302
1718
  "Pen stroke thickness in pixels for the draw canvas (1\u201320); when absent the renderer default (typically 2) is used"
1303
1719
  ),
1304
- backgroundColor: z3.string().max(50).optional().describe(
1720
+ backgroundColor: z4.string().max(50).optional().describe(
1305
1721
  "Background color of the draw canvas; any valid CSS color; when absent the canvas is transparent and inherits the form background"
1306
1722
  ),
1307
- canvasHeight: z3.number().int().min(60).max(600).optional().describe(
1723
+ canvasHeight: z4.number().int().min(60).max(600).optional().describe(
1308
1724
  "Draw canvas height in logical pixels (60\u2013600); width always fills the container; when absent the renderer chooses a sensible default (typically 200)"
1309
1725
  ),
1310
- clearButtonLabel: z3.string().max(50).optional().describe(
1726
+ clearButtonLabel: z4.string().max(50).optional().describe(
1311
1727
  "Label for the clear/redo button in draw mode; when absent the platform default label or icon is shown"
1312
1728
  ),
1313
- placeholder: z3.string().max(200).optional().describe(
1729
+ placeholder: z4.string().max(200).optional().describe(
1314
1730
  "Optional shared fallback copy for draw-canvas and upload-zone hints when their dedicated fields are unset"
1315
1731
  ),
1316
- modeTabLabelType: z3.string().max(80).optional().describe(
1732
+ modeTabLabelType: z4.string().max(80).optional().describe(
1317
1733
  "Custom visible label for the Type tab; when absent only the tab icon is shown (use aria-label on the client)"
1318
1734
  ),
1319
- modeTabLabelDraw: z3.string().max(80).optional().describe(
1735
+ modeTabLabelDraw: z4.string().max(80).optional().describe(
1320
1736
  "Custom visible label for the Draw tab; when absent only the tab icon is shown"
1321
1737
  ),
1322
- modeTabLabelUpload: z3.string().max(80).optional().describe(
1738
+ modeTabLabelUpload: z4.string().max(80).optional().describe(
1323
1739
  "Custom visible label for the Upload tab; when absent only the tab icon is shown"
1324
1740
  ),
1325
- drawCanvasHint: z3.string().max(200).optional().describe(
1741
+ drawCanvasHint: z4.string().max(200).optional().describe(
1326
1742
  "Hint shown on the empty draw canvas (e.g. 'Draw your signature here'); falls back to placeholder then platform default"
1327
1743
  ),
1328
- uploadZonePrimary: z3.string().max(200).optional().describe(
1744
+ uploadZonePrimary: z4.string().max(200).optional().describe(
1329
1745
  "Main prompt on the upload drop zone when idle (e.g. click to upload); falls back to placeholder then default"
1330
1746
  ),
1331
- uploadZoneDrag: z3.string().max(120).optional().describe(
1747
+ uploadZoneDrag: z4.string().max(120).optional().describe(
1332
1748
  "Short prompt when dragging a file over the upload zone; falls back to platform default"
1333
- )
1749
+ ),
1750
+ uploadSignatureButtonLabel: z4.string().max(80).optional().describe("Label for the Upload Signature button in draw mode"),
1751
+ uploadButtonLabel: z4.string().max(80).optional().describe("Label for the Upload button in upload mode preview"),
1752
+ removeButtonLabel: z4.string().max(80).optional().describe("Label for Remove controls in upload mode"),
1753
+ dismissErrorButtonLabel: z4.string().max(80).optional().describe("Accessible label for the dismiss control on upload error overlays")
1334
1754
  }).describe(
1335
1755
  "Schema for a signature question where respondents can type, draw, or upload their electronic signature"
1336
1756
  );
1337
1757
  var fileUploadQuestionSchema = questionSchema.extend({
1338
- type: z3.literal("file_upload").describe("Must be exactly 'file_upload'"),
1339
- allowedFileTypes: z3.array(z3.string()).min(1).optional().describe(
1758
+ type: z4.literal("file_upload").describe("Must be exactly 'file_upload'"),
1759
+ allowedFileTypes: z4.array(z4.string()).min(1).optional().describe(
1340
1760
  "MIME types and/or file extensions the respondent is allowed to upload (e.g. ['image/jpeg', '.pdf']); when absent all file types are accepted"
1341
1761
  ),
1342
- maxFileSizeMb: z3.number().int().min(1).max(100).optional().describe(
1762
+ maxFileSizeMb: z4.number().int().min(1).max(100).optional().describe(
1343
1763
  "Maximum size per uploaded file in megabytes (1\u2013100); when absent the platform enforces its own ceiling"
1344
1764
  ),
1345
- multiple: z3.boolean().optional().default(false).describe(
1765
+ multiple: z4.boolean().optional().default(false).describe(
1346
1766
  "When true the respondent may upload more than one file in a single question; when false (default) only one file is accepted"
1347
1767
  ),
1348
- maxFiles: z3.number().int().min(1).max(20).optional().describe(
1768
+ maxFiles: z4.number().int().min(1).max(20).optional().describe(
1349
1769
  "Maximum number of files the respondent may upload (1\u201320); only applies when multiple is true; when absent no per-question file count limit is enforced"
1350
1770
  ),
1351
- placeholder: z3.string().max(200).optional().describe(
1771
+ placeholder: z4.string().max(200).optional().describe(
1352
1772
  "Text shown inside the upload dropzone to guide respondents (e.g. 'Drop your CV here or click to browse')"
1353
1773
  )
1354
1774
  }).describe(
1355
1775
  "Schema for a file upload question where respondents can attach one or more files from their device"
1356
1776
  );
1357
1777
  var emailQuestionSchema = questionSchema.extend({
1358
- type: z3.literal("email").describe("Must be exactly 'email'"),
1359
- placeholder: z3.string().max(200).optional().describe("Placeholder text shown inside the email input"),
1360
- prepopulatedValue: z3.string().optional().describe(
1778
+ type: z4.literal("email").describe("Must be exactly 'email'"),
1779
+ placeholder: z4.string().max(200).optional().describe("Placeholder text shown inside the email input"),
1780
+ prepopulatedValue: z4.string().optional().describe(
1361
1781
  "Default email address to pre-fill the input (e.g. passed via URL param or hidden field)"
1362
1782
  )
1363
1783
  }).describe(
1364
1784
  "Schema for an email question that only accepts correctly formatted email addresses"
1365
1785
  );
1366
1786
  var numberQuestionSchema = questionSchema.extend({
1367
- type: z3.literal("number").describe("Must be exactly 'number'"),
1368
- min: z3.number().optional().describe(
1787
+ type: z4.literal("number").describe("Must be exactly 'number'"),
1788
+ min: z4.number().optional().describe(
1369
1789
  "Minimum allowed value (inclusive); when absent no lower bound is enforced"
1370
1790
  ),
1371
- max: z3.number().optional().describe(
1791
+ max: z4.number().optional().describe(
1372
1792
  "Maximum allowed value (inclusive); when absent no upper bound is enforced"
1373
1793
  ),
1374
- allowDecimal: z3.boolean().optional().default(false).describe(
1794
+ allowDecimal: z4.boolean().optional().default(false).describe(
1375
1795
  "Whether decimal (non-integer) values are accepted; Typeform restricts to whole numbers only, making this a differentiator"
1376
1796
  ),
1377
- allowNegative: z3.boolean().optional().default(false).describe(
1797
+ allowNegative: z4.boolean().optional().default(false).describe(
1378
1798
  "Whether negative values are accepted; Typeform restricts to positive numbers only, making this a differentiator"
1379
1799
  ),
1380
- placeholder: z3.string().max(200).optional().describe("Placeholder text shown inside the number input"),
1381
- prepopulatedValue: z3.number().optional().describe("Default numeric value to pre-fill the input"),
1382
- unit: z3.string().max(10).optional().describe(
1800
+ placeholder: z4.string().max(200).optional().describe("Placeholder text shown inside the number input"),
1801
+ prepopulatedValue: z4.number().optional().describe("Default numeric value to pre-fill the input"),
1802
+ unit: z4.string().max(10).optional().describe(
1383
1803
  "Unit label displayed beside the input (e.g. 'kg', '$', 'years')"
1384
1804
  )
1385
1805
  }).refine(
@@ -1392,39 +1812,39 @@ var numberQuestionSchema = questionSchema.extend({
1392
1812
  "Schema for a number question that only accepts numeric input with configurable range and format constraints"
1393
1813
  );
1394
1814
  var websiteQuestionSchema = questionSchema.extend({
1395
- type: z3.literal("website").describe("Must be exactly 'website'"),
1396
- placeholder: z3.string().max(200).optional().describe(
1815
+ type: z4.literal("website").describe("Must be exactly 'website'"),
1816
+ placeholder: z4.string().max(200).optional().describe(
1397
1817
  "Placeholder text shown inside the URL input (e.g. 'https://yoursite.com')"
1398
1818
  ),
1399
- prepopulatedValue: z3.string().optional().describe("Default URL to pre-fill the input")
1819
+ prepopulatedValue: z4.string().optional().describe("Default URL to pre-fill the input")
1400
1820
  }).describe(
1401
1821
  "Schema for a website question that collects a URL with built-in format validation"
1402
1822
  );
1403
1823
  var phoneNumberQuestionSchema = questionSchema.extend({
1404
- type: z3.literal("phone_number").describe("Must be exactly 'phone_number'"),
1405
- defaultCountryCode: z3.string().max(2).optional().describe(
1824
+ type: z4.literal("phone_number").describe("Must be exactly 'phone_number'"),
1825
+ defaultCountryCode: z4.string().max(2).optional().describe(
1406
1826
  "ISO 3166-1 alpha-2 country code to pre-select in the country picker (e.g. 'US', 'IN'); when absent the platform uses the device/locale default"
1407
1827
  ),
1408
- allowCountryChange: z3.boolean().optional().default(true).describe(
1828
+ allowCountryChange: z4.boolean().optional().default(true).describe(
1409
1829
  "Whether the respondent can change the country code; when false the default country is locked"
1410
1830
  ),
1411
- placeholder: z3.string().max(200).optional().describe("Placeholder text shown inside the phone number input"),
1412
- prepopulatedValue: z3.string().optional().describe(
1831
+ placeholder: z4.string().max(200).optional().describe("Placeholder text shown inside the phone number input"),
1832
+ prepopulatedValue: z4.string().optional().describe(
1413
1833
  "Default phone number to pre-fill the input; E.164 format recommended (e.g. '+14155552671')"
1414
1834
  )
1415
1835
  }).describe(
1416
1836
  "Schema for a phone number question with country code picker and country-specific format validation"
1417
1837
  );
1418
- var addressSubFieldConfigSchema = z3.object({
1419
- enabled: z3.boolean().default(true).describe("Whether this sub-field is shown in the question"),
1420
- required: z3.boolean().default(false).describe("Whether the respondent must fill in this sub-field"),
1421
- placeholder: z3.string().max(200).optional().describe("Placeholder text for this sub-field input"),
1422
- label: z3.string().max(120).optional().describe(
1838
+ var addressSubFieldConfigSchema = z4.object({
1839
+ enabled: z4.boolean().default(true).describe("Whether this sub-field is shown in the question"),
1840
+ required: z4.boolean().default(false).describe("Whether the respondent must fill in this sub-field"),
1841
+ placeholder: z4.string().max(200).optional().describe("Placeholder text for this sub-field input"),
1842
+ label: z4.string().max(120).optional().describe(
1423
1843
  "Visible caption above this sub-field; defaults to built-in copy when omitted"
1424
1844
  )
1425
1845
  }).describe("Configuration for an individual address sub-field");
1426
1846
  var addressQuestionSchema = questionSchema.extend({
1427
- type: z3.literal("address").describe("Must be exactly 'address'"),
1847
+ type: z4.literal("address").describe("Must be exactly 'address'"),
1428
1848
  addressLine1: addressSubFieldConfigSchema.optional().describe("Configuration for the primary street address line"),
1429
1849
  addressLine2: addressSubFieldConfigSchema.optional().describe(
1430
1850
  "Configuration for the secondary address line (apartment, suite, etc.); hidden by default"
@@ -1433,13 +1853,16 @@ var addressQuestionSchema = questionSchema.extend({
1433
1853
  stateProvince: addressSubFieldConfigSchema.optional().describe("Configuration for the state, region, or province sub-field"),
1434
1854
  postalCode: addressSubFieldConfigSchema.optional().describe("Configuration for the ZIP/postal code sub-field"),
1435
1855
  country: addressSubFieldConfigSchema.optional().describe("Configuration for the country sub-field"),
1436
- defaultCountry: z3.string().max(2).optional().describe(
1856
+ defaultCountry: z4.string().max(2).optional().describe(
1437
1857
  "ISO 3166-1 alpha-2 country code to pre-select in the country dropdown (e.g. 'US', 'GB')"
1858
+ ),
1859
+ prepopulatedValue: AddressAnswerSchema.optional().describe(
1860
+ "Default address values to pre-fill the sub-fields"
1438
1861
  )
1439
1862
  }).describe(
1440
1863
  "Schema for an address question that collects a full structured address on a single screen"
1441
1864
  );
1442
- var videoAudioModeSchema = z3.enum(["video", "audio", "photo", "text"]);
1865
+ var videoAudioModeSchema = z4.enum(["video", "audio", "photo", "text"]);
1443
1866
  var VideoAudioModes = {
1444
1867
  VIDEO: "video",
1445
1868
  AUDIO: "audio",
@@ -1447,186 +1870,197 @@ var VideoAudioModes = {
1447
1870
  TEXT: "text"
1448
1871
  };
1449
1872
  var videoAudioQuestionSchema = questionSchema.extend({
1450
- type: z3.literal("video_audio").describe("Must be exactly 'video_audio'"),
1451
- allowedModes: z3.array(videoAudioModeSchema).min(1).optional().describe(
1873
+ type: z4.literal("video_audio").describe("Must be exactly 'video_audio'"),
1874
+ allowedModes: z4.array(videoAudioModeSchema).min(1).optional().describe(
1452
1875
  "Which answer types the respondent can choose from (video, audio, photo, text); when absent all four are enabled"
1453
1876
  ),
1454
1877
  defaultMode: videoAudioModeSchema.optional().describe(
1455
1878
  "Which mode tab is pre-selected when the question opens; when absent the platform chooses"
1456
1879
  ),
1457
- maxDurationSeconds: z3.number().int().min(5).max(600).optional().describe(
1880
+ maxDurationSeconds: z4.number().int().min(5).max(600).optional().describe(
1458
1881
  "Maximum recording length in seconds (5\u2013600); Typeform hardcodes 120s with no config, making this a differentiator; when absent the platform default applies"
1459
1882
  ),
1460
- maxFileSizeMb: z3.number().int().min(1).max(500).optional().describe(
1883
+ maxFileSizeMb: z4.number().int().min(1).max(500).optional().describe(
1461
1884
  "Maximum size in megabytes for uploaded pre-recorded files (1\u2013500); when absent the platform ceiling applies"
1462
1885
  ),
1463
- allowUpload: z3.boolean().optional().default(true).describe(
1886
+ allowUpload: z4.boolean().optional().default(true).describe(
1464
1887
  "Whether the respondent can upload a file in addition to recording or capturing live (video, audio, or photo)"
1465
1888
  ),
1466
- placeholder: z3.string().max(200).optional().describe(
1889
+ placeholder: z4.string().max(200).optional().describe(
1467
1890
  "Instructional text shown to the respondent before they begin recording or capturing"
1468
1891
  ),
1469
- modeTabLabelVideo: z3.string().max(80).optional().describe(
1892
+ modeTabLabelVideo: z4.string().max(80).optional().describe(
1470
1893
  "Custom tab label for video mode in the respondent UI; when absent defaults to 'Video'"
1471
1894
  ),
1472
- modeTabLabelAudio: z3.string().max(80).optional().describe(
1895
+ modeTabLabelAudio: z4.string().max(80).optional().describe(
1473
1896
  "Custom tab label for audio mode; when absent defaults to 'Audio'"
1474
1897
  ),
1475
- modeTabLabelPhoto: z3.string().max(80).optional().describe(
1898
+ modeTabLabelPhoto: z4.string().max(80).optional().describe(
1476
1899
  "Custom tab label for photo mode; when absent defaults to 'Photo'"
1477
1900
  ),
1478
- modeTabLabelText: z3.string().max(80).optional().describe(
1901
+ modeTabLabelText: z4.string().max(80).optional().describe(
1479
1902
  "Custom tab label for text mode; when absent defaults to 'Text'"
1480
1903
  ),
1481
- recordButtonLabel: z3.string().max(80).optional().describe("Label for the Record button in video/audio modes"),
1482
- uploadMediaButtonLabel: z3.string().max(80).optional().describe(
1904
+ recordButtonLabel: z4.string().max(80).optional().describe("Label for the Record button in video/audio modes"),
1905
+ uploadMediaButtonLabel: z4.string().max(80).optional().describe(
1483
1906
  "Label for the upload control in video/audio modes when uploads are allowed"
1484
1907
  ),
1485
- videoIdleHint: z3.string().max(200).optional().describe(
1908
+ videoIdleHint: z4.string().max(200).optional().describe(
1486
1909
  "Hint shown over the video preview when idle; falls back to placeholder then built-in copy"
1487
1910
  ),
1488
- photoEmptyHint: z3.string().max(200).optional().describe(
1911
+ photoEmptyHint: z4.string().max(200).optional().describe(
1489
1912
  "Hint in the empty photo preview area; falls back to placeholder then built-in copy"
1490
1913
  ),
1491
- photoUseCameraButtonLabel: z3.string().max(80).optional().describe("Label for the Use camera button in photo mode"),
1492
- photoUploadImageButtonLabel: z3.string().max(80).optional().describe("Label for the upload image button in photo mode")
1914
+ photoUseCameraButtonLabel: z4.string().max(80).optional().describe("Label for the Use camera button in photo mode"),
1915
+ photoUploadImageButtonLabel: z4.string().max(80).optional().describe("Label for the upload image button in photo mode"),
1916
+ capturePhotoButtonLabel: z4.string().max(80).optional().describe("Label for the Capture photo button in live photo mode"),
1917
+ cancelButtonLabel: z4.string().max(80).optional().describe("Label for the Cancel button when live photo camera is open"),
1918
+ uploadPhotoButtonLabel: z4.string().max(80).optional().describe("Label for the Upload Photo button on photo preview"),
1919
+ replaceButtonLabel: z4.string().max(80).optional().describe("Label for the Replace button on photo preview"),
1920
+ removeButtonLabel: z4.string().max(80).optional().describe("Label for Remove controls across media modes"),
1921
+ stopRecordingButtonLabel: z4.string().max(80).optional().describe("Label for the Stop recording button while recording"),
1922
+ playButtonLabel: z4.string().max(80).optional().describe("Label for the Play button on recording preview"),
1923
+ pauseButtonLabel: z4.string().max(80).optional().describe("Label for the Pause button on recording preview"),
1924
+ uploadButtonLabel: z4.string().max(80).optional().describe("Label for the Upload button on recording preview"),
1925
+ rerecordButtonLabel: z4.string().max(80).optional().describe("Label for the Re-record button on recording preview"),
1926
+ dismissErrorButtonLabel: z4.string().max(80).optional().describe("Accessible label for dismiss on media upload error overlays")
1493
1927
  }).describe(
1494
1928
  "Schema for a video, audio, and photo question where respondents can record or upload media or enter a text answer"
1495
1929
  );
1496
- var schedulerProviderSchema = z3.enum(["google_calendar", "calendly"]);
1930
+ var schedulerProviderSchema = z4.enum(["google_calendar", "calendly"]);
1497
1931
  var SchedulerProviders = {
1498
1932
  GOOGLE_CALENDAR: "google_calendar",
1499
1933
  CALENDLY: "calendly"
1500
1934
  };
1501
1935
  var schedulerQuestionSchema = questionSchema.extend({
1502
- type: z3.literal("scheduler").describe("Must be exactly 'scheduler'"),
1936
+ type: z4.literal("scheduler").describe("Must be exactly 'scheduler'"),
1503
1937
  provider: schedulerProviderSchema.optional().describe(
1504
1938
  "Which calendar integration to use (google_calendar or calendly); when absent the platform uses whatever is connected"
1505
1939
  ),
1506
- calendarId: z3.string().optional().describe(
1940
+ calendarId: z4.string().optional().describe(
1507
1941
  "Specific Google Calendar ID or Calendly event-type URL/slug to book from; when absent the default calendar or event type is used"
1508
1942
  ),
1509
- showIntroScreen: z3.boolean().optional().default(true).describe(
1943
+ showIntroScreen: z4.boolean().optional().default(true).describe(
1510
1944
  "Whether to show the Calendly event intro screen (account name, event name, duration) before the time picker; only applies when provider is 'calendly'"
1511
1945
  ),
1512
- autofillNameFieldId: z3.string().optional().describe(
1946
+ autofillNameFieldId: z4.string().optional().describe(
1513
1947
  "ID of a prior Short Text or Name question whose answer is pre-filled into the Calendly booking name field; only applies when provider is 'calendly'"
1514
1948
  ),
1515
- autofillEmailFieldId: z3.string().optional().describe(
1949
+ autofillEmailFieldId: z4.string().optional().describe(
1516
1950
  "ID of a prior Email question whose answer is pre-filled into the Calendly booking email field; only applies when provider is 'calendly'"
1517
1951
  ),
1518
- placeholder: z3.string().max(200).optional().describe(
1952
+ placeholder: z4.string().max(200).optional().describe(
1519
1953
  "Fallback text for the book-a-meeting button when scheduleMeetingLabel is unset; also used as a secondary fallback in the CTA copy chain"
1520
1954
  ),
1521
- scheduleMeetingLabel: z3.string().max(200).optional().describe(
1955
+ scheduleMeetingLabel: z4.string().max(200).optional().describe(
1522
1956
  "Primary label on the book-a-meeting button and modal; when absent uses placeholder then the built-in default (e.g. 'Schedule a meeting')"
1523
1957
  )
1524
1958
  }).describe(
1525
1959
  "Schema for a scheduler question where respondents book a time slot directly within the form via Google Calendar or Calendly"
1526
1960
  );
1527
1961
  var qnaWithAiQuestionSchema = questionSchema.extend({
1528
- type: z3.literal("qna_with_ai").describe("Must be exactly 'qna_with_ai'"),
1529
- knowledgeBase: z3.string().max(2e4).describe(
1962
+ type: z4.literal("qna_with_ai").describe("Must be exactly 'qna_with_ai'"),
1963
+ knowledgeBase: z4.string().max(2e4).describe(
1530
1964
  "The knowledge base content the AI draws from when answering respondent questions; Markdown formatting is recommended; up to 20,000 characters"
1531
1965
  ),
1532
- maxResponseLength: z3.number().int().min(50).max(2e3).optional().describe(
1966
+ maxResponseLength: z4.number().int().min(50).max(2e3).optional().describe(
1533
1967
  "Maximum number of characters per AI-generated response (50\u20132000); Typeform hardcodes 300, making this configurable a differentiator; when absent the platform default (300) applies"
1534
1968
  ),
1535
- maxQaPairs: z3.number().int().min(1).max(100).optional().describe(
1969
+ maxQaPairs: z4.number().int().min(1).max(100).optional().describe(
1536
1970
  "Maximum number of Q&A exchanges allowed per submission (1\u2013100); Typeform hardcodes 20, making this configurable a differentiator; when absent the platform default (20) applies"
1537
1971
  ),
1538
- placeholder: z3.string().max(200).optional().describe(
1972
+ placeholder: z4.string().max(200).optional().describe(
1539
1973
  "Hint text shown in the respondent's question input field (e.g. 'Ask me anything about this event...')"
1540
1974
  ),
1541
- askButtonLabel: z3.string().max(50).optional().describe(
1975
+ askButtonLabel: z4.string().max(50).optional().describe(
1542
1976
  "Label for the submit/ask button; when absent the platform default (e.g. 'Ask AI') is shown"
1543
1977
  ),
1544
- emptyStateHint: z3.string().max(200).optional().describe(
1978
+ emptyStateHint: z4.string().max(200).optional().describe(
1545
1979
  "Message in the empty chat area (e.g. 'Ask the AI a question to get started.'); when absent uses placeholder then a built-in default"
1546
1980
  ),
1547
- pairsRemainingTemplate: z3.string().max(160).optional().describe(
1981
+ pairsRemainingTemplate: z4.string().max(160).optional().describe(
1548
1982
  "Counter when under the limit; use tokens {remaining} and {max} (e.g. '{remaining} of {max} questions remaining'); when absent the client uses built-in English with pluralization"
1549
1983
  ),
1550
- pairsLimitReachedTemplate: z3.string().max(160).optional().describe(
1984
+ pairsLimitReachedTemplate: z4.string().max(160).optional().describe(
1551
1985
  "Counter when the exchange limit is reached; use token {max}; when absent the client uses built-in English with pluralization"
1552
1986
  )
1553
1987
  }).describe(
1554
1988
  "Schema for a Q&A with AI question where respondents ask questions and receive AI-generated answers drawn from a configurable knowledge base"
1555
1989
  );
1556
- var paymentsUpiAmountConfigSchema = z3.discriminatedUnion("mode", [
1557
- z3.object({
1558
- mode: z3.literal("fixed").describe("A fixed amount configured by the form builder"),
1559
- amount: z3.number().positive().describe("Fixed amount to request in INR")
1990
+ var paymentsUpiAmountConfigSchema = z4.discriminatedUnion("mode", [
1991
+ z4.object({
1992
+ mode: z4.literal("fixed").describe("A fixed amount configured by the form builder"),
1993
+ amount: z4.number().positive().describe("Fixed amount to request in INR")
1560
1994
  }),
1561
- z3.object({
1562
- mode: z3.literal("range").describe("Respondent enters an amount within the configured range"),
1563
- minAmount: z3.number().positive().describe("Minimum allowed amount in INR"),
1564
- maxAmount: z3.number().positive().describe("Maximum allowed amount in INR"),
1565
- defaultAmount: z3.number().positive().optional().describe("Optional initial amount shown to the respondent")
1995
+ z4.object({
1996
+ mode: z4.literal("range").describe("Respondent enters an amount within the configured range"),
1997
+ minAmount: z4.number().positive().describe("Minimum allowed amount in INR"),
1998
+ maxAmount: z4.number().positive().describe("Maximum allowed amount in INR"),
1999
+ defaultAmount: z4.number().positive().optional().describe("Optional initial amount shown to the respondent")
1566
2000
  }),
1567
- z3.object({
1568
- mode: z3.literal("question_mappings").describe("Amount is summed from one or more previous question answers"),
1569
- sources: z3.array(
1570
- z3.object({
1571
- sourceQuestionId: z3.string().describe(
2001
+ z4.object({
2002
+ mode: z4.literal("question_mappings").describe("Amount is summed from one or more previous question answers"),
2003
+ sources: z4.array(
2004
+ z4.object({
2005
+ sourceQuestionId: z4.string().describe(
1572
2006
  "ID of the prior question whose answer contributes to the amount"
1573
2007
  ),
1574
- mappings: z3.array(
1575
- z3.object({
1576
- answerValue: z3.string().describe("Previous question answer value to match"),
1577
- amount: z3.number().nonnegative().describe(
2008
+ mappings: z4.array(
2009
+ z4.object({
2010
+ answerValue: z4.string().describe("Previous question answer value to match"),
2011
+ amount: z4.number().nonnegative().describe(
1578
2012
  "Amount to add in INR when this answer is selected"
1579
2013
  ),
1580
- label: z3.string().max(120).optional().describe("Optional display label for this mapped amount")
2014
+ label: z4.string().max(120).optional().describe("Optional display label for this mapped amount")
1581
2015
  })
1582
2016
  ).min(1).describe("Answer-to-amount mappings for this source question")
1583
2017
  })
1584
2018
  ).min(1).describe("Previous question sources that contribute to the amount"),
1585
- fallbackAmount: z3.number().nonnegative().optional().describe("Optional amount to use when no source mapping matches")
2019
+ fallbackAmount: z4.number().nonnegative().optional().describe("Optional amount to use when no source mapping matches")
1586
2020
  })
1587
2021
  ]).superRefine((data, ctx) => {
1588
2022
  if (data.mode !== "range") return;
1589
2023
  if (data.minAmount > data.maxAmount) {
1590
2024
  ctx.addIssue({
1591
- code: z3.ZodIssueCode.custom,
2025
+ code: z4.ZodIssueCode.custom,
1592
2026
  message: "minAmount cannot be greater than maxAmount",
1593
2027
  path: ["minAmount"]
1594
2028
  });
1595
2029
  }
1596
2030
  if (data.defaultAmount !== void 0 && (data.defaultAmount < data.minAmount || data.defaultAmount > data.maxAmount)) {
1597
2031
  ctx.addIssue({
1598
- code: z3.ZodIssueCode.custom,
2032
+ code: z4.ZodIssueCode.custom,
1599
2033
  message: "defaultAmount must be within minAmount and maxAmount",
1600
2034
  path: ["defaultAmount"]
1601
2035
  });
1602
2036
  }
1603
2037
  }).describe("Amount configuration for a payments_upi question");
1604
2038
  var paymentsUpiQuestionSchema = questionSchema.extend({
1605
- type: z3.literal("payments_upi").describe("Must be exactly 'payments_upi'"),
1606
- payeeVpa: z3.string().min(3).max(255).regex(
2039
+ type: z4.literal("payments_upi").describe("Must be exactly 'payments_upi'"),
2040
+ payeeVpa: z4.string().min(3).max(255).regex(
1607
2041
  /^[\w.\-]+@[\w.\-]+$/,
1608
2042
  "payeeVpa must be a valid UPI VPA such as merchant@bank"
1609
2043
  ).describe("UPI virtual payment address that receives the payment"),
1610
- payeeName: z3.string().max(100).optional().describe("Display name for the UPI payee"),
2044
+ payeeName: z4.string().max(100).optional().describe("Display name for the UPI payee"),
1611
2045
  amount: paymentsUpiAmountConfigSchema.describe(
1612
2046
  "How the requested INR amount is determined"
1613
2047
  ),
1614
- sourceEmailQuestionId: z3.string().optional().describe(
2048
+ sourceEmailQuestionId: z4.string().optional().describe(
1615
2049
  "Optional ID of the email question whose answer is used for form submission receipt emails"
1616
2050
  ),
1617
- transactionNote: z3.string().max(80).optional().describe(
2051
+ transactionNote: z4.string().max(80).optional().describe(
1618
2052
  "Short note included in the UPI intent; the platform may append the Encatch reference"
1619
2053
  ),
1620
- transactionReferencePrefix: z3.string().max(24).optional().describe("Optional prefix for generated Encatch payment references"),
1621
- qrLabel: z3.string().max(100).optional().describe("Label shown above the UPI QR code"),
1622
- openUpiAppLabel: z3.string().max(80).optional().describe("Label for the mobile UPI intent button"),
1623
- copyUpiIdLabel: z3.string().max(80).optional().describe("Label for the copy UPI ID button"),
1624
- transactionIdLabel: z3.string().max(100).optional().describe("Label for the self-reported transaction ID / UTR input"),
1625
- transactionIdPlaceholder: z3.string().max(120).optional().describe("Placeholder for the transaction ID / UTR input")
2054
+ transactionReferencePrefix: z4.string().max(24).optional().describe("Optional prefix for generated Encatch payment references"),
2055
+ qrLabel: z4.string().max(100).optional().describe("Label shown above the UPI QR code"),
2056
+ openUpiAppLabel: z4.string().max(80).optional().describe("Label for the mobile UPI intent button"),
2057
+ copyUpiIdLabel: z4.string().max(80).optional().describe("Label for the copy UPI ID button"),
2058
+ transactionIdLabel: z4.string().max(100).optional().describe("Label for the self-reported transaction ID / UTR input"),
2059
+ transactionIdPlaceholder: z4.string().max(120).optional().describe("Placeholder for the transaction ID / UTR input")
1626
2060
  }).describe(
1627
2061
  "Schema for a self-reported UPI payment question that renders a UPI QR/intent link and collects the respondent-entered transaction ID"
1628
2062
  );
1629
- var combinedQuestionSchema = z3.discriminatedUnion("type", [
2063
+ var combinedQuestionSchema = z4.discriminatedUnion("type", [
1630
2064
  ratingQuestionSchema,
1631
2065
  annotationQuestionSchema,
1632
2066
  welcomeQuestionSchema,
@@ -1662,215 +2096,6 @@ var combinedQuestionSchema = z3.discriminatedUnion("type", [
1662
2096
  paymentsUpiQuestionSchema
1663
2097
  ]);
1664
2098
 
1665
- // src/schemas/fields/answer-schema.ts
1666
- import { z as z4 } from "zod";
1667
- var AnnotationMarkerSchema = z4.object({
1668
- markerNo: z4.string(),
1669
- timeline: z4.string(),
1670
- comment: z4.string()
1671
- });
1672
- var AnnotationSchema = z4.object({
1673
- fileType: z4.string(),
1674
- fileName: z4.string(),
1675
- markers: z4.array(AnnotationMarkerSchema)
1676
- });
1677
- var SignatureAnswerSchema = z4.object({
1678
- mode: z4.enum(["type", "draw", "upload"]).describe("The signing method the respondent used"),
1679
- fileUrl: z4.string().optional().describe(
1680
- "Secure URL to the signature artifact for draw and upload modes"
1681
- ),
1682
- typedName: z4.string().optional().describe("The name the respondent typed for type mode")
1683
- }).describe("Answer for a signature question");
1684
- var FileUploadAnswerItemSchema = z4.object({
1685
- fileUrl: z4.string().describe("Secure URL to the uploaded file"),
1686
- fileName: z4.string().describe("Original filename as provided by the respondent"),
1687
- fileSizeMb: z4.number().describe("File size in megabytes"),
1688
- mimeType: z4.string().optional().describe(
1689
- "MIME type of the uploaded file (e.g. 'application/pdf', 'image/jpeg')"
1690
- )
1691
- }).describe("Metadata for a single uploaded file");
1692
- var FileUploadAnswerSchema = z4.array(FileUploadAnswerItemSchema).describe(
1693
- "Answer for a file upload question; array supports single and multiple file uploads"
1694
- );
1695
- var PhoneNumberAnswerSchema = z4.object({
1696
- countryCode: z4.string().describe(
1697
- "Dialing country code including the + prefix (e.g. '+1', '+91')"
1698
- ),
1699
- number: z4.string().describe("Local phone number without the country code"),
1700
- e164: z4.string().optional().describe("Full phone number in E.164 format (e.g. '+14155552671')")
1701
- }).describe("Answer for a phone number question");
1702
- var AddressAnswerSchema = z4.object({
1703
- addressLine1: z4.string().optional().describe("Primary street address line"),
1704
- addressLine2: z4.string().optional().describe("Secondary address line (apartment, suite, etc.)"),
1705
- city: z4.string().optional().describe("City or town"),
1706
- stateProvince: z4.string().optional().describe("State, region, or province"),
1707
- postalCode: z4.string().optional().describe("ZIP or postal code"),
1708
- country: z4.string().optional().describe("Country name or ISO 3166-1 alpha-2 code")
1709
- }).describe("Answer for an address question");
1710
- var VideoAudioAnswerSchema = z4.object({
1711
- mode: z4.enum(["video", "audio", "photo", "text"]).describe("The answer mode the respondent chose"),
1712
- fileUrl: z4.string().optional().describe(
1713
- "Secure URL or temporary data URL to the recorded, captured, or uploaded video, audio, or image file"
1714
- ),
1715
- text: z4.string().optional().describe("Written answer for text mode"),
1716
- durationSeconds: z4.number().optional().describe(
1717
- "Actual recording length in seconds for video and audio modes (not used for photo)"
1718
- ),
1719
- transcriptText: z4.string().optional().describe("Auto-generated transcript for video and audio recordings")
1720
- }).describe("Answer for a video and audio question");
1721
- var QnaWithAiPairSchema = z4.object({
1722
- question: z4.string().describe("The question the respondent asked"),
1723
- answer: z4.string().describe("The AI-generated answer based on the knowledge base")
1724
- }).describe("A single Q&A exchange between the respondent and the AI");
1725
- var QnaWithAiAnswerSchema = z4.array(QnaWithAiPairSchema).describe(
1726
- "Answer for a qna_with_ai question; ordered transcript of Q&A pairs from the session"
1727
- );
1728
- var SchedulerAnswerSchema = z4.discriminatedUnion("provider", [
1729
- z4.object({
1730
- provider: z4.literal("google_calendar").describe("The calendar integration used to make the booking"),
1731
- bookedAt: z4.string().describe(
1732
- "Unix timestamp in seconds as a string when the respondent confirmed the booking"
1733
- )
1734
- }),
1735
- z4.object({
1736
- provider: z4.literal("calendly").describe("The calendar integration used to make the booking"),
1737
- slotStart: z4.string().describe(
1738
- "ISO 8601 datetime of the booked slot start (e.g. '2026-05-15T14:00:00Z')"
1739
- ),
1740
- slotEnd: z4.string().describe(
1741
- "ISO 8601 datetime of the booked slot end (e.g. '2026-05-15T14:30:00Z')"
1742
- ),
1743
- eventId: z4.string().optional().describe("Calendly event UUID"),
1744
- bookedAt: z4.string().describe(
1745
- "Unix timestamp in seconds as a string when the respondent completed the booking"
1746
- )
1747
- })
1748
- ]).describe("Answer for a scheduler question");
1749
- var PaymentsUpiAnswerSchema = z4.object({
1750
- transactionId: z4.string().describe(
1751
- "Respondent-entered UPI transaction ID / UTR; self-reported and not verified by Encatch"
1752
- ),
1753
- encatchPaymentReference: z4.string().describe(
1754
- "Opaque Encatch-generated reconciliation reference included in the UPI intent"
1755
- ),
1756
- amount: z4.string().trim().refine((s) => {
1757
- const n = Number(s);
1758
- return Number.isFinite(n) && n > 0;
1759
- }, { message: "Amount must be a positive numeric value" }).describe(
1760
- "INR amount shown to the respondent when the payment instruction was generated, as a decimal string (legacy numeric values are accepted when parsing)"
1761
- ),
1762
- currency: z4.literal("INR").describe("Currency for UPI payments"),
1763
- payeeVpa: z4.string().describe("UPI VPA shown to the respondent"),
1764
- payeeName: z4.string().optional().describe("Payee display name shown to the respondent"),
1765
- sourceEmail: z4.string().optional().describe("Email address resolved from the configured source email question"),
1766
- upiIntentUri: z4.string().optional().describe("Generated UPI intent URI shown to the respondent"),
1767
- selfReported: z4.literal(true).describe(
1768
- "Always true: Encatch records this answer but does not verify the payment"
1769
- )
1770
- }).describe("Answer for a payments_upi question");
1771
- var AnswerItemSchema = z4.object({
1772
- nps: z4.number().optional().describe("Net Promoter Score value (e.g., 0-10)"),
1773
- nestedSelection: z4.array(z4.string()).optional().describe("Array of selected nested option IDs"),
1774
- longText: z4.string().optional().describe("Long text answer, e.g., paragraph or essay"),
1775
- shortAnswer: z4.string().optional().describe("Short text answer, e.g., single sentence or word"),
1776
- singleChoice: z4.string().optional().describe("Single selected option value for single choice questions"),
1777
- rating: z4.number().optional().describe("Star rating value (e.g., 1-5)"),
1778
- yesNo: z4.boolean().optional().describe("Yes/no answer for yes_no questions (true = Yes, false = No)"),
1779
- consent: z4.boolean().optional().describe(
1780
- "Consent answer for consent questions (true = checked/agreed, false = unchecked)"
1781
- ),
1782
- multipleChoiceMultiple: z4.array(z4.string()).optional().describe(
1783
- "Array of selected option values for multiple choice questions"
1784
- ),
1785
- singleChoiceOther: z4.string().optional().describe(
1786
- 'Free-text "other" answer for single choice questions when allowOther is enabled'
1787
- ),
1788
- multipleChoiceOther: z4.string().optional().describe(
1789
- 'Free-text "other" answer for multiple choice questions when allowOther is enabled'
1790
- ),
1791
- annotation: AnnotationSchema.optional().describe(
1792
- "Annotation object containing file and marker details"
1793
- ),
1794
- ratingMatrix: z4.record(z4.string(), z4.union([z4.number(), z4.string()])).optional().describe(
1795
- "Rating matrix answers keyed by statement value (export key), value is the selected scale value (number for likert/numerical, string for custom)"
1796
- ),
1797
- matrixSingleChoice: z4.record(z4.string(), z4.string()).optional().describe(
1798
- "Matrix single-choice answers keyed by row value (export key), map value is the selected column option value"
1799
- ),
1800
- matrixMultipleChoice: z4.record(z4.string(), z4.array(z4.string())).optional().describe(
1801
- "Matrix multiple-choice answers keyed by row value (export key), map value is array of selected column option values"
1802
- ),
1803
- others: z4.string().optional().describe(
1804
- "For multiple choice questions and single choice questions, this is the value of the other option"
1805
- ),
1806
- // Date question
1807
- date: z4.string().optional().describe(
1808
- "Answer for a date question; ISO 8601 format (YYYY-MM-DD or YYYY-MM-DDTHH:MM)"
1809
- ),
1810
- // CSAT question
1811
- csat: z4.number().optional().describe(
1812
- "Answer for a CSAT question; industry-standard value: 1 (lowest/worst) to N (highest/best) where N is the scale size (2\u20135)"
1813
- ),
1814
- // Opinion scale question
1815
- opinionScale: z4.number().optional().describe(
1816
- "Answer for an opinion scale question; the selected numeric value on the scale"
1817
- ),
1818
- // Ranking question — ordered array of option values; index 0 = rank 1
1819
- ranking: z4.array(z4.string()).optional().describe(
1820
- "Answer for a ranking question; ordered array of option values where index 0 is rank 1"
1821
- ),
1822
- // Picture choice — always an array of selected option values (single selection = one-element array)
1823
- pictureChoice: z4.array(z4.string()).optional().describe(
1824
- "Answer for a picture choice question; array of selected option values (single selection produces a one-element array)"
1825
- ),
1826
- pictureChoiceOther: z4.string().optional().describe(
1827
- 'Free-text "other" answer for picture choice questions when allowOther is enabled'
1828
- ),
1829
- // Signature question
1830
- signature: SignatureAnswerSchema.optional().describe(
1831
- "Answer for a signature question"
1832
- ),
1833
- // File upload question
1834
- fileUpload: FileUploadAnswerSchema.optional().describe(
1835
- "Answer for a file upload question; array supports single and multiple file uploads"
1836
- ),
1837
- // Email question
1838
- email: z4.string().optional().describe("Answer for an email question; the submitted email address"),
1839
- // Number question
1840
- number: z4.string().optional().describe(
1841
- "Answer for a number question; the submitted numeric value as a string"
1842
- ),
1843
- // Website question
1844
- website: z4.string().optional().describe("Answer for a website question; the submitted URL"),
1845
- // Phone number question
1846
- phoneNumber: PhoneNumberAnswerSchema.optional().describe(
1847
- "Answer for a phone number question"
1848
- ),
1849
- // Address question
1850
- address: AddressAnswerSchema.optional().describe(
1851
- "Answer for an address question"
1852
- ),
1853
- // Video and audio question
1854
- videoAudio: VideoAudioAnswerSchema.optional().describe(
1855
- "Answer for a video and audio question"
1856
- ),
1857
- // Scheduler question
1858
- scheduler: SchedulerAnswerSchema.optional().describe(
1859
- "Answer for a scheduler question"
1860
- ),
1861
- // Q&A with AI question
1862
- qnaWithAi: QnaWithAiAnswerSchema.optional().describe(
1863
- "Answer for a qna_with_ai question; ordered transcript of Q&A pairs from the session"
1864
- ),
1865
- // Payments UPI question
1866
- paymentsUpi: PaymentsUpiAnswerSchema.optional().describe(
1867
- "Answer for a payments_upi question; self-reported UPI transaction reference"
1868
- )
1869
- }).describe(
1870
- "Flexible answer item supporting various question types and custom fields"
1871
- );
1872
- var AnswerSchema = AnswerItemSchema;
1873
-
1874
2099
  // src/schemas/fields/form-schema.ts
1875
2100
  import { z as z5 } from "zod";
1876
2101
  var externalPublishingPropertiesSchema = z5.object({
@@ -1970,6 +2195,14 @@ var PreviousButtonModes = {
1970
2195
  ALWAYS: "always",
1971
2196
  AUTO: "auto"
1972
2197
  };
2198
+ var inAppDisplayTypeSchema = z7.enum(["auto", "modal", "selector"]).describe(
2199
+ "How the form is presented on in-app surfaces: auto (#encatch host or modal), modal (always modal), or selector (render into inAppSelector)"
2200
+ );
2201
+ var InAppDisplayTypes = {
2202
+ AUTO: "auto",
2203
+ MODAL: "modal",
2204
+ SELECTOR: "selector"
2205
+ };
1973
2206
  var logoPlacementSchema = z7.enum(["top-left", "top-center", "top-right"]).describe("Where the logo is anchored in the form header");
1974
2207
  var logoSizeSchema = z7.enum(["small", "medium", "large"]).describe("Rendered display size of the logo within the 96\xD740 px container");
1975
2208
  var logoSurfaceOverrideSchema = z7.object({
@@ -2011,6 +2244,10 @@ var featureSettingsSchema = z7.object({
2011
2244
  rtl: z7.boolean().default(false).describe("Whether right-to-left text direction is enabled"),
2012
2245
  previousButton: previousButtonModeSchema.default(PreviousButtonModes.ALWAYS).describe("Previous button: never (hidden) or always (shown)"),
2013
2246
  maxDialogHeightPercentInApp: z7.number().int().min(10).max(100).optional().describe("Maximum height of the in-app dialog as a percentage of the viewport height (10\u2013100); when absent the dialog uses its default height"),
2247
+ inAppDisplayType: inAppDisplayTypeSchema.default(InAppDisplayTypes.AUTO).describe(
2248
+ "How the form is presented on in-app surfaces: auto (#encatch host or modal), modal (always modal), or selector (render into inAppSelector)"
2249
+ ),
2250
+ inAppSelector: z7.string().optional().describe("CSS selector for the host element to render the form into when inAppDisplayType is 'selector'; if it matches nothing the form falls back to the modal"),
2014
2251
  faviconUrl: z7.string().optional().describe("URL of a custom favicon image to display in the browser tab; when absent the platform default favicon is used"),
2015
2252
  logo: logoSchema.optional().describe("Optional form-level logo shown in the header on link/shareable surfaces; omit to show no logo")
2016
2253
  }).describe("Feature settings controlling widget UI behavior and appearance");
@@ -2336,8 +2573,10 @@ var formConfigSchema = z13.object({
2336
2573
  }).describe("Configuration information for the feedback form");
2337
2574
  var questionResponseSchema = z13.object({
2338
2575
  questionId: z13.string().uuid().describe("Unique identifier for the question"),
2339
- answer: AnswerSchema.describe("The answer provided for this question"),
2340
- type: z13.string().describe("Type of the question (e.g., 'rating', 'single_choice')"),
2576
+ answer: AnswerSchema.nullable().optional().describe(
2577
+ "The answer provided for this question; null for display-only types (thank_you, welcome, exit_form) or unanswered questions on the respondent's path"
2578
+ ),
2579
+ type: z13.string().optional().describe("Type of the question (e.g., 'rating', 'single_choice')"),
2341
2580
  error: z13.string().optional().describe("Error message if any validation failed"),
2342
2581
  isOnPath: z13.boolean().optional().describe(
2343
2582
  "When present, whether this question was on the respondent's navigation path (e.g. logic jumps); false for questions not reached"
@@ -2380,6 +2619,26 @@ var submitFeedbackSchema = baseSubmitFeedbackSchema.extend({
2380
2619
  response: responseSchema.describe("User responses (required for full submit)")
2381
2620
  }).describe("Full submit feedback request schema (response required)");
2382
2621
  var feedbackRequestSchema = z13.union([partialFeedbackSchema, submitFeedbackSchema]).describe("Union schema for both partial and full feedback submissions");
2622
+ var formDetailsSchema = z13.object({
2623
+ formConfigurationId: z13.string().uuid().describe("Server-issued configuration ID for this form"),
2624
+ feedbackIdentifier: z13.string().optional().describe("Instance identifier for the feedback session"),
2625
+ responseLanguageCode: z13.string().optional().describe("Two-letter language code for the response (e.g., 'en')"),
2626
+ isPartialSubmit: z13.boolean().optional().describe("When true, marks this as a partial (mid-journey) submission"),
2627
+ completionTimeInSeconds: z13.number().int().min(0).optional().describe("Total time taken to complete the form in seconds"),
2628
+ response: z13.object({
2629
+ questions: z13.array(questionResponseSchema).optional().describe("Array of per-question responses"),
2630
+ context: z13.record(z13.string(), z13.unknown()).optional().describe("Liquid variable substitution values from the showForm context option"),
2631
+ contact: z13.record(z13.string(), z13.unknown()).optional().describe("Contact properties from the server for Liquid substitution"),
2632
+ sourceTrackingFieldValues: z13.record(z13.string(), z13.string()).optional().describe("Source tracking field values captured at survey load time")
2633
+ }).optional().describe("User responses to the form questions"),
2634
+ visitedQuestionIds: z13.array(z13.string()).optional().describe("Ordered list of question IDs the respondent actually navigated to"),
2635
+ context: z13.record(z13.string(), z13.union([z13.string(), z13.number(), z13.boolean()])).optional().describe("Caller-provided metadata attached to this submission")
2636
+ }).describe("Form details for an SDK-style submit-form request");
2637
+ var submitFormRequestSchema = z13.object({
2638
+ triggerType: z13.enum(["automatic", "manual"]).optional().describe("Whether the form was triggered automatically or manually"),
2639
+ formDetails: formDetailsSchema.describe("Core submission payload"),
2640
+ $deviceInfo: z13.record(z13.string(), z13.unknown()).optional().describe("Device and SDK metadata automatically injected by the SDK")
2641
+ }).describe("Complete submit-form request envelope (SDK-facing contract)");
2383
2642
 
2384
2643
  // src/schemas/api/fetch-feedback-schema.ts
2385
2644
  import { z as z14 } from "zod";
@@ -2630,6 +2889,9 @@ export {
2630
2889
  AnnotationSchema,
2631
2890
  AnswerItemSchema,
2632
2891
  AnswerSchema,
2892
+ CSAT_DEFAULT_EMOJIS_BY_SCALE,
2893
+ CSAT_EMOJI_CATEGORIES,
2894
+ CSAT_EMOJI_PALETTE,
2633
2895
  ChoiceOrderOptions,
2634
2896
  CsatDisplayStyles,
2635
2897
  CsatScales,
@@ -2639,6 +2901,7 @@ export {
2639
2901
  DeviceThemes,
2640
2902
  FileUploadAnswerItemSchema,
2641
2903
  FileUploadAnswerSchema,
2904
+ InAppDisplayTypes,
2642
2905
  LanguageFieldSchema,
2643
2906
  LanguagesSchema,
2644
2907
  LayoutAttachmentTypes,
@@ -2724,9 +2987,14 @@ export {
2724
2987
  focalPointSchema,
2725
2988
  formConfigSchema,
2726
2989
  formConfigurationResponseSchema,
2990
+ formDetailsSchema,
2727
2991
  formPropertiesSchema,
2992
+ getCsatEmojiForPoint,
2993
+ getDefaultOverrideEmojiForScale,
2728
2994
  gradientAttachmentSchema,
2729
2995
  imageAttachmentSchema,
2996
+ inAppDisplayTypeSchema,
2997
+ isCsatEmojiPaletteItem,
2730
2998
  layoutAttachmentSchema,
2731
2999
  layoutSurfaceSchema,
2732
3000
  logicJumpRuleSchema,
@@ -2759,6 +3027,7 @@ export {
2759
3027
  objectToSnake,
2760
3028
  opinionScaleQuestionSchema,
2761
3029
  otherConfigurationPropertiesSchema,
3030
+ parseOverrideEmoji,
2762
3031
  partialFeedbackSchema,
2763
3032
  paymentsUpiAmountConfigSchema,
2764
3033
  paymentsUpiQuestionSchema,
@@ -2795,6 +3064,7 @@ export {
2795
3064
  refineTextDataSchema,
2796
3065
  refineTextParamsSchema,
2797
3066
  refineTextResponseSchema,
3067
+ resolveCsatEmojis,
2798
3068
  responseSchema,
2799
3069
  schedulerProviderSchema,
2800
3070
  schedulerQuestionSchema,
@@ -2804,6 +3074,7 @@ export {
2804
3074
  sectionSchema,
2805
3075
  sectionTranslationSchema,
2806
3076
  sectionTranslationsByLanguageSchema,
3077
+ serializeOverrideEmoji,
2807
3078
  sessionInfoSchema,
2808
3079
  shareableModeSchema,
2809
3080
  shortAnswerQuestionSchema,
@@ -2815,6 +3086,7 @@ export {
2815
3086
  splitLayoutSchema,
2816
3087
  stackLayoutSchema,
2817
3088
  submitFeedbackSchema,
3089
+ submitFormRequestSchema,
2818
3090
  thankYouQuestionSchema,
2819
3091
  thankYouQuestionTranslationSchema,
2820
3092
  themeColorsSchema,
@@ -2827,8 +3099,10 @@ export {
2827
3099
  translationEntrySchema,
2828
3100
  translationsSchema,
2829
3101
  triggerActionSchema,
3102
+ trimOverrideEmojiForScale,
2830
3103
  userInfoSchema,
2831
3104
  userPropertiesSchema,
3105
+ validateOverrideEmojiForScale,
2832
3106
  validationRuleSchema,
2833
3107
  validationRuleTypeSchema,
2834
3108
  videoAttachmentSchema,