@encatch/schema 0.0.1

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.
Files changed (52) hide show
  1. package/README.md +7 -0
  2. package/dist/cjs/index.js +30 -0
  3. package/dist/cjs/index.js.map +1 -0
  4. package/dist/cjs/schemas/fields/answer-schema.js +103 -0
  5. package/dist/cjs/schemas/fields/answer-schema.js.map +1 -0
  6. package/dist/cjs/schemas/fields/auto-trigger-schema.js +49 -0
  7. package/dist/cjs/schemas/fields/auto-trigger-schema.js.map +1 -0
  8. package/dist/cjs/schemas/fields/field-schema.js +678 -0
  9. package/dist/cjs/schemas/fields/field-schema.js.map +1 -0
  10. package/dist/cjs/schemas/fields/form-properties-schema.js +136 -0
  11. package/dist/cjs/schemas/fields/form-properties-schema.js.map +1 -0
  12. package/dist/cjs/schemas/fields/form-schema.js +123 -0
  13. package/dist/cjs/schemas/fields/form-schema.js.map +1 -0
  14. package/dist/cjs/schemas/fields/other-screen-schema.js +169 -0
  15. package/dist/cjs/schemas/fields/other-screen-schema.js.map +1 -0
  16. package/dist/cjs/schemas/fields/theme-schema.js +85 -0
  17. package/dist/cjs/schemas/fields/theme-schema.js.map +1 -0
  18. package/dist/cjs/schemas/fields/translations-example.js +187 -0
  19. package/dist/cjs/schemas/fields/translations-example.js.map +1 -0
  20. package/dist/cjs/schemas/fields/translations-schema.js +198 -0
  21. package/dist/cjs/schemas/fields/translations-schema.js.map +1 -0
  22. package/dist/esm/index.js +12 -0
  23. package/dist/esm/index.js.map +1 -0
  24. package/dist/esm/schemas/fields/answer-schema.js +100 -0
  25. package/dist/esm/schemas/fields/answer-schema.js.map +1 -0
  26. package/dist/esm/schemas/fields/auto-trigger-schema.js +46 -0
  27. package/dist/esm/schemas/fields/auto-trigger-schema.js.map +1 -0
  28. package/dist/esm/schemas/fields/field-schema.js +675 -0
  29. package/dist/esm/schemas/fields/field-schema.js.map +1 -0
  30. package/dist/esm/schemas/fields/form-properties-schema.js +133 -0
  31. package/dist/esm/schemas/fields/form-properties-schema.js.map +1 -0
  32. package/dist/esm/schemas/fields/form-schema.js +120 -0
  33. package/dist/esm/schemas/fields/form-schema.js.map +1 -0
  34. package/dist/esm/schemas/fields/other-screen-schema.js +166 -0
  35. package/dist/esm/schemas/fields/other-screen-schema.js.map +1 -0
  36. package/dist/esm/schemas/fields/theme-schema.js +82 -0
  37. package/dist/esm/schemas/fields/theme-schema.js.map +1 -0
  38. package/dist/esm/schemas/fields/translations-example.js +181 -0
  39. package/dist/esm/schemas/fields/translations-example.js.map +1 -0
  40. package/dist/esm/schemas/fields/translations-schema.js +193 -0
  41. package/dist/esm/schemas/fields/translations-schema.js.map +1 -0
  42. package/dist/types/index.d.ts +9 -0
  43. package/dist/types/schemas/fields/answer-schema.d.ts +77 -0
  44. package/dist/types/schemas/fields/auto-trigger-schema.d.ts +21 -0
  45. package/dist/types/schemas/fields/field-schema.d.ts +1114 -0
  46. package/dist/types/schemas/fields/form-properties-schema.d.ts +1035 -0
  47. package/dist/types/schemas/fields/form-schema.d.ts +68 -0
  48. package/dist/types/schemas/fields/other-screen-schema.d.ts +58 -0
  49. package/dist/types/schemas/fields/theme-schema.d.ts +91 -0
  50. package/dist/types/schemas/fields/translations-example.d.ts +10 -0
  51. package/dist/types/schemas/fields/translations-schema.d.ts +863 -0
  52. package/package.json +33 -0
