fix submission capture typo, fix feedback demo

This commit is contained in:
Matthias Nannt
2023-02-08 11:48:50 +01:00
parent 264c931624
commit 623d54d6e5
4 changed files with 8 additions and 16 deletions

View File

@@ -1,4 +1,3 @@
import Script from "next/script";
import { useEffect } from "react";
import AppPage from "../../components/AppPage";
@@ -11,8 +10,9 @@ declare global {
export default function Feedback() {
useEffect(() => {
window.formbricks = {
...window.formbricks,
config: {
hqUrl: process.env.NEXT_PUBLIC_FORMBRICKS_URL,
formbricksUrl: process.env.NEXT_PUBLIC_FORMBRICKS_URL,
formId: process.env.NEXT_PUBLIC_FORMBRICKS_FEEDBACK_FORM_ID,
contact: {
name: "Matti Nannt",
@@ -25,14 +25,7 @@ export default function Feedback() {
},
},
};
require("@formbricks/pmf");
require("@formbricks/feedback");
}, []);
return (
<>
<Script src="https://cdn.jsdelivr.net/npm/@formbricks/feedback@0.2.1/dist/index.umd.js" defer />
<>
<AppPage onClickFeedback={(event) => window.formbricks.open(event)} />
</>
</>
);
return <AppPage onClickFeedback={(event) => window.formbricks.open(event)} />;
}

View File

@@ -70,7 +70,7 @@ export default async function handle(req: NextApiRequest, res: NextApiResponse)
},
});
event.data.customer = {
connect: { organisationId_email: { email: customerEmail, organisationId: form.organisationId } },
connect: { email_organisationId: { email: customerEmail, organisationId: form.organisationId } },
};
} else {
// create customer

View File

@@ -13,7 +13,7 @@
},
"scripts": {
"build": "node ./html-to-ts && microbundle --define process.env.NODE_ENV=production",
"dev": "node ./html-to-ts && tsup src/index.ts --format esm,cjs --watch",
"dev": "node ./html-to-ts && microbundle watch --define process.env.NODE_ENV=production",
"clean": "rm -rf dist"
},
"devDependencies": {
@@ -24,7 +24,6 @@
"focus-trap": "^6.7.3",
"html-minifier": "^4.0.0",
"microbundle": "^0.14.2",
"tsup": "^6.4.0",
"typescript": "^4.8.4"
}
}

View File

@@ -13,7 +13,7 @@ export interface FormbricksConfig {
divId?: string;
style?: any;
formId?: string;
hqUrl?: string;
formbricksUrl?: string;
customer?: Record<any, any>;
disableErrorAlert: boolean;
}
@@ -258,7 +258,7 @@ function submit(e: Event) {
};
fetch(
`${stripLastBackslash(config.hqUrl || "https://xm.formbricks.com")}/api/capture/forms/${
`${stripLastBackslash(config.formbricksUrl || "https://app.formbricks.com")}/api/capture/forms/${
config.formId
}/submissions`,
{