@open-tender/cloud 0.4.15 → 0.4.16

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.
Files changed (51) hide show
  1. package/dist/cjs/app/hooks.d.ts +1 -1
  2. package/dist/cjs/app/store.d.ts +3 -3
  3. package/dist/cjs/services/api.d.ts +2 -2
  4. package/dist/cjs/services/api.js +8 -8
  5. package/dist/cjs/slices/allergens.d.ts +1 -1
  6. package/dist/cjs/slices/announcements.d.ts +2 -2
  7. package/dist/cjs/slices/config.d.ts +2 -2
  8. package/dist/cjs/slices/customer/creditCards.d.ts +1 -1
  9. package/dist/cjs/slices/customer/index.d.ts +2 -2
  10. package/dist/cjs/slices/customer/index.js +3 -3
  11. package/dist/cjs/slices/customer/loyalty.d.ts +2 -2
  12. package/dist/cjs/slices/customer/order.d.ts +1 -1
  13. package/dist/cjs/slices/customer/pointsShop.d.ts +9 -9
  14. package/dist/cjs/slices/customer/pointsShop.js +7 -7
  15. package/dist/cjs/slices/customer/tpls.d.ts +3 -3
  16. package/dist/cjs/slices/customer/tplsPointsShop.d.ts +38 -0
  17. package/dist/cjs/slices/customer/tplsPointsShop.js +88 -0
  18. package/dist/cjs/slices/groupOrder.d.ts +4 -4
  19. package/dist/cjs/slices/order.d.ts +3 -3
  20. package/dist/cjs/slices/quote.d.ts +1 -1
  21. package/dist/cjs/slices/tags.d.ts +1 -1
  22. package/dist/cjs/slices/types.d.ts +1 -1
  23. package/dist/cjs/slices/types.js +1 -1
  24. package/dist/esm/app/hooks.d.ts +1 -1
  25. package/dist/esm/app/store.d.ts +3 -3
  26. package/dist/esm/services/api.d.ts +2 -2
  27. package/dist/esm/services/api.js +8 -8
  28. package/dist/esm/slices/allergens.d.ts +1 -1
  29. package/dist/esm/slices/announcements.d.ts +2 -2
  30. package/dist/esm/slices/config.d.ts +2 -2
  31. package/dist/esm/slices/customer/creditCards.d.ts +1 -1
  32. package/dist/esm/slices/customer/index.d.ts +2 -2
  33. package/dist/esm/slices/customer/index.js +3 -3
  34. package/dist/esm/slices/customer/loyalty.d.ts +2 -2
  35. package/dist/esm/slices/customer/order.d.ts +1 -1
  36. package/dist/esm/slices/customer/pointsShop.d.ts +9 -9
  37. package/dist/esm/slices/customer/pointsShop.js +7 -7
  38. package/dist/esm/slices/customer/tpls.d.ts +3 -3
  39. package/dist/esm/slices/customer/tplsPointsShop.d.ts +38 -0
  40. package/dist/esm/slices/customer/tplsPointsShop.js +84 -0
  41. package/dist/esm/slices/groupOrder.d.ts +4 -4
  42. package/dist/esm/slices/order.d.ts +3 -3
  43. package/dist/esm/slices/quote.d.ts +1 -1
  44. package/dist/esm/slices/tags.d.ts +1 -1
  45. package/dist/esm/slices/types.d.ts +1 -1
  46. package/dist/esm/slices/types.js +1 -1
  47. package/package.json +2 -2
  48. package/dist/cjs/slices/customer/pointsShopV2.d.ts +0 -38
  49. package/dist/cjs/slices/customer/pointsShopV2.js +0 -88
  50. package/dist/esm/slices/customer/pointsShopV2.d.ts +0 -38
  51. package/dist/esm/slices/customer/pointsShopV2.js +0 -84
@@ -560,17 +560,17 @@ 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
- }
569
563
  getPointsShop(token) {
570
- return this.request(`/points-shop/rewards`, 'GET', null, null, token);
564
+ return this.request(`/points-shop`, 'GET', null, null, token);
571
565
  }
