{"version":3,"file":"PopUpBanner.C5UwtPCZ.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/sKK7PFk7W0xgzbYaQWyh/lqHkdnQeB9CAqy3NzcOM/PopUpBanner.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{ControlType,RenderTarget,addPropertyControls}from\"framer\";import{useEffect,useState,useRef}from\"react\";/**\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n * @framerDisableUnlink\n *\n */export default function PopUpBanner(props){const containerRef=useRef(null);const[zIndexMessage,setZIndexMessage]=useState(\"\");const{showInEdtior,fontTitle,frequencyToShow,fontSubtitle,title,subtitle,buttonText,buttonColor,fontButton,delay,link,showZIndexMessage}=props;const[isVisible,setIsVisible]=useState(false);const[isAnimating,setIsAnimating]=useState(false);const closePopup=()=>{setIsVisible(false);};const localStorageKey=\"bannerflex_lastVisitTimestamp\";const isOnCanvas=RenderTarget.current()===RenderTarget.canvas;const showOnCanvas=isOnCanvas&&!showInEdtior;useEffect(()=>{if(RenderTarget.current()===RenderTarget.canvas){const checkZIndex=()=>{const parent=containerRef.current?.parentElement;if(parent){// Check both immediate parent and grandparent\nconst elementsToCheck=[parent,parent.parentElement].filter(el=>el!==null);let foundZIndex=false;for(const element of elementsToCheck){const computedStyle=window.getComputedStyle(element);const zIndex=computedStyle.zIndex;// If zIndex is auto or empty, treat as 0\nconst zIndexValue=zIndex===\"auto\"||!zIndex?0:parseInt(zIndex);// Only show warning if zIndex is less than 10\nif(!isNaN(zIndexValue)&&zIndexValue<10){setZIndexMessage(\"Setting the zIndex of parent container to 10 or more is recommended for proper layering\\nRight sidebar in the editor -> Styles -> Add new -> Z index -> Set to 10\");foundZIndex=true;break;}else if(!isNaN(zIndexValue)&&zIndexValue>=10){// If we find a zIndex >= 10, clear any existing message\nsetZIndexMessage(\"\");foundZIndex=true;break;}}if(!foundZIndex){setZIndexMessage(\"Setting the zIndex of parent container to 10 or more is recommended for proper layering\\nRight sidebar in the editor -> Styles -> Add new -> Z index -> Set to 10\");}}else{//console.log('No parent element found')\n}};// Initial check\ncheckZIndex();// Set up interval to check z-index every 2 seconds\nconst interval=setInterval(checkZIndex,4e3);return()=>{clearInterval(interval);};}},[]);useEffect(()=>{//if (!isOnCanvas) return\nconst timer=setTimeout(()=>{const now=Date.now();const lastVisit=localStorage.getItem(localStorageKey);if(isOnCanvas){togglePopup();return;}if(!lastVisit||now-parseInt(lastVisit,10)>frequencyToShow*60*60*1e3){togglePopup();localStorage.setItem(localStorageKey,now.toString());}else{setIsVisible(false);}},delay*1e3);return()=>clearTimeout(timer);},[frequencyToShow,delay,isOnCanvas]);const togglePopup=()=>{if(isVisible){// Trigger closing animation\nsetIsAnimating(true);setTimeout(()=>{setIsAnimating(false);setIsVisible(false);},300)// Match the transition duration\n;}else{setIsVisible(true);setIsAnimating(true);setTimeout(()=>setIsAnimating(false),300)// Ensure smooth opening\n;}};if(!isVisible)return null;if(showOnCanvas)return null;const currentStyle=isVisible?isAnimating?{...popupStyles.base,...popupStyles.closing}:{...popupStyles.base,...popupStyles.open}:popupStyles.base;const modalContentStyles={base:{transition:\"transform 300ms ease\",transform:\"translateY(0)\"},open:{transform:\"translateY(0)\"},closing:{transform:\"translateY(-20px)\"}};return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:currentStyle,children:[zIndexMessage&&showInEdtior&&showZIndexMessage&&/*#__PURE__*/_jsx(\"div\",{style:messageStyle,children:zIndexMessage}),/*#__PURE__*/_jsxs(\"div\",{style:{...contentStyles,...isVisible?isAnimating?modalContentStyles.closing:modalContentStyles.open:modalContentStyles.base},children:[/*#__PURE__*/_jsx(\"button\",{style:closeButtonStyles,onClick:closePopup,children:\"\\xd7\"}),/*#__PURE__*/_jsx(\"h2\",{style:{...fontTitle,...headingStyle},children:title}),/*#__PURE__*/_jsx(\"p\",{style:{...fontSubtitle},children:subtitle}),/*#__PURE__*/_jsx(\"a\",{style:{...buttonStyles,...{backgroundColor:buttonColor},...fontButton},href:link,children:buttonText})]})]});}PopUpBanner.defaultProps={showInEdtior:true,title:\"Don't Miss Out!\",subtitle:\"Join now to get exclusive updates and offers.\",buttonText:\"Join now\",delay:0,link:\"https://example.com\",showZIndexMessage:true};addPropertyControls(PopUpBanner,{showInEdtior:{title:\"Show in editor\",type:ControlType.Boolean},title:{type:ControlType.String,title:\"Title\"},subtitle:{type:ControlType.String,title:\"Title\"},buttonText:{type:ControlType.String,title:\"Button Text\"},fontTitle:{type:ControlType.Font,controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:14,lineHeight:1.4}},fontSubtitle:{type:ControlType.Font,controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:14,lineHeight:1.4}},fontButton:{type:ControlType.Font,controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:14,lineHeight:1.4}},buttonColor:{type:ControlType.Color,defaultValue:\"#007BFF\"},frequencyToShow:{title:\"Frequency to show (hrs)\",type:ControlType.Number,defaultValue:0},delay:{title:\"Delay to show (secs)\",type:ControlType.Number,defaultValue:0},link:{type:ControlType.Link,title:\"Button Link\",defaultValue:\"https://example.com\"},showZIndexMessage:{type:ControlType.Boolean,title:\"Show Z-Index Message\",defaultValue:true}});const headingStyle={margin:0};const contentStyles={backgroundColor:\"#fff\",borderRadius:\"8px\",padding:\"24px\",maxWidth:\"400px\",boxShadow:\"0 4px 6px rgba(0, 0, 0, 0.1)\",textAlign:\"center\",display:\"flex\",flexDirection:\"column\",gap:\"12px\",justifyContent:\"center\",alignItems:\"center\",position:\"relative\",transform:\"translateY(0)\"};const buttonStyles={backgroundColor:\"#007BFF\",color:\"#fff\",padding:\"10px 20px\",border:\"none\",borderRadius:\"4px\",cursor:\"pointer\",fontSize:\"16px\"};const closeButtonStyles={position:\"absolute\",top:\"10px\",right:\"10px\",backgroundColor:\"transparent\",border:\"none\",fontSize:\"18px\",cursor:\"pointer\",zIndex:1001};const popupStyles={base:{position:\"fixed\",top:0,left:0,width:\"100%\",height:\"100%\",backgroundColor:\"rgba(0, 0, 0, 0.2)\",display:\"flex\",justifyContent:\"center\",alignItems:\"center\",opacity:0,visibility:\"hidden\",transition:\"opacity 300ms ease\",zIndex:1e3},open:{opacity:1,visibility:\"visible\"},closing:{opacity:0}};const messageStyle={position:\"absolute\",top:\"50%\",left:\"50%\",transform:\"translate(-50%, -50%)\",backgroundColor:\"#ff9800\",color:\"white\",padding:\"8px 16px\",borderRadius:\"4px\",fontSize:\"14px\",zIndex:1e3,pointerEvents:\"none\",textAlign:\"center\",maxWidth:\"80%\",boxShadow:\"0 2px 4px rgba(0,0,0,0.2)\"};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PopUpBanner\",\"slots\":[],\"annotations\":{\"framerDisableUnlink\":\"*\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PopUpBanner.map"],"mappings":"oNAMG,SAAwB,EAAY,EAAM,CAAC,IAAM,EAAaA,EAAO,KAAK,CAAM,CAAC,EAAc,GAAkBC,EAAS,GAAG,CAAM,CAAC,eAAa,YAAU,kBAAgB,eAAa,QAAM,WAAS,aAAW,cAAY,aAAW,QAAM,OAAK,qBAAmB,EAAW,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAM,CAAC,EAAY,GAAgBA,EAAS,GAAM,CAAO,MAAe,CAAC,EAAa,GAAM,EAAS,EAAgB,gCAAsC,EAAW,EAAa,SAAS,GAAG,EAAa,OAAa,EAAa,GAAY,CAAC,EAAa,MAAc,CAAC,GAAG,EAAa,SAAS,GAAG,EAAa,OAAO,CAAC,IAAM,MAAgB,CAAC,IAAM,EAAO,EAAa,SAAS,cAAc,GAAG,EAAO,CAC/sB,IAAM,EAAgB,CAAC,EAAO,EAAO,cAAc,CAAC,OAAO,GAAI,IAA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