@open-tender/cloud 0.1.116 → 0.1.118

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.
Files changed (43) hide show
  1. package/dist/cjs/app/hooks.d.ts +1 -0
  2. package/dist/cjs/app/store.d.ts +3 -0
  3. package/dist/cjs/services/api.d.ts +1 -0
  4. package/dist/cjs/services/api.js +3 -0
  5. package/dist/cjs/slices/allergens.d.ts +1 -0
  6. package/dist/cjs/slices/announcements.d.ts +2 -0
  7. package/dist/cjs/slices/config.d.ts +1 -0
  8. package/dist/cjs/slices/customer/creditCards.d.ts +1 -0
  9. package/dist/cjs/slices/customer/history.d.ts +23 -0
  10. package/dist/cjs/slices/customer/history.js +57 -0
  11. package/dist/cjs/slices/customer/index.d.ts +2 -0
  12. package/dist/cjs/slices/customer/index.js +3 -0
  13. package/dist/cjs/slices/customer/loyalty.d.ts +2 -0
  14. package/dist/cjs/slices/customer/order.d.ts +1 -0
  15. package/dist/cjs/slices/customer/tpls.d.ts +3 -0
  16. package/dist/cjs/slices/groupOrder.d.ts +4 -0
  17. package/dist/cjs/slices/order.d.ts +3 -0
  18. package/dist/cjs/slices/quote.d.ts +1 -0
  19. package/dist/cjs/slices/tags.d.ts +1 -0
  20. package/dist/cjs/slices/types.d.ts +1 -0
  21. package/dist/cjs/slices/types.js +1 -0
  22. package/dist/esm/app/hooks.d.ts +1 -0
  23. package/dist/esm/app/store.d.ts +3 -0
  24. package/dist/esm/services/api.d.ts +1 -0
  25. package/dist/esm/services/api.js +3 -0
  26. package/dist/esm/slices/allergens.d.ts +1 -0
  27. package/dist/esm/slices/announcements.d.ts +2 -0
  28. package/dist/esm/slices/config.d.ts +1 -0
  29. package/dist/esm/slices/customer/creditCards.d.ts +1 -0
  30. package/dist/esm/slices/customer/history.d.ts +23 -0
  31. package/dist/esm/slices/customer/history.js +53 -0
  32. package/dist/esm/slices/customer/index.d.ts +2 -0
  33. package/dist/esm/slices/customer/index.js +3 -0
  34. package/dist/esm/slices/customer/loyalty.d.ts +2 -0
  35. package/dist/esm/slices/customer/order.d.ts +1 -0
  36. package/dist/esm/slices/customer/tpls.d.ts +3 -0
  37. package/dist/esm/slices/groupOrder.d.ts +4 -0
  38. package/dist/esm/slices/order.d.ts +3 -0
  39. package/dist/esm/slices/quote.d.ts +1 -0
  40. package/dist/esm/slices/tags.d.ts +1 -0
  41. package/dist/esm/slices/types.d.ts +1 -0
  42. package/dist/esm/slices/types.js +1 -0
  43. package/package.json +2 -2
@@ -18,6 +18,7 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<i
18
18
  fcmToken: import("..").CustomerFcmTokenState;
19
19
  giftCards: import("..").CustomerGiftCardsState;
20
20
  groupOrders: import("..").CustomerGroupOrdersState;
21
+ history: import("..").CustomerHistoryState;
21
22
  houseAccounts: import("..").CustomerHouseAccountsState;
22
23
  loyalty: import("..").CustomerLoyaltyState;
23
24
  order: import("..").CustomerOrderState;
@@ -17,6 +17,7 @@ export declare const appReducer: import("redux").Reducer<import("redux").Combine
17
17
  fcmToken: import("../slices").CustomerFcmTokenState;
18
18
  giftCards: import("../slices").CustomerGiftCardsState;
19
19
  groupOrders: import("../slices").CustomerGroupOrdersState;
20
+ history: import("../slices").CustomerHistoryState;
20
21
  houseAccounts: import("../slices").CustomerHouseAccountsState;
21
22
  loyalty: import("../slices").CustomerLoyaltyState;
22
23
  order: import("../slices").CustomerOrderState;
@@ -79,6 +80,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
79
80
  fcmToken: import("../slices").CustomerFcmTokenState;
80
81
  giftCards: import("../slices").CustomerGiftCardsState;
81
82
  groupOrders: import("../slices").CustomerGroupOrdersState;
83
+ history: import("../slices").CustomerHistoryState;
82
84
  houseAccounts: import("../slices").CustomerHouseAccountsState;
83
85
  loyalty: import("../slices").CustomerLoyaltyState;
84
86
  order: import("../slices").CustomerOrderState;
@@ -139,6 +141,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
139
141
  fcmToken: import("../slices").CustomerFcmTokenState;
140
142
  giftCards: import("../slices").CustomerGiftCardsState;
141
143
  groupOrders: import("../slices").CustomerGroupOrdersState;
144
+ history: import("../slices").CustomerHistoryState;
142
145
  houseAccounts: import("../slices").CustomerHouseAccountsState;
143
146
  loyalty: import("../slices").CustomerLoyaltyState;
144
147
  order: import("../slices").CustomerOrderState;
@@ -159,6 +159,7 @@ declare class OpenTenderAPI {
159
159
  getCustomerThanx(token: string): Promise<unknown>;
160
160
  getThanxCardSignature(token: string, acct: string): Promise<unknown>;
161
161
  getCustomerTpls(token: string): Promise<unknown>;
162
+ getCustomerTplsHistory(token: string): Promise<unknown>;
162
163
  getCustomerHouseAccounts(token: string): Promise<unknown>;
163
164
  putCustomerOrderRating(token: string, orderId: number, data: any): Promise<unknown>;
164
165
  }
