washday-sdk 1.6.16 → 1.6.18
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 +2 -0
- package/dist/api/reports/get.js +43 -0
- package/package.json +1 -1
- package/src/api/index.ts +3 -1
- package/src/api/reports/get.ts +52 -1
- package/src/interfaces/Api.ts +2 -0
package/dist/api/index.js
CHANGED
|
@@ -320,6 +320,8 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
|
|
|
320
320
|
getProductsStatistics: reportsExportEndpoints.getModule.getProductsStatistics,
|
|
321
321
|
getMonthSalesStatistics: reportsExportEndpoints.getModule.getMonthSalesStatistics,
|
|
322
322
|
getPopularDaysStatistics: reportsExportEndpoints.getModule.getPopularDaysStatistics,
|
|
323
|
+
getSupplyCostReport: reportsExportEndpoints.getModule.getSupplyCostReport,
|
|
324
|
+
exportSupplyCostReport: reportsExportEndpoints.getModule.exportSupplyCostReport,
|
|
323
325
|
});
|
|
324
326
|
this.partners = bindMethods(this, {
|
|
325
327
|
getPartners: partnersEndpoints.getModule.getPartners,
|
package/dist/api/reports/get.js
CHANGED
|
@@ -183,6 +183,49 @@ export const getPaymentLinesReport = function (storeId, params) {
|
|
|
183
183
|
}
|
|
184
184
|
});
|
|
185
185
|
};
|
|
186
|
+
export const getSupplyCostReport = function (params) {
|
|
187
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
188
|
+
try {
|
|
189
|
+
const config = {
|
|
190
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
191
|
+
};
|
|
192
|
+
const queryParams = generateQueryParamsStr([
|
|
193
|
+
'store',
|
|
194
|
+
'fromDate',
|
|
195
|
+
'toDate',
|
|
196
|
+
'supplyId',
|
|
197
|
+
'productId',
|
|
198
|
+
], params);
|
|
199
|
+
return yield this.axiosInstance.get(`${GET_SET_REPORTS}/supply-cost?${queryParams}`, config);
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
console.error('Error fetching getSupplyCostReport:', error);
|
|
203
|
+
throw error;
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
export const exportSupplyCostReport = function (params) {
|
|
208
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
209
|
+
try {
|
|
210
|
+
const config = {
|
|
211
|
+
headers: { Authorization: `Bearer ${this.apiToken}` },
|
|
212
|
+
responseType: 'blob'
|
|
213
|
+
};
|
|
214
|
+
const queryParams = generateQueryParamsStr([
|
|
215
|
+
'store',
|
|
216
|
+
'fromDate',
|
|
217
|
+
'toDate',
|
|
218
|
+
'supplyId',
|
|
219
|
+
'productId',
|
|
220
|
+
], params);
|
|
221
|
+
return yield this.axiosInstance.get(`${GET_SET_REPORTS}/supply-cost/export?${queryParams}`, config);
|
|
222
|
+
}
|
|
223
|
+
catch (error) {
|
|
224
|
+
console.error('Error fetching exportSupplyCostReport:', error);
|
|
225
|
+
throw error;
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
};
|
|
186
229
|
export const getUnpaidOrdersReport = function (storeId, params) {
|
|
187
230
|
return __awaiter(this, void 0, void 0, function* () {
|
|
188
231
|
try {
|
package/package.json
CHANGED
package/src/api/index.ts
CHANGED
|
@@ -327,6 +327,8 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
327
327
|
getProductsStatistics: reportsExportEndpoints.getModule.getProductsStatistics,
|
|
328
328
|
getMonthSalesStatistics: reportsExportEndpoints.getModule.getMonthSalesStatistics,
|
|
329
329
|
getPopularDaysStatistics: reportsExportEndpoints.getModule.getPopularDaysStatistics,
|
|
330
|
+
getSupplyCostReport: reportsExportEndpoints.getModule.getSupplyCostReport,
|
|
331
|
+
exportSupplyCostReport: reportsExportEndpoints.getModule.exportSupplyCostReport,
|
|
330
332
|
});
|
|
331
333
|
this.partners = bindMethods(this, {
|
|
332
334
|
getPartners: partnersEndpoints.getModule.getPartners,
|
|
@@ -374,4 +376,4 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
374
376
|
});
|
|
375
377
|
} as any;
|
|
376
378
|
|
|
377
|
-
export default WashdayClient;
|
|
379
|
+
export default WashdayClient;
|
package/src/api/reports/get.ts
CHANGED
|
@@ -196,6 +196,57 @@ export const getPaymentLinesReport = async function (this: WashdayClientInstance
|
|
|
196
196
|
}
|
|
197
197
|
};
|
|
198
198
|
|
|
199
|
+
export const getSupplyCostReport = async function (this: WashdayClientInstance, params: {
|
|
200
|
+
store?: string; // store id or "all"
|
|
201
|
+
fromDate?: string;
|
|
202
|
+
toDate?: string;
|
|
203
|
+
supplyId?: string;
|
|
204
|
+
productId?: string;
|
|
205
|
+
}): Promise<any> {
|
|
206
|
+
try {
|
|
207
|
+
const config = {
|
|
208
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
209
|
+
};
|
|
210
|
+
const queryParams = generateQueryParamsStr([
|
|
211
|
+
'store',
|
|
212
|
+
'fromDate',
|
|
213
|
+
'toDate',
|
|
214
|
+
'supplyId',
|
|
215
|
+
'productId',
|
|
216
|
+
], params);
|
|
217
|
+
return await this.axiosInstance.get(`${GET_SET_REPORTS}/supply-cost?${queryParams}`, config);
|
|
218
|
+
} catch (error) {
|
|
219
|
+
console.error('Error fetching getSupplyCostReport:', error);
|
|
220
|
+
throw error;
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
export const exportSupplyCostReport = async function (this: WashdayClientInstance, params: {
|
|
225
|
+
store?: string; // store id or "all"
|
|
226
|
+
fromDate?: string;
|
|
227
|
+
toDate?: string;
|
|
228
|
+
supplyId?: string;
|
|
229
|
+
productId?: string;
|
|
230
|
+
}): Promise<any> {
|
|
231
|
+
try {
|
|
232
|
+
const config = {
|
|
233
|
+
headers: { Authorization: `Bearer ${this.apiToken}` },
|
|
234
|
+
responseType: 'blob' as const
|
|
235
|
+
};
|
|
236
|
+
const queryParams = generateQueryParamsStr([
|
|
237
|
+
'store',
|
|
238
|
+
'fromDate',
|
|
239
|
+
'toDate',
|
|
240
|
+
'supplyId',
|
|
241
|
+
'productId',
|
|
242
|
+
], params);
|
|
243
|
+
return await this.axiosInstance.get(`${GET_SET_REPORTS}/supply-cost/export?${queryParams}`, config);
|
|
244
|
+
} catch (error) {
|
|
245
|
+
console.error('Error fetching exportSupplyCostReport:', error);
|
|
246
|
+
throw error;
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
|
|
199
250
|
export const getUnpaidOrdersReport = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
200
251
|
fromDate?: string
|
|
201
252
|
toDate?: string
|
|
@@ -370,4 +421,4 @@ export const getScheduledDeliveries = async function (this: WashdayClientInstanc
|
|
|
370
421
|
console.error('Error fetching getScheduledDeliveries:', error);
|
|
371
422
|
throw error;
|
|
372
423
|
}
|
|
373
|
-
};
|
|
424
|
+
};
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -312,6 +312,8 @@ export interface WashdayClientInstance {
|
|
|
312
312
|
getProductsStatistics: typeof reportsExportEndpoints.getModule.getProductsStatistics;
|
|
313
313
|
getMonthSalesStatistics: typeof reportsExportEndpoints.getModule.getMonthSalesStatistics;
|
|
314
314
|
getPopularDaysStatistics: typeof reportsExportEndpoints.getModule.getPopularDaysStatistics;
|
|
315
|
+
getSupplyCostReport: typeof reportsExportEndpoints.getModule.getSupplyCostReport;
|
|
316
|
+
exportSupplyCostReport: typeof reportsExportEndpoints.getModule.exportSupplyCostReport;
|
|
315
317
|
};
|
|
316
318
|
partners: {
|
|
317
319
|
getPartners: typeof partnersEndpoints.getModule.getPartners;
|