@kiminix/tp-client 2.8.7 → 2.8.9

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,5 +1,6 @@
1
1
  import { Order } from "../shared/types";
2
2
  import { OrderStatus } from "../../enum";
3
+ import { CallWaiter, CallWaiterStatus } from "./types/get-calls-response";
3
4
  export declare class MenuAdminAPIs {
4
5
  static getOrders(props: {
5
6
  token?: string;
@@ -9,4 +10,12 @@ export declare class MenuAdminAPIs {
9
10
  size: number;
10
11
  sort: "asc" | "desc";
11
12
  }): Promise<Order[]>;
13
+ static getCalls(props: {
14
+ token?: string;
15
+ status: CallWaiterStatus[];
16
+ timestamp: number;
17
+ page: number;
18
+ size: number;
19
+ sort: "asc" | "desc";
20
+ }): Promise<CallWaiter[]>;
12
21
  }
@@ -64,6 +64,29 @@ var MenuAdminAPIs = /** @class */ (function () {
64
64
  });
65
65
  });
66
66
  };
67
+ MenuAdminAPIs.getCalls = function (props) {
68
+ return __awaiter(this, void 0, void 0, function () {
69
+ return __generator(this, function (_a) {
70
+ return [2 /*return*/, RequestUtils.send(function () {
71
+ var queryParams = [
72
+ "timestamp=".concat(props.timestamp),
73
+ "page=".concat(props.page),
74
+ "size=".concat(props.size),
75
+ "sort=".concat(props.sort),
76
+ props.status.map(function (value) { return "status=".concat(value); }).join('&')
77
+ ]
78
+ .filter(function (value) { return value; })
79
+ .join("&");
80
+ return axios.get(base + "/menus/admin/calls?".concat(queryParams), {
81
+ headers: {
82
+ 'Authorization': "".concat(props.token)
83
+ }
84
+ })
85
+ .then(function (response) { return response.data; });
86
+ })];
87
+ });
88
+ });
89
+ };
67
90
  return MenuAdminAPIs;
68
91
  }());
69
92
  export { MenuAdminAPIs };
@@ -0,0 +1,10 @@
1
+ export interface CallWaiter {
2
+ qrCodeLabel: string;
3
+ deviceId: string;
4
+ status: CallWaiterStatus;
5
+ createdAt: number;
6
+ }
7
+ export declare enum CallWaiterStatus {
8
+ Pending = "pending",
9
+ Completed = "completed"
10
+ }
@@ -0,0 +1,5 @@
1
+ export var CallWaiterStatus;
2
+ (function (CallWaiterStatus) {
3
+ CallWaiterStatus["Pending"] = "pending";
4
+ CallWaiterStatus["Completed"] = "completed";
5
+ })(CallWaiterStatus || (CallWaiterStatus = {}));
@@ -1,6 +1,8 @@
1
1
  export * from "./user/types/get-menu-response";
2
2
  export * from './user/types/get-qrcode-response';
3
3
  export * from "./user/types/post-order";
4
+ export * from "./user/types/post-call-waiter-request";
4
5
  export { MenuGuestAPIs } from './user/guest-apis';
6
+ export * from "./admin/types/get-calls-response";
5
7
  export { MenuAdminAPIs } from './admin/admin-apis';
6
8
  export * from "./shared/types";
@@ -2,8 +2,10 @@
2
2
  export * from "./user/types/get-menu-response";
3
3
  export * from './user/types/get-qrcode-response';
4
4
  export * from "./user/types/post-order";
5
+ export * from "./user/types/post-call-waiter-request";
5
6
  export { MenuGuestAPIs } from './user/guest-apis';
6
7
  // admin module
8
+ export * from "./admin/types/get-calls-response";
7
9
  export { MenuAdminAPIs } from './admin/admin-apis';
8
10
  // shared module
9
11
  export * from "./shared/types";
@@ -6,15 +6,16 @@ export interface Order {
6
6
  status: OrderStatus;
7
7
  price: number;
8
8
  createdAt: string;
9
- items: {
10
- categoryId: string;
11
- categoryLabel: string;
12
- productId: string;
13
- productLabel: string;
14
- variantId: string;
15
- variantLabel?: string;
16
- quantity: number;
17
- price: number;
18
- discount?: number;
19
- }[];
9
+ items: OrderItem[];
10
+ }
11
+ export interface OrderItem {
12
+ categoryId: string;
13
+ categoryLabel: string;
14
+ productId: string;
15
+ productLabel: string;
16
+ variantId: string;
17
+ variantLabel?: string;
18
+ quantity: number;
19
+ price: number;
20
+ discount?: number;
20
21
  }
@@ -2,6 +2,7 @@ import { OrderRequest, OrderResponse } from "./types/post-order";
2
2
  import { QrCode } from "./types/get-qrcode-response";
3
3
  import { Menu } from "./types/get-menu-response";
4
4
  import { Order } from "../shared/types";
5
+ import { callWaiter } from "./types/post-call-waiter-request";
5
6
  export declare class MenuGuestAPIs {
6
7
  static getOrders(businessId: string, deviceId: string, timestamp: number, page?: number, size?: number): Promise<Order[]>;
7
8
  /**
@@ -32,9 +33,9 @@ export declare class MenuGuestAPIs {
32
33
  }): Promise<Menu>;
33
34
  /**
34
35
  *
35
- * @param props
36
- * @throws qrcode_not_found, internal_error
36
+ * @param data
37
+ * @throws call_limit_exceeded, qrcode_not_found, internal_error
37
38
  * @returns
38
39
  */
39
- static callWaiter(qrcode: string): Promise<void>;
40
+ static callWaiter(data: callWaiter): Promise<void>;
40
41
  }
@@ -131,15 +131,15 @@ var MenuGuestAPIs = /** @class */ (function () {
131
131
  };
132
132
  /**
133
133
  *
134
- * @param props
135
- * @throws qrcode_not_found, internal_error
134
+ * @param data
135
+ * @throws call_limit_exceeded, qrcode_not_found, internal_error
136
136
  * @returns
137
137
  */
138
- MenuGuestAPIs.callWaiter = function (qrcode) {
138
+ MenuGuestAPIs.callWaiter = function (data) {
139
139
  return __awaiter(this, void 0, void 0, function () {
140
140
  return __generator(this, function (_a) {
141
141
  return [2 /*return*/, RequestUtils.send(function () {
142
- return axios.get(base + "/menus/guest/call-waiter/".concat(qrcode), {
142
+ return axios.post(base + "/menus/guest/call-waiter", data, {
143
143
  headers: {
144
144
  'Content-Type': 'application/json'
145
145
  }
@@ -0,0 +1,4 @@
1
+ export interface callWaiter {
2
+ deviceId: string;
3
+ qrCodeId: string;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -2,9 +2,9 @@ export interface OrderRequest {
2
2
  qrCodeId: string;
3
3
  deviceId: string;
4
4
  name?: string | undefined;
5
- items: OrderItem[];
5
+ items: OrderRequestItem[];
6
6
  }
7
- export interface OrderItem {
7
+ export interface OrderRequestItem {
8
8
  productId: string;
9
9
  variantId: string;
10
10
  quantity: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiminix/tp-client",
3
- "version": "2.8.7",
3
+ "version": "2.8.9",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [