@roomstay/core 0.1.51-0 → 0.1.51

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 (63) hide show
  1. package/dist/index.d.ts +0 -0
  2. package/dist/node.js +1 -1
  3. package/dist/types/Addons/Addon.types.d.ts +29 -0
  4. package/dist/types/Analytics/IBigQueryResults.type.d.ts +35 -0
  5. package/dist/types/Booking/ConfirmBooking.types.d.ts +19 -0
  6. package/dist/types/Booking/EBooking.types.d.ts +12 -0
  7. package/dist/types/Booking/GetBooking.types.d.ts +7 -0
  8. package/dist/types/Booking/{IBookingCreateErrorResponse.d.ts → IBookingCreateErrorResponse.type.d.ts} +0 -0
  9. package/dist/types/Booking/IBookingPayment.type.d.ts +0 -0
  10. package/dist/types/Booking/IBookingQuote.type.d.ts +0 -0
  11. package/dist/types/Booking/ICommonQueryParameters.type.d.ts +3 -0
  12. package/dist/types/Booking/Itinerary.types.d.ts +108 -0
  13. package/dist/types/Booking/PencilReservation.types.d.ts +19 -0
  14. package/dist/types/Booking/PlaceBooking.types.d.ts +83 -0
  15. package/dist/types/Company/ECompanyProvider.enum.d.ts +0 -0
  16. package/dist/types/Company/IAdminCompany.type.d.ts +2 -0
  17. package/dist/types/Company/IAdminCompanyUser.type.d.ts +0 -0
  18. package/dist/types/Events/IRoomstayEvent.type.d.ts +0 -0
  19. package/dist/types/Fees/IFee.type.d.ts +0 -5
  20. package/dist/types/General/Format.types.d.ts +1 -0
  21. package/dist/types/General/HttpMethod.enum.d.ts +0 -0
  22. package/dist/types/General/Pagination.types.d.ts +19 -0
  23. package/dist/types/GiftCards/GiftCard.types.d.ts +32 -0
  24. package/dist/types/GiftCards/GiftCardAuth.types.d.ts +31 -0
  25. package/dist/types/Hotel/EHotelPriceModel.enum.d.ts +0 -0
  26. package/dist/types/Hotel/EHotelWeekdayStartsOn.enum.d.ts +0 -0
  27. package/dist/types/Hotel/IAuxiliaryFilter.type.d.ts +0 -0
  28. package/dist/types/Hotel/IHotelColorScheme.type.d.ts +0 -0
  29. package/dist/types/Hotel/IHotelOverrides.type.d.ts +0 -0
  30. package/dist/types/Hotel/IHotelReplica.type.d.ts +0 -0
  31. package/dist/types/Hotel/IHotelService.type.d.ts +0 -0
  32. package/dist/types/Image/IRoomstayImage.type.d.ts +0 -0
  33. package/dist/types/Member/IRoomstayCognitoMember.type.d.ts +0 -0
  34. package/dist/types/Member/IRoomstayMember.type.d.ts +0 -0
  35. package/dist/types/Member/IRoomstayMemberBooking.type.d.ts +0 -0
  36. package/dist/types/Member/IRoomstayMemberBookingAddress.type.d.ts +0 -0
  37. package/dist/types/Member/IRoomstayMemberBookingItem.type.d.ts +2 -2
  38. package/dist/types/Member/IRoomstayMemberBookingProfile.type.d.ts +0 -0
  39. package/dist/types/Member/IRoomstayMemberCards.type.d.ts +0 -0
  40. package/dist/types/Member/IRoomstayMemberJWTData.type.d.ts +3 -0
  41. package/dist/types/Member/ISession.type.d.ts +0 -0
  42. package/dist/types/Package/Package.types.d.ts +101 -0
  43. package/dist/types/Policies/EGuaranteePolicy.enum.d.ts +0 -0
  44. package/dist/types/RMS/ERMSDiscountType.enum.d.ts +0 -0
  45. package/dist/types/RMS/IRMSPropertyDiscount.type.d.ts +1 -1
  46. package/dist/types/RMS/IRMSRequirement.type.d.ts +0 -0
  47. package/dist/types/Room/IRoomGroup.type.d.ts +0 -0
  48. package/dist/types/index.d.ts +24 -18
  49. package/dist/utils/bookingTotal.d.ts +0 -0
  50. package/dist/utils/index.d.ts +8 -9
  51. package/dist/utils/roomstayImageResize.d.ts +0 -0
  52. package/dist/utils/roundMoney.d.ts +1 -11
  53. package/dist/utils/uppercaseString.d.ts +0 -0
  54. package/dist/utils/zodUtils.d.ts +19 -0
  55. package/dist/web.js +1 -1
  56. package/package.json +1 -1
  57. package/dist/node.js.LICENSE.txt +0 -7
  58. package/dist/types/Booking/IBookingStatus.type.d.ts +0 -5
  59. package/dist/types/Booking/ICheckoutBrowserSession.type.d.ts +0 -14
  60. package/dist/types/Booking/IPrice.type.d.ts +0 -7
  61. package/dist/types/General/IJsonString.type.d.ts +0 -6
  62. package/dist/utils/nameof.d.ts +0 -2
  63. package/dist/web.js.LICENSE.txt +0 -7
