{"version":3,"file":"ExitIntent.D777dtsk.mjs","names":["useState","useRef","useEffect","startTransition","_jsxs","_jsx","__esmMin","init_npm_react_18_3_1","te","de","window","init_ssg_sandbox_shims","init_jsx_runtime","p","ce","_e","addPropertyControls","RenderTarget","ControlType","init_framer_ChujFWHC","ExitIntent","props","enabled","content","overlayColor","showOnce","enableDelay","delayDuration","title","message","buttonText","buttonBackgroundColor","buttonTextColor","showCloseButton","closeButtonColor","closeButtonBackgroundColor","isVisible","setIsVisible","hasTriggered","delayTimeout","handleMouseLeave","handleClose","c","init_ExitIntent"],"sources":["https:/framerusercontent.com/modules/MSsXEgBSBTCV6BgqANXI/XDuQYg6rADwjMcv3CApY/ExitIntent.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,useRef,startTransition}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * Exit Intent\n *\n * Triggers a customizable popup when the user's mouse leaves the viewport (e.g. to close the tab).\n * Connect any Frame to the \"Content\" property to display it as the popup.\n *\n * @framerIntrinsicWidth 200\n * @framerIntrinsicHeight 50\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ExitIntent(props){const{enabled,content,overlayColor,showOnce,enableDelay,delayDuration,title,message,buttonText,buttonBackgroundColor=\"#000\",buttonTextColor=\"#fff\",showCloseButton,closeButtonColor,closeButtonBackgroundColor=\"#fff\"}=props;const[isVisible,setIsVisible]=useState(false);const hasTriggered=useRef(false);const delayTimeout=useRef(null);useEffect(()=>{if(!enabled)return;// In canvas, we don't trigger\nif(RenderTarget.current()===RenderTarget.canvas)return;const handleMouseLeave=e=>{// Check if mouse left from the top\nif(e.clientY<=0){if(showOnce&&hasTriggered.current)return;if(enableDelay){delayTimeout.current=window.setTimeout(()=>{startTransition(()=>{setIsVisible(true);});hasTriggered.current=true;},delayDuration*1e3);}else{startTransition(()=>{setIsVisible(true);});hasTriggered.current=true;}}};document.addEventListener(\"mouseleave\",handleMouseLeave);return()=>{document.removeEventListener(\"mouseleave\",handleMouseLeave);if(delayTimeout.current){clearTimeout(delayTimeout.current);}};},[enabled,showOnce,enableDelay,delayDuration]);const handleClose=()=>{startTransition(()=>{setIsVisible(false);});};// Canvas view\nif(RenderTarget.current()===RenderTarget.canvas){return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",backgroundColor:\"#f0f0f0\",color:\"#888\",fontSize:12,borderRadius:8,border:\"1px dashed #ccc\",padding:8,textAlign:\"center\"},children:[\"Exit Intent Trigger\",/*#__PURE__*/_jsx(\"br\",{}),\"(Connect Content)\"]});}if(!isVisible)return null;if(typeof document===\"undefined\")return null;return /*#__PURE__*/_jsx(\"div\",{style:{position:\"fixed\",top:0,left:0,right:0,bottom:0,backgroundColor:overlayColor,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",zIndex:9999,pointerEvents:\"auto\"},onClick:handleClose,children:/*#__PURE__*/_jsxs(\"div\",{onClick:e=>e.stopPropagation(),style:{position:\"relative\"},children:[showCloseButton&&/*#__PURE__*/_jsx(\"div\",{onClick:handleClose,style:{position:\"absolute\",top:10,right:10,cursor:\"pointer\",zIndex:10,width:32,height:32,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",background:closeButtonBackgroundColor,borderRadius:\"50%\",color:closeButtonColor,boxShadow:\"0 2px 5px rgba(0,0,0,0.1)\"},children:/*#__PURE__*/_jsx(\"svg\",{width:\"12\",height:\"12\",viewBox:\"0 0 12 12\",fill:\"none\",xmlns:\"http://www.w3.org/2000/svg\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M1 1L11 11M1 11L11 1\",stroke:closeButtonColor,strokeWidth:\"2\",strokeLinecap:\"round\"})})}),content&&content.length>0?content:/*#__PURE__*/_jsxs(\"div\",{style:{background:\"white\",padding:40,borderRadius:20,boxShadow:\"0 10px 40px rgba(0,0,0,0.2)\",textAlign:\"center\",maxWidth:400,fontFamily:\"sans-serif\"},children:[/*#__PURE__*/_jsx(\"h2\",{style:{marginTop:0,marginBottom:10},children:title}),/*#__PURE__*/_jsx(\"p\",{style:{marginBottom:20,lineHeight:1.5,color:\"#666\"},children:message}),/*#__PURE__*/_jsx(\"button\",{onClick:handleClose,style:{background:buttonBackgroundColor,color:buttonTextColor,border:\"none\",padding:\"10px 20px\",borderRadius:8,cursor:\"pointer\",fontSize:16,fontWeight:600},children:buttonText})]})]})});}addPropertyControls(ExitIntent,{enabled:{type:ControlType.Boolean,title:\"Enabled\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"},enableDelay:{type:ControlType.Boolean,title:\"Enable Delay\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},delayDuration:{type:ControlType.Number,title:\"Delay\",defaultValue:2,min:0,max:10,step:.5,unit:\"s\",hidden:({enableDelay})=>!enableDelay},content:{type:ControlType.Slot,title:\"Content\",description:\"Connect a Frame to show as the popup\"},title:{type:ControlType.String,title:\"Title\",defaultValue:\"Wait!\"},message:{type:ControlType.String,title:\"Message\",defaultValue:\"Don't miss out on our newsletter. Sign up today!\",displayTextArea:true},buttonText:{type:ControlType.String,title:\"Button\",defaultValue:\"Close\"},buttonBackgroundColor:{type:ControlType.Color,title:\"Button Color\",defaultValue:\"#000\"},buttonTextColor:{type:ControlType.Color,title:\"Button Text\",defaultValue:\"#fff\"},showCloseButton:{type:ControlType.Boolean,title:\"Close Icon\",defaultValue:true},closeButtonColor:{type:ControlType.Color,title:\"Icon Color\",defaultValue:\"#000\",hidden:({showCloseButton})=>!showCloseButton},closeButtonBackgroundColor:{type:ControlType.Color,title:\"Icon Bg\",defaultValue:\"#fff\",hidden:({showCloseButton})=>!showCloseButton},overlayColor:{type:ControlType.Color,title:\"Overlay\",defaultValue:\"rgba(0, 0, 0, 0.5)\"},showOnce:{type:ControlType.Boolean,title:\"Show Once\",defaultValue:true,description:\"Only show once per session\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ExitIntent\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"50\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"200\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ExitIntent.map"],"mappings":"A,wNAUG,SAAwBoB,EAAWC,EAAM,CAAC,GAAK,CAACC,UAAQC,UAAQC,eAAaC,WAASC,cAAYC,gBAAcC,QAAMC,UAAQC,aAAWC,wBAAsB,OAAOC,kBAAgB,OAAOC,kBAAgBC,mBAAiBC,6BAA2B,QAAQd,EAAW,CAACe,EAAUC,GAAcrC,EAAS,EAAK,EAAQsC,EAAarC,EAAO,EAAK,EAAQsC,EAAatC,EAAO,IAAI,EAAEC,MAAc,CACvY,GAD2Y,CAACoB,GACzYL,EAAa,QAAQ,IAAIA,EAAa,OAAO,OAAO,IAAMuB,EAAiB,GAAG,CACjF,GAAG,EAAE,SAAS,EAAE,CAAC,GAAGf,GAAUa,EAAa,QAAQ,OAAUZ,EAAaa,EAAa,QAAQ7B,EAAO,eAAe,CAACP,MAAoB,CAACkC,EAAa,EAAI,CAAE,CAAC,EAAEC,EAAa,QAAQ,EAAK,EAAEX,EAAc,GAAG,GAAQxB,MAAoB,CAACkC,EAAa,EAAI,CAAE,CAAC,EAAEC,EAAa,QAAQ,GAAM,CAAC,EAA2D,OAAzD,SAAS,iBAAiB,aAAaE,CAAgB,MAAY,CAAC,SAAS,oBAAoB,aAAaA,CAAgB,EAAKD,EAAa,SAAS,aAAaA,EAAa,OAAO,CAAG,CAAE,EAAE,CAACjB,EAAQG,EAASC,EAAYC,CAAa,CAAC,EAAE,IAAMc,MAAgB,CAACtC,MAAoB,CAACkC,EAAa,EAAK,CAAE,CAAC,CAAE,EAC/I,OAA/bpB,EAAa,QAAQ,IAAIA,EAAa,OAA4Bb,gBAAM,MAAM,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