@explorins/pers-sdk-react-native 1.3.2 → 1.5.1

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.
Files changed (90) hide show
  1. package/README.md +276 -123
  2. package/dist/hooks/index.d.ts +8 -0
  3. package/dist/hooks/index.d.ts.map +1 -1
  4. package/dist/hooks/index.js +7 -0
  5. package/dist/hooks/useAnalytics.d.ts +96 -0
  6. package/dist/hooks/useAnalytics.d.ts.map +1 -0
  7. package/dist/hooks/useAnalytics.js +73 -0
  8. package/dist/hooks/useAuth.d.ts +52 -7
  9. package/dist/hooks/useAuth.d.ts.map +1 -1
  10. package/dist/hooks/useAuth.js +250 -3
  11. package/dist/hooks/useBusiness.d.ts +45 -3
  12. package/dist/hooks/useBusiness.d.ts.map +1 -1
  13. package/dist/hooks/useBusiness.js +182 -28
  14. package/dist/hooks/useCampaigns.d.ts +11 -4
  15. package/dist/hooks/useCampaigns.d.ts.map +1 -1
  16. package/dist/hooks/useCampaigns.js +101 -39
  17. package/dist/hooks/useDonations.d.ts +33 -0
  18. package/dist/hooks/useDonations.d.ts.map +1 -0
  19. package/dist/hooks/useDonations.js +62 -0
  20. package/dist/hooks/useFiles.d.ts +50 -0
  21. package/dist/hooks/useFiles.d.ts.map +1 -0
  22. package/dist/hooks/useFiles.js +140 -0
  23. package/dist/hooks/usePurchases.d.ts +9 -0
  24. package/dist/hooks/usePurchases.d.ts.map +1 -0
  25. package/dist/hooks/usePurchases.js +56 -0
  26. package/dist/hooks/useRedemptions.d.ts +10 -5
  27. package/dist/hooks/useRedemptions.d.ts.map +1 -1
  28. package/dist/hooks/useRedemptions.js +94 -66
  29. package/dist/hooks/useTenants.d.ts +10 -0
  30. package/dist/hooks/useTenants.d.ts.map +1 -0
  31. package/dist/hooks/useTenants.js +68 -0
  32. package/dist/hooks/useTokens.d.ts +36 -2
  33. package/dist/hooks/useTokens.d.ts.map +1 -1
  34. package/dist/hooks/useTokens.js +180 -19
  35. package/dist/hooks/useTransactions.d.ts +45 -3
  36. package/dist/hooks/useTransactions.d.ts.map +1 -1
  37. package/dist/hooks/useTransactions.js +152 -31
  38. package/dist/hooks/useUserStatus.d.ts +9 -0
  39. package/dist/hooks/useUserStatus.d.ts.map +1 -0
  40. package/dist/hooks/useUserStatus.js +57 -0
  41. package/dist/hooks/useUsers.d.ts +17 -0
  42. package/dist/hooks/useUsers.d.ts.map +1 -0
  43. package/dist/hooks/useUsers.js +120 -0
  44. package/dist/hooks/useWeb3.d.ts +69 -6
  45. package/dist/hooks/useWeb3.d.ts.map +1 -1
  46. package/dist/hooks/useWeb3.js +177 -17
  47. package/dist/index.d.ts +6 -4
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +12199 -796
  50. package/dist/index.js.map +1 -1
  51. package/dist/polyfills/index.d.ts +1 -1
  52. package/dist/polyfills/index.d.ts.map +1 -1
  53. package/dist/polyfills/index.js +155 -9
  54. package/dist/polyfills/web3-polyfills.d.ts +7 -0
  55. package/dist/polyfills/web3-polyfills.d.ts.map +1 -0
  56. package/dist/polyfills/web3-polyfills.js +85 -0
  57. package/dist/providers/PersSDKProvider.d.ts +28 -18
  58. package/dist/providers/PersSDKProvider.d.ts.map +1 -1
  59. package/dist/providers/PersSDKProvider.js +63 -129
  60. package/dist/providers/react-native-auth-provider.d.ts +19 -64
  61. package/dist/providers/react-native-auth-provider.d.ts.map +1 -1
  62. package/dist/providers/react-native-auth-provider.js +57 -175
  63. package/package.json +171 -157
  64. package/src/hooks/index.ts +11 -1
  65. package/src/hooks/useAnalytics.ts +150 -0
  66. package/src/hooks/useAuth.ts +286 -27
  67. package/src/hooks/useBusiness.ts +193 -30
  68. package/src/hooks/useCampaigns.ts +121 -43
  69. package/src/hooks/useDonations.ts +68 -0
  70. package/src/hooks/useFiles.ts +160 -0
  71. package/src/hooks/usePurchases.ts +69 -0
  72. package/src/hooks/useRedemptions.ts +109 -68
  73. package/src/hooks/useTenants.ts +77 -0
  74. package/src/hooks/useTokens.ts +189 -21
  75. package/src/hooks/useTransactions.ts +170 -34
  76. package/src/hooks/useUserStatus.ts +65 -0
  77. package/src/hooks/useUsers.ts +133 -0
  78. package/src/hooks/useWeb3.ts +201 -21
  79. package/src/index.ts +21 -17
  80. package/src/polyfills/index.ts +163 -10
  81. package/src/polyfills/web3-polyfills.ts +98 -0
  82. package/src/providers/PersSDKProvider.tsx +114 -178
  83. package/src/providers/react-native-auth-provider.ts +65 -208
  84. package/dist/index.esm.js +0 -1057
  85. package/dist/index.esm.js.map +0 -1
  86. package/dist/polyfills/index.simple.d.ts +0 -2
  87. package/dist/polyfills/index.simple.d.ts.map +0 -1
  88. package/dist/polyfills/index.simple.js +0 -17
  89. package/src/polyfills/index.simple.ts +0 -22
  90. package/src/types/external-modules.d.ts +0 -13
