diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 301aed0751..5ec2fa7ced 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -12,8 +12,8 @@ // Configure properties specific to VS Code. "vscode": { // Add the IDs of extensions you want installed when the container is created. - "extensions": ["dbaeumer.vscode-eslint"], - }, + "extensions": ["dbaeumer.vscode-eslint"] + } }, // Use 'forwardPorts' to make a list of ports inside the container available locally. @@ -25,5 +25,5 @@ "postAttachCommand": "pnpm dev --filter=web... --filter=demo...", // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. - "remoteUser": "node", + "remoteUser": "node" } diff --git a/apps/formbricks-com/pages/api/oss-friends/index.ts b/apps/formbricks-com/pages/api/oss-friends/index.ts index 1521616661..0a62a950e7 100644 --- a/apps/formbricks-com/pages/api/oss-friends/index.ts +++ b/apps/formbricks-com/pages/api/oss-friends/index.ts @@ -12,7 +12,8 @@ export default async function handle(req: NextApiRequest, res: NextApiResponse) }, { name: "Aptabase", - description: "Analytics for Apps, open source, simple and privacy-friendly. SDKs for Swift, React Native, Electron, Flutter and many others.", + description: + "Analytics for Apps, open source, simple and privacy-friendly. SDKs for Swift, React Native, Electron, Flutter and many others.", href: "https://aptabase.com", }, { diff --git a/apps/web/app/s/[surveyId]/components/LinkSurvey.tsx b/apps/web/app/s/[surveyId]/components/LinkSurvey.tsx index 96c82dee71..09e23725f6 100644 --- a/apps/web/app/s/[surveyId]/components/LinkSurvey.tsx +++ b/apps/web/app/s/[surveyId]/components/LinkSurvey.tsx @@ -48,6 +48,7 @@ export default function LinkSurvey({ const searchParams = useSearchParams(); const isPreview = searchParams?.get("preview") === "true"; const sourceParam = searchParams?.get("source"); + const suId = searchParams?.get("suId"); // pass in the responseId if the survey is a single use survey, ensures survey state is updated with the responseId const [surveyState, setSurveyState] = useState(new SurveyState(survey.id, singleUseId, responseId, userId)); @@ -129,7 +130,7 @@ export default function LinkSurvey({ return ; } //emailVerificationStatus === "not-verified" - return ; + return ; } return ( diff --git a/apps/web/app/s/[surveyId]/components/VerifyEmail.tsx b/apps/web/app/s/[surveyId]/components/VerifyEmail.tsx index fe5aec6a15..217891fef9 100644 --- a/apps/web/app/s/[surveyId]/components/VerifyEmail.tsx +++ b/apps/web/app/s/[surveyId]/components/VerifyEmail.tsx @@ -22,9 +22,11 @@ const StackedCardsContainer = ({ children }) => ( export default function VerifyEmail({ survey, isErrorComponent, + singleUseId, }: { survey: TSurvey; isErrorComponent?: boolean; + singleUseId?: string; }) { const [showPreviewQuestions, setShowPreviewQuestions] = useState(false); const [email, setEmail] = useState(null); @@ -44,6 +46,7 @@ export default function VerifyEmail({ surveyId: survey.id, email: email, surveyData: survey.verifyEmail, + suId: singleUseId ?? "", }; try { await sendLinkSurveyEmailAction(data); diff --git a/packages/lib/emails/emails.ts b/packages/lib/emails/emails.ts index 89659a7693..110c0755f3 100644 --- a/packages/lib/emails/emails.ts +++ b/packages/lib/emails/emails.ts @@ -40,6 +40,7 @@ interface TEmailUserWithName extends TEmailUser { export interface LinkSurveyEmailData { surveyId: string; email: string; + suId: string; surveyData?: { name?: string; subheading?: string; @@ -249,8 +250,14 @@ export const sendLinkSurveyToVerifiedEmail = async (data: LinkSurveyEmailData) = const surveyId = data.surveyId; const email = data.email; const surveyData = data.surveyData; + const singleUseId = data.suId ?? null; const token = createTokenForLinkSurvey(surveyId, email); - const surveyLink = `${WEBAPP_URL}/s/${surveyId}?verify=${encodeURIComponent(token)}`; + const getSurveyLink = () => { + if (singleUseId) { + return `${WEBAPP_URL}/s/${surveyId}?verify=${encodeURIComponent(token)}&suId=${singleUseId}`; + } + return `${WEBAPP_URL}/s/${surveyId}?verify=${encodeURIComponent(token)}`; + }; await sendEmail({ to: data.email, subject: "Your Formbricks Survey", @@ -258,7 +265,7 @@ export const sendLinkSurveyToVerifiedEmail = async (data: LinkSurveyEmailData) = Thanks for validating your email. Here is your Survey.

${surveyData?.name}

${surveyData?.subheading}

- Take survey
+ Take survey

All the best,
Your Formbricks Team 🤍`), diff --git a/packages/lib/response/service.ts b/packages/lib/response/service.ts index 95ed1c8b02..99c07a1ce1 100644 --- a/packages/lib/response/service.ts +++ b/packages/lib/response/service.ts @@ -256,6 +256,7 @@ export const createResponse = async (responseInput: TResponseInput): Promise