@open-tender/cloud 0.1.114 → 0.1.116
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/checkout.d.ts +2 -2
- package/dist/cjs/slices/customer/pointsShop.d.ts +6 -2
- package/dist/cjs/slices/customer/pointsShop.js +7 -4
- package/dist/esm/slices/checkout.d.ts +2 -2
- package/dist/esm/slices/customer/pointsShop.d.ts +6 -2
- package/dist/esm/slices/customer/pointsShop.js +7 -4
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dispatch } from '@reduxjs/toolkit';
|
|
2
|
-
import { CheckoutCheck, CheckoutErrorMessages, CheckoutForm, Order, OrderCreate,
|
|
2
|
+
import { CheckoutCheck, CheckoutErrorMessages, CheckoutForm, Order, OrderCreate, RequestStatus } from '@open-tender/types';
|
|
3
3
|
import { AppState } from '../app';
|
|
4
4
|
export interface CheckoutState {
|
|
5
5
|
check: CheckoutCheck | null;
|
|
@@ -20,7 +20,7 @@ export declare const validateOrder: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
20
20
|
errors: any;
|
|
21
21
|
}, OrderCreate | null | undefined, {
|
|
22
22
|
state: AppState;
|
|
23
|
-
rejectValue:
|
|
23
|
+
rejectValue: CheckoutErrorMessages;
|
|
24
24
|
dispatch?: Dispatch<import("redux").AnyAction> | undefined;
|
|
25
25
|
extra?: unknown;
|
|
26
26
|
serializedErrorType?: unknown;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { AppState } from '../../app';
|
|
2
|
-
import { RequestError, RequestStatus, TPLSPointsShopRewards } from '@open-tender/types';
|
|
2
|
+
import { RequestError, RequestStatus, TPLSPointsShopReward, TPLSPointsShopRewards } from '@open-tender/types';
|
|
3
3
|
export interface PointsShopState {
|
|
4
4
|
entities: TPLSPointsShopRewards;
|
|
5
|
+
data: TPLSPointsShopReward | null;
|
|
5
6
|
error: RequestError;
|
|
6
7
|
loading: RequestStatus;
|
|
7
8
|
}
|
|
@@ -19,7 +20,10 @@ export declare const fetchPointsShop: import("@reduxjs/toolkit").AsyncThunk<TPLS
|
|
|
19
20
|
fulfilledMeta?: unknown;
|
|
20
21
|
rejectedMeta?: unknown;
|
|
21
22
|
}>;
|
|
22
|
-
export declare const exchangePointsShopReward: import("@reduxjs/toolkit").AsyncThunk<
|
|
23
|
+
export declare const exchangePointsShopReward: import("@reduxjs/toolkit").AsyncThunk<{
|
|
24
|
+
data: TPLSPointsShopReward;
|
|
25
|
+
entities: TPLSPointsShopRewards;
|
|
26
|
+
}, string, {
|
|
23
27
|
state: AppState;
|
|
24
28
|
rejectValue: RequestError;
|
|
25
29
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
@@ -8,6 +8,7 @@ const types_2 = require("@open-tender/types");
|
|
|
8
8
|
const account_1 = require("./account");
|
|
9
9
|
const initialState = {
|
|
10
10
|
entities: [],
|
|
11
|
+
data: null,
|
|
11
12
|
error: null,
|
|
12
13
|
loading: 'idle'
|
|
13
14
|
};
|
|
@@ -34,12 +35,13 @@ exports.exchangePointsShopReward = (0, toolkit_1.createAsyncThunk)(PointsShopAct
|
|
|
34
35
|
try {
|
|
35
36
|
const { api } = getState().config;
|
|
36
37
|
if (!api)
|
|
37
|
-
return;
|
|
38
|
+
return { data: null, entities: [] };
|
|
38
39
|
const token = (0, account_1.selectToken)(getState());
|
|
39
40
|
if (!token)
|
|
40
41
|
throw new Error(types_2.MISSING_CUSTOMER);
|
|
41
|
-
yield api.postPointsShopReward(token, rewardId);
|
|
42
|
-
|
|
42
|
+
const data = yield api.postPointsShopReward(token, rewardId);
|
|
43
|
+
const entities = yield api.getPointsShop(token);
|
|
44
|
+
return { data, entities };
|
|
43
45
|
}
|
|
44
46
|
catch (err) {
|
|
45
47
|
return rejectWithValue(err);
|
|
@@ -66,7 +68,8 @@ const pointsShopSlice = (0, toolkit_1.createSlice)({
|
|
|
66
68
|
state.loading = 'idle';
|
|
67
69
|
})
|
|
68
70
|
.addCase(exports.exchangePointsShopReward.fulfilled, (state, action) => {
|
|
69
|
-
state.entities = action.payload;
|
|
71
|
+
state.entities = action.payload.entities;
|
|
72
|
+
state.data = action.payload.data;
|
|
70
73
|
state.loading = 'idle';
|
|
71
74
|
state.error = null;
|
|
72
75
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dispatch } from '@reduxjs/toolkit';
|
|
2
|
-
import { CheckoutCheck, CheckoutErrorMessages, CheckoutForm, Order, OrderCreate,
|
|
2
|
+
import { CheckoutCheck, CheckoutErrorMessages, CheckoutForm, Order, OrderCreate, RequestStatus } from '@open-tender/types';
|
|
3
3
|
import { AppState } from '../app';
|
|
4
4
|
export interface CheckoutState {
|
|
5
5
|
check: CheckoutCheck | null;
|
|
@@ -20,7 +20,7 @@ export declare const validateOrder: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
20
20
|
errors: any;
|
|
21
21
|
}, OrderCreate | null | undefined, {
|
|
22
22
|
state: AppState;
|
|
23
|
-
rejectValue:
|
|
23
|
+
rejectValue: CheckoutErrorMessages;
|
|
24
24
|
dispatch?: Dispatch<import("redux").AnyAction> | undefined;
|
|
25
25
|
extra?: unknown;
|
|
26
26
|
serializedErrorType?: unknown;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { AppState } from '../../app';
|
|
2
|
-
import { RequestError, RequestStatus, TPLSPointsShopRewards } from '@open-tender/types';
|
|
2
|
+
import { RequestError, RequestStatus, TPLSPointsShopReward, TPLSPointsShopRewards } from '@open-tender/types';
|
|
3
3
|
export interface PointsShopState {
|
|
4
4
|
entities: TPLSPointsShopRewards;
|
|
5
|
+
data: TPLSPointsShopReward | null;
|
|
5
6
|
error: RequestError;
|
|
6
7
|
loading: RequestStatus;
|
|
7
8
|
}
|
|
@@ -19,7 +20,10 @@ export declare const fetchPointsShop: import("@reduxjs/toolkit").AsyncThunk<TPLS
|
|
|
19
20
|
fulfilledMeta?: unknown;
|
|
20
21
|
rejectedMeta?: unknown;
|
|
21
22
|
}>;
|
|
22
|
-
export declare const exchangePointsShopReward: import("@reduxjs/toolkit").AsyncThunk<
|
|
23
|
+
export declare const exchangePointsShopReward: import("@reduxjs/toolkit").AsyncThunk<{
|
|
24
|
+
data: TPLSPointsShopReward;
|
|
25
|
+
entities: TPLSPointsShopRewards;
|
|
26
|
+
}, string, {
|
|
23
27
|
state: AppState;
|
|
24
28
|
rejectValue: RequestError;
|
|
25
29
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
@@ -5,6 +5,7 @@ import { MISSING_CUSTOMER } from '@open-tender/types';
|
|
|
5
5
|
import { selectToken } from './account';
|
|
6
6
|
const initialState = {
|
|
7
7
|
entities: [],
|
|
8
|
+
data: null,
|
|
8
9
|
error: null,
|
|
9
10
|
loading: 'idle'
|
|
10
11
|
};
|
|
@@ -31,12 +32,13 @@ export const exchangePointsShopReward = createAsyncThunk(PointsShopActionType.Ex
|
|
|
31
32
|
try {
|
|
32
33
|
const { api } = getState().config;
|
|
33
34
|
if (!api)
|
|
34
|
-
return;
|
|
35
|
+
return { data: null, entities: [] };
|
|
35
36
|
const token = selectToken(getState());
|
|
36
37
|
if (!token)
|
|
37
38
|
throw new Error(MISSING_CUSTOMER);
|
|
38
|
-
yield api.postPointsShopReward(token, rewardId);
|
|
39
|
-
|
|
39
|
+
const data = yield api.postPointsShopReward(token, rewardId);
|
|
40
|
+
const entities = yield api.getPointsShop(token);
|
|
41
|
+
return { data, entities };
|
|
40
42
|
}
|
|
41
43
|
catch (err) {
|
|
42
44
|
return rejectWithValue(err);
|
|
@@ -63,7 +65,8 @@ const pointsShopSlice = createSlice({
|
|
|
63
65
|
state.loading = 'idle';
|
|
64
66
|
})
|
|
65
67
|
.addCase(exchangePointsShopReward.fulfilled, (state, action) => {
|
|
66
|
-
state.entities = action.payload;
|
|
68
|
+
state.entities = action.payload.entities;
|
|
69
|
+
state.data = action.payload.data;
|
|
67
70
|
state.loading = 'idle';
|
|
68
71
|
state.error = null;
|
|
69
72
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/cloud",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.116",
|
|
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,8 +49,8 @@
|
|
|
49
49
|
"typescript": "^4.8.2"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@open-tender/types": "^0.2.
|
|
53
|
-
"@open-tender/utils": "^0.1.
|
|
52
|
+
"@open-tender/types": "^0.2.109",
|
|
53
|
+
"@open-tender/utils": "^0.1.174",
|
|
54
54
|
"@reduxjs/toolkit": "^1.8.5",
|
|
55
55
|
"react": "^18.2.0"
|
|
56
56
|
}
|