{"version":3,"file":"Newsubmitform.DPb0s3Fg.mjs","names":["__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/xpkRFtasdR3ijpdTTVjx/0AgjE6ycGTxpxxP4ahhY/Newsubmitform.js"],"sourcesContent":["// Form 2 — Submit button override\n// Attach this to the \"Submit\" button on every product-specific Form 2 page:\n//   /book-a-demo-text-to-speech\n//   /book-a-demo-speech-to-text\n//   /book-a-demo-voice-agents\n//   /book-a-demo-slm-2\n//   /book-a-demo-not-sure\n//   /book-a-demo-overall\n//\n// Reads ?sid=... from the URL, collects all form fields, updates the existing\n// Zoho lead, then redirects to /thank-you.\nimport{jsx as _jsx}from\"react/jsx-runtime\";// ---------------------------------------------------------------------------\n// CONFIG — update after deploying Lambda\n// ---------------------------------------------------------------------------\nconst BACKEND_URL=\"https://wc6zltpro3.execute-api.ap-south-1.amazonaws.com/default/book-a-demo\";const THANK_YOU_URL=\"/book-a-demo-v2-basic-information/thank-you\";// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\nfunction readField(values,names){for(const name of names){if(values[name]!==undefined&&values[name]!==null){const v=String(values[name]).trim();if(v)return v;}}return\"\";}function parseMultiValue(raw){if(!raw)return[];try{const parsed=JSON.parse(raw);if(Array.isArray(parsed)){return parsed.map(String).map(s=>s.trim()).filter(Boolean);}}catch{/* not JSON */}return raw.split(/[,;]/).map(s=>s.trim()).filter(Boolean);}function detectProductFromPath(){const path=window.location.pathname||\"\";if(path.includes(\"text-to-speech\"))return\"tts\";if(path.includes(\"speech-to-text\"))return\"stt\";if(path.includes(\"voice-agents\"))return\"voice\";if(path.includes(\"slm\"))return\"slm\";if(path.includes(\"not-sure\"))return\"notsure\";if(path.includes(\"overall\"))return\"overall\";return\"unknown\";}// ---------------------------------------------------------------------------\n// Override\n// ---------------------------------------------------------------------------\nexport function withForm2Submit(){return{onClick:async event=>{event.preventDefault();event.stopPropagation();const button=event.target;const form=button.closest(\"form\")||document.querySelector(\"form\");if(!form){console.error(\"Form not found\");return;}const params=new URLSearchParams(window.location.search);const sessionId=params.get(\"sid\")||\"\";if(!sessionId){alert(\"Your session has expired. Please go back and fill the form again.\");return;}const originalText=button.textContent;button.disabled=true;button.textContent=\"Submitting...\";try{const formData=new FormData(form);const values={};formData.forEach((v,k)=>{// If same name appears multiple times (e.g. \"Others\"),\n// join with \"||\" so both values are preserved.\nvalues[k]=values[k]?`${values[k]}||${String(v)}`:String(v);});const product=detectProductFromPath();// --- common fields (present on multiple forms) ---\nconst useCases=parseMultiValue(readField(values,[\"Use Cases\",\"useCases\",\"use_cases\"]));const languages=parseMultiValue(readField(values,[\"What languages do you want?\",\"Languages\",\"languages\",\"What languages do you want\"]));const languagesOthers=readField(values,[\"Don't see your language? Add it here\",\"Don’t see your language? Add it here\",\"Language Others\",\"languagesOthers\"]);const industry=readField(values,[\"Which industry are you in?\",\"Industry\",\"industry\"]);const volumeLabel=readField(values,[\"Volume Label\",\"volumeLabel\",\"Expected Monthly Volume\"]);const volumeTier=readField(values,[\"Volume Tiers\",\"volumeTier\",\"volumeTiers\"]);const competitorOptions=parseMultiValue(readField(values,[\"Competitor Options\",\"competitorOptions\"]));const deploymentPreference=readField(values,[\"Deployment preference\",\"Deployment Preference\",\"deploymentPreference\"]);const evaluationTimeline=readField(values,[\"How soon are you looking to get started?\",\"evaluationTimeline\",\"How soon\"]);const primaryGoal=parseMultiValue(readField(values,[\"What are you mainly looking to do?\",\"primaryGoal\",\"What are you mainly looking to do\"]));// --- multiple \"Others\" fields (split by \"||\" from above) ---\n// Convention expected in Framer:\n//   useCasesOthers   → field named \"Use Case Others\" or \"Others\"\n//   industryOthers   → field named \"Industry Others\"\n//   competitorOthers → field named \"Competitor Others\"\n//   primaryGoalOthers→ field named \"Goal Others\"\n// Fallback: any untagged \"Others\" field we join by \"||\".\nconst otherJoined=readField(values,[\"Others\",\"others\"]);const otherParts=otherJoined.split(\"||\").map(s=>s.trim()).filter(Boolean);const useCasesOthers=readField(values,[\"Use Case Others\",\"useCasesOthers\",\"Usecase Others\"])||otherParts[0]||\"\";const industryOthers=readField(values,[\"Industry Others\",\"industryOthers\"])||otherParts[1]||\"\";const competitorOthers=readField(values,[\"Competitor Others\",\"competitorOthers\",\"Current Provider Others\"])||otherParts[2]||\"\";const primaryGoalOthers=readField(values,[\"Goal Others\",\"primaryGoalOthers\"])||\"\";// --- route each product's \"volume tier\" to the right Zoho field ---\nlet ttsVolumeTier=\"\";let sttVolumeTier=\"\";let callVolumeTier=\"\";if(product===\"tts\")ttsVolumeTier=volumeTier;else if(product===\"stt\")sttVolumeTier=volumeTier;else if(product===\"voice\")callVolumeTier=volumeTier;const payload={stage:\"form2\",sessionId,product,useCases,useCasesOthers,languages,languagesOthers,industry,industryOthers,volumeLabel,ttsVolumeTier,sttVolumeTier,callVolumeTier,competitorOptions,competitorOthers,deploymentPreference,evaluationTimeline,primaryGoal,primaryGoalOthers,// Raw dump — useful for debugging field-name mismatches.\n// Backend ignores it; remove once confirmed working.\n_rawFormValues:values};const res=await fetch(BACKEND_URL,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify(payload)});let result=null;try{result=await res.json();}catch{/* noop */}if(!res.ok){console.error(\"Form 2 backend error:\",res.status,result);alert(\"There was an error submitting. Please try again.\");return;}// Track completion in dataLayer for GTM\nwindow.dataLayer=window.dataLayer||[];window.dataLayer.push({event:\"demo_booked\",product});form.reset();window.location.href=THANK_YOU_URL;}catch(err){console.error(\"Form 2 error:\",err);alert(\"There was an error. Please try again.\");}finally{button.disabled=false;if(originalText)button.textContent=originalText;}}};}import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withwithForm2Submit(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...withForm2Submit(props)});};}withwithForm2Submit.displayName=\"withForm2Submit\";\nexport const __FramerMetadata__ = {\"exports\":{\"withForm2Submit\":{\"type\":\"override\",\"name\":\"withForm2Submit\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withwithForm2Submit\":{\"type\":\"reactHoc\",\"name\":\"withwithForm2Submit\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Newsubmitform.map"],"mappings":"kLAiBA,SAAS,EAAU,EAAO,EAAM,CAAC,IAAI,IAAM,KAAQ,EAAO,GAAG,EAAO,KAAQ,IAAA,IAAW,EAAO,KAAQ,KAAK,CAAC,IAAM,EAAE,OAAO,EAAO,GAAM,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,EAAI,MAAM,GAAI,SAAS,EAAgB,EAAI,CAAC,GAAG,CAAC,EAAI,MAAM,EAAE,CAAC,GAAG,CAAC,IAAM,EAAO,KAAK,MAAM,EAAI,CAAC,GAAG,MAAM,QAAQ,EAAO,CAAE,OAAO,EAAO,IAAI,OAAO,CAAC,IAAI,GAAG,EAAE,MAAM,CAAC,CAAC,OAAO,QAAQ,MAAQ,EAAgB,OAAO,EAAI,MAAM,OAAO,CAAC,IAAI,GAAG,EAAE,MAAM,CAAC,CAAC,OAAO,QAAQ,CAAE,SAAS,GAAuB,CAAC,IAAM,EAAK,EAAO,SAAS,UAAU,GAA6Q,OAAvQ,EAAK,SAAS,iBAAiB,CAAO,MAAS,EAAK,SAAS,iBAAiB,CAAO,MAAS,EAAK,SAAS,eAAe,CAAO,QAAW,EAAK,SAAS,MAAM,CAAO,MAAS,EAAK,SAAS,WAAW,CAAO,UAAa,EAAK,SAAS,UAAU,CAAO,UAAgB,UAG1vB,SAAgB,GAAiB,CAAC,MAAM,CAAC,QAAQ,KAAM,IAAO,CAAC,EAAM,gBAAgB,CAAC,EAAM,iBAAiB,CAAC,IAAM,EAAO,EAAM,OAAa,EAAK,EAAO,QAAQ,OAAO,EAAE,SAAS,cAAc,OAAO,CAAC,GAAG,CAAC,EAAK,CAAC,QAAQ,MAAM,iBAAiB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