{"version":3,"file":"ToltHubspot.CeRvbihE.mjs","names":[],"sources":["https:/framerusercontent.com/modules/zKCWt4H7a6VgMEQZ8gK6/rNFpUjHSbdQnxmVPHfKv/ToltHubspot.js"],"sourcesContent":["// 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\";const 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){return`anon-${window.crypto.randomUUID()}`;}return`anon-${Date.now()}`;}async function signUpVisitor(identifier){if(!shouldSignUp())return;// Check if tolt is available\nif(!window.tolt?.signup){console.warn(\"[tolt] tolt.signup not available\");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;console.warn(\"[tolt] signup failed\",err);}}// --- 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=>{try{// First run tolt signup (keeps signup close to the click)\nconst id=resolveIdentifier(identifier);await signUpVisitor(id);}catch(err){console.warn(\"[tolt] signup error:\",err);}// Then run the original click behavior if present\nif(typeof originalOnClick===\"function\"){try{const result=originalOnClick(event);if(result instanceof Promise){await result;}}catch(err){console.error(\"[onClick] error:\",err);}}};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){return /*#__PURE__*/forwardRef((props,ref)=>{const[store,setStore]=useStore();// Combine both behaviors in one onClick\nconst onClick=async event=>{// 1. Change background color\nsetStore({background:randomColor()});// 2. Handle tolt signup\ntry{const id=resolveIdentifier();await signUpVisitor(id);}catch(err){console.warn(\"[tolt] signup error:\",err);}// 3. Call original onClick if exists\nif(typeof props.onClick===\"function\"){try{const result=props.onClick(event);if(result instanceof Promise){await result;}}catch(err){console.error(\"[onClick] error:\",err);}}};return /*#__PURE__*/_jsx(Component,{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\":{\"withHover\":{\"type\":\"reactHoc\",\"name\":\"withHover\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRandomColor\":{\"type\":\"reactHoc\",\"name\":\"withRandomColor\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withToltSignup\":{\"type\":\"reactHoc\",\"name\":\"withToltSignup\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRotate\":{\"type\":\"reactHoc\",\"name\":\"withRotate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withToltOnly\":{\"type\":\"reactHoc\",\"name\":\"withToltOnly\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ToltHubspot.map"],"mappings":"4LAEA,SAAS,GAAc,CACvB,IA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