{"version":3,"file":"Embed.QNlorCSb.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/fUEuiEFkE7cXIJCSY5V0/gOGUKNa8H650eqwppFn1/Embed.js"],"sourcesContent":["// Simple embed component for Epitheliapro form script\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function Embed(props){const{scriptUrl=\"https://www.epitheliapro.com/forms/2149542865/embed.js\",thankYouMessage,thankYouFont,thankYouColor}=props;const iframeRef=useRef(null);const[isSubmitted,setIsSubmitted]=useState(false);const[iframeHeight,setIframeHeight]=useState(600);useEffect(()=>{if(typeof window===\"undefined\"||!iframeRef.current){return;}const iframe=iframeRef.current;const iframeDoc=iframe.contentDocument||iframe.contentWindow?.document;if(!iframeDoc)return;iframeDoc.open();iframeDoc.write(`\n            <!DOCTYPE html>\n            <html>\n            <head>\n                <meta charset=\"utf-8\">\n                <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n                <style>\n                    body {\n                        margin: 0;\n                        padding: 0;\n                        background-color: transparent;\n                        overflow: auto;\n                        max-width: 100%;\n                    }\n                    * {\n                        max-width: 100%;\n                        box-sizing: border-box;\n                    }\n                    form, form * {\n                        max-width: 100% !important;\n                    }\n                </style>\n            </head>\n            <body>\n                <script src=\"${scriptUrl}\"></script>\n                <script>\n                    // Send height updates to parent\n                    function updateHeight() {\n                        const height = document.body.scrollHeight;\n                        window.parent.postMessage({ type: 'resize', height: height }, '*');\n                    }\n                    \n                    // Update height on load and when content changes\n                    window.addEventListener('load', updateHeight);\n                    setTimeout(updateHeight, 100);\n                    setTimeout(updateHeight, 500);\n                    setTimeout(updateHeight, 1000);\n                    \n                    const resizeObserver = new ResizeObserver(updateHeight);\n                    resizeObserver.observe(document.body);\n                    \n                    // Listen for form submissions\n                    document.addEventListener('submit', function(e) {\n                        // Don't prevent default - let form submit normally\n                        setTimeout(function() {\n                            window.parent.postMessage({ type: 'formSubmitted' }, '*');\n                        }, 500);\n                    }, true);\n\n                    // Also listen for any success indicators after submission\n                    const observer = new MutationObserver(function(mutations) {\n                        updateHeight();\n                        mutations.forEach(function(mutation) {\n                            mutation.addedNodes.forEach(function(node) {\n                                if (node.nodeType === 1) {\n                                    const text = node.textContent || '';\n                                    const className = node.className || '';\n                                    // Check for common success indicators\n                                    if (text.toLowerCase().includes('thank') || \n                                        text.toLowerCase().includes('success') ||\n                                        text.toLowerCase().includes('merci') ||\n                                        text.toLowerCase().includes('submitted') ||\n                                        className.includes('success') ||\n                                        className.includes('thank')) {\n                                        window.parent.postMessage({ type: 'formSubmitted' }, '*');\n                                    }\n                                }\n                            });\n                            // Check if form disappeared (common pattern)\n                            if (mutation.removedNodes.length > 0) {\n                                mutation.removedNodes.forEach(function(node) {\n                                    if (node.nodeName === 'FORM') {\n                                        setTimeout(function() {\n                                            window.parent.postMessage({ type: 'formSubmitted' }, '*');\n                                        }, 300);\n                                    }\n                                });\n                            }\n                        });\n                    });\n                    observer.observe(document.body, { childList: true, subtree: true });\n                </script>\n            </body>\n            </html>\n        `);iframeDoc.close();},[scriptUrl]);useEffect(()=>{if(typeof window===\"undefined\")return;const handleMessage=event=>{if(event.data?.type===\"formSubmitted\"){startTransition(()=>setIsSubmitted(true));}else if(event.data?.type===\"resize\"){if(event.data?.height){startTransition(()=>setIframeHeight(event.data.height));}}};window.addEventListener(\"message\",handleMessage);return()=>window.removeEventListener(\"message\",handleMessage);},[]);if(isSubmitted){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",padding:20,position:\"relative\",backgroundColor:\"transparent\"},children:/*#__PURE__*/_jsx(\"div\",{style:{...thankYouFont,color:thankYouColor,textAlign:\"center\",maxWidth:\"100%\"},children:thankYouMessage})});}return /*#__PURE__*/_jsx(\"iframe\",{ref:iframeRef,style:{width:\"100%\",height:`${iframeHeight}px`,border:\"none\",position:\"relative\",backgroundColor:\"transparent\"},title:\"Embedded Form\"});}addPropertyControls(Embed,{scriptUrl:{type:ControlType.String,title:\"Script URL\",defaultValue:\"https://www.epitheliapro.com/forms/2149542865/embed.js\"},thankYouMessage:{type:ControlType.String,title:\"Thank You Message\",defaultValue:\"🎉 Merci infiniment !\\n\\nVotre message a bien \\xe9t\\xe9 envoy\\xe9. Nous reviendrons vers vous tr\\xe8s bient\\xf4t.\",displayTextArea:true},thankYouFont:{type:ControlType.Font,title:\"Message Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"22px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"}},thankYouColor:{type:ControlType.Color,title:\"Message Color\",defaultValue:\"#000000\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Embed\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Embed.map"],"mappings":"8MAIG,SAAwB,EAAM,EAAM,CAAC,GAAK,CAAC,YAAU,yDAAyD,kBAAgB,eAAa,iBAAe,EAAY,EAAUA,EAAO,KAAK,CAAM,CAAC,EAAY,GAAgBC,EAAS,GAAM,CAAM,CAAC,EAAa,GAAiBA,EAAS,IAAI,CAoFmf,OApFlf,MAAc,CAAC,GAAU,IAAS,QAAa,CAAC,EAAU,QAAS,OAAQ,IAAM,EAAO,EAAU,QAAc,EAAU,EAAO,iBAAiB,EAAO,eAAe,SAAa,IAAiB,EAAU,MAAM,CAAC,EAAU,MAAM;;;;;;;;;;;;;;;;;;;;;;;;+BAwB5e,EAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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