{"version":3,"file":"CalendlyPrivatePractice.DsYLFoko.mjs","names":["React.useRef","p"],"sources":["https:/framerusercontent.com/modules/dRHzvBpjVnnQCAXvpIsZ/7bJKvY8kl0OWEx8Q9RUg/CalendlyPrivatePractice.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * CalendlyPrivatePractice.tsx\n * - Works with BOTH routing (/d/...) and direct event URLs.\n * - Adds embed_domain ONLY for /d/ links (routing).\n * - Defensive sizing for Framer (Fixed vs Fill).\n * - Console logs final URL for quick UTM troubleshooting.\n */export default function CalendlyPrivatePractice({mode,height,minHeight,calendlyUrl}){const ref=React.useRef(null);React.useEffect(()=>{const el=ref.current;if(!el)return;// Base URL (use prop override if provided)\nconst base=(calendlyUrl||\"https://calendly.com/d/cwkp-xsf-fgy/airpay-demo\").trim();let url;try{url=new URL(base);}catch(e){console.error(\"Invalid Calendly URL:\",base,e);el.innerHTML='<div style=\"padding:16px;text-align:center;background:#fff;color:#222;\">Invalid Calendly URL.</div>';return;}// Common options\nurl.searchParams.set(\"hide_gdpr_banner\",\"1\");url.searchParams.set(\"text_color\",\"1a0134\");url.searchParams.set(\"primary_color\",\"454de6\");// Only add embed_domain for routing (/d/...) links\nconst isRouting=url.pathname.split(\"/\")[1]===\"d\";if(isRouting){const host=window.location?.hostname||\"airpay.dental\";url.searchParams.set(\"embed_domain\",host);}else{// Make sure we DON’T leak a stale embed_domain if user passed one in\nurl.searchParams.delete(\"embed_domain\");}// Carry through UTMs from the current page\nconst q=new URLSearchParams(window.location.search);[\"utm_source\",\"utm_medium\",\"utm_campaign\",\"utm_content\",\"utm_term\"].forEach(k=>{const v=q.get(k);if(v)url.searchParams.set(k,v);});// Debug: see exactly what we’re sending to Calendly\n// eslint-disable-next-line no-console\nconsole.log(\"[CalendlyPrivatePractice] init with URL →\",url.toString());// Avoid double init\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst anyEl=el;if(anyEl.__calInit)return;anyEl.__calInit=true;el.innerHTML=\"\";function loadCalendly(){return new Promise((resolve,reject)=>{// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst w=window;if(w.Calendly?.initInlineWidget)return resolve();const existing=document.getElementById(\"calendly-widget-js\");if(existing){const t=setInterval(()=>{// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst w2=window;if(w2.Calendly?.initInlineWidget){clearInterval(t);resolve();}},50);setTimeout(()=>{clearInterval(t);reject(new Error(\"Calendly load timeout\"));},15e3);return;}const s=document.createElement(\"script\");s.id=\"calendly-widget-js\";s.src=\"https://assets.calendly.com/assets/external/widget.js\";s.async=true;s.onload=()=>resolve();s.onerror=reject;document.body.appendChild(s);});}loadCalendly().then(()=>{// Mount the widget\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst w=window;w.Calendly.initInlineWidget({url:url.toString(),parentElement:el});// Fit the iframe once it appears\nconst fit=()=>{const iframe=el.querySelector(\"iframe\");if(!iframe||!iframe.src){requestAnimationFrame(fit);return;}const f=iframe;f.style.position=\"absolute\";f.style.inset=\"0\";f.style.width=\"100%\";f.style.height=\"100%\";f.style.border=\"0\";f.style.background=\"#fff\";};fit();// Safety: if no iframe after a short while, show a message\nconst failTimer=setTimeout(()=>{const iframe=el.querySelector(\"iframe\");if(!iframe){el.innerHTML='<div style=\"padding:16px;text-align:center;background:#fff;color:#222;\">Unable to load scheduling widget. If this is a private or restricted event, check its visibility and domain allowlist. For routing forms, ensure the embed domain matches this site.</div>';}},4e3);setTimeout(()=>{const iframe=el.querySelector(\"iframe\");if(iframe)clearTimeout(failTimer);},4500);}).catch(err=>{console.error(\"[CalendlyPrivatePractice] widget load error:\",err);el.innerHTML='<div style=\"padding:16px;text-align:center;background:#fff;color:#222;\">Unable to load scheduling widget.</div>';});return()=>{el.innerHTML=\"\";el.__calInit=false;};},[calendlyUrl]);// Sizing\nconst isFill=mode===\"Fill\";const fallbackMin=760// defensive default if parent has no height\n;const outerStyle={width:\"100%\",height:isFill?\"100%\":`${height}px`,minHeight:isFill?`${Math.max(minHeight||0,200)}px`:undefined,...isFill?{minBlockSize:`${Math.max(minHeight||fallbackMin,200)}px`}:{},display:\"flex\",alignItems:\"center\",justifyContent:\"center\",background:\"#fff\"};return /*#__PURE__*/_jsx(\"div\",{style:outerStyle,children:/*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",width:\"100%\",maxWidth:900,height:\"100%\",background:\"#fff\",borderRadius:12,overflow:\"hidden\",boxShadow:\"0 1px 4px rgba(0,0,0,0.05)\",minHeight:isFill?Math.max(minHeight||0,200):undefined},children:/*#__PURE__*/_jsx(\"div\",{ref:ref,style:{position:\"absolute\",inset:0,background:\"#fff\"}})})});}addPropertyControls(CalendlyPrivatePractice,{mode:{type:ControlType.SegmentedEnum,title:\"Size Mode\",options:[\"Fixed\",\"Fill\"],optionTitles:[\"Fixed\",\"Fill Parent\"],defaultValue:\"Fixed\"},height:{type:ControlType.Number,title:\"Height (px)\",defaultValue:760,min:400,max:2e3,displayStepper:true,hidden:p=>p.mode!==\"Fixed\"},minHeight:{type:ControlType.Number,title:\"Min Height (px)\",defaultValue:760,min:200,max:2e3,displayStepper:true,hidden:p=>p.mode!==\"Fill\"},calendlyUrl:{type:ControlType.String,title:\"Calendly URL\",defaultValue:\"https://calendly.com/d/cwkp-xsf-fgy/airpay-demo\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CalendlyPrivatePractice\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CalendlyPrivatePractice.map"],"mappings":"0LAMG,SAAwB,EAAwB,CAAC,OAAK,SAAO,YAAU,eAAa,CAAC,IAAM,EAAIA,EAAa,KAAK,CAAC,MAAoB,CAAC,IAAM,EAAG,EAAI,QAAQ,GAAG,CAAC,EAAG,OACtK,IAAM,GAAM,GAAa,mDAAmD,MAAM,CAAK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