mirror of
https://github.com/formbricks/formbricks.git
synced 2026-03-27 18:00:55 -05:00
Compare commits
2 Commits
cursor/for
...
fix-lingo-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
89bedc589a | ||
|
|
633bf18204 |
@@ -231,4 +231,4 @@ REDIS_URL=redis://localhost:6379
|
||||
|
||||
|
||||
# Lingo.dev API key for translation generation
|
||||
LINGODOTDEV_API_KEY=your_api_key_here
|
||||
LINGO_API_KEY=your_api_key_here
|
||||
|
||||
@@ -163,6 +163,9 @@ export const MultiLanguageCard: FC<MultiLanguageCardProps> = ({
|
||||
}
|
||||
} else {
|
||||
setIsMultiLanguageActivated(true);
|
||||
if (!open) {
|
||||
setOpen(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -40,29 +40,21 @@ export const SurveyInline = (props: Omit<SurveyContainerProps, "containerId">) =
|
||||
isLoadingScript = true;
|
||||
try {
|
||||
const scriptUrl = props.appUrl ? `${props.appUrl}/js/surveys.umd.cjs` : "/js/surveys.umd.cjs";
|
||||
const response = await fetch(
|
||||
scriptUrl,
|
||||
process.env.NODE_ENV === "development" ? { cache: "no-store" } : {}
|
||||
);
|
||||
|
||||
// Load the script directly via src to ensure proper execution
|
||||
// This approach works with CSP and doesn't require blob URLs or eval
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const scriptElement = document.createElement("script");
|
||||
scriptElement.src = scriptUrl;
|
||||
scriptElement.type = "text/javascript";
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to load the surveys package");
|
||||
}
|
||||
|
||||
// Add cache-busting in development to ensure fresh script loads
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
scriptElement.src += `?t=${Date.now()}`;
|
||||
}
|
||||
const scriptContent = await response.text();
|
||||
const scriptElement = document.createElement("script");
|
||||
|
||||
scriptElement.onload = () => {
|
||||
resolve();
|
||||
};
|
||||
scriptElement.onerror = () => {
|
||||
reject(new Error("Failed to load the surveys package"));
|
||||
};
|
||||
|
||||
document.head.appendChild(scriptElement);
|
||||
});
|
||||
scriptElement.textContent = scriptContent;
|
||||
|
||||
document.head.appendChild(scriptElement);
|
||||
setIsScriptLoaded(true);
|
||||
hasLoadedRef.current = true;
|
||||
} catch (error) {
|
||||
|
||||
@@ -269,7 +269,6 @@ test.describe("Multi Language Survey Create", async () => {
|
||||
await page.getByText("Start from scratch").click();
|
||||
await page.getByRole("button", { name: "Create survey", exact: true }).click();
|
||||
await page.locator("#multi-lang-toggle").click();
|
||||
await page.getByText("Multiple languages").click();
|
||||
await page.getByRole("combobox").click();
|
||||
await page.getByLabel("English (en)").click();
|
||||
await page.getByRole("button", { name: "Confirm" }).click();
|
||||
|
||||
@@ -64,7 +64,7 @@ packages/surveys/
|
||||
|
||||
```bash
|
||||
# packages/surveys/.env
|
||||
LINGODOTDEV_API_KEY=<YOUR_API_KEY>
|
||||
LINGO_API_KEY=<YOUR_API_KEY>
|
||||
```
|
||||
|
||||
4. **Generate Translations**
|
||||
|
||||
Reference in New Issue
Block a user