@roomstay/core 0.1.46-1 → 0.1.46-3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/node.js CHANGED
@@ -1 +1 @@
1
- (()=>{"use strict";var e={n:n=>{var o=n&&n.__esModule?()=>n.default:()=>n;return e.d(o,{a:o}),o},d:(n,o)=>{for(var t in o)e.o(o,t)&&!e.o(n,t)&&Object.defineProperty(n,t,{enumerable:!0,get:o[t]})},o:(e,n)=>Object.prototype.hasOwnProperty.call(e,n),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},n={};let o,t,r;e.r(n),e.d(n,{EBookingPaymentMethod:()=>o,ECompanyProvider:()=>c,EDistanceUnitType:()=>y,EFeeType:()=>h,EGuarantyPolicyPrepaymentType:()=>m,EHotelCardProcessor:()=>t,EHotelPriceModel:()=>d,EHotelStateFieldConfiguration:()=>u,EHotelWeekdayStartsOn:()=>l,EIntegration:()=>g,EPlanpayBookingStatus:()=>r,ERMSDiscountType:()=>P,ERoomstayImageSize:()=>f,HttpMethod:()=>p,IAuxiliaryFilterType:()=>s,IBookingStatus:()=>i,PCIBookingCardProcessorTypes:()=>a,calculateFeeAmount:()=>B,calculateTotalForMemberBooking:()=>S,getFilteredBookingAddonFees:()=>I,getFilteredBookingFees:()=>b,getFilteredBookingRateFees:()=>D,nameof:()=>O,resizeRoomstayImageUrl:()=>T,roundMoney:()=>k,subset:()=>E,uppercaseString:()=>C}),function(e){e.Card="Card",e.SavedCard="SavedCard",e.Planpay="Planpay",e.Adyen="Adyen",e.Afterpay="Afterpay",e.PCIBookingCard="PCIBookingCard"}(o||(o={})),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"}(r||(r={}));const a=[];let i,c,d,u,l,g,s,y,P,f,m,p,h;function C(e){return e.toUpperCase()}!function(e){e.Pending="Pending",e.Committed="Committed",e.Cancelled="Cancelled"}(i||(i={})),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"}(d||(d={})),function(e){e.NotIncluded="NotIncluded",e.Optional="Optional",e.Required="Required"}(u||(u={})),function(e){e.Monday="monday",e.Sunday="sunday"}(l||(l={})),function(e){e.Big4="Big4",e.RmsTop10="Top10",e.Top10="NewTop10",e.Gday="Gday",e.Salesforce="Salesforce"}(g||(g={})),function(e){e.AreaDwellingLength="AreaDwellingLength",e.AreaDwellingType="AreaDwellingType"}(s||(s={})),function(e){e.Metric="metric",e.Imperial="imperial"}(y||(y={})),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"}(f||(f={})),function(e){e.FixedAmount="fixed",e.Percentage="percentage",e.Nights="nights"}(m||(m={})),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"}(h||(h={}));const S=e=>{let n=0;const o=Object.values(e.itinerary);for(const e of o){const o=Object.keys(e.nights);for(const t of o)n+=e.nights[t].total}return n},T=(e,n)=>e.includes("cdn.app.roomstay.io")?e+"?w="+n:e,O=e=>e,E=(e,n)=>{const o={};return n.forEach((n=>{n in e&&(o[n]=e[n])})),o},R=require("decimal.js");var A=e.n(R);const k=e=>new(A())(e).toDecimalPlaces(2).toNumber();function B(e,n={}){const{baseAmount:o=0,numberOfNights:t=1}=n;switch(e.feeType){case h.PercentageOfBooking:return o*(e.amount/100);case h.FixedChargePerRoom:case h.FixedChargePerBooking:return e.amount;case h.NightlyChargePerRoom:return e.amount*t;default:return 0}}const F=[h.FixedChargePerBooking],M=[h.PercentageOfBooking,h.FixedChargePerRoom,h.NightlyChargePerRoom],v=[h.PercentageOfBooking];function x(e,n){return e.filter((e=>n.includes(e.feeType)))}function b(e){return x(e,F)}function D(e){return x(e,M)}function I(e){return x(e,v)}module.exports=n})();
1
+ (()=>{"use strict";var e={n:n=>{var o=n&&n.__esModule?()=>n.default:()=>n;return e.d(o,{a:o}),o},d:(n,o)=>{for(var t in o)e.o(o,t)&&!e.o(n,t)&&Object.defineProperty(n,t,{enumerable:!0,get:o[t]})},o:(e,n)=>Object.prototype.hasOwnProperty.call(e,n),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},n={};let o,t,r;e.r(n),e.d(n,{EBookingPaymentMethod:()=>o,ECompanyProvider:()=>c,EDistanceUnitType:()=>y,EFeeType:()=>S,EGuarantyPolicyPrepaymentType:()=>p,EHotelCardProcessor:()=>t,EHotelPriceModel:()=>d,EHotelStateFieldConfiguration:()=>u,EHotelWeekdayStartsOn:()=>l,EIntegration:()=>g,EPlanpayBookingStatus:()=>r,ERMSDiscountType:()=>P,ERoomstayImageSize:()=>m,HttpMethod:()=>h,IAuxiliaryFilterType:()=>s,IBookingStatus:()=>i,IMaintenanceStatusService:()=>f,PCIBookingCardProcessorTypes:()=>a,calculateFeeAmount:()=>v,calculateTotalForMemberBooking:()=>T,getFilteredBookingAddonFees:()=>N,getFilteredBookingFees:()=>b,getFilteredBookingRateFees:()=>D,nameof:()=>E,resizeRoomstayImageUrl:()=>O,roundMoney:()=>k,subset:()=>R,uppercaseString:()=>C}),function(e){e.Card="Card",e.SavedCard="SavedCard",e.Planpay="Planpay",e.Adyen="Adyen",e.Afterpay="Afterpay",e.PCIBookingCard="PCIBookingCard"}(o||(o={})),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"}(r||(r={}));const a=[];let i,c,d,u,l,g,s,y,P,m,f,p,h,S;function C(e){return e.toUpperCase()}!function(e){e.Pending="Pending",e.Committed="Committed",e.Cancelled="Cancelled"}(i||(i={})),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"}(d||(d={})),function(e){e.NotIncluded="NotIncluded",e.Optional="Optional",e.Required="Required"}(u||(u={})),function(e){e.Monday="monday",e.Sunday="sunday"}(l||(l={})),function(e){e.Big4="Big4",e.RmsTop10="Top10",e.Top10="NewTop10",e.Gday="Gday",e.Salesforce="Salesforce"}(g||(g={})),function(e){e.AreaDwellingLength="AreaDwellingLength",e.AreaDwellingType="AreaDwellingType"}(s||(s={})),function(e){e.Metric="metric",e.Imperial="imperial"}(y||(y={})),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"}(m||(m={})),function(e){e.Frontend="frontend",e.Hotel="hotel",e.Events="events"}(f||(f={})),function(e){e.FixedAmount="fixed",e.Percentage="percentage",e.Nights="nights"}(p||(p={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE",e.PATCH="PATCH",e.OPTIONS="OPTIONS",e.HEAD="HEAD"}(h||(h={})),function(e){e.PercentageOfBooking="PercentageOfBooking",e.FixedChargePerRoom="FixedChargePerRoom",e.NightlyChargePerRoom="NightlyChargePerRoom",e.FixedChargePerBooking="FixedChargePerBooking",e.DepositSurcharge="DepositSurcharge"}(S||(S={}));const T=e=>{let n=0;const o=Object.values(e.itinerary);for(const e of o){const o=Object.keys(e.nights);for(const t of o)n+=e.nights[t].total}return n},O=(e,n)=>e.includes("cdn.app.roomstay.io")?e+"?w="+n:e,E=e=>e,R=(e,n)=>{const o={};return n.forEach((n=>{n in e&&(o[n]=e[n])})),o},A=require("decimal.js");var B=e.n(A);const k=e=>new(B())(e).toDecimalPlaces(2).toNumber();function v(e,n={}){const{baseAmount:o=0,numberOfNights:t=1,feeIncludedInBaseAmount:r=!1,feeWasRemoved:a=!1,removedPercentages:i=[]}=n;switch(e.feeType){case S.PercentageOfBooking:return r?o*e.amount/(100+e.amount):a?o/(1-i.reduce(((e,n)=>e+n/(100+n)),0))*e.amount/(100+e.amount):o*(e.amount/100);case S.FixedChargePerRoom:case S.FixedChargePerBooking:return e.amount;case S.NightlyChargePerRoom:return e.amount*t;default:return 0}}const F=[S.FixedChargePerBooking],I=[S.PercentageOfBooking,S.FixedChargePerRoom,S.NightlyChargePerRoom],M=[S.PercentageOfBooking];function x(e,n){return e.filter((e=>n.includes(e.feeType)))}function b(e){return x(e,F)}function D(e){return x(e,I)}function N(e){return x(e,M)}module.exports=n})();
@@ -1,5 +1,6 @@
1
1
  import { EFeeType } from "./EFeeType.enum";
