washday-sdk 1.6.15 → 1.6.17
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/.github/workflows/bump-version-pr.yml +58 -0
- package/.github/workflows/publish-on-merge.yml +38 -0
- package/dist/api/index.js +2 -0
- package/dist/api/order/post.js +15 -0
- package/dist/api/reports/get.js +21 -0
- package/package.json +1 -1
- package/src/api/index.ts +3 -1
- package/src/api/integrations/post.ts +5 -0
- package/src/api/order/post.ts +17 -0
- package/src/api/reports/get.ts +26 -1
- package/src/interfaces/Api.ts +2 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
name: Bump Version on PR
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened, synchronize, reopened]
|
|
6
|
+
branches:
|
|
7
|
+
- main
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: write
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
bump-version:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
if: github.event.pull_request.base.ref == 'main'
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout repository
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
with:
|
|
20
|
+
ref: ${{ github.head_ref }}
|
|
21
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
22
|
+
|
|
23
|
+
- name: Use Node.js 22
|
|
24
|
+
uses: actions/setup-node@v4
|
|
25
|
+
with:
|
|
26
|
+
node-version: 22
|
|
27
|
+
|
|
28
|
+
- name: Configure git identity
|
|
29
|
+
run: |
|
|
30
|
+
git config --global user.name "washday-bot"
|
|
31
|
+
git config --global user.email "ci@washday.dev"
|
|
32
|
+
|
|
33
|
+
- name: Fetch main branch
|
|
34
|
+
run: git fetch origin main:main
|
|
35
|
+
|
|
36
|
+
- name: Check if version already bumped
|
|
37
|
+
id: check_version
|
|
38
|
+
run: |
|
|
39
|
+
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
|
40
|
+
git show main:package.json > /tmp/main-package.json
|
|
41
|
+
MAIN_VERSION=$(node -p "require('/tmp/main-package.json').version")
|
|
42
|
+
echo "Current PR version: $CURRENT_VERSION"
|
|
43
|
+
echo "Main branch version: $MAIN_VERSION"
|
|
44
|
+
if [ "$CURRENT_VERSION" != "$MAIN_VERSION" ]; then
|
|
45
|
+
echo "already_bumped=true" >> $GITHUB_OUTPUT
|
|
46
|
+
echo "✅ Version already bumped in this PR"
|
|
47
|
+
else
|
|
48
|
+
echo "already_bumped=false" >> $GITHUB_OUTPUT
|
|
49
|
+
echo "⚠️ Version needs bumping"
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
- name: Bump version patch
|
|
53
|
+
if: steps.check_version.outputs.already_bumped == 'false'
|
|
54
|
+
run: |
|
|
55
|
+
npm version patch --no-git-tag-version
|
|
56
|
+
git add package.json package-lock.json
|
|
57
|
+
git commit -m "chore: bump version [skip ci]"
|
|
58
|
+
git push origin ${{ github.head_ref }}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: Publish SDK on Merge
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
id-token: write # Required for OIDC
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
publish:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
environment: publish
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Use Node.js 22
|
|
21
|
+
uses: actions/setup-node@v4
|
|
22
|
+
with:
|
|
23
|
+
node-version: 22
|
|
24
|
+
|
|
25
|
+
- name: Update npm to latest
|
|
26
|
+
run: npm install -g npm@latest
|
|
27
|
+
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: npm ci
|
|
30
|
+
|
|
31
|
+
- name: Clear NODE_AUTH_TOKEN for OIDC
|
|
32
|
+
run: |
|
|
33
|
+
unset NODE_AUTH_TOKEN || true
|
|
34
|
+
|
|
35
|
+
- name: Build and publish
|
|
36
|
+
run: npm run build && npm publish --access public --no-provenance --verbose
|
|
37
|
+
env:
|
|
38
|
+
NODE_AUTH_TOKEN: ""
|
package/dist/api/index.js
CHANGED
|
@@ -138,6 +138,7 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
|
|
|
138
138
|
getRedeemPointsPreview: ordersEndpoints.postModule.getRedeemPointsPreview,
|
|
139
139
|
setOrderUncollected: ordersEndpoints.postModule.setOrderUncollected,
|
|
140
140
|
payAndCollect: ordersEndpoints.postModule.payAndCollect,
|
|
141
|
+
sendOrderUncollectedCustomerNotification: ordersEndpoints.postModule.sendOrderUncollectedCustomerNotification,
|
|
141
142
|
deletePaymentLineById: ordersEndpoints.deleteModule.deletePaymentLineById,
|
|
142
143
|
getListCustomersApp: ordersEndpoints.getModule.getListCustomersApp,
|
|
143
144
|
getByIdCustomersApp: ordersEndpoints.getModule.getByIdCustomersApp,
|
|
@@ -319,6 +320,7 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
|
|
|
319
320
|
getProductsStatistics: reportsExportEndpoints.getModule.getProductsStatistics,
|
|
320
321
|
getMonthSalesStatistics: reportsExportEndpoints.getModule.getMonthSalesStatistics,
|
|
321
322
|
getPopularDaysStatistics: reportsExportEndpoints.getModule.getPopularDaysStatistics,
|
|
323
|
+
getSupplyCostReport: reportsExportEndpoints.getModule.getSupplyCostReport,
|
|
322
324
|
});
|
|
323
325
|
this.partners = bindMethods(this, {
|
|
324
326
|
getPartners: partnersEndpoints.getModule.getPartners,
|
package/dist/api/order/post.js
CHANGED
|
@@ -11,6 +11,7 @@ const GET_SET_ORDER_PAYMENTLINES = (orderId) => `/api/v2/order/${orderId}/paymen
|
|
|
11
11
|
const GET_SET_ORDER = 'api/v2/order';
|
|
12
12
|
const GET_SET_ORDER_CUSTOMERS_APP = 'api/v2/washdayapp/orders';
|
|
13
13
|
const PAY_AND_COLLECT = (sequence, storeId) => `/api/v2/order/${sequence}/${storeId}/pay-and-collect`;
|
|
14
|
+
const SEND_UNCOLLECTED_CUSTOMER_NOTIFICATION = (orderId) => `/api/v2/order/${orderId}/send-uncollected-customer-notification`;
|
|
14
15
|
export const createPaymentLine = function (id, data) {
|
|
15
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
17
|
try {
|
|
@@ -150,3 +151,17 @@ export const payAndCollect = function (params) {
|
|
|
150
151
|
}
|
|
151
152
|
});
|
|
152
153
|
};
|
|
154
|
+
export const sendOrderUncollectedCustomerNotification = function (orderId) {
|
|
155
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
156
|
+
try {
|
|
157
|
+
const config = {
|
|
158
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
159
|
+
};
|
|
160
|
+
return yield this.axiosInstance.post(SEND_UNCOLLECTED_CUSTOMER_NOTIFICATION(orderId), {}, config);
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
console.error('Error fetching sendOrderUncollectedCustomerNotification:', error);
|
|
164
|
+
throw error;
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
};
|
package/dist/api/reports/get.js
CHANGED
|
@@ -183,6 +183,27 @@ 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
|
+
};
|
|
186
207
|
export const getUnpaidOrdersReport = function (storeId, params) {
|
|
187
208
|
return __awaiter(this, void 0, void 0, function* () {
|
|
188
209
|
try {
|
package/package.json
CHANGED
package/src/api/index.ts
CHANGED
|
@@ -145,6 +145,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
145
145
|
getRedeemPointsPreview: ordersEndpoints.postModule.getRedeemPointsPreview,
|
|
146
146
|
setOrderUncollected: ordersEndpoints.postModule.setOrderUncollected,
|
|
147
147
|
payAndCollect: ordersEndpoints.postModule.payAndCollect,
|
|
148
|
+
sendOrderUncollectedCustomerNotification: ordersEndpoints.postModule.sendOrderUncollectedCustomerNotification,
|
|
148
149
|
deletePaymentLineById: ordersEndpoints.deleteModule.deletePaymentLineById,
|
|
149
150
|
getListCustomersApp: ordersEndpoints.getModule.getListCustomersApp,
|
|
150
151
|
getByIdCustomersApp: ordersEndpoints.getModule.getByIdCustomersApp,
|
|
@@ -326,6 +327,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
326
327
|
getProductsStatistics: reportsExportEndpoints.getModule.getProductsStatistics,
|
|
327
328
|
getMonthSalesStatistics: reportsExportEndpoints.getModule.getMonthSalesStatistics,
|
|
328
329
|
getPopularDaysStatistics: reportsExportEndpoints.getModule.getPopularDaysStatistics,
|
|
330
|
+
getSupplyCostReport: reportsExportEndpoints.getModule.getSupplyCostReport,
|
|
329
331
|
});
|
|
330
332
|
this.partners = bindMethods(this, {
|
|
331
333
|
getPartners: partnersEndpoints.getModule.getPartners,
|
|
@@ -373,4 +375,4 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
373
375
|
});
|
|
374
376
|
} as any;
|
|
375
377
|
|
|
376
|
-
export default WashdayClient;
|
|
378
|
+
export default WashdayClient;
|
|
@@ -90,6 +90,11 @@ export const createMPAttempt = async function (this: WashdayClientInstance, data
|
|
|
90
90
|
storeId: string;
|
|
91
91
|
terminalId: string;
|
|
92
92
|
cashierBoxId: string;
|
|
93
|
+
pinUserId?: string;
|
|
94
|
+
// DO WE NEED THIS NEXT 3?
|
|
95
|
+
print_on_terminal?: 'no_ticket' | 'seller_ticket';
|
|
96
|
+
clientRequestId?: string;
|
|
97
|
+
description?: string;
|
|
93
98
|
}): Promise<any> {
|
|
94
99
|
try {
|
|
95
100
|
const config = {
|
package/src/api/order/post.ts
CHANGED
|
@@ -7,6 +7,7 @@ const GET_SET_ORDER_PAYMENTLINES = (orderId: string) => `/api/v2/order/${orderId
|
|
|
7
7
|
const GET_SET_ORDER = 'api/v2/order';
|
|
8
8
|
const GET_SET_ORDER_CUSTOMERS_APP = 'api/v2/washdayapp/orders';
|
|
9
9
|
const PAY_AND_COLLECT = (sequence: string, storeId: string) => `/api/v2/order/${sequence}/${storeId}/pay-and-collect`;
|
|
10
|
+
const SEND_UNCOLLECTED_CUSTOMER_NOTIFICATION = (orderId: string) => `/api/v2/order/${orderId}/send-uncollected-customer-notification`;
|
|
10
11
|
|
|
11
12
|
export const createPaymentLine = async function (this: WashdayClientInstance, id: string, data: {
|
|
12
13
|
amountPaid: number,
|
|
@@ -169,4 +170,20 @@ export const payAndCollect = async function (this: WashdayClientInstance, params
|
|
|
169
170
|
console.error('Error fetching payAndCollect:', error);
|
|
170
171
|
throw error;
|
|
171
172
|
}
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export const sendOrderUncollectedCustomerNotification = async function (this: WashdayClientInstance, orderId: string): Promise<AxiosResponse<any, any>> {
|
|
176
|
+
try {
|
|
177
|
+
const config = {
|
|
178
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
179
|
+
};
|
|
180
|
+
return await this.axiosInstance.post(
|
|
181
|
+
SEND_UNCOLLECTED_CUSTOMER_NOTIFICATION(orderId),
|
|
182
|
+
{},
|
|
183
|
+
config
|
|
184
|
+
);
|
|
185
|
+
} catch (error) {
|
|
186
|
+
console.error('Error fetching sendOrderUncollectedCustomerNotification:', error);
|
|
187
|
+
throw error;
|
|
188
|
+
}
|
|
172
189
|
};
|
package/src/api/reports/get.ts
CHANGED
|
@@ -196,6 +196,31 @@ 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
|
+
|
|
199
224
|
export const getUnpaidOrdersReport = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
200
225
|
fromDate?: string
|
|
201
226
|
toDate?: string
|
|
@@ -370,4 +395,4 @@ export const getScheduledDeliveries = async function (this: WashdayClientInstanc
|
|
|
370
395
|
console.error('Error fetching getScheduledDeliveries:', error);
|
|
371
396
|
throw error;
|
|
372
397
|
}
|
|
373
|
-
};
|
|
398
|
+
};
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -130,6 +130,7 @@ export interface WashdayClientInstance {
|
|
|
130
130
|
getRedeemPointsPreview: typeof ordersEndpoints.postModule.getRedeemPointsPreview,
|
|
131
131
|
setOrderUncollected: typeof ordersEndpoints.postModule.setOrderUncollected,
|
|
132
132
|
payAndCollect: typeof ordersEndpoints.postModule.payAndCollect,
|
|
133
|
+
sendOrderUncollectedCustomerNotification: typeof ordersEndpoints.postModule.sendOrderUncollectedCustomerNotification,
|
|
133
134
|
deletePaymentLineById: typeof ordersEndpoints.deleteModule.deletePaymentLineById;
|
|
134
135
|
getListCustomersApp: typeof ordersEndpoints.getModule.getListCustomersApp;
|
|
135
136
|
getByIdCustomersApp: typeof ordersEndpoints.getModule.getByIdCustomersApp;
|
|
@@ -311,6 +312,7 @@ export interface WashdayClientInstance {
|
|
|
311
312
|
getProductsStatistics: typeof reportsExportEndpoints.getModule.getProductsStatistics;
|
|
312
313
|
getMonthSalesStatistics: typeof reportsExportEndpoints.getModule.getMonthSalesStatistics;
|
|
313
314
|
getPopularDaysStatistics: typeof reportsExportEndpoints.getModule.getPopularDaysStatistics;
|
|
315
|
+
getSupplyCostReport: typeof reportsExportEndpoints.getModule.getSupplyCostReport;
|
|
314
316
|
};
|
|
315
317
|
partners: {
|
|
316
318
|
getPartners: typeof partnersEndpoints.getModule.getPartners;
|