@kiminix/tp-client 2.8.4 → 2.8.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.
@@ -0,0 +1,12 @@
1
+ import { Order } from "../shared/types";
2
+ import { OrderStatus } from "../../enum";
3
+ export declare class MenuAdminAPIs {
4
+ static getOrders(props: {
5
+ token?: string;
6
+ status: OrderStatus[];
7
+ timestamp: number;
8
+ page: number;
9
+ size: number;
10
+ sort: "asc" | "desc";
11
+ }): Promise<Order[]>;
12
+ }
@@ -0,0 +1,69 @@
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
+ // Admin APIS
41
+ var MenuAdminAPIs = /** @class */ (function () {
42
+ function MenuAdminAPIs() {
43
+ }
44
+ MenuAdminAPIs.getOrders = function (props) {
45
+ return __awaiter(this, void 0, void 0, function () {
46
+ return __generator(this, function (_a) {
47
+ return [2 /*return*/, RequestUtils.send(function () {
48
+ var queryParams = [
49
+ "timestamp=".concat(props.timestamp),
50
+ "page=".concat(props.page),
51
+ "size=".concat(props.size),
52
+ "sort=".concat(props.sort),
53
+ props.status.map(function (value) { return "status=".concat(value); }).join('&')
54
+ ]
55
+ .filter(function (value) { return value; })
56
+ .join("&");
57
+ return axios.get(base + "/menus/admin/orders?".concat(queryParams), {
58
+ headers: {
59
+ 'Authorization': "".concat(props.token)
60
+ }
61
+ })
62
+ .then(function (response) { return response.data; });
63
+ })];
64
+ });
65
+ });
66
+ };
67
+ return MenuAdminAPIs;
68
+ }());
69
+ export { MenuAdminAPIs };
@@ -1,5 +1,6 @@
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";
5
4
  export { MenuGuestAPIs } from './user/guest-apis';
5
+ export { MenuAdminAPIs } from './admin/admin-apis';
6
+ export * from "./shared/types";
@@ -2,7 +2,8 @@
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";
6
5
  export { MenuGuestAPIs } from './user/guest-apis';
7
6
  // admin module
7
+ export { MenuAdminAPIs } from './admin/admin-apis';
8
8
  // shared module
9
+ export * from "./shared/types";
@@ -1,5 +1,6 @@
1
- import { OrderStatus } from "../../../enum";
1
+ import { OrderStatus } from "../../enum";
2
2
  export interface Order {
3
+ id: string;
3
4
  qrCodeLabel: string;
4
5
  deviceId: string;
5
6
  status: OrderStatus;
@@ -1,7 +1,7 @@
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
+ import { Order } from "../shared/types";
5
5
  export declare class MenuGuestAPIs {
6
6
  static getOrders(businessId: string, deviceId: string, timestamp: number, page?: number, size?: number): Promise<Order[]>;
7
7
  /**
@@ -30,4 +30,11 @@ export declare class MenuGuestAPIs {
30
30
  static getMenu(props: {
31
31
  id: string;
32
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>;
33
40
  }
@@ -129,6 +129,26 @@ var MenuGuestAPIs = /** @class */ (function () {
129
129
  });
130
130
  });
131
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
+ };
132
152
  return MenuGuestAPIs;
133
153
  }());
134
154
  export { MenuGuestAPIs };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiminix/tp-client",
3
- "version": "2.8.4",
3
+ "version": "2.8.6",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [