1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3230],{6644:(e,i,t)=>{t.d(i,{Bo:()=>A,EE:()=>c,F4:()=>d,Ne:()=>u,PT:()=>g,R9:()=>b,RP:()=>s,SR:()=>C,UW:()=>o,X1:()=>p,bN:()=>v,cN:()=>m,d7:()=>r,fg:()=>n,hq:()=>N,n7:()=>f,nz:()=>y,sr:()=>h,v5:()=>l,w_:()=>F});var a=t(66031);let r=2,n=e=>e?e.replace(/\.00$/,""):"",s=e=>null!=e&&0!==e,o=e=>e?.campgroundPricingRules?.find(e=>e.ruleType===a.S6.StayLength),l=1,d=e=>{let i=e?.campsitesConfiguration?.cleaningFee;return i&&i.minorAmount>0?i.formatWithoutMinorIfWhole:void 0},u=e=>{let i=e?.petFee?.valueMoney;return i&&i.minorAmount>0?i.formatWithoutMinorIfWhole:void 0},c=e=>e?.campsitesConfiguration?.baseCapacity??r,p=e=>n(e?.pricePerNight?.formatWithoutSymbol),m=e=>e?.pricePerNight?.symbol??"$",g=e=>{let i=e?.campsitesConfiguration;if(!i)return!1;let t=i.baseCapacity,a=i.maxCapacity;return null!=t&&null!=a&&t===a},h=e=>{let i=e?.campgroundSetting?.pricePerVehicle;return i&&i.minorAmount>0?i.formatWithoutMinorIfWhole:void 0},v=(e,i,t)=>{let a;if(!i)return;let r=e?.campsitesConfiguration?.maxVehicles??1,n=e?.campgroundSetting?.includedParkingSpots??1,s=(a=Math.max(l,r-1),Math.max(l,Math.min(n,a)));return 0===r?t("siteEditor:overview.sections.pricing.rules.extraVehicleFee.subtitleNoVehicles"):0===s?t("siteEditor:overview.sections.pricing.rules.extraVehicleFee.subtitleFromFirst"):1===s?t("siteEditor:overview.sections.pricing.rules.extraVehicleFee.subtitleAfterFirst"):t("siteEditor:overview.sections.pricing.rules.extraVehicleFee.subtitleAfterFirstN",{count:s})},f=(e,i)=>{let t=e?.holidaySettings,a=(t?.length??0)>0,r=t?.[0]?.premiumPercentage||0,n=t?.[0]?.minimumNights;return{value:a?`+${r}%`:void 0,subtitle:a&&n?i("siteEditor:overview.sections.pricing.rules.customHolidayPricing.subtitle",{minimumNights:n}):void 0,hasHolidayPricing:a}},y=e=>{let i=e?.campsitesConfiguration?.weeknightPricePercentage;return(i??0)>0?`${i}%`:void 0},A=e=>{let i=o(e);return i?.percentageAdjustment?Math.abs(i.percentageAdjustment):null},C=e=>{let i=A(e);return(i??0)>0?`${i}%`:void 0},F=(e,i)=>(parseFloat(e||"0")*(1-(i||0)/100)).toFixed(2),$=(e,i)=>(parseFloat(e||"0")*(1+(i||0)/100)).toFixed(2),b=(e,i,t,a,r,s,o)=>{let l=F(e,a),d=F(i,a),u=F(t,a);return{displayPrice:`${r}${n(l)}`,displayAdditionalAdultFee:`+${r}${n(d)} ${s}`,displayAdditionalChildFee:`+${r}${n(u)} ${o}`}},N=(e,i,t,a,r,s,o)=>{let l=$(e,a),d=$(i,a),u=$(t,a);return{displayPrice:`${r}${n(l)}`,displayAdditionalAdultFee:`+${r}${n(d)} ${s}`,displayAdditionalChildFee:`+${r}${n(u)} ${o}`}}},33972:(e,i,t)=>{t.d(i,{A:()=>A});var a=t(37876),r=t(31219),n=t(37094),s=t(14232),o=t(59733),l=t(34321),d=t(48045),u=t(6644),c=t(51072),p=t(73444),m=t(53738),g=t(62535),h=t(35113),v=t(27814),f=t(2583);let y={adult:{fieldName:"additionalAdultFeePerNight",translationKey:"additionalAdultFee",inputId:"additional-adult-fee-input",ruleId:d.I.ADDITIONAL_ADULT_FEE},child:{fieldName:"additionalChildFeePerNight",translationKey:"additionalChildFee",inputId:"additional-child-fee-input",ruleId:d.I.ADDITIONAL_CHILD_FEE}},A=({feeType:e,onCancel:i,onSave:t})=>{let{t:d}=(0,n.Bd)(),{closeEditor:A,editorVariant:C}=(0,o.h)(),{campground:F,campgroundId:$,refetchCampground:b,handleError:N}=(0,m.A)(),{setSnackbarState:x}=(0,g.A)(),[w,I]=(0,s.useState)(!1),E=(0,s.useRef)(null),P=y[e],S=(0,c.tN)(c.jI.PRICING,P.ruleId,"additional-charges",C),T=F?.pricePerNight?.symbol??v.Zy,D=F?.campsitesConfiguration?.[P.fieldName],M=(0,u.fg)(D?.formatWithoutSymbol),V=D&&D.minorAmount>0,k=V?M:"0",{currentValue:W,hasChanges:L,updateValue:_,save:R}=(0,p.Y)({initialValue:k}),j=async()=>{if(!E.current?.checkValidity())return void x({snackbarMessage:d(`siteEditor:overview.sections.pricing.editors.${P.translationKey}.invalidFeeError`)});I(!0);try{await N(async()=>{await (0,h.A)({campgroundId:$,[P.fieldName]:W}),await b(),R()})&&(x({snackbarMessage:d("siteEditor:overview.sections.pricing.editors.common.updatedMessage",{title:d(`siteEditor:overview.sections.pricing.editors.${P.translationKey}.title`)})}),t&&t())}finally{I(!1)}},K=parseFloat(W),U=!isNaN(K)&&K>=0&&(!V||L);return(0,a.jsx)(l.A,{title:d(`siteEditor:overview.sections.pricing.editors.${P.translationKey}.title`),subtitle:d(`siteEditor:overview.sections.pricing.editors.${P.translationKey}.subtitle`),onCancel:i||A,onSave:j,saveDisabled:!U,isSaving:w,hasChanges:L,valueBefore:L?k:void 0,valueAfter:L?W:void 0,children:(0,a.jsx)(r.Box,{display:"flex",width:"100%",minHeight:"120px",children:(0,a.jsx)(f.A,{ref:E,id:P.inputId,type:"number",inputMode:"decimal",min:0,step:"any",variant:"displayL",textColor:"brand2.500",leadingCharacter:T,value:W,onChange:_,event:S.event("change")})})})}},35113:(e,i,t)=>{t.d(i,{A:()=>s});var a=t(48789),r=t(2155);let n=(0,a.gql)` 2 mutation UpdateCampsitesConfiguration($input: UpdateCampsitesConfigurationInput!) { 3 updateCampsitesConfiguration(input: $input) { 4 campsitesConfiguration { 5 accessType 6 accessVehicleType 7 accessVehicleTypeDescription 8 hasWheelchairAccess 9 maxRvLengthUnits { 10 value 11 abbr 12 plural 13 } 14 rvAccessType 15 rvAccommodatesSlideouts 16 rvSurfaceDescription 17 rvSurfaceLevelnessType 18 rvSurfaceType 19 rvTypesDescription 20 rvSlideoutsDescription 21 maxRvLengthDescription 22 weeknightPricePercentage 23 maxCapacity 24 } 25 } 26 } 27`,s=async e=>{await (0,r.A)()(n,{input:e})}},53230:(e,i,t)=>{t.r(i),t.d(i,{default:()=>n});var a=t(37876),r=t(33972);let n={component:e=>(0,a.jsx)(r.A,{...e,feeType:"adult"})}}}]); 28//# sourceMappingURL=3230.e2bbcb2003ddff63.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.