@kiminix/tp-client 2.41.0 → 2.44.0

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 (41) hide show
  1. package/dist/business/admin/api/get-business-api.d.ts +17 -0
  2. package/dist/business/{admin-apis.js → admin/api/get-business-api.js} +19 -13
  3. package/dist/business/apis.d.ts +1 -1
  4. package/dist/business/index.d.ts +2 -2
  5. package/dist/business/index.js +2 -2
  6. package/dist/business/types/{get-id.d.ts → business.d.ts} +2 -2
  7. package/dist/business/types/get-all.d.ts +0 -1
  8. package/dist/business/types/shared.d.ts +15 -0
  9. package/dist/cashback/admin/api/add-cashback-transaction-api.d.ts +20 -0
  10. package/dist/cashback/admin/api/add-cashback-transaction-api.js +65 -0
  11. package/dist/cashback/admin/api/create-cashback-api.d.ts +22 -0
  12. package/dist/cashback/admin/api/create-cashback-api.js +65 -0
  13. package/dist/cashback/admin/api/get-cashback-transactions-api.d.ts +55 -0
  14. package/dist/cashback/admin/api/get-cashback-transactions-api.js +67 -0
  15. package/dist/cashback/admin/api/get-full-cashback-api.d.ts +28 -0
  16. package/dist/{vouchers/user/guest-apis.js → cashback/admin/api/get-full-cashback-api.js} +14 -48
  17. package/dist/cashback/admin/api/search-cashback-api.d.ts +32 -0
  18. package/dist/cashback/{user/user-apis.js → admin/api/search-cashback-api.js} +13 -29
  19. package/dist/cashback/index.d.ts +6 -2
  20. package/dist/cashback/index.js +6 -2
  21. package/dist/cashback/shared/types.d.ts +5 -0
  22. package/dist/deals/types.d.ts +0 -1
  23. package/dist/enum.d.ts +5 -5
  24. package/dist/enum.js +6 -6
  25. package/dist/index.d.ts +0 -1
  26. package/dist/index.js +0 -2
  27. package/dist/reservations/shared/reservation.d.ts +0 -1
  28. package/dist/types.d.ts +1 -1
  29. package/package.json +1 -1
  30. package/dist/business/admin-apis.d.ts +0 -10
  31. package/dist/cashback/user/types/resp-get-cashback.d.ts +0 -22
  32. package/dist/cashback/user/user-apis.d.ts +0 -19
  33. package/dist/vouchers/index.d.ts +0 -3
  34. package/dist/vouchers/index.js +0 -6
  35. package/dist/vouchers/user/guest-apis.d.ts +0 -30
  36. package/dist/vouchers/user/types/voucher-booking-response.d.ts +0 -4
  37. package/dist/vouchers/user/types/voucher-booking-response.js +0 -1
  38. package/dist/vouchers/user/types/voucher-response.d.ts +0 -23
  39. package/dist/vouchers/user/types/voucher-response.js +0 -1
  40. /package/dist/business/types/{get-id.js → business.js} +0 -0
  41. /package/dist/cashback/{user/types/resp-get-cashback.js → shared/types.js} +0 -0
@@ -0,0 +1,17 @@
1
+ import { Business } from "../../types/business";
2
+ /**
3
+ * patch order fields
4
+ *
5
+ * @param token
6
+ * @param id
7
+ * @param status
8
+ */
9
+ export declare class GetBusinessAdminAPI {
10
+ /**
11
+ *
12
+ * @param token
13
+ * @throws unauthorized, internal_error
14
+ * @returns
15
+ */
16
+ static get(token?: string): Promise<Business>;
17
+ }
@@ -35,20 +35,26 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  }
36
36
  };
37
37
  import axios from "axios";
38
- import { base } from "../constants";
39
38
  import { parseISO } from "date-fns";
