@roomstay/core 0.1.52 → 0.1.53-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.
Files changed (68) hide show
  1. package/dist/index.d.ts +0 -0
  2. package/dist/node.js +1 -1
  3. package/dist/node.js.LICENSE.txt +7 -0
  4. package/dist/types/Addons/Addon.type.d.ts +24 -0
  5. package/dist/types/Booking/Booking.types.d.ts +7 -0
  6. package/dist/types/Booking/EBookingStatus.type.d.ts +7 -0
  7. package/dist/types/Booking/IBookingCreateErrorResponse.d.ts +11 -0
  8. package/dist/types/Booking/IBookingPayment.type.d.ts +0 -0
  9. package/dist/types/Booking/IBookingQuote.type.d.ts +0 -0
  10. package/dist/types/Booking/IBookingStatus.type.d.ts +5 -0
  11. package/dist/types/Booking/ICheckoutBrowserSession.type.d.ts +14 -0
  12. package/dist/types/Booking/ICommonQueryParameters.d.ts +3 -0
  13. package/dist/types/Booking/IConfirmBooking.type.d.ts +19 -0
  14. package/dist/types/Booking/IConfirmBookingRequest.d.ts +14 -0
  15. package/dist/types/Booking/IConfirmBookingRequest.type.d.ts +14 -0
  16. package/dist/types/Booking/IGetBooking.type.d.ts +7 -0
  17. package/dist/types/Booking/IItinerary.type.d.ts +99 -0
  18. package/dist/types/Booking/IItineraryResponse.d.ts +105 -0
  19. package/dist/types/Booking/IPackage.type.d.ts +89 -0
  20. package/dist/types/Booking/IPencilReservation.type.d.ts +16 -0
  21. package/dist/types/Booking/IPlaceBooking.type.d.ts +83 -0
  22. package/dist/types/Booking/IPrice.type.d.ts +7 -0
  23. package/dist/types/Booking/IRollbackBooking.type.d.ts +6 -0
  24. package/dist/types/Booking/Package.types.d.ts +89 -0
  25. package/dist/types/Company/ECompanyProvider.enum.d.ts +0 -0
  26. package/dist/types/Company/IAdminCompany.type.d.ts +0 -3
  27. package/dist/types/Company/IAdminCompanyUser.type.d.ts +0 -0
  28. package/dist/types/Events/IRoomstayEvent.type.d.ts +0 -0
  29. package/dist/types/Fees/IFee.type.d.ts +5 -0
  30. package/dist/types/General/HttpMethod.enum.d.ts +0 -0
  31. package/dist/types/General/IJsonString.type.d.ts +6 -0
  32. package/dist/types/Hotel/EHotelPriceModel.enum.d.ts +0 -0
  33. package/dist/types/Hotel/EHotelWeekdayStartsOn.enum.d.ts +0 -0
  34. package/dist/types/Hotel/IAuxiliaryFilter.type.d.ts +0 -0
  35. package/dist/types/Hotel/IHotelColorScheme.type.d.ts +0 -0
  36. package/dist/types/Hotel/IHotelOverrides.type.d.ts +0 -0
  37. package/dist/types/Hotel/IHotelReplica.type.d.ts +0 -0
  38. package/dist/types/Hotel/IHotelService.type.d.ts +0 -0
  39. package/dist/types/Image/IRoomstayImage.type.d.ts +0 -0
  40. package/dist/types/Member/IRoomstayCognitoMember.type.d.ts +0 -0
  41. package/dist/types/Member/IRoomstayMember.type.d.ts +0 -0
  42. package/dist/types/Member/IRoomstayMemberBooking.type.d.ts +0 -0
  43. package/dist/types/Member/IRoomstayMemberBookingAddress.type.d.ts +0 -0
  44. package/dist/types/Member/IRoomstayMemberBookingItem.type.d.ts +0 -0
  45. package/dist/types/Member/IRoomstayMemberBookingProfile.type.d.ts +0 -0
  46. package/dist/types/Member/IRoomstayMemberCards.type.d.ts +0 -0
  47. package/dist/types/Member/ISession.type.d.ts +0 -0
  48. package/dist/types/Package/IPackage.type.d.ts +101 -0
  49. package/dist/types/Policies/EGuaranteePolicy.enum.d.ts +0 -0
  50. package/dist/types/RMS/ERMSDiscountType.enum.d.ts +0 -0
  51. package/dist/types/RMS/IRMSPropertyDiscount.type.d.ts +1 -1
  52. package/dist/types/RMS/IRMSRequirement.type.d.ts +0 -0
  53. package/dist/types/Room/IRoomGroup.type.d.ts +0 -0
  54. package/dist/types/index.d.ts +13 -1
  55. package/dist/utils/bookingTotal.d.ts +0 -0
  56. package/dist/utils/index.d.ts +9 -8
  57. package/dist/utils/nameof.d.ts +2 -0
  58. package/dist/utils/roomstayImageResize.d.ts +0 -0
  59. package/dist/utils/roundMoney.d.ts +11 -1
  60. package/dist/utils/uppercaseString.d.ts +0 -0
  61. package/dist/web.js +1 -1
  62. package/dist/web.js.LICENSE.txt +7 -0
  63. package/package.json +1 -1
  64. package/dist/types/General/Format.types.d.ts +0 -1
  65. package/dist/types/General/Pagination.types.d.ts +0 -19
  66. package/dist/types/GiftCards/GiftCard.types.d.ts +0 -32
  67. package/dist/types/GiftCards/GiftCardAuth.types.d.ts +0 -31
  68. package/dist/utils/zodUtils.d.ts +0 -19
