@open-tender/cloud 0.1.94 → 0.1.95

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.
@@ -11,7 +11,6 @@ export interface CheckoutState {
11
11
  loading: RequestStatus;
12
12
  }
13
13
  export declare enum CheckoutActionType {
14
- FetchCheckout = "checkout/fetchCheckout",
15
14
  ValidateOrder = "checkout/validateOrder",
16
15
  SubmitOrder = "checkout/SubmitOrder",
17
16
  SubmitOrderPay = "checkout/SubmitOrderPay"
@@ -30,7 +30,6 @@ const initialState = {
30
30
  };
31
31
  var CheckoutActionType;
32
32
  (function (CheckoutActionType) {
33
- CheckoutActionType["FetchCheckout"] = "checkout/fetchCheckout";
34
33
  CheckoutActionType["ValidateOrder"] = "checkout/validateOrder";
35
34
  CheckoutActionType["SubmitOrder"] = "checkout/SubmitOrder";
36
35
  CheckoutActionType["SubmitOrderPay"] = "checkout/SubmitOrderPay";
@@ -99,7 +98,7 @@ const handleOrderErrors = (err, preparedOrder, dispatch) => {
99
98
  return errors;
100
99
  }
101
100
  };
102
- exports.validateOrder = (0, toolkit_1.createAsyncThunk)(CheckoutActionType.FetchCheckout, (order, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
101
+ exports.validateOrder = (0, toolkit_1.createAsyncThunk)(CheckoutActionType.ValidateOrder, (order, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
103
102
  try {
104
103
  const { api } = getState().config;
105
104
  const token = (0, customer_1.selectToken)(getState());
@@ -157,7 +157,7 @@ export declare const selectCustomerPointsProgram: (orderType: OrderType | null)
157
157
  validTimes: import("..").ValidTimesState;
158
158
  verifyAccount: import("..").VerifyAccountState;
159
159
  }) => import("@open-tender/types").CustomerLoyalty | null) & import("reselect").OutputSelectorFields<(args_0: {
160
- loyalty: CustomerLoyaltyState;
160
+ loyaltyPrograms: CustomerLoyalties;
161
161
  }) => import("@open-tender/types").CustomerLoyalty | null, {
162
162
  clearCache: () => void;
163
163
  }> & {
@@ -75,11 +75,12 @@ exports.selectCustomerLoyaltyProgram = (0, toolkit_1.createSelector)((state) =>
75
75
  });
76
76
  const selectCustomerPointsProgram = (orderType) => (0, toolkit_1.createSelector)((state) => {
77
77
  const { loyalty } = state.customer;
78
- return { loyalty };
79
- }, ({ loyalty }) => {
80
- if (!loyalty)
78
+ const { entities: loyaltyPrograms } = loyalty;
79
+ return { loyaltyPrograms };
80
+ }, ({ loyaltyPrograms }) => {
81
+ if (!loyaltyPrograms)
81
82
  return null;
82
- const programs = loyalty.entities.filter(i => i.loyalty_type === 'POINTS' &&
83
+ const programs = loyaltyPrograms.filter(i => i.loyalty_type === 'POINTS' &&
83
84
  (i.spend.order_type === null || i.spend.order_type === orderType));
84
85
  return programs.length ? programs[0] : null;
85
86
  });
@@ -11,7 +11,6 @@ export interface CheckoutState {
11
11
  loading: RequestStatus;
12
12
  }
13
13
  export declare enum CheckoutActionType {
14
- FetchCheckout = "checkout/fetchCheckout",
15
14
  ValidateOrder = "checkout/validateOrder",
16
15
  SubmitOrder = "checkout/SubmitOrder",
17
16
  SubmitOrderPay = "checkout/SubmitOrderPay"
@@ -26,7 +26,6 @@ const initialState = {
26
26
  };
27
27
  export var CheckoutActionType;
28
28
  (function (CheckoutActionType) {
29
- CheckoutActionType["FetchCheckout"] = "checkout/fetchCheckout";
30
29
  CheckoutActionType["ValidateOrder"] = "checkout/validateOrder";
31
30
  CheckoutActionType["SubmitOrder"] = "checkout/SubmitOrder";
32
31
  CheckoutActionType["SubmitOrderPay"] = "checkout/SubmitOrderPay";
@@ -95,7 +94,7 @@ const handleOrderErrors = (err, preparedOrder, dispatch) => {
95
94
  return errors;
96
95
  }
97
96
  };
98
- export const validateOrder = createAsyncThunk(CheckoutActionType.FetchCheckout, (order, { dispatch, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
97
+ export const validateOrder = createAsyncThunk(CheckoutActionType.ValidateOrder, (order, { dispatch, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
99
98
  try {
100
99
  const { api } = getState().config;
101
100
  const token = selectToken(getState());
@@ -157,7 +157,7 @@ export declare const selectCustomerPointsProgram: (orderType: OrderType | null)
157
157
  validTimes: import("..").ValidTimesState;
158
158
  verifyAccount: import("..").VerifyAccountState;
159
159
  }) => import("@open-tender/types").CustomerLoyalty | null) & import("reselect").OutputSelectorFields<(args_0: {
160
- loyalty: CustomerLoyaltyState;
160
+ loyaltyPrograms: CustomerLoyalties;
161
161
  }) => import("@open-tender/types").CustomerLoyalty | null, {
162
162
  clearCache: () => void;
163
163
  }> & {
@@ -70,11 +70,12 @@ export const selectCustomerLoyaltyProgram = createSelector((state) => {
70
70
  });
71
71
  export const selectCustomerPointsProgram = (orderType) => createSelector((state) => {
72
72
  const { loyalty } = state.customer;
73
- return { loyalty };
74
- }, ({ loyalty }) => {
75
- if (!loyalty)
73
+ const { entities: loyaltyPrograms } = loyalty;
74
+ return { loyaltyPrograms };
75
+ }, ({ loyaltyPrograms }) => {
76
+ if (!loyaltyPrograms)
76
77
  return null;
77
- const programs = loyalty.entities.filter(i => i.loyalty_type === 'POINTS' &&
78
+ const programs = loyaltyPrograms.filter(i => i.loyalty_type === 'POINTS' &&
78
79
  (i.spend.order_type === null || i.spend.order_type === orderType));
79
80
  return programs.length ? programs[0] : null;
80
81
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/cloud",
3
- "version": "0.1.94",
3
+ "version": "0.1.95",
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",