@@ -693,6 +693,9 @@ class OpenTenderAPI {
693
693
  getCustomerTpls(token) {
694
694
  return this.request(`/customer/tpls`, 'GET', null, null, token);
695
695
  }
696
+ getCustomerTplsHistory(token) {
697
+ return this.request(`/customer/tpls/history`, 'GET', null, null, token);
698
+ }
696
699
  getCustomerHouseAccounts(token) {
697
700
  return this.request(`/customer/house-accounts`, 'GET', null, null, token);
698
701
  }
@@ -45,6 +45,7 @@ export declare const selectSelectedAllergenNames: ((state: import("redux").Empty
45
45
  fcmToken: import("./customer").CustomerFcmTokenState;
46
46
  giftCards: import("./customer").CustomerGiftCardsState;
47
47
  groupOrders: import("./customer").CustomerGroupOrdersState;
48
+ history: import("./customer").CustomerHistoryState;
48
49
  houseAccounts: import("./customer").CustomerHouseAccountsState;
49
50
  loyalty: import("./customer").CustomerLoyaltyState;
50
51
  order: import("./customer").CustomerOrderState;
@@ -42,6 +42,7 @@ export declare const selectAnnouncementsPage: (page: AnnouncementPageType) => ((
42
42
  fcmToken: import("./customer").CustomerFcmTokenState;
43
43
  giftCards: import("./customer").CustomerGiftCardsState;
44
44
  groupOrders: import("./customer").CustomerGroupOrdersState;
45
+ history: import("./customer").CustomerHistoryState;
45
46
  houseAccounts: import("./customer").CustomerHouseAccountsState;
46
47
  loyalty: import("./customer").CustomerLoyaltyState;
47
48
  order: import("./customer").CustomerOrderState;
@@ -121,6 +122,7 @@ export declare const selectHasAnnouncementsPage: (page: AnnouncementPageType) =>
121
122
  fcmToken: import("./customer").CustomerFcmTokenState;
122
123
  giftCards: import("./customer").CustomerGiftCardsState;
123
124
  groupOrders: import("./customer").CustomerGroupOrdersState;
125
+ history: import("./customer").CustomerHistoryState;
124
126
  houseAccounts: import("./customer").CustomerHouseAccountsState;
125
127
  loyalty: import("./customer").CustomerLoyaltyState;
126
128
  order: import("./customer").CustomerOrderState;
@@ -105,6 +105,7 @@ export declare const selectOptIns: ((state: import("redux").EmptyObject & {
105
105
  fcmToken: import("./customer").CustomerFcmTokenState;
106
106
  giftCards: import("./customer").CustomerGiftCardsState;
107
107
  groupOrders: import("./customer").CustomerGroupOrdersState;
108
+ history: import("./customer").CustomerHistoryState;
108
109
  houseAccounts: import("./customer").CustomerHouseAccountsState;
109
110
  loyalty: import("./customer").CustomerLoyaltyState;
110
111
  order: import("./customer").CustomerOrderState;
@@ -84,6 +84,7 @@ export declare const selectCustomerCreditCardsForPayment: ((state: import("redux
84
84
  fcmToken: import("./fcmToken").CustomerFcmTokenState;
85
85
  giftCards: import("./giftCards").CustomerGiftCardsState;
86
86
  groupOrders: import("./groupOrders").CustomerGroupOrdersState;
87
+ history: import("./history").CustomerHistoryState;
87
88
  houseAccounts: import("./houseAccounts").CustomerHouseAccountsState;
88
89
  loyalty: import("./loyalty").CustomerLoyaltyState;
89
90
  order: import("./order").CustomerOrderState;
@@ -0,0 +1,23 @@
1
+ import { AppState } from '../../app';
2
+ import { RequestError, RequestStatus, TPLSHistory } from '@open-tender/types';
3
+ export interface CustomerHistoryState {
4
+ entities: TPLSHistory;
5
+ error: RequestError;
6
+ loading: RequestStatus;
7
+ }
8
+ export declare enum CustomerHistoryActionType {
9
+ FetchHistory = "history/fetchCustomerHistory"
10
+ }
11
+ export declare const fetchCustomerHistory: import("@reduxjs/toolkit").AsyncThunk<TPLSHistory, void, {
12
+ state: AppState;
13
+ rejectValue: RequestError;
14
+ dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
15
+ extra?: unknown;
16
+ serializedErrorType?: unknown;
17
+ pendingMeta?: unknown;
18
+ fulfilledMeta?: unknown;
19
+ rejectedMeta?: unknown;
20
+ }>;
21
+ export declare const resetCustomerHistory: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"history/resetCustomerHistory">;
22
+ export declare const selectCustomerHistory: (state: AppState) => CustomerHistoryState;
23
+ export declare const customerHistoryReducer: import("redux").Reducer<CustomerHistoryState, import("redux").AnyAction>;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.customerHistoryReducer = exports.selectCustomerHistory = exports.resetCustomerHistory = exports.fetchCustomerHistory = exports.CustomerHistoryActionType = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const toolkit_1 = require("@reduxjs/toolkit");
6
+ const types_1 = require("../types");
7
+ const types_2 = require("@open-tender/types");
8
+ const account_1 = require("./account");
9
+ const initialState = {
10
+ entities: [],
11
+ error: null,
12
+ loading: 'idle'
13
+ };
14
+ var CustomerHistoryActionType;
15
+ (function (CustomerHistoryActionType) {
16
+ CustomerHistoryActionType["FetchHistory"] = "history/fetchCustomerHistory";
17
+ })(CustomerHistoryActionType = exports.CustomerHistoryActionType || (exports.CustomerHistoryActionType = {}));
18
+ exports.fetchCustomerHistory = (0, toolkit_1.createAsyncThunk)(CustomerHistoryActionType.FetchHistory, (_, { getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
19
+ try {
20
+ const { api } = getState().config;
21
+ if (!api)
22
+ return;
23
+ const token = (0, account_1.selectToken)(getState());
24
+ if (!token)
25
+ throw new Error(types_2.MISSING_CUSTOMER);
26
+ return yield api.getCustomerTplsHistory(token);
27
+ }
28
+ catch (err) {
29
+ return rejectWithValue(err);
30
+ }
31
+ }));
32
+ const historySlice = (0, toolkit_1.createSlice)({
33
+ name: types_1.ReducerType.History,
34
+ initialState,
35
+ reducers: {
36
+ resetCustomerHistory: () => initialState
37
+ },
38
+ extraReducers: builder => {
39
+ builder
40
+ .addCase(exports.fetchCustomerHistory.fulfilled, (state, action) => {
41
+ state.entities = action.payload;
42
+ state.loading = 'idle';
43
+ state.error = null;
44
+ })
45
+ .addCase(exports.fetchCustomerHistory.pending, state => {
46
+ state.loading = 'pending';
47
+ })
48
+ .addCase(exports.fetchCustomerHistory.rejected, (state, action) => {
49
+ state.error = action.payload;
50
+ state.loading = 'idle';
51
+ });
52
+ }
53
+ });
54
+ exports.resetCustomerHistory = historySlice.actions.resetCustomerHistory;
55
+ const selectCustomerHistory = (state) => state.customer.history;
56
+ exports.selectCustomerHistory = selectCustomerHistory;
57
+ exports.customerHistoryReducer = historySlice.reducer;
@@ -8,6 +8,7 @@ export declare const customerReducer: import("redux").Reducer<import("redux").Co
8
8
  fcmToken: import("./fcmToken").CustomerFcmTokenState;
9
9
  giftCards: import("./giftCards").CustomerGiftCardsState;
10
10
  groupOrders: import("./groupOrders").CustomerGroupOrdersState;
11
+ history: import("./history").CustomerHistoryState;
11
12
  houseAccounts: import("./houseAccounts").CustomerHouseAccountsState;
12
13
  loyalty: import("./loyalty").CustomerLoyaltyState;
13
14
  order: import("./order").CustomerOrderState;
@@ -27,6 +28,7 @@ export * from './favorites';
27
28
  export * from './fcmToken';
28
29
  export * from './giftCards';
29
30
  export * from './groupOrders';
31
+ export * from './history';
30
32
  export * from './houseAccounts';
31
33
  export * from './loyalty';
32
34
  export * from './order';
@@ -13,6 +13,7 @@ const favorites_1 = require("./favorites");
13
13
  const fcmToken_1 = require("./fcmToken");
14
14
  const giftCards_1 = require("./giftCards");
15
15
  const groupOrders_1 = require("./groupOrders");
16
+ const history_1 = require("./history");
16
17
  const houseAccounts_1 = require("./houseAccounts");
17
18
  const loyalty_1 = require("./loyalty");
18
19
  const order_1 = require("./order");
@@ -32,6 +33,7 @@ exports.customerReducer = (0, redux_1.combineReducers)({
32
33
  [types_1.ReducerType.FcmToken]: fcmToken_1.customerFcmTokenReducer,
33
34
  [types_1.ReducerType.GiftCards]: giftCards_1.customerGiftCardsReducer,
34
35
  [types_1.ReducerType.GroupOrders]: groupOrders_1.customerGroupOrdersReducer,
36
+ [types_1.ReducerType.History]: history_1.customerHistoryReducer,
35
37
  [types_1.ReducerType.HouseAccounts]: houseAccounts_1.customerHouseAccountsReducer,
36
38
  [types_1.ReducerType.Loyalty]: loyalty_1.customerLoyaltyReducer,
37
39
  [types_1.ReducerType.Order]: order_1.customerOrderReducer,
@@ -51,6 +53,7 @@ tslib_1.__exportStar(require("./favorites"), exports);
51
53
  tslib_1.__exportStar(require("./fcmToken"), exports);
52
54
  tslib_1.__exportStar(require("./giftCards"), exports);
53
55
  tslib_1.__exportStar(require("./groupOrders"), exports);
56
+ tslib_1.__exportStar(require("./history"), exports);
54
57
  tslib_1.__exportStar(require("./houseAccounts"), exports);
55
58
  tslib_1.__exportStar(require("./loyalty"), exports);
56
59
  tslib_1.__exportStar(require("./order"), exports);
@@ -41,6 +41,7 @@ export declare const selectCustomerLoyaltyProgram: ((state: import("redux").Empt
41
41
  fcmToken: import("./fcmToken").CustomerFcmTokenState;
42
42
  giftCards: import("./giftCards").CustomerGiftCardsState;
43
43
  groupOrders: import("./groupOrders").CustomerGroupOrdersState;
44
+ history: import("./history").CustomerHistoryState;
44
45
  houseAccounts: import("./houseAccounts").CustomerHouseAccountsState;
45
46
  loyalty: CustomerLoyaltyState;
46
47
  order: import("./order").CustomerOrderState;
@@ -118,6 +119,7 @@ export declare const selectCustomerPointsProgram: (orderType: OrderType | null)
118
119
  fcmToken: import("./fcmToken").CustomerFcmTokenState;
119
120
  giftCards: import("./giftCards").CustomerGiftCardsState;
120
121
  groupOrders: import("./groupOrders").CustomerGroupOrdersState;
122
+ history: import("./history").CustomerHistoryState;
121
123
  houseAccounts: import("./houseAccounts").CustomerHouseAccountsState;
122
124
  loyalty: CustomerLoyaltyState;
123
125
  order: import("./order").CustomerOrderState;
@@ -51,6 +51,7 @@ export declare const selectCustomerOrder: ((state: import("redux").EmptyObject &
51
51
  fcmToken: import("./fcmToken").CustomerFcmTokenState;
52
52
  giftCards: import("./giftCards").CustomerGiftCardsState;
53
53
  groupOrders: import("./groupOrders").CustomerGroupOrdersState;
54
+ history: import("./history").CustomerHistoryState;
54
55
  houseAccounts: import("./houseAccounts").CustomerHouseAccountsState;
55
56
  loyalty: import("./loyalty").CustomerLoyaltyState;
56
57
  order: CustomerOrderState;
@@ -38,6 +38,7 @@ export declare const selectCustomerTplsPoints: ((state: import("redux").EmptyObj
38
38
  fcmToken: import("./fcmToken").CustomerFcmTokenState;
39
39
  giftCards: import("./giftCards").CustomerGiftCardsState;
40
40
  groupOrders: import("./groupOrders").CustomerGroupOrdersState;
41
+ history: import("./history").CustomerHistoryState;
41
42
  houseAccounts: import("./houseAccounts").CustomerHouseAccountsState;
42
43
  loyalty: import("./loyalty").CustomerLoyaltyState;
43
44
  order: import("./order").CustomerOrderState;
@@ -103,6 +104,7 @@ export declare const selectCustomerTplsRewards: ((state: import("redux").EmptyOb
103
104
  fcmToken: import("./fcmToken").CustomerFcmTokenState;
104
105
  giftCards: import("./giftCards").CustomerGiftCardsState;
105
106
  groupOrders: import("./groupOrders").CustomerGroupOrdersState;
107
+ history: import("./history").CustomerHistoryState;
106
108
  houseAccounts: import("./houseAccounts").CustomerHouseAccountsState;
107
109
  loyalty: import("./loyalty").CustomerLoyaltyState;
108
110
  order: import("./order").CustomerOrderState;
@@ -168,6 +170,7 @@ export declare const selectCustomerTplsProgress: ((state: import("redux").EmptyO
168
170
  fcmToken: import("./fcmToken").CustomerFcmTokenState;
169
171
  giftCards: import("./giftCards").CustomerGiftCardsState;
170
172
  groupOrders: import("./groupOrders").CustomerGroupOrdersState;
173
+ history: import("./history").CustomerHistoryState;
171
174
  houseAccounts: import("./houseAccounts").CustomerHouseAccountsState;
172
175
  loyalty: import("./loyalty").CustomerLoyaltyState;
173
176
  order: import("./order").CustomerOrderState;
@@ -124,6 +124,7 @@ export declare const selectSpendingLimit: ((state: import("redux").EmptyObject &
124
124
  fcmToken: import("./customer").CustomerFcmTokenState;
125
125
  giftCards: import("./customer").CustomerGiftCardsState;
126
126
  groupOrders: import("./customer").CustomerGroupOrdersState;
127
+ history: import("./customer").CustomerHistoryState;
127
128
  houseAccounts: import("./customer").CustomerHouseAccountsState;
128
129
  loyalty: import("./customer").CustomerLoyaltyState;
129
130
  order: import("./customer").CustomerOrderState;
@@ -192,6 +193,7 @@ export declare const selectGroupOrderClosed: ((state: import("redux").EmptyObjec
192
193
  fcmToken: import("./customer").CustomerFcmTokenState;
193
194
  giftCards: import("./customer").CustomerGiftCardsState;
194
195
  groupOrders: import("./customer").CustomerGroupOrdersState;
196
+ history: import("./customer").CustomerHistoryState;
195
197
  houseAccounts: import("./customer").CustomerHouseAccountsState;
196
198
  loyalty: import("./customer").CustomerLoyaltyState;
197
199
  order: import("./customer").CustomerOrderState;
@@ -262,6 +264,7 @@ export declare const selectGroupOrderTests: ((state: import("redux").EmptyObject
262
264
  fcmToken: import("./customer").CustomerFcmTokenState;
263
265
  giftCards: import("./customer").CustomerGiftCardsState;
264
266
  groupOrders: import("./customer").CustomerGroupOrdersState;
267
+ history: import("./customer").CustomerHistoryState;
265
268
  houseAccounts: import("./customer").CustomerHouseAccountsState;
266
269
  loyalty: import("./customer").CustomerLoyaltyState;
267
270
  order: import("./customer").CustomerOrderState;
@@ -341,6 +344,7 @@ export declare const selectGroupOrderPrepTimes: ((state: import("redux").EmptyOb
341
344
  fcmToken: import("./customer").CustomerFcmTokenState;
342
345
  giftCards: import("./customer").CustomerGiftCardsState;
343
346
  groupOrders: import("./customer").CustomerGroupOrdersState;
347
+ history: import("./customer").CustomerHistoryState;
344
348
  houseAccounts: import("./customer").CustomerHouseAccountsState;
345
349
  loyalty: import("./customer").CustomerLoyaltyState;
346
350
  order: import("./customer").CustomerOrderState;
@@ -146,6 +146,7 @@ export declare const selectOrderLimits: ((state: import("redux").EmptyObject & {
146
146
  fcmToken: import("./customer").CustomerFcmTokenState;
147
147
  giftCards: import("./customer").CustomerGiftCardsState;
148
148
  groupOrders: import("./customer").CustomerGroupOrdersState;
149
+ history: import("./customer").CustomerHistoryState;
149
150
  houseAccounts: import("./customer").CustomerHouseAccountsState;
150
151
  loyalty: import("./customer").CustomerLoyaltyState;
151
152
  order: import("./customer").CustomerOrderState;
@@ -222,6 +223,7 @@ export declare const selectCartIds: ((state: import("redux").EmptyObject & {
222
223
  fcmToken: import("./customer").CustomerFcmTokenState;
223
224
  giftCards: import("./customer").CustomerGiftCardsState;
224
225
  groupOrders: import("./customer").CustomerGroupOrdersState;
226
+ history: import("./customer").CustomerHistoryState;
225
227
  houseAccounts: import("./customer").CustomerHouseAccountsState;
226
228
  loyalty: import("./customer").CustomerLoyaltyState;
227
229
  order: import("./customer").CustomerOrderState;
@@ -293,6 +295,7 @@ export declare const selectMenuVars: ((state: import("redux").EmptyObject & {
293
295
  fcmToken: import("./customer").CustomerFcmTokenState;
294
296
  giftCards: import("./customer").CustomerGiftCardsState;
295
297
  groupOrders: import("./customer").CustomerGroupOrdersState;
298
+ history: import("./customer").CustomerHistoryState;
296
299
  houseAccounts: import("./customer").CustomerHouseAccountsState;
297
300
  loyalty: import("./customer").CustomerLoyaltyState;
298
301
  order: import("./customer").CustomerOrderState;
@@ -37,6 +37,7 @@ export declare const selectQuote: ((state: import("redux").EmptyObject & {
37
37
  fcmToken: import("./customer").CustomerFcmTokenState;
38
38
  giftCards: import("./customer").CustomerGiftCardsState;
39
39
  groupOrders: import("./customer").CustomerGroupOrdersState;
40
+ history: import("./customer").CustomerHistoryState;
40
41
  houseAccounts: import("./customer").CustomerHouseAccountsState;
41
42
  loyalty: import("./customer").CustomerLoyaltyState;
42
43
  order: import("./customer").CustomerOrderState;
@@ -45,6 +45,7 @@ export declare const selectSelectedTagNames: ((state: import("redux").EmptyObjec
45
45
  fcmToken: import("./customer").CustomerFcmTokenState;
46
46
  giftCards: import("./customer").CustomerGiftCardsState;
47
47
  groupOrders: import("./customer").CustomerGroupOrdersState;
48
+ history: import("./customer").CustomerHistoryState;
48
49
  houseAccounts: import("./customer").CustomerHouseAccountsState;
49
50
  loyalty: import("./customer").CustomerLoyaltyState;
50
51
  order: import("./customer").CustomerOrderState;
@@ -21,6 +21,7 @@ export declare enum ReducerType {
21
21
  GroupOrder = "groupOrder",
22
22
  GroupOrders = "groupOrders",
23
23
  Guest = "guest",
24
+ History = "history",
24
25
  HouseAccounts = "houseAccounts",
25
26
  Loader = "loader",
26
27
  Loyalty = "loyalty",
@@ -25,6 +25,7 @@ var ReducerType;
25
25
  ReducerType["GroupOrder"] = "groupOrder";
26
26
  ReducerType["GroupOrders"] = "groupOrders";
27
27
  ReducerType["Guest"] = "guest";
28
+ ReducerType["History"] = "history";
28
29
  ReducerType["HouseAccounts"] = "houseAccounts";
29
30
  ReducerType["Loader"] = "loader";
30
31
  ReducerType["Loyalty"] = "loyalty";
@@ -18,6 +18,7 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<i
18
18
  fcmToken: import("..").CustomerFcmTokenState;
19
19
  giftCards: import("..").CustomerGiftCardsState;
20
20
  groupOrders: import("..").CustomerGroupOrdersState;
21
+ history: import("..").CustomerHistoryState;
21
22
  houseAccounts: import("..").CustomerHouseAccountsState;
22
23
  loyalty: import("..").CustomerLoyaltyState;
23
24
  order: import("..").CustomerOrderState;
@@ -17,6 +17,7 @@ export declare const appReducer: import("redux").Reducer<import("redux").Combine
17
17
  fcmToken: import("../slices").CustomerFcmTokenState;
18
18
  giftCards: import("../slices").CustomerGiftCardsState;
19
19
  groupOrders: import("../slices").CustomerGroupOrdersState;
20
+ history: import("../slices").CustomerHistoryState;
20
21
  houseAccounts: import("../slices").CustomerHouseAccountsState;
21
22
  loyalty: import("../slices").CustomerLoyaltyState;
22
23
  order: import("../slices").CustomerOrderState;
@@ -79,6 +80,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
79
80
  fcmToken: import("../slices").CustomerFcmTokenState;
80
81
  giftCards: import("../slices").CustomerGiftCardsState;
81
82
  groupOrders: import("../slices").CustomerGroupOrdersState;
83
+ history: import("../slices").CustomerHistoryState;
82
84
  houseAccounts: import("../slices").CustomerHouseAccountsState;
83
85
  loyalty: import("../slices").CustomerLoyaltyState;
84
86
  order: import("../slices").CustomerOrderState;
@@ -139,6 +141,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
139
141
  fcmToken: import("../slices").CustomerFcmTokenState;
140
142
  giftCards: import("../slices").CustomerGiftCardsState;
141
143
  groupOrders: import("../slices").CustomerGroupOrdersState;
144
+ history: import("../slices").CustomerHistoryState;
142
145
  houseAccounts: import("../slices").CustomerHouseAccountsState;
143
146
  loyalty: import("../slices").CustomerLoyaltyState;
144
147
  order: import("../slices").CustomerOrderState;
@@ -159,6 +159,7 @@ declare class OpenTenderAPI {
159
159
  getCustomerThanx(token: string): Promise<unknown>;
160
160
  getThanxCardSignature(token: string, acct: string): Promise<unknown>;
161
161
  getCustomerTpls(token: string): Promise<unknown>;
162
+ getCustomerTplsHistory(token: string): Promise<unknown>;
162
163
  getCustomerHouseAccounts(token: string): Promise<unknown>;
163
164
  putCustomerOrderRating(token: string, orderId: number, data: any): Promise<unknown>;
164
165
  }
@@ -691,6 +691,9 @@ class OpenTenderAPI {
691
691
  getCustomerTpls(token) {
692
692
  return this.request(`/customer/tpls`, 'GET', null, null, token);
693
693
  }
694
+ getCustomerTplsHistory(token) {
695
+ return this.request(`/customer/tpls/history`, 'GET', null, null, token);
696
+ }
694
697
  getCustomerHouseAccounts(token) {
695
698
  return this.request(`/customer/house-accounts`, 'GET', null, null, token);
696
699
  }
@@ -45,6 +45,7 @@ export declare const selectSelectedAllergenNames: ((state: import("redux").Empty
45
45
  fcmToken: import("./customer").CustomerFcmTokenState;
46
46
  giftCards: import("./customer").CustomerGiftCardsState;
47
47
  groupOrders: import("./customer").CustomerGroupOrdersState;
48
+ history: import("./customer").CustomerHistoryState;
48
49
  houseAccounts: import("./customer").CustomerHouseAccountsState;
49
50
  loyalty: import("./customer").CustomerLoyaltyState;
50
51
  order: import("./customer").CustomerOrderState;
@@ -42,6 +42,7 @@ export declare const selectAnnouncementsPage: (page: AnnouncementPageType) => ((
42
42
  fcmToken: import("./customer").CustomerFcmTokenState;
43
43
  giftCards: import("./customer").CustomerGiftCardsState;
44
44
  groupOrders: import("./customer").CustomerGroupOrdersState;
45
+ history: import("./customer").CustomerHistoryState;
45
46
  houseAccounts: import("./customer").CustomerHouseAccountsState;
46
47
  loyalty: import("./customer").CustomerLoyaltyState;
47
48
  order: import("./customer").CustomerOrderState;
@@ -121,6 +122,7 @@ export declare const selectHasAnnouncementsPage: (page: AnnouncementPageType) =>
121
122
  fcmToken: import("./customer").CustomerFcmTokenState;
122
123
  giftCards: import("./customer").CustomerGiftCardsState;
123
124
  groupOrders: import("./customer").CustomerGroupOrdersState;
125
+ history: import("./customer").CustomerHistoryState;
124
126
  houseAccounts: import("./customer").CustomerHouseAccountsState;
125
127
  loyalty: import("./customer").CustomerLoyaltyState;
126
128
  order: import("./customer").CustomerOrderState;
@@ -105,6 +105,7 @@ export declare const selectOptIns: ((state: import("redux").EmptyObject & {
105
105
  fcmToken: import("./customer").CustomerFcmTokenState;
106
106
  giftCards: import("./customer").CustomerGiftCardsState;
107
107
  groupOrders: import("./customer").CustomerGroupOrdersState;
108
+ history: import("./customer").CustomerHistoryState;
108
109
  houseAccounts: import("./customer").CustomerHouseAccountsState;
109
110
  loyalty: import("./customer").CustomerLoyaltyState;
110
111
  order: import("./customer").CustomerOrderState;
@@ -84,6 +84,7 @@ export declare const selectCustomerCreditCardsForPayment: ((state: import("redux
84
84
  fcmToken: import("./fcmToken").CustomerFcmTokenState;
85
85
  giftCards: import("./giftCards").CustomerGiftCardsState;
86
86
  groupOrders: import("./groupOrders").CustomerGroupOrdersState;
87
+ history: import("./history").CustomerHistoryState;
87
88
  houseAccounts: import("./houseAccounts").CustomerHouseAccountsState;
88
89
  loyalty: import("./loyalty").CustomerLoyaltyState;
89
90
  order: import("./order").CustomerOrderState;
@@ -0,0 +1,23 @@
1
+ import { AppState } from '../../app';
2
+ import { RequestError, RequestStatus, TPLSHistory } from '@open-tender/types';
3
+ export interface CustomerHistoryState {
4
+ entities: TPLSHistory;
5
+ error: RequestError;
6
+ loading: RequestStatus;
7
+ }
8
+ export declare enum CustomerHistoryActionType {
9
+ FetchHistory = "history/fetchCustomerHistory"
10
+ }
11
+ export declare const fetchCustomerHistory: import("@reduxjs/toolkit").AsyncThunk<TPLSHistory, void, {
12
+ state: AppState;
13
+ rejectValue: RequestError;
14
+ dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
15
+ extra?: unknown;
16
+ serializedErrorType?: unknown;
17
+ pendingMeta?: unknown;
18
+ fulfilledMeta?: unknown;
19
+ rejectedMeta?: unknown;
20
+ }>;
21
+ export declare const resetCustomerHistory: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"history/resetCustomerHistory">;
22
+ export declare const selectCustomerHistory: (state: AppState) => CustomerHistoryState;
23
+ export declare const customerHistoryReducer: import("redux").Reducer<CustomerHistoryState, import("redux").AnyAction>;
@@ -0,0 +1,53 @@
1
+ import { __awaiter } from "tslib";
2
+ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
3
+ import { ReducerType } from '../types';
4
+ import { MISSING_CUSTOMER } from '@open-tender/types';
5
+ import { selectToken } from './account';
6
+ const initialState = {
7
+ entities: [],
8
+ error: null,
9
+ loading: 'idle'
10
+ };
11
+ export var CustomerHistoryActionType;
12
+ (function (CustomerHistoryActionType) {
13
+ CustomerHistoryActionType["FetchHistory"] = "history/fetchCustomerHistory";
14
+ })(CustomerHistoryActionType || (CustomerHistoryActionType = {}));
15
+ export const fetchCustomerHistory = createAsyncThunk(CustomerHistoryActionType.FetchHistory, (_, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
16
+ try {
17
+ const { api } = getState().config;
18
+ if (!api)
19
+ return;
20
+ const token = selectToken(getState());
21
+ if (!token)
22
+ throw new Error(MISSING_CUSTOMER);
23
+ return yield api.getCustomerTplsHistory(token);
24
+ }
25
+ catch (err) {
26
+ return rejectWithValue(err);
27
+ }
28
+ }));
29
+ const historySlice = createSlice({
30
+ name: ReducerType.History,
31
+ initialState,
32
+ reducers: {
33
+ resetCustomerHistory: () => initialState
34
+ },
35
+ extraReducers: builder => {
36
+ builder
37
+ .addCase(fetchCustomerHistory.fulfilled, (state, action) => {
38
+ state.entities = action.payload;
39
+ state.loading = 'idle';
40
+ state.error = null;
41
+ })
42
+ .addCase(fetchCustomerHistory.pending, state => {
43
+ state.loading = 'pending';
44
+ })
45
+ .addCase(fetchCustomerHistory.rejected, (state, action) => {
46
+ state.error = action.payload;
47
+ state.loading = 'idle';
48
+ });
49
+ }
50
+ });
51
+ export const { resetCustomerHistory } = historySlice.actions;
52
+ export const selectCustomerHistory = (state) => state.customer.history;
53
+ export const customerHistoryReducer = historySlice.reducer;
@@ -8,6 +8,7 @@ export declare const customerReducer: import("redux").Reducer<import("redux").Co
8
8
  fcmToken: import("./fcmToken").CustomerFcmTokenState;
9
9
  giftCards: import("./giftCards").CustomerGiftCardsState;
10
10
  groupOrders: import("./groupOrders").CustomerGroupOrdersState;
11
+ history: import("./history").CustomerHistoryState;
11
12
  houseAccounts: import("./houseAccounts").CustomerHouseAccountsState;
12
13
  loyalty: import("./loyalty").CustomerLoyaltyState;
13
14
  order: import("./order").CustomerOrderState;
@@ -27,6 +28,7 @@ export * from './favorites';
27
28
  export * from './fcmToken';
28
29
  export * from './giftCards';
29
30
  export * from './groupOrders';
31
+ export * from './history';
30
32
  export * from './houseAccounts';
31
33
  export * from './loyalty';
32
34
  export * from './order';
@@ -9,6 +9,7 @@ import { customerFavoritesReducer } from './favorites';
9
9
  import { customerFcmTokenReducer } from './fcmToken';
10
10
  import { customerGiftCardsReducer } from './giftCards';
11
11
  import { customerGroupOrdersReducer } from './groupOrders';
12
+ import { customerHistoryReducer } from './history';
12
13
  import { customerHouseAccountsReducer } from './houseAccounts';
13
14
  import { customerLoyaltyReducer } from './loyalty';
14
15
  import { customerOrderReducer } from './order';
@@ -28,6 +29,7 @@ export const customerReducer = combineReducers({
28
29
  [ReducerType.FcmToken]: customerFcmTokenReducer,
29
30
  [ReducerType.GiftCards]: customerGiftCardsReducer,
30
31
  [ReducerType.GroupOrders]: customerGroupOrdersReducer,
32
+ [ReducerType.History]: customerHistoryReducer,
31
33
  [ReducerType.HouseAccounts]: customerHouseAccountsReducer,
32
34
  [ReducerType.Loyalty]: customerLoyaltyReducer,
33
35
  [ReducerType.Order]: customerOrderReducer,
@@ -47,6 +49,7 @@ export * from './favorites';
47
49
  export * from './fcmToken';
48
50
  export * from './giftCards';
49
51
  export * from './groupOrders';
52
+ export * from './history';
50
53
  export * from './houseAccounts';
51
54
  export * from './loyalty';
52
55
  export * from './order';
@@ -41,6 +41,7 @@ export declare const selectCustomerLoyaltyProgram: ((state: import("redux").Empt
41
41
  fcmToken: import("./fcmToken").CustomerFcmTokenState;
42
42
  giftCards: import("./giftCards").CustomerGiftCardsState;
43
43
  groupOrders: import("./groupOrders").CustomerGroupOrdersState;
44
+ history: import("./history").CustomerHistoryState;
44
45
  houseAccounts: import("./houseAccounts").CustomerHouseAccountsState;
45
46
  loyalty: CustomerLoyaltyState;
46
47
  order: import("./order").CustomerOrderState;
@@ -118,6 +119,7 @@ export declare const selectCustomerPointsProgram: (orderType: OrderType | null)
118
119
  fcmToken: import("./fcmToken").CustomerFcmTokenState;
119
120
  giftCards: import("./giftCards").CustomerGiftCardsState;
120
121
  groupOrders: import("./groupOrders").CustomerGroupOrdersState;
122
+ history: import("./history").CustomerHistoryState;
121
123
  houseAccounts: import("./houseAccounts").CustomerHouseAccountsState;
122
124
  loyalty: CustomerLoyaltyState;
123
125
  order: import("./order").CustomerOrderState;
@@ -51,6 +51,7 @@ export declare const selectCustomerOrder: ((state: import("redux").EmptyObject &
51
51
  fcmToken: import("./fcmToken").CustomerFcmTokenState;
52
52
  giftCards: import("./giftCards").CustomerGiftCardsState;
53
53
  groupOrders: import("./groupOrders").CustomerGroupOrdersState;
54
+ history: import("./history").CustomerHistoryState;
54
55
  houseAccounts: import("./houseAccounts").CustomerHouseAccountsState;
55
56
  loyalty: import("./loyalty").CustomerLoyaltyState;
56
57
  order: CustomerOrderState;
@@ -38,6 +38,7 @@ export declare const selectCustomerTplsPoints: ((state: import("redux").EmptyObj
38
38
  fcmToken: import("./fcmToken").CustomerFcmTokenState;
39
39
  giftCards: import("./giftCards").CustomerGiftCardsState;
40
40
  groupOrders: import("./groupOrders").CustomerGroupOrdersState;
41
+ history: import("./history").CustomerHistoryState;
41
42
  houseAccounts: import("./houseAccounts").CustomerHouseAccountsState;
42
43
  loyalty: import("./loyalty").CustomerLoyaltyState;
43
44
  order: import("./order").CustomerOrderState;
@@ -103,6 +104,7 @@ export declare const selectCustomerTplsRewards: ((state: import("redux").EmptyOb
103
104
  fcmToken: import("./fcmToken").CustomerFcmTokenState;
104
105
  giftCards: import("./giftCards").CustomerGiftCardsState;
105
106
  groupOrders: import("./groupOrders").CustomerGroupOrdersState;
107
+ history: import("./history").CustomerHistoryState;
106
108
  houseAccounts: import("./houseAccounts").CustomerHouseAccountsState;
107
109
  loyalty: import("./loyalty").CustomerLoyaltyState;
108
110
  order: import("./order").CustomerOrderState;
@@ -168,6 +170,7 @@ export declare const selectCustomerTplsProgress: ((state: import("redux").EmptyO
168
170
  fcmToken: import("./fcmToken").CustomerFcmTokenState;
169
171
  giftCards: import("./giftCards").CustomerGiftCardsState;
170
172
  groupOrders: import("./groupOrders").CustomerGroupOrdersState;
173
+ history: import("./history").CustomerHistoryState;
171
174
  houseAccounts: import("./houseAccounts").CustomerHouseAccountsState;
172
175
  loyalty: import("./loyalty").CustomerLoyaltyState;
173
176
  order: import("./order").CustomerOrderState;
@@ -124,6 +124,7 @@ export declare const selectSpendingLimit: ((state: import("redux").EmptyObject &
124
124
  fcmToken: import("./customer").CustomerFcmTokenState;
125
125
  giftCards: import("./customer").CustomerGiftCardsState;
126
126
  groupOrders: import("./customer").CustomerGroupOrdersState;
127
+ history: import("./customer").CustomerHistoryState;
127
128
  houseAccounts: import("./customer").CustomerHouseAccountsState;
128
129
  loyalty: import("./customer").CustomerLoyaltyState;
129
130
  order: import("./customer").CustomerOrderState;
@@ -192,6 +193,7 @@ export declare const selectGroupOrderClosed: ((state: import("redux").EmptyObjec
192
193
  fcmToken: import("./customer").CustomerFcmTokenState;
193
194
  giftCards: import("./customer").CustomerGiftCardsState;
194
195
  groupOrders: import("./customer").CustomerGroupOrdersState;
196
+ history: import("./customer").CustomerHistoryState;
195
197
  houseAccounts: import("./customer").CustomerHouseAccountsState;
196
198
  loyalty: import("./customer").CustomerLoyaltyState;
197
199
  order: import("./customer").CustomerOrderState;
@@ -262,6 +264,7 @@ export declare const selectGroupOrderTests: ((state: import("redux").EmptyObject
262
264
  fcmToken: import("./customer").CustomerFcmTokenState;
263
265
  giftCards: import("./customer").CustomerGiftCardsState;
264
266
  groupOrders: import("./customer").CustomerGroupOrdersState;
267
+ history: import("./customer").CustomerHistoryState;
265
268
  houseAccounts: import("./customer").CustomerHouseAccountsState;
266
269
  loyalty: import("./customer").CustomerLoyaltyState;
267
270
  order: import("./customer").CustomerOrderState;
@@ -341,6 +344,7 @@ export declare const selectGroupOrderPrepTimes: ((state: import("redux").EmptyOb
341
344
  fcmToken: import("./customer").CustomerFcmTokenState;
342
345
  giftCards: import("./customer").CustomerGiftCardsState;
343
346
  groupOrders: import("./customer").CustomerGroupOrdersState;
347
+ history: import("./customer").CustomerHistoryState;
344
348
  houseAccounts: import("./customer").CustomerHouseAccountsState;
345
349
  loyalty: import("./customer").CustomerLoyaltyState;
346
350
  order: import("./customer").CustomerOrderState;
@@ -146,6 +146,7 @@ export declare const selectOrderLimits: ((state: import("redux").EmptyObject & {
146
146
  fcmToken: import("./customer").CustomerFcmTokenState;
147
147
  giftCards: import("./customer").CustomerGiftCardsState;
148
148
  groupOrders: import("./customer").CustomerGroupOrdersState;
149
+ history: import("./customer").CustomerHistoryState;
149
150
  houseAccounts: import("./customer").CustomerHouseAccountsState;
150
151
  loyalty: import("./customer").CustomerLoyaltyState;
151
152
  order: import("./customer").CustomerOrderState;
@@ -222,6 +223,7 @@ export declare const selectCartIds: ((state: import("redux").EmptyObject & {
222
223
  fcmToken: import("./customer").CustomerFcmTokenState;
223
224
  giftCards: import("./customer").CustomerGiftCardsState;
224
225
  groupOrders: import("./customer").CustomerGroupOrdersState;
226
+ history: import("./customer").CustomerHistoryState;
225
227
  houseAccounts: import("./customer").CustomerHouseAccountsState;
226
228
  loyalty: import("./customer").CustomerLoyaltyState;
227
229
  order: import("./customer").CustomerOrderState;
@@ -293,6 +295,7 @@ export declare const selectMenuVars: ((state: import("redux").EmptyObject & {
293
295
  fcmToken: import("./customer").CustomerFcmTokenState;
294
296
  giftCards: import("./customer").CustomerGiftCardsState;
295
297
  groupOrders: import("./customer").CustomerGroupOrdersState;
298
+ history: import("./customer").CustomerHistoryState;
296
299
  houseAccounts: import("./customer").CustomerHouseAccountsState;
297
300
  loyalty: import("./customer").CustomerLoyaltyState;
298
301
  order: import("./customer").CustomerOrderState;
@@ -37,6 +37,7 @@ export declare const selectQuote: ((state: import("redux").EmptyObject & {
37
37
  fcmToken: import("./customer").CustomerFcmTokenState;
38
38
  giftCards: import("./customer").CustomerGiftCardsState;
39
39
  groupOrders: import("./customer").CustomerGroupOrdersState;
40
+ history: import("./customer").CustomerHistoryState;
40
41
  houseAccounts: import("./customer").CustomerHouseAccountsState;
41
42
  loyalty: import("./customer").CustomerLoyaltyState;
42
43
  order: import("./customer").CustomerOrderState;
@@ -45,6 +45,7 @@ export declare const selectSelectedTagNames: ((state: import("redux").EmptyObjec
45
45
  fcmToken: import("./customer").CustomerFcmTokenState;
46
46
  giftCards: import("./customer").CustomerGiftCardsState;
47
47
  groupOrders: import("./customer").CustomerGroupOrdersState;
48
+ history: import("./customer").CustomerHistoryState;
48
49
  houseAccounts: import("./customer").CustomerHouseAccountsState;
49
50
  loyalty: import("./customer").CustomerLoyaltyState;
50
51
  order: import("./customer").CustomerOrderState;
@@ -21,6 +21,7 @@ export declare enum ReducerType {
21
21
  GroupOrder = "groupOrder",
22
22
  GroupOrders = "groupOrders",
23
23
  Guest = "guest",
24
+ History = "history",
24
25
  HouseAccounts = "houseAccounts",
25
26
  Loader = "loader",
26
27
  Loyalty = "loyalty",
@@ -22,6 +22,7 @@ export var ReducerType;
22
22
  ReducerType["GroupOrder"] = "groupOrder";
23
23
  ReducerType["GroupOrders"] = "groupOrders";
24
24
  ReducerType["Guest"] = "guest";
25
+ ReducerType["History"] = "history";
25
26
  ReducerType["HouseAccounts"] = "houseAccounts";
26
27
  ReducerType["Loader"] = "loader";
27
28
  ReducerType["Loyalty"] = "loyalty";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/cloud",
3
- "version": "0.1.116",
3
+ "version": "0.1.118",
4
4
  "description": "A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our cloud-based Order API.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -49,7 +49,7 @@
49
49
  "typescript": "^4.8.2"
50
50
  },
51
51
  "peerDependencies": {
52
- "@open-tender/types": "^0.2.109",
52
+ "@open-tender/types": "^0.2.110",
53
53
  "@open-tender/utils": "^0.1.174",
54
54
  "@reduxjs/toolkit": "^1.8.5",
55
55
  "react": "^18.2.0"