washday-sdk 0.0.132 → 0.0.134

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.
@@ -118,3 +118,127 @@ export const exportCleanedOrdersReport = function (storeId, params) {
118
118
  }
119
119
  });
120
120
  };
121
+ export const exportSalesReport = function (storeId, params) {
122
+ return __awaiter(this, void 0, void 0, function* () {
123
+ try {
124
+ const config = {
125
+ headers: {
126
+ Authorization: `Bearer ${this.apiToken}`,
127
+ 'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
128
+ 'Content-disposition': 'attachment; filename=[file.csv]'
129
+ },
130
+ params: {
131
+ responseType: 'blob'
132
+ }
133
+ };
134
+ const queryParams = generateQueryParamsStr([
135
+ 'fromDate',
136
+ 'toDate',
137
+ 'timezone',
138
+ 'type'
139
+ ], params);
140
+ return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/sales/export?${queryParams}`, config);
141
+ }
142
+ catch (error) {
143
+ console.error('Error fetching exportOrdersList:', error);
144
+ throw error;
145
+ }
146
+ });
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
+ };
package/dist/api/index.js CHANGED
@@ -221,14 +221,23 @@ const WashdayClient = function WashdayClient(apiToken) {
221
221
  exportCustomersList: csvExportEndpoints.getModule.exportCustomersList,
222
222
  exportOrdersList: csvExportEndpoints.getModule.exportOrdersList,
223
223
  exportProductsList: csvExportEndpoints.getModule.exportProductsList,
224
- exportCleanedOrdersReport: csvExportEndpoints.getModule.exportCleanedOrdersReport
224
+ exportCleanedOrdersReport: csvExportEndpoints.getModule.exportCleanedOrdersReport,
225
+ exportSalesReport: csvExportEndpoints.getModule.exportSalesReport,
226
+ exportCustomersReport: csvExportEndpoints.getModule.exportCustomersReport,
227
+ exportSuppliesReport: csvExportEndpoints.getModule.exportSuppliesReport,
228
+ exportDiscountCodesReport: csvExportEndpoints.getModule.exportDiscountCodesReport,
225
229
  });
226
230
  this.pdf = bindMethods(this, {
227
231
  exportUnpaidOrdersReportPDF: pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF,
228
232
  });
229
233
  this.reports = bindMethods(this, {
230
234
  getCleanedOrdersReport: reportsExportEndpoints.getModule.getCleanedOrdersReport,
231
- getCleanedOrdersGraphDataReport: reportsExportEndpoints.getModule.getCleanedOrdersGraphDataReport
235
+ getCleanedOrdersGraphDataReport: reportsExportEndpoints.getModule.getCleanedOrdersGraphDataReport,
236
+ getSalesReport: reportsExportEndpoints.getModule.getSalesReport,
237
+ getCustomersReport: reportsExportEndpoints.getModule.getCustomersReport,
238
+ getSuppliesReport: reportsExportEndpoints.getModule.getSuppliesReport,
239
+ getDiscountCodesReport: reportsExportEndpoints.getModule.getDiscountCodesReport,
240
+ getStaffReport: reportsExportEndpoints.getModule.getStaffReport,
232
241
  });
233
242
  };
234
243
  export default WashdayClient;
@@ -50,3 +50,95 @@ export const getCleanedOrdersGraphDataReport = function (storeId, params) {
50
50
  }
51
51
  });
52
52
  };
53
+ export const getSalesReport = function (storeId, params) {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ try {
56
+ const config = {
57
+ headers: { Authorization: `Bearer ${this.apiToken}` }
58
+ };
59
+ const queryParams = generateQueryParamsStr([
60
+ 'toDate',
61
+ 'fromDate',
62
+ 'timezone',
63
+ 'type',
64
+ ], params);
65
+ return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/sales?${queryParams}`, config);
66
+ }
67
+ catch (error) {
68
+ console.error('Error fetching getSalesReport:', error);
69
+ throw error;
70
+ }
71
+ });
72
+ };
73
+ export const getCustomersReport = function (storeId, params) {
74
+ return __awaiter(this, void 0, void 0, function* () {
75
+ try {
76
+ const config = {
77
+ headers: { Authorization: `Bearer ${this.apiToken}` }
78
+ };
79
+ const queryParams = generateQueryParamsStr([
80
+ 'storeId',
81
+ 'fromDate',
82
+ 'toDate',
83
+ ], params);
84
+ return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/customers?${queryParams}`, config);
85
+ }
86
+ catch (error) {
87
+ console.error('Error fetching getCustomersReport:', error);
88
+ throw error;
89
+ }
90
+ });
91
+ };
92
+ export const getSuppliesReport = function (storeId, params) {
93
+ return __awaiter(this, void 0, void 0, function* () {
94
+ try {
95
+ const config = {
96
+ headers: { Authorization: `Bearer ${this.apiToken}` }
97
+ };
98
+ const queryParams = generateQueryParamsStr([
99
+ 'storeId',
100
+ 'fromDate',
101
+ 'toDate',
102
+ ], params);
103
+ return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/supplies?${queryParams}`, config);
104
+ }
105
+ catch (error) {
106
+ console.error('Error fetching getSuppliesReport:', error);
107
+ throw error;
108
+ }
109
+ });
110
+ };
111
+ export const getDiscountCodesReport = function (storeId, params) {
112
+ return __awaiter(this, void 0, void 0, function* () {
113
+ try {
114
+ const config = {
115
+ headers: { Authorization: `Bearer ${this.apiToken}` }
116
+ };
117
+ const queryParams = generateQueryParamsStr([], params);
118
+ return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/discountCodes?${queryParams}`, config);
119
+ }
120
+ catch (error) {
121
+ console.error('Error fetching getDiscountCodesReport:', error);
122
+ throw error;
123
+ }
124
+ });
125
+ };
126
+ export const getStaffReport = function (storeId, params) {
127
+ return __awaiter(this, void 0, void 0, function* () {
128
+ try {
129
+ const config = {
130
+ headers: { Authorization: `Bearer ${this.apiToken}` }
131
+ };
132
+ const queryParams = generateQueryParamsStr([
133
+ 'storeId',
134
+ 'fromDate',
135
+ 'toDate',
136
+ ], params);
137
+ return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/staff?${queryParams}`, config);
138
+ }
139
+ catch (error) {
140
+ console.error('Error fetching getStaffReport:', error);
141
+ throw error;
142
+ }
143
+ });
144
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.132",
3
+ "version": "0.0.134",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -131,4 +131,133 @@ export const exportCleanedOrdersReport = async function (this: WashdayClientInst
131
131
  console.error('Error fetching exportOrdersList:', error);
132
132
  throw error;
133
133
  }
