mirror of
https://github.com/formbricks/formbricks.git
synced 2025-12-30 10:19:51 -06:00
fix: build (#4755)
Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
This commit is contained in:
committed by
GitHub
parent
b91ae7e9b1
commit
cd65850308
@@ -144,7 +144,6 @@ export const EditProfileAvatarForm = ({ session, environmentId, imageUrl }: Edit
|
||||
id="hiddenFileInput"
|
||||
ref={(e) => {
|
||||
field.ref(e);
|
||||
// @ts-expect-error
|
||||
inputRef.current = e;
|
||||
}}
|
||||
className="hidden"
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/modules/ui/components/tooltip";
|
||||
import { useTranslate } from "@tolgee/react";
|
||||
import { TimerIcon } from "lucide-react";
|
||||
import { JSX } from "react";
|
||||
import { getQuestionIcon } from "@formbricks/lib/utils/questions";
|
||||
import { recallToHeadline } from "@formbricks/lib/utils/recall";
|
||||
import { TSurvey, TSurveyQuestionType, TSurveySummary } from "@formbricks/types/surveys/types";
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { JSX } from "react";
|
||||
|
||||
// Utility function to render hyperlinked content
|
||||
export const renderHyperlinkedContent = (data: string): JSX.Element[] => {
|
||||
// More specific URL pattern
|
||||
|
||||
@@ -50,7 +50,7 @@ export const EmailCustomizationSettings = ({
|
||||
const [logoFile, setLogoFile] = useState<File | null>(null);
|
||||
const [logoUrl, setLogoUrl] = useState<string>(organization.whitelabel?.logoUrl || DEFAULT_LOGO_URL);
|
||||
const [isSaving, setIsSaving] = useState(false);
|
||||
const inputRef = useRef<HTMLInputElement>(null);
|
||||
const inputRef = useRef<HTMLInputElement | null>(null) as React.RefObject<HTMLInputElement>;
|
||||
|
||||
const isDefaultLogo = logoUrl === DEFAULT_LOGO_URL;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { RecallItemSelect } from "@/modules/survey/components/question-form-inpu
|
||||
import { Button } from "@/modules/ui/components/button";
|
||||
import { useTranslate } from "@tolgee/react";
|
||||
import { PencilIcon } from "lucide-react";
|
||||
import React, { ReactNode, useCallback, useEffect, useRef, useState } from "react";
|
||||
import React, { JSX, ReactNode, useCallback, useEffect, useRef, useState } from "react";
|
||||
import { toast } from "react-hot-toast";
|
||||
import { structuredClone } from "@formbricks/lib/pollyfills/structuredClone";
|
||||
import {
|
||||
@@ -239,6 +239,7 @@ export const RecallWrapper = ({
|
||||
};
|
||||
|
||||
setRenderedText(processInput());
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [internalValue, recallItems]);
|
||||
|
||||
return (
|
||||
@@ -281,7 +282,7 @@ export const RecallWrapper = ({
|
||||
filteredRecallItems={recallItems}
|
||||
fallbacks={fallbacks}
|
||||
setFallbacks={setFallbacks}
|
||||
fallbackInputRef={fallbackInputRef}
|
||||
fallbackInputRef={fallbackInputRef as React.RefObject<HTMLInputElement>}
|
||||
addFallback={addFallback}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -93,6 +93,7 @@ export const QuestionFormInput = ({
|
||||
: isEndingCard
|
||||
? localSurvey.endings[questionIdx - localSurvey.questions.length].id
|
||||
: question.id;
|
||||
//eslint-disable-next-line
|
||||
}, [isWelcomeCard, isEndingCard, question?.id]);
|
||||
|
||||
const surveyLanguageCodes = useMemo(
|
||||
|
||||
@@ -14,7 +14,7 @@ interface MediaBackgroundProps {
|
||||
surveyType: SurveyType;
|
||||
isEditorView?: boolean;
|
||||
isMobilePreview?: boolean;
|
||||
ContentRef?: React.RefObject<HTMLDivElement>;
|
||||
ContentRef?: React.RefObject<HTMLDivElement> | null;
|
||||
onBackgroundLoaded?: (isLoaded: boolean) => void;
|
||||
}
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@ export const PreviewSurvey = ({
|
||||
<MediaBackground
|
||||
surveyType={survey.type}
|
||||
styling={styling}
|
||||
ContentRef={ContentRef}
|
||||
ContentRef={ContentRef as React.RefObject<HTMLDivElement>}
|
||||
isMobilePreview>
|
||||
{previewType === "modal" ? (
|
||||
<Modal
|
||||
@@ -385,7 +385,7 @@ export const PreviewSurvey = ({
|
||||
<MediaBackground
|
||||
surveyType={survey.type}
|
||||
styling={styling}
|
||||
ContentRef={ContentRef}
|
||||
ContentRef={ContentRef as React.RefObject<HTMLDivElement>}
|
||||
isEditorView>
|
||||
<div className="absolute left-5 top-5">
|
||||
{!styling.isLogoHidden && (
|
||||
|
||||
@@ -176,7 +176,7 @@ export const ThemeStylingPreviewSurvey = ({
|
||||
<MediaBackground
|
||||
surveyType={survey.type}
|
||||
styling={project.styling}
|
||||
ContentRef={ContentRef}
|
||||
ContentRef={ContentRef as React.MutableRefObject<HTMLDivElement> | null}
|
||||
isEditorView>
|
||||
{!project.styling?.isLogoHidden && (
|
||||
<div className="absolute left-5 top-5" onClick={scrollToEditLogoSection}>
|
||||
|
||||
@@ -110,6 +110,7 @@
|
||||
"react-hook-form": "7.54.1",
|
||||
"react-hot-toast": "2.4.1",
|
||||
"react-icons": "5.4.0",
|
||||
"react-markdown": "9.0.3",
|
||||
"react-radio-group": "3.0.3",
|
||||
"react-turnstile": "1.1.4",
|
||||
"react-use": "17.6.0",
|
||||
|
||||
@@ -2,7 +2,7 @@ import { RefObject, useEffect } from "react";
|
||||
|
||||
// Improved version of https://usehooks.com/useOnClickOutside/
|
||||
export const useClickOutside = (
|
||||
ref: RefObject<HTMLElement>,
|
||||
ref: RefObject<HTMLElement | HTMLDivElement | null>,
|
||||
handler: (event: MouseEvent | TouchEvent) => void
|
||||
): void => {
|
||||
useEffect(() => {
|
||||
|
||||
@@ -2,8 +2,8 @@ import { RefObject, useEffect } from "react";
|
||||
|
||||
// Custom hook to synchronize the horizontal scroll position of two elements.
|
||||
export const useSyncScroll = (
|
||||
highlightContainerRef: RefObject<HTMLElement>,
|
||||
inputRef: RefObject<HTMLElement>
|
||||
highlightContainerRef: RefObject<HTMLElement | HTMLInputElement | null>,
|
||||
inputRef: RefObject<HTMLElement | HTMLInputElement | null>
|
||||
): void => {
|
||||
useEffect(() => {
|
||||
const syncScrollPosition = () => {
|
||||
|
||||
@@ -46,14 +46,14 @@
|
||||
"devDependencies": {
|
||||
"@formbricks/api": "workspace:*",
|
||||
"@formbricks/config-typescript": "workspace:*",
|
||||
"@types/react": "18.3.11",
|
||||
"@vitest/coverage-v8": "3.0.4",
|
||||
"react": "18.3.1",
|
||||
"react-native": "0.74.5",
|
||||
"terser": "5.37.0",
|
||||
"vite": "6.0.9",
|
||||
"vite-plugin-dts": "4.3.0",
|
||||
"vitest": "3.0.5"
|
||||
"vitest": "3.0.5",
|
||||
"react": "18.3.1",
|
||||
"@types/react": "18.3.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=16.8.0",
|
||||
|
||||
@@ -158,6 +158,7 @@ export function SurveyWebView({ survey }: SurveyWebViewProps): JSX.Element | und
|
||||
setShowSurvey(false);
|
||||
setIsSurveyRunning(false);
|
||||
}}>
|
||||
{/* @ts-expect-error -- WebView type incompatibility with React.Component */}
|
||||
<WebView
|
||||
ref={webViewRef}
|
||||
originWhitelist={["*"]}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { GlobeIcon } from "@/components/general/globe-icon";
|
||||
import { useClickOutside } from "@/lib/utils";
|
||||
import { useRef, useState } from "preact/hooks";
|
||||
import { getLanguageLabel } from "@formbricks/lib/i18n/utils";
|
||||
import { useClickOutside } from "@formbricks/lib/utils/hooks/useClickOutside";
|
||||
import { type TSurveyLanguage } from "@formbricks/types/surveys/types";
|
||||
|
||||
interface LanguageSwitchProps {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { MutableRef } from "preact/hooks";
|
||||
import { useEffect, useMemo, useState } from "preact/hooks";
|
||||
import { JSX } from "preact/jsx-runtime";
|
||||
import React from "react";
|
||||
import { TJsEnvironmentStateSurvey } from "@formbricks/types/js";
|
||||
import { TCardArrangementOptions } from "@formbricks/types/styling";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { MutableRef, useEffect } from "preact/hooks";
|
||||
import { type TJsEnvironmentStateSurvey } from "@formbricks/types/js";
|
||||
import {
|
||||
type TShuffleOption,
|
||||
@@ -101,3 +102,38 @@ const getPossibleNextQuestions = (question: TSurveyQuestion): string[] => {
|
||||
|
||||
return possibleDestinations;
|
||||
};
|
||||
|
||||
// Improved version of https://usehooks.com/useOnClickOutside/
|
||||
export const useClickOutside = (
|
||||
ref: MutableRef<HTMLElement | null>,
|
||||
handler: (event: MouseEvent | TouchEvent) => void
|
||||
): void => {
|
||||
useEffect(() => {
|
||||
let startedInside = false;
|
||||
let startedWhenMounted = false;
|
||||
|
||||
const listener = (event: MouseEvent | TouchEvent) => {
|
||||
// Do nothing if `mousedown` or `touchstart` started inside ref element
|
||||
if (startedInside || !startedWhenMounted) return;
|
||||
// Do nothing if clicking ref's element or descendent elements
|
||||
if (!ref.current || ref.current.contains(event.target as Node)) return;
|
||||
|
||||
handler(event);
|
||||
};
|
||||
|
||||
const validateEventStart = (event: MouseEvent | TouchEvent) => {
|
||||
startedWhenMounted = ref.current !== null;
|
||||
startedInside = ref.current !== null && ref.current.contains(event.target as Node);
|
||||
};
|
||||
|
||||
document.addEventListener("mousedown", validateEventStart);
|
||||
document.addEventListener("touchstart", validateEventStart);
|
||||
document.addEventListener("click", listener);
|
||||
|
||||
return () => {
|
||||
document.removeEventListener("mousedown", validateEventStart);
|
||||
document.removeEventListener("touchstart", validateEventStart);
|
||||
document.removeEventListener("click", listener);
|
||||
};
|
||||
}, [ref, handler]);
|
||||
};
|
||||
|
||||
3090
pnpm-lock.yaml
generated
3090
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user