@vibe-flats/booking-engine-common-server 1.0.122 → 1.0.124

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.
@@ -21,4 +21,5 @@ export declare const vibePrice: (obj: {
21
21
  excludeCleaning?: boolean;
22
22
  excludeUtilities?: boolean;
23
23
  markup?: number;
24
+ forceMonthlyDiscount?: boolean;
24
25
  }) => VibePrice;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.vibePrice = void 0;
4
4
  const monthly_diff_1 = require("./monthly-diff");
5
5
  const vibePrice = (obj) => {
6
- const { unit, stay, excludeCleaning, excludeUtilities, markup } = obj;
6
+ const { unit, stay, excludeCleaning, excludeUtilities, markup, forceMonthlyDiscount } = obj;
7
7
  // Get min and max dates from stay array
8
8
  const sortedStay = [...stay].sort((a, b) => a.date.getTime() - b.date.getTime());
9
9
  const dateFrom = sortedStay[0].date;
@@ -19,7 +19,9 @@ const vibePrice = (obj) => {
19
19
  const cleaning = excludeCleaning ? 0 : unit.prices.cleaningFee;
20
20
  const utilities = excludeUtilities ? 0 : unit.prices.utilities * nights;
21
21
  const subTotal = rent + utilities + cleaning;
22
- const discount = nights >= 30 && unit.prices.monthlyPriceFactor !== 1 ? +(rent * (1 - unit.prices.monthlyPriceFactor)).toFixed(0) : 0;
22
+ const discount = (nights >= 30 || forceMonthlyDiscount) && unit.prices.monthlyPriceFactor !== 1
23
+ ? +(rent * (1 - unit.prices.monthlyPriceFactor)).toFixed(0)
24
+ : 0;
23
25
  const total = subTotal - discount;
24
26
  const monthly = {
25
27
  rent: Math.round(rent / monthsDiff),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibe-flats/booking-engine-common-server",
3
- "version": "1.0.122",
3
+ "version": "1.0.124",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",