{"version":3,"file":"StickyRevealFooter.CAMHg85M.mjs","names":["useState","useRef","url"],"sources":["https:/framerusercontent.com/modules/IqDnOsdSCtRoy5BEfDvk/bmqCShOJNmecNsHfoGNh/StickyRevealFooter.js"],"sourcesContent":["// Smart Sticky Reveal Footer component that slides up when scrolling near bottom\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,useRef,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,AnimatePresence}from\"framer-motion\";/**\n * Smart Sticky Reveal Footer\n *\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 80\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function StickyRevealFooter(props){const{content,revealThreshold,animationSpeed,backgroundColor,textColor,padding,borderRadius,shadow,font,buttonText,buttonColor,buttonTextColor,showButton,buttonFont,linkDestination}=props;const[isVisible,setIsVisible]=useState(false);const[lastScrollY,setLastScrollY]=useState(0);const[scrollYWhenShown,setScrollYWhenShown]=useState(0);const isStatic=useIsStaticRenderer();function normalizeLink(raw){let v=\"\";if(!raw)return v;if(typeof raw===\"string\")v=raw.trim();else v=(raw.href||raw.url||\"\").trim();if(!v)return\"\";if(/^(https?:|mailto:|tel:|data:)/i.test(v))return v;if(/^\\/\\//.test(v))return`https:${v}`;// protocol-relative\nif(/^[a-z0-9.-]+\\.[a-z]{2,}([/:?#].*)?$/i.test(v))return`https://${v}`;// bare domain\nreturn v;// probably internal route; we'll still handle it\n}const url=normalizeLink(linkDestination);// One-shot guard to prevent double-opens (StrictMode / multiple events)\nconst openOnceRef=useRef(false);function openExternal(url){if(!url||openOnceRef.current)return;openOnceRef.current=true;const isHttp=/^https?:\\/\\//i.test(url);try{// Prefer Framer's opener inside editor/preview if present\n// @ts-ignore\nconst framer=window.framer;if(isHttp&&framer?.openExternalURL){framer.openExternalURL(url);return;}// Break out of iframe and open in new tab\nconst topWin=window.top??window;if(isHttp){topWin.open(url,\"_blank\",\"noopener,noreferrer\");}else{topWin.location.href=url;}}finally{// allow future clicks after a short cooldown\nsetTimeout(()=>openOnceRef.current=false,600);}}useEffect(()=>{if(isStatic||typeof window===\"undefined\"){startTransition(()=>setIsVisible(true));return;}const handleScroll=()=>{const currentScrollY=window.scrollY;const documentHeight=document.documentElement.scrollHeight;const windowHeight=window.innerHeight;const scrollPercentage=(currentScrollY+windowHeight)/documentHeight*100;// Check if user is at the very bottom of the page\nconst isAtBottom=currentScrollY+windowHeight>=documentHeight-50;// Hide banner if at the very bottom\nif(isAtBottom){startTransition(()=>setIsVisible(false));return;}// Show footer when scrolling down and near bottom\nif(scrollPercentage>=revealThreshold&&currentScrollY>lastScrollY){startTransition(()=>{setIsVisible(true);setScrollYWhenShown(currentScrollY);});}else if(currentScrollY<lastScrollY&&scrollYWhenShown-currentScrollY>200){startTransition(()=>setIsVisible(false));}setLastScrollY(currentScrollY);};window.addEventListener(\"scroll\",handleScroll,{passive:true});return()=>window.removeEventListener(\"scroll\",handleScroll);},[lastScrollY,revealThreshold,isStatic]);return /*#__PURE__*/_jsx(AnimatePresence,{children:(isVisible||isStatic)&&/*#__PURE__*/_jsxs(motion.div,{initial:{y:\"100%\"},animate:{y:0},exit:{y:\"100%\"},transition:{duration:animationSpeed,ease:\"easeOut\"},style:{position:\"fixed\",bottom:0,left:0,right:0,backgroundColor,color:textColor,padding:`${padding}px`,borderRadius:`${borderRadius}px ${borderRadius}px 0 0`,boxShadow:shadow?\"0 -4px 20px rgba(0, 0, 0, 0.1)\":\"none\",zIndex:1e3,display:\"flex\",alignItems:\"center\",justifyContent:\"space-between\",gap:\"20px\",...font},children:[/*#__PURE__*/_jsx(\"div\",{style:{flex:1},children:content}),showButton&&/*#__PURE__*/_jsx(\"button\",{type:\"button\",onClick:e=>{e.preventDefault();e.stopPropagation();// stop router hijack\nopenExternal(url);},onKeyDown:e=>{if(e.key===\"Enter\"||e.key===\" \"){e.preventDefault();e.stopPropagation();openExternal(url);}},style:{backgroundColor:buttonColor,color:buttonTextColor,border:\"none\",borderRadius:0,padding:\"12px 24px\",cursor:url?\"pointer\":\"default\",textDecoration:\"none\",display:\"inline-block\",// ensure it sits above any overlays\nposition:\"relative\",zIndex:9999,...buttonFont},\"aria-label\":`Open link ${url||\"\"}`,disabled:!url,children:buttonText})]})});}addPropertyControls(StickyRevealFooter,{content:{type:ControlType.String,title:\"Content\",defaultValue:\"🎉 Special offer! Get 20% off your first order. Limited time only!\",displayTextArea:true},revealThreshold:{type:ControlType.Number,title:\"Reveal Threshold\",defaultValue:80,min:50,max:95,step:5,unit:\"%\"},animationSpeed:{type:ControlType.Number,title:\"Animation Speed\",defaultValue:.3,min:.1,max:1,step:.1,unit:\"s\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#000000\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#FFFFFF\"},padding:{type:ControlType.Number,title:\"Padding\",defaultValue:20,min:10,max:40,step:2,unit:\"px\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:12,min:0,max:24,step:2,unit:\"px\"},shadow:{type:ControlType.Boolean,title:\"Shadow\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontSize:\"16px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.4em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},showButton:{type:ControlType.Boolean,title:\"Show Button\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},buttonText:{type:ControlType.String,title:\"Button Text\",defaultValue:\"Get Offer\",hidden:({showButton})=>!showButton},linkDestination:{type:ControlType.String,title:\"Link Destination\",defaultValue:\"https://google.com\",placeholder:\"https://example.com\",hidden:({showButton})=>!showButton},buttonColor:{type:ControlType.Color,title:\"Button Color\",defaultValue:\"#FFFFFF\",hidden:({showButton})=>!showButton},buttonTextColor:{type:ControlType.Color,title:\"Button Text Color\",defaultValue:\"#000000\",hidden:({showButton})=>!showButton},buttonFont:{type:ControlType.Font,title:\"Button Font\",defaultValue:{fontSize:\"14px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\",hidden:({showButton})=>!showButton}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"StickyRevealFooter\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerIntrinsicWidth\":\"400\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"80\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./StickyRevealFooter.map"],"mappings":"oRASG,SAAwB,EAAmB,EAAM,CAAC,GAAK,CAAC,UAAQ,kBAAgB,iBAAe,kBAAgB,YAAU,UAAQ,eAAa,SAAO,OAAK,aAAW,cAAY,kBAAgB,aAAW,aAAW,mBAAiB,EAAW,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAM,CAAC,EAAY,GAAgBA,EAAS,EAAE,CAAM,CAAC,EAAiB,GAAqBA,EAAS,EAAE,CAAO,EAAS,GAAqB,CAAC,SAAS,EAAc,EAAI,CAAC,IAAI,EAAE,GAE5c,OAFmd,GAAa,AAA2C,EAAxC,OAAO,GAAM,SAAW,EAAI,MAAM,EAAS,EAAI,MAAM,EAAI,KAAK,IAAI,MAAM,CAAK,EAAc,iCAAiC,KAAK,EAAE,CAAQ,EAAK,QAAQ,KAAK,EAAE,CAAO,SAAS,IAC/oB,uCAAuC,KAAK,EAAE,CAAO,WAAW,IAC5D,EAFijB,IAA1F,EAG7d,IAAM,EAAI,EAAc,EAAgB,CACnC,EAAYC,EAAO,GAAM,CAAC,SAAS,EAAa,EAAI,CAAC,GAAG,CAACC,GAAK,EAAY,QAAQ,OAAO,EAAY,QAAQ,GAAK,IAAM,EAAO,gBAAgB,KAAKA,EAAI,CAAC,G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