@@ -0,0 +1,181 @@
1
+ import { createTranslationProvider } from './translations-schema';
2
+ // Example translation data following the structure:
3
+ // {
4
+ // "languageCode": {
5
+ // "question_id": {
6
+ // translated schema
7
+ // }
8
+ // }
9
+ // }
10
+ export const exampleTranslations = {
11
+ defaultLanguage: "en",
12
+ version: "1.0.0",
13
+ languages: [
14
+ {
15
+ languageCode: "en",
16
+ questions: {
17
+ "rating-q1": {
18
+ type: "rating",
19
+ translations: {
20
+ title: { text: "How satisfied are you?" },
21
+ description: { text: "Please rate your experience on a scale of 1-5" },
22
+ minLabel: { text: "Not satisfied" },
23
+ maxLabel: { text: "Very satisfied" }
24
+ }
25
+ },
26
+ "choice-q2": {
27
+ type: "single_choice",
28
+ translations: {
29
+ title: { text: "What is your favorite color?" },
30
+ description: { text: "Choose one option from the list below" },
31
+ options: {
32
+ "opt-red": { label: { text: "Red" } },
33
+ "opt-blue": { label: { text: "Blue" } },
34
+ "opt-green": { label: { text: "Green" } }
35
+ }
36
+ }
37
+ },
38
+ "nps-q3": {
39
+ type: "nps",
40
+ translations: {
41
+ title: { text: "How likely are you to recommend us?" },
42
+ description: { text: "Rate from 0 to 10" },
43
+ minLabel: { text: "Not at all likely" },
44
+ maxLabel: { text: "Extremely likely" },
45
+ scaleLabels: {
46
+ 0: { text: "Not at all likely" },
47
+ 5: { text: "Neutral" },
48
+ 10: { text: "Extremely likely" }
49
+ }
50
+ }
51
+ },
52
+ "text-q4": {
53
+ type: "short_answer",
54
+ translations: {
55
+ title: { text: "What improvements would you suggest?" },
56
+ placeholder: { text: "Enter your suggestions here..." }
57
+ }
58
+ },
59
+ "nested-q5": {
60
+ type: "nested_selection",
61
+ translations: {
62
+ title: { text: "Select your location" },
63
+ placeholder: { text: "Choose a country first..." },
64
+ nestedOptions: {
65
+ "country-us": { label: { text: "United States" } },
66
+ "country-in": { label: { text: "India" } },
67
+ "state-ca": { label: { text: "California" } },
68
+ "state-ny": { label: { text: "New York" } }
69
+ }
70
+ }
71
+ }
72
+ }
73
+ },
74
+ {
75
+ languageCode: "hi", // Hindi
76
+ questions: {
77
+ "rating-q1": {
78
+ type: "rating",
79
+ translations: {
80
+ title: { text: "आप कितने संतुष्ट हैं?" },
81
+ description: { text: "कृपया 1-5 स्केल पर अपनी संतुष्टि दर करें" },
82
+ minLabel: { text: "असंतुष्ट" },
83
+ maxLabel: { text: "बहुत संतुष्ट" }
84
+ }
85
+ },
86
+ "choice-q2": {
87
+ type: "single_choice",
88
+ translations: {
89
+ title: { text: "आपका पसंदीदा रंग क्या है?" },
90
+ options: {
91
+ "opt-red": { label: { text: "लाल" } },
92
+ "opt-blue": { label: { text: "नीला" } },
93
+ "opt-green": { label: { text: "हरा" } }
94
+ }
95
+ }
96
+ }
97
+ }
98
+ },
99
+ {
100
+ languageCode: "es", // Spanish
101
+ questions: {
102
+ "rating-q1": {
103
+ type: "rating",
104
+ translations: {
105
+ title: { text: "¿Qué tan satisfecho estás?" },
106
+ minLabel: { text: "No satisfecho" },
107
+ maxLabel: { text: "Muy satisfecho" }
108
+ }
109
+ },
110
+ "choice-q2": {
111
+ type: "single_choice",
112
+ translations: {
113
+ title: { text: "¿Cuál es tu color favorito?" },
114
+ options: {
115
+ "opt-red": { label: { text: "Rojo" } },
116
+ "opt-blue": { label: { text: "Azul" } },
117
+ "opt-green": { label: { text: "Verde" } }
118
+ }
119
+ }
120
+ }
121
+ }
122
+ }
123
+ ]
124
+ };
125
+ // Define available languages using your existing schema
126
+ export const availableLanguages = [
127
+ {
128
+ value: "en",
129
+ label: "English",
130
+ isFixed: true
131
+ },
132
+ {
133
+ value: "hi",
134
+ label: "हिन्दी",
135
+ isFixed: false
136
+ },
137
+ {
138
+ value: "es",
139
+ label: "Español",
140
+ isFixed: false
141
+ },
142
+ {
143
+ value: "fr",
144
+ label: "Français",
145
+ isFixed: false
146
+ }
147
+ ];
148
+ // Create translation provider
149
+ export const translationProvider = createTranslationProvider(exampleTranslations);
150
+ // Helper function to get language display name
151
+ export function getLanguageDisplayName(languageCode) {
152
+ const language = availableLanguages.find(lang => lang.value === languageCode);
153
+ return language?.label || languageCode;
154
+ }
155
+ // Helper function to get supported languages
156
+ export function getSupportedLanguages() {
157
+ return availableLanguages.filter(lang => exampleTranslations.languages.some(t => t.languageCode === lang.value));
158
+ }
159
+ // Usage examples
160
+ export function demonstrateUsage() {
161
+ console.log("=== Translation System with Language Integration ===\n");
162
+ // Get translations for a specific question
163
+ const ratingTranslations = translationProvider.getQuestionTranslations("rating-q1", "hi");
164
+ console.log("Hindi rating title:", ratingTranslations?.translations.title.text);
165
+ // Get specific translation text
166
+ const titleText = translationProvider.getTranslationText("choice-q2", "es", ["title"]);
167
+ console.log("Spanish choice title:", titleText);
168
+ // Get option translation
169
+ const optionText = translationProvider.getTranslationText("choice-q2", "hi", ["options", "opt-red", "label"]);
170
+ console.log("Hindi red option:", optionText);
171
+ // Language integration examples
172
+ console.log("\n=== Language Integration ===");
173
+ console.log("Available languages:", translationProvider.getAvailableLanguages());
174
+ console.log("Supported languages with display names:");
175
+ getSupportedLanguages().forEach(lang => {
176
+ console.log(` ${lang.value}: ${lang.label}`);
177
+ });
178
+ console.log("\nDefault language:", translationProvider.getDefaultLanguage());
179
+ console.log("Is French supported?", translationProvider.isLanguageSupported("fr"));
180
+ }
181
+ //# sourceMappingURL=translations-example.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translations-example.js","sourceRoot":"","sources":["../../../../src/schemas/fields/translations-example.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAGhF,oDAAoD;AACpD,IAAI;AACJ,sBAAsB;AACtB,uBAAuB;AACvB,0BAA0B;AAC1B,QAAQ;AACR,MAAM;AACN,IAAI;AACJ,MAAM,CAAC,MAAM,mBAAmB,GAAiB;IAC/C,eAAe,EAAE,IAAI;IACrB,OAAO,EAAE,OAAO;IAChB,SAAS,EAAE;QACT;YACE,YAAY,EAAE,IAAI;YAClB,SAAS,EAAE;gBACT,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,YAAY,EAAE;wBACZ,KAAK,EAAE,EAAE,IAAI,EAAE,wBAAwB,EAAE;wBACzC,WAAW,EAAE,EAAE,IAAI,EAAE,+CAA+C,EAAE;wBACtE,QAAQ,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE;wBACnC,QAAQ,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE;qBACrC;iBACF;gBACD,WAAW,EAAE;oBACX,IAAI,EAAE,eAAe;oBACrB,YAAY,EAAE;wBACZ,KAAK,EAAE,EAAE,IAAI,EAAE,8BAA8B,EAAE;w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B,EAAE,mBAAmB,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAC7E,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,mBAAmB,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;AACrF,CAAC"}
@@ -0,0 +1,193 @@
1
+ import { z } from "zod";
2
+ // Base translation entry
3
+ export const translationEntrySchema = z
4
+ .object({
5
+ text: z.string().min(1).describe("Translated text content"),
6
+ context: z.string().optional().describe("Optional context for translators"),
7
+ })
8
+ .describe("Translation entry with translated text");
9
+ // Rating question translations
10
+ export const ratingTranslationsSchema = z
11
+ .object({
12
+ title: translationEntrySchema.describe("Question title translation"),
13
+ description: translationEntrySchema.optional().describe("Question description translation"),
14
+ errorMessage: translationEntrySchema.optional().describe("Error message translation"),
15
+ minLabel: translationEntrySchema.optional().describe("Minimum rating label translation"),
16
+ maxLabel: translationEntrySchema.optional().describe("Maximum rating label translation"),
17
+ })
18
+ .describe("Translation schema for rating questions");
19
+ // Single choice question translations
20
+ export const singleChoiceTranslationsSchema = z
21
+ .object({
22
+ title: translationEntrySchema.describe("Question title translation"),
23
+ description: translationEntrySchema.optional().describe("Question description translation"),
24
+ errorMessage: translationEntrySchema.optional().describe("Error message translation"),
25
+ placeholder: translationEntrySchema.optional().describe("Input placeholder translation"),
26
+ options: z.record(z.string(), z.object({
27
+ label: translationEntrySchema.describe("Option label translation"),
28
+ hint: translationEntrySchema.optional().describe("Option hint translation"),
29
+ })).describe("Option translations keyed by option ID"),
30
+ })
31
+ .describe("Translation schema for single choice questions");
32
+ // Multiple choice question translations
33
+ export const multipleChoiceTranslationsSchema = z
34
+ .object({
35
+ title: translationEntrySchema.describe("Question title translation"),
36
+ description: translationEntrySchema.optional().describe("Question description translation"),
37
+ errorMessage: translationEntrySchema.optional().describe("Error message translation"),
38
+ placeholder: translationEntrySchema.optional().describe("Input placeholder translation"),
39
+ options: z.record(z.string(), z.object({
40
+ label: translationEntrySchema.describe("Option label translation"),
41
+ hint: translationEntrySchema.optional().describe("Option hint translation"),
42
+ })).describe("Option translations keyed by option ID"),
43
+ })
44
+ .describe("Translation schema for multiple choice questions");
45
+ // NPS question translations
46
+ export const npsTranslationsSchema = z
47
+ .object({
48
+ title: translationEntrySchema.describe("Question title translation"),
49
+ description: translationEntrySchema.optional().describe("Question description translation"),
50
+ errorMessage: translationEntrySchema.optional().describe("Error message translation"),
51
+ minLabel: translationEntrySchema.optional().describe("Minimum NPS label (0) translation"),
52
+ maxLabel: translationEntrySchema.optional().describe("Maximum NPS label (10) translation"),
53
+ scaleLabels: z.record(z.number().int().min(0).max(10), translationEntrySchema)
54
+ .optional()
55
+ .describe("Scale label translations for specific NPS values (0-10)"),
56
+ })
57
+ .describe("Translation schema for NPS questions");
58
+ // Short answer question translations
59
+ export const shortAnswerTranslationsSchema = z
60
+ .object({
61
+ title: translationEntrySchema.describe("Question title translation"),
62
+ description: translationEntrySchema.optional().describe("Question description translation"),
63
+ errorMessage: translationEntrySchema.optional().describe("Error message translation"),
64
+ placeholder: translationEntrySchema.optional().describe("Input placeholder translation"),
65
+ })
66
+ .describe("Translation schema for short answer questions");
67
+ // Long answer question translations
68
+ export const longAnswerTranslationsSchema = z
69
+ .object({
70
+ title: translationEntrySchema.describe("Question title translation"),
71
+ description: translationEntrySchema.optional().describe("Question description translation"),
72
+ errorMessage: translationEntrySchema.optional().describe("Error message translation"),
73
+ placeholder: translationEntrySchema.optional().describe("Textarea placeholder translation"),
74
+ })
75
+ .describe("Translation schema for long answer questions");
76
+ // Nested selection question translations
77
+ export const nestedSelectionTranslationsSchema = z
78
+ .object({
79
+ title: translationEntrySchema.describe("Question title translation"),
80
+ description: translationEntrySchema.optional().describe("Question description translation"),
81
+ errorMessage: translationEntrySchema.optional().describe("Error message translation"),
82
+ placeholder: translationEntrySchema.optional().describe("Dropdown placeholder translation"),
83
+ nestedOptions: z.record(z.string(), z.object({
84
+ label: translationEntrySchema.describe("Nested option label translation"),
85
+ hint: translationEntrySchema.optional().describe("Nested option hint translation"),
86
+ })).describe("Nested option translations keyed by option ID"),
87
+ })
88
+ .describe("Translation schema for nested selection questions");
89
+ // Annotation question translations
90
+ export const annotationTranslationsSchema = z
91
+ .object({
92
+ title: translationEntrySchema.describe("Question title translation"),
93
+ description: translationEntrySchema.optional().describe("Question description translation"),
94
+ errorMessage: translationEntrySchema.optional().describe("Error message translation"),
95
+ annotationText: translationEntrySchema.optional().describe("Annotation display text translation"),
96
+ noAnnotationText: translationEntrySchema.optional().describe("No annotation display text translation"),
97
+ })
98
+ .describe("Translation schema for annotation questions");
99
+ // Discriminated union of all translation types
100
+ export const questionTranslationsSchema = z
101
+ .discriminatedUnion("type", [
102
+ z.object({ type: z.literal("rating"), translations: ratingTranslationsSchema }),
103
+ z.object({ type: z.literal("single_choice"), translations: singleChoiceTranslationsSchema }),
104
+ z.object({ type: z.literal("multiple_choice_multiple"), translations: multipleChoiceTranslationsSchema }),
105
+ z.object({ type: z.literal("nps"), translations: npsTranslationsSchema }),
106
+ z.object({ type: z.literal("short_answer"), translations: shortAnswerTranslationsSchema }),
107
+ z.object({ type: z.literal("long_text"), translations: longAnswerTranslationsSchema }),
108
+ z.object({ type: z.literal("nested_selection"), translations: nestedSelectionTranslationsSchema }),
109
+ z.object({ type: z.literal("annotation"), translations: annotationTranslationsSchema }),
110
+ ])
111
+ .describe("Discriminated union of all question type translation schemas");
112
+ // Language-specific translations keyed by question ID
113
+ export const languageTranslationsSchema = z
114
+ .object({
115
+ languageCode: z.string().describe("Language code matching LanguagesSchema values"),
116
+ questions: z.record(z.string(), questionTranslationsSchema)
117
+ .describe("Question translations keyed by question ID"),
118
+ })
119
+ .describe("Language-specific translation set keyed by question IDs");
120
+ // Complete translation schema
121
+ export const translationsSchema = z
122
+ .object({
123
+ defaultLanguage: z.string().describe("Default/fallback language code"),
124
+ languages: z.array(languageTranslationsSchema).min(1)
125
+ .describe("Available language translations"),
126
+ version: z.string().optional().describe("Translation version for cache management"),
127
+ })
128
+ .describe("Complete translation schema keyed by question IDs");
129
+ // Translation helper class
130
+ export class TranslationProvider {
131
+ constructor(translations) {
132
+ this.translations = translations;
133
+ }
134
+ /**
135
+ * Get translations for a specific question in a specific language
136
+ */
137
+ getQuestionTranslations(questionId, languageCode) {
138
+ const languageData = this.translations.languages.find(lang => lang.languageCode === languageCode);
139
+ if (!languageData) {
140
+ // Fallback to default language
141
+ const defaultLang = this.translations.languages.find(lang => lang.languageCode === this.translations.defaultLanguage);
142
+ if (!defaultLang)
143
+ return null;
144
+ return defaultLang.questions[questionId] || null;
145
+ }
146
+ return languageData.questions[questionId] || null;
147
+ }
148
+ /**
149
+ * Get a specific translation text
150
+ */
151
+ getTranslationText(questionId, languageCode, path) {
152
+ const questionTranslations = this.getQuestionTranslations(questionId, languageCode);
153
+ if (!questionTranslations)
154
+ return null;
155
+ let current = questionTranslations.translations;
156
+ for (const key of path) {
157
+ if (current && typeof current === 'object' && key in current) {
158
+ current = current[key];
159
+ }
160
+ else {
161
+ return null;
162
+ }
163
+ }
164
+ // Handle nested structures like options
165
+ if (current && typeof current === 'object' && 'text' in current) {
166
+ return current.text;
167
+ }
168
+ return null;
169
+ }
170
+ /**
171
+ * Get all available languages
172
+ */
173
+ getAvailableLanguages() {
174
+ return this.translations.languages.map(lang => lang.languageCode);
175
+ }
176
+ /**
177
+ * Check if a language is supported
178
+ */
179
+ isLanguageSupported(languageCode) {
180
+ return this.translations.languages.some(lang => lang.languageCode === languageCode);
181
+ }
182
+ /**
183
+ * Get the default language
184
+ */
185
+ getDefaultLanguage() {
186
+ return this.translations.defaultLanguage;
187
+ }
188
+ }
189
+ // Factory function to create translation provider
190
+ export function createTranslationProvider(translations) {
191
+ return new TranslationProvider(translations);
192
+ }
193
+ //# sourceMappingURL=translations-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translations-schema.js","sourceRoot":"","sources":["../../../../src/schemas/fields/translations-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,C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AS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,YAAY,KAAK,YAAY,CAAC,CAAC;IACtF,CAAC;IAED;;OAEG;IACH,kBAAkB;QAChB,OAAO,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC;IAC3C,CAAC;CACF;AAED,kDAAkD;AAClD,MAAM,UAAU,yBAAyB,CAAC,YAA0B;IAClE,OAAO,IAAI,mBAAmB,CAAC,YAAY,CAAC,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,9 @@
1
+ export * from './schemas/fields/field-schema';
2
+ export * from './schemas/fields/answer-schema';
3
+ export * from './schemas/fields/form-schema';
4
+ export * from './schemas/fields/form-properties-schema';
5
+ export * from './schemas/fields/other-screen-schema';
6
+ export * from './schemas/fields/theme-schema';
7
+ export * from './schemas/fields/translations-schema';
8
+ export * from './schemas/fields/auto-trigger-schema';
9
+ export { z } from 'zod';
@@ -0,0 +1,77 @@
1
+ import { z } from "zod";
2
+ export declare const SimpleAnswerSchema: z.ZodObject<{
3
+ type: z.ZodLiteral<"simple">;
4
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
5
+ }, z.core.$strip>;
6
+ export declare const ChoiceAnswerSchema: z.ZodObject<{
7
+ type: z.ZodLiteral<"choice">;
8
+ selectedOptionId: z.ZodString;
9
+ }, z.core.$strip>;
10
+ export declare const MultipleChoiceAnswerSchema: z.ZodObject<{
11
+ type: z.ZodLiteral<"multiple_choice">;
12
+ selectedOptionIds: z.ZodArray<z.ZodString>;
13
+ }, z.core.$strip>;
14
+ export declare const ScaleAnswerSchema: z.ZodObject<{
15
+ type: z.ZodLiteral<"scale">;
16
+ value: z.ZodNumber;
17
+ }, z.core.$strip>;
18
+ export declare const ContinuousSumAnswerSchema: z.ZodObject<{
19
+ type: z.ZodLiteral<"continuous_sum">;
20
+ values: z.ZodArray<z.ZodObject<{
21
+ optionId: z.ZodString;
22
+ value: z.ZodNumber;
23
+ }, z.core.$strip>>;
24
+ }, z.core.$strip>;
25
+ export declare const RankingAnswerSchema: z.ZodObject<{
26
+ type: z.ZodLiteral<"ranking">;
27
+ ranks: z.ZodArray<z.ZodObject<{
28
+ optionId: z.ZodString;
29
+ rank: z.ZodNumber;
30
+ }, z.core.$strip>>;
31
+ }, z.core.$strip>;
32
+ export declare const TextAnswerSchema: z.ZodObject<{
33
+ type: z.ZodLiteral<"text">;
34
+ values: z.ZodArray<z.ZodObject<{
35
+ fieldId: z.ZodString;
36
+ text: z.ZodString;
37
+ }, z.core.$strip>>;
38
+ }, z.core.$strip>;
39
+ export declare const AnswerSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
40
+ type: z.ZodLiteral<"simple">;
41
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
42
+ }, z.core.$strip>, z.ZodObject<{
43
+ type: z.ZodLiteral<"choice">;
44
+ selectedOptionId: z.ZodString;
45
+ }, z.core.$strip>, z.ZodObject<{
46
+ type: z.ZodLiteral<"multiple_choice">;
47
+ selectedOptionIds: z.ZodArray<z.ZodString>;
48
+ }, z.core.$strip>, z.ZodObject<{
49
+ type: z.ZodLiteral<"scale">;
50
+ value: z.ZodNumber;
51
+ }, z.core.$strip>, z.ZodObject<{
52
+ type: z.ZodLiteral<"continuous_sum">;
53
+ values: z.ZodArray<z.ZodObject<{
54
+ optionId: z.ZodString;
55
+ value: z.ZodNumber;
56
+ }, z.core.$strip>>;
57
+ }, z.core.$strip>, z.ZodObject<{
58
+ type: z.ZodLiteral<"ranking">;
59
+ ranks: z.ZodArray<z.ZodObject<{
60
+ optionId: z.ZodString;
61
+ rank: z.ZodNumber;
62
+ }, z.core.$strip>>;
63
+ }, z.core.$strip>, z.ZodObject<{
64
+ type: z.ZodLiteral<"text">;
65
+ values: z.ZodArray<z.ZodObject<{
66
+ fieldId: z.ZodString;
67
+ text: z.ZodString;
68
+ }, z.core.$strip>>;
69
+ }, z.core.$strip>], "type">;
70
+ export type SimpleAnswer = z.infer<typeof SimpleAnswerSchema>;
71
+ export type ChoiceAnswer = z.infer<typeof ChoiceAnswerSchema>;
72
+ export type MultipleChoiceAnswer = z.infer<typeof MultipleChoiceAnswerSchema>;
73
+ export type ScaleAnswer = z.infer<typeof ScaleAnswerSchema>;
74
+ export type ContinuousSumAnswer = z.infer<typeof ContinuousSumAnswerSchema>;
75
+ export type RankingAnswer = z.infer<typeof RankingAnswerSchema>;
76
+ export type TextAnswer = z.infer<typeof TextAnswerSchema>;
77
+ export type Answer = z.infer<typeof AnswerSchema>;
@@ -0,0 +1,21 @@
1
+ import { z } from "zod";
2
+ export declare const audienceSegmentSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ name: z.ZodString;
5
+ isImportant: z.ZodBoolean;
6
+ when: z.ZodString;
7
+ who: z.ZodString;
8
+ }, z.core.$strip>;
9
+ export declare const audienceTriggerPropertiesSchema: z.ZodObject<{
10
+ isAuto: z.ZodBoolean;
11
+ isManual: z.ZodBoolean;
12
+ segments: z.ZodArray<z.ZodObject<{
13
+ id: z.ZodString;
14
+ name: z.ZodString;
15
+ isImportant: z.ZodBoolean;
16
+ when: z.ZodString;
17
+ who: z.ZodString;
18
+ }, z.core.$strip>>;
19
+ }, z.core.$strip>;
20
+ export type AudienceSegment = z.infer<typeof audienceSegmentSchema>;
21
+ export type AudienceTriggerProperties = z.infer<typeof audienceTriggerPropertiesSchema>;