washday-sdk 1.6.3 → 1.6.5
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 +26 -0
- package/dist/api/index.js +3 -0
- package/dist/api/products/post.js +16 -0
- package/dist/api/reports/get.js +19 -0
- package/package.json +1 -1
- package/src/api/csv/get.ts +28 -0
- package/src/api/index.ts +3 -0
- package/src/api/products/post.ts +33 -15
- package/src/api/reports/get.ts +21 -0
- package/src/interfaces/Api.ts +3 -0
- package/src/interfaces/Store.ts +2 -0
package/dist/api/csv/get.js
CHANGED
|
@@ -294,6 +294,32 @@ export const exportPaymentLinesReport = function (storeId, params) {
|
|
|
294
294
|
}
|
|
295
295
|
});
|
|
296
296
|
};
|
|
297
|
+
export const exportCashUpReportsByDateRange = function (storeId, params) {
|
|
298
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
299
|
+
try {
|
|
300
|
+
const config = {
|
|
301
|
+
headers: {
|
|
302
|
+
Authorization: `Bearer ${this.apiToken}`,
|
|
303
|
+
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
304
|
+
'Content-disposition': 'attachment; filename=[file.csv]'
|
|
305
|
+
},
|
|
306
|
+
params: {
|
|
307
|
+
responseType: 'blob'
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
const queryParams = generateQueryParamsStr([
|
|
311
|
+
'fromDate',
|
|
312
|
+
'toDate',
|
|
313
|
+
'cashierBoxId',
|
|
314
|
+
], params);
|
|
315
|
+
return yield this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/cashups/export?${queryParams}`, config);
|
|
316
|
+
}
|
|
317
|
+
catch (error) {
|
|
318
|
+
console.error('Error fetching exportCashUpReportsByDateRange:', error);
|
|
319
|
+
throw error;
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
};
|
|
297
323
|
export const exportUnpaidOrdersReportCSV = function (storeId, params) {
|
|
298
324
|
return __awaiter(this, void 0, void 0, function* () {
|
|
299
325
|
try {
|
package/dist/api/index.js
CHANGED
|
@@ -182,6 +182,7 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
|
|
|
182
182
|
updateById: productsEndpoints.putModule.updateById,
|
|
183
183
|
bulkUpdate: productsEndpoints.putModule.bulkUpdate,
|
|
184
184
|
createPriceOption: productsEndpoints.postModule.createPriceOption,
|
|
185
|
+
bulkUpdateProductPrices: productsEndpoints.postModule.bulkUpdateProductPrices,
|
|
185
186
|
updatePriceOption: productsEndpoints.putModule.updatePriceOption,
|
|
186
187
|
deletePriceOption: productsEndpoints.deleteModule.deletePriceOption,
|
|
187
188
|
});
|
|
@@ -285,11 +286,13 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
|
|
|
285
286
|
exportPaymentLinesReport: csvExportEndpoints.getModule.exportPaymentLinesReport,
|
|
286
287
|
exportUnpaidOrdersReportCSV: csvExportEndpoints.getModule.exportUnpaidOrdersReportCSV,
|
|
287
288
|
exportAttendanceReport: csvExportEndpoints.getModule.exportAttendanceReport,
|
|
289
|
+
exportCashUpReportsByDateRange: csvExportEndpoints.getModule.exportCashUpReportsByDateRange,
|
|
288
290
|
});
|
|
289
291
|
this.pdf = bindMethods(this, {
|
|
290
292
|
exportUnpaidOrdersReportPDF: pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF,
|
|
291
293
|
});
|
|
292
294
|
this.reports = bindMethods(this, {
|
|
295
|
+
getCashUpReportsByDateRange: reportsExportEndpoints.getModule.getCashUpReportsByDateRange,
|
|
293
296
|
getCleanedOrdersReport: reportsExportEndpoints.getModule.getCleanedOrdersReport,
|
|
294
297
|
getCleanedOrdersGraphDataReport: reportsExportEndpoints.getModule.getCleanedOrdersGraphDataReport,
|
|
295
298
|
getSalesReport: reportsExportEndpoints.getModule.getSalesReport,
|
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
const GET_SET_PRODUCTS_SUPPLY = 'api/product-supply';
|
|
11
11
|
const GET_SET_PRODUCTS = 'api/product';
|
|
12
|
+
const GET_SET_PRODUCTS_STORES = 'api/stores';
|
|
12
13
|
export const create = function (data) {
|
|
13
14
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14
15
|
try {
|
|
@@ -73,3 +74,18 @@ export const createPriceOption = function (productId, data) {
|
|
|
73
74
|
}
|
|
74
75
|
});
|
|
75
76
|
};
|
|
77
|
+
export const bulkUpdateProductPrices = function (data) {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
try {
|
|
80
|
+
const config = {
|
|
81
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
82
|
+
};
|
|
83
|
+
const response = yield this.axiosInstance.post(`${GET_SET_PRODUCTS_STORES}/${data === null || data === void 0 ? void 0 : data.storeId}/products/bulk-update-prices`, data, config);
|
|
84
|
+
return response.data || {};
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
console.error('Error bulk updating product prices:', error);
|
|
88
|
+
throw error;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
};
|
package/dist/api/reports/get.js
CHANGED
|
@@ -300,3 +300,22 @@ export const getPopularDaysStatistics = function (storeId, params) {
|
|
|
300
300
|
}
|
|
301
301
|
});
|
|
302
302
|
};
|
|
303
|
+
export const getCashUpReportsByDateRange = function (storeId, params) {
|
|
304
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
305
|
+
try {
|
|
306
|
+
const config = {
|
|
307
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
308
|
+
};
|
|
309
|
+
const queryParams = generateQueryParamsStr([
|
|
310
|
+
'fromDate',
|
|
311
|
+
'toDate',
|
|
312
|
+
'cashierBoxId',
|
|
313
|
+
], params);
|
|
314
|
+
return yield this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/cashups?${queryParams}`, config);
|
|
315
|
+
}
|
|
316
|
+
catch (error) {
|
|
317
|
+
console.error('Error fetching getCashUpReportsByDateRange:', error);
|
|
318
|
+
throw error;
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
};
|
package/package.json
CHANGED
package/src/api/csv/get.ts
CHANGED
|
@@ -321,6 +321,34 @@ export const exportPaymentLinesReport = async function (this: WashdayClientInsta
|
|
|
321
321
|
}
|
|
322
322
|
};
|
|
323
323
|
|
|
324
|
+
export const exportCashUpReportsByDateRange = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
325
|
+
fromDate?: string
|
|
326
|
+
toDate?: string
|
|
327
|
+
cashierBoxId?: string
|
|
328
|
+
}): Promise<any> {
|
|
329
|
+
try {
|
|
330
|
+
const config = {
|
|
331
|
+
headers: {
|
|
332
|
+
Authorization: `Bearer ${this.apiToken}`,
|
|
333
|
+
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
334
|
+
'Content-disposition': 'attachment; filename=[file.csv]'
|
|
335
|
+
},
|
|
336
|
+
params: {
|
|
337
|
+
responseType: 'blob'
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
const queryParams = generateQueryParamsStr([
|
|
341
|
+
'fromDate',
|
|
342
|
+
'toDate',
|
|
343
|
+
'cashierBoxId',
|
|
344
|
+
], params);
|
|
345
|
+
return await this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/cashups/export?${queryParams}`, config);
|
|
346
|
+
} catch (error) {
|
|
347
|
+
console.error('Error fetching exportCashUpReportsByDateRange:', error);
|
|
348
|
+
throw error;
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
|
|
324
352
|
export const exportUnpaidOrdersReportCSV = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
325
353
|
fromDate?: string
|
|
326
354
|
toDate?: string
|
package/src/api/index.ts
CHANGED
|
@@ -189,6 +189,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
189
189
|
updateById: productsEndpoints.putModule.updateById,
|
|
190
190
|
bulkUpdate: productsEndpoints.putModule.bulkUpdate,
|
|
191
191
|
createPriceOption: productsEndpoints.postModule.createPriceOption,
|
|
192
|
+
bulkUpdateProductPrices: productsEndpoints.postModule.bulkUpdateProductPrices,
|
|
192
193
|
updatePriceOption: productsEndpoints.putModule.updatePriceOption,
|
|
193
194
|
deletePriceOption: productsEndpoints.deleteModule.deletePriceOption,
|
|
194
195
|
});
|
|
@@ -292,11 +293,13 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
292
293
|
exportPaymentLinesReport: csvExportEndpoints.getModule.exportPaymentLinesReport,
|
|
293
294
|
exportUnpaidOrdersReportCSV: csvExportEndpoints.getModule.exportUnpaidOrdersReportCSV,
|
|
294
295
|
exportAttendanceReport: csvExportEndpoints.getModule.exportAttendanceReport,
|
|
296
|
+
exportCashUpReportsByDateRange: csvExportEndpoints.getModule.exportCashUpReportsByDateRange,
|
|
295
297
|
});
|
|
296
298
|
this.pdf = bindMethods(this, {
|
|
297
299
|
exportUnpaidOrdersReportPDF: pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF,
|
|
298
300
|
});
|
|
299
301
|
this.reports = bindMethods(this, {
|
|
302
|
+
getCashUpReportsByDateRange: reportsExportEndpoints.getModule.getCashUpReportsByDateRange,
|
|
300
303
|
getCleanedOrdersReport: reportsExportEndpoints.getModule.getCleanedOrdersReport,
|
|
301
304
|
getCleanedOrdersGraphDataReport: reportsExportEndpoints.getModule.getCleanedOrdersGraphDataReport,
|
|
302
305
|
getSalesReport: reportsExportEndpoints.getModule.getSalesReport,
|
package/src/api/products/post.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { WashdayClientInstance } from "../../interfaces/Api";
|
|
|
2
2
|
import axiosInstance from "../axiosInstance";
|
|
3
3
|
const GET_SET_PRODUCTS_SUPPLY = 'api/product-supply';
|
|
4
4
|
const GET_SET_PRODUCTS = 'api/product';
|
|
5
|
+
const GET_SET_PRODUCTS_STORES = 'api/stores';
|
|
5
6
|
|
|
6
7
|
export const create = async function (this: WashdayClientInstance, data: {
|
|
7
8
|
name: string;
|
|
@@ -74,20 +75,37 @@ export const bulkCreate = async function (this: WashdayClientInstance, storeId:
|
|
|
74
75
|
|
|
75
76
|
// New: create price option for a product
|
|
76
77
|
export const createPriceOption = async function (this: WashdayClientInstance, productId: string, data: {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
label: string;
|
|
79
|
+
price: number;
|
|
80
|
+
expressPrice: number;
|
|
81
|
+
isDefault?: boolean;
|
|
82
|
+
isActive?: boolean;
|
|
82
83
|
}): Promise<any> {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
84
|
+
try {
|
|
85
|
+
const config = {
|
|
86
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
87
|
+
};
|
|
88
|
+
const response = await this.axiosInstance.post(`${GET_SET_PRODUCTS}/${productId}/price-options`, data, config);
|
|
89
|
+
return response.data || {};
|
|
90
|
+
} catch (error) {
|
|
91
|
+
console.error('Error creating price option:', error);
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export const bulkUpdateProductPrices = async function (this: WashdayClientInstance, data: {
|
|
97
|
+
storeId: string,
|
|
98
|
+
section: 'all' | string;
|
|
99
|
+
value: number;
|
|
100
|
+
}): Promise<any> {
|
|
101
|
+
try {
|
|
102
|
+
const config = {
|
|
103
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
104
|
+
};
|
|
105
|
+
const response = await this.axiosInstance.post(`${GET_SET_PRODUCTS_STORES}/${data?.storeId}/products/bulk-update-prices`, data, config);
|
|
106
|
+
return response.data || {};
|
|
107
|
+
} catch (error) {
|
|
108
|
+
console.error('Error bulk updating product prices:', error);
|
|
109
|
+
throw error;
|
|
110
|
+
}
|
|
93
111
|
};
|
package/src/api/reports/get.ts
CHANGED
|
@@ -326,4 +326,25 @@ export const getPopularDaysStatistics = async function (this: WashdayClientInsta
|
|
|
326
326
|
console.error('Error fetching getPopularDaysStatistics :', error);
|
|
327
327
|
throw error;
|
|
328
328
|
}
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
export const getCashUpReportsByDateRange = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
332
|
+
fromDate?: string
|
|
333
|
+
toDate?: string
|
|
334
|
+
cashierBoxId?: string
|
|
335
|
+
}): Promise<any> {
|
|
336
|
+
try {
|
|
337
|
+
const config = {
|
|
338
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
339
|
+
};
|
|
340
|
+
const queryParams = generateQueryParamsStr([
|
|
341
|
+
'fromDate',
|
|
342
|
+
'toDate',
|
|
343
|
+
'cashierBoxId',
|
|
344
|
+
], params);
|
|
345
|
+
return await this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/cashups?${queryParams}`, config);
|
|
346
|
+
} catch (error) {
|
|
347
|
+
console.error('Error fetching getCashUpReportsByDateRange:', error);
|
|
348
|
+
throw error;
|
|
349
|
+
}
|
|
329
350
|
};
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -174,6 +174,7 @@ export interface WashdayClientInstance {
|
|
|
174
174
|
updateById: typeof productsEndpoints.putModule.updateById;
|
|
175
175
|
bulkUpdate: typeof productsEndpoints.putModule.bulkUpdate;
|
|
176
176
|
createPriceOption: typeof productsEndpoints.postModule.createPriceOption;
|
|
177
|
+
bulkUpdateProductPrices: typeof productsEndpoints.postModule.bulkUpdateProductPrices;
|
|
177
178
|
updatePriceOption: typeof productsEndpoints.putModule.updatePriceOption;
|
|
178
179
|
deletePriceOption: typeof productsEndpoints.deleteModule.deletePriceOption;
|
|
179
180
|
};
|
|
@@ -271,6 +272,7 @@ export interface WashdayClientInstance {
|
|
|
271
272
|
exportProductSalesReport: typeof csvExportEndpoints.getModule.exportProductSalesReport;
|
|
272
273
|
exportPaymentLinesReport: typeof csvExportEndpoints.getModule.exportPaymentLinesReport;
|
|
273
274
|
exportUnpaidOrdersReportCSV: typeof csvExportEndpoints.getModule.exportUnpaidOrdersReportCSV;
|
|
275
|
+
exportCashUpReportsByDateRange: typeof csvExportEndpoints.getModule.exportCashUpReportsByDateRange;
|
|
274
276
|
exportOrdersList: typeof csvExportEndpoints.getModule.exportOrdersList,
|
|
275
277
|
exportProductsList: typeof csvExportEndpoints.getModule.exportProductsList,
|
|
276
278
|
exportCleanedOrdersReport: typeof csvExportEndpoints.getModule.exportCleanedOrdersReport,
|
|
@@ -282,6 +284,7 @@ export interface WashdayClientInstance {
|
|
|
282
284
|
exportUnpaidOrdersReportPDF: typeof pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF;
|
|
283
285
|
};
|
|
284
286
|
reports: {
|
|
287
|
+
getCashUpReportsByDateRange: typeof reportsExportEndpoints.getModule.getCashUpReportsByDateRange;
|
|
285
288
|
getCleanedOrdersReport: typeof reportsExportEndpoints.getModule.getCleanedOrdersReport;
|
|
286
289
|
getCleanedOrdersGraphDataReport: typeof reportsExportEndpoints.getModule.getCleanedOrdersGraphDataReport;
|
|
287
290
|
getSalesReport: typeof reportsExportEndpoints.getModule.getSalesReport;
|
package/src/interfaces/Store.ts
CHANGED
|
@@ -288,6 +288,7 @@ export interface ITicketStructure {
|
|
|
288
288
|
showLegend: Boolean,
|
|
289
289
|
showPaymentMethod: Boolean,
|
|
290
290
|
showStorePhone: Boolean,
|
|
291
|
+
showCustomerPoints: Boolean,
|
|
291
292
|
showDeliveryDate: Boolean,
|
|
292
293
|
showDeliveryTime: Boolean,
|
|
293
294
|
ticketLegendText: String,
|
|
@@ -307,6 +308,7 @@ export interface ITicketForLaundryStructure {
|
|
|
307
308
|
showLegend: Boolean,
|
|
308
309
|
showPaymentMethod: Boolean,
|
|
309
310
|
showStorePhone: Boolean,
|
|
311
|
+
showCustomerPoints: Boolean,
|
|
310
312
|
showDeliveryDate: Boolean,
|
|
311
313
|
showDeliveryTime: Boolean,
|
|
312
314
|
ticketLegendText: String,
|