package/dist/index.d.ts CHANGED
File without changes
package/dist/node.js CHANGED
@@ -1 +1 @@
1
- (()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var i in n)e.o(n,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:n[i]})},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 n,i,a;e.r(t),e.d(t,{ADDON_PER_NIGHT_TYPES:()=>m,AddonPricingType:()=>N,EBookingPaymentMethod:()=>n,ECompanyProvider:()=>c,EDistanceUnitType:()=>g,EFeeType:()=>p,EGuarantyPolicyPrepaymentType:()=>h,EHotelCardProcessor:()=>i,EHotelPriceModel:()=>l,EHotelStateFieldConfiguration:()=>d,EHotelWeekdayStartsOn:()=>u,EIntegration:()=>P,EPlanpayBookingStatus:()=>a,ERMSDiscountType:()=>y,ERoomstayEventSource:()=>E,ERoomstayImageSize:()=>R,HttpMethod:()=>T,IAuxiliaryFilterType:()=>s,IBookingStatus:()=>o,IMaintenanceStatusService:()=>_,PCIBookingCardProcessorTypes:()=>r,RoundingType:()=>C,TotalCalculator:()=>Q,calculateFeeAmount:()=>I,calculateTotalForMemberBooking:()=>O,getFeeOptionValidity:()=>v,getFilteredBookingAddonFees:()=>k,getFilteredBookingFees:()=>U,getFilteredBookingRateFees:()=>B,nameof:()=>G,resizeRoomstayImageUrl:()=>M,roundMoney:()=>F,subset:()=>b,uppercaseString:()=>x}),function(e){e.Card="Card",e.SavedCard="SavedCard",e.Planpay="Planpay",e.Adyen="Adyen",e.Afterpay="Afterpay",e.PCIBookingCard="PCIBookingCard"}(n||(n={})),function(e){e.Passthrough="Passthrough",e.Adyen="Adyen",e.Till="Till",e.RMSPay="RMSPay",e.Windcave="Windcave"}(i||(i={})),function(e){e.Unknown="unknown",e.Unpaid="unpaid",e.Accepted="accepted",e.Cancelled="cancelled",e.Refunded="refunded",e.Rejected="rejected"}(a||(a={}));const r=[];let o,c,l,d,u,P,s,g,y,R,_,h,E,T,p,N;!function(e){e.Pending="Pending",e.Committed="Committed",e.Cancelled="Cancelled"}(o||(o={})),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"}(T||(T={})),function(e){e.PercentageOfBooking="PercentageOfBooking",e.FixedChargePerRoom="FixedChargePerRoom",e.NightlyChargePerRoom="NightlyChargePerRoom",e.FixedChargePerBooking="FixedChargePerBooking",e.DepositSurcharge="DepositSurcharge"}(p||(p={})),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 m=[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],O=e=>{let t=0;const n=Object.values(e.itinerary);for(const e of n){const n=Object.keys(e.nights);for(const i of n)t+=e.nights[i].total}return t},f=require("decimal.js");var A=e.n(f);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:i=C.HALF_UP}=t||{};return new(A())(e).toDecimalPlaces(n,i).toNumber()};function I(e,t={}){const{baseAmount:n=0,numberOfNights:i=1,feeIncludedInBaseAmount:a=!1,extractedFromRates:r=!1,removedPercentages:o=[]}=t,c=F(n);switch(e.feeType){case p.PercentageOfBooking:if(a)return F(c*e.amount/(100+e.amount));if(r){const t=o.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 p.FixedChargePerRoom:case p.FixedChargePerBooking:return e.amount;case p.NightlyChargePerRoom:return F(e.amount*i);default:return 0}}const S=[p.FixedChargePerBooking],H=[p.PercentageOfBooking,p.FixedChargePerRoom,p.NightlyChargePerRoom],L=[p.PercentageOfBooking];function D(e,t){return e.filter((e=>t.includes(e.feeType)))}function U(e){return D(e,S)}function B(e){return D(e,H)}function k(e){return D(e,L)}function v(e){return{includeInRates:[p.PercentageOfBooking,p.NightlyChargePerRoom].includes(e),extractFeeFromRates:e===p.PercentageOfBooking,appliesToAddons:e===p.PercentageOfBooking,includePreviousFeesInCalculation:e===p.PercentageOfBooking}}const G=e=>e,b=(e,t)=>{const n={};return t.forEach((t=>{t in e&&(n[t]=e[t])})),n},M=(e,t)=>e.includes("cdn.app.roomstay.io")?e+"?w="+t:e;class Q{}function x(e){return e.toUpperCase()}Q.calculateBaseAddonTotal=(e,t)=>{let n=0,i=0,a=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&&(i=e.adultQuantity*Number(e.adultPrice)),e.childPrice&&e.childQuantity&&(a=e.childQuantity*Number(e.childPrice));let r=n+i+a;return m.includes(e.pricingType)&&e.nights&&!t&&(r*=e.nights),{indPrice:n,indAdultPrice:i,indChildPrice:a,addonTotal:r}},Q.calculateBasketAddonTotal=(e,t=!1)=>(Array.isArray(e)||(e=[e]),e.reduce(((e,n)=>{const i=Q.calculateBaseAddonTotal(n,t);let a=0;return(n.fee||n.fees?.length)&&n.quantity?n.fees?.length?n.fees.forEach((e=>{a+=n.quantity*e.amount})):a=n.quantity*Number(n.fee):((n.adultFee||n.adultFees?.length)&&n.adultQuantity&&(n.adultFees?.length?n.adultFees.forEach((e=>{a+=n.adultQuantity*e.amount})):a+=n.adultQuantity??1*Number(n.adultFee)),(n.childFee||n.childFees?.length)&&n.childQuantity&&(n.childFees?.length?n.childFees.forEach((e=>{a+=n.childQuantity??1*e.amount})):a+=n.childQuantity*Number(n.childFee))),m.includes(n.pricingType)&&n.nights&&!t&&(a*=n.nights),{price:e.price+i.indPrice,adultPrice:e.adultPrice+i.indAdultPrice,childPrice:e.childPrice+i.indChildPrice,totalFees:e.totalFees+a,total:e.total+i.addonTotal+a}}),{price:0,adultPrice:0,childPrice:0,totalFees:0,total:0})),Q.calculateReservationAddonTotal=(e,t=!1)=>(Array.isArray(e)||(e=[e]),e.reduce(((e,n)=>{const i=Q.calculateBaseAddonTotal(n,t);let a=n.fees||0;n.itemisedFees?.length&&(a=n.itemisedFees.reduce(((e,t)=>e+t.amount),0));const r=n.itemisedFees?.length?i.addonTotal:i.addonTotal+a;return{price:e.price+i.indPrice,adultPrice:e.adultPrice+i.indAdultPrice,childPrice:e.childPrice+i.indChildPrice,totalFees:e.totalFees+a,total:e.total+i.addonTotal+a,displayPrice:e.displayPrice+r}}),{price:0,adultPrice:0,childPrice:0,totalFees:0,total:0,displayPrice:0})),Q.calculateTotalForReservation=(e,t=!1)=>{let n=0;return e.itemisedFees?.forEach((e=>{n+=e.amount})),e.reservations.forEach((e=>{n+=e.total.afterTax;const i=Object.keys(e.nights)?.length??0;if(e.addons?.length){const a=(e.addons??[]).map((e=>({...e,nights:i})));n+=Q.calculateReservationAddonTotal(a,t)?.total}})),F(n)},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,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})();
@@ -0,0 +1,29 @@
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
+ PER_QUANTITY_NAME_PER_NIGHT = "Per Quantity Name Per Night",
9
+ PER_ROOM_QUANTITY_PER_NIGHT = "Per Room Quantity Per Night",
10
+ PER_PERSON_OCCUPANCY_PER_NIGHT = "Per Person Occupancy Per Night",
11
+ PER_ADULT_OCCUPANCY_PER_NIGHT = "Per Adult Occupancy Per Night",
12
+ PER_CHILD_OCCUPANCY_PER_NIGHT = "Per Child Occupancy Per Night"
13
+ }
14
+ export type IAddonPriceDetails = {
15
+ adultPrice: number;
16
+ childPrice: number;
17
+ price: number;
18
+ adultFee: number;
19
+ childFee: number;
20
+ fee: number;
21
+ adultFees?: IAddonPriceDetailsFee[];
22
+ childFees?: IAddonPriceDetailsFee[];
23
+ fees?: IAddonPriceDetailsFee[];
24
+ pricingType: EAddonPricingType;
25
+ };
26
+ export type IAddonPriceDetailsFee = {
27
+ name: string;
28
+ amount: number;
29
+ };
@@ -0,0 +1,35 @@
1
+ export type IDailyMetrics = {
2
+ date: string;
3
+ revenue: number;
4
+ purchases: number;
5
+ sessionCount: number;
6
+ };
7
+ export type IDailyRoomBreakdown = {
8
+ date: string;
9
+ roomName: string;
10
+ purchases: number;
11
+ };
12
+ export type IRegionBreakdown = {
13
+ country: string;
14
+ region: string;
15
+ purchases: number;
16
+ revenue: number;
17
+ };
18
+ export type ICheckoutFunnel = {
19
+ roomName: string;
20
+ selectedDate: number;
21
+ addedToCart: number;
22
+ startedCheckout: number;
23
+ completedCheckout: number;
24
+ };
25
+ export type IBigQueryResults = {
26
+ purchases: number;
27
+ cancellations: number;
28
+ revenue: number;
29
+ conversionRate: number;
30
+ totalDateSelections: number;
31
+ dailyMetrics: IDailyMetrics[];
32
+ dailyRoomsBreakdown: IDailyRoomBreakdown[];
33
+ regionBreakdown: IRegionBreakdown[];
34
+ checkoutFunnel: ICheckoutFunnel[];
35
+ };
@@ -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,12 @@
1
+ export declare enum EBookingStatus {
2
+ Pending = "Pending",
3
+ Processing = "Processing",
4
+ Committed = "Committed",
5
+ Cancelled = "Cancelled",
6
+ Reverted = "Reverted"
7
+ }
8
+ export declare enum EBookingFlow {
9
+ Default = "Default",
10
+ PreCheckoutPencil = "PreCheckoutPencil",
11
+ PostCheckoutPencil = "PostCheckoutPencil"
12
+ }
@@ -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;
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ export type ICommonQueryParameters = {
2
+ language?: string;
3
+ };
@@ -0,0 +1,108 @@
1
+ import { EBookingPaymentMethod } from './IBookingPayment.type';
2
+ import { ReservedPackage } from '../Package/Package.types';
3
+ export declare class ItineraryResponse {
4
+ roomstayId: string;
5
+ itineraryNumber?: string;
6
+ total?: IAmount;
7
+ hotelFrontendId?: string;
8
+ reservations: Reservation[];
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 declare class Reservation {
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: {
38
+ adults: number;
39
+ children: number;
40
+ };
41
+ guest: GuestProfile;
42
+ paymentCard: {
43
+ type: string | undefined;
44
+ last4: string;
45
+ expiry: string;
46
+ name: string;
47
+ };
48
+ paymentMethod: EBookingPaymentMethod;
49
+ total: IAmount;
50
+ status: string;
51
+ isCancelable: boolean;
52
+ addons: ReservedPackage[] | undefined;
53
+ comments?: string[];
54
+ specialRequests?: string[];
55
+ promoCode?: string;
56
+ guaranteePolicyLongDescription?: string;
57
+ cancellationPolicyLongDescription?: string;
58
+ itemisedFees?: IItemisedBookingFeeResponse[];
59
+ }
60
+ export declare class GuestProfile {
61
+ title?: string;
62
+ firstName?: string;
63
+ middleName?: string;
64
+ lastName?: string;
65
+ nameSuffix?: string;
66
+ phone?: string;
67
+ email?: string;
68
+ address: IAddress;
69
+ marketingOptIn?: boolean;
70
+ country: string;
71
+ }
72
+ export type IGuestCounts = {
73
+ adults: number;
74
+ children: number;
75
+ };
76
+ export type IAddress = {
77
+ line1?: string;
78
+ line2?: string;
79
+ line3?: string;
80
+ city?: string;
81
+ postalCode?: string;
82
+ state?: string;
83
+ country?: string;
84
+ };
85
+ export type IAmount = {
86
+ beforeTax: number;
87
+ afterTax: number;
88
+ beforeFees?: number;
89
+ };
90
+ export type ICheckoutWorkflowType = {
91
+ sdkWidget: {
92
+ type: string;
93
+ id: string;
94
+ scriptUrl: string;
95
+ };
96
+ };
97
+ export type IItemisedBookingFeeResponse = {
98
+ name: string;
99
+ description?: string;
100
+ amount: number;
101
+ };
102
+ export type IPrice = {
103
+ cost: number;
104
+ discount: number;
105
+ tax: number;
106
+ fee: number;
107
+ total: number;
108
+ };
@@ -0,0 +1,19 @@
1
+ import { IBookingQuoteRequest, IBookingQuoteResponse } from './IBookingQuote.type';
2
+ export type IPencilReservationRequest = IBookingQuoteRequest & {
3
+ pencilId?: string;
4
+ rows: ({
5
+ pencilId?: string;
6
+ auxInputs?: {
7
+ [auxInputId: string]: string;
8
+ };
9
+ } & IBookingQuoteRequest['rows'][number])[];
10
+ };
11
+ export type IPencilReservationResponse = {
12
+ timeout?: Date;
13
+ pencilId?: string;
14
+ rows: {
15
+ rowId: string;
16
+ pencilId: string;
17
+ }[];
18
+ quote?: IBookingQuoteResponse;
19
+ };
@@ -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
+ };
File without changes
@@ -20,8 +20,10 @@ export interface IAdminCompany {
20
20
  clientPassword: string;
21
21
  useTrainingDb: boolean;
22
22
  apiUrl: string;
23
+ pencilGuestId?: number;
23
24
  };
