@open-tender/cloud 0.4.33 → 0.4.34
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.
|
@@ -236,7 +236,7 @@ exports.selectGroupOrderClosed = (0, toolkit_1.createSelector)((state) => {
|
|
|
236
236
|
return { cartGuest, cutoffAt, closed, tz };
|
|
237
237
|
}, ({ cartGuest, cutoffAt, closed, tz }) => {
|
|
238
238
|
const cutoffDate = cutoffAt ? (0, utils_1.isoToDate)(cutoffAt, tz) : null;
|
|
239
|
-
const pastCutoff = cutoffDate ?
|
|
239
|
+
const pastCutoff = cutoffDate ? (0, utils_1.currentLocalDate)(tz) > cutoffDate : false;
|
|
240
240
|
return cartGuest && (closed || pastCutoff);
|
|
241
241
|
});
|
|
242
242
|
exports.selectGroupOrderTests = (0, toolkit_1.createSelector)((state) => {
|
package/dist/cjs/slices/guest.js
CHANGED
|
@@ -5,6 +5,7 @@ exports.guestReducer = exports.selectGuest = exports.setGuestEmail = exports.res
|
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
7
7
|
const types_1 = require("./types");
|
|
8
|
+
const order_1 = require("./order");
|
|
8
9
|
const initialState = {
|
|
9
10
|
brands: null,
|
|
10
11
|
email: null,
|
|
@@ -32,7 +33,7 @@ exports.fetchGuest = (0, toolkit_1.createAsyncThunk)(GuestActionType.FetchGuest,
|
|
|
32
33
|
return rejectWithValue(error);
|
|
33
34
|
}
|
|
34
35
|
}));
|
|
35
|
-
exports.fetchGuestThanx = (0, toolkit_1.createAsyncThunk)(GuestActionType.FetchGuestThanx, ({ email, callback }, { getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
+
exports.fetchGuestThanx = (0, toolkit_1.createAsyncThunk)(GuestActionType.FetchGuestThanx, ({ email, callback }, { getState, rejectWithValue, dispatch }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
36
37
|
const { api } = getState().config;
|
|
37
38
|
if (!api)
|
|
38
39
|
return;
|
|
@@ -40,6 +41,7 @@ exports.fetchGuestThanx = (0, toolkit_1.createAsyncThunk)(GuestActionType.FetchG
|
|
|
40
41
|
yield api.postThanxLogin(email, origin);
|
|
41
42
|
if (callback)
|
|
42
43
|
callback();
|
|
44
|
+
dispatch((0, order_1.addMessage)('Thanks! Please check your email on this device.'));
|
|
43
45
|
return { email: email };
|
|
44
46
|
}
|
|
45
47
|
catch (err) {
|
|
@@ -2,7 +2,7 @@ import { __awaiter } from "tslib";
|
|
|
2
2
|
import { createAsyncThunk, createSelector, createSlice } from '@reduxjs/toolkit';
|
|
3
3
|
import { ReducerType } from './types';
|
|
4
4
|
import { MISSING_CUSTOMER } from '@open-tender/types';
|
|
5
|
-
import { isoToDate, makeSimpleCart, rehydrateCart } from '@open-tender/utils';
|
|
5
|
+
import { currentLocalDate, isoToDate, makeSimpleCart, rehydrateCart } from '@open-tender/utils';
|
|
6
6
|
import { resetOrder, selectTimezone, setCart, setMenuVars } from './order';
|
|
7
7
|
import { checkAuth, makeCartData, selectToken } from './customer';
|
|
8
8
|
const initialState = {
|
|
@@ -229,7 +229,7 @@ export const selectGroupOrderClosed = createSelector((state) => {
|
|
|
229
229
|
return { cartGuest, cutoffAt, closed, tz };
|
|
230
230
|
}, ({ cartGuest, cutoffAt, closed, tz }) => {
|
|
231
231
|
const cutoffDate = cutoffAt ? isoToDate(cutoffAt, tz) : null;
|
|
232
|
-
const pastCutoff = cutoffDate ?
|
|
232
|
+
const pastCutoff = cutoffDate ? currentLocalDate(tz) > cutoffDate : false;
|
|
233
233
|
return cartGuest && (closed || pastCutoff);
|
|
234
234
|
});
|
|
235
235
|
export const selectGroupOrderTests = createSelector((state) => {
|
package/dist/esm/slices/guest.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
3
3
|
import { ReducerType } from './types';
|
|
4
|
+
import { addMessage } from './order';
|
|
4
5
|
const initialState = {
|
|
5
6
|
brands: null,
|
|
6
7
|
email: null,
|
|
@@ -28,7 +29,7 @@ export const fetchGuest = createAsyncThunk(GuestActionType.FetchGuest, ({ email,
|
|
|
28
29
|
return rejectWithValue(error);
|
|
29
30
|
}
|
|
30
31
|
}));
|
|
31
|
-
export const fetchGuestThanx = createAsyncThunk(GuestActionType.FetchGuestThanx, ({ email, callback }, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
|
+
export const fetchGuestThanx = createAsyncThunk(GuestActionType.FetchGuestThanx, ({ email, callback }, { getState, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
33
|
const { api } = getState().config;
|
|
33
34
|
if (!api)
|
|
34
35
|
return;
|
|
@@ -36,6 +37,7 @@ export const fetchGuestThanx = createAsyncThunk(GuestActionType.FetchGuestThanx,
|
|
|
36
37
|
yield api.postThanxLogin(email, origin);
|
|
37
38
|
if (callback)
|
|
38
39
|
callback();
|
|
40
|
+
dispatch(addMessage('Thanks! Please check your email on this device.'));
|
|
39
41
|
return { email: email };
|
|
40
42
|
}
|
|
41
43
|
catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/cloud",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.34",
|
|
4
4
|
"description": "A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our cloud-based Order API.",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -54,5 +54,6 @@
|
|
|
54
54
|
"@open-tender/utils": "^0.4.45",
|
|
55
55
|
"@reduxjs/toolkit": "^1.8.5",
|
|
56
56
|
"react": "^18.2.0"
|
|
57
|
-
}
|
|
57
|
+
},
|
|
58
|
+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
58
59
|
}
|