@kiminix/tp-client 2.6.0 → 2.8.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/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/menus/index.d.ts +4 -0
- package/dist/menus/index.js +7 -0
- package/dist/menus/user/guest-apis.d.ts +31 -0
- package/dist/menus/user/guest-apis.js +111 -0
- package/dist/menus/user/types/get-menu-response.d.ts +41 -0
- package/dist/menus/user/types/get-menu-response.js +4 -0
- package/dist/menus/user/types/get-qrcode-response.d.ts +3 -0
- package/dist/menus/user/types/get-qrcode-response.js +1 -0
- package/dist/menus/user/types/post-order.d.ts +14 -0
- package/dist/menus/user/types/post-order.js +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export * from './reservations/index';
|
|
|
9
9
|
export * from './cashback/index';
|
|
10
10
|
export * from './discounts/index';
|
|
11
11
|
export * from './vouchers/index';
|
|
12
|
+
export * from './menus/index';
|
|
12
13
|
export * from './utils/business-utils';
|
|
13
14
|
export * from './utils/date-utils';
|
|
14
15
|
export * from './enum';
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,8 @@ export * from './cashback/index';
|
|
|
16
16
|
export * from './discounts/index';
|
|
17
17
|
//vouchers module
|
|
18
18
|
export * from './vouchers/index';
|
|
19
|
+
//menus module
|
|
20
|
+
export * from './menus/index';
|
|
19
21
|
//utils
|
|
20
22
|
export * from './utils/business-utils';
|
|
21
23
|
export * from './utils/date-utils';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { OrderRequest, OrderResponse } from "./types/post-order";
|
|
2
|
+
import { QrCode } from "./types/get-qrcode-response";
|
|
3
|
+
import { Menu } from "./types/get-menu-response";
|
|
4
|
+
export declare class MenuGuestAPIs {
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param props
|
|
8
|
+
* @throws item_unavailable, closed_hour, item_not_found, variant_not_found, qrcode_not_found, internal_error
|
|
9
|
+
*
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
static order(props: OrderRequest): Promise<OrderResponse>;
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param props
|
|
16
|
+
* @throws qrcode_not_found, qrcode_bad_config, internal_error
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
static getQrCode(props: {
|
|
20
|
+
id: string;
|
|
21
|
+
}): Promise<QrCode>;
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @param props
|
|
25
|
+
* @throws qrcode_not_found, internal_error
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
static getMenu(props: {
|
|
29
|
+
id: string;
|
|
30
|
+
}): Promise<Menu>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
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
|
+
import { RequestUtils } from "../../utils/request-utils";
|
|
40
|
+
// GUEST APIS
|
|
41
|
+
var MenuGuestAPIs = /** @class */ (function () {
|
|
42
|
+
function MenuGuestAPIs() {
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @param props
|
|
47
|
+
* @throws item_unavailable, closed_hour, item_not_found, variant_not_found, qrcode_not_found, internal_error
|
|
48
|
+
*
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
MenuGuestAPIs.order = function (props) {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
53
|
+
return __generator(this, function (_a) {
|
|
54
|
+
return [2 /*return*/, RequestUtils.send(function () {
|
|
55
|
+
return axios.post(base + "/menus/guest/order", props, {
|
|
56
|
+
headers: {
|
|
57
|
+
'Content-Type': 'application/json'
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
.then(function (response) { return response.data; });
|
|
61
|
+
})];
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
*
|
|
67
|
+
* @param props
|
|
68
|
+
* @throws qrcode_not_found, qrcode_bad_config, internal_error
|
|
69
|
+
* @returns
|
|
70
|
+
*/
|
|
71
|
+
MenuGuestAPIs.getQrCode = function (props) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
73
|
+
return __generator(this, function (_a) {
|
|
74
|
+
return [2 /*return*/, RequestUtils.send(function () {
|
|
75
|
+
return axios.get(base + "/menus/guest/qrcode/".concat(props.id), {
|
|
76
|
+
headers: {
|
|
77
|
+
'Content-Type': 'application/json'
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
.then(function (response) {
|
|
81
|
+
return response.data;
|
|
82
|
+
});
|
|
83
|
+
})];
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
*
|
|
89
|
+
* @param props
|
|
90
|
+
* @throws qrcode_not_found, internal_error
|
|
91
|
+
* @returns
|
|
92
|
+
*/
|
|
93
|
+
MenuGuestAPIs.getMenu = function (props) {
|
|
94
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
95
|
+
return __generator(this, function (_a) {
|
|
96
|
+
return [2 /*return*/, RequestUtils.send(function () {
|
|
97
|
+
return axios.get(base + "/menus/guest/".concat(props.id), {
|
|
98
|
+
headers: {
|
|
99
|
+
'Content-Type': 'application/json'
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
.then(function (response) {
|
|
103
|
+
return response.data;
|
|
104
|
+
});
|
|
105
|
+
})];
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
return MenuGuestAPIs;
|
|
110
|
+
}());
|
|
111
|
+
export { MenuGuestAPIs };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export interface Menu {
|
|
2
|
+
qrCodeLabel: string;
|
|
3
|
+
business: BusinessOfMenu;
|
|
4
|
+
categories: Category[];
|
|
5
|
+
}
|
|
6
|
+
export interface BusinessOfMenu {
|
|
7
|
+
id: string;
|
|
8
|
+
identifier: string;
|
|
9
|
+
name: string;
|
|
10
|
+
coverPhoto: string;
|
|
11
|
+
logo?: string;
|
|
12
|
+
socialLinks?: SocialLinks;
|
|
13
|
+
}
|
|
14
|
+
export interface SocialLinks {
|
|
15
|
+
facebook?: string;
|
|
16
|
+
instagram?: string;
|
|
17
|
+
twitter?: string;
|
|
18
|
+
tiktok?: string;
|
|
19
|
+
youtube?: string;
|
|
20
|
+
website?: string;
|
|
21
|
+
googleMapReview?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface Category {
|
|
24
|
+
label: string;
|
|
25
|
+
isPublic: boolean;
|
|
26
|
+
products: Product[];
|
|
27
|
+
}
|
|
28
|
+
export interface Product {
|
|
29
|
+
label: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
picture: string;
|
|
32
|
+
variants: Variant[];
|
|
33
|
+
}
|
|
34
|
+
export declare function isAvailable(product: Product): boolean;
|
|
35
|
+
export interface Variant {
|
|
36
|
+
id: string;
|
|
37
|
+
label?: string;
|
|
38
|
+
isAvailable: boolean;
|
|
39
|
+
price: number;
|
|
40
|
+
discount?: number;
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface OrderRequest {
|
|
2
|
+
qrCodeId: string;
|
|
3
|
+
deviceId: string;
|
|
4
|
+
name: string;
|
|
5
|
+
items: OrderItem[];
|
|
6
|
+
}
|
|
7
|
+
export interface OrderItem {
|
|
8
|
+
productId: string;
|
|
9
|
+
variantId: string;
|
|
10
|
+
quantity: number;
|
|
11
|
+
}
|
|
12
|
+
export interface OrderResponse {
|
|
13
|
+
id: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|