@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/slices/order.js
CHANGED
|
@@ -11,26 +11,26 @@ const checkout_1 = require("./checkout");
|
|
|
11
11
|
const menu_1 = require("./menu");
|
|
12
12
|
const menuItems_1 = require("./menuItems");
|
|
13
13
|
const initialState = {
|
|
14
|
-
orderId: null,
|
|
15
|
-
orderType: null,
|
|
16
|
-
serviceType: null,
|
|
17
|
-
deviceType: null,
|
|
18
|
-
isOutpost: false,
|
|
19
|
-
isCurbside: false,
|
|
20
|
-
revenueCenter: null,
|
|
21
|
-
table: null,
|
|
22
|
-
prepType: null,
|
|
23
|
-
requestedAt: 'asap',
|
|
24
14
|
address: null,
|
|
25
|
-
|
|
26
|
-
currentItem: null,
|
|
15
|
+
alert: null,
|
|
27
16
|
cart: [],
|
|
28
17
|
cartCounts: {},
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
currentCategory: null,
|
|
19
|
+
currentItem: null,
|
|
20
|
+
currentVendor: null,
|
|
21
|
+
deviceType: null,
|
|
31
22
|
error: null,
|
|
23
|
+
isCurbside: false,
|
|
24
|
+
isOutpost: false,
|
|
32
25
|
loading: 'idle',
|
|
33
|
-
|
|
26
|
+
messages: [],
|
|
27
|
+
orderId: null,
|
|
28
|
+
prepType: null,
|
|
29
|
+
orderType: null,
|
|
30
|
+
requestedAt: 'asap',
|
|
31
|
+
revenueCenter: null,
|
|
32
|
+
serviceType: null,
|
|
33
|
+
table: null
|
|
34
34
|
};
|
|
35
35
|
var OrderActionType;
|
|
36
36
|
(function (OrderActionType) {
|
|
@@ -459,7 +459,7 @@ const selectOrderLimits = (state) => {
|
|
|
459
459
|
return { orderMinimum: null, orderMaximum: null };
|
|
460
460
|
}
|
|
461
461
|
const { cartGuest, spendingLimit } = state.groupOrder;
|
|
462
|
-
const { order_maximum, order_minimum } = revenueCenter
|
|
462
|
+
const { order_maximum, order_minimum } = revenueCenter;
|
|
463
463
|
const orderMax = cartGuest && spendingLimit
|
|
464
464
|
? parseFloat(spendingLimit)
|
|
465
465
|
: order_maximum
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AppState } from '../app';
|
|
2
|
-
import {
|
|
2
|
+
import { RevenueCenters, RevenueCenterParams, RequestError, RequestStatus } from '@open-tender/types';
|
|
3
3
|
export interface RevenueCentersState {
|
|
4
|
-
revenueCenters:
|
|
4
|
+
revenueCenters: RevenueCenters;
|
|
5
5
|
error: RequestError;
|
|
6
6
|
loading: RequestStatus;
|
|
7
7
|
}
|
|
@@ -9,13 +9,7 @@ export declare enum RevenueCentersActionType {
|
|
|
9
9
|
FetchRevenueCenters = "revenueCenters/fetchRevenueCenters",
|
|
10
10
|
FetchLocations = "revenueCenters/fetchLocations"
|
|
11
11
|
}
|
|
12
|
-
export declare const fetchRevenueCenters: import("@reduxjs/toolkit").AsyncThunk<
|
|
13
|
-
type: string;
|
|
14
|
-
is_outpost: boolean;
|
|
15
|
-
lat: number;
|
|
16
|
-
lng: number;
|
|
17
|
-
requestedAt: string;
|
|
18
|
-
}, {
|
|
12
|
+
export declare const fetchRevenueCenters: import("@reduxjs/toolkit").AsyncThunk<RevenueCenters, RevenueCenterParams, {
|
|
19
13
|
state: AppState;
|
|
20
14
|
rejectValue: RequestError;
|
|
21
15
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
@@ -25,13 +19,7 @@ export declare const fetchRevenueCenters: import("@reduxjs/toolkit").AsyncThunk<
|
|
|
25
19
|
fulfilledMeta?: unknown;
|
|
26
20
|
rejectedMeta?: unknown;
|
|
27
21
|
}>;
|
|
28
|
-
export declare const fetchLocations: import("@reduxjs/toolkit").AsyncThunk<
|
|
29
|
-
type: string;
|
|
30
|
-
is_outpost: boolean;
|
|
31
|
-
lat: number;
|
|
32
|
-
lng: number;
|
|
33
|
-
requestedAt: string;
|
|
34
|
-
}, {
|
|
22
|
+
export declare const fetchLocations: import("@reduxjs/toolkit").AsyncThunk<RevenueCenters, RevenueCenterParams, {
|
|
35
23
|
state: AppState;
|
|
36
24
|
rejectValue: RequestError;
|
|
37
25
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
package/dist/esm/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/esm/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/esm/app/store.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { combineReducers, configureStore } from '@reduxjs/toolkit';
|
|
2
|
-
import { alertsReducer, notificationsReducer, allergensReducer, announcementsReducer, customerReducer, signUpReducer, revenueCentersReducer, checkoutReducer, completedOrdersReducer, orderReducer, orderFulfillmentReducer, orderRatingReducer,
|
|
2
|
+
import { alertsReducer, notificationsReducer, allergensReducer, announcementsReducer, customerReducer, signUpReducer, revenueCentersReducer, checkoutReducer, completedOrdersReducer, orderReducer, orderFulfillmentReducer, orderRatingReducer, dealsReducer, confirmationReducer, donationsReducer, guestReducer, verifyAccountReducer, menuReducer, resetPasswordReducer, validTimesReducer, menuItemsReducer, menuDisplayReducer, giftCardsReducer, groupOrderReducer, levelupReducer, configReducer, geolocationReducer, loaderReducer, qrReducer, miscReducer, modalReducer, navSiteReducer, navReducer, postsReducer, sidebarModalReducer, sidebarReducer } from '../slices';
|
|
3
3
|
import { ReducerType } from '../slices/types';
|
|
4
4
|
export const appReducer = combineReducers({
|
|
5
5
|
[ReducerType.Alerts]: alertsReducer,
|
|
@@ -14,7 +14,6 @@ export const appReducer = combineReducers({
|
|
|
14
14
|
[ReducerType.Order]: orderReducer,
|
|
15
15
|
[ReducerType.OrderFulfillment]: orderFulfillmentReducer,
|
|
16
16
|
[ReducerType.OrderRating]: orderRatingReducer,
|
|
17
|
-
[ReducerType.Orders]: ordersReducer,
|
|
18
17
|
[ReducerType.Deals]: dealsReducer,
|
|
19
18
|
[ReducerType.Confirmation]: confirmationReducer,
|
|
20
19
|
[ReducerType.Donations]: 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>;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
3
|
+
import { contains, handleCheckoutErrors, isEmpty, isString, prepareOrder } from '@open-tender/utils';
|
|
3
4
|
import { ReducerType } from './types';
|
|
4
5
|
import { loginCustomer, selectToken } from './customer';
|
|
5
|
-
import { isEmpty, prepareOrder, handleCheckoutErrors, contains, isString } from '@open-tender/utils';
|
|
6
|
-
import { refreshRevenueCenter, setAlert } from './order';
|
|
7
6
|
import { fetchMenu } from './menu';
|
|
7
|
+
import { refreshRevenueCenter, setAlert } from './order';
|
|
8
8
|
const initialState = {
|
|
9
9
|
check: null,
|
|
10
10
|
form: {
|
|
11
|
-
details: {},
|
|
12
|
-
customer: {},
|
|
13
11
|
address: {},
|
|
14
|
-
|
|
12
|
+
customer: {},
|
|
13
|
+
details: {},
|
|
15
14
|
discounts: [],
|
|
16
|
-
promoCodes: [],
|
|
17
15
|
points: [],
|
|
16
|
+
promoCodes: [],
|
|
17
|
+
surcharges: [],
|
|
18
18
|
tenders: [],
|
|
19
19
|
tip: null
|
|
20
20
|
},
|
|
@@ -35,41 +35,65 @@ const assembleOrder = (orderData) => {
|
|
|
35
35
|
const { order, checkout, groupOrder } = orderData;
|
|
36
36
|
const { orderId, revenueCenter, serviceType, requestedAt, cart, deviceType, prepType, table } = order;
|
|
37
37
|
const { revenue_center_id: revenueCenterId } = revenueCenter || {};
|
|
38
|
+
if (!revenueCenterId || !serviceType || !requestedAt || !cart)
|
|
39
|
+
return null;
|
|
38
40
|
const { form } = checkout;
|
|
39
41
|
const { customer, address, details, surcharges, discounts, promoCodes, points, tenders, tip } = form;
|
|
40
42
|
// const defaultTip = check ? getDefaultTip(check.config) : null
|
|
41
43
|
const fullAddress = Object.assign(Object.assign({}, order.address), address);
|
|
42
44
|
const data = {
|
|
43
|
-
orderId,
|
|
44
|
-
revenueCenterId,
|
|
45
|
-
serviceType,
|
|
46
|
-
requestedAt,
|
|
47
|
-
cart,
|
|
48
|
-
customer,
|
|
49
45
|
address: isEmpty(fullAddress) ? null : fullAddress,
|
|
46
|
+
cart: cart,
|
|
47
|
+
cartId: groupOrder.cartId || null,
|
|
48
|
+
customer,
|
|
50
49
|
details,
|
|
51
|
-
|
|
50
|
+
deviceType,
|
|
52
51
|
discounts,
|
|
53
|
-
|
|
52
|
+
orderId,
|
|
54
53
|
points,
|
|
55
|
-
tip,
|
|
56
|
-
tenders,
|
|
57
|
-
cartId: groupOrder.cartId || null,
|
|
58
|
-
deviceType,
|
|
59
54
|
prepType,
|
|
60
|
-
|
|
55
|
+
promoCodes,
|
|
56
|
+
requestedAt,
|
|
57
|
+
revenueCenterId,
|
|
58
|
+
serviceType,
|
|
59
|
+
surcharges,
|
|
60
|
+
table,
|
|
61
|
+
tenders,
|
|
62
|
+
tip
|
|
61
63
|
};
|
|
62
64
|
const preparedOrder = prepareOrder(data);
|
|
63
65
|
return preparedOrder;
|
|
64
66
|
};
|
|
65
67
|
const refreshKeys = ['revenue_center_id', 'service_type', 'requested_at'];
|
|
66
|
-
const makeRefreshArgs = (order) => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
const makeRefreshArgs = (order) => ({
|
|
69
|
+
revenueCenterId: order.revenue_center_id,
|
|
70
|
+
serviceType: order.service_type,
|
|
71
|
+
requestedAt: order.requested_at
|
|
72
|
+
});
|
|
73
|
+
const handleOrderErrors = (err, preparedOrder, dispatch, rejectWithValue) => {
|
|
74
|
+
const errors = handleCheckoutErrors(err);
|
|
75
|
+
const keys = Object.keys(errors);
|
|
76
|
+
const args = makeRefreshArgs(preparedOrder);
|
|
77
|
+
if (contains(keys, refreshKeys)) {
|
|
78
|
+
dispatch(refreshRevenueCenter(args));
|
|
79
|
+
return rejectWithValue({});
|
|
80
|
+
}
|
|
81
|
+
else if (contains(keys, ['cart'])) {
|
|
82
|
+
const cartError = errors.cart;
|
|
83
|
+
if (isString(cartError)) {
|
|
84
|
+
dispatch(fetchMenu(args));
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
const alert = { type: 'cartCounts', args: { errors: cartError } };
|
|
88
|
+
setTimeout(() => {
|
|
89
|
+
dispatch(setAlert(alert));
|
|
90
|
+
}, 500);
|
|
91
|
+
}
|
|
92
|
+
return rejectWithValue({});
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
return rejectWithValue(errors);
|
|
96
|
+
}
|
|
73
97
|
};
|
|
74
98
|
export const validateOrder = createAsyncThunk(CheckoutActionType.FetchCheckout, (order, { dispatch, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
75
99
|
try {
|
|
@@ -77,9 +101,13 @@ export const validateOrder = createAsyncThunk(CheckoutActionType.FetchCheckout,
|
|
|
77
101
|
const token = selectToken(getState());
|
|
78
102
|
if (!order)
|
|
79
103
|
order = assembleOrder(getState());
|
|
104
|
+
const errors = {};
|
|
105
|
+
if (!order) {
|
|
106
|
+
errors['form'] = 'Empty cart. Please return to menu.';
|
|
107
|
+
return { check: null, errors };
|
|
108
|
+
}
|
|
80
109
|
const check = yield api.postOrderValidate(order, token);
|
|
81
110
|
const errMessages = handleCheckoutErrors({ params: check.errors });
|
|
82
|
-
const errors = {};
|
|
83
111
|
const keys = Object.keys(errMessages);
|
|
84
112
|
const args = makeRefreshArgs(order);
|
|
85
113
|
if (contains(keys, refreshKeys)) {
|
|
@@ -104,31 +132,6 @@ export const validateOrder = createAsyncThunk(CheckoutActionType.FetchCheckout,
|
|
|
104
132
|
return rejectWithValue(err);
|
|
105
133
|
}
|
|
106
134
|
}));
|
|
107
|
-
const handleOrderErrors = (err, preparedOrder, dispatch, rejectWithValue) => {
|
|
108
|
-
const errors = handleCheckoutErrors(err);
|
|
109
|
-
const keys = Object.keys(errors);
|
|
110
|
-
const args = makeRefreshArgs(preparedOrder);
|
|
111
|
-
if (contains(keys, refreshKeys)) {
|
|
112
|
-
dispatch(refreshRevenueCenter(args));
|
|
113
|
-
return rejectWithValue({});
|
|
114
|
-
}
|
|
115
|
-
else if (contains(keys, ['cart'])) {
|
|
116
|
-
const cartError = errors.cart;
|
|
117
|
-
if (isString(cartError)) {
|
|
118
|
-
dispatch(fetchMenu(args));
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
const alert = { type: 'cartCounts', args: { errors: cartError } };
|
|
122
|
-
setTimeout(() => {
|
|
123
|
-
dispatch(setAlert(alert));
|
|
124
|
-
}, 500);
|
|
125
|
-
}
|
|
126
|
-
return rejectWithValue({});
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
return rejectWithValue(errors);
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
135
|
export const submitOrder = createAsyncThunk(CheckoutActionType.SubmitOrder, (_, { dispatch, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
133
136
|
const { api } = getState().config;
|
|
134
137
|
if (!api)
|
|
@@ -140,6 +143,8 @@ export const submitOrder = createAsyncThunk(CheckoutActionType.SubmitOrder, (_,
|
|
|
140
143
|
};
|
|
141
144
|
dispatch(setAlert(alert));
|
|
142
145
|
const preparedOrder = assembleOrder(getState());
|
|
146
|
+
if (!preparedOrder)
|
|
147
|
+
return dispatch(setAlert({ type: 'close' }));
|
|
143
148
|
try {
|
|
144
149
|
const completedOrder = yield api.postOrder(preparedOrder, token);
|
|
145
150
|
const auth = getState().customer.account.auth;
|
|
@@ -168,6 +173,8 @@ export const submitOrderPay = createAsyncThunk(CheckoutActionType.SubmitOrderPay
|
|
|
168
173
|
dispatch(setAlert(alert));
|
|
169
174
|
}
|
|
170
175
|
const preparedOrder = assembleOrder(getState());
|
|
176
|
+
if (!preparedOrder)
|
|
177
|
+
return dispatch(setAlert({ type: 'close' }));
|
|
171
178
|
try {
|
|
172
179
|
const completedOrder = yield api.postOrder(preparedOrder, token);
|
|
173
180
|
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>;
|
|
@@ -241,8 +241,7 @@ export const selectGroupOrderPrepTimes = (state) => {
|
|
|
241
241
|
const { revenueCenter, serviceType } = state.order;
|
|
242
242
|
if (!revenueCenter || !serviceType)
|
|
243
243
|
return {};
|
|
244
|
-
const {
|
|
245
|
-
const { wait_times, group_ordering } = settings || revenueCenter;
|
|
244
|
+
const { wait_times, group_ordering } = revenueCenter;
|
|
246
245
|
const { prep_time, lead_time: leadTime } = group_ordering || {};
|
|
247
246
|
const st = serviceType === 'WALKIN' ? 'PICKUP' : serviceType;
|
|
248
247
|
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/esm/slices/index.js
CHANGED
|
@@ -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';
|
|
@@ -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>;
|