24
25
  }[];
26
+ enableLighthouseAvailability: boolean;
25
27
  }
26
28
  export type IAdminGetCompaniesResponse = IAdminCompany[];
27
29
  /** What the API expects */
File without changes
File without changes
@@ -4,8 +4,3 @@ 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
- };
@@ -0,0 +1 @@
1
+ export declare const DATE_FORMAT = "DD/MM/YYYY";
File without changes
@@ -0,0 +1,19 @@
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
+ };
@@ -0,0 +1,32 @@
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
+ };
@@ -0,0 +1,31 @@
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>;
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
@@ -1,4 +1,4 @@
1
- import { IBookingStatus, IPrice, IRoomstayMemberBookingProfile } from '../index.js';
1
+ import { EBookingStatus, IPrice, IRoomstayMemberBookingProfile } from '../index.js';
2
2
  export type IRoomstayMemberBookingItem = {
3
3
  id: string;
4
4
  roomCode: string;
@@ -10,7 +10,7 @@ export type IRoomstayMemberBookingItem = {
10
10
  children?: number;
11
11
  profile: IRoomstayMemberBookingProfile;
12
12
  comments: string[];
13
- status: IBookingStatus;
13
+ status: EBookingStatus;
14
14
  isCancellable: boolean;
15
15
  checkInDate: string;
16
16
  checkOutDate: string;
File without changes
@@ -0,0 +1,3 @@
1
+ export type IRoomstayMemberJWTData = {
2
+ 'cognito:username': string;
3
+ };
File without changes
@@ -0,0 +1,101 @@
1
+ import { IAddonPriceDetailsFee } from '../Addons/Addon.types';
2
+ import { IItemisedBookingFeeResponse } from '../Booking/Itinerary.types';
3
+ import { ICommonQueryParameters } from '../Booking/ICommonQueryParameters.type';
4
+ export declare class Package {
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 declare class ReservedPackage extends Package {
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]: ReservedPackage;
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
@@ -1,11 +1,20 @@
1
+ /**
2
+ * Addons
3
+ */
4
+ export * from './Addons/Addon.types';
1
5
  /**
2
6
  * Booking Details
3
7
  */
8
+ export * from './Booking/EBooking.types';
9
+ export * from './Booking/IBookingCreateErrorResponse.type';
4
10
  export * from './Booking/IBookingPayment.type';
5
- export * from './Booking/IBookingStatus.type';
6
- export * from './Booking/IPrice.type';
7
- export * from './Booking/IBookingCreateErrorResponse';
8
11
  export * from './Booking/IBookingQuote.type';
12
+ export * from './Booking/ICommonQueryParameters.type';
13
+ export * from './Booking/ConfirmBooking.types';
14
+ export * from './Booking/GetBooking.types';
15
+ export * from './Booking/Itinerary.types';
16
+ export * from './Booking/PencilReservation.types';
17
+ export * from './Booking/PlaceBooking.types';
9
18
  /**
10
19
  * Company
11
20
  */
@@ -38,8 +47,6 @@ export * from './RMS/IRMSRequirement.type';
38
47
  * Image
39
48
  */
40
49
  export * from './Image/IRoomstayImage.type';
41
- /** Maintenance */
42
- export * from './Maintenance/IMaintenanceStatus.type';
43
50
  /**
44
51
  * Member Details
45
52
  */
@@ -52,7 +59,12 @@ export * from './Member/IRoomstayMemberBookingAddress.type';
52
59
  export * from './Member/IRoomstayMemberBookingItem.type';
53
60
  export * from './Member/IRoomstayMemberBookingProfile.type';
54
61
  export * from './Member/IRoomstayMemberCards.type';
62
+ export * from './Member/IRoomstayMemberJWTData.type';
55
63
  export * from './Member/ISession.type';
64
+ /**
65
+ * Package
66
+ */
67
+ export * from './Package/Package.types';
56
68
  /**
57
69
  * Policies
58
70
  */
@@ -60,8 +72,8 @@ export * from './Policies/EGuaranteePolicy.enum';
60
72
  /**
61
73
  * Roomstay Events
62
74
  */
63
- export * from "./Events/ERoomstayEventSource.enum";
64
- export * from "./Events/IRoomstayEvent.type";
75
+ export * from './Events/IRoomstayEvent.type';
76
+ export * from './Events/ERoomstayEventSource.enum';
65
77
  /**
66
78
  * General
67
79
  */
@@ -74,16 +86,10 @@ export * from './Media/IMedia.type';
74
86
  /**
75
87
  * Fees
76
88
  */
77
- export * from "./Fees/EFeeType.enum";
78
- export * from "./Fees/IFee.type";
79
- export * from "./Fees/IFeeConfigurationOptions.type";
80
- /**
81
- * Addon
82
- */
83
- export * from "./Addon/Addon.enum";
84
- export * from "./Addon/Addon.type";
89
+ export * from './Fees/EFeeType.enum';
90
+ export * from './Fees/IFee.type';
91
+ export * from './Fees/IFeeConfigurationOptions.type';
85
92
  /**
86
- * Api
93
+ * Analytics
87
94
  */
88
- export * from "./Api/Reservations.type";
89
- export * from "./Api/RoomNightRate.type";
95
+ export * from './Analytics/IBigQueryResults.type';
File without changes
@@ -1,9 +1,8 @@
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";
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';
File without changes
@@ -1,11 +1,3 @@
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
- }
9
1
  /**
10
2
  * Rounds a monetary amount to two decimal places.
11
3
  *
@@ -13,8 +5,6 @@ interface RoundMoneyOptions {
13
5
  * with some systems, such as RMS.
14
6
  *
15
7
  * @param amount a string or number to be rounded
16
- * @param options an object containing precision and rounding options
17
8
  * @returns the rounded amount as a number
18
9
  */
19
- export declare const roundMoney: (amount: string | number, options?: RoundMoneyOptions) => number;
20
- export {};
10
+ export declare const roundMoney: (amount: string | number) => number;
File without changes
@@ -0,0 +1,19 @@
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;
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,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})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roomstay/core",
3
- "version": "0.1.51-0",
3
+ "version": "0.1.51",
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,7 +0,0 @@
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
- */
@@ -1,5 +0,0 @@
1
- export declare enum IBookingStatus {
2
- Pending = "Pending",
3
- Committed = "Committed",
4
- Cancelled = "Cancelled"
5
- }
@@ -1,14 +0,0 @@
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
- };
@@ -1,7 +0,0 @@
1
- export type IPrice = {
2
- cost: number;
3
- discount: number;
4
- tax: number;
5
- fee: number;
6
- total: number;
7
- };
@@ -1,6 +0,0 @@
1
- /**
2
- * Basic object to wrap a string that is de/encoded as JSON.
3
- */
4
- export type IJsonString = {
5
- message: string;
6
- };
@@ -1,2 +0,0 @@
1
- export declare const nameof: <T>(name: Extract<keyof T, string>) => string;
2
- export declare const nameofField: <T>(instance: T, name: keyof T) => string;
@@ -1,7 +0,0 @@
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
- */