@open-tender/store 1.1.3 → 1.1.5
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/LICENSE.md +21 -21
- package/README.md +3 -3
- package/dist/cjs/components/Allergen.d.ts +8 -0
- package/dist/cjs/components/Allergen.js +10 -0
- package/dist/cjs/components/Applied.d.ts +6 -0
- package/dist/cjs/components/Applied.js +10 -0
- package/dist/cjs/components/ButtonLink.d.ts +9 -0
- package/dist/cjs/components/ButtonLink.js +10 -0
- package/dist/cjs/components/Card.d.ts +7 -0
- package/dist/cjs/components/Card.js +10 -0
- package/dist/cjs/components/Cart.d.ts +7 -0
- package/dist/cjs/components/Cart.js +41 -0
- package/dist/cjs/components/CartItem.d.ts +11 -0
- package/dist/cjs/components/CartItem.js +31 -0
- package/dist/cjs/components/CartUpsellItem.d.ts +10 -0
- package/dist/cjs/components/CartUpsellItem.js +24 -0
- package/dist/cjs/components/CartUpsells.d.ts +6 -0
- package/dist/cjs/components/CartUpsells.js +25 -0
- package/dist/cjs/components/CategoryItem.d.ts +11 -0
- package/dist/cjs/components/CategoryItem.js +27 -0
- package/dist/cjs/components/CategoryNav.d.ts +7 -0
- package/dist/cjs/components/CategoryNav.js +26 -0
- package/dist/cjs/components/CategoryNavItem.d.ts +9 -0
- package/dist/cjs/components/CategoryNavItem.js +27 -0
- package/dist/cjs/components/CategoryNavOther.d.ts +9 -0
- package/dist/cjs/components/CategoryNavOther.js +19 -0
- package/dist/cjs/components/CheckTotals.d.ts +8 -0
- package/dist/cjs/components/CheckTotals.js +10 -0
- package/dist/cjs/components/Discount.d.ts +8 -0
- package/dist/cjs/components/Discount.js +12 -0
- package/dist/cjs/components/ErrorMessage.d.ts +9 -0
- package/dist/cjs/components/ErrorMessage.js +10 -0
- package/dist/cjs/components/Header.d.ts +9 -0
- package/dist/cjs/components/Header.js +26 -0
- package/dist/cjs/components/Ingredients.d.ts +10 -0
- package/dist/cjs/components/Ingredients.js +11 -0
- package/dist/cjs/components/Input.d.ts +11 -0
- package/dist/cjs/components/Input.js +22 -0
- package/dist/cjs/components/ItemGroup.d.ts +9 -0
- package/dist/cjs/components/ItemGroup.js +18 -0
- package/dist/cjs/components/ItemGroups.d.ts +11 -0
- package/dist/cjs/components/ItemGroups.js +25 -0
- package/dist/cjs/components/ItemOption.d.ts +11 -0
- package/dist/cjs/components/ItemOption.js +30 -0
- package/dist/cjs/components/ItemSelections.d.ts +11 -0
- package/dist/cjs/components/ItemSelections.js +23 -0
- package/dist/cjs/components/Label.d.ts +10 -0
- package/dist/cjs/components/Label.js +10 -0
- package/dist/cjs/components/Loader.d.ts +8 -0
- package/dist/cjs/components/Loader.js +10 -0
- package/dist/cjs/components/MadeForNotes.d.ts +14 -0
- package/dist/cjs/components/MadeForNotes.js +29 -0
- package/dist/cjs/components/MenuCategory.d.ts +3 -3
- package/dist/cjs/components/MenuCategory.js +5 -5
- package/dist/cjs/components/MenuOther.d.ts +12 -0
- package/dist/cjs/components/MenuOther.js +16 -0
- package/dist/cjs/components/Modal.d.ts +9 -0
- package/dist/cjs/components/Modal.js +16 -0
- package/dist/cjs/components/ModalContent.d.ts +14 -0
- package/dist/cjs/components/ModalContent.js +20 -0
- package/dist/cjs/components/ModalHeader.d.ts +8 -0
- package/dist/cjs/components/ModalHeader.js +10 -0
- package/dist/cjs/components/NutritionalInfo.d.ts +11 -0
- package/dist/cjs/components/NutritionalInfo.js +18 -0
- package/dist/cjs/components/Option.d.ts +11 -0
- package/dist/cjs/components/Option.js +24 -0
- package/dist/cjs/components/OrderCard.d.ts +9 -0
- package/dist/cjs/components/OrderCard.js +56 -0
- package/dist/cjs/components/PointsReward.d.ts +10 -0
- package/dist/cjs/components/PointsReward.js +62 -0
- package/dist/cjs/components/PointsRewards.d.ts +6 -0
- package/dist/cjs/components/PointsRewards.js +24 -0
- package/dist/cjs/components/PromoCode.d.ts +7 -0
- package/dist/cjs/components/PromoCode.js +52 -0
- package/dist/cjs/components/Quantity.d.ts +13 -0
- package/dist/cjs/components/Quantity.js +19 -0
- package/dist/cjs/components/Reward.d.ts +10 -0
- package/dist/cjs/components/Reward.js +39 -0
- package/dist/cjs/components/Rewards.d.ts +10 -0
- package/dist/cjs/components/Rewards.js +15 -0
- package/dist/cjs/components/SignIn.d.ts +11 -0
- package/dist/cjs/components/SignIn.js +37 -0
- package/dist/cjs/components/SignInButton.d.ts +8 -0
- package/dist/cjs/components/SignInButton.js +41 -0
- package/dist/cjs/components/SignInCheckout.d.ts +9 -0
- package/dist/cjs/components/SignInCheckout.js +38 -0
- package/dist/cjs/components/SignInOptions.d.ts +7 -0
- package/dist/cjs/components/SignInOptions.js +28 -0
- package/dist/cjs/components/SignInPhone.d.ts +7 -0
- package/dist/cjs/components/SignInPhone.js +59 -0
- package/dist/cjs/components/SignInQr.d.ts +7 -0
- package/dist/cjs/components/SignInQr.js +61 -0
- package/dist/cjs/components/SuccessMessage.d.ts +9 -0
- package/dist/cjs/components/SuccessMessage.js +10 -0
- package/dist/cjs/components/Tag.d.ts +8 -0
- package/dist/cjs/components/Tag.js +10 -0
- package/dist/cjs/components/TextArea.d.ts +11 -0
- package/dist/cjs/components/TextArea.js +22 -0
- package/dist/cjs/components/UpsellItem.d.ts +10 -0
- package/dist/cjs/components/UpsellItem.js +24 -0
- package/dist/cjs/components/Upsells.d.ts +8 -0
- package/dist/cjs/components/Upsells.js +25 -0
- package/dist/cjs/components/index.d.ts +47 -1
- package/dist/cjs/components/index.js +93 -1
- package/dist/cjs/config/index.js +1 -1
- package/dist/cjs/hooks/useBarcode.js +1 -1
- package/dist/cjs/hooks/useChipDNATender/useChipDNATender.js +1 -1
- package/dist/cjs/hooks/useEmployee.js +8 -4
- package/dist/cjs/hooks/useGiftCardBalance.js +1 -1
- package/dist/cjs/hooks/useOrderValidate.js +1 -1
- package/dist/cjs/hooks/usePunch.js +1 -1
- package/dist/cjs/slices/alerts.js +1 -1
- package/dist/cjs/slices/arrivals.js +32 -36
- package/dist/cjs/slices/checkout.d.ts +1 -1
- package/dist/cjs/slices/checkout.js +329 -351
- package/dist/cjs/slices/config.js +79 -81
- package/dist/cjs/slices/customer.js +17 -19
- package/dist/cjs/slices/customerIdentify.js +16 -18
- package/dist/cjs/slices/deals.js +16 -18
- package/dist/cjs/slices/discounts.js +19 -21
- package/dist/cjs/slices/errorAlerts.d.ts +1 -1
- package/dist/cjs/slices/errorAlerts.js +34 -38
- package/dist/cjs/slices/kds.js +253 -275
- package/dist/cjs/slices/kiosk.d.ts +113 -1
- package/dist/cjs/slices/kiosk.js +74 -53
- package/dist/cjs/slices/menu.js +24 -26
- package/dist/cjs/slices/menuPages.js +16 -18
- package/dist/cjs/slices/notifications.js +1 -1
- package/dist/cjs/slices/offlineAuths.js +32 -36
- package/dist/cjs/slices/order.js +25 -27
- package/dist/cjs/slices/pos.js +59 -65
- package/dist/cjs/slices/punches.d.ts +1 -1
- package/dist/cjs/slices/punches.js +16 -18
- package/dist/cjs/slices/refund.js +54 -60
- package/dist/cjs/slices/settings.js +56 -62
- package/dist/cjs/slices/surcharges.js +19 -21
- package/dist/cjs/slices/taxes.js +19 -21
- package/dist/cjs/utils/punches.js +1 -1
- package/dist/esm/components/Allergen.d.ts +8 -0
- package/dist/esm/components/Allergen.js +8 -0
- package/dist/esm/components/Applied.d.ts +6 -0
- package/dist/esm/components/Applied.js +8 -0
- package/dist/esm/components/ButtonLink.d.ts +9 -0
- package/dist/esm/components/ButtonLink.js +8 -0
- package/dist/esm/components/Card.d.ts +7 -0
- package/dist/esm/components/Card.js +8 -0
- package/dist/esm/components/Cart.d.ts +7 -0
- package/dist/esm/components/Cart.js +38 -0
- package/dist/esm/components/CartItem.d.ts +11 -0
- package/dist/esm/components/CartItem.js +28 -0
- package/dist/esm/components/CartUpsellItem.d.ts +10 -0
- package/dist/esm/components/CartUpsellItem.js +22 -0
- package/dist/esm/components/CartUpsells.d.ts +6 -0
- package/dist/esm/components/CartUpsells.js +22 -0
- package/dist/esm/components/CategoryItem.d.ts +11 -0
- package/dist/esm/components/CategoryItem.js +25 -0
- package/dist/esm/components/CategoryNav.d.ts +7 -0
- package/dist/esm/components/CategoryNav.js +23 -0
- package/dist/esm/components/CategoryNavItem.d.ts +9 -0
- package/dist/esm/components/CategoryNavItem.js +25 -0
- package/dist/esm/components/CategoryNavOther.d.ts +9 -0
- package/dist/esm/components/CategoryNavOther.js +17 -0
- package/dist/esm/components/CheckTotals.d.ts +8 -0
- package/dist/esm/components/CheckTotals.js +8 -0
- package/dist/esm/components/Discount.d.ts +8 -0
- package/dist/esm/components/Discount.js +10 -0
- package/dist/esm/components/ErrorMessage.d.ts +9 -0
- package/dist/esm/components/ErrorMessage.js +8 -0
- package/dist/esm/components/Header.d.ts +9 -0
- package/dist/esm/components/Header.js +23 -0
- package/dist/esm/components/Ingredients.d.ts +10 -0
- package/dist/esm/components/Ingredients.js +9 -0
- package/dist/esm/components/Input.d.ts +11 -0
- package/dist/esm/components/Input.js +20 -0
- package/dist/esm/components/ItemGroup.d.ts +9 -0
- package/dist/esm/components/ItemGroup.js +16 -0
- package/dist/esm/components/ItemGroups.d.ts +11 -0
- package/dist/esm/components/ItemGroups.js +22 -0
- package/dist/esm/components/ItemOption.d.ts +11 -0
- package/dist/esm/components/ItemOption.js +28 -0
- package/dist/esm/components/ItemSelections.d.ts +11 -0
- package/dist/esm/components/ItemSelections.js +20 -0
- package/dist/esm/components/Label.d.ts +10 -0
- package/dist/esm/components/Label.js +8 -0
- package/dist/esm/components/Loader.d.ts +8 -0
- package/dist/esm/components/Loader.js +8 -0
- package/dist/esm/components/MadeForNotes.d.ts +14 -0
- package/dist/esm/components/MadeForNotes.js +26 -0
- package/dist/esm/components/MenuCategory.d.ts +3 -3
- package/dist/esm/components/MenuCategory.js +1 -1
- package/dist/esm/components/MenuOther.d.ts +12 -0
- package/dist/esm/components/MenuOther.js +14 -0
- package/dist/esm/components/Modal.d.ts +9 -0
- package/dist/esm/components/Modal.js +13 -0
- package/dist/esm/components/ModalContent.d.ts +14 -0
- package/dist/esm/components/ModalContent.js +18 -0
- package/dist/esm/components/ModalHeader.d.ts +8 -0
- package/dist/esm/components/ModalHeader.js +8 -0
- package/dist/esm/components/NutritionalInfo.d.ts +11 -0
- package/dist/esm/components/NutritionalInfo.js +16 -0
- package/dist/esm/components/Option.d.ts +11 -0
- package/dist/esm/components/Option.js +22 -0
- package/dist/esm/components/OrderCard.d.ts +9 -0
- package/dist/esm/components/OrderCard.js +53 -0
- package/dist/esm/components/PointsReward.d.ts +10 -0
- package/dist/esm/components/PointsReward.js +60 -0
- package/dist/esm/components/PointsRewards.d.ts +6 -0
- package/dist/esm/components/PointsRewards.js +21 -0
- package/dist/esm/components/PromoCode.d.ts +7 -0
- package/dist/esm/components/PromoCode.js +49 -0
- package/dist/esm/components/Quantity.d.ts +13 -0
- package/dist/esm/components/Quantity.js +17 -0
- package/dist/esm/components/Reward.d.ts +10 -0
- package/dist/esm/components/Reward.js +36 -0
- package/dist/esm/components/Rewards.d.ts +10 -0
- package/dist/esm/components/Rewards.js +12 -0
- package/dist/esm/components/SignIn.d.ts +11 -0
- package/dist/esm/components/SignIn.js +35 -0
- package/dist/esm/components/SignInButton.d.ts +8 -0
- package/dist/esm/components/SignInButton.js +39 -0
- package/dist/esm/components/SignInCheckout.d.ts +9 -0
- package/dist/esm/components/SignInCheckout.js +36 -0
- package/dist/esm/components/SignInOptions.d.ts +7 -0
- package/dist/esm/components/SignInOptions.js +25 -0
- package/dist/esm/components/SignInPhone.d.ts +7 -0
- package/dist/esm/components/SignInPhone.js +56 -0
- package/dist/esm/components/SignInQr.d.ts +7 -0
- package/dist/esm/components/SignInQr.js +59 -0
- package/dist/esm/components/SuccessMessage.d.ts +9 -0
- package/dist/esm/components/SuccessMessage.js +8 -0
- package/dist/esm/components/Tag.d.ts +8 -0
- package/dist/esm/components/Tag.js +8 -0
- package/dist/esm/components/TextArea.d.ts +11 -0
- package/dist/esm/components/TextArea.js +20 -0
- package/dist/esm/components/UpsellItem.d.ts +10 -0
- package/dist/esm/components/UpsellItem.js +22 -0
- package/dist/esm/components/Upsells.d.ts +8 -0
- package/dist/esm/components/Upsells.js +22 -0
- package/dist/esm/components/index.d.ts +47 -1
- package/dist/esm/components/index.js +47 -1
- package/dist/esm/config/index.js +1 -1
- package/dist/esm/hooks/useBarcode.js +1 -1
- package/dist/esm/hooks/useChipDNATender/useChipDNATender.js +1 -1
- package/dist/esm/hooks/useEmployee.js +9 -5
- package/dist/esm/hooks/useGiftCardBalance.js +1 -1
- package/dist/esm/hooks/useOrderValidate.js +1 -1
- package/dist/esm/hooks/usePunch.js +1 -1
- package/dist/esm/slices/alerts.js +1 -1
- package/dist/esm/slices/arrivals.js +32 -36
- package/dist/esm/slices/checkout.d.ts +1 -1
- package/dist/esm/slices/checkout.js +329 -351
- package/dist/esm/slices/config.js +79 -81
- package/dist/esm/slices/customer.js +17 -19
- package/dist/esm/slices/customerIdentify.js +16 -18
- package/dist/esm/slices/deals.js +16 -18
- package/dist/esm/slices/discounts.js +19 -21
- package/dist/esm/slices/errorAlerts.d.ts +1 -1
- package/dist/esm/slices/errorAlerts.js +34 -38
- package/dist/esm/slices/kds.js +253 -275
- package/dist/esm/slices/kiosk.d.ts +113 -1
- package/dist/esm/slices/kiosk.js +73 -52
- package/dist/esm/slices/menu.js +24 -26
- package/dist/esm/slices/menuPages.js +16 -18
- package/dist/esm/slices/notifications.js +1 -1
- package/dist/esm/slices/offlineAuths.js +32 -36
- package/dist/esm/slices/order.js +25 -27
- package/dist/esm/slices/pos.js +59 -65
- package/dist/esm/slices/punches.d.ts +1 -1
- package/dist/esm/slices/punches.js +16 -18
- package/dist/esm/slices/refund.js +54 -60
- package/dist/esm/slices/settings.js +56 -62
- package/dist/esm/slices/surcharges.js +19 -21
- package/dist/esm/slices/taxes.js +19 -21
- package/dist/esm/utils/punches.js +1 -1
- package/package.json +82 -75
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useAppSelector } from '../app/hooks';
|
|
2
|
+
import { selectKioskConfig } from '../slices';
|
|
3
|
+
var Card = function (_a) {
|
|
4
|
+
var children = _a.children, content = _a.content;
|
|
5
|
+
var config = useAppSelector(selectKioskConfig).card;
|
|
6
|
+
return children({ config: config, children: content });
|
|
7
|
+
};
|
|
8
|
+
export default Card;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { CartItem, CartUpsells } from '@open-tender/ui';
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
|
+
import { useAppDispatch, useAppSelector } from '../app/hooks';
|
|
4
|
+
import { closeCartSummary, selectCartSummary, selectCartTotals, selectKioskConfig, selectOrder, toggleCartSummary } from '../slices';
|
|
5
|
+
import { default as CartItemContainer } from './CartItem';
|
|
6
|
+
import { default as CartUpsellsContainer } from './CartUpsells';
|
|
7
|
+
var Cart = function (_a) {
|
|
8
|
+
var navigate = _a.navigate, children = _a.children;
|
|
9
|
+
var dispatch = useAppDispatch();
|
|
10
|
+
var config = useAppSelector(selectKioskConfig).cart;
|
|
11
|
+
var cart = useAppSelector(selectOrder).cart;
|
|
12
|
+
var _b = useAppSelector(selectCartTotals), count = _b.count, total = _b.total;
|
|
13
|
+
var isOpen = useAppSelector(selectCartSummary).isOpen;
|
|
14
|
+
var isEmpty = !cart.length;
|
|
15
|
+
var toggleCart = function () { return dispatch(toggleCartSummary()); };
|
|
16
|
+
var checkout = function () { return navigate('/checkout'); };
|
|
17
|
+
var handlers = { checkout: checkout, toggleCart: toggleCart };
|
|
18
|
+
useEffect(function () {
|
|
19
|
+
if (!isOpen || !isEmpty)
|
|
20
|
+
return;
|
|
21
|
+
dispatch(closeCartSummary());
|
|
22
|
+
}, [dispatch, isOpen, isEmpty]);
|
|
23
|
+
var renderCartItem = function (item, isLast) { return (React.createElement(CartItemContainer, { navigate: navigate, item: item, isLast: isLast, children: CartItem })); };
|
|
24
|
+
var renderCartUpsells = function () { return (React.createElement(CartUpsellsContainer, { children: CartUpsells })); };
|
|
25
|
+
if (!config)
|
|
26
|
+
return null;
|
|
27
|
+
return children({
|
|
28
|
+
config: config,
|
|
29
|
+
handlers: handlers,
|
|
30
|
+
cart: cart,
|
|
31
|
+
count: count,
|
|
32
|
+
total: total,
|
|
33
|
+
isOpen: isOpen,
|
|
34
|
+
renderCartItem: renderCartItem,
|
|
35
|
+
renderCartUpsells: renderCartUpsells
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
export default Cart;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CartItem as CartItemType } from '@open-tender/types';
|
|
2
|
+
import { CartItemProps } from '@open-tender/ui';
|
|
3
|
+
import React, { ReactNode } from 'react';
|
|
4
|
+
declare const CartItem: ({ item, isLast, isEditable, navigate, children }: {
|
|
5
|
+
item: CartItemType;
|
|
6
|
+
isLast?: boolean;
|
|
7
|
+
isEditable?: boolean;
|
|
8
|
+
navigate: (route: string) => void;
|
|
9
|
+
children: (props: CartItemProps) => ReactNode;
|
|
10
|
+
}) => React.ReactNode;
|
|
11
|
+
export default CartItem;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Quantity } from '@open-tender/ui';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useAppDispatch, useAppSelector } from '../app/hooks';
|
|
4
|
+
import { decrementItemInCart, incrementItemInCart, removeItemFromCart, selectKioskConfig, setCurrentItem } from '../slices';
|
|
5
|
+
import { default as QuantityContainer } from './Quantity';
|
|
6
|
+
var CartItem = function (_a) {
|
|
7
|
+
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;
|
|
8
|
+
var dispatch = useAppDispatch();
|
|
9
|
+
var config = useAppSelector(selectKioskConfig).cartItem;
|
|
10
|
+
var increment = function () { return dispatch(incrementItemInCart(item)); };
|
|
11
|
+
var decrement = function () { return dispatch(decrementItemInCart(item)); };
|
|
12
|
+
var remove = function () { return dispatch(removeItemFromCart(item)); };
|
|
13
|
+
var edit = function () {
|
|
14
|
+
dispatch(setCurrentItem(item));
|
|
15
|
+
navigate('/menu/item');
|
|
16
|
+
};
|
|
17
|
+
var handlers = { increment: increment, decrement: decrement, edit: edit, remove: remove };
|
|
18
|
+
var renderQuantity = function (quantity) { return (React.createElement(QuantityContainer, { fontSize: 24, iconSize: 28, quantity: quantity, increment: increment, decrement: decrement, children: Quantity })); };
|
|
19
|
+
return children({
|
|
20
|
+
item: item,
|
|
21
|
+
config: config,
|
|
22
|
+
handlers: handlers,
|
|
23
|
+
isLast: isLast,
|
|
24
|
+
isEditable: isEditable,
|
|
25
|
+
renderQuantity: renderQuantity
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
export default CartItem;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CartItem } from '@open-tender/types';
|
|
2
|
+
import { CartUpsellItemProps } from '@open-tender/ui';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
declare const CartUpsellItem: ({ item, callback, isLast, children }: {
|
|
5
|
+
item: CartItem;
|
|
6
|
+
callback?: () => void;
|
|
7
|
+
isLast?: boolean;
|
|
8
|
+
children: (props: CartUpsellItemProps) => ReactNode;
|
|
9
|
+
}) => ReactNode;
|
|
10
|
+
export default CartUpsellItem;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { hasGroupsBelowMin, useBuilder } from '@open-tender/utils';
|
|
2
|
+
import { useAppDispatch, useAppSelector } from '../app/hooks';
|
|
3
|
+
import { addItemToCart, selectKioskConfig } from '../slices';
|
|
4
|
+
var CartUpsellItem = function (_a) {
|
|
5
|
+
var item = _a.item, callback = _a.callback, isLast = _a.isLast, children = _a.children;
|
|
6
|
+
var dispatch = useAppDispatch();
|
|
7
|
+
var _b = useAppSelector(selectKioskConfig), config = _b.cartUpsellItem, cardConfig = _b.card;
|
|
8
|
+
var builtItem = useBuilder(item).item;
|
|
9
|
+
var quantity = builtItem.quantity, groups = builtItem.groups;
|
|
10
|
+
var groupsBelowMin = hasGroupsBelowMin(null, groups);
|
|
11
|
+
var isIncomplete = "".concat(quantity) === '' || quantity === 0 || groupsBelowMin;
|
|
12
|
+
var add = function () {
|
|
13
|
+
if (!isIncomplete) {
|
|
14
|
+
dispatch(addItemToCart(builtItem));
|
|
15
|
+
if (callback)
|
|
16
|
+
callback();
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
var handlers = { add: add };
|
|
20
|
+
return children({ config: config, handlers: handlers, item: item, isLast: isLast, cardConfig: cardConfig });
|
|
21
|
+
};
|
|
22
|
+
export default CartUpsellItem;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CartUpsellItem } from '@open-tender/ui';
|
|
2
|
+
import { makeUpsellItemsForCart } from '@open-tender/utils';
|
|
3
|
+
import React, { useMemo } from 'react';
|
|
4
|
+
import { useAppSelector } from '../app/hooks';
|
|
5
|
+
import { selectCartIds, selectKioskConfig, selectMenu } from '../slices';
|
|
6
|
+
import { default as CartUpsellItemContainer } from './CartUpsellItem';
|
|
7
|
+
var CartUpsells = function (_a) {
|
|
8
|
+
var children = _a.children;
|
|
9
|
+
var config = useAppSelector(selectKioskConfig).cartUpsells;
|
|
10
|
+
var cartIds = useAppSelector(selectCartIds);
|
|
11
|
+
var _b = useAppSelector(selectMenu), categories = _b.categories, soldOut = _b.soldOut;
|
|
12
|
+
var upsellItems = useMemo(function () { return makeUpsellItemsForCart(categories, cartIds, soldOut); }, [categories, cartIds, soldOut]);
|
|
13
|
+
var renderCartUpsellItem = function (item, isLast) { return (React.createElement(CartUpsellItemContainer, { item: item, isLast: isLast, children: CartUpsellItem })); };
|
|
14
|
+
if (!upsellItems.length)
|
|
15
|
+
return null;
|
|
16
|
+
return children({
|
|
17
|
+
config: config,
|
|
18
|
+
upsellItems: upsellItems.slice(0, 5),
|
|
19
|
+
renderCartUpsellItem: renderCartUpsellItem
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
export default CartUpsells;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MenuItem, MenuItemFavorite } from '@open-tender/types';
|
|
2
|
+
import { CategoryItemProps } from '@open-tender/ui';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
declare const CategoryItem: ({ item, favorite, allergenAlerts, navigate, children }: {
|
|
5
|
+
item: MenuItem;
|
|
6
|
+
favorite?: MenuItemFavorite;
|
|
7
|
+
allergenAlerts?: string[];
|
|
8
|
+
navigate: (route: string) => void;
|
|
9
|
+
children: (props: CategoryItemProps) => ReactNode;
|
|
10
|
+
}) => ReactNode;
|
|
11
|
+
export default CategoryItem;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import { makeOrderItem, rehydrateOrderItem, useOrderItem } from '@open-tender/utils';
|
|
3
|
+
import { useAppDispatch, useAppSelector } from '../app/hooks';
|
|
4
|
+
import { selectCartCounts, selectKioskConfig, selectMenu, setCurrentItem } from '../slices';
|
|
5
|
+
var CategoryItem = function (_a) {
|
|
6
|
+
var item = _a.item, favorite = _a.favorite, allergenAlerts = _a.allergenAlerts, navigate = _a.navigate, children = _a.children;
|
|
7
|
+
var dispatch = useAppDispatch();
|
|
8
|
+
var categoryItem = useAppSelector(selectKioskConfig).categoryItem;
|
|
9
|
+
var soldOut = useAppSelector(selectMenu).soldOut;
|
|
10
|
+
var cartCounts = useAppSelector(selectCartCounts);
|
|
11
|
+
var hasPoints = false;
|
|
12
|
+
var displaySettings = {};
|
|
13
|
+
var _b = displaySettings || {}, _c = _b.calories, showCals = _c === void 0 ? false : _c, _d = _b.tags, showTags = _d === void 0 ? false : _d, _e = _b.allergens, showAllergens = _e === void 0 ? false : _e;
|
|
14
|
+
var showDesc = 'SHOW';
|
|
15
|
+
var orderItem = favorite
|
|
16
|
+
? __assign(__assign({}, rehydrateOrderItem(item, favorite.item)), { index: -1 }) : makeOrderItem(item, undefined, soldOut, undefined, hasPoints);
|
|
17
|
+
var cartItem = useOrderItem(orderItem, favorite, allergenAlerts, cartCounts, showCals, showTags, showAllergens, showDesc);
|
|
18
|
+
var browse = function () {
|
|
19
|
+
dispatch(setCurrentItem(cartItem));
|
|
20
|
+
navigate('/menu/item');
|
|
21
|
+
};
|
|
22
|
+
var handlers = { browse: browse };
|
|
23
|
+
return children({ item: cartItem, config: categoryItem, handlers: handlers });
|
|
24
|
+
};
|
|
25
|
+
export default CategoryItem;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CategoryNavProps } from '@open-tender/ui';
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
3
|
+
declare const CategoryNav: ({ children, navigate }: {
|
|
4
|
+
children: (props: CategoryNavProps) => ReactNode;
|
|
5
|
+
navigate: (route: string) => void;
|
|
6
|
+
}) => React.ReactNode;
|
|
7
|
+
export default CategoryNav;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CategoryNavItem, CategoryNavOther } from '@open-tender/ui';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useAppSelector } from '../app/hooks';
|
|
4
|
+
import { selectKioskConfig, selectMenu } from '../slices';
|
|
5
|
+
import { default as CategoryNavItemContainer } from './CategoryNavItem';
|
|
6
|
+
import { default as CategoryNavOtherContainer } from './CategoryNavOther';
|
|
7
|
+
var CategoryNav = function (_a) {
|
|
8
|
+
var children = _a.children, navigate = _a.navigate;
|
|
9
|
+
var categoryNav = useAppSelector(selectKioskConfig).categoryNav;
|
|
10
|
+
var _b = useAppSelector(selectMenu), categories = _b.categories, featured = _b.featured, favorites = _b.favorites, recents = _b.recents;
|
|
11
|
+
var renderCategoryNavOther = function (title, path) { return (React.createElement(CategoryNavOtherContainer, { navigate: navigate, title: title, path: path, children: CategoryNavOther })); };
|
|
12
|
+
var renderCategoryNavItem = function (item) { return (React.createElement(CategoryNavItemContainer, { navigate: navigate, category: item, children: CategoryNavItem })); };
|
|
13
|
+
return children({
|
|
14
|
+
config: categoryNav,
|
|
15
|
+
categories: categories,
|
|
16
|
+
featured: featured,
|
|
17
|
+
favorites: favorites,
|
|
18
|
+
recents: recents,
|
|
19
|
+
renderCategoryNavOther: renderCategoryNavOther,
|
|
20
|
+
renderCategoryNavItem: renderCategoryNavItem
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
export default CategoryNav;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MenuCategory } from '@open-tender/types';
|
|
2
|
+
import { CategoryNavItemProps } from '@open-tender/ui';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
declare const CategoryNavItem: ({ category, children, navigate }: {
|
|
5
|
+
category: MenuCategory;
|
|
6
|
+
navigate: (route: string) => void;
|
|
7
|
+
children: (props: CategoryNavItemProps) => ReactNode;
|
|
8
|
+
}) => ReactNode;
|
|
9
|
+
export default CategoryNavItem;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { makeImageUrl } from '@open-tender/ui';
|
|
2
|
+
import { useAppDispatch, useAppSelector } from '../app/hooks';
|
|
3
|
+
import { selectCurrentCategory, selectKioskConfig, setCurrentCategory } from '../slices';
|
|
4
|
+
var CategoryNavItem = function (_a) {
|
|
5
|
+
var category = _a.category, children = _a.children, navigate = _a.navigate;
|
|
6
|
+
var dispatch = useAppDispatch();
|
|
7
|
+
var current = useAppSelector(selectCurrentCategory);
|
|
8
|
+
var isCurrent = (current === null || current === void 0 ? void 0 : current.id) === category.id;
|
|
9
|
+
var _b = useAppSelector(selectKioskConfig), categoryNavItem = _b.categoryNavItem, categoryNavItemSelected = _b.categoryNavItemSelected;
|
|
10
|
+
var config = isCurrent ? categoryNavItemSelected : categoryNavItem;
|
|
11
|
+
var name = category.name;
|
|
12
|
+
var imageUrl = makeImageUrl(category);
|
|
13
|
+
var browse = function () {
|
|
14
|
+
dispatch(setCurrentCategory(category));
|
|
15
|
+
navigate('/menu/category');
|
|
16
|
+
};
|
|
17
|
+
var handlers = { browse: browse };
|
|
18
|
+
return children({
|
|
19
|
+
config: config,
|
|
20
|
+
handlers: handlers,
|
|
21
|
+
title: name,
|
|
22
|
+
imageUrl: imageUrl
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
export default CategoryNavItem;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CategoryNavOtherProps } from '@open-tender/ui';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
declare const CategoryNavOther: ({ title, path, navigate, children }: {
|
|
4
|
+
title: string;
|
|
5
|
+
path: string;
|
|
6
|
+
navigate: (route: string) => void;
|
|
7
|
+
children: (props: CategoryNavOtherProps) => ReactNode;
|
|
8
|
+
}) => ReactNode;
|
|
9
|
+
export default CategoryNavOther;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useAppDispatch, useAppSelector } from '../app/hooks';
|
|
2
|
+
import { selectCurrentSection, selectKioskConfig, setCurrentCategory } from '../slices';
|
|
3
|
+
var CategoryNavOther = function (_a) {
|
|
4
|
+
var title = _a.title, path = _a.path, navigate = _a.navigate, children = _a.children;
|
|
5
|
+
var dispatch = useAppDispatch();
|
|
6
|
+
var _b = useAppSelector(selectKioskConfig), categoryNavItem = _b.categoryNavItem, categoryNavItemSelected = _b.categoryNavItemSelected;
|
|
7
|
+
var currentSection = useAppSelector(selectCurrentSection);
|
|
8
|
+
var isCurrent = path === currentSection;
|
|
9
|
+
var config = isCurrent ? categoryNavItemSelected : categoryNavItem;
|
|
10
|
+
var browse = function () {
|
|
11
|
+
dispatch(setCurrentCategory(null));
|
|
12
|
+
navigate(path);
|
|
13
|
+
};
|
|
14
|
+
var handlers = { browse: browse };
|
|
15
|
+
return children({ config: config, handlers: handlers, title: title, imageUrl: null });
|
|
16
|
+
};
|
|
17
|
+
export default CategoryNavOther;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Order } from '@open-tender/types';
|
|
2
|
+
import { CheckTotalsProps } from '@open-tender/ui';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
declare const CheckTotals: ({ check, children }: {
|
|
5
|
+
check: Order;
|
|
6
|
+
children: (props: CheckTotalsProps) => ReactNode;
|
|
7
|
+
}) => ReactNode;
|
|
8
|
+
export default CheckTotals;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useAppSelector } from '../app/hooks';
|
|
2
|
+
import { selectKioskConfig } from '../slices';
|
|
3
|
+
var CheckTotals = function (_a) {
|
|
4
|
+
var check = _a.check, children = _a.children;
|
|
5
|
+
var config = useAppSelector(selectKioskConfig).checkTotals;
|
|
6
|
+
return children({ config: config, check: check });
|
|
7
|
+
};
|
|
8
|
+
export default CheckTotals;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Discount as DiscountType } from '@open-tender/types';
|
|
2
|
+
import { DiscountProps } from '@open-tender/ui';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
declare const Discount: ({ discount, children }: {
|
|
5
|
+
discount: DiscountType;
|
|
6
|
+
children: (props: DiscountProps) => ReactNode;
|
|
7
|
+
}) => ReactNode;
|
|
8
|
+
export default Discount;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useAppSelector } from '../app/hooks';
|
|
2
|
+
import { selectKioskConfig } from '../slices';
|
|
3
|
+
var Discount = function (_a) {
|
|
4
|
+
var discount = _a.discount, children = _a.children;
|
|
5
|
+
var _b = useAppSelector(selectKioskConfig), config = _b.discount, cardConfig = _b.card;
|
|
6
|
+
if (!config)
|
|
7
|
+
return null;
|
|
8
|
+
return children({ config: config, discount: discount, cardConfig: cardConfig });
|
|
9
|
+
};
|
|
10
|
+
export default Discount;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ErrorMessageProps, Styles } from '@open-tender/ui';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
declare const ErrorMessage: ({ content, icon, style, children }: {
|
|
4
|
+
content: string;
|
|
5
|
+
icon?: ReactNode;
|
|
6
|
+
style?: Styles;
|
|
7
|
+
children: (props: ErrorMessageProps) => ReactNode;
|
|
8
|
+
}) => ReactNode;
|
|
9
|
+
export default ErrorMessage;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useAppSelector } from '../app/hooks';
|
|
2
|
+
import { selectKioskConfig } from '../slices';
|
|
3
|
+
var ErrorMessage = function (_a) {
|
|
4
|
+
var content = _a.content, icon = _a.icon, style = _a.style, children = _a.children;
|
|
5
|
+
var config = useAppSelector(selectKioskConfig).errorMessage;
|
|
6
|
+
return children({ config: config, icon: icon, style: style, children: content });
|
|
7
|
+
};
|
|
8
|
+
export default ErrorMessage;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HeaderProps } from '@open-tender/ui';
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
3
|
+
declare const Header: ({ to, pathname, navigate, children }: {
|
|
4
|
+
to?: string;
|
|
5
|
+
pathname: string;
|
|
6
|
+
navigate: (route: string) => void;
|
|
7
|
+
children: (props: HeaderProps) => ReactNode;
|
|
8
|
+
}) => React.ReactNode;
|
|
9
|
+
export default Header;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SignInButton } from '@open-tender/ui';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useAppDispatch, useAppSelector } from '../app/hooks';
|
|
4
|
+
import { selectKioskConfig, toggleSidebar } from '../slices';
|
|
5
|
+
import { default as SignInButtonContainer } from './SignInButton';
|
|
6
|
+
var Header = function (_a) {
|
|
7
|
+
var to = _a.to, pathname = _a.pathname, navigate = _a.navigate, children = _a.children;
|
|
8
|
+
var dispatch = useAppDispatch();
|
|
9
|
+
var header = (useAppSelector(selectKioskConfig) || {}).header;
|
|
10
|
+
var back = function () {
|
|
11
|
+
if (to)
|
|
12
|
+
navigate(to);
|
|
13
|
+
};
|
|
14
|
+
var open = function () {
|
|
15
|
+
dispatch(toggleSidebar());
|
|
16
|
+
};
|
|
17
|
+
var handlers = to ? { back: back, open: open } : null;
|
|
18
|
+
var renderSignInButton = function () { return (React.createElement(SignInButtonContainer, { pathname: pathname, navigate: navigate, children: SignInButton })); };
|
|
19
|
+
if (!header)
|
|
20
|
+
return null;
|
|
21
|
+
return children({ config: header, handlers: handlers, renderSignInButton: renderSignInButton });
|
|
22
|
+
};
|
|
23
|
+
export default Header;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IngredientsProps } from '@open-tender/ui';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
declare const Ingredients: ({ title, subtitle, ingredients, close, children }: {
|
|
4
|
+
title: string;
|
|
5
|
+
subtitle?: string;
|
|
6
|
+
ingredients: string;
|
|
7
|
+
close: () => void;
|
|
8
|
+
children: (props: IngredientsProps) => ReactNode;
|
|
9
|
+
}) => ReactNode;
|
|
10
|
+
export default Ingredients;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useAppSelector } from '../app/hooks';
|
|
2
|
+
import { selectKioskConfig } from '../slices';
|
|
3
|
+
var Ingredients = function (_a) {
|
|
4
|
+
var title = _a.title, subtitle = _a.subtitle, ingredients = _a.ingredients, close = _a.close, children = _a.children;
|
|
5
|
+
var config = useAppSelector(selectKioskConfig).ingredients;
|
|
6
|
+
var handlers = { close: close };
|
|
7
|
+
return children({ config: config, handlers: handlers, title: title, subtitle: subtitle, ingredients: ingredients });
|
|
8
|
+
};
|
|
9
|
+
export default Ingredients;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { InputProps, Styles } from '@open-tender/ui';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
declare const Input: ({ label, value, setValue, isRequired, style, children }: {
|
|
4
|
+
label?: string;
|
|
5
|
+
value: string;
|
|
6
|
+
setValue: (value: string) => void;
|
|
7
|
+
isRequired?: boolean;
|
|
8
|
+
style?: Styles;
|
|
9
|
+
children: (props: InputProps) => ReactNode;
|
|
10
|
+
}) => ReactNode;
|
|
11
|
+
export default Input;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useAppSelector } from '../app/hooks';
|
|
2
|
+
import { selectKioskConfig } from '../slices';
|
|
3
|
+
var Input = function (_a) {
|
|
4
|
+
var label = _a.label, value = _a.value, setValue = _a.setValue, isRequired = _a.isRequired, style = _a.style, children = _a.children;
|
|
5
|
+
var _b = useAppSelector(selectKioskConfig), config = _b.input, labelConfig = _b.label;
|
|
6
|
+
var update = function (evt) {
|
|
7
|
+
setValue(evt.target.value);
|
|
8
|
+
};
|
|
9
|
+
var handlers = { update: update };
|
|
10
|
+
return children({
|
|
11
|
+
config: config,
|
|
12
|
+
handlers: handlers,
|
|
13
|
+
label: label,
|
|
14
|
+
value: value,
|
|
15
|
+
isRequired: isRequired,
|
|
16
|
+
style: style,
|
|
17
|
+
labelConfig: labelConfig
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
export default Input;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CartItemGroup } from '@open-tender/types';
|
|
2
|
+
import { ItemGroupProps } from '@open-tender/ui';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
declare const ItemGroup: ({ group, content, children }: {
|
|
5
|
+
group: CartItemGroup;
|
|
6
|
+
content: ReactNode;
|
|
7
|
+
children: (props: ItemGroupProps) => ReactNode;
|
|
8
|
+
}) => ReactNode;
|
|
9
|
+
export default ItemGroup;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useModifierGroup } from '@open-tender/utils';
|
|
2
|
+
import { useAppSelector } from '../app/hooks';
|
|
3
|
+
import { selectKioskConfig } from '../slices';
|
|
4
|
+
var ItemGroup = function (_a) {
|
|
5
|
+
var group = _a.group, content = _a.content, children = _a.children;
|
|
6
|
+
var _b = useAppSelector(selectKioskConfig), config = _b.itemGroup, errorMessageConfig = _b.errorMessage, successMessageConfig = _b.successMessage;
|
|
7
|
+
var modifierGroup = useModifierGroup(group);
|
|
8
|
+
return children({
|
|
9
|
+
config: config,
|
|
10
|
+
group: modifierGroup,
|
|
11
|
+
children: content,
|
|
12
|
+
errorMessageConfig: errorMessageConfig,
|
|
13
|
+
successMessageConfig: successMessageConfig
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
export default ItemGroup;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CartItemGroups, CartLevels } from '@open-tender/types';
|
|
2
|
+
import { Handlers, ItemGroupsProps } from '@open-tender/ui';
|
|
3
|
+
import React, { ReactNode } from 'react';
|
|
4
|
+
declare const ItemGroups: ({ handlers, groups, levels, excludeSize, children }: {
|
|
5
|
+
handlers: Handlers;
|
|
6
|
+
groups: CartItemGroups;
|
|
7
|
+
levels: CartLevels;
|
|
8
|
+
excludeSize?: boolean;
|
|
9
|
+
children: (props: ItemGroupsProps) => ReactNode;
|
|
10
|
+
}) => React.ReactNode;
|
|
11
|
+
export default ItemGroups;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ItemOption, ItemGroup } from '@open-tender/ui';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useAppSelector } from '../app/hooks';
|
|
4
|
+
import { selectKioskConfig } from '../slices';
|
|
5
|
+
import { default as ItemGroupContainer } from './ItemGroup';
|
|
6
|
+
import { default as ItemOptionContainer } from './ItemOption';
|
|
7
|
+
var ItemGroups = function (_a) {
|
|
8
|
+
var handlers = _a.handlers, groups = _a.groups, levels = _a.levels, _b = _a.excludeSize, excludeSize = _b === void 0 ? true : _b, children = _a.children;
|
|
9
|
+
var config = useAppSelector(selectKioskConfig).itemGroups;
|
|
10
|
+
var renderItemOption = function (group, option) { return (React.createElement(ItemOptionContainer, { levels: levels, handlers: handlers, group: group, option: option, children: ItemOption })); };
|
|
11
|
+
var renderItemGroup = function (group, content) { return (React.createElement(ItemGroupContainer, { group: group, content: content, children: ItemGroup })); };
|
|
12
|
+
if (!config)
|
|
13
|
+
return null;
|
|
14
|
+
return children({
|
|
15
|
+
config: config,
|
|
16
|
+
groups: groups,
|
|
17
|
+
excludeSize: excludeSize,
|
|
18
|
+
renderItemOption: renderItemOption,
|
|
19
|
+
renderItemGroup: renderItemGroup
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
export default ItemGroups;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CartItemGroup, CartItemOption, CartLevels } from '@open-tender/types';
|
|
2
|
+
import { Handlers, ItemOptionProps } from '@open-tender/ui';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
declare const ItemOption: ({ handlers, group, option, levels, children }: {
|
|
5
|
+
handlers: Handlers;
|
|
6
|
+
group: CartItemGroup;
|
|
7
|
+
option: CartItemOption;
|
|
8
|
+
levels: CartLevels;
|
|
9
|
+
children: (props: ItemOptionProps) => ReactNode;
|
|
10
|
+
}) => ReactNode;
|
|
11
|
+
export default ItemOption;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useModifier } from '@open-tender/utils';
|
|
2
|
+
import { useAppDispatch, useAppSelector } from '../app/hooks';
|
|
3
|
+
import { selectKioskConfig, setCurrentOption } from '../slices';
|
|
4
|
+
var ItemOption = function (_a) {
|
|
5
|
+
var handlers = _a.handlers, group = _a.group, option = _a.option, levels = _a.levels, children = _a.children;
|
|
6
|
+
var dispatch = useAppDispatch();
|
|
7
|
+
var _b = useAppSelector(selectKioskConfig), config = _b.itemOption, cardConfig = _b.card;
|
|
8
|
+
var toggleOption = handlers.toggleOption, incrementOption = handlers.incrementOption, decrementOption = handlers.decrementOption, setOptionQuantity = handlers.setOptionQuantity;
|
|
9
|
+
var allergenAlerts = [];
|
|
10
|
+
var modifier = useModifier(group, option, levels, toggleOption, incrementOption, decrementOption, setOptionQuantity, allergenAlerts);
|
|
11
|
+
var showNested = function () {
|
|
12
|
+
// dispatch(setCurrentOption(modifier))
|
|
13
|
+
var currentOption = {
|
|
14
|
+
groupId: group.id,
|
|
15
|
+
optionId: option.id,
|
|
16
|
+
levels: modifier.updatedLevels
|
|
17
|
+
};
|
|
18
|
+
dispatch(setCurrentOption(currentOption));
|
|
19
|
+
};
|
|
20
|
+
return children({
|
|
21
|
+
config: config,
|
|
22
|
+
handlers: { showNested: showNested },
|
|
23
|
+
group: group,
|
|
24
|
+
option: modifier,
|
|
25
|
+
cardConfig: cardConfig
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
export default ItemOption;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CartItemGroups, CartLevels } from '@open-tender/types';
|
|
2
|
+
import { Handlers, ItemSelectionsProps } from '@open-tender/ui';
|
|
3
|
+
import React, { ReactNode } from 'react';
|
|
4
|
+
declare const ItemSelections: ({ handlers, groups, levels, isIncomplete, children }: {
|
|
5
|
+
handlers: Handlers;
|
|
6
|
+
groups: CartItemGroups;
|
|
7
|
+
levels: CartLevels;
|
|
8
|
+
isIncomplete: boolean;
|
|
9
|
+
children: (props: ItemSelectionsProps) => ReactNode;
|
|
10
|
+
}) => React.ReactNode;
|
|
11
|
+
export default ItemSelections;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ErrorMessage, ItemOption } from '@open-tender/ui';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useAppSelector } from '../app/hooks';
|
|
4
|
+
import { selectKioskConfig } from '../slices';
|
|
5
|
+
import { default as ErrorMessageContainer } from './ErrorMessage';
|
|
6
|
+
import { default as ItemOptionContainer } from './ItemOption';
|
|
7
|
+
var ItemSelections = function (_a) {
|
|
8
|
+
var handlers = _a.handlers, groups = _a.groups, levels = _a.levels, isIncomplete = _a.isIncomplete, children = _a.children;
|
|
9
|
+
var config = useAppSelector(selectKioskConfig).itemSelections;
|
|
10
|
+
var renderErrorMessage = function (icon, children) { return (React.createElement(ErrorMessageContainer, { icon: icon, content: children, children: ErrorMessage })); };
|
|
11
|
+
var renderItemOption = function (group, option) { return (React.createElement(ItemOptionContainer, { levels: levels, handlers: handlers, group: group, option: option, children: ItemOption })); };
|
|
12
|
+
return children({
|
|
13
|
+
config: config,
|
|
14
|
+
groups: groups,
|
|
15
|
+
isIncomplete: isIncomplete,
|
|
16
|
+
renderErrorMessage: renderErrorMessage,
|
|
17
|
+
renderItemOption: renderItemOption
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
export default ItemSelections;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LabelProps, Styles } from '@open-tender/ui';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
declare const Label: ({ content, label, isRequired, style, children }: {
|
|
4
|
+
content: ReactNode;
|
|
5
|
+
label?: string;
|
|
6
|
+
isRequired?: boolean;
|
|
7
|
+
style?: Styles;
|
|
8
|
+
children: (props: LabelProps) => ReactNode;
|
|
9
|
+
}) => ReactNode;
|
|
10
|
+
export default Label;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useAppSelector } from '../app/hooks';
|
|
2
|
+
import { selectKioskConfig } from '../slices';
|
|
3
|
+
var Label = function (_a) {
|
|
4
|
+
var content = _a.content, label = _a.label, isRequired = _a.isRequired, style = _a.style, children = _a.children;
|
|
5
|
+
var config = useAppSelector(selectKioskConfig).label;
|
|
6
|
+
return children({ config: config, label: label, isRequired: isRequired, style: style, children: content });
|
|
7
|
+
};
|
|
8
|
+
export default Label;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LoaderProps, Styles } from '@open-tender/ui';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
declare const Loader: ({ text, style, children }: {
|
|
4
|
+
text?: string;
|
|
5
|
+
style?: Styles;
|
|
6
|
+
children: (props: LoaderProps) => ReactNode;
|
|
7
|
+
}) => ReactNode;
|
|
8
|
+
export default Loader;
|