@open-tender/store 1.0.6 → 1.0.8

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.
@@ -41,12 +41,193 @@ export declare const selectCurrentVendor: (state: AppState) => MenuRevenueCenter
41
41
  export declare const selectCurrentCategory: (state: AppState) => MenuCategory | null;
42
42
  export declare const selectCurrentItem: (state: AppState) => CartItem | null;
43
43
  export declare const selectCart: (state: AppState) => Cart;
44
- export declare const selectCartIds: (state: AppState) => number[];
45
- export declare const selectCartQuantity: (state: AppState) => number;
46
- export declare const selectCartTotal: (state: AppState) => number;
47
- export declare const selectCartTotals: (state: AppState) => {
44
+ export declare const selectCartIds: ((state: {
45
+ alerts: import("..").Alerts;
46
+ arrivals: import("./arrivals").ArrivalsState;
47
+ cartSummary: import("./cartSummary").CartSummaryState;
48
+ checkout: import("./checkout").CheckoutState;
49
+ config: import("./config").ConfigState;
50
+ discounts: import("./discounts").DiscountsState;
51
+ errorAlerts: import("./errorAlerts").ErrorAlertsState;
52
+ kds: import("./kds").KdsState;
53
+ kiosk: import("./kiosk").KioskState;
54
+ menu: import("./menu").MenuState;
55
+ menuPages: import("./menuPages").MenuPagesState;
56
+ modal: import("./modal").ModalState;
57
+ notifications: import("..").Notifications;
58
+ offlineAuths: import("./offlineAuths").OfflineAuthsState;
59
+ order: OrderState;
60
+ pos: import("./pos").PosState;
61
+ punches: import("./punches").PunchesState;
62
+ refund: import("./refund").RefundState;
63
+ settings: import("./settings").SettingsState;
64
+ sidebar: import("./sidebar").SidebarState;
65
+ surcharges: import("./surcharges").SurchargesState;
66
+ taxes: import("./taxes").TaxesState;
67
+ }) => number[]) & {
68
+ clearCache: () => void;
69
+ resultsCount: () => number;
70
+ resetResultsCount: () => void;
71
+ } & {
72
+ resultFunc: (resultFuncArgs_0: Cart) => number[];
73
+ memoizedResultFunc: ((resultFuncArgs_0: Cart) => number[]) & {
74
+ clearCache: () => void;
75
+ resultsCount: () => number;
76
+ resetResultsCount: () => void;
77
+ };
78
+ lastResult: () => number[];
79
+ dependencies: [(state: AppState) => Cart];
80
+ recomputations: () => number;
81
+ resetRecomputations: () => void;
82
+ dependencyRecomputations: () => number;
83
+ resetDependencyRecomputations: () => void;
84
+ } & {
85
+ argsMemoize: typeof import("reselect").weakMapMemoize;
86
+ memoize: typeof import("reselect").weakMapMemoize;
87
+ };
88
+ export declare const selectCartQuantity: ((state: {
89
+ alerts: import("..").Alerts;
90
+ arrivals: import("./arrivals").ArrivalsState;
91
+ cartSummary: import("./cartSummary").CartSummaryState;
92
+ checkout: import("./checkout").CheckoutState;
93
+ config: import("./config").ConfigState;
94
+ discounts: import("./discounts").DiscountsState;
95
+ errorAlerts: import("./errorAlerts").ErrorAlertsState;
96
+ kds: import("./kds").KdsState;
97
+ kiosk: import("./kiosk").KioskState;
98
+ menu: import("./menu").MenuState;
99
+ menuPages: import("./menuPages").MenuPagesState;
100
+ modal: import("./modal").ModalState;
101
+ notifications: import("..").Notifications;
102
+ offlineAuths: import("./offlineAuths").OfflineAuthsState;
103
+ order: OrderState;
104
+ pos: import("./pos").PosState;
105
+ punches: import("./punches").PunchesState;
106
+ refund: import("./refund").RefundState;
107
+ settings: import("./settings").SettingsState;
108
+ sidebar: import("./sidebar").SidebarState;
109
+ surcharges: import("./surcharges").SurchargesState;
110
+ taxes: import("./taxes").TaxesState;
111
+ }) => number) & {
112
+ clearCache: () => void;
113
+ resultsCount: () => number;
114
+ resetResultsCount: () => void;
115
+ } & {
116
+ resultFunc: (resultFuncArgs_0: Cart) => number;
117
+ memoizedResultFunc: ((resultFuncArgs_0: Cart) => number) & {
118
+ clearCache: () => void;
119
+ resultsCount: () => number;
120
+ resetResultsCount: () => void;
121
+ };
122
+ lastResult: () => number;
123
+ dependencies: [(state: AppState) => Cart];
124
+ recomputations: () => number;
125
+ resetRecomputations: () => void;
126
+ dependencyRecomputations: () => number;
127
+ resetDependencyRecomputations: () => void;
128
+ } & {
129
+ argsMemoize: typeof import("reselect").weakMapMemoize;
130
+ memoize: typeof import("reselect").weakMapMemoize;
131
+ };
132
+ export declare const selectCartTotal: ((state: {
133
+ alerts: import("..").Alerts;
134
+ arrivals: import("./arrivals").ArrivalsState;
135
+ cartSummary: import("./cartSummary").CartSummaryState;
136
+ checkout: import("./checkout").CheckoutState;
137
+ config: import("./config").ConfigState;
138
+ discounts: import("./discounts").DiscountsState;
139
+ errorAlerts: import("./errorAlerts").ErrorAlertsState;
140
+ kds: import("./kds").KdsState;
141
+ kiosk: import("./kiosk").KioskState;
142
+ menu: import("./menu").MenuState;
143
+ menuPages: import("./menuPages").MenuPagesState;
144
+ modal: import("./modal").ModalState;
145
+ notifications: import("..").Notifications;
146
+ offlineAuths: import("./offlineAuths").OfflineAuthsState;
147
+ order: OrderState;
148
+ pos: import("./pos").PosState;
149
+ punches: import("./punches").PunchesState;
150
+ refund: import("./refund").RefundState;
151
+ settings: import("./settings").SettingsState;
152
+ sidebar: import("./sidebar").SidebarState;
153
+ surcharges: import("./surcharges").SurchargesState;
154
+ taxes: import("./taxes").TaxesState;
155
+ }) => number) & {
156
+ clearCache: () => void;
157
+ resultsCount: () => number;
158
+ resetResultsCount: () => void;
159
+ } & {
160
+ resultFunc: (resultFuncArgs_0: Cart) => number;
161
+ memoizedResultFunc: ((resultFuncArgs_0: Cart) => number) & {
162
+ clearCache: () => void;
163
+ resultsCount: () => number;
164
+ resetResultsCount: () => void;
165
+ };
166
+ lastResult: () => number;
167
+ dependencies: [(state: AppState) => Cart];
168
+ recomputations: () => number;
169
+ resetRecomputations: () => void;
170
+ dependencyRecomputations: () => number;
171
+ resetDependencyRecomputations: () => void;
172
+ } & {
173
+ argsMemoize: typeof import("reselect").weakMapMemoize;
174
+ memoize: typeof import("reselect").weakMapMemoize;
175
+ };
176
+ export declare const selectCartTotals: ((state: {
177
+ alerts: import("..").Alerts;
178
+ arrivals: import("./arrivals").ArrivalsState;
179
+ cartSummary: import("./cartSummary").CartSummaryState;
180
+ checkout: import("./checkout").CheckoutState;
181
+ config: import("./config").ConfigState;
182
+ discounts: import("./discounts").DiscountsState;
183
+ errorAlerts: import("./errorAlerts").ErrorAlertsState;
184
+ kds: import("./kds").KdsState;
185
+ kiosk: import("./kiosk").KioskState;
186
+ menu: import("./menu").MenuState;
187
+ menuPages: import("./menuPages").MenuPagesState;
188
+ modal: import("./modal").ModalState;
189
+ notifications: import("..").Notifications;
190
+ offlineAuths: import("./offlineAuths").OfflineAuthsState;
191
+ order: OrderState;
192
+ pos: import("./pos").PosState;
193
+ punches: import("./punches").PunchesState;
194
+ refund: import("./refund").RefundState;
195
+ settings: import("./settings").SettingsState;
196
+ sidebar: import("./sidebar").SidebarState;
197
+ surcharges: import("./surcharges").SurchargesState;
198
+ taxes: import("./taxes").TaxesState;
199
+ }) => {
48
200
  count: number;
49
201
  total: number;
202
+ }) & {
203
+ clearCache: () => void;
204
+ resultsCount: () => number;
205
+ resetResultsCount: () => void;
206
+ } & {
207
+ resultFunc: (resultFuncArgs_0: Cart) => {
208
+ count: number;
209
+ total: number;
210
+ };
211
+ memoizedResultFunc: ((resultFuncArgs_0: Cart) => {
212
+ count: number;
213
+ total: number;
214
+ }) & {
215
+ clearCache: () => void;
216
+ resultsCount: () => number;
217
+ resetResultsCount: () => void;
218
+ };
219
+ lastResult: () => {
220
+ count: number;
221
+ total: number;
222
+ };
223
+ dependencies: [(state: AppState) => Cart];
224
+ recomputations: () => number;
225
+ resetRecomputations: () => void;
226
+ dependencyRecomputations: () => number;
227
+ resetDependencyRecomputations: () => void;
228
+ } & {
229
+ argsMemoize: typeof import("reselect").weakMapMemoize;
230
+ memoize: typeof import("reselect").weakMapMemoize;
50
231
  };
51
232
  export declare const selectCartCounts: (state: AppState) => CartCounts;
52
233
  export declare const selectCanOrder: (state: AppState) => 0 | RequestedAt | null;
@@ -198,28 +198,50 @@ var selectCurrentItem = function (state) { return state.order.currentItem; };
198
198
  exports.selectCurrentItem = selectCurrentItem;
199
199
  var selectCart = function (state) { return state.order.cart; };
200
200
  exports.selectCart = selectCart;
201
- var selectCartIds = function (state) {
202
- return state.order.cart ? state.order.cart.map(function (i) { return i.id; }) : [];
203
- };
204
- exports.selectCartIds = selectCartIds;
205
- var selectCartQuantity = function (state) {
206
- return state.order.cart
207
- ? state.order.cart.reduce(function (t, i) { return (t += i.quantity); }, 0)
208
- : 0;
209
- };
210
- exports.selectCartQuantity = selectCartQuantity;
211
- var selectCartTotal = function (state) {
212
- return state.order.cart
213
- ? state.order.cart.reduce(function (t, i) { return (t += i.totalPrice || 0); }, 0.0)
214
- : 0.0;
215
- };
216
- exports.selectCartTotal = selectCartTotal;
217
- var selectCartTotals = function (state) {
218
- var count = (0, exports.selectCartQuantity)(state);
219
- var total = (0, exports.selectCartTotal)(state);
201
+ exports.selectCartIds = (0, toolkit_1.createSelector)(function (state) {
202
+ var cart = state.order.cart;
203
+ return cart;
204
+ }, function (cart) {
205
+ if (!cart)
206
+ return [];
207
+ return cart.map(function (i) { return i.id; });
208
+ });
209
+ exports.selectCartQuantity = (0, toolkit_1.createSelector)(function (state) {
210
+ var cart = state.order.cart;
211
+ return cart;
212
+ }, function (cart) {
213
+ if (!cart)
214
+ return 0;
215
+ return cart.reduce(function (t, i) { return (t += i.quantity); }, 0);
216
+ });
217
+ exports.selectCartTotal = (0, toolkit_1.createSelector)(function (state) {
218
+ var cart = state.order.cart;
219
+ return cart;
220
+ }, function (cart) {
221
+ if (!cart)
222
+ return 0.0;
223
+ return cart.reduce(function (t, i) { return (t += i.totalPrice || 0); }, 0.0);
224
+ });
225
+ // export const selectCartTotals = createSelector(
226
+ // (state: AppState) => {
227
+ // const count = selectCartQuantity(state)
228
+ // const total = selectCartTotal(state)
229
+ // return { count, total }
230
+ // },
231
+ // ({ count, total }) => {
232
+ // return { count, total }
233
+ // }
234
+ // )
235
+ exports.selectCartTotals = (0, toolkit_1.createSelector)(function (state) {
236
+ var cart = state.order.cart;
237
+ return cart;
238
+ }, function (cart) {
239
+ if (!cart)
240
+ return { count: 0, total: 0.0 };
241
+ var count = cart.reduce(function (t, i) { return (t += i.quantity); }, 0);
242
+ var total = cart.reduce(function (t, i) { return (t += i.totalPrice || 0); }, 0.0);
220
243
  return { count: count, total: total };
221
- };
222
- exports.selectCartTotals = selectCartTotals;
244
+ });
223
245
  var selectCartCounts = function (state) {
224
246
  return state.order.cartCounts || {};
225
247
  };
@@ -41,12 +41,193 @@ export declare const selectCurrentVendor: (state: AppState) => MenuRevenueCenter
41
41
  export declare const selectCurrentCategory: (state: AppState) => MenuCategory | null;
42
42
  export declare const selectCurrentItem: (state: AppState) => CartItem | null;
43
43
  export declare const selectCart: (state: AppState) => Cart;
44
- export declare const selectCartIds: (state: AppState) => number[];
45
- export declare const selectCartQuantity: (state: AppState) => number;
46
- export declare const selectCartTotal: (state: AppState) => number;
47
- export declare const selectCartTotals: (state: AppState) => {
44
+ export declare const selectCartIds: ((state: {
45
+ alerts: import("..").Alerts;
46
+ arrivals: import("./arrivals").ArrivalsState;
47
+ cartSummary: import("./cartSummary").CartSummaryState;
48
+ checkout: import("./checkout").CheckoutState;
49
+ config: import("./config").ConfigState;
50
+ discounts: import("./discounts").DiscountsState;
51
+ errorAlerts: import("./errorAlerts").ErrorAlertsState;
52
+ kds: import("./kds").KdsState;
53
+ kiosk: import("./kiosk").KioskState;
54
+ menu: import("./menu").MenuState;
55
+ menuPages: import("./menuPages").MenuPagesState;
56
+ modal: import("./modal").ModalState;
57
+ notifications: import("..").Notifications;
58
+ offlineAuths: import("./offlineAuths").OfflineAuthsState;
59
+ order: OrderState;
60
+ pos: import("./pos").PosState;
61
+ punches: import("./punches").PunchesState;
62
+ refund: import("./refund").RefundState;
63
+ settings: import("./settings").SettingsState;
64
+ sidebar: import("./sidebar").SidebarState;
65
+ surcharges: import("./surcharges").SurchargesState;
66
+ taxes: import("./taxes").TaxesState;
67
+ }) => number[]) & {
68
+ clearCache: () => void;
69
+ resultsCount: () => number;
70
+ resetResultsCount: () => void;
71
+ } & {
72
+ resultFunc: (resultFuncArgs_0: Cart) => number[];
73
+ memoizedResultFunc: ((resultFuncArgs_0: Cart) => number[]) & {
74
+ clearCache: () => void;
75
+ resultsCount: () => number;
76
+ resetResultsCount: () => void;
77
+ };
78
+ lastResult: () => number[];
79
+ dependencies: [(state: AppState) => Cart];
80
+ recomputations: () => number;
81
+ resetRecomputations: () => void;
82
+ dependencyRecomputations: () => number;
83
+ resetDependencyRecomputations: () => void;
84
+ } & {
85
+ argsMemoize: typeof import("reselect").weakMapMemoize;
86
+ memoize: typeof import("reselect").weakMapMemoize;
87
+ };
88
+ export declare const selectCartQuantity: ((state: {
89
+ alerts: import("..").Alerts;
90
+ arrivals: import("./arrivals").ArrivalsState;
91
+ cartSummary: import("./cartSummary").CartSummaryState;
92
+ checkout: import("./checkout").CheckoutState;
93
+ config: import("./config").ConfigState;
94
+ discounts: import("./discounts").DiscountsState;
95
+ errorAlerts: import("./errorAlerts").ErrorAlertsState;
96
+ kds: import("./kds").KdsState;
97
+ kiosk: import("./kiosk").KioskState;
98
+ menu: import("./menu").MenuState;
99
+ menuPages: import("./menuPages").MenuPagesState;
100
+ modal: import("./modal").ModalState;
101
+ notifications: import("..").Notifications;
102
+ offlineAuths: import("./offlineAuths").OfflineAuthsState;
103
+ order: OrderState;
104
+ pos: import("./pos").PosState;
105
+ punches: import("./punches").PunchesState;
106
+ refund: import("./refund").RefundState;
107
+ settings: import("./settings").SettingsState;
108
+ sidebar: import("./sidebar").SidebarState;
109
+ surcharges: import("./surcharges").SurchargesState;
110
+ taxes: import("./taxes").TaxesState;
111
+ }) => number) & {
112
+ clearCache: () => void;
113
+ resultsCount: () => number;
114
+ resetResultsCount: () => void;
115
+ } & {
116
+ resultFunc: (resultFuncArgs_0: Cart) => number;
117
+ memoizedResultFunc: ((resultFuncArgs_0: Cart) => number) & {
118
+ clearCache: () => void;
119
+ resultsCount: () => number;
120
+ resetResultsCount: () => void;
121
+ };
122
+ lastResult: () => number;
123
+ dependencies: [(state: AppState) => Cart];
124
+ recomputations: () => number;
125
+ resetRecomputations: () => void;
126
+ dependencyRecomputations: () => number;
127
+ resetDependencyRecomputations: () => void;
128
+ } & {
129
+ argsMemoize: typeof import("reselect").weakMapMemoize;
130
+ memoize: typeof import("reselect").weakMapMemoize;
131
+ };
132
+ export declare const selectCartTotal: ((state: {
133
+ alerts: import("..").Alerts;
134
+ arrivals: import("./arrivals").ArrivalsState;
135
+ cartSummary: import("./cartSummary").CartSummaryState;
136
+ checkout: import("./checkout").CheckoutState;
137
+ config: import("./config").ConfigState;
138
+ discounts: import("./discounts").DiscountsState;
139
+ errorAlerts: import("./errorAlerts").ErrorAlertsState;
140
+ kds: import("./kds").KdsState;
141
+ kiosk: import("./kiosk").KioskState;
142
+ menu: import("./menu").MenuState;
143
+ menuPages: import("./menuPages").MenuPagesState;
144
+ modal: import("./modal").ModalState;
145
+ notifications: import("..").Notifications;
146
+ offlineAuths: import("./offlineAuths").OfflineAuthsState;
147
+ order: OrderState;
148
+ pos: import("./pos").PosState;
149
+ punches: import("./punches").PunchesState;
150
+ refund: import("./refund").RefundState;
151
+ settings: import("./settings").SettingsState;
152
+ sidebar: import("./sidebar").SidebarState;
153
+ surcharges: import("./surcharges").SurchargesState;
154
+ taxes: import("./taxes").TaxesState;
155
+ }) => number) & {
156
+ clearCache: () => void;
157
+ resultsCount: () => number;
158
+ resetResultsCount: () => void;
159
+ } & {
160
+ resultFunc: (resultFuncArgs_0: Cart) => number;
161
+ memoizedResultFunc: ((resultFuncArgs_0: Cart) => number) & {
162
+ clearCache: () => void;
163
+ resultsCount: () => number;
164
+ resetResultsCount: () => void;
165
+ };
166
+ lastResult: () => number;
167
+ dependencies: [(state: AppState) => Cart];
168
+ recomputations: () => number;
169
+ resetRecomputations: () => void;
170
+ dependencyRecomputations: () => number;
171
+ resetDependencyRecomputations: () => void;
172
+ } & {
173
+ argsMemoize: typeof import("reselect").weakMapMemoize;
174
+ memoize: typeof import("reselect").weakMapMemoize;
175
+ };
176
+ export declare const selectCartTotals: ((state: {
177
+ alerts: import("..").Alerts;
178
+ arrivals: import("./arrivals").ArrivalsState;
179
+ cartSummary: import("./cartSummary").CartSummaryState;
180
+ checkout: import("./checkout").CheckoutState;
181
+ config: import("./config").ConfigState;
182
+ discounts: import("./discounts").DiscountsState;
183
+ errorAlerts: import("./errorAlerts").ErrorAlertsState;
184
+ kds: import("./kds").KdsState;
185
+ kiosk: import("./kiosk").KioskState;
186
+ menu: import("./menu").MenuState;
187
+ menuPages: import("./menuPages").MenuPagesState;
188
+ modal: import("./modal").ModalState;
189
+ notifications: import("..").Notifications;
190
+ offlineAuths: import("./offlineAuths").OfflineAuthsState;
191
+ order: OrderState;
192
+ pos: import("./pos").PosState;
193
+ punches: import("./punches").PunchesState;
194
+ refund: import("./refund").RefundState;
195
+ settings: import("./settings").SettingsState;
196
+ sidebar: import("./sidebar").SidebarState;
197
+ surcharges: import("./surcharges").SurchargesState;
198
+ taxes: import("./taxes").TaxesState;
199
+ }) => {
48
200
  count: number;
49
201
  total: number;
202
+ }) & {
203
+ clearCache: () => void;
204
+ resultsCount: () => number;
205
+ resetResultsCount: () => void;
206
+ } & {
207
+ resultFunc: (resultFuncArgs_0: Cart) => {
208
+ count: number;
209
+ total: number;
210
+ };
211
+ memoizedResultFunc: ((resultFuncArgs_0: Cart) => {
212
+ count: number;
213
+ total: number;
214
+ }) & {
215
+ clearCache: () => void;
216
+ resultsCount: () => number;
217
+ resetResultsCount: () => void;
218
+ };
219
+ lastResult: () => {
220
+ count: number;
221
+ total: number;
222
+ };
223
+ dependencies: [(state: AppState) => Cart];
224
+ recomputations: () => number;
225
+ resetRecomputations: () => void;
226
+ dependencyRecomputations: () => number;
227
+ resetDependencyRecomputations: () => void;
228
+ } & {
229
+ argsMemoize: typeof import("reselect").weakMapMemoize;
230
+ memoize: typeof import("reselect").weakMapMemoize;
50
231
  };
51
232
  export declare const selectCartCounts: (state: AppState) => CartCounts;
52
233
  export declare const selectCanOrder: (state: AppState) => 0 | RequestedAt | null;
@@ -1,6 +1,6 @@
1
1
  var _a;
2
2
  import { __spreadArray } from "tslib";
3
- import { createSlice } from '@reduxjs/toolkit';
3
+ import { createSelector, createSlice } from '@reduxjs/toolkit';
4
4
  import { addItem, calcCartCounts, decrementItem, incrementItem, makeRandomNumberString, orderTypeNamesMap, removeItem, serviceTypeNamesMap } from '@open-tender/utils';
5
5
  import { ReducerType } from './types';
6
6
  var initialState = {
@@ -179,24 +179,50 @@ export var selectCurrentCategory = function (state) {
179
179
  };
180
180
  export var selectCurrentItem = function (state) { return state.order.currentItem; };
181
181
  export var selectCart = function (state) { return state.order.cart; };
182
- export var selectCartIds = function (state) {
183
- return state.order.cart ? state.order.cart.map(function (i) { return i.id; }) : [];
184
- };
185
- export var selectCartQuantity = function (state) {
186
- return state.order.cart
187
- ? state.order.cart.reduce(function (t, i) { return (t += i.quantity); }, 0)
188
- : 0;
189
- };
190
- export var selectCartTotal = function (state) {
191
- return state.order.cart
192
- ? state.order.cart.reduce(function (t, i) { return (t += i.totalPrice || 0); }, 0.0)
193
- : 0.0;
194
- };
195
- export var selectCartTotals = function (state) {
196
- var count = selectCartQuantity(state);
197
- var total = selectCartTotal(state);
182
+ export var selectCartIds = createSelector(function (state) {
183
+ var cart = state.order.cart;
184
+ return cart;
185
+ }, function (cart) {
186
+ if (!cart)
187
+ return [];
188
+ return cart.map(function (i) { return i.id; });
189
+ });
190
+ export var selectCartQuantity = createSelector(function (state) {
191
+ var cart = state.order.cart;
192
+ return cart;
193
+ }, function (cart) {
194
+ if (!cart)
195
+ return 0;
196
+ return cart.reduce(function (t, i) { return (t += i.quantity); }, 0);
197
+ });
198
+ export var selectCartTotal = createSelector(function (state) {
199
+ var cart = state.order.cart;
200
+ return cart;
201
+ }, function (cart) {
202
+ if (!cart)
203
+ return 0.0;
204
+ return cart.reduce(function (t, i) { return (t += i.totalPrice || 0); }, 0.0);
205
+ });
206
+ // export const selectCartTotals = createSelector(
207
+ // (state: AppState) => {
208
+ // const count = selectCartQuantity(state)
209
+ // const total = selectCartTotal(state)
210
+ // return { count, total }
211
+ // },
212
+ // ({ count, total }) => {
213
+ // return { count, total }
214
+ // }
215
+ // )
216
+ export var selectCartTotals = createSelector(function (state) {
217
+ var cart = state.order.cart;
218
+ return cart;
219
+ }, function (cart) {
220
+ if (!cart)
221
+ return { count: 0, total: 0.0 };
222
+ var count = cart.reduce(function (t, i) { return (t += i.quantity); }, 0);
223
+ var total = cart.reduce(function (t, i) { return (t += i.totalPrice || 0); }, 0.0);
198
224
  return { count: count, total: total };
199
- };
225
+ });
200
226
  export var selectCartCounts = function (state) {
201
227
  return state.order.cartCounts || {};
202
228
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/store",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
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",