Compare commits

..

2 Commits

Author SHA1 Message Date
Balázs Úr
89bedc589a chore: change LINGO_API_KEY environment variable name 2026-03-18 13:57:12 +01:00
Dhruwang Jariwala
633bf18204 fix: auto-expand multi-language card when toggle is enabled (#7504)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-18 12:18:35 +00:00
5 changed files with 16 additions and 22 deletions

View File

@@ -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

View File

@@ -163,6 +163,9 @@ export const MultiLanguageCard: FC<MultiLanguageCardProps> = ({
}
} else {
setIsMultiLanguageActivated(true);
if (!open) {
setOpen(true);
}
}
};

View File

@@ -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) {

View File

@@ -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();

View File

@@ -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**