washday-sdk 1.6.13 → 1.6.16

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.
@@ -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
@@ -12,7 +12,7 @@ import { deleteAutomaticDiscountById, deleteDiscountCodeById, updateAutomaticDis
12
12
  import { deleteStoreStaffById } from "./staff/delete";
13
13
  import { getStoreStaff, getStoreStaffById } from "./staff/get";
14
14
  import { createStoreStaff } from "./staff/post";
15
- import { updateStoreStaffById } from "./staff/put";
15
+ import { updateStoreStaffById, updateStoreStaffStores } from "./staff/put";
16
16
  import { getOrderSequence, getPaymentFees, getStoreById, getStoreImages, getStoreReviewLink, getStores, getStoresByIdCustomersApp, getStoresByName } from "./stores/get";
17
17
  import { copyStore, createStore, createStoreImage } from "./stores/post";
18
18
  import { deleteStoreById, setOrderSequence, updatePaymentFees, updateStoreById } from "./stores/put";
@@ -22,6 +22,7 @@ import { getSupplies, getSupplyById, getSupplyHistory } from "./supplies/get";
22
22
  import { createSupply } from "./supplies/post";
23
23
  import { addSupplyStock, updateSupplyById } from "./supplies/put";
24
24
  import { updateUserById } from "./users/put";
25
+ import { getUserStoreAccess } from "./users/get";
25
26
  import * as inventoryEndpoints from './inventory';
26
27
  import * as sectionsEndpoints from './sections';
27
28
  import * as productsEndpoints from './products';
@@ -137,6 +138,7 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
137
138
  getRedeemPointsPreview: ordersEndpoints.postModule.getRedeemPointsPreview,
138
139
  setOrderUncollected: ordersEndpoints.postModule.setOrderUncollected,
139
140
  payAndCollect: ordersEndpoints.postModule.payAndCollect,
141
+ sendOrderUncollectedCustomerNotification: ordersEndpoints.postModule.sendOrderUncollectedCustomerNotification,
140
142
  deletePaymentLineById: ordersEndpoints.deleteModule.deletePaymentLineById,
141
143
  getListCustomersApp: ordersEndpoints.getModule.getListCustomersApp,
142
144
  getByIdCustomersApp: ordersEndpoints.getModule.getByIdCustomersApp,
@@ -194,6 +196,7 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
194
196
  });
195
197
  this.users = bindMethods(this, {
196
198
  updateUserById: updateUserById,
199
+ getUserStoreAccess: getUserStoreAccess,
197
200
  deleteUserById: deleteUserById,
198
201
  validateUserPin: validateUserPin,
199
202
  });
@@ -258,6 +261,7 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
258
261
  getStoreStaff: getStoreStaff,
259
262
  getStoreStaffById: getStoreStaffById,
260
263
  updateStoreStaffById: updateStoreStaffById,
264
+ updateStoreStaffStores: updateStoreStaffStores,
261
265
  createStoreStaff: createStoreStaff,
262
266
  deleteStoreStaffById: deleteStoreStaffById,
263
267
  });
@@ -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
+ };
@@ -23,3 +23,18 @@ export const updateStoreStaffById = function (storeId, staffId, data) {
23
23
  }
24
24
  });
25
25
  };
26
+ export const updateStoreStaffStores = function (storeId, staffId, allowedStoreIds) {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ try {
29
+ const config = {
30
+ headers: { Authorization: `Bearer ${this.apiToken}` }
31
+ };
32
+ const response = yield this.axiosInstance.put(`${GET_SET_STAFF(storeId)}/${staffId}/stores`, { allowedStoreIds }, config);
33
+ return response;
34
+ }
35
+ catch (error) {
36
+ console.error('Error fetching updateStoreStaffStores:', error);
37
+ throw error;
38
+ }
39
+ });
40
+ };
@@ -0,0 +1,24 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ const GET_USER_STORE_ACCESS = (userId) => `api/users/${userId}/store-access`;
11
+ export const getUserStoreAccess = function (userId) {
12
+ return __awaiter(this, void 0, void 0, function* () {
13
+ try {
14
+ const config = {
15
+ headers: { Authorization: `Bearer ${this.apiToken}` }
16
+ };
17
+ return yield this.axiosInstance.get(GET_USER_STORE_ACCESS(userId), config);
18
+ }
19
+ catch (error) {
20
+ console.error('Error fetching getUserStoreAccess:', error);
21
+ throw error;
22
+ }
23
+ });
24
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "1.6.13",
3
+ "version": "1.6.16",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
package/src/api/index.ts CHANGED
@@ -13,7 +13,7 @@ import { deleteAutomaticDiscountById, deleteDiscountCodeById, updateAutomaticDis
13
13
  import { deleteStoreStaffById } from "./staff/delete";
14
14
  import { getStoreStaff, getStoreStaffById } from "./staff/get";
15
15
  import { createStoreStaff } from "./staff/post";
16
- import { updateStoreStaffById } from "./staff/put";
16
+ import { updateStoreStaffById, updateStoreStaffStores } from "./staff/put";
17
17
  import { getOrderSequence, getPaymentFees, getStoreById, getStoreImages, getStoreReviewLink, getStores, getStoresByIdCustomersApp, getStoresByName } from "./stores/get";
18
18
  import { copyStore, createStore, createStoreImage } from "./stores/post";
19
19
  import { deleteStoreById, setOrderSequence, updatePaymentFees, updateStoreById } from "./stores/put";
@@ -23,6 +23,7 @@ import { getSupplies, getSupplyById, getSupplyHistory } from "./supplies/get";
23
23
  import { createSupply } from "./supplies/post";
24
24
  import { addSupplyStock, updateSupplyById } from "./supplies/put";
25
25
  import { updateUserById } from "./users/put";
26
+ import { getUserStoreAccess } from "./users/get";
26
27
  import * as inventoryEndpoints from './inventory';
27
28
  import * as sectionsEndpoints from './sections';
28
29
  import * as productsEndpoints from './products';
@@ -144,6 +145,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
144
145
  getRedeemPointsPreview: ordersEndpoints.postModule.getRedeemPointsPreview,
145
146
  setOrderUncollected: ordersEndpoints.postModule.setOrderUncollected,
146
147
  payAndCollect: ordersEndpoints.postModule.payAndCollect,
148
+ sendOrderUncollectedCustomerNotification: ordersEndpoints.postModule.sendOrderUncollectedCustomerNotification,
147
149
  deletePaymentLineById: ordersEndpoints.deleteModule.deletePaymentLineById,
148
150
  getListCustomersApp: ordersEndpoints.getModule.getListCustomersApp,
149
151
  getByIdCustomersApp: ordersEndpoints.getModule.getByIdCustomersApp,
@@ -201,6 +203,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
201
203
  });
202
204
  this.users = bindMethods(this, {
203
205
  updateUserById: updateUserById,
206
+ getUserStoreAccess: getUserStoreAccess,
204
207
  deleteUserById: deleteUserById,
205
208
  validateUserPin: validateUserPin,
206
209
  });
@@ -265,6 +268,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
265
268
  getStoreStaff: getStoreStaff,
266
269
  getStoreStaffById: getStoreStaffById,
267
270
  updateStoreStaffById: updateStoreStaffById,
271
+ updateStoreStaffStores: updateStoreStaffStores,
268
272
  createStoreStaff: createStoreStaff,
269
273
  deleteStoreStaffById: deleteStoreStaffById,
270
274
  });
@@ -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 = {
@@ -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
  };
@@ -15,3 +15,17 @@ export const updateStoreStaffById = async function (this: WashdayClientInstance,
15
15
  throw error;
16
16
  }
17
17
  };
