@chift/chift-nodejs 1.0.5 → 1.0.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.
@@ -65,12 +65,14 @@ class InternalAPI {
65
65
  }
66
66
  if (this.token) {
67
67
  if (((_a = this.token) === null || _a === void 0 ? void 0 : _a.expires_on) < new Date().getTime()) {
68
- return this.getToken().then(() => {
68
+ return this.getToken()
69
+ .then(() => {
69
70
  var _a;
70
71
  config.headers['Authorization'] =
71
72
  'Bearer ' + ((_a = this.token) === null || _a === void 0 ? void 0 : _a.access_token);
72
73
  return resolve(config);
73
- }).catch((err) => {
74
+ })
75
+ .catch((err) => {
74
76
  return reject(err);
75
77
  });
76
78
  }
@@ -80,11 +82,14 @@ class InternalAPI {
80
82
  }
81
83
  }
82
84
  else {
83
- return this.getToken().then(() => {
85
+ return this.getToken()
86
+ .then(() => {
84
87
  var _a;
85
- config.headers['Authorization'] = 'Bearer ' + ((_a = this.token) === null || _a === void 0 ? void 0 : _a.access_token);
88
+ config.headers['Authorization'] =
89
+ 'Bearer ' + ((_a = this.token) === null || _a === void 0 ? void 0 : _a.access_token);
86
90
  return resolve(config);
87
- }).catch((err) => {
91
+ })
92
+ .catch((err) => {
88
93
  return reject(err);
89
94
  });
90
95
  }
@@ -2,6 +2,8 @@ import { operations, components } from '../types/public-api/schema';
2
2
  import { RequestData } from '../types/api';
3
3
  type getPaymentsParams = Omit<operations['pos_get_payments']['parameters']['query'], 'page' | 'size'>;
4
4
  type getPaymentMethodsParams = Omit<operations['pos_get_payments_methods']['parameters']['query'], 'page' | 'size'>;
5
+ type getProductCategoriesParams = Omit<operations['pos_get_product_categories']['parameters']['query'], 'page' | 'size'>;
6
+ type getProductsParams = Omit<operations['pos_get_products']['parameters']['query'], 'page' | 'size'>;
5
7
  type getCustomersParams = Omit<operations['pos_get_customers']['parameters']['query'], 'page' | 'size'>;
6
8
  type getOrdersParams = Omit<operations['pos_get_orders']['parameters']['query'], 'page' | 'size'>;
7
9
  declare const posFactory: {
@@ -12,6 +14,8 @@ declare const posFactory: {
12
14
  getCustomer(customerId: string): RequestData<components['schemas']['POSCustomerItem']>;
13
15
  createCustomer(customer: components['schemas']['POSCreateCustomerItem']): RequestData<components['schemas']['POSCustomerItem']>;
14
16
  getPaymentMethods(params: getPaymentMethodsParams): RequestData<components['schemas']['PaymentMethods'][]>;
17
+ getProductCategories(params: getProductCategoriesParams): RequestData<components['schemas']['ProductCategoryItem'][]>;
18
+ getProducts(params: getProductsParams): RequestData<components['schemas']['POSProductItem'][]>;
15
19
  getSales(params: operations['pos_get_sales']['parameters']['query']): RequestData<components['schemas']['SalesItem']>;
16
20
  getClosure(date: string, params: operations['pos_get_closure']['parameters']['query']): RequestData<components['schemas']['ClosureItem']>;
17
21
  getPayments(params: getPaymentsParams): RequestData<components['schemas']['PaymentItem'][]>;
@@ -48,6 +48,20 @@ const posFactory = {
48
48
  url: `/consumers/{consumer_id}/pos/payment-methods`,
49
49
  };
50
50
  },
51
+ getProductCategories(params) {
52
+ return {
53
+ params,
54
+ method: 'get',
55
+ url: `/consumers/{consumer_id}/pos/product-categories`,
56
+ };
57
+ },
58
+ getProducts(params) {
59
+ return {
60
+ params,
61
+ method: 'get',
62
+ url: `/consumers/{consumer_id}/pos/products`,
63
+ };
64
+ },
51
65
  getSales(params) {
52
66
  return {
53
67
  params,