washday-sdk 1.6.40 → 1.6.42
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/csv/get.js +27 -0
- package/dist/api/index.js +4 -1
- package/dist/api/order/index.js +1 -0
- package/dist/api/order/patch.js +28 -0
- package/dist/api/reports/get.js +20 -0
- package/dist/enum/index.js +9 -0
- package/package.json +1 -1
- package/src/api/csv/get.ts +30 -0
- package/src/api/index.ts +4 -1
- package/src/api/order/index.ts +1 -0
- package/src/api/order/patch.ts +25 -0
- package/src/api/reports/get.ts +23 -0
- package/src/enum/index.ts +9 -0
- package/src/interfaces/Api.ts +3 -0
- package/src/interfaces/Order.ts +17 -0
- package/src/interfaces/Product.ts +15 -0
package/dist/api/csv/get.js
CHANGED
|
@@ -429,3 +429,30 @@ export const exportScheduledDeliveriesReport = function (companyId, params) {
|
|
|
429
429
|
}
|
|
430
430
|
});
|
|
431
431
|
};
|
|
432
|
+
export const exportServicesToDeliverReport = function (companyId, params) {
|
|
433
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
434
|
+
try {
|
|
435
|
+
const config = {
|
|
436
|
+
headers: {
|
|
437
|
+
Authorization: `Bearer ${this.apiToken}`,
|
|
438
|
+
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
439
|
+
'Content-disposition': 'attachment; filename=[file.xlsx]'
|
|
440
|
+
},
|
|
441
|
+
params: {
|
|
442
|
+
responseType: 'blob'
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
const queryParams = generateQueryParamsStr([
|
|
446
|
+
'storeId',
|
|
447
|
+
'dateFrom',
|
|
448
|
+
'dateTo',
|
|
449
|
+
'hideReady'
|
|
450
|
+
], params);
|
|
451
|
+
return yield this.axiosInstance.get(`${GET_SET_REPORTS}/${companyId}/servicesToDeliver/export/csv?${queryParams}`, config);
|
|
452
|
+
}
|
|
453
|
+
catch (error) {
|
|
454
|
+
console.error('Error fetching exportServicesToDeliverReport:', error);
|
|
455
|
+
throw error;
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
};
|
package/dist/api/index.js
CHANGED
|
@@ -151,7 +151,8 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
|
|
|
151
151
|
bulkCancel: ordersEndpoints.putModule.bulkCancel,
|
|
152
152
|
bulkClean: ordersEndpoints.putModule.bulkClean,
|
|
153
153
|
bulkCollect: ordersEndpoints.putModule.bulkCollect,
|
|
154
|
-
cancelOrderByIdCustomersApp: ordersEndpoints.deleteModule.cancelOrderByIdCustomersApp
|
|
154
|
+
cancelOrderByIdCustomersApp: ordersEndpoints.deleteModule.cancelOrderByIdCustomersApp,
|
|
155
|
+
updateLineStatuses: ordersEndpoints.patchModule.updateLineStatuses,
|
|
155
156
|
});
|
|
156
157
|
this.customers = bindMethods(this, {
|
|
157
158
|
getCustomers: customersEndpoints.getModule.getList,
|
|
@@ -307,6 +308,7 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
|
|
|
307
308
|
exportAttendanceReport: csvExportEndpoints.getModule.exportAttendanceReport,
|
|
308
309
|
exportCashUpReportsByDateRange: csvExportEndpoints.getModule.exportCashUpReportsByDateRange,
|
|
309
310
|
exportScheduledDeliveriesReport: csvExportEndpoints.getModule.exportScheduledDeliveriesReport,
|
|
311
|
+
exportServicesToDeliverReport: csvExportEndpoints.getModule.exportServicesToDeliverReport,
|
|
310
312
|
});
|
|
311
313
|
this.pdf = bindMethods(this, {
|
|
312
314
|
exportUnpaidOrdersReportPDF: pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF,
|
|
@@ -326,6 +328,7 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
|
|
|
326
328
|
getCashierBoxMovementsReport: reportsExportEndpoints.getModule.getCashierBoxMovementsReport,
|
|
327
329
|
getUnpaidOrdersReport: reportsExportEndpoints.getModule.getUnpaidOrdersReport,
|
|
328
330
|
getScheduledDeliveries: reportsExportEndpoints.getModule.getScheduledDeliveries,
|
|
331
|
+
getServicesToDeliver: reportsExportEndpoints.getModule.getServicesToDeliver,
|
|
329
332
|
getAnnualSalesStatistics: reportsExportEndpoints.getModule.getAnnualSalesStatistics,
|
|
330
333
|
getPaymentMethodStatistics: reportsExportEndpoints.getModule.getPaymentMethodStatistics,
|
|
331
334
|
getProductsStatistics: reportsExportEndpoints.getModule.getProductsStatistics,
|
package/dist/api/order/index.js
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
const ORDER_LINE_STATUSES = (orderId) => `/api/v2/order/${orderId}/line-statuses`;
|
|
11
|
+
/**
|
|
12
|
+
* Batch update of line-level statuses for a single order.
|
|
13
|
+
*
|
|
14
|
+
* - Validates all transitions server-side before applying any.
|
|
15
|
+
* - Does NOT modify the order's own status.
|
|
16
|
+
* - Returns the full updated order.
|
|
17
|
+
*
|
|
18
|
+
* Actor: Staff / POS (requires valid auth token)
|
|
19
|
+
* Endpoint: PATCH /api/v2/order/:id/line-statuses
|
|
20
|
+
*/
|
|
21
|
+
export const updateLineStatuses = function (orderId, dto) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const config = {
|
|
24
|
+
headers: { Authorization: `Bearer ${this.apiToken}` },
|
|
25
|
+
};
|
|
26
|
+
return yield this.axiosInstance.patch(ORDER_LINE_STATUSES(orderId), dto, config);
|
|
27
|
+
});
|
|
28
|
+
};
|
package/dist/api/reports/get.js
CHANGED
|
@@ -432,3 +432,23 @@ export const getScheduledDeliveries = function (companyId, params) {
|
|
|
432
432
|
}
|
|
433
433
|
});
|
|
434
434
|
};
|
|
435
|
+
export const getServicesToDeliver = function (companyId, params) {
|
|
436
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
437
|
+
try {
|
|
438
|
+
const config = {
|
|
439
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
440
|
+
};
|
|
441
|
+
const queryParams = generateQueryParamsStr([
|
|
442
|
+
'storeId',
|
|
443
|
+
'dateFrom',
|
|
444
|
+
'dateTo',
|
|
445
|
+
'hideReady',
|
|
446
|
+
], params);
|
|
447
|
+
return yield this.axiosInstance.get(`${GET_SET_REPORTS}/${companyId}/servicesToDeliver?${queryParams}`, config);
|
|
448
|
+
}
|
|
449
|
+
catch (error) {
|
|
450
|
+
console.error('Error fetching getServicesToDeliver:', error);
|
|
451
|
+
throw error;
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
};
|
package/dist/enum/index.js
CHANGED
|
@@ -18,3 +18,12 @@ export var PaymentMethodsEnum;
|
|
|
18
18
|
PaymentMethodsEnum["Delivery"] = "delivery";
|
|
19
19
|
PaymentMethodsEnum["Transfer"] = "transfer";
|
|
20
20
|
})(PaymentMethodsEnum || (PaymentMethodsEnum = {}));
|
|
21
|
+
export var OrderProductLineStatus;
|
|
22
|
+
(function (OrderProductLineStatus) {
|
|
23
|
+
OrderProductLineStatus["Created"] = "created";
|
|
24
|
+
OrderProductLineStatus["Cleaning"] = "cleaning";
|
|
25
|
+
OrderProductLineStatus["Ready"] = "ready";
|
|
26
|
+
OrderProductLineStatus["Collected"] = "collected";
|
|
27
|
+
OrderProductLineStatus["Uncollected"] = "uncollected";
|
|
28
|
+
OrderProductLineStatus["Cancelled"] = "cancelled";
|
|
29
|
+
})(OrderProductLineStatus || (OrderProductLineStatus = {}));
|
package/package.json
CHANGED
package/src/api/csv/get.ts
CHANGED
|
@@ -470,3 +470,33 @@ export const exportScheduledDeliveriesReport = async function (this: WashdayClie
|
|
|
470
470
|
throw error;
|
|
471
471
|
}
|
|
472
472
|
};
|
|
473
|
+
|
|
474
|
+
export const exportServicesToDeliverReport = async function (this: WashdayClientInstance, companyId: string, params: {
|
|
475
|
+
storeId?: string
|
|
476
|
+
dateFrom?: string
|
|
477
|
+
dateTo?: string
|
|
478
|
+
hideReady?: string
|
|
479
|
+
}): Promise<any> {
|
|
480
|
+
try {
|
|
481
|
+
const config = {
|
|
482
|
+
headers: {
|
|
483
|
+
Authorization: `Bearer ${this.apiToken}`,
|
|
484
|
+
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
485
|
+
'Content-disposition': 'attachment; filename=[file.xlsx]'
|
|
486
|
+
},
|
|
487
|
+
params: {
|
|
488
|
+
responseType: 'blob'
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
const queryParams = generateQueryParamsStr([
|
|
492
|
+
'storeId',
|
|
493
|
+
'dateFrom',
|
|
494
|
+
'dateTo',
|
|
495
|
+
'hideReady'
|
|
496
|
+
], params);
|
|
497
|
+
return await this.axiosInstance.get(`${GET_SET_REPORTS}/${companyId}/servicesToDeliver/export/csv?${queryParams}`, config);
|
|
498
|
+
} catch (error) {
|
|
499
|
+
console.error('Error fetching exportServicesToDeliverReport:', error);
|
|
500
|
+
throw error;
|
|
501
|
+
}
|
|
502
|
+
};
|
package/src/api/index.ts
CHANGED
|
@@ -158,7 +158,8 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
158
158
|
bulkCancel: ordersEndpoints.putModule.bulkCancel,
|
|
159
159
|
bulkClean: ordersEndpoints.putModule.bulkClean,
|
|
160
160
|
bulkCollect: ordersEndpoints.putModule.bulkCollect,
|
|
161
|
-
cancelOrderByIdCustomersApp: ordersEndpoints.deleteModule.cancelOrderByIdCustomersApp
|
|
161
|
+
cancelOrderByIdCustomersApp: ordersEndpoints.deleteModule.cancelOrderByIdCustomersApp,
|
|
162
|
+
updateLineStatuses: ordersEndpoints.patchModule.updateLineStatuses,
|
|
162
163
|
});
|
|
163
164
|
this.customers = bindMethods(this, {
|
|
164
165
|
getCustomers: customersEndpoints.getModule.getList,
|
|
@@ -314,6 +315,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
314
315
|
exportAttendanceReport: csvExportEndpoints.getModule.exportAttendanceReport,
|
|
315
316
|
exportCashUpReportsByDateRange: csvExportEndpoints.getModule.exportCashUpReportsByDateRange,
|
|
316
317
|
exportScheduledDeliveriesReport: csvExportEndpoints.getModule.exportScheduledDeliveriesReport,
|
|
318
|
+
exportServicesToDeliverReport: csvExportEndpoints.getModule.exportServicesToDeliverReport,
|
|
317
319
|
});
|
|
318
320
|
this.pdf = bindMethods(this, {
|
|
319
321
|
exportUnpaidOrdersReportPDF: pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF,
|
|
@@ -333,6 +335,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
333
335
|
getCashierBoxMovementsReport: reportsExportEndpoints.getModule.getCashierBoxMovementsReport,
|
|
334
336
|
getUnpaidOrdersReport: reportsExportEndpoints.getModule.getUnpaidOrdersReport,
|
|
335
337
|
getScheduledDeliveries: reportsExportEndpoints.getModule.getScheduledDeliveries,
|
|
338
|
+
getServicesToDeliver: reportsExportEndpoints.getModule.getServicesToDeliver,
|
|
336
339
|
getAnnualSalesStatistics: reportsExportEndpoints.getModule.getAnnualSalesStatistics,
|
|
337
340
|
getPaymentMethodStatistics: reportsExportEndpoints.getModule.getPaymentMethodStatistics,
|
|
338
341
|
getProductsStatistics: reportsExportEndpoints.getModule.getProductsStatistics,
|
package/src/api/order/index.ts
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { WashdayClientInstance } from '../../interfaces/Api';
|
|
2
|
+
import { IUpdateOrderLineStatusesDto } from '../../interfaces/Order';
|
|
3
|
+
|
|
4
|
+
const ORDER_LINE_STATUSES = (orderId: string) => `/api/v2/order/${orderId}/line-statuses`;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Batch update of line-level statuses for a single order.
|
|
8
|
+
*
|
|
9
|
+
* - Validates all transitions server-side before applying any.
|
|
10
|
+
* - Does NOT modify the order's own status.
|
|
11
|
+
* - Returns the full updated order.
|
|
12
|
+
*
|
|
13
|
+
* Actor: Staff / POS (requires valid auth token)
|
|
14
|
+
* Endpoint: PATCH /api/v2/order/:id/line-statuses
|
|
15
|
+
*/
|
|
16
|
+
export const updateLineStatuses = async function (
|
|
17
|
+
this: WashdayClientInstance,
|
|
18
|
+
orderId: string,
|
|
19
|
+
dto: IUpdateOrderLineStatusesDto
|
|
20
|
+
): Promise<any> {
|
|
21
|
+
const config = {
|
|
22
|
+
headers: { Authorization: `Bearer ${this.apiToken}` },
|
|
23
|
+
};
|
|
24
|
+
return await this.axiosInstance.patch(ORDER_LINE_STATUSES(orderId), dto, config);
|
|
25
|
+
};
|
package/src/api/reports/get.ts
CHANGED
|
@@ -484,3 +484,26 @@ export const getScheduledDeliveries = async function (this: WashdayClientInstanc
|
|
|
484
484
|
throw error;
|
|
485
485
|
}
|
|
486
486
|
};
|
|
487
|
+
|
|
488
|
+
export const getServicesToDeliver = async function (this: WashdayClientInstance, companyId: string, params: {
|
|
489
|
+
storeId?: string
|
|
490
|
+
dateFrom?: string
|
|
491
|
+
dateTo?: string
|
|
492
|
+
hideReady?: string
|
|
493
|
+
}): Promise<any> {
|
|
494
|
+
try {
|
|
495
|
+
const config = {
|
|
496
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
497
|
+
};
|
|
498
|
+
const queryParams = generateQueryParamsStr([
|
|
499
|
+
'storeId',
|
|
500
|
+
'dateFrom',
|
|
501
|
+
'dateTo',
|
|
502
|
+
'hideReady',
|
|
503
|
+
], params);
|
|
504
|
+
return await this.axiosInstance.get(`${GET_SET_REPORTS}/${companyId}/servicesToDeliver?${queryParams}`, config);
|
|
505
|
+
} catch (error) {
|
|
506
|
+
console.error('Error fetching getServicesToDeliver:', error);
|
|
507
|
+
throw error;
|
|
508
|
+
}
|
|
509
|
+
};
|
package/src/enum/index.ts
CHANGED
|
@@ -16,4 +16,13 @@ export enum PaymentMethodsEnum {
|
|
|
16
16
|
Card = "card",
|
|
17
17
|
Delivery = "delivery",
|
|
18
18
|
Transfer = "transfer",
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export enum OrderProductLineStatus {
|
|
22
|
+
Created = 'created',
|
|
23
|
+
Cleaning = 'cleaning',
|
|
24
|
+
Ready = 'ready',
|
|
25
|
+
Collected = 'collected',
|
|
26
|
+
Uncollected = 'uncollected',
|
|
27
|
+
Cancelled = 'cancelled',
|
|
19
28
|
}
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -144,6 +144,7 @@ export interface WashdayClientInstance {
|
|
|
144
144
|
bulkClean: typeof ordersEndpoints.putModule.bulkClean,
|
|
145
145
|
bulkCollect: typeof ordersEndpoints.putModule.bulkCollect,
|
|
146
146
|
cancelOrderByIdCustomersApp: typeof ordersEndpoints.deleteModule.cancelOrderByIdCustomersApp;
|
|
147
|
+
updateLineStatuses: typeof ordersEndpoints.patchModule.updateLineStatuses;
|
|
147
148
|
};
|
|
148
149
|
customers: {
|
|
149
150
|
getCustomers: typeof customersEndpoints.getModule.getList;
|
|
@@ -293,6 +294,7 @@ export interface WashdayClientInstance {
|
|
|
293
294
|
exportUnpaidOrdersReportCSV: typeof csvExportEndpoints.getModule.exportUnpaidOrdersReportCSV;
|
|
294
295
|
exportCashUpReportsByDateRange: typeof csvExportEndpoints.getModule.exportCashUpReportsByDateRange;
|
|
295
296
|
exportScheduledDeliveriesReport: typeof csvExportEndpoints.getModule.exportScheduledDeliveriesReport;
|
|
297
|
+
exportServicesToDeliverReport: typeof csvExportEndpoints.getModule.exportServicesToDeliverReport;
|
|
296
298
|
exportOrdersList: typeof csvExportEndpoints.getModule.exportOrdersList,
|
|
297
299
|
exportProductsList: typeof csvExportEndpoints.getModule.exportProductsList,
|
|
298
300
|
exportCleanedOrdersReport: typeof csvExportEndpoints.getModule.exportCleanedOrdersReport,
|
|
@@ -318,6 +320,7 @@ export interface WashdayClientInstance {
|
|
|
318
320
|
getCashierBoxMovementsReport: typeof reportsExportEndpoints.getModule.getCashierBoxMovementsReport;
|
|
319
321
|
getUnpaidOrdersReport: typeof reportsExportEndpoints.getModule.getUnpaidOrdersReport;
|
|
320
322
|
getScheduledDeliveries: typeof reportsExportEndpoints.getModule.getScheduledDeliveries;
|
|
323
|
+
getServicesToDeliver: typeof reportsExportEndpoints.getModule.getServicesToDeliver;
|
|
321
324
|
getAnnualSalesStatistics: typeof reportsExportEndpoints.getModule.getAnnualSalesStatistics;
|
|
322
325
|
getPaymentMethodStatistics: typeof reportsExportEndpoints.getModule.getPaymentMethodStatistics;
|
|
323
326
|
getProductsStatistics: typeof reportsExportEndpoints.getModule.getProductsStatistics;
|
package/src/interfaces/Order.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { ICustomer } from "./Customer";
|
|
|
2
2
|
import { IOrderProduct, IProduct } from "./Product";
|
|
3
3
|
import { ICashierBox, IStore, IStoreDiscount, ITaxConfig } from "./Store";
|
|
4
4
|
import { IUser } from "./User";
|
|
5
|
+
import { OrderProductLineStatus } from "../enum";
|
|
5
6
|
|
|
6
7
|
interface IDeliveryInfo {
|
|
7
8
|
date: Date,
|
|
@@ -102,6 +103,22 @@ export interface IOrder {
|
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
|
|
106
|
+
/**
|
|
107
|
+
* A single line status update within a batch request.
|
|
108
|
+
* `status` cannot be 'created' — lines cannot be reset to initial state.
|
|
109
|
+
*/
|
|
110
|
+
export interface IOrderLineStatusUpdate {
|
|
111
|
+
lineId: string;
|
|
112
|
+
status: Exclude<OrderProductLineStatus, OrderProductLineStatus.Created>;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Request body for PATCH /api/v2/order/:id/line-statuses
|
|
117
|
+
*/
|
|
118
|
+
export interface IUpdateOrderLineStatusesDto {
|
|
119
|
+
updates: IOrderLineStatusUpdate[];
|
|
120
|
+
}
|
|
121
|
+
|
|
105
122
|
export interface IOrderInfo {
|
|
106
123
|
topProducts: IProduct[];
|
|
107
124
|
sales: number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IStore } from "./Store"
|
|
2
2
|
import { IStoreImage } from "./StoreImage"
|
|
3
3
|
import { IUser } from "./User"
|
|
4
|
+
import { OrderProductLineStatus } from "../enum"
|
|
4
5
|
|
|
5
6
|
export interface ProductLineTotals {
|
|
6
7
|
product: IOrderProduct,
|
|
@@ -71,4 +72,18 @@ export interface IOrderProduct extends IProduct {
|
|
|
71
72
|
isBuyAndGetProduct: boolean,
|
|
72
73
|
storeProductId: IStoreProduct | string
|
|
73
74
|
qty?: number
|
|
75
|
+
|
|
76
|
+
// Operational line-level status fields (added 2026-04-04)
|
|
77
|
+
status?: OrderProductLineStatus,
|
|
78
|
+
cleanedDateTime?: Date | null, // set on → ready (cleaning completed)
|
|
79
|
+
readyDateTime?: Date | null, // set on → ready; currently always equals cleanedDateTime
|
|
80
|
+
collectedDateTime?: Date | null,
|
|
81
|
+
uncollectedDateTime?: Date | null,
|
|
82
|
+
cancelledDateTime?: Date | null,
|
|
83
|
+
markedCleaningBy?: IUser | string | null, // who sent the line to cleaning (→ cleaning)
|
|
84
|
+
markedCleanedBy?: IUser | string | null, // who confirmed cleaning complete (→ ready)
|
|
85
|
+
markedReadyBy?: IUser | string | null,
|
|
86
|
+
markedCollectedBy?: IUser | string | null,
|
|
87
|
+
markedUncollectedBy?: IUser | string | null,
|
|
88
|
+
markedCancelledBy?: IUser | string | null,
|
|
74
89
|
}
|