@kiminix/tp-client 1.22.0 → 1.23.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.
- package/dist/business/types/get-all.d.ts +17 -0
- package/dist/business/types/get-id.d.ts +7 -5
- package/dist/cashback/admin/admin-apis.d.ts +7 -0
- package/dist/{menus/preset/user-apis.js → cashback/admin/admin-apis.js} +37 -33
- package/dist/cashback/admin/types/resp-get-cashback.d.ts +12 -0
- package/dist/cashback/index.d.ts +4 -0
- package/dist/cashback/index.js +6 -0
- package/dist/cashback/user/types/resp-get-cashback.d.ts +10 -0
- package/dist/cashback/user/user-apis.d.ts +7 -0
- package/dist/cashback/user/user-apis.js +87 -0
- package/dist/deals/types.d.ts +2 -1
- package/dist/enum.d.ts +11 -5
- package/dist/enum.js +14 -7
- package/dist/index.d.ts +5 -8
- package/dist/index.js +9 -9
- package/dist/menus/preset/index.d.ts +7 -0
- package/dist/menus/preset/index.js +9 -0
- package/dist/reservations/{admin-apis.d.ts → admin/admin-apis.d.ts} +11 -5
- package/dist/reservations/{admin-apis.js → admin/admin-apis.js} +42 -4
- package/dist/reservations/admin/types/get-id.d.ts +4 -0
- package/dist/reservations/index.d.ts +11 -0
- package/dist/reservations/index.js +14 -0
- package/dist/reservations/shared/reservation-deal.d.ts +19 -0
- package/dist/reservations/shared/reservation-deal.js +13 -0
- package/dist/reservations/{types/shared.d.ts → shared/reservation.d.ts} +7 -6
- package/dist/reservations/{types/user/reservation-preview.d.ts → user/types/resp-reservation-preview.d.ts} +4 -2
- package/dist/reservations/user/types/resp-reservation-preview.js +2 -0
- package/dist/reservations/user/types/resp-reservation-settings.d.ts +22 -0
- package/dist/reservations/user/types/resp-save-reservation.d.ts +3 -0
- package/dist/reservations/user/user-apis.d.ts +21 -7
- package/dist/reservations/user/user-apis.js +71 -5
- package/dist/statistics/admin-apis.d.ts +2 -2
- package/dist/statistics/admin-apis.js +37 -30
- package/dist/statistics/types/menus-statistic.d.ts +2 -0
- package/dist/utils/request-utils.d.ts +3 -0
- package/dist/utils/request-utils.js +81 -0
- package/package.json +3 -1
- package/dist/deals/types/get-id.d.ts +0 -49
- package/dist/deals/types/get-pages.d.ts +0 -30
- package/dist/menus/discounts/admin-apis.d.ts +0 -7
- package/dist/menus/discounts/admin-apis.js +0 -90
- package/dist/menus/discounts/types/update-discount.d.ts +0 -9
- package/dist/menus/preset/types/available-menu.d.ts +0 -12
- package/dist/menus/preset/user-apis.d.ts +0 -16
- package/dist/menus/types/preset-menu.d.ts +0 -22
- package/dist/reservations/types/admin/get-page.js +0 -1
- package/dist/reservations/types/admin/patch-status.d.ts +0 -6
- package/dist/reservations/types/admin/patch-status.js +0 -1
- package/dist/reservations/types/admin/reserve-onmenu.d.ts +0 -17
- package/dist/reservations/types/admin/reserve-onmenu.js +0 -1
- package/dist/reservations/types/shared.js +0 -1
- package/dist/reservations/types/types.d.ts +0 -27
- package/dist/reservations/types/types.js +0 -2
- package/dist/reservations/types/user/get-id.d.ts +0 -4
- package/dist/reservations/types/user/get-id.js +0 -1
- package/dist/reservations/types/user/get-page.d.ts +0 -7
- package/dist/reservations/types/user/get-page.js +0 -1
- package/dist/reservations/types/user/reservation-preview.js +0 -1
- package/dist/reservations/types/user/reserve-onmenu.d.ts +0 -13
- package/dist/reservations/types/user/reserve-onmenu.js +0 -1
- package/dist/reservations/types/user/reserve-response.d.ts +0 -3
- package/dist/reservations/types/user/reserve-response.js +0 -1
- package/dist/reservations/types.d.ts +0 -27
- package/dist/reservations/user/types.d.ts +0 -31
- package/dist/reservations/user-apis.d.ts +0 -30
- package/dist/reservations/user-apis.js +0 -206
- /package/dist/{deals/types/get-id.js → cashback/admin/types/resp-get-cashback.js} +0 -0
- /package/dist/{deals/types/get-pages.js → cashback/user/types/resp-get-cashback.js} +0 -0
- /package/dist/reservations/{types/admin → admin/types}/get-available-transitions.d.ts +0 -0
- /package/dist/reservations/{types/admin → admin/types}/get-available-transitions.js +0 -0
- /package/dist/reservations/{types/admin → admin/types}/get-id.js +0 -0
- /package/dist/{menus/discounts/types/update-discount.js → reservations/shared/reservation.js} +0 -0
- /package/dist/reservations/{types/admin/get-id.d.ts → user/types/req-get-by-id.d.ts} +0 -0
- /package/dist/reservations/user/{types.js → types/req-get-by-id.js} +0 -0
- /package/dist/reservations/{types/admin/get-page.d.ts → user/types/req-get-page-reservation.d.ts} +0 -0
- /package/dist/reservations/{types.js → user/types/req-get-page-reservation.js} +0 -0
- /package/dist/{menus/preset/types/available-menu.js → reservations/user/types/resp-reservation-settings.js} +0 -0
- /package/dist/{menus/types/preset-menu.js → reservations/user/types/resp-save-reservation.js} +0 -0
|
@@ -10,4 +10,21 @@ export interface AllBusiness {
|
|
|
10
10
|
address: string;
|
|
11
11
|
review: Review;
|
|
12
12
|
images: string[];
|
|
13
|
+
cashback: CashbackSettings | undefined;
|
|
13
14
|
}
|
|
15
|
+
export interface CashbackSettings {
|
|
16
|
+
isActive: boolean;
|
|
17
|
+
rates: CashbackRates;
|
|
18
|
+
thresholds: Thresholds;
|
|
19
|
+
resetAtSeasonStart: boolean;
|
|
20
|
+
}
|
|
21
|
+
interface CashbackRates {
|
|
22
|
+
bronze: number;
|
|
23
|
+
silver: number;
|
|
24
|
+
gold: number;
|
|
25
|
+
}
|
|
26
|
+
interface Thresholds {
|
|
27
|
+
silver: number;
|
|
28
|
+
gold: number;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Licence } from "../../types";
|
|
2
|
+
import { CashbackSettings } from "./get-all";
|
|
2
3
|
export interface GoogleMap {
|
|
3
4
|
link: string;
|
|
4
5
|
image: string;
|
|
@@ -17,14 +18,15 @@ export interface Business {
|
|
|
17
18
|
id: string;
|
|
18
19
|
identifier: string;
|
|
19
20
|
name: string;
|
|
20
|
-
licence
|
|
21
|
+
licence: Licence | undefined;
|
|
21
22
|
createdAt: Date;
|
|
22
23
|
address: string;
|
|
23
|
-
googleMap
|
|
24
|
+
googleMap: GoogleMap | undefined;
|
|
24
25
|
review: Review;
|
|
25
26
|
phones: string[];
|
|
26
|
-
socialNetworks
|
|
27
|
+
socialNetworks: SocialNetworks | undefined;
|
|
27
28
|
images: string[];
|
|
28
|
-
email
|
|
29
|
-
description
|
|
29
|
+
email: string | undefined;
|
|
30
|
+
description: string | undefined;
|
|
31
|
+
cashback: CashbackSettings | undefined;
|
|
30
32
|
}
|
|
@@ -36,46 +36,50 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
};
|
|
37
37
|
import axios from "axios";
|
|
38
38
|
import { base } from "../../constants";
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
var PresetMenusUserAPIs = /** @class */ (function () {
|
|
42
|
-
function PresetMenusUserAPIs() {
|
|
39
|
+
var CashbackAdminAPIs = /** @class */ (function () {
|
|
40
|
+
function CashbackAdminAPIs() {
|
|
43
41
|
}
|
|
44
|
-
|
|
45
|
-
*
|
|
46
|
-
* @param businessId
|
|
47
|
-
* @param date
|
|
48
|
-
* @returns available preset menus for the given business and date. can fail with bellow errors code: unauthenticated, past_day, expired_licence, internal_error
|
|
49
|
-
*/
|
|
50
|
-
PresetMenusUserAPIs.getAvailableMenus = function (props) {
|
|
42
|
+
CashbackAdminAPIs.get = function (props) {
|
|
51
43
|
return __awaiter(this, void 0, void 0, function () {
|
|
44
|
+
var response, error_1, axiosError;
|
|
52
45
|
return __generator(this, function (_a) {
|
|
53
46
|
switch (_a.label) {
|
|
54
|
-
case 0:
|
|
55
|
-
|
|
56
|
-
|
|
47
|
+
case 0:
|
|
48
|
+
_a.trys.push([0, 2, , 3]);
|
|
49
|
+
return [4 /*yield*/, axios.get(base + "/cashback/admin?userId=".concat(props.userId), {
|
|
50
|
+
headers: {
|
|
51
|
+
'Authorization': "".concat(props.token)
|
|
52
|
+
}
|
|
53
|
+
})];
|
|
54
|
+
case 1:
|
|
55
|
+
response = _a.sent();
|
|
56
|
+
return [2 /*return*/, response.data];
|
|
57
|
+
case 2:
|
|
58
|
+
error_1 = _a.sent();
|
|
59
|
+
axiosError = error_1;
|
|
60
|
+
// The request was made and the server responded with a status code that falls out of the range of 2xx
|
|
61
|
+
if (axiosError && axiosError.response) {
|
|
62
|
+
switch (axiosError.response.status) {
|
|
63
|
+
case 401:
|
|
64
|
+
throw new Error("unauthorized");
|
|
65
|
+
default:
|
|
66
|
+
throw new Error('internal_error');
|
|
57
67
|
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
else if (((_d = error.response) === null || _d === void 0 ? void 0 : _d.status) == 400)
|
|
70
|
-
return (Left(new Error((_f = (_e = error.response) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.code)));
|
|
71
|
-
else
|
|
72
|
-
throw new Error('internal_error', error);
|
|
73
|
-
})];
|
|
74
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
68
|
+
}
|
|
69
|
+
// The request was made but no response was received
|
|
70
|
+
else if (axiosError && axiosError.request) {
|
|
71
|
+
throw new Error('network_error');
|
|
72
|
+
}
|
|
73
|
+
// Something happened in setting up the request that triggered an Error
|
|
74
|
+
else {
|
|
75
|
+
throw new Error('client_request_setting_error');
|
|
76
|
+
}
|
|
77
|
+
return [3 /*break*/, 3];
|
|
78
|
+
case 3: return [2 /*return*/];
|
|
75
79
|
}
|
|
76
80
|
});
|
|
77
81
|
});
|
|
78
82
|
};
|
|
79
|
-
return
|
|
83
|
+
return CashbackAdminAPIs;
|
|
80
84
|
}());
|
|
81
|
-
export {
|
|
85
|
+
export { CashbackAdminAPIs };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Cashback } from "../../user/types/resp-get-cashback";
|
|
2
|
+
export interface CashbackWithCustomerInfo {
|
|
3
|
+
user: CustomerInfo;
|
|
4
|
+
cashback: Cashback | undefined;
|
|
5
|
+
}
|
|
6
|
+
export interface CustomerInfo {
|
|
7
|
+
id: string;
|
|
8
|
+
firstname: string;
|
|
9
|
+
lastname: string;
|
|
10
|
+
phone: string | undefined;
|
|
11
|
+
verifiedPhone: boolean;
|
|
12
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
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;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "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
|
+
var CashbackUserAPIs = /** @class */ (function () {
|
|
40
|
+
function CashbackUserAPIs() {
|
|
41
|
+
}
|
|
42
|
+
CashbackUserAPIs.get = function (props) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
44
|
+
var response, error_1, axiosError;
|
|
45
|
+
return __generator(this, function (_a) {
|
|
46
|
+
switch (_a.label) {
|
|
47
|
+
case 0:
|
|
48
|
+
_a.trys.push([0, 2, , 3]);
|
|
49
|
+
return [4 /*yield*/, axios.get(base + "/cashback/user?businessId=".concat(props.businessId), {
|
|
50
|
+
headers: {
|
|
51
|
+
'Authorization': "".concat(props.token)
|
|
52
|
+
}
|
|
53
|
+
})];
|
|
54
|
+
case 1:
|
|
55
|
+
response = _a.sent();
|
|
56
|
+
return [2 /*return*/, response.data];
|
|
57
|
+
case 2:
|
|
58
|
+
error_1 = _a.sent();
|
|
59
|
+
axiosError = error_1;
|
|
60
|
+
// The request was made and the server responded with a status code that falls out of the range of 2xx
|
|
61
|
+
if (axiosError && axiosError.response) {
|
|
62
|
+
switch (axiosError.response.status) {
|
|
63
|
+
case 401:
|
|
64
|
+
throw new Error("unauthorized");
|
|
65
|
+
case 404:
|
|
66
|
+
return [2 /*return*/, undefined];
|
|
67
|
+
default:
|
|
68
|
+
throw new Error('internal_error');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// The request was made but no response was received
|
|
72
|
+
else if (axiosError && axiosError.request) {
|
|
73
|
+
throw new Error('network_error');
|
|
74
|
+
}
|
|
75
|
+
// Something happened in setting up the request that triggered an Error
|
|
76
|
+
else {
|
|
77
|
+
throw new Error('client_request_setting_error');
|
|
78
|
+
}
|
|
79
|
+
return [3 /*break*/, 3];
|
|
80
|
+
case 3: return [2 /*return*/];
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
return CashbackUserAPIs;
|
|
86
|
+
}());
|
|
87
|
+
export { CashbackUserAPIs };
|
package/dist/deals/types.d.ts
CHANGED
package/dist/enum.d.ts
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
export declare enum ReservationStatus {
|
|
2
2
|
Pending = "pending",
|
|
3
3
|
Confirmed = "confirmed",
|
|
4
|
+
Validated = "validated",
|
|
4
5
|
Missed = "missed",
|
|
5
6
|
CanceledUser = "canceled_user",
|
|
6
7
|
CanceledBusiness = "canceled_business"
|
|
7
8
|
}
|
|
8
|
-
export declare enum
|
|
9
|
+
export declare enum ReservationDealKind {
|
|
9
10
|
Discount = "discount",
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
CashbackEarn = "cashback_earn",
|
|
12
|
+
CashBackApply = "cashback_apply"
|
|
13
|
+
}
|
|
14
|
+
export declare enum Level {
|
|
15
|
+
Bronze = "bronze",
|
|
16
|
+
Silver = "silver",
|
|
17
|
+
Gold = "gold"
|
|
12
18
|
}
|
|
13
19
|
export declare enum TimelineDirection {
|
|
14
20
|
Past = "past",
|
|
@@ -16,10 +22,10 @@ export declare enum TimelineDirection {
|
|
|
16
22
|
}
|
|
17
23
|
export declare enum ReservationEventKind {
|
|
18
24
|
Confirmed = "confirmed",
|
|
25
|
+
Validated = "validated",
|
|
19
26
|
Missed = "missed",
|
|
20
27
|
CanceledUser = "canceled_user",
|
|
21
|
-
CanceledBusiness = "canceled_business"
|
|
22
|
-
Updated = "updated"
|
|
28
|
+
CanceledBusiness = "canceled_business"
|
|
23
29
|
}
|
|
24
30
|
export declare enum CancellationReason {
|
|
25
31
|
UnavailablePlace = "unavailable_place",
|
package/dist/enum.js
CHANGED
|
@@ -2,16 +2,23 @@ export var ReservationStatus;
|
|
|
2
2
|
(function (ReservationStatus) {
|
|
3
3
|
ReservationStatus["Pending"] = "pending";
|
|
4
4
|
ReservationStatus["Confirmed"] = "confirmed";
|
|
5
|
+
ReservationStatus["Validated"] = "validated";
|
|
5
6
|
ReservationStatus["Missed"] = "missed";
|
|
6
7
|
ReservationStatus["CanceledUser"] = "canceled_user";
|
|
7
8
|
ReservationStatus["CanceledBusiness"] = "canceled_business";
|
|
8
9
|
})(ReservationStatus || (ReservationStatus = {}));
|
|
9
|
-
export var
|
|
10
|
-
(function (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
})(
|
|
10
|
+
export var ReservationDealKind;
|
|
11
|
+
(function (ReservationDealKind) {
|
|
12
|
+
ReservationDealKind["Discount"] = "discount";
|
|
13
|
+
ReservationDealKind["CashbackEarn"] = "cashback_earn";
|
|
14
|
+
ReservationDealKind["CashBackApply"] = "cashback_apply";
|
|
15
|
+
})(ReservationDealKind || (ReservationDealKind = {}));
|
|
16
|
+
export var Level;
|
|
17
|
+
(function (Level) {
|
|
18
|
+
Level["Bronze"] = "bronze";
|
|
19
|
+
Level["Silver"] = "silver";
|
|
20
|
+
Level["Gold"] = "gold";
|
|
21
|
+
})(Level || (Level = {}));
|
|
15
22
|
export var TimelineDirection;
|
|
16
23
|
(function (TimelineDirection) {
|
|
17
24
|
TimelineDirection["Past"] = "past";
|
|
@@ -20,10 +27,10 @@ export var TimelineDirection;
|
|
|
20
27
|
export var ReservationEventKind;
|
|
21
28
|
(function (ReservationEventKind) {
|
|
22
29
|
ReservationEventKind["Confirmed"] = "confirmed";
|
|
30
|
+
ReservationEventKind["Validated"] = "validated";
|
|
23
31
|
ReservationEventKind["Missed"] = "missed";
|
|
24
32
|
ReservationEventKind["CanceledUser"] = "canceled_user";
|
|
25
33
|
ReservationEventKind["CanceledBusiness"] = "canceled_business";
|
|
26
|
-
ReservationEventKind["Updated"] = "updated";
|
|
27
34
|
})(ReservationEventKind || (ReservationEventKind = {}));
|
|
28
35
|
export var CancellationReason;
|
|
29
36
|
(function (CancellationReason) {
|
package/dist/index.d.ts
CHANGED
|
@@ -3,17 +3,14 @@ export { BusinessAdminAPIs } from './business/admin-apis';
|
|
|
3
3
|
export { DealsAPIs } from './deals/apis';
|
|
4
4
|
export { IamAdminAPIs } from './iam/admin-apis';
|
|
5
5
|
export { IamUserAPIs } from './iam/user-apis';
|
|
6
|
-
export { PresetMenusAPIs } from './menus/preset/apis';
|
|
7
|
-
export { PresetMenusAdminAPIs } from './menus/preset/admin-apis';
|
|
8
6
|
export { NotifyAPIs } from './notify/apis';
|
|
9
|
-
export { ReservationsUserAPIs } from './reservations/user/user-apis';
|
|
10
|
-
export * from './reservations/user/types';
|
|
11
|
-
export { ReservationsAdminAPIs } from './reservations/admin-apis';
|
|
12
7
|
export { SitemapAPIs } from './sitemap/apis';
|
|
13
8
|
export { StatisticsAdminAPIs } from './statistics/admin-apis';
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
9
|
+
export * from './menus/preset/index';
|
|
10
|
+
export * from './reservations/index';
|
|
11
|
+
export * from './cashback/index';
|
|
12
|
+
export * from './utils/menu-utils';
|
|
13
|
+
export * from './utils/business-utils';
|
|
17
14
|
export * from './utils/date-utils';
|
|
18
15
|
export * from './enum';
|
|
19
16
|
export * from './types';
|
package/dist/index.js
CHANGED
|
@@ -3,18 +3,18 @@ export { BusinessAdminAPIs } from './business/admin-apis';
|
|
|
3
3
|
export { DealsAPIs } from './deals/apis';
|
|
4
4
|
export { IamAdminAPIs } from './iam/admin-apis';
|
|
5
5
|
export { IamUserAPIs } from './iam/user-apis';
|
|
6
|
-
export { PresetMenusAPIs } from './menus/preset/apis';
|
|
7
|
-
export { PresetMenusAdminAPIs } from './menus/preset/admin-apis';
|
|
8
6
|
export { NotifyAPIs } from './notify/apis';
|
|
9
|
-
export { ReservationsUserAPIs } from './reservations/user/user-apis';
|
|
10
|
-
export * from './reservations/user/types';
|
|
11
|
-
export { ReservationsAdminAPIs } from './reservations/admin-apis';
|
|
12
7
|
export { SitemapAPIs } from './sitemap/apis';
|
|
13
8
|
export { StatisticsAdminAPIs } from './statistics/admin-apis';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export
|
|
9
|
+
// menus module
|
|
10
|
+
export * from './menus/preset/index';
|
|
11
|
+
// reservations module
|
|
12
|
+
export * from './reservations/index';
|
|
13
|
+
// cashback module
|
|
14
|
+
export * from './cashback/index';
|
|
15
|
+
//utils
|
|
16
|
+
export * from './utils/menu-utils';
|
|
17
|
+
export * from './utils/business-utils';
|
|
18
18
|
export * from './utils/date-utils';
|
|
19
19
|
export * from './enum';
|
|
20
20
|
export * from './types';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './types/preset-menu';
|
|
2
|
+
export * from './types/types';
|
|
3
|
+
export * from './types/update-preset-menu';
|
|
4
|
+
export { PresetMenusAPIs } from './apis';
|
|
5
|
+
export { PresetMenusAdminAPIs } from './admin-apis';
|
|
6
|
+
export * from './discounts/types/update-discount';
|
|
7
|
+
export { PresetMenusDiscountAdminAPIs } from './discounts/admin-apis';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// preset-menus module
|
|
2
|
+
export * from './types/preset-menu';
|
|
3
|
+
export * from './types/types';
|
|
4
|
+
export * from './types/update-preset-menu';
|
|
5
|
+
export { PresetMenusAPIs } from './apis';
|
|
6
|
+
export { PresetMenusAdminAPIs } from './admin-apis';
|
|
7
|
+
// discount module
|
|
8
|
+
export * from './discounts/types/update-discount';
|
|
9
|
+
export { PresetMenusDiscountAdminAPIs } from './discounts/admin-apis';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CancellationReason, ReservationStatus, TimelineDirection } from "
|
|
2
|
-
import { GetTransitionsRequest } from "
|
|
3
|
-
import {
|
|
4
|
-
import { Reservation } from "
|
|
1
|
+
import { CancellationReason, ReservationStatus, TimelineDirection } from "../../enum";
|
|
2
|
+
import { GetTransitionsRequest } from "./types/get-available-transitions";
|
|
3
|
+
import { GetByIdAdminRequest } from "./types/get-id";
|
|
4
|
+
import { Reservation } from "../shared/reservation";
|
|
5
5
|
import { Either } from "purify-ts";
|
|
6
6
|
export declare class ReservationsAdminAPIs {
|
|
7
7
|
static getPage(props: {
|
|
@@ -11,7 +11,13 @@ export declare class ReservationsAdminAPIs {
|
|
|
11
11
|
status?: ReservationStatus;
|
|
12
12
|
direction?: TimelineDirection;
|
|
13
13
|
}): Promise<Reservation[]>;
|
|
14
|
-
static
|
|
14
|
+
static getUserHistoryPage(props: {
|
|
15
|
+
token?: string;
|
|
16
|
+
user: string;
|
|
17
|
+
page: number;
|
|
18
|
+
size: number;
|
|
19
|
+
}): Promise<Reservation[]>;
|
|
20
|
+
static getById({ token, id }: GetByIdAdminRequest): Promise<Reservation>;
|
|
15
21
|
static getAvailableTransitions({ token, reservationId }: GetTransitionsRequest): Promise<ReservationStatus[]>;
|
|
16
22
|
static patchStatus(props: {
|
|
17
23
|
token?: string;
|
|
@@ -35,10 +35,12 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
import axios from "axios";
|
|
38
|
-
import { base } from "
|
|
39
|
-
import { ErrorWithMetadata } from "
|
|
38
|
+
import { base } from "../../constants";
|
|
39
|
+
import { ErrorWithMetadata } from "../../types";
|
|
40
40
|
import { format } from "date-fns";
|
|
41
41
|
import { Left, Right } from "purify-ts";
|
|
42
|
+
import { parseReservationDeal } from "../shared/reservation-deal";
|
|
43
|
+
import { RequestUtils } from "../../utils/request-utils";
|
|
42
44
|
var ReservationsAdminAPIs = /** @class */ (function () {
|
|
43
45
|
function ReservationsAdminAPIs() {
|
|
44
46
|
}
|
|
@@ -61,7 +63,13 @@ var ReservationsAdminAPIs = /** @class */ (function () {
|
|
|
61
63
|
'Authorization': "".concat(props.token)
|
|
62
64
|
}
|
|
63
65
|
})
|
|
64
|
-
.then(function (response) {
|
|
66
|
+
.then(function (response) {
|
|
67
|
+
var result = response.data;
|
|
68
|
+
for (var i = 0; i < result.length; i++) {
|
|
69
|
+
result[i].deal = result[i].deal ? parseReservationDeal(result[i].deal) : undefined;
|
|
70
|
+
}
|
|
71
|
+
return result;
|
|
72
|
+
})
|
|
65
73
|
.catch(function (error) {
|
|
66
74
|
// handle error
|
|
67
75
|
if (error.response.status == 401)
|
|
@@ -74,6 +82,32 @@ var ReservationsAdminAPIs = /** @class */ (function () {
|
|
|
74
82
|
});
|
|
75
83
|
});
|
|
76
84
|
};
|
|
85
|
+
ReservationsAdminAPIs.getUserHistoryPage = function (props) {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
87
|
+
return __generator(this, function (_a) {
|
|
88
|
+
return [2 /*return*/, RequestUtils.send(function () {
|
|
89
|
+
var queryParams = [
|
|
90
|
+
"page=".concat(props.page),
|
|
91
|
+
"size=".concat(props.size)
|
|
92
|
+
]
|
|
93
|
+
.filter(function (value) { return value; })
|
|
94
|
+
.join("&");
|
|
95
|
+
return axios.get(base + "/reservations/admin/users/".concat(props.user, "?").concat(queryParams), {
|
|
96
|
+
headers: {
|
|
97
|
+
'Authorization': "".concat(props.token)
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
.then(function (response) {
|
|
101
|
+
var result = response.data;
|
|
102
|
+
for (var i = 0; i < result.length; i++) {
|
|
103
|
+
result[i].deal = result[i].deal ? parseReservationDeal(result[i].deal) : undefined;
|
|
104
|
+
}
|
|
105
|
+
return result;
|
|
106
|
+
});
|
|
107
|
+
})];
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
};
|
|
77
111
|
ReservationsAdminAPIs.getById = function (_a) {
|
|
78
112
|
var token = _a.token, id = _a.id;
|
|
79
113
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -85,7 +119,11 @@ var ReservationsAdminAPIs = /** @class */ (function () {
|
|
|
85
119
|
'Content-Type': 'application/json'
|
|
86
120
|
}
|
|
87
121
|
})
|
|
88
|
-
.then(function (response) {
|
|
122
|
+
.then(function (response) {
|
|
123
|
+
var result = response.data;
|
|
124
|
+
result.deal = result.deal ? parseReservationDeal(result.deal) : undefined;
|
|
125
|
+
return result;
|
|
126
|
+
})
|
|
89
127
|
.catch(function (error) {
|
|
90
128
|
// handle error
|
|
91
129
|
if (error.response.status == 401)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./user/types/resp-reservation-settings";
|
|
2
|
+
export * from './user/types/resp-reservation-preview';
|
|
3
|
+
export * from "./user/types/resp-save-reservation";
|
|
4
|
+
export * from "./user/types/req-get-by-id";
|
|
5
|
+
export * from "./user/types/req-get-page-reservation";
|
|
6
|
+
export { ReservationsUserAPIs } from './user/user-apis';
|
|
7
|
+
export * from "./admin/types/get-available-transitions";
|
|
8
|
+
export * from "./admin/types/get-id";
|
|
9
|
+
export { ReservationsAdminAPIs } from './admin/admin-apis';
|
|
10
|
+
export * from './shared/reservation';
|
|
11
|
+
export * from './shared/reservation-deal';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// user module
|
|
2
|
+
export * from "./user/types/resp-reservation-settings";
|
|
3
|
+
export * from './user/types/resp-reservation-preview';
|
|
4
|
+
export * from "./user/types/resp-save-reservation";
|
|
5
|
+
export * from "./user/types/req-get-by-id";
|
|
6
|
+
export * from "./user/types/req-get-page-reservation";
|
|
7
|
+
export { ReservationsUserAPIs } from './user/user-apis';
|
|
8
|
+
// admin module
|
|
9
|
+
export * from "./admin/types/get-available-transitions";
|
|
10
|
+
export * from "./admin/types/get-id";
|
|
11
|
+
export { ReservationsAdminAPIs } from './admin/admin-apis';
|
|
12
|
+
// shared module
|
|
13
|
+
export * from './shared/reservation';
|
|
14
|
+
export * from './shared/reservation-deal';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Level, ReservationDealKind } from "../../enum";
|
|
2
|
+
export interface Discount {
|
|
3
|
+
type: ReservationDealKind.Discount;
|
|
4
|
+
value: number;
|
|
5
|
+
}
|
|
6
|
+
export interface CashbackEarn {
|
|
7
|
+
type: ReservationDealKind.CashbackEarn;
|
|
8
|
+
value: number;
|
|
9
|
+
level: Level;
|
|
10
|
+
rate: number;
|
|
11
|
+
isInProgress: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface CashbackApply {
|
|
14
|
+
type: ReservationDealKind.CashBackApply;
|
|
15
|
+
value: number;
|
|
16
|
+
isInProgress: boolean;
|
|
17
|
+
}
|
|
18
|
+
export type ReservationDeal = Discount | CashbackEarn | CashbackApply;
|
|
19
|
+
export declare function parseReservationDeal(json: any): ReservationDeal;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReservationDealKind } from "../../enum";
|
|
2
|
+
export function parseReservationDeal(json) {
|
|
3
|
+
switch (json.type) {
|
|
4
|
+
case ReservationDealKind.Discount:
|
|
5
|
+
return json;
|
|
6
|
+
case ReservationDealKind.CashbackEarn:
|
|
7
|
+
return json;
|
|
8
|
+
case ReservationDealKind.CashBackApply:
|
|
9
|
+
return json;
|
|
10
|
+
default:
|
|
11
|
+
throw new Error("Unknown reservation's deal type: ".concat(json.type));
|
|
12
|
+
}
|
|
13
|
+
}
|