@open-tender/cloud 0.5.40 → 0.5.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/app/hooks.d.ts +1 -0
- package/dist/cjs/app/store.d.ts +3 -0
- package/dist/cjs/app/store.js +1 -0
- package/dist/cjs/services/api.d.ts +2 -1
- package/dist/cjs/services/api.js +4 -0
- package/dist/cjs/slices/allergens.d.ts +1 -0
- package/dist/cjs/slices/announcements.d.ts +2 -0
- package/dist/cjs/slices/config.d.ts +3 -0
- package/dist/cjs/slices/customer/creditCards.d.ts +1 -0
- package/dist/cjs/slices/customer/loyalty.d.ts +3 -0
- package/dist/cjs/slices/customer/order.d.ts +1 -0
- package/dist/cjs/slices/customer/tpls.d.ts +3 -0
- package/dist/cjs/slices/groupOrder.d.ts +4 -0
- package/dist/cjs/slices/index.d.ts +1 -0
- package/dist/cjs/slices/index.js +1 -0
- package/dist/cjs/slices/order.d.ts +3 -0
- package/dist/cjs/slices/quote.d.ts +1 -0
- package/dist/cjs/slices/recommendation.d.ts +27 -0
- package/dist/cjs/slices/recommendation.js +58 -0
- package/dist/cjs/slices/tags.d.ts +1 -0
- package/dist/cjs/slices/types.d.ts +1 -0
- package/dist/cjs/slices/types.js +1 -0
- package/dist/esm/app/hooks.d.ts +1 -0
- package/dist/esm/app/store.d.ts +3 -0
- package/dist/esm/app/store.js +2 -1
- package/dist/esm/services/api.d.ts +2 -1
- package/dist/esm/services/api.js +4 -0
- package/dist/esm/slices/allergens.d.ts +1 -0
- package/dist/esm/slices/announcements.d.ts +2 -0
- package/dist/esm/slices/config.d.ts +3 -0
- package/dist/esm/slices/customer/creditCards.d.ts +1 -0
- package/dist/esm/slices/customer/loyalty.d.ts +3 -0
- package/dist/esm/slices/customer/order.d.ts +1 -0
- package/dist/esm/slices/customer/tpls.d.ts +3 -0
- package/dist/esm/slices/groupOrder.d.ts +4 -0
- package/dist/esm/slices/index.d.ts +1 -0
- package/dist/esm/slices/index.js +1 -0
- package/dist/esm/slices/order.d.ts +3 -0
- package/dist/esm/slices/quote.d.ts +1 -0
- package/dist/esm/slices/recommendation.d.ts +27 -0
- package/dist/esm/slices/recommendation.js +54 -0
- package/dist/esm/slices/tags.d.ts +1 -0
- package/dist/esm/slices/types.d.ts +1 -0
- package/dist/esm/slices/types.js +1 -0
- package/package.json +3 -3
package/dist/cjs/app/hooks.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<i
|
|
|
53
53
|
pushNotifications: import("..").PushNotificationsState;
|
|
54
54
|
qr: import("..").QrState;
|
|
55
55
|
quote: import("..").QuoteState;
|
|
56
|
+
recommendation: import("..").RecommendationState;
|
|
56
57
|
resetPassword: import("..").ResetPasswordState;
|
|
57
58
|
revenueCenters: import("..").RevenueCentersState;
|
|
58
59
|
rewardCode: import("..").RewardCodeState;
|
package/dist/cjs/app/store.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ export declare const appReducer: import("redux").Reducer<import("redux").Combine
|
|
|
52
52
|
pushNotifications: import("../slices").PushNotificationsState;
|
|
53
53
|
qr: import("../slices").QrState;
|
|
54
54
|
quote: import("../slices").QuoteState;
|
|
55
|
+
recommendation: import("../slices").RecommendationState;
|
|
55
56
|
resetPassword: import("../slices").ResetPasswordState;
|
|
56
57
|
revenueCenters: import("../slices").RevenueCentersState;
|
|
57
58
|
rewardCode: import("../slices").RewardCodeState;
|
|
@@ -119,6 +120,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
119
120
|
pushNotifications: import("../slices").PushNotificationsState;
|
|
120
121
|
qr: import("../slices").QrState;
|
|
121
122
|
quote: import("../slices").QuoteState;
|
|
123
|
+
recommendation: import("../slices").RecommendationState;
|
|
122
124
|
resetPassword: import("../slices").ResetPasswordState;
|
|
123
125
|
revenueCenters: import("../slices").RevenueCentersState;
|
|
124
126
|
rewardCode: import("../slices").RewardCodeState;
|
|
@@ -184,6 +186,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
184
186
|
pushNotifications: import("../slices").PushNotificationsState;
|
|
185
187
|
qr: import("../slices").QrState;
|
|
186
188
|
quote: import("../slices").QuoteState;
|
|
189
|
+
recommendation: import("../slices").RecommendationState;
|
|
187
190
|
resetPassword: import("../slices").ResetPasswordState;
|
|
188
191
|
revenueCenters: import("../slices").RevenueCentersState;
|
|
189
192
|
rewardCode: import("../slices").RewardCodeState;
|
package/dist/cjs/app/store.js
CHANGED
|
@@ -36,6 +36,7 @@ exports.appReducer = (0, toolkit_1.combineReducers)({
|
|
|
36
36
|
[types_1.ReducerType.PushNotifications]: slices_1.pushNotificationsReducer,
|
|
37
37
|
[types_1.ReducerType.Qr]: slices_1.qrReducer,
|
|
38
38
|
[types_1.ReducerType.Quote]: slices_1.quoteReducer,
|
|
39
|
+
[types_1.ReducerType.Recommendation]: slices_1.recommendationReducer,
|
|
39
40
|
[types_1.ReducerType.ResetPassword]: slices_1.resetPasswordReducer,
|
|
40
41
|
[types_1.ReducerType.RevenueCenters]: slices_1.revenueCentersReducer,
|
|
41
42
|
[types_1.ReducerType.RewardCode]: slices_1.rewardCodeReducer,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Auth, ConfigApp, Customer, CustomerCreate, CustomerSignIn, GroupOrder, GroupOrdersExpanded, OrderType, RevenueCenterType, ServiceType, TPLSTerms, Weekday } from '@open-tender/types';
|
|
1
|
+
import { Auth, ConfigApp, Customer, CustomerCreate, CustomerSignIn, GroupOrder, GroupOrdersExpanded, OrderType, RevenueCenterType, ServiceType, TPLSTerms, Weekday, RecommendationInput } from '@open-tender/types';
|
|
2
2
|
declare class OpenTenderAPI {
|
|
3
3
|
brandId?: string;
|
|
4
4
|
clientId?: string;
|
|
@@ -67,6 +67,7 @@ declare class OpenTenderAPI {
|
|
|
67
67
|
getMenuItems(revenueCenterId: number, serviceType: ServiceType): Promise<unknown>;
|
|
68
68
|
getMenuDisplay(revenueCenterId: number, serviceType: ServiceType, weekday: Weekday, minutes: number): Promise<unknown>;
|
|
69
69
|
getMenuPages(): Promise<unknown>;
|
|
70
|
+
postMenuRecommendations(params: RecommendationInput, token: string): Promise<unknown>;
|
|
70
71
|
getTerms(): Promise<TPLSTerms | null | undefined>;
|
|
71
72
|
getDeals(customerId: number): Promise<unknown>;
|
|
72
73
|
getAnnouncements(page: string): Promise<unknown>;
|
package/dist/cjs/services/api.js
CHANGED
|
@@ -375,6 +375,10 @@ class OpenTenderAPI {
|
|
|
375
375
|
getMenuPages() {
|
|
376
376
|
return this.request(`/menu-pages`);
|
|
377
377
|
}
|
|
378
|
+
// ML recommendations
|
|
379
|
+
postMenuRecommendations(params, token) {
|
|
380
|
+
return this.request(`/recommendations`, 'POST', params, null, token);
|
|
381
|
+
}
|
|
378
382
|
getTerms() {
|
|
379
383
|
return this.request(`/terms`);
|
|
380
384
|
}
|
|
@@ -80,6 +80,7 @@ export declare const selectSelectedAllergenNames: ((state: import("redux").Empty
|
|
|
80
80
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
81
81
|
qr: import("./qr").QrState;
|
|
82
82
|
quote: import("./quote").QuoteState;
|
|
83
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
83
84
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
84
85
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
85
86
|
rewardCode: import("./rewardCode").RewardCodeState;
|
|
@@ -77,6 +77,7 @@ export declare const selectAnnouncementsPage: (page: AnnouncementPageType) => ((
|
|
|
77
77
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
78
78
|
qr: import("./qr").QrState;
|
|
79
79
|
quote: import("./quote").QuoteState;
|
|
80
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
80
81
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
81
82
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
82
83
|
rewardCode: import("./rewardCode").RewardCodeState;
|
|
@@ -161,6 +162,7 @@ export declare const selectHasAnnouncementsPage: (page: AnnouncementPageType) =>
|
|
|
161
162
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
162
163
|
qr: import("./qr").QrState;
|
|
163
164
|
quote: import("./quote").QuoteState;
|
|
165
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
164
166
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
165
167
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
166
168
|
rewardCode: import("./rewardCode").RewardCodeState;
|
|
@@ -142,6 +142,7 @@ export declare const selectOptIns: ((state: import("redux").EmptyObject & {
|
|
|
142
142
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
143
143
|
qr: import("./qr").QrState;
|
|
144
144
|
quote: import("./quote").QuoteState;
|
|
145
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
145
146
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
146
147
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
147
148
|
rewardCode: import("./rewardCode").RewardCodeState;
|
|
@@ -221,6 +222,7 @@ export declare const selectShowLoyalty: ((state: import("redux").EmptyObject & {
|
|
|
221
222
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
222
223
|
qr: import("./qr").QrState;
|
|
223
224
|
quote: import("./quote").QuoteState;
|
|
225
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
224
226
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
225
227
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
226
228
|
rewardCode: import("./rewardCode").RewardCodeState;
|
|
@@ -299,6 +301,7 @@ export declare const selectBottomTabsTitles: ((state: import("redux").EmptyObjec
|
|
|
299
301
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
300
302
|
qr: import("./qr").QrState;
|
|
301
303
|
quote: import("./quote").QuoteState;
|
|
304
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
302
305
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
303
306
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
304
307
|
rewardCode: import("./rewardCode").RewardCodeState;
|
|
@@ -119,6 +119,7 @@ export declare const selectCustomerCreditCardsForPayment: ((state: import("redux
|
|
|
119
119
|
pushNotifications: import("..").PushNotificationsState;
|
|
120
120
|
qr: import("..").QrState;
|
|
121
121
|
quote: import("..").QuoteState;
|
|
122
|
+
recommendation: import("..").RecommendationState;
|
|
122
123
|
resetPassword: import("..").ResetPasswordState;
|
|
123
124
|
revenueCenters: import("..").RevenueCentersState;
|
|
124
125
|
rewardCode: import("..").RewardCodeState;
|
|
@@ -76,6 +76,7 @@ export declare const selectCustomerLoyaltyProgram: ((state: import("redux").Empt
|
|
|
76
76
|
pushNotifications: import("..").PushNotificationsState;
|
|
77
77
|
qr: import("..").QrState;
|
|
78
78
|
quote: import("..").QuoteState;
|
|
79
|
+
recommendation: import("..").RecommendationState;
|
|
79
80
|
resetPassword: import("..").ResetPasswordState;
|
|
80
81
|
revenueCenters: import("..").RevenueCentersState;
|
|
81
82
|
rewardCode: import("..").RewardCodeState;
|
|
@@ -158,6 +159,7 @@ export declare const selectHasPointsShop: ((state: import("redux").EmptyObject &
|
|
|
158
159
|
pushNotifications: import("..").PushNotificationsState;
|
|
159
160
|
qr: import("..").QrState;
|
|
160
161
|
quote: import("..").QuoteState;
|
|
162
|
+
recommendation: import("..").RecommendationState;
|
|
161
163
|
resetPassword: import("..").ResetPasswordState;
|
|
162
164
|
revenueCenters: import("..").RevenueCentersState;
|
|
163
165
|
rewardCode: import("..").RewardCodeState;
|
|
@@ -230,6 +232,7 @@ export declare const selectCustomerPointsProgram: (orderType: OrderType | null)
|
|
|
230
232
|
pushNotifications: import("..").PushNotificationsState;
|
|
231
233
|
qr: import("..").QrState;
|
|
232
234
|
quote: import("..").QuoteState;
|
|
235
|
+
recommendation: import("..").RecommendationState;
|
|
233
236
|
resetPassword: import("..").ResetPasswordState;
|
|
234
237
|
revenueCenters: import("..").RevenueCentersState;
|
|
235
238
|
rewardCode: import("..").RewardCodeState;
|
|
@@ -86,6 +86,7 @@ export declare const selectCustomerOrder: ((state: import("redux").EmptyObject &
|
|
|
86
86
|
pushNotifications: import("..").PushNotificationsState;
|
|
87
87
|
qr: import("..").QrState;
|
|
88
88
|
quote: import("..").QuoteState;
|
|
89
|
+
recommendation: import("..").RecommendationState;
|
|
89
90
|
resetPassword: import("..").ResetPasswordState;
|
|
90
91
|
revenueCenters: import("..").RevenueCentersState;
|
|
91
92
|
rewardCode: import("..").RewardCodeState;
|
|
@@ -84,6 +84,7 @@ export declare const selectCustomerTplsPoints: ((state: import("redux").EmptyObj
|
|
|
84
84
|
pushNotifications: import("..").PushNotificationsState;
|
|
85
85
|
qr: import("..").QrState;
|
|
86
86
|
quote: import("..").QuoteState;
|
|
87
|
+
recommendation: import("..").RecommendationState;
|
|
87
88
|
resetPassword: import("..").ResetPasswordState;
|
|
88
89
|
revenueCenters: import("..").RevenueCentersState;
|
|
89
90
|
rewardCode: import("..").RewardCodeState;
|
|
@@ -154,6 +155,7 @@ export declare const selectCustomerTplsRewards: ((state: import("redux").EmptyOb
|
|
|
154
155
|
pushNotifications: import("..").PushNotificationsState;
|
|
155
156
|
qr: import("..").QrState;
|
|
156
157
|
quote: import("..").QuoteState;
|
|
158
|
+
recommendation: import("..").RecommendationState;
|
|
157
159
|
resetPassword: import("..").ResetPasswordState;
|
|
158
160
|
revenueCenters: import("..").RevenueCentersState;
|
|
159
161
|
rewardCode: import("..").RewardCodeState;
|
|
@@ -224,6 +226,7 @@ export declare const selectCustomerTplsProgress: ((state: import("redux").EmptyO
|
|
|
224
226
|
pushNotifications: import("..").PushNotificationsState;
|
|
225
227
|
qr: import("..").QrState;
|
|
226
228
|
quote: import("..").QuoteState;
|
|
229
|
+
recommendation: import("..").RecommendationState;
|
|
227
230
|
resetPassword: import("..").ResetPasswordState;
|
|
228
231
|
revenueCenters: import("..").RevenueCentersState;
|
|
229
232
|
rewardCode: import("..").RewardCodeState;
|
|
@@ -159,6 +159,7 @@ export declare const selectSpendingLimit: ((state: import("redux").EmptyObject &
|
|
|
159
159
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
160
160
|
qr: import("./qr").QrState;
|
|
161
161
|
quote: import("./quote").QuoteState;
|
|
162
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
162
163
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
163
164
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
164
165
|
rewardCode: import("./rewardCode").RewardCodeState;
|
|
@@ -232,6 +233,7 @@ export declare const selectGroupOrderClosed: ((state: import("redux").EmptyObjec
|
|
|
232
233
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
233
234
|
qr: import("./qr").QrState;
|
|
234
235
|
quote: import("./quote").QuoteState;
|
|
236
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
235
237
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
236
238
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
237
239
|
rewardCode: import("./rewardCode").RewardCodeState;
|
|
@@ -307,6 +309,7 @@ export declare const selectGroupOrderTests: ((state: import("redux").EmptyObject
|
|
|
307
309
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
308
310
|
qr: import("./qr").QrState;
|
|
309
311
|
quote: import("./quote").QuoteState;
|
|
312
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
310
313
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
311
314
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
312
315
|
rewardCode: import("./rewardCode").RewardCodeState;
|
|
@@ -391,6 +394,7 @@ export declare const selectGroupOrderPrepTimes: ((state: import("redux").EmptyOb
|
|
|
391
394
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
392
395
|
qr: import("./qr").QrState;
|
|
393
396
|
quote: import("./quote").QuoteState;
|
|
397
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
394
398
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
395
399
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
396
400
|
rewardCode: import("./rewardCode").RewardCodeState;
|
package/dist/cjs/slices/index.js
CHANGED
|
@@ -32,6 +32,7 @@ tslib_1.__exportStar(require("./posts"), exports);
|
|
|
32
32
|
tslib_1.__exportStar(require("./pushNotifications"), exports);
|
|
33
33
|
tslib_1.__exportStar(require("./qr"), exports);
|
|
34
34
|
tslib_1.__exportStar(require("./quote"), exports);
|
|
35
|
+
tslib_1.__exportStar(require("./recommendation"), exports);
|
|
35
36
|
tslib_1.__exportStar(require("./resetPassword"), exports);
|
|
36
37
|
tslib_1.__exportStar(require("./revenueCenters"), exports);
|
|
37
38
|
tslib_1.__exportStar(require("./rewardCode"), exports);
|
|
@@ -190,6 +190,7 @@ export declare const selectOrderLimits: ((state: import("redux").EmptyObject & {
|
|
|
190
190
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
191
191
|
qr: import("./qr").QrState;
|
|
192
192
|
quote: import("./quote").QuoteState;
|
|
193
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
193
194
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
194
195
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
195
196
|
rewardCode: import("./rewardCode").RewardCodeState;
|
|
@@ -271,6 +272,7 @@ export declare const selectCartIds: ((state: import("redux").EmptyObject & {
|
|
|
271
272
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
272
273
|
qr: import("./qr").QrState;
|
|
273
274
|
quote: import("./quote").QuoteState;
|
|
275
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
274
276
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
275
277
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
276
278
|
rewardCode: import("./rewardCode").RewardCodeState;
|
|
@@ -347,6 +349,7 @@ export declare const selectMenuVars: ((state: import("redux").EmptyObject & {
|
|
|
347
349
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
348
350
|
qr: import("./qr").QrState;
|
|
349
351
|
quote: import("./quote").QuoteState;
|
|
352
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
350
353
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
351
354
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
352
355
|
rewardCode: import("./rewardCode").RewardCodeState;
|
|
@@ -72,6 +72,7 @@ export declare const selectQuote: ((state: import("redux").EmptyObject & {
|
|
|
72
72
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
73
73
|
qr: import("./qr").QrState;
|
|
74
74
|
quote: QuoteState;
|
|
75
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
75
76
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
76
77
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
77
78
|
rewardCode: import("./rewardCode").RewardCodeState;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { RecommendationInput, RecommendationPayload, RequestError, RequestStatus } from '@open-tender/types';
|
|
2
|
+
import { AppState } from '../app';
|
|
3
|
+
export interface RecommendationState {
|
|
4
|
+
entities: RecommendationPayload | null;
|
|
5
|
+
error: RequestError;
|
|
6
|
+
loading: RequestStatus;
|
|
7
|
+
}
|
|
8
|
+
export declare enum RecommendationActionType {
|
|
9
|
+
FetchRecommendations = "recommendation/fetchRecommendations"
|
|
10
|
+
}
|
|
11
|
+
export declare const fetchRecommendations: import("@reduxjs/toolkit").AsyncThunk<RecommendationPayload, RecommendationInput, {
|
|
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 resetRecommendations: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"recommendation/resetRecommendations">;
|
|
22
|
+
export declare const selectRecommendations: (state: AppState) => {
|
|
23
|
+
recommendations: RecommendationPayload | null;
|
|
24
|
+
loading: RequestStatus;
|
|
25
|
+
error: RequestError;
|
|
26
|
+
};
|
|
27
|
+
export declare const recommendationReducer: import("redux").Reducer<RecommendationState, import("redux").AnyAction>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.recommendationReducer = exports.selectRecommendations = exports.resetRecommendations = exports.fetchRecommendations = exports.RecommendationActionType = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const customer_1 = require("./customer");
|
|
7
|
+
const types_1 = require("./types");
|
|
8
|
+
const initialState = {
|
|
9
|
+
entities: null,
|
|
10
|
+
loading: 'idle',
|
|
11
|
+
error: null
|
|
12
|
+
};
|
|
13
|
+
var RecommendationActionType;
|
|
14
|
+
(function (RecommendationActionType) {
|
|
15
|
+
RecommendationActionType["FetchRecommendations"] = "recommendation/fetchRecommendations";
|
|
16
|
+
})(RecommendationActionType = exports.RecommendationActionType || (exports.RecommendationActionType = {}));
|
|
17
|
+
exports.fetchRecommendations = (0, toolkit_1.createAsyncThunk)(RecommendationActionType.FetchRecommendations, (params, { getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
try {
|
|
19
|
+
const { api } = getState().config;
|
|
20
|
+
if (!api)
|
|
21
|
+
throw new Error('No api found');
|
|
22
|
+
const token = (0, customer_1.selectToken)(getState());
|
|
23
|
+
const recommendations = yield api.postMenuRecommendations(params, token);
|
|
24
|
+
return recommendations;
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
return rejectWithValue(err);
|
|
28
|
+
}
|
|
29
|
+
}));
|
|
30
|
+
const recommendationSlice = (0, toolkit_1.createSlice)({
|
|
31
|
+
name: types_1.ReducerType.Recommendation,
|
|
32
|
+
initialState,
|
|
33
|
+
reducers: {
|
|
34
|
+
resetRecommendations: () => initialState
|
|
35
|
+
},
|
|
36
|
+
extraReducers: builder => {
|
|
37
|
+
builder
|
|
38
|
+
.addCase(exports.fetchRecommendations.fulfilled, (state, action) => {
|
|
39
|
+
state.entities = action.payload;
|
|
40
|
+
state.loading = 'idle';
|
|
41
|
+
state.error = null;
|
|
42
|
+
})
|
|
43
|
+
.addCase(exports.fetchRecommendations.pending, state => {
|
|
44
|
+
state.loading = 'pending';
|
|
45
|
+
})
|
|
46
|
+
.addCase(exports.fetchRecommendations.rejected, (state, action) => {
|
|
47
|
+
state.error = action.payload;
|
|
48
|
+
state.loading = 'idle';
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
exports.resetRecommendations = recommendationSlice.actions.resetRecommendations;
|
|
53
|
+
const selectRecommendations = (state) => {
|
|
54
|
+
const { entities: recommendations, loading, error } = state.recommendation;
|
|
55
|
+
return { recommendations, loading, error };
|
|
56
|
+
};
|
|
57
|
+
exports.selectRecommendations = selectRecommendations;
|
|
58
|
+
exports.recommendationReducer = recommendationSlice.reducer;
|
|
@@ -80,6 +80,7 @@ export declare const selectSelectedTagNames: ((state: import("redux").EmptyObjec
|
|
|
80
80
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
81
81
|
qr: import("./qr").QrState;
|
|
82
82
|
quote: import("./quote").QuoteState;
|
|
83
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
83
84
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
84
85
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
85
86
|
rewardCode: import("./rewardCode").RewardCodeState;
|
package/dist/cjs/slices/types.js
CHANGED
|
@@ -48,6 +48,7 @@ var ReducerType;
|
|
|
48
48
|
ReducerType["Qr"] = "qr";
|
|
49
49
|
ReducerType["QRCode"] = "qrcode";
|
|
50
50
|
ReducerType["Quote"] = "quote";
|
|
51
|
+
ReducerType["Recommendation"] = "recommendation";
|
|
51
52
|
ReducerType["ResetPassword"] = "resetPassword";
|
|
52
53
|
ReducerType["RevenueCenters"] = "revenueCenters";
|
|
53
54
|
ReducerType["Rewards"] = "rewards";
|
package/dist/esm/app/hooks.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<i
|
|
|
53
53
|
pushNotifications: import("..").PushNotificationsState;
|
|
54
54
|
qr: import("..").QrState;
|
|
55
55
|
quote: import("..").QuoteState;
|
|
56
|
+
recommendation: import("..").RecommendationState;
|
|
56
57
|
resetPassword: import("..").ResetPasswordState;
|
|
57
58
|
revenueCenters: import("..").RevenueCentersState;
|
|
58
59
|
rewardCode: import("..").RewardCodeState;
|
package/dist/esm/app/store.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ export declare const appReducer: import("redux").Reducer<import("redux").Combine
|
|
|
52
52
|
pushNotifications: import("../slices").PushNotificationsState;
|
|
53
53
|
qr: import("../slices").QrState;
|
|
54
54
|
quote: import("../slices").QuoteState;
|
|
55
|
+
recommendation: import("../slices").RecommendationState;
|
|
55
56
|
resetPassword: import("../slices").ResetPasswordState;
|
|
56
57
|
revenueCenters: import("../slices").RevenueCentersState;
|
|
57
58
|
rewardCode: import("../slices").RewardCodeState;
|
|
@@ -119,6 +120,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
119
120
|
pushNotifications: import("../slices").PushNotificationsState;
|
|
120
121
|
qr: import("../slices").QrState;
|
|
121
122
|
quote: import("../slices").QuoteState;
|
|
123
|
+
recommendation: import("../slices").RecommendationState;
|
|
122
124
|
resetPassword: import("../slices").ResetPasswordState;
|
|
123
125
|
revenueCenters: import("../slices").RevenueCentersState;
|
|
124
126
|
rewardCode: import("../slices").RewardCodeState;
|
|
@@ -184,6 +186,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
184
186
|
pushNotifications: import("../slices").PushNotificationsState;
|
|
185
187
|
qr: import("../slices").QrState;
|
|
186
188
|
quote: import("../slices").QuoteState;
|
|
189
|
+
recommendation: import("../slices").RecommendationState;
|
|
187
190
|
resetPassword: import("../slices").ResetPasswordState;
|
|
188
191
|
revenueCenters: import("../slices").RevenueCentersState;
|
|
189
192
|
rewardCode: import("../slices").RewardCodeState;
|
package/dist/esm/app/store.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { combineReducers, configureStore } from '@reduxjs/toolkit';
|
|
2
|
-
import { alertsReducer, allergensReducer, announcementsReducer, checkoutReducer, completedOrdersReducer, configReducer, confirmationReducer, customerReducer, dealsReducer, donationsReducer, geolocationReducer, giftCardsReducer, groupOrderReducer, guestReducer, loaderReducer, menuDisplayReducer, menuItemsReducer, menuReducer, miscReducer, modalReducer, navReducer, navSiteReducer, notificationsReducer, oneTimePasscodeReducer, orderFulfillmentReducer, orderRatingReducer, orderReducer, postsReducer, pushNotificationsReducer, qrReducer, quoteReducer, resetPasswordReducer, revenueCentersReducer, rewardCodeReducer, sidebarModalReducer, sidebarReducer, signUpReducer, statesReducer, tagsReducer, termsReducer, unsubscribeReducer, validTimesReducer, verifyAccountReducer } from '../slices';
|
|
2
|
+
import { alertsReducer, allergensReducer, announcementsReducer, checkoutReducer, completedOrdersReducer, configReducer, confirmationReducer, customerReducer, dealsReducer, donationsReducer, geolocationReducer, giftCardsReducer, groupOrderReducer, guestReducer, loaderReducer, menuDisplayReducer, menuItemsReducer, menuReducer, miscReducer, modalReducer, navReducer, navSiteReducer, notificationsReducer, oneTimePasscodeReducer, orderFulfillmentReducer, orderRatingReducer, orderReducer, postsReducer, pushNotificationsReducer, qrReducer, quoteReducer, recommendationReducer, resetPasswordReducer, revenueCentersReducer, rewardCodeReducer, sidebarModalReducer, sidebarReducer, signUpReducer, statesReducer, tagsReducer, termsReducer, unsubscribeReducer, validTimesReducer, verifyAccountReducer } from '../slices';
|
|
3
3
|
import { ReducerType } from '../slices/types';
|
|
4
4
|
export const appReducer = combineReducers({
|
|
5
5
|
[ReducerType.Alerts]: alertsReducer,
|
|
@@ -33,6 +33,7 @@ export const appReducer = combineReducers({
|
|
|
33
33
|
[ReducerType.PushNotifications]: pushNotificationsReducer,
|
|
34
34
|
[ReducerType.Qr]: qrReducer,
|
|
35
35
|
[ReducerType.Quote]: quoteReducer,
|
|
36
|
+
[ReducerType.Recommendation]: recommendationReducer,
|
|
36
37
|
[ReducerType.ResetPassword]: resetPasswordReducer,
|
|
37
38
|
[ReducerType.RevenueCenters]: revenueCentersReducer,
|
|
38
39
|
[ReducerType.RewardCode]: rewardCodeReducer,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Auth, ConfigApp, Customer, CustomerCreate, CustomerSignIn, GroupOrder, GroupOrdersExpanded, OrderType, RevenueCenterType, ServiceType, TPLSTerms, Weekday } from '@open-tender/types';
|
|
1
|
+
import { Auth, ConfigApp, Customer, CustomerCreate, CustomerSignIn, GroupOrder, GroupOrdersExpanded, OrderType, RevenueCenterType, ServiceType, TPLSTerms, Weekday, RecommendationInput } from '@open-tender/types';
|
|
2
2
|
declare class OpenTenderAPI {
|
|
3
3
|
brandId?: string;
|
|
4
4
|
clientId?: string;
|
|
@@ -67,6 +67,7 @@ declare class OpenTenderAPI {
|
|
|
67
67
|
getMenuItems(revenueCenterId: number, serviceType: ServiceType): Promise<unknown>;
|
|
68
68
|
getMenuDisplay(revenueCenterId: number, serviceType: ServiceType, weekday: Weekday, minutes: number): Promise<unknown>;
|
|
69
69
|
getMenuPages(): Promise<unknown>;
|
|
70
|
+
postMenuRecommendations(params: RecommendationInput, token: string): Promise<unknown>;
|
|
70
71
|
getTerms(): Promise<TPLSTerms | null | undefined>;
|
|
71
72
|
getDeals(customerId: number): Promise<unknown>;
|
|
72
73
|
getAnnouncements(page: string): Promise<unknown>;
|
package/dist/esm/services/api.js
CHANGED
|
@@ -373,6 +373,10 @@ class OpenTenderAPI {
|
|
|
373
373
|
getMenuPages() {
|
|
374
374
|
return this.request(`/menu-pages`);
|
|
375
375
|
}
|
|
376
|
+
// ML recommendations
|
|
377
|
+
postMenuRecommendations(params, token) {
|
|
378
|
+
return this.request(`/recommendations`, 'POST', params, null, token);
|
|
379
|
+
}
|
|
376
380
|
getTerms() {
|
|
377
381
|
return this.request(`/terms`);
|
|
378
382
|
}
|
|
@@ -80,6 +80,7 @@ export declare const selectSelectedAllergenNames: ((state: import("redux").Empty
|
|
|
80
80
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
81
81
|
qr: import("./qr").QrState;
|
|
82
82
|
quote: import("./quote").QuoteState;
|
|
83
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
83
84
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
84
85
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
85
86
|
rewardCode: import("./rewardCode").RewardCodeState;
|
|
@@ -77,6 +77,7 @@ export declare const selectAnnouncementsPage: (page: AnnouncementPageType) => ((
|
|
|
77
77
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
78
78
|
qr: import("./qr").QrState;
|
|
79
79
|
quote: import("./quote").QuoteState;
|
|
80
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
80
81
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
81
82
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
82
83
|
rewardCode: import("./rewardCode").RewardCodeState;
|
|
@@ -161,6 +162,7 @@ export declare const selectHasAnnouncementsPage: (page: AnnouncementPageType) =>
|
|
|
161
162
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
162
163
|
qr: import("./qr").QrState;
|
|
163
164
|
quote: import("./quote").QuoteState;
|
|
165
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
164
166
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
165
167
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
166
168
|
rewardCode: import("./rewardCode").RewardCodeState;
|
|
@@ -142,6 +142,7 @@ export declare const selectOptIns: ((state: import("redux").EmptyObject & {
|
|
|
142
142
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
143
143
|
qr: import("./qr").QrState;
|
|
144
144
|
quote: import("./quote").QuoteState;
|
|
145
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
145
146
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
146
147
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
147
148
|
rewardCode: import("./rewardCode").RewardCodeState;
|
|
@@ -221,6 +222,7 @@ export declare const selectShowLoyalty: ((state: import("redux").EmptyObject & {
|
|
|
221
222
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
222
223
|
qr: import("./qr").QrState;
|
|
223
224
|
quote: import("./quote").QuoteState;
|
|
225
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
224
226
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
225
227
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
226
228
|
rewardCode: import("./rewardCode").RewardCodeState;
|
|
@@ -299,6 +301,7 @@ export declare const selectBottomTabsTitles: ((state: import("redux").EmptyObjec
|
|
|
299
301
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
300
302
|
qr: import("./qr").QrState;
|
|
301
303
|
quote: import("./quote").QuoteState;
|
|
304
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
302
305
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
303
306
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
304
307
|
rewardCode: import("./rewardCode").RewardCodeState;
|
|
@@ -119,6 +119,7 @@ export declare const selectCustomerCreditCardsForPayment: ((state: import("redux
|
|
|
119
119
|
pushNotifications: import("..").PushNotificationsState;
|
|
120
120
|
qr: import("..").QrState;
|
|
121
121
|
quote: import("..").QuoteState;
|
|
122
|
+
recommendation: import("..").RecommendationState;
|
|
122
123
|
resetPassword: import("..").ResetPasswordState;
|
|
123
124
|
revenueCenters: import("..").RevenueCentersState;
|
|
124
125
|
rewardCode: import("..").RewardCodeState;
|
|
@@ -76,6 +76,7 @@ export declare const selectCustomerLoyaltyProgram: ((state: import("redux").Empt
|
|
|
76
76
|
pushNotifications: import("..").PushNotificationsState;
|
|
77
77
|
qr: import("..").QrState;
|
|
78
78
|
quote: import("..").QuoteState;
|
|
79
|
+
recommendation: import("..").RecommendationState;
|
|
79
80
|
resetPassword: import("..").ResetPasswordState;
|
|
80
81
|
revenueCenters: import("..").RevenueCentersState;
|
|
81
82
|
rewardCode: import("..").RewardCodeState;
|
|
@@ -158,6 +159,7 @@ export declare const selectHasPointsShop: ((state: import("redux").EmptyObject &
|
|
|
158
159
|
pushNotifications: import("..").PushNotificationsState;
|
|
159
160
|
qr: import("..").QrState;
|
|
160
161
|
quote: import("..").QuoteState;
|
|
162
|
+
recommendation: import("..").RecommendationState;
|
|
161
163
|
resetPassword: import("..").ResetPasswordState;
|
|
162
164
|
revenueCenters: import("..").RevenueCentersState;
|
|
163
165
|
rewardCode: import("..").RewardCodeState;
|
|
@@ -230,6 +232,7 @@ export declare const selectCustomerPointsProgram: (orderType: OrderType | null)
|
|
|
230
232
|
pushNotifications: import("..").PushNotificationsState;
|
|
231
233
|
qr: import("..").QrState;
|
|
232
234
|
quote: import("..").QuoteState;
|
|
235
|
+
recommendation: import("..").RecommendationState;
|
|
233
236
|
resetPassword: import("..").ResetPasswordState;
|
|
234
237
|
revenueCenters: import("..").RevenueCentersState;
|
|
235
238
|
rewardCode: import("..").RewardCodeState;
|
|
@@ -86,6 +86,7 @@ export declare const selectCustomerOrder: ((state: import("redux").EmptyObject &
|
|
|
86
86
|
pushNotifications: import("..").PushNotificationsState;
|
|
87
87
|
qr: import("..").QrState;
|
|
88
88
|
quote: import("..").QuoteState;
|
|
89
|
+
recommendation: import("..").RecommendationState;
|
|
89
90
|
resetPassword: import("..").ResetPasswordState;
|
|
90
91
|
revenueCenters: import("..").RevenueCentersState;
|
|
91
92
|
rewardCode: import("..").RewardCodeState;
|
|
@@ -84,6 +84,7 @@ export declare const selectCustomerTplsPoints: ((state: import("redux").EmptyObj
|
|
|
84
84
|
pushNotifications: import("..").PushNotificationsState;
|
|
85
85
|
qr: import("..").QrState;
|
|
86
86
|
quote: import("..").QuoteState;
|
|
87
|
+
recommendation: import("..").RecommendationState;
|
|
87
88
|
resetPassword: import("..").ResetPasswordState;
|
|
88
89
|
revenueCenters: import("..").RevenueCentersState;
|
|
89
90
|
rewardCode: import("..").RewardCodeState;
|
|
@@ -154,6 +155,7 @@ export declare const selectCustomerTplsRewards: ((state: import("redux").EmptyOb
|
|
|
154
155
|
pushNotifications: import("..").PushNotificationsState;
|
|
155
156
|
qr: import("..").QrState;
|
|
156
157
|
quote: import("..").QuoteState;
|
|
158
|
+
recommendation: import("..").RecommendationState;
|
|
157
159
|
resetPassword: import("..").ResetPasswordState;
|
|
158
160
|
revenueCenters: import("..").RevenueCentersState;
|
|
159
161
|
rewardCode: import("..").RewardCodeState;
|
|
@@ -224,6 +226,7 @@ export declare const selectCustomerTplsProgress: ((state: import("redux").EmptyO
|
|
|
224
226
|
pushNotifications: import("..").PushNotificationsState;
|
|
225
227
|
qr: import("..").QrState;
|
|
226
228
|
quote: import("..").QuoteState;
|
|
229
|
+
recommendation: import("..").RecommendationState;
|
|
227
230
|
resetPassword: import("..").ResetPasswordState;
|
|
228
231
|
revenueCenters: import("..").RevenueCentersState;
|
|
229
232
|
rewardCode: import("..").RewardCodeState;
|
|
@@ -159,6 +159,7 @@ export declare const selectSpendingLimit: ((state: import("redux").EmptyObject &
|
|
|
159
159
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
160
160
|
qr: import("./qr").QrState;
|
|
161
161
|
quote: import("./quote").QuoteState;
|
|
162
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
162
163
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
163
164
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
164
165
|
rewardCode: import("./rewardCode").RewardCodeState;
|
|
@@ -232,6 +233,7 @@ export declare const selectGroupOrderClosed: ((state: import("redux").EmptyObjec
|
|
|
232
233
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
233
234
|
qr: import("./qr").QrState;
|
|
234
235
|
quote: import("./quote").QuoteState;
|
|
236
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
235
237
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
236
238
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
237
239
|
rewardCode: import("./rewardCode").RewardCodeState;
|
|
@@ -307,6 +309,7 @@ export declare const selectGroupOrderTests: ((state: import("redux").EmptyObject
|
|
|
307
309
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
308
310
|
qr: import("./qr").QrState;
|
|
309
311
|
quote: import("./quote").QuoteState;
|
|
312
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
310
313
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
311
314
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
312
315
|
rewardCode: import("./rewardCode").RewardCodeState;
|
|
@@ -391,6 +394,7 @@ export declare const selectGroupOrderPrepTimes: ((state: import("redux").EmptyOb
|
|
|
391
394
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
392
395
|
qr: import("./qr").QrState;
|
|
393
396
|
quote: import("./quote").QuoteState;
|
|
397
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
394
398
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
395
399
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
396
400
|
rewardCode: import("./rewardCode").RewardCodeState;
|
package/dist/esm/slices/index.js
CHANGED
|
@@ -190,6 +190,7 @@ export declare const selectOrderLimits: ((state: import("redux").EmptyObject & {
|
|
|
190
190
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
191
191
|
qr: import("./qr").QrState;
|
|
192
192
|
quote: import("./quote").QuoteState;
|
|
193
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
193
194
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
194
195
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
195
196
|
rewardCode: import("./rewardCode").RewardCodeState;
|
|
@@ -271,6 +272,7 @@ export declare const selectCartIds: ((state: import("redux").EmptyObject & {
|
|
|
271
272
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
272
273
|
qr: import("./qr").QrState;
|
|
273
274
|
quote: import("./quote").QuoteState;
|
|
275
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
274
276
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
275
277
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
276
278
|
rewardCode: import("./rewardCode").RewardCodeState;
|
|
@@ -347,6 +349,7 @@ export declare const selectMenuVars: ((state: import("redux").EmptyObject & {
|
|
|
347
349
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
348
350
|
qr: import("./qr").QrState;
|
|
349
351
|
quote: import("./quote").QuoteState;
|
|
352
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
350
353
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
351
354
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
352
355
|
rewardCode: import("./rewardCode").RewardCodeState;
|
|
@@ -72,6 +72,7 @@ export declare const selectQuote: ((state: import("redux").EmptyObject & {
|
|
|
72
72
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
73
73
|
qr: import("./qr").QrState;
|
|
74
74
|
quote: QuoteState;
|
|
75
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
75
76
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
76
77
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
77
78
|
rewardCode: import("./rewardCode").RewardCodeState;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { RecommendationInput, RecommendationPayload, RequestError, RequestStatus } from '@open-tender/types';
|
|
2
|
+
import { AppState } from '../app';
|
|
3
|
+
export interface RecommendationState {
|
|
4
|
+
entities: RecommendationPayload | null;
|
|
5
|
+
error: RequestError;
|
|
6
|
+
loading: RequestStatus;
|
|
7
|
+
}
|
|
8
|
+
export declare enum RecommendationActionType {
|
|
9
|
+
FetchRecommendations = "recommendation/fetchRecommendations"
|
|
10
|
+
}
|
|
11
|
+
export declare const fetchRecommendations: import("@reduxjs/toolkit").AsyncThunk<RecommendationPayload, RecommendationInput, {
|
|
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 resetRecommendations: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"recommendation/resetRecommendations">;
|
|
22
|
+
export declare const selectRecommendations: (state: AppState) => {
|
|
23
|
+
recommendations: RecommendationPayload | null;
|
|
24
|
+
loading: RequestStatus;
|
|
25
|
+
error: RequestError;
|
|
26
|
+
};
|
|
27
|
+
export declare const recommendationReducer: import("redux").Reducer<RecommendationState, import("redux").AnyAction>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
3
|
+
import { selectToken } from './customer';
|
|
4
|
+
import { ReducerType } from './types';
|
|
5
|
+
const initialState = {
|
|
6
|
+
entities: null,
|
|
7
|
+
loading: 'idle',
|
|
8
|
+
error: null
|
|
9
|
+
};
|
|
10
|
+
export var RecommendationActionType;
|
|
11
|
+
(function (RecommendationActionType) {
|
|
12
|
+
RecommendationActionType["FetchRecommendations"] = "recommendation/fetchRecommendations";
|
|
13
|
+
})(RecommendationActionType || (RecommendationActionType = {}));
|
|
14
|
+
export const fetchRecommendations = createAsyncThunk(RecommendationActionType.FetchRecommendations, (params, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
try {
|
|
16
|
+
const { api } = getState().config;
|
|
17
|
+
if (!api)
|
|
18
|
+
throw new Error('No api found');
|
|
19
|
+
const token = selectToken(getState());
|
|
20
|
+
const recommendations = yield api.postMenuRecommendations(params, token);
|
|
21
|
+
return recommendations;
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
return rejectWithValue(err);
|
|
25
|
+
}
|
|
26
|
+
}));
|
|
27
|
+
const recommendationSlice = createSlice({
|
|
28
|
+
name: ReducerType.Recommendation,
|
|
29
|
+
initialState,
|
|
30
|
+
reducers: {
|
|
31
|
+
resetRecommendations: () => initialState
|
|
32
|
+
},
|
|
33
|
+
extraReducers: builder => {
|
|
34
|
+
builder
|
|
35
|
+
.addCase(fetchRecommendations.fulfilled, (state, action) => {
|
|
36
|
+
state.entities = action.payload;
|
|
37
|
+
state.loading = 'idle';
|
|
38
|
+
state.error = null;
|
|
39
|
+
})
|
|
40
|
+
.addCase(fetchRecommendations.pending, state => {
|
|
41
|
+
state.loading = 'pending';
|
|
42
|
+
})
|
|
43
|
+
.addCase(fetchRecommendations.rejected, (state, action) => {
|
|
44
|
+
state.error = action.payload;
|
|
45
|
+
state.loading = 'idle';
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
export const { resetRecommendations } = recommendationSlice.actions;
|
|
50
|
+
export const selectRecommendations = (state) => {
|
|
51
|
+
const { entities: recommendations, loading, error } = state.recommendation;
|
|
52
|
+
return { recommendations, loading, error };
|
|
53
|
+
};
|
|
54
|
+
export const recommendationReducer = recommendationSlice.reducer;
|
|
@@ -80,6 +80,7 @@ export declare const selectSelectedTagNames: ((state: import("redux").EmptyObjec
|
|
|
80
80
|
pushNotifications: import("./pushNotifications").PushNotificationsState;
|
|
81
81
|
qr: import("./qr").QrState;
|
|
82
82
|
quote: import("./quote").QuoteState;
|
|
83
|
+
recommendation: import("./recommendation").RecommendationState;
|
|
83
84
|
resetPassword: import("./resetPassword").ResetPasswordState;
|
|
84
85
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
85
86
|
rewardCode: import("./rewardCode").RewardCodeState;
|
package/dist/esm/slices/types.js
CHANGED
|
@@ -45,6 +45,7 @@ export var ReducerType;
|
|
|
45
45
|
ReducerType["Qr"] = "qr";
|
|
46
46
|
ReducerType["QRCode"] = "qrcode";
|
|
47
47
|
ReducerType["Quote"] = "quote";
|
|
48
|
+
ReducerType["Recommendation"] = "recommendation";
|
|
48
49
|
ReducerType["ResetPassword"] = "resetPassword";
|
|
49
50
|
ReducerType["RevenueCenters"] = "revenueCenters";
|
|
50
51
|
ReducerType["Rewards"] = "rewards";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/cloud",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.41",
|
|
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",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"private": false,
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@babel/core": "^7.19.1",
|
|
37
|
-
"@open-tender/types": "^0.4.
|
|
38
|
-
"@open-tender/utils": "^0.5.
|
|
37
|
+
"@open-tender/types": "^0.4.178",
|
|
38
|
+
"@open-tender/utils": "^0.5.70",
|
|
39
39
|
"@reduxjs/toolkit": "^1.8.5",
|
|
40
40
|
"@types/react": "^18.0.18",
|
|
41
41
|
"@types/react-dom": "^18.0.6",
|