@kiminix/tp-client 2.11.1 → 2.11.2

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.
@@ -12,8 +12,6 @@ export declare namespace GetBillAdminAPI {
12
12
  number: number;
13
13
  discount?: number;
14
14
  total: number;
15
- ordersRef: string[];
16
- ordersCount: number;
17
15
  name?: string | undefined;
18
16
  createdAt: string;
19
17
  updatedAt?: string | undefined;
@@ -13,8 +13,6 @@ export declare namespace GetBillsAdminAPI {
13
13
  businessId: string;
14
14
  number: number;
15
15
  total: number;
16
- ordersRef: string[];
17
- ordersCount: number;
18
16
  name?: string | undefined;
19
17
  createdAt: string;
20
18
  updatedAt?: string | undefined;
@@ -0,0 +1,7 @@
1
+ import { Order } from "../../shared/types";
2
+ export declare class GetOrderAdminAPI {
3
+ static get(props: {
4
+ token?: string;
5
+ id: string;
6
+ }): Promise<Order>;
7
+ }
@@ -0,0 +1,59 @@
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 { RequestUtils } from "../../../utils/request-utils";
38
+ import { base } from "../../../constants";
39
+ import axios from "axios";
40
+ var GetOrderAdminAPI = /** @class */ (function () {
41
+ function GetOrderAdminAPI() {
42
+ }
43
+ GetOrderAdminAPI.get = function (props) {
44
+ return __awaiter(this, void 0, void 0, function () {
45
+ return __generator(this, function (_a) {
46
+ return [2 /*return*/, RequestUtils.send(function () {
47
+ return axios.get(base + "/menus/admin/orders/".concat(props.id), {
48
+ headers: {
49
+ 'Authorization': "".concat(props.token)
50
+ }
51
+ })
52
+ .then(function (response) { return response.data; });
53
+ })];
54
+ });
55
+ });
56
+ };
57
+ return GetOrderAdminAPI;
58
+ }());
59
+ export { GetOrderAdminAPI };
@@ -1,10 +1,15 @@
1
1
  import { OrderStatus } from "../../../enum";
2
- export declare class UpdateOrdersAdminAPI {
2
+ /**
3
+ * patch order fields
4
+ *
5
+ * @param token
6
+ * @param id
7
+ * @param status
8
+ */
9
+ export declare class PatchOrderAdminAPI {
3
10
  static update(props: {
4
11
  token?: string;
5
12
  id: string;
6
13
  status?: OrderStatus;
7
14
  }): Promise<undefined>;
8
15
  }
9
- export declare namespace UpdateOrdersAdminAPI {
10
- }
@@ -37,10 +37,17 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  import axios from "axios";
38
38
  import { base } from "../../../constants";
39
39
  import { RequestUtils } from "../../../utils/request-utils";
40
- var UpdateOrdersAdminAPI = /** @class */ (function () {
41
- function UpdateOrdersAdminAPI() {
40
+ /**
41
+ * patch order fields
42
+ *
43
+ * @param token
44
+ * @param id
45
+ * @param status
46
+ */
47
+ var PatchOrderAdminAPI = /** @class */ (function () {
48
+ function PatchOrderAdminAPI() {
42
49
  }
43
- UpdateOrdersAdminAPI.update = function (props) {
50
+ PatchOrderAdminAPI.update = function (props) {
44
51
  return __awaiter(this, void 0, void 0, function () {
45
52
  return __generator(this, function (_a) {
46
53
  return [2 /*return*/, RequestUtils.send(function () {
@@ -57,6 +64,6 @@ var UpdateOrdersAdminAPI = /** @class */ (function () {
57
64
  });
58
65
  });
59
66
  };
60
- return UpdateOrdersAdminAPI;
67
+ return PatchOrderAdminAPI;
61
68
  }());
62
- export { UpdateOrdersAdminAPI };
69
+ export { PatchOrderAdminAPI };
@@ -0,0 +1,25 @@
1
+ import { OrderStatus } from "../../../enum";
2
+ /**
3
+ * update order
4
+ * @error order_not_found, item_unavailable, item_not_found, variant_not_found, internal_error
5
+ * @param token
6
+ */
7
+ export declare class UpdateOrderAdminAPI {
8
+ static update(props: {
9
+ token?: string;
10
+ request: UpdateOrderAdminAPI.Request;
11
+ }): Promise<undefined>;
12
+ }
13
+ export declare namespace UpdateOrderAdminAPI {
14
+ interface Request {
15
+ id: string;
16
+ status: OrderStatus;
17
+ qrcodeId?: string | undefined;
18
+ items: OrderItem[];
19
+ }
20
+ interface OrderItem {
21
+ productId: string;
22
+ variantId: string;
23
+ quantity: number;
24
+ }
25
+ }
@@ -0,0 +1,64 @@
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
+ /**
41
+ * update order
42
+ * @error order_not_found, item_unavailable, item_not_found, variant_not_found, internal_error
43
+ * @param token
44
+ */
45
+ var UpdateOrderAdminAPI = /** @class */ (function () {
46
+ function UpdateOrderAdminAPI() {
47
+ }
48
+ UpdateOrderAdminAPI.update = function (props) {
49
+ return __awaiter(this, void 0, void 0, function () {
50
+ return __generator(this, function (_a) {
51
+ return [2 /*return*/, RequestUtils.send(function () {
52
+ return axios.put(base + "/menus/admin/orders", props.request, {
53
+ headers: {
54
+ 'Authorization': "".concat(props.token)
55
+ }
56
+ })
57
+ .then(function (_) { return undefined; });
58
+ })];
59
+ });
60
+ });
61
+ };
62
+ return UpdateOrderAdminAPI;
63
+ }());
64
+ export { UpdateOrderAdminAPI };
@@ -10,9 +10,11 @@ export * from "./admin/api/get-menu-api";
10
10
  export * from "./admin/api/get-product-api";
11
11
  export * from "./admin/api/update-product-api";
12
12
  export * from "./admin/api/create-orders-api";
13
- export * from "./admin/api/update-orders-api";
13
+ export * from "./admin/api/patch-order-api";
14
+ export * from "./admin/api/update-order-api";
14
15
  export * from "./admin/api/search-orders-api";
15
16
  export * from "./admin/api/get-qrcodes-api";
17
+ export * from "./admin/api/get-order-by-id-api";
16
18
  export * from "./admin/types/get-calls-response";
17
19
  export { MenuAdminAPIs } from './admin/admin-apis';
18
20
  export * from "./shared/types";
@@ -12,9 +12,11 @@ export * from "./admin/api/get-menu-api";
12
12
  export * from "./admin/api/get-product-api";
13
13
  export * from "./admin/api/update-product-api";
14
14
  export * from "./admin/api/create-orders-api";
15
- export * from "./admin/api/update-orders-api";
15
+ export * from "./admin/api/patch-order-api";
16
+ export * from "./admin/api/update-order-api";
16
17
  export * from "./admin/api/search-orders-api";
17
18
  export * from "./admin/api/get-qrcodes-api";
19
+ export * from "./admin/api/get-order-by-id-api";
18
20
  export * from "./admin/types/get-calls-response";
19
21
  export { MenuAdminAPIs } from './admin/admin-apis';
20
22
  // shared module
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiminix/tp-client",
3
- "version": "2.11.1",
3
+ "version": "2.11.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [