@open-tender/cloud 0.5.16 → 0.5.18
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/services/api.d.ts +1 -0
- package/dist/cjs/services/api.js +3 -0
- package/dist/cjs/slices/announcements.d.ts +1 -1
- package/dist/cjs/slices/announcements.js +7 -3
- package/dist/cjs/slices/customer/tplsPointsShop.d.ts +12 -1
- package/dist/cjs/slices/customer/tplsPointsShop.js +17 -1
- package/dist/esm/services/api.d.ts +1 -0
- package/dist/esm/services/api.js +3 -0
- package/dist/esm/slices/announcements.d.ts +1 -1
- package/dist/esm/slices/announcements.js +5 -2
- package/dist/esm/slices/customer/tplsPointsShop.d.ts +12 -1
- package/dist/esm/slices/customer/tplsPointsShop.js +16 -0
- package/package.json +1 -1
|
@@ -167,6 +167,7 @@ declare class OpenTenderAPI {
|
|
|
167
167
|
postCustomerTplsVerify(token: string): Promise<unknown>;
|
|
168
168
|
getCustomerTpls(token: string): Promise<unknown>;
|
|
169
169
|
getCustomerTplsHistory(token: string): Promise<unknown>;
|
|
170
|
+
retroClaimPoints(token: string, receiptId: string): Promise<unknown>;
|
|
170
171
|
getCustomerHouseAccounts(token: string): Promise<unknown>;
|
|
171
172
|
putCustomerOrderRating(token: string, orderId: number, data: any): Promise<unknown>;
|
|
172
173
|
postClaimRewardCode(token: string, rewardCode: string): Promise<unknown>;
|
package/dist/cjs/services/api.js
CHANGED
|
@@ -734,6 +734,9 @@ class OpenTenderAPI {
|
|
|
734
734
|
getCustomerTplsHistory(token) {
|
|
735
735
|
return this.request(`/customer/tpls/history`, 'GET', null, null, token);
|
|
736
736
|
}
|
|
737
|
+
retroClaimPoints(token, receiptId) {
|
|
738
|
+
return this.request(`/customer/tpls/retro-claim`, 'POST', { receipt_id: receiptId }, null, token);
|
|
739
|
+
}
|
|
737
740
|
getCustomerHouseAccounts(token) {
|
|
738
741
|
return this.request(`/customer/house-accounts`, 'GET', null, null, token);
|
|
739
742
|
}
|
|
@@ -22,7 +22,7 @@ export declare const fetchAnnouncementPage: import("@reduxjs/toolkit").AsyncThun
|
|
|
22
22
|
fulfilledMeta?: unknown;
|
|
23
23
|
rejectedMeta?: unknown;
|
|
24
24
|
}>;
|
|
25
|
-
export declare const resetAnnouncements: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"announcements/resetAnnouncements">;
|
|
25
|
+
export declare const resetAnnouncements: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"announcements/resetAnnouncements">, resetAnnouncementsError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"announcements/resetAnnouncementsError">;
|
|
26
26
|
export declare const selectAnnouncements: (state: AppState) => AnnouncementsState;
|
|
27
27
|
export declare const selectAnnouncementsPage: (page: AnnouncementPageType) => ((state: import("redux").EmptyObject & {
|
|
28
28
|
alerts: import("@open-tender/types").Alerts;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var _a;
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.announcementsReducer = exports.selectHasAnnouncementsPage = exports.selectAnnouncementsPage = exports.selectAnnouncements = exports.resetAnnouncements = exports.fetchAnnouncementPage = exports.AnnouncementsActionType = void 0;
|
|
4
|
+
exports.announcementsReducer = exports.selectHasAnnouncementsPage = exports.selectAnnouncementsPage = exports.selectAnnouncements = exports.resetAnnouncementsError = exports.resetAnnouncements = exports.fetchAnnouncementPage = exports.AnnouncementsActionType = void 0;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
6
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
7
|
const types_1 = require("./types");
|
|
@@ -32,7 +33,10 @@ const announcementsSlice = (0, toolkit_1.createSlice)({
|
|
|
32
33
|
name: types_1.ReducerType.Announcements,
|
|
33
34
|
initialState,
|
|
34
35
|
reducers: {
|
|
35
|
-
resetAnnouncements: () => initialState
|
|
36
|
+
resetAnnouncements: () => initialState,
|
|
37
|
+
resetAnnouncementsError: state => {
|
|
38
|
+
state.error = null;
|
|
39
|
+
}
|
|
36
40
|
},
|
|
37
41
|
extraReducers: builder => {
|
|
38
42
|
builder
|
|
@@ -56,7 +60,7 @@ const announcementsSlice = (0, toolkit_1.createSlice)({
|
|
|
56
60
|
});
|
|
57
61
|
}
|
|
58
62
|
});
|
|
59
|
-
exports.resetAnnouncements =
|
|
63
|
+
_a = announcementsSlice.actions, exports.resetAnnouncements = _a.resetAnnouncements, exports.resetAnnouncementsError = _a.resetAnnouncementsError;
|
|
60
64
|
const selectAnnouncements = (state) => state.announcements;
|
|
61
65
|
exports.selectAnnouncements = selectAnnouncements;
|
|
62
66
|
const selectAnnouncementsPage = (page) => (0, toolkit_1.createSelector)((state) => {
|
|
@@ -8,7 +8,8 @@ export interface TplsPointsShopState {
|
|
|
8
8
|
}
|
|
9
9
|
export declare enum TplsPointsShopActionType {
|
|
10
10
|
FetchTplsPointsShop = "pointsShop/fetchTplsPointsShop",
|
|
11
|
-
ExchangeTplsPointsShopReward = "pointsShop/exchangeTplsPointsShopReward"
|
|
11
|
+
ExchangeTplsPointsShopReward = "pointsShop/exchangeTplsPointsShopReward",
|
|
12
|
+
RetroClaimTplsPointsShop = "pointsShop/retroClaimTplsPointsShop"
|
|
12
13
|
}
|
|
13
14
|
export declare const fetchTplsPointsShop: import("@reduxjs/toolkit").AsyncThunk<TPLSPointsShopRewards, void, {
|
|
14
15
|
state: AppState;
|
|
@@ -33,6 +34,16 @@ export declare const exchangeTplsPointsShopReward: import("@reduxjs/toolkit").As
|
|
|
33
34
|
fulfilledMeta?: unknown;
|
|
34
35
|
rejectedMeta?: unknown;
|
|
35
36
|
}>;
|
|
37
|
+
export declare const retroClaimTplsPointsShop: import("@reduxjs/toolkit").AsyncThunk<void, string, {
|
|
38
|
+
state: AppState;
|
|
39
|
+
rejectValue: RequestError;
|
|
40
|
+
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
41
|
+
extra?: unknown;
|
|
42
|
+
serializedErrorType?: unknown;
|
|
43
|
+
pendingMeta?: unknown;
|
|
44
|
+
fulfilledMeta?: unknown;
|
|
45
|
+
rejectedMeta?: unknown;
|
|
46
|
+
}>;
|
|
36
47
|
export declare const resetTplsPointsShop: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"tplsPointsShop/resetTplsPointsShop">;
|
|
37
48
|
export declare const selectTplsPointsShop: (state: AppState) => TplsPointsShopState;
|
|
38
49
|
export declare const tplsPointsShopReducer: import("redux").Reducer<TplsPointsShopState, import("redux").AnyAction>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tplsPointsShopReducer = exports.selectTplsPointsShop = exports.resetTplsPointsShop = exports.exchangeTplsPointsShopReward = exports.fetchTplsPointsShop = exports.TplsPointsShopActionType = void 0;
|
|
3
|
+
exports.tplsPointsShopReducer = exports.selectTplsPointsShop = exports.resetTplsPointsShop = exports.retroClaimTplsPointsShop = exports.exchangeTplsPointsShopReward = exports.fetchTplsPointsShop = exports.TplsPointsShopActionType = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const types_1 = require("../types");
|
|
@@ -17,6 +17,7 @@ var TplsPointsShopActionType;
|
|
|
17
17
|
(function (TplsPointsShopActionType) {
|
|
18
18
|
TplsPointsShopActionType["FetchTplsPointsShop"] = "pointsShop/fetchTplsPointsShop";
|
|
19
19
|
TplsPointsShopActionType["ExchangeTplsPointsShopReward"] = "pointsShop/exchangeTplsPointsShopReward";
|
|
20
|
+
TplsPointsShopActionType["RetroClaimTplsPointsShop"] = "pointsShop/retroClaimTplsPointsShop";
|
|
20
21
|
})(TplsPointsShopActionType = exports.TplsPointsShopActionType || (exports.TplsPointsShopActionType = {}));
|
|
21
22
|
exports.fetchTplsPointsShop = (0, toolkit_1.createAsyncThunk)(TplsPointsShopActionType.FetchTplsPointsShop, (_, { getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
22
23
|
try {
|
|
@@ -49,6 +50,21 @@ exports.exchangeTplsPointsShopReward = (0, toolkit_1.createAsyncThunk)(TplsPoint
|
|
|
49
50
|
return rejectWithValue(err);
|
|
50
51
|
}
|
|
51
52
|
}));
|
|
53
|
+
exports.retroClaimTplsPointsShop = (0, toolkit_1.createAsyncThunk)(TplsPointsShopActionType.RetroClaimTplsPointsShop, (receiptId, { getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
54
|
+
try {
|
|
55
|
+
const { api } = getState().config;
|
|
56
|
+
if (!api)
|
|
57
|
+
return;
|
|
58
|
+
const token = (0, account_1.selectToken)(getState());
|
|
59
|
+
if (!token)
|
|
60
|
+
throw new Error(types_2.MISSING_CUSTOMER);
|
|
61
|
+
yield api.retroClaimPoints(token, receiptId);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
return rejectWithValue(err);
|
|
66
|
+
}
|
|
67
|
+
}));
|
|
52
68
|
const tplsPointsShopSlice = (0, toolkit_1.createSlice)({
|
|
53
69
|
name: types_1.ReducerType.TplsPointsShop,
|
|
54
70
|
initialState,
|
|
@@ -167,6 +167,7 @@ declare class OpenTenderAPI {
|
|
|
167
167
|
postCustomerTplsVerify(token: string): Promise<unknown>;
|
|
168
168
|
getCustomerTpls(token: string): Promise<unknown>;
|
|
169
169
|
getCustomerTplsHistory(token: string): Promise<unknown>;
|
|
170
|
+
retroClaimPoints(token: string, receiptId: string): Promise<unknown>;
|
|
170
171
|
getCustomerHouseAccounts(token: string): Promise<unknown>;
|
|
171
172
|
putCustomerOrderRating(token: string, orderId: number, data: any): Promise<unknown>;
|
|
172
173
|
postClaimRewardCode(token: string, rewardCode: string): Promise<unknown>;
|
package/dist/esm/services/api.js
CHANGED
|
@@ -732,6 +732,9 @@ class OpenTenderAPI {
|
|
|
732
732
|
getCustomerTplsHistory(token) {
|
|
733
733
|
return this.request(`/customer/tpls/history`, 'GET', null, null, token);
|
|
734
734
|
}
|
|
735
|
+
retroClaimPoints(token, receiptId) {
|
|
736
|
+
return this.request(`/customer/tpls/retro-claim`, 'POST', { receipt_id: receiptId }, null, token);
|
|
737
|
+
}
|
|
735
738
|
getCustomerHouseAccounts(token) {
|
|
736
739
|
return this.request(`/customer/house-accounts`, 'GET', null, null, token);
|
|
737
740
|
}
|
|
@@ -22,7 +22,7 @@ export declare const fetchAnnouncementPage: import("@reduxjs/toolkit").AsyncThun
|
|
|
22
22
|
fulfilledMeta?: unknown;
|
|
23
23
|
rejectedMeta?: unknown;
|
|
24
24
|
}>;
|
|
25
|
-
export declare const resetAnnouncements: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"announcements/resetAnnouncements">;
|
|
25
|
+
export declare const resetAnnouncements: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"announcements/resetAnnouncements">, resetAnnouncementsError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"announcements/resetAnnouncementsError">;
|
|
26
26
|
export declare const selectAnnouncements: (state: AppState) => AnnouncementsState;
|
|
27
27
|
export declare const selectAnnouncementsPage: (page: AnnouncementPageType) => ((state: import("redux").EmptyObject & {
|
|
28
28
|
alerts: import("@open-tender/types").Alerts;
|
|
@@ -29,7 +29,10 @@ const announcementsSlice = createSlice({
|
|
|
29
29
|
name: ReducerType.Announcements,
|
|
30
30
|
initialState,
|
|
31
31
|
reducers: {
|
|
32
|
-
resetAnnouncements: () => initialState
|
|
32
|
+
resetAnnouncements: () => initialState,
|
|
33
|
+
resetAnnouncementsError: state => {
|
|
34
|
+
state.error = null;
|
|
35
|
+
}
|
|
33
36
|
},
|
|
34
37
|
extraReducers: builder => {
|
|
35
38
|
builder
|
|
@@ -53,7 +56,7 @@ const announcementsSlice = createSlice({
|
|
|
53
56
|
});
|
|
54
57
|
}
|
|
55
58
|
});
|
|
56
|
-
export const { resetAnnouncements } = announcementsSlice.actions;
|
|
59
|
+
export const { resetAnnouncements, resetAnnouncementsError } = announcementsSlice.actions;
|
|
57
60
|
export const selectAnnouncements = (state) => state.announcements;
|
|
58
61
|
export const selectAnnouncementsPage = (page) => createSelector((state) => {
|
|
59
62
|
const { pages, loading, error } = state.announcements;
|
|
@@ -8,7 +8,8 @@ export interface TplsPointsShopState {
|
|
|
8
8
|
}
|
|
9
9
|
export declare enum TplsPointsShopActionType {
|
|
10
10
|
FetchTplsPointsShop = "pointsShop/fetchTplsPointsShop",
|
|
11
|
-
ExchangeTplsPointsShopReward = "pointsShop/exchangeTplsPointsShopReward"
|
|
11
|
+
ExchangeTplsPointsShopReward = "pointsShop/exchangeTplsPointsShopReward",
|
|
12
|
+
RetroClaimTplsPointsShop = "pointsShop/retroClaimTplsPointsShop"
|
|
12
13
|
}
|
|
13
14
|
export declare const fetchTplsPointsShop: import("@reduxjs/toolkit").AsyncThunk<TPLSPointsShopRewards, void, {
|
|
14
15
|
state: AppState;
|
|
@@ -33,6 +34,16 @@ export declare const exchangeTplsPointsShopReward: import("@reduxjs/toolkit").As
|
|
|
33
34
|
fulfilledMeta?: unknown;
|
|
34
35
|
rejectedMeta?: unknown;
|
|
35
36
|
}>;
|
|
37
|
+
export declare const retroClaimTplsPointsShop: import("@reduxjs/toolkit").AsyncThunk<void, string, {
|
|
38
|
+
state: AppState;
|
|
39
|
+
rejectValue: RequestError;
|
|
40
|
+
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
41
|
+
extra?: unknown;
|
|
42
|
+
serializedErrorType?: unknown;
|
|
43
|
+
pendingMeta?: unknown;
|
|
44
|
+
fulfilledMeta?: unknown;
|
|
45
|
+
rejectedMeta?: unknown;
|
|
46
|
+
}>;
|
|
36
47
|
export declare const resetTplsPointsShop: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"tplsPointsShop/resetTplsPointsShop">;
|
|
37
48
|
export declare const selectTplsPointsShop: (state: AppState) => TplsPointsShopState;
|
|
38
49
|
export declare const tplsPointsShopReducer: import("redux").Reducer<TplsPointsShopState, import("redux").AnyAction>;
|
|
@@ -14,6 +14,7 @@ export var TplsPointsShopActionType;
|
|
|
14
14
|
(function (TplsPointsShopActionType) {
|
|
15
15
|
TplsPointsShopActionType["FetchTplsPointsShop"] = "pointsShop/fetchTplsPointsShop";
|
|
16
16
|
TplsPointsShopActionType["ExchangeTplsPointsShopReward"] = "pointsShop/exchangeTplsPointsShopReward";
|
|
17
|
+
TplsPointsShopActionType["RetroClaimTplsPointsShop"] = "pointsShop/retroClaimTplsPointsShop";
|
|
17
18
|
})(TplsPointsShopActionType || (TplsPointsShopActionType = {}));
|
|
18
19
|
export const fetchTplsPointsShop = createAsyncThunk(TplsPointsShopActionType.FetchTplsPointsShop, (_, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
20
|
try {
|
|
@@ -46,6 +47,21 @@ export const exchangeTplsPointsShopReward = createAsyncThunk(TplsPointsShopActio
|
|
|
46
47
|
return rejectWithValue(err);
|
|
47
48
|
}
|
|
48
49
|
}));
|
|
50
|
+
export const retroClaimTplsPointsShop = createAsyncThunk(TplsPointsShopActionType.RetroClaimTplsPointsShop, (receiptId, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
+
try {
|
|
52
|
+
const { api } = getState().config;
|
|
53
|
+
if (!api)
|
|
54
|
+
return;
|
|
55
|
+
const token = selectToken(getState());
|
|
56
|
+
if (!token)
|
|
57
|
+
throw new Error(MISSING_CUSTOMER);
|
|
58
|
+
yield api.retroClaimPoints(token, receiptId);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
return rejectWithValue(err);
|
|
63
|
+
}
|
|
64
|
+
}));
|
|
49
65
|
const tplsPointsShopSlice = createSlice({
|
|
50
66
|
name: ReducerType.TplsPointsShop,
|
|
51
67
|
initialState,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/cloud",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.18",
|
|
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",
|