2
2
  export interface IFee {
3
+ name: string;
3
4
  amount: number;
4
5
  feeType: EFeeType;
5
6
  }
@@ -0,0 +1,6 @@
1
+ export interface IFeeConfigurationOptions {
2
+ includeInRates: boolean;
3
+ alreadyIncludedInRates: boolean;
4
+ appliesToAddons: boolean;
5
+ includePreviousFeesInCalculation: boolean;
6
+ }
@@ -0,0 +1,6 @@
1
+ export interface IFeeOptions {
2
+ includeInRates: boolean;
3
+ alreadyIncludedInRates: boolean;
4
+ appliesToAddons: boolean;
5
+ includePreviousFeesInCalculation: boolean;
6
+ }
@@ -0,0 +1,25 @@
1
+ export type IMaintenanceStatus = {
2
+ /**
3
+ * Which service is currently experiencing issues.
4
+ */
5
+ service: IMaintenanceStatusService;
6
+ /**
7
+ * The start time of the maintenance window in ISO 8601 format
8
+ *
9
+ * @example 2023-10-01T00:00:00Z
10
+ */
11
+ startDate: string;
12
+ endDate: string;
13
+ /**
14
+ * Whether the status is currently in effect or not
15
+ */
16
+ isActive: boolean;
17
+ status: 'error' | 'maintenance';
18
+ title: string;
19
+ message: string;
20
+ };
21
+ export declare enum IMaintenanceStatusService {
22
+ Frontend = "frontend",
23
+ Hotel = "hotel",
24
+ Events = "events"
25
+ }
@@ -1,75 +1,78 @@
1
1
  /**
2
2
  * Booking Details
3
3
  */
