1"use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[4661],{54817:(t,e,n)=>{n.d(e,{Z:()=>Z});var a=n(72791),i=n(81694),o=n.n(i),s=(n(29305),n(53176)),r=(n(73665),n(84480)),l=n(82795);const d="FieldDateAndTimeInput_root__fHOSN",m="FieldDateAndTimeInput_formRow__UVYlg",c="FieldDateAndTimeInput_field__+MASE",u="FieldDateAndTimeInput_fieldDateInput__6xhar",h="FieldDateAndTimeInput_fieldSelect__CAH5l",g="FieldDateAndTimeInput_fieldSelectDisabled__sne9z FieldDateAndTimeInput_fieldSelect__CAH5l",D="FieldDateAndTimeInput_select__amDFS",b="FieldDateAndTimeInput_selectDisabled__4GXyO FieldDateAndTimeInput_select__amDFS",T="FieldDateAndTimeInput_arrowIcon__tId9H",p="FieldDateAndTimeInput_startDate__qT-Pz",k="FieldDateAndTimeInput_lineBetween__y+FmY",_="FieldDateAndTimeInput_lineBetweenDisabled__Him6r",y=new Date,E=(t,e)=>(0,s.RY)(t,"month",e,1,"months"),S=(t,e)=>(0,s.RY)(t,"month",e,-1,"months"),v=(t,e,n)=>(0,s.RY)(t,"day",n,e-1,"days"),f=(t,e,n,a)=>{if(0===a.length||!a[0]||!n)return[];const i=(0,s.RY)(n,"day",e);return a.reduce(((n,a)=>{const o=a.attributes.start,r=a.attributes.end,l=(0,s.RY)(i,"day",e,1,"days"),d=(0,s.U$)(i,o)?i:o,m=(0,s.U$)(r,l)?l:r,c=(0,s.Sj)(d,m,e,t);return n.concat(c)}),[])},M=(t,e,n,a,i)=>{if(!i||!i.attributes||!a||!n)return[];const o=i.attributes.end,r=(0,s.Ft)(n),l=(0,s.RY)(a,"day",e,1,"days"),d=(0,s.RY)(r,"day",e,1,"days"),m=(0,s.RY)(a,"day",e);let c,u;return(0,s.U$)(m,r)?(c=(0,s.U$)(r,m)?r:m,u=(0,s.Fo)((0,s.RY)(o,"day",e),m)?o:l):(c=r,u=(0,s.U$)(d,o)?o:d),(0,s.Ym)(c,u,e,t)},C=(t,e,n)=>t&&t[0]?t.filter((t=>(0,s.mh)(e,t.attributes.start,t.attributes.end,"day",n))):[],A=(t,e,n,a,i,o)=>{const r=i?[]:f(t,e,a,C(n,a,e)),l=i||(r.length>0&&r[0]&&r[0].timestamp?r[0].timestamp.toString():null),d=l?(0,s.Ft)(l):null,m=o||(d?new Date((0,s.Kn)(d,"hour",e).getTime()-1):null),c=n.find((t=>(0,s.mh)(d,t.attributes.start,t.attributes.end))),u=M(t,e,l,m,c);return{startTime:l,endDate:m,endTime:u.length>0&&u[0]&&u[0].timestamp?u[0].timestamp.toString():null,selectedTimeSlot:c}},N=(t,e,n)=>{const a=(0,s.XU)(e,n);return t&&0!==Object.keys(t).length&&t[a]&&t[a].timeSlots?t[a].timeSlots:[]},F=t=>a.createElement(l.JT,Object.assign({},t,{direction:"left",rootClassName:T})),I=t=>a.createElement(l.JT,Object.assign({},t,{direction:"right",rootClassName:T})),R=t=>{const{currentMonth:e,dayCountAvailableForBooking:n,timeZone:i}=t,o=E(e,i);return(0,s.U$)(o,v(y,n,i))?null:a.createElement(I,null)},Y=t=>{const{currentMonth:e,timeZone:n}=t,i=S(e,n),o=(0,s.RY)(y,"month",n);return(0,s.U$)(i,o)?a.createElement(F,null):null};class B extends a.Component{constructor(t){super(t),this.onBookingStartDateChange=t=>{const{monthlyTimeSlots:e,timeZone:n,intl:a,form:i}=this.props;if(!t||!t.date)return i.batch((()=>{i.change("bookingStartTime",null),i.change("bookingEndDate",{date:null}),i.change("bookingEndTime",null)})),void this.setState({currentMonth:(0,s.RY)(y,"month",n)});const o=(0,s.vc)(t.date,n),r=N(e,this.state.currentMonth,n),l=C(r,o,n),{startTime:d,endDate:m,endTime:c}=A(a,n,l,o);i.batch((()=>{i.change("bookingStartTime",d),i.change("bookingEndDate",{date:m}),i.change("bookingEndTime",c)}))},this.onBookingStartTimeChange=t=>{const{monthlyTimeSlots:e,timeZone:n,intl:a,form:i,values:o}=this.props,s=N(e,this.state.currentMonth,n),r=o.bookingStartDate.date,l=C(s,r,n),{endDate:d,endTime:m}=A(a,n,l,r,t);i.batch((()=>{i.change("bookingEndDate",{date:d}),i.change("bookingEndTime",m)}))},this.onBookingEndDateChange=t=>{const{monthlyTimeSlots:e,timeZone:n,intl:a,form:i,values:o}=this.props;if(!t||!t.date)return void i.change("bookingEndTime",null);const r=(0,s.vc)(t.date,n),{bookingStartDate:l,bookingStartTime:d}=o,m=l.date,c=N(e,this.state.currentMonth,n),u=C(c,m,n),{endTime:h}=A(a,n,u,m,d,r);i.change("bookingEndTime",h)},this.state={currentMonth:(0,s.RY)(y,"month",t.timeZone)},this.fetchMonthData=this.fetchMonthData.bind(this),this.onMonthClick=this.onMonthClick.bind(this),this.onBookingStartDateChange=this.onBookingStartDateChange.bind(this),this.onBookingStartTimeChange=this.onBookingStartTimeChange.bind(this),this.onBookingEndDateChange=this.onBookingEndDateChange.bind(this),this.isOutsideRange=this.isOutsideRange.bind(this)}fetchMonthData(t){const{listingId:e,timeZone:n,onFetchTimeSlots:a,dayCountAvailableForBooking:i}=this.props,o=v(y,i,n);if((0,s.mh)(t,y,o)){const i=(0,s.U$)(y,t)?y:t,r=E(t,n);a(e,i,(0,s.U$)(r,o)?(0,s.RY)(o,"day",n):r,n)}}onMonthClick(t){const{onMonthChanged:e,timeZone:n}=this.props;this.setState((e=>({currentMonth:t(e.currentMonth,n)})),(()=>{this.fetchMonthData(t(this.state.currentMonth,n));const a=(0,s.XU)(this.state.currentMonth,n),i=this.props.monthlyTimeSlots[a];i&&i.fetchTimeSlotsError&&this.fetchMonthData(this.state.currentMonth),e&&e(a)}))}isOutsideRange(t,e,n,a){if(!n)return!0;const i=(0,s.vc)(t,a),o=(0,s.RY)(e,"day",a),r=new Date(n.attributes.end.getTime()-1),l=(0,s.RY)(r,"day",a,1,"days");return!((0,s.U$)(i,o)&&(0,s.U$)(l,i))}render(){const{rootClassName:t,className:e,formId:n,startDateInputProps:i,values:T,monthlyTimeSlots:v,timeZone:F,intl:I,dayCountAvailableForBooking:B}=this.props,Z=o()(t||d,e),U=T.bookingStartDate&&T.bookingStartDate.date?T.bookingStartDate.date:null,O=T.bookingStartTime?T.bookingStartTime:null,w=T.bookingEndDate&&T.bookingEndDate.date?T.bookingEndDate.date:null,P=N(v,this.state.currentMonth,F),$=C(P,U,F),H=f(I,F,U,$),L=H.length>0&&H[0]&&H[0].timestamp?H[0].timestamp:null,{startTime:x,endDate:J,selectedTimeSlot:V}=A(I,F,$,U,O||L,w||U),j=M(I,F,O||x,w||J,V),K=P?t=>!P.find((e=>(0,s.JV)(t,e.attributes.start,e.attributes.end,F))):()=>!1,X=(0,s.Kn)(y,"hour",F);let q="08:00";try{var z;q=null===(z=(0,s.DX)(X,I,{timeZone:F}))||void 0===z?void 0:z.time}catch(G){}const Q=(0,s.RY)(y,"day",F),W=U&&(O||x);return a.createElement("div",{className:Z},a.createElement("div",{className:m},a.createElement("div",{className:o()(c,p)},a.createElement(l.vl,{className:u,name:"bookingStartDate",id:n?"".concat(n,".bookingStartDate"):"bookingStartDate",label:i.label,placeholderText:i.placeholderText,format:t=>t&&t.date?{date:(0,s.dw)(t.date,F)}:t,parse:t=>t&&t.date?{date:(0,s.vc)(t.date,F)}:t,initialVisibleMonth:(0,s.$T)(U||Q,F),isDayBlocked:K,onChange:this.onBookingStartDateChange,onPrevMonthClick:()=>this.onMonthClick(S),onNextMonthClick:()=>this.onMonthClick(E),navNext:a.createElement(R,{currentMonth:this.state.currentMonth,timeZone:F,dayCountAvailableForBooking:B}),navPrev:a.createElement(Y,{currentMonth:this.state.currentMonth,timeZone:F}),useMobileMargins:!0,validate:(0,r.BA)(I.formatMessage({id:"BookingTimeForm.requiredDate"})),onClose:t=>{var e;return this.setState({currentMonth:(0,s.RY)(null!==(e=null===t||void 0===t?void 0:t.date)&&void 0!==e?e:y,"month",this.props.timeZone)})}}))),a.createElement("div",{className:m},a.createElement("div",{className:c},a.createElement(l.Wy,{name:"bookingStartTime",id:n?"".concat(n,".bookingStartTime"):"bookingStartTime",className:U?h:g,selectClassName:U?D:b,label:I.formatMessage({id:"FieldDateAndTimeInput.startTime"}),disabled:!U,onChange:this.onBookingStartTimeChange},U?H.map((t=>a.createElement("option",{key:t.timeOfDay,value:t.timestamp},t.timeOfDay))):a.createElement("option",null,q))),a.createElement("div",{className:U?k:_},"-"),a.createElement("div",{className:c},a.createElement(l.Wy,{name:"bookingEndTime",id:n?"".concat(n,".bookingEndTime"):"bookingEndTime",className:U?h:g,selectClassName:U?D:b,label:I.formatMessage({id:"FieldDateAndTimeInput.endTime"}),disabled:!W},W?j.map((t=>a.createElement("option",{key:"00:00"===t.timeOfDay?"24:00":t.timeOfDay,value:t.timestamp},"00:00"===t.timeOfDay?"24:00":t.timeOfDay))):a.createElement("option",null,q)))))}}B.defaultProps={rootClassName:null,className:null,startDateInputProps:null,endD
1ateInputProps:null,startTimeInputProps:null,endTimeInputProps:null,listingId:null,monthlyTimeSlots:null,timeZone:null};const Z=B},38975:(t,e,n)=>{n.d(e,{Z:()=>p});var a=n(6515),i=n(72791),o=n(73142),s=n.n(o),r=n(66319),l=n(29305),d=n(73665),m=n(79908),c=n(26871),u=n(82795),h=n(60949);const{Money:g,UUID:D}=r.V5,b=(t,e)=>{const n=t.reduce(((t,e)=>{const n=(0,m.ud)(e.lineTotal);return new(s())(n).add(t)}),new(s())(0)),a=t[0]&&t[0].unitPrice?t[0].unitPrice.currency:e;return new g((0,m.aV)(n.toNumber(),(0,m.p_)(a)),a)},T=function(t,e,n){const i={start:t,end:e};return{id:new D("estimated-booking"),type:"booking",attributes:(0,a.Z)({},i)}},p=t=>{const{breakdownData:e={},lineItems:n,timeZone:o,currency:s,marketplaceName:r,processName:m}=t,{startDate:g,endDate:p}=e;let k=null;try{k=(0,c.Yt)(m)}catch(C){return i.createElement("div",{className:h.Z.error},i.createElement(l._H,{id:"OrderPanel.unknownTransactionProcess"}))}const _=null===n||void 0===n?void 0:n.find((t=>d.Y8.includes(t.code)&&!t.reversal)),y=null===_||void 0===_?void 0:_.code,E=[d.E4,d.mi].includes(y),S=n&&n.length>0,v=!E||g&&p,f=y===d.PC?d.In:d.FJ,M=S&&v?((t,e,n,i,o,s,r,l)=>{const d=null===s||void 0===s?void 0:s.transitions,m=new Date,u=t.filter((t=>t.includeFor.includes("customer"))),h=t.filter((t=>t.includeFor.includes("provider"))),g=b(u,l),p=b(h,l),k=e&&n?{booking:T(e,n,i,o)}:{};return(0,a.Z)({id:new D("estimated-transaction"),type:"transaction",attributes:{createdAt:m,processName:r,lastTransitionedAt:m,lastTransition:d.REQUEST_PAYMENT,payinTotal:g,payoutTotal:p,lineItems:u,transitions:[{createdAt:m,by:c.AL,transition:d.REQUEST_PAYMENT}]}},k)})(n,g,p,y,o,k,m,s):null;return M?i.createElement(u.J0,{className:h.Z.receipt,userRole:"customer",transaction:M,booking:M.booking,dateType:f,timeZone:o,currency:s,marketplaceName:r}):null}}}]); 2//# sourceMappingURL=4661.474e97aa.chunk.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.