572
566
  postPointsShopReward(token, rewardId) {
573
- return this.request(`/points-shop/rewards/${rewardId}/exchange`, 'POST', null, null, token);
567
+ return this.request(`/points-shop/${rewardId}/exchange`, 'POST', null, null, token);
568
+ }
569
+ getTplsPointsShop(token) {
570
+ return this.request(`/tpls/points-shop`, 'GET', null, null, token);
571
+ }
572
+ postTplsPointsShopReward(token, rewardId) {
573
+ return this.request(`/tpls/points-shop/${rewardId}/exchange`, 'POST', null, null, token);
574
574
  }
575
575
  getCustomerOrders(token, limit, timing) {
576
576
  let params = [];
@@ -51,7 +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
+ tplsPointsShop: import("./customer").TplsPointsShopState;
55
55
  qrcode: import("./customer").CustomerQRCodeState;
56
56
  rewards: import("./customer").CustomerRewardsState;
57
57
  thanx: import("./customer").CustomerThanxState;
@@ -48,7 +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
+ tplsPointsShop: import("./customer").TplsPointsShopState;
52
52
  qrcode: import("./customer").CustomerQRCodeState;
53
53
  rewards: import("./customer").CustomerRewardsState;
54
54
  thanx: import("./customer").CustomerThanxState;
@@ -129,7 +129,7 @@ export declare const selectHasAnnouncementsPage: (page: AnnouncementPageType) =>
129
129
  order: import("./customer").CustomerOrderState;
130
130
  orders: import("./customer").CustomerOrdersState;
131
131
  pointsShop: import("./customer").PointsShopState;
132
- pointsShopV2: import("./customer").PointsShopV2State;
132
+ tplsPointsShop: import("./customer").TplsPointsShopState;
133
133
  qrcode: import("./customer").CustomerQRCodeState;
134
134
  rewards: import("./customer").CustomerRewardsState;
135
135
  thanx: import("./customer").CustomerThanxState;
@@ -111,7 +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
+ tplsPointsShop: import("./customer").TplsPointsShopState;
115
115
  qrcode: import("./customer").CustomerQRCodeState;
116
116
  rewards: import("./customer").CustomerRewardsState;
117
117
  thanx: import("./customer").CustomerThanxState;
@@ -192,7 +192,7 @@ export declare const selectBottomTabsTitles: ((state: import("redux").EmptyObjec
192
192
  order: import("./customer").CustomerOrderState;
193
193
  orders: import("./customer").CustomerOrdersState;
194
194
  pointsShop: import("./customer").PointsShopState;
195
- pointsShopV2: import("./customer").PointsShopV2State;
195
+ tplsPointsShop: import("./customer").TplsPointsShopState;
196
196
  qrcode: import("./customer").CustomerQRCodeState;
197
197
  rewards: import("./customer").CustomerRewardsState;
198
198
  thanx: import("./customer").CustomerThanxState;
@@ -90,7 +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
+ tplsPointsShop: import("./tplsPointsShop").TplsPointsShopState;
94
94
  qrcode: import("./qrCode").CustomerQRCodeState;
95
95
  rewards: import("./rewards").CustomerRewardsState;
96
96
  thanx: import("./thanx").CustomerThanxState;
@@ -14,7 +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
+ tplsPointsShop: import("./tplsPointsShop").TplsPointsShopState;
18
18
  qrcode: import("./qrCode").CustomerQRCodeState;
19
19
  rewards: import("./rewards").CustomerRewardsState;
20
20
  thanx: import("./thanx").CustomerThanxState;
@@ -35,8 +35,8 @@ export * from './loyalty';
35
35
  export * from './order';
36
36
  export * from './orders';
37
37
  export * from './pointsShop';
38
- export * from './pointsShopV2';
39
38
  export * from './qrCode';
40
39
  export * from './rewards';
41
40
  export * from './thanx';
42
41
  export * from './tpls';
42
+ export * from './tplsPointsShop';
@@ -15,7 +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
+ import { tplsPointsShopReducer } from './tplsPointsShop';
19
19
  import { customerQRCodeReducer } from './qrCode';
20
20
  import { customerRewardsReducer } from './rewards';
21
21
  import { customerThanxReducer } from './thanx';
@@ -36,7 +36,7 @@ export const customerReducer = combineReducers({
36
36
  [ReducerType.Order]: customerOrderReducer,
37
37
  [ReducerType.Orders]: customerOrdersReducer,
38
38
  [ReducerType.PointsShop]: pointsShopReducer,
39
- [ReducerType.PointsShopV2]: pointsShopV2Reducer,
39
+ [ReducerType.TplsPointsShop]: tplsPointsShopReducer,
40
40
  [ReducerType.QRCode]: customerQRCodeReducer,
41
41
  [ReducerType.Rewards]: customerRewardsReducer,
42
42
  [ReducerType.Thanx]: customerThanxReducer,
@@ -57,8 +57,8 @@ export * from './loyalty';
57
57
  export * from './order';
58
58
  export * from './orders';
59
59
  export * from './pointsShop';
60
- export * from './pointsShopV2';
61
60
  export * from './qrCode';
62
61
  export * from './rewards';
63
62
  export * from './thanx';
64
63
  export * from './tpls';
64
+ export * from './tplsPointsShop';
@@ -47,7 +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
+ tplsPointsShop: import("./tplsPointsShop").TplsPointsShopState;
51
51
  qrcode: import("./qrCode").CustomerQRCodeState;
52
52
  rewards: import("./rewards").CustomerRewardsState;
53
53
  thanx: import("./thanx").CustomerThanxState;
@@ -126,7 +126,7 @@ export declare const selectCustomerPointsProgram: (orderType: OrderType | null)
126
126
  order: import("./order").CustomerOrderState;
127
127
  orders: import("./orders").CustomerOrdersState;
128
128
  pointsShop: import("./pointsShop").PointsShopState;
129
- pointsShopV2: import("./pointsShopV2").PointsShopV2State;
129
+ tplsPointsShop: import("./tplsPointsShop").TplsPointsShopState;
130
130
  qrcode: import("./qrCode").CustomerQRCodeState;
131
131
  rewards: import("./rewards").CustomerRewardsState;
132
132
  thanx: import("./thanx").CustomerThanxState;
@@ -57,7 +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
+ tplsPointsShop: import("./tplsPointsShop").TplsPointsShopState;
61
61
  qrcode: import("./qrCode").CustomerQRCodeState;
62
62
  rewards: import("./rewards").CustomerRewardsState;
63
63
  thanx: import("./thanx").CustomerThanxState;
@@ -1,16 +1,16 @@
1
1
  import { AppState } from '../../app';
2
- import { RequestError, RequestStatus, TPLSPointsShopReward, TPLSPointsShopRewards } from '@open-tender/types';
2
+ import { Discount, Discounts, RequestError, RequestStatus } from '@open-tender/types';
3
3
  export interface PointsShopState {
4
- entities: TPLSPointsShopRewards;
5
- data: TPLSPointsShopReward | null;
4
+ entities: Discounts;
5
+ data: Discount | null;
6
6
  error: RequestError;
7
7
  loading: RequestStatus;
8
8
  }
9
9
  export declare enum PointsShopActionType {
10
- FetchPointsShop = "pointsShop/fetchPointsShop",
11
- ExchangePointsShopReward = "pointsShop/exchangePointsShopReward"
10
+ FetchPointsShop = "pointsShopV2/fetchPointsShop",
11
+ ExchangePointsShopReward = "pointsShopV2/exchangePointsShopReward"
12
12
  }
13
- export declare const fetchPointsShop: import("@reduxjs/toolkit").AsyncThunk<TPLSPointsShopRewards, void, {
13
+ export declare const fetchPointsShop: import("@reduxjs/toolkit").AsyncThunk<Discounts, void, {
14
14
  state: AppState;
15
15
  rejectValue: RequestError;
16
16
  dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
@@ -20,9 +20,9 @@ export declare const fetchPointsShop: import("@reduxjs/toolkit").AsyncThunk<TPLS
20
20
  fulfilledMeta?: unknown;
21
21
  rejectedMeta?: unknown;
22
22
  }>;
23
- export declare const exchangePointsShopReward: import("@reduxjs/toolkit").AsyncThunk<{
24
- data: TPLSPointsShopReward;
25
- entities: TPLSPointsShopRewards;
23
+ export declare const exchangePointsShopRewardV2: import("@reduxjs/toolkit").AsyncThunk<{
24
+ data: Discount;
25
+ entities: Discounts;
26
26
  }, string, {
27
27
  state: AppState;
28
28
  rejectValue: RequestError;
@@ -11,8 +11,8 @@ const initialState = {
11
11
  };
12
12
  export var PointsShopActionType;
13
13
  (function (PointsShopActionType) {
14
- PointsShopActionType["FetchPointsShop"] = "pointsShop/fetchPointsShop";
15
- PointsShopActionType["ExchangePointsShopReward"] = "pointsShop/exchangePointsShopReward";
14
+ PointsShopActionType["FetchPointsShop"] = "pointsShopV2/fetchPointsShop";
15
+ PointsShopActionType["ExchangePointsShopReward"] = "pointsShopV2/exchangePointsShopReward";
16
16
  })(PointsShopActionType || (PointsShopActionType = {}));
17
17
  export const fetchPointsShop = createAsyncThunk(PointsShopActionType.FetchPointsShop, (_, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
18
18
  try {
@@ -28,7 +28,7 @@ export const fetchPointsShop = createAsyncThunk(PointsShopActionType.FetchPoints
28
28
  return rejectWithValue(err);
29
29
  }
30
30
  }));
31
- export const exchangePointsShopReward = createAsyncThunk(PointsShopActionType.ExchangePointsShopReward, (rewardId, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
31
+ export const exchangePointsShopRewardV2 = createAsyncThunk(PointsShopActionType.ExchangePointsShopReward, (rewardId, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
32
32
  try {
33
33
  const { api } = getState().config;
34
34
  if (!api)
@@ -64,21 +64,21 @@ const pointsShopSlice = createSlice({
64
64
  state.error = action.payload;
65
65
  state.loading = 'idle';
66
66
  })
67
- .addCase(exchangePointsShopReward.fulfilled, (state, action) => {
67
+ .addCase(exchangePointsShopRewardV2.fulfilled, (state, action) => {
68
68
  state.entities = action.payload.entities;
69
69
  state.data = action.payload.data;
70
70
  state.loading = 'idle';
71
71
  state.error = null;
72
72
  })
73
- .addCase(exchangePointsShopReward.pending, state => {
73
+ .addCase(exchangePointsShopRewardV2.pending, state => {
74
74
  state.loading = 'pending';
75
75
  })
76
- .addCase(exchangePointsShopReward.rejected, (state, action) => {
76
+ .addCase(exchangePointsShopRewardV2.rejected, (state, action) => {
77
77
  state.error = action.payload;
78
78
  state.loading = 'idle';
79
79
  });
80
80
  }
81
81
  });
82
- export const { resetPointsShop } = pointsShopSlice.actions;
82
+ export const { resetPointsShop: resetPointsShop } = pointsShopSlice.actions;
83
83
  export const selectPointsShop = (state) => state.customer.pointsShop;
84
84
  export const pointsShopReducer = pointsShopSlice.reducer;
@@ -55,7 +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
+ tplsPointsShop: import("./tplsPointsShop").TplsPointsShopState;
59
59
  qrcode: import("./qrCode").CustomerQRCodeState;
60
60
  rewards: import("./rewards").CustomerRewardsState;
61
61
  thanx: import("./thanx").CustomerThanxState;
@@ -122,7 +122,7 @@ export declare const selectCustomerTplsRewards: ((state: import("redux").EmptyOb
122
122
  order: import("./order").CustomerOrderState;
123
123
  orders: import("./orders").CustomerOrdersState;
124
124
  pointsShop: import("./pointsShop").PointsShopState;
125
- pointsShopV2: import("./pointsShopV2").PointsShopV2State;
125
+ tplsPointsShop: import("./tplsPointsShop").TplsPointsShopState;
126
126
  qrcode: import("./qrCode").CustomerQRCodeState;
127
127
  rewards: import("./rewards").CustomerRewardsState;
128
128
  thanx: import("./thanx").CustomerThanxState;
@@ -189,7 +189,7 @@ export declare const selectCustomerTplsProgress: ((state: import("redux").EmptyO
189
189
  order: import("./order").CustomerOrderState;
190
190
  orders: import("./orders").CustomerOrdersState;
191
191
  pointsShop: import("./pointsShop").PointsShopState;
192
- pointsShopV2: import("./pointsShopV2").PointsShopV2State;
192
+ tplsPointsShop: import("./tplsPointsShop").TplsPointsShopState;
193
193
  qrcode: import("./qrCode").CustomerQRCodeState;
194
194
  rewards: import("./rewards").CustomerRewardsState;
195
195
  thanx: import("./thanx").CustomerThanxState;
@@ -0,0 +1,38 @@
1
+ import { AppState } from '../../app';
2
+ import { RequestError, RequestStatus, TPLSPointsShopReward, TPLSPointsShopRewards } from '@open-tender/types';
3
+ export interface TplsPointsShopState {
4
+ entities: TPLSPointsShopRewards;
5
+ data: TPLSPointsShopReward | null;
6
+ error: RequestError;
7
+ loading: RequestStatus;
8
+ }
9
+ export declare enum TplsPointsShopActionType {
10
+ FetchTplsPointsShop = "pointsShop/fetchTplsPointsShop",
11
+ ExchangeTplsPointsShopReward = "pointsShop/exchangeTplsPointsShopReward"
12
+ }
13
+ export declare const fetchTplsPointsShop: import("@reduxjs/toolkit").AsyncThunk<TPLSPointsShopRewards, 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 exchangeTplsPointsShopReward: import("@reduxjs/toolkit").AsyncThunk<{
24
+ data: TPLSPointsShopReward;
25
+ entities: TPLSPointsShopRewards;
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 resetTplsPointsShop: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"tplsPointsShop/resetTplsPointsShop">;
37
+ export declare const selectTplsPointsShop: (state: AppState) => TplsPointsShopState;
38
+ export declare const tplsPointsShopReducer: import("redux").Reducer<TplsPointsShopState, 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 TplsPointsShopActionType;
13
+ (function (TplsPointsShopActionType) {
14
+ TplsPointsShopActionType["FetchTplsPointsShop"] = "pointsShop/fetchTplsPointsShop";
15
+ TplsPointsShopActionType["ExchangeTplsPointsShopReward"] = "pointsShop/exchangeTplsPointsShopReward";
16
+ })(TplsPointsShopActionType || (TplsPointsShopActionType = {}));
17
+ export const fetchTplsPointsShop = createAsyncThunk(TplsPointsShopActionType.FetchTplsPointsShop, (_, { 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.getTplsPointsShop(token);
26
+ }
27
+ catch (err) {
28
+ return rejectWithValue(err);
29
+ }
30
+ }));
31
+ export const exchangeTplsPointsShopReward = createAsyncThunk(TplsPointsShopActionType.ExchangeTplsPointsShopReward, (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.postTplsPointsShopReward(token, rewardId);
40
+ const entities = yield api.getTplsPointsShop(token);
41
+ return { data, entities };
42
+ }
43
+ catch (err) {
44
+ return rejectWithValue(err);
45
+ }
46
+ }));
47
+ const tplsPointsShopSlice = createSlice({
48
+ name: ReducerType.TplsPointsShop,
49
+ initialState,
50
+ reducers: {
51
+ resetTplsPointsShop: () => initialState
52
+ },
53
+ extraReducers: builder => {
54
+ builder
55
+ .addCase(fetchTplsPointsShop.fulfilled, (state, action) => {
56
+ state.entities = action.payload;
57
+ state.loading = 'idle';
58
+ state.error = null;
59
+ })
60
+ .addCase(fetchTplsPointsShop.pending, state => {
61
+ state.loading = 'pending';
62
+ })
63
+ .addCase(fetchTplsPointsShop.rejected, (state, action) => {
64
+ state.error = action.payload;
65
+ state.loading = 'idle';
66
+ })
67
+ .addCase(exchangeTplsPointsShopReward.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(exchangeTplsPointsShopReward.pending, state => {
74
+ state.loading = 'pending';
75
+ })
76
+ .addCase(exchangeTplsPointsShopReward.rejected, (state, action) => {
77
+ state.error = action.payload;
78
+ state.loading = 'idle';
79
+ });
80
+ }
81
+ });
82
+ export const { resetTplsPointsShop } = tplsPointsShopSlice.actions;
83
+ export const selectTplsPointsShop = (state) => state.customer.tplsPointsShop;
84
+ export const tplsPointsShopReducer = tplsPointsShopSlice.reducer;
@@ -130,7 +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
+ tplsPointsShop: import("./customer").TplsPointsShopState;
134
134
  qrcode: import("./customer").CustomerQRCodeState;
135
135
  rewards: import("./customer").CustomerRewardsState;
136
136
  thanx: import("./customer").CustomerThanxState;
@@ -200,7 +200,7 @@ export declare const selectGroupOrderClosed: ((state: import("redux").EmptyObjec
200
200
  order: import("./customer").CustomerOrderState;
201
201
  orders: import("./customer").CustomerOrdersState;
202
202
  pointsShop: import("./customer").PointsShopState;
203
- pointsShopV2: import("./customer").PointsShopV2State;
203
+ tplsPointsShop: import("./customer").TplsPointsShopState;
204
204
  qrcode: import("./customer").CustomerQRCodeState;
205
205
  rewards: import("./customer").CustomerRewardsState;
206
206
  thanx: import("./customer").CustomerThanxState;
@@ -272,7 +272,7 @@ export declare const selectGroupOrderTests: ((state: import("redux").EmptyObject
272
272
  order: import("./customer").CustomerOrderState;
273
273
  orders: import("./customer").CustomerOrdersState;
274
274
  pointsShop: import("./customer").PointsShopState;
275
- pointsShopV2: import("./customer").PointsShopV2State;
275
+ tplsPointsShop: import("./customer").TplsPointsShopState;
276
276
  qrcode: import("./customer").CustomerQRCodeState;
277
277
  rewards: import("./customer").CustomerRewardsState;
278
278
  thanx: import("./customer").CustomerThanxState;
@@ -353,7 +353,7 @@ export declare const selectGroupOrderPrepTimes: ((state: import("redux").EmptyOb
353
353
  order: import("./customer").CustomerOrderState;
354
354
  orders: import("./customer").CustomerOrdersState;
355
355
  pointsShop: import("./customer").PointsShopState;
356
- pointsShopV2: import("./customer").PointsShopV2State;
356
+ tplsPointsShop: import("./customer").TplsPointsShopState;
357
357
  qrcode: import("./customer").CustomerQRCodeState;
358
358
  rewards: import("./customer").CustomerRewardsState;
359
359
  thanx: import("./customer").CustomerThanxState;
@@ -152,7 +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
+ tplsPointsShop: import("./customer").TplsPointsShopState;
156
156
  qrcode: import("./customer").CustomerQRCodeState;
157
157
  rewards: import("./customer").CustomerRewardsState;
158
158
  thanx: import("./customer").CustomerThanxState;
@@ -230,7 +230,7 @@ export declare const selectCartIds: ((state: import("redux").EmptyObject & {
230
230
  order: import("./customer").CustomerOrderState;
231
231
  orders: import("./customer").CustomerOrdersState;
232
232
  pointsShop: import("./customer").PointsShopState;
233
- pointsShopV2: import("./customer").PointsShopV2State;
233
+ tplsPointsShop: import("./customer").TplsPointsShopState;
234
234
  qrcode: import("./customer").CustomerQRCodeState;
235
235
  rewards: import("./customer").CustomerRewardsState;
236
236
  thanx: import("./customer").CustomerThanxState;
@@ -303,7 +303,7 @@ export declare const selectMenuVars: ((state: import("redux").EmptyObject & {
303
303
  order: import("./customer").CustomerOrderState;
304
304
  orders: import("./customer").CustomerOrdersState;
305
305
  pointsShop: import("./customer").PointsShopState;
306
- pointsShopV2: import("./customer").PointsShopV2State;
306
+ tplsPointsShop: import("./customer").TplsPointsShopState;
307
307
  qrcode: import("./customer").CustomerQRCodeState;
308
308
  rewards: import("./customer").CustomerRewardsState;
309
309
  thanx: import("./customer").CustomerThanxState;
@@ -43,7 +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
+ tplsPointsShop: import("./customer").TplsPointsShopState;
47
47
  qrcode: import("./customer").CustomerQRCodeState;
48
48
  rewards: import("./customer").CustomerRewardsState;
49
49
  thanx: import("./customer").CustomerThanxState;
@@ -51,7 +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
+ tplsPointsShop: import("./customer").TplsPointsShopState;
55
55
  qrcode: import("./customer").CustomerQRCodeState;
56
56
  rewards: import("./customer").CustomerRewardsState;
57
57
  thanx: import("./customer").CustomerThanxState;
@@ -40,7 +40,6 @@ export declare enum ReducerType {
40
40
  Orders = "orders",
41
41
  Posts = "posts",
42
42
  PointsShop = "pointsShop",
43
- PointsShopV2 = "pointsShopV2",
44
43
  PushNotifications = "pushNotifications",
45
44
  Qr = "qr",
46
45
  QRCode = "qrcode",
@@ -56,6 +55,7 @@ export declare enum ReducerType {
56
55
  Terms = "terms",
57
56
  Thanx = "thanx",
58
57
  Tpls = "tpls",
58
+ TplsPointsShop = "tplsPointsShop",
59
59
  ValidTimes = "validTimes",
60
60
  VerifyAccount = "verifyAccount"
61
61
  }
@@ -41,7 +41,6 @@ export var ReducerType;
41
41
  ReducerType["Orders"] = "orders";
42
42
  ReducerType["Posts"] = "posts";
43
43
  ReducerType["PointsShop"] = "pointsShop";
44
- ReducerType["PointsShopV2"] = "pointsShopV2";
45
44
  ReducerType["PushNotifications"] = "pushNotifications";
46
45
  ReducerType["Qr"] = "qr";
47
46
  ReducerType["QRCode"] = "qrcode";
@@ -57,6 +56,7 @@ export var ReducerType;
57
56
  ReducerType["Terms"] = "terms";
58
57
  ReducerType["Thanx"] = "thanx";
59
58
  ReducerType["Tpls"] = "tpls";
59
+ ReducerType["TplsPointsShop"] = "tplsPointsShop";
60
60
  ReducerType["ValidTimes"] = "validTimes";
61
61
  ReducerType["VerifyAccount"] = "verifyAccount";
62
62
  })(ReducerType || (ReducerType = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/cloud",
3
- "version": "0.4.15",
3
+ "version": "0.4.16",
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",
@@ -57,6 +57,6 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "@open-tender/types": "^0.4.44",
60
- "@open-tender/utils": "^0.4.6"
60
+ "@open-tender/utils": "^0.4.23"
61
61
  }
62
62
  }
@@ -1,38 +0,0 @@
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) => PointsShopV2State;
38
- export declare const pointsShopV2Reducer: import("redux").Reducer<PointsShopV2State, import("redux").AnyAction>;