diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/components/AddIntegrationModal.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/components/AddIntegrationModal.tsx index 2b26963510..60abee4917 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/components/AddIntegrationModal.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/components/AddIntegrationModal.tsx @@ -13,6 +13,7 @@ import { TIntegrationNotionDatabase, } from "@formbricks/types/integration/notion"; import { TSurvey, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { getTextContent } from "@formbricks/types/surveys/validation"; import { createOrUpdateIntegrationAction } from "@/app/(app)/environments/[environmentId]/project/integrations/actions"; import { ERRORS, @@ -122,7 +123,7 @@ export const AddIntegrationModal = ({ const questions = selectedSurvey ? replaceHeadlineRecall(selectedSurvey, "default")?.questions.map((q) => ({ id: q.id, - name: getLocalizedValue(q.headline, "default"), + name: getTextContent(getLocalizedValue(q.headline, "default")), type: q.type, })) : []; diff --git a/apps/web/modules/ee/quotas/components/ending-card-selector.tsx b/apps/web/modules/ee/quotas/components/ending-card-selector.tsx index 77695ba43a..894964cef6 100644 --- a/apps/web/modules/ee/quotas/components/ending-card-selector.tsx +++ b/apps/web/modules/ee/quotas/components/ending-card-selector.tsx @@ -3,6 +3,7 @@ import { HandshakeIcon, Undo2Icon } from "lucide-react"; import { useTranslation } from "react-i18next"; import { TSurveyEndings } from "@formbricks/types/surveys/types"; +import { getTextContent } from "@formbricks/types/surveys/validation"; import { getLocalizedValue } from "@/lib/i18n/utils"; import { Select, @@ -41,7 +42,7 @@ export const EndingCardSelector = ({ endings, value, onChange }: EndingCardSelec {/* Custom endings */} {endingCards.map((ending) => ( - {getLocalizedValue(ending.headline, "default")} + {getTextContent(getLocalizedValue(ending.headline, "default"))} ))} diff --git a/apps/web/modules/survey/editor/components/logic-editor.tsx b/apps/web/modules/survey/editor/components/logic-editor.tsx index 490f017ad6..8f3a34b3d2 100644 --- a/apps/web/modules/survey/editor/components/logic-editor.tsx +++ b/apps/web/modules/survey/editor/components/logic-editor.tsx @@ -4,6 +4,7 @@ import { ArrowRightIcon } from "lucide-react"; import { ReactElement, useMemo } from "react"; import { useTranslation } from "react-i18next"; import { TSurvey, TSurveyLogic, TSurveyQuestion } from "@formbricks/types/surveys/types"; +import { getTextContent } from "@formbricks/types/surveys/validation"; import { getLocalizedValue } from "@/lib/i18n/utils"; import { LogicEditorActions } from "@/modules/survey/editor/components/logic-editor-actions"; import { LogicEditorConditions } from "@/modules/survey/editor/components/logic-editor-conditions"; @@ -48,7 +49,7 @@ export function LogicEditor({ const ques = localSurvey.questions[i]; options.push({ icon: QUESTIONS_ICON_MAP[ques.type], - label: getLocalizedValue(ques.headline, "default"), + label: getTextContent(getLocalizedValue(ques.headline, "default")), value: ques.id, }); } @@ -57,7 +58,8 @@ export function LogicEditor({ options.push({ label: ending.type === "endScreen" - ? getLocalizedValue(ending.headline, "default") || t("environments.surveys.edit.end_screen_card") + ? getTextContent(getLocalizedValue(ending.headline, "default")) || + t("environments.surveys.edit.end_screen_card") : ending.label || t("environments.surveys.edit.redirect_thank_you_card"), value: ending.id, }); diff --git a/apps/web/modules/survey/editor/lib/utils.tsx b/apps/web/modules/survey/editor/lib/utils.tsx index ebf11dda9e..76f0303bfb 100644 --- a/apps/web/modules/survey/editor/lib/utils.tsx +++ b/apps/web/modules/survey/editor/lib/utils.tsx @@ -594,7 +594,7 @@ export const getMatchValueProps = ( const questionOptions = openTextQuestions.map((question) => { return { icon: getQuestionIconMapping(t)[question.type], - label: getLocalizedValue(question.headline, "default"), + label: getTextContent(getLocalizedValue(question.headline, "default")), value: question.id, meta: { type: "question", @@ -691,7 +691,7 @@ export const getMatchValueProps = ( const questionOptions = allowedQuestions.map((question) => { return { icon: getQuestionIconMapping(t)[question.type], - label: getLocalizedValue(question.headline, "default"), + label: getTextContent(getLocalizedValue(question.headline, "default")), value: question.id, meta: { type: "question", @@ -765,7 +765,7 @@ export const getMatchValueProps = ( const questionOptions = allowedQuestions.map((question) => { return { icon: getQuestionIconMapping(t)[question.type], - label: getLocalizedValue(question.headline, "default"), + label: getTextContent(getLocalizedValue(question.headline, "default")), value: question.id, meta: { type: "question", @@ -845,7 +845,7 @@ export const getMatchValueProps = ( const questionOptions = allowedQuestions.map((question) => { return { icon: getQuestionIconMapping(t)[question.type], - label: getLocalizedValue(question.headline, "default"), + label: getTextContent(getLocalizedValue(question.headline, "default")), value: question.id, meta: { type: "question", diff --git a/apps/web/modules/survey/follow-ups/components/follow-up-modal.tsx b/apps/web/modules/survey/follow-ups/components/follow-up-modal.tsx index acb108a6b7..93b78504ae 100644 --- a/apps/web/modules/survey/follow-ups/components/follow-up-modal.tsx +++ b/apps/web/modules/survey/follow-ups/components/follow-up-modal.tsx @@ -18,6 +18,7 @@ import toast from "react-hot-toast"; import { useTranslation } from "react-i18next"; import { TSurveyFollowUpAction, TSurveyFollowUpTrigger } from "@formbricks/database/types/survey-follow-up"; import { TSurvey, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { getTextContent } from "@formbricks/types/surveys/validation"; import { TUserLocale } from "@formbricks/types/user"; import { getLocalizedValue } from "@/lib/i18n/utils"; import { recallToHeadline } from "@/lib/utils/recall"; @@ -140,9 +141,9 @@ export const FollowUpModal = ({ return [ ...openTextAndContactQuestions.map((question) => ({ - label: recallToHeadline(question.headline, localSurvey, false, selectedLanguageCode)[ - selectedLanguageCode - ], + label: getTextContent( + recallToHeadline(question.headline, localSurvey, false, selectedLanguageCode)[selectedLanguageCode] + ), id: question.id, type: question.type === TSurveyQuestionTypeEnum.OpenText @@ -517,7 +518,9 @@ export const FollowUpModal = ({ const getEndingLabel = (): string => { if (ending.type === "endScreen") { return ( - getLocalizedValue(ending.headline, selectedLanguageCode) || "Ending" + getTextContent( + getLocalizedValue(ending.headline, selectedLanguageCode) + ) || "Ending" ); }