@open-tender/cloud 0.1.79 → 0.1.81
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/slices/customer/favorites.d.ts +2 -2
- package/dist/cjs/slices/customer/favorites.js +2 -2
- package/dist/cjs/slices/signUp.js +4 -5
- package/dist/esm/slices/customer/favorites.d.ts +2 -2
- package/dist/esm/slices/customer/favorites.js +2 -2
- package/dist/esm/slices/signUp.js +4 -5
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AppState } from '../../app';
|
|
2
|
-
import { Favorite, Favorites, FavoritesLookup, RequestError, RequestStatus,
|
|
2
|
+
import { Favorite, Favorites, FavoritesLookup, RequestError, RequestStatus, SimpleCartItem } from '@open-tender/types';
|
|
3
3
|
export interface CustomerFavoritesState {
|
|
4
4
|
entities: Favorites;
|
|
5
5
|
error: RequestError;
|
|
@@ -50,7 +50,7 @@ export declare const removeCustomerFavorite: import("@reduxjs/toolkit").AsyncThu
|
|
|
50
50
|
rejectedMeta?: unknown;
|
|
51
51
|
}>;
|
|
52
52
|
export declare const addCustomerFavorite: import("@reduxjs/toolkit").AsyncThunk<Favorites, {
|
|
53
|
-
|
|
53
|
+
item: SimpleCartItem;
|
|
54
54
|
name?: string | undefined;
|
|
55
55
|
callback?: (() => void) | undefined;
|
|
56
56
|
}, {
|
|
@@ -77,13 +77,13 @@ exports.removeCustomerFavorite = (0, toolkit_1.createAsyncThunk)(CustomerFavorit
|
|
|
77
77
|
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(error));
|
|
78
78
|
}
|
|
79
79
|
}));
|
|
80
|
-
exports.addCustomerFavorite = (0, toolkit_1.createAsyncThunk)(CustomerFavoritesActionType.AddCustomerFavorite, ({
|
|
80
|
+
exports.addCustomerFavorite = (0, toolkit_1.createAsyncThunk)(CustomerFavoritesActionType.AddCustomerFavorite, ({ item, name, callback }, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
81
81
|
try {
|
|
82
82
|
const api = getState().config.api;
|
|
83
83
|
const token = (0, account_1.selectToken)(getState());
|
|
84
84
|
if (!token)
|
|
85
85
|
throw new Error(types_2.MISSING_CUSTOMER);
|
|
86
|
-
const data = { cart, name: name || '' };
|
|
86
|
+
const data = { cart: item, name: name || '' };
|
|
87
87
|
yield api.postCustomerFavorite(token, data);
|
|
88
88
|
const { data: favorites } = yield api.getCustomerFavorites(token);
|
|
89
89
|
const lookup = (0, utils_1.makeFavoritesLookup)(favorites);
|
|
@@ -14,14 +14,13 @@ var SignUpActionType;
|
|
|
14
14
|
SignUpActionType["SignUpCustomer"] = "signUp/signUpCustomer";
|
|
15
15
|
})(SignUpActionType = exports.SignUpActionType || (exports.SignUpActionType = {}));
|
|
16
16
|
exports.signUpCustomer = (0, toolkit_1.createAsyncThunk)(SignUpActionType.SignUpCustomer, ({ data, callback }, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
-
var _a, _b;
|
|
18
17
|
try {
|
|
19
18
|
const api = getState().config.api;
|
|
20
19
|
const response = yield api.postSignUp(data);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
20
|
+
const { email, password } = data;
|
|
21
|
+
if (email && password) {
|
|
22
|
+
dispatch((0, customer_1.loginCustomer)({ email, password }));
|
|
23
|
+
}
|
|
25
24
|
if (callback)
|
|
26
25
|
callback(response);
|
|
27
26
|
return;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AppState } from '../../app';
|
|
2
|
-
import { Favorite, Favorites, FavoritesLookup, RequestError, RequestStatus,
|
|
2
|
+
import { Favorite, Favorites, FavoritesLookup, RequestError, RequestStatus, SimpleCartItem } from '@open-tender/types';
|
|
3
3
|
export interface CustomerFavoritesState {
|
|
4
4
|
entities: Favorites;
|
|
5
5
|
error: RequestError;
|
|
@@ -50,7 +50,7 @@ export declare const removeCustomerFavorite: import("@reduxjs/toolkit").AsyncThu
|
|
|
50
50
|
rejectedMeta?: unknown;
|
|
51
51
|
}>;
|
|
52
52
|
export declare const addCustomerFavorite: import("@reduxjs/toolkit").AsyncThunk<Favorites, {
|
|
53
|
-
|
|
53
|
+
item: SimpleCartItem;
|
|
54
54
|
name?: string | undefined;
|
|
55
55
|
callback?: (() => void) | undefined;
|
|
56
56
|
}, {
|
|
@@ -73,13 +73,13 @@ export const removeCustomerFavorite = createAsyncThunk(CustomerFavoritesActionTy
|
|
|
73
73
|
return checkAuth(error, dispatch, () => rejectWithValue(error));
|
|
74
74
|
}
|
|
75
75
|
}));
|
|
76
|
-
export const addCustomerFavorite = createAsyncThunk(CustomerFavoritesActionType.AddCustomerFavorite, ({
|
|
76
|
+
export const addCustomerFavorite = createAsyncThunk(CustomerFavoritesActionType.AddCustomerFavorite, ({ item, name, callback }, { dispatch, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
77
77
|
try {
|
|
78
78
|
const api = getState().config.api;
|
|
79
79
|
const token = selectToken(getState());
|
|
80
80
|
if (!token)
|
|
81
81
|
throw new Error(MISSING_CUSTOMER);
|
|
82
|
-
const data = { cart, name: name || '' };
|
|
82
|
+
const data = { cart: item, name: name || '' };
|
|
83
83
|
yield api.postCustomerFavorite(token, data);
|
|
84
84
|
const { data: favorites } = yield api.getCustomerFavorites(token);
|
|
85
85
|
const lookup = makeFavoritesLookup(favorites);
|
|
@@ -11,14 +11,13 @@ export var SignUpActionType;
|
|
|
11
11
|
SignUpActionType["SignUpCustomer"] = "signUp/signUpCustomer";
|
|
12
12
|
})(SignUpActionType || (SignUpActionType = {}));
|
|
13
13
|
export const signUpCustomer = createAsyncThunk(SignUpActionType.SignUpCustomer, ({ data, callback }, { dispatch, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
-
var _a, _b;
|
|
15
14
|
try {
|
|
16
15
|
const api = getState().config.api;
|
|
17
16
|
const response = yield api.postSignUp(data);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
17
|
+
const { email, password } = data;
|
|
18
|
+
if (email && password) {
|
|
19
|
+
dispatch(loginCustomer({ email, password }));
|
|
20
|
+
}
|
|
22
21
|
if (callback)
|
|
23
22
|
callback(response);
|
|
24
23
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/cloud",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.81",
|
|
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",
|