{"version":3,"file":"WhatsAppButton.Ba7WPCQZ.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/a3e5Wr14ppSVB2ctXdF0/ARaROO87bnszfWS9aI5j/WhatsAppButton.js"],"sourcesContent":["// WhatsApp button that appears with animation when user scrolls the page\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{motion,useScroll,useTransform}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useState,useRef,startTransition}from\"react\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function WhatsAppButton(props){const{phoneNumber=\"1234567890\",message=\"Hello!\",backgroundColor=\"#25D366\",iconColor=\"#FFFFFF\",size=60,bottomOffset=20,rightOffset=20,showShadow=true,scrollThreshold=100}=props;const{scrollY}=useScroll();const[isFooterVisible,setIsFooterVisible]=useState(false);const footerRef=useRef(null);useEffect(()=>{if(typeof window===\"undefined\")return;const footer=document.querySelector(\"#footer\");if(footer){footerRef.current=footer;const observer=new IntersectionObserver(entries=>{entries.forEach(entry=>{startTransition(()=>{setIsFooterVisible(entry.isIntersecting);});});},{threshold:.1});observer.observe(footer);return()=>observer.disconnect();}},[]);const opacity=useTransform(scrollY,[0,scrollThreshold],[0,1]);const scale=useTransform(scrollY,[0,scrollThreshold],[.5,1]);const handleClick=()=>{if(typeof window!==\"undefined\"){const cleanedPhone=phoneNumber.replace(/\\D/g,\"\");const encodedMessage=encodeURIComponent(message);const whatsappUrl=`https://wa.me/${cleanedPhone}?text=${encodedMessage}`;window.open(whatsappUrl,\"_blank\");}};return /*#__PURE__*/_jsx(motion.button,{onClick:handleClick,style:{position:\"fixed\",bottom:bottomOffset,right:rightOffset,width:size,height:size,borderRadius:\"50%\",backgroundColor,border:\"none\",cursor:\"pointer\",display:isFooterVisible?\"none\":\"flex\",alignItems:\"center\",justifyContent:\"center\",zIndex:9999,boxShadow:showShadow?\"0 4px 12px rgba(0, 0, 0, 0.15)\":\"none\",opacity,scale},whileHover:{scale:1.1},whileTap:{scale:.95},\"aria-label\":\"Contact us on WhatsApp\",children:/*#__PURE__*/_jsx(\"svg\",{width:size*.6,height:size*.6,viewBox:\"0 0 24 24\",fill:\"none\",xmlns:\"http://www.w3.org/2000/svg\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z\",fill:iconColor})})});}addPropertyControls(WhatsAppButton,{phoneNumber:{type:ControlType.String,title:\"Phone Number\",defaultValue:\"1234567890\",placeholder:\"1234567890\"},message:{type:ControlType.String,title:\"Default Message\",defaultValue:\"Hello!\",displayTextArea:true},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#25D366\"},iconColor:{type:ControlType.Color,title:\"Icon Color\",defaultValue:\"#FFFFFF\"},size:{type:ControlType.Number,title:\"Size\",defaultValue:60,min:40,max:100,step:5,unit:\"px\"},bottomOffset:{type:ControlType.Number,title:\"Bottom\",defaultValue:20,min:0,max:200,step:5,unit:\"px\"},rightOffset:{type:ControlType.Number,title:\"Right\",defaultValue:20,min:0,max:200,step:5,unit:\"px\"},scrollThreshold:{type:ControlType.Number,title:\"Scroll Distance\",defaultValue:100,min:0,max:500,step:10,unit:\"px\"},showShadow:{type:ControlType.Boolean,title:\"Shadow\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"WhatsAppButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WhatsAppButton.map"],"mappings":"6QAIG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,cAAY,aAAa,UAAQ,SAAS,kBAAgB,UAAU,YAAU,UAAU,OAAK,GAAG,eAAa,GAAG,cAAY,GAAG,aAAW,GAAK,kBAAgB,KAAK,EAAW,CAAC,WAAS,GAAW,CAAM,CAAC,EAAgB,GAAoBA,EAAS,GAAM,CAAO,EAAUC,EAAO,KAAK,CAAC,MAAc,CAAC,GAAU,IAAS,OAAY,OAAO,IAAM,EAAO,SAAS,cAAc,UAAU,CAAC,GAAG,EAAO,CAAC,EAAU,QAAQ,EAAO,IAAM,EAAS,IAAI,qBAAqB,GAAS,CAAC,EAAQ,QAAQ,GAAO,CAAC,MAAoB,CAAC,EAAmB,EAAM,eAAe,EAAG,EAAG,EAAG,CAAC,UAAU,GAAG,CAAC,CAA0B,OAAzB,EAAS,QAAQ,EAAO,KAAW,EAAS,YAAY,GAAI,EAAE,CAAC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