@encatch/schema 1.0.1-beta.3 → 1.1.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 CHANGED
@@ -10,13 +10,15 @@ var translationEntrySchema = z.string().min(1).describe("Translated text content
10
10
  var baseQuestionTranslationFieldsSchema = z.object({
11
11
  title: translationEntrySchema.describe("Question title translation"),
12
12
  description: translationEntrySchema.optional().describe("Question description translation"),
13
- errorMessage: translationEntrySchema.optional().describe("Error message translation")
13
+ errorMessage: translationEntrySchema.optional().describe("Error message translation"),
14
+ nextButtonLabel: translationEntrySchema.max(50).optional().describe("Next button label translation when advancing past this question")
14
15
  });
15
16
  var BASE_QUESTION_TRANSLATION_KEYS = [
16
17
  "type",
17
18
  "title",
18
19
  "description",
19
- "errorMessage"
20
+ "errorMessage",
21
+ "nextButtonLabel"
20
22
  ];
21
23
  var ratingQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
22
24
  type: z.literal("rating").describe("Question type identifier"),
@@ -177,6 +179,12 @@ var questionTranslationSchema = z.union([
177
179
  matrixMultipleChoiceQuestionTranslationSchema
178
180
  ]).describe("Union of all question type translation schemas");
179
181
  var languageCodeSchema = z.string().min(2).max(10).describe("Language code (e.g., 'en', 'es', 'hi')");
182
+ var sectionTranslationSchema = z.object({
183
+ title: translationEntrySchema.max(200).describe("Section title translation"),
184
+ description: translationEntrySchema.max(1e3).optional().describe("Section description translation"),
185
+ nextButtonLabel: translationEntrySchema.max(50).optional().describe("Next button label translation for this section")
186
+ }).describe("Translation payload for a section in a single language");
187
+ var sectionTranslationsByLanguageSchema = z.record(languageCodeSchema, sectionTranslationSchema).describe("Section translations keyed by language code");
180
188
  var questionTranslationsByLanguageSchema = z.record(languageCodeSchema, questionTranslationSchema).describe("Question translations keyed by language code");
181
189
  var questionCentricTranslationsSchema = z.record(z.string().uuid(), questionTranslationsByLanguageSchema).describe("Question-centric translations keyed by question ID, then by language code");
182
190
  var translationsSchema = questionCentricTranslationsSchema.describe("Question-centric translations at root level");
@@ -367,23 +375,12 @@ var visibilityConditionSchema = z2.object({
367
375
  var sectionSchema = z2.object({
368
376
  id: z2.string().describe("Unique identifier for the section"),
369
377
  title: z2.string().min(1).max(200).describe("Display title for the section"),
370
- titleTranslations: z2.record(
371
- languageCodeSchema,
372
- z2.string().min(1).max(200)
373
- ).optional().describe("Localized section titles keyed by language code"),
374
378
  description: z2.string().max(1e3).optional().describe("Optional detailed description or help text for the section"),
375
- descriptionTranslations: z2.record(
376
- languageCodeSchema,
377
- z2.string().min(1).max(1e3)
378
- ).optional().describe("Localized section descriptions keyed by language code"),
379
379
  showTitle: z2.boolean().default(true).describe("Whether to show the section title in the UI"),
380
380
  showDescription: z2.boolean().default(true).describe("Whether to show the section description in the UI"),
381
381
  nextButtonLabel: z2.string().min(1).max(50).optional().describe("Label for the next button when navigating from this section"),
382
- nextButtonLabelTranslations: z2.record(
383
- languageCodeSchema,
384
- z2.string().min(1).max(50)
385
- ).optional().describe(
386
- "Localized next-button labels for this section keyed by language code"
382
+ translations: sectionTranslationsByLanguageSchema.optional().describe(
383
+ "Per-language section copy (title, optional description and nextButtonLabel), keyed by language code"
387
384
  ),
388
385
  inAppSingleQuestion: z2.boolean().default(false).describe(
389
386
  "When true, the native app shows one question at a time within this section"
@@ -483,7 +480,10 @@ var questionSchema = z2.object({
483
480
  status: questionStatusSchema.describe(
484
481
  "Current status of the question (Draft, Published, etc.)"
485
482
  ),
486
- textAlign: z2.enum(["left", "center"]).optional().default("left").describe("Text alignment for the question title and description")
483
+ textAlign: z2.enum(["left", "center"]).optional().default("left").describe("Text alignment for the question title and description"),
484
+ nextButtonLabel: z2.string().min(1).max(50).optional().describe(
485
+ "Label for the next button when advancing past this question (overrides section or form defaults when set)"
486
+ )
487
487
  }).describe("Base schema for all question types with common properties");
488
488
  var ratingQuestionSchema = questionSchema.extend({
489
489
  type: z2.literal("rating").describe("Must be exactly 'rating'"),
@@ -1567,6 +1567,8 @@ export {
1567
1567
  refineTextResponseSchema,
1568
1568
  responseSchema,
1569
1569
  sectionSchema,
1570
+ sectionTranslationSchema,
1571
+ sectionTranslationsByLanguageSchema,
1570
1572
  sessionInfoSchema,
1571
1573
  shareableModeSchema,
1572
1574
  shortAnswerQuestionSchema,