@escapenavigator/utils 1.10.39 → 1.10.41
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/dist/tz-date.js
CHANGED
|
@@ -13,6 +13,8 @@ const convertDateToZonedDate = ({ date, timeZone, time, offset, }) => {
|
|
|
13
13
|
};
|
|
14
14
|
exports.convertDateToZonedDate = convertDateToZonedDate;
|
|
15
15
|
const convertUTCDateToZonedDate = ({ date, timeZone, offset = 0, format = 'dd.MM.yyyy, HH:mm', showTZ = false, }) => {
|
|
16
|
+
if (!date)
|
|
17
|
+
return '';
|
|
16
18
|
const d = (0, date_fns_tz_1.utcToZonedTime)(date, timeZone);
|
|
17
19
|
const dt = (0, date_fns_1.addHours)(d, offset);
|
|
18
20
|
const res = (0, date_fns_1.format)(dt, format);
|
|
@@ -15,9 +15,10 @@ type Order = {
|
|
|
15
15
|
timeZone: string;
|
|
16
16
|
type: 'order';
|
|
17
17
|
};
|
|
18
|
-
export declare function validatePromocode({ promocode, players, questroomId, timeZone, orderDate, hasCertificates, otherPromocodes, isInside, type, }: {
|
|
18
|
+
export declare function validatePromocode({ promocode, players, questroomId, timeZone, orderDate, hasCertificates, otherPromocodes, slotDiscount, isInside, type, }: {
|
|
19
19
|
promocode: PromocodeRO;
|
|
20
20
|
isInside: boolean;
|
|
21
|
+
slotDiscount: number;
|
|
21
22
|
otherPromocodes: Array<{
|
|
22
23
|
canUseWithOtherPromocodes: boolean;
|
|
23
24
|
code: string;
|
|
@@ -7,7 +7,7 @@ function getWeekdayNumber(date) {
|
|
|
7
7
|
const day = new Date(date).getDay();
|
|
8
8
|
return (day === 0 ? 7 : day) - 1;
|
|
9
9
|
}
|
|
10
|
-
function validatePromocode({ promocode, players, questroomId, timeZone, orderDate, hasCertificates, otherPromocodes, isInside, type, }) {
|
|
10
|
+
function validatePromocode({ promocode, players, questroomId, timeZone, orderDate, hasCertificates, otherPromocodes, slotDiscount, isInside, type, }) {
|
|
11
11
|
const errors = [];
|
|
12
12
|
const orderDateInTimeZone = type === 'order' && (0, date_fns_tz_1.utcToZonedTime)(new Date(orderDate).toISOString(), timeZone);
|
|
13
13
|
const currentDate = type === 'order' && (0, date_fns_1.format)(orderDateInTimeZone, 'yyyy-MM-dd');
|
|
@@ -35,8 +35,8 @@ function validatePromocode({ promocode, players, questroomId, timeZone, orderDat
|
|
|
35
35
|
else if (promocode.applyings > 0) {
|
|
36
36
|
errors.push('The promocode can only be used once.');
|
|
37
37
|
}
|
|
38
|
-
if (!promocode.canUseWithOtherPromocodes && otherPromocodes.length) {
|
|
39
|
-
errors.push('The promocode cannot be used with other promocodes.');
|
|
38
|
+
if (!promocode.canUseWithOtherPromocodes && (otherPromocodes.length || slotDiscount)) {
|
|
39
|
+
errors.push('The promocode cannot be used with other promocodes or discounts.');
|
|
40
40
|
}
|
|
41
41
|
if (!promocode.canUseWithOtherCertificates && hasCertificates) {
|
|
42
42
|
errors.push('The promocode cannot be used with other certificates.');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@escapenavigator/utils",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.41",
|
|
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.
|
|
17
|
+
"@escapenavigator/types": "^1.10.37",
|
|
18
18
|
"axios": "^0.21.4",
|
|
19
19
|
"class-transformer": "^0.5.1",
|
|
20
20
|
"class-validator": "^0.13.2",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"utility-types": "^3.10.0",
|
|
48
48
|
"uuid": "^8.3.2"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "aabf60144b705a756b1f228d5f2702d1021274f1"
|
|
51
51
|
}
|