@encatch/schema 1.3.0-beta.3 → 1.3.0-beta.5
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 +621 -572
- package/dist/esm/index.js.map +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/internal/type-assert.d.ts +19 -0
- package/dist/types/schemas/api/fetch-feedback-schema.d.ts +90 -72
- package/dist/types/schemas/api/submit-feedback-schema.d.ts +314 -25
- package/dist/types/schemas/fields/answer-schema.d.ts +121 -17
- package/dist/types/schemas/fields/app-props-schema.d.ts +45 -36
- package/dist/types/schemas/fields/field-schema.d.ts +103 -85
- package/dist/types/schemas/fields/form-properties-schema.d.ts +45 -36
- package/dist/types/schemas/fields/translations-example.d.ts +10 -0
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -2,7 +2,7 @@ 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
|
|
5
|
+
import { z as z4 } from "zod";
|
|
6
6
|
|
|
7
7
|
// src/schemas/fields/translations-schema.ts
|
|
8
8
|
import { z } from "zod";
|
|
@@ -438,8 +438,217 @@ var completionCtaSchema = z2.object({
|
|
|
438
438
|
"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
439
|
);
|
|
440
440
|
|
|
441
|
+
// src/schemas/fields/answer-schema.ts
|
|
442
|
+
import { z as z3 } from "zod";
|
|
443
|
+
var AnnotationMarkerSchema = z3.object({
|
|
444
|
+
markerNo: z3.string(),
|
|
445
|
+
timeline: z3.string(),
|
|
446
|
+
comment: z3.string()
|
|
447
|
+
});
|
|
448
|
+
var AnnotationSchema = z3.object({
|
|
449
|
+
fileType: z3.string(),
|
|
450
|
+
fileName: z3.string(),
|
|
451
|
+
markers: z3.array(AnnotationMarkerSchema)
|
|
452
|
+
});
|
|
453
|
+
var SignatureAnswerSchema = z3.object({
|
|
454
|
+
mode: z3.enum(["type", "draw", "upload"]).describe("The signing method the respondent used"),
|
|
455
|
+
fileUrl: z3.string().optional().describe(
|
|
456
|
+
"Secure URL to the signature artifact for draw and upload modes"
|
|
457
|
+
),
|
|
458
|
+
typedName: z3.string().optional().describe("The name the respondent typed for type mode")
|
|
459
|
+
}).describe("Answer for a signature question");
|
|
460
|
+
var FileUploadAnswerItemSchema = z3.object({
|
|
461
|
+
fileUrl: z3.string().describe("Secure URL to the uploaded file"),
|
|
462
|
+
fileName: z3.string().describe("Original filename as provided by the respondent"),
|
|
463
|
+
fileSizeMb: z3.number().describe("File size in megabytes"),
|
|
464
|
+
mimeType: z3.string().optional().describe(
|
|
465
|
+
"MIME type of the uploaded file (e.g. 'application/pdf', 'image/jpeg')"
|
|
466
|
+
)
|
|
467
|
+
}).describe("Metadata for a single uploaded file");
|
|
468
|
+
var FileUploadAnswerSchema = z3.array(FileUploadAnswerItemSchema).describe(
|
|
469
|
+
"Answer for a file upload question; array supports single and multiple file uploads"
|
|
470
|
+
);
|
|
471
|
+
var PhoneNumberAnswerSchema = z3.object({
|
|
472
|
+
countryCode: z3.string().describe(
|
|
473
|
+
"Dialing country code including the + prefix (e.g. '+1', '+91')"
|
|
474
|
+
),
|
|
475
|
+
number: z3.string().describe("Local phone number without the country code"),
|
|
476
|
+
e164: z3.string().optional().describe("Full phone number in E.164 format (e.g. '+14155552671')")
|
|
477
|
+
}).describe("Answer for a phone number question");
|
|
478
|
+
var AddressAnswerSchema = z3.object({
|
|
479
|
+
addressLine1: z3.string().optional().describe("Primary street address line"),
|
|
480
|
+
addressLine2: z3.string().optional().describe("Secondary address line (apartment, suite, etc.)"),
|
|
481
|
+
city: z3.string().optional().describe("City or town"),
|
|
482
|
+
stateProvince: z3.string().optional().describe("State, region, or province"),
|
|
483
|
+
postalCode: z3.string().optional().describe("ZIP or postal code"),
|
|
484
|
+
country: z3.string().optional().describe("Country name or ISO 3166-1 alpha-2 code")
|
|
485
|
+
}).describe("Answer for an address question");
|
|
486
|
+
var VideoAudioAnswerSchema = z3.object({
|
|
487
|
+
mode: z3.enum(["video", "audio", "photo", "text"]).describe("The answer mode the respondent chose"),
|
|
488
|
+
fileUrl: z3.string().optional().describe(
|
|
489
|
+
"Secure URL or temporary data URL to the recorded, captured, or uploaded video, audio, or image file"
|
|
490
|
+
),
|
|
491
|
+
text: z3.string().optional().describe("Written answer for text mode"),
|
|
492
|
+
durationSeconds: z3.number().optional().describe(
|
|
493
|
+
"Actual recording length in seconds for video and audio modes (not used for photo)"
|
|
494
|
+
),
|
|
495
|
+
transcriptText: z3.string().optional().describe("Auto-generated transcript for video and audio recordings")
|
|
496
|
+
}).describe("Answer for a video and audio question");
|
|
497
|
+
var QnaWithAiPairSchema = z3.object({
|
|
498
|
+
question: z3.string().describe("The question the respondent asked"),
|
|
499
|
+
answer: z3.string().describe("The AI-generated answer based on the knowledge base")
|
|
500
|
+
}).describe("A single Q&A exchange between the respondent and the AI");
|
|
501
|
+
var QnaWithAiAnswerSchema = z3.array(QnaWithAiPairSchema).describe(
|
|
502
|
+
"Answer for a qna_with_ai question; ordered transcript of Q&A pairs from the session"
|
|
503
|
+
);
|
|
504
|
+
var SchedulerAnswerSchema = z3.discriminatedUnion("provider", [
|
|
505
|
+
z3.object({
|
|
506
|
+
provider: z3.literal("google_calendar").describe("The calendar integration used to make the booking"),
|
|
507
|
+
bookedAt: z3.string().describe(
|
|
508
|
+
"Unix timestamp in seconds as a string when the respondent confirmed the booking"
|
|
509
|
+
)
|
|
510
|
+
}),
|
|
511
|
+
z3.object({
|
|
512
|
+
provider: z3.literal("calendly").describe("The calendar integration used to make the booking"),
|
|
513
|
+
slotStart: z3.string().describe(
|
|
514
|
+
"ISO 8601 datetime of the booked slot start (e.g. '2026-05-15T14:00:00Z')"
|
|
515
|
+
),
|
|
516
|
+
slotEnd: z3.string().describe(
|
|
517
|
+
"ISO 8601 datetime of the booked slot end (e.g. '2026-05-15T14:30:00Z')"
|
|
518
|
+
),
|
|
519
|
+
eventId: z3.string().optional().describe("Calendly event UUID"),
|
|
520
|
+
bookedAt: z3.string().describe(
|
|
521
|
+
"Unix timestamp in seconds as a string when the respondent completed the booking"
|
|
522
|
+
)
|
|
523
|
+
})
|
|
524
|
+
]).describe("Answer for a scheduler question");
|
|
525
|
+
var PaymentsUpiAnswerSchema = z3.object({
|
|
526
|
+
transactionId: z3.string().describe(
|
|
527
|
+
"Respondent-entered UPI transaction ID / UTR; self-reported and not verified by Encatch"
|
|
528
|
+
),
|
|
529
|
+
encatchPaymentReference: z3.string().describe(
|
|
530
|
+
"Opaque Encatch-generated reconciliation reference included in the UPI intent"
|
|
531
|
+
),
|
|
532
|
+
amount: z3.string().trim().refine((s) => {
|
|
533
|
+
const n = Number(s);
|
|
534
|
+
return Number.isFinite(n) && n > 0;
|
|
535
|
+
}, { message: "Amount must be a positive numeric value" }).describe(
|
|
536
|
+
"INR amount shown to the respondent when the payment instruction was generated, as a decimal string (legacy numeric values are accepted when parsing)"
|
|
537
|
+
),
|
|
538
|
+
currency: z3.literal("INR").describe("Currency for UPI payments"),
|
|
539
|
+
payeeVpa: z3.string().describe("UPI VPA shown to the respondent"),
|
|
540
|
+
payeeName: z3.string().optional().describe("Payee display name shown to the respondent"),
|
|
541
|
+
sourceEmail: z3.string().optional().describe("Email address resolved from the configured source email question"),
|
|
542
|
+
upiIntentUri: z3.string().optional().describe("Generated UPI intent URI shown to the respondent"),
|
|
543
|
+
selfReported: z3.literal(true).describe(
|
|
544
|
+
"Always true: Encatch records this answer but does not verify the payment"
|
|
545
|
+
)
|
|
546
|
+
}).describe("Answer for a payments_upi question");
|
|
547
|
+
var AnswerItemSchema = z3.object({
|
|
548
|
+
nps: z3.number().optional().describe("Net Promoter Score value (e.g., 0-10)"),
|
|
549
|
+
nestedSelection: z3.array(z3.string()).optional().describe("Array of selected nested option IDs"),
|
|
550
|
+
longText: z3.string().optional().describe("Long text answer, e.g., paragraph or essay"),
|
|
551
|
+
shortAnswer: z3.string().optional().describe("Short text answer, e.g., single sentence or word"),
|
|
552
|
+
singleChoice: z3.string().optional().describe("Single selected option value for single choice questions"),
|
|
553
|
+
rating: z3.number().optional().describe("Star rating value (e.g., 1-5)"),
|
|
554
|
+
yesNo: z3.boolean().optional().describe("Yes/no answer for yes_no questions (true = Yes, false = No)"),
|
|
555
|
+
consent: z3.boolean().optional().describe(
|
|
556
|
+
"Consent answer for consent questions (true = checked/agreed, false = unchecked)"
|
|
557
|
+
),
|
|
558
|
+
multipleChoiceMultiple: z3.array(z3.string()).optional().describe(
|
|
559
|
+
"Array of selected option values for multiple choice questions"
|
|
560
|
+
),
|
|
561
|
+
singleChoiceOther: z3.string().optional().describe(
|
|
562
|
+
'Free-text "other" answer for single choice questions when allowOther is enabled'
|
|
563
|
+
),
|
|
564
|
+
multipleChoiceOther: z3.string().optional().describe(
|
|
565
|
+
'Free-text "other" answer for multiple choice questions when allowOther is enabled'
|
|
566
|
+
),
|
|
567
|
+
annotation: AnnotationSchema.optional().describe(
|
|
568
|
+
"Annotation object containing file and marker details"
|
|
569
|
+
),
|
|
570
|
+
ratingMatrix: z3.record(z3.string(), z3.union([z3.number(), z3.string()])).optional().describe(
|
|
571
|
+
"Rating matrix answers keyed by statement value (export key), value is the selected scale value (number for likert/numerical, string for custom)"
|
|
572
|
+
),
|
|
573
|
+
matrixSingleChoice: z3.record(z3.string(), z3.string()).optional().describe(
|
|
574
|
+
"Matrix single-choice answers keyed by row value (export key), map value is the selected column option value"
|
|
575
|
+
),
|
|
576
|
+
matrixMultipleChoice: z3.record(z3.string(), z3.array(z3.string())).optional().describe(
|
|
577
|
+
"Matrix multiple-choice answers keyed by row value (export key), map value is array of selected column option values"
|
|
578
|
+
),
|
|
579
|
+
others: z3.string().optional().describe(
|
|
580
|
+
"For multiple choice questions and single choice questions, this is the value of the other option"
|
|
581
|
+
),
|
|
582
|
+
// Date question
|
|
583
|
+
date: z3.string().optional().describe(
|
|
584
|
+
"Answer for a date question; ISO 8601 format (YYYY-MM-DD or YYYY-MM-DDTHH:MM)"
|
|
585
|
+
),
|
|
586
|
+
// CSAT question
|
|
587
|
+
csat: z3.number().optional().describe(
|
|
588
|
+
"Answer for a CSAT question; industry-standard value: 1 (lowest/worst) to N (highest/best) where N is the scale size (2\u20135)"
|
|
589
|
+
),
|
|
590
|
+
// Opinion scale question
|
|
591
|
+
opinionScale: z3.number().optional().describe(
|
|
592
|
+
"Answer for an opinion scale question; the selected numeric value on the scale"
|
|
593
|
+
),
|
|
594
|
+
// Ranking question — ordered array of option values; index 0 = rank 1
|
|
595
|
+
ranking: z3.array(z3.string()).optional().describe(
|
|
596
|
+
"Answer for a ranking question; ordered array of option values where index 0 is rank 1"
|
|
597
|
+
),
|
|
598
|
+
// Picture choice — always an array of selected option values (single selection = one-element array)
|
|
599
|
+
pictureChoice: z3.array(z3.string()).optional().describe(
|
|
600
|
+
"Answer for a picture choice question; array of selected option values (single selection produces a one-element array)"
|
|
601
|
+
),
|
|
602
|
+
pictureChoiceOther: z3.string().optional().describe(
|
|
603
|
+
'Free-text "other" answer for picture choice questions when allowOther is enabled'
|
|
604
|
+
),
|
|
605
|
+
// Signature question
|
|
606
|
+
signature: SignatureAnswerSchema.optional().describe(
|
|
607
|
+
"Answer for a signature question"
|
|
608
|
+
),
|
|
609
|
+
// File upload question
|
|
610
|
+
fileUpload: FileUploadAnswerSchema.optional().describe(
|
|
611
|
+
"Answer for a file upload question; array supports single and multiple file uploads"
|
|
612
|
+
),
|
|
613
|
+
// Email question
|
|
614
|
+
email: z3.string().optional().describe("Answer for an email question; the submitted email address"),
|
|
615
|
+
// Number question
|
|
616
|
+
number: z3.string().optional().describe(
|
|
617
|
+
"Answer for a number question; the submitted numeric value as a string"
|
|
618
|
+
),
|
|
619
|
+
// Website question
|
|
620
|
+
website: z3.string().optional().describe("Answer for a website question; the submitted URL"),
|
|
621
|
+
// Phone number question
|
|
622
|
+
phoneNumber: PhoneNumberAnswerSchema.optional().describe(
|
|
623
|
+
"Answer for a phone number question"
|
|
624
|
+
),
|
|
625
|
+
// Address question
|
|
626
|
+
address: AddressAnswerSchema.optional().describe(
|
|
627
|
+
"Answer for an address question"
|
|
628
|
+
),
|
|
629
|
+
// Video and audio question
|
|
630
|
+
videoAudio: VideoAudioAnswerSchema.optional().describe(
|
|
631
|
+
"Answer for a video and audio question"
|
|
632
|
+
),
|
|
633
|
+
// Scheduler question
|
|
634
|
+
scheduler: SchedulerAnswerSchema.optional().describe(
|
|
635
|
+
"Answer for a scheduler question"
|
|
636
|
+
),
|
|
637
|
+
// Q&A with AI question
|
|
638
|
+
qnaWithAi: QnaWithAiAnswerSchema.optional().describe(
|
|
639
|
+
"Answer for a qna_with_ai question; ordered transcript of Q&A pairs from the session"
|
|
640
|
+
),
|
|
641
|
+
// Payments UPI question
|
|
642
|
+
paymentsUpi: PaymentsUpiAnswerSchema.optional().describe(
|
|
643
|
+
"Answer for a payments_upi question; self-reported UPI transaction reference"
|
|
644
|
+
)
|
|
645
|
+
}).describe(
|
|
646
|
+
"Flexible answer item supporting various question types and custom fields"
|
|
647
|
+
);
|
|
648
|
+
var AnswerSchema = AnswerItemSchema;
|
|
649
|
+
|
|
441
650
|
// src/schemas/fields/field-schema.ts
|
|
442
|
-
var questionTypeSchema =
|
|
651
|
+
var questionTypeSchema = z4.enum([
|
|
443
652
|
"rating",
|
|
444
653
|
"single_choice",
|
|
445
654
|
"nps",
|
|
@@ -509,7 +718,7 @@ var QuestionTypes = {
|
|
|
509
718
|
QNA_WITH_AI: "qna_with_ai",
|
|
510
719
|
PAYMENTS_UPI: "payments_upi"
|
|
511
720
|
};
|
|
512
|
-
var validationRuleTypeSchema =
|
|
721
|
+
var validationRuleTypeSchema = z4.enum([
|
|
513
722
|
"required",
|
|
514
723
|
"min",
|
|
515
724
|
"max",
|
|
@@ -531,13 +740,13 @@ var ValidationRuleTypes = {
|
|
|
531
740
|
URL: "url",
|
|
532
741
|
CUSTOM: "custom"
|
|
533
742
|
};
|
|
534
|
-
var validationRuleSchema =
|
|
743
|
+
var validationRuleSchema = z4.object({
|
|
535
744
|
type: validationRuleTypeSchema.describe("Type of validation rule to apply"),
|
|
536
|
-
value:
|
|
537
|
-
message:
|
|
538
|
-
describe:
|
|
745
|
+
value: z4.union([z4.string(), z4.number(), z4.boolean()]).optional().describe("Value for the validation rule (string, number, or boolean)"),
|
|
746
|
+
message: z4.string().optional().describe("Custom error message when validation fails"),
|
|
747
|
+
describe: z4.string().max(500).optional().describe("LLM tool call description for this validation rule")
|
|
539
748
|
}).describe("Schema defining validation rules for question responses");
|
|
540
|
-
var visibilityConditionOperatorSchema =
|
|
749
|
+
var visibilityConditionOperatorSchema = z4.enum([
|
|
541
750
|
"equals",
|
|
542
751
|
"not_equals",
|
|
543
752
|
"contains",
|
|
@@ -557,44 +766,44 @@ var VisibilityConditionOperators = {
|
|
|
557
766
|
IS_EMPTY: "is_empty",
|
|
558
767
|
IS_NOT_EMPTY: "is_not_empty"
|
|
559
768
|
};
|
|
560
|
-
var visibilityConditionSchema =
|
|
561
|
-
field:
|
|
769
|
+
var visibilityConditionSchema = z4.object({
|
|
770
|
+
field: z4.string().describe("ID of the field to check against"),
|
|
562
771
|
operator: visibilityConditionOperatorSchema.describe(
|
|
563
772
|
"Comparison operator for the condition"
|
|
564
773
|
),
|
|
565
|
-
value:
|
|
566
|
-
describe:
|
|
774
|
+
value: z4.union([z4.string(), z4.number(), z4.boolean()]).optional().describe("Value to compare against (string, number, or boolean)"),
|
|
775
|
+
describe: z4.string().max(500).optional().describe("LLM tool call description for this visibility condition")
|
|
567
776
|
}).describe(
|
|
568
777
|
"Schema defining conditions that control when questions are visible"
|
|
569
778
|
);
|
|
570
|
-
var sectionSchema =
|
|
571
|
-
id:
|
|
572
|
-
title:
|
|
573
|
-
description:
|
|
574
|
-
showTitle:
|
|
575
|
-
showDescription:
|
|
576
|
-
nextButtonLabel:
|
|
779
|
+
var sectionSchema = z4.object({
|
|
780
|
+
id: z4.string().describe("Unique identifier for the section"),
|
|
781
|
+
title: z4.string().min(1).max(200).describe("Display title for the section"),
|
|
782
|
+
description: z4.string().max(1e3).optional().describe("Optional detailed description or help text for the section"),
|
|
783
|
+
showTitle: z4.boolean().default(true).describe("Whether to show the section title in the UI"),
|
|
784
|
+
showDescription: z4.boolean().default(true).describe("Whether to show the section description in the UI"),
|
|
785
|
+
nextButtonLabel: z4.string().min(1).max(50).optional().describe("Label for the next button when navigating from this section"),
|
|
577
786
|
translations: sectionTranslationsByLanguageSchema.optional().describe(
|
|
578
787
|
"Per-language section copy (title, optional description and nextButtonLabel), keyed by language code"
|
|
579
788
|
),
|
|
580
|
-
inAppSingleQuestion:
|
|
789
|
+
inAppSingleQuestion: z4.boolean().default(false).describe(
|
|
581
790
|
"When true, the native app shows one question at a time within this section"
|
|
582
791
|
),
|
|
583
|
-
isPreviousAllowed:
|
|
792
|
+
isPreviousAllowed: z4.boolean().default(false).optional().describe(
|
|
584
793
|
"When the global previousButton mode is 'auto', controls whether the Previous button is shown for this section. Defaults to false (hidden)."
|
|
585
794
|
),
|
|
586
|
-
questionIds:
|
|
795
|
+
questionIds: z4.array(z4.string()).min(1).describe("Array of question IDs that belong to this section")
|
|
587
796
|
}).describe(
|
|
588
797
|
"Schema defining sections that organize questions into logical groups"
|
|
589
798
|
);
|
|
590
|
-
var questionStatusSchema =
|
|
799
|
+
var questionStatusSchema = z4.enum(["D", "P", "A", "S"]);
|
|
591
800
|
var QuestionStatuses = {
|
|
592
801
|
DRAFT: "D",
|
|
593
802
|
PUBLISHED: "P",
|
|
594
803
|
ARCHIVED: "A",
|
|
595
804
|
SUSPENDED: "S"
|
|
596
805
|
};
|
|
597
|
-
var ratingDisplayStyleSchema =
|
|
806
|
+
var ratingDisplayStyleSchema = z4.enum([
|
|
598
807
|
"star",
|
|
599
808
|
"heart",
|
|
600
809
|
"thumbs-up",
|
|
@@ -610,7 +819,7 @@ var RatingDisplayStyles = {
|
|
|
610
819
|
EMOJI: "emoji",
|
|
611
820
|
EMOJI_EXP: "emoji_exp"
|
|
612
821
|
};
|
|
613
|
-
var ratingRepresentationSizeSchema =
|
|
822
|
+
var ratingRepresentationSizeSchema = z4.enum([
|
|
614
823
|
"small",
|
|
615
824
|
"medium",
|
|
616
825
|
"large"
|
|
@@ -620,7 +829,7 @@ var RatingRepresentationSizes = {
|
|
|
620
829
|
MEDIUM: "medium",
|
|
621
830
|
LARGE: "large"
|
|
622
831
|
};
|
|
623
|
-
var multipleChoiceDisplayStyleSchema =
|
|
832
|
+
var multipleChoiceDisplayStyleSchema = z4.enum([
|
|
624
833
|
"radio",
|
|
625
834
|
"list",
|
|
626
835
|
"chip",
|
|
@@ -634,7 +843,7 @@ var MultipleChoiceDisplayStyles = {
|
|
|
634
843
|
DROPDOWN: "dropdown",
|
|
635
844
|
AUTOSUGGEST: "autosuggest"
|
|
636
845
|
};
|
|
637
|
-
var multipleChoiceMultipleDisplayStyleSchema =
|
|
846
|
+
var multipleChoiceMultipleDisplayStyleSchema = z4.enum([
|
|
638
847
|
"checkbox",
|
|
639
848
|
"list",
|
|
640
849
|
"chip",
|
|
@@ -646,12 +855,12 @@ var MultipleChoiceMultipleDisplayStyles = {
|
|
|
646
855
|
CHIP: "chip",
|
|
647
856
|
AUTOSUGGEST: "autosuggest"
|
|
648
857
|
};
|
|
649
|
-
var yesNoDisplayStyleSchema =
|
|
858
|
+
var yesNoDisplayStyleSchema = z4.enum(["horizontal", "vertical"]);
|
|
650
859
|
var YesNoDisplayStyles = {
|
|
651
860
|
HORIZONTAL: "horizontal",
|
|
652
861
|
VERTICAL: "vertical"
|
|
653
862
|
};
|
|
654
|
-
var choiceOrderOptionSchema =
|
|
863
|
+
var choiceOrderOptionSchema = z4.enum([
|
|
655
864
|
"randomize",
|
|
656
865
|
"flip",
|
|
657
866
|
"rotate",
|
|
@@ -665,74 +874,74 @@ var ChoiceOrderOptions = {
|
|
|
665
874
|
ASCENDING: "ascending",
|
|
666
875
|
NONE: "none"
|
|
667
876
|
};
|
|
668
|
-
var questionSchema =
|
|
669
|
-
id:
|
|
670
|
-
slug:
|
|
877
|
+
var questionSchema = z4.object({
|
|
878
|
+
id: z4.string().describe("Unique identifier for the question"),
|
|
879
|
+
slug: z4.string().min(1).max(128).optional().describe(
|
|
671
880
|
"Optional stable identifier for the question (e.g. URLs, analytics, or integrations)"
|
|
672
881
|
),
|
|
673
882
|
type: questionTypeSchema.describe(
|
|
674
883
|
"The type of question (rating, single_choice, etc.)"
|
|
675
884
|
),
|
|
676
|
-
title:
|
|
677
|
-
description:
|
|
678
|
-
describe:
|
|
885
|
+
title: z4.string().min(1).max(200).describe("The main title/question text displayed to users"),
|
|
886
|
+
description: z4.string().max(1e3).optional().describe("Optional detailed description or help text"),
|
|
887
|
+
describe: z4.string().max(2e3).optional().describe(
|
|
679
888
|
"LLM tool call description for better AI understanding and context"
|
|
680
889
|
),
|
|
681
|
-
required:
|
|
682
|
-
isHidden:
|
|
683
|
-
errorMessage:
|
|
684
|
-
validations:
|
|
685
|
-
visibility:
|
|
686
|
-
sectionId:
|
|
890
|
+
required: z4.boolean().default(false).describe("Whether this question must be answered"),
|
|
891
|
+
isHidden: z4.boolean().default(false).describe("When true, the question is hidden from the form UI"),
|
|
892
|
+
errorMessage: z4.string().max(500).optional().describe("Custom error message when validation fails"),
|
|
893
|
+
validations: z4.array(validationRuleSchema).optional().default([]).describe("Array of validation rules to apply"),
|
|
894
|
+
visibility: z4.array(visibilityConditionSchema).optional().default([]).describe("Conditions that control when this question is shown"),
|
|
895
|
+
sectionId: z4.string().optional().describe("ID of the section this question belongs to"),
|
|
687
896
|
status: questionStatusSchema.describe(
|
|
688
897
|
"Current status of the question (Draft, Published, etc.)"
|
|
689
898
|
),
|
|
690
|
-
textAlign:
|
|
899
|
+
textAlign: z4.enum(["left", "center", "justify"]).optional().default("left").describe(
|
|
691
900
|
"Text alignment for the question title and description; `justify` is intended for consent questions (full-width justified consent body markdown)"
|
|
692
901
|
),
|
|
693
|
-
nextButtonLabel:
|
|
902
|
+
nextButtonLabel: z4.string().min(1).max(50).default("Next").describe(
|
|
694
903
|
"Label for the next button when advancing past this question (overrides section or form defaults when set)"
|
|
695
904
|
),
|
|
696
|
-
showQuestionTitle:
|
|
697
|
-
questionMediaUrl:
|
|
905
|
+
showQuestionTitle: z4.boolean().default(true).describe("Whether to display the question title; defaults to true"),
|
|
906
|
+
questionMediaUrl: z4.string().url().optional().describe(
|
|
698
907
|
"Optional URL for media (image or video) displayed alongside the question"
|
|
699
908
|
),
|
|
700
|
-
questionMediaType:
|
|
909
|
+
questionMediaType: z4.enum(["image", "video", "youtube", "vimeo"]).optional().describe(
|
|
701
910
|
"Type of media referenced by questionMediaUrl; one of 'image', 'video', 'youtube', or 'vimeo'"
|
|
702
911
|
)
|
|
703
912
|
}).describe("Base schema for all question types with common properties");
|
|
704
913
|
var ratingQuestionSchema = questionSchema.extend({
|
|
705
|
-
type:
|
|
706
|
-
showLabels:
|
|
707
|
-
minLabel:
|
|
708
|
-
maxLabel:
|
|
914
|
+
type: z4.literal("rating").describe("Must be exactly 'rating'"),
|
|
915
|
+
showLabels: z4.boolean().optional().describe("Whether to show min/max labels"),
|
|
916
|
+
minLabel: z4.string().max(100).optional().describe("Label for the minimum rating value"),
|
|
917
|
+
maxLabel: z4.string().max(100).optional().describe("Label for the maximum rating value"),
|
|
709
918
|
displayStyle: ratingDisplayStyleSchema.optional().describe("Visual style for rating display"),
|
|
710
|
-
numberOfRatings:
|
|
919
|
+
numberOfRatings: z4.number().int().min(1).max(10).describe("Number of rating options (1-10)"),
|
|
711
920
|
representationSize: ratingRepresentationSizeSchema.optional().describe("Size of rating visual elements"),
|
|
712
|
-
color:
|
|
921
|
+
color: z4.string().regex(/^#[0-9A-F]{6}$/i, "Must be a valid hex color").optional().describe("Hex color for rating elements")
|
|
713
922
|
}).describe("Schema for rating questions with customizable display options");
|
|
714
923
|
var annotationQuestionSchema = questionSchema.extend({
|
|
715
|
-
type:
|
|
716
|
-
annotationText:
|
|
717
|
-
noAnnotationText:
|
|
924
|
+
type: z4.literal("annotation").describe("Must be exactly 'annotation'"),
|
|
925
|
+
annotationText: z4.string().max(1e3).optional().describe("Text to display when annotation is provided"),
|
|
926
|
+
noAnnotationText: z4.string().max(500).optional().describe("Text to display when no annotation is provided")
|
|
718
927
|
}).describe(
|
|
719
928
|
"Schema for annotation questions that provide additional context or instructions"
|
|
720
929
|
);
|
|
721
930
|
var welcomeQuestionSchema = questionSchema.extend({
|
|
722
|
-
type:
|
|
723
|
-
title:
|
|
724
|
-
description:
|
|
725
|
-
imageUrl:
|
|
931
|
+
type: z4.literal("welcome").describe("Must be exactly 'welcome'"),
|
|
932
|
+
title: z4.string().min(1).max(200).describe("The main heading displayed on the welcome screen"),
|
|
933
|
+
description: z4.string().max(1e3).optional().describe("Optional sub-text body shown below the heading"),
|
|
934
|
+
imageUrl: z4.string().url().optional().describe("Optional image URL displayed on the welcome screen")
|
|
726
935
|
}).describe(
|
|
727
936
|
"Schema for a welcome screen displayed at the start or inline within a form"
|
|
728
937
|
);
|
|
729
938
|
var thankYouQuestionSchema = questionSchema.extend({
|
|
730
|
-
type:
|
|
731
|
-
title:
|
|
732
|
-
description:
|
|
939
|
+
type: z4.literal("thank_you").describe("Must be exactly 'thank_you'"),
|
|
940
|
+
title: z4.string().min(1).max(200).describe("The main heading displayed on the thank you screen"),
|
|
941
|
+
description: z4.string().max(1e3).optional().describe(
|
|
733
942
|
"Optional thank you body text; rendered as Markdown where the form supports it"
|
|
734
943
|
),
|
|
735
|
-
imageUrl:
|
|
944
|
+
imageUrl: z4.string().url().optional().describe("Optional image URL displayed on the thank you screen"),
|
|
736
945
|
completionCta: completionCtaSchema.optional().describe(
|
|
737
946
|
"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
947
|
)
|
|
@@ -740,15 +949,15 @@ var thankYouQuestionSchema = questionSchema.extend({
|
|
|
740
949
|
"Schema for a thank you screen shown at the end or inline within a form"
|
|
741
950
|
);
|
|
742
951
|
var messagePanelQuestionSchema = questionSchema.extend({
|
|
743
|
-
type:
|
|
744
|
-
title:
|
|
745
|
-
description:
|
|
746
|
-
imageUrl:
|
|
952
|
+
type: z4.literal("message_panel").describe("Must be exactly 'message_panel'"),
|
|
953
|
+
title: z4.string().min(1).max(200).describe("The main heading displayed on the message panel"),
|
|
954
|
+
description: z4.string().max(1e3).optional().describe("Optional body text shown below the heading"),
|
|
955
|
+
imageUrl: z4.string().url().optional().describe("Optional image URL displayed on the message panel")
|
|
747
956
|
}).describe(
|
|
748
957
|
"Schema for an inline message panel (informational); distinct from welcome for UI semantics and analytics"
|
|
749
958
|
);
|
|
750
959
|
var exitFormQuestionSchema = questionSchema.extend({
|
|
751
|
-
type:
|
|
960
|
+
type: z4.literal("exit_form").describe("Must be exactly 'exit_form'"),
|
|
752
961
|
completionCta: completionCtaSchema.optional().describe(
|
|
753
962
|
"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
963
|
)
|
|
@@ -756,11 +965,11 @@ var exitFormQuestionSchema = questionSchema.extend({
|
|
|
756
965
|
"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
966
|
);
|
|
758
967
|
var yesNoQuestionSchema = questionSchema.extend({
|
|
759
|
-
type:
|
|
760
|
-
yesLabel:
|
|
968
|
+
type: z4.literal("yes_no").describe("Must be exactly 'yes_no'"),
|
|
969
|
+
yesLabel: z4.string().min(1).max(50).optional().describe(
|
|
761
970
|
"Label for the Yes option (defaults to 'Yes' in the UI if omitted)"
|
|
762
971
|
),
|
|
763
|
-
noLabel:
|
|
972
|
+
noLabel: z4.string().min(1).max(50).optional().describe(
|
|
764
973
|
"Label for the No option (defaults to 'No' in the UI if omitted)"
|
|
765
974
|
),
|
|
766
975
|
displayStyle: yesNoDisplayStyleSchema.optional().describe(
|
|
@@ -770,11 +979,11 @@ var yesNoQuestionSchema = questionSchema.extend({
|
|
|
770
979
|
"Schema for yes/no questions with optional custom labels and layout"
|
|
771
980
|
);
|
|
772
981
|
var consentQuestionSchema = questionSchema.extend({
|
|
773
|
-
type:
|
|
982
|
+
type: z4.literal("consent").describe("Must be exactly 'consent'")
|
|
774
983
|
}).describe(
|
|
775
984
|
"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
985
|
);
|
|
777
|
-
var ratingMatrixDisplayStyleSchema =
|
|
986
|
+
var ratingMatrixDisplayStyleSchema = z4.enum([
|
|
778
987
|
"radio",
|
|
779
988
|
"star",
|
|
780
989
|
"emoji",
|
|
@@ -786,82 +995,82 @@ var RatingMatrixDisplayStyles = {
|
|
|
786
995
|
EMOJI: "emoji",
|
|
787
996
|
BUTTON: "button"
|
|
788
997
|
};
|
|
789
|
-
var ratingMatrixStatementSchema =
|
|
790
|
-
id:
|
|
998
|
+
var ratingMatrixStatementSchema = z4.object({
|
|
999
|
+
id: z4.string().describe(
|
|
791
1000
|
"Unique identifier for this statement (system time milliseconds)"
|
|
792
1001
|
),
|
|
793
|
-
value:
|
|
794
|
-
label:
|
|
795
|
-
describe:
|
|
1002
|
+
value: z4.string().min(1).max(100).describe("Internal value / export key for this statement"),
|
|
1003
|
+
label: z4.string().min(1).max(200).describe("Display text shown to users for this statement"),
|
|
1004
|
+
describe: z4.string().max(500).optional().describe("LLM tool call description for this statement")
|
|
796
1005
|
}).describe("Schema for an individual statement (row) in a rating matrix");
|
|
797
|
-
var ratingMatrixScalePointSchema =
|
|
798
|
-
id:
|
|
799
|
-
value:
|
|
1006
|
+
var ratingMatrixScalePointSchema = z4.object({
|
|
1007
|
+
id: z4.string().describe("Unique identifier for this scale point"),
|
|
1008
|
+
value: z4.union([z4.number(), z4.string()]).describe(
|
|
800
1009
|
"Stored response value for this scale point (number or string)"
|
|
801
1010
|
),
|
|
802
|
-
label:
|
|
803
|
-
describe:
|
|
1011
|
+
label: z4.string().min(1).max(200).describe("Display label shown for this scale point"),
|
|
1012
|
+
describe: z4.string().max(500).optional().describe("LLM tool call description for this scale point")
|
|
804
1013
|
}).describe("Schema for a single point on a custom rating scale");
|
|
805
|
-
var ratingMatrixScaleSchema =
|
|
1014
|
+
var ratingMatrixScaleSchema = z4.discriminatedUnion("kind", [
|
|
806
1015
|
// Likert: symmetric ordinal scale -2…+2, explicit scale points with labels
|
|
807
|
-
|
|
808
|
-
kind:
|
|
809
|
-
scalePoints:
|
|
1016
|
+
z4.object({
|
|
1017
|
+
kind: z4.literal("likert").describe("Symmetric ordinal scale (-2 to +2)"),
|
|
1018
|
+
scalePoints: z4.array(ratingMatrixScalePointSchema).min(2).max(10).describe("Scale points with display labels for each column")
|
|
810
1019
|
}),
|
|
811
1020
|
// Numerical: 1…N points where N is 2, 3, 4, or 5, explicit scale points with labels
|
|
812
|
-
|
|
813
|
-
kind:
|
|
814
|
-
scalePoints:
|
|
815
|
-
pointCount:
|
|
1021
|
+
z4.object({
|
|
1022
|
+
kind: z4.literal("numerical").describe("Numerical scale from 1 to N"),
|
|
1023
|
+
scalePoints: z4.array(ratingMatrixScalePointSchema).min(2).max(10).describe("Scale points with display labels for each column"),
|
|
1024
|
+
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
1025
|
}),
|
|
817
1026
|
// Custom: consumer defines each point's value and label
|
|
818
|
-
|
|
819
|
-
kind:
|
|
820
|
-
scalePoints:
|
|
1027
|
+
z4.object({
|
|
1028
|
+
kind: z4.literal("custom").describe("Custom scale with user-defined points and values"),
|
|
1029
|
+
scalePoints: z4.array(ratingMatrixScalePointSchema).min(2).max(10).describe("Scale points with display labels for each column")
|
|
821
1030
|
})
|
|
822
1031
|
]).describe("Scale configuration for rating matrix questions");
|
|
823
1032
|
var ratingMatrixQuestionSchema = questionSchema.extend({
|
|
824
|
-
type:
|
|
825
|
-
statements:
|
|
1033
|
+
type: z4.literal("rating_matrix").describe("Must be exactly 'rating_matrix'"),
|
|
1034
|
+
statements: z4.array(ratingMatrixStatementSchema).min(1).max(10).describe("Statements (rows) users will rate on the shared scale (1-10)"),
|
|
826
1035
|
scale: ratingMatrixScaleSchema.describe(
|
|
827
1036
|
"Scale configuration shared across all statement rows"
|
|
828
1037
|
),
|
|
829
1038
|
displayStyle: ratingMatrixDisplayStyleSchema.optional().describe(
|
|
830
1039
|
"Visual representation of scale points per row (radio buttons, stars, emoji, or buttons)"
|
|
831
1040
|
),
|
|
832
|
-
randomizeStatements:
|
|
1041
|
+
randomizeStatements: z4.boolean().optional().default(false).describe("Whether to randomize the order of statements")
|
|
833
1042
|
}).describe(
|
|
834
1043
|
"Schema for rating matrix questions with multiple statements on a shared scale"
|
|
835
1044
|
);
|
|
836
|
-
var matrixRowSchema =
|
|
837
|
-
id:
|
|
838
|
-
value:
|
|
839
|
-
label:
|
|
840
|
-
describe:
|
|
1045
|
+
var matrixRowSchema = z4.object({
|
|
1046
|
+
id: z4.string().describe("Unique identifier for this row (system time milliseconds)"),
|
|
1047
|
+
value: z4.string().min(1).max(100).describe("Internal value / export key for this row"),
|
|
1048
|
+
label: z4.string().min(1).max(200).describe("Display text shown to users for this row"),
|
|
1049
|
+
describe: z4.string().max(500).optional().describe("LLM tool call description for this row")
|
|
841
1050
|
}).describe("Schema for an individual row in a matrix choice question");
|
|
842
|
-
var matrixColumnSchema =
|
|
843
|
-
id:
|
|
844
|
-
value:
|
|
845
|
-
label:
|
|
846
|
-
describe:
|
|
1051
|
+
var matrixColumnSchema = z4.object({
|
|
1052
|
+
id: z4.string().describe("Unique identifier for this column (system time milliseconds)"),
|
|
1053
|
+
value: z4.string().min(1).max(100).describe("Internal value / export key for this column"),
|
|
1054
|
+
label: z4.string().min(1).max(200).describe("Display label shown for this column"),
|
|
1055
|
+
describe: z4.string().max(500).optional().describe("LLM tool call description for this column")
|
|
847
1056
|
}).describe("Schema for an individual column in a matrix choice question");
|
|
848
1057
|
var matrixSingleChoiceQuestionSchema = questionSchema.extend({
|
|
849
|
-
type:
|
|
850
|
-
rows:
|
|
851
|
-
columns:
|
|
852
|
-
randomizeRows:
|
|
853
|
-
randomizeColumns:
|
|
1058
|
+
type: z4.literal("matrix_single_choice").describe("Must be exactly 'matrix_single_choice'"),
|
|
1059
|
+
rows: z4.array(matrixRowSchema).min(1).max(20).describe("Row items (1-20 rows)"),
|
|
1060
|
+
columns: z4.array(matrixColumnSchema).min(2).max(10).describe("Column options shared across all rows (2-10 columns)"),
|
|
1061
|
+
randomizeRows: z4.boolean().optional().default(false).describe("Whether to randomize the order of rows"),
|
|
1062
|
+
randomizeColumns: z4.boolean().optional().default(false).describe("Whether to randomize the order of columns")
|
|
854
1063
|
}).describe(
|
|
855
1064
|
"Schema for matrix single-choice questions where one column is selected per row"
|
|
856
1065
|
);
|
|
857
1066
|
var matrixMultipleChoiceQuestionSchema = questionSchema.extend({
|
|
858
|
-
type:
|
|
859
|
-
rows:
|
|
860
|
-
columns:
|
|
861
|
-
minSelectionsPerRow:
|
|
862
|
-
maxSelectionsPerRow:
|
|
863
|
-
randomizeRows:
|
|
864
|
-
randomizeColumns:
|
|
1067
|
+
type: z4.literal("matrix_multiple_choice").describe("Must be exactly 'matrix_multiple_choice'"),
|
|
1068
|
+
rows: z4.array(matrixRowSchema).min(1).max(20).describe("Row items (1-20 rows)"),
|
|
1069
|
+
columns: z4.array(matrixColumnSchema).min(2).max(10).describe("Column options shared across all rows (2-10 columns)"),
|
|
1070
|
+
minSelectionsPerRow: z4.number().int().min(0).optional().describe("Minimum number of columns a user must select per row"),
|
|
1071
|
+
maxSelectionsPerRow: z4.number().int().min(1).optional().describe("Maximum number of columns a user can select per row"),
|
|
1072
|
+
randomizeRows: z4.boolean().optional().default(false).describe("Whether to randomize the order of rows"),
|
|
1073
|
+
randomizeColumns: z4.boolean().optional().default(false).describe("Whether to randomize the order of columns")
|
|
865
1074
|
}).refine(
|
|
866
1075
|
(data) => {
|
|
867
1076
|
if (data.minSelectionsPerRow !== void 0 && data.maxSelectionsPerRow !== void 0) {
|
|
@@ -876,64 +1085,64 @@ var matrixMultipleChoiceQuestionSchema = questionSchema.extend({
|
|
|
876
1085
|
).describe(
|
|
877
1086
|
"Schema for matrix multiple-choice questions where one or more columns can be selected per row"
|
|
878
1087
|
);
|
|
879
|
-
var questionOptionSchema =
|
|
880
|
-
id:
|
|
881
|
-
value:
|
|
882
|
-
label:
|
|
883
|
-
hint:
|
|
1088
|
+
var questionOptionSchema = z4.object({
|
|
1089
|
+
id: z4.string().describe("Unique identifier for this option (system time milliseconds)"),
|
|
1090
|
+
value: z4.string().min(1).max(100).describe("The internal value used for this option"),
|
|
1091
|
+
label: z4.string().min(1).max(200).describe("The display text shown to users for this option"),
|
|
1092
|
+
hint: z4.string().max(300).optional().describe(
|
|
884
1093
|
"Optional short description shown below the option label to help respondents understand what they are selecting or ranking"
|
|
885
1094
|
),
|
|
886
|
-
describe:
|
|
1095
|
+
describe: z4.string().max(500).optional().describe(
|
|
887
1096
|
"LLM tool call description providing context about this option"
|
|
888
1097
|
),
|
|
889
|
-
imageUrl:
|
|
1098
|
+
imageUrl: z4.string().url().optional().describe("Optional image URL to display with this option")
|
|
890
1099
|
}).describe("Schema for individual options in choice-based questions");
|
|
891
|
-
var nestedOptionSchema =
|
|
892
|
-
() =>
|
|
893
|
-
id:
|
|
1100
|
+
var nestedOptionSchema = z4.lazy(
|
|
1101
|
+
() => z4.object({
|
|
1102
|
+
id: z4.string().describe(
|
|
894
1103
|
"Unique identifier for this nested option (system time milliseconds)"
|
|
895
1104
|
),
|
|
896
|
-
value:
|
|
897
|
-
label:
|
|
898
|
-
describe:
|
|
899
|
-
imageUrl:
|
|
900
|
-
hint:
|
|
1105
|
+
value: z4.string().min(1).max(100).describe("The internal value used for this nested option"),
|
|
1106
|
+
label: z4.string().min(1).max(200).describe("The display text shown for this nested option"),
|
|
1107
|
+
describe: z4.string().max(500).optional().describe("LLM tool call description for this nested option context"),
|
|
1108
|
+
imageUrl: z4.string().url().optional().describe("Optional image URL for this nested option"),
|
|
1109
|
+
hint: z4.string().max(500).optional().describe(
|
|
901
1110
|
"Optional hint text to help users understand this nested option"
|
|
902
1111
|
),
|
|
903
|
-
children:
|
|
1112
|
+
children: z4.array(nestedOptionSchema).optional().default([]).describe("Array of child options for hierarchical structure")
|
|
904
1113
|
}).describe("Schema for nested options with hierarchical structure support")
|
|
905
1114
|
);
|
|
906
1115
|
var multipleChoiceSingleQuestionSchema = questionSchema.extend({
|
|
907
|
-
type:
|
|
1116
|
+
type: z4.literal("single_choice").describe("Must be exactly 'single_choice'"),
|
|
908
1117
|
displayStyle: multipleChoiceDisplayStyleSchema.optional().describe("Visual style for displaying options"),
|
|
909
|
-
allowOther:
|
|
910
|
-
otherTextConfig:
|
|
911
|
-
minChars:
|
|
912
|
-
maxChars:
|
|
913
|
-
placeholder:
|
|
914
|
-
showLimitIndicatorThreshold:
|
|
1118
|
+
allowOther: z4.boolean().optional().default(false).describe('Whether to allow a custom "other" option'),
|
|
1119
|
+
otherTextConfig: z4.object({
|
|
1120
|
+
minChars: z4.number().int().min(0).optional().describe("Minimum number of characters required for the other text"),
|
|
1121
|
+
maxChars: z4.number().int().min(1).optional().describe("Maximum number of characters allowed for the other text"),
|
|
1122
|
+
placeholder: z4.string().max(200).optional().describe("Placeholder text for the other text input"),
|
|
1123
|
+
showLimitIndicatorThreshold: z4.number().int().min(0).optional().describe(
|
|
915
1124
|
"Show the character limit indicator (e.g. '12/100') once the user has typed this many characters; 0 = show immediately, absent = never show"
|
|
916
1125
|
)
|
|
917
1126
|
}).optional().describe('Configuration for the custom "other" text input'),
|
|
918
|
-
randomizeOptions:
|
|
919
|
-
options:
|
|
1127
|
+
randomizeOptions: z4.boolean().optional().default(false).describe("Whether to randomize the order of options"),
|
|
1128
|
+
options: z4.array(questionOptionSchema).min(1).max(50).describe("Array of options for user selection (1-50 options)")
|
|
920
1129
|
}).describe("Schema for single-choice multiple selection questions");
|
|
921
1130
|
var multipleChoiceMultipleQuestionSchema = questionSchema.extend({
|
|
922
|
-
type:
|
|
1131
|
+
type: z4.literal("multiple_choice_multiple").describe("Must be exactly 'multiple_choice_multiple'"),
|
|
923
1132
|
displayStyle: multipleChoiceMultipleDisplayStyleSchema.optional().describe("Visual style for displaying multiple options"),
|
|
924
|
-
allowOther:
|
|
925
|
-
otherTextConfig:
|
|
926
|
-
minChars:
|
|
927
|
-
maxChars:
|
|
928
|
-
placeholder:
|
|
929
|
-
showLimitIndicatorThreshold:
|
|
1133
|
+
allowOther: z4.boolean().optional().default(false).describe('Whether to allow a custom "other" option'),
|
|
1134
|
+
otherTextConfig: z4.object({
|
|
1135
|
+
minChars: z4.number().int().min(0).optional().describe("Minimum number of characters required for the other text"),
|
|
1136
|
+
maxChars: z4.number().int().min(1).optional().describe("Maximum number of characters allowed for the other text"),
|
|
1137
|
+
placeholder: z4.string().max(200).optional().describe("Placeholder text for the other text input"),
|
|
1138
|
+
showLimitIndicatorThreshold: z4.number().int().min(0).optional().describe(
|
|
930
1139
|
"Show the character limit indicator (e.g. '12/100') once the user has typed this many characters; 0 = show immediately, absent = never show"
|
|
931
1140
|
)
|
|
932
1141
|
}).optional().describe('Configuration for the custom "other" text input'),
|
|
933
|
-
minSelections:
|
|
934
|
-
maxSelections:
|
|
935
|
-
randomizeOptions:
|
|
936
|
-
options:
|
|
1142
|
+
minSelections: z4.number().int().min(0).optional().describe("Minimum number of options that must be selected"),
|
|
1143
|
+
maxSelections: z4.number().int().min(1).optional().describe("Maximum number of options that can be selected"),
|
|
1144
|
+
randomizeOptions: z4.boolean().optional().default(false).describe("Whether to randomize the order of options"),
|
|
1145
|
+
options: z4.array(questionOptionSchema).min(1).max(50).describe("Array of options for user selection (1-50 options)")
|
|
937
1146
|
}).refine(
|
|
938
1147
|
(data) => {
|
|
939
1148
|
if (data.minSelections !== void 0 && data.maxSelections !== void 0) {
|
|
@@ -950,20 +1159,20 @@ var multipleChoiceMultipleQuestionSchema = questionSchema.extend({
|
|
|
950
1159
|
"Schema for multiple-choice questions allowing multiple selections"
|
|
951
1160
|
);
|
|
952
1161
|
var npsQuestionSchema = questionSchema.extend({
|
|
953
|
-
type:
|
|
954
|
-
min:
|
|
955
|
-
max:
|
|
956
|
-
minLabel:
|
|
957
|
-
maxLabel:
|
|
958
|
-
scaleLabels:
|
|
959
|
-
prepopulatedValue:
|
|
960
|
-
detractorColor:
|
|
1162
|
+
type: z4.literal("nps").describe("Must be exactly 'nps'"),
|
|
1163
|
+
min: z4.literal(0).describe("NPS always starts at 0"),
|
|
1164
|
+
max: z4.literal(10).describe("NPS always ends at 10"),
|
|
1165
|
+
minLabel: z4.string().max(100).optional().describe("Label for the minimum NPS value (0)"),
|
|
1166
|
+
maxLabel: z4.string().max(100).optional().describe("Label for the maximum NPS value (10)"),
|
|
1167
|
+
scaleLabels: z4.record(z4.string().regex(/^\d+$/), z4.string().max(50)).optional().describe("Custom labels for specific NPS values (0-10)"),
|
|
1168
|
+
prepopulatedValue: z4.number().int().min(0).max(10).optional().describe("Default value to pre-select (0-10)"),
|
|
1169
|
+
detractorColor: z4.string().max(50).optional().describe(
|
|
961
1170
|
"Color applied to detractor scores (0\u20136); accepts any valid CSS color value (hex, rgb, hsl, named)"
|
|
962
1171
|
),
|
|
963
|
-
passiveColor:
|
|
1172
|
+
passiveColor: z4.string().max(50).optional().describe(
|
|
964
1173
|
"Color applied to passive scores (7\u20138); accepts any valid CSS color value"
|
|
965
1174
|
),
|
|
966
|
-
promoterColor:
|
|
1175
|
+
promoterColor: z4.string().max(50).optional().describe(
|
|
967
1176
|
"Color applied to promoter scores (9\u201310); accepts any valid CSS color value"
|
|
968
1177
|
)
|
|
969
1178
|
}).refine(
|
|
@@ -983,19 +1192,19 @@ var npsQuestionSchema = questionSchema.extend({
|
|
|
983
1192
|
}
|
|
984
1193
|
).describe("Schema for Net Promoter Score questions with 0-10 scale");
|
|
985
1194
|
var shortAnswerQuestionSchema = questionSchema.extend({
|
|
986
|
-
type:
|
|
987
|
-
maxCharacters:
|
|
988
|
-
minCharacters:
|
|
989
|
-
showLimitIndicatorThreshold:
|
|
1195
|
+
type: z4.literal("short_answer").describe("Must be exactly 'short_answer'"),
|
|
1196
|
+
maxCharacters: z4.number().int().min(1).max(1e4).optional().describe("Maximum number of characters allowed"),
|
|
1197
|
+
minCharacters: z4.number().int().min(0).optional().describe("Minimum number of characters required"),
|
|
1198
|
+
showLimitIndicatorThreshold: z4.number().int().min(0).optional().describe(
|
|
990
1199
|
"Show the character limit indicator (e.g. '12/100') once the user has typed this many characters; 0 = show immediately, absent = never show"
|
|
991
1200
|
),
|
|
992
|
-
placeholder:
|
|
993
|
-
enableRegexValidation:
|
|
994
|
-
regexPattern:
|
|
995
|
-
enableEnhanceWithAi:
|
|
996
|
-
promptTemplate:
|
|
997
|
-
maxTokenAllowed:
|
|
998
|
-
minCharactersToEnhance:
|
|
1201
|
+
placeholder: z4.string().max(200).optional().describe("Placeholder text shown in the input field"),
|
|
1202
|
+
enableRegexValidation: z4.boolean().optional().default(false).describe("Whether to enable regex pattern validation"),
|
|
1203
|
+
regexPattern: z4.string().optional().describe("Regular expression pattern for validation"),
|
|
1204
|
+
enableEnhanceWithAi: z4.boolean().optional().default(false).describe("Whether to enable AI enhancement features"),
|
|
1205
|
+
promptTemplate: z4.string().max(2e3).optional().describe("Template for AI enhancement prompts"),
|
|
1206
|
+
maxTokenAllowed: z4.number().int().min(1).max(1e4).optional().describe("Maximum tokens allowed for AI processing"),
|
|
1207
|
+
minCharactersToEnhance: z4.number().int().min(1).optional().describe("Minimum characters needed to trigger AI enhancement")
|
|
999
1208
|
}).refine(
|
|
1000
1209
|
(data) => {
|
|
1001
1210
|
if (data.minCharacters !== void 0 && data.maxCharacters !== void 0) {
|
|
@@ -1031,22 +1240,22 @@ var shortAnswerQuestionSchema = questionSchema.extend({
|
|
|
1031
1240
|
}
|
|
1032
1241
|
).describe("Schema for short answer questions with optional AI enhancement");
|
|
1033
1242
|
var longAnswerQuestionSchema = questionSchema.extend({
|
|
1034
|
-
type:
|
|
1035
|
-
maxCharacters:
|
|
1243
|
+
type: z4.literal("long_text").describe("Must be exactly 'long_text'"),
|
|
1244
|
+
maxCharacters: z4.number().int().min(1).max(5e4).optional().describe(
|
|
1036
1245
|
"Maximum number of characters allowed (higher limit for long text)"
|
|
1037
1246
|
),
|
|
1038
|
-
minCharacters:
|
|
1039
|
-
showLimitIndicatorThreshold:
|
|
1247
|
+
minCharacters: z4.number().int().min(0).optional().describe("Minimum number of characters required"),
|
|
1248
|
+
showLimitIndicatorThreshold: z4.number().int().min(0).optional().describe(
|
|
1040
1249
|
"Show the character limit indicator (e.g. '12/100') once the user has typed this many characters; 0 = show immediately, absent = never show"
|
|
1041
1250
|
),
|
|
1042
|
-
rows:
|
|
1043
|
-
placeholder:
|
|
1044
|
-
enableEnhanceWithAi:
|
|
1045
|
-
promptTemplate:
|
|
1046
|
-
maxTokenAllowed:
|
|
1251
|
+
rows: z4.number().int().min(1).max(20).optional().describe("Number of textarea rows to display (1-20)"),
|
|
1252
|
+
placeholder: z4.string().max(500).optional().describe("Placeholder text for the textarea (longer for long text)"),
|
|
1253
|
+
enableEnhanceWithAi: z4.boolean().optional().default(false).describe("Whether to enable AI enhancement features"),
|
|
1254
|
+
promptTemplate: z4.string().max(2e3).optional().describe("Template for AI enhancement prompts"),
|
|
1255
|
+
maxTokenAllowed: z4.number().int().min(1).max(25e3).optional().describe(
|
|
1047
1256
|
"Maximum tokens allowed for AI processing (higher for long text)"
|
|
1048
1257
|
),
|
|
1049
|
-
minCharactersToEnhance:
|
|
1258
|
+
minCharactersToEnhance: z4.number().int().min(1).optional().describe("Minimum characters needed to trigger AI enhancement")
|
|
1050
1259
|
}).refine(
|
|
1051
1260
|
(data) => {
|
|
1052
1261
|
if (data.minCharacters !== void 0 && data.maxCharacters !== void 0) {
|
|
@@ -1073,19 +1282,19 @@ var longAnswerQuestionSchema = questionSchema.extend({
|
|
|
1073
1282
|
"Schema for long answer questions with rich text support and AI enhancement"
|
|
1074
1283
|
);
|
|
1075
1284
|
var nestedDropdownQuestionSchema = questionSchema.extend({
|
|
1076
|
-
type:
|
|
1077
|
-
placeholder:
|
|
1078
|
-
options:
|
|
1285
|
+
type: z4.literal("nested_selection").describe("Must be exactly 'nested_selection'"),
|
|
1286
|
+
placeholder: z4.string().max(200).optional().describe("Placeholder text for the nested dropdown"),
|
|
1287
|
+
options: z4.array(nestedOptionSchema).min(1).max(100).describe(
|
|
1079
1288
|
"Array of nested options for hierarchical selection (1-100 options)"
|
|
1080
1289
|
),
|
|
1081
|
-
displayStyle:
|
|
1290
|
+
displayStyle: z4.literal("list").describe("Fixed display style for nested dropdowns"),
|
|
1082
1291
|
choiceOrderOption: choiceOrderOptionSchema.optional().default("none").describe("How to order the nested choices"),
|
|
1083
|
-
preserveLastChoices:
|
|
1084
|
-
prepopulatedValue:
|
|
1085
|
-
allowOther:
|
|
1086
|
-
otherColumnName:
|
|
1087
|
-
maxDepth:
|
|
1088
|
-
cascadeLabels:
|
|
1292
|
+
preserveLastChoices: z4.number().int().min(0).max(10).optional().describe("Number of choice levels to preserve (0-10)"),
|
|
1293
|
+
prepopulatedValue: z4.string().max(1e3).optional().describe("Default value to pre-populate"),
|
|
1294
|
+
allowOther: z4.boolean().optional().default(false).describe('Whether to allow custom "other" options'),
|
|
1295
|
+
otherColumnName: z4.string().max(100).optional().describe('Column name for storing custom "other" values'),
|
|
1296
|
+
maxDepth: z4.number().int().min(1).max(10).optional().describe("Maximum nesting depth allowed (1-10)"),
|
|
1297
|
+
cascadeLabels: z4.boolean().optional().default(false).describe("Whether to cascade labels from parent options")
|
|
1089
1298
|
}).refine(
|
|
1090
1299
|
(data) => {
|
|
1091
1300
|
if (data.allowOther && !data.otherColumnName) {
|
|
@@ -1100,7 +1309,7 @@ var nestedDropdownQuestionSchema = questionSchema.extend({
|
|
|
1100
1309
|
).describe(
|
|
1101
1310
|
"Schema for nested dropdown questions with hierarchical option structure"
|
|
1102
1311
|
);
|
|
1103
|
-
var dateFormatSchema =
|
|
1312
|
+
var dateFormatSchema = z4.enum([
|
|
1104
1313
|
"MM/DD/YYYY",
|
|
1105
1314
|
"DD/MM/YYYY",
|
|
1106
1315
|
"YYYY/MM/DD"
|
|
@@ -1110,40 +1319,40 @@ var DateFormats = {
|
|
|
1110
1319
|
DD_MM_YYYY: "DD/MM/YYYY",
|
|
1111
1320
|
YYYY_MM_DD: "YYYY/MM/DD"
|
|
1112
1321
|
};
|
|
1113
|
-
var dateSeparatorSchema =
|
|
1322
|
+
var dateSeparatorSchema = z4.enum(["/", "-", "."]);
|
|
1114
1323
|
var DateSeparators = {
|
|
1115
1324
|
SLASH: "/",
|
|
1116
1325
|
DASH: "-",
|
|
1117
1326
|
DOT: "."
|
|
1118
1327
|
};
|
|
1119
1328
|
var dateQuestionSchema = questionSchema.extend({
|
|
1120
|
-
type:
|
|
1329
|
+
type: z4.literal("date").describe("Must be exactly 'date'"),
|
|
1121
1330
|
format: dateFormatSchema.optional().default("DD/MM/YYYY").describe("Order of day, month, and year segments in the input"),
|
|
1122
1331
|
separator: dateSeparatorSchema.optional().default("/").describe("Character used to separate day, month, and year segments"),
|
|
1123
|
-
includeTime:
|
|
1124
|
-
minDate:
|
|
1332
|
+
includeTime: z4.boolean().optional().default(false).describe("Whether to also collect a time (HH:MM) alongside the date"),
|
|
1333
|
+
minDate: z4.string().optional().describe(
|
|
1125
1334
|
"Earliest allowed date in ISO 8601 format (YYYY-MM-DD); when absent no lower bound is enforced"
|
|
1126
1335
|
),
|
|
1127
|
-
maxDate:
|
|
1336
|
+
maxDate: z4.string().optional().describe(
|
|
1128
1337
|
"Latest allowed date in ISO 8601 format (YYYY-MM-DD); when absent no upper bound is enforced"
|
|
1129
1338
|
),
|
|
1130
|
-
placeholder:
|
|
1131
|
-
segmentLabelDD:
|
|
1339
|
+
placeholder: z4.string().max(50).optional().describe("Placeholder text shown in the date input"),
|
|
1340
|
+
segmentLabelDD: z4.string().max(40).optional().describe(
|
|
1132
1341
|
"Visible label above the day segment; when absent a locale default is used"
|
|
1133
1342
|
),
|
|
1134
|
-
segmentLabelMM:
|
|
1135
|
-
segmentLabelYYYY:
|
|
1136
|
-
prepopulatedValue:
|
|
1343
|
+
segmentLabelMM: z4.string().max(40).optional().describe("Visible label above the month segment"),
|
|
1344
|
+
segmentLabelYYYY: z4.string().max(40).optional().describe("Visible label above the year segment"),
|
|
1345
|
+
prepopulatedValue: z4.string().optional().describe(
|
|
1137
1346
|
"Default date value in ISO 8601 format (YYYY-MM-DD) to pre-fill the input"
|
|
1138
1347
|
)
|
|
1139
1348
|
}).describe(
|
|
1140
1349
|
"Schema for a date question that collects a structured date (and optionally time) from the respondent"
|
|
1141
1350
|
);
|
|
1142
|
-
var csatScaleSchema =
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1351
|
+
var csatScaleSchema = z4.union([
|
|
1352
|
+
z4.literal(2),
|
|
1353
|
+
z4.literal(3),
|
|
1354
|
+
z4.literal(4),
|
|
1355
|
+
z4.literal(5)
|
|
1147
1356
|
]);
|
|
1148
1357
|
var CsatScales = {
|
|
1149
1358
|
TWO: 2,
|
|
@@ -1151,56 +1360,56 @@ var CsatScales = {
|
|
|
1151
1360
|
FOUR: 4,
|
|
1152
1361
|
FIVE: 5
|
|
1153
1362
|
};
|
|
1154
|
-
var csatDisplayStyleSchema =
|
|
1363
|
+
var csatDisplayStyleSchema = z4.enum(["emoji", "text"]);
|
|
1155
1364
|
var CsatDisplayStyles = {
|
|
1156
1365
|
EMOJI: "emoji",
|
|
1157
1366
|
TEXT: "text"
|
|
1158
1367
|
};
|
|
1159
1368
|
var csatQuestionSchema = questionSchema.extend({
|
|
1160
|
-
type:
|
|
1369
|
+
type: z4.literal("csat").describe("Must be exactly 'csat'"),
|
|
1161
1370
|
scale: csatScaleSchema.optional().default(5).describe(
|
|
1162
1371
|
"Number of response points (2\u20135); 2 and 4 have no neutral option, default is 5"
|
|
1163
1372
|
),
|
|
1164
1373
|
displayStyle: csatDisplayStyleSchema.optional().default("emoji").describe(
|
|
1165
1374
|
"How response options are rendered \u2014 emoji faces (default) or text buttons"
|
|
1166
1375
|
),
|
|
1167
|
-
multicolor:
|
|
1376
|
+
multicolor: z4.boolean().optional().default(false).describe(
|
|
1168
1377
|
"Whether to apply distinct colors to negative, neutral, and positive segments"
|
|
1169
1378
|
),
|
|
1170
|
-
negativeColor:
|
|
1379
|
+
negativeColor: z4.string().max(50).optional().describe(
|
|
1171
1380
|
"Color for negative response options (lower half of scale); any valid CSS color; used when multicolor is true"
|
|
1172
1381
|
),
|
|
1173
|
-
neutralColor:
|
|
1382
|
+
neutralColor: z4.string().max(50).optional().describe(
|
|
1174
1383
|
"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
1384
|
),
|
|
1176
|
-
positiveColor:
|
|
1385
|
+
positiveColor: z4.string().max(50).optional().describe(
|
|
1177
1386
|
"Color for positive response options (upper half of scale); any valid CSS color; used when multicolor is true"
|
|
1178
1387
|
),
|
|
1179
|
-
showLabels:
|
|
1388
|
+
showLabels: z4.boolean().optional().default(false).describe(
|
|
1180
1389
|
"Whether to render per-point labels below each response option"
|
|
1181
1390
|
),
|
|
1182
|
-
scaleLabels:
|
|
1391
|
+
scaleLabels: z4.record(z4.string(), z4.string().max(100)).optional().describe(
|
|
1183
1392
|
"Per-point label text keyed by value string ('1'\u2013'5'); keys must match the chosen scale size"
|
|
1184
1393
|
)
|
|
1185
1394
|
}).describe(
|
|
1186
1395
|
"Schema for a CSAT (Customer Satisfaction Score) question using an industry-standard 1-to-N positive scale (N = 2\u20135)"
|
|
1187
1396
|
);
|
|
1188
1397
|
var opinionScaleQuestionSchema = questionSchema.extend({
|
|
1189
|
-
type:
|
|
1190
|
-
startValue:
|
|
1191
|
-
steps:
|
|
1398
|
+
type: z4.literal("opinion_scale").describe("Must be exactly 'opinion_scale'"),
|
|
1399
|
+
startValue: z4.union([z4.literal(0), z4.literal(1)]).optional().default(0).describe("Starting value of the scale \u2014 0 (default) or 1"),
|
|
1400
|
+
steps: z4.number().int().min(5).max(11).optional().default(11).describe(
|
|
1192
1401
|
"Number of points on the scale (5\u201311); default 11 gives a 0\u201310 or 1\u201311 range depending on startValue"
|
|
1193
1402
|
),
|
|
1194
|
-
minLabel:
|
|
1403
|
+
minLabel: z4.string().max(100).optional().describe(
|
|
1195
1404
|
"Optional label anchoring the low end of the scale (e.g. 'Not at all likely')"
|
|
1196
1405
|
),
|
|
1197
|
-
maxLabel:
|
|
1406
|
+
maxLabel: z4.string().max(100).optional().describe(
|
|
1198
1407
|
"Optional label anchoring the high end of the scale (e.g. 'Extremely likely')"
|
|
1199
1408
|
)
|
|
1200
1409
|
}).describe(
|
|
1201
1410
|
"Schema for an opinion scale question \u2014 a horizontal numeric button scale with configurable range and optional end labels"
|
|
1202
1411
|
);
|
|
1203
|
-
var rankingDisplayStyleSchema =
|
|
1412
|
+
var rankingDisplayStyleSchema = z4.enum([
|
|
1204
1413
|
"drag_drop",
|
|
1205
1414
|
"dropdown",
|
|
1206
1415
|
"up_down"
|
|
@@ -1211,18 +1420,21 @@ var RankingDisplayStyles = {
|
|
|
1211
1420
|
UP_DOWN: "up_down"
|
|
1212
1421
|
};
|
|
1213
1422
|
var rankingQuestionSchema = questionSchema.extend({
|
|
1214
|
-
type:
|
|
1215
|
-
options:
|
|
1423
|
+
type: z4.literal("ranking").describe("Must be exactly 'ranking'"),
|
|
1424
|
+
options: z4.array(questionOptionSchema).min(2).max(30).describe(
|
|
1216
1425
|
"List of items to rank (2\u201330 items); each item supports an optional hint for clarification"
|
|
1217
1426
|
),
|
|
1218
|
-
randomizeOptions:
|
|
1427
|
+
randomizeOptions: z4.boolean().optional().default(false).describe(
|
|
1219
1428
|
"Whether to shuffle item order per respondent to avoid position bias"
|
|
1220
1429
|
),
|
|
1221
1430
|
displayStyle: rankingDisplayStyleSchema.optional().default("drag_drop").describe(
|
|
1222
1431
|
"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
1432
|
),
|
|
1224
|
-
maxRank:
|
|
1433
|
+
maxRank: z4.number().int().min(1).optional().describe(
|
|
1225
1434
|
"Maximum number of items the respondent must rank (e.g. 3 = 'rank your top 3'); when absent all items must be ranked"
|
|
1435
|
+
),
|
|
1436
|
+
prepopulatedValue: z4.array(z4.string()).optional().describe(
|
|
1437
|
+
"Default ranked order as option value strings (index 0 = rank 1)"
|
|
1226
1438
|
)
|
|
1227
1439
|
}).refine(
|
|
1228
1440
|
(data) => data.maxRank === void 0 || data.maxRank <= data.options.length,
|
|
@@ -1230,34 +1442,53 @@ var rankingQuestionSchema = questionSchema.extend({
|
|
|
1230
1442
|
message: "maxRank cannot exceed the number of options",
|
|
1231
1443
|
path: ["maxRank"]
|
|
1232
1444
|
}
|
|
1445
|
+
).refine(
|
|
1446
|
+
(data) => {
|
|
1447
|
+
if (!data.prepopulatedValue?.length) return true;
|
|
1448
|
+
const optionValues = new Set(data.options.map((o) => o.value));
|
|
1449
|
+
return data.prepopulatedValue.every((v) => optionValues.has(v));
|
|
1450
|
+
},
|
|
1451
|
+
{
|
|
1452
|
+
message: "Prepopulated value must use valid option values",
|
|
1453
|
+
path: ["prepopulatedValue"]
|
|
1454
|
+
}
|
|
1455
|
+
).refine(
|
|
1456
|
+
(data) => {
|
|
1457
|
+
if (!data.prepopulatedValue?.length || data.maxRank === void 0) return true;
|
|
1458
|
+
return data.prepopulatedValue.length <= data.maxRank;
|
|
1459
|
+
},
|
|
1460
|
+
{
|
|
1461
|
+
message: "Prepopulated value cannot exceed maxRank",
|
|
1462
|
+
path: ["prepopulatedValue"]
|
|
1463
|
+
}
|
|
1233
1464
|
).describe(
|
|
1234
1465
|
"Schema for a ranking question where respondents order items by preference"
|
|
1235
1466
|
);
|
|
1236
1467
|
var pictureChoiceQuestionSchema = questionSchema.extend({
|
|
1237
|
-
type:
|
|
1238
|
-
options:
|
|
1468
|
+
type: z4.literal("picture_choice").describe("Must be exactly 'picture_choice'"),
|
|
1469
|
+
options: z4.array(questionOptionSchema).min(1).max(50).describe(
|
|
1239
1470
|
"Array of options; each should include an imageUrl for the picture to display"
|
|
1240
1471
|
),
|
|
1241
|
-
multiple:
|
|
1472
|
+
multiple: z4.boolean().optional().default(false).describe(
|
|
1242
1473
|
"When true respondents may select more than one image; when false (default) only one image can be selected"
|
|
1243
1474
|
),
|
|
1244
|
-
minSelections:
|
|
1475
|
+
minSelections: z4.number().int().min(1).optional().describe(
|
|
1245
1476
|
"Minimum number of images the respondent must select (only applies when multiple is true)"
|
|
1246
1477
|
),
|
|
1247
|
-
maxSelections:
|
|
1478
|
+
maxSelections: z4.number().int().min(1).optional().describe(
|
|
1248
1479
|
"Maximum number of images the respondent may select (only applies when multiple is true)"
|
|
1249
1480
|
),
|
|
1250
|
-
supersize:
|
|
1251
|
-
showLabels:
|
|
1252
|
-
randomizeOptions:
|
|
1481
|
+
supersize: z4.boolean().optional().default(false).describe("Whether to display images at an enlarged size"),
|
|
1482
|
+
showLabels: z4.boolean().optional().default(true).describe("Whether to show the text label below each image"),
|
|
1483
|
+
randomizeOptions: z4.boolean().optional().default(false).describe(
|
|
1253
1484
|
"Whether to shuffle image order per respondent to avoid position bias"
|
|
1254
1485
|
),
|
|
1255
|
-
allowOther:
|
|
1256
|
-
otherTextConfig:
|
|
1257
|
-
minChars:
|
|
1258
|
-
maxChars:
|
|
1259
|
-
placeholder:
|
|
1260
|
-
showLimitIndicatorThreshold:
|
|
1486
|
+
allowOther: z4.boolean().optional().default(false).describe('Whether to include a free-text "other" option'),
|
|
1487
|
+
otherTextConfig: z4.object({
|
|
1488
|
+
minChars: z4.number().int().min(0).optional().describe("Minimum number of characters required for the other text"),
|
|
1489
|
+
maxChars: z4.number().int().min(1).optional().describe("Maximum number of characters allowed for the other text"),
|
|
1490
|
+
placeholder: z4.string().max(200).optional().describe("Placeholder text for the other text input"),
|
|
1491
|
+
showLimitIndicatorThreshold: z4.number().int().min(0).optional().describe(
|
|
1261
1492
|
"Show the character limit indicator once the user has typed this many characters; 0 = show immediately, absent = never show"
|
|
1262
1493
|
)
|
|
1263
1494
|
}).optional().describe('Configuration for the custom "other" text input')
|
|
@@ -1275,111 +1506,111 @@ var pictureChoiceQuestionSchema = questionSchema.extend({
|
|
|
1275
1506
|
).describe(
|
|
1276
1507
|
"Schema for a picture choice question where respondents select from image-based options"
|
|
1277
1508
|
);
|
|
1278
|
-
var signatureModeSchema =
|
|
1509
|
+
var signatureModeSchema = z4.enum(["type", "draw", "upload"]);
|
|
1279
1510
|
var SignatureModes = {
|
|
1280
1511
|
TYPE: "type",
|
|
1281
1512
|
DRAW: "draw",
|
|
1282
1513
|
UPLOAD: "upload"
|
|
1283
1514
|
};
|
|
1284
1515
|
var signatureQuestionSchema = questionSchema.extend({
|
|
1285
|
-
type:
|
|
1286
|
-
allowedModes:
|
|
1516
|
+
type: z4.literal("signature").describe("Must be exactly 'signature'"),
|
|
1517
|
+
allowedModes: z4.array(signatureModeSchema).min(1).optional().describe(
|
|
1287
1518
|
"Which signing methods the respondent can choose from (type, draw, upload); when absent all three are enabled"
|
|
1288
1519
|
),
|
|
1289
1520
|
defaultMode: signatureModeSchema.optional().describe(
|
|
1290
1521
|
"Which signing tab is pre-selected when the question is first shown; when absent the platform chooses"
|
|
1291
1522
|
),
|
|
1292
|
-
collectSignerEmail:
|
|
1523
|
+
collectSignerEmail: z4.boolean().optional().default(true).describe(
|
|
1293
1524
|
"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
1525
|
),
|
|
1295
|
-
signerEmailFieldId:
|
|
1526
|
+
signerEmailFieldId: z4.string().optional().describe(
|
|
1296
1527
|
"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
1528
|
),
|
|
1298
|
-
penColor:
|
|
1529
|
+
penColor: z4.string().max(50).optional().describe(
|
|
1299
1530
|
"Stroke color for the draw canvas; any valid CSS color; when absent the theme foreground color is used"
|
|
1300
1531
|
),
|
|
1301
|
-
penWidth:
|
|
1532
|
+
penWidth: z4.number().int().min(1).max(20).optional().describe(
|
|
1302
1533
|
"Pen stroke thickness in pixels for the draw canvas (1\u201320); when absent the renderer default (typically 2) is used"
|
|
1303
1534
|
),
|
|
1304
|
-
backgroundColor:
|
|
1535
|
+
backgroundColor: z4.string().max(50).optional().describe(
|
|
1305
1536
|
"Background color of the draw canvas; any valid CSS color; when absent the canvas is transparent and inherits the form background"
|
|
1306
1537
|
),
|
|
1307
|
-
canvasHeight:
|
|
1538
|
+
canvasHeight: z4.number().int().min(60).max(600).optional().describe(
|
|
1308
1539
|
"Draw canvas height in logical pixels (60\u2013600); width always fills the container; when absent the renderer chooses a sensible default (typically 200)"
|
|
1309
1540
|
),
|
|
1310
|
-
clearButtonLabel:
|
|
1541
|
+
clearButtonLabel: z4.string().max(50).optional().describe(
|
|
1311
1542
|
"Label for the clear/redo button in draw mode; when absent the platform default label or icon is shown"
|
|
1312
1543
|
),
|
|
1313
|
-
placeholder:
|
|
1544
|
+
placeholder: z4.string().max(200).optional().describe(
|
|
1314
1545
|
"Optional shared fallback copy for draw-canvas and upload-zone hints when their dedicated fields are unset"
|
|
1315
1546
|
),
|
|
1316
|
-
modeTabLabelType:
|
|
1547
|
+
modeTabLabelType: z4.string().max(80).optional().describe(
|
|
1317
1548
|
"Custom visible label for the Type tab; when absent only the tab icon is shown (use aria-label on the client)"
|
|
1318
1549
|
),
|
|
1319
|
-
modeTabLabelDraw:
|
|
1550
|
+
modeTabLabelDraw: z4.string().max(80).optional().describe(
|
|
1320
1551
|
"Custom visible label for the Draw tab; when absent only the tab icon is shown"
|
|
1321
1552
|
),
|
|
1322
|
-
modeTabLabelUpload:
|
|
1553
|
+
modeTabLabelUpload: z4.string().max(80).optional().describe(
|
|
1323
1554
|
"Custom visible label for the Upload tab; when absent only the tab icon is shown"
|
|
1324
1555
|
),
|
|
1325
|
-
drawCanvasHint:
|
|
1556
|
+
drawCanvasHint: z4.string().max(200).optional().describe(
|
|
1326
1557
|
"Hint shown on the empty draw canvas (e.g. 'Draw your signature here'); falls back to placeholder then platform default"
|
|
1327
1558
|
),
|
|
1328
|
-
uploadZonePrimary:
|
|
1559
|
+
uploadZonePrimary: z4.string().max(200).optional().describe(
|
|
1329
1560
|
"Main prompt on the upload drop zone when idle (e.g. click to upload); falls back to placeholder then default"
|
|
1330
1561
|
),
|
|
1331
|
-
uploadZoneDrag:
|
|
1562
|
+
uploadZoneDrag: z4.string().max(120).optional().describe(
|
|
1332
1563
|
"Short prompt when dragging a file over the upload zone; falls back to platform default"
|
|
1333
1564
|
)
|
|
1334
1565
|
}).describe(
|
|
1335
1566
|
"Schema for a signature question where respondents can type, draw, or upload their electronic signature"
|
|
1336
1567
|
);
|
|
1337
1568
|
var fileUploadQuestionSchema = questionSchema.extend({
|
|
1338
|
-
type:
|
|
1339
|
-
allowedFileTypes:
|
|
1569
|
+
type: z4.literal("file_upload").describe("Must be exactly 'file_upload'"),
|
|
1570
|
+
allowedFileTypes: z4.array(z4.string()).min(1).optional().describe(
|
|
1340
1571
|
"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
1572
|
),
|
|
1342
|
-
maxFileSizeMb:
|
|
1573
|
+
maxFileSizeMb: z4.number().int().min(1).max(100).optional().describe(
|
|
1343
1574
|
"Maximum size per uploaded file in megabytes (1\u2013100); when absent the platform enforces its own ceiling"
|
|
1344
1575
|
),
|
|
1345
|
-
multiple:
|
|
1576
|
+
multiple: z4.boolean().optional().default(false).describe(
|
|
1346
1577
|
"When true the respondent may upload more than one file in a single question; when false (default) only one file is accepted"
|
|
1347
1578
|
),
|
|
1348
|
-
maxFiles:
|
|
1579
|
+
maxFiles: z4.number().int().min(1).max(20).optional().describe(
|
|
1349
1580
|
"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
1581
|
),
|
|
1351
|
-
placeholder:
|
|
1582
|
+
placeholder: z4.string().max(200).optional().describe(
|
|
1352
1583
|
"Text shown inside the upload dropzone to guide respondents (e.g. 'Drop your CV here or click to browse')"
|
|
1353
1584
|
)
|
|
1354
1585
|
}).describe(
|
|
1355
1586
|
"Schema for a file upload question where respondents can attach one or more files from their device"
|
|
1356
1587
|
);
|
|
1357
1588
|
var emailQuestionSchema = questionSchema.extend({
|
|
1358
|
-
type:
|
|
1359
|
-
placeholder:
|
|
1360
|
-
prepopulatedValue:
|
|
1589
|
+
type: z4.literal("email").describe("Must be exactly 'email'"),
|
|
1590
|
+
placeholder: z4.string().max(200).optional().describe("Placeholder text shown inside the email input"),
|
|
1591
|
+
prepopulatedValue: z4.string().optional().describe(
|
|
1361
1592
|
"Default email address to pre-fill the input (e.g. passed via URL param or hidden field)"
|
|
1362
1593
|
)
|
|
1363
1594
|
}).describe(
|
|
1364
1595
|
"Schema for an email question that only accepts correctly formatted email addresses"
|
|
1365
1596
|
);
|
|
1366
1597
|
var numberQuestionSchema = questionSchema.extend({
|
|
1367
|
-
type:
|
|
1368
|
-
min:
|
|
1598
|
+
type: z4.literal("number").describe("Must be exactly 'number'"),
|
|
1599
|
+
min: z4.number().optional().describe(
|
|
1369
1600
|
"Minimum allowed value (inclusive); when absent no lower bound is enforced"
|
|
1370
1601
|
),
|
|
1371
|
-
max:
|
|
1602
|
+
max: z4.number().optional().describe(
|
|
1372
1603
|
"Maximum allowed value (inclusive); when absent no upper bound is enforced"
|
|
1373
1604
|
),
|
|
1374
|
-
allowDecimal:
|
|
1605
|
+
allowDecimal: z4.boolean().optional().default(false).describe(
|
|
1375
1606
|
"Whether decimal (non-integer) values are accepted; Typeform restricts to whole numbers only, making this a differentiator"
|
|
1376
1607
|
),
|
|
1377
|
-
allowNegative:
|
|
1608
|
+
allowNegative: z4.boolean().optional().default(false).describe(
|
|
1378
1609
|
"Whether negative values are accepted; Typeform restricts to positive numbers only, making this a differentiator"
|
|
1379
1610
|
),
|
|
1380
|
-
placeholder:
|
|
1381
|
-
prepopulatedValue:
|
|
1382
|
-
unit:
|
|
1611
|
+
placeholder: z4.string().max(200).optional().describe("Placeholder text shown inside the number input"),
|
|
1612
|
+
prepopulatedValue: z4.number().optional().describe("Default numeric value to pre-fill the input"),
|
|
1613
|
+
unit: z4.string().max(10).optional().describe(
|
|
1383
1614
|
"Unit label displayed beside the input (e.g. 'kg', '$', 'years')"
|
|
1384
1615
|
)
|
|
1385
1616
|
}).refine(
|
|
@@ -1392,39 +1623,39 @@ var numberQuestionSchema = questionSchema.extend({
|
|
|
1392
1623
|
"Schema for a number question that only accepts numeric input with configurable range and format constraints"
|
|
1393
1624
|
);
|
|
1394
1625
|
var websiteQuestionSchema = questionSchema.extend({
|
|
1395
|
-
type:
|
|
1396
|
-
placeholder:
|
|
1626
|
+
type: z4.literal("website").describe("Must be exactly 'website'"),
|
|
1627
|
+
placeholder: z4.string().max(200).optional().describe(
|
|
1397
1628
|
"Placeholder text shown inside the URL input (e.g. 'https://yoursite.com')"
|
|
1398
1629
|
),
|
|
1399
|
-
prepopulatedValue:
|
|
1630
|
+
prepopulatedValue: z4.string().optional().describe("Default URL to pre-fill the input")
|
|
1400
1631
|
}).describe(
|
|
1401
1632
|
"Schema for a website question that collects a URL with built-in format validation"
|
|
1402
1633
|
);
|
|
1403
1634
|
var phoneNumberQuestionSchema = questionSchema.extend({
|
|
1404
|
-
type:
|
|
1405
|
-
defaultCountryCode:
|
|
1635
|
+
type: z4.literal("phone_number").describe("Must be exactly 'phone_number'"),
|
|
1636
|
+
defaultCountryCode: z4.string().max(2).optional().describe(
|
|
1406
1637
|
"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
1638
|
),
|
|
1408
|
-
allowCountryChange:
|
|
1639
|
+
allowCountryChange: z4.boolean().optional().default(true).describe(
|
|
1409
1640
|
"Whether the respondent can change the country code; when false the default country is locked"
|
|
1410
1641
|
),
|
|
1411
|
-
placeholder:
|
|
1412
|
-
prepopulatedValue:
|
|
1642
|
+
placeholder: z4.string().max(200).optional().describe("Placeholder text shown inside the phone number input"),
|
|
1643
|
+
prepopulatedValue: z4.string().optional().describe(
|
|
1413
1644
|
"Default phone number to pre-fill the input; E.164 format recommended (e.g. '+14155552671')"
|
|
1414
1645
|
)
|
|
1415
1646
|
}).describe(
|
|
1416
1647
|
"Schema for a phone number question with country code picker and country-specific format validation"
|
|
1417
1648
|
);
|
|
1418
|
-
var addressSubFieldConfigSchema =
|
|
1419
|
-
enabled:
|
|
1420
|
-
required:
|
|
1421
|
-
placeholder:
|
|
1422
|
-
label:
|
|
1649
|
+
var addressSubFieldConfigSchema = z4.object({
|
|
1650
|
+
enabled: z4.boolean().default(true).describe("Whether this sub-field is shown in the question"),
|
|
1651
|
+
required: z4.boolean().default(false).describe("Whether the respondent must fill in this sub-field"),
|
|
1652
|
+
placeholder: z4.string().max(200).optional().describe("Placeholder text for this sub-field input"),
|
|
1653
|
+
label: z4.string().max(120).optional().describe(
|
|
1423
1654
|
"Visible caption above this sub-field; defaults to built-in copy when omitted"
|
|
1424
1655
|
)
|
|
1425
1656
|
}).describe("Configuration for an individual address sub-field");
|
|
1426
1657
|
var addressQuestionSchema = questionSchema.extend({
|
|
1427
|
-
type:
|
|
1658
|
+
type: z4.literal("address").describe("Must be exactly 'address'"),
|
|
1428
1659
|
addressLine1: addressSubFieldConfigSchema.optional().describe("Configuration for the primary street address line"),
|
|
1429
1660
|
addressLine2: addressSubFieldConfigSchema.optional().describe(
|
|
1430
1661
|
"Configuration for the secondary address line (apartment, suite, etc.); hidden by default"
|
|
@@ -1433,13 +1664,16 @@ var addressQuestionSchema = questionSchema.extend({
|
|
|
1433
1664
|
stateProvince: addressSubFieldConfigSchema.optional().describe("Configuration for the state, region, or province sub-field"),
|
|
1434
1665
|
postalCode: addressSubFieldConfigSchema.optional().describe("Configuration for the ZIP/postal code sub-field"),
|
|
1435
1666
|
country: addressSubFieldConfigSchema.optional().describe("Configuration for the country sub-field"),
|
|
1436
|
-
defaultCountry:
|
|
1667
|
+
defaultCountry: z4.string().max(2).optional().describe(
|
|
1437
1668
|
"ISO 3166-1 alpha-2 country code to pre-select in the country dropdown (e.g. 'US', 'GB')"
|
|
1669
|
+
),
|
|
1670
|
+
prepopulatedValue: AddressAnswerSchema.optional().describe(
|
|
1671
|
+
"Default address values to pre-fill the sub-fields"
|
|
1438
1672
|
)
|
|
1439
1673
|
}).describe(
|
|
1440
1674
|
"Schema for an address question that collects a full structured address on a single screen"
|
|
1441
1675
|
);
|
|
1442
|
-
var videoAudioModeSchema =
|
|
1676
|
+
var videoAudioModeSchema = z4.enum(["video", "audio", "photo", "text"]);
|
|
1443
1677
|
var VideoAudioModes = {
|
|
1444
1678
|
VIDEO: "video",
|
|
1445
1679
|
AUDIO: "audio",
|
|
@@ -1447,186 +1681,186 @@ var VideoAudioModes = {
|
|
|
1447
1681
|
TEXT: "text"
|
|
1448
1682
|
};
|
|
1449
1683
|
var videoAudioQuestionSchema = questionSchema.extend({
|
|
1450
|
-
type:
|
|
1451
|
-
allowedModes:
|
|
1684
|
+
type: z4.literal("video_audio").describe("Must be exactly 'video_audio'"),
|
|
1685
|
+
allowedModes: z4.array(videoAudioModeSchema).min(1).optional().describe(
|
|
1452
1686
|
"Which answer types the respondent can choose from (video, audio, photo, text); when absent all four are enabled"
|
|
1453
1687
|
),
|
|
1454
1688
|
defaultMode: videoAudioModeSchema.optional().describe(
|
|
1455
1689
|
"Which mode tab is pre-selected when the question opens; when absent the platform chooses"
|
|
1456
1690
|
),
|
|
1457
|
-
maxDurationSeconds:
|
|
1691
|
+
maxDurationSeconds: z4.number().int().min(5).max(600).optional().describe(
|
|
1458
1692
|
"Maximum recording length in seconds (5\u2013600); Typeform hardcodes 120s with no config, making this a differentiator; when absent the platform default applies"
|
|
1459
1693
|
),
|
|
1460
|
-
maxFileSizeMb:
|
|
1694
|
+
maxFileSizeMb: z4.number().int().min(1).max(500).optional().describe(
|
|
1461
1695
|
"Maximum size in megabytes for uploaded pre-recorded files (1\u2013500); when absent the platform ceiling applies"
|
|
1462
1696
|
),
|
|
1463
|
-
allowUpload:
|
|
1697
|
+
allowUpload: z4.boolean().optional().default(true).describe(
|
|
1464
1698
|
"Whether the respondent can upload a file in addition to recording or capturing live (video, audio, or photo)"
|
|
1465
1699
|
),
|
|
1466
|
-
placeholder:
|
|
1700
|
+
placeholder: z4.string().max(200).optional().describe(
|
|
1467
1701
|
"Instructional text shown to the respondent before they begin recording or capturing"
|
|
1468
1702
|
),
|
|
1469
|
-
modeTabLabelVideo:
|
|
1703
|
+
modeTabLabelVideo: z4.string().max(80).optional().describe(
|
|
1470
1704
|
"Custom tab label for video mode in the respondent UI; when absent defaults to 'Video'"
|
|
1471
1705
|
),
|
|
1472
|
-
modeTabLabelAudio:
|
|
1706
|
+
modeTabLabelAudio: z4.string().max(80).optional().describe(
|
|
1473
1707
|
"Custom tab label for audio mode; when absent defaults to 'Audio'"
|
|
1474
1708
|
),
|
|
1475
|
-
modeTabLabelPhoto:
|
|
1709
|
+
modeTabLabelPhoto: z4.string().max(80).optional().describe(
|
|
1476
1710
|
"Custom tab label for photo mode; when absent defaults to 'Photo'"
|
|
1477
1711
|
),
|
|
1478
|
-
modeTabLabelText:
|
|
1712
|
+
modeTabLabelText: z4.string().max(80).optional().describe(
|
|
1479
1713
|
"Custom tab label for text mode; when absent defaults to 'Text'"
|
|
1480
1714
|
),
|
|
1481
|
-
recordButtonLabel:
|
|
1482
|
-
uploadMediaButtonLabel:
|
|
1715
|
+
recordButtonLabel: z4.string().max(80).optional().describe("Label for the Record button in video/audio modes"),
|
|
1716
|
+
uploadMediaButtonLabel: z4.string().max(80).optional().describe(
|
|
1483
1717
|
"Label for the upload control in video/audio modes when uploads are allowed"
|
|
1484
1718
|
),
|
|
1485
|
-
videoIdleHint:
|
|
1719
|
+
videoIdleHint: z4.string().max(200).optional().describe(
|
|
1486
1720
|
"Hint shown over the video preview when idle; falls back to placeholder then built-in copy"
|
|
1487
1721
|
),
|
|
1488
|
-
photoEmptyHint:
|
|
1722
|
+
photoEmptyHint: z4.string().max(200).optional().describe(
|
|
1489
1723
|
"Hint in the empty photo preview area; falls back to placeholder then built-in copy"
|
|
1490
1724
|
),
|
|
1491
|
-
photoUseCameraButtonLabel:
|
|
1492
|
-
photoUploadImageButtonLabel:
|
|
1725
|
+
photoUseCameraButtonLabel: z4.string().max(80).optional().describe("Label for the Use camera button in photo mode"),
|
|
1726
|
+
photoUploadImageButtonLabel: z4.string().max(80).optional().describe("Label for the upload image button in photo mode")
|
|
1493
1727
|
}).describe(
|
|
1494
1728
|
"Schema for a video, audio, and photo question where respondents can record or upload media or enter a text answer"
|
|
1495
1729
|
);
|
|
1496
|
-
var schedulerProviderSchema =
|
|
1730
|
+
var schedulerProviderSchema = z4.enum(["google_calendar", "calendly"]);
|
|
1497
1731
|
var SchedulerProviders = {
|
|
1498
1732
|
GOOGLE_CALENDAR: "google_calendar",
|
|
1499
1733
|
CALENDLY: "calendly"
|
|
1500
1734
|
};
|
|
1501
1735
|
var schedulerQuestionSchema = questionSchema.extend({
|
|
1502
|
-
type:
|
|
1736
|
+
type: z4.literal("scheduler").describe("Must be exactly 'scheduler'"),
|
|
1503
1737
|
provider: schedulerProviderSchema.optional().describe(
|
|
1504
1738
|
"Which calendar integration to use (google_calendar or calendly); when absent the platform uses whatever is connected"
|
|
1505
1739
|
),
|
|
1506
|
-
calendarId:
|
|
1740
|
+
calendarId: z4.string().optional().describe(
|
|
1507
1741
|
"Specific Google Calendar ID or Calendly event-type URL/slug to book from; when absent the default calendar or event type is used"
|
|
1508
1742
|
),
|
|
1509
|
-
showIntroScreen:
|
|
1743
|
+
showIntroScreen: z4.boolean().optional().default(true).describe(
|
|
1510
1744
|
"Whether to show the Calendly event intro screen (account name, event name, duration) before the time picker; only applies when provider is 'calendly'"
|
|
1511
1745
|
),
|
|
1512
|
-
autofillNameFieldId:
|
|
1746
|
+
autofillNameFieldId: z4.string().optional().describe(
|
|
1513
1747
|
"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
1748
|
),
|
|
1515
|
-
autofillEmailFieldId:
|
|
1749
|
+
autofillEmailFieldId: z4.string().optional().describe(
|
|
1516
1750
|
"ID of a prior Email question whose answer is pre-filled into the Calendly booking email field; only applies when provider is 'calendly'"
|
|
1517
1751
|
),
|
|
1518
|
-
placeholder:
|
|
1752
|
+
placeholder: z4.string().max(200).optional().describe(
|
|
1519
1753
|
"Fallback text for the book-a-meeting button when scheduleMeetingLabel is unset; also used as a secondary fallback in the CTA copy chain"
|
|
1520
1754
|
),
|
|
1521
|
-
scheduleMeetingLabel:
|
|
1755
|
+
scheduleMeetingLabel: z4.string().max(200).optional().describe(
|
|
1522
1756
|
"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
1757
|
)
|
|
1524
1758
|
}).describe(
|
|
1525
1759
|
"Schema for a scheduler question where respondents book a time slot directly within the form via Google Calendar or Calendly"
|
|
1526
1760
|
);
|
|
1527
1761
|
var qnaWithAiQuestionSchema = questionSchema.extend({
|
|
1528
|
-
type:
|
|
1529
|
-
knowledgeBase:
|
|
1762
|
+
type: z4.literal("qna_with_ai").describe("Must be exactly 'qna_with_ai'"),
|
|
1763
|
+
knowledgeBase: z4.string().max(2e4).describe(
|
|
1530
1764
|
"The knowledge base content the AI draws from when answering respondent questions; Markdown formatting is recommended; up to 20,000 characters"
|
|
1531
1765
|
),
|
|
1532
|
-
maxResponseLength:
|
|
1766
|
+
maxResponseLength: z4.number().int().min(50).max(2e3).optional().describe(
|
|
1533
1767
|
"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
1768
|
),
|
|
1535
|
-
maxQaPairs:
|
|
1769
|
+
maxQaPairs: z4.number().int().min(1).max(100).optional().describe(
|
|
1536
1770
|
"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
1771
|
),
|
|
1538
|
-
placeholder:
|
|
1772
|
+
placeholder: z4.string().max(200).optional().describe(
|
|
1539
1773
|
"Hint text shown in the respondent's question input field (e.g. 'Ask me anything about this event...')"
|
|
1540
1774
|
),
|
|
1541
|
-
askButtonLabel:
|
|
1775
|
+
askButtonLabel: z4.string().max(50).optional().describe(
|
|
1542
1776
|
"Label for the submit/ask button; when absent the platform default (e.g. 'Ask AI') is shown"
|
|
1543
1777
|
),
|
|
1544
|
-
emptyStateHint:
|
|
1778
|
+
emptyStateHint: z4.string().max(200).optional().describe(
|
|
1545
1779
|
"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
1780
|
),
|
|
1547
|
-
pairsRemainingTemplate:
|
|
1781
|
+
pairsRemainingTemplate: z4.string().max(160).optional().describe(
|
|
1548
1782
|
"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
1783
|
),
|
|
1550
|
-
pairsLimitReachedTemplate:
|
|
1784
|
+
pairsLimitReachedTemplate: z4.string().max(160).optional().describe(
|
|
1551
1785
|
"Counter when the exchange limit is reached; use token {max}; when absent the client uses built-in English with pluralization"
|
|
1552
1786
|
)
|
|
1553
1787
|
}).describe(
|
|
1554
1788
|
"Schema for a Q&A with AI question where respondents ask questions and receive AI-generated answers drawn from a configurable knowledge base"
|
|
1555
1789
|
);
|
|
1556
|
-
var paymentsUpiAmountConfigSchema =
|
|
1557
|
-
|
|
1558
|
-
mode:
|
|
1559
|
-
amount:
|
|
1790
|
+
var paymentsUpiAmountConfigSchema = z4.discriminatedUnion("mode", [
|
|
1791
|
+
z4.object({
|
|
1792
|
+
mode: z4.literal("fixed").describe("A fixed amount configured by the form builder"),
|
|
1793
|
+
amount: z4.number().positive().describe("Fixed amount to request in INR")
|
|
1560
1794
|
}),
|
|
1561
|
-
|
|
1562
|
-
mode:
|
|
1563
|
-
minAmount:
|
|
1564
|
-
maxAmount:
|
|
1565
|
-
defaultAmount:
|
|
1795
|
+
z4.object({
|
|
1796
|
+
mode: z4.literal("range").describe("Respondent enters an amount within the configured range"),
|
|
1797
|
+
minAmount: z4.number().positive().describe("Minimum allowed amount in INR"),
|
|
1798
|
+
maxAmount: z4.number().positive().describe("Maximum allowed amount in INR"),
|
|
1799
|
+
defaultAmount: z4.number().positive().optional().describe("Optional initial amount shown to the respondent")
|
|
1566
1800
|
}),
|
|
1567
|
-
|
|
1568
|
-
mode:
|
|
1569
|
-
sources:
|
|
1570
|
-
|
|
1571
|
-
sourceQuestionId:
|
|
1801
|
+
z4.object({
|
|
1802
|
+
mode: z4.literal("question_mappings").describe("Amount is summed from one or more previous question answers"),
|
|
1803
|
+
sources: z4.array(
|
|
1804
|
+
z4.object({
|
|
1805
|
+
sourceQuestionId: z4.string().describe(
|
|
1572
1806
|
"ID of the prior question whose answer contributes to the amount"
|
|
1573
1807
|
),
|
|
1574
|
-
mappings:
|
|
1575
|
-
|
|
1576
|
-
answerValue:
|
|
1577
|
-
amount:
|
|
1808
|
+
mappings: z4.array(
|
|
1809
|
+
z4.object({
|
|
1810
|
+
answerValue: z4.string().describe("Previous question answer value to match"),
|
|
1811
|
+
amount: z4.number().nonnegative().describe(
|
|
1578
1812
|
"Amount to add in INR when this answer is selected"
|
|
1579
1813
|
),
|
|
1580
|
-
label:
|
|
1814
|
+
label: z4.string().max(120).optional().describe("Optional display label for this mapped amount")
|
|
1581
1815
|
})
|
|
1582
1816
|
).min(1).describe("Answer-to-amount mappings for this source question")
|
|
1583
1817
|
})
|
|
1584
1818
|
).min(1).describe("Previous question sources that contribute to the amount"),
|
|
1585
|
-
fallbackAmount:
|
|
1819
|
+
fallbackAmount: z4.number().nonnegative().optional().describe("Optional amount to use when no source mapping matches")
|
|
1586
1820
|
})
|
|
1587
1821
|
]).superRefine((data, ctx) => {
|
|
1588
1822
|
if (data.mode !== "range") return;
|
|
1589
1823
|
if (data.minAmount > data.maxAmount) {
|
|
1590
1824
|
ctx.addIssue({
|
|
1591
|
-
code:
|
|
1825
|
+
code: z4.ZodIssueCode.custom,
|
|
1592
1826
|
message: "minAmount cannot be greater than maxAmount",
|
|
1593
1827
|
path: ["minAmount"]
|
|
1594
1828
|
});
|
|
1595
1829
|
}
|
|
1596
1830
|
if (data.defaultAmount !== void 0 && (data.defaultAmount < data.minAmount || data.defaultAmount > data.maxAmount)) {
|
|
1597
1831
|
ctx.addIssue({
|
|
1598
|
-
code:
|
|
1832
|
+
code: z4.ZodIssueCode.custom,
|
|
1599
1833
|
message: "defaultAmount must be within minAmount and maxAmount",
|
|
1600
1834
|
path: ["defaultAmount"]
|
|
1601
1835
|
});
|
|
1602
1836
|
}
|
|
1603
1837
|
}).describe("Amount configuration for a payments_upi question");
|
|
1604
1838
|
var paymentsUpiQuestionSchema = questionSchema.extend({
|
|
1605
|
-
type:
|
|
1606
|
-
payeeVpa:
|
|
1839
|
+
type: z4.literal("payments_upi").describe("Must be exactly 'payments_upi'"),
|
|
1840
|
+
payeeVpa: z4.string().min(3).max(255).regex(
|
|
1607
1841
|
/^[\w.\-]+@[\w.\-]+$/,
|
|
1608
1842
|
"payeeVpa must be a valid UPI VPA such as merchant@bank"
|
|
1609
1843
|
).describe("UPI virtual payment address that receives the payment"),
|
|
1610
|
-
payeeName:
|
|
1844
|
+
payeeName: z4.string().max(100).optional().describe("Display name for the UPI payee"),
|
|
1611
1845
|
amount: paymentsUpiAmountConfigSchema.describe(
|
|
1612
1846
|
"How the requested INR amount is determined"
|
|
1613
1847
|
),
|
|
1614
|
-
sourceEmailQuestionId:
|
|
1848
|
+
sourceEmailQuestionId: z4.string().optional().describe(
|
|
1615
1849
|
"Optional ID of the email question whose answer is used for form submission receipt emails"
|
|
1616
1850
|
),
|
|
1617
|
-
transactionNote:
|
|
1851
|
+
transactionNote: z4.string().max(80).optional().describe(
|
|
1618
1852
|
"Short note included in the UPI intent; the platform may append the Encatch reference"
|
|
1619
1853
|
),
|
|
1620
|
-
transactionReferencePrefix:
|
|
1621
|
-
qrLabel:
|
|
1622
|
-
openUpiAppLabel:
|
|
1623
|
-
copyUpiIdLabel:
|
|
1624
|
-
transactionIdLabel:
|
|
1625
|
-
transactionIdPlaceholder:
|
|
1854
|
+
transactionReferencePrefix: z4.string().max(24).optional().describe("Optional prefix for generated Encatch payment references"),
|
|
1855
|
+
qrLabel: z4.string().max(100).optional().describe("Label shown above the UPI QR code"),
|
|
1856
|
+
openUpiAppLabel: z4.string().max(80).optional().describe("Label for the mobile UPI intent button"),
|
|
1857
|
+
copyUpiIdLabel: z4.string().max(80).optional().describe("Label for the copy UPI ID button"),
|
|
1858
|
+
transactionIdLabel: z4.string().max(100).optional().describe("Label for the self-reported transaction ID / UTR input"),
|
|
1859
|
+
transactionIdPlaceholder: z4.string().max(120).optional().describe("Placeholder for the transaction ID / UTR input")
|
|
1626
1860
|
}).describe(
|
|
1627
1861
|
"Schema for a self-reported UPI payment question that renders a UPI QR/intent link and collects the respondent-entered transaction ID"
|
|
1628
1862
|
);
|
|
1629
|
-
var combinedQuestionSchema =
|
|
1863
|
+
var combinedQuestionSchema = z4.discriminatedUnion("type", [
|
|
1630
1864
|
ratingQuestionSchema,
|
|
1631
1865
|
annotationQuestionSchema,
|
|
1632
1866
|
welcomeQuestionSchema,
|
|
@@ -1662,215 +1896,6 @@ var combinedQuestionSchema = z3.discriminatedUnion("type", [
|
|
|
1662
1896
|
paymentsUpiQuestionSchema
|
|
1663
1897
|
]);
|
|
1664
1898
|
|
|
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
1899
|
// src/schemas/fields/form-schema.ts
|
|
1875
1900
|
import { z as z5 } from "zod";
|
|
1876
1901
|
var externalPublishingPropertiesSchema = z5.object({
|
|
@@ -2336,8 +2361,10 @@ var formConfigSchema = z13.object({
|
|
|
2336
2361
|
}).describe("Configuration information for the feedback form");
|
|
2337
2362
|
var questionResponseSchema = z13.object({
|
|
2338
2363
|
questionId: z13.string().uuid().describe("Unique identifier for the question"),
|
|
2339
|
-
answer: AnswerSchema.describe(
|
|
2340
|
-
|
|
2364
|
+
answer: AnswerSchema.nullable().optional().describe(
|
|
2365
|
+
"The answer provided for this question; null for display-only types (thank_you, welcome, exit_form) or unanswered questions on the respondent's path"
|
|
2366
|
+
),
|
|
2367
|
+
type: z13.string().optional().describe("Type of the question (e.g., 'rating', 'single_choice')"),
|
|
2341
2368
|
error: z13.string().optional().describe("Error message if any validation failed"),
|
|
2342
2369
|
isOnPath: z13.boolean().optional().describe(
|
|
2343
2370
|
"When present, whether this question was on the respondent's navigation path (e.g. logic jumps); false for questions not reached"
|
|
@@ -2380,6 +2407,26 @@ var submitFeedbackSchema = baseSubmitFeedbackSchema.extend({
|
|
|
2380
2407
|
response: responseSchema.describe("User responses (required for full submit)")
|
|
2381
2408
|
}).describe("Full submit feedback request schema (response required)");
|
|
2382
2409
|
var feedbackRequestSchema = z13.union([partialFeedbackSchema, submitFeedbackSchema]).describe("Union schema for both partial and full feedback submissions");
|
|
2410
|
+
var formDetailsSchema = z13.object({
|
|
2411
|
+
formConfigurationId: z13.string().uuid().describe("Server-issued configuration ID for this form"),
|
|
2412
|
+
feedbackIdentifier: z13.string().optional().describe("Instance identifier for the feedback session"),
|
|
2413
|
+
responseLanguageCode: z13.string().optional().describe("Two-letter language code for the response (e.g., 'en')"),
|
|
2414
|
+
isPartialSubmit: z13.boolean().optional().describe("When true, marks this as a partial (mid-journey) submission"),
|
|
2415
|
+
completionTimeInSeconds: z13.number().int().min(0).optional().describe("Total time taken to complete the form in seconds"),
|
|
2416
|
+
response: z13.object({
|
|
2417
|
+
questions: z13.array(questionResponseSchema).optional().describe("Array of per-question responses"),
|
|
2418
|
+
context: z13.record(z13.string(), z13.unknown()).optional().describe("Liquid variable substitution values from the showForm context option"),
|
|
2419
|
+
contact: z13.record(z13.string(), z13.unknown()).optional().describe("Contact properties from the server for Liquid substitution"),
|
|
2420
|
+
sourceTrackingFieldValues: z13.record(z13.string(), z13.string()).optional().describe("Source tracking field values captured at survey load time")
|
|
2421
|
+
}).optional().describe("User responses to the form questions"),
|
|
2422
|
+
visitedQuestionIds: z13.array(z13.string()).optional().describe("Ordered list of question IDs the respondent actually navigated to"),
|
|
2423
|
+
context: z13.record(z13.string(), z13.union([z13.string(), z13.number(), z13.boolean()])).optional().describe("Caller-provided metadata attached to this submission")
|
|
2424
|
+
}).describe("Form details for an SDK-style submit-form request");
|
|
2425
|
+
var submitFormRequestSchema = z13.object({
|
|
2426
|
+
triggerType: z13.enum(["automatic", "manual"]).optional().describe("Whether the form was triggered automatically or manually"),
|
|
2427
|
+
formDetails: formDetailsSchema.describe("Core submission payload"),
|
|
2428
|
+
$deviceInfo: z13.record(z13.string(), z13.unknown()).optional().describe("Device and SDK metadata automatically injected by the SDK")
|
|
2429
|
+
}).describe("Complete submit-form request envelope (SDK-facing contract)");
|
|
2383
2430
|
|
|
2384
2431
|
// src/schemas/api/fetch-feedback-schema.ts
|
|
2385
2432
|
import { z as z14 } from "zod";
|
|
@@ -2724,6 +2771,7 @@ export {
|
|
|
2724
2771
|
focalPointSchema,
|
|
2725
2772
|
formConfigSchema,
|
|
2726
2773
|
formConfigurationResponseSchema,
|
|
2774
|
+
formDetailsSchema,
|
|
2727
2775
|
formPropertiesSchema,
|
|
2728
2776
|
gradientAttachmentSchema,
|
|
2729
2777
|
imageAttachmentSchema,
|
|
@@ -2815,6 +2863,7 @@ export {
|
|
|
2815
2863
|
splitLayoutSchema,
|
|
2816
2864
|
stackLayoutSchema,
|
|
2817
2865
|
submitFeedbackSchema,
|
|
2866
|
+
submitFormRequestSchema,
|
|
2818
2867
|
thankYouQuestionSchema,
|
|
2819
2868
|
thankYouQuestionTranslationSchema,
|
|
2820
2869
|
themeColorsSchema,
|