@kiminix/tp-client 2.8.3 → 2.8.5

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/enum.d.ts CHANGED
@@ -44,3 +44,9 @@ export declare enum VoucherStatus {
44
44
  Succeeded = "succeeded",
45
45
  Failed = "failed"
46
46
  }
47
+ export declare enum OrderStatus {
48
+ Pending = "pending",
49
+ InProgress = "in_progress",
50
+ Completed = "completed",
51
+ Canceled = "canceled"
52
+ }
package/dist/enum.js CHANGED
@@ -52,3 +52,10 @@ export var VoucherStatus;
52
52
  VoucherStatus["Succeeded"] = "succeeded";
53
53
  VoucherStatus["Failed"] = "failed";
54
54
  })(VoucherStatus || (VoucherStatus = {}));
55
+ export var OrderStatus;
56
+ (function (OrderStatus) {
57
+ OrderStatus["Pending"] = "pending";
58
+ OrderStatus["InProgress"] = "in_progress";
59
+ OrderStatus["Completed"] = "completed";
60
+ OrderStatus["Canceled"] = "canceled";
61
+ })(OrderStatus || (OrderStatus = {}));
@@ -1,4 +1,5 @@
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/get-orders";
4
5
  export { MenuGuestAPIs } from './user/guest-apis';
@@ -2,6 +2,7 @@
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/get-orders";
5
6
  export { MenuGuestAPIs } from './user/guest-apis';
6
7
  // admin module
7
8
  // shared module
@@ -1,7 +1,9 @@
1
1
  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
+ import { Order } from "./types/get-orders";
4
5
  export declare class MenuGuestAPIs {
6
+ static getOrders(businessId: string, deviceId: string, timestamp: number, page?: number, size?: number): Promise<Order[]>;
5
7
  /**
6
8
  *
7
9
  * @param props
@@ -28,4 +30,11 @@ export declare class MenuGuestAPIs {
28
30
  static getMenu(props: {
29
31
  id: string;
30
32
  }): Promise<Menu>;
33
+ /**
34
+ *
35
+ * @param props
36
+ * @throws qrcode_not_found, internal_error
37
+ * @returns
38
+ */
39
+ static callWaiter(qrcode: string): Promise<void>;
31
40
  }
@@ -41,6 +41,29 @@ import { RequestUtils } from "../../utils/request-utils";
41
41
  var MenuGuestAPIs = /** @class */ (function () {
42
42
  function MenuGuestAPIs() {
43
43
  }
44
+ MenuGuestAPIs.getOrders = function (businessId, deviceId, timestamp, page, size) {
45
+ if (page === void 0) { page = 1; }
46
+ if (size === void 0) { size = 12; }
47
+ return __awaiter(this, void 0, void 0, function () {
48
+ return __generator(this, function (_a) {
49
+ return [2 /*return*/, RequestUtils.send(function () {
50
+ var queryParams = [
51
+ "timestamp=".concat(timestamp),
52
+ "page=".concat(page),
53
+ "size=".concat(size),
54
+ "business_id=".concat(businessId),
55
+ "device_id=".concat(deviceId),
56
+ ]
57
+ .filter(function (value) { return value; })
58
+ .join("&");
59
+ return axios.get(base + "/menus/guest/orders?".concat(queryParams), {
60
+ headers: {}
61
+ })
62
+ .then(function (response) { return response.data; });
63
+ })];
64
+ });
65
+ });
66
+ };
44
67
  /**
45
68
  *
46
69
  * @param props
@@ -106,6 +129,26 @@ var MenuGuestAPIs = /** @class */ (function () {
106
129
  });
107
130
  });
108
131
  };
132
+ /**
133
+ *
134
+ * @param props
135
+ * @throws qrcode_not_found, internal_error
136
+ * @returns
137
+ */
138
+ MenuGuestAPIs.callWaiter = function (qrcode) {
139
+ return __awaiter(this, void 0, void 0, function () {
140
+ return __generator(this, function (_a) {
141
+ return [2 /*return*/, RequestUtils.send(function () {
142
+ return axios.get(base + "/menus/guest/call-waiter/".concat(qrcode), {
143
+ headers: {
144
+ 'Content-Type': 'application/json'
145
+ }
146
+ })
147
+ .then(function (_) { return undefined; });
148
+ })];
149
+ });
150
+ });
151
+ };
109
152
  return MenuGuestAPIs;
110
153
  }());
111
154
  export { MenuGuestAPIs };
@@ -0,0 +1,17 @@
1
+ import { OrderStatus } from "../../../enum";
2
+ export interface Order {
3
+ qrCodeLabel: string;
4
+ deviceId: string;
5
+ status: OrderStatus;
6
+ price: number;
7
+ createdAt: string;
8
+ items: {
9
+ productId: string;
10
+ productLabel: string;
11
+ variantId: string;
12
+ variantLabel?: string;
13
+ quantity: number;
14
+ price: number;
15
+ discount?: number;
16
+ }[];
17
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiminix/tp-client",
3
- "version": "2.8.3",
3
+ "version": "2.8.5",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [