:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(surveys): keep question settings in the survey write schema (#117680)
posthog[bot]4bd7444e0cc3
diff --git a/products/desktop/packages/api-client/src/generated.ts b/products/desktop/packages/api-client/src/generated.tsindex 736feb9fb5e3..9325696ab061 100644--- a/products/desktop/packages/api-client/src/generated.ts+++ b/products/desktop/packages/api-client/src/generated.ts@@ -20806,6 +20806,15 @@ export namespace Schemas {* * `link` - link*/export type SurveyLinkQuestionSchemaTypeEnum = "link";+ export type SurveyQuestionTranslationSchema = Partial<{+ question: string;+ description: string;+ buttonText: string;+ lowerBoundLabel: string;+ upperBoundLabel: string;+ choices: Array<string>;+ link: string;+ }>;export type SurveyLinkQuestionSchema = {id?: string | undefined;type: SurveyLinkQuestionSchemaTypeEnum;@@ -20817,10 +20826,14 @@ export namespace Schemas {descriptionContentType?: DescriptionContentTypeEnum | undefined;optional?: boolean | undefined;buttonText?: string | undefined;+ translations?:+ | Record<string, SurveyQuestionTranslationSchema>+ | undefined;/*** HTTPS or mailto URL for link questions.*/link: string;+ branching?: (SurveyBranchingSchema | null) | undefined;};/*** * `multiple_choice` - multiple_choice@@ -20837,6 +20850,9 @@ export namespace Schemas {descriptionContentType?: DescriptionContentTypeEnum | undefined;optional?: boolean | undefined;buttonText?: string | undefined;+ translations?:+ | Record<string, SurveyQuestionTranslationSchema>+ | undefined;/*** Array of choice options. Multiple selections allowed. No branching logic supported.*/@@ -20859,6 +20875,11 @@ export namespace Schemas {descriptionContentType?: DescriptionContentTypeEnum | undefined;optional?: boolean | undefined;buttonText?: string | undefined;+ translations?:+ | Record<string, SurveyQuestionTranslationSchema>+ | undefined;+ validation?: (Array<SurveyQuestionValidationRule> | null) | undefined;+ branching?: (SurveyBranchingSchema | null) | undefined;};/*** * `rating` - rating@@ -20880,10 +20901,14 @@ export namespace Schemas {descriptionContentType?: DescriptionContentTypeEnum | undefined;optional?: boolean | undefined;buttonText?: string | undefined;+ translations?:+ | Record<string, SurveyQuestionTranslationSchema>+ | undefined;display?: SurveyRatingQuestionSchemaDisplayEnum | undefined;scale?: number | undefined;lowerBoundLabel?: string | undefined;upperBoundLabel?: string | undefined;+ isNpsQuestion?: boolean | undefined;branching?: (SurveyBranchingSchema | null) | undefined;};/**@@ -20901,6 +20926,9 @@ export namespace Schemas {descriptionContentType?: DescriptionContentTypeEnum | undefined;optional?: boolean | undefined;buttonText?: string | undefined;+ translations?:+ | Record<string, SurveyQuestionTranslationSchema>+ | undefined;/*** Array of choice options. Choice indices (0, 1, 2, ...) are used for branching logic.*/@@ -20915,6 +20943,26 @@ export namespace Schemas {| SurveyRatingQuestionSchema| SurveySingleChoiceQuestionSchema| SurveyMultipleChoiceQuestionSchema;+ /**+ * * `min_length` - min_length+ * * `max_length` - max_length+ * * `email` - email+ */+ export type SurveyQuestionValidationRuleTypeEnum =+ | "min_length"+ | "max_length"+ | "email";+ export type SurveyQuestionValidationRule = {+ /**+ * Validation rule type for open-text questions.+ *+ * * `min_length` - min_length+ * * `max_length` - max_length+ * * `email` - email+ */+ type: SurveyQuestionValidationRuleTypeEnum;+ value?: (number | null) | undefined;+ };export type SurveySerializerCreateUpdateOnly = {id: string;name: string;diff --git a/products/surveys/backend/api/survey.py b/products/surveys/backend/api/survey.pyindex ab96e3542d52..a048ff3c22ae 100644--- a/products/surveys/backend/api/survey.py+++ b/products/surveys/backend/api/survey.py@@ -509,6 +509,24 @@ class SurveyQuestionValidationRuleSerializer(serializers.Serializer):)+class SurveyQuestionTranslationSchemaSerializer(serializers.Serializer):+ question = serializers.CharField(required=False, allow_blank=True, help_text="Translated question text.")+ description = serializers.CharField(required=False, allow_blank=True, help_text="Translated helper text.")+ buttonText = serializers.CharField(required=False, allow_blank=True, help_text="Translated button label.")+ lowerBoundLabel = serializers.CharField(+ required=False, allow_blank=True, help_text="Translated lowest rating label. Rating questions only."+ )+ upperBoundLabel = serializers.CharField(+ required=False, allow_blank=True, help_text="Translated highest rating label. Rating questions only."+ )+ choices = serializers.ListField(+ child=serializers.CharField(),+ required=False,+ help_text="Translated choices. Must have the same length as the question choices. Choice questions only.",+ )+ link = serializers.CharField(required=False, allow_blank=True, help_text="Translated URL. Link questions only.")++class DescriptionContentType(models.TextChoices):TEXT = "text", "text"HTML = "html", "html"@@ -537,15 +555,31 @@ class SurveyBaseQuestionSchemaSerializer(serializers.Serializer):)optional = serializers.BooleanField(required=False, help_text="Whether respondents may skip this question.")buttonText = serializers.CharField(required=False, allow_blank=True, help_text="Custom button label.")+ translations = serializers.DictField(+ child=SurveyQuestionTranslationSchemaSerializer(),+ required=False,+ help_text=(+ "Inline translations keyed by language code (for example 'es' or 'pt-BR'). "+ "Send back the current value when editing other question fields, or the translations are lost."+ ),+ )class SurveyOpenQuestionSchemaSerializer(SurveyBaseQuestionSchemaSerializer):type = serializers.ChoiceField(choices=["open"], required=True)+ validation = SurveyQuestionValidationRuleSerializer(+ many=True,+ required=False,+ allow_null=True,+ help_text="Validation rules for the response text, for example a minimum length.",+ )+ branching = SurveyBranchingSchemaField(required=False, allow_null=True)class SurveyLinkQuestionSchemaSerializer(SurveyBaseQuestionSchemaSerializer):type = serializers.ChoiceField(choices=["link"], required=True)link = serializers.CharField(required=True, help_text="HTTPS or mailto URL for link questions.")+ branching = SurveyBranchingSchemaField(required=False, allow_null=True)class SurveyRatingQuestionSchemaSerializer(SurveyBaseQuestionSchemaSerializer):@@ -570,6 +604,10 @@ class SurveyRatingQuestionSchemaSerializer(SurveyBaseQuestionSchemaSerializer):allow_blank=True,help_text="Label for the highest rating (e.g., 'Excellent')",)+ isNpsQuestion = serializers.BooleanField(+ required=False,+ help_text="Whether a rating question with a scale of 10 shows NPS scoring. A missing value counts as true.",+ )branching = SurveyBranchingSchemaField(required=False, allow_null=True)diff --git a/products/surveys/backend/api/test/test_survey.py b/products/surveys/backend/api/test/test_survey.pyindex 4cf06a68658d..194186be08df 100644--- a/products/surveys/backend/api/test/test_survey.py+++ b/products/surveys/backend/api/test/test_survey.py@@ -19,7 +19,7 @@ from django.test import SimpleTestCase, override_settingsfrom nanoid import generatefrom parameterized import parameterized-from rest_framework import status+from rest_framework import serializers, statusfrom posthog.hogql.constants import DEFAULT_RETURNED_ROWS@@ -42,6 +42,8 @@ from products.product_tours.backend.models import ProductTourfrom products.surveys.backend.api.survey import (SURVEY_APPEARANCE_HTML_FIELDS,SurveyAppearanceSchemaSerializer,+ SurveyOpenQuestionSchemaSerializer,+ SurveySerializerCreateUpdateOnly,get_survey_api_translations,get_surveys_response,nh3_clean_with_allow_list,@@ -5130,6 +5132,22 @@ class TestGetSurveyConditionsActionSanitization(SimpleTestCase):assert value["name"] == "person subscribed"+class TestSurveyQuestionSchema(SimpleTestCase):+ @parameterized.expand([("validation", True), ("translations", False)])+ def test_nullability_matches_runtime_validation(self, field: str, allows_null: bool) -> None:+ question = {"type": "open", "question": "How was your experience?", field: None}+ runtime_serializer = SurveySerializerCreateUpdateOnly()+ schema_serializer = SurveyOpenQuestionSchemaSerializer(data=question)++ if allows_null:+ assert runtime_serializer.validate_questions([question]) == [question]+ else:+ with pytest.raises(serializers.ValidationError, match="translations must be an object"):+ runtime_serializer.validate_questions([question])++ assert schema_serializer.is_valid() == allows_null, schema_serializer.errors++class TestSurveyAppearanceSchema(SimpleTestCase):def test_documented_schema_keeps_every_supported_appearance_key(self) -> None:appearance = {diff --git a/products/surveys/frontend/generated/api.schemas.ts b/products/surveys/frontend/generated/api.schemas.tsindex 49c748c876c8..4c1d498a49e6 100644--- a/products/surveys/frontend/generated/api.schemas.ts+++ b/products/surveys/frontend/generated/api.schemas.ts@@ -942,78 +942,52 @@ export const DescriptionContentTypeEnumApi = {Text: 'text',} as const-export interface SurveyOpenQuestionSchemaApi {- /** Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one. */- id?: string- type: SurveyOpenQuestionSchemaTypeEnumApi- /** Question text shown to respondents. */- question: string- /** Optional helper text. */+export interface SurveyQuestionTranslationSchemaApi {+ /** Translated question text. */+ question?: string+ /** Translated helper text. */description?: string- /** Format for the description field.- *- * * `text` - text- * * `html` - html */- descriptionContentType?: DescriptionContentTypeEnumApi- /** Whether respondents may skip this question. */- optional?: boolean- /** Custom button label. */+ /** Translated button label. */buttonText?: string+ /** Translated lowest rating label. Rating questions only. */+ lowerBoundLabel?: string+ /** Translated highest rating label. Rating questions only. */+ upperBoundLabel?: string+ /** Translated choices. Must have the same length as the question choices. Choice questions only. */+ choices?: string[]+ /** Translated URL. Link questions only. */+ link?: string}/**- * * `link` - link+ * * `min_length` - min_length+ * * `max_length` - max_length+ * * `email` - email*/-export type SurveyLinkQuestionSchemaTypeEnumApi =- (typeof SurveyLinkQuestionSchemaTypeEnumApi)[keyof typeof SurveyLinkQuestionSchemaTypeEnumApi]+export type SurveyQuestionValidationRuleTypeEnumApi =+ (typeof SurveyQuestionValidationRuleTypeEnumApi)[keyof typeof SurveyQuestionValidationRuleTypeEnumApi]-export const SurveyLinkQuestionSchemaTypeEnumApi = {- Link: 'link',+export const SurveyQuestionValidationRuleTypeEnumApi = {+ MinLength: 'min_length',+ MaxLength: 'max_length',+ Email: 'email',} as const-export interface SurveyLinkQuestionSchemaApi {- /** Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one. */- id?: string- type: SurveyLinkQuestionSchemaTypeEnumApi- /** Question text shown to respondents. */- question: string- /** Optional helper text. */- description?: string- /** Format for the description field.+export interface SurveyQuestionValidationRuleApi {+ /** Validation rule type for open-text questions.*- * * `text` - text- * * `html` - html */- descriptionContentType?: DescriptionContentTypeEnumApi- /** Whether respondents may skip this question. */- optional?: boolean- /** Custom button label. */- buttonText?: string- /** HTTPS or mailto URL for link questions. */- link: string+ * * `min_length` - min_length+ * * `max_length` - max_length+ * * `email` - email */+ type: SurveyQuestionValidationRuleTypeEnumApi+ /**+ * Rule value for min_length or max_length validations.+ * @minimum 1+ * @nullable+ */+ value?: number | null}-/**- * * `rating` - rating- */-export type SurveyRatingQuestionSchemaTypeEnumApi =- (typeof SurveyRatingQuestionSchemaTypeEnumApi)[keyof typeof SurveyRatingQuestionSchemaTypeEnumApi]--export const SurveyRatingQuestionSchemaTypeEnumApi = {- Rating: 'rating',-} as const--/**- * * `number` - number- * * `emoji` - emoji- */-export type SurveyRatingQuestionSchemaDisplayEnumApi =- (typeof SurveyRatingQuestionSchemaDisplayEnumApi)[keyof typeof SurveyRatingQuestionSchemaDisplayEnumApi]--export const SurveyRatingQuestionSchemaDisplayEnumApi = {- Number: 'number',- Emoji: 'emoji',-} as const-/*** * `next_question` - next_question*/@@ -1100,6 +1074,104 @@ export type SurveyBranchingSchemaApi =| SurveySpecificQuestionBranchingApi| SurveyResponseBasedBranchingApi+/**+ * Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost.+ */+export type SurveyOpenQuestionSchemaApiTranslations = { [key: string]: SurveyQuestionTranslationSchemaApi }++export interface SurveyOpenQuestionSchemaApi {+ /** Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one. */+ id?: string+ type: SurveyOpenQuestionSchemaTypeEnumApi+ /** Question text shown to respondents. */+ question: string+ /** Optional helper text. */+ description?: string+ /** Format for the description field.+ *+ * * `text` - text+ * * `html` - html */+ descriptionContentType?: DescriptionContentTypeEnumApi+ /** Whether respondents may skip this question. */+ optional?: boolean+ /** Custom button label. */+ buttonText?: string+ /** Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost. */+ translations?: SurveyOpenQuestionSchemaApiTranslations+ /**+ * Validation rules for the response text, for example a minimum length.+ * @nullable+ */+ validation?: SurveyQuestionValidationRuleApi[] | null+ branching?: SurveyBranchingSchemaApi | null+}++/**+ * * `link` - link+ */+export type SurveyLinkQuestionSchemaTypeEnumApi =+ (typeof SurveyLinkQuestionSchemaTypeEnumApi)[keyof typeof SurveyLinkQuestionSchemaTypeEnumApi]++export const SurveyLinkQuestionSchemaTypeEnumApi = {+ Link: 'link',+} as const++/**+ * Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost.+ */+export type SurveyLinkQuestionSchemaApiTranslations = { [key: string]: SurveyQuestionTranslationSchemaApi }++export interface SurveyLinkQuestionSchemaApi {+ /** Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one. */+ id?: string+ type: SurveyLinkQuestionSchemaTypeEnumApi+ /** Question text shown to respondents. */+ question: string+ /** Optional helper text. */+ description?: string+ /** Format for the description field.+ *+ * * `text` - text+ * * `html` - html */+ descriptionContentType?: DescriptionContentTypeEnumApi+ /** Whether respondents may skip this question. */+ optional?: boolean+ /** Custom button label. */+ buttonText?: string+ /** Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost. */+ translations?: SurveyLinkQuestionSchemaApiTranslations+ /** HTTPS or mailto URL for link questions. */+ link: string+ branching?: SurveyBranchingSchemaApi | null+}++/**+ * * `rating` - rating+ */+export type SurveyRatingQuestionSchemaTypeEnumApi =+ (typeof SurveyRatingQuestionSchemaTypeEnumApi)[keyof typeof SurveyRatingQuestionSchemaTypeEnumApi]++export const SurveyRatingQuestionSchemaTypeEnumApi = {+ Rating: 'rating',+} as const++/**+ * * `number` - number+ * * `emoji` - emoji+ */+export type SurveyRatingQuestionSchemaDisplayEnumApi =+ (typeof SurveyRatingQuestionSchemaDisplayEnumApi)[keyof typeof SurveyRatingQuestionSchemaDisplayEnumApi]++export const SurveyRatingQuestionSchemaDisplayEnumApi = {+ Number: 'number',+ Emoji: 'emoji',+} as const++/**+ * Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost.+ */+export type SurveyRatingQuestionSchemaApiTranslations = { [key: string]: SurveyQuestionTranslationSchemaApi }+export interface SurveyRatingQuestionSchemaApi {/** Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one. */id?: string@@ -1117,6 +1189,8 @@ export interface SurveyRatingQuestionSchemaApi {optional?: boolean/** Custom button label. */buttonText?: string+ /** Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost. */+ translations?: SurveyRatingQuestionSchemaApiTranslations/** Display format: 'number' shows numeric scale, 'emoji' shows emoji scale.** * `number` - number@@ -1131,6 +1205,8 @@ export interface SurveyRatingQuestionSchemaApi {lowerBoundLabel?: string/** Label for the highest rating (e.g., 'Excellent') */upperBoundLabel?: string+ /** Whether a rating question with a scale of 10 shows NPS scoring. A missing value counts as true. */+ isNpsQuestion?: booleanbranching?: SurveyBranchingSchemaApi | null}@@ -1144,6 +1220,11 @@ export const SurveySingleChoiceQuestionSchemaTypeEnumApi = {SingleChoice: 'single_choice',} as const+/**+ * Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost.+ */+export type SurveySingleChoiceQuestionSchemaApiTranslations = { [key: string]: SurveyQuestionTranslationSchemaApi }+export interface SurveySingleChoiceQuestionSchemaApi {/** Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one. */id?: string@@ -1161,6 +1242,8 @@ export interface SurveySingleChoiceQuestionSchemaApi {optional?: boolean/** Custom button label. */buttonText?: string+ /** Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost. */+ translations?: SurveySingleChoiceQuestionSchemaApiTranslations/*** Array of choice options. Choice indices (0, 1, 2, ...) are used for branching logic.* @minItems 2@@ -1184,6 +1267,11 @@ export const SurveyMultipleChoiceQuestionSchemaTypeEnumApi = {MultipleChoice: 'multiple_choice',} as const+/**+ * Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost.+ */+export type SurveyMultipleChoiceQuestionSchemaApiTranslations = { [key: string]: SurveyQuestionTranslationSchemaApi }+export interface SurveyMultipleChoiceQuestionSchemaApi {/** Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one. */id?: string@@ -1201,6 +1289,8 @@ export interface SurveyMultipleChoiceQuestionSchemaApi {optional?: boolean/** Custom button label. */buttonText?: string+ /** Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost. */+ translations?: SurveyMultipleChoiceQuestionSchemaApiTranslations/*** Array of choice options. Multiple selections allowed. No branching logic supported.* @minItems 2diff --git a/products/surveys/frontend/generated/api.zod.ts b/products/surveys/frontend/generated/api.zod.tsindex 6f4d5467ee6e..b8d59cce35e0 100644--- a/products/surveys/frontend/generated/api.zod.ts+++ b/products/surveys/frontend/generated/api.zod.ts@@ -77,927 +77,9 @@ export const DesktopFeedbackCreateBody = /* @__PURE__ */ zod.object({* decorator on serializer methods and converts them into the same responses the viewset path* produces (see decorators._result_to_response), so both paths share one contract.*/-export const surveysCreateBodyNameMax = 400--export const surveysCreateBodyTargetingFlagFiltersOneEarlyExitDefault = false-export const surveysCreateBodyQuestionsItemThreeBranchingOneThreeIndexMin = 0--export const surveysCreateBodyQuestionsItemThreeBranchingOneFourResponseValuesOneMin = 0--export const surveysCreateBodyQuestionsItemFourChoicesMin = 2-export const surveysCreateBodyQuestionsItemFourChoicesMax = 20--export const surveysCreateBodyQuestionsItemFourBranchingOneThreeIndexMin = 0--export const surveysCreateBodyQuestionsItemFourBranchingOneFourResponseValuesOneMin = 0--export const surveysCreateBodyQuestionsItemFiveChoicesMin = 2-export const surveysCreateBodyQuestionsItemFiveChoicesMax = 20--export const surveysCreateBodyConditionsOneSeenSurveyWaitPeriodInDaysMin = 0--export const surveysCreateBodyIterationCountMax = 500--export const surveysCreateBodyIterationFrequencyDaysMax = 365--export const surveysCreateBodyCurrentIterationMin = 0-export const surveysCreateBodyCurrentIterationMax = 2147483647--export const surveysCreateBodyResponseSamplingIntervalMin = 0-export const surveysCreateBodyResponseSamplingIntervalMax = 2147483647--export const surveysCreateBodyResponseSamplingLimitMin = 0-export const surveysCreateBodyResponseSamplingLimitMax = 2147483647--export const surveysCreateBodyBaseLanguageMax = 20--export const SurveysCreateBody = /* @__PURE__ */ zod.object({- name: zod- .string()- .min(1)- .max(surveysCreateBodyNameMax)- .describe(- "Survey name. Anyone can read it. In-app surveys send it to every visitor's browser alongside the questions and appearance text, and a hosted survey shows it on its public page. Keep customer names and other private details out of it."- ),- description: zod- .string()- .optional()- .describe(- 'Survey description. Internal only: unlike the name and questions, it is never delivered to visitors.'- ),- type: zod- .enum(['popover', 'widget', 'external_survey', 'api'])- .describe(- '\* `popover` - popover\n\* `widget` - widget\n\* `external_survey` - external survey\n\* `api` - api'- )- .describe(- 'Survey type.\n\n\* `popover` - popover\n\* `widget` - widget\n\* `external_survey` - external survey\n\* `api` - api'- ),- schedule: zod- .union([- zod- .enum(['once', 'recurring', 'always'])- .describe('\* `once` - once\n\* `recurring` - recurring\n\* `always` - always'),- zod.null(),- ])- .optional()- .describe(- "Survey scheduling behavior: 'once' = show once per user (default), 'recurring' = repeat based on iteration_count and iteration_frequency_days settings, 'always' = show every time conditions are met (mainly for widget surveys)\n\n\* `once` - once\n\* `recurring` - recurring\n\* `always` - always"- ),- linked_flag_id: zod.number().nullish().describe('The feature flag linked to this survey.'),- linked_insight_id: zod.number().nullish(),- targeting_flag_id: zod.number().optional().describe('An existing targeting flag to use for this survey.'),- targeting_flag_filters: zod- .union([- zod.object({- groups: zod- .array(- zod.object({- properties: zod- .array(- zod.union([- zod.object({- key: zod- .string()- .describe('Property key used in this feature flag condition.'),- type: zod- .enum(['cohort', 'person', 'group'])- .describe(- '\* `cohort` - cohort\n\* `person` - person\n\* `group` - group'- )- .optional()- .describe(- "Property filter type. Set it on every property. Use `group` with `group_type_index` to filter on a group's properties.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"- ),- cohort_name: zod- .string()- .nullish()- .describe('Resolved cohort name for cohort-type filters.'),- group_type_index: zod- .number()- .nullish()- .describe(- "Group type index a `group` filter reads properties from. Defaults to the condition set's `aggregation_group_type_index`."- ),- value: zod- .unknown()- .describe(- 'Comparison value for the property filter. Supports strings, numbers, booleans, and arrays.'- ),- operator: zod- .enum([- 'exact',- 'is_not',- 'icontains',- 'not_icontains',- 'starts_with',- 'not_starts_with',- 'ends_with',- 'not_ends_with',- 'regex',- 'not_regex',- 'gt',- 'gte',- 'lt',- 'lte',- ])- .describe(- '\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `gte` - gte\n\* `lt` - lt\n\* `lte` - lte'- )- .describe(- 'Operator used to compare the property value.\n\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `gte` - gte\n\* `lt` - lt\n\* `lte` - lte'- ),- }),- zod.object({- key: zod- .string()- .describe('Property key used in this feature flag condition.'),- type: zod- .enum(['cohort', 'person', 'group'])- .describe(- '\* `cohort` - cohort\n\* `person` - person\n\* `group` - group'- )- .optional()- .describe(- "Property filter type. Set it on every property. Use `group` with `group_type_index` to filter on a group's properties.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"- ),- cohort_name: zod- .string()- .nullish()- .describe('Resolved cohort name for cohort-type filters.'),- group_type_index: zod- .number()- .nullish()- .describe(- "Group type index a `group` filter reads properties from. Defaults to the condition set's `aggregation_group_type_index`."- ),- operator: zod- .enum(['is_set', 'is_not_set'])- .describe('\* `is_set` - is_set\n\* `is_not_set` - is_not_set')- .describe(- 'Existence operator.\n\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'- ),- value: zod- .unknown()- .optional()- .describe(- 'Optional value. Runtime behavior determines whether this is ignored.'- ),- }),- zod.object({- key: zod- .string()- .describe('Property key used in this feature flag condition.'),- type: zod- .enum(['cohort', 'person', 'group'])- .describe(- '\* `cohort` - cohort\n\* `person` - person\n\* `group` - group'- )- .optional()- .describe(- "Property filter type. Set it on every property. Use `group` with `group_type_index` to filter on a group's properties.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"- ),- cohort_name: zod- .string()- .nullish()- .describe('Resolved cohort name for cohort-type filters.'),- group_type_index: zod- .number()- .nullish()- .describe(- "Group type index a `group` filter reads properties from. Defaults to the condition set's `aggregation_group_type_index`."- ),- operator: zod- .enum(['is_date_exact', 'is_date_before', 'is_date_after'])- .describe(- '\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after'- )- .describe(- 'Date comparison operator.\n\n\* `is_date_exact` - is_date_exact\n\* `is_date_after` - is_date_after\n\* `is_date_before` - is_date_before'- ),- value: zod- .string()- .describe('Date value in ISO format or relative date expression.'),- }),- zod.object({- key: zod- .string()- .describe('Property key used in this feature flag condition.'),- type: zod- .enum(['cohort', 'person', 'group'])- .describe(- '\* `cohort` - cohort\n\* `person` - person\n\* `group` - group'- )- .optional()- .describe(- "Property filter type. Set it on every property. Use `group` with `group_type_index` to filter on a group's properties.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"- ),- cohort_name: zod- .string()- .nullish()- .describe('Resolved cohort name for cohort-type filters.'),- group_type_index: zod- .number()- .nullish()- .describe(- "Group type index a `group` filter reads properties from. Defaults to the condition set's `aggregation_group_type_index`."- ),- operator: zod- .enum([- 'semver_gt',- 'semver_gte',- 'semver_lt',- 'semver_lte',- 'semver_eq',- 'semver_neq',- 'semver_tilde',- 'semver_caret',- 'semver_wildcard',- ])- .describe(- '\* `semver_gt` - semver_gt\n\* `semver_gte` - semver_gte\n\* `semver_lt` - semver_lt\n\* `semver_lte` - semver_lte\n\* `semver_eq` - semver_eq\n\* `semver_neq` - semver_neq\n\* `semver_tilde` - semver_tilde\n\* `semver_caret` - semver_caret\n\* `semver_wildcard` - semver_wildcard'- )- .describe(- 'Semantic version comparison operator.\n\n\* `semver_gt` - semver_gt\n\* `semver_gte` - semver_gte\n\* `semver_lt` - semver_lt\n\* `semver_lte` - semver_lte\n\* `semver_eq` - semver_eq\n\* `semver_neq` - semver_neq\n\* `semver_tilde` - semver_tilde\n\* `semver_caret` - semver_caret\n\* `semver_wildcard` - semver_wildcard'- ),- value: zod.string().describe('Semantic version string.'),- }),- zod.object({- key: zod- .string()- .describe('Property key used in this feature flag condition.'),- type: zod- .enum(['cohort', 'person', 'group'])- .describe(- '\* `cohort` - cohort\n\* `person` - person\n\* `group` - group'- )- .optional()- .describe(- "Property filter type. Set it on every property. Use `group` with `group_type_index` to filter on a group's properties.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"- ),- cohort_name: zod- .string()- .nullish()- .describe('Resolved cohort name for cohort-type filters.'),- group_type_index: zod- .number()- .nullish()- .describe(- "Group type index a `group` filter reads properties from. Defaults to the condition set's `aggregation_group_type_index`."- ),- operator: zod- .enum(['icontains_multi', 'not_icontains_multi'])- .describe(- '\* `icontains_multi` - icontains_multi\n\* `not_icontains_multi` - not_icontains_multi'- )- .describe(- 'Multi-contains operator.\n\n\* `icontains_multi` - icontains_multi\n\* `not_icontains_multi` - not_icontains_multi'- ),- value: zod- .array(zod.string())- .describe('List of strings to evaluate against.'),- }),- zod.object({- key: zod- .string()- .describe('Property key used in this feature flag condition.'),- type: zod- .enum(['cohort'])- .describe('\* `cohort` - cohort')- .describe(- 'Cohort property type required for in\/not_in operators.\n\n\* `cohort` - cohort'- ),- cohort_name: zod- .string()- .nullish()- .describe('Resolved cohort name for cohort-type filters.'),- group_type_index: zod- .number()- .nullish()- .describe(- "Group type index a `group` filter reads properties from. Defaults to the condition set's `aggregation_group_type_index`."- ),- operator: zod- .enum(['in', 'not_in'])- .describe('\* `in` - in\n\* `not_in` - not_in')- .describe(- 'Membership operator for cohort properties.\n\n\* `in` - in\n\* `not_in` - not_in'- ),- value: zod- .unknown()- .describe(- 'Cohort comparison value (single or list, depending on usage).'- ),- }),- zod.object({- key: zod- .string()- .describe('Property key used in this feature flag condition.'),- type: zod- .enum(['flag'])- .describe('\* `flag` - flag')- .describe(- 'Flag property type required for flag dependency checks.\n\n\* `flag` - flag'- ),- cohort_name: zod- .string()- .nullish()- .describe('Resolved cohort name for cohort-type filters.'),- group_type_index: zod- .number()- .nullish()- .describe(- "Group type index a `group` filter reads properties from. Defaults to the condition set's `aggregation_group_type_index`."- ),- operator: zod- .enum(['flag_evaluates_to'])- .describe('\* `flag_evaluates_to` - flag_evaluates_to')- .describe(- 'Operator for feature flag dependency evaluation.\n\n\* `flag_evaluates_to` - flag_evaluates_to'- ),- value: zod.unknown().describe('Value to compare flag evaluation against.'),- }),- ])- )- .optional()- .describe('Property conditions for this release condition group.'),- rollout_percentage: zod- .number()- .optional()- .describe('Rollout percentage for this release condition group.'),- variant: zod.string().nullish().describe('Variant key override for multivariate flags.'),- aggregation_group_type_index: zod- .number()- .nullish()- .describe(- 'Group type index for this condition set. None means person-level aggregation.'- ),- })- )- .optional()- .describe('Release condition groups for the feature flag.'),- multivariate: zod- .union([- zod.object({- variants: zod- .array(- zod.object({- key: zod.string().describe('Unique key for this variant.'),- name: zod.string().optional().describe('Human-readable name for this variant.'),- rollout_percentage: zod.number().describe('Variant rollout percentage.'),- })- )- .describe('Variant definitions for multivariate feature flags.'),- }),- zod.null(),- ])- .optional()- .describe('Multivariate configuration for variant-based rollouts.'),- aggregation_group_type_index: zod- .number()- .nullish()- .describe('Group type index for group-based feature flags.'),- payloads: zod- .record(zod.string(), zod.string())- .optional()- .describe('Optional payload values keyed by variant key.'),- feature_enrollment: zod- .boolean()- .nullish()- .describe(- 'Whether this flag has early access feature enrollment enabled. When true, the flag is evaluated against the person property $feature_enrollment\/{flag_key}.'- ),- early_exit: zod- .boolean()- .default(surveysCreateBodyTargetingFlagFiltersOneEarlyExitDefault)- .describe(- 'When true, condition evaluation stops at the first matching condition set rather than continuing to evaluate subsequent groups.'- ),- }),- zod.null(),- ])- .optional()- .describe(- "Target specific users based on their properties. Example: {groups: [{properties: [{key: 'email', value: ['@company.com'], operator: 'icontains'}], rollout_percentage: 100}]}"- ),- remove_targeting_flag: zod- .boolean()- .nullish()- .describe(- 'Set to true to completely remove all targeting filters from the survey, making it visible to all users (subject to other display conditions like URL matching).'- ),- questions: zod- .array(- zod.union([- zod.object({- id: zod- .string()- .optional()- .describe(- 'Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one.'- ),- type: zod.enum(['open']).describe('\* `open` - open'),- question: zod.string().describe('Question text shown to respondents.'),- description: zod.string().optional().describe('Optional helper text.'),- descriptionContentType: zod- .enum(['html', 'text'])- .describe('\* `html` - html\n\* `text` - text')- .optional()- .describe('Format for the description field.\n\n\* `text` - text\n\* `html` - html'),- optional: zod.boolean().optional().describe('Whether respondents may skip this question.'),- buttonText: zod.string().optional().describe('Custom button label.'),- }),- zod.object({- id: zod- .string()- .optional()- .describe(- 'Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one.'- ),- type: zod.enum(['link']).describe('\* `link` - link'),- question: zod.string().describe('Question text shown to respondents.'),- description: zod.string().optional().describe('Optional helper text.'),- descriptionContentType: zod- .enum(['html', 'text'])- .describe('\* `html` - html\n\* `text` - text')- .optional()- .describe('Format for the description field.\n\n\* `text` - text\n\* `html` - html'),- optional: zod.boolean().optional().describe('Whether respondents may skip this question.'),- buttonText: zod.string().optional().describe('Custom button label.'),- link: zod.string().describe('HTTPS or mailto URL for link questions.'),- }),- zod.object({- id: zod- .string()- .optional()- .describe(- 'Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one.'- ),- type: zod.enum(['rating']).describe('\* `rating` - rating'),- question: zod.string().describe('Question text shown to respondents.'),- description: zod.string().optional().describe('Optional helper text.'),- descriptionContentType: zod- .enum(['html', 'text'])- .describe('\* `html` - html\n\* `text` - text')- .optional()- .describe('Format for the description field.\n\n\* `text` - text\n\* `html` - html'),- optional: zod.boolean().optional().describe('Whether respondents may skip this question.'),- buttonText: zod.string().optional().describe('Custom button label.'),- display: zod- .enum(['number', 'emoji'])- .describe('\* `number` - number\n\* `emoji` - emoji')- .optional()- .describe(- "Display format: 'number' shows numeric scale, 'emoji' shows emoji scale.\n\n\* `number` - number\n\* `emoji` - emoji"- ),- scale: zod.number().min(1).optional().describe('Rating scale can be one of 3, 5, or 7'),- lowerBoundLabel: zod- .string()- .optional()- .describe("Label for the lowest rating (e.g., 'Very Poor')"),- upperBoundLabel: zod- .string()- .optional()- .describe("Label for the highest rating (e.g., 'Excellent')"),- branching: zod- .union([- zod.union([- zod.object({- type: zod- .enum(['next_question'])- .describe('\* `next_question` - next_question')- .describe(- 'Continue to the next question in sequence.\n\n\* `next_question` - next_question'- ),- }),- zod.object({- type: zod- .enum(['end'])- .describe('\* `end` - end')- .describe('End the survey.\n\n\* `end` - end'),- }),- zod.object({- type: zod- .enum(['specific_question'])- .describe('\* `specific_question` - specific_question')- .describe(- 'Jump to a specific question index.\n\n\* `specific_question` - specific_question'- ),- index: zod- .number()- .min(surveysCreateBodyQuestionsItemThreeBranchingOneThreeIndexMin)- .describe('0-based index of the next question.'),- }),- zod.object({- type: zod- .enum(['response_based'])- .describe('\* `response_based` - response_based')- .describe(- 'Branch based on the selected or entered response.\n\n\* `response_based` - response_based'- ),- responseValues: zod- .record(- zod.string(),- zod.union([- zod- .number()- .min(- surveysCreateBodyQuestionsItemThreeBranchingOneFourResponseValuesOneMin- ),- zod.enum(['end']),- ])- )- .describe(- "Response-based branching map. Values can be a question index or 'end'."- ),- }),- ]),- zod.null(),- ])- .optional(),- }),- zod.object({- id: zod- .string()- .optional()- .describe(- 'Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one.'- ),- type: zod.enum(['single_choice']).describe('\* `single_choice` - single_choice'),- question: zod.string().describe('Question text shown to respondents.'),- description: zod.string().optional().describe('Optional helper text.'),- descriptionContentType: zod- .enum(['html', 'text'])- .describe('\* `html` - html\n\* `text` - text')- .optional()- .describe('Format for the description field.\n\n\* `text` - text\n\* `html` - html'),- optional: zod.boolean().optional().describe('Whether respondents may skip this question.'),- buttonText: zod.string().optional().describe('Custom button label.'),- choices: zod- .array(zod.string())- .min(surveysCreateBodyQuestionsItemFourChoicesMin)- .max(surveysCreateBodyQuestionsItemFourChoicesMax)- .describe(- 'Array of choice options. Choice indices (0, 1, 2, ...) are used for branching logic.'- ),- shuffleOptions: zod- .boolean()- .optional()- .describe('Whether to randomize the order of choices for each respondent.'),- hasOpenChoice: zod- .boolean()- .optional()- .describe("Whether the final option should be an open-text choice (for example, 'Other')."),- branching: zod- .union([- zod.union([- zod.object({- type: zod- .enum(['next_question'])- .describe('\* `next_question` - next_question')- .describe(- 'Continue to the next question in sequence.\n\n\* `next_question` - next_question'- ),- }),- zod.object({- type: zod- .enum(['end'])- .describe('\* `end` - end')- .describe('End the survey.\n\n\* `end` - end'),- }),- zod.object({- type: zod- .enum(['specific_question'])- .describe('\* `specific_question` - specific_question')- .describe(- 'Jump to a specific question index.\n\n\* `specific_question` - specific_question'- ),- index: zod- .number()- .min(surveysCreateBodyQuestionsItemFourBranchingOneThreeIndexMin)- .describe('0-based index of the next question.'),- }),- zod.object({- type: zod- .enum(['response_based'])- .describe('\* `response_based` - response_based')- .describe(- 'Branch based on the selected or entered response.\n\n\* `response_based` - response_based'- ),- responseValues: zod- .record(- zod.string(),- zod.union([- zod- .number()- .min(- surveysCreateBodyQuestionsItemFourBranchingOneFourResponseValuesOneMin- ),- zod.enum(['end']),- ])- )- .describe(- "Response-based branching map. Values can be a question index or 'end'."- ),- }),- ]),- zod.null(),- ])- .optional(),- }),- zod.object({- id: zod- .string()- .optional()- .describe(- 'Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one.'- ),- type: zod.enum(['multiple_choice']).describe('\* `multiple_choice` - multiple_choice'),- question: zod.string().describe('Question text shown to respondents.'),- description: zod.string().optional().describe('Optional helper text.'),- descriptionContentType: zod- .enum(['html', 'text'])- .describe('\* `html` - html\n\* `text` - text')- .optional()- .describe('Format for the description field.\n\n\* `text` - text\n\* `html` - html'),- optional: zod.boolean().optional().describe('Whether respondents may skip this question.'),- buttonText: zod.string().optional().describe('Custom button label.'),- choices: zod- .array(zod.string())- .min(surveysCreateBodyQuestionsItemFiveChoicesMin)- .max(surveysCreateBodyQuestionsItemFiveChoicesMax)- .describe(- 'Array of choice options. Multiple selections allowed. No branching logic supported.'- ),- shuffleOptions: zod- .boolean()- .optional()- .describe('Whether to randomize the order of choices for each respondent.'),- hasOpenChoice: zod- .boolean()- .optional()- .describe("Whether the final option should be an open-text choice (for example, 'Other')."),- }),- ])- )- .nullish()- .describe(- '\n The `array` of questions included in the survey. Each question must conform to one of the defined question types: Basic, Link, Rating, or Multiple Choice.\n\n Basic (open-ended question)\n - `id`: The question ID\n - `type`: `open`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Link (a question with a link)\n - `id`: The question ID\n - `type`: `link`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `link`: The URL associated with the question.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Rating (a question with a rating scale)\n - `id`: The question ID\n - `type`: `rating`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `display`: Display style of the rating (`number` or `emoji`).\n - `scale`: The scale of the rating (`number`).\n - `lowerBoundLabel`: Label for the lower bound of the scale.\n - `upperBoundLabel`: Label for the upper bound of the scale.\n - `isNpsQuestion`: Whether the question is an NPS rating.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Multiple choice\n - `id`: The question ID\n - `type`: `single_choice` or `multiple_choice`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `choices`: An array of choices for the question.\n - `shuffleOptions`: Whether to shuffle the order of the choices (`boolean`).\n - `hasOpenChoice`: Whether the question allows an open-ended response (`boolean`).\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Branching logic can be one of the following types:\n\n Next question: Proceeds to the next question\n ```json\n {\n \"type\": \"next_question\"\n }\n ```\n\n End: Ends the survey, optionally displaying a confirmation message.\n ```json\n {\n \"type\": \"end\"\n }\n ```\n\n Response-based: Branches based on the response values. Available for the `rating` and `single_choice` question types.\n ```json\n {\n \"type\": \"response_based\",\n \"responseValues\": {\n \"responseKey\": \"value\"\n }\n }\n ```\n\n Specific question: Proceeds to a specific question by index.\n ```json\n {\n \"type\": \"specific_question\",\n \"index\": 2\n }\n ```\n\n Translations: Each question can include inline translations.\n - `translations`: Object mapping language codes to translated fields.\n - Language codes: Canonical BCP-47-ish strings (e.g., \"es\", \"es-MX\", \"zh-CN\"). Aliases like \"english\" or \"default\" are rejected. The survey\'s `base_language` (default \"en\") declares the language of the untranslated text and cannot also appear as a translation key.\n - Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`\n\n Example with translations:\n ```json\n {\n \"id\": \"uuid\",\n \"type\": \"rating\",\n \"question\": \"How satisfied are you?\",\n \"lowerBoundLabel\": \"Not satisfied\",\n \"upperBoundLabel\": \"Very satisfied\",\n \"translations\": {\n \"es\": {\n \"question\": \"¿Qué tan satisfecho estás?\",\n \"lowerBoundLabel\": \"No satisfecho\",\n \"upperBoundLabel\": \"Muy satisfecho\"\n },\n \"fr\": {\n \"question\": \"Dans quelle mesure êtes-vous satisfait?\"\n }\n }\n }\n ```\n '- ),- conditions: zod- .union([- zod.object({- url: zod.string().optional(),- selector: zod.string().optional(),- seenSurveyWaitPeriodInDays: zod- .number()- .min(surveysCreateBodyConditionsOneSeenSurveyWaitPeriodInDaysMin)- .optional()- .describe("Don't show this survey to users who saw any survey in the last x days."),- urlMatchType: zod- .enum(['regex', 'not_regex', 'exact', 'is_not', 'icontains', 'not_icontains'])- .describe(- '\* `regex` - regex\n\* `not_regex` - not_regex\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains'- )- .optional()- .describe(- "URL\/device matching types: 'regex' (matches regex pattern), 'not_regex' (does not match regex pattern), 'exact' (exact string match), 'is_not' (not exact match), 'icontains' (case-insensitive contains), 'not_icontains' (case-insensitive does not contain).\n\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains"- ),- events: zod- .object({- repeatedActivation: zod- .boolean()- .optional()- .describe(- 'Whether to show the survey every time one of the events is triggered (true), or just once (false).'- ),- values: zod- .array(- zod.object({- name: zod.string().describe('Event name that triggers the survey.'),- })- )- .optional()- .describe('Array of event names that trigger the survey.'),- })- .optional(),- deviceTypes: zod- .array(- zod- .enum(['Desktop', 'Mobile', 'Tablet'])- .describe('\* `Desktop` - Desktop\n\* `Mobile` - Mobile\n\* `Tablet` - Tablet')- )- .optional()- .describe('Device types that should match for this survey to be shown.'),- deviceTypesMatchType: zod- .enum(['regex', 'not_regex', 'exact', 'is_not', 'icontains', 'not_icontains'])- .describe(- '\* `regex` - regex\n\* `not_regex` - not_regex\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains'- )- .optional()- .describe(- "URL\/device matching types: 'regex' (matches regex pattern), 'not_regex' (does not match regex pattern), 'exact' (exact string match), 'is_not' (not exact match), 'icontains' (case-insensitive contains), 'not_icontains' (case-insensitive does not contain).\n\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains"- ),- linkedFlagVariant: zod- .string()- .optional()- .describe('The variant of the feature flag linked to this survey.'),- }),- zod.null(),- ])- .optional()- .describe('Display and targeting conditions for the survey.'),- appearance: zod- .union([- zod.object({- backgroundColor: zod.string().optional(),- submitButtonColor: zod.string().optional(),- textColor: zod.string().optional(),- submitButtonText: zod.string().optional(),- submitButtonTextColor: zod.string().optional(),- descriptionTextColor: zod.string().optional(),- ratingButtonColor: zod.string().optional(),- ratingButtonActiveColor: zod.string().optional(),- ratingButtonHoverColor: zod.string().optional(),- textSubtleColor: zod- .string()- .optional()- .describe('Color of secondary text, such as question descriptions.'),- inputBackground: zod- .string()- .optional()- .describe('Background color of open text inputs and rating buttons.'),- inputTextColor: zod- .string()- .optional()- .describe(- 'Text color of open text inputs and rating buttons. Calculated from inputBackground when not set.'- ),- whiteLabel: zod.boolean().optional(),- autoDisappear: zod.boolean().optional(),- displayThankYouMessage: zod.boolean().optional(),- thankYouMessageHeader: zod.string().optional(),- thankYouMessageDescription: zod.string().optional(),- thankYouMessageDescriptionContentType: zod- .enum(['html', 'text'])- .optional()- .describe('\* `html` - html\n\* `text` - text'),- thankYouMessageCloseButtonText: zod.string().optional(),- displayIntroScreen: zod- .boolean()- .optional()- .describe(- 'Whether to show an intro screen before the first question. The intro screen shows only when introScreenHeader or introScreenDescription is set.'- ),- introScreenHeader: zod.string().optional().describe('Heading of the intro screen.'),- introScreenDescription: zod.string().optional().describe('Body text of the intro screen.'),- introScreenDescriptionContentType: zod- .enum(['html', 'text'])- .describe('\* `html` - html\n\* `text` - text')- .optional()- .describe('Content type of introScreenDescription.\n\n\* `text` - text\n\* `html` - html'),- introScreenButtonText: zod- .string()- .optional()- .describe('Label of the button that closes the intro screen and starts the survey.'),- borderColor: zod.string().optional(),- placeholder: zod.string().optional(),- position: zod- .enum([- 'top_left',- 'top_center',- 'top_right',- 'middle_left',- 'middle_center',- 'middle_right',- 'left',- 'center',- 'right',- 'next_to_trigger',- ])- .describe(- '\* `top_left` - top_left\n\* `top_center` - top_center\n\* `top_right` - top_right\n\* `middle_left` - middle_left\n\* `middle_center` - middle_center\n\* `middle_right` - middle_right\n\* `left` - left\n\* `center` - center\n\* `right` - right\n\* `next_to_trigger` - next_to_trigger'- )- .optional()- .describe(- "Where a popover survey appears on the page. Defaults to 'right'.\n\n\* `top_left` - top_left\n\* `top_center` - top_center\n\* `top_right` - top_right\n\* `middle_left` - middle_left\n\* `middle_center` - middle_center\n\* `middle_right` - middle_right\n\* `left` - left\n\* `center` - center\n\* `right` - right\n\* `next_to_trigger` - next_to_trigger"- ),- shuffleQuestions: zod.boolean().optional(),- surveyPopupDelaySeconds: zod- .number()- .nullish()- .describe('Seconds to wait before a popover survey appears. Null shows it without a delay.'),- allowGoBack: zod- .boolean()- .optional()- .describe(- "Whether to show a 'Back' button on web surveys after the first question, letting respondents return to a previously visited question. Defaults to false."- ),- backButtonText: zod- .string()- .optional()- .describe("Optional override for the back button label. Defaults to 'Back'."),- widgetType: zod- .enum(['button', 'tab', 'selector'])- .optional()- .describe('\* `button` - button\n\* `tab` - tab\n\* `selector` - selector'),- widgetSelector: zod.string().optional(),- widgetLabel: zod.string().optional(),- widgetColor: zod.string().optional(),- tabPosition: zod- .enum(['top', 'left', 'right', 'bottom'])- .describe('\* `top` - top\n\* `left` - left\n\* `right` - right\n\* `bottom` - bottom')- .optional()- .describe(- "Which edge of the page holds the tab of a widget survey with widgetType 'tab'.\n\n\* `top` - top\n\* `left` - left\n\* `right` - right\n\* `bottom` - bottom"- ),- fontFamily: zod.string().optional(),- maxWidth: zod.string().optional(),- zIndex: zod.string().optional(),- disabledButtonOpacity: zod.string().optional(),- boxPadding: zod.string().optional(),- boxShadow: zod.string().optional().describe('CSS box-shadow value of the survey box.'),- borderRadius: zod.string().optional().describe('CSS border-radius value of the survey box.'),- }),- zod.null(),- ])- .optional()- .describe('Survey appearance customization.'),- start_date: zod.iso- .datetime({ offset: true })- .nullish()- .describe(- "Setting this will launch the survey immediately. Don't add a start_date unless explicitly requested to do so."- ),- end_date: zod.iso- .datetime({ offset: true })- .nullish()- .describe('When the survey stopped being shown to users. Setting this will complete the survey.'),- archived: zod.boolean().optional().describe('Archive state for the survey.'),- responses_limit: zod- .number()- .nullish()- .describe('The maximum number of responses before automatically stopping the survey.'),- iteration_count: zod- .number()- .min(1)- .max(surveysCreateBodyIterationCountMax)- .nullish()- .describe(- "For a recurring schedule, this field specifies the number of times the survey should be shown to the user. Use 1 for 'once every X days', higher numbers for multiple repetitions. Works together with iteration_frequency_days to determine the overall survey schedule."- ),- iteration_frequency_days: zod- .number()- .min(1)- .max(surveysCreateBodyIterationFrequencyDaysMax)- .nullish()- .describe(- 'For a recurring schedule, this field specifies the interval in days between each survey instance shown to the user, used alongside iteration_count for precise scheduling.'- ),- iteration_start_dates: zod.array(zod.iso.datetime({ offset: true }).nullable()).nullish(),- current_iteration: zod- .number()- .min(surveysCreateBodyCurrentIterationMin)- .max(surveysCreateBodyCurrentIterationMax)- .nullish(),- current_iteration_start_date: zod.iso.datetime({ offset: true }).nullish(),- response_sampling_start_date: zod.iso.datetime({ offset: true }).nullish(),- response_sampling_interval_type: zod- .union([- zod.enum(['day', 'week', 'month']).describe('\* `day` - day\n\* `week` - week\n\* `month` - month'),- zod.enum(['']),- zod.null(),- ])- .optional(),- response_sampling_interval: zod- .number()- .min(surveysCreateBodyResponseSamplingIntervalMin)- .max(surveysCreateBodyResponseSamplingIntervalMax)- .nullish(),- response_sampling_limit: zod- .number()- .min(surveysCreateBodyResponseSamplingLimitMin)- .max(surveysCreateBodyResponseSamplingLimitMax)- .nullish(),- response_sampling_daily_limits: zod.unknown().optional(),- enable_partial_responses: zod- .boolean()- .nullish()- .describe(- 'When at least one question is answered, the response is stored (true). The response is stored when all questions are answered (false).'- ),- enable_iframe_embedding: zod.boolean().nullish(),- base_language: zod- .string()- .max(surveysCreateBodyBaseLanguageMax)- .optional()- .describe(- "BCP-47 language code (e.g. 'en', 'es', 'es-MX') describing the language of the survey's untranslated text. Defaults to 'en'. Cannot also appear as a key in `translations`."- ),- translations: zod.unknown().optional(),- _create_in_folder: zod.string().optional(),- form_content: zod.unknown().optional(),-})+export const SurveysCreateBody = /* @__PURE__ */ zod+ .record(zod.string(), zod.unknown())+ .describe('Deep\/recursive schema (opaque in Zod — use TypeScript types for full shape)')/*** Mixin for ViewSets to handle approval-gate exceptions raised from decorated serializers.@@ -1006,927 +88,9 @@ export const SurveysCreateBody = /* @__PURE__ */ zod.object({* decorator on serializer methods and converts them into the same responses the viewset path* produces (see decorators._result_to_response), so both paths share one contract.*/-export const surveysUpdateBodyNameMax = 400--export const surveysUpdateBodyTargetingFlagFiltersOneEarlyExitDefault = false-export const surveysUpdateBodyQuestionsItemThreeBranchingOneThreeIndexMin = 0--export const surveysUpdateBodyQuestionsItemThreeBranchingOneFourResponseValuesOneMin = 0--export const surveysUpdateBodyQuestionsItemFourChoicesMin = 2-export const surveysUpdateBodyQuestionsItemFourChoicesMax = 20--export const surveysUpdateBodyQuestionsItemFourBranchingOneThreeIndexMin = 0--export const surveysUpdateBodyQuestionsItemFourBranchingOneFourResponseValuesOneMin = 0--export const surveysUpdateBodyQuestionsItemFiveChoicesMin = 2-export const surveysUpdateBodyQuestionsItemFiveChoicesMax = 20--export const surveysUpdateBodyConditionsOneSeenSurveyWaitPeriodInDaysMin = 0--export const surveysUpdateBodyIterationCountMax = 500--export const surveysUpdateBodyIterationFrequencyDaysMax = 365--export const surveysUpdateBodyCurrentIterationMin = 0-export const surveysUpdateBodyCurrentIterationMax = 2147483647--export const surveysUpdateBodyResponseSamplingIntervalMin = 0-export const surveysUpdateBodyResponseSamplingIntervalMax = 2147483647--export const surveysUpdateBodyResponseSamplingLimitMin = 0-export const surveysUpdateBodyResponseSamplingLimitMax = 2147483647--export const surveysUpdateBodyBaseLanguageMax = 20--export const SurveysUpdateBody = /* @__PURE__ */ zod.object({- name: zod- .string()- .min(1)- .max(surveysUpdateBodyNameMax)- .describe(- "Survey name. Anyone can read it. In-app surveys send it to every visitor's browser alongside the questions and appearance text, and a hosted survey shows it on its public page. Keep customer names and other private details out of it."- ),- description: zod- .string()- .optional()- .describe(- 'Survey description. Internal only: unlike the name and questions, it is never delivered to visitors.'- ),- type: zod- .enum(['popover', 'widget', 'external_survey', 'api'])- .describe(- '\* `popover` - popover\n\* `widget` - widget\n\* `external_survey` - external survey\n\* `api` - api'- )- .describe(- 'Survey type.\n\n\* `popover` - popover\n\* `widget` - widget\n\* `external_survey` - external survey\n\* `api` - api'- ),- schedule: zod- .union([- zod- .enum(['once', 'recurring', 'always'])- .describe('\* `once` - once\n\* `recurring` - recurring\n\* `always` - always'),- zod.null(),- ])- .optional()- .describe(- "Survey scheduling behavior: 'once' = show once per user (default), 'recurring' = repeat based on iteration_count and iteration_frequency_days settings, 'always' = show every time conditions are met (mainly for widget surveys)\n\n\* `once` - once\n\* `recurring` - recurring\n\* `always` - always"- ),- linked_flag_id: zod.number().nullish().describe('The feature flag linked to this survey.'),- linked_insight_id: zod.number().nullish(),- targeting_flag_id: zod.number().optional().describe('An existing targeting flag to use for this survey.'),- targeting_flag_filters: zod- .union([- zod.object({- groups: zod- .array(- zod.object({- properties: zod- .array(- zod.union([- zod.object({- key: zod- .string()- .describe('Property key used in this feature flag condition.'),- type: zod- .enum(['cohort', 'person', 'group'])- .describe(- '\* `cohort` - cohort\n\* `person` - person\n\* `group` - group'- )- .optional()- .describe(- "Property filter type. Set it on every property. Use `group` with `group_type_index` to filter on a group's properties.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"- ),- cohort_name: zod- .string()- .nullish()- .describe('Resolved cohort name for cohort-type filters.'),- group_type_index: zod- .number()- .nullish()- .describe(- "Group type index a `group` filter reads properties from. Defaults to the condition set's `aggregation_group_type_index`."- ),- value: zod- .unknown()- .describe(- 'Comparison value for the property filter. Supports strings, numbers, booleans, and arrays.'- ),- operator: zod- .enum([- 'exact',- 'is_not',- 'icontains',- 'not_icontains',- 'starts_with',- 'not_starts_with',- 'ends_with',- 'not_ends_with',- 'regex',- 'not_regex',- 'gt',- 'gte',- 'lt',- 'lte',- ])- .describe(- '\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `gte` - gte\n\* `lt` - lt\n\* `lte` - lte'- )- .describe(- 'Operator used to compare the property value.\n\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `gte` - gte\n\* `lt` - lt\n\* `lte` - lte'- ),- }),- zod.object({- key: zod- .string()- .describe('Property key used in this feature flag condition.'),- type: zod- .enum(['cohort', 'person', 'group'])- .describe(- '\* `cohort` - cohort\n\* `person` - person\n\* `group` - group'- )- .optional()- .describe(- "Property filter type. Set it on every property. Use `group` with `group_type_index` to filter on a group's properties.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"- ),- cohort_name: zod- .string()- .nullish()- .describe('Resolved cohort name for cohort-type filters.'),- group_type_index: zod- .number()- .nullish()- .describe(- "Group type index a `group` filter reads properties from. Defaults to the condition set's `aggregation_group_type_index`."- ),- operator: zod- .enum(['is_set', 'is_not_set'])- .describe('\* `is_set` - is_set\n\* `is_not_set` - is_not_set')- .describe(- 'Existence operator.\n\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'- ),- value: zod- .unknown()- .optional()- .describe(- 'Optional value. Runtime behavior determines whether this is ignored.'- ),- }),- zod.object({- key: zod- .string()- .describe('Property key used in this feature flag condition.'),- type: zod- .enum(['cohort', 'person', 'group'])- .describe(- '\* `cohort` - cohort\n\* `person` - person\n\* `group` - group'- )- .optional()- .describe(- "Property filter type. Set it on every property. Use `group` with `group_type_index` to filter on a group's properties.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"- ),- cohort_name: zod- .string()- .nullish()- .describe('Resolved cohort name for cohort-type filters.'),- group_type_index: zod- .number()- .nullish()- .describe(- "Group type index a `group` filter reads properties from. Defaults to the condition set's `aggregation_group_type_index`."- ),- operator: zod- .enum(['is_date_exact', 'is_date_before', 'is_date_after'])- .describe(- '\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after'- )- .describe(- 'Date comparison operator.\n\n\* `is_date_exact` - is_date_exact\n\* `is_date_after` - is_date_after\n\* `is_date_before` - is_date_before'- ),- value: zod- .string()- .describe('Date value in ISO format or relative date expression.'),- }),- zod.object({- key: zod- .string()- .describe('Property key used in this feature flag condition.'),- type: zod- .enum(['cohort', 'person', 'group'])- .describe(- '\* `cohort` - cohort\n\* `person` - person\n\* `group` - group'- )- .optional()- .describe(- "Property filter type. Set it on every property. Use `group` with `group_type_index` to filter on a group's properties.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"- ),- cohort_name: zod- .string()- .nullish()- .describe('Resolved cohort name for cohort-type filters.'),- group_type_index: zod- .number()- .nullish()- .describe(- "Group type index a `group` filter reads properties from. Defaults to the condition set's `aggregation_group_type_index`."- ),- operator: zod- .enum([- 'semver_gt',- 'semver_gte',- 'semver_lt',- 'semver_lte',- 'semver_eq',- 'semver_neq',- 'semver_tilde',- 'semver_caret',- 'semver_wildcard',- ])- .describe(- '\* `semver_gt` - semver_gt\n\* `semver_gte` - semver_gte\n\* `semver_lt` - semver_lt\n\* `semver_lte` - semver_lte\n\* `semver_eq` - semver_eq\n\* `semver_neq` - semver_neq\n\* `semver_tilde` - semver_tilde\n\* `semver_caret` - semver_caret\n\* `semver_wildcard` - semver_wildcard'- )- .describe(- 'Semantic version comparison operator.\n\n\* `semver_gt` - semver_gt\n\* `semver_gte` - semver_gte\n\* `semver_lt` - semver_lt\n\* `semver_lte` - semver_lte\n\* `semver_eq` - semver_eq\n\* `semver_neq` - semver_neq\n\* `semver_tilde` - semver_tilde\n\* `semver_caret` - semver_caret\n\* `semver_wildcard` - semver_wildcard'- ),- value: zod.string().describe('Semantic version string.'),- }),- zod.object({- key: zod- .string()- .describe('Property key used in this feature flag condition.'),- type: zod- .enum(['cohort', 'person', 'group'])- .describe(- '\* `cohort` - cohort\n\* `person` - person\n\* `group` - group'- )- .optional()- .describe(- "Property filter type. Set it on every property. Use `group` with `group_type_index` to filter on a group's properties.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"- ),- cohort_name: zod- .string()- .nullish()- .describe('Resolved cohort name for cohort-type filters.'),- group_type_index: zod- .number()- .nullish()- .describe(- "Group type index a `group` filter reads properties from. Defaults to the condition set's `aggregation_group_type_index`."- ),- operator: zod- .enum(['icontains_multi', 'not_icontains_multi'])- .describe(- '\* `icontains_multi` - icontains_multi\n\* `not_icontains_multi` - not_icontains_multi'- )- .describe(- 'Multi-contains operator.\n\n\* `icontains_multi` - icontains_multi\n\* `not_icontains_multi` - not_icontains_multi'- ),- value: zod- .array(zod.string())- .describe('List of strings to evaluate against.'),- }),- zod.object({- key: zod- .string()- .describe('Property key used in this feature flag condition.'),- type: zod- .enum(['cohort'])- .describe('\* `cohort` - cohort')- .describe(- 'Cohort property type required for in\/not_in operators.\n\n\* `cohort` - cohort'- ),- cohort_name: zod- .string()- .nullish()- .describe('Resolved cohort name for cohort-type filters.'),- group_type_index: zod- .number()- .nullish()- .describe(- "Group type index a `group` filter reads properties from. Defaults to the condition set's `aggregation_group_type_index`."- ),- operator: zod- .enum(['in', 'not_in'])- .describe('\* `in` - in\n\* `not_in` - not_in')- .describe(- 'Membership operator for cohort properties.\n\n\* `in` - in\n\* `not_in` - not_in'- ),- value: zod- .unknown()- .describe(- 'Cohort comparison value (single or list, depending on usage).'- ),- }),- zod.object({- key: zod- .string()- .describe('Property key used in this feature flag condition.'),- type: zod- .enum(['flag'])- .describe('\* `flag` - flag')- .describe(- 'Flag property type required for flag dependency checks.\n\n\* `flag` - flag'- ),- cohort_name: zod- .string()- .nullish()- .describe('Resolved cohort name for cohort-type filters.'),- group_type_index: zod- .number()- .nullish()- .describe(- "Group type index a `group` filter reads properties from. Defaults to the condition set's `aggregation_group_type_index`."- ),- operator: zod- .enum(['flag_evaluates_to'])- .describe('\* `flag_evaluates_to` - flag_evaluates_to')- .describe(- 'Operator for feature flag dependency evaluation.\n\n\* `flag_evaluates_to` - flag_evaluates_to'- ),- value: zod.unknown().describe('Value to compare flag evaluation against.'),- }),- ])- )- .optional()- .describe('Property conditions for this release condition group.'),- rollout_percentage: zod- .number()- .optional()- .describe('Rollout percentage for this release condition group.'),- variant: zod.string().nullish().describe('Variant key override for multivariate flags.'),- aggregation_group_type_index: zod- .number()- .nullish()- .describe(- 'Group type index for this condition set. None means person-level aggregation.'- ),- })- )- .optional()- .describe('Release condition groups for the feature flag.'),- multivariate: zod- .union([- zod.object({- variants: zod- .array(- zod.object({- key: zod.string().describe('Unique key for this variant.'),- name: zod.string().optional().describe('Human-readable name for this variant.'),- rollout_percentage: zod.number().describe('Variant rollout percentage.'),- })- )- .describe('Variant definitions for multivariate feature flags.'),- }),- zod.null(),- ])- .optional()- .describe('Multivariate configuration for variant-based rollouts.'),- aggregation_group_type_index: zod- .number()- .nullish()- .describe('Group type index for group-based feature flags.'),- payloads: zod- .record(zod.string(), zod.string())- .optional()- .describe('Optional payload values keyed by variant key.'),- feature_enrollment: zod- .boolean()- .nullish()- .describe(- 'Whether this flag has early access feature enrollment enabled. When true, the flag is evaluated against the person property $feature_enrollment\/{flag_key}.'- ),- early_exit: zod- .boolean()- .default(surveysUpdateBodyTargetingFlagFiltersOneEarlyExitDefault)- .describe(- 'When true, condition evaluation stops at the first matching condition set rather than continuing to evaluate subsequent groups.'- ),- }),- zod.null(),- ])- .optional()- .describe(- "Target specific users based on their properties. Example: {groups: [{properties: [{key: 'email', value: ['@company.com'], operator: 'icontains'}], rollout_percentage: 100}]}"- ),- remove_targeting_flag: zod- .boolean()- .nullish()- .describe(- 'Set to true to completely remove all targeting filters from the survey, making it visible to all users (subject to other display conditions like URL matching).'- ),- questions: zod- .array(- zod.union([- zod.object({- id: zod- .string()- .optional()- .describe(- 'Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one.'- ),- type: zod.enum(['open']).describe('\* `open` - open'),- question: zod.string().describe('Question text shown to respondents.'),- description: zod.string().optional().describe('Optional helper text.'),- descriptionContentType: zod- .enum(['html', 'text'])- .describe('\* `html` - html\n\* `text` - text')- .optional()- .describe('Format for the description field.\n\n\* `text` - text\n\* `html` - html'),- optional: zod.boolean().optional().describe('Whether respondents may skip this question.'),- buttonText: zod.string().optional().describe('Custom button label.'),- }),- zod.object({- id: zod- .string()- .optional()- .describe(- 'Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one.'- ),- type: zod.enum(['link']).describe('\* `link` - link'),- question: zod.string().describe('Question text shown to respondents.'),- description: zod.string().optional().describe('Optional helper text.'),- descriptionContentType: zod- .enum(['html', 'text'])- .describe('\* `html` - html\n\* `text` - text')- .optional()- .describe('Format for the description field.\n\n\* `text` - text\n\* `html` - html'),- optional: zod.boolean().optional().describe('Whether respondents may skip this question.'),- buttonText: zod.string().optional().describe('Custom button label.'),- link: zod.string().describe('HTTPS or mailto URL for link questions.'),- }),- zod.object({- id: zod- .string()- .optional()- .describe(- 'Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one.'- ),- type: zod.enum(['rating']).describe('\* `rating` - rating'),- question: zod.string().describe('Question text shown to respondents.'),- description: zod.string().optional().describe('Optional helper text.'),- descriptionContentType: zod- .enum(['html', 'text'])- .describe('\* `html` - html\n\* `text` - text')- .optional()- .describe('Format for the description field.\n\n\* `text` - text\n\* `html` - html'),- optional: zod.boolean().optional().describe('Whether respondents may skip this question.'),- buttonText: zod.string().optional().describe('Custom button label.'),- display: zod- .enum(['number', 'emoji'])- .describe('\* `number` - number\n\* `emoji` - emoji')- .optional()- .describe(- "Display format: 'number' shows numeric scale, 'emoji' shows emoji scale.\n\n\* `number` - number\n\* `emoji` - emoji"- ),- scale: zod.number().min(1).optional().describe('Rating scale can be one of 3, 5, or 7'),- lowerBoundLabel: zod- .string()- .optional()- .describe("Label for the lowest rating (e.g., 'Very Poor')"),- upperBoundLabel: zod- .string()- .optional()- .describe("Label for the highest rating (e.g., 'Excellent')"),- branching: zod- .union([- zod.union([- zod.object({- type: zod- .enum(['next_question'])- .describe('\* `next_question` - next_question')- .describe(- 'Continue to the next question in sequence.\n\n\* `next_question` - next_question'- ),- }),- zod.object({- type: zod- .enum(['end'])- .describe('\* `end` - end')- .describe('End the survey.\n\n\* `end` - end'),- }),- zod.object({- type: zod- .enum(['specific_question'])- .describe('\* `specific_question` - specific_question')- .describe(- 'Jump to a specific question index.\n\n\* `specific_question` - specific_question'- ),- index: zod- .number()- .min(surveysUpdateBodyQuestionsItemThreeBranchingOneThreeIndexMin)- .describe('0-based index of the next question.'),- }),- zod.object({- type: zod- .enum(['response_based'])- .describe('\* `response_based` - response_based')- .describe(- 'Branch based on the selected or entered response.\n\n\* `response_based` - response_based'- ),- responseValues: zod- .record(- zod.string(),- zod.union([- zod- .number()- .min(- surveysUpdateBodyQuestionsItemThreeBranchingOneFourResponseValuesOneMin- ),- zod.enum(['end']),- ])- )- .describe(- "Response-based branching map. Values can be a question index or 'end'."- ),- }),- ]),- zod.null(),- ])- .optional(),- }),- zod.object({- id: zod- .string()- .optional()- .describe(- 'Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one.'- ),- type: zod.enum(['single_choice']).describe('\* `single_choice` - single_choice'),- question: zod.string().describe('Question text shown to respondents.'),- description: zod.string().optional().describe('Optional helper text.'),- descriptionContentType: zod- .enum(['html', 'text'])- .describe('\* `html` - html\n\* `text` - text')- .optional()- .describe('Format for the description field.\n\n\* `text` - text\n\* `html` - html'),- optional: zod.boolean().optional().describe('Whether respondents may skip this question.'),- buttonText: zod.string().optional().describe('Custom button label.'),- choices: zod- .array(zod.string())- .min(surveysUpdateBodyQuestionsItemFourChoicesMin)- .max(surveysUpdateBodyQuestionsItemFourChoicesMax)- .describe(- 'Array of choice options. Choice indices (0, 1, 2, ...) are used for branching logic.'- ),- shuffleOptions: zod- .boolean()- .optional()- .describe('Whether to randomize the order of choices for each respondent.'),- hasOpenChoice: zod- .boolean()- .optional()- .describe("Whether the final option should be an open-text choice (for example, 'Other')."),- branching: zod- .union([- zod.union([- zod.object({- type: zod- .enum(['next_question'])- .describe('\* `next_question` - next_question')- .describe(- 'Continue to the next question in sequence.\n\n\* `next_question` - next_question'- ),- }),- zod.object({- type: zod- .enum(['end'])- .describe('\* `end` - end')- .describe('End the survey.\n\n\* `end` - end'),- }),- zod.object({- type: zod- .enum(['specific_question'])- .describe('\* `specific_question` - specific_question')- .describe(- 'Jump to a specific question index.\n\n\* `specific_question` - specific_question'- ),- index: zod- .number()- .min(surveysUpdateBodyQuestionsItemFourBranchingOneThreeIndexMin)- .describe('0-based index of the next question.'),- }),- zod.object({- type: zod- .enum(['response_based'])- .describe('\* `response_based` - response_based')- .describe(- 'Branch based on the selected or entered response.\n\n\* `response_based` - response_based'- ),- responseValues: zod- .record(- zod.string(),- zod.union([- zod- .number()- .min(- surveysUpdateBodyQuestionsItemFourBranchingOneFourResponseValuesOneMin- ),- zod.enum(['end']),- ])- )- .describe(- "Response-based branching map. Values can be a question index or 'end'."- ),- }),- ]),- zod.null(),- ])- .optional(),- }),- zod.object({- id: zod- .string()- .optional()- .describe(- 'Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one.'- ),- type: zod.enum(['multiple_choice']).describe('\* `multiple_choice` - multiple_choice'),- question: zod.string().describe('Question text shown to respondents.'),- description: zod.string().optional().describe('Optional helper text.'),- descriptionContentType: zod- .enum(['html', 'text'])- .describe('\* `html` - html\n\* `text` - text')- .optional()- .describe('Format for the description field.\n\n\* `text` - text\n\* `html` - html'),- optional: zod.boolean().optional().describe('Whether respondents may skip this question.'),- buttonText: zod.string().optional().describe('Custom button label.'),- choices: zod- .array(zod.string())- .min(surveysUpdateBodyQuestionsItemFiveChoicesMin)- .max(surveysUpdateBodyQuestionsItemFiveChoicesMax)- .describe(- 'Array of choice options. Multiple selections allowed. No branching logic supported.'- ),- shuffleOptions: zod- .boolean()- .optional()- .describe('Whether to randomize the order of choices for each respondent.'),- hasOpenChoice: zod- .boolean()- .optional()- .describe("Whether the final option should be an open-text choice (for example, 'Other')."),- }),- ])- )- .nullish()- .describe(- '\n The `array` of questions included in the survey. Each question must conform to one of the defined question types: Basic, Link, Rating, or Multiple Choice.\n\n Basic (open-ended question)\n - `id`: The question ID\n - `type`: `open`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Link (a question with a link)\n - `id`: The question ID\n - `type`: `link`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `link`: The URL associated with the question.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Rating (a question with a rating scale)\n - `id`: The question ID\n - `type`: `rating`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `display`: Display style of the rating (`number` or `emoji`).\n - `scale`: The scale of the rating (`number`).\n - `lowerBoundLabel`: Label for the lower bound of the scale.\n - `upperBoundLabel`: Label for the upper bound of the scale.\n - `isNpsQuestion`: Whether the question is an NPS rating.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Multiple choice\n - `id`: The question ID\n - `type`: `single_choice` or `multiple_choice`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `choices`: An array of choices for the question.\n - `shuffleOptions`: Whether to shuffle the order of the choices (`boolean`).\n - `hasOpenChoice`: Whether the question allows an open-ended response (`boolean`).\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Branching logic can be one of the following types:\n\n Next question: Proceeds to the next question\n ```json\n {\n \"type\": \"next_question\"\n }\n ```\n\n End: Ends the survey, optionally displaying a confirmation message.\n ```json\n {\n \"type\": \"end\"\n }\n ```\n\n Response-based: Branches based on the response values. Available for the `rating` and `single_choice` question types.\n ```json\n {\n \"type\": \"response_based\",\n \"responseValues\": {\n \"responseKey\": \"value\"\n }\n }\n ```\n\n Specific question: Proceeds to a specific question by index.\n ```json\n {\n \"type\": \"specific_question\",\n \"index\": 2\n }\n ```\n\n Translations: Each question can include inline translations.\n - `translations`: Object mapping language codes to translated fields.\n - Language codes: Canonical BCP-47-ish strings (e.g., \"es\", \"es-MX\", \"zh-CN\"). Aliases like \"english\" or \"default\" are rejected. The survey\'s `base_language` (default \"en\") declares the language of the untranslated text and cannot also appear as a translation key.\n - Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`\n\n Example with translations:\n ```json\n {\n \"id\": \"uuid\",\n \"type\": \"rating\",\n \"question\": \"How satisfied are you?\",\n \"lowerBoundLabel\": \"Not satisfied\",\n \"upperBoundLabel\": \"Very satisfied\",\n \"translations\": {\n \"es\": {\n \"question\": \"¿Qué tan satisfecho estás?\",\n \"lowerBoundLabel\": \"No satisfecho\",\n \"upperBoundLabel\": \"Muy satisfecho\"\n },\n \"fr\": {\n \"question\": \"Dans quelle mesure êtes-vous satisfait?\"\n }\n }\n }\n ```\n '- ),- conditions: zod- .union([- zod.object({- url: zod.string().optional(),- selector: zod.string().optional(),- seenSurveyWaitPeriodInDays: zod- .number()- .min(surveysUpdateBodyConditionsOneSeenSurveyWaitPeriodInDaysMin)- .optional()- .describe("Don't show this survey to users who saw any survey in the last x days."),- urlMatchType: zod- .enum(['regex', 'not_regex', 'exact', 'is_not', 'icontains', 'not_icontains'])- .describe(- '\* `regex` - regex\n\* `not_regex` - not_regex\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains'- )- .optional()- .describe(- "URL\/device matching types: 'regex' (matches regex pattern), 'not_regex' (does not match regex pattern), 'exact' (exact string match), 'is_not' (not exact match), 'icontains' (case-insensitive contains), 'not_icontains' (case-insensitive does not contain).\n\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains"- ),- events: zod- .object({- repeatedActivation: zod- .boolean()- .optional()- .describe(- 'Whether to show the survey every time one of the events is triggered (true), or just once (false).'- ),- values: zod- .array(- zod.object({- name: zod.string().describe('Event name that triggers the survey.'),- })- )- .optional()- .describe('Array of event names that trigger the survey.'),- })- .optional(),- deviceTypes: zod- .array(- zod- .enum(['Desktop', 'Mobile', 'Tablet'])- .describe('\* `Desktop` - Desktop\n\* `Mobile` - Mobile\n\* `Tablet` - Tablet')- )- .optional()- .describe('Device types that should match for this survey to be shown.'),- deviceTypesMatchType: zod- .enum(['regex', 'not_regex', 'exact', 'is_not', 'icontains', 'not_icontains'])- .describe(- '\* `regex` - regex\n\* `not_regex` - not_regex\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains'- )- .optional()- .describe(- "URL\/device matching types: 'regex' (matches regex pattern), 'not_regex' (does not match regex pattern), 'exact' (exact string match), 'is_not' (not exact match), 'icontains' (case-insensitive contains), 'not_icontains' (case-insensitive does not contain).\n\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains"- ),- linkedFlagVariant: zod- .string()- .optional()- .describe('The variant of the feature flag linked to this survey.'),- }),- zod.null(),- ])- .optional()- .describe('Display and targeting conditions for the survey.'),- appearance: zod- .union([- zod.object({- backgroundColor: zod.string().optional(),- submitButtonColor: zod.string().optional(),- textColor: zod.string().optional(),- submitButtonText: zod.string().optional(),- submitButtonTextColor: zod.string().optional(),- descriptionTextColor: zod.string().optional(),- ratingButtonColor: zod.string().optional(),- ratingButtonActiveColor: zod.string().optional(),- ratingButtonHoverColor: zod.string().optional(),- textSubtleColor: zod- .string()- .optional()- .describe('Color of secondary text, such as question descriptions.'),- inputBackground: zod- .string()- .optional()- .describe('Background color of open text inputs and rating buttons.'),- inputTextColor: zod- .string()- .optional()- .describe(- 'Text color of open text inputs and rating buttons. Calculated from inputBackground when not set.'- ),- whiteLabel: zod.boolean().optional(),- autoDisappear: zod.boolean().optional(),- displayThankYouMessage: zod.boolean().optional(),- thankYouMessageHeader: zod.string().optional(),- thankYouMessageDescription: zod.string().optional(),- thankYouMessageDescriptionContentType: zod- .enum(['html', 'text'])- .optional()- .describe('\* `html` - html\n\* `text` - text'),- thankYouMessageCloseButtonText: zod.string().optional(),- displayIntroScreen: zod- .boolean()- .optional()- .describe(- 'Whether to show an intro screen before the first question. The intro screen shows only when introScreenHeader or introScreenDescription is set.'- ),- introScreenHeader: zod.string().optional().describe('Heading of the intro screen.'),- introScreenDescription: zod.string().optional().describe('Body text of the intro screen.'),- introScreenDescriptionContentType: zod- .enum(['html', 'text'])- .describe('\* `html` - html\n\* `text` - text')- .optional()- .describe('Content type of introScreenDescription.\n\n\* `text` - text\n\* `html` - html'),- introScreenButtonText: zod- .string()- .optional()- .describe('Label of the button that closes the intro screen and starts the survey.'),- borderColor: zod.string().optional(),- placeholder: zod.string().optional(),- position: zod- .enum([- 'top_left',- 'top_center',- 'top_right',- 'middle_left',- 'middle_center',- 'middle_right',- 'left',- 'center',- 'right',- 'next_to_trigger',- ])- .describe(- '\* `top_left` - top_left\n\* `top_center` - top_center\n\* `top_right` - top_right\n\* `middle_left` - middle_left\n\* `middle_center` - middle_center\n\* `middle_right` - middle_right\n\* `left` - left\n\* `center` - center\n\* `right` - right\n\* `next_to_trigger` - next_to_trigger'- )- .optional()- .describe(- "Where a popover survey appears on the page. Defaults to 'right'.\n\n\* `top_left` - top_left\n\* `top_center` - top_center\n\* `top_right` - top_right\n\* `middle_left` - middle_left\n\* `middle_center` - middle_center\n\* `middle_right` - middle_right\n\* `left` - left\n\* `center` - center\n\* `right` - right\n\* `next_to_trigger` - next_to_trigger"- ),- shuffleQuestions: zod.boolean().optional(),- surveyPopupDelaySeconds: zod- .number()- .nullish()- .describe('Seconds to wait before a popover survey appears. Null shows it without a delay.'),- allowGoBack: zod- .boolean()- .optional()- .describe(- "Whether to show a 'Back' button on web surveys after the first question, letting respondents return to a previously visited question. Defaults to false."- ),- backButtonText: zod- .string()- .optional()- .describe("Optional override for the back button label. Defaults to 'Back'."),- widgetType: zod- .enum(['button', 'tab', 'selector'])- .optional()- .describe('\* `button` - button\n\* `tab` - tab\n\* `selector` - selector'),- widgetSelector: zod.string().optional(),- widgetLabel: zod.string().optional(),- widgetColor: zod.string().optional(),- tabPosition: zod- .enum(['top', 'left', 'right', 'bottom'])- .describe('\* `top` - top\n\* `left` - left\n\* `right` - right\n\* `bottom` - bottom')- .optional()- .describe(- "Which edge of the page holds the tab of a widget survey with widgetType 'tab'.\n\n\* `top` - top\n\* `left` - left\n\* `right` - right\n\* `bottom` - bottom"- ),- fontFamily: zod.string().optional(),- maxWidth: zod.string().optional(),- zIndex: zod.string().optional(),- disabledButtonOpacity: zod.string().optional(),- boxPadding: zod.string().optional(),- boxShadow: zod.string().optional().describe('CSS box-shadow value of the survey box.'),- borderRadius: zod.string().optional().describe('CSS border-radius value of the survey box.'),- }),- zod.null(),- ])- .optional()- .describe('Survey appearance customization.'),- start_date: zod.iso- .datetime({ offset: true })- .nullish()- .describe(- "Setting this will launch the survey immediately. Don't add a start_date unless explicitly requested to do so."- ),- end_date: zod.iso- .datetime({ offset: true })- .nullish()- .describe('When the survey stopped being shown to users. Setting this will complete the survey.'),- archived: zod.boolean().optional().describe('Archive state for the survey.'),- responses_limit: zod- .number()- .nullish()- .describe('The maximum number of responses before automatically stopping the survey.'),- iteration_count: zod- .number()- .min(1)- .max(surveysUpdateBodyIterationCountMax)- .nullish()- .describe(- "For a recurring schedule, this field specifies the number of times the survey should be shown to the user. Use 1 for 'once every X days', higher numbers for multiple repetitions. Works together with iteration_frequency_days to determine the overall survey schedule."- ),- iteration_frequency_days: zod- .number()- .min(1)- .max(surveysUpdateBodyIterationFrequencyDaysMax)- .nullish()- .describe(- 'For a recurring schedule, this field specifies the interval in days between each survey instance shown to the user, used alongside iteration_count for precise scheduling.'- ),- iteration_start_dates: zod.array(zod.iso.datetime({ offset: true }).nullable()).nullish(),- current_iteration: zod- .number()- .min(surveysUpdateBodyCurrentIterationMin)- .max(surveysUpdateBodyCurrentIterationMax)- .nullish(),- current_iteration_start_date: zod.iso.datetime({ offset: true }).nullish(),- response_sampling_start_date: zod.iso.datetime({ offset: true }).nullish(),- response_sampling_interval_type: zod- .union([- zod.enum(['day', 'week', 'month']).describe('\* `day` - day\n\* `week` - week\n\* `month` - month'),- zod.enum(['']),- zod.null(),- ])- .optional(),- response_sampling_interval: zod- .number()- .min(surveysUpdateBodyResponseSamplingIntervalMin)- .max(surveysUpdateBodyResponseSamplingIntervalMax)- .nullish(),- response_sampling_limit: zod- .number()- .min(surveysUpdateBodyResponseSamplingLimitMin)- .max(surveysUpdateBodyResponseSamplingLimitMax)- .nullish(),- response_sampling_daily_limits: zod.unknown().optional(),- enable_partial_responses: zod- .boolean()- .nullish()- .describe(- 'When at least one question is answered, the response is stored (true). The response is stored when all questions are answered (false).'- ),- enable_iframe_embedding: zod.boolean().nullish(),- base_language: zod- .string()- .max(surveysUpdateBodyBaseLanguageMax)- .optional()- .describe(- "BCP-47 language code (e.g. 'en', 'es', 'es-MX') describing the language of the survey's untranslated text. Defaults to 'en'. Cannot also appear as a key in `translations`."- ),- translations: zod.unknown().optional(),- _create_in_folder: zod.string().optional(),- form_content: zod.unknown().optional(),-})+export const SurveysUpdateBody = /* @__PURE__ */ zod+ .record(zod.string(), zod.unknown())+ .describe('Deep\/recursive schema (opaque in Zod — use TypeScript types for full shape)')/*** Mixin for ViewSets to handle approval-gate exceptions raised from decorated serializers.@@ -1935,929 +99,9 @@ export const SurveysUpdateBody = /* @__PURE__ */ zod.object({* decorator on serializer methods and converts them into the same responses the viewset path* produces (see decorators._result_to_response), so both paths share one contract.*/-export const surveysPartialUpdateBodyNameMax = 400--export const surveysPartialUpdateBodyTargetingFlagFiltersOneEarlyExitDefault = false-export const surveysPartialUpdateBodyQuestionsItemThreeBranchingOneThreeIndexMin = 0--export const surveysPartialUpdateBodyQuestionsItemThreeBranchingOneFourResponseValuesOneMin = 0--export const surveysPartialUpdateBodyQuestionsItemFourChoicesMin = 2-export const surveysPartialUpdateBodyQuestionsItemFourChoicesMax = 20--export const surveysPartialUpdateBodyQuestionsItemFourBranchingOneThreeIndexMin = 0--export const surveysPartialUpdateBodyQuestionsItemFourBranchingOneFourResponseValuesOneMin = 0--export const surveysPartialUpdateBodyQuestionsItemFiveChoicesMin = 2-export const surveysPartialUpdateBodyQuestionsItemFiveChoicesMax = 20--export const surveysPartialUpdateBodyConditionsOneSeenSurveyWaitPeriodInDaysMin = 0--export const surveysPartialUpdateBodyIterationCountMax = 500--export const surveysPartialUpdateBodyIterationFrequencyDaysMax = 365--export const surveysPartialUpdateBodyCurrentIterationMin = 0-export const surveysPartialUpdateBodyCurrentIterationMax = 2147483647--export const surveysPartialUpdateBodyResponseSamplingIntervalMin = 0-export const surveysPartialUpdateBodyResponseSamplingIntervalMax = 2147483647--export const surveysPartialUpdateBodyResponseSamplingLimitMin = 0-export const surveysPartialUpdateBodyResponseSamplingLimitMax = 2147483647--export const surveysPartialUpdateBodyBaseLanguageMax = 20--export const SurveysPartialUpdateBody = /* @__PURE__ */ zod.object({- name: zod- .string()- .min(1)- .max(surveysPartialUpdateBodyNameMax)- .optional()- .describe(- "Survey name. Anyone can read it. In-app surveys send it to every visitor's browser alongside the questions and appearance text, and a hosted survey shows it on its public page. Keep customer names and other private details out of it."- ),- description: zod- .string()- .optional()- .describe(- 'Survey description. Internal only: unlike the name and questions, it is never delivered to visitors.'- ),- type: zod- .enum(['popover', 'widget', 'external_survey', 'api'])- .describe(- '\* `popover` - popover\n\* `widget` - widget\n\* `external_survey` - external survey\n\* `api` - api'- )- .optional()- .describe(- 'Survey type.\n\n\* `popover` - popover\n\* `widget` - widget\n\* `external_survey` - external survey\n\* `api` - api'- ),- schedule: zod- .union([- zod- .enum(['once', 'recurring', 'always'])- .describe('\* `once` - once\n\* `recurring` - recurring\n\* `always` - always'),- zod.null(),- ])- .optional()- .describe(- "Survey scheduling behavior: 'once' = show once per user (default), 'recurring' = repeat based on iteration_count and iteration_frequency_days settings, 'always' = show every time conditions are met (mainly for widget surveys)\n\n\* `once` - once\n\* `recurring` - recurring\n\* `always` - always"- ),- linked_flag_id: zod.number().nullish().describe('The feature flag linked to this survey.'),- linked_insight_id: zod.number().nullish(),- targeting_flag_id: zod.number().optional().describe('An existing targeting flag to use for this survey.'),- targeting_flag_filters: zod- .union([- zod.object({- groups: zod- .array(- zod.object({- properties: zod- .array(- zod.union([- zod.object({- key: zod- .string()- .describe('Property key used in this feature flag condition.'),- type: zod- .enum(['cohort', 'person', 'group'])- .describe(- '\* `cohort` - cohort\n\* `person` - person\n\* `group` - group'- )- .optional()- .describe(- "Property filter type. Set it on every property. Use `group` with `group_type_index` to filter on a group's properties.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"- ),- cohort_name: zod- .string()- .nullish()- .describe('Resolved cohort name for cohort-type filters.'),- group_type_index: zod- .number()- .nullish()- .describe(- "Group type index a `group` filter reads properties from. Defaults to the condition set's `aggregation_group_type_index`."- ),- value: zod- .unknown()- .describe(- 'Comparison value for the property filter. Supports strings, numbers, booleans, and arrays.'- ),- operator: zod- .enum([- 'exact',- 'is_not',- 'icontains',- 'not_icontains',- 'starts_with',- 'not_starts_with',- 'ends_with',- 'not_ends_with',- 'regex',- 'not_regex',- 'gt',- 'gte',- 'lt',- 'lte',- ])- .describe(- '\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `gte` - gte\n\* `lt` - lt\n\* `lte` - lte'- )- .describe(- 'Operator used to compare the property value.\n\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `gte` - gte\n\* `lt` - lt\n\* `lte` - lte'- ),- }),- zod.object({- key: zod- .string()- .describe('Property key used in this feature flag condition.'),- type: zod- .enum(['cohort', 'person', 'group'])- .describe(- '\* `cohort` - cohort\n\* `person` - person\n\* `group` - group'- )- .optional()- .describe(- "Property filter type. Set it on every property. Use `group` with `group_type_index` to filter on a group's properties.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"- ),- cohort_name: zod- .string()- .nullish()- .describe('Resolved cohort name for cohort-type filters.'),- group_type_index: zod- .number()- .nullish()- .describe(- "Group type index a `group` filter reads properties from. Defaults to the condition set's `aggregation_group_type_index`."- ),- operator: zod- .enum(['is_set', 'is_not_set'])- .describe('\* `is_set` - is_set\n\* `is_not_set` - is_not_set')- .describe(- 'Existence operator.\n\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'- ),- value: zod- .unknown()- .optional()- .describe(- 'Optional value. Runtime behavior determines whether this is ignored.'- ),- }),- zod.object({- key: zod- .string()- .describe('Property key used in this feature flag condition.'),- type: zod- .enum(['cohort', 'person', 'group'])- .describe(- '\* `cohort` - cohort\n\* `person` - person\n\* `group` - group'- )- .optional()- .describe(- "Property filter type. Set it on every property. Use `group` with `group_type_index` to filter on a group's properties.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"- ),- cohort_name: zod- .string()- .nullish()- .describe('Resolved cohort name for cohort-type filters.'),- group_type_index: zod- .number()- .nullish()- .describe(- "Group type index a `group` filter reads properties from. Defaults to the condition set's `aggregation_group_type_index`."- ),- operator: zod- .enum(['is_date_exact', 'is_date_before', 'is_date_after'])- .describe(- '\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after'- )- .describe(- 'Date comparison operator.\n\n\* `is_date_exact` - is_date_exact\n\* `is_date_after` - is_date_after\n\* `is_date_before` - is_date_before'- ),- value: zod- .string()- .describe('Date value in ISO format or relative date expression.'),- }),- zod.object({- key: zod- .string()- .describe('Property key used in this feature flag condition.'),- type: zod- .enum(['cohort', 'person', 'group'])- .describe(- '\* `cohort` - cohort\n\* `person` - person\n\* `group` - group'- )- .optional()- .describe(- "Property filter type. Set it on every property. Use `group` with `group_type_index` to filter on a group's properties.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"- ),- cohort_name: zod- .string()- .nullish()- .describe('Resolved cohort name for cohort-type filters.'),- group_type_index: zod- .number()- .nullish()- .describe(- "Group type index a `group` filter reads properties from. Defaults to the condition set's `aggregation_group_type_index`."- ),- operator: zod- .enum([- 'semver_gt',- 'semver_gte',- 'semver_lt',- 'semver_lte',- 'semver_eq',- 'semver_neq',- 'semver_tilde',- 'semver_caret',- 'semver_wildcard',- ])- .describe(- '\* `semver_gt` - semver_gt\n\* `semver_gte` - semver_gte\n\* `semver_lt` - semver_lt\n\* `semver_lte` - semver_lte\n\* `semver_eq` - semver_eq\n\* `semver_neq` - semver_neq\n\* `semver_tilde` - semver_tilde\n\* `semver_caret` - semver_caret\n\* `semver_wildcard` - semver_wildcard'- )- .describe(- 'Semantic version comparison operator.\n\n\* `semver_gt` - semver_gt\n\* `semver_gte` - semver_gte\n\* `semver_lt` - semver_lt\n\* `semver_lte` - semver_lte\n\* `semver_eq` - semver_eq\n\* `semver_neq` - semver_neq\n\* `semver_tilde` - semver_tilde\n\* `semver_caret` - semver_caret\n\* `semver_wildcard` - semver_wildcard'- ),- value: zod.string().describe('Semantic version string.'),- }),- zod.object({- key: zod- .string()- .describe('Property key used in this feature flag condition.'),- type: zod- .enum(['cohort', 'person', 'group'])- .describe(- '\* `cohort` - cohort\n\* `person` - person\n\* `group` - group'- )- .optional()- .describe(- "Property filter type. Set it on every property. Use `group` with `group_type_index` to filter on a group's properties.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"- ),- cohort_name: zod- .string()- .nullish()- .describe('Resolved cohort name for cohort-type filters.'),- group_type_index: zod- .number()- .nullish()- .describe(- "Group type index a `group` filter reads properties from. Defaults to the condition set's `aggregation_group_type_index`."- ),- operator: zod- .enum(['icontains_multi', 'not_icontains_multi'])- .describe(- '\* `icontains_multi` - icontains_multi\n\* `not_icontains_multi` - not_icontains_multi'- )- .describe(- 'Multi-contains operator.\n\n\* `icontains_multi` - icontains_multi\n\* `not_icontains_multi` - not_icontains_multi'- ),- value: zod- .array(zod.string())- .describe('List of strings to evaluate against.'),- }),- zod.object({- key: zod- .string()- .describe('Property key used in this feature flag condition.'),- type: zod- .enum(['cohort'])- .describe('\* `cohort` - cohort')- .describe(- 'Cohort property type required for in\/not_in operators.\n\n\* `cohort` - cohort'- ),- cohort_name: zod- .string()- .nullish()- .describe('Resolved cohort name for cohort-type filters.'),- group_type_index: zod- .number()- .nullish()- .describe(- "Group type index a `group` filter reads properties from. Defaults to the condition set's `aggregation_group_type_index`."- ),- operator: zod- .enum(['in', 'not_in'])- .describe('\* `in` - in\n\* `not_in` - not_in')- .describe(- 'Membership operator for cohort properties.\n\n\* `in` - in\n\* `not_in` - not_in'- ),- value: zod- .unknown()- .describe(- 'Cohort comparison value (single or list, depending on usage).'- ),- }),- zod.object({- key: zod- .string()- .describe('Property key used in this feature flag condition.'),- type: zod- .enum(['flag'])- .describe('\* `flag` - flag')- .describe(- 'Flag property type required for flag dependency checks.\n\n\* `flag` - flag'- ),- cohort_name: zod- .string()- .nullish()- .describe('Resolved cohort name for cohort-type filters.'),- group_type_index: zod- .number()- .nullish()- .describe(- "Group type index a `group` filter reads properties from. Defaults to the condition set's `aggregation_group_type_index`."- ),- operator: zod- .enum(['flag_evaluates_to'])- .describe('\* `flag_evaluates_to` - flag_evaluates_to')- .describe(- 'Operator for feature flag dependency evaluation.\n\n\* `flag_evaluates_to` - flag_evaluates_to'- ),- value: zod.unknown().describe('Value to compare flag evaluation against.'),- }),- ])- )- .optional()- .describe('Property conditions for this release condition group.'),- rollout_percentage: zod- .number()- .optional()- .describe('Rollout percentage for this release condition group.'),- variant: zod.string().nullish().describe('Variant key override for multivariate flags.'),- aggregation_group_type_index: zod- .number()- .nullish()- .describe(- 'Group type index for this condition set. None means person-level aggregation.'- ),- })- )- .optional()- .describe('Release condition groups for the feature flag.'),- multivariate: zod- .union([- zod.object({- variants: zod- .array(- zod.object({- key: zod.string().describe('Unique key for this variant.'),- name: zod.string().optional().describe('Human-readable name for this variant.'),- rollout_percentage: zod.number().describe('Variant rollout percentage.'),- })- )- .describe('Variant definitions for multivariate feature flags.'),- }),- zod.null(),- ])- .optional()- .describe('Multivariate configuration for variant-based rollouts.'),- aggregation_group_type_index: zod- .number()- .nullish()- .describe('Group type index for group-based feature flags.'),- payloads: zod- .record(zod.string(), zod.string())- .optional()- .describe('Optional payload values keyed by variant key.'),- feature_enrollment: zod- .boolean()- .nullish()- .describe(- 'Whether this flag has early access feature enrollment enabled. When true, the flag is evaluated against the person property $feature_enrollment\/{flag_key}.'- ),- early_exit: zod- .boolean()- .default(surveysPartialUpdateBodyTargetingFlagFiltersOneEarlyExitDefault)- .describe(- 'When true, condition evaluation stops at the first matching condition set rather than continuing to evaluate subsequent groups.'- ),- }),- zod.null(),- ])- .optional()- .describe(- "Target specific users based on their properties. Example: {groups: [{properties: [{key: 'email', value: ['@company.com'], operator: 'icontains'}], rollout_percentage: 100}]}"- ),- remove_targeting_flag: zod- .boolean()- .nullish()- .describe(- 'Set to true to completely remove all targeting filters from the survey, making it visible to all users (subject to other display conditions like URL matching).'- ),- questions: zod- .array(- zod.union([- zod.object({- id: zod- .string()- .optional()- .describe(- 'Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one.'- ),- type: zod.enum(['open']).describe('\* `open` - open'),- question: zod.string().describe('Question text shown to respondents.'),- description: zod.string().optional().describe('Optional helper text.'),- descriptionContentType: zod- .enum(['html', 'text'])- .describe('\* `html` - html\n\* `text` - text')- .optional()- .describe('Format for the description field.\n\n\* `text` - text\n\* `html` - html'),- optional: zod.boolean().optional().describe('Whether respondents may skip this question.'),- buttonText: zod.string().optional().describe('Custom button label.'),- }),- zod.object({- id: zod- .string()- .optional()- .describe(- 'Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one.'- ),- type: zod.enum(['link']).describe('\* `link` - link'),- question: zod.string().describe('Question text shown to respondents.'),- description: zod.string().optional().describe('Optional helper text.'),- descriptionContentType: zod- .enum(['html', 'text'])- .describe('\* `html` - html\n\* `text` - text')- .optional()- .describe('Format for the description field.\n\n\* `text` - text\n\* `html` - html'),- optional: zod.boolean().optional().describe('Whether respondents may skip this question.'),- buttonText: zod.string().optional().describe('Custom button label.'),- link: zod.string().describe('HTTPS or mailto URL for link questions.'),- }),- zod.object({- id: zod- .string()- .optional()- .describe(- 'Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one.'- ),- type: zod.enum(['rating']).describe('\* `rating` - rating'),- question: zod.string().describe('Question text shown to respondents.'),- description: zod.string().optional().describe('Optional helper text.'),- descriptionContentType: zod- .enum(['html', 'text'])- .describe('\* `html` - html\n\* `text` - text')- .optional()- .describe('Format for the description field.\n\n\* `text` - text\n\* `html` - html'),- optional: zod.boolean().optional().describe('Whether respondents may skip this question.'),- buttonText: zod.string().optional().describe('Custom button label.'),- display: zod- .enum(['number', 'emoji'])- .describe('\* `number` - number\n\* `emoji` - emoji')- .optional()- .describe(- "Display format: 'number' shows numeric scale, 'emoji' shows emoji scale.\n\n\* `number` - number\n\* `emoji` - emoji"- ),- scale: zod.number().min(1).optional().describe('Rating scale can be one of 3, 5, or 7'),- lowerBoundLabel: zod- .string()- .optional()- .describe("Label for the lowest rating (e.g., 'Very Poor')"),- upperBoundLabel: zod- .string()- .optional()- .describe("Label for the highest rating (e.g., 'Excellent')"),- branching: zod- .union([- zod.union([- zod.object({- type: zod- .enum(['next_question'])- .describe('\* `next_question` - next_question')- .describe(- 'Continue to the next question in sequence.\n\n\* `next_question` - next_question'- ),- }),- zod.object({- type: zod- .enum(['end'])- .describe('\* `end` - end')- .describe('End the survey.\n\n\* `end` - end'),- }),- zod.object({- type: zod- .enum(['specific_question'])- .describe('\* `specific_question` - specific_question')- .describe(- 'Jump to a specific question index.\n\n\* `specific_question` - specific_question'- ),- index: zod- .number()- .min(surveysPartialUpdateBodyQuestionsItemThreeBranchingOneThreeIndexMin)- .describe('0-based index of the next question.'),- }),- zod.object({- type: zod- .enum(['response_based'])- .describe('\* `response_based` - response_based')- .describe(- 'Branch based on the selected or entered response.\n\n\* `response_based` - response_based'- ),- responseValues: zod- .record(- zod.string(),- zod.union([- zod- .number()- .min(- surveysPartialUpdateBodyQuestionsItemThreeBranchingOneFourResponseValuesOneMin- ),- zod.enum(['end']),- ])- )- .describe(- "Response-based branching map. Values can be a question index or 'end'."- ),- }),- ]),- zod.null(),- ])- .optional(),- }),- zod.object({- id: zod- .string()- .optional()- .describe(- 'Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one.'- ),- type: zod.enum(['single_choice']).describe('\* `single_choice` - single_choice'),- question: zod.string().describe('Question text shown to respondents.'),- description: zod.string().optional().describe('Optional helper text.'),- descriptionContentType: zod- .enum(['html', 'text'])- .describe('\* `html` - html\n\* `text` - text')- .optional()- .describe('Format for the description field.\n\n\* `text` - text\n\* `html` - html'),- optional: zod.boolean().optional().describe('Whether respondents may skip this question.'),- buttonText: zod.string().optional().describe('Custom button label.'),- choices: zod- .array(zod.string())- .min(surveysPartialUpdateBodyQuestionsItemFourChoicesMin)- .max(surveysPartialUpdateBodyQuestionsItemFourChoicesMax)- .describe(- 'Array of choice options. Choice indices (0, 1, 2, ...) are used for branching logic.'- ),- shuffleOptions: zod- .boolean()- .optional()- .describe('Whether to randomize the order of choices for each respondent.'),- hasOpenChoice: zod- .boolean()- .optional()- .describe("Whether the final option should be an open-text choice (for example, 'Other')."),- branching: zod- .union([- zod.union([- zod.object({- type: zod- .enum(['next_question'])- .describe('\* `next_question` - next_question')- .describe(- 'Continue to the next question in sequence.\n\n\* `next_question` - next_question'- ),- }),- zod.object({- type: zod- .enum(['end'])- .describe('\* `end` - end')- .describe('End the survey.\n\n\* `end` - end'),- }),- zod.object({- type: zod- .enum(['specific_question'])- .describe('\* `specific_question` - specific_question')- .describe(- 'Jump to a specific question index.\n\n\* `specific_question` - specific_question'- ),- index: zod- .number()- .min(surveysPartialUpdateBodyQuestionsItemFourBranchingOneThreeIndexMin)- .describe('0-based index of the next question.'),- }),- zod.object({- type: zod- .enum(['response_based'])- .describe('\* `response_based` - response_based')- .describe(- 'Branch based on the selected or entered response.\n\n\* `response_based` - response_based'- ),- responseValues: zod- .record(- zod.string(),- zod.union([- zod- .number()- .min(- surveysPartialUpdateBodyQuestionsItemFourBranchingOneFourResponseValuesOneMin- ),- zod.enum(['end']),- ])- )- .describe(- "Response-based branching map. Values can be a question index or 'end'."- ),- }),- ]),- zod.null(),- ])- .optional(),- }),- zod.object({- id: zod- .string()- .optional()- .describe(- 'Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one.'- ),- type: zod.enum(['multiple_choice']).describe('\* `multiple_choice` - multiple_choice'),- question: zod.string().describe('Question text shown to respondents.'),- description: zod.string().optional().describe('Optional helper text.'),- descriptionContentType: zod- .enum(['html', 'text'])- .describe('\* `html` - html\n\* `text` - text')- .optional()- .describe('Format for the description field.\n\n\* `text` - text\n\* `html` - html'),- optional: zod.boolean().optional().describe('Whether respondents may skip this question.'),- buttonText: zod.string().optional().describe('Custom button label.'),- choices: zod- .array(zod.string())- .min(surveysPartialUpdateBodyQuestionsItemFiveChoicesMin)- .max(surveysPartialUpdateBodyQuestionsItemFiveChoicesMax)- .describe(- 'Array of choice options. Multiple selections allowed. No branching logic supported.'- ),- shuffleOptions: zod- .boolean()- .optional()- .describe('Whether to randomize the order of choices for each respondent.'),- hasOpenChoice: zod- .boolean()- .optional()- .describe("Whether the final option should be an open-text choice (for example, 'Other')."),- }),- ])- )- .nullish()- .describe(- '\n The `array` of questions included in the survey. Each question must conform to one of the defined question types: Basic, Link, Rating, or Multiple Choice.\n\n Basic (open-ended question)\n - `id`: The question ID\n - `type`: `open`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Link (a question with a link)\n - `id`: The question ID\n - `type`: `link`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `link`: The URL associated with the question.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Rating (a question with a rating scale)\n - `id`: The question ID\n - `type`: `rating`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `display`: Display style of the rating (`number` or `emoji`).\n - `scale`: The scale of the rating (`number`).\n - `lowerBoundLabel`: Label for the lower bound of the scale.\n - `upperBoundLabel`: Label for the upper bound of the scale.\n - `isNpsQuestion`: Whether the question is an NPS rating.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Multiple choice\n - `id`: The question ID\n - `type`: `single_choice` or `multiple_choice`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `choices`: An array of choices for the question.\n - `shuffleOptions`: Whether to shuffle the order of the choices (`boolean`).\n - `hasOpenChoice`: Whether the question allows an open-ended response (`boolean`).\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Branching logic can be one of the following types:\n\n Next question: Proceeds to the next question\n ```json\n {\n \"type\": \"next_question\"\n }\n ```\n\n End: Ends the survey, optionally displaying a confirmation message.\n ```json\n {\n \"type\": \"end\"\n }\n ```\n\n Response-based: Branches based on the response values. Available for the `rating` and `single_choice` question types.\n ```json\n {\n \"type\": \"response_based\",\n \"responseValues\": {\n \"responseKey\": \"value\"\n }\n }\n ```\n\n Specific question: Proceeds to a specific question by index.\n ```json\n {\n \"type\": \"specific_question\",\n \"index\": 2\n }\n ```\n\n Translations: Each question can include inline translations.\n - `translations`: Object mapping language codes to translated fields.\n - Language codes: Canonical BCP-47-ish strings (e.g., \"es\", \"es-MX\", \"zh-CN\"). Aliases like \"english\" or \"default\" are rejected. The survey\'s `base_language` (default \"en\") declares the language of the untranslated text and cannot also appear as a translation key.\n - Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`\n\n Example with translations:\n ```json\n {\n \"id\": \"uuid\",\n \"type\": \"rating\",\n \"question\": \"How satisfied are you?\",\n \"lowerBoundLabel\": \"Not satisfied\",\n \"upperBoundLabel\": \"Very satisfied\",\n \"translations\": {\n \"es\": {\n \"question\": \"¿Qué tan satisfecho estás?\",\n \"lowerBoundLabel\": \"No satisfecho\",\n \"upperBoundLabel\": \"Muy satisfecho\"\n },\n \"fr\": {\n \"question\": \"Dans quelle mesure êtes-vous satisfait?\"\n }\n }\n }\n ```\n '- ),- conditions: zod- .union([- zod.object({- url: zod.string().optional(),- selector: zod.string().optional(),- seenSurveyWaitPeriodInDays: zod- .number()- .min(surveysPartialUpdateBodyConditionsOneSeenSurveyWaitPeriodInDaysMin)- .optional()- .describe("Don't show this survey to users who saw any survey in the last x days."),- urlMatchType: zod- .enum(['regex', 'not_regex', 'exact', 'is_not', 'icontains', 'not_icontains'])- .describe(- '\* `regex` - regex\n\* `not_regex` - not_regex\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains'- )- .optional()- .describe(- "URL\/device matching types: 'regex' (matches regex pattern), 'not_regex' (does not match regex pattern), 'exact' (exact string match), 'is_not' (not exact match), 'icontains' (case-insensitive contains), 'not_icontains' (case-insensitive does not contain).\n\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains"- ),- events: zod- .object({- repeatedActivation: zod- .boolean()- .optional()- .describe(- 'Whether to show the survey every time one of the events is triggered (true), or just once (false).'- ),- values: zod- .array(- zod.object({- name: zod.string().describe('Event name that triggers the survey.'),- })- )- .optional()- .describe('Array of event names that trigger the survey.'),- })- .optional(),- deviceTypes: zod- .array(- zod- .enum(['Desktop', 'Mobile', 'Tablet'])- .describe('\* `Desktop` - Desktop\n\* `Mobile` - Mobile\n\* `Tablet` - Tablet')- )- .optional()- .describe('Device types that should match for this survey to be shown.'),- deviceTypesMatchType: zod- .enum(['regex', 'not_regex', 'exact', 'is_not', 'icontains', 'not_icontains'])- .describe(- '\* `regex` - regex\n\* `not_regex` - not_regex\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains'- )- .optional()- .describe(- "URL\/device matching types: 'regex' (matches regex pattern), 'not_regex' (does not match regex pattern), 'exact' (exact string match), 'is_not' (not exact match), 'icontains' (case-insensitive contains), 'not_icontains' (case-insensitive does not contain).\n\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains"- ),- linkedFlagVariant: zod- .string()- .optional()- .describe('The variant of the feature flag linked to this survey.'),- }),- zod.null(),- ])- .optional()- .describe('Display and targeting conditions for the survey.'),- appearance: zod- .union([- zod.object({- backgroundColor: zod.string().optional(),- submitButtonColor: zod.string().optional(),- textColor: zod.string().optional(),- submitButtonText: zod.string().optional(),- submitButtonTextColor: zod.string().optional(),- descriptionTextColor: zod.string().optional(),- ratingButtonColor: zod.string().optional(),- ratingButtonActiveColor: zod.string().optional(),- ratingButtonHoverColor: zod.string().optional(),- textSubtleColor: zod- .string()- .optional()- .describe('Color of secondary text, such as question descriptions.'),- inputBackground: zod- .string()- .optional()- .describe('Background color of open text inputs and rating buttons.'),- inputTextColor: zod- .string()- .optional()- .describe(- 'Text color of open text inputs and rating buttons. Calculated from inputBackground when not set.'- ),- whiteLabel: zod.boolean().optional(),- autoDisappear: zod.boolean().optional(),- displayThankYouMessage: zod.boolean().optional(),- thankYouMessageHeader: zod.string().optional(),- thankYouMessageDescription: zod.string().optional(),- thankYouMessageDescriptionContentType: zod- .enum(['html', 'text'])- .optional()- .describe('\* `html` - html\n\* `text` - text'),- thankYouMessageCloseButtonText: zod.string().optional(),- displayIntroScreen: zod- .boolean()- .optional()- .describe(- 'Whether to show an intro screen before the first question. The intro screen shows only when introScreenHeader or introScreenDescription is set.'- ),- introScreenHeader: zod.string().optional().describe('Heading of the intro screen.'),- introScreenDescription: zod.string().optional().describe('Body text of the intro screen.'),- introScreenDescriptionContentType: zod- .enum(['html', 'text'])- .describe('\* `html` - html\n\* `text` - text')- .optional()- .describe('Content type of introScreenDescription.\n\n\* `text` - text\n\* `html` - html'),- introScreenButtonText: zod- .string()- .optional()- .describe('Label of the button that closes the intro screen and starts the survey.'),- borderColor: zod.string().optional(),- placeholder: zod.string().optional(),- position: zod- .enum([- 'top_left',- 'top_center',- 'top_right',- 'middle_left',- 'middle_center',- 'middle_right',- 'left',- 'center',- 'right',- 'next_to_trigger',- ])- .describe(- '\* `top_left` - top_left\n\* `top_center` - top_center\n\* `top_right` - top_right\n\* `middle_left` - middle_left\n\* `middle_center` - middle_center\n\* `middle_right` - middle_right\n\* `left` - left\n\* `center` - center\n\* `right` - right\n\* `next_to_trigger` - next_to_trigger'- )- .optional()- .describe(- "Where a popover survey appears on the page. Defaults to 'right'.\n\n\* `top_left` - top_left\n\* `top_center` - top_center\n\* `top_right` - top_right\n\* `middle_left` - middle_left\n\* `middle_center` - middle_center\n\* `middle_right` - middle_right\n\* `left` - left\n\* `center` - center\n\* `right` - right\n\* `next_to_trigger` - next_to_trigger"- ),- shuffleQuestions: zod.boolean().optional(),- surveyPopupDelaySeconds: zod- .number()- .nullish()- .describe('Seconds to wait before a popover survey appears. Null shows it without a delay.'),- allowGoBack: zod- .boolean()- .optional()- .describe(- "Whether to show a 'Back' button on web surveys after the first question, letting respondents return to a previously visited question. Defaults to false."- ),- backButtonText: zod- .string()- .optional()- .describe("Optional override for the back button label. Defaults to 'Back'."),- widgetType: zod- .enum(['button', 'tab', 'selector'])- .optional()- .describe('\* `button` - button\n\* `tab` - tab\n\* `selector` - selector'),- widgetSelector: zod.string().optional(),- widgetLabel: zod.string().optional(),- widgetColor: zod.string().optional(),- tabPosition: zod- .enum(['top', 'left', 'right', 'bottom'])- .describe('\* `top` - top\n\* `left` - left\n\* `right` - right\n\* `bottom` - bottom')- .optional()- .describe(- "Which edge of the page holds the tab of a widget survey with widgetType 'tab'.\n\n\* `top` - top\n\* `left` - left\n\* `right` - right\n\* `bottom` - bottom"- ),- fontFamily: zod.string().optional(),- maxWidth: zod.string().optional(),- zIndex: zod.string().optional(),- disabledButtonOpacity: zod.string().optional(),- boxPadding: zod.string().optional(),- boxShadow: zod.string().optional().describe('CSS box-shadow value of the survey box.'),- borderRadius: zod.string().optional().describe('CSS border-radius value of the survey box.'),- }),- zod.null(),- ])- .optional()- .describe('Survey appearance customization.'),- start_date: zod.iso- .datetime({ offset: true })- .nullish()- .describe(- "Setting this will launch the survey immediately. Don't add a start_date unless explicitly requested to do so."- ),- end_date: zod.iso- .datetime({ offset: true })- .nullish()- .describe('When the survey stopped being shown to users. Setting this will complete the survey.'),- archived: zod.boolean().optional().describe('Archive state for the survey.'),- responses_limit: zod- .number()- .nullish()- .describe('The maximum number of responses before automatically stopping the survey.'),- iteration_count: zod- .number()- .min(1)- .max(surveysPartialUpdateBodyIterationCountMax)- .nullish()- .describe(- "For a recurring schedule, this field specifies the number of times the survey should be shown to the user. Use 1 for 'once every X days', higher numbers for multiple repetitions. Works together with iteration_frequency_days to determine the overall survey schedule."- ),- iteration_frequency_days: zod- .number()- .min(1)- .max(surveysPartialUpdateBodyIterationFrequencyDaysMax)- .nullish()- .describe(- 'For a recurring schedule, this field specifies the interval in days between each survey instance shown to the user, used alongside iteration_count for precise scheduling.'- ),- iteration_start_dates: zod.array(zod.iso.datetime({ offset: true }).nullable()).nullish(),- current_iteration: zod- .number()- .min(surveysPartialUpdateBodyCurrentIterationMin)- .max(surveysPartialUpdateBodyCurrentIterationMax)- .nullish(),- current_iteration_start_date: zod.iso.datetime({ offset: true }).nullish(),- response_sampling_start_date: zod.iso.datetime({ offset: true }).nullish(),- response_sampling_interval_type: zod- .union([- zod.enum(['day', 'week', 'month']).describe('\* `day` - day\n\* `week` - week\n\* `month` - month'),- zod.enum(['']),- zod.null(),- ])- .optional(),- response_sampling_interval: zod- .number()- .min(surveysPartialUpdateBodyResponseSamplingIntervalMin)- .max(surveysPartialUpdateBodyResponseSamplingIntervalMax)- .nullish(),- response_sampling_limit: zod- .number()- .min(surveysPartialUpdateBodyResponseSamplingLimitMin)- .max(surveysPartialUpdateBodyResponseSamplingLimitMax)- .nullish(),- response_sampling_daily_limits: zod.unknown().optional(),- enable_partial_responses: zod- .boolean()- .nullish()- .describe(- 'When at least one question is answered, the response is stored (true). The response is stored when all questions are answered (false).'- ),- enable_iframe_embedding: zod.boolean().nullish(),- base_language: zod- .string()- .max(surveysPartialUpdateBodyBaseLanguageMax)- .optional()- .describe(- "BCP-47 language code (e.g. 'en', 'es', 'es-MX') describing the language of the survey's untranslated text. Defaults to 'en'. Cannot also appear as a key in `translations`."- ),- translations: zod.unknown().optional(),- _create_in_folder: zod.string().optional(),- form_content: zod.unknown().optional(),-})+export const SurveysPartialUpdateBody = /* @__PURE__ */ zod+ .record(zod.string(), zod.unknown())+ .describe('Deep\/recursive schema (opaque in Zod — use TypeScript types for full shape)')/*** Duplicate a survey to multiple projects in a single transaction.diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 9f2191aa4483..63f29d38c50e 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -87258,78 +87258,52 @@ export namespace Schemas {Open: 'open',} as const;- export interface SurveyOpenQuestionSchema {- /** Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one. */- id?: string;- type: SurveyOpenQuestionSchemaTypeEnum;- /** Question text shown to respondents. */- question: string;- /** Optional helper text. */+ export interface SurveyQuestionTranslationSchema {+ /** Translated question text. */+ question?: string;+ /** Translated helper text. */description?: string;- /** Format for the description field.- *- * * `text` - text- * * `html` - html */- descriptionContentType?: DescriptionContentTypeEnum;- /** Whether respondents may skip this question. */- optional?: boolean;- /** Custom button label. */+ /** Translated button label. */buttonText?: string;+ /** Translated lowest rating label. Rating questions only. */+ lowerBoundLabel?: string;+ /** Translated highest rating label. Rating questions only. */+ upperBoundLabel?: string;+ /** Translated choices. Must have the same length as the question choices. Choice questions only. */+ choices?: string[];+ /** Translated URL. Link questions only. */+ link?: string;}/**- * * `link` - link+ * * `min_length` - min_length+ * * `max_length` - max_length+ * * `email` - email*/- export type SurveyLinkQuestionSchemaTypeEnum = typeof SurveyLinkQuestionSchemaTypeEnum[keyof typeof SurveyLinkQuestionSchemaTypeEnum];+ export type SurveyQuestionValidationRuleTypeEnum = typeof SurveyQuestionValidationRuleTypeEnum[keyof typeof SurveyQuestionValidationRuleTypeEnum];- export const SurveyLinkQuestionSchemaTypeEnum = {- Link: 'link',+ export const SurveyQuestionValidationRuleTypeEnum = {+ MinLength: 'min_length',+ MaxLength: 'max_length',+ Email: 'email',} as const;- export interface SurveyLinkQuestionSchema {- /** Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one. */- id?: string;- type: SurveyLinkQuestionSchemaTypeEnum;- /** Question text shown to respondents. */- question: string;- /** Optional helper text. */- description?: string;- /** Format for the description field.+ export interface SurveyQuestionValidationRule {+ /** Validation rule type for open-text questions.*- * * `text` - text- * * `html` - html */- descriptionContentType?: DescriptionContentTypeEnum;- /** Whether respondents may skip this question. */- optional?: boolean;- /** Custom button label. */- buttonText?: string;- /** HTTPS or mailto URL for link questions. */- link: string;+ * * `min_length` - min_length+ * * `max_length` - max_length+ * * `email` - email */+ type: SurveyQuestionValidationRuleTypeEnum;+ /**+ * Rule value for min_length or max_length validations.+ * @minimum 1+ * @nullable+ */+ value?: number | null;}- /**- * * `rating` - rating- */- export type SurveyRatingQuestionSchemaTypeEnum = typeof SurveyRatingQuestionSchemaTypeEnum[keyof typeof SurveyRatingQuestionSchemaTypeEnum];--- export const SurveyRatingQuestionSchemaTypeEnum = {- Rating: 'rating',- } as const;-- /**- * * `number` - number- * * `emoji` - emoji- */- export type SurveyRatingQuestionSchemaDisplayEnum = typeof SurveyRatingQuestionSchemaDisplayEnum[keyof typeof SurveyRatingQuestionSchemaDisplayEnum];--- export const SurveyRatingQuestionSchemaDisplayEnum = {- Number: 'number',- Emoji: 'emoji',- } as const;-/*** * `next_question` - next_question*/@@ -87412,6 +87386,104 @@ export namespace Schemas {export type SurveyBranchingSchema = SurveyNextQuestionBranching | SurveyEndBranching | SurveySpecificQuestionBranching | SurveyResponseBasedBranching;+ /**+ * Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost.+ */+ export type SurveyOpenQuestionSchemaTranslations = {[key: string]: SurveyQuestionTranslationSchema};++ export interface SurveyOpenQuestionSchema {+ /** Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one. */+ id?: string;+ type: SurveyOpenQuestionSchemaTypeEnum;+ /** Question text shown to respondents. */+ question: string;+ /** Optional helper text. */+ description?: string;+ /** Format for the description field.+ *+ * * `text` - text+ * * `html` - html */+ descriptionContentType?: DescriptionContentTypeEnum;+ /** Whether respondents may skip this question. */+ optional?: boolean;+ /** Custom button label. */+ buttonText?: string;+ /** Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost. */+ translations?: SurveyOpenQuestionSchemaTranslations;+ /**+ * Validation rules for the response text, for example a minimum length.+ * @nullable+ */+ validation?: SurveyQuestionValidationRule[] | null;+ branching?: SurveyBranchingSchema | null;+ }++ /**+ * * `link` - link+ */+ export type SurveyLinkQuestionSchemaTypeEnum = typeof SurveyLinkQuestionSchemaTypeEnum[keyof typeof SurveyLinkQuestionSchemaTypeEnum];+++ export const SurveyLinkQuestionSchemaTypeEnum = {+ Link: 'link',+ } as const;++ /**+ * Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost.+ */+ export type SurveyLinkQuestionSchemaTranslations = {[key: string]: SurveyQuestionTranslationSchema};++ export interface SurveyLinkQuestionSchema {+ /** Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one. */+ id?: string;+ type: SurveyLinkQuestionSchemaTypeEnum;+ /** Question text shown to respondents. */+ question: string;+ /** Optional helper text. */+ description?: string;+ /** Format for the description field.+ *+ * * `text` - text+ * * `html` - html */+ descriptionContentType?: DescriptionContentTypeEnum;+ /** Whether respondents may skip this question. */+ optional?: boolean;+ /** Custom button label. */+ buttonText?: string;+ /** Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost. */+ translations?: SurveyLinkQuestionSchemaTranslations;+ /** HTTPS or mailto URL for link questions. */+ link: string;+ branching?: SurveyBranchingSchema | null;+ }++ /**+ * * `rating` - rating+ */+ export type SurveyRatingQuestionSchemaTypeEnum = typeof SurveyRatingQuestionSchemaTypeEnum[keyof typeof SurveyRatingQuestionSchemaTypeEnum];+++ export const SurveyRatingQuestionSchemaTypeEnum = {+ Rating: 'rating',+ } as const;++ /**+ * * `number` - number+ * * `emoji` - emoji+ */+ export type SurveyRatingQuestionSchemaDisplayEnum = typeof SurveyRatingQuestionSchemaDisplayEnum[keyof typeof SurveyRatingQuestionSchemaDisplayEnum];+++ export const SurveyRatingQuestionSchemaDisplayEnum = {+ Number: 'number',+ Emoji: 'emoji',+ } as const;++ /**+ * Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost.+ */+ export type SurveyRatingQuestionSchemaTranslations = {[key: string]: SurveyQuestionTranslationSchema};+export interface SurveyRatingQuestionSchema {/** Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one. */id?: string;@@ -87429,6 +87501,8 @@ export namespace Schemas {optional?: boolean;/** Custom button label. */buttonText?: string;+ /** Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost. */+ translations?: SurveyRatingQuestionSchemaTranslations;/** Display format: 'number' shows numeric scale, 'emoji' shows emoji scale.** * `number` - number@@ -87443,6 +87517,8 @@ export namespace Schemas {lowerBoundLabel?: string;/** Label for the highest rating (e.g., 'Excellent') */upperBoundLabel?: string;+ /** Whether a rating question with a scale of 10 shows NPS scoring. A missing value counts as true. */+ isNpsQuestion?: boolean;branching?: SurveyBranchingSchema | null;}@@ -87456,6 +87532,11 @@ export namespace Schemas {SingleChoice: 'single_choice',} as const;+ /**+ * Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost.+ */+ export type SurveySingleChoiceQuestionSchemaTranslations = {[key: string]: SurveyQuestionTranslationSchema};+export interface SurveySingleChoiceQuestionSchema {/** Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one. */id?: string;@@ -87473,6 +87554,8 @@ export namespace Schemas {optional?: boolean;/** Custom button label. */buttonText?: string;+ /** Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost. */+ translations?: SurveySingleChoiceQuestionSchemaTranslations;/*** Array of choice options. Choice indices (0, 1, 2, ...) are used for branching logic.* @minItems 2@@ -87496,6 +87579,11 @@ export namespace Schemas {MultipleChoice: 'multiple_choice',} as const;+ /**+ * Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost.+ */+ export type SurveyMultipleChoiceQuestionSchemaTranslations = {[key: string]: SurveyQuestionTranslationSchema};+export interface SurveyMultipleChoiceQuestionSchema {/** Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one. */id?: string;@@ -87513,6 +87601,8 @@ export namespace Schemas {optional?: boolean;/** Custom button label. */buttonText?: string;+ /** Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost. */+ translations?: SurveyMultipleChoiceQuestionSchemaTranslations;/*** Array of choice options. Multiple selections allowed. No branching logic supported.* @minItems 2diff --git a/services/mcp/src/generated/surveys/api.ts b/services/mcp/src/generated/surveys/api.tsindex a7449e6fb1ac..3c619465bcc7 100644--- a/services/mcp/src/generated/surveys/api.ts+++ b/services/mcp/src/generated/surveys/api.ts@@ -71,6 +71,14 @@ export const SurveysCreateParams = () => zod.object({export const surveysCreateBodyNameMax = 400export const surveysCreateBodyTargetingFlagFiltersOneEarlyExitDefault = false+export const surveysCreateBodyQuestionsItemOneBranchingOneThreeIndexMin = 0++export const surveysCreateBodyQuestionsItemOneBranchingOneFourResponseValuesOneMin = 0++export const surveysCreateBodyQuestionsItemTwoBranchingOneThreeIndexMin = 0++export const surveysCreateBodyQuestionsItemTwoBranchingOneFourResponseValuesOneMin = 0+export const surveysCreateBodyQuestionsItemThreeBranchingOneThreeIndexMin = 0export const surveysCreateBodyQuestionsItemThreeBranchingOneFourResponseValuesOneMin = 0@@ -497,6 +505,110 @@ export const SurveysCreateBody = () => zod.object({.describe('Format for the description field.\n\n\* `text` - text\n\* `html` - html'),optional: zod.boolean().optional().describe('Whether respondents may skip this question.'),buttonText: zod.string().optional().describe('Custom button label.'),+ translations: zod+ .record(+ zod.string(),+ zod.object({+ question: zod.string().optional().describe('Translated question text.'),+ description: zod.string().optional().describe('Translated helper text.'),+ buttonText: zod.string().optional().describe('Translated button label.'),+ lowerBoundLabel: zod+ .string()+ .optional()+ .describe('Translated lowest rating label. Rating questions only.'),+ upperBoundLabel: zod+ .string()+ .optional()+ .describe('Translated highest rating label. Rating questions only.'),+ choices: zod+ .array(zod.string())+ .optional()+ .describe(+ 'Translated choices. Must have the same length as the question choices. Choice questions only.'+ ),+ link: zod.string().optional().describe('Translated URL. Link questions only.'),+ })+ )+ .optional()+ .describe(+ "Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost."+ ),+ validation: zod+ .array(+ zod.object({+ type: zod+ .enum(['min_length', 'max_length', 'email'])+ .describe(+ '\* `min_length` - min_length\n\* `max_length` - max_length\n\* `email` - email'+ )+ .describe(+ 'Validation rule type for open-text questions.\n\n\* `min_length` - min_length\n\* `max_length` - max_length\n\* `email` - email'+ ),+ value: zod+ .number()+ .min(1)+ .nullish()+ .describe('Rule value for min_length or max_length validations.'),+ })+ )+ .nullish()+ .describe('Validation rules for the response text, for example a minimum length.'),+ branching: zod+ .union([+ zod.union([+ zod.object({+ type: zod+ .enum(['next_question'])+ .describe('\* `next_question` - next_question')+ .describe(+ 'Continue to the next question in sequence.\n\n\* `next_question` - next_question'+ ),+ }),+ zod.object({+ type: zod+ .enum(['end'])+ .describe('\* `end` - end')+ .describe('End the survey.\n\n\* `end` - end'),+ }),+ zod.object({+ type: zod+ .enum(['specific_question'])+ .describe('\* `specific_question` - specific_question')+ .describe(+ 'Jump to a specific question index.\n\n\* `specific_question` - specific_question'+ ),+ index: zod+ .number()+ .min(surveysCreateBodyQuestionsItemOneBranchingOneThreeIndexMin)+ .describe('0-based index of the next question.'),+ }),+ zod.object({+ type: zod+ .enum(['response_based'])+ .describe('\* `response_based` - response_based')+ .describe(+ 'Branch based on the selected or entered response.\n\n\* `response_based` - response_based'+ ),+ responseValues: zod+ .record(+ zod.string(),+ zod.union([+ zod+ .number()+ .min(+ surveysCreateBodyQuestionsItemOneBranchingOneFourResponseValuesOneMin+ ),+ zod.enum(['end']),+ ])+ )+ .describe(+ "Response-based branching map. Values can be a question index or 'end'."+ ),+ }),+ ]),+ zod.null(),+ ])+ .optional(),}),zod.object({id: zod@@ -515,7 +627,91 @@ export const SurveysCreateBody = () => zod.object({.describe('Format for the description field.\n\n\* `text` - text\n\* `html` - html'),optional: zod.boolean().optional().describe('Whether respondents may skip this question.'),buttonText: zod.string().optional().describe('Custom button label.'),+ translations: zod+ .record(+ zod.string(),+ zod.object({+ question: zod.string().optional().describe('Translated question text.'),+ description: zod.string().optional().describe('Translated helper text.'),+ buttonText: zod.string().optional().describe('Translated button label.'),+ lowerBoundLabel: zod+ .string()+ .optional()+ .describe('Translated lowest rating label. Rating questions only.'),+ upperBoundLabel: zod+ .string()+ .optional()+ .describe('Translated highest rating label. Rating questions only.'),+ choices: zod+ .array(zod.string())+ .optional()+ .describe(+ 'Translated choices. Must have the same length as the question choices. Choice questions only.'+ ),+ link: zod.string().optional().describe('Translated URL. Link questions only.'),+ })+ )+ .optional()+ .describe(+ "Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost."+ ),link: zod.string().describe('HTTPS or mailto URL for link questions.'),+ branching: zod+ .union([+ zod.union([+ zod.object({+ type: zod+ .enum(['next_question'])+ .describe('\* `next_question` - next_question')+ .describe(+ 'Continue to the next question in sequence.\n\n\* `next_question` - next_question'+ ),+ }),+ zod.object({+ type: zod+ .enum(['end'])+ .describe('\* `end` - end')+ .describe('End the survey.\n\n\* `end` - end'),+ }),+ zod.object({+ type: zod+ .enum(['specific_question'])+ .describe('\* `specific_question` - specific_question')+ .describe(+ 'Jump to a specific question index.\n\n\* `specific_question` - specific_question'+ ),+ index: zod+ .number()+ .min(surveysCreateBodyQuestionsItemTwoBranchingOneThreeIndexMin)+ .describe('0-based index of the next question.'),+ }),+ zod.object({+ type: zod+ .enum(['response_based'])+ .describe('\* `response_based` - response_based')+ .describe(+ 'Branch based on the selected or entered response.\n\n\* `response_based` - response_based'+ ),+ responseValues: zod+ .record(+ zod.string(),+ zod.union([+ zod+ .number()+ .min(+ surveysCreateBodyQuestionsItemTwoBranchingOneFourResponseValuesOneMin+ ),+ zod.enum(['end']),+ ])+ )+ .describe(+ "Response-based branching map. Values can be a question index or 'end'."+ ),+ }),+ ]),+ zod.null(),+ ])+ .optional(),}),zod.object({id: zod@@ -534,6 +730,34 @@ export const SurveysCreateBody = () => zod.object({.describe('Format for the description field.\n\n\* `text` - text\n\* `html` - html'),optional: zod.boolean().optional().describe('Whether respondents may skip this question.'),buttonText: zod.string().optional().describe('Custom button label.'),+ translations: zod+ .record(+ zod.string(),+ zod.object({+ question: zod.string().optional().describe('Translated question text.'),+ description: zod.string().optional().describe('Translated helper text.'),+ buttonText: zod.string().optional().describe('Translated button label.'),+ lowerBoundLabel: zod+ .string()+ .optional()+ .describe('Translated lowest rating label. Rating questions only.'),+ upperBoundLabel: zod+ .string()+ .optional()+ .describe('Translated highest rating label. Rating questions only.'),+ choices: zod+ .array(zod.string())+ .optional()+ .describe(+ 'Translated choices. Must have the same length as the question choices. Choice questions only.'+ ),+ link: zod.string().optional().describe('Translated URL. Link questions only.'),+ })+ )+ .optional()+ .describe(+ "Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost."+ ),display: zod.enum(['number', 'emoji']).describe('\* `number` - number\n\* `emoji` - emoji')@@ -550,6 +774,12 @@ export const SurveysCreateBody = () => zod.object({.string().optional().describe("Label for the highest rating (e.g., 'Excellent')"),+ isNpsQuestion: zod+ .boolean()+ .optional()+ .describe(+ 'Whether a rating question with a scale of 10 shows NPS scoring. A missing value counts as true.'+ ),branching: zod.union([zod.union([@@ -624,6 +854,34 @@ export const SurveysCreateBody = () => zod.object({.describe('Format for the description field.\n\n\* `text` - text\n\* `html` - html'),optional: zod.boolean().optional().describe('Whether respondents may skip this question.'),buttonText: zod.string().optional().describe('Custom button label.'),+ translations: zod+ .record(+ zod.string(),+ zod.object({+ question: zod.string().optional().describe('Translated question text.'),+ description: zod.string().optional().describe('Translated helper text.'),+ buttonText: zod.string().optional().describe('Translated button label.'),+ lowerBoundLabel: zod+ .string()+ .optional()+ .describe('Translated lowest rating label. Rating questions only.'),+ upperBoundLabel: zod+ .string()+ .optional()+ .describe('Translated highest rating label. Rating questions only.'),+ choices: zod+ .array(zod.string())+ .optional()+ .describe(+ 'Translated choices. Must have the same length as the question choices. Choice questions only.'+ ),+ link: zod.string().optional().describe('Translated URL. Link questions only.'),+ })+ )+ .optional()+ .describe(+ "Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost."+ ),choices: zod.array(zod.string()).min(surveysCreateBodyQuestionsItemFourChoicesMin)@@ -713,6 +971,34 @@ export const SurveysCreateBody = () => zod.object({.describe('Format for the description field.\n\n\* `text` - text\n\* `html` - html'),optional: zod.boolean().optional().describe('Whether respondents may skip this question.'),buttonText: zod.string().optional().describe('Custom button label.'),+ translations: zod+ .record(+ zod.string(),+ zod.object({+ question: zod.string().optional().describe('Translated question text.'),+ description: zod.string().optional().describe('Translated helper text.'),+ buttonText: zod.string().optional().describe('Translated button label.'),+ lowerBoundLabel: zod+ .string()+ .optional()+ .describe('Translated lowest rating label. Rating questions only.'),+ upperBoundLabel: zod+ .string()+ .optional()+ .describe('Translated highest rating label. Rating questions only.'),+ choices: zod+ .array(zod.string())+ .optional()+ .describe(+ 'Translated choices. Must have the same length as the question choices. Choice questions only.'+ ),+ link: zod.string().optional().describe('Translated URL. Link questions only.'),+ })+ )+ .optional()+ .describe(+ "Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost."+ ),choices: zod.array(zod.string()).min(surveysCreateBodyQuestionsItemFiveChoicesMin)@@ -1025,6 +1311,14 @@ export const SurveysPartialUpdateParams = () => zod.object({export const surveysPartialUpdateBodyNameMax = 400export const surveysPartialUpdateBodyTargetingFlagFiltersOneEarlyExitDefault = false+export const surveysPartialUpdateBodyQuestionsItemOneBranchingOneThreeIndexMin = 0++export const surveysPartialUpdateBodyQuestionsItemOneBranchingOneFourResponseValuesOneMin = 0++export const surveysPartialUpdateBodyQuestionsItemTwoBranchingOneThreeIndexMin = 0++export const surveysPartialUpdateBodyQuestionsItemTwoBranchingOneFourResponseValuesOneMin = 0+export const surveysPartialUpdateBodyQuestionsItemThreeBranchingOneThreeIndexMin = 0export const surveysPartialUpdateBodyQuestionsItemThreeBranchingOneFourResponseValuesOneMin = 0@@ -1453,6 +1747,110 @@ export const SurveysPartialUpdateBody = () => zod.object({.describe('Format for the description field.\n\n\* `text` - text\n\* `html` - html'),optional: zod.boolean().optional().describe('Whether respondents may skip this question.'),buttonText: zod.string().optional().describe('Custom button label.'),+ translations: zod+ .record(+ zod.string(),+ zod.object({+ question: zod.string().optional().describe('Translated question text.'),+ description: zod.string().optional().describe('Translated helper text.'),+ buttonText: zod.string().optional().describe('Translated button label.'),+ lowerBoundLabel: zod+ .string()+ .optional()+ .describe('Translated lowest rating label. Rating questions only.'),+ upperBoundLabel: zod+ .string()+ .optional()+ .describe('Translated highest rating label. Rating questions only.'),+ choices: zod+ .array(zod.string())+ .optional()+ .describe(+ 'Translated choices. Must have the same length as the question choices. Choice questions only.'+ ),+ link: zod.string().optional().describe('Translated URL. Link questions only.'),+ })+ )+ .optional()+ .describe(+ "Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost."+ ),+ validation: zod+ .array(+ zod.object({+ type: zod+ .enum(['min_length', 'max_length', 'email'])+ .describe(+ '\* `min_length` - min_length\n\* `max_length` - max_length\n\* `email` - email'+ )+ .describe(+ 'Validation rule type for open-text questions.\n\n\* `min_length` - min_length\n\* `max_length` - max_length\n\* `email` - email'+ ),+ value: zod+ .number()+ .min(1)+ .nullish()+ .describe('Rule value for min_length or max_length validations.'),+ })+ )+ .nullish()+ .describe('Validation rules for the response text, for example a minimum length.'),+ branching: zod+ .union([+ zod.union([+ zod.object({+ type: zod+ .enum(['next_question'])+ .describe('\* `next_question` - next_question')+ .describe(+ 'Continue to the next question in sequence.\n\n\* `next_question` - next_question'+ ),+ }),+ zod.object({+ type: zod+ .enum(['end'])+ .describe('\* `end` - end')+ .describe('End the survey.\n\n\* `end` - end'),+ }),+ zod.object({+ type: zod+ .enum(['specific_question'])+ .describe('\* `specific_question` - specific_question')+ .describe(+ 'Jump to a specific question index.\n\n\* `specific_question` - specific_question'+ ),+ index: zod+ .number()+ .min(surveysPartialUpdateBodyQuestionsItemOneBranchingOneThreeIndexMin)+ .describe('0-based index of the next question.'),+ }),+ zod.object({+ type: zod+ .enum(['response_based'])+ .describe('\* `response_based` - response_based')+ .describe(+ 'Branch based on the selected or entered response.\n\n\* `response_based` - response_based'+ ),+ responseValues: zod+ .record(+ zod.string(),+ zod.union([+ zod+ .number()+ .min(+ surveysPartialUpdateBodyQuestionsItemOneBranchingOneFourResponseValuesOneMin+ ),+ zod.enum(['end']),+ ])+ )+ .describe(+ "Response-based branching map. Values can be a question index or 'end'."+ ),+ }),+ ]),+ zod.null(),+ ])+ .optional(),}),zod.object({id: zod@@ -1471,7 +1869,91 @@ export const SurveysPartialUpdateBody = () => zod.object({.describe('Format for the description field.\n\n\* `text` - text\n\* `html` - html'),optional: zod.boolean().optional().describe('Whether respondents may skip this question.'),buttonText: zod.string().optional().describe('Custom button label.'),+ translations: zod+ .record(+ zod.string(),+ zod.object({+ question: zod.string().optional().describe('Translated question text.'),+ description: zod.string().optional().describe('Translated helper text.'),+ buttonText: zod.string().optional().describe('Translated button label.'),+ lowerBoundLabel: zod+ .string()+ .optional()+ .describe('Translated lowest rating label. Rating questions only.'),+ upperBoundLabel: zod+ .string()+ .optional()+ .describe('Translated highest rating label. Rating questions only.'),+ choices: zod+ .array(zod.string())+ .optional()+ .describe(+ 'Translated choices. Must have the same length as the question choices. Choice questions only.'+ ),+ link: zod.string().optional().describe('Translated URL. Link questions only.'),+ })+ )+ .optional()+ .describe(+ "Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost."+ ),link: zod.string().describe('HTTPS or mailto URL for link questions.'),+ branching: zod+ .union([+ zod.union([+ zod.object({+ type: zod+ .enum(['next_question'])+ .describe('\* `next_question` - next_question')+ .describe(+ 'Continue to the next question in sequence.\n\n\* `next_question` - next_question'+ ),+ }),+ zod.object({+ type: zod+ .enum(['end'])+ .describe('\* `end` - end')+ .describe('End the survey.\n\n\* `end` - end'),+ }),+ zod.object({+ type: zod+ .enum(['specific_question'])+ .describe('\* `specific_question` - specific_question')+ .describe(+ 'Jump to a specific question index.\n\n\* `specific_question` - specific_question'+ ),+ index: zod+ .number()+ .min(surveysPartialUpdateBodyQuestionsItemTwoBranchingOneThreeIndexMin)+ .describe('0-based index of the next question.'),+ }),+ zod.object({+ type: zod+ .enum(['response_based'])+ .describe('\* `response_based` - response_based')+ .describe(+ 'Branch based on the selected or entered response.\n\n\* `response_based` - response_based'+ ),+ responseValues: zod+ .record(+ zod.string(),+ zod.union([+ zod+ .number()+ .min(+ surveysPartialUpdateBodyQuestionsItemTwoBranchingOneFourResponseValuesOneMin+ ),+ zod.enum(['end']),+ ])+ )+ .describe(+ "Response-based branching map. Values can be a question index or 'end'."+ ),+ }),+ ]),+ zod.null(),+ ])+ .optional(),}),zod.object({id: zod@@ -1490,6 +1972,34 @@ export const SurveysPartialUpdateBody = () => zod.object({.describe('Format for the description field.\n\n\* `text` - text\n\* `html` - html'),optional: zod.boolean().optional().describe('Whether respondents may skip this question.'),buttonText: zod.string().optional().describe('Custom button label.'),+ translations: zod+ .record(+ zod.string(),+ zod.object({+ question: zod.string().optional().describe('Translated question text.'),+ description: zod.string().optional().describe('Translated helper text.'),+ buttonText: zod.string().optional().describe('Translated button label.'),+ lowerBoundLabel: zod+ .string()+ .optional()+ .describe('Translated lowest rating label. Rating questions only.'),+ upperBoundLabel: zod+ .string()+ .optional()+ .describe('Translated highest rating label. Rating questions only.'),+ choices: zod+ .array(zod.string())+ .optional()+ .describe(+ 'Translated choices. Must have the same length as the question choices. Choice questions only.'+ ),+ link: zod.string().optional().describe('Translated URL. Link questions only.'),+ })+ )+ .optional()+ .describe(+ "Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost."+ ),display: zod.enum(['number', 'emoji']).describe('\* `number` - number\n\* `emoji` - emoji')@@ -1506,6 +2016,12 @@ export const SurveysPartialUpdateBody = () => zod.object({.string().optional().describe("Label for the highest rating (e.g., 'Excellent')"),+ isNpsQuestion: zod+ .boolean()+ .optional()+ .describe(+ 'Whether a rating question with a scale of 10 shows NPS scoring. A missing value counts as true.'+ ),branching: zod.union([zod.union([@@ -1580,6 +2096,34 @@ export const SurveysPartialUpdateBody = () => zod.object({.describe('Format for the description field.\n\n\* `text` - text\n\* `html` - html'),optional: zod.boolean().optional().describe('Whether respondents may skip this question.'),buttonText: zod.string().optional().describe('Custom button label.'),+ translations: zod+ .record(+ zod.string(),+ zod.object({+ question: zod.string().optional().describe('Translated question text.'),+ description: zod.string().optional().describe('Translated helper text.'),+ buttonText: zod.string().optional().describe('Translated button label.'),+ lowerBoundLabel: zod+ .string()+ .optional()+ .describe('Translated lowest rating label. Rating questions only.'),+ upperBoundLabel: zod+ .string()+ .optional()+ .describe('Translated highest rating label. Rating questions only.'),+ choices: zod+ .array(zod.string())+ .optional()+ .describe(+ 'Translated choices. Must have the same length as the question choices. Choice questions only.'+ ),+ link: zod.string().optional().describe('Translated URL. Link questions only.'),+ })+ )+ .optional()+ .describe(+ "Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost."+ ),choices: zod.array(zod.string()).min(surveysPartialUpdateBodyQuestionsItemFourChoicesMin)@@ -1669,6 +2213,34 @@ export const SurveysPartialUpdateBody = () => zod.object({.describe('Format for the description field.\n\n\* `text` - text\n\* `html` - html'),optional: zod.boolean().optional().describe('Whether respondents may skip this question.'),buttonText: zod.string().optional().describe('Custom button label.'),+ translations: zod+ .record(+ zod.string(),+ zod.object({+ question: zod.string().optional().describe('Translated question text.'),+ description: zod.string().optional().describe('Translated helper text.'),+ buttonText: zod.string().optional().describe('Translated button label.'),+ lowerBoundLabel: zod+ .string()+ .optional()+ .describe('Translated lowest rating label. Rating questions only.'),+ upperBoundLabel: zod+ .string()+ .optional()+ .describe('Translated highest rating label. Rating questions only.'),+ choices: zod+ .array(zod.string())+ .optional()+ .describe(+ 'Translated choices. Must have the same length as the question choices. Choice questions only.'+ ),+ link: zod.string().optional().describe('Translated URL. Link questions only.'),+ })+ )+ .optional()+ .describe(+ "Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost."+ ),choices: zod.array(zod.string()).min(surveysPartialUpdateBodyQuestionsItemFiveChoicesMin)diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/survey-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/survey-create.jsonindex 000a4028e6e3..b3a8cb9a7f27 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/survey-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/survey-create.json@@ -332,6 +332,85 @@"anyOf": [{"properties": {+ "branching": {+ "anyOf": [+ {+ "anyOf": [+ {+ "properties": {+ "type": {+ "description": "Continue to the next question in sequence.\n\n* `next_question` - next_question",+ "enum": ["next_question"],+ "type": "string"+ }+ },+ "required": ["type"],+ "type": "object"+ },+ {+ "properties": {+ "type": {+ "description": "End the survey.\n\n* `end` - end",+ "enum": ["end"],+ "type": "string"+ }+ },+ "required": ["type"],+ "type": "object"+ },+ {+ "properties": {+ "index": {+ "description": "0-based index of the next question.",+ "minimum": 0,+ "type": "number"+ },+ "type": {+ "description": "Jump to a specific question index.\n\n* `specific_question` - specific_question",+ "enum": ["specific_question"],+ "type": "string"+ }+ },+ "required": ["type", "index"],+ "type": "object"+ },+ {+ "properties": {+ "responseValues": {+ "additionalProperties": {+ "anyOf": [+ {+ "minimum": 0,+ "type": "number"+ },+ {+ "enum": ["end"],+ "type": "string"+ }+ ]+ },+ "description": "Response-based branching map. Values can be a question index or 'end'.",+ "propertyNames": {+ "type": "string"+ },+ "type": "object"+ },+ "type": {+ "description": "Branch based on the selected or entered response.\n\n* `response_based` - response_based",+ "enum": ["response_based"],+ "type": "string"+ }+ },+ "required": ["type", "responseValues"],+ "type": "object"+ }+ ]+ },+ {+ "type": "null"+ }+ ]+ },"buttonText": {"description": "Custom button label.","type": "string"@@ -357,10 +436,87 @@"description": "Question text shown to respondents.","type": "string"},+ "translations": {+ "additionalProperties": {+ "properties": {+ "buttonText": {+ "description": "Translated button label.",+ "type": "string"+ },+ "choices": {+ "description": "Translated choices. Must have the same length as the question choices. Choice questions only.",+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ "description": {+ "description": "Translated helper text.",+ "type": "string"+ },+ "link": {+ "description": "Translated URL. Link questions only.",+ "type": "string"+ },+ "lowerBoundLabel": {+ "description": "Translated lowest rating label. Rating questions only.",+ "type": "string"+ },+ "question": {+ "description": "Translated question text.",+ "type": "string"+ },+ "upperBoundLabel": {+ "description": "Translated highest rating label. Rating questions only.",+ "type": "string"+ }+ },+ "type": "object"+ },+ "description": "Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost.",+ "propertyNames": {+ "type": "string"+ },+ "type": "object"+ },"type": {"description": "* `open` - open","enum": ["open"],"type": "string"+ },+ "validation": {+ "anyOf": [+ {+ "items": {+ "properties": {+ "type": {+ "description": "Validation rule type for open-text questions.\n\n* `min_length` - min_length\n* `max_length` - max_length\n* `email` - email",+ "enum": ["min_length", "max_length", "email"],+ "type": "string"+ },+ "value": {+ "anyOf": [+ {+ "minimum": 1,+ "type": "number"+ },+ {+ "type": "null"+ }+ ],+ "description": "Rule value for min_length or max_length validations."+ }+ },+ "required": ["type"],+ "type": "object"+ },+ "type": "array"+ },+ {+ "type": "null"+ }+ ],+ "description": "Validation rules for the response text, for example a minimum length."}},"required": ["type", "question"],@@ -368,6 +524,85 @@},{"properties": {+ "branching": {+ "anyOf": [+ {+ "anyOf": [+ {+ "properties": {+ "type": {+ "description": "Continue to the next question in sequence.\n\n* `next_question` - next_question",+ "enum": ["next_question"],+ "type": "string"+ }+ },+ "required": ["type"],+ "type": "object"+ },+ {+ "properties": {+ "type": {+ "description": "End the survey.\n\n* `end` - end",+ "enum": ["end"],+ "type": "string"+ }+ },+ "required": ["type"],+ "type": "object"+ },+ {+ "properties": {+ "index": {+ "description": "0-based index of the next question.",+ "minimum": 0,+ "type": "number"+ },+ "type": {+ "description": "Jump to a specific question index.\n\n* `specific_question` - specific_question",+ "enum": ["specific_question"],+ "type": "string"+ }+ },+ "required": ["type", "index"],+ "type": "object"+ },+ {+ "properties": {+ "responseValues": {+ "additionalProperties": {+ "anyOf": [+ {+ "minimum": 0,+ "type": "number"+ },+ {+ "enum": ["end"],+ "type": "string"+ }+ ]+ },+ "description": "Response-based branching map. Values can be a question index or 'end'.",+ "propertyNames": {+ "type": "string"+ },+ "type": "object"+ },+ "type": {+ "description": "Branch based on the selected or entered response.\n\n* `response_based` - response_based",+ "enum": ["response_based"],+ "type": "string"+ }+ },+ "required": ["type", "responseValues"],+ "type": "object"+ }+ ]+ },+ {+ "type": "null"+ }+ ]+ },"buttonText": {"description": "Custom button label.","type": "string"@@ -397,6 +632,49 @@"description": "Question text shown to respondents.","type": "string"},+ "translations": {+ "additionalProperties": {+ "properties": {+ "buttonText": {+ "description": "Translated button label.",+ "type": "string"+ },+ "choices": {+ "description": "Translated choices. Must have the same length as the question choices. Choice questions only.",+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ "description": {+ "description": "Translated helper text.",+ "type": "string"+ },+ "link": {+ "description": "Translated URL. Link questions only.",+ "type": "string"+ },+ "lowerBoundLabel": {+ "description": "Translated lowest rating label. Rating questions only.",+ "type": "string"+ },+ "question": {+ "description": "Translated question text.",+ "type": "string"+ },+ "upperBoundLabel": {+ "description": "Translated highest rating label. Rating questions only.",+ "type": "string"+ }+ },+ "type": "object"+ },+ "description": "Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost.",+ "propertyNames": {+ "type": "string"+ },+ "type": "object"+ },"type": {"description": "* `link` - link","enum": ["link"],@@ -509,6 +787,10 @@"description": "Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one.","type": "string"},+ "isNpsQuestion": {+ "description": "Whether a rating question with a scale of 10 shows NPS scoring. A missing value counts as true.",+ "type": "boolean"+ },"lowerBoundLabel": {"description": "Label for the lowest rating (e.g., 'Very Poor')","type": "string"@@ -526,6 +808,49 @@"minimum": 1,"type": "number"},+ "translations": {+ "additionalProperties": {+ "properties": {+ "buttonText": {+ "description": "Translated button label.",+ "type": "string"+ },+ "choices": {+ "description": "Translated choices. Must have the same length as the question choices. Choice questions only.",+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ "description": {+ "description": "Translated helper text.",+ "type": "string"+ },+ "link": {+ "description": "Translated URL. Link questions only.",+ "type": "string"+ },+ "lowerBoundLabel": {+ "description": "Translated lowest rating label. Rating questions only.",+ "type": "string"+ },+ "question": {+ "description": "Translated question text.",+ "type": "string"+ },+ "upperBoundLabel": {+ "description": "Translated highest rating label. Rating questions only.",+ "type": "string"+ }+ },+ "type": "object"+ },+ "description": "Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost.",+ "propertyNames": {+ "type": "string"+ },+ "type": "object"+ },"type": {"description": "* `rating` - rating","enum": ["rating"],@@ -662,6 +987,49 @@"description": "Whether to randomize the order of choices for each respondent.","type": "boolean"},+ "translations": {+ "additionalProperties": {+ "properties": {+ "buttonText": {+ "description": "Translated button label.",+ "type": "string"+ },+ "choices": {+ "description": "Translated choices. Must have the same length as the question choices. Choice questions only.",+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ "description": {+ "description": "Translated helper text.",+ "type": "string"+ },+ "link": {+ "description": "Translated URL. Link questions only.",+ "type": "string"+ },+ "lowerBoundLabel": {+ "description": "Translated lowest rating label. Rating questions only.",+ "type": "string"+ },+ "question": {+ "description": "Translated question text.",+ "type": "string"+ },+ "upperBoundLabel": {+ "description": "Translated highest rating label. Rating questions only.",+ "type": "string"+ }+ },+ "type": "object"+ },+ "description": "Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost.",+ "propertyNames": {+ "type": "string"+ },+ "type": "object"+ },"type": {"description": "* `single_choice` - single_choice","enum": ["single_choice"],@@ -715,6 +1083,49 @@"description": "Whether to randomize the order of choices for each respondent.","type": "boolean"},+ "translations": {+ "additionalProperties": {+ "properties": {+ "buttonText": {+ "description": "Translated button label.",+ "type": "string"+ },+ "choices": {+ "description": "Translated choices. Must have the same length as the question choices. Choice questions only.",+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ "description": {+ "description": "Translated helper text.",+ "type": "string"+ },+ "link": {+ "description": "Translated URL. Link questions only.",+ "type": "string"+ },+ "lowerBoundLabel": {+ "description": "Translated lowest rating label. Rating questions only.",+ "type": "string"+ },+ "question": {+ "description": "Translated question text.",+ "type": "string"+ },+ "upperBoundLabel": {+ "description": "Translated highest rating label. Rating questions only.",+ "type": "string"+ }+ },+ "type": "object"+ },+ "description": "Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost.",+ "propertyNames": {+ "type": "string"+ },+ "type": "object"+ },"type": {"description": "* `multiple_choice` - multiple_choice","enum": ["multiple_choice"],diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/survey-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/survey-update.jsonindex 942ab70b37fc..e137a17653b5 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/survey-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/survey-update.json@@ -352,6 +352,85 @@"anyOf": [{"properties": {+ "branching": {+ "anyOf": [+ {+ "anyOf": [+ {+ "properties": {+ "type": {+ "description": "Continue to the next question in sequence.\n\n* `next_question` - next_question",+ "enum": ["next_question"],+ "type": "string"+ }+ },+ "required": ["type"],+ "type": "object"+ },+ {+ "properties": {+ "type": {+ "description": "End the survey.\n\n* `end` - end",+ "enum": ["end"],+ "type": "string"+ }+ },+ "required": ["type"],+ "type": "object"+ },+ {+ "properties": {+ "index": {+ "description": "0-based index of the next question.",+ "minimum": 0,+ "type": "number"+ },+ "type": {+ "description": "Jump to a specific question index.\n\n* `specific_question` - specific_question",+ "enum": ["specific_question"],+ "type": "string"+ }+ },+ "required": ["type", "index"],+ "type": "object"+ },+ {+ "properties": {+ "responseValues": {+ "additionalProperties": {+ "anyOf": [+ {+ "minimum": 0,+ "type": "number"+ },+ {+ "enum": ["end"],+ "type": "string"+ }+ ]+ },+ "description": "Response-based branching map. Values can be a question index or 'end'.",+ "propertyNames": {+ "type": "string"+ },+ "type": "object"+ },+ "type": {+ "description": "Branch based on the selected or entered response.\n\n* `response_based` - response_based",+ "enum": ["response_based"],+ "type": "string"+ }+ },+ "required": ["type", "responseValues"],+ "type": "object"+ }+ ]+ },+ {+ "type": "null"+ }+ ]+ },"buttonText": {"description": "Custom button label.","type": "string"@@ -377,10 +456,87 @@"description": "Question text shown to respondents.","type": "string"},+ "translations": {+ "additionalProperties": {+ "properties": {+ "buttonText": {+ "description": "Translated button label.",+ "type": "string"+ },+ "choices": {+ "description": "Translated choices. Must have the same length as the question choices. Choice questions only.",+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ "description": {+ "description": "Translated helper text.",+ "type": "string"+ },+ "link": {+ "description": "Translated URL. Link questions only.",+ "type": "string"+ },+ "lowerBoundLabel": {+ "description": "Translated lowest rating label. Rating questions only.",+ "type": "string"+ },+ "question": {+ "description": "Translated question text.",+ "type": "string"+ },+ "upperBoundLabel": {+ "description": "Translated highest rating label. Rating questions only.",+ "type": "string"+ }+ },+ "type": "object"+ },+ "description": "Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost.",+ "propertyNames": {+ "type": "string"+ },+ "type": "object"+ },"type": {"description": "* `open` - open","enum": ["open"],"type": "string"+ },+ "validation": {+ "anyOf": [+ {+ "items": {+ "properties": {+ "type": {+ "description": "Validation rule type for open-text questions.\n\n* `min_length` - min_length\n* `max_length` - max_length\n* `email` - email",+ "enum": ["min_length", "max_length", "email"],+ "type": "string"+ },+ "value": {+ "anyOf": [+ {+ "minimum": 1,+ "type": "number"+ },+ {+ "type": "null"+ }+ ],+ "description": "Rule value for min_length or max_length validations."+ }+ },+ "required": ["type"],+ "type": "object"+ },+ "type": "array"+ },+ {+ "type": "null"+ }+ ],+ "description": "Validation rules for the response text, for example a minimum length."}},"required": ["type", "question"],@@ -388,6 +544,85 @@},{"properties": {+ "branching": {+ "anyOf": [+ {+ "anyOf": [+ {+ "properties": {+ "type": {+ "description": "Continue to the next question in sequence.\n\n* `next_question` - next_question",+ "enum": ["next_question"],+ "type": "string"+ }+ },+ "required": ["type"],+ "type": "object"+ },+ {+ "properties": {+ "type": {+ "description": "End the survey.\n\n* `end` - end",+ "enum": ["end"],+ "type": "string"+ }+ },+ "required": ["type"],+ "type": "object"+ },+ {+ "properties": {+ "index": {+ "description": "0-based index of the next question.",+ "minimum": 0,+ "type": "number"+ },+ "type": {+ "description": "Jump to a specific question index.\n\n* `specific_question` - specific_question",+ "enum": ["specific_question"],+ "type": "string"+ }+ },+ "required": ["type", "index"],+ "type": "object"+ },+ {+ "properties": {+ "responseValues": {+ "additionalProperties": {+ "anyOf": [+ {+ "minimum": 0,+ "type": "number"+ },+ {+ "enum": ["end"],+ "type": "string"+ }+ ]+ },+ "description": "Response-based branching map. Values can be a question index or 'end'.",+ "propertyNames": {+ "type": "string"+ },+ "type": "object"+ },+ "type": {+ "description": "Branch based on the selected or entered response.\n\n* `response_based` - response_based",+ "enum": ["response_based"],+ "type": "string"+ }+ },+ "required": ["type", "responseValues"],+ "type": "object"+ }+ ]+ },+ {+ "type": "null"+ }+ ]+ },"buttonText": {"description": "Custom button label.","type": "string"@@ -417,6 +652,49 @@"description": "Question text shown to respondents.","type": "string"},+ "translations": {+ "additionalProperties": {+ "properties": {+ "buttonText": {+ "description": "Translated button label.",+ "type": "string"+ },+ "choices": {+ "description": "Translated choices. Must have the same length as the question choices. Choice questions only.",+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ "description": {+ "description": "Translated helper text.",+ "type": "string"+ },+ "link": {+ "description": "Translated URL. Link questions only.",+ "type": "string"+ },+ "lowerBoundLabel": {+ "description": "Translated lowest rating label. Rating questions only.",+ "type": "string"+ },+ "question": {+ "description": "Translated question text.",+ "type": "string"+ },+ "upperBoundLabel": {+ "description": "Translated highest rating label. Rating questions only.",+ "type": "string"+ }+ },+ "type": "object"+ },+ "description": "Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost.",+ "propertyNames": {+ "type": "string"+ },+ "type": "object"+ },"type": {"description": "* `link` - link","enum": ["link"],@@ -529,6 +807,10 @@"description": "Stable question identifier (UUID). When editing an existing question, send back its current id so its responses (keyed by $survey_response_<id>) stay attached; omit it for new questions and the server generates one.","type": "string"},+ "isNpsQuestion": {+ "description": "Whether a rating question with a scale of 10 shows NPS scoring. A missing value counts as true.",+ "type": "boolean"+ },"lowerBoundLabel": {"description": "Label for the lowest rating (e.g., 'Very Poor')","type": "string"@@ -546,6 +828,49 @@"minimum": 1,"type": "number"},+ "translations": {+ "additionalProperties": {+ "properties": {+ "buttonText": {+ "description": "Translated button label.",+ "type": "string"+ },+ "choices": {+ "description": "Translated choices. Must have the same length as the question choices. Choice questions only.",+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ "description": {+ "description": "Translated helper text.",+ "type": "string"+ },+ "link": {+ "description": "Translated URL. Link questions only.",+ "type": "string"+ },+ "lowerBoundLabel": {+ "description": "Translated lowest rating label. Rating questions only.",+ "type": "string"+ },+ "question": {+ "description": "Translated question text.",+ "type": "string"+ },+ "upperBoundLabel": {+ "description": "Translated highest rating label. Rating questions only.",+ "type": "string"+ }+ },+ "type": "object"+ },+ "description": "Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost.",+ "propertyNames": {+ "type": "string"+ },+ "type": "object"+ },"type": {"description": "* `rating` - rating","enum": ["rating"],@@ -682,6 +1007,49 @@"description": "Whether to randomize the order of choices for each respondent.","type": "boolean"},+ "translations": {+ "additionalProperties": {+ "properties": {+ "buttonText": {+ "description": "Translated button label.",+ "type": "string"+ },+ "choices": {+ "description": "Translated choices. Must have the same length as the question choices. Choice questions only.",+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ "description": {+ "description": "Translated helper text.",+ "type": "string"+ },+ "link": {+ "description": "Translated URL. Link questions only.",+ "type": "string"+ },+ "lowerBoundLabel": {+ "description": "Translated lowest rating label. Rating questions only.",+ "type": "string"+ },+ "question": {+ "description": "Translated question text.",+ "type": "string"+ },+ "upperBoundLabel": {+ "description": "Translated highest rating label. Rating questions only.",+ "type": "string"+ }+ },+ "type": "object"+ },+ "description": "Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost.",+ "propertyNames": {+ "type": "string"+ },+ "type": "object"+ },"type": {"description": "* `single_choice` - single_choice","enum": ["single_choice"],@@ -735,6 +1103,49 @@"description": "Whether to randomize the order of choices for each respondent.","type": "boolean"},+ "translations": {+ "additionalProperties": {+ "properties": {+ "buttonText": {+ "description": "Translated button label.",+ "type": "string"+ },+ "choices": {+ "description": "Translated choices. Must have the same length as the question choices. Choice questions only.",+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ "description": {+ "description": "Translated helper text.",+ "type": "string"+ },+ "link": {+ "description": "Translated URL. Link questions only.",+ "type": "string"+ },+ "lowerBoundLabel": {+ "description": "Translated lowest rating label. Rating questions only.",+ "type": "string"+ },+ "question": {+ "description": "Translated question text.",+ "type": "string"+ },+ "upperBoundLabel": {+ "description": "Translated highest rating label. Rating questions only.",+ "type": "string"+ }+ },+ "type": "object"+ },+ "description": "Inline translations keyed by language code (for example 'es' or 'pt-BR'). Send back the current value when editing other question fields, or the translations are lost.",+ "propertyNames": {+ "type": "string"+ },+ "type": "object"+ },"type": {"description": "* `multiple_choice` - multiple_choice","enum": ["multiple_choice"],diff --git a/services/mcp/tests/unit/schema.survey-question-id.test.ts b/services/mcp/tests/unit/schema.survey-question-id.test.tsindex aca2f01c79df..4d8059d9c714 100644--- a/services/mcp/tests/unit/schema.survey-question-id.test.ts+++ b/services/mcp/tests/unit/schema.survey-question-id.test.ts@@ -20,4 +20,57 @@ describe('Survey question id preservation', () => {expect(result.success).toBe(true)expect(result.data?.[0]).toMatchObject({ id: existingId })})++ // A wording edit resends the full questions array. Zod strips any field the schema omits,+ // and the survey then saves without that setting.+ it.each([+ ['survey-create', SurveysCreateBody().shape.questions],+ ['survey-update', SurveysPartialUpdateBody().shape.questions],+ ])('keeps every question setting through %s validation', (_label, questionsSchema) => {+ const questions = [+ {+ type: 'rating',+ question: 'How likely are you to recommend us?',+ scale: 10,+ isNpsQuestion: false,+ branching: { type: 'response_based', responseValues: { promoters: 'end' } },+ translations: { es: { question: '¿Nos recomendarías?', lowerBoundLabel: 'Nada probable' } },+ },+ {+ type: 'open',+ question: 'What should we improve?',+ validation: [{ type: 'min_length', value: 20 }],+ branching: { type: 'specific_question', index: 0 },+ translations: { fr: { question: 'Que devrions-nous améliorer ?' } },+ },+ {+ type: 'link',+ question: 'Read the release notes',+ link: 'https://example.com/notes',+ branching: { type: 'end' },+ translations: { de: { link: 'https://example.com/de/notes' } },+ },+ {+ type: 'open',+ question: 'Anything else?',+ validation: null,+ },+ ]++ const result = questionsSchema.safeParse(questions)++ expect(result.success).toBe(true)+ expect(result.data).toEqual(questions)+ })++ it.each([+ ['survey-create', SurveysCreateBody().shape.questions],+ ['survey-update', SurveysPartialUpdateBody().shape.questions],+ ])('rejects null question translations through %s validation', (_label, questionsSchema) => {+ const result = questionsSchema.safeParse([+ { type: 'open', question: 'How was your experience?', translations: null },+ ])++ expect(result.success).toBe(false)+ })})