washday-sdk 0.0.100 → 0.0.102
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 +8 -0
- package/dist/api/order/get.js +1 -1
- package/dist/api/order/put.js +14 -0
- package/dist/api/routes/get.js +45 -0
- package/dist/api/routes/index.js +3 -0
- package/dist/api/routes/post.js +25 -0
- package/dist/api/routes/put.js +25 -0
- package/package.json +1 -1
- package/src/api/index.ts +8 -0
- package/src/api/order/get.ts +1 -1
- package/src/api/order/put.ts +12 -0
- package/src/api/routes/get.ts +37 -0
- package/src/api/routes/index.ts +3 -0
- package/src/api/routes/post.ts +27 -0
- package/src/api/routes/put.ts +17 -0
- package/src/interfaces/Api.ts +9 -0
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,6 +63,12 @@ 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,
|
|
67
74
|
getOrdersHeaderSummary: ordersEndpoints.getModule.getOrdersHeaderSummary,
|
|
@@ -70,6 +77,7 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
70
77
|
updateById: ordersEndpoints.putModule.updateById,
|
|
71
78
|
updatePaymentLineById: ordersEndpoints.putModule.updatePaymentLineById,
|
|
72
79
|
setOrderCancelledBySequence: ordersEndpoints.putModule.setOrderCancelledBySequence,
|
|
80
|
+
setOrderCleaningBySequence: ordersEndpoints.putModule.setOrderCleaningBySequence,
|
|
73
81
|
setOrderCleanedBySequence: ordersEndpoints.putModule.setOrderCleanedBySequence,
|
|
74
82
|
setOrderCollectedBySequence: ordersEndpoints.putModule.setOrderCollectedBySequence,
|
|
75
83
|
setOrdePickingBySequence: ordersEndpoints.putModule.setOrdePickingBySequence,
|
package/dist/api/order/get.js
CHANGED
|
@@ -35,7 +35,7 @@ export const getList = function (params) {
|
|
|
35
35
|
'readyDateTime',
|
|
36
36
|
'collectedDateTime',
|
|
37
37
|
'q',
|
|
38
|
-
], params);
|
|
38
|
+
], Object.assign(Object.assign({}, params), { q: params.q ? encodeURIComponent(params.q) : undefined }));
|
|
39
39
|
return yield axiosInstance.get(`${GET_SET_ORDER}?${queryParams}`, config);
|
|
40
40
|
}
|
|
41
41
|
catch (error) {
|
package/dist/api/order/put.js
CHANGED
|
@@ -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,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}/close`, data, config);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
console.error('Error fetching closeStoreRoutes:', error);
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
};
|
package/package.json
CHANGED
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,6 +69,12 @@ 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,
|
|
73
80
|
getOrdersHeaderSummary: ordersEndpoints.getModule.getOrdersHeaderSummary,
|
|
@@ -76,6 +83,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
76
83
|
updateById: ordersEndpoints.putModule.updateById,
|
|
77
84
|
updatePaymentLineById: ordersEndpoints.putModule.updatePaymentLineById,
|
|
78
85
|
setOrderCancelledBySequence: ordersEndpoints.putModule.setOrderCancelledBySequence,
|
|
86
|
+
setOrderCleaningBySequence: ordersEndpoints.putModule.setOrderCleaningBySequence,
|
|
79
87
|
setOrderCleanedBySequence: ordersEndpoints.putModule.setOrderCleanedBySequence,
|
|
80
88
|
setOrderCollectedBySequence: ordersEndpoints.putModule.setOrderCollectedBySequence,
|
|
81
89
|
setOrdePickingBySequence: ordersEndpoints.putModule.setOrdePickingBySequence,
|
package/src/api/order/get.ts
CHANGED
|
@@ -45,7 +45,7 @@ export const getList = async function (this: WashdayClientInstance, params: {
|
|
|
45
45
|
'readyDateTime',
|
|
46
46
|
'collectedDateTime',
|
|
47
47
|
'q',
|
|
48
|
-
], params);
|
|
48
|
+
], { ...params, q: params.q ? encodeURIComponent(params.q) : undefined });
|
|
49
49
|
return await axiosInstance.get(`${GET_SET_ORDER}?${queryParams}`, config);
|
|
50
50
|
} catch (error) {
|
|
51
51
|
console.error('Error fetching getList orders:', error);
|
package/src/api/order/put.ts
CHANGED
|
@@ -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,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?: string,
|
|
12
|
+
pickingUpDateTime?: string,
|
|
13
|
+
collectedDateTime?: string
|
|
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}/close`, data, config);
|
|
13
|
+
} catch (error) {
|
|
14
|
+
console.error('Error fetching closeStoreRoutes:', error);
|
|
15
|
+
throw error;
|
|
16
|
+
}
|
|
17
|
+
};
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -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,6 +55,13 @@ 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;
|
|
59
67
|
getOrdersHeaderSummary: typeof ordersEndpoints.getModule.getOrdersHeaderSummary;
|
|
@@ -62,6 +70,7 @@ export interface WashdayClientInstance {
|
|
|
62
70
|
updateById: typeof ordersEndpoints.putModule.updateById;
|
|
63
71
|
updatePaymentLineById: typeof ordersEndpoints.putModule.updatePaymentLineById;
|
|
64
72
|
setOrderCancelledBySequence: typeof ordersEndpoints.putModule.setOrderCancelledBySequence,
|
|
73
|
+
setOrderCleaningBySequence: typeof ordersEndpoints.putModule.setOrderCleaningBySequence,
|
|
65
74
|
setOrderCleanedBySequence: typeof ordersEndpoints.putModule.setOrderCleanedBySequence,
|
|
66
75
|
setOrderCollectedBySequence: typeof ordersEndpoints.putModule.setOrderCollectedBySequence,
|
|
67
76
|
setOrdePickingBySequence: typeof ordersEndpoints.putModule.setOrdePickingBySequence,
|