@vibe-flats/booking-engine-common-server 1.0.155 → 1.0.157
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/build/index.d.ts +1 -0
- package/build/index.js +1 -0
- package/build/src/models/units.d.ts +35 -14
- package/build/src/models/units.js +22 -0
- package/build/src/types/guesty-reservation.d.ts +192 -0
- package/build/src/types/guesty-reservation.js +11 -0
- package/build/src/utils/guesty-total.d.ts +1 -5
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
package/build/index.js
CHANGED
|
@@ -21,3 +21,4 @@ __exportStar(require("./src/utils/monthly-diff"), exports);
|
|
|
21
21
|
__exportStar(require("./src/utils/purge-unit-cache"), exports);
|
|
22
22
|
__exportStar(require("./src/utils/cache"), exports);
|
|
23
23
|
__exportStar(require("./src/utils/guesty-total"), exports);
|
|
24
|
+
__exportStar(require("./src/types/guesty-reservation"), exports);
|
|
@@ -6,6 +6,39 @@ import { MarketDocument } from './markets';
|
|
|
6
6
|
import { GuestDocument } from './guests';
|
|
7
7
|
export type UnitReviewCategory = 'cleanliness' | 'communication' | 'checkin' | 'accuracy' | 'location' | 'value' | 'service';
|
|
8
8
|
export type UnitReviewPlatform = 'direct' | 'airbnb' | 'vrbo' | 'booking' | 'expedia';
|
|
9
|
+
export type UnitReviewChannel = 'all' | 'airbnb' | 'booking' | 'vrbo';
|
|
10
|
+
export interface UnitReview {
|
|
11
|
+
body: string;
|
|
12
|
+
isPublic: boolean;
|
|
13
|
+
isPublicOnChannel: boolean;
|
|
14
|
+
rating: number;
|
|
15
|
+
nativeRating?: number;
|
|
16
|
+
nativeScale?: 5 | 10;
|
|
17
|
+
createdAt: Date;
|
|
18
|
+
reservationId: string;
|
|
19
|
+
externalId: string;
|
|
20
|
+
platform: UnitReviewPlatform;
|
|
21
|
+
guest: GuestDocument;
|
|
22
|
+
categories: {
|
|
23
|
+
name: UnitReviewCategory;
|
|
24
|
+
rating: number;
|
|
25
|
+
}[];
|
|
26
|
+
}
|
|
27
|
+
export interface UnitRatingBucket {
|
|
28
|
+
rating: number;
|
|
29
|
+
count: number;
|
|
30
|
+
}
|
|
31
|
+
export interface UnitRatingsByWindow {
|
|
32
|
+
allTime: UnitRatingBucket;
|
|
33
|
+
last6Months: UnitRatingBucket;
|
|
34
|
+
last3Reviews: UnitRatingBucket;
|
|
35
|
+
}
|
|
36
|
+
export interface UnitRatings {
|
|
37
|
+
all: UnitRatingsByWindow;
|
|
38
|
+
airbnb: UnitRatingsByWindow;
|
|
39
|
+
booking: UnitRatingsByWindow;
|
|
40
|
+
vrbo: UnitRatingsByWindow;
|
|
41
|
+
}
|
|
9
42
|
export declare const UNIT_TYPES: {
|
|
10
43
|
readonly SINGLE: "single";
|
|
11
44
|
readonly MULTI_PARENT: "multi-listing-parent";
|
|
@@ -120,20 +153,8 @@ export interface UnitDocument extends mongoose.Document {
|
|
|
120
153
|
updatedAt: Date;
|
|
121
154
|
isTrue: boolean;
|
|
122
155
|
rating: number;
|
|
123
|
-
reviews:
|
|
124
|
-
|
|
125
|
-
isPublic: boolean;
|
|
126
|
-
rating: number;
|
|
127
|
-
createdAt: Date;
|
|
128
|
-
reservationId: string;
|
|
129
|
-
externalId: string;
|
|
130
|
-
platform: UnitReviewPlatform;
|
|
131
|
-
guest: GuestDocument;
|
|
132
|
-
categories: {
|
|
133
|
-
name: UnitReviewCategory;
|
|
134
|
-
rating: number;
|
|
135
|
-
}[];
|
|
136
|
-
}[];
|
|
156
|
+
reviews: UnitReview[];
|
|
157
|
+
ratings: UnitRatings;
|
|
137
158
|
salesBlockWarning: string;
|
|
138
159
|
hasOpenExtensionLink: boolean;
|
|
139
160
|
lengthOfStayType: 'monthly' | 'hybrid' | 'nightly';
|
|
@@ -38,6 +38,15 @@ exports.TAX_QUANTIFIERS = {
|
|
|
38
38
|
PER_STAY: 'PER_STAY',
|
|
39
39
|
PER_NIGHT: 'PER_NIGHT'
|
|
40
40
|
};
|
|
41
|
+
const ratingBucketSchema = new mongoose_1.default.Schema({
|
|
42
|
+
rating: { type: Number, required: true, default: 0 },
|
|
43
|
+
count: { type: Number, required: true, default: 0 }
|
|
44
|
+
}, { _id: false });
|
|
45
|
+
const ratingsByWindowSchema = new mongoose_1.default.Schema({
|
|
46
|
+
allTime: { type: ratingBucketSchema, required: true, default: () => ({}) },
|
|
47
|
+
last6Months: { type: ratingBucketSchema, required: true, default: () => ({}) },
|
|
48
|
+
last3Reviews: { type: ratingBucketSchema, required: true, default: () => ({}) }
|
|
49
|
+
}, { _id: false });
|
|
41
50
|
const schema = new mongoose_1.default.Schema({
|
|
42
51
|
name: { type: String, required: true },
|
|
43
52
|
code: { type: Number, required: true },
|
|
@@ -163,7 +172,10 @@ const schema = new mongoose_1.default.Schema({
|
|
|
163
172
|
{
|
|
164
173
|
body: { type: String, required: true },
|
|
165
174
|
isPublic: { type: Boolean, required: true },
|
|
175
|
+
isPublicOnChannel: { type: Boolean, required: false },
|
|
166
176
|
rating: { type: Number, required: true },
|
|
177
|
+
nativeRating: { type: Number, required: false },
|
|
178
|
+
nativeScale: { type: Number, enum: [5, 10], required: false },
|
|
167
179
|
createdAt: { type: Date, required: true },
|
|
168
180
|
reservationId: { type: String, required: true },
|
|
169
181
|
externalId: { type: String, required: true },
|
|
@@ -184,6 +196,16 @@ const schema = new mongoose_1.default.Schema({
|
|
|
184
196
|
required: false,
|
|
185
197
|
_id: false
|
|
186
198
|
},
|
|
199
|
+
ratings: {
|
|
200
|
+
type: new mongoose_1.default.Schema({
|
|
201
|
+
all: { type: ratingsByWindowSchema, required: true, default: () => ({}) },
|
|
202
|
+
airbnb: { type: ratingsByWindowSchema, required: true, default: () => ({}) },
|
|
203
|
+
booking: { type: ratingsByWindowSchema, required: true, default: () => ({}) },
|
|
204
|
+
vrbo: { type: ratingsByWindowSchema, required: true, default: () => ({}) }
|
|
205
|
+
}, { _id: false }),
|
|
206
|
+
required: false,
|
|
207
|
+
default: () => ({})
|
|
208
|
+
},
|
|
187
209
|
salesBlockWarning: { type: String, required: false },
|
|
188
210
|
hasOpenExtensionLink: { type: Boolean, required: false },
|
|
189
211
|
lengthOfStayType: { type: String, required: false },
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Consolidated shape of a Guesty reservation, merged from every variation
|
|
3
|
+
* previously duplicated across the booking-engine subprojects
|
|
4
|
+
* (pay, quotes, extensions, admin, sync).
|
|
5
|
+
*
|
|
6
|
+
* Fields are required when every variation had them as required,
|
|
7
|
+
* and optional when at least one variation marked them optional OR
|
|
8
|
+
* when Guesty only returns them for specific `?fields=` queries.
|
|
9
|
+
*/
|
|
10
|
+
export interface GuestyReservationCurrency {
|
|
11
|
+
rate?: number;
|
|
12
|
+
rateDate?: string;
|
|
13
|
+
from?: string;
|
|
14
|
+
to?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface GuestyReservationChannelCommission {
|
|
17
|
+
manual?: any[];
|
|
18
|
+
}
|
|
19
|
+
export interface GuestyReservationSettingsSnapshot {
|
|
20
|
+
currency?: GuestyReservationCurrency;
|
|
21
|
+
monthlyPriceFactor?: number;
|
|
22
|
+
weeklyPriceFactor?: number;
|
|
23
|
+
taxes?: any[];
|
|
24
|
+
additionalFees?: any[];
|
|
25
|
+
markup?: any | null;
|
|
26
|
+
channelCommission?: GuestyReservationChannelCommission;
|
|
27
|
+
useAccountRevenueShare?: boolean;
|
|
28
|
+
useAccountAdditionalFees?: boolean;
|
|
29
|
+
guestsIncludedInRegularFee?: number;
|
|
30
|
+
extraPersonFee?: number;
|
|
31
|
+
cleaningFee?: number;
|
|
32
|
+
}
|
|
33
|
+
export interface GuestyReservationInvoiceItem {
|
|
34
|
+
_id?: string;
|
|
35
|
+
type?: string;
|
|
36
|
+
normalType?: string;
|
|
37
|
+
title: string;
|
|
38
|
+
amount: number;
|
|
39
|
+
isLocked?: boolean;
|
|
40
|
+
currency?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface GuestyReservationChargebacksData {
|
|
43
|
+
chargebacks?: any[];
|
|
44
|
+
}
|
|
45
|
+
export interface GuestyReservationRefund {
|
|
46
|
+
status: string;
|
|
47
|
+
amount: number;
|
|
48
|
+
}
|
|
49
|
+
export interface GuestyReservationPayment {
|
|
50
|
+
_id: string;
|
|
51
|
+
paymentMethodStatus?: string;
|
|
52
|
+
isAuthorizationHold?: boolean;
|
|
53
|
+
status: string;
|
|
54
|
+
chargebacksData?: GuestyReservationChargebacksData;
|
|
55
|
+
paymentMethodId?: string;
|
|
56
|
+
amount: number;
|
|
57
|
+
shouldBePaidAt?: string;
|
|
58
|
+
currency?: string;
|
|
59
|
+
guestId?: string;
|
|
60
|
+
refunds?: GuestyReservationRefund[];
|
|
61
|
+
authorizationHoldCaptures?: any[];
|
|
62
|
+
createdAt?: string;
|
|
63
|
+
attempts?: any[];
|
|
64
|
+
receiptTargets?: any[];
|
|
65
|
+
paidAt?: string;
|
|
66
|
+
receiptId?: number;
|
|
67
|
+
}
|
|
68
|
+
export interface GuestyMoney {
|
|
69
|
+
_id?: string;
|
|
70
|
+
settingsSnapshot?: GuestyReservationSettingsSnapshot;
|
|
71
|
+
channelCommissionRules?: any | null;
|
|
72
|
+
paymentProviderIds?: string[];
|
|
73
|
+
altered?: boolean;
|
|
74
|
+
invoiceItems?: GuestyReservationInvoiceItem[];
|
|
75
|
+
payments?: GuestyReservationPayment[];
|
|
76
|
+
autoPaymentsPolicy?: any[];
|
|
77
|
+
transientOccupancyTax?: number;
|
|
78
|
+
hostOriginalPayout?: number;
|
|
79
|
+
fareAccommodation?: number;
|
|
80
|
+
hostServiceFee?: number;
|
|
81
|
+
fareCleaning?: number;
|
|
82
|
+
currency?: string;
|
|
83
|
+
version?: number;
|
|
84
|
+
fareAccommodationAdjustment?: number;
|
|
85
|
+
fareAccommodationDiscount?: number;
|
|
86
|
+
fareAccommodationAdjusted?: number;
|
|
87
|
+
hostServiceFeeTax?: number;
|
|
88
|
+
hostServiceFeeIncTax?: number;
|
|
89
|
+
totalFees?: number;
|
|
90
|
+
subTotalPrice: number;
|
|
91
|
+
hostPayout?: number;
|
|
92
|
+
hostPayoutUsd?: number;
|
|
93
|
+
totalTaxes: number;
|
|
94
|
+
useAccountRevenueShare?: boolean;
|
|
95
|
+
netIncomeFormula?: string;
|
|
96
|
+
netIncome?: number;
|
|
97
|
+
commissionFormula?: string;
|
|
98
|
+
commission?: number;
|
|
99
|
+
commissionTaxPercentage?: number;
|
|
100
|
+
commissionTax?: number;
|
|
101
|
+
commissionIncTax?: number;
|
|
102
|
+
ownerRevenueFormula?: string;
|
|
103
|
+
ownerRevenue?: number;
|
|
104
|
+
currencyConversionRateToAccount?: number;
|
|
105
|
+
fareAccommodationBundleFeesApplied?: number;
|
|
106
|
+
platform?: string;
|
|
107
|
+
reservationId?: string;
|
|
108
|
+
bundledFees?: any[];
|
|
109
|
+
createdAt?: string;
|
|
110
|
+
updatedAt?: string;
|
|
111
|
+
balanceDue: number;
|
|
112
|
+
isFullyPaid?: boolean;
|
|
113
|
+
paymentsDue?: number;
|
|
114
|
+
totalRefunded?: number;
|
|
115
|
+
totalPaid: number;
|
|
116
|
+
isTouchedPayments?: boolean;
|
|
117
|
+
}
|
|
118
|
+
export interface GuestyReservationListing {
|
|
119
|
+
_id: string;
|
|
120
|
+
picture?: {
|
|
121
|
+
thumbnail?: string;
|
|
122
|
+
};
|
|
123
|
+
prices?: {
|
|
124
|
+
currency?: string;
|
|
125
|
+
};
|
|
126
|
+
type?: string;
|
|
127
|
+
nickname?: string;
|
|
128
|
+
title?: string;
|
|
129
|
+
address?: {
|
|
130
|
+
full?: string;
|
|
131
|
+
};
|
|
132
|
+
timezone?: string;
|
|
133
|
+
defaultCheckInTime?: string;
|
|
134
|
+
}
|
|
135
|
+
export interface GuestyReservationNumberOfGuests {
|
|
136
|
+
numberOfAdults?: number;
|
|
137
|
+
numberOfChildren?: number;
|
|
138
|
+
numberOfInfants?: number;
|
|
139
|
+
numberOfPets?: number;
|
|
140
|
+
}
|
|
141
|
+
export interface GuestyReservationGuest {
|
|
142
|
+
_id: string;
|
|
143
|
+
phone?: string;
|
|
144
|
+
fullName?: string;
|
|
145
|
+
lastName?: string;
|
|
146
|
+
firstName?: string;
|
|
147
|
+
email?: string;
|
|
148
|
+
}
|
|
149
|
+
export interface GuestyReservationIntegration {
|
|
150
|
+
platform?: string;
|
|
151
|
+
}
|
|
152
|
+
export interface GuestyReservationBlockDayFlag {
|
|
153
|
+
blockDay?: boolean;
|
|
154
|
+
}
|
|
155
|
+
export interface GuestyReservation {
|
|
156
|
+
_id: string;
|
|
157
|
+
manuallyCreated?: boolean;
|
|
158
|
+
creationInfo?: any | null;
|
|
159
|
+
listingId: string;
|
|
160
|
+
confirmationCode?: string;
|
|
161
|
+
checkIn?: string;
|
|
162
|
+
checkInDateLocalized: string;
|
|
163
|
+
nightsCount: number;
|
|
164
|
+
guestsCount?: number;
|
|
165
|
+
cancellationPolicy?: string;
|
|
166
|
+
checkOut?: string;
|
|
167
|
+
checkOutDateLocalized: string;
|
|
168
|
+
source?: string;
|
|
169
|
+
listing: GuestyReservationListing;
|
|
170
|
+
numberOfGuests?: GuestyReservationNumberOfGuests;
|
|
171
|
+
plannedArrival?: string;
|
|
172
|
+
plannedDeparture?: string;
|
|
173
|
+
status: string;
|
|
174
|
+
guest: GuestyReservationGuest;
|
|
175
|
+
money: GuestyMoney;
|
|
176
|
+
accountId?: string;
|
|
177
|
+
importedAt?: string;
|
|
178
|
+
guestId?: string;
|
|
179
|
+
isReturningGuest?: boolean;
|
|
180
|
+
confirmedAt?: string;
|
|
181
|
+
createdAt?: string;
|
|
182
|
+
pendingTasks?: any[];
|
|
183
|
+
customFields?: any[];
|
|
184
|
+
integration?: GuestyReservationIntegration;
|
|
185
|
+
earlyCheckIn?: GuestyReservationBlockDayFlag;
|
|
186
|
+
lateCheckOut?: GuestyReservationBlockDayFlag;
|
|
187
|
+
reservedAt?: string;
|
|
188
|
+
reservedExpiresAt?: string;
|
|
189
|
+
createdBy?: string;
|
|
190
|
+
browserCheckIn?: string;
|
|
191
|
+
browserCheckOut?: string;
|
|
192
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Consolidated shape of a Guesty reservation, merged from every variation
|
|
4
|
+
* previously duplicated across the booking-engine subprojects
|
|
5
|
+
* (pay, quotes, extensions, admin, sync).
|
|
6
|
+
*
|
|
7
|
+
* Fields are required when every variation had them as required,
|
|
8
|
+
* and optional when at least one variation marked them optional OR
|
|
9
|
+
* when Guesty only returns them for specific `?fields=` queries.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
subTotalPrice: number;
|
|
3
|
-
totalTaxes: number;
|
|
4
|
-
[key: string]: any;
|
|
5
|
-
}
|
|
1
|
+
import { GuestyMoney } from '../types/guesty-reservation';
|
|
6
2
|
/**
|
|
7
3
|
* Calculates the true Guesty reservation total including taxes.
|
|
8
4
|
* Guesty's `subTotalPrice` excludes taxes, so this adds `totalTaxes` to get the full amount.
|