4
- export * from "./Booking/IBookingPayment.type";
5
- export * from "./Booking/IBookingStatus.type";
6
- export * from "./Booking/IPrice.type";
7
- export * from "./Booking/IBookingCreateErrorResponse";
8
- export * from "./Booking/IBookingQuote.type";
4
+ export * from './Booking/IBookingPayment.type';
5
+ export * from './Booking/IBookingStatus.type';
6
+ export * from './Booking/IPrice.type';
7
+ export * from './Booking/IBookingCreateErrorResponse';
8
+ export * from './Booking/IBookingQuote.type';
9
9
  /**
10
10
  * Company
11
11
  */
12
- export * from "./Company/ECompanyProvider.enum";
13
- export * from "./Company/IAdminCompany.type";
14
- export * from "./Company/IAdminCompanyUser.type";
12
+ export * from './Company/ECompanyProvider.enum';
13
+ export * from './Company/IAdminCompany.type';
14
+ export * from './Company/IAdminCompanyUser.type';
15
15
  /**
16
16
  * Hotel
17
17
  */
18
- export * from "./Hotel/EHotelPriceModel.enum";
19
- export * from "./Hotel/EHotelStateFieldConfiguration.enum";
20
- export * from "./Hotel/EHotelWeekdayStartsOn.enum";
21
- export * from "./Hotel/EIntegration.enum";
22
- export * from "./Hotel/IAuxiliaryFilter.type";
23
- export * from "./Hotel/IHotelColorScheme.type";
24
- export * from "./Hotel/IHotelOverrides.type";
25
- export * from "./Hotel/IHotelReplica.type";
26
- export * from "./Hotel/IHotelService.type";
18
+ export * from './Hotel/EHotelPriceModel.enum';
19
+ export * from './Hotel/EHotelStateFieldConfiguration.enum';
20
+ export * from './Hotel/EHotelWeekdayStartsOn.enum';
21
+ export * from './Hotel/EIntegration.enum';
22
+ export * from './Hotel/IAuxiliaryFilter.type';
23
+ export * from './Hotel/IHotelColorScheme.type';
24
+ export * from './Hotel/IHotelOverrides.type';
25
+ export * from './Hotel/IHotelReplica.type';
26
+ export * from './Hotel/IHotelService.type';
27
27
  /**
28
28
  * Room
29
29
  */
