@open-tender/store 1.0.7 → 1.0.9

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.
@@ -8,7 +8,7 @@ export interface CheckoutState {
8
8
  completedOrder: Order | null;
9
9
  customer: CustomerCheckout | null;
10
10
  discounts: OrderCreateDiscounts;
11
- error: any | null;
11
+ error: RequestError;
12
12
  giftCards: OrderCreateGiftCards;
13
13
  identifying: RequestStatus;
14
14
  isTaxExempt: boolean;
@@ -173,9 +173,61 @@ export declare const selectCartTotal: ((state: {
173
173
  argsMemoize: typeof import("reselect").weakMapMemoize;
174
174
  memoize: typeof import("reselect").weakMapMemoize;
175
175
  };
176
- export declare const selectCartTotals: (state: AppState) => {
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
+ }) => {
177
200
  count: number;
178
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;
179
231
  };
180
232
  export declare const selectCartCounts: (state: AppState) => CartCounts;
181
233
  export declare const selectCanOrder: (state: AppState) => 0 | RequestedAt | null;
@@ -222,12 +222,16 @@ exports.selectCartTotal = (0, toolkit_1.createSelector)(function (state) {
222
222
  return 0.0;
223
223
  return cart.reduce(function (t, i) { return (t += i.totalPrice || 0); }, 0.0);
224
224
  });
225
- var selectCartTotals = function (state) {
226
- var count = (0, exports.selectCartQuantity)(state);
227
- var total = (0, exports.selectCartTotal)(state);
225
+ exports.selectCartTotals = (0, toolkit_1.createSelector)(function (state) {
226
+ var cart = state.order.cart;
227
+ return cart;
228
+ }, function (cart) {
229
+ if (!cart)
230
+ return { count: 0, total: 0.0 };
231
+ var count = cart.reduce(function (t, i) { return (t += i.quantity); }, 0);
232
+ var total = cart.reduce(function (t, i) { return (t += i.totalPrice || 0); }, 0.0);
228
233
  return { count: count, total: total };
229
- };
230
- exports.selectCartTotals = selectCartTotals;
234
+ });
231
235
  var selectCartCounts = function (state) {
232
236
  return state.order.cartCounts || {};
233
237
  };
@@ -8,7 +8,7 @@ export interface CheckoutState {
8
8
  completedOrder: Order | null;
9
9
  customer: CustomerCheckout | null;
10
10
  discounts: OrderCreateDiscounts;
11
- error: any | null;
11
+ error: RequestError;
12
12
  giftCards: OrderCreateGiftCards;
13
13
  identifying: RequestStatus;
14
14
  isTaxExempt: boolean;
@@ -173,9 +173,61 @@ export declare const selectCartTotal: ((state: {
173
173
  argsMemoize: typeof import("reselect").weakMapMemoize;
174
174
  memoize: typeof import("reselect").weakMapMemoize;
175
175
  };
176
- export declare const selectCartTotals: (state: AppState) => {
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
+ }) => {
177
200
  count: number;
178
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;
179
231
  };
180
232
  export declare const selectCartCounts: (state: AppState) => CartCounts;
181
233
  export declare const selectCanOrder: (state: AppState) => 0 | RequestedAt | null;
@@ -203,11 +203,16 @@ export var selectCartTotal = createSelector(function (state) {
203
203
  return 0.0;
204
204
  return cart.reduce(function (t, i) { return (t += i.totalPrice || 0); }, 0.0);
205
205
  });
206
- export var selectCartTotals = function (state) {
207
- var count = selectCartQuantity(state);
208
- var total = selectCartTotal(state);
206
+ export var selectCartTotals = createSelector(function (state) {
207
+ var cart = state.order.cart;
208
+ return cart;
209
+ }, function (cart) {
210
+ if (!cart)
211
+ return { count: 0, total: 0.0 };
212
+ var count = cart.reduce(function (t, i) { return (t += i.quantity); }, 0);
213
+ var total = cart.reduce(function (t, i) { return (t += i.totalPrice || 0); }, 0.0);
209
214
  return { count: count, total: total };
210
- };
215
+ });
211
216
  export var selectCartCounts = function (state) {
212
217
  return state.order.cartCounts || {};
213
218
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/store",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
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",