washday-sdk 1.6.0 → 1.6.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.
@@ -8,9 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  const GET_SET_COMPANIES = 'api/company';
11
- const REQUEST_PARAMS = {
12
- token: 'LOGGED_USER_TOKEN',
13
- };
14
11
  export const getCompanyById = function (companyId) {
15
12
  return __awaiter(this, void 0, void 0, function* () {
16
13
  try {
@@ -26,3 +23,18 @@ export const getCompanyById = function (companyId) {
26
23
  }
27
24
  });
28
25
  };
26
+ export const getCompanyOrdersMetrics = function () {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ try {
29
+ const config = {
30
+ headers: { Authorization: `Bearer ${this.apiToken}` }
31
+ };
32
+ const response = yield this.axiosInstance.get(`${GET_SET_COMPANIES}/metrics/orders`, config);
33
+ return response;
34
+ }
35
+ catch (error) {
36
+ console.error('Error fetching getCompanyOrdersMetrics:', error);
37
+ throw error;
38
+ }
39
+ });
40
+ };
package/dist/api/index.js CHANGED
@@ -2,7 +2,7 @@ import { deleteCashierBoxById, deleteCashierBoxMovementById } from "./cashierbox
2
2
  import { getCashierBoxMovementsHistory, getCashierboxesById, getCashierboxesByStoreId } from "./cashierbox/get";
3
3
  import { addCashierBoxMovement, createCashierBox } from "./cashierbox/post";
4
4
  import { updateCashierBoxById, updateCashierBoxMovementById } from "./cashierbox/put";
5
- import { getCompanyById } from "./companies/get";
5
+ import { getCompanyById, getCompanyOrdersMetrics } from "./companies/get";
6
6
  import { disableBillingOverage, enableBillingOverage, updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "./companies/post";
7
7
  import { updateCompanyById, updateCompanyLogoById, updateCompanyTaxInfoById } from "./companies/put";
8
8
  import { getCountries } from "./countries/get";
@@ -231,6 +231,7 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
231
231
  });
232
232
  this.companies = bindMethods(this, {
233
233
  getCompanyById: getCompanyById,
234
+ getCompanyOrdersMetrics: getCompanyOrdersMetrics,
234
235
  updateCompanyById: updateCompanyById,
235
236
  updateCompanyLogoById: updateCompanyLogoById,
236
237
  updateCompanyTaxInfoById: updateCompanyTaxInfoById,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -1,13 +1,6 @@
1
1
  import { WashdayClientInstance } from "../../interfaces/Api";
2
- import { ICustomer } from "../../interfaces/Customer";
3
- import { IOrderInfo } from "../../interfaces/Order";
4
- import axiosInstance from "../axiosInstance";
5
2
 
6
3
  const GET_SET_COMPANIES = 'api/company';
7
- const REQUEST_PARAMS = {
8
- token: 'LOGGED_USER_TOKEN',
9
- };
10
-
11
4
 
12
5
  export const getCompanyById = async function (this: WashdayClientInstance, companyId: string): Promise<any> {
13
6
  try {
@@ -21,3 +14,16 @@ export const getCompanyById = async function (this: WashdayClientInstance, compa
21
14
  throw error;
22
15
  }
23
16
  };
17
+
18
+ export const getCompanyOrdersMetrics = async function (this: WashdayClientInstance): Promise<any> {
19
+ try {
20
+ const config = {
21
+ headers: { Authorization: `Bearer ${this.apiToken}` }
22
+ };
23
+ const response = await this.axiosInstance.get(`${GET_SET_COMPANIES}/metrics/orders`, config);
24
+ return response;
25
+ } catch (error) {
26
+ console.error('Error fetching getCompanyOrdersMetrics:', error);
27
+ throw error;
28
+ }
29
+ };
package/src/api/index.ts CHANGED
@@ -3,7 +3,7 @@ import { deleteCashierBoxById, deleteCashierBoxMovementById } from "./cashierbox
3
3
  import { getCashierBoxMovementsHistory, getCashierboxesById, getCashierboxesByStoreId } from "./cashierbox/get";
4
4
  import { addCashierBoxMovement, createCashierBox } from "./cashierbox/post";
5
5
  import { updateCashierBoxById, updateCashierBoxMovementById } from "./cashierbox/put";
6
- import { getCompanyById } from "./companies/get";
6
+ import { getCompanyById, getCompanyOrdersMetrics } from "./companies/get";
7
7
  import { disableBillingOverage, enableBillingOverage, updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "./companies/post";
8
8
  import { updateCompanyById, updateCompanyLogoById, updateCompanyTaxInfoById } from "./companies/put";
9
9
  import { getCountries } from "./countries/get";
@@ -238,6 +238,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
238
238
  });
239
239
  this.companies = bindMethods(this, {
240
240
  getCompanyById: getCompanyById,
241
+ getCompanyOrdersMetrics: getCompanyOrdersMetrics,
241
242
  updateCompanyById: updateCompanyById,
242
243
  updateCompanyLogoById: updateCompanyLogoById,
243
244
  updateCompanyTaxInfoById: updateCompanyTaxInfoById,
@@ -2,7 +2,7 @@ import { deleteCashierBoxById, deleteCashierBoxMovementById } from "../api/cashi
2
2
  import { getCashierBoxMovementsHistory, getCashierboxesById, getCashierboxesByStoreId } from "../api/cashierbox/get";
3
3
  import { addCashierBoxMovement, createCashierBox } from "../api/cashierbox/post";
4
4
  import { updateCashierBoxById, updateCashierBoxMovementById } from "../api/cashierbox/put";
5
- import { getCompanyById } from "../api/companies/get";
5
+ import { getCompanyById, getCompanyOrdersMetrics } from "../api/companies/get";
6
6
  import { disableBillingOverage, enableBillingOverage, updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "../api/companies/post";
7
7
  import { updateCompanyById, updateCompanyLogoById, updateCompanyTaxInfoById } from "../api/companies/put";
8
8
  import { getCountries } from "../api/countries/get";
@@ -223,6 +223,7 @@ export interface WashdayClientInstance {
223
223
  };
224
224
  companies: {
225
225
  getCompanyById: typeof getCompanyById;
226
+ getCompanyOrdersMetrics: typeof getCompanyOrdersMetrics;
226
227
  updateCompanyById: typeof updateCompanyById;
227
228
  updateCompanyLogoById: typeof updateCompanyLogoById;
228
229
  updateCompanyTaxInfoById: typeof updateCompanyTaxInfoById;