@roomstay/core 0.1.47-2 → 0.1.47-4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node.js +1 -1
- package/dist/types/Company/IAdminCompany.type.d.ts +1 -0
- package/dist/types/Events/ERoomstayEventSource.enum.d.ts +4 -0
- package/dist/types/Events/IRoomstayEvent.type.d.ts +12 -10
- package/dist/types/index.d.ts +2 -1
- package/dist/web.js +1 -1
- package/package.json +3 -6
- package/dist/types/Fees/IFeeOptions.type.d.ts +0 -6
- package/dist/utils/feeOptionRules.d.ts +0 -0
package/dist/node.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e={n:n=>{var
|
|
1
|
+
(()=>{"use strict";var e={n:n=>{var t=n&&n.__esModule?()=>n.default:()=>n;return e.d(t,{a:t}),t},d:(n,t)=>{for(var o in t)e.o(t,o)&&!e.o(n,o)&&Object.defineProperty(n,o,{enumerable:!0,get:t[o]})},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 t,o,r;e.r(n),e.d(n,{EBookingPaymentMethod:()=>t,ECompanyProvider:()=>c,EDistanceUnitType:()=>y,EFeeType:()=>C,EGuarantyPolicyPrepaymentType:()=>p,EHotelCardProcessor:()=>o,EHotelPriceModel:()=>u,EHotelStateFieldConfiguration:()=>d,EHotelWeekdayStartsOn:()=>l,EIntegration:()=>g,EPlanpayBookingStatus:()=>r,ERMSDiscountType:()=>P,ERoomstayEventSource:()=>h,ERoomstayImageSize:()=>f,HttpMethod:()=>S,IAuxiliaryFilterType:()=>s,IBookingStatus:()=>i,IMaintenanceStatusService:()=>m,PCIBookingCardProcessorTypes:()=>a,calculateFeeAmount:()=>v,calculateTotalForMemberBooking:()=>O,getFeeOptionValidity:()=>H,getFilteredBookingAddonFees:()=>w,getFilteredBookingFees:()=>D,getFilteredBookingRateFees:()=>N,nameof:()=>R,resizeRoomstayImageUrl:()=>E,roundMoney:()=>F,subset:()=>B,uppercaseString:()=>T}),function(e){e.Card="Card",e.SavedCard="SavedCard",e.Planpay="Planpay",e.Adyen="Adyen",e.Afterpay="Afterpay",e.PCIBookingCard="PCIBookingCard"}(t||(t={})),function(e){e.Passthrough="Passthrough",e.Adyen="Adyen",e.Till="Till",e.RMSPay="RMSPay",e.Windcave="Windcave"}(o||(o={})),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,u,d,l,g,s,y,P,f,m,p,h,S,C;function T(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"}(u||(u={})),function(e){e.NotIncluded="NotIncluded",e.Optional="Optional",e.Required="Required"}(d||(d={})),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.Eventbrite="eventbrite",e.ATDW="atdw"}(h||(h={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE",e.PATCH="PATCH",e.OPTIONS="OPTIONS",e.HEAD="HEAD"}(S||(S={})),function(e){e.PercentageOfBooking="PercentageOfBooking",e.FixedChargePerRoom="FixedChargePerRoom",e.NightlyChargePerRoom="NightlyChargePerRoom",e.FixedChargePerBooking="FixedChargePerBooking",e.DepositSurcharge="DepositSurcharge"}(C||(C={}));const O=e=>{let n=0;const t=Object.values(e.itinerary);for(const e of t){const t=Object.keys(e.nights);for(const o of t)n+=e.nights[o].total}return n},E=(e,n)=>e.includes("cdn.app.roomstay.io")?e+"?w="+n:e,R=e=>e,B=(e,n)=>{const t={};return n.forEach((n=>{n in e&&(t[n]=e[n])})),t},k=require("decimal.js");var A=e.n(k);const F=e=>new(A())(e).toDecimalPlaces(2).toNumber();function v(e,n={}){const{baseAmount:t=0,numberOfNights:o=1,feeIncludedInBaseAmount:r=!1,extractedFromRates:a=!1,removedPercentages:i=[]}=n,c=F(t);switch(e.feeType){case C.PercentageOfBooking:if(r)return F(c*e.amount/(100+e.amount));if(a){const n=i.reduce(((e,n)=>e+n/(100+n)),0);return F(c/(1-n)*e.amount/(100+e.amount))}return F(c*(e.amount/100));case C.FixedChargePerRoom:case C.FixedChargePerBooking:return e.amount;case C.NightlyChargePerRoom:return F(e.amount*o);default:return 0}}const I=[C.FixedChargePerBooking],x=[C.PercentageOfBooking,C.FixedChargePerRoom,C.NightlyChargePerRoom],M=[C.PercentageOfBooking];function b(e,n){return e.filter((e=>n.includes(e.feeType)))}function D(e){return b(e,I)}function N(e){return b(e,x)}function w(e){return b(e,M)}function H(e){return{includeInRates:[C.PercentageOfBooking,C.NightlyChargePerRoom].includes(e),extractFeeFromRates:e===C.PercentageOfBooking,appliesToAddons:e===C.PercentageOfBooking,includePreviousFeesInCalculation:e===C.PercentageOfBooking}}module.exports=n})();
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
+
import { ERoomstayEventSource } from "./ERoomstayEventSource.enum";
|
|
1
2
|
type IRoomstayEventAvailabilityPrice = {
|
|
2
3
|
currency: string;
|
|
3
4
|
majorValue: string;
|
|
4
5
|
value: number;
|
|
5
6
|
};
|
|
7
|
+
export type IRoomstayEventAvailability = {
|
|
8
|
+
isSoldOut?: boolean;
|
|
9
|
+
hasAvailableTickets?: boolean;
|
|
10
|
+
isFree: boolean;
|
|
11
|
+
minPrice?: IRoomstayEventAvailabilityPrice;
|
|
12
|
+
maxPrice?: IRoomstayEventAvailabilityPrice;
|
|
13
|
+
};
|
|
6
14
|
export type IRoomstayEvent = {
|
|
7
15
|
eventId: string;
|
|
8
|
-
source:
|
|
16
|
+
source: ERoomstayEventSource | string;
|
|
9
17
|
name: string;
|
|
10
18
|
summary: string;
|
|
11
19
|
description: string;
|
|
@@ -15,14 +23,14 @@ export type IRoomstayEvent = {
|
|
|
15
23
|
isRoomstay?: boolean;
|
|
16
24
|
id?: string;
|
|
17
25
|
};
|
|
18
|
-
checkoutUrl
|
|
26
|
+
checkoutUrl?: string;
|
|
19
27
|
url: string;
|
|
20
28
|
endDate: string;
|
|
21
29
|
startDate: string;
|
|
22
30
|
/**
|
|
23
31
|
* Used to override the startDate (if event is repeating for example, say every thursday at 6pm)
|
|
24
32
|
*/
|
|
25
|
-
eventTimeDescription
|
|
33
|
+
eventTimeDescription?: string;
|
|
26
34
|
unixStartTime: number;
|
|
27
35
|
timezone: string;
|
|
28
36
|
searchCity: string[];
|
|
@@ -36,13 +44,7 @@ export type IRoomstayEvent = {
|
|
|
36
44
|
country: string;
|
|
37
45
|
region: string;
|
|
38
46
|
};
|
|
39
|
-
availability
|
|
40
|
-
isSoldOut: boolean;
|
|
41
|
-
hasAvailableTickets: boolean;
|
|
42
|
-
isFree: boolean;
|
|
43
|
-
minPrice: IRoomstayEventAvailabilityPrice;
|
|
44
|
-
maxPrice: IRoomstayEventAvailabilityPrice;
|
|
45
|
-
};
|
|
47
|
+
availability?: IRoomstayEventAvailability;
|
|
46
48
|
tags: any;
|
|
47
49
|
};
|
|
48
50
|
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -60,7 +60,8 @@ export * from './Policies/EGuaranteePolicy.enum';
|
|
|
60
60
|
/**
|
|
61
61
|
* Roomstay Events
|
|
62
62
|
*/
|
|
63
|
-
export * from
|
|
63
|
+
export * from "./Events/IRoomstayEvent.type";
|
|
64
|
+
export * from "./Events/ERoomstayEventSource.enum";
|
|
64
65
|
/**
|
|
65
66
|
* General
|
|
66
67
|
*/
|
package/dist/web.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
define("@roomstay/core",["decimal.js"],(e=>(()=>{"use strict";var n={60:n=>{n.exports=e}},
|
|
1
|
+
define("@roomstay/core",["decimal.js"],(e=>(()=>{"use strict";var n={60:n=>{n.exports=e}},t={};function o(e){var r=t[e];if(void 0!==r)return r.exports;var a=t[e]={exports:{}};return n[e](a,a.exports,o),a.exports}o.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return o.d(n,{a:n}),n},o.d=(e,n)=>{for(var t in n)o.o(n,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},o.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),o.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,t;o.r(r),o.d(r,{EBookingPaymentMethod:()=>e,ECompanyProvider:()=>c,EDistanceUnitType:()=>y,EFeeType:()=>C,EGuarantyPolicyPrepaymentType:()=>p,EHotelCardProcessor:()=>n,EHotelPriceModel:()=>u,EHotelStateFieldConfiguration:()=>d,EHotelWeekdayStartsOn:()=>l,EIntegration:()=>g,EPlanpayBookingStatus:()=>t,ERMSDiscountType:()=>f,ERoomstayEventSource:()=>h,ERoomstayImageSize:()=>P,HttpMethod:()=>S,IAuxiliaryFilterType:()=>s,IBookingStatus:()=>i,IMaintenanceStatusService:()=>m,PCIBookingCardProcessorTypes:()=>a,calculateFeeAmount:()=>F,calculateTotalForMemberBooking:()=>O,getFeeOptionValidity:()=>H,getFilteredBookingAddonFees:()=>w,getFilteredBookingFees:()=>D,getFilteredBookingRateFees:()=>N,nameof:()=>R,resizeRoomstayImageUrl:()=>E,roundMoney:()=>A,subset:()=>v,uppercaseString:()=>T}),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"}(t||(t={}));const a=[];let i,c,u,d,l,g,s,y,f,P,m,p,h,S,C;function T(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"}(u||(u={})),function(e){e.NotIncluded="NotIncluded",e.Optional="Optional",e.Required="Required"}(d||(d={})),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"}(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"}(P||(P={})),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.Eventbrite="eventbrite",e.ATDW="atdw"}(h||(h={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE",e.PATCH="PATCH",e.OPTIONS="OPTIONS",e.HEAD="HEAD"}(S||(S={})),function(e){e.PercentageOfBooking="PercentageOfBooking",e.FixedChargePerRoom="FixedChargePerRoom",e.NightlyChargePerRoom="NightlyChargePerRoom",e.FixedChargePerBooking="FixedChargePerBooking",e.DepositSurcharge="DepositSurcharge"}(C||(C={}));const O=e=>{let n=0;const t=Object.values(e.itinerary);for(const e of t){const t=Object.keys(e.nights);for(const o of t)n+=e.nights[o].total}return n},E=(e,n)=>e.includes("cdn.app.roomstay.io")?e+"?w="+n:e,R=e=>e,v=(e,n)=>{const t={};return n.forEach((n=>{n in e&&(t[n]=e[n])})),t};var B=o(60),k=o.n(B);const A=e=>new(k())(e).toDecimalPlaces(2).toNumber();function F(e,n={}){const{baseAmount:t=0,numberOfNights:o=1,feeIncludedInBaseAmount:r=!1,extractedFromRates:a=!1,removedPercentages:i=[]}=n,c=A(t);switch(e.feeType){case C.PercentageOfBooking:if(r)return A(c*e.amount/(100+e.amount));if(a){const n=i.reduce(((e,n)=>e+n/(100+n)),0);return A(c/(1-n)*e.amount/(100+e.amount))}return A(c*(e.amount/100));case C.FixedChargePerRoom:case C.FixedChargePerBooking:return e.amount;case C.NightlyChargePerRoom:return A(e.amount*o);default:return 0}}const x=[C.FixedChargePerBooking],I=[C.PercentageOfBooking,C.FixedChargePerRoom,C.NightlyChargePerRoom],M=[C.PercentageOfBooking];function b(e,n){return e.filter((e=>n.includes(e.feeType)))}function D(e){return b(e,x)}function N(e){return b(e,I)}function w(e){return b(e,M)}function H(e){return{includeInRates:[C.PercentageOfBooking,C.NightlyChargePerRoom].includes(e),extractFeeFromRates:e===C.PercentageOfBooking,appliesToAddons:e===C.PercentageOfBooking,includePreviousFeesInCalculation:e===C.PercentageOfBooking}}})(),r})()));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roomstay/core",
|
|
3
|
-
"version": "0.1.47-
|
|
3
|
+
"version": "0.1.47-4",
|
|
4
4
|
"description": "Details shared between Roomstay libraries. Anything from Currency, to Generic types",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -42,13 +42,10 @@
|
|
|
42
42
|
"ts-loader": "^9.4.1",
|
|
43
43
|
"typescript": "^4.9.3",
|
|
44
44
|
"webpack": "^5.75.0",
|
|
45
|
-
"webpack-cli": "^5.0.0"
|
|
45
|
+
"webpack-cli": "^5.0.0",
|
|
46
|
+
"yalc": "^1.0.0-pre.53"
|
|
46
47
|
},
|
|
47
48
|
"peerDependencies": {
|
|
48
49
|
"decimal.js": "^10.4.3"
|
|
49
|
-
},
|
|
50
|
-
"dependencies": {
|
|
51
|
-
"global": "^4.4.0",
|
|
52
|
-
"yalc": "^1.0.0-pre.53"
|
|
53
50
|
}
|
|
54
51
|
}
|
|
File without changes
|