{"version":3,"file":"OneStepBookDemoForm.BiioM-ZN.mjs","names":[],"sources":["https:/framerusercontent.com/modules/mUyjRlDdmNm0wX9OjbJw/uxewVCK3NDRyq9SMJgN6/OneStepBookDemoForm.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";const BASE_CALENDLY_URL=\"https://calendly.com/thomas-747/jimo-intro-call?hide_gdpr_banner=1&hide_event_type_details=1\";// Where the form hands off once it is submitted. The three visible fields are\n// passed along as query params so the app can prefill its own signup step:\n// https://i.usejimo.com/register?firstName=…&lastName=…&email=…\nconst REGISTER_APP_URL=\"https://i.usejimo.com/register\";const useStore=createStore({formFieldsValid:false,firstName:\"\",companyName:\"Jimo\",calendlyLink:BASE_CALENDLY_URL});// ─── HELPER: Extract company name from email domain ───────────────────────────\n// e.g. thomas@jimo.ai → \"Jimo\" | sarah@usejimo.com → \"Usejimo\"\nconst extractCompanyName=email=>{const domain=email.split(\"@\")[1];if(!domain)return\"\";const base=domain.split(\".\")[0];return base.charAt(0).toUpperCase()+base.slice(1).toLowerCase();};// ─── withNextButton ───────────────────────────────────────────────────────────\nexport function withNextButton(Component){return props=>{const[store]=useStore();const variant=store.formFieldsValid?\"Default\":\"Disabled\";return /*#__PURE__*/_jsx(Component,{...props,variant:variant});};}// ─── withCalendly ─────────────────────────────────────────────────────────────\nexport function withCalendly(Component){return props=>{const[store]=useStore();return /*#__PURE__*/_jsx(Component,{...props,calendlylink:store.calendlyLink});};}function capitalize(word){if(!word)return\"\";return word[0].toUpperCase()+word.slice(1).toLowerCase();}// ─── withFirstName ────────────────────────────────────────────────────────────\nexport function withFirstName(Component){return props=>{const[store]=useStore();const textCapital=capitalize(store.firstName);const text=store.firstName?`Welcome ${textCapital}, let's have a quick chat!`:\"Welcome, let's have a quick chat!\";return /*#__PURE__*/_jsx(Component,{...props,text:text});};}// ─── withCompanyName ──────────────────────────────────────────────────────────\nexport function withCompanyName(Component){return props=>{const[store]=useStore();return /*#__PURE__*/_jsx(Component,{...props,text:store.companyName});};}// ─── withCompanyInitial ───────────────────────────────────────────────────────\nexport function withCompanyInitial(Component){return props=>{const[store]=useStore();const initial=store.companyName?store.companyName.charAt(0):\"\";return /*#__PURE__*/_jsx(Component,{...props,text:initial});};}// ─── withCompanyVariant ───────────────────────────────────────────────────────\nexport function withCompanyVariant(Component){return props=>{const[store]=useStore();const isJimo=store.companyName.toLowerCase()===\"jimo\"||store.companyName.toLowerCase()===\"usejimo\";const variant=isJimo?\"default\":\"filled\";return /*#__PURE__*/_jsx(Component,{...props,variant:variant});};}// ─── withFormValidation ───────────────────────────────────────────────────────\nexport function withFormValidation(Component){return props=>{const[,setStore]=useStore();useEffect(()=>{// /register renders several <form> elements — the Main CTA Input\n// (email only), this One-Step Demo form, and both of those again\n// inside the modal. A bare document.querySelector would bind to\n// whichever lands first in the DOM, so scope every lookup to the\n// form this override is actually applied to.\nconst className=typeof props.className===\"string\"?props.className.trim():\"\";const scopedForm=className?document.querySelector(`form.${className.split(/\\s+/).join(\".\")}`):null;// Fallback for the rare case Framer does not hand us a className:\n// this is the only form on the page carrying a first-name field.\nconst formElement=scopedForm??Array.from(document.querySelectorAll(\"form\")).find(form=>form.querySelector(\"[name='first-name']\"));if(!formElement)return;// `channel` is a textarea, so the selector must not be tag-qualified.\nconst field=name=>formElement.querySelector(`[name='${name}']`);const emailInput=field(\"email\");const nameInput=field(\"first-name\");const lastNameInput=field(\"last-name\");const channelInput=field(\"channel\");const buildCalendlyLink=()=>{const name=nameInput?.value.trim()??\"\";const email=emailInput?.value.trim()??\"\";return`${BASE_CALENDLY_URL}&name=${encodeURIComponent(name)}&email=${encodeURIComponent(email)}`;};const checkFormValidity=()=>{const isEmailValid=emailInput&&emailInput.value.trim()!==\"\"&&emailInput.checkValidity()&&emailInput.validationMessage===\"\";const isNameValid=nameInput&&nameInput.value.trim()!==\"\";const isLastNameValid=lastNameInput&&lastNameInput.value.trim()!==\"\";const isChannelValid=channelInput&&channelInput.value.trim()!==\"\";const allValid=!!isEmailValid&&!!isNameValid&&!!isLastNameValid&&!!isChannelValid;const firstName=nameInput?.value.trim()??\"\";const extracted=extractCompanyName(emailInput?.value.trim()??\"\");const companyName=extracted!==\"\"?extracted:\"Jimo\";const calendlyLink=buildCalendlyLink();setStore({formFieldsValid:allValid,firstName,companyName,calendlyLink});return allValid;};const handleEmailInput=()=>{if(!emailInput)return;const blockedEmailDomains=[\"gmail\",\"yahoo\",\"hotmail\",\"outlook\",\"live\",\"aol\",\"icloud\",\"mail\",\"protonmail\",\"zoho\",\"test\",\"gmai\",\"msn\",\"yandex\",\"gmx\",\"aim\",\"inbox\",\"example\",\"gmail.com\",\"10minutemail\",\"guerrillamail\",\"mailinator\",\"tempmail\",\"maildrop\",\"yopmail\",\"trashmail\",\"getnada\",\"mailnesia\",\"fakemail\",\"throwawaymail\",\"sharklasers\",\"spamgourmet\",\"moakt\",\"dispostable\",\"mailcatch\",\"mintemail\",\"mytempemail\",\"tempinbox\",\"spam4.me\",\"qq\",\"163\",\"bhuxp.org\",\"volku.org\",\"laxiw.org\",\"tst\",\"xxx\"];const emailPattern=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$/;const value=emailInput.value.trim();const domain=value.split(\"@\")[1];if(value===\"\"){emailInput.setCustomValidity(\"\");}else if(!emailPattern.test(value)){emailInput.setCustomValidity(\"Please input your email in the valid format.\");}else if(domain&&blockedEmailDomains.some(d=>domain.toLowerCase().includes(d.toLowerCase()))){emailInput.setCustomValidity(\"Please only enter your work email.\");}else{emailInput.setCustomValidity(\"\");}emailInput.reportValidity();setTimeout(checkFormValidity,100);};const handleFieldChange=()=>{setTimeout(checkFormValidity,100);};// ─── Redirect on submit ──────────────────────────────────────────\n// Hands the three visible fields to the app as query params:\n// https://i.usejimo.com/register?firstName=…&lastName=…&email=…\nconst handleSubmit=event=>{event.preventDefault();if(!formElement.checkValidity()){formElement.reportValidity();return;}const query=[[\"firstName\",nameInput?.value.trim()??\"\"],[\"lastName\",lastNameInput?.value.trim()??\"\"],[\"email\",emailInput?.value.trim()??\"\"]]// encodeURIComponent (not URLSearchParams) so spaces become\n// %20 rather than \"+\", which decodes correctly whichever\n// parser the app uses on the other side.\n.map(([key,value])=>`${key}=${encodeURIComponent(value)}`).join(\"&\");window.location.href=`${REGISTER_APP_URL}?${query}`;};emailInput?.addEventListener(\"input\",handleEmailInput);emailInput?.addEventListener(\"blur\",handleEmailInput);nameInput?.addEventListener(\"input\",handleFieldChange);nameInput?.addEventListener(\"blur\",handleFieldChange);lastNameInput?.addEventListener(\"input\",handleFieldChange);lastNameInput?.addEventListener(\"blur\",handleFieldChange);channelInput?.addEventListener(\"input\",handleFieldChange);channelInput?.addEventListener(\"blur\",handleFieldChange);formElement.addEventListener(\"submit\",handleSubmit);setTimeout(checkFormValidity,200);return()=>{emailInput?.removeEventListener(\"input\",handleEmailInput);emailInput?.removeEventListener(\"blur\",handleEmailInput);nameInput?.removeEventListener(\"input\",handleFieldChange);nameInput?.removeEventListener(\"blur\",handleFieldChange);lastNameInput?.removeEventListener(\"input\",handleFieldChange);lastNameInput?.removeEventListener(\"blur\",handleFieldChange);channelInput?.removeEventListener(\"input\",handleFieldChange);channelInput?.removeEventListener(\"blur\",handleFieldChange);formElement.removeEventListener(\"submit\",handleSubmit);};},[props.className]);return /*#__PURE__*/_jsx(Component,{...props});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withCompanyInitial\":{\"type\":\"reactHoc\",\"name\":\"withCompanyInitial\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withFirstName\":{\"type\":\"reactHoc\",\"name\":\"withFirstName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withFormValidation\":{\"type\":\"reactHoc\",\"name\":\"withFormValidation\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCompanyName\":{\"type\":\"reactHoc\",\"name\":\"withCompanyName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCalendly\":{\"type\":\"reactHoc\",\"name\":\"withCalendly\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCompanyVariant\":{\"type\":\"reactHoc\",\"name\":\"withCompanyVariant\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withNextButton\":{\"type\":\"reactHoc\",\"name\":\"withNextButton\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./OneStepBookDemoForm.map"],"mappings":"oLAOA,SAAgB,EAAa,EAAU,CAAC,MAAO,IAAO,CAAC,GAAK,CAAC,GAAO,EAAS,EAAE,OAAoB,EAAK,EAAU,CAAC,GAAG,EAAM,aAAa,EAAM,YAAY,CAAC,CAAE,CAAE,CAAC,SAAS,EAAW,EAAK,CAAmB,OAAd,EAAqB,EAAK,EAAE,CAAC,YAAY,EAAE,EAAK,MAAM,CAAC,CAAC,CAAC,YAAY,EAA1D,EAA4D,CACtQ,SAAgB,EAAc,EAAU,CAAC,MAAO,IAAO,CAAC,GAAK,CAAC,GAAO,EAAS,EAAQ,EAAY,EAAW,EAAM,SAAS,EAAQ,EAAK,EAAM,UAAU,WAAW,EAAY,4BAA4B,oCAAoC,OAAoB,EAAK,EAAU,CAAC,GAAG,EAAW,MAAI,CAAC,CAAE,CAAE,CAC3S,SAAgB,EAAgB,EAAU,CAAC,MAAO,IAAO,CAAC,GAAK,CAAC,GAAO,EAAS,EAAE,OAAoB,EAAK,EAAU,CAAC,GAAG,EAAM,KAAK,EAAM,WAAW,CAAC,CAAE,CAAE,CAC1J,SAAgB,EAAmB,EAAU,CAAC,MAAO,IAAO,CAAC,GAAK,CAAC,GAAO,EAAS,EAAQ,EAAQ,EAAM,YAAY,EAAM,YAAY,OAAO,CAAC,EAAE,GAAG,OAAoB,EAAK,EAAU,CAAC,GAAG,EAAM,KAAK,CAAO,CAAC,CAAE,CAAE,CAClN,SAAgB,EAAmB,EAAU,CAAC,MAAO,IAAO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