@open-tender/cloud 0.0.1
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/LICENSE.md +21 -0
- package/README.md +3 -0
- package/dist/cjs/app/hooks.d.ts +50 -0
- package/dist/cjs/app/hooks.js +8 -0
- package/dist/cjs/app/index.d.ts +1 -0
- package/dist/cjs/app/index.js +4 -0
- package/dist/cjs/app/store.d.ts +146 -0
- package/dist/cjs/app/store.js +51 -0
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.js +7 -0
- package/dist/cjs/services/api.d.ts +162 -0
- package/dist/cjs/services/api.js +691 -0
- package/dist/cjs/services/errors.d.ts +50 -0
- package/dist/cjs/services/errors.js +53 -0
- package/dist/cjs/services/index.d.ts +2 -0
- package/dist/cjs/services/index.js +6 -0
- package/dist/cjs/slices/alerts.d.ts +5 -0
- package/dist/cjs/slices/alerts.js +28 -0
- package/dist/cjs/slices/allergens.d.ts +19 -0
- package/dist/cjs/slices/allergens.js +66 -0
- package/dist/cjs/slices/announcements.d.ts +28 -0
- package/dist/cjs/slices/announcements.js +77 -0
- package/dist/cjs/slices/checkout.d.ts +38 -0
- package/dist/cjs/slices/checkout.js +276 -0
- package/dist/cjs/slices/completedOrders.d.ts +25 -0
- package/dist/cjs/slices/completedOrders.js +61 -0
- package/dist/cjs/slices/config.d.ts +87 -0
- package/dist/cjs/slices/config.js +121 -0
- package/dist/cjs/slices/confirmation.d.ts +8 -0
- package/dist/cjs/slices/confirmation.js +22 -0
- package/dist/cjs/slices/customer/account.d.ts +59 -0
- package/dist/cjs/slices/customer/account.js +288 -0
- package/dist/cjs/slices/customer/addresses.d.ts +37 -0
- package/dist/cjs/slices/customer/addresses.js +134 -0
- package/dist/cjs/slices/customer/allergens.d.ts +25 -0
- package/dist/cjs/slices/customer/allergens.js +94 -0
- package/dist/cjs/slices/customer/communicationPreferences.d.ts +44 -0
- package/dist/cjs/slices/customer/communicationPreferences.js +165 -0
- package/dist/cjs/slices/customer/creditCards.d.ts +46 -0
- package/dist/cjs/slices/customer/creditCards.js +172 -0
- package/dist/cjs/slices/customer/favorites.d.ts +45 -0
- package/dist/cjs/slices/customer/favorites.js +176 -0
- package/dist/cjs/slices/customer/fcmToken.d.ts +31 -0
- package/dist/cjs/slices/customer/fcmToken.js +110 -0
- package/dist/cjs/slices/customer/giftCards.d.ts +62 -0
- package/dist/cjs/slices/customer/giftCards.js +196 -0
- package/dist/cjs/slices/customer/groupOrders.d.ts +33 -0
- package/dist/cjs/slices/customer/groupOrders.js +148 -0
- package/dist/cjs/slices/customer/houseAccounts.d.ts +20 -0
- package/dist/cjs/slices/customer/houseAccounts.js +67 -0
- package/dist/cjs/slices/customer/index.d.ts +29 -0
- package/dist/cjs/slices/customer/index.js +52 -0
- package/dist/cjs/slices/customer/levelup.d.ts +36 -0
- package/dist/cjs/slices/customer/levelup.js +128 -0
- package/dist/cjs/slices/customer/loyalty.d.ts +27 -0
- package/dist/cjs/slices/customer/loyalty.js +87 -0
- package/dist/cjs/slices/customer/order.d.ts +25 -0
- package/dist/cjs/slices/customer/order.js +84 -0
- package/dist/cjs/slices/customer/orders.d.ts +20 -0
- package/dist/cjs/slices/customer/orders.js +67 -0
- package/dist/cjs/slices/customer/qrCode.d.ts +17 -0
- package/dist/cjs/slices/customer/qrCode.js +57 -0
- package/dist/cjs/slices/customer/rewards.d.ts +20 -0
- package/dist/cjs/slices/customer/rewards.js +67 -0
- package/dist/cjs/slices/customer/thanx.d.ts +17 -0
- package/dist/cjs/slices/customer/thanx.js +57 -0
- package/dist/cjs/slices/deals.d.ts +19 -0
- package/dist/cjs/slices/deals.js +97 -0
- package/dist/cjs/slices/donations.d.ts +26 -0
- package/dist/cjs/slices/donations.js +62 -0
- package/dist/cjs/slices/giftCards.d.ts +26 -0
- package/dist/cjs/slices/giftCards.js +63 -0
- package/dist/cjs/slices/groupOrder.d.ts +80 -0
- package/dist/cjs/slices/groupOrder.js +226 -0
- package/dist/cjs/slices/guest.d.ts +38 -0
- package/dist/cjs/slices/guest.js +101 -0
- package/dist/cjs/slices/index.d.ts +27 -0
- package/dist/cjs/slices/index.js +30 -0
- package/dist/cjs/slices/levelup.d.ts +18 -0
- package/dist/cjs/slices/levelup.js +51 -0
- package/dist/cjs/slices/menu.d.ts +22 -0
- package/dist/cjs/slices/menu.js +86 -0
- package/dist/cjs/slices/menuDisplay.d.ts +26 -0
- package/dist/cjs/slices/menuDisplay.js +59 -0
- package/dist/cjs/slices/menuItems.d.ts +20 -0
- package/dist/cjs/slices/menuItems.js +57 -0
- package/dist/cjs/slices/notifications.d.ts +5 -0
- package/dist/cjs/slices/notifications.js +27 -0
- package/dist/cjs/slices/order.d.ts +77 -0
- package/dist/cjs/slices/order.js +426 -0
- package/dist/cjs/slices/orderFulfillment.d.ts +29 -0
- package/dist/cjs/slices/orderFulfillment.js +83 -0
- package/dist/cjs/slices/orderRating.d.ts +34 -0
- package/dist/cjs/slices/orderRating.js +108 -0
- package/dist/cjs/slices/orders.d.ts +86 -0
- package/dist/cjs/slices/orders.js +311 -0
- package/dist/cjs/slices/resetPassword.d.ts +29 -0
- package/dist/cjs/slices/resetPassword.js +83 -0
- package/dist/cjs/slices/revenueCenters.d.ts +35 -0
- package/dist/cjs/slices/revenueCenters.js +95 -0
- package/dist/cjs/slices/signUp.d.ts +19 -0
- package/dist/cjs/slices/signUp.js +52 -0
- package/dist/cjs/slices/types.d.ts +43 -0
- package/dist/cjs/slices/types.js +47 -0
- package/dist/cjs/slices/validTimes.d.ts +17 -0
- package/dist/cjs/slices/validTimes.js +57 -0
- package/dist/cjs/slices/verifyAccount.d.ts +17 -0
- package/dist/cjs/slices/verifyAccount.js +54 -0
- package/dist/esm/app/hooks.d.ts +50 -0
- package/dist/esm/app/hooks.js +4 -0
- package/dist/esm/app/index.d.ts +1 -0
- package/dist/esm/app/index.js +1 -0
- package/dist/esm/app/store.d.ts +146 -0
- package/dist/esm/app/store.js +48 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/services/api.d.ts +162 -0
- package/dist/esm/services/api.js +689 -0
- package/dist/esm/services/errors.d.ts +50 -0
- package/dist/esm/services/errors.js +50 -0
- package/dist/esm/services/index.d.ts +2 -0
- package/dist/esm/services/index.js +2 -0
- package/dist/esm/slices/alerts.d.ts +5 -0
- package/dist/esm/slices/alerts.js +23 -0
- package/dist/esm/slices/allergens.d.ts +19 -0
- package/dist/esm/slices/allergens.js +60 -0
- package/dist/esm/slices/announcements.d.ts +28 -0
- package/dist/esm/slices/announcements.js +71 -0
- package/dist/esm/slices/checkout.d.ts +38 -0
- package/dist/esm/slices/checkout.js +268 -0
- package/dist/esm/slices/completedOrders.d.ts +25 -0
- package/dist/esm/slices/completedOrders.js +57 -0
- package/dist/esm/slices/config.d.ts +87 -0
- package/dist/esm/slices/config.js +102 -0
- package/dist/esm/slices/confirmation.d.ts +8 -0
- package/dist/esm/slices/confirmation.js +18 -0
- package/dist/esm/slices/customer/account.d.ts +59 -0
- package/dist/esm/slices/customer/account.js +282 -0
- package/dist/esm/slices/customer/addresses.d.ts +37 -0
- package/dist/esm/slices/customer/addresses.js +129 -0
- package/dist/esm/slices/customer/allergens.d.ts +25 -0
- package/dist/esm/slices/customer/allergens.js +89 -0
- package/dist/esm/slices/customer/communicationPreferences.d.ts +44 -0
- package/dist/esm/slices/customer/communicationPreferences.js +161 -0
- package/dist/esm/slices/customer/creditCards.d.ts +46 -0
- package/dist/esm/slices/customer/creditCards.js +166 -0
- package/dist/esm/slices/customer/favorites.d.ts +45 -0
- package/dist/esm/slices/customer/favorites.js +171 -0
- package/dist/esm/slices/customer/fcmToken.d.ts +31 -0
- package/dist/esm/slices/customer/fcmToken.js +106 -0
- package/dist/esm/slices/customer/giftCards.d.ts +62 -0
- package/dist/esm/slices/customer/giftCards.js +191 -0
- package/dist/esm/slices/customer/groupOrders.d.ts +33 -0
- package/dist/esm/slices/customer/groupOrders.js +143 -0
- package/dist/esm/slices/customer/houseAccounts.d.ts +20 -0
- package/dist/esm/slices/customer/houseAccounts.js +62 -0
- package/dist/esm/slices/customer/index.d.ts +29 -0
- package/dist/esm/slices/customer/index.js +48 -0
- package/dist/esm/slices/customer/levelup.d.ts +36 -0
- package/dist/esm/slices/customer/levelup.js +123 -0
- package/dist/esm/slices/customer/loyalty.d.ts +27 -0
- package/dist/esm/slices/customer/loyalty.js +79 -0
- package/dist/esm/slices/customer/order.d.ts +25 -0
- package/dist/esm/slices/customer/order.js +79 -0
- package/dist/esm/slices/customer/orders.d.ts +20 -0
- package/dist/esm/slices/customer/orders.js +62 -0
- package/dist/esm/slices/customer/qrCode.d.ts +17 -0
- package/dist/esm/slices/customer/qrCode.js +53 -0
- package/dist/esm/slices/customer/rewards.d.ts +20 -0
- package/dist/esm/slices/customer/rewards.js +62 -0
- package/dist/esm/slices/customer/thanx.d.ts +17 -0
- package/dist/esm/slices/customer/thanx.js +53 -0
- package/dist/esm/slices/deals.d.ts +19 -0
- package/dist/esm/slices/deals.js +91 -0
- package/dist/esm/slices/donations.d.ts +26 -0
- package/dist/esm/slices/donations.js +58 -0
- package/dist/esm/slices/giftCards.d.ts +26 -0
- package/dist/esm/slices/giftCards.js +59 -0
- package/dist/esm/slices/groupOrder.d.ts +80 -0
- package/dist/esm/slices/groupOrder.js +216 -0
- package/dist/esm/slices/guest.d.ts +38 -0
- package/dist/esm/slices/guest.js +97 -0
- package/dist/esm/slices/index.d.ts +27 -0
- package/dist/esm/slices/index.js +27 -0
- package/dist/esm/slices/levelup.d.ts +18 -0
- package/dist/esm/slices/levelup.js +48 -0
- package/dist/esm/slices/menu.d.ts +22 -0
- package/dist/esm/slices/menu.js +81 -0
- package/dist/esm/slices/menuDisplay.d.ts +26 -0
- package/dist/esm/slices/menuDisplay.js +55 -0
- package/dist/esm/slices/menuItems.d.ts +20 -0
- package/dist/esm/slices/menuItems.js +52 -0
- package/dist/esm/slices/notifications.d.ts +5 -0
- package/dist/esm/slices/notifications.js +22 -0
- package/dist/esm/slices/order.d.ts +77 -0
- package/dist/esm/slices/order.js +423 -0
- package/dist/esm/slices/orderFulfillment.d.ts +29 -0
- package/dist/esm/slices/orderFulfillment.js +79 -0
- package/dist/esm/slices/orderRating.d.ts +34 -0
- package/dist/esm/slices/orderRating.js +104 -0
- package/dist/esm/slices/orders.d.ts +86 -0
- package/dist/esm/slices/orders.js +302 -0
- package/dist/esm/slices/resetPassword.d.ts +29 -0
- package/dist/esm/slices/resetPassword.js +79 -0
- package/dist/esm/slices/revenueCenters.d.ts +35 -0
- package/dist/esm/slices/revenueCenters.js +89 -0
- package/dist/esm/slices/signUp.d.ts +19 -0
- package/dist/esm/slices/signUp.js +48 -0
- package/dist/esm/slices/types.d.ts +43 -0
- package/dist/esm/slices/types.js +44 -0
- package/dist/esm/slices/validTimes.d.ts +17 -0
- package/dist/esm/slices/validTimes.js +52 -0
- package/dist/esm/slices/verifyAccount.d.ts +17 -0
- package/dist/esm/slices/verifyAccount.js +50 -0
- package/package.json +61 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.customerGiftCardsReducer = exports.selectCustomerGiftCards = exports.setCustomerGiftCards = exports.resetCustomerGiftCardsError = exports.resetCustomerGiftCards = exports.assignCustomerGiftCardOther = exports.assignCustomerGiftCard = exports.addCustomerGiftCard = exports.removeCustomerGiftCard = exports.updateCustomerGiftCard = exports.fetchCustomerGiftCards = exports.CustomerGiftCardsActionType = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
7
|
+
const types_1 = require("../types");
|
|
8
|
+
const types_2 = require("@open-tender/types");
|
|
9
|
+
const account_1 = require("./account");
|
|
10
|
+
const notifications_1 = require("../notifications");
|
|
11
|
+
const initialState = {
|
|
12
|
+
entities: [],
|
|
13
|
+
error: null,
|
|
14
|
+
loading: 'idle',
|
|
15
|
+
lookup: {}
|
|
16
|
+
};
|
|
17
|
+
var CustomerGiftCardsActionType;
|
|
18
|
+
(function (CustomerGiftCardsActionType) {
|
|
19
|
+
CustomerGiftCardsActionType["FetchCustomerGiftCards"] = "customer/fetchCustomerGiftCards";
|
|
20
|
+
CustomerGiftCardsActionType["RemoveCustomerGiftCard"] = "customer/removeCustomerGiftCard";
|
|
21
|
+
CustomerGiftCardsActionType["AddCustomerGiftCard"] = "customer/addCustomerGiftCard";
|
|
22
|
+
CustomerGiftCardsActionType["AssignCustomerGiftCard"] = "customer/assignCustomerGiftCard";
|
|
23
|
+
CustomerGiftCardsActionType["AssignCustomerGiftCardOther"] = "customer/assignCustomerGiftCardOther";
|
|
24
|
+
CustomerGiftCardsActionType["UpdateCustomerGiftCard"] = "customer/updateCustomerGiftCard";
|
|
25
|
+
})(CustomerGiftCardsActionType = exports.CustomerGiftCardsActionType || (exports.CustomerGiftCardsActionType = {}));
|
|
26
|
+
exports.fetchCustomerGiftCards = (0, toolkit_1.createAsyncThunk)(CustomerGiftCardsActionType.FetchCustomerGiftCards, (_, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
+
try {
|
|
28
|
+
const api = getState().config.api;
|
|
29
|
+
const token = (0, account_1.selectToken)(getState());
|
|
30
|
+
if (!token)
|
|
31
|
+
throw new Error(types_2.MISSING_CUSTOMER);
|
|
32
|
+
return yield api.getCustomerGiftCards(token);
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
const error = err;
|
|
36
|
+
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(error));
|
|
37
|
+
}
|
|
38
|
+
}));
|
|
39
|
+
exports.updateCustomerGiftCard = (0, toolkit_1.createAsyncThunk)(CustomerGiftCardsActionType.UpdateCustomerGiftCard, (requestData, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
+
try {
|
|
41
|
+
const api = getState().config.api;
|
|
42
|
+
const token = (0, account_1.selectToken)(getState());
|
|
43
|
+
if (!token)
|
|
44
|
+
throw new Error(types_2.MISSING_CUSTOMER);
|
|
45
|
+
yield api.putCustomerGiftCard(token, requestData.giftCardId, requestData.data);
|
|
46
|
+
const giftCards = yield api.getCustomerGiftCards(token);
|
|
47
|
+
dispatch((0, notifications_1.showNotification)('Gift card balance updated!'));
|
|
48
|
+
if (requestData.callback)
|
|
49
|
+
requestData.callback();
|
|
50
|
+
return giftCards;
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
const error = err;
|
|
54
|
+
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(error));
|
|
55
|
+
}
|
|
56
|
+
}));
|
|
57
|
+
exports.removeCustomerGiftCard = (0, toolkit_1.createAsyncThunk)(CustomerGiftCardsActionType.RemoveCustomerGiftCard, (requestData, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
58
|
+
try {
|
|
59
|
+
const api = getState().config.api;
|
|
60
|
+
const token = (0, account_1.selectToken)(getState());
|
|
61
|
+
if (!token)
|
|
62
|
+
throw new Error(types_2.MISSING_CUSTOMER);
|
|
63
|
+
yield api.deleteCustomerGiftCard(token, requestData.giftCardId);
|
|
64
|
+
const giftCards = yield api.getCustomerGiftCards(token);
|
|
65
|
+
dispatch((0, notifications_1.showNotification)('Gift card removed!'));
|
|
66
|
+
if (requestData.callback)
|
|
67
|
+
requestData.callback();
|
|
68
|
+
return giftCards;
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
const error = err;
|
|
72
|
+
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(error));
|
|
73
|
+
}
|
|
74
|
+
}));
|
|
75
|
+
exports.addCustomerGiftCard = (0, toolkit_1.createAsyncThunk)(CustomerGiftCardsActionType.AddCustomerGiftCard, (requestData, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
76
|
+
try {
|
|
77
|
+
const api = getState().config.api;
|
|
78
|
+
const token = (0, account_1.selectToken)(getState());
|
|
79
|
+
if (!token)
|
|
80
|
+
throw new Error(types_2.MISSING_CUSTOMER);
|
|
81
|
+
yield api.postCustomerGiftCard(token, requestData.data);
|
|
82
|
+
const giftCards = yield api.getCustomerGiftCards(token);
|
|
83
|
+
dispatch((0, notifications_1.showNotification)('Gift card added!'));
|
|
84
|
+
if (requestData.callback)
|
|
85
|
+
requestData.callback();
|
|
86
|
+
return giftCards;
|
|
87
|
+
}
|
|
88
|
+
catch (err) {
|
|
89
|
+
const error = err;
|
|
90
|
+
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(error));
|
|
91
|
+
}
|
|
92
|
+
}));
|
|
93
|
+
exports.assignCustomerGiftCard = (0, toolkit_1.createAsyncThunk)(CustomerGiftCardsActionType.AssignCustomerGiftCard, (requestData, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
94
|
+
try {
|
|
95
|
+
const api = getState().config.api;
|
|
96
|
+
const token = (0, account_1.selectToken)(getState());
|
|
97
|
+
if (!token)
|
|
98
|
+
throw new Error(types_2.MISSING_CUSTOMER);
|
|
99
|
+
yield api.postCustomerGiftCardAssign(token, requestData.cardNumber);
|
|
100
|
+
const giftCards = yield api.getCustomerGiftCards(token);
|
|
101
|
+
dispatch((0, notifications_1.showNotification)('Gift card added to your account!'));
|
|
102
|
+
if (requestData.callback)
|
|
103
|
+
requestData.callback();
|
|
104
|
+
return giftCards;
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
const error = err;
|
|
108
|
+
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(error));
|
|
109
|
+
}
|
|
110
|
+
}));
|
|
111
|
+
exports.assignCustomerGiftCardOther = (0, toolkit_1.createAsyncThunk)(CustomerGiftCardsActionType.AssignCustomerGiftCardOther, (requestData, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
112
|
+
try {
|
|
113
|
+
const api = getState().config.api;
|
|
114
|
+
const token = (0, account_1.selectToken)(getState());
|
|
115
|
+
if (!token)
|
|
116
|
+
throw new Error(types_2.MISSING_CUSTOMER);
|
|
117
|
+
yield api.postCustomerGiftCardAssignOther(token, requestData.giftCardId, requestData.email);
|
|
118
|
+
const giftCards = yield api.getCustomerGiftCards(token);
|
|
119
|
+
dispatch((0, notifications_1.showNotification)(`Gift card assigned to ${requestData.email}`));
|
|
120
|
+
if (requestData.callback)
|
|
121
|
+
requestData.callback();
|
|
122
|
+
return giftCards;
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
const error = err;
|
|
126
|
+
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(error));
|
|
127
|
+
}
|
|
128
|
+
}));
|
|
129
|
+
const customerGiftCardsSlice = (0, toolkit_1.createSlice)({
|
|
130
|
+
name: types_1.ReducerType.GiftCards,
|
|
131
|
+
initialState,
|
|
132
|
+
reducers: {
|
|
133
|
+
resetCustomerGiftCards: () => initialState,
|
|
134
|
+
resetCustomerGiftCardsError: state => {
|
|
135
|
+
state.error = null;
|
|
136
|
+
state.loading = 'idle';
|
|
137
|
+
},
|
|
138
|
+
setCustomerGiftCards: (state, action) => {
|
|
139
|
+
state.entities = action.payload;
|
|
140
|
+
state.error = null;
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
extraReducers: builder => {
|
|
144
|
+
builder
|
|
145
|
+
.addCase(exports.fetchCustomerGiftCards.fulfilled, (state, action) => {
|
|
146
|
+
state.entities = action.payload;
|
|
147
|
+
state.loading = 'idle';
|
|
148
|
+
state.error = null;
|
|
149
|
+
})
|
|
150
|
+
.addCase(exports.fetchCustomerGiftCards.pending, state => {
|
|
151
|
+
state.loading = 'pending';
|
|
152
|
+
})
|
|
153
|
+
.addCase(exports.fetchCustomerGiftCards.rejected, (state, action) => {
|
|
154
|
+
state.error = action.payload;
|
|
155
|
+
state.loading = 'idle';
|
|
156
|
+
})
|
|
157
|
+
.addCase(exports.removeCustomerGiftCard.fulfilled, state => {
|
|
158
|
+
state.loading = 'idle';
|
|
159
|
+
state.error = null;
|
|
160
|
+
})
|
|
161
|
+
.addCase(exports.removeCustomerGiftCard.pending, state => {
|
|
162
|
+
state.loading = 'pending';
|
|
163
|
+
})
|
|
164
|
+
.addCase(exports.removeCustomerGiftCard.rejected, (state, action) => {
|
|
165
|
+
state.error = action.payload;
|
|
166
|
+
state.loading = 'idle';
|
|
167
|
+
})
|
|
168
|
+
.addCase(exports.addCustomerGiftCard.fulfilled, state => {
|
|
169
|
+
state.loading = 'idle';
|
|
170
|
+
state.error = null;
|
|
171
|
+
})
|
|
172
|
+
.addCase(exports.addCustomerGiftCard.pending, state => {
|
|
173
|
+
state.loading = 'pending';
|
|
174
|
+
})
|
|
175
|
+
.addCase(exports.addCustomerGiftCard.rejected, (state, action) => {
|
|
176
|
+
state.error = action.payload;
|
|
177
|
+
state.loading = 'idle';
|
|
178
|
+
})
|
|
179
|
+
.addCase(exports.updateCustomerGiftCard.fulfilled, (state, action) => {
|
|
180
|
+
state.entities = action.payload;
|
|
181
|
+
state.loading = 'idle';
|
|
182
|
+
state.error = null;
|
|
183
|
+
})
|
|
184
|
+
.addCase(exports.updateCustomerGiftCard.pending, state => {
|
|
185
|
+
state.loading = 'pending';
|
|
186
|
+
})
|
|
187
|
+
.addCase(exports.updateCustomerGiftCard.rejected, (state, action) => {
|
|
188
|
+
state.error = action.payload;
|
|
189
|
+
state.loading = 'idle';
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
_a = customerGiftCardsSlice.actions, exports.resetCustomerGiftCards = _a.resetCustomerGiftCards, exports.resetCustomerGiftCardsError = _a.resetCustomerGiftCardsError, exports.setCustomerGiftCards = _a.setCustomerGiftCards;
|
|
194
|
+
const selectCustomerGiftCards = (state) => state.customer.giftCards;
|
|
195
|
+
exports.selectCustomerGiftCards = selectCustomerGiftCards;
|
|
196
|
+
exports.customerGiftCardsReducer = customerGiftCardsSlice.reducer;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AppState } from '../../app';
|
|
2
|
+
import { GroupOrder, GroupOrders, RequestError, RequestStatus } from '@open-tender/types';
|
|
3
|
+
export interface CustomerGroupOrdersState {
|
|
4
|
+
entities: GroupOrders;
|
|
5
|
+
error: RequestError;
|
|
6
|
+
loading: RequestStatus;
|
|
7
|
+
lookup: {
|
|
8
|
+
[key: number]: number;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare enum CustomerGroupOrdersActionType {
|
|
12
|
+
FetchCustomerGroupOrders = "customer/fetchCustomerGroupOrders",
|
|
13
|
+
FetchCustomerGroupOrder = "customer/fetchCustomerGroupOrder",
|
|
14
|
+
AddCustomerGroupOrder = "customer/addCustomerGroupOrder"
|
|
15
|
+
}
|
|
16
|
+
export declare const fetchCustomerGroupOrders: import("@reduxjs/toolkit").AsyncThunk<GroupOrders, void, {
|
|
17
|
+
state: AppState;
|
|
18
|
+
rejectValue: RequestError;
|
|
19
|
+
}>;
|
|
20
|
+
export declare const fetchCustomerGroupOrder: import("@reduxjs/toolkit").AsyncThunk<GroupOrders, number, {
|
|
21
|
+
state: AppState;
|
|
22
|
+
rejectValue: RequestError;
|
|
23
|
+
}>;
|
|
24
|
+
export declare const addCustomerGroupOrder: import("@reduxjs/toolkit").AsyncThunk<GroupOrders, {
|
|
25
|
+
data: Partial<GroupOrder>;
|
|
26
|
+
callback?: (() => void) | undefined;
|
|
27
|
+
}, {
|
|
28
|
+
state: AppState;
|
|
29
|
+
rejectValue: RequestError;
|
|
30
|
+
}>;
|
|
31
|
+
export declare const resetCustomerGroupOrders: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetCustomerGroupOrdersError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setCustomerGroupOrders: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>;
|
|
32
|
+
export declare const selectCustomerGroupOrders: (state: AppState) => CustomerGroupOrdersState;
|
|
33
|
+
export declare const customerGroupOrdersReducer: import("redux").Reducer<CustomerGroupOrdersState, import("redux").AnyAction>;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.customerGroupOrdersReducer = exports.selectCustomerGroupOrders = exports.setCustomerGroupOrders = exports.resetCustomerGroupOrdersError = exports.resetCustomerGroupOrders = exports.addCustomerGroupOrder = exports.fetchCustomerGroupOrder = exports.fetchCustomerGroupOrders = exports.CustomerGroupOrdersActionType = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
7
|
+
const types_1 = require("../types");
|
|
8
|
+
const types_2 = require("@open-tender/types");
|
|
9
|
+
const account_1 = require("./account");
|
|
10
|
+
const groupOrder_1 = require("../groupOrder");
|
|
11
|
+
const utils_1 = require("@open-tender/utils");
|
|
12
|
+
const initialState = {
|
|
13
|
+
entities: [],
|
|
14
|
+
lookup: {},
|
|
15
|
+
loading: 'idle',
|
|
16
|
+
error: null
|
|
17
|
+
};
|
|
18
|
+
var CustomerGroupOrdersActionType;
|
|
19
|
+
(function (CustomerGroupOrdersActionType) {
|
|
20
|
+
CustomerGroupOrdersActionType["FetchCustomerGroupOrders"] = "customer/fetchCustomerGroupOrders";
|
|
21
|
+
CustomerGroupOrdersActionType["FetchCustomerGroupOrder"] = "customer/fetchCustomerGroupOrder";
|
|
22
|
+
CustomerGroupOrdersActionType["AddCustomerGroupOrder"] = "customer/addCustomerGroupOrder";
|
|
23
|
+
})(CustomerGroupOrdersActionType = exports.CustomerGroupOrdersActionType || (exports.CustomerGroupOrdersActionType = {}));
|
|
24
|
+
exports.fetchCustomerGroupOrders = (0, toolkit_1.createAsyncThunk)(CustomerGroupOrdersActionType.FetchCustomerGroupOrders, (_, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
+
try {
|
|
26
|
+
const api = getState().config.api;
|
|
27
|
+
const token = (0, account_1.selectToken)(getState());
|
|
28
|
+
if (!token)
|
|
29
|
+
throw new Error(types_2.MISSING_CUSTOMER);
|
|
30
|
+
const orders = yield api.getCustomerGroupOrders(token);
|
|
31
|
+
return orders;
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
const error = err;
|
|
35
|
+
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(error));
|
|
36
|
+
}
|
|
37
|
+
}));
|
|
38
|
+
exports.fetchCustomerGroupOrder = (0, toolkit_1.createAsyncThunk)(CustomerGroupOrdersActionType.FetchCustomerGroupOrder, (cartId, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
39
|
+
try {
|
|
40
|
+
const api = getState().config.api;
|
|
41
|
+
const token = (0, account_1.selectToken)(getState());
|
|
42
|
+
if (!token)
|
|
43
|
+
throw new Error(types_2.MISSING_CUSTOMER);
|
|
44
|
+
const response = yield api.getCustomerGroupOrder(token, cartId);
|
|
45
|
+
const payload = Object.assign(Object.assign({}, (0, groupOrder_1.makeCartPayload)(response)), { isCartOwner: true });
|
|
46
|
+
return payload;
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
const error = err;
|
|
50
|
+
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(error));
|
|
51
|
+
}
|
|
52
|
+
}));
|
|
53
|
+
const makeCartData = (order, data = {}) => {
|
|
54
|
+
const { address, revenueCenter, requestedAt, serviceType, cart } = order;
|
|
55
|
+
const orderData = {
|
|
56
|
+
address,
|
|
57
|
+
revenue_center_id: revenueCenter === null || revenueCenter === void 0 ? void 0 : revenueCenter.revenue_center_id,
|
|
58
|
+
service_type: serviceType,
|
|
59
|
+
requested_at: requestedAt,
|
|
60
|
+
cart: (0, utils_1.makeSimpleCart)(cart !== null && cart !== void 0 ? cart : []),
|
|
61
|
+
spending_limit: null
|
|
62
|
+
};
|
|
63
|
+
const { spendingLimit } = data;
|
|
64
|
+
if (spendingLimit !== undefined) {
|
|
65
|
+
delete data.spendingLimit;
|
|
66
|
+
orderData.spending_limit = isNaN(parseFloat(spendingLimit))
|
|
67
|
+
? null
|
|
68
|
+
: parseFloat(spendingLimit).toFixed(2);
|
|
69
|
+
}
|
|
70
|
+
return Object.assign(Object.assign({}, orderData), data);
|
|
71
|
+
};
|
|
72
|
+
exports.addCustomerGroupOrder = (0, toolkit_1.createAsyncThunk)(CustomerGroupOrdersActionType.AddCustomerGroupOrder, (requestData, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
73
|
+
try {
|
|
74
|
+
const api = getState().config.api;
|
|
75
|
+
const token = (0, account_1.selectToken)(getState());
|
|
76
|
+
if (!token)
|
|
77
|
+
throw new Error(types_2.MISSING_CUSTOMER);
|
|
78
|
+
const cartData = makeCartData(getState().order, requestData.data);
|
|
79
|
+
const response = yield api.postCustomerGroupOrder(token, cartData);
|
|
80
|
+
const customer = getState().customer.account.profile;
|
|
81
|
+
const payload = Object.assign(Object.assign({}, (0, groupOrder_1.makeCartPayload)(response)), { isCartOwner: true, cartOwner: customer });
|
|
82
|
+
if (requestData.callback)
|
|
83
|
+
requestData.callback();
|
|
84
|
+
return payload;
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
const error = err;
|
|
88
|
+
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(error));
|
|
89
|
+
}
|
|
90
|
+
}));
|
|
91
|
+
const customerGroupOrdersSlice = (0, toolkit_1.createSlice)({
|
|
92
|
+
name: types_1.ReducerType.GroupOrders,
|
|
93
|
+
initialState,
|
|
94
|
+
reducers: {
|
|
95
|
+
resetCustomerGroupOrders: () => initialState,
|
|
96
|
+
resetCustomerGroupOrdersError: state => {
|
|
97
|
+
state.error = null;
|
|
98
|
+
state.loading = 'idle';
|
|
99
|
+
},
|
|
100
|
+
setCustomerGroupOrders: (state, action) => {
|
|
101
|
+
state.entities = action.payload;
|
|
102
|
+
state.error = null;
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
extraReducers: builder => {
|
|
106
|
+
builder
|
|
107
|
+
.addCase(exports.fetchCustomerGroupOrders.fulfilled, (state, action) => {
|
|
108
|
+
state.entities = action.payload;
|
|
109
|
+
state.loading = 'idle';
|
|
110
|
+
state.error = null;
|
|
111
|
+
})
|
|
112
|
+
.addCase(exports.fetchCustomerGroupOrders.pending, state => {
|
|
113
|
+
state.loading = 'pending';
|
|
114
|
+
})
|
|
115
|
+
.addCase(exports.fetchCustomerGroupOrders.rejected, (state, action) => {
|
|
116
|
+
state.error = action.payload;
|
|
117
|
+
state.loading = 'idle';
|
|
118
|
+
})
|
|
119
|
+
.addCase(exports.fetchCustomerGroupOrder.fulfilled, (state, action) => {
|
|
120
|
+
state.entities = action.payload;
|
|
121
|
+
state.loading = 'idle';
|
|
122
|
+
state.error = null;
|
|
123
|
+
})
|
|
124
|
+
.addCase(exports.fetchCustomerGroupOrder.pending, state => {
|
|
125
|
+
state.loading = 'pending';
|
|
126
|
+
})
|
|
127
|
+
.addCase(exports.fetchCustomerGroupOrder.rejected, (state, action) => {
|
|
128
|
+
state.error = action.payload;
|
|
129
|
+
state.loading = 'idle';
|
|
130
|
+
})
|
|
131
|
+
.addCase(exports.addCustomerGroupOrder.fulfilled, (state, action) => {
|
|
132
|
+
state.entities = action.payload;
|
|
133
|
+
state.loading = 'idle';
|
|
134
|
+
state.error = null;
|
|
135
|
+
})
|
|
136
|
+
.addCase(exports.addCustomerGroupOrder.pending, state => {
|
|
137
|
+
state.loading = 'pending';
|
|
138
|
+
})
|
|
139
|
+
.addCase(exports.addCustomerGroupOrder.rejected, (state, action) => {
|
|
140
|
+
state.error = action.payload;
|
|
141
|
+
state.loading = 'idle';
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
_a = customerGroupOrdersSlice.actions, exports.resetCustomerGroupOrders = _a.resetCustomerGroupOrders, exports.resetCustomerGroupOrdersError = _a.resetCustomerGroupOrdersError, exports.setCustomerGroupOrders = _a.setCustomerGroupOrders;
|
|
146
|
+
const selectCustomerGroupOrders = (state) => state.customer.groupOrders;
|
|
147
|
+
exports.selectCustomerGroupOrders = selectCustomerGroupOrders;
|
|
148
|
+
exports.customerGroupOrdersReducer = customerGroupOrdersSlice.reducer;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AppState } from '../../app';
|
|
2
|
+
import { HouseAccounts, RequestError, RequestStatus } from '@open-tender/types';
|
|
3
|
+
export interface CustomerHouseAccountsState {
|
|
4
|
+
entities: HouseAccounts;
|
|
5
|
+
error: RequestError;
|
|
6
|
+
loading: RequestStatus;
|
|
7
|
+
lookup: {
|
|
8
|
+
[key: number]: number;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare enum CustomerHouseAccountsActionType {
|
|
12
|
+
FetchCustomerHouseAccounts = "customer/fetchCustomerHouseAccounts"
|
|
13
|
+
}
|
|
14
|
+
export declare const fetchCustomerHouseAccounts: import("@reduxjs/toolkit").AsyncThunk<HouseAccounts, void, {
|
|
15
|
+
state: AppState;
|
|
16
|
+
rejectValue: RequestError;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const resetCustomerHouseAccounts: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetCustomerHouseAccountsError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setCustomerHouseAccounts: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>;
|
|
19
|
+
export declare const selectCustomerHouseAccounts: (state: AppState) => import("./orders").CustomerOrdersState;
|
|
20
|
+
export declare const customerHouseAccountsReducer: import("redux").Reducer<CustomerHouseAccountsState, import("redux").AnyAction>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.customerHouseAccountsReducer = exports.selectCustomerHouseAccounts = exports.setCustomerHouseAccounts = exports.resetCustomerHouseAccountsError = exports.resetCustomerHouseAccounts = exports.fetchCustomerHouseAccounts = exports.CustomerHouseAccountsActionType = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
7
|
+
const types_1 = require("../types");
|
|
8
|
+
const types_2 = require("@open-tender/types");
|
|
9
|
+
const account_1 = require("./account");
|
|
10
|
+
const initialState = {
|
|
11
|
+
entities: [],
|
|
12
|
+
error: null,
|
|
13
|
+
loading: 'idle',
|
|
14
|
+
lookup: {}
|
|
15
|
+
};
|
|
16
|
+
var CustomerHouseAccountsActionType;
|
|
17
|
+
(function (CustomerHouseAccountsActionType) {
|
|
18
|
+
CustomerHouseAccountsActionType["FetchCustomerHouseAccounts"] = "customer/fetchCustomerHouseAccounts";
|
|
19
|
+
})(CustomerHouseAccountsActionType = exports.CustomerHouseAccountsActionType || (exports.CustomerHouseAccountsActionType = {}));
|
|
20
|
+
exports.fetchCustomerHouseAccounts = (0, toolkit_1.createAsyncThunk)(CustomerHouseAccountsActionType.FetchCustomerHouseAccounts, (_, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
+
try {
|
|
22
|
+
const api = getState().config.api;
|
|
23
|
+
const token = (0, account_1.selectToken)(getState());
|
|
24
|
+
if (!token)
|
|
25
|
+
throw new Error(types_2.MISSING_CUSTOMER);
|
|
26
|
+
const houseAccounts = yield api.getCustomerHouseAccounts(token);
|
|
27
|
+
return houseAccounts;
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
const error = err;
|
|
31
|
+
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(error));
|
|
32
|
+
}
|
|
33
|
+
}));
|
|
34
|
+
const customerHouseAccountsSlice = (0, toolkit_1.createSlice)({
|
|
35
|
+
name: types_1.ReducerType.HouseAccounts,
|
|
36
|
+
initialState,
|
|
37
|
+
reducers: {
|
|
38
|
+
resetCustomerHouseAccounts: () => initialState,
|
|
39
|
+
resetCustomerHouseAccountsError: state => {
|
|
40
|
+
state.error = null;
|
|
41
|
+
state.loading = 'idle';
|
|
42
|
+
},
|
|
43
|
+
setCustomerHouseAccounts: (state, action) => {
|
|
44
|
+
state.entities = action.payload;
|
|
45
|
+
state.error = null;
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
extraReducers: builder => {
|
|
49
|
+
builder
|
|
50
|
+
.addCase(exports.fetchCustomerHouseAccounts.fulfilled, (state, action) => {
|
|
51
|
+
state.entities = action.payload;
|
|
52
|
+
state.loading = 'idle';
|
|
53
|
+
state.error = null;
|
|
54
|
+
})
|
|
55
|
+
.addCase(exports.fetchCustomerHouseAccounts.pending, state => {
|
|
56
|
+
state.loading = 'pending';
|
|
57
|
+
})
|
|
58
|
+
.addCase(exports.fetchCustomerHouseAccounts.rejected, (state, action) => {
|
|
59
|
+
state.error = action.payload;
|
|
60
|
+
state.loading = 'idle';
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
_a = customerHouseAccountsSlice.actions, exports.resetCustomerHouseAccounts = _a.resetCustomerHouseAccounts, exports.resetCustomerHouseAccountsError = _a.resetCustomerHouseAccountsError, exports.setCustomerHouseAccounts = _a.setCustomerHouseAccounts;
|
|
65
|
+
const selectCustomerHouseAccounts = (state) => state.customer.orders;
|
|
66
|
+
exports.selectCustomerHouseAccounts = selectCustomerHouseAccounts;
|
|
67
|
+
exports.customerHouseAccountsReducer = customerHouseAccountsSlice.reducer;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const customerReducer: import("redux").Reducer<import("redux").CombinedState<{
|
|
2
|
+
account: import("./account").AccountState;
|
|
3
|
+
allergens: import("./allergens").CustomerAllergensState;
|
|
4
|
+
addresses: import("./addresses").CustomerAddressesState;
|
|
5
|
+
communicationPreferences: import("./communicationPreferences").CustomerCommunicationPrefsState;
|
|
6
|
+
creditCards: import("./creditCards").CustomerCreditCardsState;
|
|
7
|
+
favorites: import("./favorites").CustomerFavoritesState;
|
|
8
|
+
fcmToken: import("./fcmToken").CustomerFcmTokenState;
|
|
9
|
+
giftCards: import("./giftCards").CustomerGiftCardsState;
|
|
10
|
+
orders: import("./orders").CustomerOrdersState;
|
|
11
|
+
order: import("./order").CustomerOrderState;
|
|
12
|
+
loyalty: import("./loyalty").CustomerLoyaltyState;
|
|
13
|
+
groupOrders: import("./groupOrders").CustomerGroupOrdersState;
|
|
14
|
+
houseAccounts: import("./houseAccounts").CustomerHouseAccountsState;
|
|
15
|
+
rewards: import("./rewards").CustomerRewardsState;
|
|
16
|
+
qrcode: import("./qrCode").CustomerQRCodeState;
|
|
17
|
+
thanx: import("./thanx").CustomerThanxState;
|
|
18
|
+
levelup: import("./levelup").CustomerLevelUpState;
|
|
19
|
+
}>, import("redux").AnyAction>;
|
|
20
|
+
export * from './account';
|
|
21
|
+
export * from './allergens';
|
|
22
|
+
export * from './addresses';
|
|
23
|
+
export * from './communicationPreferences';
|
|
24
|
+
export * from './creditCards';
|
|
25
|
+
export * from './favorites';
|
|
26
|
+
export * from './fcmToken';
|
|
27
|
+
export * from './giftCards';
|
|
28
|
+
export * from './orders';
|
|
29
|
+
export * from './loyalty';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.customerReducer = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const redux_1 = require("redux");
|
|
6
|
+
const types_1 = require("../types");
|
|
7
|
+
const account_1 = require("./account");
|
|
8
|
+
const addresses_1 = require("./addresses");
|
|
9
|
+
const allergens_1 = require("./allergens");
|
|
10
|
+
const communicationPreferences_1 = require("./communicationPreferences");
|
|
11
|
+
const creditCards_1 = require("./creditCards");
|
|
12
|
+
const favorites_1 = require("./favorites");
|
|
13
|
+
const fcmToken_1 = require("./fcmToken");
|
|
14
|
+
const giftCards_1 = require("./giftCards");
|
|
15
|
+
const groupOrders_1 = require("./groupOrders");
|
|
16
|
+
const houseAccounts_1 = require("./houseAccounts");
|
|
17
|
+
const levelup_1 = require("./levelup");
|
|
18
|
+
const loyalty_1 = require("./loyalty");
|
|
19
|
+
const order_1 = require("./order");
|
|
20
|
+
const orders_1 = require("./orders");
|
|
21
|
+
const qrCode_1 = require("./qrCode");
|
|
22
|
+
const rewards_1 = require("./rewards");
|
|
23
|
+
const thanx_1 = require("./thanx");
|
|
24
|
+
exports.customerReducer = (0, redux_1.combineReducers)({
|
|
25
|
+
[types_1.ReducerType.Account]: account_1.accountReducer,
|
|
26
|
+
[types_1.ReducerType.CustomerAllergens]: allergens_1.customerAllergensReducer,
|
|
27
|
+
[types_1.ReducerType.CustomerAddresses]: addresses_1.customerAddressesReducer,
|
|
28
|
+
[types_1.ReducerType.CommunicationPrefs]: communicationPreferences_1.customerCommunicationPrefsReducer,
|
|
29
|
+
[types_1.ReducerType.CreditCards]: creditCards_1.customerCreditCardsReducer,
|
|
30
|
+
[types_1.ReducerType.Favorites]: favorites_1.customerFavoritesReducer,
|
|
31
|
+
[types_1.ReducerType.FcmToken]: fcmToken_1.customerFcmTokenReducer,
|
|
32
|
+
[types_1.ReducerType.GiftCards]: giftCards_1.customerGiftCardsReducer,
|
|
33
|
+
[types_1.ReducerType.Orders]: orders_1.customerOrdersReducer,
|
|
34
|
+
[types_1.ReducerType.Order]: order_1.customerOrderReducer,
|
|
35
|
+
[types_1.ReducerType.Loyalty]: loyalty_1.customerLoyaltyReducer,
|
|
36
|
+
[types_1.ReducerType.GroupOrders]: groupOrders_1.customerGroupOrdersReducer,
|
|
37
|
+
[types_1.ReducerType.HouseAccounts]: houseAccounts_1.customerHouseAccountsReducer,
|
|
38
|
+
[types_1.ReducerType.Rewards]: rewards_1.customerRewardsReducer,
|
|
39
|
+
[types_1.ReducerType.QRCode]: qrCode_1.customerQRCodeReducer,
|
|
40
|
+
[types_1.ReducerType.Thanx]: thanx_1.customerThanxReducer,
|
|
41
|
+
[types_1.ReducerType.Levelup]: levelup_1.customerLevelUpReducer
|
|
42
|
+
});
|
|
43
|
+
tslib_1.__exportStar(require("./account"), exports);
|
|
44
|
+
tslib_1.__exportStar(require("./allergens"), exports);
|
|
45
|
+
tslib_1.__exportStar(require("./addresses"), exports);
|
|
46
|
+
tslib_1.__exportStar(require("./communicationPreferences"), exports);
|
|
47
|
+
tslib_1.__exportStar(require("./creditCards"), exports);
|
|
48
|
+
tslib_1.__exportStar(require("./favorites"), exports);
|
|
49
|
+
tslib_1.__exportStar(require("./fcmToken"), exports);
|
|
50
|
+
tslib_1.__exportStar(require("./giftCards"), exports);
|
|
51
|
+
tslib_1.__exportStar(require("./orders"), exports);
|
|
52
|
+
tslib_1.__exportStar(require("./loyalty"), exports);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AppState } from '../../app';
|
|
2
|
+
import { LevelUp, RequestError, RequestStatus } from '@open-tender/types';
|
|
3
|
+
export interface CustomerLevelUpState {
|
|
4
|
+
entities: LevelUp[];
|
|
5
|
+
error: RequestError;
|
|
6
|
+
loading: RequestStatus;
|
|
7
|
+
lookup: {
|
|
8
|
+
[key: number]: number;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare enum CustomerLevelUpActionType {
|
|
12
|
+
FetchCustomerLevelUp = "customer/fetchCustomerLevelUp",
|
|
13
|
+
RemoveCustomerLevelUp = "customer/removeCustomerLevelUp",
|
|
14
|
+
AddCustomerLevelUp = "customer/addCustomerLevelUp"
|
|
15
|
+
}
|
|
16
|
+
export declare const fetchCustomerLevelUp: import("@reduxjs/toolkit").AsyncThunk<LevelUp[], void, {
|
|
17
|
+
state: AppState;
|
|
18
|
+
rejectValue: RequestError;
|
|
19
|
+
}>;
|
|
20
|
+
export declare const removeCustomerLevelUp: import("@reduxjs/toolkit").AsyncThunk<LevelUp[], {
|
|
21
|
+
levelupConnectId: number;
|
|
22
|
+
callback?: (() => void) | undefined;
|
|
23
|
+
}, {
|
|
24
|
+
state: AppState;
|
|
25
|
+
rejectValue: RequestError;
|
|
26
|
+
}>;
|
|
27
|
+
export declare const addCustomerLevelUp: import("@reduxjs/toolkit").AsyncThunk<LevelUp[], {
|
|
28
|
+
data: LevelUp;
|
|
29
|
+
callback?: (() => void) | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
state: AppState;
|
|
32
|
+
rejectValue: RequestError;
|
|
33
|
+
}>;
|
|
34
|
+
export declare const resetCustomerLevelUp: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setCustomerLevelUp: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>;
|
|
35
|
+
export declare const selectCustomerLevelUp: (state: AppState) => CustomerLevelUpState;
|
|
36
|
+
export declare const customerLevelUpReducer: import("redux").Reducer<CustomerLevelUpState, import("redux").AnyAction>;
|