mirror of
https://github.com/formbricks/formbricks.git
synced 2026-02-21 18:18:48 -06:00
fix: 404 on js integration connect page (#2901)
This commit is contained in:
committed by
GitHub
parent
f084e64aed
commit
f94d7f2b03
@@ -15,6 +15,7 @@ import { getIntegrations } from "@formbricks/lib/integration/service";
|
||||
import { getMembershipByUserIdOrganizationId } from "@formbricks/lib/membership/service";
|
||||
import { getAccessFlags } from "@formbricks/lib/membership/utils";
|
||||
import { getOrganizationByEnvironmentId } from "@formbricks/lib/organization/service";
|
||||
import { getProductByEnvironmentId } from "@formbricks/lib/product/service";
|
||||
import { getWebhookCountBySource } from "@formbricks/lib/webhook/service";
|
||||
import { TIntegrationType } from "@formbricks/types/integration";
|
||||
import { Card } from "@formbricks/ui/Card";
|
||||
@@ -34,6 +35,7 @@ const Page = async ({ params }) => {
|
||||
zapierWebhookCount,
|
||||
makeWebhookCount,
|
||||
n8nwebhookCount,
|
||||
product,
|
||||
] = await Promise.all([
|
||||
getEnvironment(environmentId),
|
||||
getIntegrations(environmentId),
|
||||
@@ -43,6 +45,7 @@ const Page = async ({ params }) => {
|
||||
getWebhookCountBySource(environmentId, "zapier"),
|
||||
getWebhookCountBySource(environmentId, "make"),
|
||||
getWebhookCountBySource(environmentId, "n8n"),
|
||||
getProductByEnvironmentId(environmentId),
|
||||
]);
|
||||
|
||||
const isIntegrationConnected = (type: TIntegrationType) =>
|
||||
@@ -64,29 +67,12 @@ const Page = async ({ params }) => {
|
||||
const isN8nIntegrationConnected = isIntegrationConnected("n8n");
|
||||
const isSlackIntegrationConnected = isIntegrationConnected("slack");
|
||||
|
||||
const widgetSetupCompleted = environment?.appSetupCompleted || environment?.websiteSetupCompleted;
|
||||
const widgetSetupCompleted = !!environment?.appSetupCompleted || !!environment?.websiteSetupCompleted;
|
||||
const bothSetupCompleted = environment?.appSetupCompleted && environment?.websiteSetupCompleted;
|
||||
const productChannel =
|
||||
product?.config.channel === "website" || !product?.config.channel ? "website" : product?.config.channel;
|
||||
|
||||
const integrationCards = [
|
||||
{
|
||||
docsHref: "https://formbricks.com/docs/getting-started/framework-guides#next-js",
|
||||
docsText: "Docs",
|
||||
docsNewTab: true,
|
||||
connectHref: `/environments/${environmentId}/product/app-connection`,
|
||||
connectText: "Connect",
|
||||
connectNewTab: false,
|
||||
label: "Javascript Widget",
|
||||
description: "Integrate Formbricks into your Webapp",
|
||||
icon: <Image src={JsLogo} alt="Javascript Logo" />,
|
||||
connected: widgetSetupCompleted,
|
||||
statusText: bothSetupCompleted
|
||||
? "app & website connected"
|
||||
: environment?.appSetupCompleted
|
||||
? "app Connected"
|
||||
: environment?.websiteSetupCompleted
|
||||
? "website connected"
|
||||
: "Not Connected",
|
||||
},
|
||||
{
|
||||
docsHref: "https://formbricks.com/docs/integrations/zapier",
|
||||
docsText: "Docs",
|
||||
@@ -213,6 +199,28 @@ const Page = async ({ params }) => {
|
||||
},
|
||||
];
|
||||
|
||||
if (productChannel !== "link") {
|
||||
integrationCards.unshift({
|
||||
docsHref: "https://formbricks.com/docs/getting-started/framework-guides#next-js",
|
||||
docsText: "Docs",
|
||||
docsNewTab: true,
|
||||
connectHref: `/environments/${environmentId}/product/${productChannel}-connection`,
|
||||
connectText: "Connect",
|
||||
connectNewTab: false,
|
||||
label: "Javascript Widget",
|
||||
description: "Integrate Formbricks into your Webapp",
|
||||
icon: <Image src={JsLogo} alt="Javascript Logo" />,
|
||||
connected: widgetSetupCompleted,
|
||||
statusText: bothSetupCompleted
|
||||
? "app & website connected"
|
||||
: environment?.appSetupCompleted
|
||||
? "app Connected"
|
||||
: environment?.websiteSetupCompleted
|
||||
? "website connected"
|
||||
: "Not Connected",
|
||||
});
|
||||
}
|
||||
|
||||
if (isViewer) return <ErrorComponent />;
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user