{"version":3,"file":"ToltHubspot.m89cRRYN.mjs","names":["useStore"],"sources":["https:/framerusercontent.com/modules/FZUr169qgsf8YvqXJMK6/V9YoVsao51aK8VOdFt86/SurfaceFormHandler.js","https:/framerusercontent.com/modules/zKCWt4H7a6VgMEQZ8gK6/ds8bIe9MduqfhenOMArB/ToltHubspot.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import{randomColor}from\"https://framer.com/m/framer/utils.js@^0.9.0\";// Learn more: https://www.framer.com/developers/overrides/\nconst useStore=createStore({background:\"#0099FF\"});export function withClass(Component){return props=>{props.className+=\" surface-form-handler\"// Remember to add a space\n;return /*#__PURE__*/_jsx(Component,{...props,\"data-question-id\":\"ZpntedGGuSBd\"});};}export function withRotate(Component){return /*#__PURE__*/forwardRef((props,ref)=>{return /*#__PURE__*/_jsx(Component,{ref:ref,...props,animate:{rotate:90},transition:{duration:2}});});}export function withHover(Component){return /*#__PURE__*/forwardRef((props,ref)=>{return /*#__PURE__*/_jsx(Component,{ref:ref,...props,whileHover:{scale:1.05}});});}export function withRandomColor(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store,setStore]=useStore();return /*#__PURE__*/_jsx(Component,{ref:ref,...props,animate:{background:store.background},onClick:()=>{setStore({background:randomColor()});}});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withHover\":{\"type\":\"reactHoc\",\"name\":\"withHover\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRotate\":{\"type\":\"reactHoc\",\"name\":\"withRotate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRandomColor\":{\"type\":\"reactHoc\",\"name\":\"withRandomColor\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withClass\":{\"type\":\"reactHoc\",\"name\":\"withClass\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SurfaceFormHandler.map","// overrides.tsx\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import{randomColor}from\"https://framer.com/m/framer/utils.js@^0.9.0\";// Learn more: https://www.framer.com/developers/overrides/\nconst useStore=createStore({background:\"#0099FF\"});// --- tolt helpers (per docs) ---\nfunction shouldSignUp(){// Only sign up if visitor came via affiliate and is not already signed up\nconst td=window.tolt_data;return Boolean(td)&&!td?.customer_id;}function resolveIdentifier(explicit){const trimmed=explicit?.trim();if(trimmed)return trimmed;// Try to read an email input commonly present on landing pages\nconst emailInput=document.querySelector('input[name=\"email\"]')||document.querySelector('input[type=\"email\"]');const email=emailInput?.value?.trim();if(email)return email;// Fallback to generated ID so the click still produces a unique identifier\nif(window.crypto&&\"randomUUID\"in window.crypto){return`anon-${window.crypto.randomUUID()}`;}return`anon-${Date.now()}`;}async function signUpVisitor(identifier){if(!shouldSignUp())return;try{await window.tolt.signup(identifier);// On success, window.tolt_data.customer_id is auto-updated\n}catch(err){// Swallow duplicates (409 \"Customer already exists\")\nconst status=err?.status;const msg=err?.message||\"\";if(status===409||msg.includes(\"Customer already exists\"))return;// Optional: console.error(\"[tolt] signup failed\", err)\n}}// --- Reusable HOC: attach tolt signup on click, preserving original onClick ---\nexport function withToltSignup(Component,identifier){return /*#__PURE__*/forwardRef((props,ref)=>{const originalOnClick=props.onClick;const onClick=async event=>{// First run tolt signup (keeps signup close to the click)\nconst id=resolveIdentifier(identifier);await signUpVisitor(id);// Then run the original click behavior if present\nif(typeof originalOnClick===\"function\"){// If original handler is async, await it; otherwise just call\nconst result=originalOnClick(event);if(result instanceof Promise){await result;}}};return /*#__PURE__*/_jsx(Component,{ref:ref,...props,onClick:onClick});});}// --- Your original overrides ---\nexport function withRotate(Component){return /*#__PURE__*/forwardRef((props,ref)=>{return /*#__PURE__*/_jsx(Component,{ref:ref,...props,animate:{rotate:90},transition:{duration:2}});});}export function withHover(Component){return /*#__PURE__*/forwardRef((props,ref)=>{return /*#__PURE__*/_jsx(Component,{ref:ref,...props,whileHover:{scale:1.05}});});}// Compose random color + tolt signup so one click does both\nexport function withRandomColor(Component){// First wrap the component with tolt signup, then apply random color behavior\nconst ComponentWithTolt=withToltSignup(Component);return /*#__PURE__*/forwardRef((props,ref)=>{const[store,setStore]=useStore();// Keep your original behavior: change background color on click\nconst onClick=()=>{setStore({background:randomColor()});};return /*#__PURE__*/_jsx(ComponentWithTolt,{ref:ref,...props,animate:{background:store.background},onClick:onClick});});}// --- Optional: If you want a standalone export to use without randomColor ---\nexport function withToltOnly(Component,identifier){return withToltSignup(Component,identifier);}\nexport const __FramerMetadata__ = {\"exports\":{\"withToltSignup\":{\"type\":\"reactHoc\",\"name\":\"withToltSignup\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withToltOnly\":{\"type\":\"reactHoc\",\"name\":\"withToltOnly\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRandomColor\":{\"type\":\"reactHoc\",\"name\":\"withRandomColor\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRotate\":{\"type\":\"reactHoc\",\"name\":\"withRotate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHover\":{\"type\":\"reactHoc\",\"name\":\"withHover\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ToltHubspot.map"],"mappings":"4LACmD,SAAgB,EAAU,EAAU,CAAC,MAAO,KAAQ,EAAM,WAAW,wBACnG,EAAK,EAAU,CAAC,GAAG,EAAM,mBAAmB,eAAe,CAAC,mBAFtC,IAA8B,IAAqE,IAAqE,CACpM,EAAY,CAAC,WAAW,UAAU,CAAC,ICElD,SAAS,GAAc,CACvB,IAAM,EAAG,EAAO,UAAU,MAAO,EAAQ,GAAK,CAAC,GAAI,YAAa,SAAS,EAAkB,EAAS,CAER,OAFuB,GAAU,MAAM,GAClH,SAAS,cAAc,sBAAsB,EAAE,SAAS,cAAc,sBAAsB,GAAyB,OAAO,MAAM,GAChJ,EAAO,QAAQ,eAAe,EAAO,OAAc,QAAQ,EAAO,OAAO,YAAY,GAAU,QAAQ,KAAK,KAAK,IAAI,eAAe,EAAc,EAAW,CAAK,MAAc,CAAQ,GAAG,CAAC,MAAM,EAAO,KAAK,OAAO,EAAW,OAC5N,EAAI,CACX,IAAM,EAAO,GAAK,OAAa,EAAI,GAAK,SAAS,GAAG,GAAG,IAAS,KAAK,EAAI,SAAS,0BAA0B,CAAC,QAE7G,SAAgB,EAAe,EAAU,EAAW,CAAC,OAAoB,GAAY,EAAM,IAAM,CAAC,IAAM,EAAgB,EAAM,QAAc,EAAQ,KAAM,IAAO,CAEjK,GADuC,MAAM,EAApC,EAAkB,EAAW,CAAwB,CAC3D,OAAO,GAAkB,WAAW,CACvC,IAAM,EAAO,EAAgB,EAAM,CAAI,aAAkB,SAAS,MAAM,IAAW,OAAoB,EAAK,EAAU,CAAK,MAAI,GAAG,EAAc,UAAQ,CAAC,EAAG,sBAZjH,IAA8B,IAAqE,IAAqE,CACpM,EAAY,CAAC,WAAW,UAAU,CAAC"}