washday-sdk 0.0.133 → 0.0.135
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 +178 -0
- package/dist/api/index.js +15 -2
- package/dist/api/reports/get.js +136 -0
- package/package.json +1 -1
- package/src/api/csv/get.ts +190 -0
- package/src/api/index.ts +15 -2
- package/src/api/reports/get.ts +150 -0
- package/src/interfaces/Api.ts +13 -0
package/dist/api/csv/get.js
CHANGED
|
@@ -145,3 +145,181 @@ export const exportSalesReport = function (storeId, params) {
|
|
|
145
145
|
}
|
|
146
146
|
});
|
|
147
147
|
};
|
|
148
|
+
export const exportCustomersReport = function (storeId, params) {
|
|
149
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
150
|
+
try {
|
|
151
|
+
const config = {
|
|
152
|
+
headers: {
|
|
153
|
+
Authorization: `Bearer ${this.apiToken}`,
|
|
154
|
+
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
155
|
+
'Content-disposition': 'attachment; filename=[file.csv]'
|
|
156
|
+
},
|
|
157
|
+
params: {
|
|
158
|
+
responseType: 'blob'
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
const queryParams = generateQueryParamsStr([
|
|
162
|
+
'fromDate',
|
|
163
|
+
'toDate',
|
|
164
|
+
], params);
|
|
165
|
+
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/customers/export?${queryParams}`, config);
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
console.error('Error fetching exportCustomersReport:', error);
|
|
169
|
+
throw error;
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
export const exportSuppliesReport = function (storeId, params) {
|
|
174
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
175
|
+
try {
|
|
176
|
+
const config = {
|
|
177
|
+
headers: {
|
|
178
|
+
Authorization: `Bearer ${this.apiToken}`,
|
|
179
|
+
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
180
|
+
'Content-disposition': 'attachment; filename=[file.csv]'
|
|
181
|
+
},
|
|
182
|
+
params: {
|
|
183
|
+
responseType: 'blob'
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
const queryParams = generateQueryParamsStr([
|
|
187
|
+
'fromDate',
|
|
188
|
+
'toDate',
|
|
189
|
+
], params);
|
|
190
|
+
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/supplies/export?${queryParams}`, config);
|
|
191
|
+
}
|
|
192
|
+
catch (error) {
|
|
193
|
+
console.error('Error fetching exportCustomersReport:', error);
|
|
194
|
+
throw error;
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
};
|
|
198
|
+
export const exportDiscountCodesReport = function (storeId, params) {
|
|
199
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
200
|
+
try {
|
|
201
|
+
const config = {
|
|
202
|
+
headers: {
|
|
203
|
+
Authorization: `Bearer ${this.apiToken}`,
|
|
204
|
+
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
205
|
+
'Content-disposition': 'attachment; filename=[file.csv]'
|
|
206
|
+
},
|
|
207
|
+
params: {
|
|
208
|
+
responseType: 'blob'
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
const queryParams = generateQueryParamsStr([], params);
|
|
212
|
+
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/discountCodes/export?${queryParams}`, config);
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
console.error('Error fetching exportCustomersReport:', error);
|
|
216
|
+
throw error;
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
};
|
|
220
|
+
export const exportStaffReport = function (storeId, params) {
|
|
221
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
222
|
+
try {
|
|
223
|
+
const config = {
|
|
224
|
+
headers: {
|
|
225
|
+
Authorization: `Bearer ${this.apiToken}`,
|
|
226
|
+
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
227
|
+
'Content-disposition': 'attachment; filename=[file.csv]'
|
|
228
|
+
},
|
|
229
|
+
params: {
|
|
230
|
+
responseType: 'blob'
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
const queryParams = generateQueryParamsStr([
|
|
234
|
+
'fromDate',
|
|
235
|
+
'toDate',
|
|
236
|
+
], params);
|
|
237
|
+
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/staff/export?${queryParams}`, config);
|
|
238
|
+
}
|
|
239
|
+
catch (error) {
|
|
240
|
+
console.error('Error fetching exportCustomersReport:', error);
|
|
241
|
+
throw error;
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
};
|
|
245
|
+
export const exportProductSalesReport = function (storeId, params) {
|
|
246
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
247
|
+
try {
|
|
248
|
+
const config = {
|
|
249
|
+
headers: {
|
|
250
|
+
Authorization: `Bearer ${this.apiToken}`,
|
|
251
|
+
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
252
|
+
'Content-disposition': 'attachment; filename=[file.csv]'
|
|
253
|
+
},
|
|
254
|
+
params: {
|
|
255
|
+
responseType: 'blob'
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
const queryParams = generateQueryParamsStr([
|
|
259
|
+
'fromDate',
|
|
260
|
+
'toDate',
|
|
261
|
+
'timezone'
|
|
262
|
+
], params);
|
|
263
|
+
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/productSales/export?${queryParams}`, config);
|
|
264
|
+
}
|
|
265
|
+
catch (error) {
|
|
266
|
+
console.error('Error fetching exportOrdersList:', error);
|
|
267
|
+
throw error;
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
};
|
|
271
|
+
export const exportPaymentLinesReport = function (storeId, params) {
|
|
272
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
273
|
+
try {
|
|
274
|
+
const config = {
|
|
275
|
+
headers: {
|
|
276
|
+
Authorization: `Bearer ${this.apiToken}`,
|
|
277
|
+
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
278
|
+
'Content-disposition': 'attachment; filename=[file.csv]'
|
|
279
|
+
},
|
|
280
|
+
params: {
|
|
281
|
+
responseType: 'blob'
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
const queryParams = generateQueryParamsStr([
|
|
285
|
+
'fromDate',
|
|
286
|
+
'toDate',
|
|
287
|
+
'timezone'
|
|
288
|
+
], params);
|
|
289
|
+
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/paymentLines/export?${queryParams}`, config);
|
|
290
|
+
}
|
|
291
|
+
catch (error) {
|
|
292
|
+
console.error('Error fetching exportOrdersList:', error);
|
|
293
|
+
throw error;
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
};
|
|
297
|
+
export const exportUnpaidOrdersReportCSV = 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
|
+
'pageNum',
|
|
314
|
+
'limit',
|
|
315
|
+
'timezone',
|
|
316
|
+
'customerName'
|
|
317
|
+
], params);
|
|
318
|
+
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/paymentLines/export?${queryParams}`, config);
|
|
319
|
+
}
|
|
320
|
+
catch (error) {
|
|
321
|
+
console.error('Error fetching exportOrdersList:', error);
|
|
322
|
+
throw error;
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
};
|
package/dist/api/index.js
CHANGED
|
@@ -222,7 +222,13 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
222
222
|
exportOrdersList: csvExportEndpoints.getModule.exportOrdersList,
|
|
223
223
|
exportProductsList: csvExportEndpoints.getModule.exportProductsList,
|
|
224
224
|
exportCleanedOrdersReport: csvExportEndpoints.getModule.exportCleanedOrdersReport,
|
|
225
|
-
exportSalesReport: csvExportEndpoints.getModule.exportSalesReport
|
|
225
|
+
exportSalesReport: csvExportEndpoints.getModule.exportSalesReport,
|
|
226
|
+
exportCustomersReport: csvExportEndpoints.getModule.exportCustomersReport,
|
|
227
|
+
exportSuppliesReport: csvExportEndpoints.getModule.exportSuppliesReport,
|
|
228
|
+
exportDiscountCodesReport: csvExportEndpoints.getModule.exportDiscountCodesReport,
|
|
229
|
+
exportProductSalesReport: csvExportEndpoints.getModule.exportProductSalesReport,
|
|
230
|
+
exportPaymentLinesReport: csvExportEndpoints.getModule.exportPaymentLinesReport,
|
|
231
|
+
exportUnpaidOrdersReportCSV: csvExportEndpoints.getModule.exportUnpaidOrdersReportCSV,
|
|
226
232
|
});
|
|
227
233
|
this.pdf = bindMethods(this, {
|
|
228
234
|
exportUnpaidOrdersReportPDF: pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF,
|
|
@@ -230,7 +236,14 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
230
236
|
this.reports = bindMethods(this, {
|
|
231
237
|
getCleanedOrdersReport: reportsExportEndpoints.getModule.getCleanedOrdersReport,
|
|
232
238
|
getCleanedOrdersGraphDataReport: reportsExportEndpoints.getModule.getCleanedOrdersGraphDataReport,
|
|
233
|
-
getSalesReport: reportsExportEndpoints.getModule.getSalesReport
|
|
239
|
+
getSalesReport: reportsExportEndpoints.getModule.getSalesReport,
|
|
240
|
+
getCustomersReport: reportsExportEndpoints.getModule.getCustomersReport,
|
|
241
|
+
getSuppliesReport: reportsExportEndpoints.getModule.getSuppliesReport,
|
|
242
|
+
getDiscountCodesReport: reportsExportEndpoints.getModule.getDiscountCodesReport,
|
|
243
|
+
getStaffReport: reportsExportEndpoints.getModule.getStaffReport,
|
|
244
|
+
getProductSalesReport: reportsExportEndpoints.getModule.getProductSalesReport,
|
|
245
|
+
getPaymentLinesReport: reportsExportEndpoints.getModule.getPaymentLinesReport,
|
|
246
|
+
getUnpaidOrdersReport: reportsExportEndpoints.getModule.getUnpaidOrdersReport,
|
|
234
247
|
});
|
|
235
248
|
};
|
|
236
249
|
export default WashdayClient;
|
package/dist/api/reports/get.js
CHANGED
|
@@ -21,6 +21,7 @@ export const getCleanedOrdersReport = function (storeId, params) {
|
|
|
21
21
|
'fromDate',
|
|
22
22
|
'pageNum',
|
|
23
23
|
'limit',
|
|
24
|
+
'timezone',
|
|
24
25
|
'includeGraph',
|
|
25
26
|
], params);
|
|
26
27
|
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/cleaned-orders?${queryParams}`, config);
|
|
@@ -70,3 +71,138 @@ export const getSalesReport = function (storeId, params) {
|
|
|
70
71
|
}
|
|
71
72
|
});
|
|
72
73
|
};
|
|
74
|
+
export const getCustomersReport = function (storeId, params) {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
try {
|
|
77
|
+
const config = {
|
|
78
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
79
|
+
};
|
|
80
|
+
const queryParams = generateQueryParamsStr([
|
|
81
|
+
'storeId',
|
|
82
|
+
'fromDate',
|
|
83
|
+
'toDate',
|
|
84
|
+
], params);
|
|
85
|
+
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/customers?${queryParams}`, config);
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
console.error('Error fetching getCustomersReport:', error);
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
export const getSuppliesReport = function (storeId, params) {
|
|
94
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
+
try {
|
|
96
|
+
const config = {
|
|
97
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
98
|
+
};
|
|
99
|
+
const queryParams = generateQueryParamsStr([
|
|
100
|
+
'storeId',
|
|
101
|
+
'fromDate',
|
|
102
|
+
'toDate',
|
|
103
|
+
], params);
|
|
104
|
+
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/supplies?${queryParams}`, config);
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
console.error('Error fetching getSuppliesReport:', error);
|
|
108
|
+
throw error;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
export const getDiscountCodesReport = function (storeId, params) {
|
|
113
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
try {
|
|
115
|
+
const config = {
|
|
116
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
117
|
+
};
|
|
118
|
+
const queryParams = generateQueryParamsStr([], params);
|
|
119
|
+
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/discountCodes?${queryParams}`, config);
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
console.error('Error fetching getDiscountCodesReport:', error);
|
|
123
|
+
throw error;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
export const getStaffReport = function (storeId, params) {
|
|
128
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
129
|
+
try {
|
|
130
|
+
const config = {
|
|
131
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
132
|
+
};
|
|
133
|
+
const queryParams = generateQueryParamsStr([
|
|
134
|
+
'storeId',
|
|
135
|
+
'fromDate',
|
|
136
|
+
'toDate',
|
|
137
|
+
], params);
|
|
138
|
+
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/staff?${queryParams}`, config);
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
console.error('Error fetching getStaffReport:', error);
|
|
142
|
+
throw error;
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
export const getProductSalesReport = function (storeId, params) {
|
|
147
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
148
|
+
try {
|
|
149
|
+
const config = {
|
|
150
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
151
|
+
};
|
|
152
|
+
const queryParams = generateQueryParamsStr([
|
|
153
|
+
'toDate',
|
|
154
|
+
'fromDate',
|
|
155
|
+
'timezone',
|
|
156
|
+
'type',
|
|
157
|
+
], params);
|
|
158
|
+
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/productSales?${queryParams}`, config);
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
console.error('Error fetching getProductSalesReport:', error);
|
|
162
|
+
throw error;
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
export const getPaymentLinesReport = function (storeId, params) {
|
|
167
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
168
|
+
try {
|
|
169
|
+
const config = {
|
|
170
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
171
|
+
};
|
|
172
|
+
const queryParams = generateQueryParamsStr([
|
|
173
|
+
'fromDate',
|
|
174
|
+
'toDate',
|
|
175
|
+
'pageNum',
|
|
176
|
+
'limit',
|
|
177
|
+
'timezone',
|
|
178
|
+
], params);
|
|
179
|
+
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/paymentLines?${queryParams}`, config);
|
|
180
|
+
}
|
|
181
|
+
catch (error) {
|
|
182
|
+
console.error('Error fetching getPaymentLinesReport:', error);
|
|
183
|
+
throw error;
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
export const getUnpaidOrdersReport = function (storeId, params) {
|
|
188
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
189
|
+
try {
|
|
190
|
+
const config = {
|
|
191
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
192
|
+
};
|
|
193
|
+
const queryParams = generateQueryParamsStr([
|
|
194
|
+
'fromDate',
|
|
195
|
+
'toDate',
|
|
196
|
+
'pageNum',
|
|
197
|
+
'limit',
|
|
198
|
+
'timezone',
|
|
199
|
+
'customerName'
|
|
200
|
+
], params);
|
|
201
|
+
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/unpaidOrders?${queryParams}`, config);
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
console.error('Error fetching getUnpaidOrdersReport:', error);
|
|
205
|
+
throw error;
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
};
|
package/package.json
CHANGED
package/src/api/csv/get.ts
CHANGED
|
@@ -161,4 +161,194 @@ export const exportSalesReport = async function (this: WashdayClientInstance, st
|
|
|
161
161
|
console.error('Error fetching exportOrdersList:', error);
|
|
162
162
|
throw error;
|
|
163
163
|
}
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export const exportCustomersReport = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
167
|
+
fromDate?: string
|
|
168
|
+
toDate?: string
|
|
169
|
+
}): Promise<any> {
|
|
170
|
+
try {
|
|
171
|
+
const config = {
|
|
172
|
+
headers: {
|
|
173
|
+
Authorization: `Bearer ${this.apiToken}`,
|
|
174
|
+
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
175
|
+
'Content-disposition': 'attachment; filename=[file.csv]'
|
|
176
|
+
},
|
|
177
|
+
params: {
|
|
178
|
+
responseType: 'blob'
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
const queryParams = generateQueryParamsStr([
|
|
182
|
+
'fromDate',
|
|
183
|
+
'toDate',
|
|
184
|
+
], params);
|
|
185
|
+
return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/customers/export?${queryParams}`, config);
|
|
186
|
+
} catch (error) {
|
|
187
|
+
console.error('Error fetching exportCustomersReport:', error);
|
|
188
|
+
throw error;
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
export const exportSuppliesReport = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
193
|
+
fromDate?: string
|
|
194
|
+
toDate?: string
|
|
195
|
+
}): Promise<any> {
|
|
196
|
+
try {
|
|
197
|
+
const config = {
|
|
198
|
+
headers: {
|
|
199
|
+
Authorization: `Bearer ${this.apiToken}`,
|
|
200
|
+
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
201
|
+
'Content-disposition': 'attachment; filename=[file.csv]'
|
|
202
|
+
},
|
|
203
|
+
params: {
|
|
204
|
+
responseType: 'blob'
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
const queryParams = generateQueryParamsStr([
|
|
208
|
+
'fromDate',
|
|
209
|
+
'toDate',
|
|
210
|
+
], params);
|
|
211
|
+
return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/supplies/export?${queryParams}`, config);
|
|
212
|
+
} catch (error) {
|
|
213
|
+
console.error('Error fetching exportCustomersReport:', error);
|
|
214
|
+
throw error;
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
export const exportDiscountCodesReport = async function (this: WashdayClientInstance, storeId: string, params: {}): Promise<any> {
|
|
219
|
+
try {
|
|
220
|
+
const config = {
|
|
221
|
+
headers: {
|
|
222
|
+
Authorization: `Bearer ${this.apiToken}`,
|
|
223
|
+
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
224
|
+
'Content-disposition': 'attachment; filename=[file.csv]'
|
|
225
|
+
},
|
|
226
|
+
params: {
|
|
227
|
+
responseType: 'blob'
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
const queryParams = generateQueryParamsStr([
|
|
231
|
+
], params);
|
|
232
|
+
return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/discountCodes/export?${queryParams}`, config);
|
|
233
|
+
} catch (error) {
|
|
234
|
+
console.error('Error fetching exportCustomersReport:', error);
|
|
235
|
+
throw error;
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
export const exportStaffReport = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
240
|
+
fromDate?: string
|
|
241
|
+
toDate?: string
|
|
242
|
+
}): Promise<any> {
|
|
243
|
+
try {
|
|
244
|
+
const config = {
|
|
245
|
+
headers: {
|
|
246
|
+
Authorization: `Bearer ${this.apiToken}`,
|
|
247
|
+
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
248
|
+
'Content-disposition': 'attachment; filename=[file.csv]'
|
|
249
|
+
},
|
|
250
|
+
params: {
|
|
251
|
+
responseType: 'blob'
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
const queryParams = generateQueryParamsStr([
|
|
255
|
+
'fromDate',
|
|
256
|
+
'toDate',
|
|
257
|
+
], params);
|
|
258
|
+
return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/staff/export?${queryParams}`, config);
|
|
259
|
+
} catch (error) {
|
|
260
|
+
console.error('Error fetching exportCustomersReport:', error);
|
|
261
|
+
throw error;
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
export const exportProductSalesReport = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
267
|
+
fromDate?: string
|
|
268
|
+
toDate?: string
|
|
269
|
+
timezone?: string
|
|
270
|
+
}): Promise<any> {
|
|
271
|
+
try {
|
|
272
|
+
const config = {
|
|
273
|
+
headers: {
|
|
274
|
+
Authorization: `Bearer ${this.apiToken}`,
|
|
275
|
+
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
276
|
+
'Content-disposition': 'attachment; filename=[file.csv]'
|
|
277
|
+
},
|
|
278
|
+
params: {
|
|
279
|
+
responseType: 'blob'
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
const queryParams = generateQueryParamsStr([
|
|
283
|
+
'fromDate',
|
|
284
|
+
'toDate',
|
|
285
|
+
'timezone'
|
|
286
|
+
], params);
|
|
287
|
+
return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/productSales/export?${queryParams}`, config);
|
|
288
|
+
} catch (error) {
|
|
289
|
+
console.error('Error fetching exportOrdersList:', error);
|
|
290
|
+
throw error;
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
export const exportPaymentLinesReport = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
295
|
+
fromDate?: string
|
|
296
|
+
toDate?: string
|
|
297
|
+
timezone?: string
|
|
298
|
+
}): Promise<any> {
|
|
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
|
+
'timezone'
|
|
314
|
+
], params);
|
|
315
|
+
return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/paymentLines/export?${queryParams}`, config);
|
|
316
|
+
} catch (error) {
|
|
317
|
+
console.error('Error fetching exportOrdersList:', error);
|
|
318
|
+
throw error;
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
export const exportUnpaidOrdersReportCSV = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
323
|
+
fromDate?: string
|
|
324
|
+
toDate?: string
|
|
325
|
+
timezone?: string
|
|
326
|
+
pageNum?: string
|
|
327
|
+
limit?: string
|
|
328
|
+
customerName?: string
|
|
329
|
+
}): Promise<any> {
|
|
330
|
+
try {
|
|
331
|
+
const config = {
|
|
332
|
+
headers: {
|
|
333
|
+
Authorization: `Bearer ${this.apiToken}`,
|
|
334
|
+
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
335
|
+
'Content-disposition': 'attachment; filename=[file.csv]'
|
|
336
|
+
},
|
|
337
|
+
params: {
|
|
338
|
+
responseType: 'blob'
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
const queryParams = generateQueryParamsStr([
|
|
342
|
+
'fromDate',
|
|
343
|
+
'toDate',
|
|
344
|
+
'pageNum',
|
|
345
|
+
'limit',
|
|
346
|
+
'timezone',
|
|
347
|
+
'customerName'
|
|
348
|
+
], params);
|
|
349
|
+
return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/paymentLines/export?${queryParams}`, config);
|
|
350
|
+
} catch (error) {
|
|
351
|
+
console.error('Error fetching exportOrdersList:', error);
|
|
352
|
+
throw error;
|
|
353
|
+
}
|
|
164
354
|
};
|
package/src/api/index.ts
CHANGED
|
@@ -228,7 +228,13 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
228
228
|
exportOrdersList: csvExportEndpoints.getModule.exportOrdersList,
|
|
229
229
|
exportProductsList: csvExportEndpoints.getModule.exportProductsList,
|
|
230
230
|
exportCleanedOrdersReport: csvExportEndpoints.getModule.exportCleanedOrdersReport,
|
|
231
|
-
exportSalesReport: csvExportEndpoints.getModule.exportSalesReport
|
|
231
|
+
exportSalesReport: csvExportEndpoints.getModule.exportSalesReport,
|
|
232
|
+
exportCustomersReport: csvExportEndpoints.getModule.exportCustomersReport,
|
|
233
|
+
exportSuppliesReport: csvExportEndpoints.getModule.exportSuppliesReport,
|
|
234
|
+
exportDiscountCodesReport: csvExportEndpoints.getModule.exportDiscountCodesReport,
|
|
235
|
+
exportProductSalesReport: csvExportEndpoints.getModule.exportProductSalesReport,
|
|
236
|
+
exportPaymentLinesReport: csvExportEndpoints.getModule.exportPaymentLinesReport,
|
|
237
|
+
exportUnpaidOrdersReportCSV: csvExportEndpoints.getModule.exportUnpaidOrdersReportCSV,
|
|
232
238
|
});
|
|
233
239
|
this.pdf = bindMethods(this, {
|
|
234
240
|
exportUnpaidOrdersReportPDF: pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF,
|
|
@@ -236,7 +242,14 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
236
242
|
this.reports = bindMethods(this, {
|
|
237
243
|
getCleanedOrdersReport: reportsExportEndpoints.getModule.getCleanedOrdersReport,
|
|
238
244
|
getCleanedOrdersGraphDataReport: reportsExportEndpoints.getModule.getCleanedOrdersGraphDataReport,
|
|
239
|
-
getSalesReport: reportsExportEndpoints.getModule.getSalesReport
|
|
245
|
+
getSalesReport: reportsExportEndpoints.getModule.getSalesReport,
|
|
246
|
+
getCustomersReport: reportsExportEndpoints.getModule.getCustomersReport,
|
|
247
|
+
getSuppliesReport: reportsExportEndpoints.getModule.getSuppliesReport,
|
|
248
|
+
getDiscountCodesReport: reportsExportEndpoints.getModule.getDiscountCodesReport,
|
|
249
|
+
getStaffReport: reportsExportEndpoints.getModule.getStaffReport,
|
|
250
|
+
getProductSalesReport: reportsExportEndpoints.getModule.getProductSalesReport,
|
|
251
|
+
getPaymentLinesReport: reportsExportEndpoints.getModule.getPaymentLinesReport,
|
|
252
|
+
getUnpaidOrdersReport: reportsExportEndpoints.getModule.getUnpaidOrdersReport,
|
|
240
253
|
});
|
|
241
254
|
} as any;
|
|
242
255
|
|
package/src/api/reports/get.ts
CHANGED
|
@@ -20,6 +20,7 @@ export const getCleanedOrdersReport = async function (this: WashdayClientInstanc
|
|
|
20
20
|
'fromDate',
|
|
21
21
|
'pageNum',
|
|
22
22
|
'limit',
|
|
23
|
+
'timezone',
|
|
23
24
|
'includeGraph',
|
|
24
25
|
], params);
|
|
25
26
|
return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/cleaned-orders?${queryParams}`, config);
|
|
@@ -72,3 +73,152 @@ export const getSalesReport = async function (this: WashdayClientInstance, store
|
|
|
72
73
|
throw error;
|
|
73
74
|
}
|
|
74
75
|
};
|
|
76
|
+
|
|
77
|
+
export const getCustomersReport = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
78
|
+
fromDate?: string
|
|
79
|
+
toDate?: string
|
|
80
|
+
}): Promise<any> {
|
|
81
|
+
try {
|
|
82
|
+
const config = {
|
|
83
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
84
|
+
};
|
|
85
|
+
const queryParams = generateQueryParamsStr([
|
|
86
|
+
'storeId',
|
|
87
|
+
'fromDate',
|
|
88
|
+
'toDate',
|
|
89
|
+
], params);
|
|
90
|
+
return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/customers?${queryParams}`, config);
|
|
91
|
+
} catch (error) {
|
|
92
|
+
console.error('Error fetching getCustomersReport:', error);
|
|
93
|
+
throw error;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const getSuppliesReport = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
98
|
+
fromDate?: string
|
|
99
|
+
toDate?: string
|
|
100
|
+
}): Promise<any> {
|
|
101
|
+
try {
|
|
102
|
+
const config = {
|
|
103
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
104
|
+
};
|
|
105
|
+
const queryParams = generateQueryParamsStr([
|
|
106
|
+
'storeId',
|
|
107
|
+
'fromDate',
|
|
108
|
+
'toDate',
|
|
109
|
+
], params);
|
|
110
|
+
return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/supplies?${queryParams}`, config);
|
|
111
|
+
} catch (error) {
|
|
112
|
+
console.error('Error fetching getSuppliesReport:', error);
|
|
113
|
+
throw error;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export const getDiscountCodesReport = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
118
|
+
}): Promise<any> {
|
|
119
|
+
try {
|
|
120
|
+
const config = {
|
|
121
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
122
|
+
};
|
|
123
|
+
const queryParams = generateQueryParamsStr([
|
|
124
|
+
], params);
|
|
125
|
+
return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/discountCodes?${queryParams}`, config);
|
|
126
|
+
} catch (error) {
|
|
127
|
+
console.error('Error fetching getDiscountCodesReport:', error);
|
|
128
|
+
throw error;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export const getStaffReport = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
133
|
+
fromDate?: string
|
|
134
|
+
toDate?: string
|
|
135
|
+
}): Promise<any> {
|
|
136
|
+
try {
|
|
137
|
+
const config = {
|
|
138
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
139
|
+
};
|
|
140
|
+
const queryParams = generateQueryParamsStr([
|
|
141
|
+
'storeId',
|
|
142
|
+
'fromDate',
|
|
143
|
+
'toDate',
|
|
144
|
+
], params);
|
|
145
|
+
return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/staff?${queryParams}`, config);
|
|
146
|
+
} catch (error) {
|
|
147
|
+
console.error('Error fetching getStaffReport:', error);
|
|
148
|
+
throw error;
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export const getProductSalesReport = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
153
|
+
fromDate?: string
|
|
154
|
+
toDate?: string
|
|
155
|
+
timezone?: string
|
|
156
|
+
}): Promise<any> {
|
|
157
|
+
try {
|
|
158
|
+
const config = {
|
|
159
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
160
|
+
};
|
|
161
|
+
const queryParams = generateQueryParamsStr([
|
|
162
|
+
'toDate',
|
|
163
|
+
'fromDate',
|
|
164
|
+
'timezone',
|
|
165
|
+
'type',
|
|
166
|
+
], params);
|
|
167
|
+
return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/productSales?${queryParams}`, config);
|
|
168
|
+
} catch (error) {
|
|
169
|
+
console.error('Error fetching getProductSalesReport:', error);
|
|
170
|
+
throw error;
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export const getPaymentLinesReport = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
175
|
+
fromDate?: string
|
|
176
|
+
toDate?: string
|
|
177
|
+
timezone?: string
|
|
178
|
+
pageNum?: string
|
|
179
|
+
limit?: string
|
|
180
|
+
}): Promise<any> {
|
|
181
|
+
try {
|
|
182
|
+
const config = {
|
|
183
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
184
|
+
};
|
|
185
|
+
const queryParams = generateQueryParamsStr([
|
|
186
|
+
'fromDate',
|
|
187
|
+
'toDate',
|
|
188
|
+
'pageNum',
|
|
189
|
+
'limit',
|
|
190
|
+
'timezone',
|
|
191
|
+
], params);
|
|
192
|
+
return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/paymentLines?${queryParams}`, config);
|
|
193
|
+
} catch (error) {
|
|
194
|
+
console.error('Error fetching getPaymentLinesReport:', error);
|
|
195
|
+
throw error;
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export const getUnpaidOrdersReport = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
200
|
+
fromDate?: string
|
|
201
|
+
toDate?: string
|
|
202
|
+
timezone?: string
|
|
203
|
+
pageNum?: string
|
|
204
|
+
limit?: string
|
|
205
|
+
customerName?: string
|
|
206
|
+
}): Promise<any> {
|
|
207
|
+
try {
|
|
208
|
+
const config = {
|
|
209
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
210
|
+
};
|
|
211
|
+
const queryParams = generateQueryParamsStr([
|
|
212
|
+
'fromDate',
|
|
213
|
+
'toDate',
|
|
214
|
+
'pageNum',
|
|
215
|
+
'limit',
|
|
216
|
+
'timezone',
|
|
217
|
+
'customerName'
|
|
218
|
+
], params);
|
|
219
|
+
return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/unpaidOrders?${queryParams}`, config);
|
|
220
|
+
} catch (error) {
|
|
221
|
+
console.error('Error fetching getUnpaidOrdersReport:', error);
|
|
222
|
+
throw error;
|
|
223
|
+
}
|
|
224
|
+
};
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -211,6 +211,12 @@ export interface WashdayClientInstance {
|
|
|
211
211
|
};
|
|
212
212
|
csv: {
|
|
213
213
|
exportCustomersList: typeof csvExportEndpoints.getModule.exportCustomersList;
|
|
214
|
+
exportCustomersReport: typeof csvExportEndpoints.getModule.exportCustomersReport;
|
|
215
|
+
exportSuppliesReport: typeof csvExportEndpoints.getModule.exportSuppliesReport;
|
|
216
|
+
exportDiscountCodesReport: typeof csvExportEndpoints.getModule.exportDiscountCodesReport;
|
|
217
|
+
exportProductSalesReport: typeof csvExportEndpoints.getModule.exportProductSalesReport;
|
|
218
|
+
exportPaymentLinesReport: typeof csvExportEndpoints.getModule.exportPaymentLinesReport;
|
|
219
|
+
exportUnpaidOrdersReportCSV: typeof csvExportEndpoints.getModule.exportUnpaidOrdersReportCSV;
|
|
214
220
|
};
|
|
215
221
|
pdf: {
|
|
216
222
|
exportUnpaidOrdersReportPDF: typeof pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF;
|
|
@@ -219,5 +225,12 @@ export interface WashdayClientInstance {
|
|
|
219
225
|
getCleanedOrdersReport: typeof reportsExportEndpoints.getModule.getCleanedOrdersReport;
|
|
220
226
|
getCleanedOrdersGraphDataReport: typeof reportsExportEndpoints.getModule.getCleanedOrdersGraphDataReport;
|
|
221
227
|
getSalesReport: typeof reportsExportEndpoints.getModule.getSalesReport;
|
|
228
|
+
getCustomersReport: typeof reportsExportEndpoints.getModule.getCustomersReport;
|
|
229
|
+
getSuppliesReport: typeof reportsExportEndpoints.getModule.getSuppliesReport;
|
|
230
|
+
getDiscountCodesReport: typeof reportsExportEndpoints.getModule.getDiscountCodesReport;
|
|
231
|
+
getStaffReport: typeof reportsExportEndpoints.getModule.getStaffReport;
|
|
232
|
+
getProductSalesReport: typeof reportsExportEndpoints.getModule.getProductSalesReport;
|
|
233
|
+
getPaymentLinesReport: typeof reportsExportEndpoints.getModule.getPaymentLinesReport;
|
|
234
|
+
getUnpaidOrdersReport: typeof reportsExportEndpoints.getModule.getUnpaidOrdersReport;
|
|
222
235
|
};
|
|
223
236
|
}
|