@encatch/schema 0.1.38 → 1.0.0-beta.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.
package/README.md CHANGED
@@ -146,7 +146,7 @@ const validated = submitFeedbackSchema.parse(feedbackData);
146
146
 
147
147
  ### Theme Schemas
148
148
  - Themes: `themesSchema`, `themeConfigurationSchema`
149
- - Colors: `themeColorsSchema`
149
+ - Theme (per mode): `themeColorsSchema` (shadcn variables JSON)
150
150
  - Features: `featureSettingsSchema`
151
151
 
152
152
  ### Translation Schemas
package/dist/esm/index.js CHANGED
@@ -836,6 +836,14 @@ var ThemeModes = {
836
836
  LIGHT: "light",
837
837
  DARK: "dark"
838
838
  };
839
+ var shareableModeSchema = z6.enum(["light", "dark", "system"]).describe(
840
+ "Display mode for the shareable widget: light, dark, or system preference"
841
+ );
842
+ var ShareableModes = {
843
+ LIGHT: "light",
844
+ DARK: "dark",
845
+ SYSTEM: "system"
846
+ };
839
847
  var featureSettingsSchema = z6.object({
840
848
  darkOverlay: z6.boolean().describe("Whether to show a dark overlay behind the widget"),
841
849
  closeButton: z6.boolean().describe("Whether to display a close button on the widget"),
@@ -843,31 +851,14 @@ var featureSettingsSchema = z6.object({
843
851
  showBranding: z6.boolean().describe("Whether to display branding elements on the widget"),
844
852
  customPosition: z6.boolean().describe("Whether custom positioning is enabled"),
845
853
  customIconPosition: z6.boolean().describe("Whether custom icon positioning is enabled"),
846
- customCss: z6.string().optional().describe("Custom CSS link to apply for the feedback form")
854
+ customCss: z6.string().optional().describe("Custom CSS link to apply for the feedback form"),
855
+ shareableMode: shareableModeSchema.optional().describe(
856
+ "Display mode for the shareable: light, dark, or system preference"
857
+ )
847
858
  }).describe("Feature settings controlling widget UI behavior and appearance");
848
859
  var themeColorsSchema = z6.object({
849
- brandColor: z6.string().regex(
850
- /^#([0-9A-F]{3}|[0-9A-F]{6})$/i,
851
- "Must be a valid hex color (e.g., #3366CC)"
852
- ).describe("Primary brand color in hex format"),
853
- overlayColor: z6.string().regex(
854
- /^#([0-9A-F]{3}|[0-9A-F]{6})$/i,
855
- "Must be a valid hex color (e.g., #FFFFFF)"
856
- ).describe("Overlay background color in hex format"),
857
- textColor: z6.string().regex(
858
- /^#([0-9A-F]{3}|[0-9A-F]{6})$/i,
859
- "Must be a valid hex color (e.g., #333333)"
860
- ).describe("Primary text color in hex format"),
861
- backgroundColor: z6.union([
862
- z6.string().regex(/^#([0-9A-F]{3}|[0-9A-F]{6})$/i),
863
- z6.string().regex(
864
- /^rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(?:,\s*[01](?:\.\d+)?)?\s*\)$/i
865
- )
866
- ]).describe(
867
- "Background color in hex format or rgba format (e.g., #1A1A1A or rgba(255,255,255, 1))"
868
- ),
869
- theme: z6.string().optional().describe("JSON string of shadcn variables for the theme")
870
- }).describe("Color scheme for a single theme");
860
+ theme: z6.string().optional().describe("Theme for a single mode (shadcn variables JSON)")
861
+ }).describe("Theme for a single mode (shadcn variables)");
871
862
  var themesSchema = z6.object({
872
863
  light: themeColorsSchema,
873
864
  dark: themeColorsSchema
@@ -1081,16 +1072,11 @@ var userInfoSchema = z10.object({
1081
1072
 
1082
1073
  // src/schemas/api/submit-feedback-schema.ts
1083
1074
  import { z as z11 } from "zod";
1084
- var userActionSchema = z11.enum(["V", "S"]).describe("User action: V for view, S for submit");
1085
- var UserActions = {
1086
- VIEW: "V",
1087
- SUBMIT: "S"
1088
- };
1089
1075
  var formConfigSchema = z11.object({
1090
1076
  feedbackIdentifier: z11.string().uuid().describe("Unique identifier for the feedback instance"),
1091
1077
  feedbackConfigurationId: z11.string().uuid().describe("Unique identifier for the feedback configuration"),
1092
1078
  completionTimeInSeconds: z11.number().int().min(0).describe("Time taken to complete the feedback in seconds"),
1093
- userAction: userActionSchema.describe("Action performed by the user"),
1079
+ isPartialSubmit: z11.boolean().describe("Whether this is a partial submission (true) or full submission (false)"),
1094
1080
  responseLanguageCode: z11.string().length(2).describe("Language code for the response (e.g., 'en', 'es')")
1095
1081
  }).describe("Configuration information for the feedback form");
1096
1082
  var questionResponseSchema = z11.object({
@@ -1117,18 +1103,19 @@ var baseSubmitFeedbackSchema = z11.object({
1117
1103
  ),
1118
1104
  customProperties: z11.record(z11.string(), z11.unknown()).optional().describe("Custom properties for advanced use cases")
1119
1105
  }).describe("Base submit feedback request schema");
1120
- var viewFeedbackSchema = baseSubmitFeedbackSchema.extend({
1106
+ var partialFeedbackSchema = baseSubmitFeedbackSchema.extend({
1121
1107
  formConfig: formConfigSchema.extend({
1122
- userAction: z11.literal("V").describe("Action performed by the user (view)")
1123
- })
1124
- }).strict().describe("View feedback request schema (no response required)");
1108
+ isPartialSubmit: z11.literal(true).describe("Indicates this is a partial submission")
1109
+ }),
1110
+ response: responseSchema.optional().describe("User responses (optional for partial submit)")
1111
+ }).describe("Partial feedback request schema (response optional)");
1125
1112
  var submitFeedbackSchema = baseSubmitFeedbackSchema.extend({
1126
1113
  formConfig: formConfigSchema.extend({
1127
- userAction: z11.literal("S").describe("Action performed by the user (submit)")
1114
+ isPartialSubmit: z11.literal(false).describe("Indicates this is a full submission")
1128
1115
  }),
1129
- response: responseSchema.describe("User responses (required for submit)")
1130
- }).strict().describe("Submit feedback request schema (response required)");
1131
- var feedbackRequestSchema = z11.union([viewFeedbackSchema, submitFeedbackSchema]).describe("Union schema for both view and submit feedback requests");
1116
+ response: responseSchema.describe("User responses (required for full submit)")
1117
+ }).describe("Full submit feedback request schema (response required)");
1118
+ var feedbackRequestSchema = z11.union([partialFeedbackSchema, submitFeedbackSchema]).describe("Union schema for both partial and full feedback submissions");
1132
1119
 
1133
1120
  // src/schemas/api/fetch-feedback-schema.ts
1134
1121
  import { z as z12 } from "zod";
@@ -1143,17 +1130,11 @@ var feedbackConfigurationItemSchema = z12.object({
1143
1130
  appearanceProperties: z12.object({
1144
1131
  themes: z12.object({
1145
1132
  light: z12.object({
1146
- brandColor: z12.string().describe("Brand color for light theme"),
1147
- overlayColor: z12.string().describe("Overlay color for light theme"),
1148
- textColor: z12.string().describe("Text color for light theme"),
1149
- backgroundColor: z12.string().describe("Background color for light theme")
1150
- }).describe("Light theme colors"),
1133
+ theme: z12.string().optional().describe("Theme for light mode (shadcn variables JSON)")
1134
+ }).describe("Light theme"),
1151
1135
  dark: z12.object({
1152
- brandColor: z12.string().describe("Brand color for dark theme"),
1153
- overlayColor: z12.string().describe("Overlay color for dark theme"),
1154
- textColor: z12.string().describe("Text color for dark theme"),
1155
- backgroundColor: z12.string().describe("Background color for dark theme")
1156
- }).describe("Dark theme colors")
1136
+ theme: z12.string().optional().describe("Theme for dark mode (shadcn variables JSON)")
1137
+ }).describe("Dark theme")
1157
1138
  }).nullable().optional().describe("Theme configuration (optional)"),
1158
1139
  featureSettings: z12.object({
1159
1140
  darkOverlay: z12.boolean().describe("Whether to show dark overlay"),
@@ -1392,10 +1373,10 @@ export {
1392
1373
  RatingDisplayStyles,
1393
1374
  RatingRepresentationSizes,
1394
1375
  RecurringUnits,
1376
+ ShareableModes,
1395
1377
  SurveyTypes,
1396
1378
  ThemeModes,
1397
1379
  TranslationProvider,
1398
- UserActions,
1399
1380
  ValidationRuleTypes,
1400
1381
  VisibilityConditionOperators,
1401
1382
  WelcomeFieldsTranslationSchema,
@@ -1456,6 +1437,7 @@ export {
1456
1437
  objectToPascal,
1457
1438
  objectToSnake,
1458
1439
  otherConfigurationPropertiesSchema,
1440
+ partialFeedbackSchema,
1459
1441
  positionSchema,
1460
1442
  publicationStatusSchema,
1461
1443
  queryOutputSchema,
@@ -1478,6 +1460,7 @@ export {
1478
1460
  responseSchema,
1479
1461
  sectionSchema,
1480
1462
  sessionInfoSchema,
1463
+ shareableModeSchema,
1481
1464
  shortAnswerQuestionSchema,
1482
1465
  shortAnswerQuestionTranslationSchema,
1483
1466
  singleChoiceQuestionTranslationSchema,
@@ -1493,12 +1476,10 @@ export {
1493
1476
  translationEntrySchema,
1494
1477
  translationsSchema,
1495
1478
  triggerActionSchema,
1496
- userActionSchema,
1497
1479
  userInfoSchema,
1498
1480
  userPropertiesSchema,
1499
1481
  validationRuleSchema,
1500
1482
  validationRuleTypeSchema,
1501
- viewFeedbackSchema,
1502
1483
  visibilityConditionSchema,
1503
1484
  welcomeScreenPropertiesSchema,
1504
1485
  whoSchema,