134
+ };
135
+
136
+ export const exportSalesReport = async function (this: WashdayClientInstance, storeId: string, params: {
137
+ fromDate?: string
138
+ toDate?: string
139
+ timezone?: string
140
+ type: "daily" | "month" | "year";
141
+ }): Promise<any> {
142
+ try {
143
+ const config = {
144
+ headers: {
145
+ Authorization: `Bearer ${this.apiToken}`,
146
+ 'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
147
+ 'Content-disposition': 'attachment; filename=[file.csv]'
148
+ },
149
+ params: {
150
+ responseType: 'blob'
151
+ }
152
+ };
153
+ const queryParams = generateQueryParamsStr([
154
+ 'fromDate',
155
+ 'toDate',
156
+ 'timezone',
157
+ 'type'
158
+ ], params);
159
+ return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/sales/export?${queryParams}`, config);
160
+ } catch (error) {
161
+ console.error('Error fetching exportOrdersList:', error);
162
+ throw error;
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
+ }
134
263
  };
package/src/api/index.ts CHANGED
@@ -227,14 +227,23 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
227
227
  exportCustomersList: csvExportEndpoints.getModule.exportCustomersList,
228
228
  exportOrdersList: csvExportEndpoints.getModule.exportOrdersList,
229
229
  exportProductsList: csvExportEndpoints.getModule.exportProductsList,
230
- exportCleanedOrdersReport: csvExportEndpoints.getModule.exportCleanedOrdersReport
230
+ exportCleanedOrdersReport: csvExportEndpoints.getModule.exportCleanedOrdersReport,
231
+ exportSalesReport: csvExportEndpoints.getModule.exportSalesReport,
232
+ exportCustomersReport: csvExportEndpoints.getModule.exportCustomersReport,
233
+ exportSuppliesReport: csvExportEndpoints.getModule.exportSuppliesReport,
234
+ exportDiscountCodesReport: csvExportEndpoints.getModule.exportDiscountCodesReport,
231
235
  });
232
236
  this.pdf = bindMethods(this, {
233
237
  exportUnpaidOrdersReportPDF: pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF,
234
238
  });
235
239
  this.reports = bindMethods(this, {
236
240
  getCleanedOrdersReport: reportsExportEndpoints.getModule.getCleanedOrdersReport,
237
- getCleanedOrdersGraphDataReport: reportsExportEndpoints.getModule.getCleanedOrdersGraphDataReport
241
+ getCleanedOrdersGraphDataReport: reportsExportEndpoints.getModule.getCleanedOrdersGraphDataReport,
242
+ getSalesReport: reportsExportEndpoints.getModule.getSalesReport,
243
+ getCustomersReport: reportsExportEndpoints.getModule.getCustomersReport,
244
+ getSuppliesReport: reportsExportEndpoints.getModule.getSuppliesReport,
245
+ getDiscountCodesReport: reportsExportEndpoints.getModule.getDiscountCodesReport,
246
+ getStaffReport: reportsExportEndpoints.getModule.getStaffReport,
238
247
  });
239
248
  } as any;
240
249
 
@@ -50,3 +50,100 @@ export const getCleanedOrdersGraphDataReport = async function (this: WashdayClie
50
50
  }
51
51
  };
52
52
 
53
+ export const getSalesReport = async function (this: WashdayClientInstance, storeId: string, params: {
54
+ fromDate?: string
55
+ toDate?: string
56
+ timezone?: string
57
+ type: "daily" | "month" | "year";
58
+ }): Promise<any> {
59
+ try {
60
+ const config = {
61
+ headers: { Authorization: `Bearer ${this.apiToken}` }
62
+ };
63
+ const queryParams = generateQueryParamsStr([
64
+ 'toDate',
65
+ 'fromDate',
66
+ 'timezone',
67
+ 'type',
68
+ ], params);
69
+ return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/sales?${queryParams}`, config);
70
+ } catch (error) {
71
+ console.error('Error fetching getSalesReport:', error);
72
+ throw error;
73
+ }
74
+ };
75
+
76
+ export const getCustomersReport = async function (this: WashdayClientInstance, storeId: string, params: {
77
+ fromDate?: string
78
+ toDate?: string
79
+ }): Promise<any> {
80
+ try {
81
+ const config = {
82
+ headers: { Authorization: `Bearer ${this.apiToken}` }
83
+ };
84
+ const queryParams = generateQueryParamsStr([
85
+ 'storeId',
86
+ 'fromDate',
87
+ 'toDate',
88
+ ], params);
89
+ return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/customers?${queryParams}`, config);
90
+ } catch (error) {
91
+ console.error('Error fetching getCustomersReport:', error);
92
+ throw error;
93
+ }
94
+ };
95
+
96
+ export const getSuppliesReport = async function (this: WashdayClientInstance, storeId: string, params: {
97
+ fromDate?: string
98
+ toDate?: string
99
+ }): Promise<any> {
100
+ try {
101
+ const config = {
102
+ headers: { Authorization: `Bearer ${this.apiToken}` }
103
+ };
104
+ const queryParams = generateQueryParamsStr([
105
+ 'storeId',
106
+ 'fromDate',
107
+ 'toDate',
108
+ ], params);
109
+ return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/supplies?${queryParams}`, config);
110
+ } catch (error) {
111
+ console.error('Error fetching getSuppliesReport:', error);
112
+ throw error;
113
+ }
114
+ };
115
+
116
+ export const getDiscountCodesReport = async function (this: WashdayClientInstance, storeId: string, params: {
117
+ }): Promise<any> {
118
+ try {
119
+ const config = {
120
+ headers: { Authorization: `Bearer ${this.apiToken}` }
121
+ };
122
+ const queryParams = generateQueryParamsStr([
123
+ ], params);
124
+ return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/discountCodes?${queryParams}`, config);
125
+ } catch (error) {
126
+ console.error('Error fetching getDiscountCodesReport:', error);
127
+ throw error;
128
+ }
129
+ };
130
+
131
+ export const getStaffReport = async function (this: WashdayClientInstance, storeId: string, params: {
132
+ fromDate?: string
133
+ toDate?: string
134
+ }): Promise<any> {
135
+ try {
136
+ const config = {
137
+ headers: { Authorization: `Bearer ${this.apiToken}` }
138
+ };
139
+ const queryParams = generateQueryParamsStr([
140
+ 'storeId',
141
+ 'fromDate',
142
+ 'toDate',
143
+ ], params);
144
+ return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/staff?${queryParams}`, config);
145
+ } catch (error) {
146
+ console.error('Error fetching getStaffReport:', error);
147
+ throw error;
148
+ }
149
+ };
@@ -211,6 +211,9 @@ 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;
214
217
  };
215
218
  pdf: {
216
219
  exportUnpaidOrdersReportPDF: typeof pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF;
@@ -218,5 +221,10 @@ export interface WashdayClientInstance {
218
221
  reports: {
219
222
  getCleanedOrdersReport: typeof reportsExportEndpoints.getModule.getCleanedOrdersReport;
220
223
  getCleanedOrdersGraphDataReport: typeof reportsExportEndpoints.getModule.getCleanedOrdersGraphDataReport;
224
+ getSalesReport: typeof reportsExportEndpoints.getModule.getSalesReport;
225
+ getCustomersReport: typeof reportsExportEndpoints.getModule.getCustomersReport;
226
+ getSuppliesReport: typeof reportsExportEndpoints.getModule.getSuppliesReport;
227
+ getDiscountCodesReport: typeof reportsExportEndpoints.getModule.getDiscountCodesReport;
228
+ getStaffReport: typeof reportsExportEndpoints.getModule.getStaffReport;
221
229
  };
222
230
  }