PageSourceSearch

https://get.checkfront.com/lib/vite/ProductBuilderRouter-514bb04d.js

js checkfront.com collected 2026-09-24 15:19:23 UTC 53,480 bytes, 1 lines download raw bytes

1var Ht=Object.defineProperty;var Wt=(e,a,t)=>a in e?Ht(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t;var N=(e,a,t)=>(Wt(e,typeof a!="symbol"?a+"":a,t),t);import{v as g,c as R,F as Et,j as P,L as S,P as E,m as K,S as qt}from"./componentLoader.jsx-2026.09.09-3cefc4ce.js";import{_ as X,b as Yt,r as zt,l as w}from"./logger-3e1e3eff.js";import{S as Jt,a as At,R as Ct,B as Kt}from"./react-router-dom-6e2566f9.js";import{t as k}from"./toNumber-8f88376b.js";import{g as et,_}from"./vendor-21ae10b1.js";import{c as b}from"./createAxiosInstance-650ff559.js";import{s as B}from"./index-2506ba77.js";import{u as m}from"./index-2089c6e8.js";import{q as It}from"./index-6a18cc6d.js";import{i as x}from"./isEqual-8f2d02ec.js";import{_ as Xt,a as M}from"./omit-abc9bd77.js";import{c as T}from"./cloneDeep-02f21378.js";import{d as Qt,e as Zt,a as te}from"./_baseIteratee-2da5a91f.js";import{b as ct}from"./skuHelper-00d76e9e.js";import{g as ee}from"./richTextEditorFunctions-9e6dc16b.js";import{a as j,s as se,f as F,b as wt,h as ae,k as ne,i as re,J as oe,d as ie,P as le}from"./universe.js-2026.09.09-3cefc4ce.js";import{_ as ce}from"./uniqWith-e6899964.js";import{c as ue}from"./_baseClone-a0680933.js";import{g as $,b5 as de,b2 as st,b1 as St,L as pe,H as ut,p as V,ba as he,b0 as ge,ax as fe,aU as me,q as Pe,a_ as ye,aZ as ve,aM as be}from"./constants-9e5fc5e0.js";import{T as Te}from"./Title-bc4116fa.js";import{E as dt}from"./Link-0005ddf4.js";import{_ as Ee,G as Ae}from"./uniq-942e3a3d.js";import{T as pt}from"./TextStyle-014c4a6a.js";import{_ as Ce}from"./_arrayReduce-4ab62823.js";import{a as Ie}from"./_baseEach-5996395c.js";import"./index-e642497c.js";import{a as ht}from"./constants-b445ac4b.js";var we=Object.prototype,Se=we.hasOwnProperty;function _e(e,a){return e!=null&&Se.call(e,a)}var De=_e,xe=De,Oe=Qt;function Re(e,a){return e!=null&&Oe(e,a,xe)}var ke=Re;const $e=et(ke);var Ue=ue,Me=1,Fe=4;function Be(e,a){return a=typeof a=="function"?a:void 0,Ue(e,Me|Fe,a)}var Le=Be;const Ne=et(Le);function _t(e,{start:a,end:t}={}){return a&&t&&e?(a=ae(g.legacyParse(a)),t=ne(g.legacyParse(t)),wt(g.legacyParse(e),{start:g.legacyParse(a),end:g.legacyParse(t)})):!1}function Dt(e,a=[]){return a.some(t=>t.end?_t(e,t):j(g.legacyParse(e),se(g.legacyParse(t.start),1)))}function xt(e={}){return{eventStart:e.start?g.legacyParse(e.start):null,eventEnd:e.end?g.legacyParse(e.end):null}}function Ba(e,a,t){return e?F(g.legacyParse(e),g.convertTokens(a)):t.never}function La({datePeriod:e}){return e.start}function Na(e,a){return e.filter(({overriddenEventId:t})=>a.eventId&&t===a.eventId||t&&t===a.id)}function Ge(e,a){return e.find(t=>t.id&&t.id===a&&t.id||t.eventId&&t.eventId===a)}function je({overriddenEventId:e}){return!e}function Ve({overriddenEventId:e}){return!!e}function Q(e,a,t){return t?!wt(g.legacyParse(e),{start:g.legacyParse(a),end:g.legacyParse(t)}):j(e,g.legacyParse(a))}function He(e,a,t){return e.filter(({datePeriod:n})=>a.some(r=>_t(r,n))).filter(n=>Object.keys(n.applicableDaysOfWeek).some(r=>{const o=n.applicableDaysOfWeek[r];return o==!0&&o==t[r]}))}function Ga(e,a){return a?e.filter(({datePeriod:t})=>Q(t.start,a.start,a.end)||Q(t.end,a.start,a.end)):!1}function We(e,a,t){return t?a.some(s=>{const{start:n}=s;return re(g.legacyParse(t),g.legacyParse(n))&&j(g.legacyParse(e),g.legacyParse(n))}):!1}const qe=e=>a=>{const t=a.format($),{eventStart:s,eventEnd:n}=e?xt(e.datePeriod):{};return n?Q(t,s,n):j(s,g.legacyParse(t))},Ye=(e,a)=>t=>{const s=t.format($);return Dt(s,e)?!0:We(s,e,a)};function ja(e,a,t){const s=t.map(({datePeriod:n})=>n);return e?qe(e):Ye(s,a)}function Va(e,a){return a.filter(t=>t.overriddenEventId?!1:t.eventId?e.eventId!==t.eventId:e.id!==t.id&&e.id!==null)}function Ha(e){const a=e.map(({datePeriod:t})=>t);return t=>Dt(t.format($),a)}function Wa(e){const a=e.availability.timeslots.map(t=>{const s=Z(t);return{...t,startTime:s.getTime()}});return ce(a,x).length!==a.length}function ze(e,a){const t=Z(e),s=gt(t,e.duration),n=Z(a),r=gt(n,a.duration);return ie({start:g.legacyParse(t),end:g.legacyParse(s)},{start:g.legacyParse(n),end:g.legacyParse(r)})}function Z(e){return g.legacyParse(`2001-01-20T${e.startTime}`)}function gt(e,a){return le(g.legacyParse(e),a)}function qa(e,a){const t=Ne(e,c=>({...c,datePeriod:{start:c.datePeriod.start,end:c.datePeriod.end?c.datePeriod.end:"2100-01-01"}})),s=a.map(c=>({...c,datePeriod:{start:c.datePeriod.start,end:c.datePeriod.end?c.datePeriod.end:"2100-01-01"}})),{timeslots:n}=t.availability,{eventStart:r,eventEnd:o}=xt(t.datePeriod);if(!r||!o)return[];const i=oe({start:r,end:o});return He(s,i,t.applicableDaysOfWeek).filter(c=>c.availability.timeslots?c.availability.timeslots.some(l=>n.some(p=>ze(l,p))):!1)}const Ya="guests",za="total",Ja="_total",H="assets",W="staff",q="both",L="static",Ot="",Je="unlimited",Ka="guest",Xa="asset",Ke="HH:mm",Qa=[{label:"10/mins",value:10},{label:"15/mins",value:15},{label:"20/mins",value:20},{label:"30/mins",value:30},{label:"Hourly",value:60}],Za=[{title:"Product Examples",contents:["Be clear and concise with product names, such as: Sunset Cruise, Guided Tour, Kayak Rental."]},{title:"Category Examples",contents:["Categories group similar types of products, such as Day Tours, Bike Rental, or 
1Cabins"]},{title:"Tags Examples",contents:["Tags allow for further filtering of products in reports and during booking. Tags may describe various attributes such as Location, Duration, Size, or Theme.","Tags created here are only visible to Staff by default."],featureFlag:"itemTags"},{title:"Booking Type Examples"},{title:"Day",contents:["Use per-day for full-day or multi-day activities"]},{title:"Night",contents:["Use per-night if using morning check-outs"],example:"Most used by: Accommodation"},{title:"Hourly",contents:["Use per-hour for bookings with flexible start/end times"],example:"Most used by: Space or Equipment Rental"},{title:"Timeslots",contents:["Use timeslots for products with fixed start/end times"],example:"Most used by: Tours and Activities"}],tn=[{title:"Summary",example:"Get a true taste of Chicago and eat where the locals do with this delicious two-hour walking tour. Enjoy freshly-made pizza, discover our burgeoning microbrew culture, and much more."},{title:"How photos display on the Booking Page",contents:["If more than 1 photo is uploaded, the first photo listed will be the main thumbnail image on the booking page."]}],en=[{title:"Optional Email Detail Examples",contents:["Details added here will not be shown during the booking process, only in emails sent where the extra details variable is present"],example:"Examples include:",exampleList:["Access Key Codes","Check-in/out times","WiFi password","Discounts for local partners"]},{title:"Carbon Offset Amount",contents:["Set the amount of carbon (in kilograms) to be offset in order to make this product carbon neutral. Your guests will then be given the option of making their booking carbon neutral.",R(Et,{children:[P(Te,{size:"xs",children:"Helpful Carbon Offset Links"}),P(dt,{url:"https://cloverly.com/",external:!0,customClass:"display-block",children:"Cloverly"}),P(dt,{url:"https://co2.myclimate.org/en/",external:!0,customClass:"display-block",children:"MyClimate Carbon Calculators"})]})],featureFlag:"cloverlyCarbonOffsets"}],sn=[{title:"Example Upsells",contents:["Add optional upsells to any booking such as T-Shirts, romance packages, champagne bottles, or bike rentals"]},{contents:["Upsells need to be created as their own product and attached to each individual parent product to be bookable as an optional add-on."]}],an=[{title:"Using Inventory Types"},{title:"Assets",contents:["For products that rely on assets to determine the number of available spaces or options."],example:"Example: Bikes rented per hour"},{title:"Staff",contents:["For products that do not rely on assets but require at least one staff to make the product available."],example:"Example: Guided Hike Activity",featureFlag:"staffResources"},{title:"Staff and Assets",contents:["For products that rely on assets to determine the number of available spaces and require at least one staff to make the product available."],example:"Example: Guided Bike Tour",featureFlag:"staffResources"},{title:"Static",contents:["For products that don’t rely on assets for availability but have a static daily inventory limit."],example:"Example: Tickets"},{title:"Allocating Additional Assets",contents:["Connect assets together when booking one is dependent on the availability of another.","For example, if a Helmet should be added to every Bike Rental, and the Helmet is an Additional Asset"]},{title:"Allocating Staff",contents:["Connect staff to your products based on the number of guests. Use ratios to control how many staff are allocated per guest."],featureFlag:"staffResources"}],nn=[{title:"Rate Type",contents:["Select how you would like your product price to be calculated."]},{title:"Base Price",contents:["Set the base rate(s) for your product. This can be set either per product, per guest, or both. If no base price is set, this product will be free.","Product — this directly relates to your inventory type and allows you to set single or groups rates for your product. This is optional and can be used alone or along with per guest pricing.","Guests — this directly relates to the guest types set for this product and allows you to set per guest and per group rates. This is optional and can be used alone or along with your product pricing."],example:"Example: Boat Charter: Product Price = $100/hour, Guest price = $50/hour per adult, child, etc..."},{title:"Group Pricing",contents:["Allows you to adjust pricing based on the number of people booking at one time."]},{contents:["Pricing per Guest — Will tally the product based on the quantity booked."],example:"Example: Base price of $100 for 1-3 adults = $300. $100 for each Guest."},{contents:["Pricing per Group — will tally the item total based on a group rate."],example:"Example: Base price of $100 for 1-3 adults = $100. $100 for the whole group"},{title:"Pricing Schedule",contents:["This allows you to adjust your base rates with seasonal and/or custom availability."],example:"Note — This applies to base prices only. Rule based rates such as tiered pricing can be applied using special rates and discounts."}],Rt="staticInventoryResourcePoolId",at=e=>e?k(e)*-1:Rt,Xe=(e,a,t)=>{const{allocationType:s}=t;switch(s){case L:return es(e,a);case H:return ts(e,t);case W:return Ze(e,t);case q:return Qe(e,t);default:return[]}};function Qe(e,a){return e.filter(t=>kt(t,a)||$t(t,a))}function Ze(e,a){return e.filter(t=>$t(t,a))}function ts(e,a){return e.filter(t=>kt(t,a))}function es(e,a){return e.filter(t=>t.resourcePoolId===at(a)).map(t=>({...t,resourcePoolId:ss(t.resourcePoolId,a)}))}const kt=(e,a)=>a.assetGroups?a.assetGroups.some(t=>t.assetPools.some(({assetPoolId:s})=>e.resourcePoolId==s)):!1,$t=(e,a)=>a.staffResources?a.staffResources.some(({staffPoolId:t})=>e.resourcePoolId==t):!1;function ss(e,a){return e===Rt?at(a):e}function rn(e,a){return e.length>0&&e[0].allotmentLimit&&a?e[0].allotmentLimit:a}function ft(e){let a=null;return as(e)&&e.assetGroups.forEach(t=>{t.isPrimary&&(a=t.allotmentType)}),a}function as(e){return![L,W].includes(e.allocationType)&&e.assetGroups&&e.assetGroups.length>0}function ns(e){return e.reduce((a,t)=>{const s=t.assetPools.map(({assetPoolId:n})=>n);return[...a,...s]},[])}function rs(e,a){const t=ns(a.assetGroups);return e.map(s=>{const n=a.allocationType===L?os(s.availability.allotments,a):s.availability.allotments.filter(r=>t.includes(r.resourcePoolId));return{...s,availability:{...s.availability,allotments:n}}})}function os(e,a){const{inventory:t,productId:s}=a,n=at(s);if(t===Je)return[];const r=e.length>0?e.filter(o=>o.resourcePoolId===n):[];return r.length===1?is(r,n,t):[]}function is(e,a,t){const s=e[0];return[{resourcePoolId:a,allotmentLimit:s.allotmentLimit>t?t:s.allotmentLimit,resourcePoolMax:t}]}function ls(e,a){return e.map(t=>{const{availability:s,pricing:n}=t;return{...t,datePeriod:ds(t.datePeriod),id:B.generate(),availability:cs(s),pricing:us(n,a)}})}function cs(e){return{...e,allotments:tt(e.allotments)}}function us(e,a){const t=e.productPrices?mt(e.productPrices,a.pricing.productPrices):[],s=e.guestPrices?mt(e.guestPrices,a.pricing.guestPrices):[],n=s.length>0||t.length>0?de:e.priceAdjustmentType;return{...e,adjustmentCents:n===st?e.adjustmentCents:null,adjustmentPercent:n===St?e.adjustmentPercent:null,priceAdjustmentType:n,productPrices:t,guestPrices:s}}function mt(e,a){return e.map(t=>{let s=a.find(n=>t.groupMin==n.groupMin&&t.groupMax==n.groupMax&&t.guestType==n.guestType);return{...t,id:s.id}})}function tt(e){return e?e.map(a=>({...a,id:B.generate()})):[]}function ds({start:e,end:a}){return{start:F(g.legacyParse(e),g.convertTokens($)),end:a?F(g.legacyParse(a),g.convertTokens($)):null}}function ps(e){const a=e.filter(t=>!t.overriddenEventId);return e.filter(t=>{const s=Ge(a,t.overriddenEventId);return!Zt(s,"deleted",!1)&&!t.deleted})}function on(e,a){return e=k(e),a=k(a),e===a+1||e===a-1}function hs(e){return e.findIndex(({groupMin:a,groupMax:t})=>a==0&&t==0)}function gs(e){const a=hs(e);return e[a]}function fs(e,a,t){const s=ft(t);let n=e.cfMeta.pricingOptions.hideBookByAssetParam;if(a&&a.assetGroups.length){const r=ft(a);s===pe&&r===ut&&(n=!0)}return s===ut&&(n=!1),n}function ms(e,a,t,s,n){const r=gs(a.pricing.productPrices),o=r?k(r.amount)>0:!1,i=X(e.cfMeta.pricingOptions)?t:e.cfMeta.pricingOptions,u=X(e.cfMeta.timeslotOptions)?s:e.cfMeta.timeslotOptions,c=X(e.cfMeta.carbonOffset)?n:e.cfMeta.carbonOffset;return{timeslotOptions:u,carbonOffset:c,pricingOptions:{...i,hideBookByAssetParam:o?!1:i.hideBookByAssetParam}}}function Ps({allocationType:e,assetGroups:a}){const s=!!e&&[H,q].includes(e),n=a&&a.some(({isPrimary:r,assetPools:o})=>r&&o.length);return s&&!n}function ys(e){const{guestPrices:a,productPrices:t}=e;return bs(a)&&vs(t)}function vs(e){return e.length?e.some(a=>Ut(a)):!0}function bs(e){const a=Ee(e.map(({guestType:t})=>t));return a.length?a.every(t=>e.filter(n=>n.guestType==t).some(n=>Ut(n)&&n.amount>=0)):!0}function Ut(e){return!e.groupMin&&!e.groupMax}function Ts(e){let a=[];return e.forEach(t=>{t.applyByDefault===!0&&(a=m(a,{$push:[t]}))}),a}function nt(e){return e.map(a=>a.id)}function Mt(e,a){return e.filter(t=>a.includes(t.guestType))}function Es(e,a){const t=nt(a);return t.push(Ae),e.filter(s=>t.includes(s.guestTypeId))}function Ft(e,a){return Mt(e,nt(a))}function ln(e,a){const t=nt(a);return e.map(s=>({...s,pricing:{...s.pricing,guestPrices:Mt(s.pricing.guestPrices,t)}}))}function As(e){let a=e.replace(/\s/g,"");return a.includes("?v=")&&(a=It.parseUrl(a).query.v),a.length==11?a:""}function Cs(e,a,t,s,n){return n(e,function(r,o,i){t=s?(s=!1,r):a(t,r,o,i)}),t}var Is=Cs,ws=Ce,Ss=Ie,_s=te,Ds=Is,xs=Yt;function Os(e,a,t){var s=xs(e)?ws:Ds,n=arguments.length<3;return s(e,_s(a),t,n,Ss)}var Rs=Os;const Pt=et(Rs);function ks({start:e,end:a}){const t=F(g.legacyParse(e),g.convertTokens($)),s=a?F(g.legacyParse(a),g.convertTokens($)):null;return{start:t,end:s}}function $s({eventId:e,name:a,datePeriod:t,applicableDaysOfWeek:s,overriddenEventId:n,availability:r,pricing:o},i,u,c,l,p){let d={eventId:e,name:a,datePeriod:ks(t),overriddenEventId:n,availability:Us(r,i,u,n,c,p),pricing:Ms(o,u,l)};return(i!==V||n)&&(d.applicableDaysOfWeek=s),d}function Us({fixedStartTime:e,guestTypeRestrictions:a,triggers:t,allotments:s,timeslots:n},r,o,i,u,c){let l={fixedStartTime:Bs(e),guestTypeRestrictions:Es(a,o),triggers:Ls(t)};if(r===V&&i&&(l.timeslots=n.map(p=>({...p,startTime:F(g.legacyParse("January 20, 01 "+p.startTime),g.convertTokens(Ke))}))),s&&s.length){const p=Xe(s,u,c);p&&p.length&&(l.allotments=p)}return l}function Ms(e,a,t){if(Fs(t)||!e.priceAdjustmentType||e.priceAdjustmentType===he)return{};const s={},{priceAdjustmentType:n,adjustmentCents:r,adjustmentPercent:o,guestPrices:i}=e;return n===st?s.adjustmentCents=r||0:n===St&&(s.adjustmentPercent=o||0),s.priceAdjustmentType=n,s.guestPrices=Ft(i,a),s.productPrices=e.productPrices,s}function Fs(e){return!e.pricing.guestPrices.length&&!e.pricing.productPrices.length}function Bs(e){return e!==""?e:null}function Ls(e){return Pt(e,(a,t,s)=>({[s]:Pt(t,(n,r,o)=>({[o]:r||0,...n}),{}),...a}),{})}function Ns({assetGroups:e,inventory:a,allocationType:t,staffResources:s}){const n=e.filter(i=>i.assetPools.length).map(({groupId:i,allotmentType:u,assetPools:c,isPrimary:l})=>({groupId:i,allotmentType:u,assetPools:c,isPrimary:l})),r=s.filter(i=>i.staffPoolId).map(({id:i,staffPoolId:u,basedOn:c,capacity:l})=>{let p={staffPoolId:u,basedOn:c,capacity:l};return Number.isInteger(i)&&(p.id=i),p});let o={assetGroups:[],staffResources:[],inventory:null};switch(t){case H:o.assetGroups=n;break;case W:o.staffResources=r,o.inventory=a===null?0:a;break;case L:o.inventory=a===null?0:a;break;case q:o.assetGroups=n,o.staffResources=r;break}return o}function Gs(e,a){const t=a.map(s=>{const n=B.generate();return{file:qs(s.base64,`${n}.jpg`),unsaved:!0,id:n,base64:s.base64}});return m(e,{productId:{$set:null},sku:{$set:`${e.sku}-copy`},name:{$set:`${e.name} copy`},images:{$set:t}})}function js(e){const a={};return e.forEach(t=>{a[t.eventId]=t.id}),e.map(t=>m(t,{eventId:{$set:null},overriddenEventId:{$set:t.overriddenEventId?a[t.overriddenEventId]:null},productId:{$set:null}}))}function Vs(e){const a=e.assetGroups.map(t=>({allotmentType:t.allotmentType,assetPools:t.assetPools,isPrimary:t.isPrimary,categoryId:t.categoryId}));return m(e,{assetGroups:{$set:a},productId:{$set:null}})}function Hs(e){return m(e,{productId:{$set:null}})}function Ws(e){return e.map(a=>m(a,{productId:{$set:null}}))}function qs(e,a){for(var t=e.split(","),s=t[0].match(/:(.*?);/)[1],n=atob(t[1]),r=n.length,o=new Uint8Array(r);r--;)o[r]=n.charCodeAt(r);return new File([o],a,{type:s})}const Ys=S(()=>_(()=>import("./BuilderMainLayout-06ef07d8.js"),["BuilderMainLayout-06ef07d8.js","componentLoader.jsx-2026.09.09-3cefc4ce.js","vendor-21ae10b1.js","brand-387037d2.js","logger-3e1e3eff.js","index-213dd4d3.js","universe.js-2026.09.09-3cefc4ce.js","Grid-63374a37.js","Title-bc4116fa.js","Text-393329c6.js","TextStyle-014c4a6a.js","SectionHeader-fe038840.js","react-router-dom-6e2566f9.js","hoist-non-react-statics.cjs-3f8ebaa8.js","objectWithoutPropertiesLoose-4f48578a.js","index-33a30c39.js","Button-ad9712a3.js","Popover-7b090f95.js","index-e642497c.js","Menu-25761ab7.js","Icon-a1844e0f.js","IconButton-b18cf368.js","More-968ac717.js","ArrowLeft-155d0c32.js","Checkout-2d8739c7.js","constants-9e5fc5e0.js"])),zs=S(()=>_(()=>import("./BuilderAttributes-bccda151.js"),["BuilderAttributes-bccda151.js","componentLoader.jsx-2026.09.09-3cefc4ce.js","vendor-21ae10b1.js","brand-387037d2.js","logger-3e1e3eff.js","index-213dd4d3.js","universe.js-2026.09.09-3cefc4ce.js","Grid-63374a37.js","ButtonGroup-b00430ce.js","Button-ad9712a3.js","TextField-3930079d.js","DropDown2-ecd6eae7.js","index-e642497c.js","FieldLabel-e62f5b18.js","BuilderContentsLayout-29ce1ec8.js","index-33a30c39.js","TextStyle-014c4a6a.js","Title-bc4116fa.js","Icon-a1844e0f.js","_Uint8Array-4a201bc7.js","eq-9168d086.js","_equalByTag-f809a93d.js","index-6a18cc6d.js","IconButton-b18cf368.js","Check-ee9f11d2.js","Cross-eb4df075.js","Edit-1d071c82.js","skuHelper-00d76e9e.js","constants-9e5fc5e0.js","index-2506ba77.js","CollapsibleRow-7eb01a38.js","Card-3a1b3235.js","ChevronRight-02ef16e8.js","ChevronDown-38748d0a.js","Toggle-6d42fad4.js","Add-563a4607.js","index-2089c6e8.js","isEqual-8f2d02ec.js","_baseIsEqual-8f542891.js","_getAllKeys-a79fe303.js","_isIndex-1f105582.js","Modal-25e86be7.js","Incrementer-0fe5b84f.js","FormMessaging-3318ec3f.js","range-2640dfde.js","_isIterateeCall-18b95b3a.js","toFinite-cca2f94c.js","toNumber-8f88376b.js","isSymbol-34885b27.js","Text-393329c6.js","addCreateCategoryOption-4b0c18e6.js","react-router-dom-6e2566f9.js","hoist-non-react-statics.cjs-3f8ebaa8.js","objectWithoutPropertiesLoose-4f48578a.js","createAxiosInstance-650ff559.js","om
1it-abc9bd77.js","toString-4b4600cf.js","_baseIteratee-2da5a91f.js","_baseClone-a0680933.js","_baseAssignValue-ed5c7dbb.js","_defineProperty-27e63e7c.js","_baseSlice-35988e44.js","isPlainObject-b126badf.js","flatten-a652afe7.js","_setToString-74030a2f.js","cloneDeep-02f21378.js","richTextEditorFunctions-9e6dc16b.js","uniqWith-e6899964.js","_baseUniq-21d7e434.js","Link-0005ddf4.js","uniq-942e3a3d.js","_arrayReduce-4ab62823.js","_baseEach-5996395c.js","constants-b445ac4b.js"])),Js=S(()=>_(()=>import("./BuilderDetails-7238f97b.js"),["BuilderDetails-7238f97b.js","componentLoader.jsx-2026.09.09-3cefc4ce.js","vendor-21ae10b1.js","brand-387037d2.js","logger-3e1e3eff.js","index-213dd4d3.js","universe.js-2026.09.09-3cefc4ce.js","index-33a30c39.js","Grid-63374a37.js","ImageUpload-511acded.js","TextField-3930079d.js","Incrementer-0fe5b84f.js","FormLayout-644dabe8.js","Image-61a89831.js","Card-3a1b3235.js","IconButton-b18cf368.js","FieldLabel-e62f5b18.js","Link-0005ddf4.js","Trash-83186639.js","RichTextEditor-a067d6a9.js","Banner-09ca2b24.js","FormControl-1fd47c48.js","FormMessaging-3318ec3f.js","richTextEditorFunctions-9e6dc16b.js","BuilderContentsLayout-29ce1ec8.js","TextStyle-014c4a6a.js","Title-bc4116fa.js","Icon-a1844e0f.js","index-e642497c.js","_Uint8Array-4a201bc7.js","eq-9168d086.js","_equalByTag-f809a93d.js","index-6a18cc6d.js","AdvancedSettings-ae17e7f3.js","CollapsibleRow-7eb01a38.js","Heading-45ab5a28.js","ChevronRight-02ef16e8.js","ChevronDown-38748d0a.js","react-router-dom-6e2566f9.js","hoist-non-react-statics.cjs-3f8ebaa8.js","objectWithoutPropertiesLoose-4f48578a.js","toNumber-8f88376b.js","isSymbol-34885b27.js","createAxiosInstance-650ff559.js","constants-9e5fc5e0.js","index-2506ba77.js","index-2089c6e8.js","isEqual-8f2d02ec.js","_baseIsEqual-8f542891.js","_getAllKeys-a79fe303.js","_isIndex-1f105582.js","omit-abc9bd77.js","toString-4b4600cf.js","_baseIteratee-2da5a91f.js","_baseClone-a0680933.js","_baseAssignValue-ed5c7dbb.js","_defineProperty-27e63e7c.js","_baseSlice-35988e44.js","isPlainObject-b126badf.js","flatten-a652afe7.js","_setToString-74030a2f.js","cloneDeep-02f21378.js","skuHelper-00d76e9e.js","uniqWith-e6899964.js","_baseUniq-21d7e434.js","uniq-942e3a3d.js","_arrayReduce-4ab62823.js","_baseEach-5996395c.js","constants-b445ac4b.js"])),Ks=S(()=>_(()=>import("./BuilderAvailability-5abb5743.js"),["BuilderAvailability-5abb5743.js","componentLoader.jsx-2026.09.09-3cefc4ce.js","vendor-21ae10b1.js","brand-387037d2.js","logger-3e1e3eff.js","index-213dd4d3.js","universe.js-2026.09.09-3cefc4ce.js","Dialog-0099f068.js","index-e642497c.js","TextStyle-014c4a6a.js","Tabs-3f2a715b.js","index-2089c6e8.js","EventModalContainer-881be445.js","_createCompounder-d03d2ffe.js","_arrayReduce-4ab62823.js","toString-4b4600cf.js","isSymbol-34885b27.js","constants-9e5fc5e0.js","Banner-09ca2b24.js","index-2506ba77.js","isEqual-8f2d02ec.js","_baseIsEqual-8f542891.js","_Uint8Array-4a201bc7.js","eq-9168d086.js","_equalByTag-f809a93d.js","_getAllKeys-a79fe303.js","_isIndex-1f105582.js","cloneDeep-02f21378.js","_baseClone-a0680933.js","_baseAssignValue-ed5c7dbb.js","_defineProperty-27e63e7c.js","index-33a30c39.js","Modal-25e86be7.js","TextField-3930079d.js","FormLayout-644dabe8.js","SectionHeader-fe038840.js","Grid-63374a37.js","Heading-45ab5a28.js","Incrementer-0fe5b84f.js","ButtonGroup-b00430ce.js","Button-ad9712a3.js","ChoiceGroup-8bc54c41.js","FormMessaging-3318ec3f.js","Checkbox-bd46d4a0.js","TimePicker-1f83cd46.js","moment-3238fc2d.js","Icon-a1844e0f.js","IconButton-b18cf368.js","ArrowRightLine-4c137dc5.js","Cross-eb4df075.js","List-3d3404f0.js","FieldLabel-e62f5b18.js","Add-563a4607.js","Text-393329c6.js","Edit-1d071c82.js","DateRangePicker-9969c921.js","ApplicableDays-d26588c7.js","DropDown2-ecd6eae7.js","BuilderContentsLayout-29ce1ec8.js","Title-bc4116fa.js","index-6a18cc6d.js","Card-3a1b3235.js","EmptyState-53c9c04c.js","Toggle-6d42fad4.js","Popover-7b090f95.js","Assets-616a6b02.js","HelpCircle-0303da15.js","_baseSum-340d39f5.js","_baseIteratee-2da5a91f.js","map-0a928914.js","_baseMap-d2567cee.js","_baseEach-5996395c.js","Link-0005ddf4.js","ChevronRight-02ef16e8.js","ChevronDown-38748d0a.js","CollapsibleRow-7eb01a38.js","Pill-aabd1c9f.js","isNumber-5490b21a.js","orderBy-697545e4.js","_baseOrderBy-8b0fc0ae.js","Availability-dc0a575d.js","PlusCircle-d9b3a71f.js","Trash-83186639.js","_baseSlice-35988e44.js","_isIterateeCall-18b95b3a.js","toInteger-a00cd50d.js","toFinite-cca2f94c.js","toNumber-8f88376b.js","react-router-dom-6e2566f9.js","hoist-non-react-statics.cjs-3f8ebaa8.js","objectWithoutPropertiesLoose-4f48578a.js","createAxiosInstance-650ff559.js","om
1it-abc9bd77.js","isPlainObject-b126badf.js","flatten-a652afe7.js","_setToString-74030a2f.js","skuHelper-00d76e9e.js","richTextEditorFunctions-9e6dc16b.js","uniqWith-e6899964.js","_baseUniq-21d7e434.js","uniq-942e3a3d.js","constants-b445ac4b.js"])),Xs=S(()=>_(()=>import("./BuilderPricing-4b184fd4.js"),["BuilderPricing-4b184fd4.js","componentLoader.jsx-2026.09.09-3cefc4ce.js","vendor-21ae10b1.js","brand-387037d2.js","logger-3e1e3eff.js","index-213dd4d3.js","universe.js-2026.09.09-3cefc4ce.js","Grid-63374a37.js","Title-bc4116fa.js","Dialog-0099f068.js","index-e642497c.js","EmptyState-53c9c04c.js","Text-393329c6.js","TextStyle-014c4a6a.js","SectionHeader-fe038840.js","BuilderContentsLayout-29ce1ec8.js","index-33a30c39.js","Icon-a1844e0f.js","_Uint8Array-4a201bc7.js","eq-9168d086.js","_equalByTag-f809a93d.js","index-6a18cc6d.js","Heading-45ab5a28.js","IconButton-b18cf368.js","Tooltip-a5f55937.js","Price-13d9957e.js","PlusCircle-d9b3a71f.js","CurrencyField-9c2f59bc.js","TextField-3930079d.js","CurrencyLabel-c23ac7bc.js","customerside.js-2026.09.09-3cefc4ce.js","toNumber-8f88376b.js","isSymbol-34885b27.js","VisibleDisabled-35c3beb4.js","Visible-444530d1.js","Trash-83186639.js","Incrementer-0fe5b84f.js","DropDown2-ecd6eae7.js","react-router-dom-6e2566f9.js","hoist-non-react-statics.cjs-3f8ebaa8.js","objectWithoutPropertiesLoose-4f48578a.js","cloneDeep-02f21378.js","_baseClone-a0680933.js","_baseAssignValue-ed5c7dbb.js","_defineProperty-27e63e7c.js","_getAllKeys-a79fe303.js","_isIndex-1f105582.js","orderBy-697545e4.js","_baseOrderBy-8b0fc0ae.js","toString-4b4600cf.js","_baseIteratee-2da5a91f.js","_baseIsEqual-8f542891.js","_baseMap-d2567cee.js","_baseEach-5996395c.js","index-2089c6e8.js","DataTable-7167be3c.js","constants-9e5fc5e0.js","Edit-1d071c82.js","ArrowRightLine-4c137dc5.js","ButtonGroup-b00430ce.js","Button-ad9712a3.js","Cube-0b718f9b.js","Percent-88c4673d.js","Pricing-22b55ad8.js","Link-0005ddf4.js","Popover-7b090f95.js","Menu-25761ab7.js","Add-563a4607.js","EventModalContainer-881be445.js","_createCompounder-d03d2ffe.js","_arrayReduce-4ab62823.js","Banner-09ca2b24.js","index-2506ba77.js","isEqual-8f2d02ec.js","Modal-25e86be7.js","moment-3238fc2d.js","DateRangePicker-9969c921.js","FormLayout-644dabe8.js","FieldLabel-e62f5b18.js","ApplicableDays-d26588c7.js","WarningCircle-cb107399.js","_baseUniq-21d7e434.js","AdvancedSettings-ae17e7f3.js","CollapsibleRow-7eb01a38.js","ChevronRight-02ef16e8.js","ChevronDown-38748d0a.js","Toggle-6d42fad4.js","ErrorMessage-93cdff5c.js","createAxiosInstance-650ff559.js","difference-637a01ba.js","flatten-a652afe7.js","_baseRest-95402609.js","_setToString-74030a2f.js","isString-1f05dd1e.js","toInteger-a00cd50d.js","toFinite-cca2f94c.js","List-3d3404f0.js","Checkbox-bd46d4a0.js","SearchFilter-e579441a.js","Search-22bd302e.js","TextFieldDebounced-9d207915.js","debounce-a96a8bf6.js","Cross-eb4df075.js","searchFilterFunctions-6e94a6af.js","capitalize-7d1af713.js","_baseSlice-35988e44.js","Card-3a1b3235.js","omit-abc9bd77.js","isPlainObject-b126badf.js","skuHelper-00d76e9e.js","richTextEditorFunctions-9e6dc16b.js","uniqWith-e6899964.js","uniq-942e3a3d.js","constants-b445ac4b.js"])),Qs=S(()=>_(()=>import("./BuilderUpsells-63223a8d.js"),["BuilderUpsells-63223a8d.js","componentLoader.jsx-2026.09.09-3cefc4ce.js","vendor-21ae10b1.js","brand-387037d2.js","logger-3e1e3eff.js","index-213dd4d3.js","universe.js-2026.09.09-3cefc4ce.js","Grid-63374a37.js","Heading-45ab5a28.js","Toggle-6d42fad4.js","BuilderContentsLayout-29ce1ec8.js","index-33a30c39.js","TextStyle-014c4a6a.js","Title-bc4116fa.js","Icon-a1844e0f.js","index-e642497c.js","_Uint8Array-4a201bc7.js","eq-9168d086.js","_equalByTag-f809a93d.js","index-6a18cc6d.js","isEqual-8f2d02ec.js","_baseIsEqual-8f542891.js","_getAllKeys-a79fe303.js","_isIndex-1f105582.js","cloneDeep-02f21378.js","_baseClone-a0680933.js","_baseAssignValue-ed5c7dbb.js","_defineProperty-27e63e7c.js","index-2089c6e8.js","Modal-25e86be7.js","toNumber-8f88376b.js","isSymbol-34885b27.js","FormLayout-644dabe8.js","TextField-3930079d.js","DropDown2-ecd6eae7.js","constants-9e5fc5e0.js","List-3d3404f0.js","ButtonGroup-b00430ce.js","Button-ad9712a3.js","Edit-1d071c82.js","Trash-83186639.js","PlusCircle-d9b3a71f.js","IconButton-b18cf368.js","Link-0005ddf4.js","EmptyState-53c9c04c.js","react-router-dom-6e2566f9.js","hoist-non-react-statics.cjs-3f8ebaa8.js","objectWithoutPropertiesLoose-4f48578a.js","createAxiosInstance-650ff559.js","index-2506ba77.js","omit-abc9bd77.js","toString-4b4600cf.js","_baseIteratee-2da5a91f.js","_baseSlice-35988e44.js","isPlainObject-b126badf.js","flatten-a652afe7.js","_setToString-74030a2f.js","skuHelper-00d76e9e.js","richTextEditorFunctions-9e6dc16b.js","uniqWith-e6899964.js","_baseUniq-21d7e434.js","uniq-942e3a3d.js","_arrayReduce-4ab62823.js","_baseEach-5996395c.js","constants-b445ac4b.js"])),Zs=S(()=>_(()=>import("./ErrorMessage-93cdff5c.js"),["ErrorMessage-93cdff5c.js","componentLoader.jsx-2026.09.09-3cefc4ce.js","vendor-21ae10b1.js","brand-387037d2.js","logger-3e1e3eff.js","index-213dd4d3.js","universe.js-2026.09.09-3cefc4ce.js","Dialog-0099f068.js","index-e642497c.js"])),ta=S(()=>_(()=>import("./Product404-6b86e5fb.js"),["Product404-6b86e5fb.js","componentLoader.jsx-2026.09.09-3cefc4ce.js","vendor-21ae10b1.js","brand-387037d2.js","logger-3e1e3eff.js","index-213dd4d3.js","universe.js-2026.09.09-3cefc4ce.js","Grid-63374a37.js","EmptyState-53c9c04c.js","Button-ad9712a3.js","ErrorOne-5ec3e009.js"])),ea=S(()=>_(()=>import("./UnsavedChangesDialog-cc5f89bb.js"),["UnsavedChangesDialog-cc5f89bb.js","componentLoader.jsx-2026.09.09-3cefc4ce.js","vendor-21ae10b1.js","brand-387037d2.js","logger-3e1e3eff.js","index-213dd4d3.js","universe.js-2026.09.09-3cefc4ce.js","Dialog-0099f068.js","index-e642497c.js"])),sa=S(()=>_(()=>import("./ArchiveProductDialog-d2b17601.js"),["ArchiveProductDialog-d2b17601.js","componentLoader.jsx-2026.09.09-3cefc4ce.js","vendor-21ae10b1.js","brand-387037d2.js","logger-3e1e3eff.js","index-213dd4d3.js","universe.js-2026.09.09-3cefc4ce.js","Dialog-0099f068.js","index-e642497c.js","TextStyle-014c4a6a.js"])),aa={productId:E.number,csrfToken:E.string,categories:E.array,allTaxes:E.array,guestTypeOptions:E.array,tagOptions:E.array,translations:E.object,match:E.object,dateFormat:E.string,timeFormat:E.string,history:E.object,featureFlags:E.object,allTemplates:E.object},na={parameters:E.array},G={bookingDisplay:"buttons",showUnavailableSlots:!1},rt={hideBookByAssetParam:!0},ot={distance:{value:0,units:"km"},fuelEfficiency:{value:0,units:"km/l",of:"gasoline"},carbonAmount:0},Bt={categoryId:null,name:"",sku:"",summary:"",details:"",extraDetails:"",url:"",images:[],video:"",location:"",visibility:"everyone",allocation:null,guestTypes:[],pricingType:fe,tags:[],commissionType:null,commissionCents:null,commissionPercent:null,interval:60,weight:0,enabled:!0,taxes:[],depositType:me,depositCents:null,depositPercent:null,carbonOffset:0,integrations:[],cfMeta:{timeslotOptions:G,pricingOptions:rt,carbonOffset:ot},events:[],templates:[],customRateIds:[]},Lt={assetGroups:[],staffResources:[],inventory:null,allocationType:Ot},Nt={pricing:{productPrices:[{id:B.generate(),groupMin:0,groupMax:0,amount:0}],guestPrices:[]}};function yt({staffResources:e,assetGroups:a,inventory:t}){const s=!!a.length,n=!!e.length;let r=Ot;return s&&n?r=q:s?r=H:n?r=W:t&&(r=L),r}function ra({preselected:e,priceOverridePercentage:a,dateRestriction:t,restrictGuestTypeAdjustment:s,guestTypeMaps:n}){return{preselected:e,priceOverridePercentage:a||0,dateRestriction:t||be,restrictGuestTypeAdjustment:s,guestTypeMaps:n}}function oa({productPrices:e,guestPrices:a}){return{pricing:{productPrices:tt(e),guestPrices:tt(a)}}}function vt(e,a){return e.map(t=>{const s=t.assetPools.length?t.assetPools[0].assetPoolId:null,n=s&&a.length?a.find(r=>r.id==s).categoryId:null;return{...t,id:B.generate(),categoryId:n}})}function bt({name:e,sku:a,categoryId:t,allocation:s,visibility:n,interval:r,summary:o,video:i,details:u,extraDetails:c,url:l,weight:p,guestTypes:d,tags:A,pricingType:C,integrations:I,cfMeta:y,taxes:f,depositType:D,depositCents:O,depositPercent:Y,carbonOffset:h,images:v,commissionType:U,commissionCents:z,commissionPercent:J,templates:it,customRateIds:lt}){return{name:e,categoryId:t,sku:a,allocation:s,visibility:n,summary:o,video:As(i),details:u,extraDetails:c,url:l,weight:p,guestTypes:d,tags:A,pricingType:C,interval:s==Pe?r:60,taxes:f.map(({id:Vt})=>({id:Vt})),depositType:D,depositCents:O,depositPercent:Y,carbonOffset:h,integrations:I,cfMeta:{timeslotOptions:s==V?y.timeslotOptions:null,pricingOptions:y.pricingOptions||rt,carbonOffset:y.carbonOffset||ot},images:v,commissionType:U&&(z||J)?U:null,commissionCents:U===ye&&z?z:null,commissionPercent:U===ve&&J?J:null,templates:it||[],customRateIds:lt||[]}}function ia({pricing:{productPrices:e,guestPrices:a}},t,s){return{productPrices:e.map(({groupMin:n,groupMax:r,amount:o})=>({groupMax:r,groupMin:n,amount:o||0})).map(n=>M(n,"id")),guestPrices:Ft(a,t).map(n=>M(n,"id")),productId:s}}function Gt({parameters:e}){const a=e.map((t,s)=>P("li",{children:t},s));return R("div",{className:"padding-top-1",children:[P("strong",{children:"Invalid Parameters:"}),P("ul",{children:a})]})}function Tt(){return{product:Bt,events:[],upsells:[],loading:!0,leav
1ingBuilder:!1,error:{errorMessage:"",errorCode:"",parameters:null},notFound:!1,currency:{},saving:!1,productAssets:Lt,assetPools:[],staffPools:[],assetPoolCategories:[],showArchiveDialog:!1,defaultPricing:Nt,nextWindowLocation:"/inventory/products"}}class jt extends zt.Component{constructor(t){super(t);N(this,"handleLeave",t=>(!this.state.leavingBuilder&&this.isProductDirty()&&(t.returnValue=!0),t.returnValue));N(this,"handleImageUpload",t=>{const s=new FileReader;s.addEventListener("load",n=>{const r=n.target.result;this.setState({product:m(this.state.product,{images:{$push:[{file:t,unsaved:!0,id:B.generate(),base64:r}]}})})}),s.readAsDataURL(t)});N(this,"handleImageDelete",t=>{const s=this.state.product.images.findIndex(n=>n.id===t);this.setState({product:m(this.state.product,{images:{[s]:{deleted:{$set:!0}}}})})});const{categories:s,tagOptions:n,allTemplates:r}=t;this.setDefaultOriginalValues();const o=this.getProductIdToCopy();this.state={categories:s,tagOptions:n,productIdToCopy:o,allTemplates:r?Object.keys(r).map(i=>({value:k(r[i].id),label:r[i].title,status:r[i].status})):[],...Tt()}}setDefaultOriginalValues(){this.originalEvents=[],this.originalProduct={},this.originalProductAssets={allocationType:"",assetGroups:[],inventory:null,staffResources:[]},this.originalDefaultPricing={},this.originalUpsells=[]}async componentDidMount(){window.removeEventListener("beforeunload",this.handleLeave),window.addEventListener("beforeunload",this.handleLeave),await this.loadProduct()}async componentWillUnmount(){window.removeEventListener("beforeunload",this.handleLeave)}getProductIdToCopy(){let t=null;const s=It.parse(location.search);return t=$e(s,"copy")&&this.props.productId===null?k(s.copy):null,t}resetOriginalValues(){const{events:t,product:s,productAssets:n,defaultPricing:r,upsells:o}=this.state;this.originalEvents=T(t),this.originalProduct=T(s),this.originalProductAssets=T(n),this.originalDefaultPricing=T(r.pricing),this.originalUpsells=T(o)}componentDidCatch(t,s){w.notice({subject:"There was a problem in the Product Builder",context:{error:t,info:s}})}async loadCompany(){const t=b();try{const{data:{data:{currency:s}}}=await t("/company");return s}catch(s){w.notice({subject:"There was a problem retrieving company data",context:s})}}async loadAssetPools(){const t=b();try{const{data:{data:s}}=await t("/assetpools");return s}catch(s){w.notice({subject:"There was a problem retrieving Asset Pools",context:s})}}async loadAssetPoolCategories(){const t=b();try{const{data:{data:s}}=await t("/assetpool-categories");return s}catch(s){w.notice({subject:"There was a problem retrieving Asset Pool Categories",context:s})}}async loadStaffPools(){const{featureFlags:t}=this.props,s=b();if(!t.staffResources)return[];try{const{data:{data:n}}=await s("/staffpools");return n}catch(n){w.notice({subject:"There was a problem retrieving Staff Pools",context:n})}}async loadProduct(){try{const{productId:t}=this.props;if(t)await this.loadExistingProduct(t);else if(this.state.productIdToCopy){const s=this.state.productIdToCopy;await this.loadExistingProduct(s),await this.resetProductForCopy(s)}else await this.loadDefaultProduct()}catch(t){this.setState({loading:!1,error:"Something went wrong, please try again"}),w.notice({subject:"There was a problem loading Product data",context:t})}}async loadExistingProduct(t){const[{data:{data:s}},{data:{data:n}},{data:{data:r}},{data:{data:o}},{data:{data:i}},u,c,l,p]=await this.getAllProductData(t),d=oa(o),A=ls(r,d),C={...s,enabled:s.status==ht,cfMeta:ms(s,d,rt,G,ot),images:s.images},I={...n,assetGroups:vt(n.assetGroups,u),allocationType:yt(n),staffPools:c};this.originalEvents=T(A),this.originalProduct=T(C),this.originalProductAssets=T(I),this.originalDefaultPricing=T(o),this.originalUpsells=T(i),document.title=K(C.name),this.setState({loading:!1,product:C,events:A,productAssets:I,defaultPricing:d,upsells:i,assetPools:u,staffPools:c,currency:l,assetPoolCategories:p})}async resetProductForCopy(t){const s=await this.getImagesForProduct(t),n=Gs(this.state.product,s),r=js(this.state.events),o=Vs(this.state.productAssets),i=Hs(this.state.defaultPricing),u=Ws(this.state.upsells);this.setDefaultOriginalValues(),document.title=K(n.name),this.setState({product:n,events:r,productAssets:o,defaultPricing:i,upsells:u})}async getImagesForProduct(t){const s=b(this.props.csrfToken),{data:{data:n}}=await s(`/products/${t}/images?with[]=base64`);return n}async loadDefaultProduct(){const[t,s,n,r]=await Promise.all([this.loadCompany(),this.loadAssetPools(),this.loadStaffPools(),this.loadAssetPoolCategories()]);this.setState({...Tt(),product:Bt,productAssets:Lt,defaultPricing:Nt,upsells:[],loading:!1,currency:t,assetPools:s,staffPools:n,assetPoolCategories:r}),await this.enableDefaultTaxes()}async enableDefaultTaxes(){const{allTaxes:t}=this.props;
1let s=Ts(t);this.handleChangeProduct(s,"taxes")}async getAllProductData(t){const s=b();return await Promise.all([s(`/products/${t}?with[]=images&with[]=integrations`).catch(n=>{if(n.response.status==404)this.setState({loading:!1,notFound:!0});else throw n}),s(`/products/${t}/resources`),s(`/products/${t}/events`),s(`/products/${t}/pricing`),s(`/products/${t}/upsells`),this.loadAssetPools(),this.loadStaffPools(),this.loadCompany(),this.loadAssetPoolCategories()])}async saveProductData(){var u,c;const{productAssets:t,defaultPricing:s,product:n,product:{productId:r}}=this.state,o=Ns(t),i=b(this.props.csrfToken);try{const l=this.getDirtyMap();if(l.product&&await i.patch(`/products/${r}/`,bt(n)),l.productAssets){const{data:{data:y}}=await i.patch(`/products/${r}/resources`,o),{assetPools:f,staffPools:D}=this.state,O={...y,assetGroups:vt(y.assetGroups,f),allocationType:yt(y),staffPools:D};this.setState({productAssets:O}),this.originalProductAssets=T(O)}const p=[];let d=null;(l.productPrices||l.guestPrices)&&(d=ia(s,n.guestTypes,r),p.push(i.patch(`/products/${r}/pricing`,d)));const A=l.upsells?this.getUpsellsApiCall():[],C=[...p,...A,this.makeImageApiCalls()];await Promise.all(C);const I=this.state.upsells.filter(({deleted:y})=>!y);this.setState({product:n,defaultPricing:s,upsells:I}),this.originalProduct=T(n),this.originalUpsells=T(I),d&&(this.originalDefaultPricing=T(d))}catch(l){const p=((c=(u=l.response)==null?void 0:u.data)==null?void 0:c.error)||"Upsell save error";p&&this.setErrorMessageAndCode(p),w.notice({subject:"There was a problem saving Product data",context:l})}}getUpsellsApiCall(){const{product:{productId:t},upsells:s}=this.state,n=b(this.props.csrfToken);return s.map(r=>{const o=this.originalUpsells.find(u=>u.addonId==r.addonId),i=ra(r);return r.deleted?o?n.delete(`/products/${t}/upsells/${r.addonId}`):null:o?n.patch(`/products/${t}/upsells/${r.addonId}`,i):n.post(`/products/${t}/upsells/${r.addonId}`,i)})}async deleteImageApiCall(t){return await b(this.props.csrfToken).delete(`/products/${this.state.product.productId}/images/${t.id}`)}makeImageApiCall(t){return b(this.props.csrfToken).post(`/products/${this.state.product.productId}/images`,t.file,{"content-type":t.file.type})}makeImageApiCalls(){return this.state.product.images.reduce(async(t,s)=>{if(await t,s.unsaved&&!s.deleted)await this.makeImageApiCall(s);else if(!s.unsaved&&s.deleted&&s.id)return this.deleteImageApiCall(s)},Promise.resolve())}async upsertEvent(t){let{data:{data:{eventId:s}}}=await this.makeEventApiCall(t);return{...t,eventId:s||t.eventId}}async saveEventsData(){if(!this.getDirtyMap().events)return;const{events:t}=this.state,s={};t.forEach(l=>{s[l.id]=l});const n={};this.originalEvents.forEach(l=>{n[l.id]=l});const r=t.filter(l=>l.id&&!x(n[l.id],l)||l.eventId===null),o=r.filter(({deleted:l})=>l),i=r.filter(({deleted:l})=>!l),u=i.filter(je),c=i.filter(Ve);try{const l=o.map(async f=>this.makeEventApiCall(f));await Promise.all(l);const p=Xt(s,f=>!("deleted"in f)),d=u.map(async f=>this.upsertEvent(f));(await Promise.all(d)).forEach(f=>p[f.id]=f);const C=c.map(async f=>{if(f.overriddenEventId!==null&&isNaN(f.overriddenEventId)){const D=p[f.overriddenEventId];f.overriddenEventId=D.eventId}return this.upsertEvent(f)});(await Promise.all(C)).forEach(f=>p[f.id]=f);const y=Object.values(p);this.setState({events:y}),this.originalEvents=T(y)}catch(l){const p=l.response.data.error;p&&this.setErrorMessageAndCode(p),w.notice({subject:"There was a problem saving Event data",context:l})}}async makeEventApiCall(t){const{product:{productId:s,allocation:n,guestTypes:r},defaultPricing:o,productAssets:i}=this.state,u=$s(t,n,r,s,o,i),c=b(this.props.csrfToken);return t.deleted?t.eventId?c.delete(`/products/${s}/events/${t.eventId}`):{data:{data:{eventId:null}}}:t.eventId?c.patch(`/products/${s}/events/${t.eventId}`,u):c.post(`/products/${s}/events/`,u)}setErrorMessageAndCode({errorCode:t,message:s,parameters:n}){this.setState({error:{errorMessage:s,errorCode:t,parameters:n}})}async handleSaveNewProduct(){const t=bt(this.state.product),s=b(this.props.csrfToken);try{const{data:{data:{productId:n}}}=await s.post("/products/",t);return this.handleChangeProduct(n,"productId"),await this.saveProductData(),await this.saveEventsData(),this.resetOriginalValues(),n}catch(n){const r=n.response.data.error;r&&this.setErrorMessageAndCode(r),w.notice({subject:"There was a problem saving new Product",context:n})}finally{this.setState({saving:!1})}}async handleSave(){const{history:t}=this.props;if(this.props.productId)await this.saveProductData(),await this.saveEventsData(),this.setState({saving:!1});else{const s=await this.handleSaveNewProduct();s?t.push(t.location.pathname.replace("new",s)):this.setState({saving:!1})}}async handleClickSave(){this.setState({saving:!0}),await this.handleSave()}handleClickExit(){this.isProductDirty()?this.setState({leavingBuilder:!0}):this.handleFinish()}async saveAndContinue(){this.isProductDirty()&&await this.handleClickSave(),window.location=this.state.nextWindowLocation}handleFinish(){window.location=this.state.nextWindowLocation}async handleAddNewTag(t){const{tagOptions:s,product:n}=this.state,r=b(this.props.csrfToken);try{const{data:{data:o}}=await r.post("/tags",{name:t,visibility:"staff"}),i=m(s,{$push:[{label:o.name,value:o.id}]}),u=m(n,{tags:{$push:[o]}});this.setState({tagOptions:i,product:u})}catch(o){w.notice({subject:"There was a problem adding a new Tag",context:o})}}async handleAddNewCategory(t){const{categories:s,product:n}=this.state,r=b(this.props.csrfToken);try{const{data:{data:o}}=await r.post("/categories",{name:t,weight:0}),i=m(s,{$push:[{label:o.name,value:o.id}]}),u=m(n,{categoryId:{$set:o.id}});this.setState({categories:i,product:u})}catch(o){w.notice({subject:"There was a problem adding a new Category",context:o})}}handleChangeUpsell(t){const{upsells:s}=this.state,n=s.findIndex(({addonId:i})=>i==t.addonId),r=n<0?{$push:[t]}:{[n]:{$set:t}},o=m(s,r);this.handleChange(o,"upsells")}handleSaveEvent(t){const{events:s}=this.state,n=this.getEventIndex(t.id),r=n<0?{$push:[t]}:{[n]:{$set:t}},o=m(s,r);this.handleChange(o,"events")}handleChangeEvent(t,s,n){const{events:r}=this.state,o=this.getEventIndex(n),i=m(r,{[o]:{[s]:{$set:t}}});this.handleChange(i,"events")}getEventIndex(t){const{events:s}=this.state;return s.findIndex(n=>n.id==t)}handleChangeProductName(t){const{product:s,product:{sku:n,name:r,productId:o}}=this.state,{translations:i}=this.props,u=n==ct(r).toLowerCase()?ct(t).toLowerCase():n,c={name:{$set:t},...o?{}:{sku:{$set:u}}};document.title=K(t||i.newProduct),this.handleChange(m(s,c),"product")}handleChange(t,s){this.setState({[s]:t})}handleChangeProductAssets(t){const s=rs(this.state.events,t),n=this.updateCfMetaPricingOptionsAfterProductAssetsChange(this.state.product,this.state.productAssets,t);this.setState({events:s,productAssets:t,product:n})}updateCfMetaPricingOptionsAfterProductAssetsChange(t,s,n){const r=fs(t,s,n);return m(t,{cfMeta:{pricingOptions:{hideBookByAssetParam:{$set:r}}}})}handleChangeDefaultPricing(t,s){const{events:n,defaultPricing:r}=this.state,o={...r,pricing:{...r.pricing,[s]:t}},i=n.map(u=>{const c=u.pricing[s]?u.pricing[s].reduce((l,p)=>{const d=o.pricing[s].find(({id:A})=>A==p.id);return d?l.concat({...p,pricingType:d.pricingType,groupMin:d.groupMin,groupMax:d.groupMax}):l},[]):null;return{...u,pricing:{...u.pricing,[s]:c}}});this.setState({events:i,defaultPricing:o})}handleChangeProduct(t,s){const{product:n}=this.state,r=m(n,{[s]:{$set:t}});this.setState({product:r})}handleChangeMultipleProductProperties(t){const s=t.reduce((r,o)=>({...r,[o.property]:{$set:o.value}}),{}),n=m(this.state.product,s);this.setState({product:n})}handleChangeProductAllocation(t){const{bookingDisplay:s,showUnavailableSlots:n}=this.state.product.cfMeta.timeslotOptions,{pricingType:r}=this.state.product,o=m(this.state.product,{allocation:{$set:t},cfMeta:{timeslotOptions:{bookingDisplay:{$set:s||G.bookingDisplay},showUnavailableSlots:{$set:n||G.showUnavailableSlots}}},pricingType:{$set:r===ge||t===V?st:r}});this.handleChange(o,"product")}handleCloseDialog(){this.setState({leavingBuilder:!1,error:{errorMessage:"",errorCode:"",parameters:null}})}async handleToggleArchive(){const{product:t,product:{productId:s,enabled:n}}=this.state,r=b(this.props.csrfToken);this.setState({saving:!0,showArchiveDialog:!1});try{n?await r.delete(`/products/${s}`):await r.patch(`/products/${s}`,{status:ht}),this.setState({product:{...t,enabled:!n},saving:!1})}catch(o){const i=o.response.data.error;i&&this.setErrorMessageAndCode(i),w.notice({subject:`There was a problem ${n?"archiving":"unarchiving"} a product`,context:o})}}handleSaveTemplate(t){const{templates:s}=this.state.product,n=s.findIndex(({templateId:i})=>i===t.templateId),r=n<0?{$push:[t]}:{[n]:{$set:t}},o=m(s,r);this.handleChangeProduct(o,"templates")}
1handleRemoveTemplate(t){const{templates:s}=this.state.product,n=s.findIndex(o=>o.templateId===t),r=m(s,{$splice:[[n,1]]});this.handleChangeProduct(r,"templates")}getDirtyMap(){const{product:t,events:s,productAssets:n,defaultPricing:r,upsells:o}=this.state,i=!x(this.originalProduct,t),u=!x(this.originalEvents,s),c=!x(this.originalProductAssets,n),l=r.pricing.productPrices.map(f=>M(f,["id","pricingType","enabled"])),p=r.pricing.guestPrices.map(f=>M(f,["id","enabled"])),d=this.originalDefaultPricing.productPrices?this.originalDefaultPricing.productPrices.map(f=>M(f,["id","pricingType","enabled"])):{},A=this.originalDefaultPricing.guestPrices?this.originalDefaultPricing.guestPrices.map(f=>M(f,["id","enabled"])):{},C=!x(d,l),I=!x(A,p),y=!x(this.originalUpsells,o);return{product:i,events:u,productAssets:c,productPrices:C,guestPrices:I,upsells:y}}isProductDirty(){return Object.values(this.getDirtyMap()).some(t=>t)}validateFields(){const{product:{name:t,sku:s,summary:n}}=this.state,r=ee(n)<=60;return!!t&&!!s&&r}canSave(){return this.canProceed()&&this.isProductDirty()&&this.validateFields()}canProceed(){return this.newProductWithRequiredFields()&&!Ps(this.state.productAssets)&&this.checkDefaultPricesAreValid()}newProductWithRequiredFields(){const{product:{name:t,categoryId:s,allocation:n}}=this.state,{productId:r}=this.props;return!r&&t&&s&&n||!!r}checkPricesNotNegative(){const t=this.state.defaultPricing.pricing;return t.guestPrices.concat(t.productPrices).every(n=>n.amount>=0)}checkDefaultPricesAreValid(){return this.checkPricesNotNegative()&&ys(this.state.defaultPricing.pricing)}handleCopyProductClick(){const t=this.generateCopyUrl(this.props.productId);this.isProductDirty()?this.setState({nextWindowLocation:t,leavingBuilder:!0}):window.location=t}generateCopyUrl(t){return`/inventory/products/new/attributes?copy=${t}`}render(){const{loading:t,product:s,product:{name:n},error:r,notFound:o,saving:i,showArchiveDialog:u,...c}=this.state,{match:{url:l},productId:p,translations:d,...A}=this.props,C=this.canSave(),I=this.canProceed(),y=ps(this.state.events),f={...A,...c,events:y,product:s,handleChange:(h,v)=>{this.handleChange(h,v)},handleSaveEvent:(h,v)=>{this.handleSaveEvent(h,v)},handleRemoveEvent:(h,v)=>{this.handleChangeEvent(!0,"deleted",h,v)},handleChangeEvent:(h,v,U)=>{this.handleChangeEvent(h,v,U)},handleChangeProductName:h=>{this.handleChangeProductName(h)},handleChangeProduct:(h,v)=>{this.handleChangeProduct(h,v)},handleChangeMultipleProductProperties:h=>{this.handleChangeMultipleProductProperties(h)},handleAddNewCategory:h=>{this.handleAddNewCategory(h)},handleAddNewTag:h=>{this.handleAddNewTag(h)},handleChangeDefaultPricing:(h,v)=>{this.handleChangeDefaultPricing(h,v)},handleChangeUpsell:h=>{this.handleChangeUpsell(h)},handleChangeProductAssets:h=>{this.handleChangeProductAssets(h)},handleChangeProductAllocation:h=>{this.handleChangeProductAllocation(h)},handleSaveTemplate:h=>{this.handleSaveTemplate(h)},handleRemoveTemplate:h=>{this.handleRemoveTemplate(h)},handleImageUpload:this.handleImageUpload,handleImageDelete:this.handleImageDelete},D=[{label:d.attributes,path:"/attributes",component:zs,title:d.productAttributes,subTitle:d.attributesSubTitle},{label:d.details,path:"/details",component:Js,title:d.productMedia,subTitle:d.detailsSubTitle},{label:d.availability,path:"/availability",component:Ks,title:d.productAvailability,subTitle:d.availabilitySubTitle},{label:d.pricing,path:"/pricing",component:Xs,title:d.productPricing,subTitle:d.pricingSubTitle},{label:d.upsells,path:"/upsells",component:Qs,title:d.productUpsells,subTitle:d.upsellsSubTitle}],O={navigationItems:D,dirty:C,handleSave:()=>{this.handleClickSave()},handleClickExit:()=>{this.handleClickExit()},name:n,nextDisabled:!I,productId:p,productVisibility:s.visibility,saving:i,moreMenu:[{title:s.enabled?d.archive:d.unarchive,id:"archiveProduct",onClick:()=>{this.handleChange(!0,"showArchiveDialog")},disabled:!s.productId}]};O.moreMenu.push({title:d.copyProduct,id:"copyProduct",onClick:()=>{this.handleCopyProductClick()},disabled:!s.productId});const Y=`${l}${D[0].path}`;return t?P(qt,{}):R(Jt,{children:[D.map(h=>P(At,{path:`${l}${h.path}`,exact:!0,render:({match:{path:v}})=>R(Et,{children:[o||!this.newProductWithRequiredFields()&&v!=Y?P(ta,{}):P(Ys,{title:h.title,subTitle:h.subTitle,baseUrl:l,currentUrl:v,...O,children:P(h.component,{...f})}),R(Zs,{active:!!r.errorMessage,handleCloseDialog:()=>{this.handleCloseDialog()},children:[R("div",{children:[P(pt,{strong:!0,children:"Message:"})," ",r.errorMessage]}),R("div",{children:[P(pt,{strong:!0,children:"Error code:"})," ",r.errorCode]}),r.parameters&&P(Gt,{parameters:r.parameters})]}),P(ea,{active:this.state.leavingBuilder,handleCloseDialog:()=>{this.handleCloseDialog()},saveAndContinue:async()=>{await this.saveAndContinue()},handleExitBuilder:()=>{this.handleFinish()}}),P(sa,{active:u,productName:s.name,isProductEnabled:s.enabled,handleConfirm:()=>{this.handleToggleArchive()},handleCancel:()=>{this.handleChange(!1,"showArchiveDialog")}})]})},`route-${h.path}`)),P(Ct,{to:`${l}/attributes`})]})}}jt.propTypes=aa;Gt.propTypes=na;const la=jt;function ca(e){return P(Kt,{basename:"/inventory/products",children:P(At,{path:"/:productId",render:({match:a,match:{params:{productId:t}},location:s,history:n})=>(t=t!="new"?k(t):null,t!==null&&Number.isNaN(t)?P(Ct,{to:"/new"}):P(la,{match:a,productId:t,location:s,history:n,...e}))})})}const cn=Object.freeze(Object.defineProperty({__proto__:null,default:ca},Symbol.toStringTag,{value:"Module"}));
1export{Wa as A,ze as B,Ya as C,as as D,Ge as E,hs as F,Ja as G,Q as H,ln as I,ft as J,nn as K,sn as L,cn as P,W as R,Ka as S,Ke as T,tn as a,Za as b,en as c,za as d,xt as e,Qa as f,Ha as g,Ba as h,ja as i,Va as j,Na as k,Xa as l,H as m,q as n,L as o,Ot as p,Je as q,on as r,rn as s,at as t,je as u,La as v,an as w,Ga as x,He as y,qa as z};

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.