@open-tender/cloud 0.1.8 → 0.1.9
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/addresses.js +1 -3
- package/dist/cjs/slices/customer/communicationPreferences.js +2 -5
- package/dist/cjs/slices/customer/creditCards.js +2 -5
- package/dist/cjs/slices/customer/favorites.js +2 -4
- package/dist/cjs/slices/guest.d.ts +5 -11
- package/dist/cjs/slices/guest.js +9 -18
- package/dist/cjs/slices/resetPassword.js +2 -5
- package/dist/cjs/slices/signUp.js +1 -3
- package/dist/esm/slices/customer/addresses.js +1 -3
- package/dist/esm/slices/customer/communicationPreferences.js +2 -5
- package/dist/esm/slices/customer/creditCards.js +2 -5
- package/dist/esm/slices/customer/favorites.js +3 -5
- package/dist/esm/slices/guest.d.ts +5 -11
- package/dist/esm/slices/guest.js +9 -18
- package/dist/esm/slices/resetPassword.js +2 -5
- package/dist/esm/slices/signUp.js +1 -3
- package/package.json +1 -1
|
@@ -8,7 +8,6 @@ const types_1 = require("../types");
|
|
|
8
8
|
const types_2 = require("@open-tender/types");
|
|
9
9
|
const account_1 = require("./account");
|
|
10
10
|
const notifications_1 = require("../notifications");
|
|
11
|
-
const utils_1 = require("@open-tender/utils");
|
|
12
11
|
const initialState = {
|
|
13
12
|
entities: [],
|
|
14
13
|
lookup: {},
|
|
@@ -50,9 +49,8 @@ exports.updateCustomerAddress = (0, toolkit_1.createAsyncThunk)(CustomerAddresse
|
|
|
50
49
|
return addresses;
|
|
51
50
|
}
|
|
52
51
|
catch (err) {
|
|
53
|
-
const errors = (0, utils_1.makeFormErrors)(err);
|
|
54
52
|
const error = err;
|
|
55
|
-
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(
|
|
53
|
+
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(error));
|
|
56
54
|
}
|
|
57
55
|
}));
|
|
58
56
|
exports.removeCustomerAddress = (0, toolkit_1.createAsyncThunk)(CustomerAddressesActionType.RemoveCustomerAddress, (data, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -8,7 +8,6 @@ const types_1 = require("../types");
|
|
|
8
8
|
const types_2 = require("@open-tender/types");
|
|
9
9
|
const account_1 = require("./account");
|
|
10
10
|
const notifications_1 = require("../notifications");
|
|
11
|
-
const utils_1 = require("@open-tender/utils");
|
|
12
11
|
const initialState = {
|
|
13
12
|
entities: [],
|
|
14
13
|
lookup: {},
|
|
@@ -55,8 +54,7 @@ exports.addCustomerCommunicationPreference = (0, toolkit_1.createAsyncThunk)(Cus
|
|
|
55
54
|
}
|
|
56
55
|
catch (err) {
|
|
57
56
|
const error = err;
|
|
58
|
-
|
|
59
|
-
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(errors));
|
|
57
|
+
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(error));
|
|
60
58
|
}
|
|
61
59
|
}));
|
|
62
60
|
exports.removeCustomerCommunicationPreference = (0, toolkit_1.createAsyncThunk)(CustomerCommunicationPrefsActionType.RemoveCustomerCommunicationPreference, (requestData, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -91,8 +89,7 @@ exports.setCustomerCommunicationDefaultPreferences = (0, toolkit_1.createAsyncTh
|
|
|
91
89
|
}
|
|
92
90
|
catch (err) {
|
|
93
91
|
const error = err;
|
|
94
|
-
|
|
95
|
-
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(errors));
|
|
92
|
+
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(error));
|
|
96
93
|
}
|
|
97
94
|
}));
|
|
98
95
|
const customerCommunicationPrefsSlice = (0, toolkit_1.createSlice)({
|
|
@@ -8,7 +8,6 @@ const types_1 = require("../types");
|
|
|
8
8
|
const types_2 = require("@open-tender/types");
|
|
9
9
|
const account_1 = require("./account");
|
|
10
10
|
const notifications_1 = require("../notifications");
|
|
11
|
-
const utils_1 = require("@open-tender/utils");
|
|
12
11
|
const initialState = {
|
|
13
12
|
entities: [],
|
|
14
13
|
lookup: {},
|
|
@@ -52,8 +51,7 @@ exports.updateCustomerCreditCard = (0, toolkit_1.createAsyncThunk)(CustomerCredi
|
|
|
52
51
|
}
|
|
53
52
|
catch (err) {
|
|
54
53
|
const error = err;
|
|
55
|
-
|
|
56
|
-
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(errors));
|
|
54
|
+
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(error));
|
|
57
55
|
}
|
|
58
56
|
}));
|
|
59
57
|
exports.removeCustomerCreditCard = (0, toolkit_1.createAsyncThunk)(CustomerCreditCardsActionType.RemoveCustomerCreditCard, (requestData, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -91,8 +89,7 @@ exports.addCustomerCreditCard = (0, toolkit_1.createAsyncThunk)(CustomerCreditCa
|
|
|
91
89
|
}
|
|
92
90
|
catch (err) {
|
|
93
91
|
const error = err;
|
|
94
|
-
|
|
95
|
-
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(errors));
|
|
92
|
+
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(error));
|
|
96
93
|
}
|
|
97
94
|
}));
|
|
98
95
|
const customerCreditCardsSlice = (0, toolkit_1.createSlice)({
|
|
@@ -55,8 +55,7 @@ exports.updateCustomerFavorite = (0, toolkit_1.createAsyncThunk)(CustomerFavorit
|
|
|
55
55
|
}
|
|
56
56
|
catch (err) {
|
|
57
57
|
const error = err;
|
|
58
|
-
|
|
59
|
-
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(errors));
|
|
58
|
+
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(error));
|
|
60
59
|
}
|
|
61
60
|
}));
|
|
62
61
|
exports.removeCustomerFavorite = (0, toolkit_1.createAsyncThunk)(CustomerFavoritesActionType.RemoveCustomerFavorite, (requestData, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -95,8 +94,7 @@ exports.addCustomerFavorite = (0, toolkit_1.createAsyncThunk)(CustomerFavoritesA
|
|
|
95
94
|
}
|
|
96
95
|
catch (err) {
|
|
97
96
|
const error = err;
|
|
98
|
-
|
|
99
|
-
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(errors));
|
|
97
|
+
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(error));
|
|
100
98
|
}
|
|
101
99
|
}));
|
|
102
100
|
const customerFavoritesSlice = (0, toolkit_1.createSlice)({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AppState } from '../app';
|
|
2
|
-
import { Brands, RequestStatus } from '@open-tender/types';
|
|
2
|
+
import { Brands, RequestError, RequestStatus } from '@open-tender/types';
|
|
3
3
|
export interface GuestState {
|
|
4
4
|
brands: Brands | null;
|
|
5
|
-
|
|
5
|
+
email: string | null;
|
|
6
|
+
error: RequestError;
|
|
6
7
|
loading: RequestStatus;
|
|
7
|
-
email?: string | null;
|
|
8
8
|
showMagicLink: boolean;
|
|
9
9
|
}
|
|
10
10
|
export declare enum GuestActionType {
|
|
@@ -16,10 +16,7 @@ export declare const fetchGuest: import("@reduxjs/toolkit").AsyncThunk<Partial<G
|
|
|
16
16
|
callback?: (() => void) | undefined;
|
|
17
17
|
}, {
|
|
18
18
|
state: AppState;
|
|
19
|
-
rejectValue:
|
|
20
|
-
errors: any;
|
|
21
|
-
email: string;
|
|
22
|
-
};
|
|
19
|
+
rejectValue: RequestError;
|
|
23
20
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
24
21
|
extra?: unknown;
|
|
25
22
|
serializedErrorType?: unknown;
|
|
@@ -35,10 +32,7 @@ export declare const fetchGuestThanx: import("@reduxjs/toolkit").AsyncThunk<void
|
|
|
35
32
|
origin?: string | undefined;
|
|
36
33
|
}, {
|
|
37
34
|
state: AppState;
|
|
38
|
-
rejectValue:
|
|
39
|
-
errors: any;
|
|
40
|
-
email: string;
|
|
41
|
-
};
|
|
35
|
+
rejectValue: RequestError;
|
|
42
36
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
43
37
|
extra?: unknown;
|
|
44
38
|
serializedErrorType?: unknown;
|
package/dist/cjs/slices/guest.js
CHANGED
|
@@ -5,13 +5,12 @@ 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 utils_1 = require("@open-tender/utils");
|
|
9
8
|
const initialState = {
|
|
10
9
|
brands: null,
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
email: null,
|
|
11
|
+
error: null,
|
|
13
12
|
loading: 'idle',
|
|
14
|
-
|
|
13
|
+
showMagicLink: false
|
|
15
14
|
};
|
|
16
15
|
var GuestActionType;
|
|
17
16
|
(function (GuestActionType) {
|
|
@@ -29,11 +28,7 @@ exports.fetchGuest = (0, toolkit_1.createAsyncThunk)(GuestActionType.FetchGuest,
|
|
|
29
28
|
return response;
|
|
30
29
|
}
|
|
31
30
|
catch (err) {
|
|
32
|
-
|
|
33
|
-
if (errors.form && errors.form.includes('Unknown 500 error')) {
|
|
34
|
-
errors = { form: 'Invalid email address. Please try again.' };
|
|
35
|
-
}
|
|
36
|
-
return rejectWithValue({ errors, email: requestData.email });
|
|
31
|
+
return rejectWithValue(err);
|
|
37
32
|
}
|
|
38
33
|
}));
|
|
39
34
|
exports.fetchGuestThanx = (0, toolkit_1.createAsyncThunk)(GuestActionType.FetchGuestThanx, (requestData, { getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -47,8 +42,7 @@ exports.fetchGuestThanx = (0, toolkit_1.createAsyncThunk)(GuestActionType.FetchG
|
|
|
47
42
|
return { email: requestData.email };
|
|
48
43
|
}
|
|
49
44
|
catch (err) {
|
|
50
|
-
|
|
51
|
-
return rejectWithValue({ errors, email: requestData.email });
|
|
45
|
+
return rejectWithValue(err);
|
|
52
46
|
}
|
|
53
47
|
}));
|
|
54
48
|
const guestSlice = (0, toolkit_1.createSlice)({
|
|
@@ -57,7 +51,7 @@ const guestSlice = (0, toolkit_1.createSlice)({
|
|
|
57
51
|
reducers: {
|
|
58
52
|
resetGuest: () => initialState,
|
|
59
53
|
resetGuestErrors: state => {
|
|
60
|
-
state.
|
|
54
|
+
state.error = null;
|
|
61
55
|
state.loading = 'idle';
|
|
62
56
|
state.showMagicLink = false;
|
|
63
57
|
},
|
|
@@ -74,9 +68,8 @@ const guestSlice = (0, toolkit_1.createSlice)({
|
|
|
74
68
|
state.loading = 'pending';
|
|
75
69
|
})
|
|
76
70
|
.addCase(exports.fetchGuest.rejected, (state, action) => {
|
|
77
|
-
|
|
78
|
-
state.
|
|
79
|
-
state.email = (_b = action.payload) === null || _b === void 0 ? void 0 : _b.email;
|
|
71
|
+
state.error = action.payload;
|
|
72
|
+
// state.email = action.payload?.email
|
|
80
73
|
state.loading = 'idle';
|
|
81
74
|
state.brands = null;
|
|
82
75
|
})
|
|
@@ -87,9 +80,7 @@ const guestSlice = (0, toolkit_1.createSlice)({
|
|
|
87
80
|
state.loading = 'pending';
|
|
88
81
|
})
|
|
89
82
|
.addCase(exports.fetchGuestThanx.rejected, (state, action) => {
|
|
90
|
-
|
|
91
|
-
state.errors = (_a = action.payload) === null || _a === void 0 ? void 0 : _a.errors;
|
|
92
|
-
state.email = (_b = action.payload) === null || _b === void 0 ? void 0 : _b.email;
|
|
83
|
+
state.error = action.payload;
|
|
93
84
|
state.loading = 'idle';
|
|
94
85
|
state.showMagicLink = false;
|
|
95
86
|
state.brands = null;
|
|
@@ -4,7 +4,6 @@ exports.resetPasswordReducer = exports.selectResetPassword = exports.resetPasswo
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const types_1 = require("./types");
|
|
7
|
-
const utils_1 = require("@open-tender/utils");
|
|
8
7
|
const initialState = {
|
|
9
8
|
loading: 'idle',
|
|
10
9
|
error: null,
|
|
@@ -25,8 +24,7 @@ exports.sendPasswordResetEmail = (0, toolkit_1.createAsyncThunk)(ResetPasswordAc
|
|
|
25
24
|
return;
|
|
26
25
|
}
|
|
27
26
|
catch (err) {
|
|
28
|
-
|
|
29
|
-
return rejectWithValue(errors);
|
|
27
|
+
return rejectWithValue(err);
|
|
30
28
|
}
|
|
31
29
|
}));
|
|
32
30
|
exports.resetPassword = (0, toolkit_1.createAsyncThunk)(ResetPasswordActionType.ResetPassword, (requestData, { getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -38,8 +36,7 @@ exports.resetPassword = (0, toolkit_1.createAsyncThunk)(ResetPasswordActionType.
|
|
|
38
36
|
return;
|
|
39
37
|
}
|
|
40
38
|
catch (err) {
|
|
41
|
-
|
|
42
|
-
return rejectWithValue(errors);
|
|
39
|
+
return rejectWithValue(err);
|
|
43
40
|
}
|
|
44
41
|
}));
|
|
45
42
|
const resetPasswordSlice = (0, toolkit_1.createSlice)({
|
|
@@ -5,7 +5,6 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const types_1 = require("./types");
|
|
7
7
|
const customer_1 = require("./customer");
|
|
8
|
-
const utils_1 = require("@open-tender/utils");
|
|
9
8
|
const initialState = {
|
|
10
9
|
loading: 'idle',
|
|
11
10
|
error: null
|
|
@@ -28,8 +27,7 @@ exports.signUpCustomer = (0, toolkit_1.createAsyncThunk)(SignUpActionType.SignUp
|
|
|
28
27
|
return;
|
|
29
28
|
}
|
|
30
29
|
catch (err) {
|
|
31
|
-
|
|
32
|
-
return rejectWithValue(errors);
|
|
30
|
+
return rejectWithValue(err);
|
|
33
31
|
}
|
|
34
32
|
}));
|
|
35
33
|
const signUpSlice = (0, toolkit_1.createSlice)({
|
|
@@ -4,7 +4,6 @@ import { ReducerType } from '../types';
|
|
|
4
4
|
import { MISSING_CUSTOMER } from '@open-tender/types';
|
|
5
5
|
import { checkAuth, selectToken } from './account';
|
|
6
6
|
import { showNotification } from '../notifications';
|
|
7
|
-
import { makeFormErrors } from '@open-tender/utils';
|
|
8
7
|
const initialState = {
|
|
9
8
|
entities: [],
|
|
10
9
|
lookup: {},
|
|
@@ -46,9 +45,8 @@ export const updateCustomerAddress = createAsyncThunk(CustomerAddressesActionTyp
|
|
|
46
45
|
return addresses;
|
|
47
46
|
}
|
|
48
47
|
catch (err) {
|
|
49
|
-
const errors = makeFormErrors(err);
|
|
50
48
|
const error = err;
|
|
51
|
-
return checkAuth(error, dispatch, () => rejectWithValue(
|
|
49
|
+
return checkAuth(error, dispatch, () => rejectWithValue(error));
|
|
52
50
|
}
|
|
53
51
|
}));
|
|
54
52
|
export const removeCustomerAddress = createAsyncThunk(CustomerAddressesActionType.RemoveCustomerAddress, (data, { dispatch, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -4,7 +4,6 @@ import { ReducerType } from '../types';
|
|
|
4
4
|
import { MISSING_CUSTOMER } from '@open-tender/types';
|
|
5
5
|
import { checkAuth, selectToken } from './account';
|
|
6
6
|
import { showNotification } from '../notifications';
|
|
7
|
-
import { makeFormErrors } from '@open-tender/utils';
|
|
8
7
|
const initialState = {
|
|
9
8
|
entities: [],
|
|
10
9
|
lookup: {},
|
|
@@ -51,8 +50,7 @@ export const addCustomerCommunicationPreference = createAsyncThunk(CustomerCommu
|
|
|
51
50
|
}
|
|
52
51
|
catch (err) {
|
|
53
52
|
const error = err;
|
|
54
|
-
|
|
55
|
-
return checkAuth(error, dispatch, () => rejectWithValue(errors));
|
|
53
|
+
return checkAuth(error, dispatch, () => rejectWithValue(error));
|
|
56
54
|
}
|
|
57
55
|
}));
|
|
58
56
|
export const removeCustomerCommunicationPreference = createAsyncThunk(CustomerCommunicationPrefsActionType.RemoveCustomerCommunicationPreference, (requestData, { dispatch, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -87,8 +85,7 @@ export const setCustomerCommunicationDefaultPreferences = createAsyncThunk(Custo
|
|
|
87
85
|
}
|
|
88
86
|
catch (err) {
|
|
89
87
|
const error = err;
|
|
90
|
-
|
|
91
|
-
return checkAuth(error, dispatch, () => rejectWithValue(errors));
|
|
88
|
+
return checkAuth(error, dispatch, () => rejectWithValue(error));
|
|
92
89
|
}
|
|
93
90
|
}));
|
|
94
91
|
const customerCommunicationPrefsSlice = createSlice({
|
|
@@ -4,7 +4,6 @@ import { ReducerType } from '../types';
|
|
|
4
4
|
import { MISSING_CUSTOMER } from '@open-tender/types';
|
|
5
5
|
import { checkAuth, selectToken } from './account';
|
|
6
6
|
import { showNotification } from '../notifications';
|
|
7
|
-
import { makeFormErrors } from '@open-tender/utils';
|
|
8
7
|
const initialState = {
|
|
9
8
|
entities: [],
|
|
10
9
|
lookup: {},
|
|
@@ -48,8 +47,7 @@ export const updateCustomerCreditCard = createAsyncThunk(CustomerCreditCardsActi
|
|
|
48
47
|
}
|
|
49
48
|
catch (err) {
|
|
50
49
|
const error = err;
|
|
51
|
-
|
|
52
|
-
return checkAuth(error, dispatch, () => rejectWithValue(errors));
|
|
50
|
+
return checkAuth(error, dispatch, () => rejectWithValue(error));
|
|
53
51
|
}
|
|
54
52
|
}));
|
|
55
53
|
export const removeCustomerCreditCard = createAsyncThunk(CustomerCreditCardsActionType.RemoveCustomerCreditCard, (requestData, { dispatch, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -87,8 +85,7 @@ export const addCustomerCreditCard = createAsyncThunk(CustomerCreditCardsActionT
|
|
|
87
85
|
}
|
|
88
86
|
catch (err) {
|
|
89
87
|
const error = err;
|
|
90
|
-
|
|
91
|
-
return checkAuth(error, dispatch, () => rejectWithValue(errors));
|
|
88
|
+
return checkAuth(error, dispatch, () => rejectWithValue(error));
|
|
92
89
|
}
|
|
93
90
|
}));
|
|
94
91
|
const customerCreditCardsSlice = createSlice({
|
|
@@ -4,7 +4,7 @@ import { ReducerType } from '../types';
|
|
|
4
4
|
import { MISSING_CUSTOMER } from '@open-tender/types';
|
|
5
5
|
import { checkAuth, selectToken } from './account';
|
|
6
6
|
import { showNotification } from '../notifications';
|
|
7
|
-
import { makeFavoritesLookup
|
|
7
|
+
import { makeFavoritesLookup } from '@open-tender/utils';
|
|
8
8
|
const initialState = {
|
|
9
9
|
entities: [],
|
|
10
10
|
error: null,
|
|
@@ -51,8 +51,7 @@ export const updateCustomerFavorite = createAsyncThunk(CustomerFavoritesActionTy
|
|
|
51
51
|
}
|
|
52
52
|
catch (err) {
|
|
53
53
|
const error = err;
|
|
54
|
-
|
|
55
|
-
return checkAuth(error, dispatch, () => rejectWithValue(errors));
|
|
54
|
+
return checkAuth(error, dispatch, () => rejectWithValue(error));
|
|
56
55
|
}
|
|
57
56
|
}));
|
|
58
57
|
export const removeCustomerFavorite = createAsyncThunk(CustomerFavoritesActionType.RemoveCustomerFavorite, (requestData, { dispatch, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -91,8 +90,7 @@ export const addCustomerFavorite = createAsyncThunk(CustomerFavoritesActionType.
|
|
|
91
90
|
}
|
|
92
91
|
catch (err) {
|
|
93
92
|
const error = err;
|
|
94
|
-
|
|
95
|
-
return checkAuth(error, dispatch, () => rejectWithValue(errors));
|
|
93
|
+
return checkAuth(error, dispatch, () => rejectWithValue(error));
|
|
96
94
|
}
|
|
97
95
|
}));
|
|
98
96
|
const customerFavoritesSlice = createSlice({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AppState } from '../app';
|
|
2
|
-
import { Brands, RequestStatus } from '@open-tender/types';
|
|
2
|
+
import { Brands, RequestError, RequestStatus } from '@open-tender/types';
|
|
3
3
|
export interface GuestState {
|
|
4
4
|
brands: Brands | null;
|
|
5
|
-
|
|
5
|
+
email: string | null;
|
|
6
|
+
error: RequestError;
|
|
6
7
|
loading: RequestStatus;
|
|
7
|
-
email?: string | null;
|
|
8
8
|
showMagicLink: boolean;
|
|
9
9
|
}
|
|
10
10
|
export declare enum GuestActionType {
|
|
@@ -16,10 +16,7 @@ export declare const fetchGuest: import("@reduxjs/toolkit").AsyncThunk<Partial<G
|
|
|
16
16
|
callback?: (() => void) | undefined;
|
|
17
17
|
}, {
|
|
18
18
|
state: AppState;
|
|
19
|
-
rejectValue:
|
|
20
|
-
errors: any;
|
|
21
|
-
email: string;
|
|
22
|
-
};
|
|
19
|
+
rejectValue: RequestError;
|
|
23
20
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
24
21
|
extra?: unknown;
|
|
25
22
|
serializedErrorType?: unknown;
|
|
@@ -35,10 +32,7 @@ export declare const fetchGuestThanx: import("@reduxjs/toolkit").AsyncThunk<void
|
|
|
35
32
|
origin?: string | undefined;
|
|
36
33
|
}, {
|
|
37
34
|
state: AppState;
|
|
38
|
-
rejectValue:
|
|
39
|
-
errors: any;
|
|
40
|
-
email: string;
|
|
41
|
-
};
|
|
35
|
+
rejectValue: RequestError;
|
|
42
36
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
43
37
|
extra?: unknown;
|
|
44
38
|
serializedErrorType?: unknown;
|
package/dist/esm/slices/guest.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
3
3
|
import { ReducerType } from './types';
|
|
4
|
-
import { makeFormErrors } from '@open-tender/utils';
|
|
5
4
|
const initialState = {
|
|
6
5
|
brands: null,
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
email: null,
|
|
7
|
+
error: null,
|
|
9
8
|
loading: 'idle',
|
|
10
|
-
|
|
9
|
+
showMagicLink: false
|
|
11
10
|
};
|
|
12
11
|
export var GuestActionType;
|
|
13
12
|
(function (GuestActionType) {
|
|
@@ -25,11 +24,7 @@ export const fetchGuest = createAsyncThunk(GuestActionType.FetchGuest, (requestD
|
|
|
25
24
|
return response;
|
|
26
25
|
}
|
|
27
26
|
catch (err) {
|
|
28
|
-
|
|
29
|
-
if (errors.form && errors.form.includes('Unknown 500 error')) {
|
|
30
|
-
errors = { form: 'Invalid email address. Please try again.' };
|
|
31
|
-
}
|
|
32
|
-
return rejectWithValue({ errors, email: requestData.email });
|
|
27
|
+
return rejectWithValue(err);
|
|
33
28
|
}
|
|
34
29
|
}));
|
|
35
30
|
export const fetchGuestThanx = createAsyncThunk(GuestActionType.FetchGuestThanx, (requestData, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -43,8 +38,7 @@ export const fetchGuestThanx = createAsyncThunk(GuestActionType.FetchGuestThanx,
|
|
|
43
38
|
return { email: requestData.email };
|
|
44
39
|
}
|
|
45
40
|
catch (err) {
|
|
46
|
-
|
|
47
|
-
return rejectWithValue({ errors, email: requestData.email });
|
|
41
|
+
return rejectWithValue(err);
|
|
48
42
|
}
|
|
49
43
|
}));
|
|
50
44
|
const guestSlice = createSlice({
|
|
@@ -53,7 +47,7 @@ const guestSlice = createSlice({
|
|
|
53
47
|
reducers: {
|
|
54
48
|
resetGuest: () => initialState,
|
|
55
49
|
resetGuestErrors: state => {
|
|
56
|
-
state.
|
|
50
|
+
state.error = null;
|
|
57
51
|
state.loading = 'idle';
|
|
58
52
|
state.showMagicLink = false;
|
|
59
53
|
},
|
|
@@ -70,9 +64,8 @@ const guestSlice = createSlice({
|
|
|
70
64
|
state.loading = 'pending';
|
|
71
65
|
})
|
|
72
66
|
.addCase(fetchGuest.rejected, (state, action) => {
|
|
73
|
-
|
|
74
|
-
state.
|
|
75
|
-
state.email = (_b = action.payload) === null || _b === void 0 ? void 0 : _b.email;
|
|
67
|
+
state.error = action.payload;
|
|
68
|
+
// state.email = action.payload?.email
|
|
76
69
|
state.loading = 'idle';
|
|
77
70
|
state.brands = null;
|
|
78
71
|
})
|
|
@@ -83,9 +76,7 @@ const guestSlice = createSlice({
|
|
|
83
76
|
state.loading = 'pending';
|
|
84
77
|
})
|
|
85
78
|
.addCase(fetchGuestThanx.rejected, (state, action) => {
|
|
86
|
-
|
|
87
|
-
state.errors = (_a = action.payload) === null || _a === void 0 ? void 0 : _a.errors;
|
|
88
|
-
state.email = (_b = action.payload) === null || _b === void 0 ? void 0 : _b.email;
|
|
79
|
+
state.error = action.payload;
|
|
89
80
|
state.loading = 'idle';
|
|
90
81
|
state.showMagicLink = false;
|
|
91
82
|
state.brands = null;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
3
3
|
import { ReducerType } from './types';
|
|
4
|
-
import { makeFormErrors } from '@open-tender/utils';
|
|
5
4
|
const initialState = {
|
|
6
5
|
loading: 'idle',
|
|
7
6
|
error: null,
|
|
@@ -22,8 +21,7 @@ export const sendPasswordResetEmail = createAsyncThunk(ResetPasswordActionType.S
|
|
|
22
21
|
return;
|
|
23
22
|
}
|
|
24
23
|
catch (err) {
|
|
25
|
-
|
|
26
|
-
return rejectWithValue(errors);
|
|
24
|
+
return rejectWithValue(err);
|
|
27
25
|
}
|
|
28
26
|
}));
|
|
29
27
|
export const resetPassword = createAsyncThunk(ResetPasswordActionType.ResetPassword, (requestData, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -35,8 +33,7 @@ export const resetPassword = createAsyncThunk(ResetPasswordActionType.ResetPassw
|
|
|
35
33
|
return;
|
|
36
34
|
}
|
|
37
35
|
catch (err) {
|
|
38
|
-
|
|
39
|
-
return rejectWithValue(errors);
|
|
36
|
+
return rejectWithValue(err);
|
|
40
37
|
}
|
|
41
38
|
}));
|
|
42
39
|
const resetPasswordSlice = createSlice({
|
|
@@ -2,7 +2,6 @@ import { __awaiter } from "tslib";
|
|
|
2
2
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
3
3
|
import { ReducerType } from './types';
|
|
4
4
|
import { loginCustomer } from './customer';
|
|
5
|
-
import { makeFormErrors } from '@open-tender/utils';
|
|
6
5
|
const initialState = {
|
|
7
6
|
loading: 'idle',
|
|
8
7
|
error: null
|
|
@@ -25,8 +24,7 @@ export const signUpCustomer = createAsyncThunk(SignUpActionType.SignUpCustomer,
|
|
|
25
24
|
return;
|
|
26
25
|
}
|
|
27
26
|
catch (err) {
|
|
28
|
-
|
|
29
|
-
return rejectWithValue(errors);
|
|
27
|
+
return rejectWithValue(err);
|
|
30
28
|
}
|
|
31
29
|
}));
|
|
32
30
|
const signUpSlice = createSlice({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/cloud",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
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",
|