@vibe-flats/booking-engine-common-server 1.0.17 → 1.0.20
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
CHANGED
package/build/index.js
CHANGED
|
@@ -15,3 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./src/units-models"), exports);
|
|
18
|
+
__exportStar(require("./src/config/app"), exports);
|
|
19
|
+
__exportStar(require("./src/utils/guesty-price"), exports);
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
export declare const COMMON_SERVER: {
|
|
2
|
+
currency: {
|
|
3
|
+
symbol: string;
|
|
4
|
+
code: string;
|
|
5
|
+
};
|
|
6
|
+
formats: {
|
|
7
|
+
date: {
|
|
8
|
+
short: {
|
|
9
|
+
db: string;
|
|
10
|
+
display: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
guesty: {
|
|
15
|
+
fees: {
|
|
16
|
+
utilities: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
hubpost: {
|
|
20
|
+
objectTypes: {
|
|
21
|
+
contact: string;
|
|
22
|
+
ticket: string;
|
|
23
|
+
reservation: string;
|
|
24
|
+
};
|
|
25
|
+
quotes: {
|
|
26
|
+
associations: {
|
|
27
|
+
contact: number;
|
|
28
|
+
unit: number;
|
|
29
|
+
ticket: number;
|
|
30
|
+
quote: number;
|
|
31
|
+
reservation: number;
|
|
32
|
+
};
|
|
33
|
+
types: {
|
|
34
|
+
new: number;
|
|
35
|
+
extension: number;
|
|
36
|
+
};
|
|
37
|
+
pipeline: string;
|
|
38
|
+
stages: {
|
|
39
|
+
open: {
|
|
40
|
+
id: string;
|
|
41
|
+
label: string;
|
|
42
|
+
};
|
|
43
|
+
won: {
|
|
44
|
+
id: string;
|
|
45
|
+
label: string;
|
|
46
|
+
};
|
|
47
|
+
groupWon: {
|
|
48
|
+
id: string;
|
|
49
|
+
label: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
pmsChannels: {
|
|
55
|
+
direct: string;
|
|
56
|
+
};
|
|
57
|
+
stages: {
|
|
58
|
+
inquiry: {
|
|
59
|
+
id: string;
|
|
60
|
+
label: string;
|
|
61
|
+
};
|
|
62
|
+
awaitingDeposit: {
|
|
63
|
+
id: string;
|
|
64
|
+
label: string;
|
|
65
|
+
};
|
|
66
|
+
awaitingKyc: {
|
|
67
|
+
id: string;
|
|
68
|
+
label: string;
|
|
69
|
+
};
|
|
70
|
+
pendingKycApproval: {
|
|
71
|
+
id: string;
|
|
72
|
+
label: string;
|
|
73
|
+
};
|
|
74
|
+
preStay: {
|
|
75
|
+
id: string;
|
|
76
|
+
label: string;
|
|
77
|
+
};
|
|
78
|
+
stay: {
|
|
79
|
+
id: string;
|
|
80
|
+
label: string;
|
|
81
|
+
};
|
|
82
|
+
postStay: {
|
|
83
|
+
id: string;
|
|
84
|
+
label: string;
|
|
85
|
+
};
|
|
86
|
+
inquiryArchive: {
|
|
87
|
+
id: string;
|
|
88
|
+
label: string;
|
|
89
|
+
};
|
|
90
|
+
cancelled: {
|
|
91
|
+
id: string;
|
|
92
|
+
label: string;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.COMMON_SERVER = void 0;
|
|
4
|
+
exports.COMMON_SERVER = {
|
|
5
|
+
currency: {
|
|
6
|
+
symbol: '$',
|
|
7
|
+
code: 'USD'
|
|
8
|
+
},
|
|
9
|
+
formats: {
|
|
10
|
+
date: {
|
|
11
|
+
short: {
|
|
12
|
+
db: 'YYYY-MM-DD',
|
|
13
|
+
display: 'MM/DD/YYYY'
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
guesty: {
|
|
18
|
+
fees: {
|
|
19
|
+
utilities: 'Utilities'
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
hubpost: {
|
|
23
|
+
objectTypes: {
|
|
24
|
+
contact: '0-1',
|
|
25
|
+
ticket: '0-5',
|
|
26
|
+
reservation: '2-30640026'
|
|
27
|
+
},
|
|
28
|
+
quotes: {
|
|
29
|
+
associations: {
|
|
30
|
+
contact: 127,
|
|
31
|
+
unit: 125,
|
|
32
|
+
ticket: 132,
|
|
33
|
+
quote: 131,
|
|
34
|
+
reservation: 129
|
|
35
|
+
},
|
|
36
|
+
types: {
|
|
37
|
+
new: 1,
|
|
38
|
+
extension: 2
|
|
39
|
+
},
|
|
40
|
+
pipeline: '125304116',
|
|
41
|
+
stages: {
|
|
42
|
+
open: {
|
|
43
|
+
id: '219455915',
|
|
44
|
+
label: 'Open'
|
|
45
|
+
},
|
|
46
|
+
won: {
|
|
47
|
+
id: '219455916',
|
|
48
|
+
label: 'Won'
|
|
49
|
+
},
|
|
50
|
+
groupWon: {
|
|
51
|
+
id: '219568457',
|
|
52
|
+
label: 'Group Won'
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
pmsChannels: {
|
|
58
|
+
direct: 'Direct'
|
|
59
|
+
},
|
|
60
|
+
stages: {
|
|
61
|
+
inquiry: {
|
|
62
|
+
id: '190000293',
|
|
63
|
+
label: 'Inquiry'
|
|
64
|
+
},
|
|
65
|
+
awaitingDeposit: {
|
|
66
|
+
id: '190068831',
|
|
67
|
+
label: 'Awaiting Deposit'
|
|
68
|
+
},
|
|
69
|
+
awaitingKyc: {
|
|
70
|
+
id: '205417363',
|
|
71
|
+
label: 'Awaiting KYC'
|
|
72
|
+
},
|
|
73
|
+
pendingKycApproval: {
|
|
74
|
+
id: '205417364',
|
|
75
|
+
label: 'Pending KYC Approval'
|
|
76
|
+
},
|
|
77
|
+
preStay: {
|
|
78
|
+
id: '190068832',
|
|
79
|
+
label: 'Pre Stay'
|
|
80
|
+
},
|
|
81
|
+
stay: {
|
|
82
|
+
id: '190068833',
|
|
83
|
+
label: 'Stay'
|
|
84
|
+
},
|
|
85
|
+
postStay: {
|
|
86
|
+
id: '190000294',
|
|
87
|
+
label: 'Post Stay'
|
|
88
|
+
},
|
|
89
|
+
inquiryArchive: {
|
|
90
|
+
id: '189954565',
|
|
91
|
+
label: 'Inquiry Archive'
|
|
92
|
+
},
|
|
93
|
+
cancelled: {
|
|
94
|
+
id: '190068915',
|
|
95
|
+
label: 'Cancelled'
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AvailabilityDocument } from '../models/availability';
|
|
2
|
+
import { UnitDocument } from '../models/units';
|
|
3
|
+
export declare const guestyPrice: (unit: UnitDocument, stay: AvailabilityDocument[]) => {
|
|
4
|
+
nights: number;
|
|
5
|
+
rent: number;
|
|
6
|
+
cleaning: number;
|
|
7
|
+
utilities: number;
|
|
8
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.guestyPrice = void 0;
|
|
4
|
+
const app_1 = require("../config/app");
|
|
5
|
+
const guestyPrice = (unit, stay) => {
|
|
6
|
+
var _a;
|
|
7
|
+
//
|
|
8
|
+
const nights = stay.length;
|
|
9
|
+
const multiplier = nights >= 30 ? unit.prices.monthlyPriceFactor : 1;
|
|
10
|
+
// Apply multiplier: Guesty's approach to monthly pricing
|
|
11
|
+
const rent = +(stay.reduce((acc, stay) => acc + stay.price, 0) * multiplier).toFixed(0);
|
|
12
|
+
const cleaning = unit.prices.cleaningFee;
|
|
13
|
+
const utilities = (((_a = unit.fees.find(fee => fee.name.trim() === app_1.COMMON_SERVER.guesty.fees.utilities)) === null || _a === void 0 ? void 0 : _a.value) || 0) * nights;
|
|
14
|
+
return { nights, rent, cleaning, utilities };
|
|
15
|
+
};
|
|
16
|
+
exports.guestyPrice = guestyPrice;
|