@roomstay/core 0.1.85-5 → 0.1.85-6

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 (32) hide show
  1. package/dist/types/DisplayPolicy/EDisplayPolicyRuleType.enum.d.ts +1 -1
  2. package/dist/types/DisplayPolicy/ERuleType.d.ts +6 -0
  3. package/dist/types/DisplayPolicy/ERuleType.enum.d.ts +6 -0
  4. package/dist/types/DisplayPolicy/IDisplayPolicy.d.ts +25 -0
  5. package/dist/types/General/IEntityValidity.type.d.ts +11 -0
  6. package/dist/types/RMS/IRMSDiscount.type.d.ts +34 -0
  7. package/dist/types/RMS/IRMSPropertyDiscount.type.d.ts +1 -0
  8. package/dist/types/Rule/EDayOfWeek.enum.d.ts +9 -0
  9. package/dist/types/Rule/EDisplayPolicyEffectType.enum.d.ts +11 -0
  10. package/dist/types/Rule/ERuleType.enum.d.ts +11 -0
  11. package/dist/types/Rule/IRule.type.d.ts +1 -0
  12. package/dist/types/Rule/IRuleConfigurations.type.d.ts +68 -0
  13. package/dist/types/Rule/IRuleContext.type.d.ts +13 -0
  14. package/dist/types/Rule/index.d.ts +4 -0
  15. package/dist/types/index.d.ts +1 -0
  16. package/package.json +1 -1
  17. package/dist/node.js.LICENSE.txt +0 -7
  18. package/dist/types/Analytics/IAnalyticsEvent.type.d.ts +0 -35
  19. package/dist/types/Analytics/IAnalyticsSession.type.d.ts +0 -11
  20. package/dist/types/Analytics/IBigQueryResponse.type.d.ts +0 -24
  21. package/dist/types/Booking/ISplitPayment.type.d.ts +0 -89
  22. package/dist/types/Fees/IFeeOptions.type.d.ts +0 -6
  23. package/dist/types/Member/LoyaltyTiers.d.ts +0 -6
  24. package/dist/types/Newbook/ENewbookSiteSelectionFeeType.enum.d.ts +0 -4
  25. package/dist/types/Newbook/ENewbookSiteSelectionType.enum.d.ts +0 -6
  26. package/dist/types/Newbook/ENewbookSyncType.enum.d.ts +0 -3
  27. package/dist/types/Newbook/INewbookSyncResponse.type.d.ts +0 -9
  28. package/dist/types/PMS/EPMSSyncStatus.enum.d.ts +0 -8
  29. package/dist/types/PMS/IPMSSyncResponse.type.d.ts +0 -10
  30. package/dist/types/PMS/index.d.ts +0 -2
  31. package/dist/utils/feeOptionRules.d.ts +0 -0
  32. package/dist/web.js.LICENSE.txt +0 -7
@@ -2,5 +2,5 @@ export declare enum EDisplayPolicyRuleType {
2
2
  Schedule = "Schedule",
3
3
  DeviceTarget = "DeviceTarget",
4
4
  GeoLock = "GeoLock",
5
- CheapestOf = "CheapestOf"
5
+ Exclusive = "Exclusive"
6
6
  }
