@roomstay/core 0.1.51-0 → 0.1.52-0
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.
- package/dist/node.js +1 -1
- package/dist/types/Addons/Addon.type.d.ts +24 -0
- package/dist/types/Addons/Addon.types.d.ts +29 -0
- package/dist/types/Analytics/IBigQueryResults.type.d.ts +35 -0
- package/dist/types/Booking/Booking.types.d.ts +7 -0
- package/dist/types/Booking/ConfirmBooking.types.d.ts +19 -0
- package/dist/types/Booking/EBooking.types.d.ts +12 -0
- package/dist/types/Booking/EBookingStatus.type.d.ts +7 -0
- package/dist/types/Booking/GetBooking.types.d.ts +7 -0
- package/dist/types/Booking/IBookingCreateErrorResponse.type.d.ts +11 -0
- package/dist/types/Booking/ICommonQueryParameters.d.ts +3 -0
- package/dist/types/Booking/ICommonQueryParameters.type.d.ts +3 -0
- package/dist/types/Booking/IConfirmBooking.type.d.ts +19 -0
- package/dist/types/Booking/IConfirmBookingRequest.d.ts +14 -0
- package/dist/types/Booking/IConfirmBookingRequest.type.d.ts +14 -0
- package/dist/types/Booking/IGetBooking.type.d.ts +7 -0
- package/dist/types/Booking/IItinerary.type.d.ts +99 -0
- package/dist/types/Booking/IItineraryResponse.d.ts +105 -0
- package/dist/types/Booking/IPackage.type.d.ts +89 -0
- package/dist/types/Booking/IPencilReservation.type.d.ts +16 -0
- package/dist/types/Booking/IPlaceBooking.type.d.ts +83 -0
- package/dist/types/Booking/IRollbackBooking.type.d.ts +6 -0
- package/dist/types/Booking/Itinerary.types.d.ts +108 -0
- package/dist/types/Booking/Package.types.d.ts +89 -0
- package/dist/types/Booking/PencilReservation.types.d.ts +19 -0
- package/dist/types/Booking/PlaceBooking.types.d.ts +83 -0
- package/dist/types/Member/IRoomstayMemberBookingItem.type.d.ts +2 -2
- package/dist/types/Member/IRoomstayMemberJWTData.type.d.ts +3 -0
- package/dist/types/Package/IPackage.type.d.ts +101 -0
- package/dist/types/Package/Package.types.d.ts +101 -0
- package/dist/types/index.d.ts +26 -12
- package/dist/web.js +1 -1
- package/package.json +1 -1
package/dist/web.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
define("@roomstay/core",["decimal.js"],(e=>(()=>{"use strict";var t={60:t=>{t.exports=e}},n={};function r(e){var i=n[e];if(void 0!==i)return i.exports;var o=n[e]={exports:{}};return t[e](o,o.exports,r),o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{let e,t,n;r.r(i),r.d(i,{ADDON_PER_NIGHT_TYPES:()=>f,AddonPricingType:()=>N,EBookingPaymentMethod:()=>e,ECompanyProvider:()=>c,EDistanceUnitType:()=>g,EFeeType:()=>T,EGuarantyPolicyPrepaymentType:()=>h,EHotelCardProcessor:()=>t,EHotelPriceModel:()=>l,EHotelStateFieldConfiguration:()=>d,EHotelWeekdayStartsOn:()=>u,EIntegration:()=>P,EPlanpayBookingStatus:()=>n,ERMSDiscountType:()=>y,ERoomstayEventSource:()=>E,ERoomstayImageSize:()=>R,HttpMethod:()=>p,IAuxiliaryFilterType:()=>s,IBookingStatus:()=>a,IMaintenanceStatusService:()=>_,PCIBookingCardProcessorTypes:()=>o,RoundingType:()=>C,TotalCalculator:()=>M,calculateFeeAmount:()=>I,calculateTotalForMemberBooking:()=>m,getFeeOptionValidity:()=>k,getFilteredBookingAddonFees:()=>B,getFilteredBookingFees:()=>U,getFilteredBookingRateFees:()=>v,nameof:()=>G,resizeRoomstayImageUrl:()=>x,roundMoney:()=>F,subset:()=>b,uppercaseString:()=>Q}),function(e){e.Card="Card",e.SavedCard="SavedCard",e.Planpay="Planpay",e.Adyen="Adyen",e.Afterpay="Afterpay",e.PCIBookingCard="PCIBookingCard"}(e||(e={})),function(e){e.Passthrough="Passthrough",e.Adyen="Adyen",e.Till="Till",e.RMSPay="RMSPay",e.Windcave="Windcave"}(t||(t={})),function(e){e.Unknown="unknown",e.Unpaid="unpaid",e.Accepted="accepted",e.Cancelled="cancelled",e.Refunded="refunded",e.Rejected="rejected"}(n||(n={}));const o=[];let a,c,l,d,u,P,s,g,y,R,_,h,E,p,T,N;!function(e){e.Pending="Pending",e.Committed="Committed",e.Cancelled="Cancelled"}(a||(a={})),function(e){e.Synxis="Synxis",e.Availpro="Availpro",e.RMS="RMS",e.Siteminder="Siteminder",e.Roomstay="Roomstay"}(c||(c={})),function(e){e.PerPerson="PerPerson",e.PerDay="PerDay",e.PerOccupancy="PerOccupancy"}(l||(l={})),function(e){e.NotIncluded="NotIncluded",e.Optional="Optional",e.Required="Required"}(d||(d={})),function(e){e.Monday="monday",e.Sunday="sunday"}(u||(u={})),function(e){e.Big4="Big4",e.RmsTop10="Top10",e.Top10="NewTop10",e.Gday="Gday",e.Salesforce="Salesforce"}(P||(P={})),function(e){e.AreaDwellingLength="AreaDwellingLength",e.AreaDwellingType="AreaDwellingType"}(s||(s={})),function(e){e.Metric="metric",e.Imperial="imperial"}(g||(g={})),function(e){e.Percentage="Percentage",e.Amount="Amount",e.Bogo="BOGO",e.NightlyRateOverride="NightlyRateOverride"}(y||(y={})),function(e){e[e.Icon=128]="Icon",e[e.Tiny=256]="Tiny",e[e.Small=512]="Small",e[e.Medium=768]="Medium",e[e.Large=1024]="Large",e[e.ExtraLarge=1600]="ExtraLarge"}(R||(R={})),function(e){e.Frontend="frontend",e.Hotel="hotel",e.Events="events"}(_||(_={})),function(e){e.FixedAmount="fixed",e.Percentage="percentage",e.Nights="nights"}(h||(h={})),function(e){e.Eventbrite="eventbrite",e.ATDW="atdw"}(E||(E={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE",e.PATCH="PATCH",e.OPTIONS="OPTIONS",e.HEAD="HEAD"}(p||(p={})),function(e){e.PercentageOfBooking="PercentageOfBooking",e.FixedChargePerRoom="FixedChargePerRoom",e.NightlyChargePerRoom="NightlyChargePerRoom",e.FixedChargePerBooking="FixedChargePerBooking",e.DepositSurcharge="DepositSurcharge"}(T||(T={})),function(e){e.PER_STAY="Per stay",e.PER_NIGHT="Per night",e.PER_PERSON="Per person",e.PER_PERSON_PER_NIGHT="Per person per night",e.PER_ALL_PERSONS="Per all persons",e.PER_ALL_PERSONS_PER_NIGHT="Per all persons per night",e.PER_QUANTITY_NAME_PER_NIGHT="Per Quantity Name Per Night",e.PER_ROOM_QUANTITY_PER_NIGHT="Per Room Quantity Per Night",e.PER_PERSON_OCCUPANCY_PER_NIGHT="Per Person Occupancy Per Night",e.PER_ADULT_OCCUPANCY_PER_NIGHT="Per Adult Occupancy Per Night",e.PER_CHILD_OCCUPANCY_PER_NIGHT="Per Child Occupancy Per Night"}(N||(N={}));const f=[N.PER_NIGHT,N.PER_PERSON_PER_NIGHT,N.PER_QUANTITY_NAME_PER_NIGHT,N.PER_ROOM_QUANTITY_PER_NIGHT,N.PER_PERSON_OCCUPANCY_PER_NIGHT,N.PER_ADULT_OCCUPANCY_PER_NIGHT,N.PER_CHILD_OCCUPANCY_PER_NIGHT,N.PER_ALL_PERSONS_PER_NIGHT],m=e=>{let t=0;const n=Object.values(e.itinerary);for(const e of n){const n=Object.keys(e.nights);for(const r of n)t+=e.nights[r].total}return t};var O=r(60),A=r.n(O);const C={UP:A().ROUND_UP,DOWN:A().ROUND_DOWN,CEIL:A().ROUND_CEIL,FLOOR:A().ROUND_FLOOR,HALF_UP:A().ROUND_HALF_UP,HALF_DOWN:A().ROUND_HALF_DOWN,HALF_EVEN:A().ROUND_HALF_EVEN,HALF_CEIL:A().ROUND_HALF_CEIL,HALF_FLOOR:A().ROUND_HALF_FLOOR},F=(e,t)=>{const{precision:n=2,rounding:r=C.HALF_UP}=t||{};return new(A())(e).toDecimalPlaces(n,r).toNumber()};function I(e,t={}){const{baseAmount:n=0,numberOfNights:r=1,feeIncludedInBaseAmount:i=!1,extractedFromRates:o=!1,removedPercentages:a=[]}=t,c=F(n);switch(e.feeType){case T.PercentageOfBooking:if(i)return F(c*e.amount/(100+e.amount));if(o){const t=a.reduce(((e,t)=>e+t/(100+t)),0);return F(c/(1-t)*e.amount/(100+e.amount))}return F(c*(e.amount/100));case T.FixedChargePerRoom:case T.FixedChargePerBooking:return e.amount;case T.NightlyChargePerRoom:return F(e.amount*r);default:return 0}}const S=[T.FixedChargePerBooking],H=[T.PercentageOfBooking,T.FixedChargePerRoom,T.NightlyChargePerRoom],L=[T.PercentageOfBooking];function D(e,t){return e.filter((e=>t.includes(e.feeType)))}function U(e){return D(e,S)}function v(e){return D(e,H)}function B(e){return D(e,L)}function k(e){return{includeInRates:[T.PercentageOfBooking,T.NightlyChargePerRoom].includes(e),extractFeeFromRates:e===T.PercentageOfBooking,appliesToAddons:e===T.PercentageOfBooking,includePreviousFeesInCalculation:e===T.PercentageOfBooking}}const G=e=>e,b=(e,t)=>{const n={};return t.forEach((t=>{t in e&&(n[t]=e[t])})),n},x=(e,t)=>e.includes("cdn.app.roomstay.io")?e+"?w="+t:e;class M{}function Q(e){return e.toUpperCase()}M.calculateBaseAddonTotal=(e,t)=>{let n=0,r=0,i=0;e.price&&e.quantity&&(n=e.quantity*Number(e.price)),e.pricingType===N.PER_ADULT_OCCUPANCY_PER_NIGHT&&e.adultQuantity?n*=e.adultQuantity:e.pricingType===N.PER_CHILD_OCCUPANCY_PER_NIGHT&&e.childQuantity&&(n*=e.childQuantity),e.adultPrice&&e.adultQuantity&&(r=e.adultQuantity*Number(e.adultPrice)),e.childPrice&&e.childQuantity&&(i=e.childQuantity*Number(e.childPrice));let o=n+r+i;return f.includes(e.pricingType)&&e.nights&&!t&&(o*=e.nights),{indPrice:n,indAdultPrice:r,indChildPrice:i,addonTotal:o}},M.calculateBasketAddonTotal=(e,t=!1)=>(Array.isArray(e)||(e=[e]),e.reduce(((e,n)=>{const r=M.calculateBaseAddonTotal(n,t);let i=0;return(n.fee||n.fees?.length)&&n.quantity?n.fees?.length?n.fees.forEach((e=>{i+=n.quantity*e.amount})):i=n.quantity*Number(n.fee):((n.adultFee||n.adultFees?.length)&&n.adultQuantity&&(n.adultFees?.length?n.adultFees.forEach((e=>{i+=n.adultQuantity*e.amount})):i+=n.adultQuantity??1*Number(n.adultFee)),(n.childFee||n.childFees?.length)&&n.childQuantity&&(n.childFees?.length?n.childFees.forEach((e=>{i+=n.childQuantity??1*e.amount})):i+=n.childQuantity*Number(n.childFee))),f.includes(n.pricingType)&&n.nights&&!t&&(i*=n.nights),{price:e.price+r.indPrice,adultPrice:e.adultPrice+r.indAdultPrice,childPrice:e.childPrice+r.indChildPrice,totalFees:e.totalFees+i,total:e.total+r.addonTotal+i}}),{price:0,adultPrice:0,childPrice:0,totalFees:0,total:0})),M.calculateReservationAddonTotal=(e,t=!1)=>(Array.isArray(e)||(e=[e]),e.reduce(((e,n)=>{const r=M.calculateBaseAddonTotal(n,t);let i=n.fees||0;n.itemisedFees?.length&&(i=n.itemisedFees.reduce(((e,t)=>e+t.amount),0));const o=n.itemisedFees?.length?r.addonTotal:r.addonTotal+i;return{price:e.price+r.indPrice,adultPrice:e.adultPrice+r.indAdultPrice,childPrice:e.childPrice+r.indChildPrice,totalFees:e.totalFees+i,total:e.total+r.addonTotal+i,displayPrice:e.displayPrice+o}}),{price:0,adultPrice:0,childPrice:0,totalFees:0,total:0,displayPrice:0})),M.calculateTotalForReservation=(e,t=!1)=>{let n=0;return e.itemisedFees?.forEach((e=>{n+=e.amount})),e.reservations.forEach((e=>{n+=e.total.afterTax;const r=Object.keys(e.nights)?.length??0;if(e.addons?.length){const i=(e.addons??[]).map((e=>({...e,nights:r})));n+=M.calculateReservationAddonTotal(i,t)?.total}})),F(n)}})(),i})()));
|
|
1
|
+
define("@roomstay/core",["decimal.js"],(e=>(()=>{"use strict";var t={60:t=>{t.exports=e}},i={};function o(e){var n=i[e];if(void 0!==n)return n.exports;var r=i[e]={exports:{}};return t[e](r,r.exports,o),r.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var i in t)o.o(t,i)&&!o.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{let e,t,i,r,a,d;o.r(n),o.d(n,{ADDON_PER_NIGHT_TYPES:()=>I,AddonPricingType:()=>f,EAddonPricingType:()=>e,EBookingFlow:()=>i,EBookingPaymentMethod:()=>r,EBookingStatus:()=>t,ECompanyProvider:()=>u,EDistanceUnitType:()=>E,EFeeType:()=>C,EGuarantyPolicyPrepaymentType:()=>T,EHotelCardProcessor:()=>a,EHotelPriceModel:()=>h,EHotelStateFieldConfiguration:()=>g,EHotelWeekdayStartsOn:()=>y,EIntegration:()=>R,EPlanpayBookingStatus:()=>d,ERMSDiscountType:()=>p,ERoomstayEventSource:()=>v,ERoomstayImageSize:()=>N,GuestProfile:()=>P,HttpMethod:()=>O,IAuxiliaryFilterType:()=>_,IMaintenanceStatusService:()=>m,ItineraryResponse:()=>s,PCIBookingCardProcessorTypes:()=>c,Package:()=>A,Reservation:()=>l,ReservedPackage:()=>F,RoundingType:()=>L,TotalCalculator:()=>V,calculateFeeAmount:()=>k,calculateTotalForMemberBooking:()=>S,getFeeOptionValidity:()=>w,getFilteredBookingAddonFees:()=>Y,getFilteredBookingFees:()=>x,getFilteredBookingRateFees:()=>M,nameof:()=>j,resizeRoomstayImageUrl:()=>W,roundMoney:()=>U,subset:()=>q,uppercaseString:()=>z}),function(e){e.PER_STAY="Per stay",e.PER_NIGHT="Per night",e.PER_PERSON="Per person",e.PER_PERSON_PER_NIGHT="Per person per night",e.PER_ALL_PERSONS="Per all persons",e.PER_ALL_PERSONS_PER_NIGHT="Per all persons per night",e.PER_QUANTITY_NAME_PER_NIGHT="Per Quantity Name Per Night",e.PER_ROOM_QUANTITY_PER_NIGHT="Per Room Quantity Per Night",e.PER_PERSON_OCCUPANCY_PER_NIGHT="Per Person Occupancy Per Night",e.PER_ADULT_OCCUPANCY_PER_NIGHT="Per Adult Occupancy Per Night",e.PER_CHILD_OCCUPANCY_PER_NIGHT="Per Child Occupancy Per Night"}(e||(e={})),function(e){e.Pending="Pending",e.Processing="Processing",e.Committed="Committed",e.Cancelled="Cancelled",e.Reverted="Reverted"}(t||(t={})),function(e){e.Default="Default",e.PreCheckoutPencil="PreCheckoutPencil",e.PostCheckoutPencil="PostCheckoutPencil"}(i||(i={})),function(e){e.Card="Card",e.SavedCard="SavedCard",e.Planpay="Planpay",e.Adyen="Adyen",e.Afterpay="Afterpay",e.PCIBookingCard="PCIBookingCard"}(r||(r={})),function(e){e.Passthrough="Passthrough",e.Adyen="Adyen",e.Till="Till",e.RMSPay="RMSPay",e.Windcave="Windcave"}(a||(a={})),function(e){e.Unknown="unknown",e.Unpaid="unpaid",e.Accepted="accepted",e.Cancelled="cancelled",e.Refunded="refunded",e.Rejected="rejected"}(d||(d={}));const c=[];class s{constructor(){this.roomstayId=void 0,this.itineraryNumber=void 0,this.total=void 0,this.hotelFrontendId=void 0,this.reservations=[],this.payment=void 0,this.feesSummary=void 0,this.itemisedFees=void 0,this.warnings=void 0}}class l{constructor(){this.reservationNumber=void 0,this.roomType=void 0,this.roomCode=void 0,this.rate=void 0,this.rateCode=void 0,this.images=void 0,this.guaranteePolicy=void 0,this.cancellationPolicy=void 0,this.checkInDate=void 0,this.checkOutDate=void 0,this.nights={},this.guestCounts={adults:1,children:0},this.guest=new P,this.paymentCard=void 0,this.paymentMethod=void 0,this.total=void 0,this.status=void 0,this.isCancelable=void 0,this.addons=void 0,this.comments=void 0,this.specialRequests=void 0,this.promoCode=void 0,this.guaranteePolicyLongDescription=void 0,this.cancellationPolicyLongDescription=void 0,this.itemisedFees=void 0}}class P{constructor(){this.title=void 0,this.firstName=void 0,this.middleName=void 0,this.lastName=void 0,this.nameSuffix=void 0,this.phone=void 0,this.email=void 0,this.address={},this.marketingOptIn=void 0,this.country=void 0}}let u,h,g,y,R,_,E,p,N,m,T,v,O,C,f;!function(e){e.Synxis="Synxis",e.Availpro="Availpro",e.RMS="RMS",e.Siteminder="Siteminder",e.Roomstay="Roomstay"}(u||(u={})),function(e){e.PerPerson="PerPerson",e.PerDay="PerDay",e.PerOccupancy="PerOccupancy"}(h||(h={})),function(e){e.NotIncluded="NotIncluded",e.Optional="Optional",e.Required="Required"}(g||(g={})),function(e){e.Monday="monday",e.Sunday="sunday"}(y||(y={})),function(e){e.Big4="Big4",e.RmsTop10="Top10",e.Top10="NewTop10",e.Gday="Gday",e.Salesforce="Salesforce"}(R||(R={})),function(e){e.AreaDwellingLength="AreaDwellingLength",e.AreaDwellingType="AreaDwellingType"}(_||(_={})),function(e){e.Metric="metric",e.Imperial="imperial"}(E||(E={})),function(e){e.Percentage="Percentage",e.Amount="Amount",e.Bogo="BOGO",e.NightlyRateOverride="NightlyRateOverride"}(p||(p={})),function(e){e[e.Icon=128]="Icon",e[e.Tiny=256]="Tiny",e[e.Small=512]="Small",e[e.Medium=768]="Medium",e[e.Large=1024]="Large",e[e.ExtraLarge=1600]="ExtraLarge"}(N||(N={})),function(e){e.Frontend="frontend",e.Hotel="hotel",e.Events="events"}(m||(m={}));class A{constructor(){this.ratePlanCode=void 0,this.name=void 0,this.description=void 0,this.inclusive=void 0,this.image=void 0,this.url=void 0,this.pricingType=void 0,this.quantity=void 0,this.category=void 0,this.cancelPenalty=void 0,this.guaranteeDescription=void 0,this.availability={}}}class F extends A{constructor(...e){super(...e),this.code=void 0,this.price=void 0,this.fees=void 0,this.itemisedFees=void 0,this.adultQuantity=void 0,this.childQuantity=void 0,this.adultPrice=void 0,this.childPrice=void 0,this.startDate=void 0,this.startTime=void 0,this.hideDatePicker=!1,this.order=void 0}}!function(e){e.FixedAmount="fixed",e.Percentage="percentage",e.Nights="nights"}(T||(T={})),function(e){e.Eventbrite="eventbrite",e.ATDW="atdw"}(v||(v={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE",e.PATCH="PATCH",e.OPTIONS="OPTIONS",e.HEAD="HEAD"}(O||(O={})),function(e){e.PercentageOfBooking="PercentageOfBooking",e.FixedChargePerRoom="FixedChargePerRoom",e.NightlyChargePerRoom="NightlyChargePerRoom",e.FixedChargePerBooking="FixedChargePerBooking",e.DepositSurcharge="DepositSurcharge"}(C||(C={})),function(e){e.PER_STAY="Per stay",e.PER_NIGHT="Per night",e.PER_PERSON="Per person",e.PER_PERSON_PER_NIGHT="Per person per night",e.PER_ALL_PERSONS="Per all persons",e.PER_ALL_PERSONS_PER_NIGHT="Per all persons per night",e.PER_QUANTITY_NAME_PER_NIGHT="Per Quantity Name Per Night",e.PER_ROOM_QUANTITY_PER_NIGHT="Per Room Quantity Per Night",e.PER_PERSON_OCCUPANCY_PER_NIGHT="Per Person Occupancy Per Night",e.PER_ADULT_OCCUPANCY_PER_NIGHT="Per Adult Occupancy Per Night",e.PER_CHILD_OCCUPANCY_PER_NIGHT="Per Child Occupancy Per Night"}(f||(f={}));const I=[f.PER_NIGHT,f.PER_PERSON_PER_NIGHT,f.PER_QUANTITY_NAME_PER_NIGHT,f.PER_ROOM_QUANTITY_PER_NIGHT,f.PER_PERSON_OCCUPANCY_PER_NIGHT,f.PER_ADULT_OCCUPANCY_PER_NIGHT,f.PER_CHILD_OCCUPANCY_PER_NIGHT,f.PER_ALL_PERSONS_PER_NIGHT],S=e=>{let t=0;const i=Object.values(e.itinerary);for(const e of i){const i=Object.keys(e.nights);for(const o of i)t+=e.nights[o].total}return t};var H=o(60),D=o.n(H);const L={UP:D().ROUND_UP,DOWN:D().ROUND_DOWN,CEIL:D().ROUND_CEIL,FLOOR:D().ROUND_FLOOR,HALF_UP:D().ROUND_HALF_UP,HALF_DOWN:D().ROUND_HALF_DOWN,HALF_EVEN:D().ROUND_HALF_EVEN,HALF_CEIL:D().ROUND_HALF_CEIL,HALF_FLOOR:D().ROUND_HALF_FLOOR},U=(e,t)=>{const{precision:i=2,rounding:o=L.HALF_UP}=t||{};return new(D())(e).toDecimalPlaces(i,o).toNumber()};function k(e,t={}){const{baseAmount:i=0,numberOfNights:o=1,feeIncludedInBaseAmount:n=!1,extractedFromRates:r=!1,removedPercentages:a=[]}=t,d=U(i);switch(e.feeType){case C.PercentageOfBooking:if(n)return U(d*e.amount/(100+e.amount));if(r){const t=a.reduce(((e,t)=>e+t/(100+t)),0);return U(d/(1-t)*e.amount/(100+e.amount))}return U(d*(e.amount/100));case C.FixedChargePerRoom:case C.FixedChargePerBooking:return e.amount;case C.NightlyChargePerRoom:return U(e.amount*o);default:return 0}}const G=[C.FixedChargePerBooking],B=[C.PercentageOfBooking,C.FixedChargePerRoom,C.NightlyChargePerRoom],b=[C.PercentageOfBooking];function Q(e,t){return e.filter((e=>t.includes(e.feeType)))}function x(e){return Q(e,G)}function M(e){return Q(e,B)}function Y(e){return Q(e,b)}function w(e){return{includeInRates:[C.PercentageOfBooking,C.NightlyChargePerRoom].includes(e),extractFeeFromRates:e===C.PercentageOfBooking,appliesToAddons:e===C.PercentageOfBooking,includePreviousFeesInCalculation:e===C.PercentageOfBooking}}const j=e=>e,q=(e,t)=>{const i={};return t.forEach((t=>{t in e&&(i[t]=e[t])})),i},W=(e,t)=>e.includes("cdn.app.roomstay.io")?e+"?w="+t:e;class V{}function z(e){return e.toUpperCase()}V.calculateBaseAddonTotal=(e,t)=>{let i=0,o=0,n=0;e.price&&e.quantity&&(i=e.quantity*Number(e.price)),e.pricingType===f.PER_ADULT_OCCUPANCY_PER_NIGHT&&e.adultQuantity?i*=e.adultQuantity:e.pricingType===f.PER_CHILD_OCCUPANCY_PER_NIGHT&&e.childQuantity&&(i*=e.childQuantity),e.adultPrice&&e.adultQuantity&&(o=e.adultQuantity*Number(e.adultPrice)),e.childPrice&&e.childQuantity&&(n=e.childQuantity*Number(e.childPrice));let r=i+o+n;return I.includes(e.pricingType)&&e.nights&&!t&&(r*=e.nights),{indPrice:i,indAdultPrice:o,indChildPrice:n,addonTotal:r}},V.calculateBasketAddonTotal=(e,t=!1)=>(Array.isArray(e)||(e=[e]),e.reduce(((e,i)=>{const o=V.calculateBaseAddonTotal(i,t);let n=0;return(i.fee||i.fees?.length)&&i.quantity?i.fees?.length?i.fees.forEach((e=>{n+=i.quantity*e.amount})):n=i.quantity*Number(i.fee):((i.adultFee||i.adultFees?.length)&&i.adultQuantity&&(i.adultFees?.length?i.adultFees.forEach((e=>{n+=i.adultQuantity*e.amount})):n+=i.adultQuantity??1*Number(i.adultFee)),(i.childFee||i.childFees?.length)&&i.childQuantity&&(i.childFees?.length?i.childFees.forEach((e=>{n+=i.childQuantity??1*e.amount})):n+=i.childQuantity*Number(i.childFee))),I.includes(i.pricingType)&&i.nights&&!t&&(n*=i.nights),{price:e.price+o.indPrice,adultPrice:e.adultPrice+o.indAdultPrice,childPrice:e.childPrice+o.indChildPrice,totalFees:e.totalFees+n,total:e.total+o.addonTotal+n}}),{price:0,adultPrice:0,childPrice:0,totalFees:0,total:0})),V.calculateReservationAddonTotal=(e,t=!1)=>(Array.isArray(e)||(e=[e]),e.reduce(((e,i)=>{const o=V.calculateBaseAddonTotal(i,t);let n=i.fees||0;i.itemisedFees?.length&&(n=i.itemisedFees.reduce(((e,t)=>e+t.amount),0));const r=i.itemisedFees?.length?o.addonTotal:o.addonTotal+n;return{price:e.price+o.indPrice,adultPrice:e.adultPrice+o.indAdultPrice,childPrice:e.childPrice+o.indChildPrice,totalFees:e.totalFees+n,total:e.total+o.addonTotal+n,displayPrice:e.displayPrice+r}}),{price:0,adultPrice:0,childPrice:0,totalFees:0,total:0,displayPrice:0})),V.calculateTotalForReservation=(e,t=!1)=>{let i=0;return e.itemisedFees?.forEach((e=>{i+=e.amount})),e.reservations.forEach((e=>{i+=e.total.afterTax;const o=Object.keys(e.nights)?.length??0;if(e.addons?.length){const n=(e.addons??[]).map((e=>({...e,nights:o})));i+=V.calculateReservationAddonTotal(n,t)?.total}})),U(i)}})(),n})()));
|