40
- import { RequestUtils } from "../utils/request-utils";
41
- // business module admin APIs
42
- var BusinessAdminAPIs = /** @class */ (function () {
43
- function BusinessAdminAPIs() {
39
+ import { base } from "../../../constants";
40
+ import { RequestUtils } from "../../../utils/request-utils";
41
+ /**
42
+ * patch order fields
43
+ *
44
+ * @param token
45
+ * @param id
46
+ * @param status
47
+ */
48
+ var GetBusinessAdminAPI = /** @class */ (function () {
49
+ function GetBusinessAdminAPI() {
44
50
  }
45
51
  /**
46
- *
47
- * @param token
48
- * @throws unauthorized, internal_error
49
- * @returns
50
- */
51
- BusinessAdminAPIs.get = function (token) {
52
+ *
53
+ * @param token
54
+ * @throws unauthorized, internal_error
55
+ * @returns
56
+ */
57
+ GetBusinessAdminAPI.get = function (token) {
52
58
  return __awaiter(this, void 0, void 0, function () {
53
59
  return __generator(this, function (_a) {
54
60
  return [2 /*return*/, RequestUtils.send(function () {
@@ -67,6 +73,6 @@ var BusinessAdminAPIs = /** @class */ (function () {
67
73
  });
68
74
  });
69
75
  };
70
- return BusinessAdminAPIs;
76
+ return GetBusinessAdminAPI;
71
77
  }());
72
- export { BusinessAdminAPIs };
78
+ export { GetBusinessAdminAPI };
@@ -1,5 +1,5 @@
1
1
  import { AllBusiness } from "./types/get-all";
2
- import { Business } from "./types/get-id";
2
+ import { Business } from "./types/business";
3
3
  export declare class BusinessAPIs {
4
4
  static getAll(timestamp: number, page?: number, size?: number): Promise<AllBusiness[]>;
5
5
  static get(identifier: string): Promise<Business | undefined>;
@@ -1,6 +1,6 @@
1
1
  export * from "./types/get-all";
2
- export * from "./types/get-id";
2
+ export * from "./types/business";
3
3
  export { BusinessAPIs } from './apis';
4
- export { BusinessAdminAPIs } from './admin-apis';
5
4
  export * from "./admin/api/patch-business-api";
6
5
  export * from "./admin/api/subscription-business-api";
6
+ export { GetBusinessAdminAPI } from './admin/api/get-business-api';
@@ -1,7 +1,7 @@
1
1
  export * from "./types/get-all";
2
- export * from "./types/get-id";
2
+ export * from "./types/business";
3
3
  export { BusinessAPIs } from './apis';
4
- export { BusinessAdminAPIs } from './admin-apis';
5
4
  // admin apis
6
5
  export * from "./admin/api/patch-business-api";
7
6
  export * from "./admin/api/subscription-business-api";
7
+ export { GetBusinessAdminAPI } from './admin/api/get-business-api';
@@ -1,5 +1,5 @@
1
1
  import { Licence } from "../../types";
2
- import { OpeningHours, TelegramConfig, Template } from "./shared";
2
+ import { CashbackSettings, OpeningHours, TelegramConfig, Template } from "./shared";
3
3
  export interface Business {
4
4
  id: string;
5
5
  identifier: string;
@@ -16,7 +16,7 @@ export interface Business {
16
16
  phones: string[];
17
17
  email: string;
18
18
  description: string | undefined;
19
- maxCashbackApply: number;
19
+ cashback: CashbackSettings | undefined;
20
20
  openingHours: OpeningHours | undefined;
21
21
  specialities: string[] | undefined;
22
22
  telegram?: TelegramConfig | undefined;
@@ -3,6 +3,5 @@ export interface AllBusiness {
3
3
  identifier: string;
4
4
  name: string;
5
5
  address: string;
6
- maxCashbackApply: number;
7
6
  specialities: string[] | undefined;
8
7
  }
@@ -30,3 +30,18 @@ export interface Template {
30
30
  themeColors?: string | undefined;
31
31
  backgroundPattern?: string | undefined;
32
32
  }
33
+ export interface CashbackSettings {
34
+ rates: CashbackRates;
35
+ thresholds: CashbackThresholds;
36
+ maxRedeemPercentage: number;
37
+ minPurchaseAmount: number;
38
+ }
39
+ export interface CashbackRates {
40
+ bronze: number;
41
+ silver: number;
42
+ gold: number;
43
+ }
44
+ export interface CashbackThresholds {
45
+ silver: number;
46
+ gold: number;
47
+ }
@@ -0,0 +1,20 @@
1
+ import { CashbackTransactionType } from "../../../enum";
2
+ export declare class AddCashbackTransactionAdminAPI {
3
+ /**
4
+ *
5
+ * @param token
6
+ * @throws unauthorized, internal_error, cashback_not_found, insufficient_purchase_amount, invalid_transaction_type, cashback_settings_not_configured
7
+ * @returns
8
+ */
9
+ static add(props: {
10
+ token?: string;
11
+ request: AddCashbackTransactionAdminAPI.Request;
12
+ }): Promise<void>;
13
+ }
14
+ export declare namespace AddCashbackTransactionAdminAPI {
15
+ interface Request {
16
+ id: string;
17
+ type: CashbackTransactionType;
18
+ amount: number;
19
+ }
20
+ }
@@ -0,0 +1,65 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import axios from "axios";
38
+ import { base } from "../../../constants";
39
+ import { RequestUtils } from "../../../utils/request-utils";
40
+ var AddCashbackTransactionAdminAPI = /** @class */ (function () {
41
+ function AddCashbackTransactionAdminAPI() {
42
+ }
43
+ /**
44
+ *
45
+ * @param token
46
+ * @throws unauthorized, internal_error, cashback_not_found, insufficient_purchase_amount, invalid_transaction_type, cashback_settings_not_configured
47
+ * @returns
48
+ */
49
+ AddCashbackTransactionAdminAPI.add = function (props) {
50
+ return __awaiter(this, void 0, void 0, function () {
51
+ return __generator(this, function (_a) {
52
+ return [2 /*return*/, RequestUtils.send(function () {
53
+ return axios.post(base + "/admin/cashback/".concat(props.request.id, "/transactions"), props.request, {
54
+ headers: {
55
+ 'Authorization': "".concat(props.token)
56
+ }
57
+ })
58
+ .then(function (_) { return undefined; });
59
+ })];
60
+ });
61
+ });
62
+ };
63
+ return AddCashbackTransactionAdminAPI;
64
+ }());
65
+ export { AddCashbackTransactionAdminAPI };
@@ -0,0 +1,22 @@
1
+ export declare class CreateCashbackAdminAPI {
2
+ /**
3
+ *
4
+ * @param token
5
+ * @throws unauthorized, internal_error, email_already_used, invalid_email_format
6
+ * @returns
7
+ */
8
+ static create(props: {
9
+ token?: string;
10
+ request: CreateCashbackAdminAPI.Request;
11
+ }): Promise<CreateCashbackAdminAPI.Response>;
12
+ }
13
+ export declare namespace CreateCashbackAdminAPI {
14
+ interface Request {
15
+ name: string;
16
+ email: string;
17
+ phone?: string | undefined;
18
+ }
19
+ interface Response {
20
+ id: string;
21
+ }
22
+ }
@@ -0,0 +1,65 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import axios from "axios";
38
+ import { base } from "../../../constants";
39
+ import { RequestUtils } from "../../../utils/request-utils";
40
+ var CreateCashbackAdminAPI = /** @class */ (function () {
41
+ function CreateCashbackAdminAPI() {
42
+ }
43
+ /**
44
+ *
45
+ * @param token
46
+ * @throws unauthorized, internal_error, email_already_used, invalid_email_format
47
+ * @returns
48
+ */
49
+ CreateCashbackAdminAPI.create = function (props) {
50
+ return __awaiter(this, void 0, void 0, function () {
51
+ return __generator(this, function (_a) {
52
+ return [2 /*return*/, RequestUtils.send(function () {
53
+ return axios.post(base + "/admin/cashback/create", props.request, {
54
+ headers: {
55
+ 'Authorization': "".concat(props.token)
56
+ }
57
+ })
58
+ .then(function (response) { return response.data; });
59
+ })];
60
+ });
61
+ });
62
+ };
63
+ return CreateCashbackAdminAPI;
64
+ }());
65
+ export { CreateCashbackAdminAPI };
@@ -0,0 +1,55 @@
1
+ import { CashbackTransactionType, Level } from "../../../enum";
2
+ export declare class GetCashbackTransactionsAdminAPI {
3
+ /**
4
+ * @param token
5
+ * @throws unauthorized, internal_error, cashback_not_found
6
+ */
7
+ static get(props: {
8
+ token?: string;
9
+ request: GetCashbackTransactionsAdminAPI.Request;
10
+ }): Promise<GetCashbackTransactionsAdminAPI.Response>;
11
+ }
12
+ export declare namespace GetCashbackTransactionsAdminAPI {
13
+ interface Request {
14
+ id: string;
15
+ page: number;
16
+ size: number;
17
+ }
18
+ interface Response {
19
+ total: number;
20
+ data: TransactionAPI[];
21
+ }
22
+ interface TransactionAPI {
23
+ id: string;
24
+ data: EarnData | RedeemData | UpdateData;
25
+ createdAt: string;
26
+ }
27
+ interface CashbackState {
28
+ level: Level;
29
+ rate: number;
30
+ score: number;
31
+ value: number;
32
+ }
33
+ interface EarnData {
34
+ type: CashbackTransactionType.Earn;
35
+ previous: CashbackState;
36
+ processedBy: string;
37
+ invoiceAmount: number;
38
+ earnedCashback: number;
39
+ }
40
+ interface RedeemData {
41
+ type: CashbackTransactionType.Redeem;
42
+ previous: CashbackState;
43
+ processedBy: string;
44
+ invoiceAmount: number;
45
+ paidAmount: number;
46
+ usedCashback: number;
47
+ earnedCashback: number;
48
+ }
49
+ interface UpdateData {
50
+ type: CashbackTransactionType.Update;
51
+ previous: CashbackState;
52
+ next: CashbackState;
53
+ processedBy: string;
54
+ }
55
+ }
@@ -0,0 +1,67 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import axios from "axios";
38
+ import { base } from "../../../constants";
39
+ import { RequestUtils } from "../../../utils/request-utils";
40
+ var GetCashbackTransactionsAdminAPI = /** @class */ (function () {
41
+ function GetCashbackTransactionsAdminAPI() {
42
+ }
43
+ /**
44
+ * @param token
45
+ * @throws unauthorized, internal_error, cashback_not_found
46
+ */
47
+ GetCashbackTransactionsAdminAPI.get = function (props) {
48
+ return __awaiter(this, void 0, void 0, function () {
49
+ return __generator(this, function (_a) {
50
+ return [2 /*return*/, RequestUtils.send(function () {
51
+ return axios.get(base + "/admin/cashback/".concat(props.request.id, "/transactions"), {
52
+ params: {
53
+ page: props.request.page,
54
+ size: props.request.size
55
+ },
56
+ headers: {
57
+ 'Authorization': "".concat(props.token)
58
+ }
59
+ })
60
+ .then(function (response) { return response.data; });
61
+ })];
62
+ });
63
+ });
64
+ };
65
+ return GetCashbackTransactionsAdminAPI;
66
+ }());
67
+ export { GetCashbackTransactionsAdminAPI };
@@ -0,0 +1,28 @@
1
+ import { Level } from "../../../enum";
2
+ import { CashbackUserAPI } from "../../shared/types";
3
+ export declare class GetFullCashbackAdminAPI {
4
+ /**
5
+ *
6
+ * @param token
7
+ * @throws unauthorized, internal_error, cashback_not_found, cashback_settings_not_found
8
+ * @returns
9
+ */
10
+ static get(props: {
11
+ token?: string;
12
+ id: string;
13
+ }): Promise<GetFullCashbackAdminAPI.Response>;
14
+ }
15
+ export declare namespace GetFullCashbackAdminAPI {
16
+ interface Response {
17
+ id: string;
18
+ user: CashbackUserAPI;
19
+ value: number;
20
+ score: number;
21
+ level: Level;
22
+ rate: number;
23
+ threshold?: number | undefined;
24
+ maxRedeemPercentage: number;
25
+ minPurchaseAmount: number;
26
+ createdAt: string;
27
+ }
28
+ }
@@ -35,36 +35,24 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  }
36
36
  };
37
37
  import axios from "axios";
38
- import { format } from "date-fns";
39
- import { base } from "../../constants";
40
- import { RequestUtils } from "../../utils/request-utils";
41
- // GUEST APIS
42
- var VouchersGuestAPIs = /** @class */ (function () {
43
- function VouchersGuestAPIs() {
38
+ import { base } from "../../../constants";
39
+ import { RequestUtils } from "../../../utils/request-utils";
40
+ var GetFullCashbackAdminAPI = /** @class */ (function () {
41
+ function GetFullCashbackAdminAPI() {
44
42
  }
45
43
  /**
46
- *
47
- * @param props
48
- * @throws invalid_persons, closed_hour, unavailable_datetime, internal_error
49
- *
50
- * @returns
51
- */
52
- VouchersGuestAPIs.reserve = function (props) {
44
+ *
45
+ * @param token
46
+ * @throws unauthorized, internal_error, cashback_not_found, cashback_settings_not_found
47
+ * @returns
48
+ */
49
+ GetFullCashbackAdminAPI.get = function (props) {
53
50
  return __awaiter(this, void 0, void 0, function () {
54
51
  return __generator(this, function (_a) {
55
52
  return [2 /*return*/, RequestUtils.send(function () {
56
- return axios.post(base + "/vouchers/guest", {
57
- businessId: props.businessId,
58
- datetime: format(props.datetime, "yyyy-MM-dd'T'HH:mm"),
59
- persons: props.persons,
60
- firstname: props.firstname,
61
- lastname: props.lastname,
62
- phone: props.phone,
63
- email: props.email,
64
- notes: props.notes
65
- }, {
53
+ return axios.get(base + "/admin/cashback/".concat(props.id), {
66
54
  headers: {
67
- 'Content-Type': 'application/json'
55
+ 'Authorization': "".concat(props.token)
68
56
  }
69
57
  })
70
58
  .then(function (response) { return response.data; });
@@ -72,28 +60,6 @@ var VouchersGuestAPIs = /** @class */ (function () {
72
60
  });
73
61
  });
74
62
  };
75
- /**
76
- *
77
- * @param props
78
- * @throws voucher_not_found, internal_error
79
- * @returns
80
- */
81
- VouchersGuestAPIs.get = function (props) {
82
- return __awaiter(this, void 0, void 0, function () {
83
- return __generator(this, function (_a) {
84
- return [2 /*return*/, RequestUtils.send(function () {
85
- return axios.get(base + "/vouchers/guest/".concat(props.id), {
86
- headers: {
87
- 'Content-Type': 'application/json'
88
- }
89
- })
90
- .then(function (response) {
91
- return response.data;
92
- });
93
- })];
94
- });
95
- });
96
- };
97
- return VouchersGuestAPIs;
63
+ return GetFullCashbackAdminAPI;
98
64
  }());
99
- export { VouchersGuestAPIs };
65
+ export { GetFullCashbackAdminAPI };
@@ -0,0 +1,32 @@
1
+ import { Level } from "../../../enum";
2
+ import { CashbackUserAPI } from "../../shared/types";
3
+ export declare class SearchCashbackAdminAPI {
4
+ /**
5
+ *
6
+ * @param token
7
+ * @throws unauthorized, internal_error
8
+ * @returns
9
+ */
10
+ static search(props: {
11
+ token?: string;
12
+ request: SearchCashbackAdminAPI.Request;
13
+ }): Promise<SearchCashbackAdminAPI.Response>;
14
+ }
15
+ export declare namespace SearchCashbackAdminAPI {
16
+ interface Request {
17
+ term?: string | undefined;
18
+ page: number;
19
+ size: number;
20
+ }
21
+ interface Response {
22
+ total: number;
23
+ data: CashBackAPI[];
24
+ }
25
+ interface CashBackAPI {
26
+ id: string;
27
+ user: CashbackUserAPI;
28
+ value: number;
29
+ level: Level;
30
+ createdAt: string;
31
+ }
32
+ }
@@ -35,22 +35,22 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  }
36
36
  };
37
37
  import axios from "axios";
38
- import { base } from "../../constants";
39
- import { RequestUtils } from "../../utils/request-utils";
40
- var CashbackUserAPIs = /** @class */ (function () {
41
- function CashbackUserAPIs() {
38
+ import { base } from "../../../constants";
39
+ import { RequestUtils } from "../../../utils/request-utils";
40
+ var SearchCashbackAdminAPI = /** @class */ (function () {
41
+ function SearchCashbackAdminAPI() {
42
42
  }
43
43
  /**
44
- *
45
- * @param props
46
- * @throws unauthorized, internal_error
47
- * @returns
48
- */
49
- CashbackUserAPIs.get = function (props) {
44
+ *
45
+ * @param token
46
+ * @throws unauthorized, internal_error
47
+ * @returns
48
+ */
49
+ SearchCashbackAdminAPI.search = function (props) {
50
50
  return __awaiter(this, void 0, void 0, function () {
51
51
  return __generator(this, function (_a) {
52
52
  return [2 /*return*/, RequestUtils.send(function () {
53
- return axios.get(base + "/cashback/user", {
53
+ return axios.post(base + "/admin/cashback/search", props.request, {
54
54
  headers: {
55
55
  'Authorization': "".concat(props.token)
56
56
  }
@@ -60,22 +60,6 @@ var CashbackUserAPIs = /** @class */ (function () {
60
60
  });
61
61
  });
62
62
  };
63
- /**
64
- *
65
- * @param props
66
- * @throws unauthorized, internal_error
67
- * @returns default cashback settings
68
- */
69
- CashbackUserAPIs.getSettings = function () {
70
- return __awaiter(this, void 0, void 0, function () {
71
- return __generator(this, function (_a) {
72
- return [2 /*return*/, RequestUtils.send(function () {
73
- return axios.get(base + "/cashback/settings")
74
- .then(function (response) { return response.data; });
75
- })];
76
- });
77
- });
78
- };
79
- return CashbackUserAPIs;
63
+ return SearchCashbackAdminAPI;
80
64
  }());
81
- export { CashbackUserAPIs };
65
+ export { SearchCashbackAdminAPI };
@@ -1,2 +1,6 @@
1
- export * from './user/types/resp-get-cashback';
2
- export { CashbackUserAPIs } from './user/user-apis';
1
+ export { SearchCashbackAdminAPI } from './admin/api/search-cashback-api';
2
+ export { GetFullCashbackAdminAPI } from './admin/api/get-full-cashback-api';
3
+ export { CreateCashbackAdminAPI } from './admin/api/create-cashback-api';
4
+ export { AddCashbackTransactionAdminAPI } from './admin/api/add-cashback-transaction-api';
5
+ export { GetCashbackTransactionsAdminAPI } from './admin/api/get-cashback-transactions-api';
6
+ export * from "./shared/types";
@@ -1,3 +1,7 @@
1
1
  // cashback module
2
- export * from './user/types/resp-get-cashback';
3
- export { CashbackUserAPIs } from './user/user-apis';
2
+ export { SearchCashbackAdminAPI } from './admin/api/search-cashback-api';
3
+ export { GetFullCashbackAdminAPI } from './admin/api/get-full-cashback-api';
4
+ export { CreateCashbackAdminAPI } from './admin/api/create-cashback-api';
5
+ export { AddCashbackTransactionAdminAPI } from './admin/api/add-cashback-transaction-api';
6
+ export { GetCashbackTransactionsAdminAPI } from './admin/api/get-cashback-transactions-api';
7
+ export * from "./shared/types";
@@ -0,0 +1,5 @@
1
+ export interface CashbackUserAPI {
2
+ name: string;
3
+ email: string;
4
+ phone: string | null;
5
+ }
@@ -9,7 +9,6 @@ export interface BusinessOfDeal {
9
9
  name: string;
10
10
  address: string;
11
11
  images: string[];
12
- maxCashbackApply: number;
13
12
  specialities: string[] | undefined;
14
13
  }
15
14
  export interface Deal {
package/dist/enum.d.ts CHANGED
@@ -39,14 +39,14 @@ export declare enum CancellationReason {
39
39
  ForceMajeur = "force_majeur",
40
40
  Other = "other"
41
41
  }
42
- export declare enum VoucherStatus {
43
- InProgress = "in_progress",
44
- Succeeded = "succeeded",
45
- Failed = "failed"
46
- }
47
42
  export declare enum OrderStatus {
48
43
  Pending = "pending",
49
44
  InProgress = "in_progress",
50
45
  Completed = "completed",
51
46
  Canceled = "canceled"
52
47
  }
48
+ export declare enum CashbackTransactionType {
49
+ Earn = "earn",
50
+ Redeem = "redeem",
51
+ Update = "update"
52
+ }
package/dist/enum.js CHANGED
@@ -46,12 +46,6 @@ export var CancellationReason;
46
46
  CancellationReason["ForceMajeur"] = "force_majeur";
47
47
  CancellationReason["Other"] = "other";
48
48
  })(CancellationReason || (CancellationReason = {}));
49
- export var VoucherStatus;
50
- (function (VoucherStatus) {
51
- VoucherStatus["InProgress"] = "in_progress";
52
- VoucherStatus["Succeeded"] = "succeeded";
53
- VoucherStatus["Failed"] = "failed";
54
- })(VoucherStatus || (VoucherStatus = {}));
55
49
  export var OrderStatus;
56
50
  (function (OrderStatus) {
57
51
  OrderStatus["Pending"] = "pending";
@@ -59,3 +53,9 @@ export var OrderStatus;
59
53
  OrderStatus["Completed"] = "completed";
60
54
  OrderStatus["Canceled"] = "canceled";
61
55
  })(OrderStatus || (OrderStatus = {}));
56
+ export var CashbackTransactionType;
57
+ (function (CashbackTransactionType) {
58
+ CashbackTransactionType["Earn"] = "earn";
59
+ CashbackTransactionType["Redeem"] = "redeem";
60
+ CashbackTransactionType["Update"] = "update";
61
+ })(CashbackTransactionType || (CashbackTransactionType = {}));
package/dist/index.d.ts CHANGED
@@ -8,7 +8,6 @@ export * from './business/index';
8
8
  export * from './reservations/index';
9
9
  export * from './cashback/index';
10
10
  export * from './discounts/index';
11
- export * from './vouchers/index';
12
11
  export * from './menus/index';
13
12
  export * from './tables/index';
14
13
  export * from './utils/patch-utils';
package/dist/index.js CHANGED
@@ -14,8 +14,6 @@ export * from './reservations/index';
14
14
  export * from './cashback/index';
15
15
  //discounts module
16
16
  export * from './discounts/index';
17
- //vouchers module
18
- export * from './vouchers/index';
19
17
  //menus module
20
18
  export * from './menus/index';
21
19
  // tables module
@@ -7,7 +7,6 @@ export interface BusinessOfReservation {
7
7
  phones: string[];
8
8
  address: string;
9
9
  googleMapUrl: string;
10
- maxCashbackApply: number;
11
10
  }
12
11
  export interface User {
13
12
  id: string | undefined;
package/dist/types.d.ts CHANGED
@@ -6,9 +6,9 @@ export interface ApiError {
6
6
  metadata?: any;
7
7
  }
8
8
  export interface Licence {
9
+ type: string;
9
10
  from: LocalDate;
10
11
  to: LocalDate;
11
- isManualBookingActive: boolean;
12
12
  }
13
13
  export declare class ErrorWithMetadata extends Error {
14
14
  metadata: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiminix/tp-client",
3
- "version": "2.41.0",
3
+ "version": "2.44.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -1,10 +0,0 @@
1
- import { Business } from "./types/get-id";
2
- export declare class BusinessAdminAPIs {
3
- /**
4
- *
5
- * @param token
6
- * @throws unauthorized, internal_error
7
- * @returns
8
- */
9
- static get(token?: string): Promise<Business>;
10
- }
@@ -1,22 +0,0 @@
1
- import { Level } from "../../../enum";
2
- export interface CashbackSettings {
3
- rates: CashbackRates;
4
- thresholds: Thresholds;
5
- }
6
- export interface CashbackRates {
7
- bronze: number;
8
- silver: number;
9
- gold: number;
10
- }
11
- export interface Thresholds {
12
- silver: number;
13
- gold: number;
14
- }
15
- export interface Cashback {
16
- value: number;
17
- level: Level;
18
- score: number;
19
- settings: CashbackSettings;
20
- createdAt: string;
21
- lastResetAt: string | undefined;
22
- }
@@ -1,19 +0,0 @@
1
- import { Cashback, CashbackSettings } from "./types/resp-get-cashback";
2
- export declare class CashbackUserAPIs {
3
- /**
4
- *
5
- * @param props
6
- * @throws unauthorized, internal_error
7
- * @returns
8
- */
9
- static get(props: {
10
- token: string | undefined;
11
- }): Promise<Cashback>;
12
- /**
13
- *
14
- * @param props
15
- * @throws unauthorized, internal_error
16
- * @returns default cashback settings
17
- */
18
- static getSettings(): Promise<CashbackSettings>;
19
- }
@@ -1,3 +0,0 @@
1
- export * from "./user/types/voucher-booking-response";
2
- export * from './user/types/voucher-response';
3
- export { VouchersGuestAPIs } from './user/guest-apis';
@@ -1,6 +0,0 @@
1
- // user module
2
- export * from "./user/types/voucher-booking-response";
3
- export * from './user/types/voucher-response';
4
- export { VouchersGuestAPIs } from './user/guest-apis';
5
- // admin module
6
- // shared module
@@ -1,30 +0,0 @@
1
- import { VoucherBookingResponse } from "./types/voucher-booking-response";
2
- import { Voucher } from "./types/voucher-response";
3
- export declare class VouchersGuestAPIs {
4
- /**
5
- *
6
- * @param props
7
- * @throws invalid_persons, closed_hour, unavailable_datetime, internal_error
8
- *
9
- * @returns
10
- */
11
- static reserve(props: {
12
- businessId: string;
13
- datetime: Date;
14
- persons: number;
15
- firstname: string;
16
- lastname: string;
17
- phone: string;
18
- email: string | undefined;
19
- notes: string | undefined;
20
- }): Promise<VoucherBookingResponse>;
21
- /**
22
- *
23
- * @param props
24
- * @throws voucher_not_found, internal_error
25
- * @returns
26
- */
27
- static get(props: {
28
- id: string;
29
- }): Promise<Voucher>;
30
- }
@@ -1,4 +0,0 @@
1
- export interface VoucherBookingResponse {
2
- id: string;
3
- paymentLink: string;
4
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,23 +0,0 @@
1
- import { VoucherStatus } from "../../../enum";
2
- export interface VoucherBusiness {
3
- id: string;
4
- identifier: string;
5
- name: string;
6
- phones: string[];
7
- address: string;
8
- googleMapUrl: string;
9
- }
10
- export interface Voucher {
11
- id: string;
12
- status: VoucherStatus;
13
- business: VoucherBusiness;
14
- datetime: string;
15
- persons: number;
16
- createdAt: string;
17
- firstname: string;
18
- lastname: string;
19
- phone: string;
20
- email: string | undefined;
21
- notesAdmin: string | undefined;
22
- notesUser: string | undefined;
23
- }
@@ -1 +0,0 @@
1
- export {};
File without changes