From 4918db1f9c98a92b371eafc8fb287288760a705c Mon Sep 17 00:00:00 2001 From: Mitchell Wright Date: Wed, 9 Mar 2022 17:42:51 -0700 Subject: [PATCH 1/9] update footer --- docs/components/Footer.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/components/Footer.tsx b/docs/components/Footer.tsx index 2c3d2a6601821..31e9af2556a3d 100644 --- a/docs/components/Footer.tsx +++ b/docs/components/Footer.tsx @@ -172,7 +172,6 @@ function SubmitForm() { }) .then((res) => res.json()) .then((res) => { - Cookies.set("ckId", res.id, { expires: 365 }); return router.push("/confirm"); }); e.preventDefault(); From 69d9f61d6fb93c2e42e7e78e145562e973077a72 Mon Sep 17 00:00:00 2001 From: Mitchell Wright Date: Wed, 9 Mar 2022 17:43:24 -0700 Subject: [PATCH 2/9] update api/signup --- docs/pages/api/signup.tsx | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/docs/pages/api/signup.tsx b/docs/pages/api/signup.tsx index d32954d71b5a4..dda835d26b621 100644 --- a/docs/pages/api/signup.tsx +++ b/docs/pages/api/signup.tsx @@ -1,23 +1,32 @@ import { NextApiRequest, NextApiResponse } from "next"; -import { subscribeToForm } from "../../lib/ConvertKitApi"; -const FORM_ID = process.env.CONVERTKIT_FORM_ID; +const TRAY_URL = "https://39dca6c2-9ca4-41b4-82c9-e48202f221f8.trayapp.io"; export default async function handle( req: NextApiRequest, res: NextApiResponse ) { if (req.method === "POST") { - const subscriber = await subscribeToForm({ - formId: FORM_ID, + const user = { email: req.body.email, - firstName: req.body.firstName, - fields: { - last_name: req.body.lastName, - }, - }); + name: `${req.body.firstName} ${req.body.lastName}`, + campaign_id: req.body.campaignId, + }; - return res.status(201).json(subscriber); + try { + await fetch(TRAY_URL, { + method: "POST", + headers: { + "Content-Type": "application/json", + Accept: "application/json", + }, + body: JSON.stringify(user), + }); + + return res.status(201).json(user); + } catch (error) { + return res.status(500).json(error); + } } else { return res.status(404).send(null); } From 0cd4803a3c85dbbceb733a2f9cce8666c83cd769 Mon Sep 17 00:00:00 2001 From: Mitchell Wright Date: Wed, 9 Mar 2022 17:44:04 -0700 Subject: [PATCH 3/9] update /confirm --- docs/components/pages/confirm.tsx | 76 +++++-------------------------- 1 file changed, 12 insertions(+), 64 deletions(-) diff --git a/docs/components/pages/confirm.tsx b/docs/components/pages/confirm.tsx index 44d9467a71d7d..17d9c6e212e71 100644 --- a/docs/components/pages/confirm.tsx +++ b/docs/components/pages/confirm.tsx @@ -1,13 +1,8 @@ /* eslint-disable react/no-unescaped-entities */ -import axios from "axios"; import Head from "next/head"; import { Container } from "../Container"; -import { Radio, RadioGroup } from "../RadioGroup"; -import { useCkViewer } from "../useCkViewer"; export default function Confirm() { - const { data, mutate } = useCkViewer(); - return ( <> @@ -19,65 +14,18 @@ export default function Confirm() {
- {data && data?.fields?.job_title ? ( -
-

- Thanks so much! There's one last step. -

-

- - Please confirm your email. - {" "} - Please check your inbox for an email that just got sent. - You'll need to click the confirmation link to receive any - further emails. -

{" "} -

- If you don't see the email after a few minutes, you might - check your spam folder or other filters and add{" "} - - hello@turborepo.org - {" "} - to your contacts. -

-

- Thanks, -
- The Turborepo Team -

-
- ) : ( -
-
- How would you describe yourself? -
- - Choose one: - - } - onChange={(job_title) => { - axios - .put(`/api/user/${data.id}`, { - ...data, - fields: { - ...data.fields, - job_title, - }, - }) - .then(() => mutate(`/api/user/${data.id}`, true)) - .catch((err) => console.log(err)); - }} - > - Engineering Manager - Senior Developer - Junior Developer - Novice Developer - Choose not to say - -
- )} +
+

Thanks so much!

+

+ Keep an eye on your inbox for product updates and + announcements from Turborepo and Vercel. +

{" "} +

+ Thanks, +
+ The Turborepo Team +

+
From b230f09f0780f50ac19953e663a7e19d1fa36a29 Mon Sep 17 00:00:00 2001 From: Mitchell Wright Date: Wed, 9 Mar 2022 18:06:58 -0700 Subject: [PATCH 4/9] update JSON payload --- docs/pages/api/signup.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/pages/api/signup.tsx b/docs/pages/api/signup.tsx index dda835d26b621..03c934715bdca 100644 --- a/docs/pages/api/signup.tsx +++ b/docs/pages/api/signup.tsx @@ -9,7 +9,6 @@ export default async function handle( if (req.method === "POST") { const user = { email: req.body.email, - name: `${req.body.firstName} ${req.body.lastName}`, campaign_id: req.body.campaignId, }; @@ -20,7 +19,7 @@ export default async function handle( "Content-Type": "application/json", Accept: "application/json", }, - body: JSON.stringify(user), + body: JSON.stringify({ user: user }), }); return res.status(201).json(user); From a751e99b39e308d43ca3fa33261ae96a43578d95 Mon Sep 17 00:00:00 2001 From: Mitchell Wright Date: Thu, 10 Mar 2022 12:14:54 -0700 Subject: [PATCH 5/9] Update TRAY_URL to be env var --- docs/pages/api/signup.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/pages/api/signup.tsx b/docs/pages/api/signup.tsx index 03c934715bdca..3687065344a5b 100644 --- a/docs/pages/api/signup.tsx +++ b/docs/pages/api/signup.tsx @@ -1,7 +1,5 @@ import { NextApiRequest, NextApiResponse } from "next"; -const TRAY_URL = "https://39dca6c2-9ca4-41b4-82c9-e48202f221f8.trayapp.io"; - export default async function handle( req: NextApiRequest, res: NextApiResponse @@ -13,7 +11,7 @@ export default async function handle( }; try { - await fetch(TRAY_URL, { + await fetch(process.env.TRAY_URL, { method: "POST", headers: { "Content-Type": "application/json", From d8b6cd69d36e555928046f5229be523d814bb94a Mon Sep 17 00:00:00 2001 From: Mitchell Wright Date: Thu, 10 Mar 2022 12:23:55 -0700 Subject: [PATCH 6/9] add turborepo salesforce campaign id --- docs/pages/api/signup.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pages/api/signup.tsx b/docs/pages/api/signup.tsx index 3687065344a5b..23be8c0a1da6b 100644 --- a/docs/pages/api/signup.tsx +++ b/docs/pages/api/signup.tsx @@ -7,7 +7,7 @@ export default async function handle( if (req.method === "POST") { const user = { email: req.body.email, - campaign_id: req.body.campaignId, + campaign_id: process.env.TURBOREPO_SFDC_CAMPAIGN_ID, }; try { From ef5c7ff2144a37729b4b743b965f21638e73a3f2 Mon Sep 17 00:00:00 2001 From: Mitchell Wright Date: Thu, 10 Mar 2022 13:29:14 -0700 Subject: [PATCH 7/9] move env vars --- docs/pages/api/signup.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/pages/api/signup.tsx b/docs/pages/api/signup.tsx index 23be8c0a1da6b..486f7e8dc1907 100644 --- a/docs/pages/api/signup.tsx +++ b/docs/pages/api/signup.tsx @@ -1,4 +1,8 @@ import { NextApiRequest, NextApiResponse } from "next"; +import { useToasterStore } from "react-hot-toast"; + +const CAMPAIGN_ID = process.env.TURBOREPO_SFDC_CAMPAIGN_ID; +const TRAY_URL = process.env.TRAY_URL; export default async function handle( req: NextApiRequest, @@ -7,11 +11,11 @@ export default async function handle( if (req.method === "POST") { const user = { email: req.body.email, - campaign_id: process.env.TURBOREPO_SFDC_CAMPAIGN_ID, + campaign_id: CAMPAIGN_ID, }; - + console.log(user); try { - await fetch(process.env.TRAY_URL, { + const trayRes = await fetch(TRAY_URL, { method: "POST", headers: { "Content-Type": "application/json", @@ -19,6 +23,7 @@ export default async function handle( }, body: JSON.stringify({ user: user }), }); + console.log(trayRes); return res.status(201).json(user); } catch (error) { From d10a0e6f1ef52dce58ab2afc798742daf31f1475 Mon Sep 17 00:00:00 2001 From: Mitchell Wright Date: Thu, 10 Mar 2022 13:29:34 -0700 Subject: [PATCH 8/9] remove import --- docs/pages/api/signup.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/pages/api/signup.tsx b/docs/pages/api/signup.tsx index 486f7e8dc1907..683d1cf77e14f 100644 --- a/docs/pages/api/signup.tsx +++ b/docs/pages/api/signup.tsx @@ -1,5 +1,4 @@ import { NextApiRequest, NextApiResponse } from "next"; -import { useToasterStore } from "react-hot-toast"; const CAMPAIGN_ID = process.env.TURBOREPO_SFDC_CAMPAIGN_ID; const TRAY_URL = process.env.TRAY_URL; From f5fbb9d5cdc5190b6ff10ed03401c3109144fa53 Mon Sep 17 00:00:00 2001 From: Mitchell Wright Date: Thu, 10 Mar 2022 14:02:00 -0700 Subject: [PATCH 9/9] remove logs --- docs/pages/api/signup.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/pages/api/signup.tsx b/docs/pages/api/signup.tsx index 683d1cf77e14f..8faa69f8c447e 100644 --- a/docs/pages/api/signup.tsx +++ b/docs/pages/api/signup.tsx @@ -12,7 +12,7 @@ export default async function handle( email: req.body.email, campaign_id: CAMPAIGN_ID, }; - console.log(user); + try { const trayRes = await fetch(TRAY_URL, { method: "POST", @@ -22,7 +22,6 @@ export default async function handle( }, body: JSON.stringify({ user: user }), }); - console.log(trayRes); return res.status(201).json(user); } catch (error) {