@kiminix/tp-client 1.32.0 → 1.34.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/menus/preset/apis.d.ts +0 -1
- package/dist/menus/preset/apis.js +1 -3
- package/dist/reservations/admin/admin-apis.d.ts +4 -0
- package/dist/reservations/admin/admin-apis.js +17 -0
- package/dist/reservations/index.d.ts +1 -0
- package/dist/reservations/index.js +2 -0
- package/dist/reservations/user/user-apis.d.ts +26 -1
- package/dist/reservations/user/user-apis.js +70 -0
- package/package.json +1 -1
|
@@ -4,7 +4,6 @@ import { SpecialDiscount } from "./types/special-discounts";
|
|
|
4
4
|
export declare class PresetMenusAPIs {
|
|
5
5
|
static getByBusiness(businessId: string): Promise<PresetMenu[]>;
|
|
6
6
|
static getSpecialDiscounts(props: {
|
|
7
|
-
token?: string;
|
|
8
7
|
businessId: string;
|
|
9
8
|
code: string;
|
|
10
9
|
date: LocalDate;
|
|
@@ -65,9 +65,7 @@ var PresetMenusAPIs = /** @class */ (function () {
|
|
|
65
65
|
.filter(function (value) { return value; })
|
|
66
66
|
.join("&");
|
|
67
67
|
return axios.get(base + "/preset-menus/user/special-discounts?".concat(queryParams), {
|
|
68
|
-
headers: {
|
|
69
|
-
'Authorization': "".concat(props.token)
|
|
70
|
-
}
|
|
68
|
+
headers: {}
|
|
71
69
|
})
|
|
72
70
|
.then(function (response) {
|
|
73
71
|
var result = response.data;
|
|
@@ -43,6 +43,10 @@ export declare class ReservationsAdminAPIs {
|
|
|
43
43
|
child?: number;
|
|
44
44
|
}[];
|
|
45
45
|
}): Promise<Either<Error, void>>;
|
|
46
|
+
static getByIdPrivate(props: {
|
|
47
|
+
token?: string;
|
|
48
|
+
id: string;
|
|
49
|
+
}): Promise<Reservation>;
|
|
46
50
|
static getPagePrivate(props: {
|
|
47
51
|
token?: string;
|
|
48
52
|
page: number;
|
|
@@ -231,6 +231,23 @@ var ReservationsAdminAPIs = /** @class */ (function () {
|
|
|
231
231
|
});
|
|
232
232
|
};
|
|
233
233
|
// API for private admins
|
|
234
|
+
ReservationsAdminAPIs.getByIdPrivate = function (props) {
|
|
235
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
236
|
+
return __generator(this, function (_a) {
|
|
237
|
+
return [2 /*return*/, RequestUtils.send(function () {
|
|
238
|
+
return axios.get(base + "/reservations/private/".concat(props.id), {
|
|
239
|
+
headers: {
|
|
240
|
+
'Authorization': "".concat(props.token)
|
|
241
|
+
}
|
|
242
|
+
}).then(function (response) {
|
|
243
|
+
var result = response.data;
|
|
244
|
+
result.deal = result.deal ? parseReservationDeal(result.deal) : undefined;
|
|
245
|
+
return result;
|
|
246
|
+
});
|
|
247
|
+
})];
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
};
|
|
234
251
|
ReservationsAdminAPIs.getPagePrivate = function (props) {
|
|
235
252
|
return __awaiter(this, void 0, void 0, function () {
|
|
236
253
|
return __generator(this, function (_a) {
|
|
@@ -4,6 +4,7 @@ export * from "./user/types/resp-save-reservation";
|
|
|
4
4
|
export * from "./user/types/req-get-by-id";
|
|
5
5
|
export * from "./user/types/req-get-page-reservation";
|
|
6
6
|
export { ReservationsUserAPIs } from './user/user-apis';
|
|
7
|
+
export { ReservationsGuestAPIs } from './user/user-apis';
|
|
7
8
|
export * from "./admin/types/get-available-transitions";
|
|
8
9
|
export * from "./admin/types/get-id";
|
|
9
10
|
export { ReservationsAdminAPIs } from './admin/admin-apis';
|
|
@@ -5,6 +5,8 @@ export * from "./user/types/resp-save-reservation";
|
|
|
5
5
|
export * from "./user/types/req-get-by-id";
|
|
6
6
|
export * from "./user/types/req-get-page-reservation";
|
|
7
7
|
export { ReservationsUserAPIs } from './user/user-apis';
|
|
8
|
+
// guest module
|
|
9
|
+
export { ReservationsGuestAPIs } from './user/user-apis';
|
|
8
10
|
// admin module
|
|
9
11
|
export * from "./admin/types/get-available-transitions";
|
|
10
12
|
export * from "./admin/types/get-id";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReservationDealKind } from "../../enum";
|
|
2
2
|
import { LocalDate } from "../../types";
|
|
3
3
|
import { Reservation } from "../shared/reservation";
|
|
4
|
-
import { GetByIdAdminRequest, GetPageRequest, ReservationPreviewResponse, ReservationSettings } from "../index";
|
|
4
|
+
import { AvailableMenu, GetByIdAdminRequest, GetPageRequest, ReservationPreviewResponse, ReservationSettings } from "../index";
|
|
5
5
|
import { SaveReservationResponse } from "./types/resp-save-reservation";
|
|
6
6
|
export declare class ReservationsUserAPIs {
|
|
7
7
|
static getPage({ token, page, size, direction }: GetPageRequest): Promise<Reservation[]>;
|
|
@@ -46,3 +46,28 @@ export declare class ReservationsUserAPIs {
|
|
|
46
46
|
}[];
|
|
47
47
|
}): Promise<ReservationPreviewResponse>;
|
|
48
48
|
}
|
|
49
|
+
export declare class ReservationsGuestAPIs {
|
|
50
|
+
static reserve(props: {
|
|
51
|
+
user: {
|
|
52
|
+
firstName: string;
|
|
53
|
+
lastName: string;
|
|
54
|
+
phone: string;
|
|
55
|
+
};
|
|
56
|
+
businessId: string;
|
|
57
|
+
date: Date;
|
|
58
|
+
time: Date;
|
|
59
|
+
specialCode?: string;
|
|
60
|
+
commands: {
|
|
61
|
+
menuId: string;
|
|
62
|
+
adult: number;
|
|
63
|
+
child?: number;
|
|
64
|
+
}[];
|
|
65
|
+
}): Promise<SaveReservationResponse>;
|
|
66
|
+
static getSettings(props: {
|
|
67
|
+
businessId: string;
|
|
68
|
+
date: LocalDate;
|
|
69
|
+
}): Promise<AvailableMenu[]>;
|
|
70
|
+
static get(props: {
|
|
71
|
+
id: string;
|
|
72
|
+
}): Promise<Reservation>;
|
|
73
|
+
}
|
|
@@ -39,6 +39,7 @@ import { format } from "date-fns";
|
|
|
39
39
|
import { base } from "../../constants";
|
|
40
40
|
import { ErrorWithMetadata } from "../../types";
|
|
41
41
|
import { parseReservationDeal } from "../shared/reservation-deal";
|
|
42
|
+
import { RequestUtils } from "../../utils/request-utils";
|
|
42
43
|
var ReservationsUserAPIs = /** @class */ (function () {
|
|
43
44
|
function ReservationsUserAPIs() {
|
|
44
45
|
}
|
|
@@ -271,3 +272,72 @@ var ReservationsUserAPIs = /** @class */ (function () {
|
|
|
271
272
|
return ReservationsUserAPIs;
|
|
272
273
|
}());
|
|
273
274
|
export { ReservationsUserAPIs };
|
|
275
|
+
// GUEST APIS
|
|
276
|
+
var ReservationsGuestAPIs = /** @class */ (function () {
|
|
277
|
+
function ReservationsGuestAPIs() {
|
|
278
|
+
}
|
|
279
|
+
ReservationsGuestAPIs.reserve = function (props) {
|
|
280
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
281
|
+
var datetime;
|
|
282
|
+
return __generator(this, function (_a) {
|
|
283
|
+
datetime = new Date(props.date);
|
|
284
|
+
datetime.setHours(props.time.getHours(), props.time.getMinutes());
|
|
285
|
+
// unavailable_day
|
|
286
|
+
// expired_preview
|
|
287
|
+
// invalid_guest_number
|
|
288
|
+
// invalid_special_code
|
|
289
|
+
return [2 /*return*/, RequestUtils.send(function () {
|
|
290
|
+
return axios.post(base + "/reservations/guest", {
|
|
291
|
+
user: {
|
|
292
|
+
firstName: props.user.firstName,
|
|
293
|
+
lastName: props.user.lastName,
|
|
294
|
+
phone: props.user.phone
|
|
295
|
+
},
|
|
296
|
+
businessId: props.businessId,
|
|
297
|
+
datetime: format(datetime, "yyyy-MM-dd'T'HH:mm"),
|
|
298
|
+
specialCode: props.specialCode,
|
|
299
|
+
commands: props.commands
|
|
300
|
+
}, {
|
|
301
|
+
headers: {
|
|
302
|
+
'Content-Type': 'application/json'
|
|
303
|
+
}
|
|
304
|
+
})
|
|
305
|
+
.then(function (response) { return response.data; });
|
|
306
|
+
})];
|
|
307
|
+
});
|
|
308
|
+
});
|
|
309
|
+
};
|
|
310
|
+
// get available menus for the guest
|
|
311
|
+
ReservationsGuestAPIs.getSettings = function (props) {
|
|
312
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
313
|
+
return __generator(this, function (_a) {
|
|
314
|
+
return [2 /*return*/, RequestUtils.send(function () {
|
|
315
|
+
return axios.get(base + "/reservations/guest/settings?business=".concat(props.businessId, "&date=").concat(props.date), { headers: {} })
|
|
316
|
+
.then(function (response) {
|
|
317
|
+
return response.data;
|
|
318
|
+
});
|
|
319
|
+
})];
|
|
320
|
+
});
|
|
321
|
+
});
|
|
322
|
+
};
|
|
323
|
+
ReservationsGuestAPIs.get = function (props) {
|
|
324
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
325
|
+
return __generator(this, function (_a) {
|
|
326
|
+
return [2 /*return*/, RequestUtils.send(function () {
|
|
327
|
+
return axios.get(base + "/reservations/guest/".concat(props.id), {
|
|
328
|
+
headers: {
|
|
329
|
+
'Content-Type': 'application/json'
|
|
330
|
+
}
|
|
331
|
+
})
|
|
332
|
+
.then(function (response) {
|
|
333
|
+
var result = response.data;
|
|
334
|
+
result.deal = result.deal ? parseReservationDeal(result.deal) : undefined;
|
|
335
|
+
return result;
|
|
336
|
+
});
|
|
337
|
+
})];
|
|
338
|
+
});
|
|
339
|
+
});
|
|
340
|
+
};
|
|
341
|
+
return ReservationsGuestAPIs;
|
|
342
|
+
}());
|
|
343
|
+
export { ReservationsGuestAPIs };
|