@open-tender/cloud 0.1.84 → 0.1.86

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.
@@ -1,5 +1,5 @@
1
1
  import { Dispatch } from '@reduxjs/toolkit';
2
- import { CheckoutCheck, CheckoutErrorMessages, CheckoutForm, Order, OrderCreate, RequestStatus } from '@open-tender/types';
2
+ import { CheckoutCheck, CheckoutErrorMessages, CheckoutForm, Order, OrderCreate, RecordInterface, RequestStatus } from '@open-tender/types';
3
3
  import { AppState } from '../app';
4
4
  export interface CheckoutState {
5
5
  check: CheckoutCheck | null;
@@ -21,7 +21,7 @@ export declare const validateOrder: import("@reduxjs/toolkit").AsyncThunk<{
21
21
  errors: any;
22
22
  }, OrderCreate | null | undefined, {
23
23
  state: AppState;
24
- rejectValue: CheckoutErrorMessages;
24
+ rejectValue: RecordInterface;
25
25
  dispatch?: Dispatch<import("redux").AnyAction> | undefined;
26
26
  extra?: unknown;
27
27
  serializedErrorType?: unknown;
@@ -137,7 +137,7 @@ exports.validateOrder = (0, toolkit_1.createAsyncThunk)(CheckoutActionType.Fetch
137
137
  return { check, errors };
138
138
  }
139
139
  catch (err) {
140
- const errors = (0, utils_1.handleCheckoutError)(err);
140
+ const errors = (0, utils_1.makeFormErrorsNested)(err);
141
141
  return rejectWithValue(errors);
142
142
  }
143
143
  }));
@@ -23,10 +23,80 @@ export declare const fetchCustomerLoyalty: import("@reduxjs/toolkit").AsyncThunk
23
23
  }>;
24
24
  export declare const resetCustomerLoyalty: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"loyalty/resetCustomerLoyalty">, resetCustomerLoyaltyError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"loyalty/resetCustomerLoyaltyError">, setCustomerLoyalty: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "loyalty/setCustomerLoyalty">;
25
25
  export declare const selectCustomerLoyalty: (state: AppState) => CustomerLoyaltyState;
