{"version":3,"file":"TicketButton.64bGb2IG.mjs","names":["useState","_Fragment","__esmMin","window","init_ssg_sandbox_shims","init_npm_react_18_3_1","_e","l","Ha","p","c","init_jsx_runtime","ce","RenderTarget","addPropertyControls","init_framer_BL70qLPA","ControlType","readSource","params","utm","TRACKING_KEY","withRef","source","base","url","trackOpen","key","eventId","eventName","firedFor","w","id","price","TicketButton","props","open","setOpen","hover","setHover","loaded","setLoaded","setSource","onCanvas","onKey","previousOverflow","fontStyle","font","handleClick","checkoutUrl","button","style","hoverColor","textColor","radius","paddingY","paddingX","hoverUnderline","label","modal","overlayColor","modalMaxWidth","modalHeight","modalRadius","init_TicketButton","init_npm_react_dom_18_3_1"],"sources":["https:/framerusercontent.com/modules/kXocIZTwnqiUUEBTxOQu/AihrVO9lwuNoBBcGAOAo/TicketButton.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{createPortal}from\"react-dom\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * MaHalla — Ticket Button\n *\n * A text link styled with MaHalla's type settings that opens the Ticket Tailor\n * checkout in a modal overlay.\n *\n * Reusable for every event: set Checkout URL, Event name, TT event ID and Price\n * per instance in the properties panel — or bind them to CMS fields / component\n * variables in Framer, so each event page fills them automatically.\n *\n * Tracking:\n * - carries the visitor's source (utm_source, or \"meta\" if only fbclid is\n *   present) into Ticket Tailor as the order's ref= tag\n * - fires GA4 `begin_checkout` (with value + EUR) when the modal opens, once\n *   per page view and event. Meta receives it as `InitiateCheckout` through the\n *   Google tag → Conversions API connection — no direct fbq call, which would\n *   double-count.\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n * @framerIntrinsicWidth 140\n * @framerIntrinsicHeight 40\n */const TRACKING_KEY=\"mh_utm_source\";// Haelt die Quelle fuer die Session fest. Ohne das waere sie weg, sobald\n// jemand von der Landingpage weiterklickt.\nfunction readSource(){if(typeof window===\"undefined\")return\"\";try{const params=new URLSearchParams(window.location.search);const utm=params.get(\"utm_source\");if(utm){sessionStorage.setItem(TRACKING_KEY,utm);return utm;}// Meta-Klick ohne UTM-Parameter: trotzdem als Meta markieren.\nif(params.get(\"fbclid\")){sessionStorage.setItem(TRACKING_KEY,\"meta\");return\"meta\";}return sessionStorage.getItem(TRACKING_KEY)||\"\";}catch{return\"\";}}// Setzt ref= auf die echte Quelle, damit sie in Ticket Tailor auf der\n// Bestellung steht. Ohne Quelle bleibt der Default aus der URL stehen.\nfunction withRef(base,source){if(!source)return base;try{const url=new URL(base);url.searchParams.set(\"ref\",source);return url.toString();}catch{return base;}}// Ein Event pro Seitenaufruf und Event — mehrfaches Oeffnen zaehlt nicht doppelt.\nconst firedFor=new Set;// Schlaegt bewusst still fehl: Tracking darf den Kauf nie blockieren.\nfunction trackOpen(source,eventName,eventId,price){if(typeof window===\"undefined\")return;const key=eventId||eventName;if(firedFor.has(key))return;firedFor.add(key);const w=window;const id=eventId||eventName;try{if(typeof w.gtag===\"function\"){w.gtag(\"event\",\"begin_checkout\",{currency:\"EUR\",value:price,items:[{item_id:id,item_name:eventName,price,quantity:1}],traffic_source:source||\"(none)\"});}// Kein direkter fbq-Aufruf: Meta bekommt InitiateCheckout ueber die\n// Google-Tag/Conversions-API-Verbindung (begin_checkout -> InitiateCheckout).\n// Ein zusaetzliches fbq() wuerde jeden Klick doppelt zaehlen.\n}catch{}}export default function TicketButton(props){const{label,checkoutUrl,eventName,eventId,price,font,textColor,hoverColor,hoverUnderline,background,paddingX,paddingY,radius,modalMaxWidth,modalHeight,modalRadius,overlayColor,style}=props;const[open,setOpen]=useState(false);const[hover,setHover]=useState(false);const[loaded,setLoaded]=useState(false)// iframe loads on first open only\n;const[source,setSource]=useState(\"\");const onCanvas=RenderTarget.current()===RenderTarget.canvas;useEffect(()=>{setSource(readSource());},[]);// Escape to close + lock background scroll while the modal is open\nuseEffect(()=>{if(!open)return;const onKey=e=>{if(e.key===\"Escape\")setOpen(false);};document.addEventListener(\"keydown\",onKey);const previousOverflow=document.body.style.overflow;document.body.style.overflow=\"hidden\";return()=>{document.removeEventListener(\"keydown\",onKey);document.body.style.overflow=previousOverflow;};},[open]);// Hard defaults first, then whatever the Font control provides. A <button>\n// does not inherit page typography, so if `font` is ever undefined the\n// browser falls back to ~13px — these defaults prevent that.\nconst fontStyle={fontFamily:'\"Inter Display\", \"Inter\", sans-serif',fontSize:30,fontWeight:700,letterSpacing:\"-0.02em\",lineHeight:\"1.2em\",...font||{}};function handleClick(){// On the Framer canvas the iframe would just show an error, so do nothing.\nif(onCanvas||!checkoutUrl)return;trackOpen(source,eventName,eventId,Number(price)||0);setLoaded(true);setOpen(true);}const button=/*#__PURE__*/_jsx(\"button\",{onClick:handleClick,onMouseEnter:()=>setHover(true),onMouseLeave:()=>setHover(false),title:onCanvas&&!checkoutUrl?\"Checkout URL fehlt\":undefined,style:{// Framer's own layout styles go first so our typography wins.\n...style,...fontStyle,display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",whiteSpace:\"nowrap\",color:hover?hoverColor:textColor,background,border:\"none\",borderRadius:radius,padding:`${paddingY}px ${paddingX}px`,margin:0,textDecoration:hover&&hoverUnderline?\"underline\":\"none\",textUnderlineOffset:\"0.12em\",cursor:\"pointer\",transition:\"color 160ms ease, background 160ms ease\",WebkitTapHighlightColor:\"transparent\",opacity:onCanvas&&!checkoutUrl?.4:1},children:label});// The overlay is rendered into document.body. Framer applies CSS\n// transforms to its containers, and position:fixed inside a transformed\n// ancestor is positioned against that ancestor instead of the viewport.\nconst modal=open&&typeof document!==\"undefined\"?/*#__PURE__*/createPortal(/*#__PURE__*/_jsx(\"div\",{role:\"dialog\",\"aria-modal\":\"true\",\"aria-label\":label,onClick:e=>{if(e.target===e.currentTarget)setOpen(false);},style:{position:\"fixed\",inset:0,zIndex:2147483e3,background:overlayColor,display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:/*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",width:\"100%\",maxWidth:modalMaxWidth,height:`${modalHeight}vh`,background:\"#fff\",borderRadius:modalRadius,overflow:\"hidden\"},children:[/*#__PURE__*/_jsx(\"button\",{onClick:()=>setOpen(false),\"aria-label\":\"Close\",style:{position:\"absolute\",top:8,right:10,zIndex:2,width:36,height:36,borderRadius:\"50%\",border:\"none\",background:\"rgba(255,255,255,0.92)\",color:\"#000\",fontSize:24,lineHeight:\"34px\",cursor:\"pointer\"},children:\"\\xd7\"}),loaded&&/*#__PURE__*/_jsx(\"iframe\",{src:withRef(checkoutUrl,source),title:\"Ticket checkout\",allow:\"payment *\",style:{width:\"100%\",height:\"100%\",border:0,display:\"block\"}})]})}),document.body):null;return /*#__PURE__*/_jsxs(_Fragment,{children:[button,modal]});}TicketButton.defaultProps={label:\"Tickets\",checkoutUrl:\"\",eventName:\"\",eventId:\"\",price:0,font:{fontFamily:'\"Inter Display\", \"Inter\", sans-serif',fontSize:30,fontWeight:700,letterSpacing:\"-0.02em\",lineHeight:\"1.2em\"},textColor:\"#FB0007\",hoverColor:\"#FFFFFF\",hoverUnderline:false,background:\"rgba(0,0,0,0)\",paddingX:0,paddingY:0,radius:0,modalMaxWidth:860,modalHeight:88,modalRadius:6,overlayColor:\"rgba(0,0,0,0.85)\"};addPropertyControls(TicketButton,{label:{type:ControlType.String,title:\"Label\",defaultValue:\"Tickets\"},// --- Per event: set these, or bind them to CMS fields / variables ---\ncheckoutUrl:{type:ControlType.String,title:\"Checkout URL\",description:\"Ticket Tailor link on tickets.mahalla.berlin. A new-session link opens directly on Select tickets.\",defaultValue:\"\"},eventName:{type:ControlType.String,title:\"Event name\",description:\"Shown in GA4 and Meta, e.g. Totenpicknick.\",defaultValue:\"\"},eventId:{type:ControlType.String,title:\"TT event ID\",description:\"Number from the Ticket Tailor event URL, e.g. 2436870.\",defaultValue:\"\"},price:{type:ControlType.Number,title:\"Price €\",min:0,max:1e3,step:1,defaultValue:0,description:\"Sent as value to GA4 and Meta.\"},// --- Style ---\nfont:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans\",defaultValue:{fontSize:30,fontWeight:700,letterSpacing:\"-0.02em\",lineHeight:\"1.2em\"}},textColor:{type:ControlType.Color,title:\"Color\"},hoverColor:{type:ControlType.Color,title:\"Hover\"},hoverUnderline:{type:ControlType.Boolean,title:\"Underline\",enabledTitle:\"On hover\",disabledTitle:\"Never\"},background:{type:ControlType.Color,title:\"Fill\",description:\"Transparent by default. Set a colour for a boxed button.\"},paddingX:{type:ControlType.Number,title:\"Pad X\",min:0,max:80,step:2},paddingY:{type:ControlType.Number,title:\"Pad Y\",min:0,max:60,step:2},radius:{type:ControlType.Number,title:\"Radius\",min:0,max:60,step:1},// --- Modal ---\nmodalMaxWidth:{type:ControlType.Number,title:\"Modal width\",min:400,max:1400,step:20},modalHeight:{type:ControlType.Number,title:\"Modal height\",min:50,max:100,step:1,description:\"Percent of the viewport height.\"},modalRadius:{type:ControlType.Number,title:\"Modal radius\",min:0,max:40,step:1},overlayColor:{type:ControlType.Color,title:\"Overlay\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TicketButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TicketButton.map"],"mappings":"A,8NAwBA,SAASiB,GAAY,CAAC,GAAUd,IAAS,OAAY,MAAM,GAAG,GAAG,CAAC,IAAMe,EAAO,IAAI,gBAAgBf,EAAO,SAAS,MAAM,EAAQgB,EAAID,EAAO,IAAI,YAAY,EACzE,OAD8EC,GAAK,eAAe,QAAQC,EAAaD,CAAG,EAASA,GACnND,EAAO,IAAI,QAAQ,GAAG,eAAe,QAAQE,EAAa,MAAM,EAAQ,QAAe,eAAe,QAAQA,CAAY,GAAG,EAAG,MAAM,CAAC,MAAM,EAAG,CAAC,CAEpJ,SAASC,EAAQ,EAAK,EAAO,CAAC,GAAG,CAACC,EAA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