@echoxyz/sonar-react 0.12.1 → 0.13.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @echoxyz/sonar-react
2
2
 
3
+ ## 0.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add wrapper function and hook for ReadCommitmentData endpoint
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @echoxyz/sonar-core@0.14.0
13
+
14
+ ## 0.12.2
15
+
16
+ ### Patch Changes
17
+
18
+ - 171a0db: Added support for ReadEntityInvestmentHistory API
19
+ - Updated dependencies [c551d7c]
20
+ - Updated dependencies [e276112]
21
+ - Updated dependencies [171a0db]
22
+ - Updated dependencies [b2cd697]
23
+ - @echoxyz/sonar-core@0.13.0
24
+
3
25
  ## 0.12.1
4
26
 
5
27
  ### Patch Changes
package/README.md CHANGED
@@ -77,7 +77,41 @@ export default function OAuthCallback() {
77
77
  }
78
78
  ```
79
79
 
80
- 4. Load the Sonar entity associated with the user's wallet
80
+ 4. (Optional) Load the authenticated user's profile
81
+
82
+ ```tsx
83
+ import { useSonarProfile } from "@echoxyz/sonar-react";
84
+
85
+ const UserProfilePanel = () => {
86
+ const { authenticated, loading, profile, error } = useSonarProfile();
87
+
88
+ if (!authenticated) {
89
+ return <p>Please sign in to view your profile</p>;
90
+ }
91
+
92
+ if (loading) {
93
+ return <p>Loading...</p>;
94
+ }
95
+
96
+ if (error) {
97
+ return <p>Error: {error.message}</p>;
98
+ }
99
+
100
+ if (!profile) {
101
+ return null;
102
+ }
103
+
104
+ return (
105
+ <div>
106
+ <span>Entity ID: {profile.EntityID}</span>
107
+ {/* EmailAddress only present if authorized with contact:email scope */}
108
+ {profile.EmailAddress && <span>Email: {profile.EmailAddress}</span>}
109
+ </div>
110
+ );
111
+ };
112
+ ```
113
+
114
+ 5. Load the Sonar entity associated with the user's wallet
81
115
 
82
116
  ```tsx
83
117
  import { useSonarEntity } from "./hooks/useSonarEntity";