30
- export * from "./Room/IRoomGroup.type";
30
+ export * from './Room/IRoomGroup.type';
31
31
  /**
32
32
  * RMS
33
33
  */
34
- export * from "./RMS/ERMSDiscountType.enum";
35
- export * from "./RMS/IRMSPropertyDiscount.type";
36
- export * from "./RMS/IRMSRequirement.type";
34
+ export * from './RMS/ERMSDiscountType.enum';
35
+ export * from './RMS/IRMSPropertyDiscount.type';
36
+ export * from './RMS/IRMSRequirement.type';
37
37
  /**
38
38
  * Image
39
39
  */
40
- export * from "./Image/IRoomstayImage.type";
40
+ export * from './Image/IRoomstayImage.type';
41
+ /** Maintenance */
42
+ export * from './Maintenance/IMaintenanceStatus.type';
41
43
  /**
42
44
  * Member Details
43
45
  */
44
- export * from "./Member/IMember.type";
45
- export * from "./Member/IMemberVerification.type";
46
- export * from "./Member/IRoomstayCognitoMember.type";
47
- export * from "./Member/IRoomstayMember.type";
48
- export * from "./Member/IRoomstayMemberBooking.type";
49
- export * from "./Member/IRoomstayMemberBookingAddress.type";
50
- export * from "./Member/IRoomstayMemberBookingItem.type";
51
- export * from "./Member/IRoomstayMemberBookingProfile.type";
52
- export * from "./Member/IRoomstayMemberCards.type";
53
- export * from "./Member/ISession.type";
46
+ export * from './Member/IMember.type';
47
+ export * from './Member/IMemberVerification.type';
48
+ export * from './Member/IRoomstayCognitoMember.type';
49
+ export * from './Member/IRoomstayMember.type';
50
+ export * from './Member/IRoomstayMemberBooking.type';
51
+ export * from './Member/IRoomstayMemberBookingAddress.type';
52
+ export * from './Member/IRoomstayMemberBookingItem.type';
53
+ export * from './Member/IRoomstayMemberBookingProfile.type';
54
+ export * from './Member/IRoomstayMemberCards.type';
55
+ export * from './Member/ISession.type';
54
56
  /**
55
57
  * Policies
56
58
  */
57
- export * from "./Policies/EGuaranteePolicy.enum";
59
+ export * from './Policies/EGuaranteePolicy.enum';
58
60
  /**
59
61
  * Roomstay Events
60
62
  */
61
- export * from "./Events/IRoomstayEvent.type";
63
+ export * from './Events/IRoomstayEvent.type';
62
64
  /**
63
65
  * General
64
66
  */
65
- export * from "./General/HttpMethod.enum";
66
- export * from "./General/IMessage.type";
67
+ export * from './General/HttpMethod.enum';
68
+ export * from './General/IMessage.type';
67
69
  /**
68
70
  * Media
69
71
  */
70
- export * from "./Media/IMedia.type";
72
+ export * from './Media/IMedia.type';
71
73
  /**
72
74
  * Fees
73
75
  */
74
76
  export * from "./Fees/EFeeType.enum";
75
77
  export * from "./Fees/IFee.type";
78
+ export * from "./Fees/IFeeConfigurationOptions.type";
@@ -2,6 +2,9 @@ import { IFee } from '../types/index.js';
2
2
  interface FeeCalculationParams {
3
3
  baseAmount?: number;
4
4
  numberOfNights?: number;
5
+ feeIncludedInBaseAmount?: boolean;
6
+ feeWasRemoved?: boolean;
7
+ removedPercentages?: number[];
5
8
  }
6
9
  export declare function calculateFeeAmount(fee: IFee, params?: FeeCalculationParams): number;
7
10
  export {};
