@open-tender/store 1.0.36 → 1.1.0

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/.DS_Store ADDED
Binary file
@@ -1,7 +1,7 @@
1
1
  import { TypedUseSelectorHook } from 'react-redux';
2
2
  import type { RootState } from './store';
3
3
  export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<{
4
- alerts: import("..").Alerts;
4
+ alerts: import("../types").Alerts;
5
5
  arrivals: import("..").ArrivalsState;
6
6
  cartSummary: import("..").CartSummaryState;
7
7
  checkout: import("..").CheckoutState;
@@ -16,7 +16,7 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<{
16
16
  menu: import("..").MenuState;
17
17
  menuPages: import("..").MenuPagesState;
18
18
  modal: import("..").ModalState;
19
- notifications: import("..").Notifications;
19
+ notifications: import("../types").Notifications;
20
20
  offlineAuths: import("..").OfflineAuthsState;
21
21
  order: import("..").OrderState;
22
22
  pos: import("..").PosState;
@@ -1,6 +1,6 @@
1
1
  import { Action, ThunkAction } from '@reduxjs/toolkit';
2
2
  export declare const appReducer: import("redux").Reducer<{
3
- alerts: import("..").Alerts;
3
+ alerts: import("../types").Alerts;
4
4
  arrivals: import("../slices").ArrivalsState;
5
5
  cartSummary: import("../slices").CartSummaryState;
6
6
  checkout: import("../slices").CheckoutState;
@@ -15,7 +15,7 @@ export declare const appReducer: import("redux").Reducer<{
15
15
  menu: import("../slices").MenuState;
16
16
  menuPages: import("../slices").MenuPagesState;
17
17
  modal: import("../slices").ModalState;
18
- notifications: import("..").Notifications;
18
+ notifications: import("../types").Notifications;
19
19
  offlineAuths: import("../slices").OfflineAuthsState;
20
20
  order: import("../slices").OrderState;
21
21
  pos: import("../slices").PosState;
@@ -26,7 +26,7 @@ export declare const appReducer: import("redux").Reducer<{
26
26
  surcharges: import("../slices").SurchargesState;
27
27
  taxes: import("../slices").TaxesState;
28
28
  }, import("redux").UnknownAction, Partial<{
29
- alerts: import("..").Alerts | undefined;
29
+ alerts: import("../types").Alerts | undefined;
30
30
  arrivals: import("../slices").ArrivalsState | undefined;
31
31
  cartSummary: import("../slices").CartSummaryState | undefined;
32
32
  checkout: import("../slices").CheckoutState | undefined;
@@ -41,7 +41,7 @@ export declare const appReducer: import("redux").Reducer<{
41
41
  menu: import("../slices").MenuState | undefined;
42
42
  menuPages: import("../slices").MenuPagesState | undefined;
43
43
  modal: import("../slices").ModalState | undefined;
44
- notifications: import("..").Notifications | undefined;
44
+ notifications: import("../types").Notifications | undefined;
45
45
  offlineAuths: import("../slices").OfflineAuthsState | undefined;
46
46
  order: import("../slices").OrderState | undefined;
47
47
  pos: import("../slices").PosState | undefined;
@@ -54,7 +54,7 @@ export declare const appReducer: import("redux").Reducer<{
54
54
  }>>;
55
55
  export type AppState = ReturnType<typeof appReducer>;
56
56
  declare const store: import("@reduxjs/toolkit").EnhancedStore<{
57
- alerts: import("..").Alerts;
57
+ alerts: import("../types").Alerts;
58
58
  arrivals: import("../slices").ArrivalsState;
59
59
  cartSummary: import("../slices").CartSummaryState;
60
60
  checkout: import("../slices").CheckoutState;
@@ -69,7 +69,7 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<{
69
69
  menu: import("../slices").MenuState;
70
70
  menuPages: import("../slices").MenuPagesState;
71
71
  modal: import("../slices").ModalState;
72
- notifications: import("..").Notifications;
72
+ notifications: import("../types").Notifications;
73
73
  offlineAuths: import("../slices").OfflineAuthsState;
74
74
  order: import("../slices").OrderState;
75
75
  pos: import("../slices").PosState;
@@ -81,7 +81,7 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<{
81
81
  taxes: import("../slices").TaxesState;
82
82
  }, Action, import("@reduxjs/toolkit").Tuple<[import("redux").StoreEnhancer<{
83
83
  dispatch: import("redux-thunk").ThunkDispatch<{
84
- alerts: import("..").Alerts;
84
+ alerts: import("../types").Alerts;
85
85
  arrivals: import("../slices").ArrivalsState;
86
86
  cartSummary: import("../slices").CartSummaryState;
87
87
  checkout: import("../slices").CheckoutState;
@@ -96,7 +96,7 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<{
96
96
  menu: import("../slices").MenuState;
97
97
  menuPages: import("../slices").MenuPagesState;
98
98
  modal: import("../slices").ModalState;
99
- notifications: import("..").Notifications;
99
+ notifications: import("../types").Notifications;
100
100
  offlineAuths: import("../slices").OfflineAuthsState;
101
101
  order: import("../slices").OrderState;
102
102
  pos: import("../slices").PosState;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { MenuCategory as MenuCategoryType } from '@open-tender/types';
3
+ import { MenuCategoryProps } from '@open-tender/ui';
4
+ declare const MenuCategory: ({ category, navigate, children }: {
5
+ category: MenuCategoryType;
6
+ navigate: (route: string) => void;
7
+ children: (props: MenuCategoryProps) => React.ReactNode;
8
+ }) => import("react").ReactNode;
9
+ export default MenuCategory;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var hooks_1 = require("../hooks");
4
+ var hooks_2 = require("../app/hooks");
5
+ var slices_1 = require("../slices");
6
+ var MenuCategory = function (_a) {
7
+ var category = _a.category, navigate = _a.navigate, children = _a.children;
8
+ var dispatch = (0, hooks_2.useAppDispatch)();
9
+ var config = (0, hooks_2.useAppSelector)(slices_1.selectKioskConfig).menuCategory;
10
+ var imageUrl = (0, hooks_1.useKioskImageUrl)(category);
11
+ var browse = function () {
12
+ dispatch((0, slices_1.setCurrentCategory)(category));
13
+ navigate('/menu/category');
14
+ };
15
+ var handlers = { browse: browse };
16
+ return children({ config: config, handlers: handlers, category: category, imageUrl: imageUrl });
17
+ };
18
+ exports.default = MenuCategory;
@@ -0,0 +1,2 @@
1
+ import MenuCategory from './MenuCategory';
2
+ export { MenuCategory };
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MenuCategory = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var MenuCategory_1 = tslib_1.__importDefault(require("./MenuCategory"));
6
+ exports.MenuCategory = MenuCategory_1.default;
@@ -3,7 +3,8 @@ import useBuilder from './useBuilder';
3
3
  import useCardSwipe from './useCardSwipe';
4
4
  import useEmployee from './useEmployee';
5
5
  import useGiftCardBalance from './useGiftCardBalance';
6
+ import { useKioskImageUrl } from './useKioskImageUrl';
6
7
  import usePrevious from './usePrevious';
7
8
  import usePunch from './usePunch';
8
9
  import useRefund from './useRefund';
9
- export { useBarcode, useBuilder, useCardSwipe, useEmployee, useGiftCardBalance, usePrevious, usePunch, useRefund };
10
+ export { useBarcode, useBuilder, useCardSwipe, useEmployee, useGiftCardBalance, useKioskImageUrl, usePrevious, usePunch, useRefund };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useRefund = exports.usePunch = exports.usePrevious = exports.useGiftCardBalance = exports.useEmployee = exports.useCardSwipe = exports.useBuilder = exports.useBarcode = void 0;
3
+ exports.useRefund = exports.usePunch = exports.usePrevious = exports.useKioskImageUrl = exports.useGiftCardBalance = exports.useEmployee = exports.useCardSwipe = exports.useBuilder = exports.useBarcode = void 0;
4
4
  var tslib_1 = require("tslib");
5
5
  var useBarcode_1 = tslib_1.__importDefault(require("./useBarcode"));
6
6
  exports.useBarcode = useBarcode_1.default;
@@ -12,6 +12,8 @@ var useEmployee_1 = tslib_1.__importDefault(require("./useEmployee"));
12
12
  exports.useEmployee = useEmployee_1.default;
13
13
  var useGiftCardBalance_1 = tslib_1.__importDefault(require("./useGiftCardBalance"));
14
14
  exports.useGiftCardBalance = useGiftCardBalance_1.default;
15
+ var useKioskImageUrl_1 = require("./useKioskImageUrl");
16
+ Object.defineProperty(exports, "useKioskImageUrl", { enumerable: true, get: function () { return useKioskImageUrl_1.useKioskImageUrl; } });
15
17
  var usePrevious_1 = tslib_1.__importDefault(require("./usePrevious"));
16
18
  exports.usePrevious = usePrevious_1.default;
17
19
  var usePunch_1 = tslib_1.__importDefault(require("./usePunch"));
@@ -0,0 +1,2 @@
1
+ import { MenuCategory, MenuItem } from '@open-tender/types';
2
+ export declare const useKioskImageUrl: (entity: MenuItem | MenuCategory) => string | null;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useKioskImageUrl = void 0;
4
+ var hooks_1 = require("../app/hooks");
5
+ var slices_1 = require("../slices");
6
+ var useKioskImageUrl = function (entity) {
7
+ var apiUrl = (0, hooks_1.useAppSelector)(slices_1.selectKioskApi);
8
+ var app_image_url = entity.app_image_url, small_image_url = entity.small_image_url, large_image_url = entity.large_image_url;
9
+ var imageUrl = large_image_url || small_image_url || app_image_url;
10
+ if (!imageUrl)
11
+ return null;
12
+ return imageUrl.startsWith('/cloud-files') ? apiUrl + imageUrl : imageUrl;
13
+ };
14
+ exports.useKioskImageUrl = useKioskImageUrl;
@@ -1,6 +1,6 @@
1
1
  import { appReducer } from './app/store';
2
+ export * from './components';
2
3
  export * from './hooks';
3
4
  export * from './slices';
4
- export * from './types';
5
5
  export * from './utils';
6
6
  export { appReducer };
package/dist/cjs/index.js CHANGED
@@ -4,7 +4,7 @@ exports.appReducer = void 0;
4
4
  var tslib_1 = require("tslib");
5
5
  var store_1 = require("./app/store");
6
6
  Object.defineProperty(exports, "appReducer", { enumerable: true, get: function () { return store_1.appReducer; } });
7
+ tslib_1.__exportStar(require("./components"), exports);
7
8
  tslib_1.__exportStar(require("./hooks"), exports);
8
9
  tslib_1.__exportStar(require("./slices"), exports);
9
- tslib_1.__exportStar(require("./types"), exports);
10
10
  tslib_1.__exportStar(require("./utils"), exports);
@@ -40,8 +40,55 @@ export declare const selectKiosk: (state: AppState) => KioskState;
40
40
  export declare const selectKioskVersion: (state: AppState) => string | null | undefined;
41
41
  export declare const selectKioskStore: (state: AppState) => Store | null;
42
42
  export declare const selectKioskBrand: (state: AppState) => KioskBrand | null;
43
+ export declare const selectKioskApi: ((state: {
44
+ alerts: import("../types").Alerts;
45
+ arrivals: import("./arrivals").ArrivalsState;
46
+ cartSummary: import("./cartSummary").CartSummaryState;
47
+ checkout: import("./checkout").CheckoutState;
48
+ config: import("./config").ConfigState;
49
+ customer: import("./customer").CustomerState;
50
+ customerIdentify: import("./customerIdentify").CustomerIdentifyState;
51
+ deals: import("./deals").DealsState;
52
+ discounts: import("./discounts").DiscountsState;
53
+ errorAlerts: import("./errorAlerts").ErrorAlertsState;
54
+ kds: import("./kds").KdsState;
55
+ kiosk: KioskState;
56
+ menu: import("./menu").MenuState;
57
+ menuPages: import("./menuPages").MenuPagesState;
58
+ modal: import("./modal").ModalState;
59
+ notifications: import("../types").Notifications;
60
+ offlineAuths: import("./offlineAuths").OfflineAuthsState;
61
+ order: import("./order").OrderState;
62
+ pos: import("./pos").PosState;
63
+ punches: import("./punches").PunchesState;
64
+ refund: import("./refund").RefundState;
65
+ settings: import("./settings").SettingsState;
66
+ sidebar: import("./sidebar").SidebarState;
67
+ surcharges: import("./surcharges").SurchargesState;
68
+ taxes: import("./taxes").TaxesState;
69
+ }) => string) & {
70
+ clearCache: () => void;
71
+ resultsCount: () => number;
72
+ resetResultsCount: () => void;
73
+ } & {
74
+ resultFunc: (resultFuncArgs_0: KioskApp | null) => string;
75
+ memoizedResultFunc: ((resultFuncArgs_0: KioskApp | null) => string) & {
76
+ clearCache: () => void;
77
+ resultsCount: () => number;
78
+ resetResultsCount: () => void;
79
+ };
80
+ lastResult: () => string;
81
+ dependencies: [(state: AppState) => KioskApp | null];
82
+ recomputations: () => number;
83
+ resetRecomputations: () => void;
84
+ dependencyRecomputations: () => number;
85
+ resetDependencyRecomputations: () => void;
86
+ } & {
87
+ argsMemoize: typeof import("reselect").weakMapMemoize;
88
+ memoize: typeof import("reselect").weakMapMemoize;
89
+ };
43
90
  export declare const selectKioskConfig: ((state: {
44
- alerts: import("..").Alerts;
91
+ alerts: import("../types").Alerts;
45
92
  arrivals: import("./arrivals").ArrivalsState;
46
93
  cartSummary: import("./cartSummary").CartSummaryState;
47
94
  checkout: import("./checkout").CheckoutState;
@@ -56,7 +103,7 @@ export declare const selectKioskConfig: ((state: {
56
103
  menu: import("./menu").MenuState;
57
104
  menuPages: import("./menuPages").MenuPagesState;
58
105
  modal: import("./modal").ModalState;
59
- notifications: import("..").Notifications;
106
+ notifications: import("../types").Notifications;
60
107
  offlineAuths: import("./offlineAuths").OfflineAuthsState;
61
108
  order: import("./order").OrderState;
62
109
  pos: import("./pos").PosState;
@@ -88,7 +135,7 @@ export declare const selectKioskConfig: ((state: {
88
135
  memoize: typeof import("reselect").weakMapMemoize;
89
136
  };
90
137
  export declare const selectKioskConfigScreen: (screen: string) => ((state: {
91
- alerts: import("..").Alerts;
138
+ alerts: import("../types").Alerts;
92
139
  arrivals: import("./arrivals").ArrivalsState;
93
140
  cartSummary: import("./cartSummary").CartSummaryState;
94
141
  checkout: import("./checkout").CheckoutState;
@@ -103,7 +150,7 @@ export declare const selectKioskConfigScreen: (screen: string) => ((state: {
103
150
  menu: import("./menu").MenuState;
104
151
  menuPages: import("./menuPages").MenuPagesState;
105
152
  modal: import("./modal").ModalState;
106
- notifications: import("..").Notifications;
153
+ notifications: import("../types").Notifications;
107
154
  offlineAuths: import("./offlineAuths").OfflineAuthsState;
108
155
  order: import("./order").OrderState;
109
156
  pos: import("./pos").PosState;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.kioskReducer = exports.selectKioskRatio = exports.selectKioskStyles = exports.selectKioskConfigScreen = exports.selectKioskConfig = exports.selectKioskBrand = exports.selectKioskStore = exports.selectKioskVersion = exports.selectKiosk = exports.setKioskStyles = exports.setKioskConfig = exports.setKioskRatio = exports.setKioskVersion = exports.incrementKioskRetries = exports.resetKioskRetries = exports.resetKiosk = exports.fetchKioskConfig = exports.KioskActionType = void 0;
4
+ exports.kioskReducer = exports.selectKioskRatio = exports.selectKioskStyles = exports.selectKioskConfigScreen = exports.selectKioskConfig = exports.selectKioskApi = exports.selectKioskBrand = exports.selectKioskStore = exports.selectKioskVersion = exports.selectKiosk = exports.setKioskStyles = exports.setKioskConfig = exports.setKioskRatio = exports.setKioskVersion = exports.incrementKioskRetries = exports.resetKioskRetries = exports.resetKiosk = exports.fetchKioskConfig = exports.KioskActionType = void 0;
5
5
  var tslib_1 = require("tslib");
6
6
  var toolkit_1 = require("@reduxjs/toolkit");
7
7
  var services_1 = require("../services");
@@ -141,7 +141,14 @@ var selectKioskStore = function (state) { return state.kiosk.store; };
141
141
  exports.selectKioskStore = selectKioskStore;
142
142
  var selectKioskBrand = function (state) { return state.kiosk.brand; };
143
143
  exports.selectKioskBrand = selectKioskBrand;
144
- // export const selectKioskConfig = (state: AppState) => state.kiosk.config || {}
144
+ exports.selectKioskApi = (0, toolkit_1.createSelector)(function (state) {
145
+ var app = state.kiosk.app;
146
+ return app;
147
+ }, function (app) {
148
+ if (!app)
149
+ return 'http://kiosk';
150
+ return app.apiUrl.replace('/pos-api', '');
151
+ });
145
152
  exports.selectKioskConfig = (0, toolkit_1.createSelector)(function (state) {
146
153
  var config = state.kiosk.config;
147
154
  return config;
@@ -64,7 +64,7 @@ export declare const selectCurrentOption: (state: AppState) => NestedOption | nu
64
64
  export declare const selectCurrentSection: (state: AppState) => string | null;
65
65
  export declare const selectCart: (state: AppState) => Cart;
66
66
  export declare const selectCartIds: ((state: {
67
- alerts: import("..").Alerts;
67
+ alerts: import("../types").Alerts;
68
68
  arrivals: import("./arrivals").ArrivalsState;
69
69
  cartSummary: import("./cartSummary").CartSummaryState;
70
70
  checkout: import("./checkout").CheckoutState;
@@ -79,7 +79,7 @@ export declare const selectCartIds: ((state: {
79
79
  menu: import("./menu").MenuState;
80
80
  menuPages: import("./menuPages").MenuPagesState;
81
81
  modal: import("./modal").ModalState;
82
- notifications: import("..").Notifications;
82
+ notifications: import("../types").Notifications;
83
83
  offlineAuths: import("./offlineAuths").OfflineAuthsState;
84
84
  order: OrderState;
85
85
  pos: import("./pos").PosState;
@@ -111,7 +111,7 @@ export declare const selectCartIds: ((state: {
111
111
  memoize: typeof import("reselect").weakMapMemoize;
112
112
  };
113
113
  export declare const selectCartQuantity: ((state: {
114
- alerts: import("..").Alerts;
114
+ alerts: import("../types").Alerts;
115
115
  arrivals: import("./arrivals").ArrivalsState;
116
116
  cartSummary: import("./cartSummary").CartSummaryState;
117
117
  checkout: import("./checkout").CheckoutState;
@@ -126,7 +126,7 @@ export declare const selectCartQuantity: ((state: {
126
126
  menu: import("./menu").MenuState;
127
127
  menuPages: import("./menuPages").MenuPagesState;
128
128
  modal: import("./modal").ModalState;
129
- notifications: import("..").Notifications;
129
+ notifications: import("../types").Notifications;
130
130
  offlineAuths: import("./offlineAuths").OfflineAuthsState;
131
131
  order: OrderState;
132
132
  pos: import("./pos").PosState;
@@ -158,7 +158,7 @@ export declare const selectCartQuantity: ((state: {
158
158
  memoize: typeof import("reselect").weakMapMemoize;
159
159
  };
160
160
  export declare const selectCartTotal: ((state: {
161
- alerts: import("..").Alerts;
161
+ alerts: import("../types").Alerts;
162
162
  arrivals: import("./arrivals").ArrivalsState;
163
163
  cartSummary: import("./cartSummary").CartSummaryState;
164
164
  checkout: import("./checkout").CheckoutState;
@@ -173,7 +173,7 @@ export declare const selectCartTotal: ((state: {
173
173
  menu: import("./menu").MenuState;
174
174
  menuPages: import("./menuPages").MenuPagesState;
175
175
  modal: import("./modal").ModalState;
176
- notifications: import("..").Notifications;
176
+ notifications: import("../types").Notifications;
177
177
  offlineAuths: import("./offlineAuths").OfflineAuthsState;
178
178
  order: OrderState;
179
179
  pos: import("./pos").PosState;
@@ -205,7 +205,7 @@ export declare const selectCartTotal: ((state: {
205
205
  memoize: typeof import("reselect").weakMapMemoize;
206
206
  };
207
207
  export declare const selectCartTotals: ((state: {
208
- alerts: import("..").Alerts;
208
+ alerts: import("../types").Alerts;
209
209
  arrivals: import("./arrivals").ArrivalsState;
210
210
  cartSummary: import("./cartSummary").CartSummaryState;
211
211
  checkout: import("./checkout").CheckoutState;
@@ -220,7 +220,7 @@ export declare const selectCartTotals: ((state: {
220
220
  menu: import("./menu").MenuState;
221
221
  menuPages: import("./menuPages").MenuPagesState;
222
222
  modal: import("./modal").ModalState;
223
- notifications: import("..").Notifications;
223
+ notifications: import("../types").Notifications;
224
224
  offlineAuths: import("./offlineAuths").OfflineAuthsState;
225
225
  order: OrderState;
226
226
  pos: import("./pos").PosState;
@@ -1,7 +1,7 @@
1
1
  import { TypedUseSelectorHook } from 'react-redux';
2
2
  import type { RootState } from './store';
3
3
  export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<{
4
- alerts: import("..").Alerts;
4
+ alerts: import("../types").Alerts;
5
5
  arrivals: import("..").ArrivalsState;
6
6
  cartSummary: import("..").CartSummaryState;
7
7
  checkout: import("..").CheckoutState;
@@ -16,7 +16,7 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<{
16
16
  menu: import("..").MenuState;
17
17
  menuPages: import("..").MenuPagesState;
18
18
  modal: import("..").ModalState;
19
- notifications: import("..").Notifications;
19
+ notifications: import("../types").Notifications;
20
20
  offlineAuths: import("..").OfflineAuthsState;
21
21
  order: import("..").OrderState;
22
22
  pos: import("..").PosState;
@@ -1,6 +1,6 @@
1
1
  import { Action, ThunkAction } from '@reduxjs/toolkit';
2
2
  export declare const appReducer: import("redux").Reducer<{
3
- alerts: import("..").Alerts;
3
+ alerts: import("../types").Alerts;
4
4
  arrivals: import("../slices").ArrivalsState;
5
5
  cartSummary: import("../slices").CartSummaryState;
6
6
  checkout: import("../slices").CheckoutState;
@@ -15,7 +15,7 @@ export declare const appReducer: import("redux").Reducer<{
15
15
  menu: import("../slices").MenuState;
16
16
  menuPages: import("../slices").MenuPagesState;
17
17
  modal: import("../slices").ModalState;
18
- notifications: import("..").Notifications;
18
+ notifications: import("../types").Notifications;
19
19
  offlineAuths: import("../slices").OfflineAuthsState;
20
20
  order: import("../slices").OrderState;
21
21
  pos: import("../slices").PosState;
@@ -26,7 +26,7 @@ export declare const appReducer: import("redux").Reducer<{
26
26
  surcharges: import("../slices").SurchargesState;
27
27
  taxes: import("../slices").TaxesState;
28
28
  }, import("redux").UnknownAction, Partial<{
29
- alerts: import("..").Alerts | undefined;
29
+ alerts: import("../types").Alerts | undefined;
30
30
  arrivals: import("../slices").ArrivalsState | undefined;
31
31
  cartSummary: import("../slices").CartSummaryState | undefined;
32
32
  checkout: import("../slices").CheckoutState | undefined;
@@ -41,7 +41,7 @@ export declare const appReducer: import("redux").Reducer<{
41
41
  menu: import("../slices").MenuState | undefined;
42
42
  menuPages: import("../slices").MenuPagesState | undefined;
43
43
  modal: import("../slices").ModalState | undefined;
44
- notifications: import("..").Notifications | undefined;
44
+ notifications: import("../types").Notifications | undefined;
45
45
  offlineAuths: import("../slices").OfflineAuthsState | undefined;
46
46
  order: import("../slices").OrderState | undefined;
47
47
  pos: import("../slices").PosState | undefined;
@@ -54,7 +54,7 @@ export declare const appReducer: import("redux").Reducer<{
54
54
  }>>;
55
55
  export type AppState = ReturnType<typeof appReducer>;
56
56
  declare const store: import("@reduxjs/toolkit").EnhancedStore<{
57
- alerts: import("..").Alerts;
57
+ alerts: import("../types").Alerts;
58
58
  arrivals: import("../slices").ArrivalsState;
59
59
  cartSummary: import("../slices").CartSummaryState;
60
60
  checkout: import("../slices").CheckoutState;
@@ -69,7 +69,7 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<{
69
69
  menu: import("../slices").MenuState;
70
70
  menuPages: import("../slices").MenuPagesState;
71
71
  modal: import("../slices").ModalState;
72
- notifications: import("..").Notifications;
72
+ notifications: import("../types").Notifications;
73
73
  offlineAuths: import("../slices").OfflineAuthsState;
74
74
  order: import("../slices").OrderState;
75
75
  pos: import("../slices").PosState;
@@ -81,7 +81,7 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<{
81
81
  taxes: import("../slices").TaxesState;
82
82
  }, Action, import("@reduxjs/toolkit").Tuple<[import("redux").StoreEnhancer<{
83
83
  dispatch: import("redux-thunk").ThunkDispatch<{
84
- alerts: import("..").Alerts;
84
+ alerts: import("../types").Alerts;
85
85
  arrivals: import("../slices").ArrivalsState;
86
86
  cartSummary: import("../slices").CartSummaryState;
87
87
  checkout: import("../slices").CheckoutState;
@@ -96,7 +96,7 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<{
96
96
  menu: import("../slices").MenuState;
97
97
  menuPages: import("../slices").MenuPagesState;
98
98
  modal: import("../slices").ModalState;
99
- notifications: import("..").Notifications;
99
+ notifications: import("../types").Notifications;
100
100
  offlineAuths: import("../slices").OfflineAuthsState;
101
101
  order: import("../slices").OrderState;
102
102
  pos: import("../slices").PosState;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { MenuCategory as MenuCategoryType } from '@open-tender/types';
3
+ import { MenuCategoryProps } from '@open-tender/ui';
4
+ declare const MenuCategory: ({ category, navigate, children }: {
5
+ category: MenuCategoryType;
6
+ navigate: (route: string) => void;
7
+ children: (props: MenuCategoryProps) => React.ReactNode;
8
+ }) => import("react").ReactNode;
9
+ export default MenuCategory;
@@ -0,0 +1,16 @@
1
+ import { useKioskImageUrl } from '../hooks';
2
+ import { useAppDispatch, useAppSelector } from '../app/hooks';
3
+ import { selectKioskConfig, setCurrentCategory } from '../slices';
4
+ var MenuCategory = function (_a) {
5
+ var category = _a.category, navigate = _a.navigate, children = _a.children;
6
+ var dispatch = useAppDispatch();
7
+ var config = useAppSelector(selectKioskConfig).menuCategory;
8
+ var imageUrl = useKioskImageUrl(category);
9
+ var browse = function () {
10
+ dispatch(setCurrentCategory(category));
11
+ navigate('/menu/category');
12
+ };
13
+ var handlers = { browse: browse };
14
+ return children({ config: config, handlers: handlers, category: category, imageUrl: imageUrl });
15
+ };
16
+ export default MenuCategory;
@@ -0,0 +1,2 @@
1
+ import MenuCategory from './MenuCategory';
2
+ export { MenuCategory };
@@ -0,0 +1,2 @@
1
+ import MenuCategory from './MenuCategory';
2
+ export { MenuCategory };
@@ -3,7 +3,8 @@ import useBuilder from './useBuilder';
3
3
  import useCardSwipe from './useCardSwipe';
4
4
  import useEmployee from './useEmployee';
5
5
  import useGiftCardBalance from './useGiftCardBalance';
6
+ import { useKioskImageUrl } from './useKioskImageUrl';
6
7
  import usePrevious from './usePrevious';
7
8
  import usePunch from './usePunch';
8
9
  import useRefund from './useRefund';
9
- export { useBarcode, useBuilder, useCardSwipe, useEmployee, useGiftCardBalance, usePrevious, usePunch, useRefund };
10
+ export { useBarcode, useBuilder, useCardSwipe, useEmployee, useGiftCardBalance, useKioskImageUrl, usePrevious, usePunch, useRefund };
@@ -3,7 +3,8 @@ import useBuilder from './useBuilder';
3
3
  import useCardSwipe from './useCardSwipe';
4
4
  import useEmployee from './useEmployee';
5
5
  import useGiftCardBalance from './useGiftCardBalance';
6
+ import { useKioskImageUrl } from './useKioskImageUrl';
6
7
  import usePrevious from './usePrevious';
7
8
  import usePunch from './usePunch';
8
9
  import useRefund from './useRefund';
9
- export { useBarcode, useBuilder, useCardSwipe, useEmployee, useGiftCardBalance, usePrevious, usePunch, useRefund };
10
+ export { useBarcode, useBuilder, useCardSwipe, useEmployee, useGiftCardBalance, useKioskImageUrl, usePrevious, usePunch, useRefund };
@@ -0,0 +1,2 @@
1
+ import { MenuCategory, MenuItem } from '@open-tender/types';
2
+ export declare const useKioskImageUrl: (entity: MenuItem | MenuCategory) => string | null;
@@ -0,0 +1,10 @@
1
+ import { useAppSelector } from '../app/hooks';
2
+ import { selectKioskApi } from '../slices';
3
+ export var useKioskImageUrl = function (entity) {
4
+ var apiUrl = useAppSelector(selectKioskApi);
5
+ var app_image_url = entity.app_image_url, small_image_url = entity.small_image_url, large_image_url = entity.large_image_url;
6
+ var imageUrl = large_image_url || small_image_url || app_image_url;
7
+ if (!imageUrl)
8
+ return null;
9
+ return imageUrl.startsWith('/cloud-files') ? apiUrl + imageUrl : imageUrl;
10
+ };
@@ -1,6 +1,6 @@
1
1
  import { appReducer } from './app/store';
2
+ export * from './components';
2
3
  export * from './hooks';
3
4
  export * from './slices';
4
- export * from './types';
5
5
  export * from './utils';
6
6
  export { appReducer };
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { appReducer } from './app/store';
2
+ export * from './components';
2
3
  export * from './hooks';
3
4
  export * from './slices';
4
- export * from './types';
5
5
  export * from './utils';
6
6
  export { appReducer };
@@ -40,8 +40,55 @@ export declare const selectKiosk: (state: AppState) => KioskState;
40
40
  export declare const selectKioskVersion: (state: AppState) => string | null | undefined;
41
41
  export declare const selectKioskStore: (state: AppState) => Store | null;
42
42
  export declare const selectKioskBrand: (state: AppState) => KioskBrand | null;
43
+ export declare const selectKioskApi: ((state: {
44
+ alerts: import("../types").Alerts;
45
+ arrivals: import("./arrivals").ArrivalsState;
46
+ cartSummary: import("./cartSummary").CartSummaryState;
47
+ checkout: import("./checkout").CheckoutState;
48
+ config: import("./config").ConfigState;
49
+ customer: import("./customer").CustomerState;
50
+ customerIdentify: import("./customerIdentify").CustomerIdentifyState;
51
+ deals: import("./deals").DealsState;
52
+ discounts: import("./discounts").DiscountsState;
53
+ errorAlerts: import("./errorAlerts").ErrorAlertsState;
54
+ kds: import("./kds").KdsState;
55
+ kiosk: KioskState;
56
+ menu: import("./menu").MenuState;
57
+ menuPages: import("./menuPages").MenuPagesState;
58
+ modal: import("./modal").ModalState;
59
+ notifications: import("../types").Notifications;
60
+ offlineAuths: import("./offlineAuths").OfflineAuthsState;
61
+ order: import("./order").OrderState;
62
+ pos: import("./pos").PosState;
63
+ punches: import("./punches").PunchesState;
64
+ refund: import("./refund").RefundState;
65
+ settings: import("./settings").SettingsState;
66
+ sidebar: import("./sidebar").SidebarState;
67
+ surcharges: import("./surcharges").SurchargesState;
68
+ taxes: import("./taxes").TaxesState;
69
+ }) => string) & {
70
+ clearCache: () => void;
71
+ resultsCount: () => number;
72
+ resetResultsCount: () => void;
73
+ } & {
74
+ resultFunc: (resultFuncArgs_0: KioskApp | null) => string;
75
+ memoizedResultFunc: ((resultFuncArgs_0: KioskApp | null) => string) & {
76
+ clearCache: () => void;
77
+ resultsCount: () => number;
78
+ resetResultsCount: () => void;
79
+ };
80
+ lastResult: () => string;
81
+ dependencies: [(state: AppState) => KioskApp | null];
82
+ recomputations: () => number;
83
+ resetRecomputations: () => void;
84
+ dependencyRecomputations: () => number;
85
+ resetDependencyRecomputations: () => void;
86
+ } & {
87
+ argsMemoize: typeof import("reselect").weakMapMemoize;
88
+ memoize: typeof import("reselect").weakMapMemoize;
89
+ };
43
90
  export declare const selectKioskConfig: ((state: {
44
- alerts: import("..").Alerts;
91
+ alerts: import("../types").Alerts;
45
92
  arrivals: import("./arrivals").ArrivalsState;
46
93
  cartSummary: import("./cartSummary").CartSummaryState;
47
94
  checkout: import("./checkout").CheckoutState;
@@ -56,7 +103,7 @@ export declare const selectKioskConfig: ((state: {
56
103
  menu: import("./menu").MenuState;
57
104
  menuPages: import("./menuPages").MenuPagesState;
58
105
  modal: import("./modal").ModalState;
59
- notifications: import("..").Notifications;
106
+ notifications: import("../types").Notifications;
60
107
  offlineAuths: import("./offlineAuths").OfflineAuthsState;
61
108
  order: import("./order").OrderState;
62
109
  pos: import("./pos").PosState;
@@ -88,7 +135,7 @@ export declare const selectKioskConfig: ((state: {
88
135
  memoize: typeof import("reselect").weakMapMemoize;
89
136
  };
90
137
  export declare const selectKioskConfigScreen: (screen: string) => ((state: {
91
- alerts: import("..").Alerts;
138
+ alerts: import("../types").Alerts;
92
139
  arrivals: import("./arrivals").ArrivalsState;
93
140
  cartSummary: import("./cartSummary").CartSummaryState;
94
141
  checkout: import("./checkout").CheckoutState;
@@ -103,7 +150,7 @@ export declare const selectKioskConfigScreen: (screen: string) => ((state: {
103
150
  menu: import("./menu").MenuState;
104
151
  menuPages: import("./menuPages").MenuPagesState;
105
152
  modal: import("./modal").ModalState;
106
- notifications: import("..").Notifications;
153
+ notifications: import("../types").Notifications;
107
154
  offlineAuths: import("./offlineAuths").OfflineAuthsState;
108
155
  order: import("./order").OrderState;
109
156
  pos: import("./pos").PosState;
@@ -134,7 +134,14 @@ export var selectKiosk = function (state) { return state.kiosk; };
134
134
  export var selectKioskVersion = function (state) { return state.kiosk.version; };
135
135
  export var selectKioskStore = function (state) { return state.kiosk.store; };
136
136
  export var selectKioskBrand = function (state) { return state.kiosk.brand; };
137
- // export const selectKioskConfig = (state: AppState) => state.kiosk.config || {}
137
+ export var selectKioskApi = createSelector(function (state) {
138
+ var app = state.kiosk.app;
139
+ return app;
140
+ }, function (app) {
141
+ if (!app)
142
+ return 'http://kiosk';
143
+ return app.apiUrl.replace('/pos-api', '');
144
+ });
138
145
  export var selectKioskConfig = createSelector(function (state) {
139
146
  var config = state.kiosk.config;
140
147
  return config;
@@ -64,7 +64,7 @@ export declare const selectCurrentOption: (state: AppState) => NestedOption | nu
64
64
  export declare const selectCurrentSection: (state: AppState) => string | null;
65
65
  export declare const selectCart: (state: AppState) => Cart;
66
66
  export declare const selectCartIds: ((state: {
67
- alerts: import("..").Alerts;
67
+ alerts: import("../types").Alerts;
68
68
  arrivals: import("./arrivals").ArrivalsState;
69
69
  cartSummary: import("./cartSummary").CartSummaryState;
70
70
  checkout: import("./checkout").CheckoutState;
@@ -79,7 +79,7 @@ export declare const selectCartIds: ((state: {
79
79
  menu: import("./menu").MenuState;
80
80
  menuPages: import("./menuPages").MenuPagesState;
81
81
  modal: import("./modal").ModalState;
82
- notifications: import("..").Notifications;
82
+ notifications: import("../types").Notifications;
83
83
  offlineAuths: import("./offlineAuths").OfflineAuthsState;
84
84
  order: OrderState;
85
85
  pos: import("./pos").PosState;
@@ -111,7 +111,7 @@ export declare const selectCartIds: ((state: {
111
111
  memoize: typeof import("reselect").weakMapMemoize;
112
112
  };
113
113
  export declare const selectCartQuantity: ((state: {
114
- alerts: import("..").Alerts;
114
+ alerts: import("../types").Alerts;
115
115
  arrivals: import("./arrivals").ArrivalsState;
116
116
  cartSummary: import("./cartSummary").CartSummaryState;
117
117
  checkout: import("./checkout").CheckoutState;
@@ -126,7 +126,7 @@ export declare const selectCartQuantity: ((state: {
126
126
  menu: import("./menu").MenuState;
127
127
  menuPages: import("./menuPages").MenuPagesState;
128
128
  modal: import("./modal").ModalState;
129
- notifications: import("..").Notifications;
129
+ notifications: import("../types").Notifications;
130
130
  offlineAuths: import("./offlineAuths").OfflineAuthsState;
131
131
  order: OrderState;
132
132
  pos: import("./pos").PosState;
@@ -158,7 +158,7 @@ export declare const selectCartQuantity: ((state: {
158
158
  memoize: typeof import("reselect").weakMapMemoize;
159
159
  };
160
160
  export declare const selectCartTotal: ((state: {
161
- alerts: import("..").Alerts;
161
+ alerts: import("../types").Alerts;
162
162
  arrivals: import("./arrivals").ArrivalsState;
163
163
  cartSummary: import("./cartSummary").CartSummaryState;
164
164
  checkout: import("./checkout").CheckoutState;
@@ -173,7 +173,7 @@ export declare const selectCartTotal: ((state: {
173
173
  menu: import("./menu").MenuState;
174
174
  menuPages: import("./menuPages").MenuPagesState;
175
175
  modal: import("./modal").ModalState;
176
- notifications: import("..").Notifications;
176
+ notifications: import("../types").Notifications;
177
177
  offlineAuths: import("./offlineAuths").OfflineAuthsState;
178
178
  order: OrderState;
179
179
  pos: import("./pos").PosState;
@@ -205,7 +205,7 @@ export declare const selectCartTotal: ((state: {
205
205
  memoize: typeof import("reselect").weakMapMemoize;
206
206
  };
207
207
  export declare const selectCartTotals: ((state: {
208
- alerts: import("..").Alerts;
208
+ alerts: import("../types").Alerts;
209
209
  arrivals: import("./arrivals").ArrivalsState;
210
210
  cartSummary: import("./cartSummary").CartSummaryState;
211
211
  checkout: import("./checkout").CheckoutState;
@@ -220,7 +220,7 @@ export declare const selectCartTotals: ((state: {
220
220
  menu: import("./menu").MenuState;
221
221
  menuPages: import("./menuPages").MenuPagesState;
222
222
  modal: import("./modal").ModalState;
223
- notifications: import("..").Notifications;
223
+ notifications: import("../types").Notifications;
224
224
  offlineAuths: import("./offlineAuths").OfflineAuthsState;
225
225
  order: OrderState;
226
226
  pos: import("./pos").PosState;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/store",
3
- "version": "1.0.36",
3
+ "version": "1.1.0",
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",
@@ -58,8 +58,8 @@
58
58
  },
59
59
  "peerDependencies": {
60
60
  "@emotion/react": "^11.11.1",
61
- "@open-tender/types": "^0.4.37",
62
- "@open-tender/ui": "^0.1.23",
61
+ "@open-tender/types": "^0.4.38",
62
+ "@open-tender/ui": "^0.2.1",
63
63
  "@open-tender/utils": "^0.4.18",
64
64
  "@reduxjs/toolkit": "^2.0.1",
65
65
  "date-fns": "2.30.0",