washday-sdk 0.0.104 → 0.0.105

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
@@ -13,7 +13,7 @@ import { deleteStoreStaffById } from "./staff/delete";
13
13
  import { getStoreStaff, getStoreStaffById } from "./staff/get";
14
14
  import { createStoreStaff } from "./staff/post";
15
15
  import { updateStoreStaffById } from "./staff/put";
16
- import { getStoreById, getStoreImages, getStoreReviewLink, getStores } from "./stores/get";
16
+ import { getStoreById, getStoreImages, getStoreReviewLink, getStores, getStoresByName } from "./stores/get";
17
17
  import { copyStore, createStore, createStoreImage } from "./stores/post";
18
18
  import { deleteStoreById, updateStoreById } from "./stores/put";
19
19
  import { createCFDISuscrptionCheckoutSession, createCreateSuscriptionCheckoutSession, createCustomerPortalSession, createGetMoreCheckoutSession } from "./stripe/post";
@@ -100,6 +100,7 @@ const WashdayClient = function WashdayClient(apiToken) {
100
100
  getStores: getStores,
101
101
  getStoreById: getStoreById,
102
102
  getStoreImages: getStoreImages,
103
+ getStoresByName: getStoresByName,
103
104
  createStore: createStore,
104
105
  copyStore: copyStore,
105
106
  updateStoreById: updateStoreById,
@@ -7,12 +7,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ import { generateQueryParamsStr } from "../../utils/apiUtils";
10
11
  import axiosInstance from "../axiosInstance";
11
12
  const GET_SET_STORES = 'api/store';
12
13
  const GET_SET_STORE_IMAGE = 'api/store-image';
13
14
  const REQUEST_PARAMS = {
14
15
  token: 'LOGGED_USER_TOKEN',
15
16
  };
17
+ const GET_STORES_WASHDAY_APP = 'api/v2/washdayapp/store';
16
18
  export const getStores = function (params) {
17
19
  return __awaiter(this, void 0, void 0, function* () {
18
20
  var _a, _b;
@@ -75,3 +77,18 @@ export const getStoreImages = function (storeId) {
75
77
  }
76
78
  });
77
79
  };
80
+ export const getStoresByName = function (query) {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ var _a, _b;
83
+ try {
84
+ const config = {};
85
+ const queryParams = generateQueryParamsStr(['q'], query);
86
+ const response = yield axiosInstance.get(`${GET_STORES_WASHDAY_APP}?${queryParams}`, config);
87
+ return ((_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.stores) || [];
88
+ }
89
+ catch (error) {
90
+ console.error('Error fetching getStoresByName:', error);
91
+ throw error;
92
+ }
93
+ });
94
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.104",
3
+ "version": "0.0.105",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
package/src/api/index.ts CHANGED
@@ -14,7 +14,7 @@ import { deleteStoreStaffById } from "./staff/delete";
14
14
  import { getStoreStaff, getStoreStaffById } from "./staff/get";
15
15
  import { createStoreStaff } from "./staff/post";
16
16
  import { updateStoreStaffById } from "./staff/put";
17
- import { getStoreById, getStoreImages, getStoreReviewLink, getStores } from "./stores/get";
17
+ import { getStoreById, getStoreImages, getStoreReviewLink, getStores, getStoresByName } from "./stores/get";
18
18
  import { copyStore, createStore, createStoreImage } from "./stores/post";
19
19
  import { deleteStoreById, updateStoreById } from "./stores/put";
20
20
  import { createCFDISuscrptionCheckoutSession, createCreateSuscriptionCheckoutSession, createCustomerPortalSession, createGetMoreCheckoutSession } from "./stripe/post";
@@ -106,6 +106,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
106
106
  getStores: getStores,
107
107
  getStoreById: getStoreById,
108
108
  getStoreImages: getStoreImages,
109
+ getStoresByName: getStoresByName,
109
110
  createStore: createStore,
110
111
  copyStore: copyStore,
111
112
  updateStoreById: updateStoreById,
@@ -1,5 +1,6 @@
1
1
  import { WashdayClientInstance } from "../../interfaces/Api";
2
2
  import { IStore } from "../../interfaces/Store";
3
+ import { generateQueryParamsStr } from "../../utils/apiUtils";
3
4
  import axiosInstance from "../axiosInstance";
4
5
 
5
6
  const GET_SET_STORES = 'api/store';
@@ -7,6 +8,7 @@ const GET_SET_STORE_IMAGE = 'api/store-image';
7
8
  const REQUEST_PARAMS = {
8
9
  token: 'LOGGED_USER_TOKEN',
9
10
  };
11
+ const GET_STORES_WASHDAY_APP = 'api/v2/washdayapp/store';
10
12
 
11
13
  export const getStores = async function (this: WashdayClientInstance, params: {
12
14
  isActive?: string
@@ -62,3 +64,17 @@ export const getStoreImages = async function (this: WashdayClientInstance, store
62
64
  throw error;
63
65
  }
64
66
  };
67
+
68
+ export const getStoresByName = async function (this: WashdayClientInstance, query: {
69
+ q?: string
70
+ }): Promise<{ stores: IStore[] }> {
71
+ try {
72
+ const config = {};
73
+ const queryParams = generateQueryParamsStr(['q'], query);
74
+ const response = await axiosInstance.get(`${GET_STORES_WASHDAY_APP}?${queryParams}`, config);
75
+ return response.data?.data?.stores || [];
76
+ } catch (error) {
77
+ console.error('Error fetching getStoresByName:', error);
78
+ throw error;
79
+ }
80
+ };
@@ -13,7 +13,7 @@ import { deleteStoreStaffById } from "../api/staff/delete";
13
13
  import { getStoreStaff, getStoreStaffById } from "../api/staff/get";
14
14
  import { createStoreStaff } from "../api/staff/post";
15
15
  import { updateStoreStaffById } from "../api/staff/put";
16
- import { getStoreById, getStoreImages, getStoreReviewLink, getStores } from "../api/stores/get";
16
+ import { getStoreById, getStoreImages, getStoreReviewLink, getStores, getStoresByName } from "../api/stores/get";
17
17
  import { copyStore, createStore, createStoreImage } from "../api/stores/post";
18
18
  import { deleteStoreById, updateStoreById } from "../api/stores/put";
19
19
  import { createCFDISuscrptionCheckoutSession, createCreateSuscriptionCheckoutSession, createCustomerPortalSession, createGetMoreCheckoutSession } from "../api/stripe/post";
@@ -92,6 +92,7 @@ export interface WashdayClientInstance {
92
92
  getStores: typeof getStores;
93
93
  getStoreById: typeof getStoreById;
94
94
  getStoreImages: typeof getStoreImages;
95
+ getStoresByName: typeof getStoresByName;
95
96
  createStore: typeof createStore;
96
97
  copyStore: typeof copyStore;
97
98
  updateStoreById: typeof updateStoreById;