1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"1.0.0"};var s=(new e.Error).stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="b1770ea4-5af9-4397-bd45-20dd44e1759f",e._sentryDebugIdIdentifier="sentry-dbid-b1770ea4-5af9-4397-bd45-20dd44e1759f")}catch(t){}}();import{j as e}from"./index-CJ0eVksD.js";import{b as s,r as t}from"./vendor-react-Cg5IBgwO.js";import{o as r,c as a}from"./vendor-firebase-db-BWYKWqg8.js";import{db as i}from"./firebase-DvHzvjpo.js";import{B as o}from"./button-Duwog9Kr.js";import{u as l}from"./DashboardContext-CecwK-yo.js";import{u as n}from"./useEffectivePermissions-DeR9iY_g.js";import{c as m}from"./planService-RCjdxSEx.js";import{l as d,m as p}from"./lockedFeatureUpsell-C7aSIBGh.js";import{F as c}from"./FeatureLockedCard-2Y2aIVAt.js";import{D as j}from"./DashboardPageHeader-DaImy8ER.js";import{T as u}from"./TabStrip-CArP_qo3.js";import{S as h}from"./StatusBadge-BI14dKeu.js";import{E as b}from"./EmptyState-CfE3HFLj.js";import{I as x}from"./IntroCard-BbVLhQ7_.js";import"./notify-DLhs2xBD.js";import{F as g}from"./FeatureSettingsGear-Dbajixlo.js";import{u as f,D as v,a as y,F as S,b as k}from"./DetailOverlay-sxQQoznb.js";import"./OverflowRow-BuyPqomT.js";import"./useEscapeLayer-BYkrVTo8.js";import"./layoutOverlayHost--rgM4dhW.js";import{e as w,a as E,b as N}from"./SettingsShapes-CO3lgAFE.js";import{S as C}from"./StatStrip-nzG12xbl.js";import{S as A}from"./StatTile-D4twhVcu.js";import{e as D}from"./pageStatStrips-qcnFDsly.js";import{M as L,U as P}from"./menuDietary-zYYOBkf9.js";import{S as B}from"./SettingsExtras-BYwCsM7P.js";import{S as M}from"./sparkles-CgUeOSxs.js";import{S as T}from"./sliders-horizontal-CPIbHz5P.js";import{S as z}from"./settings-C3buqRAy.js";import"./vendor-firebase-auth-Dw-tYyLh.js";import"./turnstileScript-Nso5-LFr.js";import"./index-C30fg99R.js";import"./utils-DruVD-uI.js";import"./useButton-Dv-sk77p.js";import"./helpers-DlcxdMGb.js";import"./cycleWindow-BHn3tM_i.js";import"./subDays-DeC4Dhpo.js";import"./en-US-DSTBSzO8.js";import"./format-Cqu3RLcn.js";import"./isWalkInSource-GMcf3upj.js";import"./postSignOutError-BXWQuBO0.js";import"./reportListenerDeath-Dlr7Syko.js";import"./apiClient--m1UJa-S.js";import"./offlineActionPolicy-Djb7n2Z2.js";import"./publicBookingSource-CE6_PvFq.js";import"./eventService-Cq61G-nh.js";import"./useListenerRedial-Dy6lpSEx.js";import"./waitlist-BBTyHysC.js";import"./specialDateRules-BSvcUCYt.js";import"./staffTableJoining-D_MbVaX2.js";import"./userDocNameCache-7DB8l2eC.js";import"./bookingTypesModel-Dj3kT6QP.js";import"./noShowTableHold-Bu7QzwNJ.js";import"./waitlistRules-Bs9wu54o.js";import"./settingsService-DWNbfFyj.js";import"./timelineColourDefaults-DmyWhyHT.js";import"./staffService-Dn6Yer-g.js";import"./themeWriteRegister-CY0ImIDj.js";import"./scopedLocalStorage-C63pQoBG.js";import"./menuDealsModel-3su4us9K.js";import"./sha256Sync-21y9jCIc.js";import"./themeSync-BN6IDfTv.js";import"./defaults-sFNQu5fI.js";import"./arrow-right-DcL7LUW3.js";import"./popover-CCJTvFZr.js";import"./composite-DSWmIJ4G.js";import"./useBaseUiId-D49M12hI.js";import"./useRole-BY-HprSY.js";import"./ToolbarRootContext-BSjCopqj.js";import"./HelpBubble-BANzJ5lJ.js";import"./LazyMountBoundary-BrLkzM1_.js";import"./circle-question-mark-B2AzTWoo.js";import"./wifi-off-Q64yAg_D.js";import"./x-C3OBs_Zs.js";import"./useViewportQuery-vHNKbmrR.js";import"./topbarTitleStore-nyK4uHxE.js";import"./ellipsis-UW_yNHBe.js";import"./NotificationBadge-DGdNA51i.js";import"./errorMessages-DM6_MVJz.js";import"./dialog-BCSGQg7_.js";import"./detailSheet-Bnsb-Tek.js";import"./chevron-left-Bp7EXqvH.js";import"./BackToOrigin-RuW2dzKN.js";import"./recordOrigin-mFCiAWUy.js";import"./quickViewModel-CxCC59T1.js";import"./chevron-right-Gtu9w0j0.js";import"./core-6ZUfEAoE.js";import"./lock-DOPcn-g5.js";import"./smartphone-RM1CIE-K.js";import"./eye-CfKknz7o.js";import"./label-BoaP9-o7.js";import"./input-BNbbDe0f.js";import"./LockChip-B9bn6ZQx.js";import"./SuperAdminGateBadge-kTo0SbdR.js";import"./useSudoConfirmedAction-EdUPmc7B.js";import"./ActionButton-CE1Zg744.js";import"./useBodyScrollLock-DyGE1b4L.js";import"./useFocusTrap-CalndOMK.js";import"./check-BWVn7Uwa.js";import"./SettingsPageHeader-Br1PjBgk.js";import"./SaveBarPresenceFlag-AnShycis.js";import"./productGoLive-DCloO1M9.js";import"./navVisibility-DeWB5MK3.js";
1import"./screenModes-DOVe14Vw.js";import"./useSetupWizardState-DMAylw7u.js";import"./visitTrackingMode-Ctuo0xO9.js";import"./SettingsSection-CRk5oIoh.js";import"./DefaultChip-jDW45DA1.js";import"./rezoControlIds-CJx2uvee.js";import"./scale-5ce2l3fF.js";import"./SettingsCrossRef-BJehIeLS.js";import"./ConfirmWarning-BIvPgVml.js";import"./ToggleSwitch-B1alh_UU.js";import"./SegmentedControl-4bRNcesj.js";import"./useLongPressReorder-DzcrOKCZ.js";import"./ImageLibraryPicker-C54s0AeP.js";import"./passDesignShared-YmXh3dza.js";import"./venueAccent-DMW231X_.js";import"./ImageCropModal-zG5aYrQa.js";import"./ModalShell-Ch-10s0s.js";import"./zoom-in-BW-uHuwR.js";import"./imagePipeline-BsWxDmXr.js";import"./images-CWpjfLF2.js";import"./upload-Vf4uzVPv.js";import"./search-D6ZOdNce.js";import"./camera-DZbvM-44.js";import"./circle-alert-D3WishKZ.js";import"./plus-BHmXlL-_.js";import"./pencil-BVvfvyeQ.js";import"./trash-2-B8PyndOr.js";function R(e,s){return Array.isArray(e)&&0!==e.length?e.map(e=>{var t;return null==(t=s.find(s=>s.key===e))?void 0:t.label}).filter(e=>!!e).join(", "):""}function F(){const{tenantId:F,planState:I}=l(),O=s(),_=O.pathname.startsWith("/portal")?"/portal":"/dashboard",H=n().has("extras.manage"),W=(null==I?void 0:I.planConfig)||(null==I?void 0:I.plan)||"taster",U=m(W,"bookingExtras"),[q,V]=t.useState("extras"),[G,K]=t.useState(!1),Q=()=>{K(!0),V("settings")};t.useEffect(()=>{const e=()=>{"settings"===window.location.hash.replace(/^#/,"")&&Q()};return e(),window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)},[O.hash]);const[Y,J]=t.useState(null),[$,X]=t.useState(!1);t.useEffect(()=>{if(!F||!U)return;return r(a(i,"tenants",F,"bookingExtras"),e=>{const s=e.docs.map(e=>({id:e.id,...e.data()}));s.sort((e,s)=>e.sortOrder-s.sortOrder||e.name.localeCompare(s.name)),X(!1),J(s)},e=>{console.error("[ExtrasPage] catalogue listener failed:",e),X(!0),J([])})},[F,U]);const[Z,ee,se]=f("view"),te=t.useMemo(()=>Z&&Y?Y.find(e=>e.id===Z)??null:null,[Y,Z]);if(t.useEffect(()=>{Z&&null!==Y&&!te&&se()},[Z,Y,te,se]),null==I?void 0:I.loading)return e.jsx("div",{className:"p-4 md:p-8 max-w-7xl mx-auto",children:e.jsx("div",{className:"h-64 rounded-dash-xl bg-slate-100 dark:bg-slate-800 animate-pulse"})});if(!U){const s=d("bookingExtras",p("bookingExtras"));return e.jsx("div",{className:"p-4 md:p-8 max-w-7xl mx-auto",children:e.jsx(c,{headline:"Extras are available on Pro and Complete",description:"Sell simple extras with bookings â champagne on arrival, flowers, a birthday cake. Customers add them while booking; paid extras are charged with the booking's payment, straight to your own Stripe account."+(s?` ${s}`:"")})})}const re=Y??[];return e.jsxs("div",{className:"p-4 md:p-8 space-y-6 max-w-7xl mx-auto",children:[e.jsx(j,{icon:M,title:"Extras",subtitle:null===Y?"Sell extras like champagne or flowers with bookings":w(Y),children:e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:e.jsx(g,{to:`${_}/extras#settings`,label:"Extras settings",backLabel:"Extras"})})}),e.jsx(x,{lead:"Extras are simple items customers add while booking â champagne on arrival, flowers, a birthday cake. Each one is either paid online (charged together with the booking's payment, straight to your own Stripe account) or just a request your team handles on the day.",sub:"Customers see your available extras as an optional step while booking; each booking's extras show on its detail panel and your day sheet."}),(()=>{const s=D(re),t=null===Y;return e.jsxs(C,{cols:3,children:[e.jsx(A,{label:"Extras",value:String(s.total),loading:t}),e.jsx(A,{label:"Available to customers",value:String(s.available),sub:s.total>s.available?s.total-s.available+" hidden":void 0,loading:t}),e.jsx(A,{label:"Paid online",value:String(s.paidOnline),sub:"charged with the booking",loading:t})]})})(),(()=>{const s=[{value:"extras",label:"Your extras",icon:M},{value:"settings",label:"Settings",icon:T}];return e.jsx(u,{tabs:s,activeValue:q,onChange:e=>{"settings"===e&&K(!0),V(e)},ariaLabel:"Extras sections"})})(),"extras"===q&&e.jsx("div",{className:"space-y-4",children:null===Y?e.jsx("div",{className:"space-y-4",children:Array.from({length:3}).map((s,t)=>
1e.jsx("div",{className:"h-20 rounded-dash-xl bg-slate-100 dark:bg-slate-800 animate-pulse"},t))}):$?e.jsxs("div",{className:"rounded-dash-xl border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-900/20 px-6 py-10 text-center",children:[e.jsx("p",{className:"text-sm font-bold text-amber-800 dark:text-amber-300",children:"We couldn't load your extras"}),e.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-400 mt-1",children:"Check your connection and reload the page â your catalogue is safe."})]}):0===re.length?e.jsx("div",{className:"rounded-dash-xl border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-900 shadow-sm",children:e.jsx(b,{icon:M,title:"No extras yet",description:"Add your first extra on the Settings tab â a bottle of prosecco, flowers on the table, or a birthday cake. Customers will see them as an optional step while booking.",actionLabel:H?"Open settings":void 0,onAction:H?Q:void 0})}):e.jsx("div",{className:"space-y-3",children:re.map(s=>e.jsxs("div",{className:"flex items-center gap-3 rounded-dash-xl border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-900 shadow-sm px-4 py-3",children:[s.imageUrl?e.jsx("img",{src:s.imageUrl,alt:"",className:"w-11 h-11 rounded-dash-md object-cover shrink-0 border border-slate-200 dark:border-slate-700"}):e.jsx("div",{className:"w-11 h-11 rounded-dash-md bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx(M,{size:18,className:"text-primary"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("button",{type:"button",onClick:()=>{s.id&&ee(s.id)},className:"text-sm font-bold text-slate-900 dark:text-slate-100 hover:text-primary dark:hover:text-primary transition-colors truncate block text-left",children:s.name}),e.jsx("p",{className:"text-xs text-slate-500 dark:text-slate-400 truncate",children:E(s)})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0 flex-wrap justify-end",children:[!0===s.foodBookingsOnly&&e.jsx(h,{tone:"amber",size:"md",children:"Food bookings only"}),e.jsx(h,{tone:"paid_online"===s.paymentMode?"blue":"slate",size:"md",children:"paid_online"===s.paymentMode?"Paid online":"Request only"}),e.jsx(h,{tone:!0===s.isAvailable?"emerald":"slate",size:"md",children:!0===s.isAvailable?"Available":"Hidden"})]})]},s.id))})}),G&&e.jsx("div",{id:"settings",className:"settings"===q?"":"hidden",children:e.jsx(B,{isActiveTab:"settings"===q})}),te&&(()=>{const s=te,t=N(s),r=R(te.dietary,L),a=R(te.allergens,P);return e.jsxs(v,{open:!0,onClose:se,title:te.name,subtitle:E(s),icon:M,chips:e.jsxs(e.Fragment,{children:[e.jsx(h,{tone:"paid_online"===te.paymentMode?"blue":"slate",size:"md",uppercase:!0,children:"paid_online"===te.paymentMode?"Paid online":"Request only"}),e.jsx(h,{tone:!0===te.isAvailable?"emerald":"slate",size:"md",uppercase:!0,children:!0===te.isAvailable?"Available":"Hidden"}),!0===te.foodBookingsOnly&&e.jsx(h,{tone:"amber",size:"md",uppercase:!0,children:"Food bookings only"})]}),actions:H?e.jsxs(o,{variant:"outline",size:"sm",className:"rounded-dash-lg font-bold",onClick:()=>{se(),Q()},children:[e.jsx(z,{size:14,className:"mr-1.5"})," Edit in settings"]}):void 0,children:[e.jsx(y,{title:"What this does",children:e.jsx("ul",{className:"space-y-1.5",children:t.map((s,t)=>e.jsxs("li",{className:"text-sm text-slate-700 dark:text-slate-300 leading-relaxed pl-4 relative",children:[e.jsx("span",{"aria-hidden":"true",className:"absolute left-0 top-[0.55em] w-1.5 h-1.5 rounded-full bg-slate-300 dark:bg-slate-600"}),s]},t))})}),e.jsx(y,{title:"Details",children:e.jsxs(S,{children:[e.jsx(k,{label:"Price",value:te.pricePence>0?`£${(te.pricePence/100).toFixed(2)}`:"Free"}),e.jsx(k,{label:"Max per booking",value:String(te.maxPerBooking)}),te.description?e.jsx(k,{label:"Description",value:te.description}):null,r?e.jsx(k,{label:"Dietary",value:r}):null,a?e.jsx(k,{label:"Allergens",value:a}):null]})})]})})()]})}export{F as ExtrasPage}; 2//# sourceMappingURL=ExtrasPage-uSuwrvDh.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.