package/dist/index.d.ts CHANGED
File without changes
package/dist/node.js CHANGED
@@ -1 +1 @@
1
- (()=>{"use strict";var e={n:t=>{var i=t&&t.__esModule?()=>t.default:()=>t;return e.d(i,{a:i}),i},d:(t,i)=>{for(var o in i)e.o(i,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:i[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};let i,o,n,r,a,s;e.r(t),e.d(t,{EAddonPricingType:()=>i,EBookingFlow:()=>n,EBookingPaymentMethod:()=>r,EBookingStatus:()=>o,ECompanyProvider:()=>P,EDistanceUnitType:()=>p,EFeeType:()=>O,EGuarantyPolicyPrepaymentType:()=>C,EHotelCardProcessor:()=>a,EHotelPriceModel:()=>h,EHotelStateFieldConfiguration:()=>g,EHotelWeekdayStartsOn:()=>y,EIntegration:()=>m,EPlanpayBookingStatus:()=>s,ERMSDiscountType:()=>f,ERoomstayEventSource:()=>E,ERoomstayImageSize:()=>R,GuestProfile:()=>l,HttpMethod:()=>T,IAuxiliaryFilterType:()=>v,ItineraryResponse:()=>c,PCIBookingCardProcessorTypes:()=>d,Package:()=>N,Reservation:()=>u,ReservedPackage:()=>S,calculateFeeAmount:()=>x,calculateTotalForMemberBooking:()=>k,getFeeOptionValidity:()=>Q,getFilteredBookingAddonFees:()=>j,getFilteredBookingFees:()=>G,getFilteredBookingRateFees:()=>U,nameof:()=>I,resizeRoomstayImageUrl:()=>_,roundMoney:()=>b,subset:()=>F,uppercaseString:()=>A}),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"}(i||(i={})),function(e){e.Pending="Pending",e.Processing="Processing",e.Committed="Committed",e.Cancelled="Cancelled",e.Reverted="Reverted"}(o||(o={})),function(e){e.Default="Default",e.PreCheckoutPencil="PreCheckoutPencil",e.PostCheckoutPencil="PostCheckoutPencil"}(n||(n={})),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"}(s||(s={}));const d=[];class c{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 u{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 l,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 l{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 P,h,g,y,m,v,p,f,R,C,E,T,O;!function(e){e.Synxis="Synxis",e.Availpro="Availpro",e.RMS="RMS",e.Siteminder="Siteminder",e.Roomstay="Roomstay"}(P||(P={})),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"}(m||(m={})),function(e){e.AreaDwellingLength="AreaDwellingLength",e.AreaDwellingType="AreaDwellingType"}(v||(v={})),function(e){e.Metric="metric",e.Imperial="imperial"}(p||(p={})),function(e){e.Percentage="Percentage",e.Amount="Amount",e.Bogo="BOGO",e.NightlyRateOverride="NightlyRateOverride"}(f||(f={})),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={}));class N{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 S extends N{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 A(e){return e.toUpperCase()}!function(e){e.FixedAmount="fixed",e.Percentage="percentage",e.Nights="nights"}(C||(C={})),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"}(T||(T={})),function(e){e.PercentageOfBooking="PercentageOfBooking",e.FixedChargePerRoom="FixedChargePerRoom",e.NightlyChargePerRoom="NightlyChargePerRoom",e.FixedChargePerBooking="FixedChargePerBooking",e.DepositSurcharge="DepositSurcharge"}(O||(O={}));const k=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},_=(e,t)=>e.includes("cdn.app.roomstay.io")?e+"?w="+t:e,I=e=>e,F=(e,t)=>{const i={};return t.forEach((t=>{t in e&&(i[t]=e[t])})),i},B=require("decimal.js");var D=e.n(B);const b=e=>new(D())(e).toDecimalPlaces(2).toNumber();function x(e,t={}){const{baseAmount:i=0,numberOfNights:o=1,feeIncludedInBaseAmount:n=!1,extractedFromRates:r=!1,removedPercentages:a=[]}=t,s=b(i);switch(e.feeType){case O.PercentageOfBooking:if(n)return b(s*e.amount/(100+e.amount));if(r){const t=a.reduce(((e,t)=>e+t/(100+t)),0);return b(s/(1-t)*e.amount/(100+e.amount))}return b(s*(e.amount/100));case O.FixedChargePerRoom:case O.FixedChargePerBooking:return e.amount;case O.NightlyChargePerRoom:return b(e.amount*o);default:return 0}}const M=[O.FixedChargePerBooking],H=[O.PercentageOfBooking,O.FixedChargePerRoom,O.NightlyChargePerRoom],L=[O.PercentageOfBooking];function w(e,t){return e.filter((e=>t.includes(e.feeType)))}function G(e){return w(e,M)}function U(e){return w(e,H)}function j(e){return w(e,L)}function Q(e){return{includeInRates:[O.PercentageOfBooking,O.NightlyChargePerRoom].includes(e),extractFeeFromRates:e===O.PercentageOfBooking,appliesToAddons:e===O.PercentageOfBooking,includePreviousFeesInCalculation:e===O.PercentageOfBooking}}module.exports=t})();
1
+ (()=>{"use strict";var e={n:t=>{var i=t&&t.__esModule?()=>t.default:()=>t;return e.d(i,{a:i}),i},d:(t,i)=>{for(var o in i)e.o(i,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:i[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};let i,o,n,r,a,d;e.r(t),e.d(t,{ADDON_PER_NIGHT_TYPES:()=>I,AddonPricingType:()=>f,EAddonPricingType:()=>i,EBookingFlow:()=>n,EBookingPaymentMethod:()=>r,EBookingStatus:()=>o,ECompanyProvider:()=>u,EDistanceUnitType:()=>E,EFeeType:()=>C,EGuarantyPolicyPrepaymentType:()=>T,EHotelCardProcessor:()=>a,EHotelPriceModel:()=>h,EHotelStateFieldConfiguration:()=>g,EHotelWeekdayStartsOn:()=>y,EIntegration:()=>R,EPlanpayBookingStatus:()=>d,ERMSDiscountType:()=>N,ERoomstayEventSource:()=>v,ERoomstayImageSize:()=>p,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:()=>M,getFilteredBookingRateFees:()=>x,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"}(i||(i={})),function(e){e.Pending="Pending",e.Processing="Processing",e.Committed="Committed",e.Cancelled="Cancelled",e.Reverted="Reverted"}(o||(o={})),function(e){e.Default="Default",e.PreCheckoutPencil="PreCheckoutPencil",e.PostCheckoutPencil="PostCheckoutPencil"}(n||(n={})),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,N,p,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"}(N||(N={})),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"}(p||(p={})),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},H=require("decimal.js");var D=e.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 M(e){return Q(e,G)}function x(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)},module.exports=t})();
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * decimal.js v10.4.3
3
+ * An arbitrary-precision Decimal type for JavaScript.
4
+ * https://github.com/MikeMcl/decimal.js
5
+ * Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
6
+ * MIT Licence
7
+ */
@@ -0,0 +1,24 @@
1
+ export declare enum EAddonPricingType {
2
+ PER_STAY = "Per stay",
3
+ PER_NIGHT = "Per night",
4
+ PER_PERSON = "Per person",
5
+ PER_PERSON_PER_NIGHT = "Per person per night",
6
+ PER_ALL_PERSONS = "Per all persons",
7
+ PER_ALL_PERSONS_PER_NIGHT = "Per all persons per night"
8
+ }
9
+ export type IAddonPriceDetails = {
10
+ adultPrice: number;
11
+ childPrice: number;
12
+ price: number;
13
+ adultFee: number;
14
+ childFee: number;
15
+ fee: number;
16
+ adultFees?: IAddonPriceDetailsFee[];
17
+ childFees?: IAddonPriceDetailsFee[];
18
+ fees?: IAddonPriceDetailsFee[];
19
+ pricingType: EAddonPricingType;
20
+ };
21
+ export type IAddonPriceDetailsFee = {
22
+ name: string;
23
+ amount: number;
24
+ };
@@ -0,0 +1,7 @@
1
+ export declare enum EBookingStatus {
2
+ Pending = "Pending",
3
+ Processing = "Processing",
4
+ Committed = "Committed",
5
+ Cancelled = "Cancelled",
6
+ Reverted = "Reverted"
7
+ }
@@ -0,0 +1,7 @@
1
+ export declare enum EBookingStatus {
2
+ Pending = "Pending",
3
+ Processing = "Processing",
4
+ Committed = "Committed",
5
+ Cancelled = "Cancelled",
6
+ Reverted = "Reverted"
7
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This is the response body that comes down if a booking fails anywhere in the booking flow.
3
+ *
4
+ * Object will contain a public message only, with partial reservation data to be able to attempt to "resume" the booking
5
+ */
6
+ export type IBookingCreateErrorResponse = {
7
+ canRetryPayment: boolean;
8
+ isPaymentTaken: boolean;
9
+ publicMessage: string;
10
+ roomstayId: string;
11
+ };
File without changes
File without changes
@@ -0,0 +1,5 @@
1
+ export declare enum IBookingStatus {
2
+ Pending = "Pending",
3
+ Committed = "Committed",
4
+ Cancelled = "Cancelled"
5
+ }
@@ -0,0 +1,14 @@
1
+ import { EHotelCardProcessor, EHotelCardProcessorInitData } from './IBookingPayment.type';
2
+ export type ICheckoutBrowserSession<T extends EHotelCardProcessor | undefined = EHotelCardProcessor> = {
3
+ browserSessionId: string;
4
+ checkoutSessionId: string;
5
+ rows: {}[];
6
+ /**
7
+ * ISO 8601 date string
8
+ */
9
+ expiry: string;
10
+ payment: {
11
+ processor: T;
12
+ data: EHotelCardProcessorInitData[T];
13
+ };
14
+ };
@@ -0,0 +1,3 @@
1
+ export type ICommonQueryParameters = {
2
+ language?: string;
3
+ };
@@ -0,0 +1,19 @@
1
+ import { IRoomstayMemberJWTData } from '../Member/IRoomstayMemberJWTData.type';
2
+ import { ICommonQueryParameters } from './ICommonQueryParameters.type';
3
+ import { ItineraryResponse } from './Itinerary.types';
4
+ export type IConfirmBookingRequest = {
5
+ reservationIds: string[];
6
+ itineraryId: string;
7
+ planpayCheckoutId?: string;
8
+ paymentId?: string;
9
+ roomstayId?: string;
10
+ frontendMember?: IRoomstayMemberJWTData;
11
+ source?: 'External' | 'Frontend' | 'Admin';
12
+ isBlocking?: boolean;
13
+ } & ICommonQueryParameters;
14
+ export type IConfirmBookingResponse = ItineraryResponse;
15
+ export type ICancelBookingRequest = {
16
+ email?: string;
17
+ reservationId: string;
18
+ frontendMember?: IRoomstayMemberJWTData;
19
+ } & ICommonQueryParameters;
@@ -0,0 +1,14 @@
1
+ import { IRoomstayMemberJWTData } from 'types/Member/IRoomstayMemberJWTData.type';
2
+ import { ICommonQueryParameters } from './ICommonQueryParameters';
3
+ import { IItineraryResponse } from './IItineraryResponse';
4
+ export type IConfirmBookingRequest = {
5
+ reservationIds: string[];
6
+ itineraryId: string;
7
+ planpayCheckoutId?: string;
8
+ paymentId?: string;
9
+ roomstayId?: string;
10
+ frontendMember?: IRoomstayMemberJWTData;
11
+ source?: 'External' | 'Frontend' | 'Admin';
12
+ isBlocking?: boolean;
13
+ } & ICommonQueryParameters;
14
+ export type IConfirmBookingResponse = IItineraryResponse;
@@ -0,0 +1,14 @@
1
+ import { IRoomstayMemberJWTData } from 'types/Member/IRoomstayMemberJWTData.type';
2
+ import { ICommonQueryParameters } from './ICommonQueryParameters.type';
3
+ import { IItineraryResponse } from './IItinerary.type';
4
+ export type IConfirmBookingRequest = {
5
+ reservationIds: string[];
6
+ itineraryId: string;
7
+ planpayCheckoutId?: string;
8
+ paymentId?: string;
9
+ roomstayId?: string;
10
+ frontendMember?: IRoomstayMemberJWTData;
11
+ source?: 'External' | 'Frontend' | 'Admin';
12
+ isBlocking?: boolean;
13
+ } & ICommonQueryParameters;
14
+ export type IConfirmBookingResponse = IItineraryResponse;
@@ -0,0 +1,7 @@
1
+ import { ICommonQueryParameters } from './ICommonQueryParameters.type';
2
+ import { ItineraryResponse } from './Itinerary.types';
3
+ export type IGetBookingRequest = {
4
+ email?: string;
5
+ reservationId: string;
6
+ } & ICommonQueryParameters;
7
+ export type IGetBookingResponse = ItineraryResponse;
@@ -0,0 +1,99 @@
1
+ import { EBookingPaymentMethod } from './IBookingPayment.type';
2
+ import { IPrice } from './IPrice.type';
3
+ import { IReservedPackage } from '../Package/IPackage.type';
4
+ export type IItineraryResponse = {
5
+ roomstayId: string;
6
+ itineraryNumber?: string;
7
+ total?: IAmount;
8
+ hotelFrontendId?: string;
9
+ reservations: IReservation[];
10
+ payment?: {
11
+ planpay?: {
12
+ id: string;
13
+ checkoutWorkflow: ICheckoutWorkflowType;
14
+ };
15
+ external?: {
16
+ id: string;
17
+ redirectUrl: string;
18
+ };
19
+ };
20
+ feesSummary?: IItemisedBookingFeeResponse[];
21
+ itemisedFees?: IItemisedBookingFeeResponse[];
22
+ warnings?: string[];
23
+ };
24
+ export type IReservation = {
25
+ reservationNumber: string;
26
+ roomType: string;
27
+ roomCode: string;
28
+ rate: string;
29
+ rateCode?: string;
30
+ images: string[];
31
+ guaranteePolicy?: string;
32
+ cancellationPolicy?: string;
33
+ checkInDate: string;
34
+ checkOutDate: string;
35
+ nights: {
36
+ [date: string]: IPrice;
37
+ };
38
+ guestCounts: IGuestCounts;
39
+ guest: IGuestProfile;
40
+ paymentCard: {
41
+ type: string | undefined;
42
+ last4: string;
43
+ expiry: string;
44
+ name: string;
45
+ };
46
+ paymentMethod: EBookingPaymentMethod;
47
+ total: IAmount;
48
+ status: string;
49
+ isCancelable: boolean;
50
+ addons: IReservedPackage[] | undefined;
51
+ comments?: string[];
52
+ specialRequests?: string[];
53
+ promoCode?: string;
54
+ guaranteePolicyLongDescription?: string;
55
+ cancellationPolicyLongDescription?: string;
56
+ itemisedFees?: IItemisedBookingFeeResponse[];
57
+ };
58
+ export type IGuestProfile = {
59
+ title?: string;
60
+ firstName?: string;
61
+ middleName?: string;
62
+ lastName?: string;
63
+ nameSuffix?: string;
64
+ phone?: string;
65
+ email?: string;
66
+ address: IAddress;
67
+ marketingOptIn?: boolean;
68
+ country: string;
69
+ };
70
+ export type IGuestCounts = {
71
+ adults: number;
72
+ children: number;
73
+ };
74
+ export type IAddress = {
75
+ line1?: string;
76
+ line2?: string;
77
+ line3?: string;
78
+ city?: string;
79
+ postalCode?: string;
80
+ state?: string;
81
+ country?: string;
82
+ };
83
+ export type IAmount = {
84
+ beforeTax: number;
85
+ afterTax: number;
86
+ beforeFees?: number;
87
+ };
88
+ export type ICheckoutWorkflowType = {
89
+ sdkWidget: {
90
+ type: string;
91
+ id: string;
92
+ scriptUrl: string;
93
+ };
94
+ };
95
+ export type IItemisedBookingFeeResponse = {
96
+ name: string;
97
+ description?: string;
98
+ amount: number;
99
+ };
@@ -0,0 +1,105 @@
1
+ import { EBookingPaymentMethod } from './IBookingPayment.type';
2
+ import { IReservedPackage } from './Package.types';
3
+ export type IItineraryResponse = {
4
+ roomstayId: string;
5
+ itineraryNumber?: string;
6
+ total?: IAmount;
7
+ hotelFrontendId?: string;
8
+ reservations: IReservation[];
9
+ payment?: {
10
+ planpay?: {
11
+ id: string;
12
+ checkoutWorkflow: ICheckoutWorkflowType;
13
+ };
14
+ external?: {
15
+ id: string;
16
+ redirectUrl: string;
17
+ };
18
+ };
19
+ feesSummary?: IItemisedBookingFeeResponse[];
20
+ itemisedFees?: IItemisedBookingFeeResponse[];
21
+ warnings?: string[];
22
+ };
23
+ export type IReservation = {
24
+ reservationNumber: string;
25
+ roomType: string;
26
+ roomCode: string;
27
+ rate: string;
28
+ rateCode?: string;
29
+ images: string[];
30
+ guaranteePolicy?: string;
31
+ cancellationPolicy?: string;
32
+ checkInDate: string;
33
+ checkOutDate: string;
34
+ nights: {
35
+ [date: string]: IPrice;
36
+ };
37
+ guestCounts: IGuestCounts;
38
+ guest: IGuestProfile;
39
+ paymentCard: {
40
+ type: string | undefined;
41
+ last4: string;
42
+ expiry: string;
43
+ name: string;
44
+ };
45
+ paymentMethod: EBookingPaymentMethod;
46
+ total: IAmount;
47
+ status: string;
48
+ isCancelable: boolean;
49
+ addons: IReservedPackage[] | undefined;
50
+ comments?: string[];
51
+ specialRequests?: string[];
52
+ promoCode?: string;
53
+ guaranteePolicyLongDescription?: string;
54
+ cancellationPolicyLongDescription?: string;
55
+ itemisedFees?: IItemisedBookingFeeResponse[];
56
+ };
57
+ export type IGuestProfile = {
58
+ title?: string;
59
+ firstName?: string;
60
+ middleName?: string;
61
+ lastName?: string;
62
+ nameSuffix?: string;
63
+ phone?: string;
64
+ email?: string;
65
+ address: IAddress;
66
+ marketingOptIn?: boolean;
67
+ country: string;
68
+ };
69
+ export type IGuestCounts = {
70
+ adults: number;
71
+ children: number;
72
+ };
73
+ export type IAddress = {
74
+ line1?: string;
75
+ line2?: string;
76
+ line3?: string;
77
+ city?: string;
78
+ postalCode?: string;
79
+ state?: string;
80
+ country?: string;
81
+ };
82
+ export type IAmount = {
83
+ beforeTax: number;
84
+ afterTax: number;
85
+ beforeFees?: number;
86
+ };
87
+ export type IPrice = {
88
+ cost: number;
89
+ discount: number;
90
+ tax: number;
91
+ fee: number;
92
+ total: number;
93
+ };
94
+ export type ICheckoutWorkflowType = {
95
+ sdkWidget: {
96
+ type: string;
97
+ id: string;
98
+ scriptUrl: string;
99
+ };
100
+ };
101
+ export type IItemisedBookingFeeResponse = {
102
+ name: string;
103
+ description?: string;
104
+ amount: number;
105
+ };
@@ -0,0 +1,89 @@
1
+ import { IAddonPriceDetailsFee } from 'types/Addons/Addon.type';
2
+ import { IItemisedBookingFeeResponse } from './IItinerary.type';
3
+ export type IPackage = {
4
+ /**
5
+ * The SynXis CR RatePlan Code associated with the Package if the Package is restricted to certain RatePlans
6
+ */
7
+ ratePlanCode?: string;
8
+ name: string;
9
+ description: string;
10
+ /**
11
+ * Whether the price for this package is included in the room rate.
12
+ * (Always `false` unless the price is zero)
13
+ */
14
+ inclusive: boolean;
15
+ image: string[];
16
+ url?: string;
17
+ /**
18
+ * Defines how a service is priced.
19
+ * Values:
20
+ * Per Stay
21
+ * Per Night
22
+ * Per Person
23
+ * Per Person Per Night
24
+ */
25
+ pricingType: string;
26
+ /**
27
+ * Number of available items for sale.
28
+ */
29
+ quantity?: number;
30
+ category: string;
31
+ cancelPenalty?: string | null;
32
+ guaranteeDescription?: string | null;
33
+ availability: {
34
+ [date: string]: IPriceInfo;
35
+ };
36
+ };
37
+ export type IReservedPackage = IPackage & {
38
+ code?: string | undefined;
39
+ price?: number;
40
+ fees?: number;
41
+ itemisedFees?: IItemisedBookingFeeResponse[];
42
+ adultQuantity?: number;
43
+ childQuantity?: number;
44
+ adultPrice?: number;
45
+ childPrice?: number;
46
+ startDate?: string;
47
+ startTime?: string;
48
+ hideDatePicker?: boolean;
49
+ order?: number;
50
+ };
51
+ export type IPriceInfo = {
52
+ /**
53
+ * Number of available items for sale.
54
+ */
55
+ quantity: number;
56
+ /**
57
+ * Price per quantity
58
+ */
59
+ price?: number;
60
+ adultPrice?: number;
61
+ childPrice?: number;
62
+ fees?: IAddonPriceDetailsFee[];
63
+ adultFees?: IAddonPriceDetailsFee[];
64
+ childFees?: IAddonPriceDetailsFee[];
65
+ timeSlots?: ITimeSlot[];
66
+ };
67
+ export type ITimeSlot = {
68
+ /**
69
+ The start date and time when the package is available.
70
+ If the package applies during the whole stay, this node is not returned unless the time needs to be selected. In that case, the Start and End dates do not
71
+ include the date: @Start="T07:30:00" and @End="T17:30:00" and @Increment="00:60:00"
72
+ Type: DateTime
73
+ **/
74
+ startTime?: string;
75
+ /**
76
+ The end date / time when the package is available.
77
+ If the package component applies during the whole stay, this node is not returned unless the time needs to be selected. In that case, the Start and End dates
78
+ do not include the date: @Start="T07:30:00" and @End="T17:30:00" and @Increment="00:60:00"
79
+ Type: DateTime
80
+ */
81
+ endTime?: string;
82
+ /**
83
+ Used with @Start and @End. Indicates the interval when the package or service is available.
84
+ For example, a package with golf lessons from 7:30 am to 5:30 pm with instructions and available hourly has the TimeSpan attributes set as: @Start="2015-
85
+ 010-28T07:30:00" and @End="2015-10-28T17:30:00" and @Increment="00:60:00"
86
+ Type: Time
87
+ */
88
+ increment?: string;
89
+ };
@@ -0,0 +1,16 @@
1
+ import { IBookingQuoteRequest, IBookingQuoteResponse } from './IBookingQuote.type';
2
+ export type IPencilReservationRequest = IBookingQuoteRequest & {
3
+ pencilId?: string;
4
+ rows: {
5
+ pencilId: string;
6
+ } & IBookingQuoteRequest['rows'][number][];
7
+ };
8
+ export type IPencilReservationResponse = {
9
+ timeout?: Date;
10
+ pencilId?: string;
11
+ rows: {
12
+ rowId: string;
13
+ pencilId: string;
14
+ }[];
15
+ quote?: IBookingQuoteResponse;
16
+ };
@@ -0,0 +1,83 @@
1
+ import { IRoomstayMemberJWTData } from '../Member/IRoomstayMemberJWTData.type';
2
+ import { IBookingPayment } from './IBookingPayment.type';
3
+ import { ItineraryResponse } from './Itinerary.types';
4
+ import { ICommonQueryParameters } from './ICommonQueryParameters.type';
5
+ export type IPlaceBookingRequest = {
6
+ Rooms: IPlaceBookingRoomsDTO[];
7
+ Services: IPlaceBookingServicesDTO[];
8
+ Profiles?: IPlaceBookingProfilesDTO[];
9
+ SpecialRequest?: string;
10
+ Comments?: string;
11
+ IATACode?: string;
12
+ SessionId?: string;
13
+ PencilId?: string;
14
+ Tracking: {
15
+ sourceIp: string;
16
+ userAgent: string;
17
+ sourceUrl: string;
18
+ } & IPlaceBookingGCLIDAndUTM;
19
+ payment: IBookingPayment;
20
+ frontendMember?: IRoomstayMemberJWTData;
21
+ } & ICommonQueryParameters;
22
+ export type IRepeatPaymentRequest = IPlaceBookingRequest & {
23
+ RoomstayId: string;
24
+ };
25
+ export type IPlaceBookingResponse = ItineraryResponse;
26
+ export type IPlaceBookingRoomsDTO = {
27
+ RoomType: string;
28
+ RatePlan: string;
29
+ PromoCode?: string;
30
+ Adults: number;
31
+ Children: number;
32
+ Infants?: number;
33
+ CheckInDate: Date;
34
+ CheckOutDate: Date;
35
+ QuoteId?: number;
36
+ RowId?: string;
37
+ MemberNumber?: string;
38
+ PencilId?: string;
39
+ };
40
+ export type IPlaceBookingServicesDTO = {
41
+ Code: string;
42
+ RatePlanCode: string;
43
+ StartDate: Date;
44
+ StartTime?: string;
45
+ Quantity?: number;
46
+ Adults?: number;
47
+ Children?: number;
48
+ PricingType?: string;
49
+ };
50
+ export type IPlaceBookingProfilesDTO = {
51
+ Title?: string;
52
+ FirstName: string;
53
+ MiddleName?: string;
54
+ LastName: string;
55
+ NameSuffix?: string;
56
+ Phone: string;
57
+ Email: string;
58
+ Address: {
59
+ Line1: string;
60
+ Line2?: string;
61
+ Line3?: string;
62
+ City?: string;
63
+ PostalCode?: string;
64
+ State?: string;
65
+ Country?: string;
66
+ CountryId?: number;
67
+ CountryCode?: string;
68
+ };
69
+ MarketingOptIn: boolean;
70
+ AuxInputs: {
71
+ [auxInputId: string]: string;
72
+ };
73
+ };
74
+ export type IPlaceBookingGCLIDAndUTM = {
75
+ utm: {
76
+ utmSource: string | null;
77
+ utmMedium: string | null;
78
+ utmCampaign: string | null;
79
+ utmTerm: string | null;
80
+ utmContent: string | null;
81
+ };
82
+ gclid: string | null;
83
+ };
@@ -0,0 +1,7 @@
1
+ export type IPrice = {
2
+ cost: number;
3
+ discount: number;
4
+ tax: number;
5
+ fee: number;
6
+ total: number;
7
+ };
@@ -0,0 +1,6 @@
1
+ import { EBookingStatus } from './EBookingStatus.type';
2
+ import { IConfirmBookingRequest } from './IConfirmBooking.type';
3
+ export type IRollbackBookingRequest = IConfirmBookingRequest & {
4
+ status: EBookingStatus.Reverted | EBookingStatus.Cancelled;
5
+ reason: string;
6
+ };
@@ -0,0 +1,89 @@
1
+ import { IAddonPriceDetailsFee } from 'types/Addons/Addon.types';
2
+ import { IItemisedBookingFeeResponse } from './IItineraryResponse';
3
+ export type IPackage = {
4
+ /**
5
+ * The SynXis CR RatePlan Code associated with the Package if the Package is restricted to certain RatePlans
6
+ */
7
+ ratePlanCode?: string;
8
+ name: string;
9
+ description: string;
10
+ /**
11
+ * Whether the price for this package is included in the room rate.
12
+ * (Always `false` unless the price is zero)
13
+ */
14
+ inclusive: boolean;
15
+ image: string[];
16
+ url?: string;
17
+ /**
18
+ * Defines how a service is priced.
19
+ * Values:
20
+ * Per Stay
21
+ * Per Night
22
+ * Per Person
23
+ * Per Person Per Night
24
+ */
25
+ pricingType: string;
26
+ /**
27
+ * Number of available items for sale.
28
+ */
29
+ quantity?: number;
30
+ category: string;
31
+ cancelPenalty?: string | null;
32
+ guaranteeDescription?: string | null;
33
+ availability: {
34
+ [date: string]: IPriceInfo;
35
+ };
36
+ };
37
+ export type IReservedPackage = IPackage & {
38
+ code?: string | undefined;
39
+ price?: number;
40
+ fees?: number;
41
+ itemisedFees?: IItemisedBookingFeeResponse[];
42
+ adultQuantity?: number;
43
+ childQuantity?: number;
44
+ adultPrice?: number;
45
+ childPrice?: number;
46
+ startDate?: string;
47
+ startTime?: string;
48
+ hideDatePicker?: boolean;
49
+ order?: number;
50
+ };
51
+ export type IPriceInfo = {
52
+ /**
53
+ * Number of available items for sale.
54
+ */
55
+ quantity: number;
56
+ /**
57
+ * Price per quantity
58
+ */
59
+ price?: number;
60
+ adultPrice?: number;
61
+ childPrice?: number;
62
+ fees?: IAddonPriceDetailsFee[];
63
+ adultFees?: IAddonPriceDetailsFee[];
64
+ childFees?: IAddonPriceDetailsFee[];
65
+ timeSlots?: ITimeSlot[];
66
+ };
67
+ export type ITimeSlot = {
68
+ /**
69
+ The start date and time when the package is available.
70
+ If the package applies during the whole stay, this node is not returned unless the time needs to be selected. In that case, the Start and End dates do not
71
+ include the date: @Start="T07:30:00" and @End="T17:30:00" and @Increment="00:60:00"
72
+ Type: DateTime
73
+ **/
74
+ startTime?: string;
75
+ /**
76
+ The end date / time when the package is available.
77
+ If the package component applies during the whole stay, this node is not returned unless the time needs to be selected. In that case, the Start and End dates
78
+ do not include the date: @Start="T07:30:00" and @End="T17:30:00" and @Increment="00:60:00"
79
+ Type: DateTime
80
+ */
81
+ endTime?: string;
82
+ /**
83
+ Used with @Start and @End. Indicates the interval when the package or service is available.
84
+ For example, a package with golf lessons from 7:30 am to 5:30 pm with instructions and available hourly has the TimeSpan attributes set as: @Start="2015-
85
+ 010-28T07:30:00" and @End="2015-10-28T17:30:00" and @Increment="00:60:00"
86
+ Type: Time
87
+ */
88
+ increment?: string;
89
+ };
File without changes
@@ -10,7 +10,6 @@ export interface IAdminCompany {
10
10
  isGiftCardsEnabled: boolean;
11
11
  isEventsEnabled: boolean;
12
12
  isAnalyticsEnabled: boolean;
13
- preventMemberPortalWelcomeEmails: boolean;
14
13
  hotels: {
15
14
  name: string;
16
15
  label: string;
@@ -21,10 +20,8 @@ export interface IAdminCompany {
21
20
  clientPassword: string;
22
21
  useTrainingDb: boolean;
23
22
  apiUrl: string;
24
- pencilGuestId?: number;
25
23
  };
26
24
  }[];
27
- enableLighthouseAvailability: boolean;
28
25
  }
29
26
  export type IAdminGetCompaniesResponse = IAdminCompany[];
30
27
  /** What the API expects */
File without changes
File without changes
@@ -4,3 +4,8 @@ export interface IFee {
4
4
  amount: number;
5
5
  feeType: EFeeType;
6
6
  }
7
+ export type SimpleItemisedFee = {
8
+ name: string;
9
+ description?: string;
10
+ amount: number;
11
+ };
File without changes
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Basic object to wrap a string that is de/encoded as JSON.
3
+ */
4
+ export type IJsonString = {
5
+ message: string;
6
+ };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,101 @@
1
+ import { IAddonPriceDetailsFee } from '../Addons/Addon.type';
2
+ import { IItemisedBookingFeeResponse } from '../Booking/Itinerary.types';
3
+ import { ICommonQueryParameters } from '../Booking/ICommonQueryParameters.type';
4
+ export type IPackage = {
5
+ /**
6
+ * The SynXis CR RatePlan Code associated with the Package if the Package is restricted to certain RatePlans
7
+ */
8
+ ratePlanCode?: string;
9
+ name: string;
10
+ description: string;
11
+ /**
12
+ * Whether the price for this package is included in the room rate.
13
+ * (Always `false` unless the price is zero)
14
+ */
15
+ inclusive: boolean;
16
+ image: string[];
17
+ url?: string;
18
+ /**
19
+ * Defines how a service is priced.
20
+ * Values:
21
+ * Per Stay
22
+ * Per Night
23
+ * Per Person
24
+ * Per Person Per Night
25
+ */
26
+ pricingType: string;
27
+ /**
28
+ * Number of available items for sale.
29
+ */
30
+ quantity?: number;
31
+ category: string;
32
+ cancelPenalty?: string | null;
33
+ guaranteeDescription?: string | null;
34
+ availability: {
35
+ [date: string]: IPriceInfo;
36
+ };
37
+ };
38
+ export type IReservedPackage = IPackage & {
39
+ code?: string | undefined;
40
+ price?: number;
41
+ fees?: number;
42
+ itemisedFees?: IItemisedBookingFeeResponse[];
43
+ adultQuantity?: number;
44
+ childQuantity?: number;
45
+ adultPrice?: number;
46
+ childPrice?: number;
47
+ startDate?: string;
48
+ startTime?: string;
49
+ hideDatePicker?: boolean;
50
+ order?: number;
51
+ };
52
+ export type IPriceInfo = {
53
+ /**
54
+ * Number of available items for sale.
55
+ */
56
+ quantity: number;
57
+ /**
58
+ * Price per quantity
59
+ */
60
+ price?: number;
61
+ adultPrice?: number;
62
+ childPrice?: number;
63
+ fees?: IAddonPriceDetailsFee[];
64
+ adultFees?: IAddonPriceDetailsFee[];
65
+ childFees?: IAddonPriceDetailsFee[];
66
+ timeSlots?: ITimeSlot[];
67
+ };
68
+ export type ITimeSlot = {
69
+ /**
70
+ The start date and time when the package is available.
71
+ If the package applies during the whole stay, this node is not returned unless the time needs to be selected. In that case, the Start and End dates do not
72
+ include the date: @Start="T07:30:00" and @End="T17:30:00" and @Increment="00:60:00"
73
+ Type: DateTime
74
+ **/
75
+ startTime?: string;
76
+ /**
77
+ The end date / time when the package is available.
78
+ If the package component applies during the whole stay, this node is not returned unless the time needs to be selected. In that case, the Start and End dates
79
+ do not include the date: @Start="T07:30:00" and @End="T17:30:00" and @Increment="00:60:00"
80
+ Type: DateTime
81
+ */
82
+ endTime?: string;
83
+ /**
84
+ Used with @Start and @End. Indicates the interval when the package or service is available.
85
+ For example, a package with golf lessons from 7:30 am to 5:30 pm with instructions and available hourly has the TimeSpan attributes set as: @Start="2015-
86
+ 010-28T07:30:00" and @End="2015-10-28T17:30:00" and @Increment="00:60:00"
87
+ Type: Time
88
+ */
89
+ increment?: string;
90
+ };
91
+ export type IGetPackagesRequest = {
92
+ adults?: number;
93
+ children?: number;
94
+ checkInDate: Date;
95
+ checkOutDate: Date;
96
+ rate: string;
97
+ room?: string;
98
+ } & ICommonQueryParameters;
99
+ export type IGetPackagesResponse = {
100
+ [packageName: string]: IReservedPackage;
101
+ };
File without changes
File without changes
@@ -1,4 +1,4 @@
1
- import { ERMSDiscountType } from './ERMSDiscountType.enum';
1
+ import { ERMSDiscountType } from "./ERMSDiscountType.enum";
2
2
  export type IRMSPropertyDiscount = {
3
3
  name: string;
4
4
  hotelId: string;
File without changes
File without changes
@@ -47,6 +47,8 @@ export * from './RMS/IRMSRequirement.type';
47
47
  * Image
48
48
  */
49
49
  export * from './Image/IRoomstayImage.type';
50
+ /** Maintenance */
51
+ export * from './Maintenance/IMaintenanceStatus.type';
50
52
  /**
51
53
  * Member Details
52
54
  */
@@ -89,7 +91,17 @@ export * from './Media/IMedia.type';
89
91
  export * from './Fees/EFeeType.enum';
90
92
  export * from './Fees/IFee.type';
91
93
  export * from './Fees/IFeeConfigurationOptions.type';
94
+ /**
95
+ * Addon
96
+ */
97
+ export * from './Addon/Addon.enum';
98
+ export * from './Addon/Addon.type';
99
+ /**
100
+ * Api
101
+ */
102
+ export * from './Api/Reservations.type';
103
+ export * from './Api/RoomNightRate.type';
92
104
  /**
93
105
  * Analytics
94
106
  */
95
- export * from './Analytics/IBigQueryResults.type';
107
+ export * from "./Analytics/IBigQueryResults.type";
File without changes
@@ -1,8 +1,9 @@
1
- export * from './uppercaseString';
2
- export * from './bookingTotal';
3
- export * from './roomstayImageResize';
4
- export * from './reflection';
5
- export * from './roundMoney';
6
- export * from './typeUtils';
7
- export * from './calculateFee';
8
- export * from './feeTypes';
1
+ export * from "./bookingTotal";
2
+ export * from "./calculateFee";
3
+ export * from "./feeTypes";
4
+ export * from "./reflection";
5
+ export * from "./roomstayImageResize";
6
+ export * from "./roundMoney";
7
+ export * from "./TotalCalculator";
8
+ export * from "./typeUtils";
9
+ export * from "./uppercaseString";
@@ -0,0 +1,2 @@
1
+ export declare const nameof: <T>(name: Extract<keyof T, string>) => string;
2
+ export declare const nameofField: <T>(instance: T, name: keyof T) => string;
File without changes
@@ -1,3 +1,11 @@
1
+ import Decimal from "decimal.js";
2
+ export declare const RoundingType: {
3
+ [key: string]: Decimal.Rounding;
4
+ };
5
+ interface RoundMoneyOptions {
6
+ precision?: number;
7
+ rounding?: Decimal.Rounding;
8
+ }
1
9
  /**
2
10
  * Rounds a monetary amount to two decimal places.
3
11
  *
@@ -5,6 +13,8 @@
5
13
  * with some systems, such as RMS.
6
14
  *
7
15
  * @param amount a string or number to be rounded
16
+ * @param options an object containing precision and rounding options
8
17
  * @returns the rounded amount as a number
9
18
  */
10
- export declare const roundMoney: (amount: string | number) => number;
19
+ export declare const roundMoney: (amount: string | number, options?: RoundMoneyOptions) => number;
20
+ export {};
File without changes
package/dist/web.js CHANGED
@@ -1 +1 @@
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,s;o.r(n),o.d(n,{EAddonPricingType:()=>e,EBookingFlow:()=>i,EBookingPaymentMethod:()=>r,EBookingStatus:()=>t,ECompanyProvider:()=>P,EDistanceUnitType:()=>p,EFeeType:()=>O,EGuarantyPolicyPrepaymentType:()=>C,EHotelCardProcessor:()=>a,EHotelPriceModel:()=>h,EHotelStateFieldConfiguration:()=>g,EHotelWeekdayStartsOn:()=>y,EIntegration:()=>v,EPlanpayBookingStatus:()=>s,ERMSDiscountType:()=>f,ERoomstayEventSource:()=>E,ERoomstayImageSize:()=>R,GuestProfile:()=>l,HttpMethod:()=>T,IAuxiliaryFilterType:()=>m,ItineraryResponse:()=>c,PCIBookingCardProcessorTypes:()=>d,Package:()=>N,Reservation:()=>u,ReservedPackage:()=>S,calculateFeeAmount:()=>b,calculateTotalForMemberBooking:()=>k,getFeeOptionValidity:()=>Q,getFilteredBookingAddonFees:()=>j,getFilteredBookingFees:()=>G,getFilteredBookingRateFees:()=>U,nameof:()=>I,resizeRoomstayImageUrl:()=>_,roundMoney:()=>x,subset:()=>F,uppercaseString:()=>A}),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"}(s||(s={}));const d=[];class c{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 u{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 l,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 l{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 P,h,g,y,v,m,p,f,R,C,E,T,O;!function(e){e.Synxis="Synxis",e.Availpro="Availpro",e.RMS="RMS",e.Siteminder="Siteminder",e.Roomstay="Roomstay"}(P||(P={})),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"}(v||(v={})),function(e){e.AreaDwellingLength="AreaDwellingLength",e.AreaDwellingType="AreaDwellingType"}(m||(m={})),function(e){e.Metric="metric",e.Imperial="imperial"}(p||(p={})),function(e){e.Percentage="Percentage",e.Amount="Amount",e.Bogo="BOGO",e.NightlyRateOverride="NightlyRateOverride"}(f||(f={})),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={}));class N{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 S extends N{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 A(e){return e.toUpperCase()}!function(e){e.FixedAmount="fixed",e.Percentage="percentage",e.Nights="nights"}(C||(C={})),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"}(T||(T={})),function(e){e.PercentageOfBooking="PercentageOfBooking",e.FixedChargePerRoom="FixedChargePerRoom",e.NightlyChargePerRoom="NightlyChargePerRoom",e.FixedChargePerBooking="FixedChargePerBooking",e.DepositSurcharge="DepositSurcharge"}(O||(O={}));const k=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},_=(e,t)=>e.includes("cdn.app.roomstay.io")?e+"?w="+t:e,I=e=>e,F=(e,t)=>{const i={};return t.forEach((t=>{t in e&&(i[t]=e[t])})),i};var B=o(60),D=o.n(B);const x=e=>new(D())(e).toDecimalPlaces(2).toNumber();function b(e,t={}){const{baseAmount:i=0,numberOfNights:o=1,feeIncludedInBaseAmount:n=!1,extractedFromRates:r=!1,removedPercentages:a=[]}=t,s=x(i);switch(e.feeType){case O.PercentageOfBooking:if(n)return x(s*e.amount/(100+e.amount));if(r){const t=a.reduce(((e,t)=>e+t/(100+t)),0);return x(s/(1-t)*e.amount/(100+e.amount))}return x(s*(e.amount/100));case O.FixedChargePerRoom:case O.FixedChargePerBooking:return e.amount;case O.NightlyChargePerRoom:return x(e.amount*o);default:return 0}}const M=[O.FixedChargePerBooking],H=[O.PercentageOfBooking,O.FixedChargePerRoom,O.NightlyChargePerRoom],L=[O.PercentageOfBooking];function w(e,t){return e.filter((e=>t.includes(e.feeType)))}function G(e){return w(e,M)}function U(e){return w(e,H)}function j(e){return w(e,L)}function Q(e){return{includeInRates:[O.PercentageOfBooking,O.NightlyChargePerRoom].includes(e),extractFeeFromRates:e===O.PercentageOfBooking,appliesToAddons:e===O.PercentageOfBooking,includePreviousFeesInCalculation:e===O.PercentageOfBooking}}})(),n})()));
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})()));
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * decimal.js v10.4.3
3
+ * An arbitrary-precision Decimal type for JavaScript.
4
+ * https://github.com/MikeMcl/decimal.js
5
+ * Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
6
+ * MIT Licence
7
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roomstay/core",
3
- "version": "0.1.52",
3
+ "version": "0.1.53-0",
4
4
  "description": "Details shared between Roomstay libraries. Anything from Currency, to Generic types",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [
@@ -1 +0,0 @@
1
- export declare const DATE_FORMAT = "DD/MM/YYYY";
@@ -1,19 +0,0 @@
1
- export type IPaginatedRequest = {
2
- pageSize?: number;
3
- currentPage?: number;
4
- };
5
- export type IPagination = {
6
- pageSize: number;
7
- currentPage: number;
8
- skip: number;
9
- };
10
- export type IPaginatedResponse<T> = {
11
- pageSize: number;
12
- currentPage: number;
13
- totalPages: number;
14
- totalItems: number;
15
- data: T[];
16
- };
17
- export type IPaginatedSearchRequest = IPaginatedRequest & {
18
- search?: string;
19
- };
@@ -1,32 +0,0 @@
1
- import * as z from 'zod/v4';
2
- export declare const AddGiftCardSchema: z.ZodObject<{
3
- amount: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodType<number, unknown, z.core.$ZodTypeInternals<number, unknown>>>;
4
- expiry: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodType<Date, unknown, z.core.$ZodTypeInternals<Date, unknown>>>;
5
- giverFirstName: z.ZodString;
6
- giverLastName: z.ZodString;
7
- giverEmail: z.ZodEmail;
8
- giverPhone: z.ZodString;
9
- cardHolder: z.ZodString;
10
- recipientEmail: z.ZodEmail;
11
- recipientPhone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12
- notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
13
- }, z.core.$strip>;
14
- export type IAddGiftCardRequest = z.infer<typeof AddGiftCardSchema>;
15
- export type IAddGiftCardResponse = IGiftCardDTO & {
16
- password: string;
17
- };
18
- export type IGiftCardDTO = {
19
- code: string;
20
- createdBy?: string | null;
21
- amount: number;
22
- balance: number;
23
- expiry: Date;
24
- giverFirstName: string;
25
- giverLastName: string;
26
- giverEmail: string;
27
- giverPhone: string;
28
- cardHolder: string;
29
- recipientEmail: string;
30
- recipientPhone?: string | null;
31
- notes?: string | null;
32
- };
@@ -1,31 +0,0 @@
1
- import * as z from 'zod/v4';
2
- export declare const RefreshGiftCardTokenSchema: z.ZodObject<{
3
- grant_type: z.ZodDefault<z.ZodReadonly<z.ZodString>>;
4
- client_id: z.ZodUUID;
5
- client_secret: z.ZodString;
6
- refresh_token: z.ZodString;
7
- scope: z.ZodOptional<z.ZodString>;
8
- }, z.core.$strip>;
9
- export type IRefreshGiftCardTokenRequest = z.infer<typeof RefreshGiftCardTokenSchema>;
10
- /**
11
- * Response from the Gift Card Engine when refreshing a token.
12
- */
13
- export type IGiftCardTokenResponse = {
14
- token_type: string;
15
- access_token: string;
16
- refresh_token?: string;
17
- expires_in: number;
18
- scope: string;
19
- user?: string;
20
- };
21
- /**
22
- * Request to register a new user on the gift card admin.
23
- */
24
- export declare const RegisterGiftCardAdminSchema: z.ZodObject<{
25
- email: z.ZodEmail;
26
- firstName: z.ZodOptional<z.ZodString>;
27
- lastName: z.ZodOptional<z.ZodString>;
28
- phone: z.ZodOptional<z.ZodString>;
29
- scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
30
- }, z.core.$strip>;
31
- export type IRegisterGiftCardAdminRequest = z.infer<typeof RegisterGiftCardAdminSchema>;
@@ -1,19 +0,0 @@
1
- import * as z from 'zod/v4';
2
- import { FieldValues, UseFormReturn } from 'react-hook-form';
3
- /**
4
- * Processes a form submission using Zod for validation.
5
- */
6
- export declare function validateFormWithZod<T extends FieldValues>(formMethods: UseFormReturn<T>, schema: z.ZodSchema<T>, data: any): T;
7
- /**
8
- * Preprocesses a form input to convert string values to numbers.
9
- */
10
- export declare const preprocessNumber: (schema: z.ZodType<number>) => z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodType<number, unknown, z.core.$ZodTypeInternals<number, unknown>>>;
11
- /**
12
- * Preprocesses a form input to convert string values to dates.
13
- */
14
- export declare const preprocessDate: (schema: z.ZodType<Date>) => z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodType<Date, unknown, z.core.$ZodTypeInternals<Date, unknown>>>;
15
- export declare const requireString: (max: number) => z.ZodString;
16
- export declare const requireEmail: () => z.ZodEmail;
17
- export declare const requirePositiveAmount: () => z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodType<number, unknown, z.core.$ZodTypeInternals<number, unknown>>>;
18
- export declare const requireFutureDate: () => z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodType<Date, unknown, z.core.$ZodTypeInternals<Date, unknown>>>;
19
- export declare const maxString: (max: number) => z.ZodString;