@encatch/schema 1.3.0-beta.4 → 1.3.0-beta.6

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
@@ -1995,6 +1995,14 @@ var PreviousButtonModes = {
1995
1995
  ALWAYS: "always",
1996
1996
  AUTO: "auto"
1997
1997
  };
1998
+ var inAppDisplayTypeSchema = z7.enum(["auto", "modal", "selector"]).describe(
1999
+ "How the form is presented on in-app surfaces: auto (#encatch host or modal), modal (always modal), or selector (render into inAppSelector)"
2000
+ );
2001
+ var InAppDisplayTypes = {
2002
+ AUTO: "auto",
2003
+ MODAL: "modal",
2004
+ SELECTOR: "selector"
2005
+ };
1998
2006
  var logoPlacementSchema = z7.enum(["top-left", "top-center", "top-right"]).describe("Where the logo is anchored in the form header");
1999
2007
  var logoSizeSchema = z7.enum(["small", "medium", "large"]).describe("Rendered display size of the logo within the 96\xD740 px container");
2000
2008
  var logoSurfaceOverrideSchema = z7.object({
@@ -2036,6 +2044,10 @@ var featureSettingsSchema = z7.object({
2036
2044
  rtl: z7.boolean().default(false).describe("Whether right-to-left text direction is enabled"),
2037
2045
  previousButton: previousButtonModeSchema.default(PreviousButtonModes.ALWAYS).describe("Previous button: never (hidden) or always (shown)"),
2038
2046
  maxDialogHeightPercentInApp: z7.number().int().min(10).max(100).optional().describe("Maximum height of the in-app dialog as a percentage of the viewport height (10\u2013100); when absent the dialog uses its default height"),
2047
+ inAppDisplayType: inAppDisplayTypeSchema.default(InAppDisplayTypes.AUTO).describe(
2048
+ "How the form is presented on in-app surfaces: auto (#encatch host or modal), modal (always modal), or selector (render into inAppSelector)"
2049
+ ),
2050
+ inAppSelector: z7.string().optional().describe("CSS selector for the host element to render the form into when inAppDisplayType is 'selector'; if it matches nothing the form falls back to the modal"),
2039
2051
  faviconUrl: z7.string().optional().describe("URL of a custom favicon image to display in the browser tab; when absent the platform default favicon is used"),
2040
2052
  logo: logoSchema.optional().describe("Optional form-level logo shown in the header on link/shareable surfaces; omit to show no logo")
2041
2053
  }).describe("Feature settings controlling widget UI behavior and appearance");
@@ -2361,8 +2373,10 @@ var formConfigSchema = z13.object({
2361
2373
  }).describe("Configuration information for the feedback form");
2362
2374
  var questionResponseSchema = z13.object({
2363
2375
  questionId: z13.string().uuid().describe("Unique identifier for the question"),
2364
- answer: AnswerSchema.describe("The answer provided for this question"),
2365
- type: z13.string().describe("Type of the question (e.g., 'rating', 'single_choice')"),
2376
+ answer: AnswerSchema.nullable().optional().describe(
2377
+ "The answer provided for this question; null for display-only types (thank_you, welcome, exit_form) or unanswered questions on the respondent's path"
2378
+ ),
2379
+ type: z13.string().optional().describe("Type of the question (e.g., 'rating', 'single_choice')"),
2366
2380
  error: z13.string().optional().describe("Error message if any validation failed"),
2367
2381
  isOnPath: z13.boolean().optional().describe(
2368
2382
  "When present, whether this question was on the respondent's navigation path (e.g. logic jumps); false for questions not reached"
@@ -2405,6 +2419,26 @@ var submitFeedbackSchema = baseSubmitFeedbackSchema.extend({
2405
2419
  response: responseSchema.describe("User responses (required for full submit)")
2406
2420
  }).describe("Full submit feedback request schema (response required)");
2407
2421
  var feedbackRequestSchema = z13.union([partialFeedbackSchema, submitFeedbackSchema]).describe("Union schema for both partial and full feedback submissions");
2422
+ var formDetailsSchema = z13.object({
2423
+ formConfigurationId: z13.string().uuid().describe("Server-issued configuration ID for this form"),
2424
+ feedbackIdentifier: z13.string().optional().describe("Instance identifier for the feedback session"),
2425
+ responseLanguageCode: z13.string().optional().describe("Two-letter language code for the response (e.g., 'en')"),
2426
+ isPartialSubmit: z13.boolean().optional().describe("When true, marks this as a partial (mid-journey) submission"),
2427
+ completionTimeInSeconds: z13.number().int().min(0).optional().describe("Total time taken to complete the form in seconds"),
2428
+ response: z13.object({
2429
+ questions: z13.array(questionResponseSchema).optional().describe("Array of per-question responses"),
2430
+ context: z13.record(z13.string(), z13.unknown()).optional().describe("Liquid variable substitution values from the showForm context option"),
2431
+ contact: z13.record(z13.string(), z13.unknown()).optional().describe("Contact properties from the server for Liquid substitution"),
2432
+ sourceTrackingFieldValues: z13.record(z13.string(), z13.string()).optional().describe("Source tracking field values captured at survey load time")
2433
+ }).optional().describe("User responses to the form questions"),
2434
+ visitedQuestionIds: z13.array(z13.string()).optional().describe("Ordered list of question IDs the respondent actually navigated to"),
2435
+ context: z13.record(z13.string(), z13.union([z13.string(), z13.number(), z13.boolean()])).optional().describe("Caller-provided metadata attached to this submission")
2436
+ }).describe("Form details for an SDK-style submit-form request");
2437
+ var submitFormRequestSchema = z13.object({
2438
+ triggerType: z13.enum(["automatic", "manual"]).optional().describe("Whether the form was triggered automatically or manually"),
2439
+ formDetails: formDetailsSchema.describe("Core submission payload"),
2440
+ $deviceInfo: z13.record(z13.string(), z13.unknown()).optional().describe("Device and SDK metadata automatically injected by the SDK")
2441
+ }).describe("Complete submit-form request envelope (SDK-facing contract)");
2408
2442
 
2409
2443
  // src/schemas/api/fetch-feedback-schema.ts
2410
2444
  import { z as z14 } from "zod";
@@ -2664,6 +2698,7 @@ export {
2664
2698
  DeviceThemes,
2665
2699
  FileUploadAnswerItemSchema,
2666
2700
  FileUploadAnswerSchema,
2701
+ InAppDisplayTypes,
2667
2702
  LanguageFieldSchema,
2668
2703
  LanguagesSchema,
2669
2704
  LayoutAttachmentTypes,
@@ -2749,9 +2784,11 @@ export {
2749
2784
  focalPointSchema,
2750
2785
  formConfigSchema,
2751
2786
  formConfigurationResponseSchema,
2787
+ formDetailsSchema,
2752
2788
  formPropertiesSchema,
2753
2789
  gradientAttachmentSchema,
2754
2790
  imageAttachmentSchema,
2791
+ inAppDisplayTypeSchema,
2755
2792
  layoutAttachmentSchema,
2756
2793
  layoutSurfaceSchema,
2757
2794
  logicJumpRuleSchema,
@@ -2840,6 +2877,7 @@ export {
2840
2877
  splitLayoutSchema,
2841
2878
  stackLayoutSchema,
2842
2879
  submitFeedbackSchema,
2880
+ submitFormRequestSchema,
2843
2881
  thankYouQuestionSchema,
2844
2882
  thankYouQuestionTranslationSchema,
2845
2883
  themeColorsSchema,