@open-tender/store 1.1.276 → 1.1.277
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.
|
@@ -6,14 +6,17 @@ var hooks_1 = require("../app/hooks");
|
|
|
6
6
|
var slices_1 = require("../slices");
|
|
7
7
|
var Applied_1 = tslib_1.__importDefault(require("./Applied"));
|
|
8
8
|
var Reward = function (_a) {
|
|
9
|
+
var _b;
|
|
9
10
|
var reward = _a.reward, isLast = _a.isLast, index = _a.index, callback = _a.callback, children = _a.children, AppliedView = _a.AppliedView;
|
|
10
11
|
var dispatch = (0, hooks_1.useAppDispatch)();
|
|
11
12
|
var apiUrl = (0, hooks_1.useAppSelector)(slices_1.selectKioskApi);
|
|
12
|
-
var
|
|
13
|
+
var _c = (0, hooks_1.useAppSelector)(slices_1.selectKioskConfig), config = _c.reward, cardConfig = _c.card;
|
|
13
14
|
var check = (0, hooks_1.useAppSelector)(slices_1.selectPosCheckout).check;
|
|
14
|
-
var discounts = check === null || check === void 0 ? void 0 : check.discounts
|
|
15
|
+
var discounts = check === null || check === void 0 ? void 0 : check.discounts;
|
|
15
16
|
var id = reward.discount_id;
|
|
16
|
-
var isApplied =
|
|
17
|
+
var isApplied = (_b = discounts === null || discounts === void 0 ? void 0 : discounts.some(function (discount) {
|
|
18
|
+
return discount.id === id && discount.index === index;
|
|
19
|
+
})) !== null && _b !== void 0 ? _b : false;
|
|
17
20
|
var apply = function () {
|
|
18
21
|
dispatch((0, slices_1.addDiscount)({ id: id, index: index }));
|
|
19
22
|
if (callback)
|
|
@@ -530,7 +530,9 @@ var checkoutSlice = (0, toolkit_1.createSlice)({
|
|
|
530
530
|
}
|
|
531
531
|
else {
|
|
532
532
|
state.discounts = state.discounts.filter(function (item) {
|
|
533
|
-
return item.id !== id &&
|
|
533
|
+
return item.id !== id &&
|
|
534
|
+
item.index !== undefined &&
|
|
535
|
+
item.index !== discountIndex;
|
|
534
536
|
});
|
|
535
537
|
}
|
|
536
538
|
},
|
|
@@ -3,14 +3,17 @@ import { useAppDispatch, useAppSelector } from '../app/hooks';
|
|
|
3
3
|
import { addDiscount, removeDiscount, selectKioskApi, selectKioskConfig, selectPosCheckout } from '../slices';
|
|
4
4
|
import { default as AppliedContainer } from './Applied';
|
|
5
5
|
var Reward = function (_a) {
|
|
6
|
+
var _b;
|
|
6
7
|
var reward = _a.reward, isLast = _a.isLast, index = _a.index, callback = _a.callback, children = _a.children, AppliedView = _a.AppliedView;
|
|
7
8
|
var dispatch = useAppDispatch();
|
|
8
9
|
var apiUrl = useAppSelector(selectKioskApi);
|
|
9
|
-
var
|
|
10
|
+
var _c = useAppSelector(selectKioskConfig), config = _c.reward, cardConfig = _c.card;
|
|
10
11
|
var check = useAppSelector(selectPosCheckout).check;
|
|
11
|
-
var discounts = check === null || check === void 0 ? void 0 : check.discounts
|
|
12
|
+
var discounts = check === null || check === void 0 ? void 0 : check.discounts;
|
|
12
13
|
var id = reward.discount_id;
|
|
13
|
-
var isApplied =
|
|
14
|
+
var isApplied = (_b = discounts === null || discounts === void 0 ? void 0 : discounts.some(function (discount) {
|
|
15
|
+
return discount.id === id && discount.index === index;
|
|
16
|
+
})) !== null && _b !== void 0 ? _b : false;
|
|
14
17
|
var apply = function () {
|
|
15
18
|
dispatch(addDiscount({ id: id, index: index }));
|
|
16
19
|
if (callback)
|
|
@@ -526,7 +526,9 @@ var checkoutSlice = createSlice({
|
|
|
526
526
|
}
|
|
527
527
|
else {
|
|
528
528
|
state.discounts = state.discounts.filter(function (item) {
|
|
529
|
-
return item.id !== id &&
|
|
529
|
+
return item.id !== id &&
|
|
530
|
+
item.index !== undefined &&
|
|
531
|
+
item.index !== discountIndex;
|
|
530
532
|
});
|
|
531
533
|
}
|
|
532
534
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/store",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.277",
|
|
4
4
|
"description": "A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our in-store POS API",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|