@@ -118,76 +152,63 @@ const ExampleEntityPanel = () => {
118
152
 
119
153
  If you want to fetch all entities associated with the logged in user, you can use the `useSonarEntities` hook.
120
154
 
121
- 5. Implement the purchase flow
155
+ 6. Implement the purchase flow
122
156
 
123
157
  ```tsx
124
- function Example({
125
- entityID,
126
- walletAddress,
127
- }: {
128
- entityID: string;
129
- walletAddress: string;
130
- }) {
131
- const sonarPurchaser = useSonarPurchase({
132
- saleUUID: sonarConfig.saleUUID,
133
- entityID,
134
- entityType,
135
- walletAddress,
136
- });
137
-
138
- if (sonarPurchaser.loading) {
139
- return <p>Loading...</p>;
140
- }
141
-
142
- if (sonarPurchaser.error) {
143
- return <p>Error: {error.message}</p>;
144
- }
145
-
146
- return (
147
- <div>
148
- {sonarPurchaser.readyToPurchase && (
149
- <PurchaseButton
150
- generatePurchasePermit={sonarPurchaser.generatePurchasePermit}
151
- />
152
- )}
153
-
154
- {!sonarPurchaser.readyToPurchase &&
155
- sonarPurchaser.failureReason ===
156
- PrePurchaseFailureReason.REQUIRES_LIVENESS && (
157
- <button
158
- onClick={() => {
159
- window.open(prePurchaseCheckResult.LivenessCheckURL, "_blank");
160
- }}
161
- >
162
- Complete liveness check to purchase
163
- </button>
164
- )}
165
- </div>
166
- );
158
+ function Example({ entityID, walletAddress }: { entityID: string; walletAddress: string }) {
159
+ const sonarPurchaser = useSonarPurchase({
160
+ saleUUID: sonarConfig.saleUUID,
161
+ entityID,
162
+ entityType,
163
+ walletAddress,
164
+ });
165
+
166
+ if (sonarPurchaser.loading) {
167
+ return <p>Loading...</p>;
168
+ }
169
+
170
+ if (sonarPurchaser.error) {
171
+ return <p>Error: {error.message}</p>;
172
+ }
173
+
174
+ return (
175
+ <div>
176
+ {sonarPurchaser.readyToPurchase && (
177
+ <PurchaseButton generatePurchasePermit={sonarPurchaser.generatePurchasePermit} />
178
+ )}
179
+
180
+ {!sonarPurchaser.readyToPurchase &&
181
+ sonarPurchaser.failureReason === PrePurchaseFailureReason.REQUIRES_LIVENESS && (
182
+ <button
183
+ onClick={() => {
184
+ window.open(prePurchaseCheckResult.LivenessCheckURL, "_blank");
185
+ }}
186
+ >
187
+ Complete liveness check to purchase
188
+ </button>
189
+ )}
190
+ </div>
191
+ );
167
192
  }
168
193
 
169
194
  function PurchaseButton({
170
- generatePurchasePermit,
195
+ generatePurchasePermit,
171
196
  }: {
172
- generatePurchasePermit: () => Promise<GeneratePurchasePermitResponse>;
197
+ generatePurchasePermit: () => Promise<GeneratePurchasePermitResponse>;
173
198
  }) {
174
- const purchase = async () => {
175
- const response = await generatePurchasePermit();
176
- const r = response as unknown as {
177
- Signature: string;
178
- PermitJSON: BasicPermitV2;
199
+ const purchase = async () => {
200
+ const response = await generatePurchasePermit();
201
+ const r = response as unknown as {
202
+ Signature: string;
203
+ PermitJSON: BasicPermitV2;
204
+ };
205
+ if (r.Signature && r.PermitJSON) {
206
+ console.log(permit.Signature, permit.Permit);
207
+ return;
208
+ }
179
209
  };
180
- if (r.Signature && r.PermitJSON) {
181
- console.log(permit.Signature, permit.Permit);
182
- return;
183
- }
184
- };
185
210
 
186
- return (
187
- <button onClick={purchase}>
188
- Purchase
189
- </button>
190
- );
211
+ return <button onClick={purchase}>Purchase</button>;
191
212
  }
192
213
  ```
193
214
 
@@ -203,9 +224,19 @@ function PurchaseButton({
203
224
  - `useSonarAuth()` → `{ authenticated, ready, token?, login(), completeOAuth({ code, state }), logout() }`
204
225
 
205
226
  - `useSonarClient()` → low-level `SonarClient` instance.
206
-
227
+
228
+ - `useSonarProfile()` → `{ authenticated, loading, profile?, error? }` high-level hook for fetching the authenticated user's profile (entity ID and email).
229
+
207
230
  - `useSonarEntity()` → `{ authenticated, loading, entity?, error? }` high-level convenience hook for fetching a Sonar entity by wallet address.
208
231
 
232
+ - `useSonarEntities()` → `{ authenticated, loading, entities?, error? }` high-level hook for fetching all entities available to the authenticated user.
233
+
234
+ - `useSonarPurchase()` → `{ loading, readyToPurchase, error?, generatePurchasePermit() }` high-level hook to check if the user is ready to purchase and generate a purchase permit.
235
+
236
+ - `useEntityInvestmentHistory()` → `{ loading, investmentHistory?, error? }` high-level hook to fetch Echo private group investment history for a given entity.
237
+
238
+ - `useCommitmentData()` → `{ loading, commitmentData?, error? }` high-level hook to poll for commitment data for a given sale. Note this calls a public API endpoint so the client does not need to be authenticated.
239
+
209
240
  ## Notes
210
241
 
211
242
  - Tokens are not auto-refreshed. On expiry, call `logout()` and re-run the OAuth flow.
package/dist/index.cjs CHANGED
@@ -21,10 +21,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  SonarProvider: () => SonarProvider,
24
+ useCommitmentData: () => useCommitmentData,
25
+ useEntityInvestmentHistory: () => useEntityInvestmentHistory,
24
26
  useSonarAuth: () => useSonarAuth,
25
27
  useSonarClient: () => useSonarClient,
26
28
  useSonarEntities: () => useSonarEntities,
27
29
  useSonarEntity: () => useSonarEntity,
30
+ useSonarProfile: () => useSonarProfile,
28
31
  useSonarPurchase: () => useSonarPurchase
29
32
  });
30
33
  module.exports = __toCommonJS(index_exports);
@@ -308,12 +311,150 @@ function useSonarPurchase(args) {
308
311
  }, [saleUUID, entityID, walletAddress, client, generatePurchasePermit]);
