@roomstay/frontend 2.6.108 → 2.6.110

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/836.bundle.js +1 -1
  2. package/dist/978.bundle.js +1 -1
  3. package/dist/main.bundle.js +1 -1
  4. package/dist/src/components/steps/addons/AddonCard.js +3 -0
  5. package/dist/src/components/steps/addons/AddonCard.js.map +1 -1
  6. package/dist/src/contexts/CompanyContext/CompanyContextWrapper.js +1 -1
  7. package/dist/src/contexts/CompanyContext/CompanyContextWrapper.js.map +1 -1
  8. package/dist/src/contexts/ConfirmationStepContext/ConfirmationStepContextWrapper.js +7 -2
  9. package/dist/src/contexts/ConfirmationStepContext/ConfirmationStepContextWrapper.js.map +1 -1
  10. package/dist/src/events/actions/AddAddonToCartEvent.d.ts +7 -0
  11. package/dist/src/events/actions/AddAddonToCartEvent.js +15 -0
  12. package/dist/src/events/actions/AddAddonToCartEvent.js.map +1 -0
  13. package/dist/src/events/index.d.ts +1 -0
  14. package/dist/src/events/index.js +1 -0
  15. package/dist/src/events/index.js.map +1 -1
  16. package/dist/src/events/views/CommittedBookingEvent.d.ts +3 -1
  17. package/dist/src/events/views/CommittedBookingEvent.js +2 -1
  18. package/dist/src/events/views/CommittedBookingEvent.js.map +1 -1
  19. package/dist/src/events/views/StepCheckoutViewEvent.d.ts +3 -1
  20. package/dist/src/events/views/StepCheckoutViewEvent.js +2 -1
  21. package/dist/src/events/views/StepCheckoutViewEvent.js.map +1 -1
  22. package/dist/src/models/Confirmation.d.ts +1 -0
  23. package/dist/src/models/Confirmation.js.map +1 -1
  24. package/dist/src/models/Room/Room.d.ts +1 -0
  25. package/dist/src/models/Room/Room.js +3 -0
  26. package/dist/src/models/Room/Room.js.map +1 -1
  27. package/dist/src/models/Room/RoomRate.d.ts +1 -0
  28. package/dist/src/models/Room/RoomRate.js +3 -0
  29. package/dist/src/models/Room/RoomRate.js.map +1 -1
  30. package/dist/src/models/Room/RoomRateSortable.d.ts +1 -0
  31. package/dist/src/models/Room/RoomRateSortable.js.map +1 -1
  32. package/dist/src/models/RoomstaySession.d.ts +1 -0
  33. package/dist/src/models/RoomstaySession.js.map +1 -1
  34. package/dist/src/pages/steps/StepConfirmation/StepConfirmationComponent.js +2 -2
  35. package/dist/src/pages/steps/StepConfirmation/StepConfirmationComponent.js.map +1 -1
  36. package/dist/src/providers/RoomSortProvider.js +15 -3
  37. package/dist/src/providers/RoomSortProvider.js.map +1 -1
  38. package/dist/src/providers/feature/AnalyticsEventsFeature.js +1 -0
  39. package/dist/src/providers/feature/AnalyticsEventsFeature.js.map +1 -1
  40. package/dist/src/util/AnalyticsEvents/AnalyticsEvents.d.ts +9 -3
  41. package/dist/src/util/AnalyticsEvents/AnalyticsEvents.js +51 -12
  42. package/dist/src/util/AnalyticsEvents/AnalyticsEvents.js.map +1 -1
  43. package/dist/src/util/AnalyticsEvents/helpers.d.ts +12 -3
  44. package/dist/src/util/AnalyticsEvents/helpers.js +27 -3
  45. package/dist/src/util/AnalyticsEvents/helpers.js.map +1 -1
  46. package/dist/test.bundle.js +1 -1
  47. package/dist/vendors.bundle.js +1 -1
  48. package/package.json +3 -3
@@ -1 +1 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkroomstay=("undefined"!=typeof self?self:this).webpackChunkroomstay||[]).push([[978],{26712:function(e,t,l){l.d(t,{e:function(){return o}});var n=l(15671),a=l(43144),i=l(60136),r=l(82963),c=l(61120);var o=function(e){(0,i.Z)(u,e);var t,l,o=(t=u,l=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,c.Z)(t);if(l){var a=(0,c.Z)(this).constructor;e=Reflect.construct(n,arguments,a)}else e=n.apply(this,arguments);return(0,r.Z)(this,e)});function u(e){var t;return(0,n.Z)(this,u),(t=o.call(this)).basketRows=void 0,t.basketRows=e,t}return(0,a.Z)(u,null,[{key:"getLabel",value:function(){return"View/Addon"}}]),u}(l(97112).x)},19370:function(e,t,l){l.r(t),l.d(t,{default:function(){return q}});var n=l(93316),a=l(26712),i=l(67294),r=l(26793),c=l(89250),o=l(79655),u=l(79478),d=l(13821),s=l(13010),m=l(46409),g=l(19874),f=l(47304),E=l(70885),p=l(89331),h=l(83893),P=l(7832),y=l(4942),v=l(76598),N=l(94184),A=l.n(N),b=l(97754),R=function(e){return i.createElement("div",{className:e.className},i.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i.createElement("rect",{width:"24",height:"24",rx:"12",fill:b.Il.Accent}),i.createElement("path",{d:"M7.33333 12L10.6667 15.3333L16.6667 9.33332L15.7267 8.38666L10.6667 13.4467L8.27333 11.06L7.33333 12Z",fill:"white"})))},T=l(64854),w=l(20858),x=l(11830),S=l(16380),Z=l(63351),_=l(2927),D=l(30584),C=l(44744),k=l(84544),O=l(18300);function I(e,t){var l=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),l.push.apply(l,n)}return l}function G(e){for(var t=1;t<arguments.length;t++){var l=null!=arguments[t]?arguments[t]:{};t%2?I(Object(l),!0).forEach((function(t){(0,y.Z)(e,t,l[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):I(Object(l)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(l,t))}))}return e}var M=function(e){var t,l=e.addon,a=e.className,c=(0,r.$)().t,o=(0,p.WP)().hotel,d=i.useContext(n.hy),m=d.getRowForAddon(l),g=(0,i.useState)(1),f=(0,E.Z)(g,2),h=f[0],P=f[1],y=(0,i.useState)(m?m.getAdultQuantity():1),N=(0,E.Z)(y,2),I=N[0],M=N[1],W=(0,i.useState)(m?m.getChildQuantity():0),L=(0,E.Z)(W,2),H=L[0],Q=L[1],j=(0,i.useState)({quantity:1}),U=(0,E.Z)(j,2),B=U[0],z=U[1],q=(0,i.useState)(m?m.getSelectedDate():""),Y=(0,E.Z)(q,2),F=Y[0],V=Y[1],$=(0,i.useState)(m?m.getSelectedTime():""),J=(0,E.Z)($,2),K=J[0],X=J[1];(0,i.useEffect)((function(){var e,t,n,a,i,r,c;m?(z(null!==(e=l.availability[m.getSelectedDate()])&&void 0!==e?e:l.availability[l.firstDate]),V(null!==(t=m.getSelectedDate())&&void 0!==t?t:l.firstDate),X(null!==(n=m.getSelectedTime())&&void 0!==n?n:""),P(m.getQuantity()),M(m.getAdultQuantity()),Q(m.getChildQuantity())):(z(null!==(a=l.availability[l.firstDate])&&void 0!==a?a:[]),V(l.firstDate),X((null===(i=l.availability[l.firstDate])||void 0===i||null===(r=i.selectorTimes)||void 0===r||null===(c=r[0])||void 0===c?void 0:c.value)||""))}),[]);var ee=A()({"--active":!!d.getRowForAddon(l)}),te=[v.EAddonPricingType.PER_PERSON,v.EAddonPricingType.PER_PERSON_PER_NIGHT].includes(l.pricingType),le=[v.EAddonPricingType.PER_ALL_PERSONS,v.EAddonPricingType.PER_ALL_PERSONS_PER_NIGHT].includes(l.pricingType),ne=te&&l.hideQuantity;(0,i.useEffect)((function(){if(te){var e=d.currentBasketRows;if(e&&0!==e.length){var t=e.reduce((function(e,t){return e+t.getAdults()}),0),l=e.reduce((function(e,t){return e+t.getChildren()}),0);M(t),null!=B&&B.childPrice?Q(l):P(t)}}}),[l.code,te,null==B?void 0:B.childPrice,d.currentBasketRows]);var ae,ie=[{name:"Date",enabled:(null==m||null===(ae=m.getNumberOfAvailableNights)||void 0===ae?void 0:ae.call(m))>1&&!(null!=m&&m.getAddon().hideDatePicker),element:i.createElement(Z.P,{nativeOnMobile:!0,options:l.selectorDates,value:F,onChange:function(e){var t,n,a,i;t=e,z(l.availability[t]),V(t),X((null===(n=l.availability[t])||void 0===n||null===(a=n.selectorTimes)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.value)||""),l.availability[t].quantity<h&&P(l.availability[t].quantity)},keyName:"value",labelName:"text",className:"u-flex align-items-center"})},{name:"Time",enabled:0!==(null==B||null===(t=B.selectorTimes)||void 0===t?void 0:t.length),element:i.createElement(Z.P,{nativeOnMobile:!0,options:(null==B?void 0:B.selectorTimes)||[],value:K,onChange:function(e){X(e)},keyName:"value",labelName:"text",className:"u-flex align-items-center"})},{name:u.W.Step.Addon.Quantity,enabled:!(null==B||!B.price)&&(null==B?void 0:B.quantity)>1&&!ne,element:i.createElement(S.Z,{number:h,min:1,max:B.quantity,onChange:function(e){P(e)}})},{name:u.W.Step.Date.Adult_plural,enabled:!le&&!(null==B||!B.adultPrice)&&!ne,element:i.createElement(S.Z,{number:I,min:0,max:B.quantity-H,onChange:function(e){M(e)}})},{name:u.W.Step.Date.Child_plural,enabled:!le&&!(null==B||!B.childPrice)&&!ne,element:i.createElement(S.Z,{number:H,min:0,max:B.quantity-I,onChange:function(e){Q(e)}})}],re=function(){switch(l.pricingType){case v.EAddonPricingType.PER_STAY:return c(u.W.Misc.QTY);case v.EAddonPricingType.PER_PERSON:return c(u.W.Misc.Person);case v.EAddonPricingType.PER_PERSON_OCCUPANCY_PER_NIGHT:case v.EAddonPricingType.PER_PERSON_PER_NIGHT:return c(u.W.Misc.PersonPerNight);case v.EAddonPricingType.PER_ADULT_OCCUPANCY_PER_NIGHT:case v.EAddonPricingType.PER_CHILD_OCCUPANCY_PER_NIGHT:return c(u.W.Misc.AdultPerNight);case v.EAddonPricingType.PER_NIGHT:case v.EAddonPricingType.PER_QUANTITY_NAME_PER_NIGHT:return c(u.W.Misc.Night);case v.EAddonPricingType.PER_ROOM_QUANTITY_PER_NIGHT:return c(u.W.Misc.PerRoomDay)}}(),ce={};l.image?ce.backgroundImage="url('".concat(C.Z.resizeImage(l.image,C.h.Original),"')"):(ce.backgroundImage="url('".concat((null==o?void 0:o.logo)&&C.Z.resizeImage(null==o?void 0:o.logo,C.h.Original),"')"),ce.backgroundSize="50%",ce.backgroundRepeat="no-repeat");var oe=(null==o?void 0:o.fees)&&o.fees.filter((function(e){return e.appliesToAddons})).length>0,ue=(0,i.useMemo)((function(){var e,t,n,a,i={code:l.code,pricingType:l.pricingType,price:null!==(e=null==B?void 0:B.price)&&void 0!==e?e:0,adultPrice:null==B?void 0:B.adultPrice,childPrice:null==B?void 0:B.childPrice,quantity:h,adultQuantity:I,childQuantity:H,nights:l.nights||1},r=v.TotalCalculator.calculateBaseAddonTotal(i,!1).addonTotal,c=G(G({},i),{},{adultQuantity:Math.max(1,I),childQuantity:Math.max(1,H)}),o=v.TotalCalculator.calculateBaseAddonTotal(c,!1).addonTotal,u=m?d.basketAddonRows.filter((function(e){return e.getID()!==m.getID()})):d.basketAddonRows,s=O.N.calculatePreviewDiscount(r,u,d.currentBasketRows,d.promoCodeDetails),g=O.N.calculatePreviewDiscount(o,u,d.currentBasketRows,d.promoCodeDetails),f=function(e,t,l){if(!e||l<=0)return{price:null!=e?e:0,discountUsed:0};var n=d.promoCodeDetails;if((null==n?void 0:n.discountType)===v.EPromoCodeDiscountType.FlatPercent){var a=n.discountAmount/100;return{price:Math.round(e*(1-a)*100)/100,discountUsed:0}}var i=Math.min(l,t),r=t>0?i/t*e:0;return{price:Math.max(0,e-r),discountUsed:i}},E=null!==(t=null==B?void 0:B.price)&&void 0!==t?t:0,p=null!==(n=null==B?void 0:B.adultPrice)&&void 0!==n?n:0,P=null!==(a=null==B?void 0:B.childPrice)&&void 0!==a?a:0;if(g>0&&o>0){var y=v.ADDON_PER_NIGHT_TYPES.includes(l.pricingType)&&l.nights||1;if(null!=B&&B.price){var N=Math.max(1,h),A=B.price*N*y;E=f(B.price,A,g).price}var b=Math.max(1,I),R=Math.max(1,H),T=null!=B&&B.adultPrice?B.adultPrice*b*y:0,w=null!=B&&B.childPrice?B.childPrice*R*y:0,x=Math.min(g,T),S=Math.max(0,g-x);null!=B&&B.adultPrice&&(p=f(B.adultPrice,T,x).price),null!=B&&B.childPrice&&(P=f(B.childPrice,w,S).price)}return{discountAmount:s,discountedPrice:r-s,discountedUnitPrice:E,discountedAdultPrice:p,discountedChildPrice:P}}),[B,h,I,H,l.pricingType,l.code,l.nights,d.promoCodeDetails,d.currentBasketRows,d.basketAddonRows,m]),de=ue.discountAmount,se=ue.discountedUnitPrice,me=ue.discountedAdultPrice,ge=ue.discountedChildPrice,fe=de>0;return i.createElement("div",{className:A()("u-flex u-flex-flex-start u-rounded addon-card-wrapper",a,ee),style:{backgroundColor:b.Il.White}},i.createElement("div",{className:"addon-card-image",style:ce}),i.createElement("div",{className:"u-marg-heavy u-marg@m- u-w-100@xl"},i.createElement("div",{className:"u-flex"},i.createElement(s.Z,{bold:!0},l.name),m?i.createElement(R,null):i.createElement(i.Fragment,null)),i.createElement(D.ZP,{color:b.Il.DarkGrey,type:D.yG.Small,asDiv:!0},i.createElement(x.R,{content:l.description})),i.createElement("div",{className:"addon-card-wrapper--price u-flex u-flex-align-flex-end"},i.createElement("div",{className:"u-w-100"},ie.map((function(e){if(e.enabled)return i.createElement("div",{key:e.name,className:"u-flex justify-content-start u-marg-bot u-marg-top"},i.createElement(D.ZP,{className:"u-mw-100",bold:!0},c(e.name)),e.element)}))),i.createElement("div",{className:"addon-card-wrapper--price-action"},i.createElement("div",{className:"u-flex u-flex-direction-column u-flex-align-flex-end",style:{alignSelf:"flex-end"}},i.createElement(D.ZP,{type:D.yG.Small,color:b.Il.Navy,inline:!0},c(u.W.Misc.From)),i.createElement("div",{className:"room-details--content-price flex-align-items-baseline flex-row"},(null==B?void 0:B.price)&&i.createElement("div",{className:"d-flex align-items-end flex-row"},fe&&i.createElement(D.ZP,{type:D.yG.Small,color:b.Il.DarkGrey,inline:!0,style:{textDecoration:"line-through"},className:"u-marg-right--light"},i.createElement(w.Z,{hideDecimals:!0},B.price)),i.createElement(s.Z,{size:"large",bold:!0,lineHeight:"1em"},i.createElement(w.Z,{hideDecimals:!0},fe?se:B.price)),i.createElement(D.ZP,{type:D.yG.Small,color:b.Il.DarkGrey,inline:!0,className:"u-marg-left--light u-clear-font-weight"},"/ ",re)),(!(null==B||!B.adultPrice)||!(null==B||!B.childPrice))&&i.createElement("h2",{className:"u-marg-none d-flex flex-wrap justify-content-end"},!!B.adultPrice&&i.createElement("div",{className:"d-flex align-items-end flex-row"},fe&&me<B.adultPrice&&i.createElement(D.ZP,{type:D.yG.Small,color:b.Il.DarkGrey,inline:!0,style:{textDecoration:"line-through"},className:"u-marg-right--light"},i.createElement(w.Z,null,B.adultPrice)),i.createElement(s.Z,{size:"large",bold:!0,lineHeight:"1em"},i.createElement(w.Z,null,fe?me:B.adultPrice)),i.createElement(D.ZP,{type:D.yG.Small,color:b.Il.DarkGrey,inline:!0,className:"u-marg-left--light u-clear-font-weight"},"/"," ",l.pricingType===v.EAddonPricingType.PER_ALL_PERSONS_PER_NIGHT?c(u.W.Misc.AdultPerNight):c(u.W.Step.Date.Adult))),!!B.adultPrice&&!!B.childPrice&&i.createElement("br",null),!!B.childPrice&&i.createElement("div",{className:"d-flex align-items-end flex-row"},fe&&ge<B.childPrice&&i.createElement(D.ZP,{type:D.yG.Small,color:b.Il.DarkGrey,inline:!0,style:{textDecoration:"line-through"},className:"u-marg-right--light"},i.createElement(w.Z,null,B.childPrice)),i.createElement(s.Z,{size:"large",bold:!0,lineHeight:"1em"},i.createElement(w.Z,null,fe?ge:B.childPrice)),i.createElement(D.ZP,{type:D.yG.Small,color:b.Il.DarkGrey,inline:!0,className:"u-marg-left--light u-clear-font-weight"},"/"," ",l.pricingType===v.EAddonPricingType.PER_ALL_PERSONS_PER_NIGHT?c(u.W.Misc.ChildPerNight):c(u.W.Step.Date.Child))))),i.createElement("div",{className:"u-marg-bottom--light"},i.createElement(D.ZP,{type:D.yG.Small,color:b.Il.Grey,inline:!0,className:"u-nowrap"},i.createElement(_._,{hasTax:!(null!=o&&o.enableCreditCardSurcharge||oe),isAddon:!0})))),i.createElement("div",{className:"u-marg-top--light u-flex justify-content-end u-w-100@l- flex-column flex-lg-row"},m?i.createElement("div",{className:"u-marg-right--light@l u-marg-bottom--light@l-"},i.createElement(T.Z,{onClick:function(){var e=d.basketAddonRows.find((function(e){return e.getAddon().code===l.code}));e&&d.removeBasketAddonRow(e)},textColor:b.Il.White,backgroundColor:b.Il.Navy,wide:!0},c(u.W.Step.Addon.Remove))):i.createElement(i.Fragment,null),i.createElement(T.Z,{onClick:function(){d.setAddonQuantities(l,{quantity:h,adult:I,child:H},F,K);var e=d.basketAddonRows.find((function(e){return e.getAddon().code===l.code})),t=d.currentBasketRows[0];e&&t&&k.ZP.instance.sendRoomAddonAddToCart(e,h,t.getStartDate(),t.getStartDate())},primary:!0,filled:!0,wide:!0},c(m?u.W.Step.Addon.UpdateCart:u.W.Step.Addon.AddToCart)))))))},W=l(62734),L=l(31972),H=function(){var e=(0,i.useContext)(n.hy),t=(0,i.useContext)(n.Qm),l=(0,p.WP)().hotel,a=e.getAllValidRows(),r=(0,i.useState)(null),c=(0,E.Z)(r,2),o=c[0],u=c[1],d=(0,i.useState)(!1),s=(0,E.Z)(d,2),g=s[0],f=s[1];return i.useEffect((function(){f(!0),h.Z.Addons.findAddons(a,null==l?void 0:l.hotelID).then((function(e){f(!1),u(e)}))}),[t.currentLanguage]),i.createElement("div",{className:"u-flex"},i.createElement(m.i5,null,i.createElement(m.mV,null,g?i.createElement(P.Z,null):null!=o&&o.length?o.map((function(e,t){return i.createElement(M,{key:t,className:"u-marg-bottom",addon:e})})):i.createElement(W.Z,null)),i.createElement(m.f,null,i.createElement(L.Z,null))))},Q=l(38279),j=l(40370),U=l(16337),B=l(90292),z=l(95692);function q(){var e=(0,i.useContext)(n.g7),t=(0,i.useContext)(n.aN).currentStep,l=(0,i.useContext)(n.hy).currentBasketRows,E=(0,c.TH)(),p=(0,r.$)().t,h=(0,U.z)().raise;return(0,i.useEffect)((function(){var e=new a.e(l);h(e)}),[]),i.createElement("div",{className:"container rs-step-addon"},i.createElement(f.V,{step:"Addon"}),i.createElement(j.default,null),i.createElement(m.i5,null,i.createElement(m.mV,null,e.screenSize>B.Z.Medium&&i.createElement(i.Fragment,null,i.createElement(o.rU,{to:{pathname:z.Z.getPreviousStepUrl(t),search:E.search}},i.createElement(d.Z,null)),i.createElement("div",{className:"u-marg-top--light u-marg-bottom--heavy"},i.createElement(s.Z,{bold:!0},p(u.W.Navigation.Steps.Addon))))),e.screenSize>B.Z.Medium&&i.createElement(m.f,null,i.createElement(Q.Z,null))),e.screenSize>B.Z.Medium&&i.createElement(g.Z,null),i.createElement(H,null))}}}]);
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkroomstay=("undefined"!=typeof self?self:this).webpackChunkroomstay||[]).push([[978],{26712:function(e,t,n){n.d(t,{e:function(){return o}});var l=n(15671),a=n(43144),i=n(60136),r=n(82963),c=n(61120);var o=function(e){(0,i.Z)(u,e);var t,n,o=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,l=(0,c.Z)(t);if(n){var a=(0,c.Z)(this).constructor;e=Reflect.construct(l,arguments,a)}else e=l.apply(this,arguments);return(0,r.Z)(this,e)});function u(e){var t;return(0,l.Z)(this,u),(t=o.call(this)).basketRows=void 0,t.basketRows=e,t}return(0,a.Z)(u,null,[{key:"getLabel",value:function(){return"View/Addon"}}]),u}(n(97112).x)},19370:function(e,t,n){n.r(t),n.d(t,{default:function(){return F}});var l=n(93316),a=n(26712),i=n(67294),r=n(26793),c=n(89250),o=n(79655),u=n(79478),d=n(13821),s=n(13010),m=n(46409),g=n(19874),f=n(47304),E=n(70885),p=n(89331),h=n(83893),P=n(7832),y=n(4942),v=n(76598),N=n(94184),A=n.n(N),b=n(97754),R=function(e){return i.createElement("div",{className:e.className},i.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i.createElement("rect",{width:"24",height:"24",rx:"12",fill:b.Il.Accent}),i.createElement("path",{d:"M7.33333 12L10.6667 15.3333L16.6667 9.33332L15.7267 8.38666L10.6667 13.4467L8.27333 11.06L7.33333 12Z",fill:"white"})))},T=n(64854),w=n(20858),x=n(11830),S=n(16380),Z=n(63351),_=n(2927),D=n(30584),C=n(39983),k=n(46415),O=n(44744),I=n(84544),G=n(18300);function M(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,l)}return n}function W(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?M(Object(n),!0).forEach((function(t){(0,y.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):M(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var L=function(e){var t,n=e.addon,a=e.className,c=(0,r.$)().t,o=(0,p.WP)().hotel,d=i.useContext(l.hy),m=d.getRowForAddon(n),g=(0,i.useState)(1),f=(0,E.Z)(g,2),h=f[0],P=f[1],y=(0,i.useState)(m?m.getAdultQuantity():1),N=(0,E.Z)(y,2),M=N[0],L=N[1],H=(0,i.useState)(m?m.getChildQuantity():0),Q=(0,E.Z)(H,2),j=Q[0],U=Q[1],B=(0,i.useState)({quantity:1}),z=(0,E.Z)(B,2),q=z[0],Y=z[1],F=(0,i.useState)(m?m.getSelectedDate():""),V=(0,E.Z)(F,2),$=V[0],J=V[1],K=(0,i.useState)(m?m.getSelectedTime():""),X=(0,E.Z)(K,2),ee=X[0],te=X[1];(0,i.useEffect)((function(){var e,t,l,a,i,r,c;m?(Y(null!==(e=n.availability[m.getSelectedDate()])&&void 0!==e?e:n.availability[n.firstDate]),J(null!==(t=m.getSelectedDate())&&void 0!==t?t:n.firstDate),te(null!==(l=m.getSelectedTime())&&void 0!==l?l:""),P(m.getQuantity()),L(m.getAdultQuantity()),U(m.getChildQuantity())):(Y(null!==(a=n.availability[n.firstDate])&&void 0!==a?a:[]),J(n.firstDate),te((null===(i=n.availability[n.firstDate])||void 0===i||null===(r=i.selectorTimes)||void 0===r||null===(c=r[0])||void 0===c?void 0:c.value)||""))}),[]);var ne=A()({"--active":!!d.getRowForAddon(n)}),le=[v.EAddonPricingType.PER_PERSON,v.EAddonPricingType.PER_PERSON_PER_NIGHT].includes(n.pricingType),ae=[v.EAddonPricingType.PER_ALL_PERSONS,v.EAddonPricingType.PER_ALL_PERSONS_PER_NIGHT].includes(n.pricingType),ie=le&&n.hideQuantity;(0,i.useEffect)((function(){if(le){var e=d.currentBasketRows;if(e&&0!==e.length){var t=e.reduce((function(e,t){return e+t.getAdults()}),0),n=e.reduce((function(e,t){return e+t.getChildren()}),0);L(t),null!=q&&q.childPrice?U(n):P(t)}}}),[n.code,le,null==q?void 0:q.childPrice,d.currentBasketRows]);var re,ce=[{name:"Date",enabled:(null==m||null===(re=m.getNumberOfAvailableNights)||void 0===re?void 0:re.call(m))>1&&!(null!=m&&m.getAddon().hideDatePicker),element:i.createElement(Z.P,{nativeOnMobile:!0,options:n.selectorDates,value:$,onChange:function(e){var t,l,a,i;t=e,Y(n.availability[t]),J(t),te((null===(l=n.availability[t])||void 0===l||null===(a=l.selectorTimes)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.value)||""),n.availability[t].quantity<h&&P(n.availability[t].quantity)},keyName:"value",labelName:"text",className:"u-flex align-items-center"})},{name:"Time",enabled:0!==(null==q||null===(t=q.selectorTimes)||void 0===t?void 0:t.length),element:i.createElement(Z.P,{nativeOnMobile:!0,options:(null==q?void 0:q.selectorTimes)||[],value:ee,onChange:function(e){te(e)},keyName:"value",labelName:"text",className:"u-flex align-items-center"})},{name:u.W.Step.Addon.Quantity,enabled:!(null==q||!q.price)&&(null==q?void 0:q.quantity)>1&&!ie,element:i.createElement(S.Z,{number:h,min:1,max:q.quantity,onChange:function(e){P(e)}})},{name:u.W.Step.Date.Adult_plural,enabled:!ae&&!(null==q||!q.adultPrice)&&!ie,element:i.createElement(S.Z,{number:M,min:0,max:q.quantity-j,onChange:function(e){L(e)}})},{name:u.W.Step.Date.Child_plural,enabled:!ae&&!(null==q||!q.childPrice)&&!ie,element:i.createElement(S.Z,{number:j,min:0,max:q.quantity-M,onChange:function(e){U(e)}})}],oe=function(){switch(n.pricingType){case v.EAddonPricingType.PER_STAY:return c(u.W.Misc.QTY);case v.EAddonPricingType.PER_PERSON:return c(u.W.Misc.Person);case v.EAddonPricingType.PER_PERSON_OCCUPANCY_PER_NIGHT:case v.EAddonPricingType.PER_PERSON_PER_NIGHT:return c(u.W.Misc.PersonPerNight);case v.EAddonPricingType.PER_ADULT_OCCUPANCY_PER_NIGHT:case v.EAddonPricingType.PER_CHILD_OCCUPANCY_PER_NIGHT:return c(u.W.Misc.AdultPerNight);case v.EAddonPricingType.PER_NIGHT:case v.EAddonPricingType.PER_QUANTITY_NAME_PER_NIGHT:return c(u.W.Misc.Night);case v.EAddonPricingType.PER_ROOM_QUANTITY_PER_NIGHT:return c(u.W.Misc.PerRoomDay)}}(),ue={};n.image?ue.backgroundImage="url('".concat(O.Z.resizeImage(n.image,O.h.Original),"')"):(ue.backgroundImage="url('".concat((null==o?void 0:o.logo)&&O.Z.resizeImage(null==o?void 0:o.logo,O.h.Original),"')"),ue.backgroundSize="50%",ue.backgroundRepeat="no-repeat");var de=(null==o?void 0:o.fees)&&o.fees.filter((function(e){return e.appliesToAddons})).length>0,se=(0,i.useMemo)((function(){var e,t,l,a,i={code:n.code,pricingType:n.pricingType,price:null!==(e=null==q?void 0:q.price)&&void 0!==e?e:0,adultPrice:null==q?void 0:q.adultPrice,childPrice:null==q?void 0:q.childPrice,quantity:h,adultQuantity:M,childQuantity:j,nights:n.nights||1},r=v.TotalCalculator.calculateBaseAddonTotal(i,!1).addonTotal,c=W(W({},i),{},{adultQuantity:Math.max(1,M),childQuantity:Math.max(1,j)}),o=v.TotalCalculator.calculateBaseAddonTotal(c,!1).addonTotal,u=m?d.basketAddonRows.filter((function(e){return e.getID()!==m.getID()})):d.basketAddonRows,s=G.N.calculatePreviewDiscount(r,u,d.currentBasketRows,d.promoCodeDetails),g=G.N.calculatePreviewDiscount(o,u,d.currentBasketRows,d.promoCodeDetails),f=function(e,t,n){if(!e||n<=0)return{price:null!=e?e:0,discountUsed:0};var l=d.promoCodeDetails;if((null==l?void 0:l.discountType)===v.EPromoCodeDiscountType.FlatPercent){var a=l.discountAmount/100;return{price:Math.round(e*(1-a)*100)/100,discountUsed:0}}var i=Math.min(n,t),r=t>0?i/t*e:0;return{price:Math.max(0,e-r),discountUsed:i}},E=null!==(t=null==q?void 0:q.price)&&void 0!==t?t:0,p=null!==(l=null==q?void 0:q.adultPrice)&&void 0!==l?l:0,P=null!==(a=null==q?void 0:q.childPrice)&&void 0!==a?a:0;if(g>0&&o>0){var y=v.ADDON_PER_NIGHT_TYPES.includes(n.pricingType)&&n.nights||1;if(null!=q&&q.price){var N=Math.max(1,h),A=q.price*N*y;E=f(q.price,A,g).price}var b=Math.max(1,M),R=Math.max(1,j),T=null!=q&&q.adultPrice?q.adultPrice*b*y:0,w=null!=q&&q.childPrice?q.childPrice*R*y:0,x=Math.min(g,T),S=Math.max(0,g-x);null!=q&&q.adultPrice&&(p=f(q.adultPrice,T,x).price),null!=q&&q.childPrice&&(P=f(q.childPrice,w,S).price)}return{discountAmount:s,discountedPrice:r-s,discountedUnitPrice:E,discountedAdultPrice:p,discountedChildPrice:P}}),[q,h,M,j,n.pricingType,n.code,n.nights,d.promoCodeDetails,d.currentBasketRows,d.basketAddonRows,m]),me=se.discountAmount,ge=se.discountedUnitPrice,fe=se.discountedAdultPrice,Ee=se.discountedChildPrice,pe=me>0;return i.createElement("div",{className:A()("u-flex u-flex-flex-start u-rounded addon-card-wrapper",a,ne),style:{backgroundColor:b.Il.White}},i.createElement("div",{className:"addon-card-image",style:ue}),i.createElement("div",{className:"u-marg-heavy u-marg@m- u-w-100@xl"},i.createElement("div",{className:"u-flex"},i.createElement(s.Z,{bold:!0},n.name),m?i.createElement(R,null):i.createElement(i.Fragment,null)),i.createElement(D.ZP,{color:b.Il.DarkGrey,type:D.yG.Small,asDiv:!0},i.createElement(x.R,{content:n.description})),i.createElement("div",{className:"addon-card-wrapper--price u-flex u-flex-align-flex-end"},i.createElement("div",{className:"u-w-100"},ce.map((function(e){if(e.enabled)return i.createElement("div",{key:e.name,className:"u-flex justify-content-start u-marg-bot u-marg-top"},i.createElement(D.ZP,{className:"u-mw-100",bold:!0},c(e.name)),e.element)}))),i.createElement("div",{className:"addon-card-wrapper--price-action"},i.createElement("div",{className:"u-flex u-flex-direction-column u-flex-align-flex-end",style:{alignSelf:"flex-end"}},i.createElement(D.ZP,{type:D.yG.Small,color:b.Il.Navy,inline:!0},c(u.W.Misc.From)),i.createElement("div",{className:"room-details--content-price flex-align-items-baseline flex-row"},(null==q?void 0:q.price)&&i.createElement("div",{className:"d-flex align-items-end flex-row"},pe&&i.createElement(D.ZP,{type:D.yG.Small,color:b.Il.DarkGrey,inline:!0,style:{textDecoration:"line-through"},className:"u-marg-right--light"},i.createElement(w.Z,{hideDecimals:!0},q.price)),i.createElement(s.Z,{size:"large",bold:!0,lineHeight:"1em"},i.createElement(w.Z,{hideDecimals:!0},pe?ge:q.price)),i.createElement(D.ZP,{type:D.yG.Small,color:b.Il.DarkGrey,inline:!0,className:"u-marg-left--light u-clear-font-weight"},"/ ",oe)),(!(null==q||!q.adultPrice)||!(null==q||!q.childPrice))&&i.createElement("h2",{className:"u-marg-none d-flex flex-wrap justify-content-end"},!!q.adultPrice&&i.createElement("div",{className:"d-flex align-items-end flex-row"},pe&&fe<q.adultPrice&&i.createElement(D.ZP,{type:D.yG.Small,color:b.Il.DarkGrey,inline:!0,style:{textDecoration:"line-through"},className:"u-marg-right--light"},i.createElement(w.Z,null,q.adultPrice)),i.createElement(s.Z,{size:"large",bold:!0,lineHeight:"1em"},i.createElement(w.Z,null,pe?fe:q.adultPrice)),i.createElement(D.ZP,{type:D.yG.Small,color:b.Il.DarkGrey,inline:!0,className:"u-marg-left--light u-clear-font-weight"},"/"," ",n.pricingType===v.EAddonPricingType.PER_ALL_PERSONS_PER_NIGHT?c(u.W.Misc.AdultPerNight):c(u.W.Step.Date.Adult))),!!q.adultPrice&&!!q.childPrice&&i.createElement("br",null),!!q.childPrice&&i.createElement("div",{className:"d-flex align-items-end flex-row"},pe&&Ee<q.childPrice&&i.createElement(D.ZP,{type:D.yG.Small,color:b.Il.DarkGrey,inline:!0,style:{textDecoration:"line-through"},className:"u-marg-right--light"},i.createElement(w.Z,null,q.childPrice)),i.createElement(s.Z,{size:"large",bold:!0,lineHeight:"1em"},i.createElement(w.Z,null,pe?Ee:q.childPrice)),i.createElement(D.ZP,{type:D.yG.Small,color:b.Il.DarkGrey,inline:!0,className:"u-marg-left--light u-clear-font-weight"},"/"," ",n.pricingType===v.EAddonPricingType.PER_ALL_PERSONS_PER_NIGHT?c(u.W.Misc.ChildPerNight):c(u.W.Step.Date.Child))))),i.createElement("div",{className:"u-marg-bottom--light"},i.createElement(D.ZP,{type:D.yG.Small,color:b.Il.Grey,inline:!0,className:"u-nowrap"},i.createElement(_._,{hasTax:!(null!=o&&o.enableCreditCardSurcharge||de),isAddon:!0})))),i.createElement("div",{className:"u-marg-top--light u-flex justify-content-end u-w-100@l- flex-column flex-lg-row"},m?i.createElement("div",{className:"u-marg-right--light@l u-marg-bottom--light@l-"},i.createElement(T.Z,{onClick:function(){var e=d.basketAddonRows.find((function(e){return e.getAddon().code===n.code}));e&&d.removeBasketAddonRow(e)},textColor:b.Il.White,backgroundColor:b.Il.Navy,wide:!0},c(u.W.Step.Addon.Remove))):i.createElement(i.Fragment,null),i.createElement(T.Z,{onClick:function(){d.setAddonQuantities(n,{quantity:h,adult:M,child:j},$,ee);var e=d.basketAddonRows.find((function(e){return e.getAddon().code===n.code})),t=d.currentBasketRows[0];e&&t&&(I.ZP.instance.sendRoomAddonAddToCart(e,h,t.getStartDate(),t.getStartDate()),k.Z.raise(new C.t(e)))},primary:!0,filled:!0,wide:!0},c(m?u.W.Step.Addon.UpdateCart:u.W.Step.Addon.AddToCart)))))))},H=n(62734),Q=n(31972),j=function(){var e=(0,i.useContext)(l.hy),t=(0,i.useContext)(l.Qm),n=(0,p.WP)().hotel,a=e.getAllValidRows(),r=(0,i.useState)(null),c=(0,E.Z)(r,2),o=c[0],u=c[1],d=(0,i.useState)(!1),s=(0,E.Z)(d,2),g=s[0],f=s[1];return i.useEffect((function(){f(!0),h.Z.Addons.findAddons(a,null==n?void 0:n.hotelID).then((function(e){f(!1),u(e)}))}),[t.currentLanguage]),i.createElement("div",{className:"u-flex"},i.createElement(m.i5,null,i.createElement(m.mV,null,g?i.createElement(P.Z,null):null!=o&&o.length?o.map((function(e,t){return i.createElement(L,{key:t,className:"u-marg-bottom",addon:e})})):i.createElement(H.Z,null)),i.createElement(m.f,null,i.createElement(Q.Z,null))))},U=n(38279),B=n(40370),z=n(16337),q=n(90292),Y=n(95692);function F(){var e=(0,i.useContext)(l.g7),t=(0,i.useContext)(l.aN).currentStep,n=(0,i.useContext)(l.hy).currentBasketRows,E=(0,c.TH)(),p=(0,r.$)().t,h=(0,z.z)().raise;return(0,i.useEffect)((function(){var e=new a.e(n);h(e)}),[]),i.createElement("div",{className:"container rs-step-addon"},i.createElement(f.V,{step:"Addon"}),i.createElement(B.default,null),i.createElement(m.i5,null,i.createElement(m.mV,null,e.screenSize>q.Z.Medium&&i.createElement(i.Fragment,null,i.createElement(o.rU,{to:{pathname:Y.Z.getPreviousStepUrl(t),search:E.search}},i.createElement(d.Z,null)),i.createElement("div",{className:"u-marg-top--light u-marg-bottom--heavy"},i.createElement(s.Z,{bold:!0},p(u.W.Navigation.Steps.Addon))))),e.screenSize>q.Z.Medium&&i.createElement(m.f,null,i.createElement(U.Z,null))),e.screenSize>q.Z.Medium&&i.createElement(g.Z,null),i.createElement(j,null))}}}]);