File without changes
package/dist/web.js CHANGED
@@ -1 +1 @@
1
- define("@roomstay/core",["decimal.js"],(e=>(()=>{"use strict";var n={60:n=>{n.exports=e}},o={};function t(e){var r=o[e];if(void 0!==r)return r.exports;var a=o[e]={exports:{}};return n[e](a,a.exports,t),a.exports}t.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},t.d=(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},t.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{let e,n,o;t.r(r),t.d(r,{EBookingPaymentMethod:()=>e,ECompanyProvider:()=>c,EDistanceUnitType:()=>y,EFeeType:()=>h,EGuarantyPolicyPrepaymentType:()=>p,EHotelCardProcessor:()=>n,EHotelPriceModel:()=>d,EHotelStateFieldConfiguration:()=>u,EHotelWeekdayStartsOn:()=>l,EIntegration:()=>g,EPlanpayBookingStatus:()=>o,ERMSDiscountType:()=>P,ERoomstayImageSize:()=>f,HttpMethod:()=>m,IAuxiliaryFilterType:()=>s,IBookingStatus:()=>i,PCIBookingCardProcessorTypes:()=>a,calculateFeeAmount:()=>B,calculateTotalForMemberBooking:()=>S,getFilteredBookingAddonFees:()=>I,getFilteredBookingFees:()=>b,getFilteredBookingRateFees:()=>D,nameof:()=>O,resizeRoomstayImageUrl:()=>T,roundMoney:()=>k,subset:()=>E,uppercaseString:()=>C}),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"}(n||(n={})),function(e){e.Unknown="unknown",e.Unpaid="unpaid",e.Accepted="accepted",e.Cancelled="cancelled",e.Refunded="refunded",e.Rejected="rejected"}(o||(o={}));const a=[];let i,c,d,u,l,g,s,y,P,f,p,m,h;function C(e){return e.toUpperCase()}!function(e){e.Pending="Pending",e.Committed="Committed",e.Cancelled="Cancelled"}(i||(i={})),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"}(d||(d={})),function(e){e.NotIncluded="NotIncluded",e.Optional="Optional",e.Required="Required"}(u||(u={})),function(e){e.Monday="monday",e.Sunday="sunday"}(l||(l={})),function(e){e.Big4="Big4",e.RmsTop10="Top10",e.Top10="NewTop10",e.Gday="Gday",e.Salesforce="Salesforce"}(g||(g={})),function(e){e.AreaDwellingLength="AreaDwellingLength",e.AreaDwellingType="AreaDwellingType"}(s||(s={})),function(e){e.Metric="metric",e.Imperial="imperial"}(y||(y={})),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"}(f||(f={})),function(e){e.FixedAmount="fixed",e.Percentage="percentage",e.Nights="nights"}(p||(p={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE",e.PATCH="PATCH",e.OPTIONS="OPTIONS",e.HEAD="HEAD"}(m||(m={})),function(e){e.PercentageOfBooking="PercentageOfBooking",e.FixedChargePerRoom="FixedChargePerRoom",e.NightlyChargePerRoom="NightlyChargePerRoom",e.FixedChargePerBooking="FixedChargePerBooking",e.DepositSurcharge="DepositSurcharge"}(h||(h={}));const S=e=>{let n=0;const o=Object.values(e.itinerary);for(const e of o){const o=Object.keys(e.nights);for(const t of o)n+=e.nights[t].total}return n},T=(e,n)=>e.includes("cdn.app.roomstay.io")?e+"?w="+n:e,O=e=>e,E=(e,n)=>{const o={};return n.forEach((n=>{n in e&&(o[n]=e[n])})),o};var R=t(60),A=t.n(R);const k=e=>new(A())(e).toDecimalPlaces(2).toNumber();function B(e,n={}){const{baseAmount:o=0,numberOfNights:t=1}=n;switch(e.feeType){case h.PercentageOfBooking:return o*(e.amount/100);case h.FixedChargePerRoom:case h.FixedChargePerBooking:return e.amount;case h.NightlyChargePerRoom:return e.amount*t;default:return 0}}const v=[h.FixedChargePerBooking],x=[h.PercentageOfBooking,h.FixedChargePerRoom,h.NightlyChargePerRoom],F=[h.PercentageOfBooking];function M(e,n){return e.filter((e=>n.includes(e.feeType)))}function b(e){return M(e,v)}function D(e){return M(e,x)}function I(e){return M(e,F)}})(),r})()));
1
+ define("@roomstay/core",["decimal.js"],(e=>(()=>{"use strict";var n={60:n=>{n.exports=e}},o={};function t(e){var r=o[e];if(void 0!==r)return r.exports;var a=o[e]={exports:{}};return n[e](a,a.exports,t),a.exports}t.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},t.d=(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},t.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{let e,n,o;t.r(r),t.d(r,{EBookingPaymentMethod:()=>e,ECompanyProvider:()=>c,EDistanceUnitType:()=>y,EFeeType:()=>S,EGuarantyPolicyPrepaymentType:()=>p,EHotelCardProcessor:()=>n,EHotelPriceModel:()=>d,EHotelStateFieldConfiguration:()=>u,EHotelWeekdayStartsOn:()=>l,EIntegration:()=>g,EPlanpayBookingStatus:()=>o,ERMSDiscountType:()=>P,ERoomstayImageSize:()=>f,HttpMethod:()=>h,IAuxiliaryFilterType:()=>s,IBookingStatus:()=>i,IMaintenanceStatusService:()=>m,PCIBookingCardProcessorTypes:()=>a,calculateFeeAmount:()=>k,calculateTotalForMemberBooking:()=>T,getFilteredBookingAddonFees:()=>N,getFilteredBookingFees:()=>b,getFilteredBookingRateFees:()=>D,nameof:()=>E,resizeRoomstayImageUrl:()=>O,roundMoney:()=>B,subset:()=>R,uppercaseString:()=>C}),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"}(n||(n={})),function(e){e.Unknown="unknown",e.Unpaid="unpaid",e.Accepted="accepted",e.Cancelled="cancelled",e.Refunded="refunded",e.Rejected="rejected"}(o||(o={}));const a=[];let i,c,d,u,l,g,s,y,P,f,m,p,h,S;function C(e){return e.toUpperCase()}!function(e){e.Pending="Pending",e.Committed="Committed",e.Cancelled="Cancelled"}(i||(i={})),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"}(d||(d={})),function(e){e.NotIncluded="NotIncluded",e.Optional="Optional",e.Required="Required"}(u||(u={})),function(e){e.Monday="monday",e.Sunday="sunday"}(l||(l={})),function(e){e.Big4="Big4",e.RmsTop10="Top10",e.Top10="NewTop10",e.Gday="Gday",e.Salesforce="Salesforce"}(g||(g={})),function(e){e.AreaDwellingLength="AreaDwellingLength",e.AreaDwellingType="AreaDwellingType"}(s||(s={})),function(e){e.Metric="metric",e.Imperial="imperial"}(y||(y={})),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"}(f||(f={})),function(e){e.Frontend="frontend",e.Hotel="hotel",e.Events="events"}(m||(m={})),function(e){e.FixedAmount="fixed",e.Percentage="percentage",e.Nights="nights"}(p||(p={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE",e.PATCH="PATCH",e.OPTIONS="OPTIONS",e.HEAD="HEAD"}(h||(h={})),function(e){e.PercentageOfBooking="PercentageOfBooking",e.FixedChargePerRoom="FixedChargePerRoom",e.NightlyChargePerRoom="NightlyChargePerRoom",e.FixedChargePerBooking="FixedChargePerBooking",e.DepositSurcharge="DepositSurcharge"}(S||(S={}));const T=e=>{let n=0;const o=Object.values(e.itinerary);for(const e of o){const o=Object.keys(e.nights);for(const t of o)n+=e.nights[t].total}return n},O=(e,n)=>e.includes("cdn.app.roomstay.io")?e+"?w="+n:e,E=e=>e,R=(e,n)=>{const o={};return n.forEach((n=>{n in e&&(o[n]=e[n])})),o};var v=t(60),A=t.n(v);const B=e=>new(A())(e).toDecimalPlaces(2).toNumber();function k(e,n={}){const{baseAmount:o=0,numberOfNights:t=1,feeIncludedInBaseAmount:r=!1,feeWasRemoved:a=!1,removedPercentages:i=[]}=n;switch(e.feeType){case S.PercentageOfBooking:return r?o*e.amount/(100+e.amount):a?o/(1-i.reduce(((e,n)=>e+n/(100+n)),0))*e.amount/(100+e.amount):o*(e.amount/100);case S.FixedChargePerRoom:case S.FixedChargePerBooking:return e.amount;case S.NightlyChargePerRoom:return e.amount*t;default:return 0}}const F=[S.FixedChargePerBooking],x=[S.PercentageOfBooking,S.FixedChargePerRoom,S.NightlyChargePerRoom],I=[S.PercentageOfBooking];function M(e,n){return e.filter((e=>n.includes(e.feeType)))}function b(e){return M(e,F)}function D(e){return M(e,x)}function N(e){return M(e,I)}})(),r})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roomstay/core",
3
- "version": "0.1.46-1",
3
+ "version": "0.1.46-3",
4
4
  "description": "Details shared between Roomstay libraries. Anything from Currency, to Generic types",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [