{"version":3,"file":"HotmartTracking.B1edEPwS.mjs","names":["useState","useCallback","useMemo","startTransition","useRef"],"sources":["https:/framerusercontent.com/modules/6r5yMwBU5eoPvBowDDK3/HV15tlCSDjhDGjFD7imL/HotmartSalesEmbed.js","https:/framerusercontent.com/modules/4UKr6BIXeJmA05qLZrDF/hNKaHPbNyw766GP3O5dj/HotmartTracking.js"],"sourcesContent":["// Create a new Framer code component named HotmartSalesEmbed that embeds a Hotmart checkout/sales URL in an iframe, with controls for url, title, min heights by breakpoint, border radius, background color, and optional fallback link; render responsively and safely in static/editor contexts with a placeholder.\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useCallback,useEffect,useMemo,useState,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function HotmartSalesEmbed(props){const{url,title,minHeightDesktop,minHeightTablet,minHeightPhone,borderRadius,backgroundColor,showFallbackLink,style}=props;const isStatic=useIsStaticRenderer();const[viewportWidth,setViewportWidth]=useState(1200);const[iframeFailed,setIframeFailed]=useState(false);const updateViewportWidth=useCallback(()=>{if(typeof window!==\"undefined\"){startTransition(()=>setViewportWidth(window.innerWidth));}},[]);useEffect(()=>{if(typeof window!==\"undefined\"){updateViewportWidth();window.addEventListener(\"resize\",updateViewportWidth);return()=>window.removeEventListener(\"resize\",updateViewportWidth);}},[updateViewportWidth]);const minHeight=useMemo(()=>{if(viewportWidth<810)return minHeightPhone;if(viewportWidth<1200)return minHeightTablet;return minHeightDesktop;},[viewportWidth,minHeightDesktop,minHeightTablet,minHeightPhone]);const resolvedHeight=useMemo(()=>{const rawHeight=style?.height;if(typeof rawHeight===\"number\")return Math.max(rawHeight,minHeight);if(typeof rawHeight===\"string\"){const parsed=Number.parseFloat(rawHeight);if(Number.isFinite(parsed)&&rawHeight.includes(\"px\")){return Math.max(parsed,minHeight);}}return minHeight;},[style?.height,minHeight]);const placeholder=/*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",minHeight,borderRadius,background:backgroundColor,border:\"1px solid #EEEEEE\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",color:\"#000000\",fontSize:14,lineHeight:1.2,textAlign:\"center\",padding:16,boxSizing:\"border-box\"},children:\"Hotmart checkout embed\"});const shouldShowPlaceholder=isStatic||iframeFailed;return /*#__PURE__*/_jsxs(\"div\",{style:{...style,position:\"relative\",width:\"100%\",minHeight:resolvedHeight,height:resolvedHeight,boxSizing:\"border-box\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",minHeight:resolvedHeight,height:\"100%\",background:backgroundColor,borderRadius,overflow:\"hidden\",display:\"flex\",boxSizing:\"border-box\"},children:shouldShowPlaceholder?placeholder:/*#__PURE__*/_jsx(\"iframe\",{title:title,src:url,loading:\"lazy\",allow:\"payment *; fullscreen\",allowFullScreen:true,referrerPolicy:\"strict-origin-when-cross-origin\",onError:()=>startTransition(()=>setIframeFailed(true)),style:{width:\"100%\",minHeight:resolvedHeight,height:\"100%\",flex:1,border:\"none\",display:\"block\",background:backgroundColor}})}),showFallbackLink?/*#__PURE__*/_jsx(\"a\",{href:url,target:\"_blank\",rel:\"noreferrer\",style:{display:\"inline-block\",marginTop:8,fontSize:13,color:\"#000000\",textDecoration:\"underline\"},children:\"Abrir checkout em nova aba\"}):null]});}addPropertyControls(HotmartSalesEmbed,{url:{type:ControlType.String,title:\"URL\",defaultValue:\"https://pay.hotmart.com/Q106666373V?checkoutMode=10\"},title:{type:ControlType.String,title:\"Title\",defaultValue:\"Hotmart Checkout\"},minHeightDesktop:{type:ControlType.Number,title:\"Min H Desk\",defaultValue:1040,min:240,max:2e3,step:10,unit:\"px\"},minHeightTablet:{type:ControlType.Number,title:\"Min H Tab\",defaultValue:920,min:240,max:2e3,step:10,unit:\"px\"},minHeightPhone:{type:ControlType.Number,title:\"Min H Phone\",defaultValue:840,min:240,max:2e3,step:10,unit:\"px\"},borderRadius:{type:ControlType.BorderRadius,title:\"Radius\",defaultValue:\"0px\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},showFallbackLink:{type:ControlType.Boolean,title:\"Fallback Link\",defaultValue:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HotmartSalesEmbed\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HotmartSalesEmbed.map","import{jsx as _jsx}from\"react/jsx-runtime\";import{useTracking}from\"framer\";import{forwardRef,useEffect,useRef}from\"react\";/**\n * Dispara \"checkout-iniciado\" quando o visitante clica DENTRO do iframe do\n * checkout Hotmart. O embed é cross-origin e NÃO emite eventos de pagamento por\n * postMessage (confirmado em compra real aprovada), então o único sinal\n * client-side de engajamento é o foco entrar no iframe: nesse instante a janela\n * pai perde o foco e document.activeElement passa a ser o <iframe>.\n *\n * Fica no nó do embed, na própria página testada. Só adiciona um listener no\n * window e repassa o componente intacto — não interfere no checkout.\n */const EVENT=\"checkout-iniciado\";export function withCheckoutTracking(Component){return /*#__PURE__*/forwardRef(function CheckoutTracking(props,ref){const track=useTracking();const fired=useRef(false);useEffect(()=>{if(typeof window===\"undefined\")return;const onBlur=()=>{const el=document.activeElement;if(!el||el.tagName!==\"IFRAME\")return;if(!(el.src||\"\").includes(\"hotmart\"))return;if(fired.current)return;fired.current=true;track(EVENT);};window.addEventListener(\"blur\",onBlur,true);return()=>window.removeEventListener(\"blur\",onBlur,true);},[track]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withCheckoutTracking\":{\"type\":\"reactHoc\",\"name\":\"withCheckoutTracking\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceM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