{"version":3,"file":"TicketButton.D44JHER2.mjs","names":["useState","_Fragment","_jsx"],"sources":["https:/framerusercontent.com/modules/kXocIZTwnqiUUEBTxOQu/vilDpd8oHnywI8EUjH83/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 * The checkout URL is a Ticket Tailor \"new-session\" link, which opens directly\n * on Select tickets and skips the date step.\n *\n * It also carries the visitor's utm_source into Ticket Tailor as the order's\n * referral tag, and fires GA4 + Meta events when the modal opens.\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n * @framerIntrinsicWidth 140\n * @framerIntrinsicHeight 40\n */const TRACKING_KEY=\"mh_utm_source\";// Haelt utm_source fuer die Session fest. Ohne das waere die Quelle weg,\n// sobald jemand von der Landingpage weiterklickt.\nfunction readUtmSource(){if(typeof window===\"undefined\")return\"\";try{const fresh=new URLSearchParams(window.location.search).get(\"utm_source\");if(fresh){sessionStorage.setItem(TRACKING_KEY,fresh);return fresh;}return sessionStorage.getItem(TRACKING_KEY)||\"\";}catch{return\"\";}}// Ersetzt ref= durch die echte Quelle, damit sie in Ticket Tailor auf der\n// Bestellung steht. Ohne utm_source 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;}}// Schlaegt bewusst still fehl: Tracking darf den Kauf nie blockieren.\nfunction trackOpen(source){if(typeof window===\"undefined\")return;const w=window;try{if(typeof w.gtag===\"function\"){w.gtag(\"event\",\"begin_checkout_click\",{event_name_mh:\"UNRUHE\",traffic_source:source||\"(none)\"});}if(typeof w.fbq===\"function\"){w.fbq(\"track\",\"InitiateCheckout\",{content_name:\"UNRUHE\",content_ids:[\"2349311\"],content_type:\"product\"});}}catch{}}export default function TicketButton(props){const{label,checkoutUrl,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;// utm_source einmal beim Mount aufloesen.\nuseEffect(()=>{setSource(readUtmSource());},[]);// 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)return;trackOpen(source);setLoaded(true);setOpen(true);}const button=/*#__PURE__*/_jsx(\"button\",{onClick:handleClick,onMouseEnter:()=>setHover(true),onMouseLeave:()=>setHover(false),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\"},children:label});// The overlay is rendered into document.body. This matters: Framer applies\n// CSS 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]});}const DEFAULT_CHECKOUT_URL=\"https://tickets.mahalla.berlin/checkout/new-session/id/8925512/chk/5553ffb1d6cc6ee126ceea4db706c84b/?ref=website_widget\";TicketButton.defaultProps={label:\"Tickets\",checkoutUrl:DEFAULT_CHECKOUT_URL,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\"},checkoutUrl:{type:ControlType.String,title:\"Checkout URL\",description:\"Ticket Tailor new-session link — opens on Select tickets and skips the date step. Must be on tickets.mahalla.berlin.\",defaultValue:DEFAULT_CHECKOUT_URL},// Gives the full Font / Weight / Size / Letter / Line panel.\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},modalMaxWidth:{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":"6NAkBA,SAAS,GAAe,CAAC,GAAU,IAAS,OAAY,MAAM,GAAG,GAAG,CAAC,IAAM,EAAM,IAAI,gBAAgB,EAAO,SAAS,MAAM,CAAC,CAAC,IAAI,YAAY,EAAqE,OAAhE,GAAO,eAAe,QAAQ,EAAa,CAAK,EAAS,GAAc,eAAe,QAAQ,CAAY,GAAG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