@open-tender/cloud 0.5.17 → 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.
@@ -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>;
@@ -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
  }
@@ -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>;
@@ -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
  }
@@ -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.17",
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",