@open-tender/store 1.1.274 → 1.1.275

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