mirror of
https://github.com/formbricks/formbricks.git
synced 2026-01-06 05:40:02 -06:00
Merge branch 'main' of https://github.com/formbricks/formbricks into randomize-row-order-matrix-questions
This commit is contained in:
@@ -23,6 +23,10 @@ This guide will help you understand how to generate and use single-use links wit
|
||||
|
||||
- The primary purpose of single-use links is to assure that no respondent submits a survey twice.
|
||||
|
||||
<Note>
|
||||
Want to create up to 5,000 single-use links? Use our [API endpoint for that.](https://documenter.getpostman.com/view/11026000/2sA3Bq5XEh#c49ef758-a78a-4ef4-a282-262621151f08).
|
||||
</Note>
|
||||
|
||||
## Using Single-Use Links with Formbricks
|
||||
|
||||
Using single-use links with Formbricks is quite straight-forward:
|
||||
|
||||
@@ -154,7 +154,7 @@ export const MatrixQuestionForm = ({
|
||||
{question.rows.map((_, index) => (
|
||||
<div className="flex items-center" onKeyDown={(e) => handleKeyDown(e, "row")}>
|
||||
<QuestionFormInput
|
||||
key={`row-${index}`}
|
||||
key={`row-${index}-${question.rows.length}`}
|
||||
id={`row-${index}`}
|
||||
label={""}
|
||||
localSurvey={localSurvey}
|
||||
@@ -196,7 +196,7 @@ export const MatrixQuestionForm = ({
|
||||
{question.columns.map((_, index) => (
|
||||
<div className="flex items-center" onKeyDown={(e) => handleKeyDown(e, "column")}>
|
||||
<QuestionFormInput
|
||||
key={`column-${index}`}
|
||||
key={`column-${index}-${question.columns.length}`}
|
||||
id={`column-${index}`}
|
||||
label={""}
|
||||
localSurvey={localSurvey}
|
||||
|
||||
@@ -2,9 +2,9 @@ import { responses } from "@/app/lib/api/response";
|
||||
import fs from "fs/promises";
|
||||
import { NextRequest } from "next/server";
|
||||
|
||||
export const GET = async (_: NextRequest, { params }: { params: { slug: string } }) => {
|
||||
export const GET = async (_: NextRequest, { params }: { params: { package: string } }) => {
|
||||
let path: string;
|
||||
const packageRequested = params["package"];
|
||||
const packageRequested = params.package;
|
||||
|
||||
switch (packageRequested) {
|
||||
case "app":
|
||||
@@ -21,7 +21,7 @@ export const GET = async (_: NextRequest, { params }: { params: { slug: string }
|
||||
"package",
|
||||
packageRequested,
|
||||
true,
|
||||
"public, s-maxage=600, max-age=1800, stale-while-revalidate=600, stale-if-error=600"
|
||||
"public, max-age=600, s-maxage=600, stale-while-revalidate=600, stale-if-error=600" // 10 minutes cache for not found
|
||||
);
|
||||
}
|
||||
|
||||
@@ -30,16 +30,26 @@ export const GET = async (_: NextRequest, { params }: { params: { slug: string }
|
||||
return new Response(packageSrcCode, {
|
||||
headers: {
|
||||
"Content-Type": "application/javascript",
|
||||
"Cache-Control": "public, s-maxage=600, max-age=1800, stale-while-revalidate=600, stale-if-error=600",
|
||||
"Cache-Control":
|
||||
"public, max-age=3600, s-maxage=604800, stale-while-revalidate=3600, stale-if-error=3600",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error reading file:", error);
|
||||
return responses.internalServerErrorResponse(
|
||||
"file not found:",
|
||||
true,
|
||||
"public, s-maxage=600, max-age=1800, stale-while-revalidate=600, stale-if-error=600"
|
||||
);
|
||||
} catch (error: any) {
|
||||
if (error.code === "ENOENT") {
|
||||
return responses.notFoundResponse(
|
||||
"package",
|
||||
packageRequested,
|
||||
true,
|
||||
"public, max-age=600, s-maxage=600, stale-while-revalidate=600, stale-if-error=600" // 10 minutes cache for file not found errors
|
||||
);
|
||||
} else {
|
||||
console.error("Error reading file:", error);
|
||||
return responses.internalServerErrorResponse(
|
||||
"internal server error",
|
||||
true,
|
||||
"public, max-age=600, s-maxage=600, stale-while-revalidate=600, stale-if-error=600" // 10 minutes cache for internal errors
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -62,11 +62,12 @@ export const OpenTextQuestion = ({
|
||||
|
||||
const openTextRef = useCallback(
|
||||
(currentElement: HTMLInputElement | HTMLTextAreaElement | null) => {
|
||||
if (question.id && currentElement && autoFocusEnabled) {
|
||||
// will focus on current element when the question ID matches the current question
|
||||
if (question.id && currentElement && autoFocusEnabled && question.id === currentQuestionId) {
|
||||
currentElement.focus();
|
||||
}
|
||||
},
|
||||
[question.id, autoFocusEnabled]
|
||||
[question.id, autoFocusEnabled, currentQuestionId]
|
||||
);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user