{"version":3,"file":"Testbutton.-FvffwfK.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/RRhsCyW1E7ansSw6k6A2/gksKHm0ugi1woDLgIoDa/Testbutton.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";const FORM_ID=\"Is3sxpgD\";export function withTypeformPopup(Component){return props=>{const popupRef=useRef(null);// Charge le SDK officiel Typeform (JS + CSS) depuis le CDN, une seule fois.\n// On passe par le CDN et NON par npm : l'import `@typeform/embed` fait\n// planter le build de Framer (la cause du crash que tu as eu).\nuseEffect(()=>{if(!document.getElementById(\"tf-embed-css\")){const link=document.createElement(\"link\");link.id=\"tf-embed-css\";link.rel=\"stylesheet\";link.href=\"https://embed.typeform.com/next/css/popup.css\";document.head.appendChild(link);}if(!document.getElementById(\"tf-embed-js\")){const script=document.createElement(\"script\");script.id=\"tf-embed-js\";script.src=\"https://embed.typeform.com/next/embed.js\";script.async=true;document.body.appendChild(script);}},[]);const openPopup=(attempts=0)=>{const tf=window.tf;// Le script CDN peut ne pas être prêt au tout 1er clic : on réessaie\n// pendant ~2 s max. En pratique il est chargé bien avant.\nif(!tf?.createPopup){if(attempts<20){window.setTimeout(()=>openPopup(attempts+1),100);}return;}// Une seule instance de popup, réutilisée entre les clics.\nif(!popupRef.current){popupRef.current=tf.createPopup(FORM_ID,{size:90,hideHeaders:true,// >>> LA ligne qui débloque ta redirection <<<\n// Le SDK reçoit le message de redirect de Typeform, et \"_top\"\n// le fait naviguer sur TOUTE la page (et non à l'intérieur de\n// l'iframe). Ne PAS ajouter `autoClose` : il fermerait le popup\n// avant le redirect et le casserait.\nredirectTarget:\"_top\"});}popupRef.current.open();};return /*#__PURE__*/_jsx(Component,{...props,onClick:()=>openPopup()});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withTypeformPopup\":{\"type\":\"reactHoc\",\"name\":\"withTypeformPopup\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Testbutton.map"],"mappings":"uIAAwG,SAAgB,EAAkB,EAAU,CAAC,MAAO,IAAO,CAAC,IAAM,EAASA,EAAO,IAAI,EAG9L,MAAc,CAAC,GAAG,CAAC,SAAS,eAAe,cAAc,EAAE,CAAC,IAAM,EAAK,SAAS,cAAc,MAAM,EAAE,EAAK,GAAG,eAAe,EAAK,IAAI,aAAa,EAAK,KAAK,gDAAgD,SAAS,KAAK,YAAY,CAAI,CAAE,CAAC,GAAG,CAAC,SAAS,eAAe,aAAa,EAAE,CAAC,IAAM,EAAO,SAAS,cAAc,QAAQ,EAAE,EAAO,GAAG,cAAc,EAAO,IAAI,2CAA2C,EAAO,MAAM,GAAK,SAAS,KAAK,YAAY,CAAM,CAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAM,GAAW,EAAS,IAAI,CAAC,IAAM,EAAG,EAAO,GAEhgB,GAAG,CAAC,GAAI,YAAY,CAAI,EAAS,IAAI,EAAO,eAAe,EAAU,EAAS,CAAC,EAAE,GAAG,EAAG,MAAO,CAC9F,AAAsB,EAAS,UAAQ,EAAG,YAAY,EAAQ,CAAC,KAAK,GAAG,YAAY,GAKnF,eAAe,MAAM,CAAC,EAAG,EAAS,QAAQ,KAAK,CAAE,EAAE,OAAoB,EAAK,EAAU,CAAC,GAAG,EAAM,YAAY,EAAU,CAAC,CAAC,CAAE,CAAE,uBAXlF,IAAoC,EAAO,EAAQ"}