{"version":3,"file":"RotatingWaitlistButton.5k9-e2XR.mjs","names":["useState","__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","_e","p","init_framer_B6PCHH0A","addPropertyControls","ControlType","counter","r","API","hit","ns","key","j","track","inFrame","RotatingWaitlistButton","props","busy","setBusy","pressed","setPressed","framed","trackKey","trackName","namespace","popup","openInNewTab","target","groupA","forceGroup","groupB","cycle","storeKey","CYCLE_PREFIX","counterKey","remembered","ctrl","timer","n","size","limit","counted","SEEN","textColor","radius","raised","style","label","init_RotatingWaitlistButton","init_jsx_runtime"],"sources":["https:/framerusercontent.com/modules/bZ1O59H2GbD0ShFyM4MK/ZuHZR9N5pnWO8uwpPkjU/RotatingWaitlistButton.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState}from\"react\";const API=\"https://abacus.jasoncameron.dev\";const SEEN=\"napcamp_wa_counted\";const CYCLE_PREFIX=\"napcamp_wa_cycle_\";// Reads the shared click counter. hit=true counts one more click, hit=false only reads it.\nasync function counter(ns,key,hit,signal){try{const r=await fetch(API+\"/\"+(hit?\"hit\":\"get\")+\"/\"+encodeURIComponent(ns)+\"/\"+encodeURIComponent(key),{signal});if(r.status===404&&!hit)return 0;if(!r.ok)return null;const j=await r.json();return typeof j.value===\"number\"?j.value:null;}catch(e){return null;}}// Adds one to a tracking counter without waiting for it, so the click is never slowed down.\nfunction track(ns,key){try{fetch(API+\"/hit/\"+encodeURIComponent(ns)+\"/\"+encodeURIComponent(key),{keepalive:true}).catch(()=>{});}catch(e){}}// True when the page is shown inside a frame, such as Framer's preview. WhatsApp refuses to load inside a frame.\nfunction inFrame(){try{return window.self!==window.top;}catch(e){return true;}}/**\n * Rotating Waitlist Button\n * With \"Alternate A and B\" on: every N new people go to Group A, then the next N to Group B, then back to A, over and over.\n * With it off: the first N clicks go to Group A, every click after that to Group B.\n * \"Raised look\" gives the button a solid darker edge underneath and a soft glow.\n * \"Track name\" counts every click on the live site under that name. Clicks inside Framer's preview are not counted.\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function RotatingWaitlistButton(props){const{label,groupA,groupB,limit,cycle,forceGroup,namespace,counterKey,trackName,openInNewTab,raised,background,textColor,radius,fontSize,style}=props;const[busy,setBusy]=useState(false);const[pressed,setPressed]=useState(false);const go=async()=>{if(busy)return;setBusy(true);const framed=inFrame();const trackKey=trackName?\"click-\"+trackName.trim().toLowerCase().replace(/[^a-z0-9]+/g,\"-\"):\"\";// Count the click straight away, but not when it comes from Framer's preview.\nif(trackKey&&!framed)track(namespace,trackKey);// In a frame (Framer preview) the link opens in a new tab, since WhatsApp can't load inside a frame.\nconst popup=openInNewTab||framed?window.open(\"about:blank\",\"_blank\"):null;let target=groupA;if(forceGroup===\"B\"&&groupB){target=groupB;}else if(forceGroup===\"auto\"&&groupB&&cycle){// Alternate mode. Each new person is counted once, then sent to whichever group is open.\n// Someone who clicks again goes to the same group they were given the first time.\nconst storeKey=CYCLE_PREFIX+counterKey;let remembered=\"\";try{remembered=localStorage.getItem(storeKey)||\"\";}catch(e){}if(remembered&&(remembered===groupA||remembered===groupB)){target=remembered;}else{const ctrl=new AbortController;const timer=window.setTimeout(()=>ctrl.abort(),3e3);const n=await counter(namespace,counterKey,true,ctrl.signal);window.clearTimeout(timer);if(n!==null){const size=Math.max(1,Math.floor(limit));const block=Math.floor((Math.max(n,1)-1)/size);target=block%2===0?groupA:groupB;try{localStorage.setItem(storeKey,target);}catch(e){}}}}else if(forceGroup===\"auto\"&&groupB){let counted=false;try{counted=localStorage.getItem(SEEN)===\"1\";}catch(e){}const ctrl=new AbortController;const timer=window.setTimeout(()=>ctrl.abort(),3e3);// First click from this browser adds to the count. Repeat clicks only read it.\nconst n=await counter(namespace,counterKey,!counted,ctrl.signal);window.clearTimeout(timer);if(n!==null&&n>limit)target=groupB;try{localStorage.setItem(SEEN,\"1\");}catch(e){}}// Also record which group the click was sent to.\nif(trackKey&&!framed&&groupB)track(namespace,trackKey+(target===groupB?\"-b\":\"-a\"));if(popup)popup.location.href=target;else window.location.href=target;setBusy(false);};const raisedStyle=raised?{boxShadow:pressed?\"0 2px 0 rgb(103, 160, 196), 0 0 26px rgba(190, 225, 250, 0.3)\":\"0 5px 0 rgb(103, 160, 196), 0 0 30px rgba(190, 225, 250, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.35)\",transform:pressed?\"translateY(3px)\":\"translateY(0)\",transition:\"transform 0.08s ease, box-shadow 0.08s ease\"}:{};return /*#__PURE__*/_jsxs(\"button\",{type:\"button\",onClick:go,onPointerDown:()=>setPressed(true),onPointerUp:()=>setPressed(false),onPointerLeave:()=>setPressed(false),style:{width:\"100%\",height:\"100%\",minHeight:56,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",gap:8,border:\"none\",cursor:\"pointer\",padding:\"0 20px\",background,color:textColor,borderRadius:radius,fontFamily:\"Fredoka, sans-serif\",fontWeight:700,fontSize,lineHeight:1.1,...raisedStyle,...style},children:[/*#__PURE__*/_jsx(\"span\",{children:label}),/*#__PURE__*/_jsx(\"svg\",{width:\"20\",height:\"20\",viewBox:\"0 0 24 24\",fill:\"currentColor\",\"aria-hidden\":\"true\",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\"})})]});}RotatingWaitlistButton.defaultProps={label:\"Join the Waitlist\",groupA:\"https://chat.whatsapp.com/Jew0bXDaSPwAXQVh02IX6K?mode=gi_t\",groupB:\"\",limit:70,cycle:false,forceGroup:\"auto\",namespace:\"napcamp-elly\",counterKey:\"waitlist3-clicks\",trackName:\"\",openInNewTab:false,raised:false,background:\"#86CDEF\",textColor:\"#2A1A1E\",radius:9999,fontSize:19};addPropertyControls(RotatingWaitlistButton,{label:{type:ControlType.String,title:\"Text\",defaultValue:\"Join the Waitlist\"},groupA:{type:ControlType.String,title:\"Group A link\",defaultValue:\"https://chat.whatsapp.com/Jew0bXDaSPwAXQVh02IX6K?mode=gi_t\",description:\"The first group.\"},groupB:{type:ControlType.String,title:\"Group B link\",defaultValue:\"\",placeholder:\"https://chat.whatsapp.com/...\",description:\"The second group. Leave empty and everyone goes to Group A.\"},limit:{type:ControlType.Number,title:\"Switch every\",defaultValue:70,min:1,max:5e3,step:1,description:\"How many new people go to one group before the next group takes over.\"},cycle:{type:ControlType.Boolean,title:\"Alternate A and B\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\",description:\"On: A, then B, then A again, over and over. Off: A first, then B for everyone after.\"},forceGroup:{type:ControlType.Enum,title:\"Send everyone to\",options:[\"auto\",\"A\",\"B\"],optionTitles:[\"Automatic\",\"Always A\",\"Always B\"],defaultValue:\"auto\",displaySegmentedControl:true,description:\"Automatic follows the rotation. Pick A or B to send everyone to that group right away.\"},namespace:{type:ControlType.String,title:\"Counter name\",defaultValue:\"napcamp-elly\",description:\"Keep this the same on every button so they share one count.\"},counterKey:{type:ControlType.String,title:\"Counter key\",defaultValue:\"waitlist3-clicks\",description:\"Change this to start the count from zero again.\"},trackName:{type:ControlType.String,title:\"Track clicks as\",defaultValue:\"\",placeholder:\"waitlist-top\",description:\"Counts every click on the live site under this name. Leave empty for no tracking. Clicks in Framer's preview are not counted.\"},openInNewTab:{type:ControlType.Boolean,title:\"Open in\",defaultValue:false,enabledTitle:\"New tab\",disabledTitle:\"Same tab\"},raised:{type:ControlType.Boolean,title:\"Raised look\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\",description:\"A solid darker edge under the button and a soft glow around it.\"},background:{type:ControlType.Color,title:\"Fill\",defaultValue:\"#86CDEF\"},textColor:{type:ControlType.Color,title:\"Text color\",defaultValue:\"#2A1A1E\"},radius:{type:ControlType.Number,title:\"Radius\",defaultValue:9999,min:0,max:9999,step:1},fontSize:{type:ControlType.Number,title:\"Font size\",defaultValue:19,min:12,max:32,step:1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RotatingWaitlistButton\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RotatingWaitlistButton.map"],"mappings":"A,qLACA,eAAeU,EAAQ,EAAG,EAAI,EAAI,EAAO,CAAC,GAAG,CAAC,IAAMC,EAAE,MAAM,MAAMC,EAAI,KAAKC,EAAI,MAAM,OAAO,IAAI,mBAAmBC,CAAE,EAAE,IAAI,mBAAmBC,CAAG,EAAE,CAAC,QAAM,CAAC,EAAE,GAAGJ,EAAE,SAAS,KAAK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