@@ -0,0 +1,73 @@
1
+ import { useCallback } from 'react';
2
+ import { usePersSDK } from '../providers/PersSDKProvider';
3
+ /**
4
+ * React hook for analytics operations in the PERS SDK
5
+ *
6
+ * Provides methods for retrieving transaction analytics and insights.
7
+ * Supports various analytics queries for business intelligence and reporting.
8
+ *
9
+ * @returns Analytics hook with methods for data analysis
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * function AnalyticsComponent() {
14
+ * const { getTransactionAnalytics } = useAnalytics();
15
+ *
16
+ * const loadAnalytics = async () => {
17
+ * try {
18
+ * const analytics = await getTransactionAnalytics({
19
+ * timeRange: 'last_30_days',
20
+ * groupBy: 'day'
21
+ * });
22
+ * console.log('Transaction analytics:', analytics);
23
+ * } catch (error) {
24
+ * console.error('Failed to load analytics:', error);
25
+ * }
26
+ * };
27
+ *
28
+ * return <button onClick={loadAnalytics}>Load Analytics</button>;
29
+ * }
30
+ * ```
31
+ */
32
+ export const useAnalytics = () => {
33
+ const { sdk, isInitialized } = usePersSDK();
34
+ /**
35
+ * Retrieves transaction analytics data based on request parameters
36
+ *
37
+ * @param request - Analytics request parameters (time range, grouping, filters, etc.)
38
+ * @returns Promise resolving to analytics data with results and metadata
39
+ * @throws Error if SDK is not initialized
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * const { getTransactionAnalytics } = useAnalytics();
44
+ * const analytics = await getTransactionAnalytics({
45
+ * groupBy: ['day'],
46
+ * metrics: ['count', 'sum'],
47
+ * startDate: '2024-01-01',
48
+ * endDate: '2024-01-31',
49
+ * filters: { status: 'completed' }
50
+ * });
51
+ * console.log('Daily transaction analytics:', analytics.results);
52
+ * console.log('Execution time:', analytics.metadata.executionTime);
53
+ * ```
54
+ */
55
+ const getTransactionAnalytics = useCallback(async (request) => {
56
+ if (!isInitialized || !sdk) {
57
+ throw new Error('SDK not initialized. Call initialize() first.');
58
+ }
59
+ try {
60
+ const result = await sdk.analytics.getTransactionAnalytics(request);
61
+ console.log('Transaction analytics fetched successfully:', result);
62
+ return result;
63
+ }
64
+ catch (error) {
65
+ console.error('Failed to fetch transaction analytics:', error);
66
+ throw error;
67
+ }
68
+ }, [sdk, isInitialized]);
69
+ return {
70
+ getTransactionAnalytics,
71
+ isAvailable: isInitialized && !!sdk?.analytics,
72
+ };
73
+ };
@@ -1,12 +1,57 @@
1
- export interface AuthHook {
1
+ import type { RawUserData } from '@explorins/pers-sdk/core';
2
+ import type { UserDTO, AdminDTO, SessionAuthContextResponseDTO } from '@explorins/pers-shared';
3
+ export type { RawUserData };
4
+ /**
5
+ * React hook for authentication operations in the PERS SDK
6
+ *
7
+ * Provides methods for user login, logout, token management, and authentication state.
8
+ * Automatically manages authentication state and user data synchronization.
9
+ *
10
+ * @returns Authentication hook with methods and state
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * function LoginComponent() {
15
+ * const { login, logout, isAuthenticated, user } = useAuth();
16
+ *
17
+ * const handleLogin = async (token: string) => {
18
+ * try {
19
+ * await login(token, 'user');
20
+ * console.log('Login successful');
21
+ * } catch (error) {
22
+ * console.error('Login failed:', error);
23
+ * }
24
+ * };
25
+ *
26
+ * return (
27
+ * <div>
28
+ * {isAuthenticated ? (
29
+ * <div>
30
+ * <p>Welcome, {user?.name}</p>
31
+ * <button onClick={logout}>Logout</button>
32
+ * </div>
33
+ * ) : (
34
+ * <button onClick={() => handleLogin('jwt-token')}>Login</button>
35
+ * )}
36
+ * </div>
37
+ * );
38
+ * }
39
+ * ```
40
+ */
41
+ export declare const useAuth: () => {
2
42
  isInitialized: boolean;
3
43
  isAuthenticated: boolean;
4
- user: any | null;
44
+ user: UserDTO | AdminDTO | null;
5
45
  accountAddress: string | null;
6
- initialize: (config: any) => Promise<void>;
7
- login: (jwtToken: string, userType?: 'user' | 'admin') => Promise<any>;
8
- loginWithRawData: (rawUserData: any) => Promise<any>;
46
+ login: (jwtToken: string, userType?: 'user' | 'admin') => Promise<SessionAuthContextResponseDTO>;
47
+ loginWithRawData: (rawUserData: RawUserData) => Promise<void>;
9
48
  logout: () => Promise<void>;
10
- }
11
- export declare const useAuth: () => AuthHook;
49
+ refreshUserData: () => Promise<void>;
50
+ getCurrentUser: () => Promise<UserDTO>;
51
+ checkIsAuthenticated: () => Promise<boolean>;
52
+ refreshTokens: (refreshToken?: string) => Promise<import("@explorins/pers-shared").SessionAuthResponseDTO>;
53
+ clearAuth: () => Promise<void>;
54
+ hasValidAuth: () => boolean;
55
+ };
56
+ export type AuthHook = ReturnType<typeof useAuth>;
12
57
  //# sourceMappingURL=useAuth.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useAuth.d.ts","sourceRoot":"","sources":["../../src/hooks/useAuth.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,QAAQ;IAEvB,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,EAAE,OAAO,CAAC;IACzB,IAAI,EAAE,GAAG,GAAG,IAAI,CAAC;IACjB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAG9B,UAAU,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACvE,gBAAgB,EAAE,CAAC,WAAW,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACrD,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B;AAED,eAAO,MAAM,OAAO,QAAO,QAyB1B,CAAC"}
