@encatch/schema 0.1.16 → 0.1.19
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 +344 -108
- package/dist/esm/index.js.map +4 -4
- package/dist/types/index.d.ts +5 -2
- package/dist/types/schemas/api/feedback-actions-schema.d.ts +0 -0
- package/dist/types/schemas/api/feedback-fetch-schema.d.ts +0 -0
- package/dist/types/schemas/api/fetch-feedback-schema.d.ts +1354 -0
- package/dist/types/schemas/api/other-schema.d.ts +68 -0
- package/dist/types/schemas/api/submit-feedback-schema.d.ts +381 -0
- package/dist/types/schemas/fields/field-schema.d.ts +2 -0
- package/dist/types/schemas/fields/form-properties-schema.d.ts +53 -211
- package/dist/types/schemas/fields/form-schema.d.ts +5 -0
- package/dist/types/schemas/fields/translations-schema.d.ts +276 -835
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -325,7 +325,8 @@ var longAnswerQuestionSchema = questionSchema.extend({
|
|
|
325
325
|
maxEnhancements: z.number().int().min(1).max(10).optional().describe("Maximum number of AI enhancements allowed"),
|
|
326
326
|
maxTokenAllowed: z.number().int().min(1).max(25e3).optional().describe(
|
|
327
327
|
"Maximum tokens allowed for AI processing (higher for long text)"
|
|
328
|
-
)
|
|
328
|
+
),
|
|
329
|
+
minCharactersToEnhance: z.number().int().min(1).optional().describe("Minimum characters needed to trigger AI enhancement")
|
|
329
330
|
}).refine(
|
|
330
331
|
(data) => {
|
|
331
332
|
if (data.minCharacters !== void 0 && data.maxCharacters !== void 0) {
|
|
@@ -550,124 +551,146 @@ var PublicationStatuses = {
|
|
|
550
551
|
DRAFT: "D",
|
|
551
552
|
ARCHIVED: "A"
|
|
552
553
|
};
|
|
554
|
+
var durationSchema = z3.object({
|
|
555
|
+
from: z3.string().describe("Start date and time for the duration (ISO format or custom format)"),
|
|
556
|
+
to: z3.string().describe("End date and time for the duration (ISO format or custom format)")
|
|
557
|
+
}).describe("Duration range for when something is active");
|
|
553
558
|
var feedbackConfigurationSchema = z3.object({
|
|
554
559
|
form_title: z3.string().describe("Title of the feedback form"),
|
|
555
560
|
form_description: z3.string().describe("Description of the feedback form"),
|
|
556
|
-
duration:
|
|
557
|
-
|
|
558
|
-
/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(\+|\-)\d{2}:\d{2}
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
561
|
+
duration: durationSchema.refine(
|
|
562
|
+
(data) => {
|
|
563
|
+
const isoRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(\+|\-)\d{2}:\d{2}$/;
|
|
564
|
+
return isoRegex.test(data.from) && isoRegex.test(data.to);
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
message: "Duration dates must be in valid ISO format with timezone",
|
|
568
|
+
path: ["from"]
|
|
569
|
+
}
|
|
570
|
+
).refine(
|
|
571
|
+
(data) => {
|
|
572
|
+
const start = new Date(data.from);
|
|
573
|
+
const end = new Date(data.to);
|
|
574
|
+
return end > start;
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
message: "End date must be after start date",
|
|
578
|
+
path: ["to"]
|
|
579
|
+
}
|
|
580
|
+
).describe("Duration period for the feedback"),
|
|
566
581
|
is_published: publicationStatusSchema.describe("Publication status of the feedback form")
|
|
567
|
-
}).
|
|
568
|
-
(data) => {
|
|
569
|
-
const start = new Date(data.duration.from);
|
|
570
|
-
const end = new Date(data.duration.to);
|
|
571
|
-
return end > start;
|
|
572
|
-
},
|
|
573
|
-
{
|
|
574
|
-
message: "End date must be after start date",
|
|
575
|
-
path: ["duration", "to"]
|
|
576
|
-
}
|
|
577
|
-
).describe("Schema defining feedback configuration properties");
|
|
582
|
+
}).describe("Schema defining feedback configuration properties");
|
|
578
583
|
|
|
579
584
|
// src/schemas/fields/form-properties-schema.ts
|
|
580
585
|
import { z as z8 } from "zod";
|
|
581
586
|
|
|
582
587
|
// src/schemas/fields/translations-schema.ts
|
|
583
588
|
import { z as z4 } from "zod";
|
|
584
|
-
var translationEntrySchema = z4.
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
}).describe("Translation entry with translated text");
|
|
588
|
-
var ratingTranslationsSchema = z4.object({
|
|
589
|
+
var translationEntrySchema = z4.string().min(1).describe("Translated text content");
|
|
590
|
+
var ratingQuestionTranslationSchema = z4.object({
|
|
591
|
+
type: z4.literal("rating").describe("Question type identifier"),
|
|
589
592
|
title: translationEntrySchema.describe("Question title translation"),
|
|
590
593
|
description: translationEntrySchema.optional().describe("Question description translation"),
|
|
591
594
|
errorMessage: translationEntrySchema.optional().describe("Error message translation"),
|
|
592
595
|
minLabel: translationEntrySchema.optional().describe("Minimum rating label translation"),
|
|
593
596
|
maxLabel: translationEntrySchema.optional().describe("Maximum rating label translation")
|
|
594
597
|
}).describe("Translation schema for rating questions");
|
|
595
|
-
var
|
|
598
|
+
var singleChoiceQuestionTranslationSchema = z4.object({
|
|
599
|
+
type: z4.literal("single_choice").describe("Question type identifier"),
|
|
596
600
|
title: translationEntrySchema.describe("Question title translation"),
|
|
597
601
|
description: translationEntrySchema.optional().describe("Question description translation"),
|
|
598
602
|
errorMessage: translationEntrySchema.optional().describe("Error message translation"),
|
|
599
|
-
placeholder: translationEntrySchema.optional().describe("Input placeholder translation")
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
603
|
+
placeholder: translationEntrySchema.optional().describe("Input placeholder translation")
|
|
604
|
+
}).catchall(translationEntrySchema).refine((data) => {
|
|
605
|
+
const additionalKeys = Object.keys(data).filter(
|
|
606
|
+
(key) => !["type", "title", "description", "errorMessage", "placeholder"].includes(key)
|
|
607
|
+
);
|
|
608
|
+
return additionalKeys.every((key) => /^option\..+\.(label|value)$/.test(key));
|
|
609
|
+
}, {
|
|
610
|
+
message: "Additional keys must follow the pattern 'option.{id}.{label|value}'"
|
|
604
611
|
}).describe("Translation schema for single choice questions");
|
|
605
|
-
var
|
|
612
|
+
var multipleChoiceQuestionTranslationSchema = z4.object({
|
|
613
|
+
type: z4.literal("multiple_choice_multiple").describe("Question type identifier"),
|
|
606
614
|
title: translationEntrySchema.describe("Question title translation"),
|
|
607
615
|
description: translationEntrySchema.optional().describe("Question description translation"),
|
|
608
616
|
errorMessage: translationEntrySchema.optional().describe("Error message translation"),
|
|
609
|
-
placeholder: translationEntrySchema.optional().describe("Input placeholder translation")
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
617
|
+
placeholder: translationEntrySchema.optional().describe("Input placeholder translation")
|
|
618
|
+
}).catchall(translationEntrySchema).refine((data) => {
|
|
619
|
+
const additionalKeys = Object.keys(data).filter(
|
|
620
|
+
(key) => !["type", "title", "description", "errorMessage", "placeholder"].includes(key)
|
|
621
|
+
);
|
|
622
|
+
return additionalKeys.every((key) => /^option\..+\.(label|value)$/.test(key));
|
|
623
|
+
}, {
|
|
624
|
+
message: "Additional keys must follow the pattern 'option.{id}.{label|value}'"
|
|
614
625
|
}).describe("Translation schema for multiple choice questions");
|
|
615
|
-
var
|
|
626
|
+
var npsQuestionTranslationSchema = z4.object({
|
|
627
|
+
type: z4.literal("nps").describe("Question type identifier"),
|
|
616
628
|
title: translationEntrySchema.describe("Question title translation"),
|
|
617
629
|
description: translationEntrySchema.optional().describe("Question description translation"),
|
|
618
630
|
errorMessage: translationEntrySchema.optional().describe("Error message translation"),
|
|
619
631
|
minLabel: translationEntrySchema.optional().describe("Minimum NPS label (0) translation"),
|
|
620
|
-
maxLabel: translationEntrySchema.optional().describe("Maximum NPS label (10) translation")
|
|
621
|
-
|
|
632
|
+
maxLabel: translationEntrySchema.optional().describe("Maximum NPS label (10) translation")
|
|
633
|
+
}).catchall(translationEntrySchema).refine((data) => {
|
|
634
|
+
const additionalKeys = Object.keys(data).filter(
|
|
635
|
+
(key) => !["type", "title", "description", "errorMessage", "minLabel", "maxLabel"].includes(key)
|
|
636
|
+
);
|
|
637
|
+
return additionalKeys.every((key) => /^scaleLabel\.\d+$/.test(key));
|
|
638
|
+
}, {
|
|
639
|
+
message: "Additional keys must follow the pattern 'scaleLabel.{number}'"
|
|
622
640
|
}).describe("Translation schema for NPS questions");
|
|
623
|
-
var
|
|
641
|
+
var shortAnswerQuestionTranslationSchema = z4.object({
|
|
642
|
+
type: z4.literal("short_answer").describe("Question type identifier"),
|
|
624
643
|
title: translationEntrySchema.describe("Question title translation"),
|
|
625
644
|
description: translationEntrySchema.optional().describe("Question description translation"),
|
|
626
645
|
errorMessage: translationEntrySchema.optional().describe("Error message translation"),
|
|
627
646
|
placeholder: translationEntrySchema.optional().describe("Input placeholder translation")
|
|
628
647
|
}).describe("Translation schema for short answer questions");
|
|
629
|
-
var
|
|
648
|
+
var longAnswerQuestionTranslationSchema = z4.object({
|
|
649
|
+
type: z4.literal("long_text").describe("Question type identifier"),
|
|
630
650
|
title: translationEntrySchema.describe("Question title translation"),
|
|
631
651
|
description: translationEntrySchema.optional().describe("Question description translation"),
|
|
632
652
|
errorMessage: translationEntrySchema.optional().describe("Error message translation"),
|
|
633
653
|
placeholder: translationEntrySchema.optional().describe("Textarea placeholder translation")
|
|
634
654
|
}).describe("Translation schema for long answer questions");
|
|
635
|
-
var
|
|
655
|
+
var nestedSelectionQuestionTranslationSchema = z4.object({
|
|
656
|
+
type: z4.literal("nested_selection").describe("Question type identifier"),
|
|
636
657
|
title: translationEntrySchema.describe("Question title translation"),
|
|
637
658
|
description: translationEntrySchema.optional().describe("Question description translation"),
|
|
638
659
|
errorMessage: translationEntrySchema.optional().describe("Error message translation"),
|
|
639
|
-
placeholder: translationEntrySchema.optional().describe("Dropdown placeholder translation")
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
660
|
+
placeholder: translationEntrySchema.optional().describe("Dropdown placeholder translation")
|
|
661
|
+
}).catchall(translationEntrySchema).refine((data) => {
|
|
662
|
+
const additionalKeys = Object.keys(data).filter(
|
|
663
|
+
(key) => !["type", "title", "description", "errorMessage", "placeholder"].includes(key)
|
|
664
|
+
);
|
|
665
|
+
return additionalKeys.every((key) => /^nestedOption\..+\.(label|hint)$/.test(key));
|
|
666
|
+
}, {
|
|
667
|
+
message: "Additional keys must follow the pattern 'nestedOption.{id}.{label|hint}'"
|
|
644
668
|
}).describe("Translation schema for nested selection questions");
|
|
645
|
-
var
|
|
669
|
+
var annotationQuestionTranslationSchema = z4.object({
|
|
670
|
+
type: z4.literal("annotation").describe("Question type identifier"),
|
|
646
671
|
title: translationEntrySchema.describe("Question title translation"),
|
|
647
672
|
description: translationEntrySchema.optional().describe("Question description translation"),
|
|
648
673
|
errorMessage: translationEntrySchema.optional().describe("Error message translation"),
|
|
649
674
|
annotationText: translationEntrySchema.optional().describe("Annotation display text translation"),
|
|
650
675
|
noAnnotationText: translationEntrySchema.optional().describe("No annotation display text translation")
|
|
651
676
|
}).describe("Translation schema for annotation questions");
|
|
652
|
-
var
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
]).describe("
|
|
662
|
-
var
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
}).describe("Language-specific translation set keyed by question IDs");
|
|
677
|
+
var questionTranslationSchema = z4.union([
|
|
678
|
+
ratingQuestionTranslationSchema,
|
|
679
|
+
singleChoiceQuestionTranslationSchema,
|
|
680
|
+
multipleChoiceQuestionTranslationSchema,
|
|
681
|
+
npsQuestionTranslationSchema,
|
|
682
|
+
shortAnswerQuestionTranslationSchema,
|
|
683
|
+
longAnswerQuestionTranslationSchema,
|
|
684
|
+
nestedSelectionQuestionTranslationSchema,
|
|
685
|
+
annotationQuestionTranslationSchema
|
|
686
|
+
]).describe("Union of all question type translation schemas");
|
|
687
|
+
var languageCodeSchema = z4.string().min(2).max(10).describe("Language code (e.g., 'en', 'es', 'hi')");
|
|
688
|
+
var questionTranslationsByLanguageSchema = z4.record(languageCodeSchema, questionTranslationSchema).describe("Question translations keyed by language code");
|
|
689
|
+
var questionCentricTranslationsSchema = z4.record(z4.string().uuid(), questionTranslationsByLanguageSchema).describe("Question-centric translations keyed by question ID, then by language code");
|
|
666
690
|
var translationsSchema = z4.object({
|
|
667
691
|
defaultLanguage: z4.string().describe("Default/fallback language code"),
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
}).describe("Complete translation schema keyed by question IDs");
|
|
692
|
+
questions: questionCentricTranslationsSchema.describe("Question-centric translations")
|
|
693
|
+
}).describe("Complete question-centric translation schema");
|
|
671
694
|
var _TranslationProvider = class _TranslationProvider {
|
|
672
695
|
constructor(translations) {
|
|
673
696
|
this.translations = translations;
|
|
@@ -676,48 +699,59 @@ var _TranslationProvider = class _TranslationProvider {
|
|
|
676
699
|
* Get translations for a specific question in a specific language
|
|
677
700
|
*/
|
|
678
701
|
getQuestionTranslations(questionId, languageCode) {
|
|
679
|
-
const
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
if (!
|
|
683
|
-
|
|
684
|
-
(lang) => lang.languageCode === this.translations.defaultLanguage
|
|
685
|
-
);
|
|
686
|
-
if (!defaultLang) return null;
|
|
687
|
-
return defaultLang.questions[questionId] || null;
|
|
702
|
+
const questionTranslations = this.translations.questions[questionId];
|
|
703
|
+
if (!questionTranslations) return null;
|
|
704
|
+
let translation = questionTranslations[languageCode];
|
|
705
|
+
if (!translation) {
|
|
706
|
+
translation = questionTranslations[this.translations.defaultLanguage];
|
|
688
707
|
}
|
|
689
|
-
return
|
|
708
|
+
return translation || null;
|
|
690
709
|
}
|
|
691
710
|
/**
|
|
692
|
-
* Get a specific translation text
|
|
711
|
+
* Get a specific translation text by field path
|
|
693
712
|
*/
|
|
694
|
-
getTranslationText(questionId, languageCode,
|
|
695
|
-
const
|
|
696
|
-
if (!
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
current = current[key];
|
|
701
|
-
} else {
|
|
702
|
-
return null;
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
if (current && typeof current === "object" && "text" in current) {
|
|
706
|
-
return current.text;
|
|
713
|
+
getTranslationText(questionId, languageCode, fieldPath) {
|
|
714
|
+
const questionTranslation = this.getQuestionTranslations(questionId, languageCode);
|
|
715
|
+
if (!questionTranslation) return null;
|
|
716
|
+
if (fieldPath in questionTranslation) {
|
|
717
|
+
const value = questionTranslation[fieldPath];
|
|
718
|
+
return typeof value === "string" ? value : null;
|
|
707
719
|
}
|
|
708
720
|
return null;
|
|
709
721
|
}
|
|
710
722
|
/**
|
|
711
|
-
* Get all available languages
|
|
723
|
+
* Get all available languages for a specific question
|
|
724
|
+
*/
|
|
725
|
+
getQuestionLanguages(questionId) {
|
|
726
|
+
const questionTranslations = this.translations.questions[questionId];
|
|
727
|
+
if (!questionTranslations) return [];
|
|
728
|
+
return Object.keys(questionTranslations);
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* Get all available languages across all questions
|
|
712
732
|
*/
|
|
713
733
|
getAvailableLanguages() {
|
|
714
|
-
|
|
734
|
+
const allLanguages = /* @__PURE__ */ new Set();
|
|
735
|
+
Object.values(this.translations.questions).forEach((questionTranslations) => {
|
|
736
|
+
Object.keys(questionTranslations).forEach((langCode) => {
|
|
737
|
+
allLanguages.add(langCode);
|
|
738
|
+
});
|
|
739
|
+
});
|
|
740
|
+
return Array.from(allLanguages);
|
|
715
741
|
}
|
|
716
742
|
/**
|
|
717
|
-
* Check if a language is supported
|
|
743
|
+
* Check if a language is supported for a specific question
|
|
744
|
+
*/
|
|
745
|
+
isLanguageSupportedForQuestion(questionId, languageCode) {
|
|
746
|
+
const questionTranslations = this.translations.questions[questionId];
|
|
747
|
+
if (!questionTranslations) return false;
|
|
748
|
+
return languageCode in questionTranslations;
|
|
749
|
+
}
|
|
750
|
+
/**
|
|
751
|
+
* Check if a language is supported across all questions
|
|
718
752
|
*/
|
|
719
753
|
isLanguageSupported(languageCode) {
|
|
720
|
-
return this.
|
|
754
|
+
return this.getAvailableLanguages().includes(languageCode);
|
|
721
755
|
}
|
|
722
756
|
/**
|
|
723
757
|
* Get the default language
|
|
@@ -725,6 +759,20 @@ var _TranslationProvider = class _TranslationProvider {
|
|
|
725
759
|
getDefaultLanguage() {
|
|
726
760
|
return this.translations.defaultLanguage;
|
|
727
761
|
}
|
|
762
|
+
/**
|
|
763
|
+
* Get all questions that have translations
|
|
764
|
+
*/
|
|
765
|
+
getQuestionIds() {
|
|
766
|
+
return Object.keys(this.translations.questions);
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
* Get question type for a specific question
|
|
770
|
+
*/
|
|
771
|
+
getQuestionType(questionId, languageCode) {
|
|
772
|
+
const langCode = languageCode || this.translations.defaultLanguage;
|
|
773
|
+
const translation = this.getQuestionTranslations(questionId, langCode);
|
|
774
|
+
return translation?.type || null;
|
|
775
|
+
}
|
|
728
776
|
};
|
|
729
777
|
__name(_TranslationProvider, "TranslationProvider");
|
|
730
778
|
var TranslationProvider = _TranslationProvider;
|
|
@@ -989,13 +1037,176 @@ var masterPropertiesSchema = z9.object({
|
|
|
989
1037
|
feedback_interval_duration: z9.number().int().positive().describe("Duration in seconds for feedback interval between two auto triggered feedbacks")
|
|
990
1038
|
}).describe("Master properties configuration for global survey settings");
|
|
991
1039
|
|
|
992
|
-
// src/
|
|
1040
|
+
// src/schemas/api/other-schema.ts
|
|
993
1041
|
import { z as z10 } from "zod";
|
|
1042
|
+
var deviceThemeSchema = z10.enum(["light", "dark", "system"]).describe("Enumeration of supported theme modes");
|
|
1043
|
+
var DeviceThemes = {
|
|
1044
|
+
LIGHT: "light",
|
|
1045
|
+
DARK: "dark",
|
|
1046
|
+
SYSTEM: "system"
|
|
1047
|
+
};
|
|
1048
|
+
var deviceInfoSchema = z10.object({
|
|
1049
|
+
deviceType: z10.string().describe("Type of device being used"),
|
|
1050
|
+
timezone: z10.string().describe("Device timezone (e.g., 'Asia/Calcutta')"),
|
|
1051
|
+
theme: deviceThemeSchema.describe("Current theme mode preference"),
|
|
1052
|
+
os: z10.string().describe("Operating system running on the device"),
|
|
1053
|
+
osVersion: z10.string().describe("Version of the operating system"),
|
|
1054
|
+
appVersion: z10.string().describe("Version of the application"),
|
|
1055
|
+
app: z10.string().describe("Browser or application being used"),
|
|
1056
|
+
language: z10.string().describe("Language preference (e.g., 'en-GB')")
|
|
1057
|
+
}).describe("Device information collected from the client");
|
|
1058
|
+
var sessionInfoSchema = z10.object({
|
|
1059
|
+
sessionId: z10.string().uuid().describe("Unique session identifier")
|
|
1060
|
+
}).describe("Session information for tracking user sessions");
|
|
1061
|
+
var deviceSessionInfoSchema = z10.object({
|
|
1062
|
+
deviceInfo: deviceInfoSchema.describe("Device information"),
|
|
1063
|
+
sessionInfo: sessionInfoSchema.describe("Session information")
|
|
1064
|
+
}).describe("Combined device and session information");
|
|
1065
|
+
var userPropertiesSchema = z10.object({
|
|
1066
|
+
$counter: z10.record(z10.string(), z10.number().int()).describe("Counter properties for user tracking (can be positive or negative)").optional(),
|
|
1067
|
+
$set: z10.record(z10.string(), z10.any()).describe("Properties to set for the user").optional(),
|
|
1068
|
+
$setOnce: z10.record(z10.string(), z10.any()).describe("Properties to set once for the user (won't overwrite existing values)").optional(),
|
|
1069
|
+
$unset: z10.array(z10.string()).describe("Array of property names to unset/remove from the user").optional()
|
|
1070
|
+
}).passthrough().describe("User properties including counters, set operations, and other dynamic data");
|
|
1071
|
+
var userInfoSchema = z10.object({
|
|
1072
|
+
userName: z10.string().email().describe("User's email address as username"),
|
|
1073
|
+
properties: userPropertiesSchema.describe("User properties and counters")
|
|
1074
|
+
}).describe("User information including identification and properties");
|
|
1075
|
+
|
|
1076
|
+
// src/schemas/api/submit-feedback-schema.ts
|
|
1077
|
+
import { z as z11 } from "zod";
|
|
1078
|
+
var userActionSchema = z11.enum(["V", "S"]).describe("User action: V for view, S for submit");
|
|
1079
|
+
var UserActions = {
|
|
1080
|
+
VIEW: "V",
|
|
1081
|
+
SUBMIT: "S"
|
|
1082
|
+
};
|
|
1083
|
+
var formConfigSchema = z11.object({
|
|
1084
|
+
feedbackIdentifier: z11.string().uuid().describe("Unique identifier for the feedback instance"),
|
|
1085
|
+
feedbackConfigurationId: z11.string().uuid().describe("Unique identifier for the feedback configuration"),
|
|
1086
|
+
completionTimeInSeconds: z11.number().int().min(0).describe("Time taken to complete the feedback in seconds"),
|
|
1087
|
+
userAction: userActionSchema.describe("Action performed by the user"),
|
|
1088
|
+
responseLanguageCode: z11.string().length(2).describe("Language code for the response (e.g., 'en', 'es')")
|
|
1089
|
+
}).describe("Configuration information for the feedback form");
|
|
1090
|
+
var questionResponseSchema = z11.object({
|
|
1091
|
+
questionId: z11.string().uuid().describe("Unique identifier for the question"),
|
|
1092
|
+
answer: AnswerSchema.describe("The answer provided for this question"),
|
|
1093
|
+
type: z11.string().describe("Type of the question (e.g., 'rating', 'single_choice')")
|
|
1094
|
+
}).describe("Response to a specific question in the feedback form");
|
|
1095
|
+
var responseSchema = z11.object({
|
|
1096
|
+
questions: z11.array(questionResponseSchema).min(1).describe("Array of question responses")
|
|
1097
|
+
}).describe("User responses to feedback questions");
|
|
1098
|
+
var matchedTriggerPropertiesSchema = z11.object({
|
|
1099
|
+
customEventName: z11.string().nullable().describe("Custom event name that triggered the feedback"),
|
|
1100
|
+
currentPath: z11.string().describe("Current page path where feedback was triggered"),
|
|
1101
|
+
eventType: z11.string().describe("Type of event that triggered the feedback")
|
|
1102
|
+
}).passthrough().describe("Properties of the trigger that matched for this feedback");
|
|
1103
|
+
var baseSubmitFeedbackSchema = z11.object({
|
|
1104
|
+
formConfig: formConfigSchema.describe("Form configuration information"),
|
|
1105
|
+
deviceInfo: deviceInfoSchema.describe("Device information"),
|
|
1106
|
+
sessionInfo: sessionInfoSchema.describe("Session information"),
|
|
1107
|
+
userInfo: userInfoSchema.optional().describe("User information (optional)"),
|
|
1108
|
+
matchedTriggerProperties: matchedTriggerPropertiesSchema.describe(
|
|
1109
|
+
"Properties of the matched trigger"
|
|
1110
|
+
)
|
|
1111
|
+
}).describe("Base submit feedback request schema");
|
|
1112
|
+
var viewFeedbackSchema = baseSubmitFeedbackSchema.extend({
|
|
1113
|
+
formConfig: formConfigSchema.extend({
|
|
1114
|
+
userAction: z11.literal("V").describe("Action performed by the user (view)")
|
|
1115
|
+
})
|
|
1116
|
+
}).strict().describe("View feedback request schema (no response required)");
|
|
1117
|
+
var submitFeedbackSchema = baseSubmitFeedbackSchema.extend({
|
|
1118
|
+
formConfig: formConfigSchema.extend({
|
|
1119
|
+
userAction: z11.literal("S").describe("Action performed by the user (submit)")
|
|
1120
|
+
}),
|
|
1121
|
+
response: responseSchema.describe("User responses (required for submit)")
|
|
1122
|
+
}).strict().describe("Submit feedback request schema (response required)");
|
|
1123
|
+
var feedbackRequestSchema = z11.union([
|
|
1124
|
+
viewFeedbackSchema,
|
|
1125
|
+
submitFeedbackSchema
|
|
1126
|
+
]).describe("Union schema for both view and submit feedback requests");
|
|
1127
|
+
|
|
1128
|
+
// src/schemas/api/fetch-feedback-schema.ts
|
|
1129
|
+
import { z as z12 } from "zod";
|
|
1130
|
+
var feedbackConfigurationItemSchema = z12.object({
|
|
1131
|
+
feedbackConfigurationId: z12.string().uuid().describe("Unique identifier for the feedback configuration"),
|
|
1132
|
+
feedbackTitle: z12.string().describe("Title of the feedback configuration"),
|
|
1133
|
+
duration: durationSchema.describe("Active duration for this feedback configuration"),
|
|
1134
|
+
triggerProperties: audienceTriggerPropertiesSchema.describe("Trigger properties including auto/manual settings and audience segments"),
|
|
1135
|
+
appearanceProperties: z12.object({
|
|
1136
|
+
themes: z12.object({
|
|
1137
|
+
light: z12.object({
|
|
1138
|
+
brandColor: z12.string().describe("Brand color for light theme"),
|
|
1139
|
+
overlayColor: z12.string().describe("Overlay color for light theme"),
|
|
1140
|
+
textColor: z12.string().describe("Text color for light theme"),
|
|
1141
|
+
backgroundColor: z12.string().describe("Background color for light theme")
|
|
1142
|
+
}).describe("Light theme colors"),
|
|
1143
|
+
dark: z12.object({
|
|
1144
|
+
brandColor: z12.string().describe("Brand color for dark theme"),
|
|
1145
|
+
overlayColor: z12.string().describe("Overlay color for dark theme"),
|
|
1146
|
+
textColor: z12.string().describe("Text color for dark theme"),
|
|
1147
|
+
backgroundColor: z12.string().describe("Background color for dark theme")
|
|
1148
|
+
}).describe("Dark theme colors")
|
|
1149
|
+
}).nullable().optional().describe("Theme configuration (optional)"),
|
|
1150
|
+
featureSettings: z12.object({
|
|
1151
|
+
darkOverlay: z12.boolean().describe("Whether to show dark overlay"),
|
|
1152
|
+
closeButton: z12.boolean().describe("Whether to show close button"),
|
|
1153
|
+
progressBar: z12.boolean().describe("Whether to show progress bar"),
|
|
1154
|
+
showBranding: z12.boolean().describe("Whether to show branding"),
|
|
1155
|
+
customPosition: z12.boolean().describe("Whether custom position is enabled"),
|
|
1156
|
+
customIconPosition: z12.boolean().describe("Whether custom icon position is enabled"),
|
|
1157
|
+
customCss: z12.string().nullable().optional().describe("Custom CSS link (optional)")
|
|
1158
|
+
}).describe("Feature settings for the feedback form"),
|
|
1159
|
+
selectedIconPosition: z12.string().describe("Selected position for the feedback icon"),
|
|
1160
|
+
selectedPosition: z12.string().describe("Selected position for the feedback form")
|
|
1161
|
+
}).describe("Appearance properties for the feedback form")
|
|
1162
|
+
}).describe("Individual feedback configuration item in the list");
|
|
1163
|
+
var fetchFormConfigSchema = z12.object({
|
|
1164
|
+
feedbackConfigurationId: z12.string().uuid().describe("Unique identifier for the feedback configuration"),
|
|
1165
|
+
responseLanguageCode: z12.string().length(2).describe("Language code for the response (e.g., 'en', 'es')")
|
|
1166
|
+
}).describe("Form configuration for fetching feedback details");
|
|
1167
|
+
var fetchConfigurationListSchema = z12.object({
|
|
1168
|
+
deviceInfo: deviceInfoSchema.describe("Device information"),
|
|
1169
|
+
sessionInfo: sessionInfoSchema.describe("Session information"),
|
|
1170
|
+
userInfo: userInfoSchema.optional().describe("User information (optional)")
|
|
1171
|
+
}).strict().describe("Request schema for fetching available feedback configurations");
|
|
1172
|
+
var fetchFeedbackDetailsSchema = z12.object({
|
|
1173
|
+
formConfig: fetchFormConfigSchema.describe("Form configuration for the specific feedback"),
|
|
1174
|
+
deviceInfo: deviceInfoSchema.describe("Device information"),
|
|
1175
|
+
sessionInfo: sessionInfoSchema.describe("Session information"),
|
|
1176
|
+
userInfo: userInfoSchema.optional().describe("User information (optional)")
|
|
1177
|
+
}).strict().describe("Request schema for fetching specific feedback form details");
|
|
1178
|
+
var formConfigurationResponseSchema = z12.object({
|
|
1179
|
+
formTitle: z12.string().describe("Title of the feedback form"),
|
|
1180
|
+
formDescription: z12.string().describe("Description of the feedback form")
|
|
1181
|
+
}).describe("Form configuration response with title and description");
|
|
1182
|
+
var questionnaireFieldsResponseSchema = z12.object({
|
|
1183
|
+
questions: z12.record(z12.string(), combinedQuestionSchema).describe("Collection of questions keyed by their string identifiers"),
|
|
1184
|
+
sections: z12.array(sectionSchema).describe("Array of sections that organize questions into logical groups"),
|
|
1185
|
+
translations: z12.record(z12.string(), z12.any()).describe("Translations object (can be empty or contain language-specific translations)"),
|
|
1186
|
+
selectedLanguages: LanguagesSchema.describe("Array of languages selected for this questionnaire")
|
|
1187
|
+
}).describe("Questionnaire fields response including questions, sections, translations, and selected languages");
|
|
1188
|
+
var fetchFeedbackDetailsResponseSchema = z12.object({
|
|
1189
|
+
feedbackConfigurationId: z12.string().uuid().describe("Unique identifier for the feedback configuration"),
|
|
1190
|
+
feedbackIdentifier: z12.string().uuid().describe("Unique identifier for this specific feedback instance"),
|
|
1191
|
+
formConfiguration: formConfigurationResponseSchema.describe("Form configuration with title and description"),
|
|
1192
|
+
questionnaireFields: questionnaireFieldsResponseSchema.describe("Questionnaire structure including questions, sections, translations, and languages"),
|
|
1193
|
+
otherConfigurationProperties: otherConfigurationPropertiesSchema.describe("Other configuration properties using existing schema"),
|
|
1194
|
+
welcomeScreenProperties: welcomeScreenPropertiesSchema.describe("Welcome screen properties using existing schema"),
|
|
1195
|
+
endScreenProperties: endScreenPropertiesSchema.describe("End screen properties using existing schema")
|
|
1196
|
+
}).strict().describe("Complete response schema for fetchFeedbackDetails API using existing field schemas");
|
|
1197
|
+
var fetchConfigurationListResponseSchema = z12.object({
|
|
1198
|
+
masterProperties: masterPropertiesSchema.describe("Master properties for global survey settings"),
|
|
1199
|
+
feedbackConfiguration: z12.array(feedbackConfigurationItemSchema).describe("Array of available feedback configurations")
|
|
1200
|
+
}).strict().describe("Response schema for fetchConfigurationList API");
|
|
1201
|
+
|
|
1202
|
+
// src/index.ts
|
|
1203
|
+
import { z as z13 } from "zod";
|
|
994
1204
|
export {
|
|
995
1205
|
AnswerSchema,
|
|
996
1206
|
ChoiceAnswerSchema,
|
|
997
1207
|
ChoiceOrderOptions,
|
|
998
1208
|
ContinuousSumAnswerSchema,
|
|
1209
|
+
DeviceThemes,
|
|
999
1210
|
DismissBehaviors,
|
|
1000
1211
|
EndFieldsTranslationSchema,
|
|
1001
1212
|
EndScreenFieldsSchema,
|
|
@@ -1020,16 +1231,18 @@ export {
|
|
|
1020
1231
|
TextAnswerSchema,
|
|
1021
1232
|
ThemeModes,
|
|
1022
1233
|
TranslationProvider,
|
|
1234
|
+
UserActions,
|
|
1023
1235
|
ValidationRuleTypes,
|
|
1024
1236
|
VisibilityConditionOperators,
|
|
1025
1237
|
WelcomeFieldsTranslationSchema,
|
|
1026
1238
|
WelcomeScreenFieldsSchema,
|
|
1027
1239
|
YesNoValues,
|
|
1028
1240
|
annotationQuestionSchema,
|
|
1029
|
-
|
|
1241
|
+
annotationQuestionTranslationSchema,
|
|
1030
1242
|
appearancePropertiesSchema,
|
|
1031
1243
|
audienceSegmentSchema,
|
|
1032
1244
|
audienceTriggerPropertiesSchema,
|
|
1245
|
+
baseSubmitFeedbackSchema,
|
|
1033
1246
|
categorySpecificFiltersSchema,
|
|
1034
1247
|
choiceOrderOptionSchema,
|
|
1035
1248
|
combinedQuestionSchema,
|
|
@@ -1039,46 +1252,65 @@ export {
|
|
|
1039
1252
|
createTranslationProvider,
|
|
1040
1253
|
customEventFieldOperatorSchema,
|
|
1041
1254
|
customEventFieldSchema,
|
|
1255
|
+
deviceInfoSchema,
|
|
1256
|
+
deviceSessionInfoSchema,
|
|
1257
|
+
deviceThemeSchema,
|
|
1042
1258
|
dismissBehaviorSchema,
|
|
1259
|
+
durationSchema,
|
|
1043
1260
|
endScreenPropertiesSchema,
|
|
1044
1261
|
externalPublishingPropertiesSchema,
|
|
1045
1262
|
featureSettingsSchema,
|
|
1263
|
+
feedbackConfigurationItemSchema,
|
|
1046
1264
|
feedbackConfigurationSchema,
|
|
1265
|
+
feedbackRequestSchema,
|
|
1266
|
+
fetchConfigurationListResponseSchema,
|
|
1267
|
+
fetchConfigurationListSchema,
|
|
1268
|
+
fetchFeedbackDetailsResponseSchema,
|
|
1269
|
+
fetchFeedbackDetailsSchema,
|
|
1270
|
+
fetchFormConfigSchema,
|
|
1047
1271
|
filterConditionSchema,
|
|
1272
|
+
formConfigSchema,
|
|
1273
|
+
formConfigurationResponseSchema,
|
|
1048
1274
|
formPropertiesSchema,
|
|
1049
1275
|
frequencyAndSchedulingPropertiesSchema,
|
|
1050
|
-
languageTranslationsSchema,
|
|
1051
1276
|
longAnswerQuestionSchema,
|
|
1052
|
-
|
|
1277
|
+
longAnswerQuestionTranslationSchema,
|
|
1053
1278
|
masterPropertiesSchema,
|
|
1279
|
+
matchedTriggerPropertiesSchema,
|
|
1054
1280
|
multipleChoiceDisplayStyleSchema,
|
|
1055
1281
|
multipleChoiceMultipleDisplayStyleSchema,
|
|
1056
1282
|
multipleChoiceMultipleQuestionSchema,
|
|
1283
|
+
multipleChoiceQuestionTranslationSchema,
|
|
1057
1284
|
multipleChoiceSingleQuestionSchema,
|
|
1058
|
-
multipleChoiceTranslationsSchema,
|
|
1059
1285
|
nestedDropdownQuestionSchema,
|
|
1060
1286
|
nestedOptionSchema,
|
|
1061
|
-
|
|
1287
|
+
nestedSelectionQuestionTranslationSchema,
|
|
1062
1288
|
npsQuestionSchema,
|
|
1063
|
-
|
|
1289
|
+
npsQuestionTranslationSchema,
|
|
1064
1290
|
otherConfigurationPropertiesSchema,
|
|
1065
1291
|
positionSchema,
|
|
1066
1292
|
publicationStatusSchema,
|
|
1067
1293
|
queryOutputSchema,
|
|
1294
|
+
questionCentricTranslationsSchema,
|
|
1068
1295
|
questionOptionSchema,
|
|
1296
|
+
questionResponseSchema,
|
|
1069
1297
|
questionSchema,
|
|
1070
1298
|
questionStatusSchema,
|
|
1071
|
-
|
|
1299
|
+
questionTranslationSchema,
|
|
1072
1300
|
questionTypeSchema,
|
|
1301
|
+
questionnaireFieldsResponseSchema,
|
|
1073
1302
|
ratingDisplayStyleSchema,
|
|
1074
1303
|
ratingQuestionSchema,
|
|
1304
|
+
ratingQuestionTranslationSchema,
|
|
1075
1305
|
ratingRepresentationSizeSchema,
|
|
1076
|
-
ratingTranslationsSchema,
|
|
1077
1306
|
recurringUnitSchema,
|
|
1307
|
+
responseSchema,
|
|
1078
1308
|
sectionSchema,
|
|
1309
|
+
sessionInfoSchema,
|
|
1079
1310
|
shortAnswerQuestionSchema,
|
|
1080
|
-
|
|
1081
|
-
|
|
1311
|
+
shortAnswerQuestionTranslationSchema,
|
|
1312
|
+
singleChoiceQuestionTranslationSchema,
|
|
1313
|
+
submitFeedbackSchema,
|
|
1082
1314
|
surveyTypeSchema,
|
|
1083
1315
|
themeColorsSchema,
|
|
1084
1316
|
themeConfigurationSchema,
|
|
@@ -1087,12 +1319,16 @@ export {
|
|
|
1087
1319
|
translationEntrySchema,
|
|
1088
1320
|
translationsSchema,
|
|
1089
1321
|
triggerActionSchema,
|
|
1322
|
+
userActionSchema,
|
|
1323
|
+
userInfoSchema,
|
|
1324
|
+
userPropertiesSchema,
|
|
1090
1325
|
validationRuleSchema,
|
|
1091
1326
|
validationRuleTypeSchema,
|
|
1327
|
+
viewFeedbackSchema,
|
|
1092
1328
|
visibilityConditionSchema,
|
|
1093
1329
|
welcomeScreenPropertiesSchema,
|
|
1094
1330
|
whoSchema,
|
|
1095
1331
|
yesNoSchema,
|
|
1096
|
-
|
|
1332
|
+
z13 as z
|
|
1097
1333
|
};
|
|
1098
1334
|
//# sourceMappingURL=index.js.map
|