{"version":3,"file":"CodeBookTicketCalendarWidgetButton.CSi862bV.mjs","names":["_Fragment","GetUpdatesFormDialog","GetUpdatesForm","GiftCardsBanner"],"sources":["https:/framerusercontent.com/modules/YzRFGBlKPCgcFc01Mfb8/s2Kkh0L0NGQvsUjmbRRh/CodeBookTicketCalendarWidgetButton.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,useLocaleInfo}from\"framer\";import{useEffect}from\"react\";import{GetUpdatesFormDialog,GetUpdatesForm,GiftCardsBanner}from\"https://framer-custom-ui-git-feat-britishtheatre-tickadoo.vercel.app/framer/britishtheatre.js\";const css=`\n    button#cta-book-tickets.btn-book-ticket {\n      --size: 1.25rem;\n      --radius: 0.75em;\n      cursor: pointer;\n      padding: 0.6em 1.8em;\n      min-width: 120px;\n      min-height: 44px;\n      font-weight: 700;\n      text-wrap: nowrap;\n      transition: 0.3s;\n      border: none;\n      border-radius: var(--radius);\n    }\n\n    button.btn-book-ticket:disabled {\n      cursor: not-allowed;\n      opacity: 0.5;\n      pointer-events: none;\n    }\n\n    button.btn-book-ticket.primary {\n      --btn-bg-1: oklch(59.07% 0.198 284.88);\n      --btn-bg-2: oklch(45.07% 0.198 284.88);\n      background-size: 280% auto;\n      background-position: right top;\n      background-image: linear-gradient(\n        325deg,\n        var(--btn-bg-2) 0%,\n        var(--btn-bg-1) 50%,\n        var(--btn-bg-2) 90%\n      );\n      color: white;\n      transition: 0.8s;\n    }\n\n    .btn-book-ticket.primary:hover:not(:disabled) {\n      background-position: left top;\n    }\n\n    .btn-book-ticket.primary:disabled {\n      background-image: none;\n      background-color: #9ca3af;\n    }\n\n    .btn-book-ticket.secondary {\n      background-color: white;\n      color: black;\n    }\n\n    .btn-book-ticket.secondary:hover:not(:disabled) {\n      background-color: #f0f0f0;\n    }\n\n    .btn-book-ticket.secondary:disabled {\n      background-color: #f3f4f6;\n      color: #9ca3af;\n    }\n\n    @media (prefers-reduced-motion: reduce) {\n      .btn-book-ticket {\n        transition: linear;\n      }\n    }\n  `;/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */const CALENDAR_ID=\"calendar-widget\";export default function CodeBookTicketCalendarWidgetButton(props){const{activeLocale}=useLocaleInfo();const{openCalendarWidget}=useOpenCalendarWidget();const handleOnClick=()=>{if(!props.productId){console.warn(\"Calendar: No product ID configured\");return;}openCalendarWidget(props.productId,activeLocale,props.provider);};return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"style\",{children:css}),props.mode===\"get-updates\"?/*#__PURE__*/_jsxs(GetUpdatesFormDialog,{trigger:/*#__PURE__*/_jsx(\"button\",{type:\"button\",id:\"cta-book-tickets\",\"aria-label\":props.buttonTitle,className:`btn-book-ticket ${props.variant}`,onClick:handleOnClick,disabled:props.disabled,style:{fontSize:\"var(--size, 1rem) !important\"},children:props.buttonTitle}),content:{...props.dialogContent},children:[/*#__PURE__*/_jsx(GetUpdatesForm,{twScope:false,content:{...props.formContent}}),/*#__PURE__*/_jsx(\"p\",{style:{textAlign:\"center\",margin:\"1.25rem auto 0\"},children:\"- Or -\"}),/*#__PURE__*/_jsx(GiftCardsBanner,{twScope:false,content:{...props.bannerContent}})]}):/*#__PURE__*/_jsx(\"button\",{type:\"button\",id:\"cta-book-tickets\",\"aria-label\":props.buttonTitle,className:`btn-book-ticket ${props.variant}`,onClick:handleOnClick,disabled:props.disabled,style:{fontSize:\"var(--size, 1rem) !important\"},children:props.buttonTitle})]});}CodeBookTicketCalendarWidgetButton.displayName=\"Code BookTicket CalendarWidget Button\";addPropertyControls(CodeBookTicketCalendarWidgetButton,{mode:{type:ControlType.Enum,options:[\"redirect\",\"calendar\",\"get-updates\"],defaultValue:\"get-updates\"},poweredBySlot:{type:ControlType.Slot,hidden(props){return props.mode!==\"calendar\";}},dialogContent:{type:ControlType.Object,hidden(props){return props.mode!==\"get-updates\";},controls:{title:{type:ControlType.String,defaultValue:\"Stay Updated\"},description:{type:ControlType.String,defaultValue:\"Get notified when this show goes on sale\"}}},formContent:{type:ControlType.Object,hidden(props){return props.mode!==\"get-updates\";},controls:{buttonText:{type:ControlType.String,defaultValue:\"Get Updates\"},newsletterLabel:{type:ControlType.String,defaultValue:\"Sign me up to the newsletter as well\"},successMessage:{type:ControlType.String,defaultValue:\"You're all set! You'll receive updates in your inbox shortly.\"},errorMessage:{type:ControlType.String,defaultValue:\"Oops! We couldn't add your information. Please check and try again.\"},emailLabel:{type:ControlType.String,defaultValue:\"Email\"},givenNameLabel:{type:ControlType.String,defaultValue:\"First Name\"},familyNameLabel:{type:ControlType.String,defaultValue:\"Last Name\"}}},bannerContent:{type:ControlType.Object,hidden(props){return props.mode!==\"get-updates\";},controls:{buttonText:{type:ControlType.String,defaultValue:\"Buy Gift Card\"},title:{type:ControlType.String,defaultValue:\"Theater & Experience Digital Gift Cards\"},description:{type:ControlType.String,defaultValue:\"Give the gift of theatre with a tickadoo gift voucher. They choose where and when to go. You just give them the key.\"},benefits:{type:ControlType.Array,control:{type:ControlType.String},defaultValue:[\"700+ cities—from London's West End to Dubai's deserts\",\"Complete flexibility—no fixed dates or restrictions\",\"Valid for 12 months\"]}}},productId:{type:ControlType.String,title:\"Product ID\",defaultValue:\"\",preventLocalization:true},provider:{type:ControlType.String,defaultValue:\"\",preventLocalization:true},buttonTitle:{type:ControlType.String,defaultValue:\"Book tickets\"},disabled:{type:ControlType.Boolean,title:\"Disabled\",defaultValue:false},variant:{type:ControlType.Enum,title:\"Variant\",options:[\"primary\",\"secondary\"],defaultValue:\"primary\"},onTap:{type:ControlType.EventHandler}});// --- HELPERS ---\nfunction useOpenCalendarWidget(){const openCalendarWidget=async(productId,localeCode,provider)=>{try{await AppendCalendarContainerToBody(productId,localeCode,provider);// Add a small delay to ensure DOM is ready and prevent race conditions\nawait new Promise(resolve=>setTimeout(resolve,50));if(typeof window.showCalendarWidget!==\"function\"){const error=new Error(\"Calendar: JS is not loaded. showCalendarWidget is not a function.\");throw error;}window.showCalendarWidget();}catch(error){console.error(\"Failed to open calendar widget:\",error);window?.Sentry?.captureException(error);alert(\"CalendarWidget couldn't be loaded. Please try again later.\");}};const cleanupCalendar=()=>{try{const container=document.getElementById(CALENDAR_ID);if(container){container.remove();}if(typeof window.hideCalendarWidget===\"function\"){window.hideCalendarWidget();}}catch(error){console.error(\"Calendar: Error during cleanup:\",error);window?.Sentry?.captureException(error);}};useEffect(()=>{if(typeof window===\"undefined\")return;cleanupCalendar();return typeof window!==\"undefined\"?()=>cleanupCalendar():undefined;},[]);return{openCalendarWidget};}function AppendCalendarContainerToBody(productId,localeCode,provider){return new Promise((resolve,reject)=>{try{// Remove any existing container\nconst existingContainer=document.getElementById(CALENDAR_ID);if(existingContainer)existingContainer.remove();// Validate required props before creating container\nif(!productId)throw new Error(\"Calendar: No product ID provided\");// Create a new container\nconst calendar_container=document.createElement(\"div\");calendar_container.id=CALENDAR_ID;try{calendar_container.dataset.productId=productId;}catch(error){console.error(\"Calendar: Failed to process product ID:\",error);reject(error);return;}if(localeCode){calendar_container.dataset.locale=localeCode;}if(provider){calendar_container.dataset.provider=provider;}//calendar_container.dataset.test = \"true\"\ncalendar_container.dataset.partner=\"britishtheatre\";document.body.appendChild(calendar_container);resolve();}catch(error){console.error(\"Calendar: Error in AppendCalendarContainerToBody:\",error);reject(error);}});}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CodeBookTicketCalendarWidgetButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CodeBookTicketCalendarWidgetButton.map"],"mappings":"qRAmEuC,SAAwB,EAAmC,EAAM,CAAC,GAAK,CAAC,gBAAc,GAAe,CAAM,CAAC,sBAAoB,GAAuB,CAAO,MAAkB,CAAC,GAAG,CAAC,EAAM,UAAU,CAAC,QAAQ,KAAK,qCAAqC,CAAC,OAAQ,EAAmB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