washday-sdk 0.0.133 → 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.
@@ -145,3 +145,100 @@ 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
+ };
package/dist/api/index.js CHANGED
@@ -222,7 +222,10 @@ 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,
226
229
  });
227
230
  this.pdf = bindMethods(this, {
228
231
  exportUnpaidOrdersReportPDF: pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF,
@@ -230,7 +233,11 @@ const WashdayClient = function WashdayClient(apiToken) {
230
233
  this.reports = bindMethods(this, {
231
234
  getCleanedOrdersReport: reportsExportEndpoints.getModule.getCleanedOrdersReport,
232
235
  getCleanedOrdersGraphDataReport: reportsExportEndpoints.getModule.getCleanedOrdersGraphDataReport,
233
- getSalesReport: reportsExportEndpoints.getModule.getSalesReport
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,
234
241
  });
235
242
  };
236
243
  export default WashdayClient;
@@ -70,3 +70,75 @@ export const getSalesReport = function (storeId, params) {
70
70
  }
71
71
  });
72
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.133",
3
+ "version": "0.0.134",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -161,4 +161,103 @@ 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
+ }
164
263
  };
package/src/api/index.ts CHANGED
@@ -228,7 +228,10 @@ 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,
232
235
  });
233
236
  this.pdf = bindMethods(this, {
234
237
  exportUnpaidOrdersReportPDF: pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF,
@@ -236,7 +239,11 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
236
239
  this.reports = bindMethods(this, {
237
240
  getCleanedOrdersReport: reportsExportEndpoints.getModule.getCleanedOrdersReport,
238
241
  getCleanedOrdersGraphDataReport: reportsExportEndpoints.getModule.getCleanedOrdersGraphDataReport,
239
- getSalesReport: reportsExportEndpoints.getModule.getSalesReport
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,
240
247
  });
241
248
  } as any;
242
249
 
@@ -72,3 +72,78 @@ export const getSalesReport = async function (this: WashdayClientInstance, store
72
72
  throw error;
73
73
  }
74
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;
@@ -219,5 +222,9 @@ export interface WashdayClientInstance {
219
222
  getCleanedOrdersReport: typeof reportsExportEndpoints.getModule.getCleanedOrdersReport;
220
223
  getCleanedOrdersGraphDataReport: typeof reportsExportEndpoints.getModule.getCleanedOrdersGraphDataReport;
221
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;
222
229
  };
223
230
  }