309
312
  return state;
310
313
  }
314
+ function useSonarProfile() {
315
+ const { authenticated, ready } = useSonarAuth();
316
+ const client = useSonarClient();
317
+ const [state, setState] = (0, import_react2.useState)({
318
+ loading: false
319
+ });
320
+ const fullyConnected = ready && authenticated;
321
+ const refetch = (0, import_react2.useCallback)(async () => {
322
+ if (!fullyConnected) {
323
+ return;
324
+ }
325
+ setState((s) => ({ ...s, loading: true }));
326
+ try {
327
+ const resp = await client.myProfile();
328
+ setState({
329
+ loading: false,
330
+ profile: resp,
331
+ error: void 0
332
+ });
333
+ } catch (err) {
334
+ const error = err instanceof Error ? err : new Error(String(err));
335
+ setState({ loading: false, profile: void 0, error });
336
+ }
337
+ }, [client, fullyConnected]);
338
+ const reset = (0, import_react2.useCallback)(() => {
339
+ setState({
340
+ loading: false,
341
+ profile: void 0,
342
+ error: void 0
343
+ });
344
+ }, []);
345
+ (0, import_react2.useEffect)(() => {
346
+ if (fullyConnected) {
347
+ refetch();
348
+ }
349
+ }, [fullyConnected, refetch]);
350
+ (0, import_react2.useEffect)(() => {
351
+ if (ready && !authenticated) {
352
+ reset();
353
+ }
354
+ }, [ready, authenticated, reset]);
355
+ return {
356
+ authenticated,
357
+ loading: state.loading,
358
+ profile: state.profile,
359
+ error: state.error
360
+ };
361
+ }
362
+ function useEntityInvestmentHistory() {
363
+ const { authenticated, ready } = useSonarAuth();
364
+ const client = useSonarClient();
365
+ const [state, setState] = (0, import_react2.useState)({
366
+ loading: false
367
+ });
368
+ const fullyConnected = ready && authenticated;
369
+ const refetch = (0, import_react2.useCallback)(async () => {
370
+ if (!fullyConnected) {
371
+ return;
372
+ }
373
+ setState((s) => ({ ...s, loading: true }));
374
+ try {
375
+ const resp = await client.readEntityInvestmentHistory();
376
+ setState({
377
+ loading: false,
378
+ investmentHistory: resp,
379
+ error: void 0
380
+ });
381
+ } catch (err) {
382
+ const error = err instanceof Error ? err : new Error(String(err));
383
+ setState({ loading: false, investmentHistory: void 0, error });
384
+ }
385
+ }, [client, fullyConnected]);
386
+ const reset = (0, import_react2.useCallback)(() => {
387
+ setState({
388
+ loading: false,
389
+ investmentHistory: void 0,
390
+ error: void 0
391
+ });
392
+ }, []);
393
+ (0, import_react2.useEffect)(() => {
394
+ if (fullyConnected) {
395
+ refetch();
396
+ }
397
+ }, [fullyConnected, refetch]);
398
+ (0, import_react2.useEffect)(() => {
399
+ if (ready && !authenticated) {
400
+ reset();
401
+ }
402
+ }, [ready, authenticated, reset]);
403
+ return {
404
+ authenticated,
405
+ loading: state.loading,
406
+ investmentHistory: state.investmentHistory,
407
+ error: state.error
408
+ };
409
+ }
410
+ var MIN_POLLING_INTERVAL_MS = 1e3;
411
+ function useCommitmentData(args) {
412
+ const saleUUID = args.saleUUID;
413
+ const pollingIntervalMs = args.pollingIntervalMs;
414
+ if (pollingIntervalMs !== void 0 && pollingIntervalMs < MIN_POLLING_INTERVAL_MS) {
415
+ throw new Error(`pollingIntervalMs must be at least ${MIN_POLLING_INTERVAL_MS}ms`);
416
+ }
417
+ const client = useSonarClient();
418
+ const [state, setState] = (0, import_react2.useState)({
419
+ loading: false
420
+ });
421
+ const refetch = (0, import_react2.useCallback)(async () => {
422
+ setState((s) => ({ ...s, loading: true }));
423
+ try {
424
+ const resp = await client.readCommitmentData({ saleUUID });
425
+ setState({
426
+ loading: false,
427
+ commitmentData: resp,
428
+ error: void 0
429
+ });
430
+ } catch (err) {
431
+ const error = err instanceof Error ? err : new Error(String(err));
432
+ setState({ loading: false, commitmentData: void 0, error });
433
+ }
434
+ }, [client, saleUUID]);
435
+ (0, import_react2.useEffect)(() => {
436
+ refetch();
437
+ if (pollingIntervalMs === void 0) {
438
+ return;
439
+ }
440
+ const intervalId = setInterval(() => {
441
+ refetch();
442
+ }, pollingIntervalMs);
443
+ return () => {
444
+ clearInterval(intervalId);
445
+ };
446
+ }, [refetch, pollingIntervalMs]);
447
+ return state;
448
+ }
311
449
  // Annotate the CommonJS export names for ESM import in node:
