@escapenavigator/utils 1.10.15 → 1.10.17

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.
@@ -30,6 +30,7 @@ const getCurrency = (currency) => {
30
30
  [profile_currency_1.ProfileCurrencyEnum.BYN]: '',
31
31
  [profile_currency_1.ProfileCurrencyEnum.UAH]: '',
32
32
  [profile_currency_1.ProfileCurrencyEnum.ISK]: '',
33
+ [profile_currency_1.ProfileCurrencyEnum.ILS]: '₪',
33
34
  };
34
35
  return res[currency] || currency;
35
36
  };
@@ -0,0 +1,11 @@
1
+ import { PromocodeTypeEnum } from '@escapenavigator/types/dist/promocode/emun/promocode-type.enum';
2
+ export declare const getPromocodeDiscount: ({ slotId, slotDiscount, total, promocodeType, promocodeDiscount, price, players, children, }: {
3
+ slotId: number;
4
+ children?: number;
5
+ total: number;
6
+ players: number;
7
+ slotDiscount: number;
8
+ price: Record<any, any>;
9
+ promocodeDiscount: number;
10
+ promocodeType: PromocodeTypeEnum;
11
+ }) => number;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPromocodeDiscount = void 0;
4
+ const promocode_type_enum_1 = require("@escapenavigator/types/dist/promocode/emun/promocode-type.enum");
5
+ const get_players_price_1 = require("./get-players-price");
6
+ const getPromocodeDiscount = ({ slotId, slotDiscount, total, promocodeType, promocodeDiscount, price, players, children = 0, }) => {
7
+ const orderTotal = slotId ? total - slotDiscount : total;
8
+ let amount = 0;
9
+ if (promocodeType === promocode_type_enum_1.PromocodeTypeEnum.FIXED)
10
+ amount = promocodeDiscount;
11
+ if (promocodeType === promocode_type_enum_1.PromocodeTypeEnum.PERCENT_BASE_SUM)
12
+ amount = ((0, get_players_price_1.getPlayersPrice)({ price, children, players }) / 10000) * promocodeDiscount;
13
+ if (promocodeType === promocode_type_enum_1.PromocodeTypeEnum.PERCENT_ALL_SUM)
14
+ amount = (orderTotal / 10000) * promocodeDiscount;
15
+ return amount;
16
+ };
17
+ exports.getPromocodeDiscount = getPromocodeDiscount;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@escapenavigator/utils",
3
- "version": "1.10.15",
3
+ "version": "1.10.17",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -14,7 +14,7 @@
14
14
  "test": "jest"
15
15
  },
16
16
  "dependencies": {
17
- "@escapenavigator/types": "^1.10.15",
17
+ "@escapenavigator/types": "^1.10.17",
18
18
  "axios": "^0.21.4",
19
19
  "class-transformer": "^0.5.1",
20
20
  "class-validator": "^0.13.2",
@@ -55,5 +55,5 @@
55
55
  "node_modules"
56
56
  ]
57
57
  },
58
- "gitHead": "8d6bfcd1771195daf3a2bbda28c9a1a81892c290"
58
+ "gitHead": "509bca68aa045bc70231fefa8e3941c2648cd0e0"
59
59
  }