@fonderie/react-native-auth 0.4.0 → 0.6.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/dist/index.js CHANGED
@@ -1,16 +1,100 @@
1
1
  // src/index.ts
2
- import { FonderieApiError as FonderieApiError7, isMfaRequired as isMfaRequired2 } from "@fonderie/client";
2
+ import { FonderieApiError as FonderieApiError12, isMfaRequired as isMfaRequired2 } from "@fonderie/client";
3
3
 
4
- // src/hooks/useForgotPassword.ts
4
+ // src/hooks/useAccountData.ts
5
5
  import { FonderieApiError } from "@fonderie/client";
6
6
  import { useFonderieSubClient } from "@fonderie/react";
7
7
  import { useCallback, useState } from "react";
8
- function useForgotPassword(client) {
9
- const auth = useFonderieSubClient(client, (c) => c.auth, "useForgotPassword");
8
+
9
+ // src/storage.ts
10
+ import AsyncStorage from "@react-native-async-storage/async-storage";
11
+ var TOKEN_KEY = "fonderie_access_token";
12
+ function persistToken(token) {
13
+ return AsyncStorage.setItem(TOKEN_KEY, token);
14
+ }
15
+ function clearToken() {
16
+ return AsyncStorage.removeItem(TOKEN_KEY);
17
+ }
18
+ function readToken() {
19
+ return AsyncStorage.getItem(TOKEN_KEY);
20
+ }
21
+
22
+ // src/hooks/useAccountData.ts
23
+ function useAccountData(client) {
24
+ const auth = useFonderieSubClient(client, (c) => c.auth, "useAccountData");
10
25
  const [isLoading, setIsLoading] = useState(false);
11
26
  const [error, setError] = useState(null);
12
- const [sent, setSent] = useState(false);
13
- const forgotPassword = useCallback(
27
+ const run = useCallback(async (op) => {
28
+ setIsLoading(true);
29
+ setError(null);
30
+ try {
31
+ return await op();
32
+ } catch (err) {
33
+ const apiError = err instanceof FonderieApiError ? err : new FonderieApiError("unknown", String(err), 0);
34
+ setError(apiError);
35
+ throw apiError;
36
+ } finally {
37
+ setIsLoading(false);
38
+ }
39
+ }, []);
40
+ const exportData = useCallback(
41
+ () => run(async () => {
42
+ const { result } = await auth.exportData();
43
+ return result;
44
+ }),
45
+ [auth, run]
46
+ );
47
+ const deleteUser = useCallback(
48
+ () => run(async () => {
49
+ await auth.deleteUser();
50
+ auth.setAccessToken(void 0);
51
+ await clearToken();
52
+ }),
53
+ [auth, run]
54
+ );
55
+ return { exportData, deleteUser, isLoading, error };
56
+ }
57
+
58
+ // src/hooks/useChangePassword.ts
59
+ import { FonderieApiError as FonderieApiError2 } from "@fonderie/client";
60
+ import { useFonderieSubClient as useFonderieSubClient2 } from "@fonderie/react";
61
+ import { useCallback as useCallback2, useState as useState2 } from "react";
62
+ function useChangePassword(client) {
63
+ const auth = useFonderieSubClient2(client, (c) => c.auth, "useChangePassword");
64
+ const [isLoading, setIsLoading] = useState2(false);
65
+ const [error, setError] = useState2(null);
66
+ const [done, setDone] = useState2(false);
67
+ const changePassword = useCallback2(
68
+ async (input) => {
69
+ setIsLoading(true);
70
+ setError(null);
71
+ setDone(false);
72
+ try {
73
+ await auth.changePassword(input);
74
+ setDone(true);
75
+ } catch (err) {
76
+ const apiError = err instanceof FonderieApiError2 ? err : new FonderieApiError2("unknown", String(err), 0);
77
+ setError(apiError);
78
+ throw apiError;
79
+ } finally {
80
+ setIsLoading(false);
81
+ }
82
+ },
83
+ [auth]
84
+ );
85
+ return { changePassword, isLoading, error, done };
86
+ }
87
+
88
+ // src/hooks/useForgotPassword.ts
89
+ import { FonderieApiError as FonderieApiError3 } from "@fonderie/client";
90
+ import { useFonderieSubClient as useFonderieSubClient3 } from "@fonderie/react";
91
+ import { useCallback as useCallback3, useState as useState3 } from "react";
92
+ function useForgotPassword(client) {
93
+ const auth = useFonderieSubClient3(client, (c) => c.auth, "useForgotPassword");
94
+ const [isLoading, setIsLoading] = useState3(false);
95
+ const [error, setError] = useState3(null);
96
+ const [sent, setSent] = useState3(false);
97
+ const forgotPassword = useCallback3(
14
98
  async (email) => {
15
99
  setIsLoading(true);
16
100
  setError(null);
@@ -18,7 +102,7 @@ function useForgotPassword(client) {
18
102
  await auth.forgotPassword(email);
19
103
  setSent(true);
20
104
  } catch (err) {
21
- const apiError = err instanceof FonderieApiError ? err : new FonderieApiError("unknown", String(err), 0);
105
+ const apiError = err instanceof FonderieApiError3 ? err : new FonderieApiError3("unknown", String(err), 0);
22
106
  setError(apiError);
23
107
  throw apiError;
24
108
  } finally {
@@ -31,31 +115,16 @@ function useForgotPassword(client) {
31
115
  }
32
116
 
33
117
  // src/hooks/useLogin.ts
34
- import { FonderieApiError as FonderieApiError2, isMfaRequired } from "@fonderie/client";
35
- import { useFonderieSubClient as useFonderieSubClient2 } from "@fonderie/react";
36
- import { useCallback as useCallback2, useState as useState2 } from "react";
37
-
38
- // src/storage.ts
39
- import AsyncStorage from "@react-native-async-storage/async-storage";
40
- var TOKEN_KEY = "fonderie_access_token";
41
- function persistToken(token) {
42
- return AsyncStorage.setItem(TOKEN_KEY, token);
43
- }
44
- function clearToken() {
45
- return AsyncStorage.removeItem(TOKEN_KEY);
46
- }
47
- function readToken() {
48
- return AsyncStorage.getItem(TOKEN_KEY);
49
- }
50
-
51
- // src/hooks/useLogin.ts
118
+ import { FonderieApiError as FonderieApiError4, isMfaRequired } from "@fonderie/client";
119
+ import { useFonderieSubClient as useFonderieSubClient4 } from "@fonderie/react";
120
+ import { useCallback as useCallback4, useState as useState4 } from "react";
52
121
  function useLogin(client) {
53
- const auth = useFonderieSubClient2(client, (c) => c.auth, "useLogin");
54
- const [isLoading, setIsLoading] = useState2(false);
55
- const [error, setError] = useState2(null);
56
- const [data, setData] = useState2(null);
57
- const [mfaPending, setMfaPending] = useState2(null);
58
- const login = useCallback2(
122
+ const auth = useFonderieSubClient4(client, (c) => c.auth, "useLogin");
123
+ const [isLoading, setIsLoading] = useState4(false);
124
+ const [error, setError] = useState4(null);
125
+ const [data, setData] = useState4(null);
126
+ const [mfaPending, setMfaPending] = useState4(null);
127
+ const login = useCallback4(
59
128
  async (input) => {
60
129
  setIsLoading(true);
61
130
  setError(null);
@@ -71,7 +140,7 @@ function useLogin(client) {
71
140
  setData(result);
72
141
  return result;
73
142
  } catch (err) {
74
- const apiError = err instanceof FonderieApiError2 ? err : new FonderieApiError2("unknown", String(err), 0);
143
+ const apiError = err instanceof FonderieApiError4 ? err : new FonderieApiError4("unknown", String(err), 0);
75
144
  setError(apiError);
76
145
  throw apiError;
77
146
  } finally {
@@ -83,21 +152,179 @@ function useLogin(client) {
83
152
  return { login, isLoading, error, data, mfaPending };
84
153
  }
85
154
 
155
+ // src/hooks/useMfaLogin.ts
156
+ import { FonderieApiError as FonderieApiError5 } from "@fonderie/client";
157
+ import { useFonderieSubClient as useFonderieSubClient5 } from "@fonderie/react";
158
+ import { useCallback as useCallback5, useState as useState5 } from "react";
159
+ function useMfaLogin(client) {
160
+ const auth = useFonderieSubClient5(client, (c) => c.auth, "useMfaLogin");
161
+ const [isLoading, setIsLoading] = useState5(false);
162
+ const [error, setError] = useState5(null);
163
+ const [data, setData] = useState5(null);
164
+ const verifyLogin = useCallback5(
165
+ async (mfaToken, code) => {
166
+ setIsLoading(true);
167
+ setError(null);
168
+ try {
169
+ const { result } = await auth.mfa.verifyLogin(mfaToken, code);
170
+ auth.setAccessToken(result.tokens.access);
171
+ await persistToken(result.tokens.access);
172
+ setData(result);
173
+ return result;
174
+ } catch (err) {
175
+ const apiError = err instanceof FonderieApiError5 ? err : new FonderieApiError5("unknown", String(err), 0);
176
+ setError(apiError);
177
+ throw apiError;
178
+ } finally {
179
+ setIsLoading(false);
180
+ }
181
+ },
182
+ [auth]
183
+ );
184
+ return { verifyLogin, isLoading, error, data };
185
+ }
186
+
187
+ // src/hooks/useMfaSetup.ts
188
+ import { FonderieApiError as FonderieApiError6 } from "@fonderie/client";
189
+ import { useFonderieSubClient as useFonderieSubClient6 } from "@fonderie/react";
190
+ import { useCallback as useCallback6, useState as useState6 } from "react";
191
+ function useMfaSetup(client) {
192
+ const auth = useFonderieSubClient6(client, (c) => c.auth, "useMfaSetup");
193
+ const [setupData, setSetupData] = useState6(null);
194
+ const [isLoading, setIsLoading] = useState6(false);
195
+ const [error, setError] = useState6(null);
196
+ const run = useCallback6(async (op) => {
197
+ setIsLoading(true);
198
+ setError(null);
199
+ try {
200
+ return await op();
201
+ } catch (err) {
202
+ const apiError = err instanceof FonderieApiError6 ? err : new FonderieApiError6("unknown", String(err), 0);
203
+ setError(apiError);
204
+ throw apiError;
205
+ } finally {
206
+ setIsLoading(false);
207
+ }
208
+ }, []);
209
+ const setup = useCallback6(
210
+ () => run(async () => {
211
+ const { result } = await auth.mfa.setup();
212
+ setSetupData(result);
213
+ return result;
214
+ }),
215
+ [auth, run]
216
+ );
217
+ const verify = useCallback6(
218
+ (code) => run(async () => {
219
+ const { result } = await auth.mfa.verify(code);
220
+ auth.setAccessToken(result.tokens.access);
221
+ await persistToken(result.tokens.access);
222
+ return result;
223
+ }),
224
+ [auth, run]
225
+ );
226
+ const disable = useCallback6(
227
+ (code) => run(async () => {
228
+ await auth.mfa.disable(code);
229
+ }),
230
+ [auth, run]
231
+ );
232
+ const regenerateBackupCodes = useCallback6(
233
+ (code) => run(async () => {
234
+ const { result } = await auth.mfa.regenerateBackupCodes(code);
235
+ return result.backupCodes;
236
+ }),
237
+ [auth, run]
238
+ );
239
+ return { setup, setupData, verify, disable, regenerateBackupCodes, isLoading, error };
240
+ }
241
+
242
+ // src/hooks/useProfile.ts
243
+ import { FonderieApiError as FonderieApiError7 } from "@fonderie/client";
244
+ import { useFonderieSubClient as useFonderieSubClient7 } from "@fonderie/react";
245
+ import { useCallback as useCallback7, useEffect, useState as useState7 } from "react";
246
+ function useProfile(client) {
247
+ const auth = useFonderieSubClient7(client, (c) => c.auth, "useProfile");
248
+ const [user, setUser] = useState7(null);
249
+ const [isLoading, setIsLoading] = useState7(true);
250
+ const [error, setError] = useState7(null);
251
+ const refresh = useCallback7(async () => {
252
+ setIsLoading(true);
253
+ setError(null);
254
+ try {
255
+ const { result } = await auth.getUser();
256
+ setUser(result.user);
257
+ } catch (err) {
258
+ const apiError = err instanceof FonderieApiError7 ? err : new FonderieApiError7("unknown", String(err), 0);
259
+ setError(apiError);
260
+ } finally {
261
+ setIsLoading(false);
262
+ }
263
+ }, [auth]);
264
+ const mutate = useCallback7(
265
+ async (op) => {
266
+ setError(null);
267
+ try {
268
+ return await op();
269
+ } catch (err) {
270
+ const apiError = err instanceof FonderieApiError7 ? err : new FonderieApiError7("unknown", String(err), 0);
271
+ setError(apiError);
272
+ throw apiError;
273
+ }
274
+ },
275
+ []
276
+ );
277
+ const updateProfile = useCallback7(
278
+ (input) => mutate(async () => {
279
+ const { result } = await auth.updateProfile(input);
280
+ setUser(result.user);
281
+ return result.user;
282
+ }),
283
+ [auth, mutate]
284
+ );
285
+ const updatePreferences = useCallback7(
286
+ (input) => mutate(async () => {
287
+ const { result } = await auth.updatePreferences(input);
288
+ setUser(result.user);
289
+ return result.user;
290
+ }),
291
+ [auth, mutate]
292
+ );
293
+ const updateEmail = useCallback7(
294
+ (email) => mutate(async () => {
295
+ await auth.updateEmail(email);
296
+ await refresh();
297
+ }),
298
+ [auth, mutate, refresh]
299
+ );
300
+ const updatePhone = useCallback7(
301
+ (phone) => mutate(async () => {
302
+ await auth.updatePhone(phone);
303
+ await refresh();
304
+ }),
305
+ [auth, mutate, refresh]
306
+ );
307
+ useEffect(() => {
308
+ void refresh();
309
+ }, [refresh]);
310
+ return { user, refresh, updateProfile, updatePreferences, updateEmail, updatePhone, isLoading, error };
311
+ }
312
+
86
313
  // src/hooks/useLogout.ts
87
- import { FonderieApiError as FonderieApiError3 } from "@fonderie/client";
88
- import { useFonderieSubClient as useFonderieSubClient3 } from "@fonderie/react";
89
- import { useCallback as useCallback3, useState as useState3 } from "react";
314
+ import { FonderieApiError as FonderieApiError8 } from "@fonderie/client";
315
+ import { useFonderieSubClient as useFonderieSubClient8 } from "@fonderie/react";
316
+ import { useCallback as useCallback8, useState as useState8 } from "react";
90
317
  function useLogout(client) {
91
- const auth = useFonderieSubClient3(client, (c) => c.auth, "useLogout");
92
- const [isLoading, setIsLoading] = useState3(false);
93
- const [error, setError] = useState3(null);
94
- const logout = useCallback3(async (refreshToken) => {
318
+ const auth = useFonderieSubClient8(client, (c) => c.auth, "useLogout");
319
+ const [isLoading, setIsLoading] = useState8(false);
320
+ const [error, setError] = useState8(null);
321
+ const logout = useCallback8(async (refreshToken) => {
95
322
  setIsLoading(true);
96
323
  setError(null);
97
324
  try {
98
325
  await auth.logout(refreshToken);
99
326
  } catch (err) {
100
- const apiError = err instanceof FonderieApiError3 ? err : new FonderieApiError3("unknown", String(err), 0);
327
+ const apiError = err instanceof FonderieApiError8 ? err : new FonderieApiError8("unknown", String(err), 0);
101
328
  setError(apiError);
102
329
  } finally {
103
330
  auth.setAccessToken(void 0);
@@ -109,15 +336,15 @@ function useLogout(client) {
109
336
  }
110
337
 
111
338
  // src/hooks/useRegister.ts
112
- import { FonderieApiError as FonderieApiError4 } from "@fonderie/client";
113
- import { useFonderieSubClient as useFonderieSubClient4 } from "@fonderie/react";
114
- import { useCallback as useCallback4, useState as useState4 } from "react";
339
+ import { FonderieApiError as FonderieApiError9 } from "@fonderie/client";
340
+ import { useFonderieSubClient as useFonderieSubClient9 } from "@fonderie/react";
341
+ import { useCallback as useCallback9, useState as useState9 } from "react";
115
342
  function useRegister(client) {
116
- const auth = useFonderieSubClient4(client, (c) => c.auth, "useRegister");
117
- const [isLoading, setIsLoading] = useState4(false);
118
- const [error, setError] = useState4(null);
119
- const [data, setData] = useState4(null);
120
- const register = useCallback4(
343
+ const auth = useFonderieSubClient9(client, (c) => c.auth, "useRegister");
344
+ const [isLoading, setIsLoading] = useState9(false);
345
+ const [error, setError] = useState9(null);
346
+ const [data, setData] = useState9(null);
347
+ const register = useCallback9(
121
348
  async (input) => {
122
349
  setIsLoading(true);
123
350
  setError(null);
@@ -128,7 +355,7 @@ function useRegister(client) {
128
355
  setData(result);
129
356
  return result;
130
357
  } catch (err) {
131
- const apiError = err instanceof FonderieApiError4 ? err : new FonderieApiError4("unknown", String(err), 0);
358
+ const apiError = err instanceof FonderieApiError9 ? err : new FonderieApiError9("unknown", String(err), 0);
132
359
  setError(apiError);
133
360
  throw apiError;
134
361
  } finally {
@@ -141,15 +368,15 @@ function useRegister(client) {
141
368
  }
142
369
 
143
370
  // src/hooks/useResetPassword.ts
144
- import { FonderieApiError as FonderieApiError5 } from "@fonderie/client";
145
- import { useFonderieSubClient as useFonderieSubClient5 } from "@fonderie/react";
146
- import { useCallback as useCallback5, useState as useState5 } from "react";
371
+ import { FonderieApiError as FonderieApiError10 } from "@fonderie/client";
372
+ import { useFonderieSubClient as useFonderieSubClient10 } from "@fonderie/react";
373
+ import { useCallback as useCallback10, useState as useState10 } from "react";
147
374
  function useResetPassword(client) {
148
- const auth = useFonderieSubClient5(client, (c) => c.auth, "useResetPassword");
149
- const [isLoading, setIsLoading] = useState5(false);
150
- const [error, setError] = useState5(null);
151
- const [done, setDone] = useState5(false);
152
- const resetPassword = useCallback5(
375
+ const auth = useFonderieSubClient10(client, (c) => c.auth, "useResetPassword");
376
+ const [isLoading, setIsLoading] = useState10(false);
377
+ const [error, setError] = useState10(null);
378
+ const [done, setDone] = useState10(false);
379
+ const resetPassword = useCallback10(
153
380
  async (input) => {
154
381
  setIsLoading(true);
155
382
  setError(null);
@@ -157,7 +384,7 @@ function useResetPassword(client) {
157
384
  await auth.resetPassword(input);
158
385
  setDone(true);
159
386
  } catch (err) {
160
- const apiError = err instanceof FonderieApiError5 ? err : new FonderieApiError5("unknown", String(err), 0);
387
+ const apiError = err instanceof FonderieApiError10 ? err : new FonderieApiError10("unknown", String(err), 0);
161
388
  setError(apiError);
162
389
  throw apiError;
163
390
  } finally {
@@ -170,14 +397,14 @@ function useResetPassword(client) {
170
397
  }
171
398
 
172
399
  // src/hooks/useSession.ts
173
- import { useFonderieSubClient as useFonderieSubClient6 } from "@fonderie/react";
174
- import { useCallback as useCallback6, useEffect, useState as useState6 } from "react";
400
+ import { useFonderieSubClient as useFonderieSubClient11 } from "@fonderie/react";
401
+ import { useCallback as useCallback11, useEffect as useEffect2, useState as useState11 } from "react";
175
402
  function useSession(client) {
176
- const auth = useFonderieSubClient6(client, (c) => c.auth, "useSession");
177
- const [user, setUser] = useState6(null);
178
- const [isLoading, setIsLoading] = useState6(true);
179
- const [isAuthenticated, setIsAuthenticated] = useState6(false);
180
- const refresh = useCallback6(async () => {
403
+ const auth = useFonderieSubClient11(client, (c) => c.auth, "useSession");
404
+ const [user, setUser] = useState11(null);
405
+ const [isLoading, setIsLoading] = useState11(true);
406
+ const [isAuthenticated, setIsAuthenticated] = useState11(false);
407
+ const refresh = useCallback11(async () => {
181
408
  setIsLoading(true);
182
409
  try {
183
410
  const { result } = await auth.getUser();
@@ -192,7 +419,7 @@ function useSession(client) {
192
419
  setIsLoading(false);
193
420
  }
194
421
  }, [auth]);
195
- const logout = useCallback6(async (refreshToken) => {
422
+ const logout = useCallback11(async (refreshToken) => {
196
423
  try {
197
424
  await auth.logout(refreshToken);
198
425
  } catch {
@@ -202,7 +429,7 @@ function useSession(client) {
202
429
  setUser(null);
203
430
  setIsAuthenticated(false);
204
431
  }, [auth]);
205
- useEffect(() => {
432
+ useEffect2(() => {
206
433
  readToken().then((token) => {
207
434
  if (token) auth.setAccessToken(token);
208
435
  void refresh();
@@ -212,15 +439,31 @@ function useSession(client) {
212
439
  }
213
440
 
214
441
  // src/hooks/useVerifyEmail.ts
215
- import { FonderieApiError as FonderieApiError6 } from "@fonderie/client";
216
- import { useFonderieSubClient as useFonderieSubClient7 } from "@fonderie/react";
217
- import { useCallback as useCallback7, useState as useState7 } from "react";
442
+ import { FonderieApiError as FonderieApiError11 } from "@fonderie/client";
443
+ import { useFonderieSubClient as useFonderieSubClient12 } from "@fonderie/react";
444
+ import { useCallback as useCallback12, useState as useState12 } from "react";
218
445
  function useVerifyEmail(client) {
219
- const auth = useFonderieSubClient7(client, (c) => c.auth, "useVerifyEmail");
220
- const [isLoading, setIsLoading] = useState7(false);
221
- const [error, setError] = useState7(null);
222
- const [data, setData] = useState7(null);
223
- const verifyEmail = useCallback7(
446
+ const auth = useFonderieSubClient12(client, (c) => c.auth, "useVerifyEmail");
447
+ const [isLoading, setIsLoading] = useState12(false);
448
+ const [error, setError] = useState12(null);
449
+ const [data, setData] = useState12(null);
450
+ const [resent, setResent] = useState12(false);
451
+ const resend = useCallback12(async () => {
452
+ setIsLoading(true);
453
+ setError(null);
454
+ setResent(false);
455
+ try {
456
+ await auth.sendVerificationEmail();
457
+ setResent(true);
458
+ } catch (err) {
459
+ const apiError = err instanceof FonderieApiError11 ? err : new FonderieApiError11("unknown", String(err), 0);
460
+ setError(apiError);
461
+ throw apiError;
462
+ } finally {
463
+ setIsLoading(false);
464
+ }
465
+ }, [auth]);
466
+ const verifyEmail = useCallback12(
224
467
  async (pin) => {
225
468
  setIsLoading(true);
226
469
  setError(null);
@@ -229,7 +472,7 @@ function useVerifyEmail(client) {
229
472
  setData(result);
230
473
  return result;
231
474
  } catch (err) {
232
- const apiError = err instanceof FonderieApiError6 ? err : new FonderieApiError6("unknown", String(err), 0);
475
+ const apiError = err instanceof FonderieApiError11 ? err : new FonderieApiError11("unknown", String(err), 0);
233
476
  setError(apiError);
234
477
  throw apiError;
235
478
  } finally {
@@ -238,14 +481,23 @@ function useVerifyEmail(client) {
238
481
  },
239
482
  [auth]
240
483
  );
241
- return { verifyEmail, isLoading, error, data };
484
+ return { verifyEmail, resend, resent, isLoading, error, data };
242
485
  }
243
486
  export {
244
- FonderieApiError7 as FonderieApiError,
487
+ FonderieApiError12 as FonderieApiError,
488
+ TOKEN_KEY,
489
+ clearToken,
245
490
  isMfaRequired2 as isMfaRequired,
491
+ persistToken,
492
+ readToken,
493
+ useAccountData,
494
+ useChangePassword,
246
495
  useForgotPassword,
247
496
  useLogin,
248
497
  useLogout,
498
+ useMfaLogin,
499
+ useMfaSetup,
500
+ useProfile,
249
501
  useRegister,
250
502
  useResetPassword,
251
503
  useSession,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/hooks/useForgotPassword.ts","../src/hooks/useLogin.ts","../src/storage.ts","../src/hooks/useLogout.ts","../src/hooks/useRegister.ts","../src/hooks/useResetPassword.ts","../src/hooks/useSession.ts","../src/hooks/useVerifyEmail.ts"],"sourcesContent":["export type {\n\tAuthClient,\n\tILoginInput,\n\tILoginResult,\n\tIMfaRequiredResult,\n\tIRegisterInput,\n\tIRegisterResult,\n\tIResetPasswordInput,\n\tITokens,\n\tIUserDTO,\n\tIVerifyEmailResult,\n} from '@fonderie/client';\n\nexport { FonderieApiError, isMfaRequired } from '@fonderie/client';\nexport type {\n\tIUseForgotPasswordReturn,\n\tIUseLoginReturn,\n\tIUseLogoutReturn,\n\tIUseRegisterReturn,\n\tIUseResetPasswordReturn,\n\tIUseSessionReturn,\n\tIUseVerifyEmailReturn,\n} from './hooks';\nexport {\n\tuseForgotPassword,\n\tuseLogin,\n\tuseLogout,\n\tuseRegister,\n\tuseResetPassword,\n\tuseSession,\n\tuseVerifyEmail,\n} from './hooks';\n","import type { AuthClient } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\n\nexport interface IUseForgotPasswordReturn {\n\tforgotPassword: (email: string) => Promise<void>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\tsent: boolean;\n}\n\nexport function useForgotPassword(client?: AuthClient): IUseForgotPasswordReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useForgotPassword');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\tconst [sent, setSent] = useState(false);\n\n\tconst forgotPassword = useCallback(\n\t\tasync (email: string) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tawait auth.forgotPassword(email);\n\t\t\t\tsetSent(true);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[auth],\n\t);\n\n\treturn { forgotPassword, isLoading, error, sent };\n}\n","import type { AuthClient, ILoginInput, ILoginResult, IMfaRequiredResult } from '@fonderie/client';\nimport { FonderieApiError, isMfaRequired } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\nimport { persistToken } from '../storage';\n\nexport interface IUseLoginReturn {\n\tlogin: (input: ILoginInput) => Promise<ILoginResult | IMfaRequiredResult>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\tdata: ILoginResult | null;\n\t// Set when the account requires MFA: no tokens were issued — complete the\n\t// login with client.auth.mfa.verifyLogin(mfaPending.mfaToken, code).\n\tmfaPending: IMfaRequiredResult | null;\n}\n\nexport function useLogin(client?: AuthClient): IUseLoginReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useLogin');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\tconst [data, setData] = useState<ILoginResult | null>(null);\n\tconst [mfaPending, setMfaPending] = useState<IMfaRequiredResult | null>(null);\n\n\tconst login = useCallback(\n\t\tasync (input: ILoginInput) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\tsetMfaPending(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await auth.login(input);\n\t\t\t\tif (isMfaRequired(result)) {\n\t\t\t\t\tsetMfaPending(result);\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t\tauth.setAccessToken(result.tokens.access);\n\t\t\t\tawait persistToken(result.tokens.access);\n\t\t\t\tsetData(result);\n\t\t\t\treturn result;\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[auth],\n\t);\n\n\treturn { login, isLoading, error, data, mfaPending };\n}\n","import AsyncStorage from '@react-native-async-storage/async-storage';\n\nexport const TOKEN_KEY = 'fonderie_access_token';\n\nexport function persistToken(token: string) {\n\treturn AsyncStorage.setItem(TOKEN_KEY, token);\n}\n\nexport function clearToken() {\n\treturn AsyncStorage.removeItem(TOKEN_KEY);\n}\n\nexport function readToken() {\n\treturn AsyncStorage.getItem(TOKEN_KEY);\n}\n","import type { AuthClient } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\nimport { clearToken } from '../storage';\n\nexport interface IUseLogoutReturn {\n\tlogout: (refreshToken?: string) => Promise<void>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n}\n\nexport function useLogout(client?: AuthClient): IUseLogoutReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useLogout');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst logout = useCallback(async (refreshToken?: string) => {\n\t\tsetIsLoading(true);\n\t\tsetError(null);\n\t\ttry {\n\t\t\tawait auth.logout(refreshToken);\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\tsetError(apiError);\n\t\t} finally {\n\t\t\tauth.setAccessToken(undefined);\n\t\t\tawait clearToken();\n\t\t\tsetIsLoading(false);\n\t\t}\n\t}, [auth]);\n\n\treturn { logout, isLoading, error };\n}\n","import type { AuthClient, IRegisterInput, IRegisterResult } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\nimport { persistToken } from '../storage';\n\nexport interface IUseRegisterReturn {\n\tregister: (input: IRegisterInput) => Promise<IRegisterResult>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\tdata: IRegisterResult | null;\n}\n\nexport function useRegister(client?: AuthClient): IUseRegisterReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useRegister');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\tconst [data, setData] = useState<IRegisterResult | null>(null);\n\n\tconst register = useCallback(\n\t\tasync (input: IRegisterInput) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await auth.register(input);\n\t\t\t\tauth.setAccessToken(result.tokens.access);\n\t\t\t\tawait persistToken(result.tokens.access);\n\t\t\t\tsetData(result);\n\t\t\t\treturn result;\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[auth],\n\t);\n\n\treturn { register, isLoading, error, data };\n}\n","import type { AuthClient, IResetPasswordInput } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\n\nexport interface IUseResetPasswordReturn {\n\tresetPassword: (input: IResetPasswordInput) => Promise<void>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\tdone: boolean;\n}\n\nexport function useResetPassword(client?: AuthClient): IUseResetPasswordReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useResetPassword');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\tconst [done, setDone] = useState(false);\n\n\tconst resetPassword = useCallback(\n\t\tasync (input: IResetPasswordInput) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tawait auth.resetPassword(input);\n\t\t\t\tsetDone(true);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[auth],\n\t);\n\n\treturn { resetPassword, isLoading, error, done };\n}\n","import type { AuthClient, IUserDTO } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\nimport { clearToken, readToken } from '../storage';\n\nexport interface IUseSessionReturn {\n\tuser: IUserDTO | null;\n\tisLoading: boolean;\n\tisAuthenticated: boolean;\n\trefresh: () => Promise<void>;\n\tlogout: (refreshToken?: string) => Promise<void>;\n}\n\nexport function useSession(client?: AuthClient): IUseSessionReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useSession');\n\tconst [user, setUser] = useState<IUserDTO | null>(null);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [isAuthenticated, setIsAuthenticated] = useState(false);\n\n\tconst refresh = useCallback(async () => {\n\t\tsetIsLoading(true);\n\t\ttry {\n\t\t\tconst { result } = await auth.getUser();\n\t\t\tsetUser(result.user);\n\t\t\tsetIsAuthenticated(true);\n\t\t} catch {\n\t\t\tsetUser(null);\n\t\t\tsetIsAuthenticated(false);\n\t\t\tauth.setAccessToken(undefined);\n\t\t\tawait clearToken();\n\t\t} finally {\n\t\t\tsetIsLoading(false);\n\t\t}\n\t}, [auth]);\n\n\tconst logout = useCallback(async (refreshToken?: string) => {\n\t\ttry {\n\t\t\tawait auth.logout(refreshToken);\n\t\t} catch {\n\t\t\t// Session is being torn down regardless of server response.\n\t\t}\n\t\tauth.setAccessToken(undefined);\n\t\tawait clearToken();\n\t\tsetUser(null);\n\t\tsetIsAuthenticated(false);\n\t}, [auth]);\n\n\tuseEffect(() => {\n\t\treadToken().then((token) => {\n\t\t\tif (token) auth.setAccessToken(token);\n\t\t\tvoid refresh();\n\t\t});\n\t}, [auth, refresh]);\n\n\treturn { user, isLoading, isAuthenticated, refresh, logout };\n}\n","import type { AuthClient, IVerifyEmailResult } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\n\nexport interface IUseVerifyEmailReturn {\n\tverifyEmail: (pin: string) => Promise<IVerifyEmailResult>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\tdata: IVerifyEmailResult | null;\n}\n\nexport function useVerifyEmail(client?: AuthClient): IUseVerifyEmailReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useVerifyEmail');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\tconst [data, setData] = useState<IVerifyEmailResult | null>(null);\n\n\tconst verifyEmail = useCallback(\n\t\tasync (pin: string) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await auth.verifyEmail(pin);\n\t\t\t\tsetData(result);\n\t\t\t\treturn result;\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[auth],\n\t);\n\n\treturn { verifyEmail, isLoading, error, data };\n}\n"],"mappings":";AAaA,SAAS,oBAAAA,mBAAkB,iBAAAC,sBAAqB;;;ACZhD,SAAS,wBAAwB;AACjC,SAAS,4BAA4B;AACrC,SAAS,aAAa,gBAAgB;AAS/B,SAAS,kBAAkB,QAA+C;AAChF,QAAM,OAAO,qBAAqB,QAAQ,CAAC,MAAM,EAAE,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ApiError","useFonderieSubClient","useCallback","useState","useFonderieSubClient","useState","useCallback","FonderieApiError","FonderieApiError","useFonderieSubClient","useCallback","useState","useFonderieSubClient","useState","useCallback","FonderieApiError","FonderieApiError","useFonderieSubClient","useCallback","useState","useFonderieSubClient","useState","useCallback","FonderieApiError","FonderieApiError","useFonderieSubClient","useCallback","useState","useFonderieSubClient","useCallback","useState","useFonderieSubClient","useState","useCallback","FonderieApiError","useFonderieSubClient","useCallback","useState"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/hooks/useAccountData.ts","../src/storage.ts","../src/hooks/useChangePassword.ts","../src/hooks/useForgotPassword.ts","../src/hooks/useLogin.ts","../src/hooks/useMfaLogin.ts","../src/hooks/useMfaSetup.ts","../src/hooks/useProfile.ts","../src/hooks/useLogout.ts","../src/hooks/useRegister.ts","../src/hooks/useResetPassword.ts","../src/hooks/useSession.ts","../src/hooks/useVerifyEmail.ts"],"sourcesContent":["export type {\n\tAuthClient,\n\tILoginInput,\n\tILoginResult,\n\tIMfaRequiredResult,\n\tIRegisterInput,\n\tIRegisterResult,\n\tIResetPasswordInput,\n\tITokens,\n\tIUserDTO,\n\tIVerifyEmailResult,\n} from '@fonderie/client';\n\nexport type {\n\tIChangePasswordInput,\n\tIMfaEnabledResult,\n\tIMfaSetupResult,\n\tIUpdatePreferencesInput,\n\tIUpdateProfileInput,\n} from '@fonderie/client';\nexport { FonderieApiError, isMfaRequired } from '@fonderie/client';\nexport type {\n\tIUseForgotPasswordReturn,\n\tIUseLoginReturn,\n\tIUseLogoutReturn,\n\tIUseAccountDataReturn,\n\tIUseChangePasswordReturn,\n\tIUseMfaLoginReturn,\n\tIUseMfaSetupReturn,\n\tIUseProfileReturn,\n\tIUseRegisterReturn,\n\tIUseResetPasswordReturn,\n\tIUseSessionReturn,\n\tIUseVerifyEmailReturn,\n} from './hooks';\nexport {\n\tuseForgotPassword,\n\tuseLogin,\n\tuseLogout,\n\tuseAccountData,\n\tuseChangePassword,\n\tuseMfaLogin,\n\tuseMfaSetup,\n\tuseProfile,\n\tuseRegister,\n\tuseResetPassword,\n\tuseSession,\n\tuseVerifyEmail,\n} from './hooks';\n\n// Token persistence primitives — for wiring app-level flows (e.g. the\n// client's auth.onTokensChanged) to the same storage the hooks use.\nexport { clearToken, persistToken, readToken, TOKEN_KEY } from './storage';\n","import type { AuthClient } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\nimport { clearToken } from '../storage';\n\nexport interface IUseAccountDataReturn {\n\t// GET /users/export — the caller's own data as a portable bundle (SAR).\n\texportData: () => Promise<unknown>;\n\t// Deletes the account, then tears the session down like a logout.\n\tdeleteUser: () => Promise<void>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n}\n\nexport function useAccountData(client?: AuthClient): IUseAccountDataReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useAccountData');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst run = useCallback(async <T>(op: () => Promise<T>): Promise<T> => {\n\t\tsetIsLoading(true);\n\t\tsetError(null);\n\t\ttry {\n\t\t\treturn await op();\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\tsetError(apiError);\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tsetIsLoading(false);\n\t\t}\n\t}, []);\n\n\tconst exportData = useCallback(\n\t\t() =>\n\t\t\trun(async () => {\n\t\t\t\tconst { result } = await auth.exportData();\n\t\t\t\treturn result;\n\t\t\t}),\n\t\t[auth, run],\n\t);\n\n\tconst deleteUser = useCallback(\n\t\t() =>\n\t\t\trun(async () => {\n\t\t\t\tawait auth.deleteUser();\n\t\t\t\tauth.setAccessToken(undefined);\n\t\t\t\tawait clearToken();\n\t\t\t}),\n\t\t[auth, run],\n\t);\n\n\treturn { exportData, deleteUser, isLoading, error };\n}\n","import AsyncStorage from '@react-native-async-storage/async-storage';\n\nexport const TOKEN_KEY = 'fonderie_access_token';\n\nexport function persistToken(token: string) {\n\treturn AsyncStorage.setItem(TOKEN_KEY, token);\n}\n\nexport function clearToken() {\n\treturn AsyncStorage.removeItem(TOKEN_KEY);\n}\n\nexport function readToken() {\n\treturn AsyncStorage.getItem(TOKEN_KEY);\n}\n","import type { AuthClient, IChangePasswordInput } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\n\nexport interface IUseChangePasswordReturn {\n\tchangePassword: (input: IChangePasswordInput) => Promise<void>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\tdone: boolean;\n}\n\nexport function useChangePassword(client?: AuthClient): IUseChangePasswordReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useChangePassword');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\tconst [done, setDone] = useState(false);\n\n\tconst changePassword = useCallback(\n\t\tasync (input: IChangePasswordInput) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\tsetDone(false);\n\t\t\ttry {\n\t\t\t\tawait auth.changePassword(input);\n\t\t\t\tsetDone(true);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[auth],\n\t);\n\n\treturn { changePassword, isLoading, error, done };\n}\n","import type { AuthClient } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\n\nexport interface IUseForgotPasswordReturn {\n\tforgotPassword: (email: string) => Promise<void>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\tsent: boolean;\n}\n\nexport function useForgotPassword(client?: AuthClient): IUseForgotPasswordReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useForgotPassword');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\tconst [sent, setSent] = useState(false);\n\n\tconst forgotPassword = useCallback(\n\t\tasync (email: string) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tawait auth.forgotPassword(email);\n\t\t\t\tsetSent(true);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[auth],\n\t);\n\n\treturn { forgotPassword, isLoading, error, sent };\n}\n","import type { AuthClient, ILoginInput, ILoginResult, IMfaRequiredResult } from '@fonderie/client';\nimport { FonderieApiError, isMfaRequired } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\nimport { persistToken } from '../storage';\n\nexport interface IUseLoginReturn {\n\tlogin: (input: ILoginInput) => Promise<ILoginResult | IMfaRequiredResult>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\tdata: ILoginResult | null;\n\t// Set when the account requires MFA: no tokens were issued — complete the\n\t// login with client.auth.mfa.verifyLogin(mfaPending.mfaToken, code).\n\tmfaPending: IMfaRequiredResult | null;\n}\n\nexport function useLogin(client?: AuthClient): IUseLoginReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useLogin');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\tconst [data, setData] = useState<ILoginResult | null>(null);\n\tconst [mfaPending, setMfaPending] = useState<IMfaRequiredResult | null>(null);\n\n\tconst login = useCallback(\n\t\tasync (input: ILoginInput) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\tsetMfaPending(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await auth.login(input);\n\t\t\t\tif (isMfaRequired(result)) {\n\t\t\t\t\tsetMfaPending(result);\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t\tauth.setAccessToken(result.tokens.access);\n\t\t\t\tawait persistToken(result.tokens.access);\n\t\t\t\tsetData(result);\n\t\t\t\treturn result;\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[auth],\n\t);\n\n\treturn { login, isLoading, error, data, mfaPending };\n}\n","import type { AuthClient, ILoginResult } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\nimport { persistToken } from '../storage';\n\nexport interface IUseMfaLoginReturn {\n\t// Completes a login that returned MFA_REQUIRED: verifies the TOTP code\n\t// against the temporary mfaToken from useLogin's mfaPending, then persists\n\t// the issued tokens exactly like a normal login.\n\tverifyLogin: (mfaToken: string, code: string) => Promise<ILoginResult>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\tdata: ILoginResult | null;\n}\n\nexport function useMfaLogin(client?: AuthClient): IUseMfaLoginReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useMfaLogin');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\tconst [data, setData] = useState<ILoginResult | null>(null);\n\n\tconst verifyLogin = useCallback(\n\t\tasync (mfaToken: string, code: string) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await auth.mfa.verifyLogin(mfaToken, code);\n\t\t\t\tauth.setAccessToken(result.tokens.access);\n\t\t\t\tawait persistToken(result.tokens.access);\n\t\t\t\tsetData(result);\n\t\t\t\treturn result;\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[auth],\n\t);\n\n\treturn { verifyLogin, isLoading, error, data };\n}\n","import type { AuthClient, IMfaEnabledResult, IMfaSetupResult } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\nimport { persistToken } from '../storage';\n\nexport interface IUseMfaSetupReturn {\n\t// Step 1: request a TOTP secret + otpauth URI to show as a QR code.\n\tsetup: () => Promise<IMfaSetupResult>;\n\tsetupData: IMfaSetupResult | null;\n\t// Step 2: verify the first TOTP code. The server rotates the session's\n\t// tokens on success — the hook persists them exactly like a login, so the\n\t// session stays valid after enrollment.\n\tverify: (code: string) => Promise<IMfaEnabledResult>;\n\tdisable: (code: string) => Promise<void>;\n\tregenerateBackupCodes: (code: string) => Promise<string[]>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n}\n\nexport function useMfaSetup(client?: AuthClient): IUseMfaSetupReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useMfaSetup');\n\tconst [setupData, setSetupData] = useState<IMfaSetupResult | null>(null);\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst run = useCallback(async <T>(op: () => Promise<T>): Promise<T> => {\n\t\tsetIsLoading(true);\n\t\tsetError(null);\n\t\ttry {\n\t\t\treturn await op();\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\tsetError(apiError);\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tsetIsLoading(false);\n\t\t}\n\t}, []);\n\n\tconst setup = useCallback(\n\t\t() =>\n\t\t\trun(async () => {\n\t\t\t\tconst { result } = await auth.mfa.setup();\n\t\t\t\tsetSetupData(result);\n\t\t\t\treturn result;\n\t\t\t}),\n\t\t[auth, run],\n\t);\n\n\tconst verify = useCallback(\n\t\t(code: string) =>\n\t\t\trun(async () => {\n\t\t\t\tconst { result } = await auth.mfa.verify(code);\n\t\t\t\tauth.setAccessToken(result.tokens.access);\n\t\t\t\tawait persistToken(result.tokens.access);\n\t\t\t\treturn result;\n\t\t\t}),\n\t\t[auth, run],\n\t);\n\n\tconst disable = useCallback(\n\t\t(code: string) =>\n\t\t\trun(async () => {\n\t\t\t\tawait auth.mfa.disable(code);\n\t\t\t}),\n\t\t[auth, run],\n\t);\n\n\tconst regenerateBackupCodes = useCallback(\n\t\t(code: string) =>\n\t\t\trun(async () => {\n\t\t\t\tconst { result } = await auth.mfa.regenerateBackupCodes(code);\n\t\t\t\treturn result.backupCodes;\n\t\t\t}),\n\t\t[auth, run],\n\t);\n\n\treturn { setup, setupData, verify, disable, regenerateBackupCodes, isLoading, error };\n}\n","import type {\n\tAuthClient,\n\tIUpdatePreferencesInput,\n\tIUpdateProfileInput,\n\tIUserDTO,\n} from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUseProfileReturn {\n\tuser: IUserDTO | null;\n\trefresh: () => Promise<void>;\n\tupdateProfile: (input: IUpdateProfileInput) => Promise<IUserDTO>;\n\tupdatePreferences: (input: IUpdatePreferencesInput) => Promise<IUserDTO>;\n\t// Email/phone changes re-fetch the profile (their endpoints don't return it).\n\tupdateEmail: (email: string) => Promise<void>;\n\tupdatePhone: (phone: string) => Promise<void>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n}\n\nexport function useProfile(client?: AuthClient): IUseProfileReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useProfile');\n\tconst [user, setUser] = useState<IUserDTO | null>(null);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(async () => {\n\t\tsetIsLoading(true);\n\t\tsetError(null);\n\t\ttry {\n\t\t\tconst { result } = await auth.getUser();\n\t\t\tsetUser(result.user);\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\tsetError(apiError);\n\t\t} finally {\n\t\t\tsetIsLoading(false);\n\t\t}\n\t}, [auth]);\n\n\tconst mutate = useCallback(\n\t\tasync <T>(op: () => Promise<T>): Promise<T> => {\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\treturn await op();\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t}\n\t\t},\n\t\t[],\n\t);\n\n\tconst updateProfile = useCallback(\n\t\t(input: IUpdateProfileInput) =>\n\t\t\tmutate(async () => {\n\t\t\t\tconst { result } = await auth.updateProfile(input);\n\t\t\t\tsetUser(result.user);\n\t\t\t\treturn result.user;\n\t\t\t}),\n\t\t[auth, mutate],\n\t);\n\n\tconst updatePreferences = useCallback(\n\t\t(input: IUpdatePreferencesInput) =>\n\t\t\tmutate(async () => {\n\t\t\t\tconst { result } = await auth.updatePreferences(input);\n\t\t\t\tsetUser(result.user);\n\t\t\t\treturn result.user;\n\t\t\t}),\n\t\t[auth, mutate],\n\t);\n\n\tconst updateEmail = useCallback(\n\t\t(email: string) =>\n\t\t\tmutate(async () => {\n\t\t\t\tawait auth.updateEmail(email);\n\t\t\t\tawait refresh();\n\t\t\t}),\n\t\t[auth, mutate, refresh],\n\t);\n\n\tconst updatePhone = useCallback(\n\t\t(phone: string) =>\n\t\t\tmutate(async () => {\n\t\t\t\tawait auth.updatePhone(phone);\n\t\t\t\tawait refresh();\n\t\t\t}),\n\t\t[auth, mutate, refresh],\n\t);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn { user, refresh, updateProfile, updatePreferences, updateEmail, updatePhone, isLoading, error };\n}\n","import type { AuthClient } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\nimport { clearToken } from '../storage';\n\nexport interface IUseLogoutReturn {\n\tlogout: (refreshToken?: string) => Promise<void>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n}\n\nexport function useLogout(client?: AuthClient): IUseLogoutReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useLogout');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst logout = useCallback(async (refreshToken?: string) => {\n\t\tsetIsLoading(true);\n\t\tsetError(null);\n\t\ttry {\n\t\t\tawait auth.logout(refreshToken);\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\tsetError(apiError);\n\t\t} finally {\n\t\t\tauth.setAccessToken(undefined);\n\t\t\tawait clearToken();\n\t\t\tsetIsLoading(false);\n\t\t}\n\t}, [auth]);\n\n\treturn { logout, isLoading, error };\n}\n","import type { AuthClient, IRegisterInput, IRegisterResult } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\nimport { persistToken } from '../storage';\n\nexport interface IUseRegisterReturn {\n\tregister: (input: IRegisterInput) => Promise<IRegisterResult>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\tdata: IRegisterResult | null;\n}\n\nexport function useRegister(client?: AuthClient): IUseRegisterReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useRegister');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\tconst [data, setData] = useState<IRegisterResult | null>(null);\n\n\tconst register = useCallback(\n\t\tasync (input: IRegisterInput) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await auth.register(input);\n\t\t\t\tauth.setAccessToken(result.tokens.access);\n\t\t\t\tawait persistToken(result.tokens.access);\n\t\t\t\tsetData(result);\n\t\t\t\treturn result;\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[auth],\n\t);\n\n\treturn { register, isLoading, error, data };\n}\n","import type { AuthClient, IResetPasswordInput } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\n\nexport interface IUseResetPasswordReturn {\n\tresetPassword: (input: IResetPasswordInput) => Promise<void>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\tdone: boolean;\n}\n\nexport function useResetPassword(client?: AuthClient): IUseResetPasswordReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useResetPassword');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\tconst [done, setDone] = useState(false);\n\n\tconst resetPassword = useCallback(\n\t\tasync (input: IResetPasswordInput) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tawait auth.resetPassword(input);\n\t\t\t\tsetDone(true);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[auth],\n\t);\n\n\treturn { resetPassword, isLoading, error, done };\n}\n","import type { AuthClient, IUserDTO } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\nimport { clearToken, readToken } from '../storage';\n\nexport interface IUseSessionReturn {\n\tuser: IUserDTO | null;\n\tisLoading: boolean;\n\tisAuthenticated: boolean;\n\trefresh: () => Promise<void>;\n\tlogout: (refreshToken?: string) => Promise<void>;\n}\n\nexport function useSession(client?: AuthClient): IUseSessionReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useSession');\n\tconst [user, setUser] = useState<IUserDTO | null>(null);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [isAuthenticated, setIsAuthenticated] = useState(false);\n\n\tconst refresh = useCallback(async () => {\n\t\tsetIsLoading(true);\n\t\ttry {\n\t\t\tconst { result } = await auth.getUser();\n\t\t\tsetUser(result.user);\n\t\t\tsetIsAuthenticated(true);\n\t\t} catch {\n\t\t\tsetUser(null);\n\t\t\tsetIsAuthenticated(false);\n\t\t\tauth.setAccessToken(undefined);\n\t\t\tawait clearToken();\n\t\t} finally {\n\t\t\tsetIsLoading(false);\n\t\t}\n\t}, [auth]);\n\n\tconst logout = useCallback(async (refreshToken?: string) => {\n\t\ttry {\n\t\t\tawait auth.logout(refreshToken);\n\t\t} catch {\n\t\t\t// Session is being torn down regardless of server response.\n\t\t}\n\t\tauth.setAccessToken(undefined);\n\t\tawait clearToken();\n\t\tsetUser(null);\n\t\tsetIsAuthenticated(false);\n\t}, [auth]);\n\n\tuseEffect(() => {\n\t\treadToken().then((token) => {\n\t\t\tif (token) auth.setAccessToken(token);\n\t\t\tvoid refresh();\n\t\t});\n\t}, [auth, refresh]);\n\n\treturn { user, isLoading, isAuthenticated, refresh, logout };\n}\n","import type { AuthClient, IVerifyEmailResult } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\n\nexport interface IUseVerifyEmailReturn {\n\tverifyEmail: (pin: string) => Promise<IVerifyEmailResult>;\n\t// Re-sends the verification email — the other half of the same lifecycle,\n\t// so one hook owns both and screens don't split loading/error handling.\n\tresend: () => Promise<void>;\n\tresent: boolean;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\tdata: IVerifyEmailResult | null;\n}\n\nexport function useVerifyEmail(client?: AuthClient): IUseVerifyEmailReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useVerifyEmail');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\tconst [data, setData] = useState<IVerifyEmailResult | null>(null);\n\tconst [resent, setResent] = useState(false);\n\n\tconst resend = useCallback(async () => {\n\t\tsetIsLoading(true);\n\t\tsetError(null);\n\t\tsetResent(false);\n\t\ttry {\n\t\t\tawait auth.sendVerificationEmail();\n\t\t\tsetResent(true);\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\tsetError(apiError);\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tsetIsLoading(false);\n\t\t}\n\t}, [auth]);\n\n\tconst verifyEmail = useCallback(\n\t\tasync (pin: string) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await auth.verifyEmail(pin);\n\t\t\t\tsetData(result);\n\t\t\t\treturn result;\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[auth],\n\t);\n\n\treturn { verifyEmail, resend, resent, isLoading, error, data };\n}\n"],"mappings":";AAoBA,SAAS,oBAAAA,oBAAkB,iBAAAC,sBAAqB;;;ACnBhD,SAAS,wBAAwB;AACjC,SAAS,4BAA4B;AACrC,SAAS,aAAa,gBAAgB;;;ACHtC,OAAO,kBAAkB;AAElB,IAAM,YAAY;AAElB,SAAS,aAAa,OAAe;AAC3C,SAAO,aAAa,QAAQ,WAAW,KAAK;AAC7C;AAEO,SAAS,aAAa;AAC5B,SAAO,aAAa,WAAW,SAAS;AACzC;AAEO,SAAS,YAAY;AAC3B,SAAO,aAAa,QAAQ,SAAS;AACtC;;;ADCO,SAAS,eAAe,QAA4C;AAC1E,QAAM,OAAO,qBAAqB,QAAQ,CAAC,MAAM,EAAE,MAAM,gBAAgB;AACzE,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAChD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAkC,IAAI;AAEhE,QAAM,MAAM,YAAY,OAAU,OAAqC;AACtE,iBAAa,IAAI;AACjB,aAAS,IAAI;AACb,QAAI;AACH,aAAO,MAAM,GAAG;AAAA,IACjB,SAAS,KAAK;AACb,YAAM,WACL,eAAe,mBAAmB,MAAM,IAAI,iBAAiB,WAAW,OAAO,GAAG,GAAG,CAAC;AACvF,eAAS,QAAQ;AACjB,YAAM;AAAA,IACP,UAAE;AACD,mBAAa,KAAK;AAAA,IACnB;AAAA,EACD,GAAG,CAAC,CAAC;AAEL,QAAM,aAAa;AAAA,IAClB,MACC,IAAI,YAAY;AACf,YAAM,EAAE,OAAO,IAAI,MAAM,KAAK,WAAW;AACzC,aAAO;AAAA,IACR,CAAC;AAAA,IACF,CAAC,MAAM,GAA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Y;AACtC,iBAAa,IAAI;AACjB,aAAS,IAAI;AACb,cAAU,KAAK;AACf,QAAI;AACH,YAAM,KAAK,sBAAsB;AACjC,gBAAU,IAAI;AAAA,IACf,SAAS,KAAK;AACb,YAAM,WACL,eAAeF,qBAAmB,MAAM,IAAIA,mBAAiB,WAAW,OAAO,GAAG,GAAG,CAAC;AACvF,eAAS,QAAQ;AACjB,YAAM;AAAA,IACP,UAAE;AACD,mBAAa,KAAK;AAAA,IACnB;AAAA,EACD,GAAG,CAAC,IAAI,CAAC;AAET,QAAM,cAAcE;AAAA,IACnB,OAAO,QAAgB;AACtB,mBAAa,IAAI;AACjB,eAAS,IAAI;AACb,UAAI;AACH,cAAM,EAAE,OAAO,IAAI,MAAM,KAAK,YAAY,GAAG;AAC7C,gBAAQ,MAAM;AACd,eAAO;AAAA,MACR,SAAS,KAAK;AACb,cAAM,WACL,eAAeF,qBAAmB,MAAM,IAAIA,mBAAiB,WAAW,OAAO,GAAG,GAAG,CAAC;AACvF,iBAAS,QAAQ;AACjB,cAAM;AAAA,MACP,UAAE;AACD,qBAAa,KAAK;AAAA,MACnB;AAAA,IACD;AAAA,IACA,CAAC,IAAI;AAAA,EACN;AAEA,SAAO,EAAE,aAAa,QAAQ,QAAQ,WAAW,OAAO,KAAK;AAC9D;","names":["FonderieApiError","isMfaRequired","FonderieApiError","useFonderieSubClient","useCallback","useState","FonderieApiError","useFonderieSubClient","useCallback","useState","FonderieApiError","useFonderieSubClient","useCallback","useState","useFonderieSubClient","useState","useCallback","FonderieApiError","FonderieApiError","useFonderieSubClient","useCallback","useState","useFonderieSubClient","useState","useCallback","FonderieApiError","FonderieApiError","useFonderieSubClient","useCallback","useState","useFonderieSubClient","useState","useCallback","FonderieApiError","FonderieApiError","useFonderieSubClient","useCallback","useState","FonderieApiError","useFonderieSubClient","useCallback","useState","useFonderieSubClient","useState","useCallback","FonderieApiError","FonderieApiError","useFonderieSubClient","useCallback","useState","useFonderieSubClient","useState","useCallback","FonderieApiError","FonderieApiError","useFonderieSubClient","useCallback","useState","useFonderieSubClient","useCallback","useEffect","useState","useFonderieSubClient","useState","useCallback","useEffect","FonderieApiError","useFonderieSubClient","useCallback","useState"]}