312
450
  0 && (module.exports = {
313
451
  SonarProvider,
452
+ useCommitmentData,
453
+ useEntityInvestmentHistory,
314
454
  useSonarAuth,
315
455
  useSonarClient,
316
456
  useSonarEntities,
317
457
  useSonarEntity,
458
+ useSonarProfile,
318
459
  useSonarPurchase
319
460
  });
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React from 'react';
3
- import { SonarClient, EntityDetails, GeneratePurchasePermitResponse, PrePurchaseFailureReason, EntityID } from '@echoxyz/sonar-core';
3
+ import { SonarClient, EntityDetails, GeneratePurchasePermitResponse, PrePurchaseFailureReason, EntityID, MyProfileResponse, EntityInvestmentHistoryResponse, ReadCommitmentDataResponse } from '@echoxyz/sonar-core';
4
4
 
5
5
  type SonarProviderProps = {
6
6
  children: React.ReactNode;
@@ -77,5 +77,31 @@ declare function useSonarPurchase(args: {
77
77
  entityID: EntityID;
78
78
  walletAddress: string;
79
79
  }): UseSonarPurchaseResult;
80
+ type UseSonarProfileResult = {
81
+ authenticated: boolean;
82
+ loading: boolean;
83
+ profile?: MyProfileResponse;
84
+ error?: Error;
85
+ };
86
+ declare function useSonarProfile(): UseSonarProfileResult;
87
+ type UseEntityInvestmentHistoryResult = {
88
+ authenticated: boolean;
89
+ loading: boolean;
90
+ investmentHistory?: EntityInvestmentHistoryResponse;
91
+ error?: Error;
92
+ };
93
+ declare function useEntityInvestmentHistory(): UseEntityInvestmentHistoryResult;
94
+ type UseCommitmentDataResult = {
95
+ loading: boolean;
96
+ commitmentData?: ReadCommitmentDataResponse;
97
+ error?: Error;
98
+ };
99
+ /**
100
+ * Fetches commitment data for a sale and optionally polls for updates. Polling is disabled by default.
101
+ */
102
+ declare function useCommitmentData(args: {
103
+ saleUUID: string;
104
+ pollingIntervalMs?: number;
105
+ }): UseCommitmentDataResult;
80
106
 
81
- export { SonarProvider, type SonarProviderConfig, type UseSonarEntitiesResult, type UseSonarEntityResult, type UseSonarPurchaseResult, type UseSonarPurchaseResultError, type UseSonarPurchaseResultLoading, type UseSonarPurchaseResultNotReadyToPurchase, type UseSonarPurchaseResultReadyToPurchase, useSonarAuth, useSonarClient, useSonarEntities, useSonarEntity, useSonarPurchase };
107
+ export { SonarProvider, type SonarProviderConfig, type UseCommitmentDataResult, type UseEntityInvestmentHistoryResult, type UseSonarEntitiesResult, type UseSonarEntityResult, type UseSonarProfileResult, type UseSonarPurchaseResult, type UseSonarPurchaseResultError, type UseSonarPurchaseResultLoading, type UseSonarPurchaseResultNotReadyToPurchase, type UseSonarPurchaseResultReadyToPurchase, useCommitmentData, useEntityInvestmentHistory, useSonarAuth, useSonarClient, useSonarEntities, useSonarEntity, useSonarProfile, useSonarPurchase };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React from 'react';
3
- import { SonarClient, EntityDetails, GeneratePurchasePermitResponse, PrePurchaseFailureReason, EntityID } from '@echoxyz/sonar-core';
3
+ import { SonarClient, EntityDetails, GeneratePurchasePermitResponse, PrePurchaseFailureReason, EntityID, MyProfileResponse, EntityInvestmentHistoryResponse, ReadCommitmentDataResponse } from '@echoxyz/sonar-core';
4
4
 
5
5
  type SonarProviderProps = {
6
6
  children: React.ReactNode;
@@ -77,5 +77,31 @@ declare function useSonarPurchase(args: {
77
77
  entityID: EntityID;
78
78
  walletAddress: string;
79
79
  }): UseSonarPurchaseResult;
80
+ type UseSonarProfileResult = {
81
+ authenticated: boolean;
82
+ loading: boolean;
83
+ profile?: MyProfileResponse;
84
+ error?: Error;
85
+ };
86
+ declare function useSonarProfile(): UseSonarProfileResult;
87
+ type UseEntityInvestmentHistoryResult = {
88
+ authenticated: boolean;
89
+ loading: boolean;
90
+ investmentHistory?: EntityInvestmentHistoryResponse;
91
+ error?: Error;
92
+ };
93
+ declare function useEntityInvestmentHistory(): UseEntityInvestmentHistoryResult;
94
+ type UseCommitmentDataResult = {
95
+ loading: boolean;
96
+ commitmentData?: ReadCommitmentDataResponse;
97
+ error?: Error;
98
+ };
99
+ /**
100
+ * Fetches commitment data for a sale and optionally polls for updates. Polling is disabled by default.
101
+ */
102
+ declare function useCommitmentData(args: {
103
+ saleUUID: string;
104
+ pollingIntervalMs?: number;
105
+ }): UseCommitmentDataResult;
80
106
 
81
- export { SonarProvider, type SonarProviderConfig, type UseSonarEntitiesResult, type UseSonarEntityResult, type UseSonarPurchaseResult, type UseSonarPurchaseResultError, type UseSonarPurchaseResultLoading, type UseSonarPurchaseResultNotReadyToPurchase, type UseSonarPurchaseResultReadyToPurchase, useSonarAuth, useSonarClient, useSonarEntities, useSonarEntity, useSonarPurchase };
107
+ export { SonarProvider, type SonarProviderConfig, type UseCommitmentDataResult, type UseEntityInvestmentHistoryResult, type UseSonarEntitiesResult, type UseSonarEntityResult, type UseSonarProfileResult, type UseSonarPurchaseResult, type UseSonarPurchaseResultError, type UseSonarPurchaseResultLoading, type UseSonarPurchaseResultNotReadyToPurchase, type UseSonarPurchaseResultReadyToPurchase, useCommitmentData, useEntityInvestmentHistory, useSonarAuth, useSonarClient, useSonarEntities, useSonarEntity, useSonarProfile, useSonarPurchase };
package/dist/index.js CHANGED
@@ -279,11 +279,149 @@ function useSonarPurchase(args) {
279
279
  }, [saleUUID, entityID, walletAddress, client, generatePurchasePermit]);
280
280
  return state;
281
281
  }
