{"version":3,"file":"NativeLeadTracking.B9YPKOO8.mjs","names":["Fragment","useRef","useState","__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","x","H","_e","J","de","newAttemptId","queueConfirmedLead","PRODUCTION_HOSTS","payload","MEASUREMENT_ID","profile","attempt","w","enqueue","_args","aiFeedback","decorate","style","feedback","content","children","args","withNativeLeadSuccess","setFeedback","confirmedCount","setConfirmedCount","inlineFeedback","AI_REPORT","onLoading","props","onError","onSuccess","acceptedAttempt","count","Component","withBookingLeadSuccess","BOOKING","withAiReportLeadSuccess","init_NativeLeadTracking"],"sources":["https:/framerusercontent.com/modules/Eh6N3Fo2eFCTNZ4j2dyJ/25nqCppUPnVBpG6NeYKb/NativeLeadTracking.js"],"sourcesContent":["import{createElement,forwardRef,Fragment,useRef,useState}from\"react\";/**\n * Attach exactly one override to the actual native Framer Form layer.\n * Framer's current runtime invokes onSuccess after its request is accepted and\n * before its configured redirect. This is not proof of email delivery or quality.\n * Do not also count /thank-you mounts, clicks or framer:formsubmit as leads.\n * The callback attachment must be verified in Framer preview before release.\n */const MEASUREMENT_ID=\"G-04V6H230Y2\";const PRODUCTION_HOSTS=new Set([\"teramok.us\",\"www.teramok.us\"]);const BOOKING={form_id:\"booking-request\",form_name:\"booking_request\",form_page:\"/book-a-call\",lead_source:\"booking_request\"};const AI_REPORT={form_id:\"ai-visibility-report-request\",form_name:\"ai_visibility_report\",form_page:\"/ai-visibility-report\",lead_source:\"ai_visibility_report\"};function newAttemptId(){try{if(typeof window!==\"undefined\"&&typeof window.crypto?.randomUUID===\"function\"){return window.crypto.randomUUID();}}catch{// A local deduplication nonce, not an authentication token.\n}return\"attempt-\"+Date.now().toString(36)+\"-\"+Math.random().toString(36).slice(2);}function queueConfirmedLead(profile,attempt){if(typeof window===\"undefined\")return;// Draft, editor, localhost and other subdomains must never send to live GA4.\nif(!PRODUCTION_HOSTS.has(window.location.hostname.toLowerCase()))return;const payload={send_to:MEASUREMENT_ID,...profile,// Random, non-PII debugging context. GA does not automatically dedupe it.\nsubmission_id:attempt.id};const w=window;if(typeof w.gtag===\"function\"){w.gtag(\"event\",\"generate_lead\",payload);return;}w.dataLayer=w.dataLayer||[];function enqueue(..._args){w.dataLayer.push(arguments);}// Keep the standard gtag queue shape; do not grant consent or load a tag.\nenqueue(\"event\",\"generate_lead\",payload);}function aiFeedback(children,feedback){const decorate=content=>{const style={gridColumn:\"1 / -1\",padding:\"14px 16px\",borderRadius:16,background:feedback===\"error\"?\"rgba(180,55,35,.08)\":\"rgba(46,125,80,.1)\",color:feedback===\"error\"?\"#843A2B\":\"#1F5A37\",fontSize:14.5,lineHeight:1.5,margin:0};if(feedback===\"sent\"){return /*#__PURE__*/createElement(\"p\",{role:\"status\",style},\"Thank you. We reply from info@teramok.us within one business day to confirm fit and ask three short questions. The report follows in about a week.\");}if(feedback===\"error\"){return /*#__PURE__*/createElement(Fragment,null,content,/*#__PURE__*/createElement(\"p\",{role:\"alert\",style},\"We couldn’t confirm this request. Please try again, or \",/*#__PURE__*/createElement(\"a\",{href:\"mailto:info@teramok.us\",style:{color:\"inherit\",textDecoration:\"underline\"}},\"email info@teramok.us\"),\".\"));}return content;};// Native Framer Form currently calls children(state). Preserve that render\n// function contract, including its arguments, rather than passing a raw node.\nreturn typeof children===\"function\"?(...args)=>decorate(children(...args)):decorate(children);}function withNativeLeadSuccess(Component,profile){return /*#__PURE__*/forwardRef(function NativeLeadSuccess(props,ref){const attempt=useRef(null);const[feedback,setFeedback]=useState(\"idle\");const[confirmedCount,setConfirmedCount]=useState(0);const inlineFeedback=profile.form_id===AI_REPORT.form_id;const onLoading=(...args)=>{// Only the native request lifecycle arms a potential success event.\n// A second loading callback replaces the pending attempt; no event is\n// sent until success. The native Form itself prevents parallel POSTs.\nattempt.current={id:newAttemptId()};if(inlineFeedback)setFeedback(\"idle\");return props.onLoading?.(...args);};const onError=(...args)=>{attempt.current=null;if(inlineFeedback)setFeedback(\"error\");return props.onError?.(...args);};const onSuccess=(...args)=>{const acceptedAttempt=attempt.current;// Consume before analytics or another callback can re-enter.\nattempt.current=null;if(acceptedAttempt){setConfirmedCount(count=>count+1);if(inlineFeedback)setFeedback(\"sent\");try{queueConfirmedLead(profile,acceptedAttempt);}catch{// Analytics must not turn an accepted native request into an\n// error or block the existing callback and native redirect.\n}}return props.onSuccess?.(...args);};return /*#__PURE__*/createElement(Component,{...props,ref,\"data-teramok-form\":profile.form_id,\"data-teramok-confirmed-count\":confirmedCount,children:inlineFeedback?aiFeedback(props.children,feedback):props.children,onLoading,onSuccess,onError});});}export function withBookingLeadSuccess(Component){return withNativeLeadSuccess(Component,BOOKING);}export function withAiReportLeadSuccess(Component){return withNativeLeadSuccess(Component,AI_REPORT);}\nexport const __FramerMetadata__ = {\"exports\":{\"withBookingLeadSuccess\":{\"type\":\"reactHoc\",\"name\":\"withBookingLeadSuccess\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAiReportLeadSuccess\":{\"type\":\"reactHoc\",\"name\":\"withAiReportLeadSuccess\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./NativeLeadTracking.map"],"mappings":"A,8IAMmY,SAASY,GAAc,CAAC,GAAG,CAAC,GAAUN,IAAS,QAAa,OAAOA,EAAO,QAAQ,YAAa,WAAY,OAAOA,EAAO,OAAO,WAAW,CAAG,MAAM,CACvhB,CAAC,MAAM,WAAW,KAAK,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,CAAE,CAAC,SAASO,EAAmB,EAAQ,EAAQ,CAC/H,GAD0IP,IAAS,QAChJ,CAACQ,EAAiB,IAAIR,EAAO,SAAS,SAAS,YAAY,CAAC,EAAE,OAAO,IAAMS,EAAQ,CAAC,QAAQC,EAAe,GAAGC,EACjH,cAAcC,EAAQ,EAAE,EAAQC,EAAEb,EAAO,GAAG,OAAOa,EAAE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