diff --git a/packages/surveys/src/components/general/Survey.tsx b/packages/surveys/src/components/general/Survey.tsx index 6b654d6c9f..c672eff8b8 100644 --- a/packages/surveys/src/components/general/Survey.tsx +++ b/packages/surveys/src/components/general/Survey.tsx @@ -37,6 +37,7 @@ export const Survey = ({ onFileUpload, responseCount, startAtQuestionId, + clickOutside, }: SurveyBaseProps) => { const isInIframe = window.self !== window.top; const [questionId, setQuestionId] = useState( @@ -72,6 +73,9 @@ export const Survey = ({ }, [questionId, survey, history]); const contentRef = useRef(null); const showProgressBar = !styling.hideProgressBar; + const getShowSurveyCloseButton = (offset: number) => { + return offset === 0 && survey.type !== "link" && (clickOutside === undefined ? true : clickOutside); + }; useEffect(() => { // scroll to top when question changes @@ -326,7 +330,7 @@ export const Survey = ({ }; return ( - {offset === 0 && survey.type !== "link" && } + {getShowSurveyCloseButton(offset) && }
diff --git a/packages/types/formbricksSurveys.ts b/packages/types/formbricksSurveys.ts index ce450c783d..416838c8cb 100644 --- a/packages/types/formbricksSurveys.ts +++ b/packages/types/formbricksSurveys.ts @@ -23,6 +23,7 @@ export interface SurveyBaseProps { responseCount?: number; isCardBorderVisible?: boolean; startAtQuestionId?: string; + clickOutside?: boolean; } export interface SurveyInlineProps extends SurveyBaseProps {