{"version":3,"file":"EndCustomerForm.QcA5fmGe.mjs","names":["React.useState","React.useRef"],"sources":["https:/framerusercontent.com/modules/cA1q7Fx1PhmKeySlHULS/ATOv316APVmy2hNBdxI3/EndCustomerForm.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";export function WebAppEmbed({label,lang,formId}){// State to hold the dynamic height of the iframe content\nconst[iframeHeight,setIframeHeight]=React.useState(\"600px\");const[isLoading,setIsLoading]=React.useState(true);// Create a ref to get direct access to the iframe DOM element\nconst iframeRef=React.useRef(null);// This effect runs once to set up a listener for messages from the iframe\nReact.useEffect(()=>{const handleMessage=event=>{if((event.data?.type===\"heightUpdate\"||event.data?.type===\"form-resize\")&&event.data.height){// Add a small buffer\nconst heightWithBuffer=event.data.height+10;const minHeight=600;// Always take the new height (with min guard)\nlet newHeight=Math.max(minHeight,heightWithBuffer);// Round up\nnewHeight=Math.ceil(newHeight);setIframeHeight(newHeight+\"px\");setIsLoading(false);console.debug(`[WebAppEmbed] Updating iframe height: ${newHeight}px`);}};window.addEventListener(\"message\",handleMessage);return()=>{window.removeEventListener(\"message\",handleMessage);};},[]);// Periodically request iframe height\nReact.useEffect(()=>{const intervalId=setInterval(()=>{requestIframeHeight();},2e3);return()=>clearInterval(intervalId);},[]);const requestIframeHeight=()=>{const iframe=iframeRef.current;if(iframe&&iframe.contentWindow){try{iframe.contentWindow.postMessage({type:\"requestHeight\"},\"*\");iframe.contentWindow.postMessage({type:\"viewportUpdate\",isMobile:window.innerWidth<640},\"*\");}catch(e){console.error(\"Error requesting iframe height:\",e);}}};const handleIframeLoad=()=>{setTimeout(()=>{requestIframeHeight();setIsLoading(false);},500);};React.useEffect(()=>{const handleResize=()=>{requestIframeHeight();};window.addEventListener(\"resize\",handleResize);return()=>window.removeEventListener(\"resize\",handleResize);},[]);// Construct URL (you can make this dynamic if needed with formId/lang/label)\nconst url=`https://formbuilder-v-9-final-2-partnerscaile.replit.app/embed?form=8`;return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",position:\"relative\",backgroundColor:\"#f9fafb\",borderRadius:\"8px\",overflow:\"hidden\"},children:[isLoading&&/*#__PURE__*/_jsxs(\"div\",{style:{position:\"absolute\",top:\"50%\",left:\"50%\",transform:\"translate(-50%, -50%)\",zIndex:1,display:\"flex\",alignItems:\"center\",gap:\"8px\",color:\"#73FF14\",fontSize:\"14px\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{width:\"20px\",height:\"20px\",border:\"2px solid #e5e7eb\",borderTop:\"2px solid #3b82f6\",borderRadius:\"50%\",animation:\"spin 1s linear infinite\"}}),\"Loading form...\"]}),/*#__PURE__*/_jsx(\"iframe\",{ref:iframeRef,id:\"embeddedWebApp\",src:url,style:{width:\"100%\",height:iframeHeight,border:\"none\",borderRadius:\"8px\",boxShadow:\"0 4px 12px rgba(0,0,0,0.1)\",transition:\"height 0.3s ease-in-out\",opacity:isLoading?.7:1,backgroundColor:\"white\",display:\"block\"},title:\"Embedded Form\",onLoad:handleIframeLoad,sandbox:\"allow-scripts allow-forms allow-same-origin allow-popups\",loading:\"lazy\",scrolling:\"no\"}),/*#__PURE__*/_jsx(\"style\",{children:`\n                @keyframes spin {\n                    0% { transform: rotate(0deg); }\n                    100% { transform: rotate(360deg); }\n                }\n            `})]});}WebAppEmbed.defaultProps={label:\"general\",lang:\"EN\",formId:8};addPropertyControls(WebAppEmbed,{label:{type:ControlType.String,title:\"Label\"},lang:{type:ControlType.String,title:\"Lang\"},formId:{type:ControlType.Number,title:\"Form ID\"}});// ✅ Added default export so Framer always finds it\nexport default WebAppEmbed;\nexport const __FramerMetadata__ = {\"exports\":{\"WebAppEmbed\":{\"type\":\"reactComponent\",\"name\":\"WebAppEmbed\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"default\":{\"type\":\"reactComponent\",\"name\":\"WebAppEmbed\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"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