@@ -0,0 +1,6 @@
1
+ export declare enum ERuleType {
2
+ Schedule = "Schedule",
3
+ DeviceTarget = "DeviceTarget",
4
+ GeoLock = "GeoLock",
5
+ CheapestOf = "CheapestOf"
6
+ }
@@ -0,0 +1,6 @@
1
+ export declare enum ERuleType {
2
+ Schedule = "Schedule",
3
+ DeviceTarget = "DeviceTarget",
4
+ GeoLock = "GeoLock",
5
+ CheapestOf = "CheapestOf"
6
+ }
@@ -0,0 +1,25 @@
1
+ import { ERuleType } from './ERuleType';
2
+ export interface IDisplayPolicy {
3
+ id: number;
4
+ name: string;
5
+ description: string;
6
+ applicableRates: string[];
7
+ conditions: ICondition[];
8
+ }
9
+ export type IScheduleConfiguration = {
10
+ rruleSet: string;
11
+ durationMs: number;
12
+ };
13
+ export type ICondition = {
14
+ ruleType: ERuleType.Schedule;
15
+ configuration: IScheduleConfiguration;
16
+ } | {
17
+ ruleType: ERuleType.DeviceTarget;
18
+ configuration: unknown;
19
+ } | {
20
+ ruleType: ERuleType.GeoLock;
21
+ configuration: unknown;
22
+ } | {
23
+ ruleType: ERuleType.CheapestOf;
24
+ configuration: unknown;
25
+ };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Whether an entity is in a usable ("valid") state, and — when it isn't — the human-readable reasons
3
+ * why. Computed on the backend and returned alongside the entity so the admin can flag it (and explain
4
+ * it) without re-deriving the logic client-side.
5
+ *
6
+ * `reasons` is empty when `valid` is true.
7
+ */
8
+ export interface IEntityValidity {
9
+ valid: boolean;
10
+ reasons: string[];
11
+ }
@@ -0,0 +1,34 @@
1
+ import { ERMSDiscountType } from './ERMSDiscountType.enum';
2
+ import { IRuleSpec } from '../Rule/IRuleConfigurations.type';
3
+ export type IRMSDiscount = {
4
+ name: string;
5
+ rmsDiscountId: number;
6
+ description: string;
7
+ discountType: ERMSDiscountType;
8
+ amount?: {
9
+ amount: number;
10
+ };
11
+ percentage?: {
12
+ percentage: number;
13
+ noGreaterThan: number;
14
+ includePackage: boolean;
15
+ includeAdditionals: boolean;
16
+ appliesToTotalRate: boolean;
17
+ };
18
+ bogo?: {
19
+ buyXNights: number;
20
+ getXNights: number;
21
+ getXNightsCycles: number;
22
+ includeAdditionals: boolean;
23
+ };
24
+ nightlyRateOverride?: {
25
+ firstXNights: number;
26
+ totalCharge: number;
27
+ includeAdditionals: boolean;
28
+ };
29
+ availableToIbe: boolean;
30
+ minimumNightStay: number;
31
+ maximumNightStay: number;
32
+ availableToMembers: boolean;
33
+ rules: IRuleSpec[];
34
+ };
@@ -5,6 +5,7 @@ export type IRMSPropertyDiscount = {
5
5
  hotelId: string;
6
6
  rmsDiscountId: number;
7
7
  rules: IStoredRule[];
8
+ allowedRateCodes: string[] | null;
8
9
  description: string;
9
10
  discountType: ERMSDiscountType;
10
11
  amount?: {
@@ -0,0 +1,9 @@
1
+ export declare enum EDayOfWeek {
2
+ MON = "MON",
3
+ TUE = "TUE",
4
+ WED = "WED",
5
+ THU = "THU",
6
+ FRI = "FRI",
7
+ SAT = "SAT",
8
+ SUN = "SUN"
9
+ }
@@ -0,0 +1,11 @@
1
+ export declare enum EDisplayPolicyEffectType {
2
+ Visibility = "visibility",
3
+ Exclusivity = "exclusivity"
4
+ }
5
+ export declare enum EDisplayPolicyExclusivityMode {
6
+ Cheapest = "cheapest",
7
+ MostExpensive = "most_expensive"
8
+ }
9
+ export interface IDisplayPolicyExclusivityConfiguration {
10
+ mode: EDisplayPolicyExclusivityMode;
11
+ }
@@ -0,0 +1,11 @@
1
+ export declare enum ERuleType {
2
+ Schedule = "Schedule",
3
+ GeoLock = "GeoLock",
4
+ DeviceTarget = "DeviceTarget",
5
+ DayOfWeek = "DayOfWeek",
6
+ HotelRestriction = "HotelRestriction",
7
+ RoomRestriction = "RoomRestriction",
8
+ RateRestriction = "RateRestriction",
9
+ NightCount = "NightCount",
10
+ AnyOf = "AnyOf"
11
+ }
@@ -0,0 +1 @@
1
+ export type { IRuleSpec } from './IRuleConfigurations.type';
@@ -0,0 +1,68 @@
1
+ import { EDayOfWeek } from './EDayOfWeek.enum';
2
+ import { ERuleType } from './ERuleType.enum';
3
+ export interface IScheduleConfig {
4
+ type: 'clock' | 'stay';
5
+ rules: Array<{
6
+ type: 'include' | 'exclude';
7
+ startDate: string;
8
+ endDate: string;
9
+ rrule?: string;
10
+ }>;
11
+ }
12
+ export interface IGeoLockConfig {
13
+ applicableCountryCodes: string[];
14
+ mode: 'allow' | 'deny';
15
+ }
16
+ export type TDeviceTarget = 'mobile' | 'desktop';
17
+ export interface IDeviceTargetConfig {
18
+ allowedDevices: TDeviceTarget[];
19
+ }
20
+ export type TDayOfWeekSource = 'arrival' | 'night' | 'booking';
21
+ export interface IDayOfWeekConfig {
22
+ source: TDayOfWeekSource;
23
+ allowedDays: EDayOfWeek[];
24
+ }
25
+ export interface IHotelRestrictionConfig {
26
+ hotelIds: string[];
27
+ }
28
+ export interface IRoomRestrictionConfig {
29
+ roomCodes: string[];
30
+ }
31
+ export interface IRateRestrictionConfig {
32
+ rateCodes: string[];
33
+ }
34
+ export interface INightCountConfig {
35
+ min?: number;
36
+ max?: number;
37
+ }
38
+ export interface IAnyOfConfig {
39
+ branches: IRuleSpec[][];
40
+ }
41
+ export type IRuleSpec = {
42
+ ruleType: ERuleType.Schedule;
43
+ configuration: IScheduleConfig;
44
+ } | {
45
+ ruleType: ERuleType.GeoLock;
46
+ configuration: IGeoLockConfig;
47
+ } | {
48
+ ruleType: ERuleType.DeviceTarget;
49
+ configuration: IDeviceTargetConfig;
50
+ } | {
51
+ ruleType: ERuleType.DayOfWeek;
52
+ configuration: IDayOfWeekConfig;
53
+ } | {
54
+ ruleType: ERuleType.HotelRestriction;
55
+ configuration: IHotelRestrictionConfig;
56
+ } | {
57
+ ruleType: ERuleType.RoomRestriction;
58
+ configuration: IRoomRestrictionConfig;
59
+ } | {
60
+ ruleType: ERuleType.RateRestriction;
61
+ configuration: IRateRestrictionConfig;
62
+ } | {
63
+ ruleType: ERuleType.NightCount;
64
+ configuration: INightCountConfig;
65
+ } | {
66
+ ruleType: ERuleType.AnyOf;
67
+ configuration: IAnyOfConfig;
68
+ };
@@ -0,0 +1,13 @@
1
+ export interface IRuleContextDescriptor {
2
+ hasHotel: true;
3
+ hasNow: true;
4
+ optional: {
5
+ checkInDate?: true;
6
+ checkOutDate?: true;
7
+ nightDate?: true;
8
+ event?: true;
9
+ geolocation?: true;
10
+ rateCode?: true;
11
+ roomCode?: true;
12
+ };
13
+ }
@@ -0,0 +1,4 @@
1
+ export * from './EDayOfWeek.enum';
2
+ export * from './EDisplayPolicyEffectType.enum';
3
+ export * from './ERuleType.enum';
4
+ export * from './IRuleConfigurations.type';
@@ -117,6 +117,7 @@ export * from './Events/IRoomstayEvent.type';
117
117
  */
118
118
  export * from './General/Format.types';
119
119
  export * from './General/HttpMethod.enum';
120
+ export * from './General/IEntityValidity.type';
120
121
  export * from './General/IMessage.type';
121
122
  export * from './General/Pagination.types';
122
123
  export * from './General/Warning.type';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roomstay/core",
3
- "version": "0.1.85-5",
3
+ "version": "0.1.85-6",
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,35 +0,0 @@
1
- export type AnalyticsEventName = 'AddToCart' | 'InitiateCheckout' | 'Purchase';
2
- export interface IAnalyticsEventData {
3
- currency: string;
4
- value: number;
5
- contentIds?: string[];
6
- contentType?: string;
7
- contents?: Array<{
8
- id: string;
9
- quantity: number;
10
- itemPrice: number;
11
- }>;
12
- numItems?: number;
13
- }
14
- export interface IAnalyticsUserData {
15
- email?: string;
16
- phone?: string;
17
- firstName?: string;
18
- lastName?: string;
19
- city?: string;
20
- state?: string;
21
- zipCode?: string;
22
- country?: string;
23
- externalId?: string;
24
- }
25
- export interface IAnalyticsEvent {
26
- eventId: string;
27
- sessionId: string;
28
- hotelId: string;
29
- eventName: AnalyticsEventName;
30
- eventTime: number;
31
- eventData: IAnalyticsEventData;
32
- userData?: IAnalyticsUserData;
33
- createdAt: number;
34
- ttl: number;
35
- }
@@ -1,11 +0,0 @@
1
- export interface IAnalyticsSession {
2
- sessionId: string;
3
- hotelId: string;
4
- fbc?: string;
5
- fbp?: string;
6
- externalId?: string;
7
- userAgent?: string;
8
- ipAddress?: string;
9
- createdAt: number;
10
- ttl: number;
11
- }
@@ -1,24 +0,0 @@
1
- export type IDailyRevenue = {
2
- date: string;
3
- revenue: number;
4
- };
5
- export type IDailyRoomBreakdown = {
6
- date: string;
7
- roomName: string;
8
- purchases: number;
9
- };
10
- export type IRegionBreakdown = {
11
- country: string;
12
- region: string;
13
- purchases: number;
14
- revenue: number;
15
- };
16
- export type IBigQueryResponse = {
17
- purchases: number;
18
- cancellations: number;
19
- revenue: number;
20
- conversionRate: number;
21
- dailyRevenue: IDailyRevenue[];
22
- dailyRoomsBreakdown: IDailyRoomBreakdown[];
23
- regionBreakdown: IRegionBreakdown[];
24
- };
@@ -1,89 +0,0 @@
1
- import { EHotelCardProcessor } from './IBookingPayment.type';
2
- export declare enum ESplitPaymentState {
3
- INITIATED = "initiated",
4
- GIFTCARD_AUTHORIZED = "giftcard_authorized",
5
- CC_AUTHORIZED = "cc_authorized",
6
- CAPTURED = "captured",
7
- FAILED = "failed",
8
- ROLLED_BACK = "rolled_back"
9
- }
10
- export declare enum ESplitPaymentStatus {
11
- PENDING = "pending",
12
- AUTHORIZED = "authorized",
13
- CAPTURED = "captured",
14
- FAILED = "failed"
15
- }
16
- export interface IGiftCardPaymentDetails {
17
- amount: number;
18
- cardCode: string;
19
- authorizationId?: string;
20
- status: ESplitPaymentStatus;
21
- expiresAt?: Date;
22
- }
23
- export interface ICreditCardPaymentDetails {
24
- amount: number;
25
- processor: EHotelCardProcessor;
26
- authorizationId?: string;
27
- status: ESplitPaymentStatus;
28
- expiresAt?: Date;
29
- }
30
- export interface ISplitPayment {
31
- splitPaymentId: string;
32
- totalAmount: number;
33
- giftCard: IGiftCardPaymentDetails;
34
- creditCard: ICreditCardPaymentDetails;
35
- sessionState: ESplitPaymentState;
36
- createdAt: Date;
37
- updatedAt: Date;
38
- expiresAt: Date;
39
- }
40
- export interface ISplitPaymentSession {
41
- id: string;
42
- bookingId: number;
43
- companyId: number;
44
- hotelId: string;
45
- splitPayment: ISplitPayment;
46
- }
47
- export interface IInitiateSplitPaymentRequest {
48
- bookingId: number;
49
- giftCardCode: string;
50
- giftCardAmount: number;
51
- creditCardAmount: number;
52
- }
53
- export interface IInitiateSplitPaymentResponse {
54
- sessionId: string;
55
- giftCardAmount: number;
56
- creditCardAmount: number;
57
- expiresAt: Date;
58
- }
59
- export interface IAuthorizationResult {
60
- success: boolean;
61
- authorizationId?: string;
62
- expiresAt?: Date;
63
- error?: string;
64
- }
65
- export interface ICaptureResult {
66
- success: boolean;
67
- giftCardCaptured: boolean;
68
- creditCardCaptured: boolean;
69
- error?: string;
70
- }
71
- export interface ISplitPaymentCheckoutDetails {
72
- sessionId: string;
73
- currentStep: 'giftcard' | 'creditcard' | 'capture';
74
- giftCard: {
75
- amount: number;
76
- status: ESplitPaymentStatus;
77
- authorizationId?: string;
78
- expiresAt?: Date;
79
- };
80
- creditCard: {
81
- amount: number;
82
- status: ESplitPaymentStatus;
83
- processor?: EHotelCardProcessor;
84
- redirectUrl?: string;
85
- authorizationId?: string;
86
- expiresAt?: Date;
87
- };
88
- expiresAt: Date;
89
- }
@@ -1,6 +0,0 @@
1
- export interface IFeeOptions {
2
- includeInRates: boolean;
3
- alreadyIncludedInRates: boolean;
4
- appliesToAddons: boolean;
5
- includePreviousFeesInCalculation: boolean;
6
- }
@@ -1,6 +0,0 @@
1
- export interface ILoyaltyTier {
2
- /** Spending threshold in cents */
3
- threshold: number;
4
- /** Discount percentage awarded at this tier */
5
- discountPercent: number;
6
- }
@@ -1,4 +0,0 @@
1
- export declare enum ENewbookSiteSelectionFeeType {
2
- PerNight = "per_night",
3
- PerBooking = "per_booking"
4
- }
@@ -1,6 +0,0 @@
1
- export declare enum ENewbookSiteSelectionType {
2
- PmsAndNbo = "pms_and_nbo",
3
- Pms = "pms",
4
- Nbo = "nbo",
5
- NoFee = "no_fee"
6
- }
@@ -1,3 +0,0 @@
1
- export declare enum ENewbookSyncType {
2
- Rates = "rates"
3
- }
@@ -1,9 +0,0 @@
1
- import { EPMSSyncStatus } from '../PMS/EPMSSyncStatus.enum';
2
- import { ENewbookSyncStrategy } from './ENewbookSyncStrategy.enum';
3
- export interface INewbookSyncResponse {
4
- id: number;
5
- status: EPMSSyncStatus;
6
- syncData: string | null;
7
- syncType: ENewbookSyncStrategy;
8
- additionalData?: any;
9
- }
@@ -1,8 +0,0 @@
1
- export declare enum EPMSSyncStatus {
2
- New = "new",
3
- Queued = "queued",
4
- InProgress = "in_progress",
5
- Success = "success",
6
- Failure = "failure",
7
- RequireResume = "require_resume"
8
- }
@@ -1,10 +0,0 @@
1
- import { ECompanyProvider } from '../Company/ECompanyProvider.enum';
2
- import { EPMSSyncStatus } from './EPMSSyncStatus.enum';
3
- export interface IPMSSyncResponse {
4
- id: number;
5
- provider: ECompanyProvider;
6
- status: EPMSSyncStatus;
7
- syncData: string | null;
8
- syncType: string;
9
- additionalData?: any;
10
- }
@@ -1,2 +0,0 @@
1
- export * from './EPMSSyncStatus.enum';
2
- export * from './IPMSSyncResponse.type';
File without changes
@@ -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
- */