18
+
19
+ export const updateStoreStaffStores = async function (this: WashdayClientInstance, storeId: string, staffId: string, allowedStoreIds: string[]): Promise<any> {
20
+ try {
21
+ const config = {
22
+ headers: { Authorization: `Bearer ${this.apiToken}` }
23
+ };
24
+ const response = await this.axiosInstance.put(`${GET_SET_STAFF(storeId)}/${staffId}/stores`, { allowedStoreIds }, config);
25
+ return response;
26
+ } catch (error) {
27
+ console.error('Error fetching updateStoreStaffStores:', error);
28
+ throw error;
29
+ }
30
+ };
31
+
@@ -0,0 +1,15 @@
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+
3
+ const GET_USER_STORE_ACCESS = (userId: string) => `api/users/${userId}/store-access`;
4
+
5
+ export const getUserStoreAccess = async function (this: WashdayClientInstance, userId: string): Promise<any> {
6
+ try {
7
+ const config = {
8
+ headers: { Authorization: `Bearer ${this.apiToken}` }
9
+ };
10
+ return await this.axiosInstance.get(GET_USER_STORE_ACCESS(userId), config);
11
+ } catch (error) {
12
+ console.error('Error fetching getUserStoreAccess:', error);
13
+ throw error;
14
+ }
15
+ };
@@ -12,7 +12,7 @@ import { deleteAutomaticDiscountById, deleteDiscountCodeById, updateAutomaticDis
12
12
  import { deleteStoreStaffById } from "../api/staff/delete";
13
13
  import { getStoreStaff, getStoreStaffById } from "../api/staff/get";
14
14
  import { createStoreStaff } from "../api/staff/post";
15
- import { updateStoreStaffById } from "../api/staff/put";
15
+ import { updateStoreStaffById, updateStoreStaffStores } from "../api/staff/put";
16
16
  import { getOrderSequence, getPaymentFees, getStoreById, getStoreImages, getStoreReviewLink, getStores, getStoresByIdCustomersApp, getStoresByName } from "../api/stores/get";
17
17
  import { copyStore, createStore, createStoreImage } from "../api/stores/post";
18
18
  import { deleteStoreById, setOrderSequence, updatePaymentFees, updateStoreById } from "../api/stores/put";
@@ -22,6 +22,7 @@ import { getSupplies, getSupplyById, getSupplyHistory } from "../api/supplies/ge
22
22
  import { createSupply } from "../api/supplies/post";
23
23
  import { addSupplyStock, updateSupplyById } from "../api/supplies/put";
24
24
  import { updateUserById } from "../api/users/put";
25
+ import { getUserStoreAccess } from "../api/users/get";
25
26
  import * as inventoryEndpoints from '../api/inventory';
26
27
  import * as sectionsEndpoints from '../api/sections';
27
28
  import * as productsEndpoints from '../api/products';
@@ -129,6 +130,7 @@ export interface WashdayClientInstance {
129
130
  getRedeemPointsPreview: typeof ordersEndpoints.postModule.getRedeemPointsPreview,
130
131
  setOrderUncollected: typeof ordersEndpoints.postModule.setOrderUncollected,
131
132
  payAndCollect: typeof ordersEndpoints.postModule.payAndCollect,
133
+ sendOrderUncollectedCustomerNotification: typeof ordersEndpoints.postModule.sendOrderUncollectedCustomerNotification,
132
134
  deletePaymentLineById: typeof ordersEndpoints.deleteModule.deletePaymentLineById;
133
135
  getListCustomersApp: typeof ordersEndpoints.getModule.getListCustomersApp;
134
136
  getByIdCustomersApp: typeof ordersEndpoints.getModule.getByIdCustomersApp;
@@ -186,6 +188,7 @@ export interface WashdayClientInstance {
186
188
  };
187
189
  users: {
188
190
  updateUserById: typeof updateUserById;
191
+ getUserStoreAccess: typeof getUserStoreAccess;
189
192
  deleteUserById: typeof deleteUserById;
190
193
  validateUserPin: typeof validateUserPin;
191
194
  };
@@ -250,6 +253,7 @@ export interface WashdayClientInstance {
250
253
  getStoreStaff: typeof getStoreStaff;
251
254
  getStoreStaffById: typeof getStoreStaffById;
252
255
  updateStoreStaffById: typeof updateStoreStaffById;
256
+ updateStoreStaffStores: typeof updateStoreStaffStores;
253
257
  createStoreStaff: typeof createStoreStaff;
254
258
  deleteStoreStaffById: typeof deleteStoreStaffById;
255
259
  };