{"version":3,"file":"TrackPhoneClick.D6rTerJS.mjs","names":[],"sources":["https:/framerusercontent.com/modules/0GA2hM5t3SlZQqFhZDvM/tGTlDvod6f1qgqVcbywl/TrackPhoneClick.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef}from\"react\";// Define the exact string argument needed for your gtag_report_conversion function\nconst conversionTarget=\"tel:416-494-5634\";/**\n * Higher-Order Component to add Google Ads conversion tracking to a clickable component.\n * It calls the globally available `gtag_report_conversion` function on click.\n * @param Component The component to wrap (e.g., a Framer Text layer used as a link)\n */export function withGtagPhoneTracking(Component){// Use forwardRef to correctly handle refs passed to the wrapped component\nreturn /*#__PURE__*/forwardRef((props,ref)=>{// Using 'any' for props type for simplicity\n// Define the enhanced click handler\nconst handleClick=event=>{console.log(`[withGtagPhoneTracking] Click detected. Attempting to report conversion for: ${conversionTarget}`);// Check if the gtag_report_conversion function exists on the window object\n// This function needs to be defined globally by your Google Ads setup script.\nif(typeof window.gtag_report_conversion===\"function\"){try{// Call the Google Ads conversion tracking function\n// We execute it, the 'return' value isn't used in the same way as inline HTML onclick\nwindow.gtag_report_conversion(conversionTarget);console.log(`[withGtagPhoneTracking] Called window.gtag_report_conversion('${conversionTarget}')`);}catch(error){console.error(`[withGtagPhoneTracking] Error calling window.gtag_report_conversion:`,error);}}else{// Log a warning if the function isn't found.\n// Ensure your Google Ads setup script (in Framer's Site Settings > Custom Code)\n// correctly defines this function globally.\nconsole.warn(`[withGtagPhoneTracking] window.gtag_report_conversion function not found. `+`Make sure it's defined globally by your Google Ads script setup.`);// You might want to fall back to the standard gtag event method if this happens:\n// if (typeof window.gtag === 'function') {\n//     window.gtag('event', 'conversion', { 'send_to': 'YOUR_AW_CONVERSION_ID/YOUR_CONVERSION_LABEL' });\n// } else {\n//     console.warn(\"[withGtagPhoneTracking] window.gtag function also not found.\");\n// }\n}// IMPORTANT: Execute the original onClick handler passed in props, if one exists.\n// This ensures that the link's default behavior (e.g., navigating to the 'tel:' link) still occurs.\nif(props.onClick){console.log(\"[withGtagPhoneTracking] Executing original onClick handler.\");props.onClick(event)// Pass the event object along\n;}else{console.log(\"[withGtagPhoneTracking] No original onClick handler found in props.\");}};// Render the original Component that was passed in\n// Spread all original props onto it ({...props})\n// BUT override the onClick prop with our custom handleClick function\nreturn /*#__PURE__*/_jsx(Component,{ref:ref,...props,onClick:handleClick});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withGtagPhoneTracking\":{\"type\":\"reactHoc\",\"name\":\"withGtagPhoneTracking\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TrackPhoneClick.map"],"mappings":"gIAKG,SAAgB,EAAsB,EAAU,CACnD,OAAoB,GAAY,EAAM,IAAM,CAE5C,IAAM,EAAY,GAAO,CAEzB,GAF0B,QAAQ,IAAI,gFAAgF,IAAmB,CAEtI,OAAO,EAAO,wBAAyB,WAAY,GAAG,CAEzD,EAAO,uBAAuB,EAAiB,CAAC,QAAQ,IAAI,iEAAiE,EAAiB,IAAI,OAAQ,EAAM,CAAC,QAAQ,MAAM,uEAAuE,EAAM,MAG5P,QAAQ,KAAK,6IAAgJ,CAQ1J,EAAM,SAAS,QAAQ,IAAI,8DAA8D,CAAC,EAAM,QAAQ,EAAM,EAC1G,QAAQ,IAAI,sEAAsE,EAGzF,OAAoB,EAAK,EAAU,CAAK,MAAI,GAAG,EAAM,QAAQ,EAAY,CAAC,EAAG,wBA3BlC,IAA8B,CACnE,EAAiB"}