@open-tender/store 1.1.18 → 1.1.20
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/Cart.d.ts +6 -2
- package/dist/cjs/components/Cart.js +3 -4
- package/dist/cjs/components/CartItem.d.ts +3 -2
- package/dist/cjs/components/CartItem.js +5 -6
- package/dist/cjs/components/CartUpsells.d.ts +3 -2
- package/dist/cjs/components/CartUpsells.js +2 -3
- package/dist/cjs/components/CategoryNav.d.ts +4 -2
- package/dist/cjs/components/CategoryNav.js +4 -5
- package/dist/cjs/components/Header.d.ts +3 -2
- package/dist/cjs/components/Header.js +3 -4
- package/dist/cjs/components/ItemGroup.d.ts +4 -2
- package/dist/cjs/components/ItemGroup.js +4 -5
- package/dist/cjs/components/ItemGroups.d.ts +7 -3
- package/dist/cjs/components/ItemGroups.js +4 -5
- package/dist/cjs/components/ItemSelections.d.ts +5 -3
- package/dist/cjs/components/ItemSelections.js +4 -5
- package/dist/cjs/components/MadeForNotes.d.ts +4 -2
- package/dist/cjs/components/MadeForNotes.js +4 -5
- package/dist/cjs/components/Option.d.ts +7 -2
- package/dist/cjs/components/Option.js +18 -5
- package/dist/cjs/components/OrderCard.d.ts +3 -2
- package/dist/cjs/components/OrderCard.js +2 -3
- package/dist/cjs/components/PointsReward.d.ts +3 -2
- package/dist/cjs/components/PointsReward.js +2 -3
- package/dist/cjs/components/PointsRewards.d.ts +4 -2
- package/dist/cjs/components/PointsRewards.js +3 -4
- package/dist/cjs/components/PromoCode.d.ts +4 -2
- package/dist/cjs/components/PromoCode.js +3 -7
- package/dist/cjs/components/Reward.d.ts +3 -2
- package/dist/cjs/components/Reward.js +3 -4
- package/dist/cjs/components/Rewards.d.ts +4 -2
- package/dist/cjs/components/Rewards.js +3 -4
- package/dist/cjs/components/SignInOptions.d.ts +6 -2
- package/dist/cjs/components/SignInOptions.js +3 -4
- package/dist/cjs/components/SignInPhone.d.ts +4 -2
- package/dist/cjs/components/SignInPhone.js +3 -7
- package/dist/cjs/components/Upsells.d.ts +3 -2
- package/dist/cjs/components/Upsells.js +2 -3
- package/dist/esm/components/Cart.d.ts +6 -2
- package/dist/esm/components/Cart.js +4 -5
- package/dist/esm/components/CartItem.d.ts +3 -2
- package/dist/esm/components/CartItem.js +5 -6
- package/dist/esm/components/CartUpsells.d.ts +3 -2
- package/dist/esm/components/CartUpsells.js +3 -4
- package/dist/esm/components/CategoryNav.d.ts +4 -2
- package/dist/esm/components/CategoryNav.js +4 -5
- package/dist/esm/components/Header.d.ts +3 -2
- package/dist/esm/components/Header.js +3 -4
- package/dist/esm/components/ItemGroup.d.ts +4 -2
- package/dist/esm/components/ItemGroup.js +4 -5
- package/dist/esm/components/ItemGroups.d.ts +7 -3
- package/dist/esm/components/ItemGroups.js +4 -5
- package/dist/esm/components/ItemSelections.d.ts +5 -3
- package/dist/esm/components/ItemSelections.js +4 -5
- package/dist/esm/components/MadeForNotes.d.ts +4 -2
- package/dist/esm/components/MadeForNotes.js +4 -5
- package/dist/esm/components/Option.d.ts +7 -2
- package/dist/esm/components/Option.js +18 -5
- package/dist/esm/components/OrderCard.d.ts +3 -2
- package/dist/esm/components/OrderCard.js +3 -4
- package/dist/esm/components/PointsReward.d.ts +3 -2
- package/dist/esm/components/PointsReward.js +2 -3
- package/dist/esm/components/PointsRewards.d.ts +4 -2
- package/dist/esm/components/PointsRewards.js +3 -4
- package/dist/esm/components/PromoCode.d.ts +4 -2
- package/dist/esm/components/PromoCode.js +4 -8
- package/dist/esm/components/Reward.d.ts +3 -2
- package/dist/esm/components/Reward.js +3 -4
- package/dist/esm/components/Rewards.d.ts +4 -2
- package/dist/esm/components/Rewards.js +3 -4
- package/dist/esm/components/SignInOptions.d.ts +6 -2
- package/dist/esm/components/SignInOptions.js +4 -5
- package/dist/esm/components/SignInPhone.d.ts +4 -2
- package/dist/esm/components/SignInPhone.js +4 -8
- package/dist/esm/components/Upsells.d.ts +3 -2
- package/dist/esm/components/Upsells.js +3 -4
- package/package.json +1 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Discount } from '@open-tender/types';
|
|
2
|
-
import { RewardProps } from '@open-tender/ui';
|
|
2
|
+
import { RewardProps, AppliedProps } from '@open-tender/ui';
|
|
3
3
|
import React, { ReactNode } from 'react';
|
|
4
|
-
declare const Reward: ({ reward, callback, isLast, children, apiUrl }: {
|
|
4
|
+
declare const Reward: ({ reward, callback, isLast, children, apiUrl, AppliedView }: {
|
|
5
5
|
reward: Discount;
|
|
6
6
|
callback?: () => void;
|
|
7
7
|
isLast?: boolean;
|
|
8
8
|
children: (props: RewardProps) => ReactNode;
|
|
9
9
|
apiUrl: string;
|
|
10
|
+
AppliedView: (props: AppliedProps) => ReactNode;
|
|
10
11
|
}) => React.ReactNode;
|
|
11
12
|
export default Reward;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
|
-
var
|
|
5
|
-
var react_1 = tslib_1.__importDefault(require("react"));
|
|
4
|
+
var react_1 = tslib_1.__importStar(require("react"));
|
|
6
5
|
var hooks_1 = require("../app/hooks");
|
|
7
6
|
var slices_1 = require("../slices");
|
|
8
7
|
var Applied_1 = tslib_1.__importDefault(require("./Applied"));
|
|
9
8
|
var Reward = function (_a) {
|
|
10
|
-
var reward = _a.reward, callback = _a.callback, isLast = _a.isLast, children = _a.children, apiUrl = _a.apiUrl;
|
|
9
|
+
var reward = _a.reward, callback = _a.callback, isLast = _a.isLast, children = _a.children, apiUrl = _a.apiUrl, AppliedView = _a.AppliedView;
|
|
11
10
|
var dispatch = (0, hooks_1.useAppDispatch)();
|
|
12
11
|
var _b = (0, hooks_1.useAppSelector)(slices_1.selectKioskConfig), config = _b.reward, cardConfig = _b.card;
|
|
13
12
|
var check = (0, hooks_1.useAppSelector)(slices_1.selectPosCheckout).check;
|
|
@@ -25,7 +24,7 @@ var Reward = function (_a) {
|
|
|
25
24
|
callback();
|
|
26
25
|
};
|
|
27
26
|
var handlers = { apply: apply, remove: remove };
|
|
28
|
-
var renderApplied = function () { return react_1.default.createElement(Applied_1.default, { children:
|
|
27
|
+
var renderApplied = (0, react_1.useCallback)(function () { return react_1.default.createElement(Applied_1.default, { children: AppliedView }); }, [AppliedView]);
|
|
29
28
|
return children({
|
|
30
29
|
config: config,
|
|
31
30
|
handlers: handlers,
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { Discounts } from '@open-tender/types';
|
|
2
|
-
import { RewardsProps } from '@open-tender/ui';
|
|
2
|
+
import { AppliedProps, RewardProps, RewardsProps } from '@open-tender/ui';
|
|
3
3
|
import React, { ReactNode } from 'react';
|
|
4
|
-
declare const Rewards: ({ title, subtitle, rewards, children, apiUrl }: {
|
|
4
|
+
declare const Rewards: ({ title, subtitle, rewards, children, apiUrl, RewardView, AppliedView }: {
|
|
5
5
|
title: string;
|
|
6
6
|
subtitle?: string;
|
|
7
7
|
rewards: Discounts;
|
|
8
8
|
children: (props: RewardsProps) => ReactNode;
|
|
9
9
|
apiUrl: string;
|
|
10
|
+
RewardView: (props: RewardProps) => ReactNode;
|
|
11
|
+
AppliedView: (props: AppliedProps) => ReactNode;
|
|
10
12
|
}) => React.ReactNode;
|
|
11
13
|
export default Rewards;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
|
-
var
|
|
5
|
-
var react_1 = tslib_1.__importDefault(require("react"));
|
|
4
|
+
var react_1 = tslib_1.__importStar(require("react"));
|
|
6
5
|
var hooks_1 = require("../app/hooks");
|
|
7
6
|
var slices_1 = require("../slices");
|
|
8
7
|
var Reward_1 = tslib_1.__importDefault(require("./Reward"));
|
|
9
8
|
var Rewards = function (_a) {
|
|
10
|
-
var title = _a.title, subtitle = _a.subtitle, rewards = _a.rewards, children = _a.children, apiUrl = _a.apiUrl;
|
|
9
|
+
var title = _a.title, subtitle = _a.subtitle, rewards = _a.rewards, children = _a.children, apiUrl = _a.apiUrl, RewardView = _a.RewardView, AppliedView = _a.AppliedView;
|
|
11
10
|
var config = (0, hooks_1.useAppSelector)(slices_1.selectKioskConfig).rewards;
|
|
12
|
-
var renderReward = function (reward, isLast) { return (react_1.default.createElement(Reward_1.default, { apiUrl: apiUrl, reward: reward, isLast: isLast, children:
|
|
11
|
+
var renderReward = (0, react_1.useCallback)(function (reward, isLast) { return (react_1.default.createElement(Reward_1.default, { apiUrl: apiUrl, reward: reward, isLast: isLast, children: RewardView, AppliedView: AppliedView })); }, [RewardView, AppliedView, apiUrl]);
|
|
13
12
|
return children({ config: config, title: title, subtitle: subtitle, rewards: rewards, renderReward: renderReward });
|
|
14
13
|
};
|
|
15
14
|
exports.default = Rewards;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { SignInOptionsProps } from '@open-tender/ui';
|
|
1
|
+
import { SignInOptionsProps, SignInQrProps, SignInPhoneProps, InputProps, ErrorMessageProps } from '@open-tender/ui';
|
|
2
2
|
import React, { ReactNode } from 'react';
|
|
3
|
-
declare const SignInOptions: ({ close, children }: {
|
|
3
|
+
declare const SignInOptions: ({ close, children, SignInQrView, SignInPhoneView, InputView, ErrorMessageView }: {
|
|
4
4
|
close: () => void;
|
|
5
5
|
children: (props: SignInOptionsProps) => ReactNode;
|
|
6
|
+
SignInQrView: (props: SignInQrProps) => ReactNode;
|
|
7
|
+
SignInPhoneView: (props: SignInPhoneProps) => ReactNode;
|
|
8
|
+
InputView: (props: InputProps) => ReactNode;
|
|
9
|
+
ErrorMessageView: (props: ErrorMessageProps) => ReactNode;
|
|
6
10
|
}) => React.ReactNode;
|
|
7
11
|
export default SignInOptions;
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
|
-
var ui_1 = require("@open-tender/ui");
|
|
5
4
|
var react_1 = tslib_1.__importStar(require("react"));
|
|
6
5
|
var hooks_1 = require("../app/hooks");
|
|
7
6
|
var slices_1 = require("../slices");
|
|
8
7
|
var SignInPhone_1 = tslib_1.__importDefault(require("./SignInPhone"));
|
|
9
8
|
var SignInQr_1 = tslib_1.__importDefault(require("./SignInQr"));
|
|
10
9
|
var SignInOptions = function (_a) {
|
|
11
|
-
var close = _a.close, children = _a.children;
|
|
10
|
+
var close = _a.close, children = _a.children, SignInQrView = _a.SignInQrView, SignInPhoneView = _a.SignInPhoneView, InputView = _a.InputView, ErrorMessageView = _a.ErrorMessageView;
|
|
12
11
|
var _b = (0, hooks_1.useAppSelector)(slices_1.selectKioskConfig), config = _b.signInOptions, modalContentConfig = _b.modalContent;
|
|
13
12
|
var _c = (0, react_1.useState)(null), signInType = _c[0], setSignInType = _c[1];
|
|
14
13
|
var handlers = { close: close, setSignInType: setSignInType };
|
|
15
|
-
var renderSignInQr = function (close) { return (react_1.default.createElement(SignInQr_1.default, { close: close, children:
|
|
16
|
-
var renderSignInPhone = function (close) { return (react_1.default.createElement(SignInPhone_1.default, { close: close, children:
|
|
14
|
+
var renderSignInQr = (0, react_1.useCallback)(function (close) { return (react_1.default.createElement(SignInQr_1.default, { close: close, children: SignInQrView })); }, [SignInQrView]);
|
|
15
|
+
var renderSignInPhone = (0, react_1.useCallback)(function (close) { return (react_1.default.createElement(SignInPhone_1.default, { ErrorMessageView: ErrorMessageView, InputView: InputView, close: close, children: SignInPhoneView })); }, [SignInPhoneView, InputView, ErrorMessageView]);
|
|
17
16
|
if (!config)
|
|
18
17
|
return null;
|
|
19
18
|
return children({
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { SignInPhoneProps } from '@open-tender/ui';
|
|
1
|
+
import { SignInPhoneProps, InputProps, ErrorMessageProps } from '@open-tender/ui';
|
|
2
2
|
import React, { ReactNode } from 'react';
|
|
3
|
-
declare const SignInPhone: ({ close, children }: {
|
|
3
|
+
declare const SignInPhone: ({ close, children, InputView, ErrorMessageView }: {
|
|
4
4
|
close: () => void;
|
|
5
5
|
children: (props: SignInPhoneProps) => ReactNode;
|
|
6
|
+
InputView: (props: InputProps) => ReactNode;
|
|
7
|
+
ErrorMessageView: (props: ErrorMessageProps) => ReactNode;
|
|
6
8
|
}) => React.ReactNode;
|
|
7
9
|
export default SignInPhone;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
|
-
var ui_1 = require("@open-tender/ui");
|
|
5
4
|
var utils_1 = require("@open-tender/utils");
|
|
6
5
|
var react_1 = tslib_1.__importStar(require("react"));
|
|
7
6
|
var hooks_1 = require("../app/hooks");
|
|
@@ -9,7 +8,7 @@ var slices_1 = require("../slices");
|
|
|
9
8
|
var ErrorMessage_1 = tslib_1.__importDefault(require("./ErrorMessage"));
|
|
10
9
|
var Input_1 = tslib_1.__importDefault(require("./Input"));
|
|
11
10
|
var SignInPhone = function (_a) {
|
|
12
|
-
var close = _a.close, children = _a.children;
|
|
11
|
+
var close = _a.close, children = _a.children, InputView = _a.InputView, ErrorMessageView = _a.ErrorMessageView;
|
|
13
12
|
var dispatch = (0, hooks_1.useAppDispatch)();
|
|
14
13
|
var _b = (0, react_1.useState)(''), phone = _b[0], setPhone = _b[1];
|
|
15
14
|
var _c = (0, react_1.useState)(false), submitted = _c[0], setSubmitted = _c[1];
|
|
@@ -18,9 +17,6 @@ var SignInPhone = function (_a) {
|
|
|
18
17
|
var _f = (0, hooks_1.useAppSelector)(slices_1.selectCustomerIdentify), customer = _f.data, loading = _f.loading, error = _f.error;
|
|
19
18
|
var hasCustomer = !!customer;
|
|
20
19
|
var isLoading = loading === 'pending';
|
|
21
|
-
var update = function (value) {
|
|
22
|
-
setPhone((0, utils_1.makePhone)(value));
|
|
23
|
-
};
|
|
24
20
|
var submit = function () {
|
|
25
21
|
setSubmitted(true);
|
|
26
22
|
dispatch((0, slices_1.fetchCustomerIdentify)({ phone: phone }));
|
|
@@ -44,8 +40,8 @@ var SignInPhone = function (_a) {
|
|
|
44
40
|
if (hasCustomer)
|
|
45
41
|
close();
|
|
46
42
|
}, [hasCustomer, close]);
|
|
47
|
-
var renderInput = function (value, isRequired, style) { return (react_1.default.createElement(Input_1.default, { setValue:
|
|
48
|
-
var renderErrorMessage = function (errMsg) { return (react_1.default.createElement(ErrorMessage_1.default, { content: errMsg, children:
|
|
43
|
+
var renderInput = (0, react_1.useCallback)(function (value, isRequired, style) { return (react_1.default.createElement(Input_1.default, { setValue: function (value) { return setPhone((0, utils_1.makePhone)(value)); }, value: value, isRequired: isRequired, style: style, children: InputView })); }, [InputView]);
|
|
44
|
+
var renderErrorMessage = (0, react_1.useCallback)(function (errMsg) { return (react_1.default.createElement(ErrorMessage_1.default, { content: errMsg, children: ErrorMessageView })); }, [ErrorMessageView]);
|
|
49
45
|
return children({
|
|
50
46
|
config: config,
|
|
51
47
|
handlers: handlers,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { UpsellsProps } from '@open-tender/ui';
|
|
1
|
+
import { UpsellsProps, UpsellItemProps } from '@open-tender/ui';
|
|
2
2
|
import React, { ReactNode } from 'react';
|
|
3
|
-
declare const Upsells: ({ itemIds, close, children, apiUrl }: {
|
|
3
|
+
declare const Upsells: ({ itemIds, close, children, apiUrl, UpsellItemView }: {
|
|
4
4
|
itemIds: number[];
|
|
5
5
|
close: () => void;
|
|
6
6
|
children: (props: UpsellsProps) => ReactNode;
|
|
7
7
|
apiUrl: string;
|
|
8
|
+
UpsellItemView: (props: UpsellItemProps) => ReactNode;
|
|
8
9
|
}) => React.ReactNode;
|
|
9
10
|
export default Upsells;
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
|
-
var ui_1 = require("@open-tender/ui");
|
|
5
4
|
var utils_1 = require("@open-tender/utils");
|
|
6
5
|
var react_1 = tslib_1.__importStar(require("react"));
|
|
7
6
|
var hooks_1 = require("../app/hooks");
|
|
8
7
|
var slices_1 = require("../slices");
|
|
9
8
|
var UpsellItem_1 = tslib_1.__importDefault(require("./UpsellItem"));
|
|
10
9
|
var Upsells = function (_a) {
|
|
11
|
-
var itemIds = _a.itemIds, close = _a.close, children = _a.children, apiUrl = _a.apiUrl;
|
|
10
|
+
var itemIds = _a.itemIds, close = _a.close, children = _a.children, apiUrl = _a.apiUrl, UpsellItemView = _a.UpsellItemView;
|
|
12
11
|
var config = (0, hooks_1.useAppSelector)(slices_1.selectKioskConfig).upsells;
|
|
13
12
|
var categories = (0, hooks_1.useAppSelector)(slices_1.selectMenu).categories;
|
|
14
13
|
var itemLookup = (0, react_1.useMemo)(function () { return (0, utils_1.makeMenuItemLookup)(categories); }, [categories]);
|
|
15
14
|
var items = (0, utils_1.makeUpsellItems)(itemIds, itemLookup);
|
|
16
15
|
var handlers = { close: close };
|
|
17
|
-
var renderUpsellItem = function (item, isLast) { return (react_1.default.createElement(UpsellItem_1.default, { apiUrl: apiUrl, item: item, isLast: isLast, children:
|
|
16
|
+
var renderUpsellItem = (0, react_1.useCallback)(function (item, isLast) { return (react_1.default.createElement(UpsellItem_1.default, { apiUrl: apiUrl, item: item, isLast: isLast, children: UpsellItemView })); }, [apiUrl, UpsellItemView]);
|
|
18
17
|
return children({
|
|
19
18
|
config: config,
|
|
20
19
|
handlers: handlers,
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { CartProps } from '@open-tender/ui';
|
|
1
|
+
import { CartProps, CartUpsellsProps, CartItemProps, QuantityProps, CartUpsellItemProps } from '@open-tender/ui';
|
|
2
2
|
import React, { ReactNode } from 'react';
|
|
3
|
-
declare const Cart: ({ navigate, children, apiUrl }: {
|
|
3
|
+
declare const Cart: ({ navigate, children, apiUrl, CartUpsellsView, CartItemView, QuantityView, CartUpsellItemView }: {
|
|
4
4
|
navigate: (route: string) => void;
|
|
5
5
|
children: (props: CartProps) => ReactNode;
|
|
6
6
|
apiUrl: string;
|
|
7
|
+
CartUpsellsView: (props: CartUpsellsProps) => ReactNode;
|
|
8
|
+
CartItemView: (props: CartItemProps) => ReactNode;
|
|
9
|
+
QuantityView: (props: QuantityProps) => ReactNode;
|
|
10
|
+
CartUpsellItemView: (props: CartUpsellItemProps) => ReactNode;
|
|
7
11
|
}) => React.ReactNode;
|
|
8
12
|
export default Cart;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React, { useEffect } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect } from 'react';
|
|
3
2
|
import { useAppDispatch, useAppSelector } from '../app/hooks';
|
|
4
3
|
import { closeCartSummary, selectCartSummary, selectCartTotals, selectKioskConfig, selectOrder, toggleCartSummary } from '../slices';
|
|
5
4
|
import { default as CartItemContainer } from './CartItem';
|
|
6
5
|
import { default as CartUpsellsContainer } from './CartUpsells';
|
|
7
6
|
var Cart = function (_a) {
|
|
8
|
-
var navigate = _a.navigate, children = _a.children, apiUrl = _a.apiUrl;
|
|
7
|
+
var navigate = _a.navigate, children = _a.children, apiUrl = _a.apiUrl, CartUpsellsView = _a.CartUpsellsView, CartItemView = _a.CartItemView, QuantityView = _a.QuantityView, CartUpsellItemView = _a.CartUpsellItemView;
|
|
9
8
|
var dispatch = useAppDispatch();
|
|
10
9
|
var config = useAppSelector(selectKioskConfig).cart;
|
|
11
10
|
var cart = useAppSelector(selectOrder).cart;
|
|
@@ -20,8 +19,8 @@ var Cart = function (_a) {
|
|
|
20
19
|
return;
|
|
21
20
|
dispatch(closeCartSummary());
|
|
22
21
|
}, [dispatch, isOpen, isEmpty]);
|
|
23
|
-
var renderCartItem = function (item, isLast) { return (React.createElement(CartItemContainer, { navigate: navigate, item: item, isLast: isLast, children:
|
|
24
|
-
var renderCartUpsells = function () { return (React.createElement(CartUpsellsContainer, { apiUrl: apiUrl, children:
|
|
22
|
+
var renderCartItem = useCallback(function (item, isLast) { return (React.createElement(CartItemContainer, { navigate: navigate, item: item, isLast: isLast, apiUrl: apiUrl, children: CartItemView, QuantityView: QuantityView })); }, [navigate, apiUrl, CartItemView, QuantityView]);
|
|
23
|
+
var renderCartUpsells = useCallback(function () { return (React.createElement(CartUpsellsContainer, { CartUpsellItemView: CartUpsellItemView, apiUrl: apiUrl, children: CartUpsellsView })); }, [apiUrl, CartUpsellsView, CartUpsellItemView]);
|
|
25
24
|
if (!config)
|
|
26
25
|
return null;
|
|
27
26
|
return children({
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { CartItem as CartItemType } from '@open-tender/types';
|
|
2
|
-
import { CartItemProps } from '@open-tender/ui';
|
|
2
|
+
import { CartItemProps, QuantityProps } from '@open-tender/ui';
|
|
3
3
|
import React, { ReactNode } from 'react';
|
|
4
|
-
declare const CartItem: ({ item, isLast, isEditable, navigate, children, apiUrl }: {
|
|
4
|
+
declare const CartItem: ({ item, isLast, isEditable, navigate, children, apiUrl, QuantityView }: {
|
|
5
5
|
item: CartItemType;
|
|
6
6
|
isLast?: boolean;
|
|
7
7
|
isEditable?: boolean;
|
|
8
8
|
navigate: (route: string) => void;
|
|
9
9
|
children: (props: CartItemProps) => ReactNode;
|
|
10
10
|
apiUrl: string;
|
|
11
|
+
QuantityView: (props: QuantityProps) => ReactNode;
|
|
11
12
|
}) => React.ReactNode;
|
|
12
13
|
export default CartItem;
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
3
2
|
import { useAppDispatch, useAppSelector } from '../app/hooks';
|
|
4
3
|
import { decrementItemInCart, incrementItemInCart, removeItemFromCart, selectKioskConfig, setCurrentItem } from '../slices';
|
|
5
4
|
import { default as QuantityContainer } from './Quantity';
|
|
6
5
|
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, apiUrl = _a.apiUrl;
|
|
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, apiUrl = _a.apiUrl, QuantityView = _a.QuantityView;
|
|
8
7
|
var dispatch = useAppDispatch();
|
|
9
8
|
var config = useAppSelector(selectKioskConfig).cartItem;
|
|
10
|
-
var increment = function () { return dispatch(incrementItemInCart(item)); };
|
|
11
|
-
var decrement = function () { return dispatch(decrementItemInCart(item)); };
|
|
9
|
+
var increment = useCallback(function () { return dispatch(incrementItemInCart(item)); }, [item, dispatch]);
|
|
10
|
+
var decrement = useCallback(function () { return dispatch(decrementItemInCart(item)); }, [dispatch, item]);
|
|
12
11
|
var remove = function () { return dispatch(removeItemFromCart(item)); };
|
|
13
12
|
var edit = function () {
|
|
14
13
|
dispatch(setCurrentItem(item));
|
|
15
14
|
navigate('/menu/item');
|
|
16
15
|
};
|
|
17
16
|
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:
|
|
17
|
+
var renderQuantity = useCallback(function (quantity) { return (React.createElement(QuantityContainer, { fontSize: 24, iconSize: 28, quantity: quantity, increment: increment, decrement: decrement, children: QuantityView })); }, [increment, decrement, QuantityView]);
|
|
19
18
|
return children({
|
|
20
19
|
item: item,
|
|
21
20
|
config: config,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { CartUpsellsProps } from '@open-tender/ui';
|
|
1
|
+
import { CartUpsellItemProps, CartUpsellsProps } from '@open-tender/ui';
|
|
2
2
|
import React, { ReactNode } from 'react';
|
|
3
|
-
declare const CartUpsells: ({ children, apiUrl }: {
|
|
3
|
+
declare const CartUpsells: ({ children, apiUrl, CartUpsellItemView }: {
|
|
4
4
|
children: (props: CartUpsellsProps) => ReactNode;
|
|
5
5
|
apiUrl: string;
|
|
6
|
+
CartUpsellItemView: (props: CartUpsellItemProps) => ReactNode;
|
|
6
7
|
}) => React.ReactNode;
|
|
7
8
|
export default CartUpsells;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { CartUpsellItem } from '@open-tender/ui';
|
|
2
1
|
import { makeUpsellItemsForCart } from '@open-tender/utils';
|
|
3
|
-
import React, { useMemo } from 'react';
|
|
2
|
+
import React, { useCallback, useMemo } from 'react';
|
|
4
3
|
import { useAppSelector } from '../app/hooks';
|
|
5
4
|
import { selectCartIds, selectKioskConfig, selectMenu } from '../slices';
|
|
6
5
|
import { default as CartUpsellItemContainer } from './CartUpsellItem';
|
|
7
6
|
var CartUpsells = function (_a) {
|
|
8
|
-
var children = _a.children, apiUrl = _a.apiUrl;
|
|
7
|
+
var children = _a.children, apiUrl = _a.apiUrl, CartUpsellItemView = _a.CartUpsellItemView;
|
|
9
8
|
var config = useAppSelector(selectKioskConfig).cartUpsells;
|
|
10
9
|
var cartIds = useAppSelector(selectCartIds);
|
|
11
10
|
var _b = useAppSelector(selectMenu), categories = _b.categories, soldOut = _b.soldOut;
|
|
12
11
|
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,
|
|
12
|
+
var renderCartUpsellItem = useCallback(function (item, isLast) { return (React.createElement(CartUpsellItemContainer, { item: item, isLast: isLast, apiUrl: apiUrl, children: CartUpsellItemView })); }, [apiUrl, CartUpsellItemView]);
|
|
14
13
|
if (!upsellItems.length)
|
|
15
14
|
return null;
|
|
16
15
|
return children({
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { CategoryNavProps } from '@open-tender/ui';
|
|
1
|
+
import { CategoryNavProps, CategoryNavOtherProps, CategoryNavItemProps } from '@open-tender/ui';
|
|
2
2
|
import React, { ReactNode } from 'react';
|
|
3
|
-
declare const CategoryNav: ({ children, navigate, apiUrl }: {
|
|
3
|
+
declare const CategoryNav: ({ children, navigate, apiUrl, CategoryNavOtherView, CategoryNavItemView }: {
|
|
4
4
|
children: (props: CategoryNavProps) => ReactNode;
|
|
5
5
|
navigate: (route: string) => void;
|
|
6
6
|
apiUrl: string;
|
|
7
|
+
CategoryNavOtherView: (props: CategoryNavOtherProps) => ReactNode;
|
|
8
|
+
CategoryNavItemView: (props: CategoryNavItemProps) => ReactNode;
|
|
7
9
|
}) => React.ReactNode;
|
|
8
10
|
export default CategoryNav;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
3
2
|
import { useAppSelector } from '../app/hooks';
|
|
4
3
|
import { selectKioskConfig, selectMenu } from '../slices';
|
|
5
4
|
import { default as CategoryNavItemContainer } from './CategoryNavItem';
|
|
6
5
|
import { default as CategoryNavOtherContainer } from './CategoryNavOther';
|
|
7
6
|
var CategoryNav = function (_a) {
|
|
8
|
-
var children = _a.children, navigate = _a.navigate, apiUrl = _a.apiUrl;
|
|
7
|
+
var children = _a.children, navigate = _a.navigate, apiUrl = _a.apiUrl, CategoryNavOtherView = _a.CategoryNavOtherView, CategoryNavItemView = _a.CategoryNavItemView;
|
|
9
8
|
var categoryNav = useAppSelector(selectKioskConfig).categoryNav;
|
|
10
9
|
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, { apiUrl: apiUrl, navigate: navigate, title: title, path: path, children:
|
|
12
|
-
var renderCategoryNavItem = function (item) { return (React.createElement(CategoryNavItemContainer, { apiUrl: apiUrl, navigate: navigate, category: item, children:
|
|
10
|
+
var renderCategoryNavOther = useCallback(function (title, path) { return (React.createElement(CategoryNavOtherContainer, { apiUrl: apiUrl, navigate: navigate, title: title, path: path, children: CategoryNavOtherView })); }, [apiUrl, navigate, CategoryNavOtherView]);
|
|
11
|
+
var renderCategoryNavItem = useCallback(function (item) { return (React.createElement(CategoryNavItemContainer, { apiUrl: apiUrl, navigate: navigate, category: item, children: CategoryNavItemView })); }, [apiUrl, navigate, CategoryNavItemView]);
|
|
13
12
|
return children({
|
|
14
13
|
config: categoryNav,
|
|
15
14
|
categories: categories,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { HeaderProps } from '@open-tender/ui';
|
|
1
|
+
import { HeaderProps, SignInButtonProps } from '@open-tender/ui';
|
|
2
2
|
import React, { ReactNode } from 'react';
|
|
3
|
-
declare const Header: ({ to, pathname, navigate, children }: {
|
|
3
|
+
declare const Header: ({ to, pathname, navigate, children, SignInButtonView }: {
|
|
4
4
|
to?: string;
|
|
5
5
|
pathname: string;
|
|
6
6
|
navigate: (route: string) => void;
|
|
7
7
|
children: (props: HeaderProps) => ReactNode;
|
|
8
|
+
SignInButtonView: (props: SignInButtonProps) => ReactNode;
|
|
8
9
|
}) => React.ReactNode;
|
|
9
10
|
export default Header;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
3
2
|
import { useAppDispatch, useAppSelector } from '../app/hooks';
|
|
4
3
|
import { selectKioskConfig, toggleSidebar } from '../slices';
|
|
5
4
|
import { default as SignInButtonContainer } from './SignInButton';
|
|
6
5
|
var Header = function (_a) {
|
|
7
|
-
var to = _a.to, pathname = _a.pathname, navigate = _a.navigate, children = _a.children;
|
|
6
|
+
var to = _a.to, pathname = _a.pathname, navigate = _a.navigate, children = _a.children, SignInButtonView = _a.SignInButtonView;
|
|
8
7
|
var dispatch = useAppDispatch();
|
|
9
8
|
var header = (useAppSelector(selectKioskConfig) || {}).header;
|
|
10
9
|
var back = function () {
|
|
@@ -15,7 +14,7 @@ var Header = function (_a) {
|
|
|
15
14
|
dispatch(toggleSidebar());
|
|
16
15
|
};
|
|
17
16
|
var handlers = to ? { back: back, open: open } : null;
|
|
18
|
-
var renderSignInButton = function () { return (React.createElement(SignInButtonContainer, { pathname: pathname, navigate: navigate, children:
|
|
17
|
+
var renderSignInButton = useCallback(function () { return (React.createElement(SignInButtonContainer, { pathname: pathname, navigate: navigate, children: SignInButtonView })); }, [pathname, navigate, SignInButtonView]);
|
|
19
18
|
if (!header)
|
|
20
19
|
return null;
|
|
21
20
|
return children({ config: header, handlers: handlers, renderSignInButton: renderSignInButton });
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { CartItemGroup } from '@open-tender/types';
|
|
2
|
-
import { ItemGroupProps } from '@open-tender/ui';
|
|
2
|
+
import { ErrorMessageProps, ItemGroupProps, SuccessMessageProps } from '@open-tender/ui';
|
|
3
3
|
import React, { ReactNode } from 'react';
|
|
4
|
-
declare const ItemGroup: ({ group, content, children }: {
|
|
4
|
+
declare const ItemGroup: ({ group, content, children, ErrorMessageView, SuccessMessageView }: {
|
|
5
5
|
group: CartItemGroup;
|
|
6
6
|
content: ReactNode;
|
|
7
7
|
children: (props: ItemGroupProps) => ReactNode;
|
|
8
|
+
ErrorMessageView: (props: ErrorMessageProps) => ReactNode;
|
|
9
|
+
SuccessMessageView: (props: SuccessMessageProps) => ReactNode;
|
|
8
10
|
}) => React.ReactNode;
|
|
9
11
|
export default ItemGroup;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { ErrorMessage, SuccessMessage } from '@open-tender/ui';
|
|
2
1
|
import { useModifierGroup } from '@open-tender/utils';
|
|
3
|
-
import React from 'react';
|
|
2
|
+
import React, { useCallback } from 'react';
|
|
4
3
|
import { useAppSelector } from '../app/hooks';
|
|
5
4
|
import { selectKioskConfig } from '../slices';
|
|
6
5
|
import { default as ErrorMessageContainer } from './ErrorMessage';
|
|
7
6
|
import { default as SuccessMessageContainer } from './SuccessMessage';
|
|
8
7
|
var ItemGroup = function (_a) {
|
|
9
|
-
var group = _a.group, content = _a.content, children = _a.children;
|
|
8
|
+
var group = _a.group, content = _a.content, children = _a.children, ErrorMessageView = _a.ErrorMessageView, SuccessMessageView = _a.SuccessMessageView;
|
|
10
9
|
var config = useAppSelector(selectKioskConfig).itemGroup;
|
|
11
10
|
var modifierGroup = useModifierGroup(group);
|
|
12
|
-
var renderErrorMessage = function (icon, children) { return (React.createElement(ErrorMessageContainer, { icon: icon, content: children, children:
|
|
13
|
-
var renderSuccessMessage = function (icon, children) { return (React.createElement(SuccessMessageContainer, { icon: icon, content: children, children:
|
|
11
|
+
var renderErrorMessage = useCallback(function (icon, children) { return (React.createElement(ErrorMessageContainer, { icon: icon, content: children, children: ErrorMessageView })); }, [ErrorMessageView]);
|
|
12
|
+
var renderSuccessMessage = useCallback(function (icon, children) { return (React.createElement(SuccessMessageContainer, { icon: icon, content: children, children: SuccessMessageView })); }, [SuccessMessageView]);
|
|
14
13
|
return children({
|
|
15
14
|
config: config,
|
|
16
15
|
group: modifierGroup,
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { CartItemGroups, CartLevels } from '@open-tender/types';
|
|
2
|
-
import { Handlers, ItemGroupsProps } from '@open-tender/ui';
|
|
2
|
+
import { Handlers, ItemGroupsProps, ItemOptionProps, ErrorMessageProps, SuccessMessageProps, ItemGroupProps } from '@open-tender/ui';
|
|
3
3
|
import React, { ReactNode } from 'react';
|
|
4
|
-
declare const ItemGroups: ({ handlers, groups, levels, excludeSize, children, apiUrl }: {
|
|
4
|
+
declare const ItemGroups: ({ handlers, groups, levels, excludeSize, children, apiUrl, ItemGroupView, ItemOptionView, ErrorMessageView, SuccessMessageView }: {
|
|
5
5
|
handlers: Handlers;
|
|
6
6
|
groups: CartItemGroups;
|
|
7
7
|
levels: CartLevels;
|
|
8
8
|
excludeSize?: boolean;
|
|
9
|
-
children: (props: ItemGroupsProps) => ReactNode;
|
|
10
9
|
apiUrl: string;
|
|
10
|
+
children: (props: ItemGroupsProps) => ReactNode;
|
|
11
|
+
ItemOptionView: (props: ItemOptionProps) => ReactNode;
|
|
12
|
+
ItemGroupView: (props: ItemGroupProps) => ReactNode;
|
|
13
|
+
ErrorMessageView: (props: ErrorMessageProps) => ReactNode;
|
|
14
|
+
SuccessMessageView: (props: SuccessMessageProps) => ReactNode;
|
|
11
15
|
}) => React.ReactNode;
|
|
12
16
|
export default ItemGroups;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
3
2
|
import { useAppSelector } from '../app/hooks';
|
|
4
3
|
import { selectKioskConfig } from '../slices';
|
|
5
4
|
import { default as ItemGroupContainer } from './ItemGroup';
|
|
6
5
|
import { default as ItemOptionContainer } from './ItemOption';
|
|
7
6
|
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, apiUrl = _a.apiUrl;
|
|
7
|
+
var handlers = _a.handlers, groups = _a.groups, levels = _a.levels, _b = _a.excludeSize, excludeSize = _b === void 0 ? true : _b, children = _a.children, apiUrl = _a.apiUrl, ItemGroupView = _a.ItemGroupView, ItemOptionView = _a.ItemOptionView, ErrorMessageView = _a.ErrorMessageView, SuccessMessageView = _a.SuccessMessageView;
|
|
9
8
|
var config = useAppSelector(selectKioskConfig).itemGroups;
|
|
10
|
-
var renderItemOption = function (group, option) { return (React.createElement(ItemOptionContainer, { apiUrl: apiUrl, levels: levels, handlers: handlers, group: group, option: option, children:
|
|
11
|
-
var renderItemGroup = function (group, content) { return (React.createElement(ItemGroupContainer, { group: group, content: content, children:
|
|
9
|
+
var renderItemOption = useCallback(function (group, option) { return (React.createElement(ItemOptionContainer, { apiUrl: apiUrl, levels: levels, handlers: handlers, group: group, option: option, children: ItemOptionView })); }, [apiUrl, levels, handlers, ItemOptionView]);
|
|
10
|
+
var renderItemGroup = useCallback(function (group, content) { return (React.createElement(ItemGroupContainer, { SuccessMessageView: SuccessMessageView, ErrorMessageView: ErrorMessageView, group: group, content: content, children: ItemGroupView })); }, [ItemGroupView, ErrorMessageView, SuccessMessageView]);
|
|
12
11
|
if (!config)
|
|
13
12
|
return null;
|
|
14
13
|
return children({
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { CartItemGroups, CartLevels } from '@open-tender/types';
|
|
2
|
-
import { Handlers, ItemSelectionsProps } from '@open-tender/ui';
|
|
2
|
+
import { Handlers, ItemSelectionsProps, ItemOptionProps, ErrorMessageProps } from '@open-tender/ui';
|
|
3
3
|
import React, { ReactNode } from 'react';
|
|
4
|
-
declare const ItemSelections: ({ handlers, groups, levels, isIncomplete, children, apiUrl }: {
|
|
4
|
+
declare const ItemSelections: ({ handlers, groups, levels, isIncomplete, children, apiUrl, ItemOptionView, ErrorMessageView }: {
|
|
5
5
|
handlers: Handlers;
|
|
6
6
|
groups: CartItemGroups;
|
|
7
7
|
levels: CartLevels;
|
|
8
8
|
isIncomplete: boolean;
|
|
9
|
-
children: (props: ItemSelectionsProps) => ReactNode;
|
|
10
9
|
apiUrl: string;
|
|
10
|
+
children: (props: ItemSelectionsProps) => ReactNode;
|
|
11
|
+
ItemOptionView: (props: ItemOptionProps) => ReactNode;
|
|
12
|
+
ErrorMessageView: (props: ErrorMessageProps) => ReactNode;
|
|
11
13
|
}) => React.ReactNode;
|
|
12
14
|
export default ItemSelections;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
3
2
|
import { useAppSelector } from '../app/hooks';
|
|
4
3
|
import { selectKioskConfig } from '../slices';
|
|
5
4
|
import { default as ErrorMessageContainer } from './ErrorMessage';
|
|
6
5
|
import { default as ItemOptionContainer } from './ItemOption';
|
|
7
6
|
var ItemSelections = function (_a) {
|
|
8
|
-
var handlers = _a.handlers, groups = _a.groups, levels = _a.levels, isIncomplete = _a.isIncomplete, children = _a.children, apiUrl = _a.apiUrl;
|
|
7
|
+
var handlers = _a.handlers, groups = _a.groups, levels = _a.levels, isIncomplete = _a.isIncomplete, children = _a.children, apiUrl = _a.apiUrl, ItemOptionView = _a.ItemOptionView, ErrorMessageView = _a.ErrorMessageView;
|
|
9
8
|
var config = useAppSelector(selectKioskConfig).itemSelections;
|
|
10
|
-
var renderErrorMessage = function (icon, children) { return (React.createElement(ErrorMessageContainer, { icon: icon, content: children, children:
|
|
11
|
-
var renderItemOption = function (group, option) { return (React.createElement(ItemOptionContainer, { levels: levels, handlers: handlers, group: group, option: option,
|
|
9
|
+
var renderErrorMessage = useCallback(function (icon, children) { return (React.createElement(ErrorMessageContainer, { icon: icon, content: children, children: ErrorMessageView })); }, [ErrorMessageView]);
|
|
10
|
+
var renderItemOption = useCallback(function (group, option) { return (React.createElement(ItemOptionContainer, { levels: levels, handlers: handlers, group: group, option: option, apiUrl: apiUrl, children: ItemOptionView })); }, [levels, handlers, apiUrl, ItemOptionView]);
|
|
12
11
|
return children({
|
|
13
12
|
config: config,
|
|
14
13
|
groups: groups,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MadeForNotesProps } from '@open-tender/ui';
|
|
1
|
+
import { InputProps, MadeForNotesProps, TextAreaProps } from '@open-tender/ui';
|
|
2
2
|
import React, { ReactNode } from 'react';
|
|
3
|
-
declare const MadeForNotes: ({ subtitle, hasMadeFor, madeFor, setMadeFor, hasNotes, notes, setNotes, close, children }: {
|
|
3
|
+
declare const MadeForNotes: ({ subtitle, hasMadeFor, madeFor, setMadeFor, hasNotes, notes, setNotes, close, children, InputView, TextAreaView }: {
|
|
4
4
|
subtitle: string;
|
|
5
5
|
hasMadeFor: boolean;
|
|
6
6
|
madeFor: string | null;
|
|
@@ -10,5 +10,7 @@ declare const MadeForNotes: ({ subtitle, hasMadeFor, madeFor, setMadeFor, hasNot
|
|
|
10
10
|
setNotes: (notes: string) => void;
|
|
11
11
|
close: () => void;
|
|
12
12
|
children: (props: MadeForNotesProps) => ReactNode;
|
|
13
|
+
InputView: (props: InputProps) => ReactNode;
|
|
14
|
+
TextAreaView: (props: TextAreaProps) => ReactNode;
|
|
13
15
|
}) => React.ReactNode;
|
|
14
16
|
export default MadeForNotes;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
3
2
|
import { useAppSelector } from '../app/hooks';
|
|
4
3
|
import { selectKioskConfig } from '../slices';
|
|
5
4
|
import { default as InputContainer } from './Input';
|
|
6
5
|
import { default as TextAreaContainer } from './TextArea';
|
|
7
6
|
var MadeForNotes = function (_a) {
|
|
8
|
-
var subtitle = _a.subtitle, hasMadeFor = _a.hasMadeFor, madeFor = _a.madeFor, setMadeFor = _a.setMadeFor, hasNotes = _a.hasNotes, notes = _a.notes, setNotes = _a.setNotes, close = _a.close, children = _a.children;
|
|
7
|
+
var subtitle = _a.subtitle, hasMadeFor = _a.hasMadeFor, madeFor = _a.madeFor, setMadeFor = _a.setMadeFor, hasNotes = _a.hasNotes, notes = _a.notes, setNotes = _a.setNotes, close = _a.close, children = _a.children, InputView = _a.InputView, TextAreaView = _a.TextAreaView;
|
|
9
8
|
var _b = useAppSelector(selectKioskConfig), config = _b.madeForNotes, modalContentConfig = _b.modalContent;
|
|
10
9
|
var handlers = { submit: close };
|
|
11
|
-
var renderInput = function (label, value, isRequired, style) { return (React.createElement(InputContainer, { label: label, setValue: setMadeFor, value: value, isRequired: isRequired, style: style, children:
|
|
12
|
-
var renderTextArea = function (label, value, isRequired, style) { return (React.createElement(TextAreaContainer, { label: label, setValue: setNotes, value: value, isRequired: isRequired, style: style, children:
|
|
10
|
+
var renderInput = useCallback(function (label, value, isRequired, style) { return (React.createElement(InputContainer, { label: label, setValue: setMadeFor, value: value, isRequired: isRequired, style: style, children: InputView })); }, [setMadeFor, InputView]);
|
|
11
|
+
var renderTextArea = useCallback(function (label, value, isRequired, style) { return (React.createElement(TextAreaContainer, { label: label, setValue: setNotes, value: value, isRequired: isRequired, style: style, children: TextAreaView })); }, [TextAreaView, setNotes]);
|
|
13
12
|
return children({
|
|
14
13
|
config: config,
|
|
15
14
|
handlers: handlers,
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { CartItemOption, CartLevels } from '@open-tender/types';
|
|
2
|
-
import { Handlers, OptionProps } from '@open-tender/ui';
|
|
2
|
+
import { Handlers, OptionProps, ItemGroupsProps, ItemGroupProps, ItemOptionProps, SuccessMessageProps, ErrorMessageProps } from '@open-tender/ui';
|
|
3
3
|
import React, { ReactNode } from 'react';
|
|
4
|
-
declare const Option: ({ option, levels, handlers, close, children, apiUrl }: {
|
|
4
|
+
declare const Option: ({ option, levels, handlers, close, children, apiUrl, ItemGroupsView, ItemGroupView, ItemOptionView, SuccessMessageView, ErrorMessageView }: {
|
|
5
5
|
option: CartItemOption | null;
|
|
6
6
|
levels: CartLevels | null;
|
|
7
7
|
handlers: Handlers;
|
|
8
8
|
close: () => void;
|
|
9
9
|
children: (props: OptionProps) => ReactNode;
|
|
10
10
|
apiUrl: string;
|
|
11
|
+
ItemGroupsView: (props: ItemGroupsProps) => ReactNode;
|
|
12
|
+
ItemGroupView: (props: ItemGroupProps) => ReactNode;
|
|
13
|
+
ItemOptionView: (props: ItemOptionProps) => ReactNode;
|
|
14
|
+
SuccessMessageView: (props: SuccessMessageProps) => ReactNode;
|
|
15
|
+
ErrorMessageView: (props: ErrorMessageProps) => ReactNode;
|
|
11
16
|
}) => React.ReactNode;
|
|
12
17
|
export default Option;
|