282
+ function useSonarProfile() {
283
+ const { authenticated, ready } = useSonarAuth();
284
+ const client = useSonarClient();
285
+ const [state, setState] = useState2({
286
+ loading: false
287
+ });
288
+ const fullyConnected = ready && authenticated;
289
+ const refetch = useCallback2(async () => {
290
+ if (!fullyConnected) {
291
+ return;
292
+ }
293
+ setState((s) => ({ ...s, loading: true }));
294
+ try {
295
+ const resp = await client.myProfile();
296
+ setState({
297
+ loading: false,
298
+ profile: resp,
299
+ error: void 0
300
+ });
301
+ } catch (err) {
302
+ const error = err instanceof Error ? err : new Error(String(err));
303
+ setState({ loading: false, profile: void 0, error });
304
+ }
305
+ }, [client, fullyConnected]);
306
+ const reset = useCallback2(() => {
307
+ setState({
308
+ loading: false,
309
+ profile: void 0,
310
+ error: void 0
311
+ });
312
+ }, []);
313
+ useEffect2(() => {
314
+ if (fullyConnected) {
315
+ refetch();
316
+ }
317
+ }, [fullyConnected, refetch]);
318
+ useEffect2(() => {
319
+ if (ready && !authenticated) {
320
+ reset();
321
+ }
322
+ }, [ready, authenticated, reset]);
323
+ return {
324
+ authenticated,
325
+ loading: state.loading,
326
+ profile: state.profile,
327
+ error: state.error
328
+ };
329
+ }
330
+ function useEntityInvestmentHistory() {
331
+ const { authenticated, ready } = useSonarAuth();
332
+ const client = useSonarClient();
333
+ const [state, setState] = useState2({
334
+ loading: false
335
+ });
336
+ const fullyConnected = ready && authenticated;
337
+ const refetch = useCallback2(async () => {
338
+ if (!fullyConnected) {
339
+ return;
340
+ }
341
+ setState((s) => ({ ...s, loading: true }));
342
+ try {
343
+ const resp = await client.readEntityInvestmentHistory();
344
+ setState({
345
+ loading: false,
346
+ investmentHistory: resp,
347
+ error: void 0
348
+ });
349
+ } catch (err) {
350
+ const error = err instanceof Error ? err : new Error(String(err));
351
+ setState({ loading: false, investmentHistory: void 0, error });
352
+ }
353
+ }, [client, fullyConnected]);
354
+ const reset = useCallback2(() => {
355
+ setState({
356
+ loading: false,
357
+ investmentHistory: void 0,
358
+ error: void 0
359
+ });
360
+ }, []);
361
+ useEffect2(() => {
362
+ if (fullyConnected) {
363
+ refetch();
364
+ }
365
+ }, [fullyConnected, refetch]);
366
+ useEffect2(() => {
367
+ if (ready && !authenticated) {
368
+ reset();
369
+ }
370
+ }, [ready, authenticated, reset]);
371
+ return {
372
+ authenticated,
373
+ loading: state.loading,
374
+ investmentHistory: state.investmentHistory,
375
+ error: state.error
376
+ };
377
+ }
378
+ var MIN_POLLING_INTERVAL_MS = 1e3;
379
+ function useCommitmentData(args) {
380
+ const saleUUID = args.saleUUID;
381
+ const pollingIntervalMs = args.pollingIntervalMs;
382
+ if (pollingIntervalMs !== void 0 && pollingIntervalMs < MIN_POLLING_INTERVAL_MS) {
383
+ throw new Error(`pollingIntervalMs must be at least ${MIN_POLLING_INTERVAL_MS}ms`);
384
+ }
385
+ const client = useSonarClient();
386
+ const [state, setState] = useState2({
387
+ loading: false
388
+ });
389
+ const refetch = useCallback2(async () => {
390
+ setState((s) => ({ ...s, loading: true }));
391
+ try {
392
+ const resp = await client.readCommitmentData({ saleUUID });
393
+ setState({
394
+ loading: false,
395
+ commitmentData: resp,
396
+ error: void 0
397
+ });
398
+ } catch (err) {
399
+ const error = err instanceof Error ? err : new Error(String(err));
400
+ setState({ loading: false, commitmentData: void 0, error });
401
+ }
402
+ }, [client, saleUUID]);
403
+ useEffect2(() => {
404
+ refetch();
405
+ if (pollingIntervalMs === void 0) {
406
+ return;
407
+ }
408
+ const intervalId = setInterval(() => {
409
+ refetch();
410
+ }, pollingIntervalMs);
411
+ return () => {
412
+ clearInterval(intervalId);
413
+ };
414
+ }, [refetch, pollingIntervalMs]);
415
+ return state;
416
+ }
282
417
  export {
283
418
  SonarProvider,
419
+ useCommitmentData,
420
+ useEntityInvestmentHistory,
284
421
  useSonarAuth,
285
422
  useSonarClient,
286
423
  useSonarEntities,
287
424
  useSonarEntity,
425
+ useSonarProfile,
288
426
  useSonarPurchase
289
427
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@echoxyz/sonar-react",
3
- "version": "0.12.1",
3
+ "version": "0.13.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -16,7 +16,7 @@
16
16
  "react": ">=18"
17
17
  },
18
18
  "dependencies": {
19
- "@echoxyz/sonar-core": "0.12.0"
19
+ "@echoxyz/sonar-core": "0.14.0"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@testing-library/react": "^16.0.0",