From e63d57667c5cd152983145f9feae74f0abbf60aa Mon Sep 17 00:00:00 2001 From: Matthias Nannt Date: Fri, 3 Feb 2023 17:06:48 +0100 Subject: [PATCH] add api functionality to add fields to customer with submission update, update waitlist to create customer once he submits email field --- apps/demo/pages/feedback-widget.tsx | 34 +++++++------ .../components/engine/SurveyPage.tsx | 16 +++++- .../components/engine/engineTypes.tsx | 1 + apps/formbricks-com/pages/waitlist.tsx | 6 ++- .../submissions/[submissionId]/index.ts | 51 +++++++++++++------ .../ee/billing/components/PricingTable.tsx | 2 - 6 files changed, 75 insertions(+), 35 deletions(-) diff --git a/apps/demo/pages/feedback-widget.tsx b/apps/demo/pages/feedback-widget.tsx index e7578d4a70..358f71e430 100644 --- a/apps/demo/pages/feedback-widget.tsx +++ b/apps/demo/pages/feedback-widget.tsx @@ -1,4 +1,5 @@ import Script from "next/script"; +import { useEffect } from "react"; import AppPage from "../components/AppPage"; declare global { @@ -7,26 +8,29 @@ declare global { } } -const formbricksConfig = { - hqUrl: "http://localhost:3000", - formId: "cldbr2x45000i19t69ncbohnn", - contact: { - name: "Johannes", - position: "Founder", - imgUrl: "https://avatars.githubusercontent.com/u/675065?s=128&v=4", - }, - customer: { - name: "Matti", - email: "matti@formbricks.com", - }, -}; - export default function FeedbackWidget() { + useEffect(() => { + window.formbricks = { + config: { + hqUrl: "http://localhost:3000", + formId: "cldohpx4t000019vijzlf8mgn", + contact: { + name: "Matti Nannt", + position: "Founder", + imgUrl: "https://avatars.githubusercontent.com/u/675065?s=128&v=4", + }, + customer: { + name: "Formbricks", + email: "johannes@formbricks.com", + }, + }, + }; + }, []); return ( <>