@open-tender/store 1.1.129 → 1.1.131
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/cjs/components/CategoryItem.js +3 -1
- package/dist/cjs/components/CategoryNav.js +5 -4
- package/dist/cjs/hooks/useBarcode.js +10 -7
- package/dist/esm/components/CategoryItem.js +4 -2
- package/dist/esm/components/CategoryNav.js +6 -5
- package/dist/esm/hooks/useBarcode.js +10 -7
- package/package.json +2 -2
|
@@ -9,6 +9,7 @@ var CategoryItem = function (_a) {
|
|
|
9
9
|
var dispatch = (0, hooks_1.useAppDispatch)();
|
|
10
10
|
var apiUrl = (0, hooks_1.useAppSelector)(slices_1.selectKioskApi);
|
|
11
11
|
var categoryItem = (0, hooks_1.useAppSelector)(slices_1.selectKioskConfig).categoryItem;
|
|
12
|
+
var display_cals = (0, hooks_1.useAppSelector)(slices_1.selectStoreSettings).display_cals;
|
|
12
13
|
var soldOut = (0, hooks_1.useAppSelector)(slices_1.selectMenu).soldOut;
|
|
13
14
|
var cartCounts = (0, hooks_1.useAppSelector)(slices_1.selectCartCounts);
|
|
14
15
|
var hasPoints = false;
|
|
@@ -28,7 +29,8 @@ var CategoryItem = function (_a) {
|
|
|
28
29
|
config: categoryItem,
|
|
29
30
|
handlers: handlers,
|
|
30
31
|
apiUrl: apiUrl,
|
|
31
|
-
placeholder: placeholder
|
|
32
|
+
placeholder: placeholder,
|
|
33
|
+
displayCals: display_cals
|
|
32
34
|
});
|
|
33
35
|
};
|
|
34
36
|
exports.default = CategoryItem;
|
|
@@ -8,17 +8,18 @@ var CategoryNavItem_1 = tslib_1.__importDefault(require("./CategoryNavItem"));
|
|
|
8
8
|
var CategoryNavOther_1 = tslib_1.__importDefault(require("./CategoryNavOther"));
|
|
9
9
|
var CategoryNav = function (_a) {
|
|
10
10
|
var children = _a.children, navigate = _a.navigate, CategoryNavOtherView = _a.CategoryNavOtherView, CategoryNavItemView = _a.CategoryNavItemView;
|
|
11
|
+
var _b = (0, hooks_1.useAppSelector)(slices_1.selectStoreSettings), display_featured = _b.display_featured, display_favorites = _b.display_favorites, display_recents = _b.display_recents;
|
|
11
12
|
var customer = ((0, hooks_1.useAppSelector)(slices_1.selectCustomerIdentified) || {}).customer;
|
|
12
13
|
var categoryNav = (0, hooks_1.useAppSelector)(slices_1.selectKioskConfig).categoryNav;
|
|
13
|
-
var
|
|
14
|
-
var favorites = customer ? rest.favorites : [];
|
|
15
|
-
var recents = customer ? rest.recents : [];
|
|
14
|
+
var _c = (0, hooks_1.useAppSelector)(slices_1.selectMenu), categories = _c.categories, featured = _c.featured, rest = tslib_1.__rest(_c, ["categories", "featured"]);
|
|
15
|
+
var favorites = customer && display_favorites ? rest.favorites : [];
|
|
16
|
+
var recents = customer && display_recents ? rest.recents : [];
|
|
16
17
|
var renderCategoryNavOther = (0, react_1.useCallback)(function (title, path) { return (react_1.default.createElement(CategoryNavOther_1.default, { navigate: navigate, title: title, path: path, children: CategoryNavOtherView })); }, [navigate, CategoryNavOtherView]);
|
|
17
18
|
var renderCategoryNavItem = (0, react_1.useCallback)(function (item) { return (react_1.default.createElement(CategoryNavItem_1.default, { key: item.id, navigate: navigate, category: item, children: CategoryNavItemView })); }, [navigate, CategoryNavItemView]);
|
|
18
19
|
return children({
|
|
19
20
|
config: categoryNav,
|
|
20
21
|
categories: categories,
|
|
21
|
-
featured: featured,
|
|
22
|
+
featured: display_featured ? featured : [],
|
|
22
23
|
favorites: favorites,
|
|
23
24
|
recents: recents,
|
|
24
25
|
renderCategoryNavOther: renderCategoryNavOther,
|
|
@@ -13,24 +13,28 @@ var useBarcode = function (api) {
|
|
|
13
13
|
};
|
|
14
14
|
}, []);
|
|
15
15
|
var read = (0, react_1.useCallback)(function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
16
|
-
var
|
|
16
|
+
var response, err_1, detail;
|
|
17
17
|
return tslib_1.__generator(this, function (_a) {
|
|
18
18
|
switch (_a.label) {
|
|
19
19
|
case 0:
|
|
20
20
|
_a.trys.push([0, 2, , 3]);
|
|
21
21
|
return [4 /*yield*/, api.getBarcodeRead()];
|
|
22
22
|
case 1:
|
|
23
|
-
|
|
23
|
+
response = _a.sent();
|
|
24
24
|
if (!isAborted.current) {
|
|
25
|
-
|
|
25
|
+
if (response) {
|
|
26
|
+
setCode(response.data);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
setError('Read timed out');
|
|
30
|
+
}
|
|
26
31
|
}
|
|
27
32
|
return [3 /*break*/, 3];
|
|
28
33
|
case 2:
|
|
29
34
|
err_1 = _a.sent();
|
|
30
|
-
console.log('read error', err_1);
|
|
31
35
|
if (!isAborted.current) {
|
|
32
36
|
detail = (0, utils_1.handleRespError)(err_1).detail;
|
|
33
|
-
setError(detail || '
|
|
37
|
+
setError(detail || 'Unknown error');
|
|
34
38
|
}
|
|
35
39
|
return [3 /*break*/, 3];
|
|
36
40
|
case 3: return [2 /*return*/];
|
|
@@ -49,10 +53,9 @@ var useBarcode = function (api) {
|
|
|
49
53
|
return [3 /*break*/, 3];
|
|
50
54
|
case 2:
|
|
51
55
|
err_2 = _a.sent();
|
|
52
|
-
console.log('cancel error', err_2);
|
|
53
56
|
if (!isAborted.current) {
|
|
54
57
|
detail = (0, utils_1.handleRespError)(err_2).detail;
|
|
55
|
-
setError(detail || '
|
|
58
|
+
setError(detail || 'Unknown error');
|
|
56
59
|
}
|
|
57
60
|
return [3 /*break*/, 3];
|
|
58
61
|
case 3: return [2 /*return*/];
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { __assign } from "tslib";
|
|
2
2
|
import { makeOrderItem, rehydrateOrderItem, useOrderItem } from '@open-tender/utils';
|
|
3
3
|
import { useAppDispatch, useAppSelector } from '../app/hooks';
|
|
4
|
-
import { selectCartCounts, selectKioskApi, selectKioskConfig, selectMenu, setCurrentItem } from '../slices';
|
|
4
|
+
import { selectCartCounts, selectKioskApi, selectKioskConfig, selectMenu, selectStoreSettings, setCurrentItem } from '../slices';
|
|
5
5
|
var CategoryItem = function (_a) {
|
|
6
6
|
var item = _a.item, favorite = _a.favorite, allergenAlerts = _a.allergenAlerts, placeholder = _a.placeholder, navigate = _a.navigate, children = _a.children;
|
|
7
7
|
var dispatch = useAppDispatch();
|
|
8
8
|
var apiUrl = useAppSelector(selectKioskApi);
|
|
9
9
|
var categoryItem = useAppSelector(selectKioskConfig).categoryItem;
|
|
10
|
+
var display_cals = useAppSelector(selectStoreSettings).display_cals;
|
|
10
11
|
var soldOut = useAppSelector(selectMenu).soldOut;
|
|
11
12
|
var cartCounts = useAppSelector(selectCartCounts);
|
|
12
13
|
var hasPoints = false;
|
|
@@ -26,7 +27,8 @@ var CategoryItem = function (_a) {
|
|
|
26
27
|
config: categoryItem,
|
|
27
28
|
handlers: handlers,
|
|
28
29
|
apiUrl: apiUrl,
|
|
29
|
-
placeholder: placeholder
|
|
30
|
+
placeholder: placeholder,
|
|
31
|
+
displayCals: display_cals
|
|
30
32
|
});
|
|
31
33
|
};
|
|
32
34
|
export default CategoryItem;
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import React, { useCallback } from 'react';
|
|
3
3
|
import { useAppSelector } from '../app/hooks';
|
|
4
|
-
import { selectCustomerIdentified, selectKioskConfig, selectMenu } from '../slices';
|
|
4
|
+
import { selectCustomerIdentified, selectKioskConfig, selectMenu, selectStoreSettings } from '../slices';
|
|
5
5
|
import { default as CategoryNavItemContainer } from './CategoryNavItem';
|
|
6
6
|
import { default as CategoryNavOtherContainer } from './CategoryNavOther';
|
|
7
7
|
var CategoryNav = function (_a) {
|
|
8
8
|
var children = _a.children, navigate = _a.navigate, CategoryNavOtherView = _a.CategoryNavOtherView, CategoryNavItemView = _a.CategoryNavItemView;
|
|
9
|
+
var _b = useAppSelector(selectStoreSettings), display_featured = _b.display_featured, display_favorites = _b.display_favorites, display_recents = _b.display_recents;
|
|
9
10
|
var customer = (useAppSelector(selectCustomerIdentified) || {}).customer;
|
|
10
11
|
var categoryNav = useAppSelector(selectKioskConfig).categoryNav;
|
|
11
|
-
var
|
|
12
|
-
var favorites = customer ? rest.favorites : [];
|
|
13
|
-
var recents = customer ? rest.recents : [];
|
|
12
|
+
var _c = useAppSelector(selectMenu), categories = _c.categories, featured = _c.featured, rest = __rest(_c, ["categories", "featured"]);
|
|
13
|
+
var favorites = customer && display_favorites ? rest.favorites : [];
|
|
14
|
+
var recents = customer && display_recents ? rest.recents : [];
|
|
14
15
|
var renderCategoryNavOther = useCallback(function (title, path) { return (React.createElement(CategoryNavOtherContainer, { navigate: navigate, title: title, path: path, children: CategoryNavOtherView })); }, [navigate, CategoryNavOtherView]);
|
|
15
16
|
var renderCategoryNavItem = useCallback(function (item) { return (React.createElement(CategoryNavItemContainer, { key: item.id, navigate: navigate, category: item, children: CategoryNavItemView })); }, [navigate, CategoryNavItemView]);
|
|
16
17
|
return children({
|
|
17
18
|
config: categoryNav,
|
|
18
19
|
categories: categories,
|
|
19
|
-
featured: featured,
|
|
20
|
+
featured: display_featured ? featured : [],
|
|
20
21
|
favorites: favorites,
|
|
21
22
|
recents: recents,
|
|
22
23
|
renderCategoryNavOther: renderCategoryNavOther,
|
|
@@ -11,24 +11,28 @@ var useBarcode = function (api) {
|
|
|
11
11
|
};
|
|
12
12
|
}, []);
|
|
13
13
|
var read = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
14
|
-
var
|
|
14
|
+
var response, err_1, detail;
|
|
15
15
|
return __generator(this, function (_a) {
|
|
16
16
|
switch (_a.label) {
|
|
17
17
|
case 0:
|
|
18
18
|
_a.trys.push([0, 2, , 3]);
|
|
19
19
|
return [4 /*yield*/, api.getBarcodeRead()];
|
|
20
20
|
case 1:
|
|
21
|
-
|
|
21
|
+
response = _a.sent();
|
|
22
22
|
if (!isAborted.current) {
|
|
23
|
-
|
|
23
|
+
if (response) {
|
|
24
|
+
setCode(response.data);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
setError('Read timed out');
|
|
28
|
+
}
|
|
24
29
|
}
|
|
25
30
|
return [3 /*break*/, 3];
|
|
26
31
|
case 2:
|
|
27
32
|
err_1 = _a.sent();
|
|
28
|
-
console.log('read error', err_1);
|
|
29
33
|
if (!isAborted.current) {
|
|
30
34
|
detail = handleRespError(err_1).detail;
|
|
31
|
-
setError(detail || '
|
|
35
|
+
setError(detail || 'Unknown error');
|
|
32
36
|
}
|
|
33
37
|
return [3 /*break*/, 3];
|
|
34
38
|
case 3: return [2 /*return*/];
|
|
@@ -47,10 +51,9 @@ var useBarcode = function (api) {
|
|
|
47
51
|
return [3 /*break*/, 3];
|
|
48
52
|
case 2:
|
|
49
53
|
err_2 = _a.sent();
|
|
50
|
-
console.log('cancel error', err_2);
|
|
51
54
|
if (!isAborted.current) {
|
|
52
55
|
detail = handleRespError(err_2).detail;
|
|
53
|
-
setError(detail || '
|
|
56
|
+
setError(detail || 'Unknown error');
|
|
54
57
|
}
|
|
55
58
|
return [3 /*break*/, 3];
|
|
56
59
|
case 3: return [2 /*return*/];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/store",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.131",
|
|
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",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@emotion/react": "^11.11.1",
|
|
64
64
|
"@open-tender/types": "^0.4.63",
|
|
65
|
-
"@open-tender/ui": "^0.3.
|
|
65
|
+
"@open-tender/ui": "^0.3.94",
|
|
66
66
|
"@open-tender/utils": "^0.4.39",
|
|
67
67
|
"@reduxjs/toolkit": "^2.0.1",
|
|
68
68
|
"date-fns": "2.30.0",
|