@open-tender/cloud 0.1.17 → 0.1.19
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/account.d.ts +0 -1
- package/dist/cjs/slices/customer/account.js +4 -6
- package/dist/cjs/slices/guest.d.ts +8 -2
- package/dist/cjs/slices/guest.js +6 -10
- package/dist/esm/slices/customer/account.d.ts +0 -1
- package/dist/esm/slices/customer/account.js +4 -6
- package/dist/esm/slices/guest.d.ts +8 -2
- package/dist/esm/slices/guest.js +6 -10
- package/package.json +1 -1
|
@@ -82,7 +82,6 @@ export declare const sendCustomerVerificationEmail: import("@reduxjs/toolkit").A
|
|
|
82
82
|
}>;
|
|
83
83
|
export declare const loginCustomerThanx: import("@reduxjs/toolkit").AsyncThunk<null, {
|
|
84
84
|
email: string;
|
|
85
|
-
origin: any;
|
|
86
85
|
}, {
|
|
87
86
|
state: AppState;
|
|
88
87
|
rejectValue: RequestError;
|
|
@@ -77,12 +77,10 @@ exports.fetchCustomer = (0, toolkit_1.createAsyncThunk)(AccountActionType.FetchC
|
|
|
77
77
|
return (0, exports.checkAuth)(error, dispatch, () => rejectWithValue(error));
|
|
78
78
|
}
|
|
79
79
|
}));
|
|
80
|
-
exports.loginCustomer = (0, toolkit_1.createAsyncThunk)(AccountActionType.LoginCustomer, (
|
|
80
|
+
exports.loginCustomer = (0, toolkit_1.createAsyncThunk)(AccountActionType.LoginCustomer, ({ email, password }, { getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
81
81
|
try {
|
|
82
|
-
const { email, password } = data;
|
|
83
82
|
const api = getState().config.api;
|
|
84
|
-
|
|
85
|
-
return auth;
|
|
83
|
+
return yield api.postLogin(email, password);
|
|
86
84
|
}
|
|
87
85
|
catch (err) {
|
|
88
86
|
return rejectWithValue(err);
|
|
@@ -173,10 +171,10 @@ exports.sendCustomerVerificationEmail = (0, toolkit_1.createAsyncThunk)(AccountA
|
|
|
173
171
|
return rejectWithValue(err);
|
|
174
172
|
}
|
|
175
173
|
}));
|
|
176
|
-
exports.loginCustomerThanx = (0, toolkit_1.createAsyncThunk)(AccountActionType.LoginCustomer, (
|
|
174
|
+
exports.loginCustomerThanx = (0, toolkit_1.createAsyncThunk)(AccountActionType.LoginCustomer, ({ email }, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
177
175
|
try {
|
|
178
176
|
const api = getState().config.api;
|
|
179
|
-
yield api.postThanxLogin(
|
|
177
|
+
yield api.postThanxLogin(email);
|
|
180
178
|
dispatch((0, order_2.setAlert)({ type: 'close' }));
|
|
181
179
|
dispatch((0, order_2.addMessage)('Thanks! Please check your email on this device.'));
|
|
182
180
|
return null;
|
|
@@ -16,7 +16,10 @@ export declare const fetchGuest: import("@reduxjs/toolkit").AsyncThunk<Partial<G
|
|
|
16
16
|
callback?: (() => void) | undefined;
|
|
17
17
|
}, {
|
|
18
18
|
state: AppState;
|
|
19
|
-
rejectValue:
|
|
19
|
+
rejectValue: {
|
|
20
|
+
error: RequestError;
|
|
21
|
+
email: string;
|
|
22
|
+
};
|
|
20
23
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
21
24
|
extra?: unknown;
|
|
22
25
|
serializedErrorType?: unknown;
|
|
@@ -31,7 +34,10 @@ export declare const fetchGuestThanx: import("@reduxjs/toolkit").AsyncThunk<void
|
|
|
31
34
|
callback?: (() => void) | null | undefined;
|
|
32
35
|
}, {
|
|
33
36
|
state: AppState;
|
|
34
|
-
rejectValue:
|
|
37
|
+
rejectValue: {
|
|
38
|
+
error: RequestError;
|
|
39
|
+
email: string;
|
|
40
|
+
};
|
|
35
41
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
36
42
|
extra?: unknown;
|
|
37
43
|
serializedErrorType?: unknown;
|
package/dist/cjs/slices/guest.js
CHANGED
|
@@ -28,7 +28,8 @@ exports.fetchGuest = (0, toolkit_1.createAsyncThunk)(GuestActionType.FetchGuest,
|
|
|
28
28
|
return response;
|
|
29
29
|
}
|
|
30
30
|
catch (err) {
|
|
31
|
-
|
|
31
|
+
const error = { error: err, email };
|
|
32
|
+
return rejectWithValue(error);
|
|
32
33
|
}
|
|
33
34
|
}));
|
|
34
35
|
exports.fetchGuestThanx = (0, toolkit_1.createAsyncThunk)(GuestActionType.FetchGuestThanx, ({ email, callback }, { getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -42,7 +43,8 @@ exports.fetchGuestThanx = (0, toolkit_1.createAsyncThunk)(GuestActionType.FetchG
|
|
|
42
43
|
return { email: email };
|
|
43
44
|
}
|
|
44
45
|
catch (err) {
|
|
45
|
-
|
|
46
|
+
const error = { error: err, email };
|
|
47
|
+
return rejectWithValue(error);
|
|
46
48
|
}
|
|
47
49
|
}));
|
|
48
50
|
const guestSlice = (0, toolkit_1.createSlice)({
|
|
@@ -68,10 +70,7 @@ const guestSlice = (0, toolkit_1.createSlice)({
|
|
|
68
70
|
state.loading = 'pending';
|
|
69
71
|
})
|
|
70
72
|
.addCase(exports.fetchGuest.rejected, (state, action) => {
|
|
71
|
-
|
|
72
|
-
// state.email = action.payload?.email
|
|
73
|
-
state.loading = 'idle';
|
|
74
|
-
state.brands = null;
|
|
73
|
+
return Object.assign(Object.assign(Object.assign({}, state), { loading: 'idle', brands: null }), action.payload);
|
|
75
74
|
})
|
|
76
75
|
.addCase(exports.fetchGuestThanx.fulfilled, (state, action) => {
|
|
77
76
|
return Object.assign(Object.assign(Object.assign({}, state), { loading: 'idle', errors: null, showMagicLink: true }), action.payload);
|
|
@@ -80,10 +79,7 @@ const guestSlice = (0, toolkit_1.createSlice)({
|
|
|
80
79
|
state.loading = 'pending';
|
|
81
80
|
})
|
|
82
81
|
.addCase(exports.fetchGuestThanx.rejected, (state, action) => {
|
|
83
|
-
|
|
84
|
-
state.loading = 'idle';
|
|
85
|
-
state.showMagicLink = false;
|
|
86
|
-
state.brands = null;
|
|
82
|
+
return Object.assign(Object.assign(Object.assign({}, state), { loading: 'idle', showMagicLink: false, brands: null }), action.payload);
|
|
87
83
|
});
|
|
88
84
|
}
|
|
89
85
|
});
|
|
@@ -82,7 +82,6 @@ export declare const sendCustomerVerificationEmail: import("@reduxjs/toolkit").A
|
|
|
82
82
|
}>;
|
|
83
83
|
export declare const loginCustomerThanx: import("@reduxjs/toolkit").AsyncThunk<null, {
|
|
84
84
|
email: string;
|
|
85
|
-
origin: any;
|
|
86
85
|
}, {
|
|
87
86
|
state: AppState;
|
|
88
87
|
rejectValue: RequestError;
|
|
@@ -72,12 +72,10 @@ export const fetchCustomer = createAsyncThunk(AccountActionType.FetchCustomer,
|
|
|
72
72
|
return checkAuth(error, dispatch, () => rejectWithValue(error));
|
|
73
73
|
}
|
|
74
74
|
}));
|
|
75
|
-
export const loginCustomer = createAsyncThunk(AccountActionType.LoginCustomer, (
|
|
75
|
+
export const loginCustomer = createAsyncThunk(AccountActionType.LoginCustomer, ({ email, password }, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
76
76
|
try {
|
|
77
|
-
const { email, password } = data;
|
|
78
77
|
const api = getState().config.api;
|
|
79
|
-
|
|
80
|
-
return auth;
|
|
78
|
+
return yield api.postLogin(email, password);
|
|
81
79
|
}
|
|
82
80
|
catch (err) {
|
|
83
81
|
return rejectWithValue(err);
|
|
@@ -168,10 +166,10 @@ export const sendCustomerVerificationEmail = createAsyncThunk(AccountActionType.
|
|
|
168
166
|
return rejectWithValue(err);
|
|
169
167
|
}
|
|
170
168
|
}));
|
|
171
|
-
export const loginCustomerThanx = createAsyncThunk(AccountActionType.LoginCustomer, (
|
|
169
|
+
export const loginCustomerThanx = createAsyncThunk(AccountActionType.LoginCustomer, ({ email }, { dispatch, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
172
170
|
try {
|
|
173
171
|
const api = getState().config.api;
|
|
174
|
-
yield api.postThanxLogin(
|
|
172
|
+
yield api.postThanxLogin(email);
|
|
175
173
|
dispatch(setAlert({ type: 'close' }));
|
|
176
174
|
dispatch(addMessage('Thanks! Please check your email on this device.'));
|
|
177
175
|
return null;
|
|
@@ -16,7 +16,10 @@ export declare const fetchGuest: import("@reduxjs/toolkit").AsyncThunk<Partial<G
|
|
|
16
16
|
callback?: (() => void) | undefined;
|
|
17
17
|
}, {
|
|
18
18
|
state: AppState;
|
|
19
|
-
rejectValue:
|
|
19
|
+
rejectValue: {
|
|
20
|
+
error: RequestError;
|
|
21
|
+
email: string;
|
|
22
|
+
};
|
|
20
23
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
21
24
|
extra?: unknown;
|
|
22
25
|
serializedErrorType?: unknown;
|
|
@@ -31,7 +34,10 @@ export declare const fetchGuestThanx: import("@reduxjs/toolkit").AsyncThunk<void
|
|
|
31
34
|
callback?: (() => void) | null | undefined;
|
|
32
35
|
}, {
|
|
33
36
|
state: AppState;
|
|
34
|
-
rejectValue:
|
|
37
|
+
rejectValue: {
|
|
38
|
+
error: RequestError;
|
|
39
|
+
email: string;
|
|
40
|
+
};
|
|
35
41
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
36
42
|
extra?: unknown;
|
|
37
43
|
serializedErrorType?: unknown;
|
package/dist/esm/slices/guest.js
CHANGED
|
@@ -24,7 +24,8 @@ export const fetchGuest = createAsyncThunk(GuestActionType.FetchGuest, ({ email,
|
|
|
24
24
|
return response;
|
|
25
25
|
}
|
|
26
26
|
catch (err) {
|
|
27
|
-
|
|
27
|
+
const error = { error: err, email };
|
|
28
|
+
return rejectWithValue(error);
|
|
28
29
|
}
|
|
29
30
|
}));
|
|
30
31
|
export const fetchGuestThanx = createAsyncThunk(GuestActionType.FetchGuestThanx, ({ email, callback }, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -38,7 +39,8 @@ export const fetchGuestThanx = createAsyncThunk(GuestActionType.FetchGuestThanx,
|
|
|
38
39
|
return { email: email };
|
|
39
40
|
}
|
|
40
41
|
catch (err) {
|
|
41
|
-
|
|
42
|
+
const error = { error: err, email };
|
|
43
|
+
return rejectWithValue(error);
|
|
42
44
|
}
|
|
43
45
|
}));
|
|
44
46
|
const guestSlice = createSlice({
|
|
@@ -64,10 +66,7 @@ const guestSlice = createSlice({
|
|
|
64
66
|
state.loading = 'pending';
|
|
65
67
|
})
|
|
66
68
|
.addCase(fetchGuest.rejected, (state, action) => {
|
|
67
|
-
|
|
68
|
-
// state.email = action.payload?.email
|
|
69
|
-
state.loading = 'idle';
|
|
70
|
-
state.brands = null;
|
|
69
|
+
return Object.assign(Object.assign(Object.assign({}, state), { loading: 'idle', brands: null }), action.payload);
|
|
71
70
|
})
|
|
72
71
|
.addCase(fetchGuestThanx.fulfilled, (state, action) => {
|
|
73
72
|
return Object.assign(Object.assign(Object.assign({}, state), { loading: 'idle', errors: null, showMagicLink: true }), action.payload);
|
|
@@ -76,10 +75,7 @@ const guestSlice = createSlice({
|
|
|
76
75
|
state.loading = 'pending';
|
|
77
76
|
})
|
|
78
77
|
.addCase(fetchGuestThanx.rejected, (state, action) => {
|
|
79
|
-
|
|
80
|
-
state.loading = 'idle';
|
|
81
|
-
state.showMagicLink = false;
|
|
82
|
-
state.brands = null;
|
|
78
|
+
return Object.assign(Object.assign(Object.assign({}, state), { loading: 'idle', showMagicLink: false, brands: null }), action.payload);
|
|
83
79
|
});
|
|
84
80
|
}
|
|
85
81
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/cloud",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19",
|
|
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",
|