@kiminix/tp-client 2.9.4 → 2.9.6

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.
@@ -1,6 +1,8 @@
1
1
  import { Order } from "../shared/types";
2
2
  import { OrderStatus } from "../../enum";
3
3
  import { CallWaiter, CallWaiterStatus } from "./types/get-calls-response";
4
+ import { Category } from "./types/get-menu-response";
5
+ import { Product } from "./types/get-product-response";
4
6
  export declare class MenuAdminAPIs {
5
7
  static updateOrders(props: {
6
8
  token?: string;
@@ -33,4 +35,11 @@ export declare class MenuAdminAPIs {
33
35
  deviceId: string;
34
36
  qrCodeId: string;
35
37
  }): Promise<undefined>;
38
+ static getMenu(props: {
39
+ token?: string;
40
+ }): Promise<Category[]>;
41
+ static getProduct(props: {
42
+ token?: string;
43
+ id: string;
44
+ }): Promise<Product>;
36
45
  }
@@ -138,6 +138,34 @@ var MenuAdminAPIs = /** @class */ (function () {
138
138
  });
139
139
  });
140
140
  };
141
+ MenuAdminAPIs.getMenu = function (props) {
142
+ return __awaiter(this, void 0, void 0, function () {
143
+ return __generator(this, function (_a) {
144
+ return [2 /*return*/, RequestUtils.send(function () {
145
+ return axios.get(base + "/menus/admin", {
146
+ headers: {
147
+ 'Authorization': "".concat(props.token)
148
+ }
149
+ })
150
+ .then(function (response) { return response.data; });
151
+ })];
152
+ });
153
+ });
154
+ };
155
+ MenuAdminAPIs.getProduct = function (props) {
156
+ return __awaiter(this, void 0, void 0, function () {
157
+ return __generator(this, function (_a) {
158
+ return [2 /*return*/, RequestUtils.send(function () {
159
+ return axios.get(base + "/menus/admin/products/".concat(props.id), {
160
+ headers: {
161
+ 'Authorization': "".concat(props.token)
162
+ }
163
+ })
164
+ .then(function (response) { return response.data; });
165
+ })];
166
+ });
167
+ });
168
+ };
141
169
  return MenuAdminAPIs;
142
170
  }());
143
171
  export { MenuAdminAPIs };
@@ -0,0 +1,21 @@
1
+ export interface Category {
2
+ label: string;
3
+ id: string;
4
+ isPublic: boolean;
5
+ products: Product[];
6
+ }
7
+ export declare class Product {
8
+ id: string;
9
+ label: string;
10
+ description?: string;
11
+ picture: string;
12
+ variants: Variant[];
13
+ }
14
+ export declare function isAvailable(product: Product): boolean;
15
+ export interface Variant {
16
+ id: string;
17
+ label?: string;
18
+ isAvailable: boolean;
19
+ price: number;
20
+ discount?: number;
21
+ }
@@ -0,0 +1,10 @@
1
+ var Product = /** @class */ (function () {
2
+ function Product() {
3
+ }
4
+ return Product;
5
+ }());
6
+ export { Product };
7
+ export function isAvailable(product) {
8
+ return product.variants.map(function (variant) { return variant.isAvailable; })
9
+ .reduce(function (a, b) { return a || b; }, false);
10
+ }
@@ -0,0 +1,20 @@
1
+ export declare class Product {
2
+ id: string;
3
+ label: string;
4
+ category: Category;
5
+ description?: string;
6
+ picture: string;
7
+ variants: Variant[];
8
+ }
9
+ export interface Category {
10
+ id: string;
11
+ label: string;
12
+ isPublic: boolean;
13
+ }
14
+ export interface Variant {
15
+ id: string;
16
+ label?: string;
17
+ isAvailable: boolean;
18
+ price: number;
19
+ discount?: number;
20
+ }
@@ -0,0 +1,6 @@
1
+ var Product = /** @class */ (function () {
2
+ function Product() {
3
+ }
4
+ return Product;
5
+ }());
6
+ export { Product };
@@ -4,5 +4,9 @@ export * from "./user/types/post-order";
4
4
  export * from "./user/types/post-call-waiter-request";
5
5
  export { MenuGuestAPIs } from './user/guest-apis';
6
6
  export * from "./admin/types/get-calls-response";
7
+ import * as AdminMenuResponse from "./admin/types/get-menu-response";
8
+ export { AdminMenuResponse };
9
+ import * as AdminProductResponse from "./admin/types/get-product-response";
10
+ export { AdminProductResponse };
7
11
  export { MenuAdminAPIs } from './admin/admin-apis';
8
12
  export * from "./shared/types";
@@ -6,6 +6,12 @@ export * from "./user/types/post-call-waiter-request";
6
6
  export { MenuGuestAPIs } from './user/guest-apis';
7
7
  // admin module
8
8
  export * from "./admin/types/get-calls-response";
9
+ // export api of get calls
10
+ import * as AdminMenuResponse from "./admin/types/get-menu-response";
11
+ export { AdminMenuResponse };
12
+ // export api of get product
13
+ import * as AdminProductResponse from "./admin/types/get-product-response";
14
+ export { AdminProductResponse };
9
15
  export { MenuAdminAPIs } from './admin/admin-apis';
10
16
  // shared module
11
17
  export * from "./shared/types";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiminix/tp-client",
3
- "version": "2.9.4",
3
+ "version": "2.9.6",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [