@open-tender/cloud 0.4.12 → 0.4.14
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 -0
- package/dist/cjs/app/store.d.ts +3 -0
- package/dist/cjs/services/api.d.ts +2 -0
- package/dist/cjs/services/api.js +6 -0
- package/dist/cjs/slices/allergens.d.ts +1 -0
- package/dist/cjs/slices/announcements.d.ts +2 -0
- package/dist/cjs/slices/config.d.ts +2 -0
- package/dist/cjs/slices/customer/creditCards.d.ts +1 -0
- package/dist/cjs/slices/customer/index.d.ts +2 -0
- package/dist/cjs/slices/customer/index.js +3 -0
- package/dist/cjs/slices/customer/loyalty.d.ts +2 -0
- package/dist/cjs/slices/customer/order.d.ts +1 -0
- package/dist/cjs/slices/customer/pointsShopV2.d.ts +38 -0
- package/dist/cjs/slices/customer/pointsShopV2.js +88 -0
- package/dist/cjs/slices/customer/tpls.d.ts +3 -0
- package/dist/cjs/slices/groupOrder.d.ts +4 -0
- package/dist/cjs/slices/order.d.ts +3 -0
- package/dist/cjs/slices/quote.d.ts +1 -0
- package/dist/cjs/slices/tags.d.ts +1 -0
- package/dist/cjs/slices/types.d.ts +1 -0
- package/dist/cjs/slices/types.js +1 -0
- package/dist/esm/app/hooks.d.ts +1 -0
- package/dist/esm/app/store.d.ts +3 -0
- package/dist/esm/services/api.d.ts +2 -0
- package/dist/esm/services/api.js +6 -0
- package/dist/esm/slices/allergens.d.ts +1 -0
- package/dist/esm/slices/announcements.d.ts +2 -0
- package/dist/esm/slices/config.d.ts +2 -0
- package/dist/esm/slices/customer/creditCards.d.ts +1 -0
- package/dist/esm/slices/customer/index.d.ts +2 -0
- package/dist/esm/slices/customer/index.js +3 -0
- package/dist/esm/slices/customer/loyalty.d.ts +2 -0
- package/dist/esm/slices/customer/order.d.ts +1 -0
- package/dist/esm/slices/customer/pointsShopV2.d.ts +38 -0
- package/dist/esm/slices/customer/pointsShopV2.js +84 -0
- package/dist/esm/slices/customer/tpls.d.ts +3 -0
- package/dist/esm/slices/groupOrder.d.ts +4 -0
- package/dist/esm/slices/order.d.ts +3 -0
- package/dist/esm/slices/quote.d.ts +1 -0
- package/dist/esm/slices/tags.d.ts +1 -0
- package/dist/esm/slices/types.d.ts +1 -0
- package/dist/esm/slices/types.js +1 -0
- package/package.json +4 -3
package/dist/cjs/app/hooks.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<i
|
|
|
24
24
|
order: import("..").CustomerOrderState;
|
|
25
25
|
orders: import("..").CustomerOrdersState;
|
|
26
26
|
pointsShop: import("..").PointsShopState;
|
|
27
|
+
pointsShopV2: import("..").PointsShopV2State;
|
|
27
28
|
qrcode: import("..").CustomerQRCodeState;
|
|
28
29
|
rewards: import("..").CustomerRewardsState;
|
|
29
30
|
thanx: import("..").CustomerThanxState;
|
package/dist/cjs/app/store.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export declare const appReducer: import("redux").Reducer<import("redux").Combine
|
|
|
23
23
|
order: import("../slices").CustomerOrderState;
|
|
24
24
|
orders: import("../slices").CustomerOrdersState;
|
|
25
25
|
pointsShop: import("../slices").PointsShopState;
|
|
26
|
+
pointsShopV2: import("../slices").PointsShopV2State;
|
|
26
27
|
qrcode: import("../slices").CustomerQRCodeState;
|
|
27
28
|
rewards: import("../slices").CustomerRewardsState;
|
|
28
29
|
thanx: import("../slices").CustomerThanxState;
|
|
@@ -86,6 +87,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
86
87
|
order: import("../slices").CustomerOrderState;
|
|
87
88
|
orders: import("../slices").CustomerOrdersState;
|
|
88
89
|
pointsShop: import("../slices").PointsShopState;
|
|
90
|
+
pointsShopV2: import("../slices").PointsShopV2State;
|
|
89
91
|
qrcode: import("../slices").CustomerQRCodeState;
|
|
90
92
|
rewards: import("../slices").CustomerRewardsState;
|
|
91
93
|
thanx: import("../slices").CustomerThanxState;
|
|
@@ -147,6 +149,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
147
149
|
order: import("../slices").CustomerOrderState;
|
|
148
150
|
orders: import("../slices").CustomerOrdersState;
|
|
149
151
|
pointsShop: import("../slices").PointsShopState;
|
|
152
|
+
pointsShopV2: import("../slices").PointsShopV2State;
|
|
150
153
|
qrcode: import("../slices").CustomerQRCodeState;
|
|
151
154
|
rewards: import("../slices").CustomerRewardsState;
|
|
152
155
|
thanx: import("../slices").CustomerThanxState;
|
|
@@ -119,6 +119,8 @@ declare class OpenTenderAPI {
|
|
|
119
119
|
postVerifyAccount(verifyToken: string): Promise<unknown>;
|
|
120
120
|
getCustomerQRCode(token: string): Promise<unknown>;
|
|
121
121
|
getCustomerRewards(token: string): Promise<unknown>;
|
|
122
|
+
getPointsShopV2(token: string): Promise<unknown>;
|
|
123
|
+
postPointsShopRewardV2(token: string, rewardId: string): Promise<unknown>;
|
|
122
124
|
getPointsShop(token: string): Promise<unknown>;
|
|
123
125
|
postPointsShopReward(token: string, rewardId: string): Promise<unknown>;
|
|
124
126
|
getCustomerOrders(token: string, limit: number, timing: string): Promise<unknown>;
|
package/dist/cjs/services/api.js
CHANGED
|
@@ -562,6 +562,12 @@ class OpenTenderAPI {
|
|
|
562
562
|
getCustomerRewards(token) {
|
|
563
563
|
return this.request(`/customer/rewards?with_related=true`, 'GET', null, null, token);
|
|
564
564
|
}
|
|
565
|
+
getPointsShopV2(token) {
|
|
566
|
+
return this.request(`/v2/points-shop`, 'GET', null, null, token);
|
|
567
|
+
}
|
|
568
|
+
postPointsShopRewardV2(token, rewardId) {
|
|
569
|
+
return this.request(`/v2/points-shop/${rewardId}/exchange`, 'POST', null, null, token);
|
|
570
|
+
}
|
|
565
571
|
getPointsShop(token) {
|
|
566
572
|
return this.request(`/points-shop/rewards`, 'GET', null, null, token);
|
|
567
573
|
}
|
|
@@ -51,6 +51,7 @@ export declare const selectSelectedAllergenNames: ((state: import("redux").Empty
|
|
|
51
51
|
order: import("./customer").CustomerOrderState;
|
|
52
52
|
orders: import("./customer").CustomerOrdersState;
|
|
53
53
|
pointsShop: import("./customer").PointsShopState;
|
|
54
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
54
55
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
55
56
|
rewards: import("./customer").CustomerRewardsState;
|
|
56
57
|
thanx: import("./customer").CustomerThanxState;
|
|
@@ -48,6 +48,7 @@ export declare const selectAnnouncementsPage: (page: AnnouncementPageType) => ((
|
|
|
48
48
|
order: import("./customer").CustomerOrderState;
|
|
49
49
|
orders: import("./customer").CustomerOrdersState;
|
|
50
50
|
pointsShop: import("./customer").PointsShopState;
|
|
51
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
51
52
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
52
53
|
rewards: import("./customer").CustomerRewardsState;
|
|
53
54
|
thanx: import("./customer").CustomerThanxState;
|
|
@@ -128,6 +129,7 @@ export declare const selectHasAnnouncementsPage: (page: AnnouncementPageType) =>
|
|
|
128
129
|
order: import("./customer").CustomerOrderState;
|
|
129
130
|
orders: import("./customer").CustomerOrdersState;
|
|
130
131
|
pointsShop: import("./customer").PointsShopState;
|
|
132
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
131
133
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
132
134
|
rewards: import("./customer").CustomerRewardsState;
|
|
133
135
|
thanx: import("./customer").CustomerThanxState;
|
|
@@ -111,6 +111,7 @@ export declare const selectOptIns: ((state: import("redux").EmptyObject & {
|
|
|
111
111
|
order: import("./customer").CustomerOrderState;
|
|
112
112
|
orders: import("./customer").CustomerOrdersState;
|
|
113
113
|
pointsShop: import("./customer").PointsShopState;
|
|
114
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
114
115
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
115
116
|
rewards: import("./customer").CustomerRewardsState;
|
|
116
117
|
thanx: import("./customer").CustomerThanxState;
|
|
@@ -191,6 +192,7 @@ export declare const selectBottomTabsTitles: ((state: import("redux").EmptyObjec
|
|
|
191
192
|
order: import("./customer").CustomerOrderState;
|
|
192
193
|
orders: import("./customer").CustomerOrdersState;
|
|
193
194
|
pointsShop: import("./customer").PointsShopState;
|
|
195
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
194
196
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
195
197
|
rewards: import("./customer").CustomerRewardsState;
|
|
196
198
|
thanx: import("./customer").CustomerThanxState;
|
|
@@ -90,6 +90,7 @@ export declare const selectCustomerCreditCardsForPayment: ((state: import("redux
|
|
|
90
90
|
order: import("./order").CustomerOrderState;
|
|
91
91
|
orders: import("./orders").CustomerOrdersState;
|
|
92
92
|
pointsShop: import("./pointsShop").PointsShopState;
|
|
93
|
+
pointsShopV2: import("./pointsShopV2").PointsShopV2State;
|
|
93
94
|
qrcode: import("./qrCode").CustomerQRCodeState;
|
|
94
95
|
rewards: import("./rewards").CustomerRewardsState;
|
|
95
96
|
thanx: import("./thanx").CustomerThanxState;
|
|
@@ -14,6 +14,7 @@ export declare const customerReducer: import("redux").Reducer<import("redux").Co
|
|
|
14
14
|
order: import("./order").CustomerOrderState;
|
|
15
15
|
orders: import("./orders").CustomerOrdersState;
|
|
16
16
|
pointsShop: import("./pointsShop").PointsShopState;
|
|
17
|
+
pointsShopV2: import("./pointsShopV2").PointsShopV2State;
|
|
17
18
|
qrcode: import("./qrCode").CustomerQRCodeState;
|
|
18
19
|
rewards: import("./rewards").CustomerRewardsState;
|
|
19
20
|
thanx: import("./thanx").CustomerThanxState;
|
|
@@ -34,6 +35,7 @@ export * from './loyalty';
|
|
|
34
35
|
export * from './order';
|
|
35
36
|
export * from './orders';
|
|
36
37
|
export * from './pointsShop';
|
|
38
|
+
export * from './pointsShopV2';
|
|
37
39
|
export * from './qrCode';
|
|
38
40
|
export * from './rewards';
|
|
39
41
|
export * from './thanx';
|
|
@@ -19,6 +19,7 @@ const loyalty_1 = require("./loyalty");
|
|
|
19
19
|
const order_1 = require("./order");
|
|
20
20
|
const orders_1 = require("./orders");
|
|
21
21
|
const pointsShop_1 = require("./pointsShop");
|
|
22
|
+
const pointsShopV2_1 = require("./pointsShopV2");
|
|
22
23
|
const qrCode_1 = require("./qrCode");
|
|
23
24
|
const rewards_1 = require("./rewards");
|
|
24
25
|
const thanx_1 = require("./thanx");
|
|
@@ -39,6 +40,7 @@ exports.customerReducer = (0, redux_1.combineReducers)({
|
|
|
39
40
|
[types_1.ReducerType.Order]: order_1.customerOrderReducer,
|
|
40
41
|
[types_1.ReducerType.Orders]: orders_1.customerOrdersReducer,
|
|
41
42
|
[types_1.ReducerType.PointsShop]: pointsShop_1.pointsShopReducer,
|
|
43
|
+
[types_1.ReducerType.PointsShopV2]: pointsShopV2_1.pointsShopV2Reducer,
|
|
42
44
|
[types_1.ReducerType.QRCode]: qrCode_1.customerQRCodeReducer,
|
|
43
45
|
[types_1.ReducerType.Rewards]: rewards_1.customerRewardsReducer,
|
|
44
46
|
[types_1.ReducerType.Thanx]: thanx_1.customerThanxReducer,
|
|
@@ -59,6 +61,7 @@ tslib_1.__exportStar(require("./loyalty"), exports);
|
|
|
59
61
|
tslib_1.__exportStar(require("./order"), exports);
|
|
60
62
|
tslib_1.__exportStar(require("./orders"), exports);
|
|
61
63
|
tslib_1.__exportStar(require("./pointsShop"), exports);
|
|
64
|
+
tslib_1.__exportStar(require("./pointsShopV2"), exports);
|
|
62
65
|
tslib_1.__exportStar(require("./qrCode"), exports);
|
|
63
66
|
tslib_1.__exportStar(require("./rewards"), exports);
|
|
64
67
|
tslib_1.__exportStar(require("./thanx"), exports);
|
|
@@ -47,6 +47,7 @@ export declare const selectCustomerLoyaltyProgram: ((state: import("redux").Empt
|
|
|
47
47
|
order: import("./order").CustomerOrderState;
|
|
48
48
|
orders: import("./orders").CustomerOrdersState;
|
|
49
49
|
pointsShop: import("./pointsShop").PointsShopState;
|
|
50
|
+
pointsShopV2: import("./pointsShopV2").PointsShopV2State;
|
|
50
51
|
qrcode: import("./qrCode").CustomerQRCodeState;
|
|
51
52
|
rewards: import("./rewards").CustomerRewardsState;
|
|
52
53
|
thanx: import("./thanx").CustomerThanxState;
|
|
@@ -125,6 +126,7 @@ export declare const selectCustomerPointsProgram: (orderType: OrderType | null)
|
|
|
125
126
|
order: import("./order").CustomerOrderState;
|
|
126
127
|
orders: import("./orders").CustomerOrdersState;
|
|
127
128
|
pointsShop: import("./pointsShop").PointsShopState;
|
|
129
|
+
pointsShopV2: import("./pointsShopV2").PointsShopV2State;
|
|
128
130
|
qrcode: import("./qrCode").CustomerQRCodeState;
|
|
129
131
|
rewards: import("./rewards").CustomerRewardsState;
|
|
130
132
|
thanx: import("./thanx").CustomerThanxState;
|
|
@@ -57,6 +57,7 @@ export declare const selectCustomerOrder: ((state: import("redux").EmptyObject &
|
|
|
57
57
|
order: CustomerOrderState;
|
|
58
58
|
orders: import("./orders").CustomerOrdersState;
|
|
59
59
|
pointsShop: import("./pointsShop").PointsShopState;
|
|
60
|
+
pointsShopV2: import("./pointsShopV2").PointsShopV2State;
|
|
60
61
|
qrcode: import("./qrCode").CustomerQRCodeState;
|
|
61
62
|
rewards: import("./rewards").CustomerRewardsState;
|
|
62
63
|
thanx: import("./thanx").CustomerThanxState;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AppState } from '../../app';
|
|
2
|
+
import { RequestError, RequestStatus, TPLSPointsShopRewardV2, TPLSPointsShopRewardsV2 } from '@open-tender/types';
|
|
3
|
+
export interface PointsShopV2State {
|
|
4
|
+
entities: TPLSPointsShopRewardsV2;
|
|
5
|
+
data: TPLSPointsShopRewardV2 | null;
|
|
6
|
+
error: RequestError;
|
|
7
|
+
loading: RequestStatus;
|
|
8
|
+
}
|
|
9
|
+
export declare enum PointsShopV2ActionType {
|
|
10
|
+
FetchPointsShop = "pointsShopV2/fetchPointsShop",
|
|
11
|
+
ExchangePointsShopReward = "pointsShopV2/exchangePointsShopReward"
|
|
12
|
+
}
|
|
13
|
+
export declare const fetchPointsShopV2: import("@reduxjs/toolkit").AsyncThunk<TPLSPointsShopRewardsV2, void, {
|
|
14
|
+
state: AppState;
|
|
15
|
+
rejectValue: RequestError;
|
|
16
|
+
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
17
|
+
extra?: unknown;
|
|
18
|
+
serializedErrorType?: unknown;
|
|
19
|
+
pendingMeta?: unknown;
|
|
20
|
+
fulfilledMeta?: unknown;
|
|
21
|
+
rejectedMeta?: unknown;
|
|
22
|
+
}>;
|
|
23
|
+
export declare const exchangePointsShopRewardV2: import("@reduxjs/toolkit").AsyncThunk<{
|
|
24
|
+
data: TPLSPointsShopRewardV2;
|
|
25
|
+
entities: TPLSPointsShopRewardsV2;
|
|
26
|
+
}, string, {
|
|
27
|
+
state: AppState;
|
|
28
|
+
rejectValue: RequestError;
|
|
29
|
+
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
30
|
+
extra?: unknown;
|
|
31
|
+
serializedErrorType?: unknown;
|
|
32
|
+
pendingMeta?: unknown;
|
|
33
|
+
fulfilledMeta?: unknown;
|
|
34
|
+
rejectedMeta?: unknown;
|
|
35
|
+
}>;
|
|
36
|
+
export declare const resetPointsShopV2: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"pointsShop/resetPointsShop">;
|
|
37
|
+
export declare const selectPointsShopV2: (state: AppState) => import("./pointsShop").PointsShopState;
|
|
38
|
+
export declare const pointsShopV2Reducer: import("redux").Reducer<PointsShopV2State, import("redux").AnyAction>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pointsShopV2Reducer = exports.selectPointsShopV2 = exports.resetPointsShopV2 = exports.exchangePointsShopRewardV2 = exports.fetchPointsShopV2 = exports.PointsShopV2ActionType = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const types_1 = require("../types");
|
|
7
|
+
const types_2 = require("@open-tender/types");
|
|
8
|
+
const account_1 = require("./account");
|
|
9
|
+
const initialState = {
|
|
10
|
+
entities: [],
|
|
11
|
+
data: null,
|
|
12
|
+
error: null,
|
|
13
|
+
loading: 'idle'
|
|
14
|
+
};
|
|
15
|
+
var PointsShopV2ActionType;
|
|
16
|
+
(function (PointsShopV2ActionType) {
|
|
17
|
+
PointsShopV2ActionType["FetchPointsShop"] = "pointsShopV2/fetchPointsShop";
|
|
18
|
+
PointsShopV2ActionType["ExchangePointsShopReward"] = "pointsShopV2/exchangePointsShopReward";
|
|
19
|
+
})(PointsShopV2ActionType = exports.PointsShopV2ActionType || (exports.PointsShopV2ActionType = {}));
|
|
20
|
+
exports.fetchPointsShopV2 = (0, toolkit_1.createAsyncThunk)(PointsShopV2ActionType.FetchPointsShop, (_, { getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
+
try {
|
|
22
|
+
const { api } = getState().config;
|
|
23
|
+
if (!api)
|
|
24
|
+
return;
|
|
25
|
+
const token = (0, account_1.selectToken)(getState());
|
|
26
|
+
if (!token)
|
|
27
|
+
throw new Error(types_2.MISSING_CUSTOMER);
|
|
28
|
+
return yield api.getPointsShopV2(token);
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
return rejectWithValue(err);
|
|
32
|
+
}
|
|
33
|
+
}));
|
|
34
|
+
exports.exchangePointsShopRewardV2 = (0, toolkit_1.createAsyncThunk)(PointsShopV2ActionType.ExchangePointsShopReward, (rewardId, { getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
35
|
+
try {
|
|
36
|
+
const { api } = getState().config;
|
|
37
|
+
if (!api)
|
|
38
|
+
return { data: null, entities: [] };
|
|
39
|
+
const token = (0, account_1.selectToken)(getState());
|
|
40
|
+
if (!token)
|
|
41
|
+
throw new Error(types_2.MISSING_CUSTOMER);
|
|
42
|
+
const data = yield api.postPointsShopRewardV2(token, rewardId);
|
|
43
|
+
const entities = yield api.getPointsShop(token);
|
|
44
|
+
return { data, entities };
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
return rejectWithValue(err);
|
|
48
|
+
}
|
|
49
|
+
}));
|
|
50
|
+
const pointsShopV2Slice = (0, toolkit_1.createSlice)({
|
|
51
|
+
name: types_1.ReducerType.PointsShop,
|
|
52
|
+
initialState,
|
|
53
|
+
reducers: {
|
|
54
|
+
resetPointsShop: () => initialState
|
|
55
|
+
},
|
|
56
|
+
extraReducers: builder => {
|
|
57
|
+
builder
|
|
58
|
+
.addCase(exports.fetchPointsShopV2.fulfilled, (state, action) => {
|
|
59
|
+
state.entities = action.payload;
|
|
60
|
+
state.loading = 'idle';
|
|
61
|
+
state.error = null;
|
|
62
|
+
})
|
|
63
|
+
.addCase(exports.fetchPointsShopV2.pending, state => {
|
|
64
|
+
state.loading = 'pending';
|
|
65
|
+
})
|
|
66
|
+
.addCase(exports.fetchPointsShopV2.rejected, (state, action) => {
|
|
67
|
+
state.error = action.payload;
|
|
68
|
+
state.loading = 'idle';
|
|
69
|
+
})
|
|
70
|
+
.addCase(exports.exchangePointsShopRewardV2.fulfilled, (state, action) => {
|
|
71
|
+
state.entities = action.payload.entities;
|
|
72
|
+
state.data = action.payload.data;
|
|
73
|
+
state.loading = 'idle';
|
|
74
|
+
state.error = null;
|
|
75
|
+
})
|
|
76
|
+
.addCase(exports.exchangePointsShopRewardV2.pending, state => {
|
|
77
|
+
state.loading = 'pending';
|
|
78
|
+
})
|
|
79
|
+
.addCase(exports.exchangePointsShopRewardV2.rejected, (state, action) => {
|
|
80
|
+
state.error = action.payload;
|
|
81
|
+
state.loading = 'idle';
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
exports.resetPointsShopV2 = pointsShopV2Slice.actions.resetPointsShop;
|
|
86
|
+
const selectPointsShopV2 = (state) => state.customer.pointsShop;
|
|
87
|
+
exports.selectPointsShopV2 = selectPointsShopV2;
|
|
88
|
+
exports.pointsShopV2Reducer = pointsShopV2Slice.reducer;
|
|
@@ -55,6 +55,7 @@ export declare const selectCustomerTplsPoints: ((state: import("redux").EmptyObj
|
|
|
55
55
|
order: import("./order").CustomerOrderState;
|
|
56
56
|
orders: import("./orders").CustomerOrdersState;
|
|
57
57
|
pointsShop: import("./pointsShop").PointsShopState;
|
|
58
|
+
pointsShopV2: import("./pointsShopV2").PointsShopV2State;
|
|
58
59
|
qrcode: import("./qrCode").CustomerQRCodeState;
|
|
59
60
|
rewards: import("./rewards").CustomerRewardsState;
|
|
60
61
|
thanx: import("./thanx").CustomerThanxState;
|
|
@@ -121,6 +122,7 @@ export declare const selectCustomerTplsRewards: ((state: import("redux").EmptyOb
|
|
|
121
122
|
order: import("./order").CustomerOrderState;
|
|
122
123
|
orders: import("./orders").CustomerOrdersState;
|
|
123
124
|
pointsShop: import("./pointsShop").PointsShopState;
|
|
125
|
+
pointsShopV2: import("./pointsShopV2").PointsShopV2State;
|
|
124
126
|
qrcode: import("./qrCode").CustomerQRCodeState;
|
|
125
127
|
rewards: import("./rewards").CustomerRewardsState;
|
|
126
128
|
thanx: import("./thanx").CustomerThanxState;
|
|
@@ -187,6 +189,7 @@ export declare const selectCustomerTplsProgress: ((state: import("redux").EmptyO
|
|
|
187
189
|
order: import("./order").CustomerOrderState;
|
|
188
190
|
orders: import("./orders").CustomerOrdersState;
|
|
189
191
|
pointsShop: import("./pointsShop").PointsShopState;
|
|
192
|
+
pointsShopV2: import("./pointsShopV2").PointsShopV2State;
|
|
190
193
|
qrcode: import("./qrCode").CustomerQRCodeState;
|
|
191
194
|
rewards: import("./rewards").CustomerRewardsState;
|
|
192
195
|
thanx: import("./thanx").CustomerThanxState;
|
|
@@ -130,6 +130,7 @@ export declare const selectSpendingLimit: ((state: import("redux").EmptyObject &
|
|
|
130
130
|
order: import("./customer").CustomerOrderState;
|
|
131
131
|
orders: import("./customer").CustomerOrdersState;
|
|
132
132
|
pointsShop: import("./customer").PointsShopState;
|
|
133
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
133
134
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
134
135
|
rewards: import("./customer").CustomerRewardsState;
|
|
135
136
|
thanx: import("./customer").CustomerThanxState;
|
|
@@ -199,6 +200,7 @@ export declare const selectGroupOrderClosed: ((state: import("redux").EmptyObjec
|
|
|
199
200
|
order: import("./customer").CustomerOrderState;
|
|
200
201
|
orders: import("./customer").CustomerOrdersState;
|
|
201
202
|
pointsShop: import("./customer").PointsShopState;
|
|
203
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
202
204
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
203
205
|
rewards: import("./customer").CustomerRewardsState;
|
|
204
206
|
thanx: import("./customer").CustomerThanxState;
|
|
@@ -270,6 +272,7 @@ export declare const selectGroupOrderTests: ((state: import("redux").EmptyObject
|
|
|
270
272
|
order: import("./customer").CustomerOrderState;
|
|
271
273
|
orders: import("./customer").CustomerOrdersState;
|
|
272
274
|
pointsShop: import("./customer").PointsShopState;
|
|
275
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
273
276
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
274
277
|
rewards: import("./customer").CustomerRewardsState;
|
|
275
278
|
thanx: import("./customer").CustomerThanxState;
|
|
@@ -350,6 +353,7 @@ export declare const selectGroupOrderPrepTimes: ((state: import("redux").EmptyOb
|
|
|
350
353
|
order: import("./customer").CustomerOrderState;
|
|
351
354
|
orders: import("./customer").CustomerOrdersState;
|
|
352
355
|
pointsShop: import("./customer").PointsShopState;
|
|
356
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
353
357
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
354
358
|
rewards: import("./customer").CustomerRewardsState;
|
|
355
359
|
thanx: import("./customer").CustomerThanxState;
|
|
@@ -152,6 +152,7 @@ export declare const selectOrderLimits: ((state: import("redux").EmptyObject & {
|
|
|
152
152
|
order: import("./customer").CustomerOrderState;
|
|
153
153
|
orders: import("./customer").CustomerOrdersState;
|
|
154
154
|
pointsShop: import("./customer").PointsShopState;
|
|
155
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
155
156
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
156
157
|
rewards: import("./customer").CustomerRewardsState;
|
|
157
158
|
thanx: import("./customer").CustomerThanxState;
|
|
@@ -229,6 +230,7 @@ export declare const selectCartIds: ((state: import("redux").EmptyObject & {
|
|
|
229
230
|
order: import("./customer").CustomerOrderState;
|
|
230
231
|
orders: import("./customer").CustomerOrdersState;
|
|
231
232
|
pointsShop: import("./customer").PointsShopState;
|
|
233
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
232
234
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
233
235
|
rewards: import("./customer").CustomerRewardsState;
|
|
234
236
|
thanx: import("./customer").CustomerThanxState;
|
|
@@ -301,6 +303,7 @@ export declare const selectMenuVars: ((state: import("redux").EmptyObject & {
|
|
|
301
303
|
order: import("./customer").CustomerOrderState;
|
|
302
304
|
orders: import("./customer").CustomerOrdersState;
|
|
303
305
|
pointsShop: import("./customer").PointsShopState;
|
|
306
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
304
307
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
305
308
|
rewards: import("./customer").CustomerRewardsState;
|
|
306
309
|
thanx: import("./customer").CustomerThanxState;
|
|
@@ -43,6 +43,7 @@ export declare const selectQuote: ((state: import("redux").EmptyObject & {
|
|
|
43
43
|
order: import("./customer").CustomerOrderState;
|
|
44
44
|
orders: import("./customer").CustomerOrdersState;
|
|
45
45
|
pointsShop: import("./customer").PointsShopState;
|
|
46
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
46
47
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
47
48
|
rewards: import("./customer").CustomerRewardsState;
|
|
48
49
|
thanx: import("./customer").CustomerThanxState;
|
|
@@ -51,6 +51,7 @@ export declare const selectSelectedTagNames: ((state: import("redux").EmptyObjec
|
|
|
51
51
|
order: import("./customer").CustomerOrderState;
|
|
52
52
|
orders: import("./customer").CustomerOrdersState;
|
|
53
53
|
pointsShop: import("./customer").PointsShopState;
|
|
54
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
54
55
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
55
56
|
rewards: import("./customer").CustomerRewardsState;
|
|
56
57
|
thanx: import("./customer").CustomerThanxState;
|
package/dist/cjs/slices/types.js
CHANGED
|
@@ -44,6 +44,7 @@ var ReducerType;
|
|
|
44
44
|
ReducerType["Orders"] = "orders";
|
|
45
45
|
ReducerType["Posts"] = "posts";
|
|
46
46
|
ReducerType["PointsShop"] = "pointsShop";
|
|
47
|
+
ReducerType["PointsShopV2"] = "pointsShopV2";
|
|
47
48
|
ReducerType["PushNotifications"] = "pushNotifications";
|
|
48
49
|
ReducerType["Qr"] = "qr";
|
|
49
50
|
ReducerType["QRCode"] = "qrcode";
|
package/dist/esm/app/hooks.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<i
|
|
|
24
24
|
order: import("..").CustomerOrderState;
|
|
25
25
|
orders: import("..").CustomerOrdersState;
|
|
26
26
|
pointsShop: import("..").PointsShopState;
|
|
27
|
+
pointsShopV2: import("..").PointsShopV2State;
|
|
27
28
|
qrcode: import("..").CustomerQRCodeState;
|
|
28
29
|
rewards: import("..").CustomerRewardsState;
|
|
29
30
|
thanx: import("..").CustomerThanxState;
|
package/dist/esm/app/store.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export declare const appReducer: import("redux").Reducer<import("redux").Combine
|
|
|
23
23
|
order: import("../slices").CustomerOrderState;
|
|
24
24
|
orders: import("../slices").CustomerOrdersState;
|
|
25
25
|
pointsShop: import("../slices").PointsShopState;
|
|
26
|
+
pointsShopV2: import("../slices").PointsShopV2State;
|
|
26
27
|
qrcode: import("../slices").CustomerQRCodeState;
|
|
27
28
|
rewards: import("../slices").CustomerRewardsState;
|
|
28
29
|
thanx: import("../slices").CustomerThanxState;
|
|
@@ -86,6 +87,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
86
87
|
order: import("../slices").CustomerOrderState;
|
|
87
88
|
orders: import("../slices").CustomerOrdersState;
|
|
88
89
|
pointsShop: import("../slices").PointsShopState;
|
|
90
|
+
pointsShopV2: import("../slices").PointsShopV2State;
|
|
89
91
|
qrcode: import("../slices").CustomerQRCodeState;
|
|
90
92
|
rewards: import("../slices").CustomerRewardsState;
|
|
91
93
|
thanx: import("../slices").CustomerThanxState;
|
|
@@ -147,6 +149,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
147
149
|
order: import("../slices").CustomerOrderState;
|
|
148
150
|
orders: import("../slices").CustomerOrdersState;
|
|
149
151
|
pointsShop: import("../slices").PointsShopState;
|
|
152
|
+
pointsShopV2: import("../slices").PointsShopV2State;
|
|
150
153
|
qrcode: import("../slices").CustomerQRCodeState;
|
|
151
154
|
rewards: import("../slices").CustomerRewardsState;
|
|
152
155
|
thanx: import("../slices").CustomerThanxState;
|
|
@@ -119,6 +119,8 @@ declare class OpenTenderAPI {
|
|
|
119
119
|
postVerifyAccount(verifyToken: string): Promise<unknown>;
|
|
120
120
|
getCustomerQRCode(token: string): Promise<unknown>;
|
|
121
121
|
getCustomerRewards(token: string): Promise<unknown>;
|
|
122
|
+
getPointsShopV2(token: string): Promise<unknown>;
|
|
123
|
+
postPointsShopRewardV2(token: string, rewardId: string): Promise<unknown>;
|
|
122
124
|
getPointsShop(token: string): Promise<unknown>;
|
|
123
125
|
postPointsShopReward(token: string, rewardId: string): Promise<unknown>;
|
|
124
126
|
getCustomerOrders(token: string, limit: number, timing: string): Promise<unknown>;
|
package/dist/esm/services/api.js
CHANGED
|
@@ -560,6 +560,12 @@ class OpenTenderAPI {
|
|
|
560
560
|
getCustomerRewards(token) {
|
|
561
561
|
return this.request(`/customer/rewards?with_related=true`, 'GET', null, null, token);
|
|
562
562
|
}
|
|
563
|
+
getPointsShopV2(token) {
|
|
564
|
+
return this.request(`/v2/points-shop`, 'GET', null, null, token);
|
|
565
|
+
}
|
|
566
|
+
postPointsShopRewardV2(token, rewardId) {
|
|
567
|
+
return this.request(`/v2/points-shop/${rewardId}/exchange`, 'POST', null, null, token);
|
|
568
|
+
}
|
|
563
569
|
getPointsShop(token) {
|
|
564
570
|
return this.request(`/points-shop/rewards`, 'GET', null, null, token);
|
|
565
571
|
}
|
|
@@ -51,6 +51,7 @@ export declare const selectSelectedAllergenNames: ((state: import("redux").Empty
|
|
|
51
51
|
order: import("./customer").CustomerOrderState;
|
|
52
52
|
orders: import("./customer").CustomerOrdersState;
|
|
53
53
|
pointsShop: import("./customer").PointsShopState;
|
|
54
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
54
55
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
55
56
|
rewards: import("./customer").CustomerRewardsState;
|
|
56
57
|
thanx: import("./customer").CustomerThanxState;
|
|
@@ -48,6 +48,7 @@ export declare const selectAnnouncementsPage: (page: AnnouncementPageType) => ((
|
|
|
48
48
|
order: import("./customer").CustomerOrderState;
|
|
49
49
|
orders: import("./customer").CustomerOrdersState;
|
|
50
50
|
pointsShop: import("./customer").PointsShopState;
|
|
51
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
51
52
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
52
53
|
rewards: import("./customer").CustomerRewardsState;
|
|
53
54
|
thanx: import("./customer").CustomerThanxState;
|
|
@@ -128,6 +129,7 @@ export declare const selectHasAnnouncementsPage: (page: AnnouncementPageType) =>
|
|
|
128
129
|
order: import("./customer").CustomerOrderState;
|
|
129
130
|
orders: import("./customer").CustomerOrdersState;
|
|
130
131
|
pointsShop: import("./customer").PointsShopState;
|
|
132
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
131
133
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
132
134
|
rewards: import("./customer").CustomerRewardsState;
|
|
133
135
|
thanx: import("./customer").CustomerThanxState;
|
|
@@ -111,6 +111,7 @@ export declare const selectOptIns: ((state: import("redux").EmptyObject & {
|
|
|
111
111
|
order: import("./customer").CustomerOrderState;
|
|
112
112
|
orders: import("./customer").CustomerOrdersState;
|
|
113
113
|
pointsShop: import("./customer").PointsShopState;
|
|
114
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
114
115
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
115
116
|
rewards: import("./customer").CustomerRewardsState;
|
|
116
117
|
thanx: import("./customer").CustomerThanxState;
|
|
@@ -191,6 +192,7 @@ export declare const selectBottomTabsTitles: ((state: import("redux").EmptyObjec
|
|
|
191
192
|
order: import("./customer").CustomerOrderState;
|
|
192
193
|
orders: import("./customer").CustomerOrdersState;
|
|
193
194
|
pointsShop: import("./customer").PointsShopState;
|
|
195
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
194
196
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
195
197
|
rewards: import("./customer").CustomerRewardsState;
|
|
196
198
|
thanx: import("./customer").CustomerThanxState;
|
|
@@ -90,6 +90,7 @@ export declare const selectCustomerCreditCardsForPayment: ((state: import("redux
|
|
|
90
90
|
order: import("./order").CustomerOrderState;
|
|
91
91
|
orders: import("./orders").CustomerOrdersState;
|
|
92
92
|
pointsShop: import("./pointsShop").PointsShopState;
|
|
93
|
+
pointsShopV2: import("./pointsShopV2").PointsShopV2State;
|
|
93
94
|
qrcode: import("./qrCode").CustomerQRCodeState;
|
|
94
95
|
rewards: import("./rewards").CustomerRewardsState;
|
|
95
96
|
thanx: import("./thanx").CustomerThanxState;
|
|
@@ -14,6 +14,7 @@ export declare const customerReducer: import("redux").Reducer<import("redux").Co
|
|
|
14
14
|
order: import("./order").CustomerOrderState;
|
|
15
15
|
orders: import("./orders").CustomerOrdersState;
|
|
16
16
|
pointsShop: import("./pointsShop").PointsShopState;
|
|
17
|
+
pointsShopV2: import("./pointsShopV2").PointsShopV2State;
|
|
17
18
|
qrcode: import("./qrCode").CustomerQRCodeState;
|
|
18
19
|
rewards: import("./rewards").CustomerRewardsState;
|
|
19
20
|
thanx: import("./thanx").CustomerThanxState;
|
|
@@ -34,6 +35,7 @@ export * from './loyalty';
|
|
|
34
35
|
export * from './order';
|
|
35
36
|
export * from './orders';
|
|
36
37
|
export * from './pointsShop';
|
|
38
|
+
export * from './pointsShopV2';
|
|
37
39
|
export * from './qrCode';
|
|
38
40
|
export * from './rewards';
|
|
39
41
|
export * from './thanx';
|
|
@@ -15,6 +15,7 @@ import { customerLoyaltyReducer } from './loyalty';
|
|
|
15
15
|
import { customerOrderReducer } from './order';
|
|
16
16
|
import { customerOrdersReducer } from './orders';
|
|
17
17
|
import { pointsShopReducer } from './pointsShop';
|
|
18
|
+
import { pointsShopV2Reducer } from './pointsShopV2';
|
|
18
19
|
import { customerQRCodeReducer } from './qrCode';
|
|
19
20
|
import { customerRewardsReducer } from './rewards';
|
|
20
21
|
import { customerThanxReducer } from './thanx';
|
|
@@ -35,6 +36,7 @@ export const customerReducer = combineReducers({
|
|
|
35
36
|
[ReducerType.Order]: customerOrderReducer,
|
|
36
37
|
[ReducerType.Orders]: customerOrdersReducer,
|
|
37
38
|
[ReducerType.PointsShop]: pointsShopReducer,
|
|
39
|
+
[ReducerType.PointsShopV2]: pointsShopV2Reducer,
|
|
38
40
|
[ReducerType.QRCode]: customerQRCodeReducer,
|
|
39
41
|
[ReducerType.Rewards]: customerRewardsReducer,
|
|
40
42
|
[ReducerType.Thanx]: customerThanxReducer,
|
|
@@ -55,6 +57,7 @@ export * from './loyalty';
|
|
|
55
57
|
export * from './order';
|
|
56
58
|
export * from './orders';
|
|
57
59
|
export * from './pointsShop';
|
|
60
|
+
export * from './pointsShopV2';
|
|
58
61
|
export * from './qrCode';
|
|
59
62
|
export * from './rewards';
|
|
60
63
|
export * from './thanx';
|
|
@@ -47,6 +47,7 @@ export declare const selectCustomerLoyaltyProgram: ((state: import("redux").Empt
|
|
|
47
47
|
order: import("./order").CustomerOrderState;
|
|
48
48
|
orders: import("./orders").CustomerOrdersState;
|
|
49
49
|
pointsShop: import("./pointsShop").PointsShopState;
|
|
50
|
+
pointsShopV2: import("./pointsShopV2").PointsShopV2State;
|
|
50
51
|
qrcode: import("./qrCode").CustomerQRCodeState;
|
|
51
52
|
rewards: import("./rewards").CustomerRewardsState;
|
|
52
53
|
thanx: import("./thanx").CustomerThanxState;
|
|
@@ -125,6 +126,7 @@ export declare const selectCustomerPointsProgram: (orderType: OrderType | null)
|
|
|
125
126
|
order: import("./order").CustomerOrderState;
|
|
126
127
|
orders: import("./orders").CustomerOrdersState;
|
|
127
128
|
pointsShop: import("./pointsShop").PointsShopState;
|
|
129
|
+
pointsShopV2: import("./pointsShopV2").PointsShopV2State;
|
|
128
130
|
qrcode: import("./qrCode").CustomerQRCodeState;
|
|
129
131
|
rewards: import("./rewards").CustomerRewardsState;
|
|
130
132
|
thanx: import("./thanx").CustomerThanxState;
|
|
@@ -57,6 +57,7 @@ export declare const selectCustomerOrder: ((state: import("redux").EmptyObject &
|
|
|
57
57
|
order: CustomerOrderState;
|
|
58
58
|
orders: import("./orders").CustomerOrdersState;
|
|
59
59
|
pointsShop: import("./pointsShop").PointsShopState;
|
|
60
|
+
pointsShopV2: import("./pointsShopV2").PointsShopV2State;
|
|
60
61
|
qrcode: import("./qrCode").CustomerQRCodeState;
|
|
61
62
|
rewards: import("./rewards").CustomerRewardsState;
|
|
62
63
|
thanx: import("./thanx").CustomerThanxState;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AppState } from '../../app';
|
|
2
|
+
import { RequestError, RequestStatus, TPLSPointsShopRewardV2, TPLSPointsShopRewardsV2 } from '@open-tender/types';
|
|
3
|
+
export interface PointsShopV2State {
|
|
4
|
+
entities: TPLSPointsShopRewardsV2;
|
|
5
|
+
data: TPLSPointsShopRewardV2 | null;
|
|
6
|
+
error: RequestError;
|
|
7
|
+
loading: RequestStatus;
|
|
8
|
+
}
|
|
9
|
+
export declare enum PointsShopV2ActionType {
|
|
10
|
+
FetchPointsShop = "pointsShopV2/fetchPointsShop",
|
|
11
|
+
ExchangePointsShopReward = "pointsShopV2/exchangePointsShopReward"
|
|
12
|
+
}
|
|
13
|
+
export declare const fetchPointsShopV2: import("@reduxjs/toolkit").AsyncThunk<TPLSPointsShopRewardsV2, void, {
|
|
14
|
+
state: AppState;
|
|
15
|
+
rejectValue: RequestError;
|
|
16
|
+
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
17
|
+
extra?: unknown;
|
|
18
|
+
serializedErrorType?: unknown;
|
|
19
|
+
pendingMeta?: unknown;
|
|
20
|
+
fulfilledMeta?: unknown;
|
|
21
|
+
rejectedMeta?: unknown;
|
|
22
|
+
}>;
|
|
23
|
+
export declare const exchangePointsShopRewardV2: import("@reduxjs/toolkit").AsyncThunk<{
|
|
24
|
+
data: TPLSPointsShopRewardV2;
|
|
25
|
+
entities: TPLSPointsShopRewardsV2;
|
|
26
|
+
}, string, {
|
|
27
|
+
state: AppState;
|
|
28
|
+
rejectValue: RequestError;
|
|
29
|
+
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
30
|
+
extra?: unknown;
|
|
31
|
+
serializedErrorType?: unknown;
|
|
32
|
+
pendingMeta?: unknown;
|
|
33
|
+
fulfilledMeta?: unknown;
|
|
34
|
+
rejectedMeta?: unknown;
|
|
35
|
+
}>;
|
|
36
|
+
export declare const resetPointsShopV2: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"pointsShop/resetPointsShop">;
|
|
37
|
+
export declare const selectPointsShopV2: (state: AppState) => import("./pointsShop").PointsShopState;
|
|
38
|
+
export declare const pointsShopV2Reducer: import("redux").Reducer<PointsShopV2State, import("redux").AnyAction>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
3
|
+
import { ReducerType } from '../types';
|
|
4
|
+
import { MISSING_CUSTOMER } from '@open-tender/types';
|
|
5
|
+
import { selectToken } from './account';
|
|
6
|
+
const initialState = {
|
|
7
|
+
entities: [],
|
|
8
|
+
data: null,
|
|
9
|
+
error: null,
|
|
10
|
+
loading: 'idle'
|
|
11
|
+
};
|
|
12
|
+
export var PointsShopV2ActionType;
|
|
13
|
+
(function (PointsShopV2ActionType) {
|
|
14
|
+
PointsShopV2ActionType["FetchPointsShop"] = "pointsShopV2/fetchPointsShop";
|
|
15
|
+
PointsShopV2ActionType["ExchangePointsShopReward"] = "pointsShopV2/exchangePointsShopReward";
|
|
16
|
+
})(PointsShopV2ActionType || (PointsShopV2ActionType = {}));
|
|
17
|
+
export const fetchPointsShopV2 = createAsyncThunk(PointsShopV2ActionType.FetchPointsShop, (_, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
try {
|
|
19
|
+
const { api } = getState().config;
|
|
20
|
+
if (!api)
|
|
21
|
+
return;
|
|
22
|
+
const token = selectToken(getState());
|
|
23
|
+
if (!token)
|
|
24
|
+
throw new Error(MISSING_CUSTOMER);
|
|
25
|
+
return yield api.getPointsShopV2(token);
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
return rejectWithValue(err);
|
|
29
|
+
}
|
|
30
|
+
}));
|
|
31
|
+
export const exchangePointsShopRewardV2 = createAsyncThunk(PointsShopV2ActionType.ExchangePointsShopReward, (rewardId, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
|
+
try {
|
|
33
|
+
const { api } = getState().config;
|
|
34
|
+
if (!api)
|
|
35
|
+
return { data: null, entities: [] };
|
|
36
|
+
const token = selectToken(getState());
|
|
37
|
+
if (!token)
|
|
38
|
+
throw new Error(MISSING_CUSTOMER);
|
|
39
|
+
const data = yield api.postPointsShopRewardV2(token, rewardId);
|
|
40
|
+
const entities = yield api.getPointsShop(token);
|
|
41
|
+
return { data, entities };
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
return rejectWithValue(err);
|
|
45
|
+
}
|
|
46
|
+
}));
|
|
47
|
+
const pointsShopV2Slice = createSlice({
|
|
48
|
+
name: ReducerType.PointsShop,
|
|
49
|
+
initialState,
|
|
50
|
+
reducers: {
|
|
51
|
+
resetPointsShop: () => initialState
|
|
52
|
+
},
|
|
53
|
+
extraReducers: builder => {
|
|
54
|
+
builder
|
|
55
|
+
.addCase(fetchPointsShopV2.fulfilled, (state, action) => {
|
|
56
|
+
state.entities = action.payload;
|
|
57
|
+
state.loading = 'idle';
|
|
58
|
+
state.error = null;
|
|
59
|
+
})
|
|
60
|
+
.addCase(fetchPointsShopV2.pending, state => {
|
|
61
|
+
state.loading = 'pending';
|
|
62
|
+
})
|
|
63
|
+
.addCase(fetchPointsShopV2.rejected, (state, action) => {
|
|
64
|
+
state.error = action.payload;
|
|
65
|
+
state.loading = 'idle';
|
|
66
|
+
})
|
|
67
|
+
.addCase(exchangePointsShopRewardV2.fulfilled, (state, action) => {
|
|
68
|
+
state.entities = action.payload.entities;
|
|
69
|
+
state.data = action.payload.data;
|
|
70
|
+
state.loading = 'idle';
|
|
71
|
+
state.error = null;
|
|
72
|
+
})
|
|
73
|
+
.addCase(exchangePointsShopRewardV2.pending, state => {
|
|
74
|
+
state.loading = 'pending';
|
|
75
|
+
})
|
|
76
|
+
.addCase(exchangePointsShopRewardV2.rejected, (state, action) => {
|
|
77
|
+
state.error = action.payload;
|
|
78
|
+
state.loading = 'idle';
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
export const { resetPointsShop: resetPointsShopV2 } = pointsShopV2Slice.actions;
|
|
83
|
+
export const selectPointsShopV2 = (state) => state.customer.pointsShop;
|
|
84
|
+
export const pointsShopV2Reducer = pointsShopV2Slice.reducer;
|
|
@@ -55,6 +55,7 @@ export declare const selectCustomerTplsPoints: ((state: import("redux").EmptyObj
|
|
|
55
55
|
order: import("./order").CustomerOrderState;
|
|
56
56
|
orders: import("./orders").CustomerOrdersState;
|
|
57
57
|
pointsShop: import("./pointsShop").PointsShopState;
|
|
58
|
+
pointsShopV2: import("./pointsShopV2").PointsShopV2State;
|
|
58
59
|
qrcode: import("./qrCode").CustomerQRCodeState;
|
|
59
60
|
rewards: import("./rewards").CustomerRewardsState;
|
|
60
61
|
thanx: import("./thanx").CustomerThanxState;
|
|
@@ -121,6 +122,7 @@ export declare const selectCustomerTplsRewards: ((state: import("redux").EmptyOb
|
|
|
121
122
|
order: import("./order").CustomerOrderState;
|
|
122
123
|
orders: import("./orders").CustomerOrdersState;
|
|
123
124
|
pointsShop: import("./pointsShop").PointsShopState;
|
|
125
|
+
pointsShopV2: import("./pointsShopV2").PointsShopV2State;
|
|
124
126
|
qrcode: import("./qrCode").CustomerQRCodeState;
|
|
125
127
|
rewards: import("./rewards").CustomerRewardsState;
|
|
126
128
|
thanx: import("./thanx").CustomerThanxState;
|
|
@@ -187,6 +189,7 @@ export declare const selectCustomerTplsProgress: ((state: import("redux").EmptyO
|
|
|
187
189
|
order: import("./order").CustomerOrderState;
|
|
188
190
|
orders: import("./orders").CustomerOrdersState;
|
|
189
191
|
pointsShop: import("./pointsShop").PointsShopState;
|
|
192
|
+
pointsShopV2: import("./pointsShopV2").PointsShopV2State;
|
|
190
193
|
qrcode: import("./qrCode").CustomerQRCodeState;
|
|
191
194
|
rewards: import("./rewards").CustomerRewardsState;
|
|
192
195
|
thanx: import("./thanx").CustomerThanxState;
|
|
@@ -130,6 +130,7 @@ export declare const selectSpendingLimit: ((state: import("redux").EmptyObject &
|
|
|
130
130
|
order: import("./customer").CustomerOrderState;
|
|
131
131
|
orders: import("./customer").CustomerOrdersState;
|
|
132
132
|
pointsShop: import("./customer").PointsShopState;
|
|
133
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
133
134
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
134
135
|
rewards: import("./customer").CustomerRewardsState;
|
|
135
136
|
thanx: import("./customer").CustomerThanxState;
|
|
@@ -199,6 +200,7 @@ export declare const selectGroupOrderClosed: ((state: import("redux").EmptyObjec
|
|
|
199
200
|
order: import("./customer").CustomerOrderState;
|
|
200
201
|
orders: import("./customer").CustomerOrdersState;
|
|
201
202
|
pointsShop: import("./customer").PointsShopState;
|
|
203
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
202
204
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
203
205
|
rewards: import("./customer").CustomerRewardsState;
|
|
204
206
|
thanx: import("./customer").CustomerThanxState;
|
|
@@ -270,6 +272,7 @@ export declare const selectGroupOrderTests: ((state: import("redux").EmptyObject
|
|
|
270
272
|
order: import("./customer").CustomerOrderState;
|
|
271
273
|
orders: import("./customer").CustomerOrdersState;
|
|
272
274
|
pointsShop: import("./customer").PointsShopState;
|
|
275
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
273
276
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
274
277
|
rewards: import("./customer").CustomerRewardsState;
|
|
275
278
|
thanx: import("./customer").CustomerThanxState;
|
|
@@ -350,6 +353,7 @@ export declare const selectGroupOrderPrepTimes: ((state: import("redux").EmptyOb
|
|
|
350
353
|
order: import("./customer").CustomerOrderState;
|
|
351
354
|
orders: import("./customer").CustomerOrdersState;
|
|
352
355
|
pointsShop: import("./customer").PointsShopState;
|
|
356
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
353
357
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
354
358
|
rewards: import("./customer").CustomerRewardsState;
|
|
355
359
|
thanx: import("./customer").CustomerThanxState;
|
|
@@ -152,6 +152,7 @@ export declare const selectOrderLimits: ((state: import("redux").EmptyObject & {
|
|
|
152
152
|
order: import("./customer").CustomerOrderState;
|
|
153
153
|
orders: import("./customer").CustomerOrdersState;
|
|
154
154
|
pointsShop: import("./customer").PointsShopState;
|
|
155
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
155
156
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
156
157
|
rewards: import("./customer").CustomerRewardsState;
|
|
157
158
|
thanx: import("./customer").CustomerThanxState;
|
|
@@ -229,6 +230,7 @@ export declare const selectCartIds: ((state: import("redux").EmptyObject & {
|
|
|
229
230
|
order: import("./customer").CustomerOrderState;
|
|
230
231
|
orders: import("./customer").CustomerOrdersState;
|
|
231
232
|
pointsShop: import("./customer").PointsShopState;
|
|
233
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
232
234
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
233
235
|
rewards: import("./customer").CustomerRewardsState;
|
|
234
236
|
thanx: import("./customer").CustomerThanxState;
|
|
@@ -301,6 +303,7 @@ export declare const selectMenuVars: ((state: import("redux").EmptyObject & {
|
|
|
301
303
|
order: import("./customer").CustomerOrderState;
|
|
302
304
|
orders: import("./customer").CustomerOrdersState;
|
|
303
305
|
pointsShop: import("./customer").PointsShopState;
|
|
306
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
304
307
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
305
308
|
rewards: import("./customer").CustomerRewardsState;
|
|
306
309
|
thanx: import("./customer").CustomerThanxState;
|
|
@@ -43,6 +43,7 @@ export declare const selectQuote: ((state: import("redux").EmptyObject & {
|
|
|
43
43
|
order: import("./customer").CustomerOrderState;
|
|
44
44
|
orders: import("./customer").CustomerOrdersState;
|
|
45
45
|
pointsShop: import("./customer").PointsShopState;
|
|
46
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
46
47
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
47
48
|
rewards: import("./customer").CustomerRewardsState;
|
|
48
49
|
thanx: import("./customer").CustomerThanxState;
|
|
@@ -51,6 +51,7 @@ export declare const selectSelectedTagNames: ((state: import("redux").EmptyObjec
|
|
|
51
51
|
order: import("./customer").CustomerOrderState;
|
|
52
52
|
orders: import("./customer").CustomerOrdersState;
|
|
53
53
|
pointsShop: import("./customer").PointsShopState;
|
|
54
|
+
pointsShopV2: import("./customer").PointsShopV2State;
|
|
54
55
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
55
56
|
rewards: import("./customer").CustomerRewardsState;
|
|
56
57
|
thanx: import("./customer").CustomerThanxState;
|
package/dist/esm/slices/types.js
CHANGED
|
@@ -41,6 +41,7 @@ export var ReducerType;
|
|
|
41
41
|
ReducerType["Orders"] = "orders";
|
|
42
42
|
ReducerType["Posts"] = "posts";
|
|
43
43
|
ReducerType["PointsShop"] = "pointsShop";
|
|
44
|
+
ReducerType["PointsShopV2"] = "pointsShopV2";
|
|
44
45
|
ReducerType["PushNotifications"] = "pushNotifications";
|
|
45
46
|
ReducerType["Qr"] = "qr";
|
|
46
47
|
ReducerType["QRCode"] = "qrcode";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/cloud",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.14",
|
|
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",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"scripts": {
|
|
12
|
+
"prepublish": "yarn build",
|
|
12
13
|
"build": "rm -rf ./dist/ && yarn build:esm && yarn build:cjs",
|
|
13
14
|
"build:esm": "tsc",
|
|
14
15
|
"build:cjs": "tsc --module commonjs --outDir dist/cjs",
|
|
@@ -49,13 +50,13 @@
|
|
|
49
50
|
"typescript": "^4.8.2"
|
|
50
51
|
},
|
|
51
52
|
"peerDependencies": {
|
|
52
|
-
"@open-tender/types": "^0.4.
|
|
53
|
+
"@open-tender/types": "^0.4.44",
|
|
53
54
|
"@open-tender/utils": "^0.4.6",
|
|
54
55
|
"@reduxjs/toolkit": "^1.8.5",
|
|
55
56
|
"react": "^18.2.0"
|
|
56
57
|
},
|
|
57
58
|
"dependencies": {
|
|
58
|
-
"@open-tender/types": "^0.4.
|
|
59
|
+
"@open-tender/types": "^0.4.44",
|
|
59
60
|
"@open-tender/utils": "^0.4.6"
|
|
60
61
|
}
|
|
61
62
|
}
|