washday-sdk 0.0.99 → 0.0.101

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/api/index.js CHANGED
@@ -28,6 +28,7 @@ import * as productsEndpoints from './products';
28
28
  import * as customersEndpoints from './customers';
29
29
  import * as csvExportEndpoints from './csv';
30
30
  import * as ordersEndpoints from './order';
31
+ import * as routesEndpoints from './routes';
31
32
  import * as reviewsEndpoints from './reviews';
32
33
  import * as cfdiEndpoints from './cfdi';
33
34
  import * as cashupsEndpoints from './cashups';
@@ -62,13 +63,21 @@ const WashdayClient = function WashdayClient(apiToken) {
62
63
  getList: reviewsEndpoints.getModule.getList,
63
64
  requestStoreReviewByCustomerId: reviewsEndpoints.getModule.requestStoreReviewByCustomerId,
64
65
  });
66
+ this.routes = bindMethods(this, {
67
+ getOrdersForRoute: routesEndpoints.getModule.getOrdersForRoute,
68
+ getStoreRoutesList: routesEndpoints.getModule.getStoreRoutesList,
69
+ createRoute: routesEndpoints.postModule.createRoute,
70
+ closeStoreRoutes: routesEndpoints.putModule.closeStoreRoutes,
71
+ });
65
72
  this.orders = bindMethods(this, {
66
73
  getList: ordersEndpoints.getModule.getList,
74
+ getOrdersHeaderSummary: ordersEndpoints.getModule.getOrdersHeaderSummary,
67
75
  getById: ordersEndpoints.getModule.getById,
68
76
  fetchOrdersForCFDI: ordersEndpoints.getModule.fetchOrdersForCFDI,
69
77
  updateById: ordersEndpoints.putModule.updateById,
70
78
  updatePaymentLineById: ordersEndpoints.putModule.updatePaymentLineById,
71
79
  setOrderCancelledBySequence: ordersEndpoints.putModule.setOrderCancelledBySequence,
80
+ setOrderCleaningBySequence: ordersEndpoints.putModule.setOrderCleaningBySequence,
72
81
  setOrderCleanedBySequence: ordersEndpoints.putModule.setOrderCleanedBySequence,
73
82
  setOrderCollectedBySequence: ordersEndpoints.putModule.setOrderCollectedBySequence,
74
83
  setOrdePickingBySequence: ordersEndpoints.putModule.setOrdePickingBySequence,
@@ -11,6 +11,7 @@ import { generateQueryParamsStr } from "../../utils/apiUtils";
11
11
  import axiosInstance from "../axiosInstance";
12
12
  const GET_SET_ORDER = 'api/v2/order';
13
13
  const GET_SET_ORDER_CFDI = 'api/v2/orders';
14
+ const GET_HEADER_SUMMARY = 'api/orderHeaderSummary';
14
15
  export const getList = function (params) {
15
16
  return __awaiter(this, void 0, void 0, function* () {
16
17
  try {
@@ -43,6 +44,24 @@ export const getList = function (params) {
43
44
  }
44
45
  });
45
46
  };
47
+ export const getOrdersHeaderSummary = function (params) {
48
+ return __awaiter(this, void 0, void 0, function* () {
49
+ try {
50
+ const config = {
51
+ headers: { Authorization: `Bearer ${this.apiToken}` }
52
+ };
53
+ const queryParams = generateQueryParamsStr([
54
+ 'store',
55
+ 'status',
56
+ ], params);
57
+ return yield axiosInstance.get(`${GET_HEADER_SUMMARY}?${queryParams}`, config);
58
+ }
59
+ catch (error) {
60
+ console.error('Error fetching getOrdersHeaderSummary :', error);
61
+ throw error;
62
+ }
63
+ });
64
+ };
46
65
  export const getById = function (id) {
47
66
  return __awaiter(this, void 0, void 0, function* () {
48
67
  try {
@@ -53,6 +53,20 @@ export const setOrderCancelledBySequence = function (sequence, storeId, data) {
53
53
  }
54
54
  });
55
55
  };
56
+ export const setOrderCleaningBySequence = function (sequence, storeId) {
57
+ return __awaiter(this, void 0, void 0, function* () {
58
+ try {
59
+ const config = {
60
+ headers: { Authorization: `Bearer ${this.apiToken}` }
61
+ };
62
+ return yield axiosInstance.put(`${GET_SET_ORDER_OLD}/${sequence}/${storeId}/cleaning`, {}, config);
63
+ }
64
+ catch (error) {
65
+ console.error('Error fetching setOrderCleaningBySequence:', error);
66
+ throw error;
67
+ }
68
+ });
69
+ };
56
70
  export const setOrderCleanedBySequence = function (sequence, storeId, data) {
57
71
  return __awaiter(this, void 0, void 0, function* () {
58
72
  try {
@@ -0,0 +1,45 @@
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
+ import { generateQueryParamsStr } from "../../utils/apiUtils";
11
+ import axiosInstance from "../axiosInstance";
12
+ const GET_SET_ROUTES_ORDERS = 'api/routes/orders';
13
+ const GET_STORE_ROUTES = 'api/storeRoutes';
14
+ export const getOrdersForRoute = function (params) {
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ try {
17
+ const config = {
18
+ headers: { Authorization: `Bearer ${this.apiToken}` }
19
+ };
20
+ const queryParams = generateQueryParamsStr([
21
+ 'store',
22
+ 'routeDate'
23
+ ], params);
24
+ return yield axiosInstance.get(`${GET_SET_ROUTES_ORDERS}?${queryParams}`, config);
25
+ }
26
+ catch (error) {
27
+ console.error('Error fetching getOrdersForRoute:', error);
28
+ throw error;
29
+ }
30
+ });
31
+ };
32
+ export const getStoreRoutesList = function (storeId) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ try {
35
+ const config = {
36
+ headers: { Authorization: `Bearer ${this.apiToken}` }
37
+ };
38
+ return yield axiosInstance.get(`${GET_STORE_ROUTES}/${storeId}`, config);
39
+ }
40
+ catch (error) {
41
+ console.error('Error fetching getStoreRoutesList:', error);
42
+ throw error;
43
+ }
44
+ });
45
+ };
@@ -0,0 +1,3 @@
1
+ export * as getModule from './get';
2
+ export * as postModule from './post';
3
+ export * as putModule from './put';
@@ -0,0 +1,25 @@
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
+ import axiosInstance from "../axiosInstance";
11
+ const GET_SET_ROUTES = 'api/routes';
12
+ export const createRoute = function (data) {
13
+ return __awaiter(this, void 0, void 0, function* () {
14
+ try {
15
+ const config = {
16
+ headers: { Authorization: `Bearer ${this.apiToken}` }
17
+ };
18
+ return yield axiosInstance.post(GET_SET_ROUTES, data, config);
19
+ }
20
+ catch (error) {
21
+ console.error('Error fetching createRoute:', error);
22
+ throw error;
23
+ }
24
+ });
25
+ };
@@ -0,0 +1,25 @@
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
+ import axiosInstance from "../axiosInstance";
11
+ const GET_STORE_ROUTES = 'api/storeRoutes';
12
+ export const closeStoreRoutes = function (storeId, data) {
13
+ return __awaiter(this, void 0, void 0, function* () {
14
+ try {
15
+ const config = {
16
+ headers: { Authorization: `Bearer ${this.apiToken}` }
17
+ };
18
+ return yield axiosInstance.put(`${GET_STORE_ROUTES}/${storeId}`, data, config);
19
+ }
20
+ catch (error) {
21
+ console.error('Error fetching closeStoreRoutes:', error);
22
+ throw error;
23
+ }
24
+ });
25
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.99",
3
+ "version": "0.0.101",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
package/src/api/index.ts CHANGED
@@ -29,6 +29,7 @@ import * as productsEndpoints from './products';
29
29
  import * as customersEndpoints from './customers';
30
30
  import * as csvExportEndpoints from './csv';
31
31
  import * as ordersEndpoints from './order';
32
+ import * as routesEndpoints from './routes';
32
33
  import * as reviewsEndpoints from './reviews';
33
34
  import * as cfdiEndpoints from './cfdi';
34
35
  import * as cashupsEndpoints from './cashups';
@@ -68,13 +69,21 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
68
69
  getList: reviewsEndpoints.getModule.getList,
69
70
  requestStoreReviewByCustomerId: reviewsEndpoints.getModule.requestStoreReviewByCustomerId,
70
71
  });
72
+ this.routes = bindMethods(this, {
73
+ getOrdersForRoute: routesEndpoints.getModule.getOrdersForRoute,
74
+ getStoreRoutesList: routesEndpoints.getModule.getStoreRoutesList,
75
+ createRoute: routesEndpoints.postModule.createRoute,
76
+ closeStoreRoutes: routesEndpoints.putModule.closeStoreRoutes,
77
+ });
71
78
  this.orders = bindMethods(this, {
72
79
  getList: ordersEndpoints.getModule.getList,
80
+ getOrdersHeaderSummary: ordersEndpoints.getModule.getOrdersHeaderSummary,
73
81
  getById: ordersEndpoints.getModule.getById,
74
82
  fetchOrdersForCFDI: ordersEndpoints.getModule.fetchOrdersForCFDI,
75
83
  updateById: ordersEndpoints.putModule.updateById,
76
84
  updatePaymentLineById: ordersEndpoints.putModule.updatePaymentLineById,
77
85
  setOrderCancelledBySequence: ordersEndpoints.putModule.setOrderCancelledBySequence,
86
+ setOrderCleaningBySequence: ordersEndpoints.putModule.setOrderCleaningBySequence,
78
87
  setOrderCleanedBySequence: ordersEndpoints.putModule.setOrderCleanedBySequence,
79
88
  setOrderCollectedBySequence: ordersEndpoints.putModule.setOrderCollectedBySequence,
80
89
  setOrdePickingBySequence: ordersEndpoints.putModule.setOrdePickingBySequence,
@@ -4,6 +4,7 @@ import { generateQueryParamsStr } from "../../utils/apiUtils";
4
4
  import axiosInstance from "../axiosInstance";
5
5
  const GET_SET_ORDER = 'api/v2/order';
6
6
  const GET_SET_ORDER_CFDI = 'api/v2/orders';
7
+ const GET_HEADER_SUMMARY = 'api/orderHeaderSummary';
7
8
 
8
9
  export const getList = async function (this: WashdayClientInstance, params: {
9
10
  store: string | undefined,
@@ -52,6 +53,26 @@ export const getList = async function (this: WashdayClientInstance, params: {
52
53
  }
53
54
  };
54
55
 
56
+ export const getOrdersHeaderSummary = async function (this: WashdayClientInstance, params: {
57
+ store?: string,
58
+ status?: string,
59
+ }): Promise<any> {
60
+ try {
61
+ const config = {
62
+ headers: { Authorization: `Bearer ${this.apiToken}` }
63
+ };
64
+ const queryParams = generateQueryParamsStr([
65
+ 'store',
66
+ 'status',
67
+ ], params);
68
+
69
+ return await axiosInstance.get(`${GET_HEADER_SUMMARY}?${queryParams}`, config);
70
+ } catch (error) {
71
+ console.error('Error fetching getOrdersHeaderSummary :', error);
72
+ throw error;
73
+ }
74
+ };
75
+
55
76
  export const getById = async function (this: WashdayClientInstance, id: string): Promise<IOrder> {
56
77
  try {
57
78
  const config = {
@@ -67,6 +67,18 @@ export const setOrderCancelledBySequence = async function (this: WashdayClientIn
67
67
  }
68
68
  };
69
69
 
70
+ export const setOrderCleaningBySequence = async function (this: WashdayClientInstance, sequence: string, storeId: string): Promise<any> {
71
+ try {
72
+ const config = {
73
+ headers: { Authorization: `Bearer ${this.apiToken}` }
74
+ };
75
+ return await axiosInstance.put(`${GET_SET_ORDER_OLD}/${sequence}/${storeId}/cleaning`, {}, config);
76
+ } catch (error) {
77
+ console.error('Error fetching setOrderCleaningBySequence:', error);
78
+ throw error;
79
+ }
80
+ };
81
+
70
82
  export const setOrderCleanedBySequence = async function (this: WashdayClientInstance, sequence: string, storeId: string, data: {
71
83
  cleanedDateTime: string,
72
84
  readyDateTime: string
@@ -0,0 +1,37 @@
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import { IOrder } from "../../interfaces/Order";
3
+ import { generateQueryParamsStr } from "../../utils/apiUtils";
4
+ import axiosInstance from "../axiosInstance";
5
+ const GET_SET_ROUTES_ORDERS = 'api/routes/orders';
6
+ const GET_STORE_ROUTES = 'api/storeRoutes';
7
+
8
+ export const getOrdersForRoute = async function (this: WashdayClientInstance, params: {
9
+ store: string | undefined,
10
+ routeDate: string | undefined,
11
+ }): Promise<any> {
12
+ try {
13
+ const config = {
14
+ headers: { Authorization: `Bearer ${this.apiToken}` }
15
+ };
16
+ const queryParams = generateQueryParamsStr([
17
+ 'store',
18
+ 'routeDate'
19
+ ], params);
20
+ return await axiosInstance.get(`${GET_SET_ROUTES_ORDERS}?${queryParams}`, config);
21
+ } catch (error) {
22
+ console.error('Error fetching getOrdersForRoute:', error);
23
+ throw error;
24
+ }
25
+ };
26
+
27
+ export const getStoreRoutesList = async function (this: WashdayClientInstance, storeId: string): Promise<any> {
28
+ try {
29
+ const config = {
30
+ headers: { Authorization: `Bearer ${this.apiToken}` }
31
+ };
32
+ return await axiosInstance.get(`${GET_STORE_ROUTES}/${storeId}`, config);
33
+ } catch (error) {
34
+ console.error('Error fetching getStoreRoutesList:', error);
35
+ throw error;
36
+ }
37
+ };
@@ -0,0 +1,3 @@
1
+ export * as getModule from './get';
2
+ export * as postModule from './post';
3
+ export * as putModule from './put';
@@ -0,0 +1,27 @@
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import axiosInstance from "../axiosInstance";
3
+ const GET_SET_ROUTES = 'api/routes';
4
+
5
+ export const createRoute = async function (this: WashdayClientInstance, data: {
6
+ driver: string;
7
+ store: string;
8
+ orders: {
9
+ _id: string,
10
+ nextStatus: string,
11
+ deliveringDateTime?: Date,
12
+ pickingUpDateTime?: Date,
13
+ collectedDateTime?: Date
14
+ }[];
15
+ createdDate: string;
16
+ isActive: boolean
17
+ }): Promise<any> {
18
+ try {
19
+ const config = {
20
+ headers: { Authorization: `Bearer ${this.apiToken}` }
21
+ };
22
+ return await axiosInstance.post(GET_SET_ROUTES, data, config);
23
+ } catch (error) {
24
+ console.error('Error fetching createRoute:', error);
25
+ throw error;
26
+ }
27
+ };
@@ -0,0 +1,17 @@
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import axiosInstance from "../axiosInstance";
3
+ const GET_STORE_ROUTES = 'api/storeRoutes';
4
+
5
+ export const closeStoreRoutes = async function (this: WashdayClientInstance, storeId: string, data: {
6
+ routes: string[],
7
+ }): Promise<any> {
8
+ try {
9
+ const config = {
10
+ headers: { Authorization: `Bearer ${this.apiToken}` }
11
+ };
12
+ return await axiosInstance.put(`${GET_STORE_ROUTES}/${storeId}`, data, config);
13
+ } catch (error) {
14
+ console.error('Error fetching closeStoreRoutes:', error);
15
+ throw error;
16
+ }
17
+ };
@@ -28,6 +28,7 @@ import * as productsEndpoints from '../api/products';
28
28
  import * as customersEndpoints from '../api/customers';
29
29
  import * as csvExportEndpoints from '../api/csv';
30
30
  import * as ordersEndpoints from '../api/order';
31
+ import * as routesEndpoints from '../api/routes';
31
32
  import * as reviewsEndpoints from '../api/reviews';
32
33
  import * as cfdiEndpoints from '../api/cfdi';
33
34
  import * as cashupsEndpoints from '../api/cashups';
@@ -54,13 +55,22 @@ export interface WashdayClientInstance {
54
55
  getList: typeof reviewsEndpoints.getModule.getList;
55
56
  requestStoreReviewByCustomerId: typeof reviewsEndpoints.getModule.requestStoreReviewByCustomerId;
56
57
  }
58
+ routes: {
59
+
60
+ getOrdersForRoute: typeof routesEndpoints.getModule.getOrdersForRoute,
61
+ getStoreRoutesList: typeof routesEndpoints.getModule.getStoreRoutesList,
62
+ createRoute: typeof routesEndpoints.postModule.createRoute,
63
+ closeStoreRoutes: typeof routesEndpoints.putModule.closeStoreRoutes,
64
+ },
57
65
  orders: {
58
66
  getList: typeof ordersEndpoints.getModule.getList;
67
+ getOrdersHeaderSummary: typeof ordersEndpoints.getModule.getOrdersHeaderSummary;
59
68
  getById: typeof ordersEndpoints.getModule.getById;
60
69
  fetchOrdersForCFDI: typeof ordersEndpoints.getModule.fetchOrdersForCFDI;
61
70
  updateById: typeof ordersEndpoints.putModule.updateById;
62
71
  updatePaymentLineById: typeof ordersEndpoints.putModule.updatePaymentLineById;
63
72
  setOrderCancelledBySequence: typeof ordersEndpoints.putModule.setOrderCancelledBySequence,
73
+ setOrderCleaningBySequence: typeof ordersEndpoints.putModule.setOrderCleaningBySequence,
64
74
  setOrderCleanedBySequence: typeof ordersEndpoints.putModule.setOrderCleanedBySequence,
65
75
  setOrderCollectedBySequence: typeof ordersEndpoints.putModule.setOrderCollectedBySequence,
66
76
  setOrdePickingBySequence: typeof ordersEndpoints.putModule.setOrdePickingBySequence,