import { withTwind } from "https://zipper.dev/render/twind/src/main.ts"; import formTemplate from "./form-html.tsx"; import responseTemplate from "./response-html.tsx"; const FORM_ACTION_URL = "https://clerk-waitlist-demo.zipper.run/relay"; const WAITLIST_ADD_API_URL = "https://clerk-waitlist.zipper.run/add/api"; const WAITLIST_APPLET_URL = "https://clerk-waitlist.zipper.run"; export const handler = withTwind(({ email }: { email: string }, context) => { context.response.headers = { ...context.response.headers, "Content-Type": "text/html charset=utf8", }; /** * ✨ Here's where the magic happens * All we have to do is call the API just like we'd call the hadler function * Any sign up emails should show up on the applet at WAITLIST_APPLET_URL above * That's it! */ if (email) { fetch(WAITLIST_ADD_API_URL, { method: "POST", body: JSON.stringify({ email }), }); } return `

We're working on something shrouded in mystery

Sign up for our waitlist and be one of the first to harness the power of whatever it is we're making.

${ !email ? formTemplate(FORM_ACTION_URL) : responseTemplate(email, WAITLIST_APPLET_URL) }
`; }); export const config = { run: true, __dangerouslyAllowScripting: true, };