@open-tender/store 1.1.203 → 1.1.205
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/CartItem.d.ts +2 -1
- package/dist/cjs/components/CartItem.js +4 -4
- package/dist/cjs/components/CheckoutCart.js +1 -1
- package/dist/cjs/components/ItemSelections.js +2 -0
- package/dist/esm/components/CartItem.d.ts +2 -1
- package/dist/esm/components/CartItem.js +4 -4
- package/dist/esm/components/CheckoutCart.js +1 -1
- package/dist/esm/components/ItemSelections.js +3 -1
- package/package.json +4 -4
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { CartItem as CartItemType } from '@open-tender/types';
|
|
2
2
|
import { CartItemProps, QuantityProps } from '@open-tender/ui';
|
|
3
3
|
import React, { ReactNode } from 'react';
|
|
4
|
-
declare const CartItem: ({ item, isLast, isEditable, navigate, children, QuantityView }: {
|
|
4
|
+
declare const CartItem: ({ item, isLast, isEditable, isCheckout, navigate, children, QuantityView }: {
|
|
5
5
|
item: CartItemType;
|
|
6
6
|
isLast?: boolean;
|
|
7
7
|
isEditable?: boolean;
|
|
8
|
+
isCheckout?: boolean;
|
|
8
9
|
navigate: (route: string) => void;
|
|
9
10
|
children: (props: CartItemProps) => ReactNode;
|
|
10
11
|
QuantityView: (props: QuantityProps) => ReactNode;
|
|
@@ -6,10 +6,10 @@ var hooks_1 = require("../app/hooks");
|
|
|
6
6
|
var slices_1 = require("../slices");
|
|
7
7
|
var Quantity_1 = tslib_1.__importDefault(require("./Quantity"));
|
|
8
8
|
var CartItem = function (_a) {
|
|
9
|
-
var item = _a.item, _b = _a.isLast, isLast = _b === void 0 ? false : _b, _c = _a.isEditable, isEditable = _c === void 0 ? true : _c, navigate = _a.navigate, children = _a.children, QuantityView = _a.QuantityView;
|
|
9
|
+
var item = _a.item, _b = _a.isLast, isLast = _b === void 0 ? false : _b, _c = _a.isEditable, isEditable = _c === void 0 ? true : _c, _d = _a.isCheckout, isCheckout = _d === void 0 ? false : _d, navigate = _a.navigate, children = _a.children, QuantityView = _a.QuantityView;
|
|
10
10
|
var dispatch = (0, hooks_1.useAppDispatch)();
|
|
11
11
|
var apiUrl = (0, hooks_1.useAppSelector)(slices_1.selectKioskApi);
|
|
12
|
-
var
|
|
12
|
+
var _e = (0, hooks_1.useAppSelector)(slices_1.selectKioskConfig), config = _e.cartItem, checkoutCartItem = _e.checkoutCartItem;
|
|
13
13
|
var display_cals = (0, hooks_1.useAppSelector)(slices_1.selectStoreSettings).display_cals;
|
|
14
14
|
var increment = (0, react_1.useCallback)(function () { return dispatch((0, slices_1.incrementItemInCart)(item)); }, [item, dispatch]);
|
|
15
15
|
var decrement = (0, react_1.useCallback)(function () { return dispatch((0, slices_1.decrementItemInCart)(item)); }, [dispatch, item]);
|
|
@@ -20,11 +20,11 @@ var CartItem = function (_a) {
|
|
|
20
20
|
};
|
|
21
21
|
var handlers = { increment: increment, decrement: decrement, edit: edit, remove: remove };
|
|
22
22
|
var renderQuantity = (0, react_1.useCallback)(function (quantity) { return (react_1.default.createElement(Quantity_1.default, { fontSize: 24, iconSize: 28, quantity: quantity, increment: increment, decrement: decrement, children: QuantityView })); }, [increment, decrement, QuantityView]);
|
|
23
|
-
if (!config)
|
|
23
|
+
if (!config || !checkoutCartItem)
|
|
24
24
|
return null;
|
|
25
25
|
return children({
|
|
26
26
|
item: item,
|
|
27
|
-
config: config,
|
|
27
|
+
config: isCheckout && checkoutCartItem ? checkoutCartItem : config,
|
|
28
28
|
handlers: handlers,
|
|
29
29
|
isLast: isLast,
|
|
30
30
|
isEditable: isEditable,
|
|
@@ -8,7 +8,7 @@ var CartItem_1 = tslib_1.__importDefault(require("./CartItem"));
|
|
|
8
8
|
var CheckoutCart = function (_a) {
|
|
9
9
|
var cart = _a.cart, navigate = _a.navigate, children = _a.children, QuantityView = _a.QuantityView, CartItemView = _a.CartItemView;
|
|
10
10
|
var config = (0, hooks_1.useAppSelector)(slices_1.selectKioskConfig).checkoutCart;
|
|
11
|
-
var renderCartItem = (0, react_1.useCallback)(function (item, index) { return (react_1.default.createElement(CartItem_1.default, { QuantityView: QuantityView, navigate: navigate, children: CartItemView, key: "".concat(item.id, "-").concat(index), item: item, isLast: index + 1 === cart.length, isEditable: false })); }, [QuantityView, navigate, CartItemView, cart.length]);
|
|
11
|
+
var renderCartItem = (0, react_1.useCallback)(function (item, index) { return (react_1.default.createElement(CartItem_1.default, { QuantityView: QuantityView, navigate: navigate, children: CartItemView, key: "".concat(item.id, "-").concat(index), item: item, isLast: index + 1 === cart.length, isEditable: false, isCheckout: true })); }, [QuantityView, navigate, CartItemView, cart.length]);
|
|
12
12
|
if (!config)
|
|
13
13
|
return null;
|
|
14
14
|
return children({ config: config, cart: cart, renderCartItem: renderCartItem });
|
|
@@ -9,6 +9,7 @@ var ItemOptionSelected_1 = tslib_1.__importDefault(require("./ItemOptionSelected
|
|
|
9
9
|
var ItemSelections = function (_a) {
|
|
10
10
|
var handlers = _a.handlers, groups = _a.groups, levels = _a.levels, isIncomplete = _a.isIncomplete, children = _a.children, ItemOptionView = _a.ItemOptionView, ErrorMessageView = _a.ErrorMessageView;
|
|
11
11
|
var config = (0, hooks_1.useAppSelector)(slices_1.selectKioskConfig).itemSelections;
|
|
12
|
+
var display_customize = (0, hooks_1.useAppSelector)(slices_1.selectStoreSettings).display_customize;
|
|
12
13
|
var renderErrorMessage = (0, react_1.useCallback)(function (icon, children) { return (react_1.default.createElement(ErrorMessage_1.default, { icon: icon, content: children, children: ErrorMessageView })); }, [ErrorMessageView]);
|
|
13
14
|
var renderItemOption = (0, react_1.useCallback)(function (group, option) { return (react_1.default.createElement(ItemOptionSelected_1.default, { levels: levels, handlers: handlers, group: group, option: option, children: ItemOptionView })); }, [levels, handlers, ItemOptionView]);
|
|
14
15
|
if (!config)
|
|
@@ -17,6 +18,7 @@ var ItemSelections = function (_a) {
|
|
|
17
18
|
config: config,
|
|
18
19
|
groups: groups,
|
|
19
20
|
isIncomplete: isIncomplete,
|
|
21
|
+
isCustomize: display_customize,
|
|
20
22
|
renderErrorMessage: renderErrorMessage,
|
|
21
23
|
renderItemOption: renderItemOption
|
|
22
24
|
});
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { CartItem as CartItemType } from '@open-tender/types';
|
|
2
2
|
import { CartItemProps, QuantityProps } from '@open-tender/ui';
|
|
3
3
|
import React, { ReactNode } from 'react';
|
|
4
|
-
declare const CartItem: ({ item, isLast, isEditable, navigate, children, QuantityView }: {
|
|
4
|
+
declare const CartItem: ({ item, isLast, isEditable, isCheckout, navigate, children, QuantityView }: {
|
|
5
5
|
item: CartItemType;
|
|
6
6
|
isLast?: boolean;
|
|
7
7
|
isEditable?: boolean;
|
|
8
|
+
isCheckout?: boolean;
|
|
8
9
|
navigate: (route: string) => void;
|
|
9
10
|
children: (props: CartItemProps) => ReactNode;
|
|
10
11
|
QuantityView: (props: QuantityProps) => ReactNode;
|
|
@@ -3,10 +3,10 @@ import { useAppDispatch, useAppSelector } from '../app/hooks';
|
|
|
3
3
|
import { decrementItemInCart, incrementItemInCart, removeItemFromCart, selectKioskApi, selectKioskConfig, selectStoreSettings, setCurrentItem } from '../slices';
|
|
4
4
|
import { default as QuantityContainer } from './Quantity';
|
|
5
5
|
var CartItem = function (_a) {
|
|
6
|
-
var item = _a.item, _b = _a.isLast, isLast = _b === void 0 ? false : _b, _c = _a.isEditable, isEditable = _c === void 0 ? true : _c, navigate = _a.navigate, children = _a.children, QuantityView = _a.QuantityView;
|
|
6
|
+
var item = _a.item, _b = _a.isLast, isLast = _b === void 0 ? false : _b, _c = _a.isEditable, isEditable = _c === void 0 ? true : _c, _d = _a.isCheckout, isCheckout = _d === void 0 ? false : _d, navigate = _a.navigate, children = _a.children, QuantityView = _a.QuantityView;
|
|
7
7
|
var dispatch = useAppDispatch();
|
|
8
8
|
var apiUrl = useAppSelector(selectKioskApi);
|
|
9
|
-
var
|
|
9
|
+
var _e = useAppSelector(selectKioskConfig), config = _e.cartItem, checkoutCartItem = _e.checkoutCartItem;
|
|
10
10
|
var display_cals = useAppSelector(selectStoreSettings).display_cals;
|
|
11
11
|
var increment = useCallback(function () { return dispatch(incrementItemInCart(item)); }, [item, dispatch]);
|
|
12
12
|
var decrement = useCallback(function () { return dispatch(decrementItemInCart(item)); }, [dispatch, item]);
|
|
@@ -17,11 +17,11 @@ var CartItem = function (_a) {
|
|
|
17
17
|
};
|
|
18
18
|
var handlers = { increment: increment, decrement: decrement, edit: edit, remove: remove };
|
|
19
19
|
var renderQuantity = useCallback(function (quantity) { return (React.createElement(QuantityContainer, { fontSize: 24, iconSize: 28, quantity: quantity, increment: increment, decrement: decrement, children: QuantityView })); }, [increment, decrement, QuantityView]);
|
|
20
|
-
if (!config)
|
|
20
|
+
if (!config || !checkoutCartItem)
|
|
21
21
|
return null;
|
|
22
22
|
return children({
|
|
23
23
|
item: item,
|
|
24
|
-
config: config,
|
|
24
|
+
config: isCheckout && checkoutCartItem ? checkoutCartItem : config,
|
|
25
25
|
handlers: handlers,
|
|
26
26
|
isLast: isLast,
|
|
27
27
|
isEditable: isEditable,
|
|
@@ -5,7 +5,7 @@ import { default as CartItemContainer } from './CartItem';
|
|
|
5
5
|
var CheckoutCart = function (_a) {
|
|
6
6
|
var cart = _a.cart, navigate = _a.navigate, children = _a.children, QuantityView = _a.QuantityView, CartItemView = _a.CartItemView;
|
|
7
7
|
var config = useAppSelector(selectKioskConfig).checkoutCart;
|
|
8
|
-
var renderCartItem = useCallback(function (item, index) { return (React.createElement(CartItemContainer, { QuantityView: QuantityView, navigate: navigate, children: CartItemView, key: "".concat(item.id, "-").concat(index), item: item, isLast: index + 1 === cart.length, isEditable: false })); }, [QuantityView, navigate, CartItemView, cart.length]);
|
|
8
|
+
var renderCartItem = useCallback(function (item, index) { return (React.createElement(CartItemContainer, { QuantityView: QuantityView, navigate: navigate, children: CartItemView, key: "".concat(item.id, "-").concat(index), item: item, isLast: index + 1 === cart.length, isEditable: false, isCheckout: true })); }, [QuantityView, navigate, CartItemView, cart.length]);
|
|
9
9
|
if (!config)
|
|
10
10
|
return null;
|
|
11
11
|
return children({ config: config, cart: cart, renderCartItem: renderCartItem });
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { useAppSelector } from '../app/hooks';
|
|
3
|
-
import { selectKioskConfig } from '../slices';
|
|
3
|
+
import { selectKioskConfig, selectStoreSettings } from '../slices';
|
|
4
4
|
import { default as ErrorMessageContainer } from './ErrorMessage';
|
|
5
5
|
import { default as ItemOptionSelectedContainer } from './ItemOptionSelected';
|
|
6
6
|
var ItemSelections = function (_a) {
|
|
7
7
|
var handlers = _a.handlers, groups = _a.groups, levels = _a.levels, isIncomplete = _a.isIncomplete, children = _a.children, ItemOptionView = _a.ItemOptionView, ErrorMessageView = _a.ErrorMessageView;
|
|
8
8
|
var config = useAppSelector(selectKioskConfig).itemSelections;
|
|
9
|
+
var display_customize = useAppSelector(selectStoreSettings).display_customize;
|
|
9
10
|
var renderErrorMessage = useCallback(function (icon, children) { return (React.createElement(ErrorMessageContainer, { icon: icon, content: children, children: ErrorMessageView })); }, [ErrorMessageView]);
|
|
10
11
|
var renderItemOption = useCallback(function (group, option) { return (React.createElement(ItemOptionSelectedContainer, { levels: levels, handlers: handlers, group: group, option: option, children: ItemOptionView })); }, [levels, handlers, ItemOptionView]);
|
|
11
12
|
if (!config)
|
|
@@ -14,6 +15,7 @@ var ItemSelections = function (_a) {
|
|
|
14
15
|
config: config,
|
|
15
16
|
groups: groups,
|
|
16
17
|
isIncomplete: isIncomplete,
|
|
18
|
+
isCustomize: display_customize,
|
|
17
19
|
renderErrorMessage: renderErrorMessage,
|
|
18
20
|
renderItemOption: renderItemOption
|
|
19
21
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/store",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.205",
|
|
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",
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@emotion/react": "^11.11.1",
|
|
64
|
-
"@open-tender/types": "^0.4.
|
|
65
|
-
"@open-tender/ui": "^0.4.
|
|
66
|
-
"@open-tender/utils": "^0.4.
|
|
64
|
+
"@open-tender/types": "^0.4.85",
|
|
65
|
+
"@open-tender/ui": "^0.4.19",
|
|
66
|
+
"@open-tender/utils": "^0.4.66",
|
|
67
67
|
"@reduxjs/toolkit": "^2.0.1",
|
|
68
68
|
"date-fns": "2.30.0",
|
|
69
69
|
"date-fns-tz": "^2.0.0",
|