@open-tender/cloud 0.0.114 → 0.0.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/app/hooks.d.ts +1 -1
- package/dist/cjs/app/store.d.ts +3 -3
- package/dist/cjs/slices/customer/index.d.ts +1 -0
- package/dist/cjs/slices/customer/index.js +1 -0
- package/dist/cjs/slices/customer/levelup.js +28 -1
- package/dist/cjs/slices/levelup.d.ts +2 -1
- package/dist/cjs/slices/levelup.js +7 -3
- package/dist/esm/app/hooks.d.ts +1 -1
- package/dist/esm/app/store.d.ts +3 -3
- package/dist/esm/slices/customer/index.d.ts +1 -0
- package/dist/esm/slices/customer/index.js +1 -0
- package/dist/esm/slices/customer/levelup.js +28 -1
- package/dist/esm/slices/levelup.d.ts +2 -1
- package/dist/esm/slices/levelup.js +4 -2
- package/package.json +1 -1
package/dist/cjs/app/hooks.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<i
|
|
|
22
22
|
rewards: import("..").CustomerRewardsState;
|
|
23
23
|
qrcode: import("..").CustomerQRCodeState;
|
|
24
24
|
thanx: import("..").CustomerThanxState;
|
|
25
|
-
levelup: import("
|
|
25
|
+
levelup: import("..").CustomerLevelUpState;
|
|
26
26
|
}>;
|
|
27
27
|
signUp: import("..").SignUpState;
|
|
28
28
|
revenueCenters: import("..").RevenueCentersState;
|
package/dist/cjs/app/store.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare const appReducer: import("redux").Reducer<import("redux").Combine
|
|
|
21
21
|
rewards: import("../slices").CustomerRewardsState;
|
|
22
22
|
qrcode: import("../slices").CustomerQRCodeState;
|
|
23
23
|
thanx: import("../slices").CustomerThanxState;
|
|
24
|
-
levelup: import("../slices
|
|
24
|
+
levelup: import("../slices").CustomerLevelUpState;
|
|
25
25
|
}>;
|
|
26
26
|
signUp: import("../slices").SignUpState;
|
|
27
27
|
revenueCenters: import("../slices").RevenueCentersState;
|
|
@@ -73,7 +73,7 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<import("redux").Co
|
|
|
73
73
|
rewards: import("../slices").CustomerRewardsState;
|
|
74
74
|
qrcode: import("../slices").CustomerQRCodeState;
|
|
75
75
|
thanx: import("../slices").CustomerThanxState;
|
|
76
|
-
levelup: import("../slices
|
|
76
|
+
levelup: import("../slices").CustomerLevelUpState;
|
|
77
77
|
}>;
|
|
78
78
|
signUp: import("../slices").SignUpState;
|
|
79
79
|
revenueCenters: import("../slices").RevenueCentersState;
|
|
@@ -123,7 +123,7 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<import("redux").Co
|
|
|
123
123
|
rewards: import("../slices").CustomerRewardsState;
|
|
124
124
|
qrcode: import("../slices").CustomerQRCodeState;
|
|
125
125
|
thanx: import("../slices").CustomerThanxState;
|
|
126
|
-
levelup: import("../slices
|
|
126
|
+
levelup: import("../slices").CustomerLevelUpState;
|
|
127
127
|
}>;
|
|
128
128
|
signUp: import("../slices").SignUpState;
|
|
129
129
|
revenueCenters: import("../slices").RevenueCentersState;
|
|
@@ -56,3 +56,4 @@ tslib_1.__exportStar(require("./thanx"), exports);
|
|
|
56
56
|
tslib_1.__exportStar(require("./order"), exports);
|
|
57
57
|
tslib_1.__exportStar(require("./houseAccounts"), exports);
|
|
58
58
|
tslib_1.__exportStar(require("./qrCode"), exports);
|
|
59
|
+
tslib_1.__exportStar(require("./levelup"), exports);
|
|
@@ -68,6 +68,25 @@ exports.addCustomerLevelUp = (0, toolkit_1.createAsyncThunk)(CustomerLevelUpActi
|
|
|
68
68
|
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(error));
|
|
69
69
|
}
|
|
70
70
|
}));
|
|
71
|
+
// export const fetchLevelUpCustomer = createAsyncThunk<
|
|
72
|
+
// Array<LevelUp>,
|
|
73
|
+
// { token: string; callback?: () => void },
|
|
74
|
+
// { state: AppState; rejectValue: RequestError }
|
|
75
|
+
// >(
|
|
76
|
+
// CustomerLevelUpActionType.AddCustomerLevelUp,
|
|
77
|
+
// async (requestData, { dispatch, getState, rejectWithValue }) => {
|
|
78
|
+
// try {
|
|
79
|
+
// const { api } = getState().config
|
|
80
|
+
// if (!api) return
|
|
81
|
+
// const auth = await api.postLevelUp({ token: requestData.token })
|
|
82
|
+
// dispatch(fetchCustomer())
|
|
83
|
+
// if (requestData.callback) requestData.callback()
|
|
84
|
+
// return auth
|
|
85
|
+
// } catch (err) {
|
|
86
|
+
// return rejectWithValue(err as RequestError)
|
|
87
|
+
// }
|
|
88
|
+
// }
|
|
89
|
+
// )
|
|
71
90
|
const customerLevelUpSlice = (0, toolkit_1.createSlice)({
|
|
72
91
|
name: types_1.ReducerType.Levelup,
|
|
73
92
|
initialState,
|
|
@@ -80,7 +99,7 @@ const customerLevelUpSlice = (0, toolkit_1.createSlice)({
|
|
|
80
99
|
resetCustomerLevelUpError: state => {
|
|
81
100
|
state.error = null;
|
|
82
101
|
state.loading = 'idle';
|
|
83
|
-
}
|
|
102
|
+
},
|
|
84
103
|
},
|
|
85
104
|
extraReducers: builder => {
|
|
86
105
|
builder
|
|
@@ -120,6 +139,14 @@ const customerLevelUpSlice = (0, toolkit_1.createSlice)({
|
|
|
120
139
|
state.error = action.payload;
|
|
121
140
|
state.loading = 'idle';
|
|
122
141
|
});
|
|
142
|
+
// .addCase(fetchLevelUpCustomer.fulfilled, () => initialState)
|
|
143
|
+
// .addCase(fetchLevelUpCustomer.pending, state => {
|
|
144
|
+
// state.loading = 'pending'
|
|
145
|
+
// })
|
|
146
|
+
// .addCase(fetchLevelUpCustomer.rejected, (state, action) => {
|
|
147
|
+
// state.error = action.payload
|
|
148
|
+
// state.loading = 'idle'
|
|
149
|
+
// })
|
|
123
150
|
}
|
|
124
151
|
});
|
|
125
152
|
_a = customerLevelUpSlice.actions, exports.resetCustomerLevelUp = _a.resetCustomerLevelUp, exports.setCustomerLevelUp = _a.setCustomerLevelUp;
|
|
@@ -14,5 +14,6 @@ export declare const fetchLevelUpCustomer: import("@reduxjs/toolkit").AsyncThunk
|
|
|
14
14
|
state: AppState;
|
|
15
15
|
rejectValue: RequestError;
|
|
16
16
|
}>;
|
|
17
|
-
export declare const resetLevelup: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
17
|
+
export declare const resetLevelup: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetLevelUpCustomer: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
18
18
|
export declare const levelupReducer: import("redux").Reducer<LevelupState, import("redux").AnyAction>;
|
|
19
|
+
export declare const selectLevelUp: (state: AppState) => LevelupState;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var _a;
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.levelupReducer = exports.resetLevelup = exports.fetchLevelUpCustomer = exports.LevelupActionType = void 0;
|
|
4
|
+
exports.selectLevelUp = exports.levelupReducer = exports.resetLevelUpCustomer = exports.resetLevelup = exports.fetchLevelUpCustomer = exports.LevelupActionType = void 0;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
6
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
7
|
const types_1 = require("./types");
|
|
@@ -33,7 +34,8 @@ const levelupSlice = (0, toolkit_1.createSlice)({
|
|
|
33
34
|
name: types_1.ReducerType.Levelup,
|
|
34
35
|
initialState,
|
|
35
36
|
reducers: {
|
|
36
|
-
resetLevelup: () => initialState
|
|
37
|
+
resetLevelup: () => initialState,
|
|
38
|
+
resetLevelUpCustomer: () => initialState,
|
|
37
39
|
},
|
|
38
40
|
extraReducers: builder => {
|
|
39
41
|
builder
|
|
@@ -47,5 +49,7 @@ const levelupSlice = (0, toolkit_1.createSlice)({
|
|
|
47
49
|
});
|
|
48
50
|
}
|
|
49
51
|
});
|
|
50
|
-
exports.resetLevelup =
|
|
52
|
+
_a = levelupSlice.actions, exports.resetLevelup = _a.resetLevelup, exports.resetLevelUpCustomer = _a.resetLevelUpCustomer;
|
|
51
53
|
exports.levelupReducer = levelupSlice.reducer;
|
|
54
|
+
const selectLevelUp = (state) => state.levelup;
|
|
55
|
+
exports.selectLevelUp = selectLevelUp;
|
package/dist/esm/app/hooks.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<i
|
|
|
22
22
|
rewards: import("..").CustomerRewardsState;
|
|
23
23
|
qrcode: import("..").CustomerQRCodeState;
|
|
24
24
|
thanx: import("..").CustomerThanxState;
|
|
25
|
-
levelup: import("
|
|
25
|
+
levelup: import("..").CustomerLevelUpState;
|
|
26
26
|
}>;
|
|
27
27
|
signUp: import("..").SignUpState;
|
|
28
28
|
revenueCenters: import("..").RevenueCentersState;
|
package/dist/esm/app/store.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare const appReducer: import("redux").Reducer<import("redux").Combine
|
|
|
21
21
|
rewards: import("../slices").CustomerRewardsState;
|
|
22
22
|
qrcode: import("../slices").CustomerQRCodeState;
|
|
23
23
|
thanx: import("../slices").CustomerThanxState;
|
|
24
|
-
levelup: import("../slices
|
|
24
|
+
levelup: import("../slices").CustomerLevelUpState;
|
|
25
25
|
}>;
|
|
26
26
|
signUp: import("../slices").SignUpState;
|
|
27
27
|
revenueCenters: import("../slices").RevenueCentersState;
|
|
@@ -73,7 +73,7 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<import("redux").Co
|
|
|
73
73
|
rewards: import("../slices").CustomerRewardsState;
|
|
74
74
|
qrcode: import("../slices").CustomerQRCodeState;
|
|
75
75
|
thanx: import("../slices").CustomerThanxState;
|
|
76
|
-
levelup: import("../slices
|
|
76
|
+
levelup: import("../slices").CustomerLevelUpState;
|
|
77
77
|
}>;
|
|
78
78
|
signUp: import("../slices").SignUpState;
|
|
79
79
|
revenueCenters: import("../slices").RevenueCentersState;
|
|
@@ -123,7 +123,7 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<import("redux").Co
|
|
|
123
123
|
rewards: import("../slices").CustomerRewardsState;
|
|
124
124
|
qrcode: import("../slices").CustomerQRCodeState;
|
|
125
125
|
thanx: import("../slices").CustomerThanxState;
|
|
126
|
-
levelup: import("../slices
|
|
126
|
+
levelup: import("../slices").CustomerLevelUpState;
|
|
127
127
|
}>;
|
|
128
128
|
signUp: import("../slices").SignUpState;
|
|
129
129
|
revenueCenters: import("../slices").RevenueCentersState;
|
|
@@ -64,6 +64,25 @@ export const addCustomerLevelUp = createAsyncThunk(CustomerLevelUpActionType.Add
|
|
|
64
64
|
return checkAuth(error, dispatch, () => rejectWithValue(error));
|
|
65
65
|
}
|
|
66
66
|
}));
|
|
67
|
+
// export const fetchLevelUpCustomer = createAsyncThunk<
|
|
68
|
+
// Array<LevelUp>,
|
|
69
|
+
// { token: string; callback?: () => void },
|
|
70
|
+
// { state: AppState; rejectValue: RequestError }
|
|
71
|
+
// >(
|
|
72
|
+
// CustomerLevelUpActionType.AddCustomerLevelUp,
|
|
73
|
+
// async (requestData, { dispatch, getState, rejectWithValue }) => {
|
|
74
|
+
// try {
|
|
75
|
+
// const { api } = getState().config
|
|
76
|
+
// if (!api) return
|
|
77
|
+
// const auth = await api.postLevelUp({ token: requestData.token })
|
|
78
|
+
// dispatch(fetchCustomer())
|
|
79
|
+
// if (requestData.callback) requestData.callback()
|
|
80
|
+
// return auth
|
|
81
|
+
// } catch (err) {
|
|
82
|
+
// return rejectWithValue(err as RequestError)
|
|
83
|
+
// }
|
|
84
|
+
// }
|
|
85
|
+
// )
|
|
67
86
|
const customerLevelUpSlice = createSlice({
|
|
68
87
|
name: ReducerType.Levelup,
|
|
69
88
|
initialState,
|
|
@@ -76,7 +95,7 @@ const customerLevelUpSlice = createSlice({
|
|
|
76
95
|
resetCustomerLevelUpError: state => {
|
|
77
96
|
state.error = null;
|
|
78
97
|
state.loading = 'idle';
|
|
79
|
-
}
|
|
98
|
+
},
|
|
80
99
|
},
|
|
81
100
|
extraReducers: builder => {
|
|
82
101
|
builder
|
|
@@ -116,6 +135,14 @@ const customerLevelUpSlice = createSlice({
|
|
|
116
135
|
state.error = action.payload;
|
|
117
136
|
state.loading = 'idle';
|
|
118
137
|
});
|
|
138
|
+
// .addCase(fetchLevelUpCustomer.fulfilled, () => initialState)
|
|
139
|
+
// .addCase(fetchLevelUpCustomer.pending, state => {
|
|
140
|
+
// state.loading = 'pending'
|
|
141
|
+
// })
|
|
142
|
+
// .addCase(fetchLevelUpCustomer.rejected, (state, action) => {
|
|
143
|
+
// state.error = action.payload
|
|
144
|
+
// state.loading = 'idle'
|
|
145
|
+
// })
|
|
119
146
|
}
|
|
120
147
|
});
|
|
121
148
|
export const { resetCustomerLevelUp, setCustomerLevelUp } = customerLevelUpSlice.actions;
|
|
@@ -14,5 +14,6 @@ export declare const fetchLevelUpCustomer: import("@reduxjs/toolkit").AsyncThunk
|
|
|
14
14
|
state: AppState;
|
|
15
15
|
rejectValue: RequestError;
|
|
16
16
|
}>;
|
|
17
|
-
export declare const resetLevelup: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
17
|
+
export declare const resetLevelup: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetLevelUpCustomer: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
18
18
|
export declare const levelupReducer: import("redux").Reducer<LevelupState, import("redux").AnyAction>;
|
|
19
|
+
export declare const selectLevelUp: (state: AppState) => LevelupState;
|
|
@@ -30,7 +30,8 @@ const levelupSlice = createSlice({
|
|
|
30
30
|
name: ReducerType.Levelup,
|
|
31
31
|
initialState,
|
|
32
32
|
reducers: {
|
|
33
|
-
resetLevelup: () => initialState
|
|
33
|
+
resetLevelup: () => initialState,
|
|
34
|
+
resetLevelUpCustomer: () => initialState,
|
|
34
35
|
},
|
|
35
36
|
extraReducers: builder => {
|
|
36
37
|
builder
|
|
@@ -44,5 +45,6 @@ const levelupSlice = createSlice({
|
|
|
44
45
|
});
|
|
45
46
|
}
|
|
46
47
|
});
|
|
47
|
-
export const { resetLevelup } = levelupSlice.actions;
|
|
48
|
+
export const { resetLevelup, resetLevelUpCustomer } = levelupSlice.actions;
|
|
48
49
|
export const levelupReducer = levelupSlice.reducer;
|
|
50
|
+
export const selectLevelUp = (state) => state.levelup;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/cloud",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.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",
|