washday-sdk 1.6.13 → 1.6.15

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 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';
@@ -194,6 +195,7 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
194
195
  });
195
196
  this.users = bindMethods(this, {
196
197
  updateUserById: updateUserById,
198
+ getUserStoreAccess: getUserStoreAccess,
197
199
  deleteUserById: deleteUserById,
198
200
  validateUserPin: validateUserPin,
199
201
  });
@@ -258,6 +260,7 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
258
260
  getStoreStaff: getStoreStaff,
259
261
  getStoreStaffById: getStoreStaffById,
260
262
  updateStoreStaffById: updateStoreStaffById,
263
+ updateStoreStaffStores: updateStoreStaffStores,
261
264
  createStoreStaff: createStoreStaff,
262
265
  deleteStoreStaffById: deleteStoreStaffById,
263
266
  });
@@ -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.15",
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';
@@ -201,6 +202,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
201
202
  });
202
203
  this.users = bindMethods(this, {
203
204
  updateUserById: updateUserById,
205
+ getUserStoreAccess: getUserStoreAccess,
204
206
  deleteUserById: deleteUserById,
205
207
  validateUserPin: validateUserPin,
206
208
  });
@@ -265,6 +267,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
265
267
  getStoreStaff: getStoreStaff,
266
268
  getStoreStaffById: getStoreStaffById,
267
269
  updateStoreStaffById: updateStoreStaffById,
270
+ updateStoreStaffStores: updateStoreStaffStores,
268
271
  createStoreStaff: createStoreStaff,
269
272
  deleteStoreStaffById: deleteStoreStaffById,
270
273
  });
@@ -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';
@@ -186,6 +187,7 @@ export interface WashdayClientInstance {
186
187
  };
187
188
  users: {
188
189
  updateUserById: typeof updateUserById;
190
+ getUserStoreAccess: typeof getUserStoreAccess;
189
191
  deleteUserById: typeof deleteUserById;
190
192
  validateUserPin: typeof validateUserPin;
191
193
  };
@@ -250,6 +252,7 @@ export interface WashdayClientInstance {
250
252
  getStoreStaff: typeof getStoreStaff;
251
253
  getStoreStaffById: typeof getStoreStaffById;
252
254
  updateStoreStaffById: typeof updateStoreStaffById;
255
+ updateStoreStaffStores: typeof updateStoreStaffStores;
253
256
  createStoreStaff: typeof createStoreStaff;
254
257
  deleteStoreStaffById: typeof deleteStoreStaffById;
255
258
  };