@open-tender/store 1.1.273 → 1.1.274

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,22 @@ 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, _c;
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 _b = (0, hooks_1.useAppSelector)(slices_1.selectKioskConfig), config = _b.reward, cardConfig = _b.card;
13
+ var _d = (0, hooks_1.useAppSelector)(slices_1.selectKioskConfig), config = _d.reward, cardConfig = _d.card;
13
14
  var check = (0, hooks_1.useAppSelector)(slices_1.selectPosCheckout).check;
14
- var discountIdIndexMap = new Map(check === null || check === void 0 ? void 0 : check.discounts.map(function (item, index) { return [item.id, index]; }));
15
+ var discountIdIndicesMap = new Map();
16
+ check === null || check === void 0 ? void 0 : check.discounts.forEach(function (item, index) {
17
+ var _a;
18
+ if (!discountIdIndicesMap.has(item.id)) {
19
+ discountIdIndicesMap.set(item.id, []);
20
+ }
21
+ (_a = discountIdIndicesMap.get(item.id)) === null || _a === void 0 ? void 0 : _a.push(index);
22
+ });
15
23
  var id = reward.discount_id;
16
- var isApplied = discountIdIndexMap.get(id) === index;
24
+ var isApplied = (_c = (_b = discountIdIndicesMap.get(id)) === null || _b === void 0 ? void 0 : _b.includes(index)) !== null && _c !== void 0 ? _c : false;
17
25
  var apply = function () {
18
26
  dispatch((0, slices_1.addDiscount)({ id: id, index: index }));
19
27
  if (callback)
@@ -3,14 +3,22 @@ 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, _c;
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 _b = useAppSelector(selectKioskConfig), config = _b.reward, cardConfig = _b.card;
10
+ var _d = useAppSelector(selectKioskConfig), config = _d.reward, cardConfig = _d.card;
10
11
  var check = useAppSelector(selectPosCheckout).check;
11
- var discountIdIndexMap = new Map(check === null || check === void 0 ? void 0 : check.discounts.map(function (item, index) { return [item.id, index]; }));
12
+ var discountIdIndicesMap = new Map();
13
+ check === null || check === void 0 ? void 0 : check.discounts.forEach(function (item, index) {
14
+ var _a;
15
+ if (!discountIdIndicesMap.has(item.id)) {
16
+ discountIdIndicesMap.set(item.id, []);
17
+ }
18
+ (_a = discountIdIndicesMap.get(item.id)) === null || _a === void 0 ? void 0 : _a.push(index);
19
+ });
12
20
  var id = reward.discount_id;
13
- var isApplied = discountIdIndexMap.get(id) === index;
21
+ var isApplied = (_c = (_b = discountIdIndicesMap.get(id)) === null || _b === void 0 ? void 0 : _b.includes(index)) !== null && _c !== void 0 ? _c : false;
14
22
  var apply = function () {
15
23
  dispatch(addDiscount({ id: id, index: index }));
16
24
  if (callback)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/store",
3
- "version": "1.1.273",
3
+ "version": "1.1.274",
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",