1
+ {"version":3,"file":"useAuth.d.ts","sourceRoot":"","sources":["../../src/hooks/useAuth.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAG/F,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,eAAO,MAAM,OAAO;;;;;sBA2ByB,MAAM,aAAY,MAAM,GAAG,OAAO,KAAY,QAAQ,6BAA6B,CAAC;oCA8CtE,WAAW,KAAG,QAAQ,IAAI,CAAC;kBA+C/C,QAAQ,IAAI,CAAC;;0BA8BL,QAAQ,OAAO,CAAC;gCAmBV,QAAQ,OAAO,CAAC;mCAqBX,MAAM;qBAmBtB,QAAQ,IAAI,CAAC;wBAoBhB,OAAO;CAyB7C,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC"}
@@ -1,16 +1,263 @@
1
+ import { useCallback } from 'react';
1
2
  import { usePersSDK } from '../providers/PersSDKProvider';
3
+ /**
4
+ * React hook for authentication operations in the PERS SDK
5
+ *
6
+ * Provides methods for user login, logout, token management, and authentication state.
7
+ * Automatically manages authentication state and user data synchronization.
8
+ *
9
+ * @returns Authentication hook with methods and state
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * function LoginComponent() {
14
+ * const { login, logout, isAuthenticated, user } = useAuth();
15
+ *
16
+ * const handleLogin = async (token: string) => {
17
+ * try {
18
+ * await login(token, 'user');
19
+ * console.log('Login successful');
20
+ * } catch (error) {
21
+ * console.error('Login failed:', error);
22
+ * }
23
+ * };
24
+ *
25
+ * return (
26
+ * <div>
27
+ * {isAuthenticated ? (
28
+ * <div>
29
+ * <p>Welcome, {user?.name}</p>
30
+ * <button onClick={logout}>Logout</button>
31
+ * </div>
32
+ * ) : (
33
+ * <button onClick={() => handleLogin('jwt-token')}>Login</button>
34
+ * )}
35
+ * </div>
36
+ * );
37
+ * }
38
+ * ```
39
+ */
2
40
  export const useAuth = () => {
3
- const { isInitialized, isAuthenticated, user, accountAddress, initialize, login, loginWithRawData, logout, } = usePersSDK();
41
+ const { sdk, authProvider, isInitialized, isAuthenticated, user, accountAddress, setAuthenticationState, refreshUserData } = usePersSDK();
42
+ /**
43
+ * Authenticates a user with a JWT token
44
+ *
45
+ * @param jwtToken - The JWT token to authenticate with
46
+ * @param userType - The type of user ('user' | 'admin'), defaults to 'user'
47
+ * @returns Promise resolving to session auth context with user data
48
+ * @throws Error if SDK is not initialized or authentication fails
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * const { login } = useAuth();
53
+ * const result = await login(jwtToken, 'user');
54
+ * console.log('Logged in user:', result.user);
55
+ * ```
56
+ */
57
+ const login = useCallback(async (jwtToken, userType = 'user') => {
58
+ if (!sdk || !authProvider) {
59
+ throw new Error('SDK not initialized. Call initialize() first.');
60
+ }
61
+ try {
62
+ console.log(`Logging in as ${userType}...`);
63
+ // Set token in auth provider
64
+ await authProvider.setToken(jwtToken);
65
+ // Perform login using the manager
66
+ const result = await sdk.auth.loginWithToken(jwtToken, userType);
67
+ const userData = result.user || result.admin;
68
+ if (userData) {
69
+ const userAccountAddress = ('accountAddress' in userData && userData.accountAddress) ||
70
+ ('wallets' in userData && userData.wallets?.[0]?.address) ||
71
+ null;
72
+ setAuthenticationState(userData, userAccountAddress, true);
73
+ console.log('Login successful');
74
+ return result;
75
+ }
76
+ else {
77
+ throw new Error('No user data returned from login');
78
+ }
79
+ }
80
+ catch (error) {
81
+ console.error('Login failed:', error);
82
+ throw error;
83
+ }
84
+ }, [sdk, authProvider, setAuthenticationState]);
85
+ /**
86
+ * Logs in a user using raw user data (direct authentication bypass)
87
+ *
88
+ * @param rawUserData - Raw user data for direct authentication
89
+ * @throws Error if SDK is not initialized or authentication fails
90
+ *
91
+ * @example
92
+ * ```typescript
93
+ * const { loginWithRawData } = useAuth();
94
+ * await loginWithRawData({ userId: '123', email: 'user@example.com' });
95
+ * ```
96
+ */
97
+ const loginWithRawData = useCallback(async (rawUserData) => {
98
+ if (!sdk || !authProvider) {
99
+ throw new Error('SDK not initialized. Call initialize() first.');
100
+ }
101
+ try {
102
+ console.log('Logging in with raw user data...');
103
+ // Use the raw data login from the API client directly
104
+ const result = await sdk.api().loginUserWithRawData(rawUserData);
105
+ // Set token from result
106
+ if (result.accessToken) {
107
+ await authProvider.setToken(result.accessToken);
108
+ }
109
+ const userData = result.user;
110
+ if (userData) {
111
+ const userAccountAddress = userData.accountAddress ||
112
+ userData?.wallets?.[0]?.address ||
113
+ null;
114
+ setAuthenticationState(userData, userAccountAddress, true);
115
+ console.log('Raw data login successful');
116
+ }
117
+ else {
118
+ throw new Error('No user data returned from raw data login');
119
+ }
120
+ }
121
+ catch (error) {
122
+ console.error('Raw data login failed:', error);
123
+ throw error;
124
+ }
125
+ }, [sdk, authProvider, setAuthenticationState]);
126
+ /**
127
+ * Logs out the current user and clears authentication state
128
+ *
129
+ * @throws Error if logout process fails
130
+ *
131
+ * @example
132
+ * ```typescript
133
+ * const { logout } = useAuth();
134
+ * await logout();
135
+ * console.log('User logged out');
136
+ * ```
137
+ */
138
+ const logout = useCallback(async () => {
139
+ try {
140
+ console.log('Logging out...');
141
+ if (authProvider) {
142
+ await authProvider.setToken(null);
143
+ }
144
+ setAuthenticationState(null, null, false);
145
+ console.log('Logout successful');
146
+ }
147
+ catch (error) {
148
+ console.error('Logout failed:', error);
149
+ throw error;
150
+ }
151
+ }, [authProvider, setAuthenticationState]);
152
+ /**
153
+ * Retrieves the current authenticated user data
154
+ *
155
+ * @returns Promise resolving to current user data
156
+ * @throws Error if SDK is not initialized
157
+ *
158
+ * @example
159
+ * ```typescript
160
+ * const { getCurrentUser } = useAuth();
161
+ * const user = await getCurrentUser();
162
+ * console.log('Current user:', user.email);
163
+ * ```
164
+ */
165
+ const getCurrentUser = useCallback(async () => {
166
+ if (!sdk) {
167
+ throw new Error('SDK not initialized. Call initialize() first.');
168
+ }
169
+ return sdk.auth.getCurrentUser();
170
+ }, [sdk]);
171
+ /**
172
+ * Checks if the current session is authenticated
173
+ *
174
+ * @returns Promise resolving to authentication status
175
+ *
176
+ * @example
177
+ * ```typescript
178
+ * const { checkIsAuthenticated } = useAuth();
179
+ * const isAuth = await checkIsAuthenticated();
180
+ * console.log('Is authenticated:', isAuth);
181
+ * ```
182
+ */
183
+ const checkIsAuthenticated = useCallback(async () => {
184
+ if (!sdk) {
185
+ return false;
186
+ }
187
+ return sdk.auth.isAuthenticated();
188
+ }, [sdk]);
189
+ /**
190
+ * Refreshes authentication tokens
191
+ *
192
+ * @param refreshToken - Optional refresh token to use
193
+ * @returns Promise resolving to new session auth response
194
+ * @throws Error if SDK is not initialized
195
+ *
196
+ * @example
197
+ * ```typescript
198
+ * const { refreshTokens } = useAuth();
199
+ * const tokens = await refreshTokens();
200
+ * console.log('Tokens refreshed:', tokens);
201
+ * ```
202
+ */
203
+ const refreshTokens = useCallback(async (refreshToken) => {
204
+ if (!sdk) {
205
+ throw new Error('SDK not initialized. Call initialize() first.');
206
+ }
207
+ return sdk.auth.refreshTokens(refreshToken);
208
+ }, [sdk]);
209
+ /**
210
+ * Clears all authentication data and resets auth state
211
+ *
212
+ * @throws Error if SDK is not initialized
213
+ *
214
+ * @example
215
+ * ```typescript
216
+ * const { clearAuth } = useAuth();
217
+ * await clearAuth();
218
+ * console.log('Auth data cleared');
219
+ * ```
220
+ */
221
+ const clearAuth = useCallback(async () => {
222
+ if (!sdk) {
223
+ throw new Error('SDK not initialized. Call initialize() first.');
224
+ }
225
+ await sdk.auth.clearAuth();
226
+ setAuthenticationState(null, null, false);
227
+ }, [sdk, setAuthenticationState]);
228
+ /**
229
+ * Checks if the current authentication is valid (non-expired)
230
+ *
231
+ * @returns Boolean indicating if auth is valid
232
+ *
233
+ * @example
234
+ * ```typescript
235
+ * const { hasValidAuth } = useAuth();
236
+ * const isValid = hasValidAuth();
237
+ * console.log('Auth is valid:', isValid);
238
+ * ```
239
+ */
240
+ const hasValidAuth = useCallback(() => {
241
+ if (!sdk) {
242
+ return false;
243
+ }
244
+ return sdk.auth.hasValidAuth();
245
+ }, [sdk]);
4
246
  return {
5
247
  // State
6
248
  isInitialized,
7
249
  isAuthenticated,
8
250
  user,
9
251
  accountAddress,
10
- // Actions
11
- initialize,
252
+ // Methods
12
253
  login,
13
254
  loginWithRawData,
14
255
  logout,
256
+ refreshUserData,
257
+ getCurrentUser,
258
+ checkIsAuthenticated,
259
+ refreshTokens,
260
+ clearAuth,
261
+ hasValidAuth,
15
262
  };
16
263
  };
@@ -1,7 +1,49 @@
1
+ import type { BusinessDTO, BusinessTypeDTO, BusinessUpdateRequestDTO, BusinessToggleActiveRequestDTO } from '@explorins/pers-shared';
2
+ /**
3
+ * React hook for business operations in the PERS SDK
4
+ *
5
+ * Provides methods for fetching, creating, and managing businesses within the platform.
6
+ * Includes both public business queries and administrative operations.
7
+ *
8
+ * @returns Business hook with methods for business management
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * function BusinessesComponent() {
13
+ * const {
14
+ * getActiveBusinesses,
15
+ * getBusinessById,
16
+ * createBusiness
17
+ * } = useBusiness();
18
+ *
19
+ * const loadBusinesses = async () => {
20
+ * try {
21
+ * const businesses = await getActiveBusinesses();
22
+ * console.log('Active businesses:', businesses);
23
+ * } catch (error) {
24
+ * console.error('Failed to load businesses:', error);
25
+ * }
26
+ * };
27
+ *
28
+ * return (
29
+ * <div>
30
+ * <button onClick={loadBusinesses}>Load Businesses</button>
31
+ * </div>
32
+ * );
33
+ * }
34
+ * ```
35
+ */
1
36
  export declare const useBusiness: () => {
2
- getActiveBusinesses: () => Promise<any>;
3
- getAllBusinessTypes: () => Promise<any>;
4
- getBusinessById: (businessId: string) => Promise<any>;
37
+ getActiveBusinesses: () => Promise<BusinessDTO[]>;
38
+ getBusinessTypes: () => Promise<BusinessTypeDTO[]>;
39
+ getBusinesses: () => Promise<BusinessDTO[]>;
40
+ getBusinessById: (businessId: string) => Promise<BusinessDTO | null>;
41
+ getBusinessByAccount: (accountAddress: string) => Promise<BusinessDTO>;
42
+ getBusinessesByType: (typeId: string) => Promise<BusinessDTO[]>;
43
+ createBusiness: (displayName: string) => Promise<BusinessDTO>;
44
+ updateBusiness: (businessId: string, businessData: BusinessUpdateRequestDTO) => Promise<BusinessDTO>;
45
+ toggleBusinessStatus: (businessId: string, toggleData: BusinessToggleActiveRequestDTO) => Promise<BusinessDTO>;
5
46
  isAvailable: boolean;
6
47
  };
48
+ export type BusinessHook = ReturnType<typeof useBusiness>;
7
49
  //# sourceMappingURL=useBusiness.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useBusiness.d.ts","sourceRoot":"","sources":["../../src/hooks/useBusiness.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW;;;kCAyCiC,MAAM;;CAwB9D,CAAC"}
1
+ {"version":3,"file":"useBusiness.d.ts","sourceRoot":"","sources":["../../src/hooks/useBusiness.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,wBAAwB,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAErI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,WAAW;+BAgB4B,QAAQ,WAAW,EAAE,CAAC;4BA4BzB,QAAQ,eAAe,EAAE,CAAC;yBA8B7B,QAAQ,WAAW,EAAE,CAAC;kCAfX,MAAM,KAAG,QAAQ,WAAW,GAAG,IAAI,CAAC;2CA8B3B,MAAM,KAAG,QAAQ,WAAW,CAAC;kCAetC,MAAM,KAAG,QAAQ,WAAW,EAAE,CAAC;kCA8B/B,MAAM,KAAG,QAAQ,WAAW,CAAC;iCAe9B,MAAM,gBAAgB,wBAAwB,KAAG,QAAQ,WAAW,CAAC;uCAe/D,MAAM,cAAc,8BAA8B,KAAG,QAAQ,WAAW,CAAC;;CA2BtI,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC"}