26
- export declare const selectCustomerLoyaltyProgram: (state: AppState) => {
26
+ export declare const selectCustomerLoyaltyProgram: ((state: import("redux").EmptyObject & {
27
+ alerts: import("@open-tender/types").Alerts;
28
+ allergens: import("..").AllergensState;
29
+ announcements: import("..").AnnouncementsState;
30
+ checkout: import("..").CheckoutState;
31
+ completedOrders: import("..").CompletedOrdersState;
32
+ config: import("..").ConfigState;
33
+ confirmation: import("..").ConfirmationState;
34
+ customer: import("redux").CombinedState<{
35
+ account: import("./account").AccountState;
36
+ communicationPreferences: import("./communicationPreferences").CustomerCommunicationPrefsState;
37
+ creditCards: import("./creditCards").CustomerCreditCardsState;
38
+ allergens: import("./allergens").CustomerAllergensState;
39
+ addresses: import("./addresses").CustomerAddressesState;
40
+ favorites: import("./favorites").CustomerFavoritesState;
41
+ fcmToken: import("./fcmToken").CustomerFcmTokenState;
42
+ giftCards: import("./giftCards").CustomerGiftCardsState;
43
+ groupOrders: import("./groupOrders").CustomerGroupOrdersState;
44
+ houseAccounts: import("./houseAccounts").CustomerHouseAccountsState;
45
+ loyalty: CustomerLoyaltyState;
46
+ order: import("./order").CustomerOrderState;
47
+ orders: import("./orders").CustomerOrdersState;
48
+ pointsShop: import("./pointsShop").PointsShopState;
49
+ qrcode: import("./qrCode").CustomerQRCodeState;
50
+ rewards: import("./rewards").CustomerRewardsState;
51
+ thanx: import("./thanx").CustomerThanxState;
52
+ tpls: import("./tpls").CustomerTplsState;
53
+ }>;
54
+ deals: import("..").DealsState;
55
+ donations: import("..").DonationState;
56
+ geolocation: import("..").GeoLocationState;
57
+ giftCards: import("..").GiftCardsState;
58
+ groupOrder: import("..").GroupOrderState;
59
+ guest: import("..").GuestState;
60
+ loader: import("..").LoaderState;
61
+ menu: import("..").MenuState;
62
+ menuDisplay: import("..").MenuDisplayState;
63
+ menuItems: import("..").MenuItemsState;
64
+ modal: import("@open-tender/types").Modal;
65
+ misc: import("..").MiscState;
66
+ nav: import("..").NavState;
67
+ navSite: import("..").NavSiteState;
68
+ notifications: import("@open-tender/types").Notifications;
69
+ oneTimePasscode: import("..").OneTimePasscodeState;
70
+ order: import("..").OrderState;
71
+ orderFulfillment: import("..").OrderFulfillmentState;
72
+ orderRating: import("..").OrderRatingState;
73
+ posts: import("..").PostsSlice;
74
+ qr: import("..").QrState;
75
+ resetPassword: import("..").ResetPasswordState;
76
+ revenueCenters: import("..").RevenueCentersState;
77
+ sidebar: import("..").SidebarState;
78
+ sidebarModal: import("..").SidebarModalState;
79
+ signUp: import("..").SignUpState;
80
+ tags: import("..").TagsState;
81
+ terms: import("..").TermsSlice;
82
+ validTimes: import("..").ValidTimesState;
83
+ verifyAccount: import("..").VerifyAccountState;
84
+ }) => {
85
+ program: import("@open-tender/types").CustomerLoyalty | null;
86
+ loading: RequestStatus;
87
+ error: RequestError;
88
+ }) & import("reselect").OutputSelectorFields<(args_0: {
89
+ entities: CustomerLoyalties;
90
+ loading: RequestStatus;
91
+ error: RequestError;
92
+ }) => {
27
93
  program: import("@open-tender/types").CustomerLoyalty | null;
28
94
  loading: RequestStatus;
29
95
  error: RequestError;
96
+ }, {
97
+ clearCache: () => void;
98
+ }> & {
99
+ clearCache: () => void;
30
100
  };
31
101
  export declare const selectCustomerPointsProgram: (orderType: OrderType | null) => ((state: import("redux").EmptyObject & {
32
102
  alerts: import("@open-tender/types").Alerts;
@@ -64,14 +64,15 @@ const customerLoyaltySlice = (0, toolkit_1.createSlice)({
64
64
  _a = customerLoyaltySlice.actions, exports.resetCustomerLoyalty = _a.resetCustomerLoyalty, exports.resetCustomerLoyaltyError = _a.resetCustomerLoyaltyError, exports.setCustomerLoyalty = _a.setCustomerLoyalty;
65
65
  const selectCustomerLoyalty = (state) => state.customer.loyalty;
66
66
  exports.selectCustomerLoyalty = selectCustomerLoyalty;
67
- const selectCustomerLoyaltyProgram = (state) => {
67
+ exports.selectCustomerLoyaltyProgram = (0, toolkit_1.createSelector)((state) => {
68
68
  const { entities, loading, error } = state.customer.loyalty;
69
+ return { entities, loading, error };
70
+ }, ({ entities, loading, error }) => {
69
71
  const programs = entities.filter(i => (i.loyalty_type === 'CREDIT' || i.loyalty_type === 'POINTS') &&
70
72
  (i.spend.order_type === null || i.spend.order_type === 'OLO'));
71
73
  const program = programs.length ? programs[0] : null;
72
74
  return { program, loading, error };
73
- };
74
- exports.selectCustomerLoyaltyProgram = selectCustomerLoyaltyProgram;
75
+ });
75
76
  const selectCustomerPointsProgram = (orderType) => (0, toolkit_1.createSelector)((state) => {
76
77
  const { loyalty } = state.customer;
77
78
  return { loyalty };
@@ -1,5 +1,5 @@
1
1
  import { Dispatch } from '@reduxjs/toolkit';
2
- import { CheckoutCheck, CheckoutErrorMessages, CheckoutForm, Order, OrderCreate, RequestStatus } from '@open-tender/types';
2
+ import { CheckoutCheck, CheckoutErrorMessages, CheckoutForm, Order, OrderCreate, RecordInterface, RequestStatus } from '@open-tender/types';
3
3
  import { AppState } from '../app';
4
4
  export interface CheckoutState {
5
5
  check: CheckoutCheck | null;
@@ -21,7 +21,7 @@ export declare const validateOrder: import("@reduxjs/toolkit").AsyncThunk<{
21
21
  errors: any;
22
22
  }, OrderCreate | null | undefined, {
23
23
  state: AppState;
24
- rejectValue: CheckoutErrorMessages;
24
+ rejectValue: RecordInterface;
25
25
  dispatch?: Dispatch<import("redux").AnyAction> | undefined;
26
26
  extra?: unknown;
27
27
  serializedErrorType?: unknown;
@@ -1,6 +1,6 @@
1
1
  import { __awaiter } from "tslib";
2
2
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
3
- import { contains, handleCheckoutError, isEmpty, isString, makeCheckError, prepareOrder } from '@open-tender/utils';
3
+ import { contains, handleCheckoutError, isEmpty, isString, makeCheckError, makeFormErrorsNested, prepareOrder } from '@open-tender/utils';
4
4
  import { ReducerType } from './types';
5
5
  import { loginCustomer, selectToken } from './customer';
6
6
  import { fetchMenu } from './menu';
@@ -133,7 +133,7 @@ export const validateOrder = createAsyncThunk(CheckoutActionType.FetchCheckout,
133
133
  return { check, errors };
134
134
  }
135
135
  catch (err) {
136
- const errors = handleCheckoutError(err);
136
+ const errors = makeFormErrorsNested(err);
137
137
  return rejectWithValue(errors);
138
138
  }
139
139
  }));
@@ -23,10 +23,80 @@ export declare const fetchCustomerLoyalty: import("@reduxjs/toolkit").AsyncThunk
23
23
  }>;
24
24
  export declare const resetCustomerLoyalty: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"loyalty/resetCustomerLoyalty">, resetCustomerLoyaltyError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"loyalty/resetCustomerLoyaltyError">, setCustomerLoyalty: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "loyalty/setCustomerLoyalty">;
25
25
  export declare const selectCustomerLoyalty: (state: AppState) => CustomerLoyaltyState;
26
- export declare const selectCustomerLoyaltyProgram: (state: AppState) => {
26
+ export declare const selectCustomerLoyaltyProgram: ((state: import("redux").EmptyObject & {
27
+ alerts: import("@open-tender/types").Alerts;
28
+ allergens: import("..").AllergensState;
29
+ announcements: import("..").AnnouncementsState;
30
+ checkout: import("..").CheckoutState;
31
+ completedOrders: import("..").CompletedOrdersState;
32
+ config: import("..").ConfigState;
33
+ confirmation: import("..").ConfirmationState;
34
+ customer: import("redux").CombinedState<{
35
+ account: import("./account").AccountState;
36
+ communicationPreferences: import("./communicationPreferences").CustomerCommunicationPrefsState;
37
+ creditCards: import("./creditCards").CustomerCreditCardsState;
38
+ allergens: import("./allergens").CustomerAllergensState;
39
+ addresses: import("./addresses").CustomerAddressesState;
40
+ favorites: import("./favorites").CustomerFavoritesState;
41
+ fcmToken: import("./fcmToken").CustomerFcmTokenState;
42
+ giftCards: import("./giftCards").CustomerGiftCardsState;
43
+ groupOrders: import("./groupOrders").CustomerGroupOrdersState;
44
+ houseAccounts: import("./houseAccounts").CustomerHouseAccountsState;
45
+ loyalty: CustomerLoyaltyState;
46
+ order: import("./order").CustomerOrderState;
47
+ orders: import("./orders").CustomerOrdersState;
48
+ pointsShop: import("./pointsShop").PointsShopState;
49
+ qrcode: import("./qrCode").CustomerQRCodeState;
50
+ rewards: import("./rewards").CustomerRewardsState;
51
+ thanx: import("./thanx").CustomerThanxState;
52
+ tpls: import("./tpls").CustomerTplsState;
53
+ }>;
54
+ deals: import("..").DealsState;
55
+ donations: import("..").DonationState;
56
+ geolocation: import("..").GeoLocationState;
57
+ giftCards: import("..").GiftCardsState;
58
+ groupOrder: import("..").GroupOrderState;
59
+ guest: import("..").GuestState;
60
+ loader: import("..").LoaderState;
61
+ menu: import("..").MenuState;
62
+ menuDisplay: import("..").MenuDisplayState;
63
+ menuItems: import("..").MenuItemsState;
64
+ modal: import("@open-tender/types").Modal;
65
+ misc: import("..").MiscState;
66
+ nav: import("..").NavState;
67
+ navSite: import("..").NavSiteState;
68
+ notifications: import("@open-tender/types").Notifications;
69
+ oneTimePasscode: import("..").OneTimePasscodeState;
70
+ order: import("..").OrderState;
71
+ orderFulfillment: import("..").OrderFulfillmentState;
72
+ orderRating: import("..").OrderRatingState;
73
+ posts: import("..").PostsSlice;
74
+ qr: import("..").QrState;
75
+ resetPassword: import("..").ResetPasswordState;
76
+ revenueCenters: import("..").RevenueCentersState;
77
+ sidebar: import("..").SidebarState;
78
+ sidebarModal: import("..").SidebarModalState;
79
+ signUp: import("..").SignUpState;
80
+ tags: import("..").TagsState;
81
+ terms: import("..").TermsSlice;
82
+ validTimes: import("..").ValidTimesState;
83
+ verifyAccount: import("..").VerifyAccountState;
84
+ }) => {
85
+ program: import("@open-tender/types").CustomerLoyalty | null;
86
+ loading: RequestStatus;
87
+ error: RequestError;
88
+ }) & import("reselect").OutputSelectorFields<(args_0: {
89
+ entities: CustomerLoyalties;
90
+ loading: RequestStatus;
91
+ error: RequestError;
92
+ }) => {
27
93
  program: import("@open-tender/types").CustomerLoyalty | null;
28
94
  loading: RequestStatus;
29
95
  error: RequestError;
96
+ }, {
97
+ clearCache: () => void;
98
+ }> & {
99
+ clearCache: () => void;
30
100
  };
31
101
  export declare const selectCustomerPointsProgram: (orderType: OrderType | null) => ((state: import("redux").EmptyObject & {
32
102
  alerts: import("@open-tender/types").Alerts;
@@ -59,13 +59,15 @@ const customerLoyaltySlice = createSlice({
59
59
  });
60
60
  export const { resetCustomerLoyalty, resetCustomerLoyaltyError, setCustomerLoyalty } = customerLoyaltySlice.actions;
61
61
  export const selectCustomerLoyalty = (state) => state.customer.loyalty;
62
- export const selectCustomerLoyaltyProgram = (state) => {
62
+ export const selectCustomerLoyaltyProgram = createSelector((state) => {
63
63
  const { entities, loading, error } = state.customer.loyalty;
64
+ return { entities, loading, error };
65
+ }, ({ entities, loading, error }) => {
64
66
  const programs = entities.filter(i => (i.loyalty_type === 'CREDIT' || i.loyalty_type === 'POINTS') &&
65
67
  (i.spend.order_type === null || i.spend.order_type === 'OLO'));
66
68
  const program = programs.length ? programs[0] : null;
67
69
  return { program, loading, error };
68
- };
70
+ });
69
71
  export const selectCustomerPointsProgram = (orderType) => createSelector((state) => {
70
72
  const { loyalty } = state.customer;
71
73
  return { loyalty };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/cloud",
3
- "version": "0.1.84",
3
+ "version": "0.1.86",
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",
@@ -49,12 +49,9 @@
49
49
  "typescript": "^4.8.2"
50
50
  },
51
51
  "peerDependencies": {
52
- "@open-tender/types": "^0.2.59",
53
- "@open-tender/utils": "^0.1.138",
52
+ "@open-tender/types": "^0.2.78",
53
+ "@open-tender/utils": "^0.1.144",
54
54
  "@reduxjs/toolkit": "^1.8.5",
55
55
  "react": "^18.2.0"
56
- },
57
- "dependencies": {
58
- "@open-tender/types": "^0.2.77"
59
56
  }
60
57
  }