@open-tender/cloud 0.1.1 → 0.1.2
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 -2
- package/dist/cjs/app/store.d.ts +3 -6
- package/dist/cjs/app/store.js +0 -1
- package/dist/cjs/slices/checkout.d.ts +7 -7
- package/dist/cjs/slices/checkout.js +59 -52
- package/dist/cjs/slices/customer/groupOrders.d.ts +2 -2
- package/dist/cjs/slices/donations.d.ts +2 -2
- package/dist/cjs/slices/groupOrder.d.ts +1 -1
- package/dist/cjs/slices/groupOrder.js +1 -2
- package/dist/cjs/slices/index.d.ts +24 -25
- package/dist/cjs/slices/index.js +24 -25
- package/dist/cjs/slices/{modalSlice.d.ts → modal.d.ts} +3 -7
- package/dist/cjs/slices/{modalSlice.js → modal.js} +1 -1
- package/dist/cjs/slices/order.d.ts +21 -25
- package/dist/cjs/slices/order.js +16 -16
- package/dist/cjs/slices/revenueCenters.d.ts +4 -16
- package/dist/esm/app/hooks.d.ts +1 -2
- package/dist/esm/app/store.d.ts +3 -6
- package/dist/esm/app/store.js +1 -2
- package/dist/esm/slices/checkout.d.ts +7 -7
- package/dist/esm/slices/checkout.js +59 -52
- package/dist/esm/slices/customer/groupOrders.d.ts +2 -2
- package/dist/esm/slices/donations.d.ts +2 -2
- package/dist/esm/slices/groupOrder.d.ts +1 -1
- package/dist/esm/slices/groupOrder.js +1 -2
- package/dist/esm/slices/index.d.ts +24 -25
- package/dist/esm/slices/index.js +24 -25
- package/dist/esm/slices/{modalSlice.d.ts → modal.d.ts} +3 -7
- package/dist/esm/slices/{modalSlice.js → modal.js} +1 -1
- package/dist/esm/slices/order.d.ts +21 -25
- package/dist/esm/slices/order.js +16 -16
- package/dist/esm/slices/revenueCenters.d.ts +4 -16
- package/package.json +3 -3
- package/dist/cjs/slices/orders.d.ts +0 -128
- package/dist/cjs/slices/orders.js +0 -311
- package/dist/esm/slices/orders.d.ts +0 -128
- package/dist/esm/slices/orders.js +0 -302
- /package/dist/cjs/slices/{navSlice.d.ts → nav.d.ts} +0 -0
- /package/dist/cjs/slices/{navSlice.js → nav.js} +0 -0
- /package/dist/cjs/slices/{navSiteSlice.d.ts → navSite.d.ts} +0 -0
- /package/dist/cjs/slices/{navSiteSlice.js → navSite.js} +0 -0
- /package/dist/cjs/slices/{postsSlice.d.ts → posts.d.ts} +0 -0
- /package/dist/cjs/slices/{postsSlice.js → posts.js} +0 -0
- /package/dist/cjs/slices/{sidebarSlice.d.ts → sidebar.d.ts} +0 -0
- /package/dist/cjs/slices/{sidebarSlice.js → sidebar.js} +0 -0
- /package/dist/cjs/slices/{sidebarModalSlice.d.ts → sidebarModal.d.ts} +0 -0
- /package/dist/cjs/slices/{sidebarModalSlice.js → sidebarModal.js} +0 -0
- /package/dist/esm/slices/{navSlice.d.ts → nav.d.ts} +0 -0
- /package/dist/esm/slices/{navSlice.js → nav.js} +0 -0
- /package/dist/esm/slices/{navSiteSlice.d.ts → navSite.d.ts} +0 -0
- /package/dist/esm/slices/{navSiteSlice.js → navSite.js} +0 -0
- /package/dist/esm/slices/{postsSlice.d.ts → posts.d.ts} +0 -0
- /package/dist/esm/slices/{postsSlice.js → posts.js} +0 -0
- /package/dist/esm/slices/{sidebarSlice.d.ts → sidebar.d.ts} +0 -0
- /package/dist/esm/slices/{sidebarSlice.js → sidebar.js} +0 -0
- /package/dist/esm/slices/{sidebarModalSlice.d.ts → sidebarModal.d.ts} +0 -0
- /package/dist/esm/slices/{sidebarModalSlice.js → sidebarModal.js} +0 -0
package/dist/cjs/app/hooks.d.ts
CHANGED
|
@@ -31,7 +31,6 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<i
|
|
|
31
31
|
order: import("..").OrderState;
|
|
32
32
|
orderFulfillment: import("..").OrderFulfillmentState;
|
|
33
33
|
orderRating: import("..").OrderRatingState;
|
|
34
|
-
orders: import("..").OrdersState;
|
|
35
34
|
deals: import("..").DealState;
|
|
36
35
|
confirmation: import("..").ConfirmationState;
|
|
37
36
|
donations: import("..").DonationState;
|
|
@@ -50,7 +49,7 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<i
|
|
|
50
49
|
loader: import("..").LoaderState;
|
|
51
50
|
qr: import("..").QrState;
|
|
52
51
|
misc: import("..").MiscState;
|
|
53
|
-
modal: import("
|
|
52
|
+
modal: import("@open-tender/types").Modal;
|
|
54
53
|
navSite: import("..").NavSiteState;
|
|
55
54
|
nav: import("..").NavState;
|
|
56
55
|
posts: import("..").PostsSlice;
|
package/dist/cjs/app/store.d.ts
CHANGED
|
@@ -30,7 +30,6 @@ export declare const appReducer: import("redux").Reducer<import("redux").Combine
|
|
|
30
30
|
order: import("../slices").OrderState;
|
|
31
31
|
orderFulfillment: import("../slices").OrderFulfillmentState;
|
|
32
32
|
orderRating: import("../slices").OrderRatingState;
|
|
33
|
-
orders: import("../slices").OrdersState;
|
|
34
33
|
deals: import("../slices").DealState;
|
|
35
34
|
confirmation: import("../slices").ConfirmationState;
|
|
36
35
|
donations: import("../slices").DonationState;
|
|
@@ -49,7 +48,7 @@ export declare const appReducer: import("redux").Reducer<import("redux").Combine
|
|
|
49
48
|
loader: import("../slices").LoaderState;
|
|
50
49
|
qr: import("../slices").QrState;
|
|
51
50
|
misc: import("../slices").MiscState;
|
|
52
|
-
modal: import("
|
|
51
|
+
modal: import("@open-tender/types").Modal;
|
|
53
52
|
navSite: import("../slices").NavSiteState;
|
|
54
53
|
nav: import("../slices").NavState;
|
|
55
54
|
posts: import("../slices").PostsSlice;
|
|
@@ -88,7 +87,6 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
88
87
|
order: import("../slices").OrderState;
|
|
89
88
|
orderFulfillment: import("../slices").OrderFulfillmentState;
|
|
90
89
|
orderRating: import("../slices").OrderRatingState;
|
|
91
|
-
orders: import("../slices").OrdersState;
|
|
92
90
|
deals: import("../slices").DealState;
|
|
93
91
|
confirmation: import("../slices").ConfirmationState;
|
|
94
92
|
donations: import("../slices").DonationState;
|
|
@@ -107,7 +105,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
107
105
|
loader: import("../slices").LoaderState;
|
|
108
106
|
qr: import("../slices").QrState;
|
|
109
107
|
misc: import("../slices").MiscState;
|
|
110
|
-
modal: import("
|
|
108
|
+
modal: import("@open-tender/types").Modal;
|
|
111
109
|
navSite: import("../slices").NavSiteState;
|
|
112
110
|
nav: import("../slices").NavState;
|
|
113
111
|
posts: import("../slices").PostsSlice;
|
|
@@ -144,7 +142,6 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
144
142
|
order: import("../slices").OrderState;
|
|
145
143
|
orderFulfillment: import("../slices").OrderFulfillmentState;
|
|
146
144
|
orderRating: import("../slices").OrderRatingState;
|
|
147
|
-
orders: import("../slices").OrdersState;
|
|
148
145
|
deals: import("../slices").DealState;
|
|
149
146
|
confirmation: import("../slices").ConfirmationState;
|
|
150
147
|
donations: import("../slices").DonationState;
|
|
@@ -163,7 +160,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
163
160
|
loader: import("../slices").LoaderState;
|
|
164
161
|
qr: import("../slices").QrState;
|
|
165
162
|
misc: import("../slices").MiscState;
|
|
166
|
-
modal: import("
|
|
163
|
+
modal: import("@open-tender/types").Modal;
|
|
167
164
|
navSite: import("../slices").NavSiteState;
|
|
168
165
|
nav: import("../slices").NavState;
|
|
169
166
|
posts: import("../slices").PostsSlice;
|
package/dist/cjs/app/store.js
CHANGED
|
@@ -17,7 +17,6 @@ exports.appReducer = (0, toolkit_1.combineReducers)({
|
|
|
17
17
|
[types_1.ReducerType.Order]: slices_1.orderReducer,
|
|
18
18
|
[types_1.ReducerType.OrderFulfillment]: slices_1.orderFulfillmentReducer,
|
|
19
19
|
[types_1.ReducerType.OrderRating]: slices_1.orderRatingReducer,
|
|
20
|
-
[types_1.ReducerType.Orders]: slices_1.ordersReducer,
|
|
21
20
|
[types_1.ReducerType.Deals]: slices_1.dealsReducer,
|
|
22
21
|
[types_1.ReducerType.Confirmation]: slices_1.confirmationReducer,
|
|
23
22
|
[types_1.ReducerType.Donations]: slices_1.donationsReducer,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Dispatch } from '@reduxjs/toolkit';
|
|
2
|
+
import { CheckoutCheck, CheckoutForm, Order, OrderCreate, RequestStatus } from '@open-tender/types';
|
|
2
3
|
import { AppState } from '../app';
|
|
3
|
-
import { CheckoutCheck, CheckoutForm, CompletedOrder, Order, RequestStatus } from '@open-tender/types';
|
|
4
4
|
export interface CheckoutState {
|
|
5
5
|
check: CheckoutCheck | null;
|
|
6
6
|
form: CheckoutForm;
|
|
7
7
|
submitting: boolean;
|
|
8
8
|
isGuest: boolean;
|
|
9
|
-
completedOrder:
|
|
9
|
+
completedOrder: Order | null;
|
|
10
10
|
errors: any;
|
|
11
11
|
loading: RequestStatus;
|
|
12
12
|
}
|
|
@@ -19,7 +19,7 @@ export declare enum CheckoutActionType {
|
|
|
19
19
|
export declare const validateOrder: import("@reduxjs/toolkit").AsyncThunk<{
|
|
20
20
|
check: CheckoutCheck;
|
|
21
21
|
errors: any;
|
|
22
|
-
},
|
|
22
|
+
}, OrderCreate | null, {
|
|
23
23
|
state: AppState;
|
|
24
24
|
rejectValue: any;
|
|
25
25
|
dispatch?: Dispatch<import("redux").AnyAction> | undefined;
|
|
@@ -29,7 +29,7 @@ export declare const validateOrder: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
29
29
|
fulfilledMeta?: unknown;
|
|
30
30
|
rejectedMeta?: unknown;
|
|
31
31
|
}>;
|
|
32
|
-
export declare const submitOrder: import("@reduxjs/toolkit").AsyncThunk<
|
|
32
|
+
export declare const submitOrder: import("@reduxjs/toolkit").AsyncThunk<Order, void, {
|
|
33
33
|
state: AppState;
|
|
34
34
|
rejectValue: any;
|
|
35
35
|
dispatch?: Dispatch<import("redux").AnyAction> | undefined;
|
|
@@ -39,7 +39,7 @@ export declare const submitOrder: import("@reduxjs/toolkit").AsyncThunk<Complete
|
|
|
39
39
|
fulfilledMeta?: unknown;
|
|
40
40
|
rejectedMeta?: unknown;
|
|
41
41
|
}>;
|
|
42
|
-
export declare const submitOrderPay: import("@reduxjs/toolkit").AsyncThunk<
|
|
42
|
+
export declare const submitOrderPay: import("@reduxjs/toolkit").AsyncThunk<Order | null, boolean | undefined, {
|
|
43
43
|
state: AppState;
|
|
44
44
|
rejectValue: any;
|
|
45
45
|
dispatch?: Dispatch<import("redux").AnyAction> | undefined;
|
|
@@ -52,6 +52,6 @@ export declare const submitOrderPay: import("@reduxjs/toolkit").AsyncThunk<Compl
|
|
|
52
52
|
export declare const resetCheckout: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetCheckout">, resetCheck: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetCheck">, resetCompletedOrder: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetCompletedOrder">, resetErrors: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetErrors">, resetTip: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetTip">, setCompletedOrder: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/setCompletedOrder">, setGuest: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/setGuest">, setSubmitting: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/setSubmitting">, updateCheckoutCustomer: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/updateCheckoutCustomer">, updateForm: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/updateForm">;
|
|
53
53
|
export declare const selectCheckout: (state: AppState) => CheckoutState;
|
|
54
54
|
export declare const selectCheck: (state: AppState) => CheckoutCheck | null;
|
|
55
|
-
export declare const selectCompletedOrder: (state: AppState) =>
|
|
56
|
-
export declare const selectDiscounts: (state: AppState) => import("@open-tender/types").
|
|
55
|
+
export declare const selectCompletedOrder: (state: AppState) => Order | null;
|
|
56
|
+
export declare const selectDiscounts: (state: AppState) => import("@open-tender/types").OrderCreateDiscounts;
|
|
57
57
|
export declare const checkoutReducer: import("redux").Reducer<CheckoutState, import("redux").AnyAction>;
|
|
@@ -4,21 +4,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.checkoutReducer = exports.selectDiscounts = exports.selectCompletedOrder = exports.selectCheck = exports.selectCheckout = exports.updateForm = exports.updateCheckoutCustomer = exports.setSubmitting = exports.setGuest = exports.setCompletedOrder = exports.resetTip = exports.resetErrors = exports.resetCompletedOrder = exports.resetCheck = exports.resetCheckout = exports.submitOrderPay = exports.submitOrder = exports.validateOrder = exports.CheckoutActionType = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
7
|
+
const utils_1 = require("@open-tender/utils");
|
|
7
8
|
const types_1 = require("./types");
|
|
8
9
|
const customer_1 = require("./customer");
|
|
9
|
-
const utils_1 = require("@open-tender/utils");
|
|
10
|
-
const order_1 = require("./order");
|
|
11
10
|
const menu_1 = require("./menu");
|
|
11
|
+
const order_1 = require("./order");
|
|
12
12
|
const initialState = {
|
|
13
13
|
check: null,
|
|
14
14
|
form: {
|
|
15
|
-
details: {},
|
|
16
|
-
customer: {},
|
|
17
15
|
address: {},
|
|
18
|
-
|
|
16
|
+
customer: {},
|
|
17
|
+
details: {},
|
|
19
18
|
discounts: [],
|
|
20
|
-
promoCodes: [],
|
|
21
19
|
points: [],
|
|
20
|
+
promoCodes: [],
|
|
21
|
+
surcharges: [],
|
|
22
22
|
tenders: [],
|
|
23
23
|
tip: null
|
|
24
24
|
},
|
|
@@ -39,41 +39,65 @@ const assembleOrder = (orderData) => {
|
|
|
39
39
|
const { order, checkout, groupOrder } = orderData;
|
|
40
40
|
const { orderId, revenueCenter, serviceType, requestedAt, cart, deviceType, prepType, table } = order;
|
|
41
41
|
const { revenue_center_id: revenueCenterId } = revenueCenter || {};
|
|
42
|
+
if (!revenueCenterId || !serviceType || !requestedAt || !cart)
|
|
43
|
+
return null;
|
|
42
44
|
const { form } = checkout;
|
|
43
45
|
const { customer, address, details, surcharges, discounts, promoCodes, points, tenders, tip } = form;
|
|
44
46
|
// const defaultTip = check ? getDefaultTip(check.config) : null
|
|
45
47
|
const fullAddress = Object.assign(Object.assign({}, order.address), address);
|
|
46
48
|
const data = {
|
|
47
|
-
orderId,
|
|
48
|
-
revenueCenterId,
|
|
49
|
-
serviceType,
|
|
50
|
-
requestedAt,
|
|
51
|
-
cart,
|
|
52
|
-
customer,
|
|
53
49
|
address: (0, utils_1.isEmpty)(fullAddress) ? null : fullAddress,
|
|
50
|
+
cart: cart,
|
|
51
|
+
cartId: groupOrder.cartId || null,
|
|
52
|
+
customer,
|
|
54
53
|
details,
|
|
55
|
-
|
|
54
|
+
deviceType,
|
|
56
55
|
discounts,
|
|
57
|
-
|
|
56
|
+
orderId,
|
|
58
57
|
points,
|
|
59
|
-
tip,
|
|
60
|
-
tenders,
|
|
61
|
-
cartId: groupOrder.cartId || null,
|
|
62
|
-
deviceType,
|
|
63
58
|
prepType,
|
|
64
|
-
|
|
59
|
+
promoCodes,
|
|
60
|
+
requestedAt,
|
|
61
|
+
revenueCenterId,
|
|
62
|
+
serviceType,
|
|
63
|
+
surcharges,
|
|
64
|
+
table,
|
|
65
|
+
tenders,
|
|
66
|
+
tip
|
|
65
67
|
};
|
|
66
68
|
const preparedOrder = (0, utils_1.prepareOrder)(data);
|
|
67
69
|
return preparedOrder;
|
|
68
70
|
};
|
|
69
71
|
const refreshKeys = ['revenue_center_id', 'service_type', 'requested_at'];
|
|
70
|
-
const makeRefreshArgs = (order) => {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
const makeRefreshArgs = (order) => ({
|
|
73
|
+
revenueCenterId: order.revenue_center_id,
|
|
74
|
+
serviceType: order.service_type,
|
|
75
|
+
requestedAt: order.requested_at
|
|
76
|
+
});
|
|
77
|
+
const handleOrderErrors = (err, preparedOrder, dispatch, rejectWithValue) => {
|
|
78
|
+
const errors = (0, utils_1.handleCheckoutErrors)(err);
|
|
79
|
+
const keys = Object.keys(errors);
|
|
80
|
+
const args = makeRefreshArgs(preparedOrder);
|
|
81
|
+
if ((0, utils_1.contains)(keys, refreshKeys)) {
|
|
82
|
+
dispatch((0, order_1.refreshRevenueCenter)(args));
|
|
83
|
+
return rejectWithValue({});
|
|
84
|
+
}
|
|
85
|
+
else if ((0, utils_1.contains)(keys, ['cart'])) {
|
|
86
|
+
const cartError = errors.cart;
|
|
87
|
+
if ((0, utils_1.isString)(cartError)) {
|
|
88
|
+
dispatch((0, menu_1.fetchMenu)(args));
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
const alert = { type: 'cartCounts', args: { errors: cartError } };
|
|
92
|
+
setTimeout(() => {
|
|
93
|
+
dispatch((0, order_1.setAlert)(alert));
|
|
94
|
+
}, 500);
|
|
95
|
+
}
|
|
96
|
+
return rejectWithValue({});
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
return rejectWithValue(errors);
|
|
100
|
+
}
|
|
77
101
|
};
|
|
78
102
|
exports.validateOrder = (0, toolkit_1.createAsyncThunk)(CheckoutActionType.FetchCheckout, (order, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
79
103
|
try {
|
|
@@ -81,9 +105,13 @@ exports.validateOrder = (0, toolkit_1.createAsyncThunk)(CheckoutActionType.Fetch
|
|
|
81
105
|
const token = (0, customer_1.selectToken)(getState());
|
|
82
106
|
if (!order)
|
|
83
107
|
order = assembleOrder(getState());
|
|
108
|
+
const errors = {};
|
|
109
|
+
if (!order) {
|
|
110
|
+
errors['form'] = 'Empty cart. Please return to menu.';
|
|
111
|
+
return { check: null, errors };
|
|
112
|
+
}
|
|
84
113
|
const check = yield api.postOrderValidate(order, token);
|
|
85
114
|
const errMessages = (0, utils_1.handleCheckoutErrors)({ params: check.errors });
|
|
86
|
-
const errors = {};
|
|
87
115
|
const keys = Object.keys(errMessages);
|
|
88
116
|
const args = makeRefreshArgs(order);
|
|
89
117
|
if ((0, utils_1.contains)(keys, refreshKeys)) {
|
|
@@ -108,31 +136,6 @@ exports.validateOrder = (0, toolkit_1.createAsyncThunk)(CheckoutActionType.Fetch
|
|
|
108
136
|
return rejectWithValue(err);
|
|
109
137
|
}
|
|
110
138
|
}));
|
|
111
|
-
const handleOrderErrors = (err, preparedOrder, dispatch, rejectWithValue) => {
|
|
112
|
-
const errors = (0, utils_1.handleCheckoutErrors)(err);
|
|
113
|
-
const keys = Object.keys(errors);
|
|
114
|
-
const args = makeRefreshArgs(preparedOrder);
|
|
115
|
-
if ((0, utils_1.contains)(keys, refreshKeys)) {
|
|
116
|
-
dispatch((0, order_1.refreshRevenueCenter)(args));
|
|
117
|
-
return rejectWithValue({});
|
|
118
|
-
}
|
|
119
|
-
else if ((0, utils_1.contains)(keys, ['cart'])) {
|
|
120
|
-
const cartError = errors.cart;
|
|
121
|
-
if ((0, utils_1.isString)(cartError)) {
|
|
122
|
-
dispatch((0, menu_1.fetchMenu)(args));
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
const alert = { type: 'cartCounts', args: { errors: cartError } };
|
|
126
|
-
setTimeout(() => {
|
|
127
|
-
dispatch((0, order_1.setAlert)(alert));
|
|
128
|
-
}, 500);
|
|
129
|
-
}
|
|
130
|
-
return rejectWithValue({});
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
return rejectWithValue(errors);
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
139
|
exports.submitOrder = (0, toolkit_1.createAsyncThunk)(CheckoutActionType.SubmitOrder, (_, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
137
140
|
const { api } = getState().config;
|
|
138
141
|
if (!api)
|
|
@@ -144,6 +147,8 @@ exports.submitOrder = (0, toolkit_1.createAsyncThunk)(CheckoutActionType.SubmitO
|
|
|
144
147
|
};
|
|
145
148
|
dispatch((0, order_1.setAlert)(alert));
|
|
146
149
|
const preparedOrder = assembleOrder(getState());
|
|
150
|
+
if (!preparedOrder)
|
|
151
|
+
return dispatch((0, order_1.setAlert)({ type: 'close' }));
|
|
147
152
|
try {
|
|
148
153
|
const completedOrder = yield api.postOrder(preparedOrder, token);
|
|
149
154
|
const auth = getState().customer.account.auth;
|
|
@@ -172,6 +177,8 @@ exports.submitOrderPay = (0, toolkit_1.createAsyncThunk)(CheckoutActionType.Subm
|
|
|
172
177
|
dispatch((0, order_1.setAlert)(alert));
|
|
173
178
|
}
|
|
174
179
|
const preparedOrder = assembleOrder(getState());
|
|
180
|
+
if (!preparedOrder)
|
|
181
|
+
return dispatch((0, order_1.setAlert)({ type: 'close' }));
|
|
175
182
|
try {
|
|
176
183
|
const completedOrder = yield api.postOrder(preparedOrder, token);
|
|
177
184
|
const auth = getState().customer.account.auth;
|
|
@@ -42,7 +42,7 @@ export declare const makeCartData: (order: OrderState, spendingLimit?: string) =
|
|
|
42
42
|
address: import("@open-tender/types").Address | null;
|
|
43
43
|
revenue_center_id: number;
|
|
44
44
|
service_type: import("@open-tender/types").ServiceType | null;
|
|
45
|
-
requested_at:
|
|
45
|
+
requested_at: import("@open-tender/types").RequestedAt | null;
|
|
46
46
|
cart: {
|
|
47
47
|
id: number;
|
|
48
48
|
quantity: number;
|
|
@@ -55,7 +55,7 @@ export declare const makeCartData: (order: OrderState, spendingLimit?: string) =
|
|
|
55
55
|
address: import("@open-tender/types").Address | null;
|
|
56
56
|
revenue_center_id: number;
|
|
57
57
|
service_type: import("@open-tender/types").ServiceType | null;
|
|
58
|
-
requested_at:
|
|
58
|
+
requested_at: import("@open-tender/types").RequestedAt | null;
|
|
59
59
|
cart: {
|
|
60
60
|
id: number;
|
|
61
61
|
quantity: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AppState } from '../app';
|
|
2
|
-
import { Donation, RequestError, RequestStatus
|
|
2
|
+
import { Donation, DonationPurchase, RequestError, RequestStatus } from '@open-tender/types';
|
|
3
3
|
export interface DonationState {
|
|
4
4
|
donation: Donation | null;
|
|
5
5
|
error: RequestError | Record<string, any>;
|
|
@@ -10,7 +10,7 @@ export declare enum DonationActionType {
|
|
|
10
10
|
PurchaseDonation = "donations/purchaseDonation"
|
|
11
11
|
}
|
|
12
12
|
export declare const purchaseDonation: import("@reduxjs/toolkit").AsyncThunk<Donation, {
|
|
13
|
-
data:
|
|
13
|
+
data: DonationPurchase;
|
|
14
14
|
callback?: (() => void) | undefined;
|
|
15
15
|
}, {
|
|
16
16
|
state: AppState;
|
|
@@ -113,6 +113,6 @@ export declare const selectGroupOrderPrepTimes: (state: AppState) => {
|
|
|
113
113
|
leadTime?: undefined;
|
|
114
114
|
} | {
|
|
115
115
|
prepTime: number;
|
|
116
|
-
leadTime: number
|
|
116
|
+
leadTime: number;
|
|
117
117
|
};
|
|
118
118
|
export declare const groupOrderReducer: import("redux").Reducer<GroupOrderState, import("redux").AnyAction>;
|
|
@@ -250,8 +250,7 @@ const selectGroupOrderPrepTimes = (state) => {
|
|
|
250
250
|
const { revenueCenter, serviceType } = state.order;
|
|
251
251
|
if (!revenueCenter || !serviceType)
|
|
252
252
|
return {};
|
|
253
|
-
const {
|
|
254
|
-
const { wait_times, group_ordering } = settings || revenueCenter;
|
|
253
|
+
const { wait_times, group_ordering } = revenueCenter;
|
|
255
254
|
const { prep_time, lead_time: leadTime } = group_ordering || {};
|
|
256
255
|
const st = serviceType === 'WALKIN' ? 'PICKUP' : serviceType;
|
|
257
256
|
const waitTime = wait_times && wait_times[st] ? wait_times[st] : 0;
|
|
@@ -1,37 +1,36 @@
|
|
|
1
1
|
export * from './alerts';
|
|
2
|
-
export * from './notifications';
|
|
3
2
|
export * from './allergens';
|
|
4
3
|
export * from './announcements';
|
|
5
|
-
export * from './customer';
|
|
6
|
-
export * from './signUp';
|
|
7
|
-
export * from './revenueCenters';
|
|
8
4
|
export * from './checkout';
|
|
9
5
|
export * from './completedOrders';
|
|
10
|
-
export * from './
|
|
11
|
-
export * from './orderFulfillment';
|
|
12
|
-
export * from './orderRating';
|
|
13
|
-
export * from './orders';
|
|
14
|
-
export * from './deals';
|
|
6
|
+
export * from './config';
|
|
15
7
|
export * from './confirmation';
|
|
8
|
+
export * from './customer';
|
|
9
|
+
export * from './deals';
|
|
16
10
|
export * from './donations';
|
|
17
|
-
export * from './
|
|
18
|
-
export * from './verifyAccount';
|
|
19
|
-
export * from './menu';
|
|
20
|
-
export * from './resetPassword';
|
|
21
|
-
export * from './validTimes';
|
|
22
|
-
export * from './menuItems';
|
|
23
|
-
export * from './menuDisplay';
|
|
11
|
+
export * from './geolocation';
|
|
24
12
|
export * from './giftCards';
|
|
25
13
|
export * from './groupOrder';
|
|
14
|
+
export * from './guest';
|
|
26
15
|
export * from './levelup';
|
|
27
|
-
export * from './config';
|
|
28
|
-
export * from './geolocation';
|
|
29
16
|
export * from './loader';
|
|
30
|
-
export * from './
|
|
17
|
+
export * from './menu';
|
|
18
|
+
export * from './menuDisplay';
|
|
19
|
+
export * from './menuItems';
|
|
31
20
|
export * from './misc';
|
|
32
|
-
export * from './
|
|
33
|
-
export * from './
|
|
34
|
-
export * from './
|
|
35
|
-
export * from './
|
|
36
|
-
export * from './
|
|
37
|
-
export * from './
|
|
21
|
+
export * from './modal';
|
|
22
|
+
export * from './nav';
|
|
23
|
+
export * from './navSite';
|
|
24
|
+
export * from './notifications';
|
|
25
|
+
export * from './order';
|
|
26
|
+
export * from './orderFulfillment';
|
|
27
|
+
export * from './orderRating';
|
|
28
|
+
export * from './posts';
|
|
29
|
+
export * from './qr';
|
|
30
|
+
export * from './resetPassword';
|
|
31
|
+
export * from './revenueCenters';
|
|
32
|
+
export * from './sidebar';
|
|
33
|
+
export * from './sidebarModal';
|
|
34
|
+
export * from './signUp';
|
|
35
|
+
export * from './validTimes';
|
|
36
|
+
export * from './verifyAccount';
|
package/dist/cjs/slices/index.js
CHANGED
|
@@ -2,39 +2,38 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./alerts"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./notifications"), exports);
|
|
6
5
|
tslib_1.__exportStar(require("./allergens"), exports);
|
|
7
6
|
tslib_1.__exportStar(require("./announcements"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./customer"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./signUp"), exports);
|
|
10
|
-
tslib_1.__exportStar(require("./revenueCenters"), exports);
|
|
11
7
|
tslib_1.__exportStar(require("./checkout"), exports);
|
|
12
8
|
tslib_1.__exportStar(require("./completedOrders"), exports);
|
|
13
|
-
tslib_1.__exportStar(require("./
|
|
14
|
-
tslib_1.__exportStar(require("./orderFulfillment"), exports);
|
|
15
|
-
tslib_1.__exportStar(require("./orderRating"), exports);
|
|
16
|
-
tslib_1.__exportStar(require("./orders"), exports);
|
|
17
|
-
tslib_1.__exportStar(require("./deals"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./config"), exports);
|
|
18
10
|
tslib_1.__exportStar(require("./confirmation"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./customer"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./deals"), exports);
|
|
19
13
|
tslib_1.__exportStar(require("./donations"), exports);
|
|
20
|
-
tslib_1.__exportStar(require("./
|
|
21
|
-
tslib_1.__exportStar(require("./verifyAccount"), exports);
|
|
22
|
-
tslib_1.__exportStar(require("./menu"), exports);
|
|
23
|
-
tslib_1.__exportStar(require("./resetPassword"), exports);
|
|
24
|
-
tslib_1.__exportStar(require("./validTimes"), exports);
|
|
25
|
-
tslib_1.__exportStar(require("./menuItems"), exports);
|
|
26
|
-
tslib_1.__exportStar(require("./menuDisplay"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./geolocation"), exports);
|
|
27
15
|
tslib_1.__exportStar(require("./giftCards"), exports);
|
|
28
16
|
tslib_1.__exportStar(require("./groupOrder"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./guest"), exports);
|
|
29
18
|
tslib_1.__exportStar(require("./levelup"), exports);
|
|
30
|
-
tslib_1.__exportStar(require("./config"), exports);
|
|
31
|
-
tslib_1.__exportStar(require("./geolocation"), exports);
|
|
32
19
|
tslib_1.__exportStar(require("./loader"), exports);
|
|
33
|
-
tslib_1.__exportStar(require("./
|
|
20
|
+
tslib_1.__exportStar(require("./menu"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./menuDisplay"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./menuItems"), exports);
|
|
34
23
|
tslib_1.__exportStar(require("./misc"), exports);
|
|
35
|
-
tslib_1.__exportStar(require("./
|
|
36
|
-
tslib_1.__exportStar(require("./
|
|
37
|
-
tslib_1.__exportStar(require("./
|
|
38
|
-
tslib_1.__exportStar(require("./
|
|
39
|
-
tslib_1.__exportStar(require("./
|
|
40
|
-
tslib_1.__exportStar(require("./
|
|
24
|
+
tslib_1.__exportStar(require("./modal"), exports);
|
|
25
|
+
tslib_1.__exportStar(require("./nav"), exports);
|
|
26
|
+
tslib_1.__exportStar(require("./navSite"), exports);
|
|
27
|
+
tslib_1.__exportStar(require("./notifications"), exports);
|
|
28
|
+
tslib_1.__exportStar(require("./order"), exports);
|
|
29
|
+
tslib_1.__exportStar(require("./orderFulfillment"), exports);
|
|
30
|
+
tslib_1.__exportStar(require("./orderRating"), exports);
|
|
31
|
+
tslib_1.__exportStar(require("./posts"), exports);
|
|
32
|
+
tslib_1.__exportStar(require("./qr"), exports);
|
|
33
|
+
tslib_1.__exportStar(require("./resetPassword"), exports);
|
|
34
|
+
tslib_1.__exportStar(require("./revenueCenters"), exports);
|
|
35
|
+
tslib_1.__exportStar(require("./sidebar"), exports);
|
|
36
|
+
tslib_1.__exportStar(require("./sidebarModal"), exports);
|
|
37
|
+
tslib_1.__exportStar(require("./signUp"), exports);
|
|
38
|
+
tslib_1.__exportStar(require("./validTimes"), exports);
|
|
39
|
+
tslib_1.__exportStar(require("./verifyAccount"), exports);
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
+
import { Modal } from '@open-tender/types';
|
|
1
2
|
import { AppState } from '../app';
|
|
2
|
-
export interface ModalState {
|
|
3
|
-
loading: string | null;
|
|
4
|
-
type: string | null;
|
|
5
|
-
args: any;
|
|
6
|
-
}
|
|
7
3
|
export declare const openModal: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "modal/openModal">, closeModal: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"modal/closeModal">;
|
|
8
|
-
export declare const selectModal: (state: AppState) =>
|
|
9
|
-
export declare const modalReducer: import("redux").Reducer<
|
|
4
|
+
export declare const selectModal: (state: AppState) => Modal;
|
|
5
|
+
export declare const modalReducer: import("redux").Reducer<Modal, import("redux").AnyAction>;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.modalReducer = exports.selectModal = exports.closeModal = exports.openModal = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const initialState = {
|
|
7
|
-
loading:
|
|
7
|
+
loading: false,
|
|
8
8
|
type: null,
|
|
9
9
|
args: null
|
|
10
10
|
};
|
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
import { AppState } from '../app';
|
|
2
|
-
import { Address, Cart, CartItem,
|
|
2
|
+
import { Address, Cart, CartCounts, CartItem, DeviceType, MenuCategory, MenuRevenueCenter, Messages, Modal, Order, OrderType, PrepType, RequestedAt, RequestError, RequestStatus, RevenueCenter, ServiceType, SimpleCart } from '@open-tender/types';
|
|
3
3
|
export interface OrderState {
|
|
4
|
-
error: RequestError | string;
|
|
5
|
-
loading: RequestStatus;
|
|
6
4
|
address: Address | null;
|
|
7
|
-
alert:
|
|
5
|
+
alert: Modal | null;
|
|
8
6
|
cart: Cart | null;
|
|
9
|
-
cartCounts:
|
|
10
|
-
[key: number]: number;
|
|
11
|
-
} | null;
|
|
7
|
+
cartCounts: CartCounts | null;
|
|
12
8
|
currentCategory: MenuCategory | null;
|
|
13
9
|
currentItem: CartItem | null;
|
|
14
|
-
currentVendor:
|
|
15
|
-
deviceType:
|
|
10
|
+
currentVendor: MenuRevenueCenter | null;
|
|
11
|
+
deviceType: DeviceType | null;
|
|
12
|
+
error: RequestError | string;
|
|
16
13
|
isCurbside: boolean;
|
|
17
14
|
isOutpost: boolean;
|
|
18
|
-
|
|
15
|
+
loading: RequestStatus;
|
|
16
|
+
messages: Messages;
|
|
19
17
|
orderId: number | null;
|
|
20
18
|
orderType: OrderType | null;
|
|
21
|
-
prepType:
|
|
22
|
-
requestedAt:
|
|
23
|
-
revenueCenter:
|
|
19
|
+
prepType: PrepType | null;
|
|
20
|
+
requestedAt: RequestedAt | null;
|
|
21
|
+
revenueCenter: RevenueCenter | null;
|
|
24
22
|
serviceType: ServiceType | null;
|
|
25
|
-
table:
|
|
23
|
+
table: string | null;
|
|
26
24
|
}
|
|
27
25
|
export declare enum OrderActionType {
|
|
28
26
|
FetchRevenueCenter = "order/fetchRevenueCenter",
|
|
@@ -55,7 +53,7 @@ export declare const fetchLocation: import("@reduxjs/toolkit").AsyncThunk<void,
|
|
|
55
53
|
fulfilledMeta?: unknown;
|
|
56
54
|
rejectedMeta?: unknown;
|
|
57
55
|
}>;
|
|
58
|
-
export declare const revertMenu: import("@reduxjs/toolkit").AsyncThunk<void |
|
|
56
|
+
export declare const revertMenu: import("@reduxjs/toolkit").AsyncThunk<void | RevenueCenter, {
|
|
59
57
|
revenueCenterId: number;
|
|
60
58
|
serviceType: ServiceType;
|
|
61
59
|
requestedAt: string;
|
|
@@ -84,7 +82,7 @@ export declare const refreshRevenueCenter: import("@reduxjs/toolkit").AsyncThunk
|
|
|
84
82
|
fulfilledMeta?: unknown;
|
|
85
83
|
rejectedMeta?: unknown;
|
|
86
84
|
}>;
|
|
87
|
-
export declare const editOrder: import("@reduxjs/toolkit").AsyncThunk<void | Partial<OrderState>,
|
|
85
|
+
export declare const editOrder: import("@reduxjs/toolkit").AsyncThunk<void | Partial<OrderState>, Order, {
|
|
88
86
|
state: AppState;
|
|
89
87
|
rejectValue: RequestError;
|
|
90
88
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
@@ -113,25 +111,23 @@ export declare const resetOrder: import("@reduxjs/toolkit").ActionCreatorWithout
|
|
|
113
111
|
serviceType: ServiceType;
|
|
114
112
|
isOutpost?: boolean | undefined;
|
|
115
113
|
}, "order/setOrderServiceType">, setOrderType: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "order/setOrderType">, setPrepType: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "order/setPrepType">, setRequestedAt: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "order/setRequestedAt">, setRevenueCenter: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "order/setRevenueCenter">, setServiceType: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "order/setServiceType">, setTable: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "order/setTable">, checkout: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"order/checkout">, setCurrentVendor: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "order/setCurrentVendor">;
|
|
116
|
-
export declare const selectAlert: (state: AppState) =>
|
|
114
|
+
export declare const selectAlert: (state: AppState) => Modal | null;
|
|
117
115
|
export declare const selectTimezone: (state: AppState) => string;
|
|
118
116
|
export declare const selectOrder: (state: AppState) => OrderState;
|
|
119
117
|
export declare const selectCartQuantity: (state: AppState) => number;
|
|
120
118
|
export declare const selectCartTotal: (state: AppState) => number;
|
|
121
|
-
export declare const selectCartCounts: (state: AppState) =>
|
|
122
|
-
|
|
123
|
-
};
|
|
124
|
-
export declare const selectCanOrder: (state: AppState) => string | null;
|
|
119
|
+
export declare const selectCartCounts: (state: AppState) => CartCounts;
|
|
120
|
+
export declare const selectCanOrder: (state: AppState) => RequestedAt | null;
|
|
125
121
|
export declare const selectOrderLimits: (state: AppState) => {
|
|
126
122
|
orderMinimum: number | null;
|
|
127
123
|
orderMaximum: number | null;
|
|
128
124
|
};
|
|
129
125
|
export declare const selectCartIds: (state: AppState) => number[];
|
|
130
126
|
export declare const selectMenuSlug: (state: AppState) => string;
|
|
131
|
-
export declare const selectRevenueCenter: (state: AppState) =>
|
|
127
|
+
export declare const selectRevenueCenter: (state: AppState) => RevenueCenter | null;
|
|
132
128
|
export declare const selectCart: (state: AppState) => Cart | null;
|
|
133
|
-
export declare const selectCurrentVendor: (state: AppState) =>
|
|
134
|
-
export declare const selectMessages: (state: AppState) =>
|
|
129
|
+
export declare const selectCurrentVendor: (state: AppState) => MenuRevenueCenter | null;
|
|
130
|
+
export declare const selectMessages: (state: AppState) => Messages;
|
|
135
131
|
export declare const selectCurrentItem: (state: AppState) => CartItem | null;
|
|
136
132
|
export declare const selectMenuVars: (state: AppState) => {
|
|
137
133
|
revenueCenterId?: undefined;
|
|
@@ -140,7 +136,7 @@ export declare const selectMenuVars: (state: AppState) => {
|
|
|
140
136
|
} | {
|
|
141
137
|
revenueCenterId: number;
|
|
142
138
|
serviceType: ServiceType | null;
|
|
143
|
-
requestedAt:
|
|
139
|
+
requestedAt: RequestedAt | null;
|
|
144
140
|
};
|
|
145
141
|
export declare const selectAutoSelect: (state: AppState) => boolean | undefined;
|
|
146
142
|
export declare const selectCurrentCategory: (state: AppState) => MenuCategory | null;
|