@open-tender/cloud 0.4.33 → 0.4.35

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.
@@ -20,7 +20,8 @@ const initialState = {
20
20
  promoCodes: [],
21
21
  surcharges: [],
22
22
  tenders: [],
23
- tip: null
23
+ tip: null,
24
+ token: null
24
25
  },
25
26
  submitting: false,
26
27
  isGuest: false,
@@ -41,7 +42,7 @@ const assembleOrder = (orderData, save = false) => {
41
42
  if (!revenueCenterId || !serviceType || !requestedAt || !cart)
42
43
  return null;
43
44
  const { form, check } = checkout;
44
- const { customer, address, details, surcharges, discounts, promoCodes, points, tenders, tip } = form;
45
+ const { customer, address, details, surcharges, discounts, promoCodes, points, tenders, tip, token } = form;
45
46
  const { deposit = null } = check || {};
46
47
  // const defaultTip = check ? getDefaultTip(check.config) : null
47
48
  const fullAddress = Object.assign(Object.assign({}, order.address), address);
@@ -65,7 +66,8 @@ const assembleOrder = (orderData, save = false) => {
65
66
  table,
66
67
  tenders,
67
68
  tip,
68
- save
69
+ save,
70
+ token
69
71
  };
70
72
  const preparedOrder = (0, utils_1.prepareOrder)(data);
71
73
  return preparedOrder;
@@ -70,6 +70,7 @@ export declare const selectAccountConfig: (state: AppState) => {
70
70
  skip: string;
71
71
  };
72
72
  mobile: string;
73
+ pointsShop: import("@open-tender/types").ConfigContentField;
73
74
  profile: import("@open-tender/types").ConfigContentField;
74
75
  punctuation: string;
75
76
  recentItems: import("@open-tender/types").ConfigContentField;
@@ -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 ? new Date() > cutoffDate : false;
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) => {
@@ -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) {
@@ -16,7 +16,8 @@ const initialState = {
16
16
  promoCodes: [],
17
17
  surcharges: [],
18
18
  tenders: [],
19
- tip: null
19
+ tip: null,
20
+ token: null
20
21
  },
21
22
  submitting: false,
22
23
  isGuest: false,
@@ -37,7 +38,7 @@ const assembleOrder = (orderData, save = false) => {
37
38
  if (!revenueCenterId || !serviceType || !requestedAt || !cart)
38
39
  return null;
39
40
  const { form, check } = checkout;
40
- const { customer, address, details, surcharges, discounts, promoCodes, points, tenders, tip } = form;
41
+ const { customer, address, details, surcharges, discounts, promoCodes, points, tenders, tip, token } = form;
41
42
  const { deposit = null } = check || {};
42
43
  // const defaultTip = check ? getDefaultTip(check.config) : null
43
44
  const fullAddress = Object.assign(Object.assign({}, order.address), address);
@@ -61,7 +62,8 @@ const assembleOrder = (orderData, save = false) => {
61
62
  table,
62
63
  tenders,
63
64
  tip,
64
- save
65
+ save,
66
+ token
65
67
  };
66
68
  const preparedOrder = prepareOrder(data);
67
69
  return preparedOrder;
@@ -70,6 +70,7 @@ export declare const selectAccountConfig: (state: AppState) => {
70
70
  skip: string;
71
71
  };
72
72
  mobile: string;
73
+ pointsShop: import("@open-tender/types").ConfigContentField;
73
74
  profile: import("@open-tender/types").ConfigContentField;
74
75
  punctuation: string;
75
76
  recentItems: import("@open-tender/types").ConfigContentField;
@@ -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 ? new Date() > cutoffDate : false;
232
+ const pastCutoff = cutoffDate ? currentLocalDate(tz) > cutoffDate : false;
233
233
  return cartGuest && (closed || pastCutoff);
234
234
  });
235
235
  export const selectGroupOrderTests = createSelector((state) => {
@@ -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.33",
3
+ "version": "0.4.35",
4
4
  "description": "A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our cloud-based Order API.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -34,6 +34,8 @@
34
34
  "private": false,
35
35
  "devDependencies": {
36
36
  "@babel/core": "^7.19.1",
37
+ "@open-tender/types": "^0.4.94",
38
+ "@open-tender/utils": "^0.4.68",
37
39
  "@reduxjs/toolkit": "^1.8.5",
38
40
  "@types/react": "^18.0.18",
39
41
  "@types/react-dom": "^18.0.6",
@@ -50,9 +52,10 @@
50
52
  "typescript": "^4.8.2"
51
53
  },
52
54
  "peerDependencies": {
53
- "@open-tender/types": "^0.4.70",
54
- "@open-tender/utils": "^0.4.45",
55
+ "@open-tender/types": "^0.4.94",
56
+ "@open-tender/utils": "^0.4.68",
55
57
  "@reduxjs/toolkit": "^1.8.5",
56
58
  "react": "^18.2.0"
57
- }
59
+ },
60
+ "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
58
61
  }