@fonderie/vue-auth 0.10.0 → 0.11.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.cjs CHANGED
@@ -20,13 +20,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
- FonderieApiError: () => import_client15.FonderieApiError,
23
+ FonderieApiError: () => import_client16.FonderieApiError,
24
24
  TOKEN_KEY: () => TOKEN_KEY,
25
25
  clearToken: () => clearToken,
26
- isMfaRequired: () => import_client15.isMfaRequired,
26
+ isMfaRequired: () => import_client16.isMfaRequired,
27
27
  persistToken: () => persistToken,
28
28
  readToken: () => readToken,
29
29
  useAccountData: () => useAccountData,
30
+ useAuthProviders: () => useAuthProviders,
30
31
  useChangePassword: () => useChangePassword,
31
32
  useForgotPassword: () => useForgotPassword,
32
33
  useLogin: () => useLogin,
@@ -39,10 +40,11 @@ __export(index_exports, {
39
40
  useResetPassword: () => useResetPassword,
40
41
  useSession: () => useSession,
41
42
  useSessions: () => useSessions,
43
+ useUnlinkOauth: () => useUnlinkOauth,
42
44
  useVerifyEmail: () => useVerifyEmail
43
45
  });
44
46
  module.exports = __toCommonJS(index_exports);
45
- var import_client15 = require("@fonderie/client");
47
+ var import_client16 = require("@fonderie/client");
46
48
 
47
49
  // src/composables/useAccountData.ts
48
50
  var import_client = require("@fonderie/client");
@@ -587,6 +589,64 @@ function useVerifyEmail(client) {
587
589
  var import_client14 = require("@fonderie/client");
588
590
  var import_vue29 = require("@fonderie/vue");
589
591
  var import_vue30 = require("vue");
592
+ function useAuthProviders(client) {
593
+ const auth = (0, import_vue29.useFonderieSubClient)(client, (c) => c.auth, "useAuthProviders");
594
+ const providers = (0, import_vue30.ref)([]);
595
+ const isLoading = (0, import_vue30.ref)(true);
596
+ const error = (0, import_vue30.ref)(null);
597
+ const refresh = async () => {
598
+ isLoading.value = true;
599
+ try {
600
+ const { result } = await auth.providers();
601
+ providers.value = result.providers;
602
+ error.value = null;
603
+ } catch (err) {
604
+ providers.value = [];
605
+ error.value = err instanceof Error ? err : new Error(String(err));
606
+ } finally {
607
+ isLoading.value = false;
608
+ }
609
+ };
610
+ (0, import_vue30.onMounted)(() => {
611
+ void refresh();
612
+ });
613
+ return {
614
+ providers,
615
+ has: (provider) => providers.value.includes(provider),
616
+ isLoading,
617
+ error,
618
+ refresh
619
+ };
620
+ }
621
+
622
+ // src/composables/useUnlinkOauth.ts
623
+ var import_client15 = require("@fonderie/client");
624
+ var import_vue31 = require("@fonderie/vue");
625
+ var import_vue32 = require("vue");
626
+ function useUnlinkOauth(client) {
627
+ const auth = (0, import_vue31.useFonderieSubClient)(client, (c) => c.auth, "useUnlinkOauth");
628
+ const isLoading = (0, import_vue32.ref)(false);
629
+ const error = (0, import_vue32.ref)(null);
630
+ const unlinked = (0, import_vue32.ref)(false);
631
+ const requiresPassword = (0, import_vue32.ref)(false);
632
+ const unlinkOauth = async (provider) => {
633
+ isLoading.value = true;
634
+ error.value = null;
635
+ requiresPassword.value = false;
636
+ try {
637
+ await auth.unlinkOauth(provider);
638
+ unlinked.value = true;
639
+ } catch (err) {
640
+ const apiError = err instanceof import_client15.FonderieApiError ? err : new import_client15.FonderieApiError("unknown", String(err), 0);
641
+ error.value = apiError;
642
+ requiresPassword.value = apiError.reason === "PASSWORD_REQUIRED";
643
+ throw apiError;
644
+ } finally {
645
+ isLoading.value = false;
646
+ }
647
+ };
648
+ return { unlinkOauth, unlinked, isLoading, error, requiresPassword };
649
+ }
590
650
  // Annotate the CommonJS export names for ESM import in node:
591
651
  0 && (module.exports = {
592
652
  FonderieApiError,
@@ -596,6 +656,7 @@ var import_vue30 = require("vue");
596
656
  persistToken,
597
657
  readToken,
598
658
  useAccountData,
659
+ useAuthProviders,
599
660
  useChangePassword,
600
661
  useForgotPassword,
601
662
  useLogin,
@@ -608,6 +669,7 @@ var import_vue30 = require("vue");
608
669
  useResetPassword,
609
670
  useSession,
610
671
  useSessions,
672
+ useUnlinkOauth,
611
673
  useVerifyEmail
612
674
  });
613
675
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/composables/useAccountData.ts","../src/storage.ts","../src/composables/useChangePassword.ts","../src/composables/useForgotPassword.ts","../src/composables/useLogin.ts","../src/composables/useLogout.ts","../src/composables/useMfaLogin.ts","../src/composables/useMfaSetup.ts","../src/composables/useProfile.ts","../src/composables/useRegister.ts","../src/composables/useResetPassword.ts","../src/composables/useSession.ts","../src/composables/useLoginHistory.ts","../src/composables/useSessions.ts","../src/composables/useVerifyEmail.ts","../src/composables/useAuthProviders.ts"],"sourcesContent":["export type {\n\tAuthClient,\n\tIChangePasswordInput,\n\tIGetLoginHistoryInput,\n\tILoginEventDTO,\n\tILoginInput,\n\tILoginResult,\n\tIMfaEnabledResult,\n\tIMfaRequiredResult,\n\tIMfaSetupResult,\n\tIRegisterInput,\n\tIRegisterResult,\n\tIResetPasswordInput,\n\tISessionDTO,\n\tITokens,\n\tIUpdatePreferencesInput,\n\tIUpdateProfileInput,\n\tIUserDTO,\n\tIVerifyEmailResult,\n} from '@fonderie/client';\n\nexport { FonderieApiError, isMfaRequired } from '@fonderie/client';\n\nexport type {\n\tIUseAccountDataReturn,\n\tIUseChangePasswordReturn,\n\tIUseForgotPasswordReturn,\n\tIUseLoginHistoryReturn,\n\tIUseLoginReturn,\n\tIUseLogoutReturn,\n\tIUseMfaLoginReturn,\n\tIUseMfaSetupReturn,\n\tIUseProfileReturn,\n\tIUseRegisterReturn,\n\tIUseResetPasswordReturn,\n\tIUseSessionReturn,\n\tIUseSessionsReturn,\n\tIUseVerifyEmailReturn,\n} from './composables';\nexport {\n\tuseAccountData,\n\tuseChangePassword,\n\tuseForgotPassword,\n\tuseLogin,\n\tuseLoginHistory,\n\tuseLogout,\n\tuseMfaLogin,\n\tuseMfaSetup,\n\tuseProfile,\n\tuseRegister,\n\tuseResetPassword,\n\tuseSession,\n\tuseSessions,\n\tuseVerifyEmail,\n} from './composables';\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/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\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: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n}\n\nexport function useAccountData(client?: AuthClient): IUseAccountDataReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useAccountData');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function run<T>(op: () => Promise<T>): Promise<T> {\n\t\tisLoading.value = true;\n\t\terror.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tfunction exportData() {\n\t\treturn run(async () => {\n\t\t\tconst { result } = await auth.exportData();\n\t\t\treturn result;\n\t\t});\n\t}\n\n\tfunction deleteUser() {\n\t\treturn run(async () => {\n\t\t\tawait auth.deleteUser();\n\t\t\tauth.setAccessToken(undefined);\n\t\t\tclearToken();\n\t\t});\n\t}\n\n\treturn { exportData, deleteUser, isLoading, error };\n}\n","export const TOKEN_KEY = 'fonderie_access_token';\n\nexport function persistToken(token: string) {\n\tlocalStorage.setItem(TOKEN_KEY, token);\n}\n\nexport function clearToken() {\n\tlocalStorage.removeItem(TOKEN_KEY);\n}\n\nexport function readToken(): string | null {\n\treturn localStorage.getItem(TOKEN_KEY);\n}\n","import type { AuthClient, IChangePasswordInput } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\n\nexport interface IUseChangePasswordReturn {\n\tchangePassword: (input: IChangePasswordInput) => Promise<void>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tdone: Ref<boolean>;\n}\n\nexport function useChangePassword(client?: AuthClient): IUseChangePasswordReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useChangePassword');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst done = ref(false);\n\n\tasync function changePassword(input: IChangePasswordInput) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\tdone.value = false;\n\t\ttry {\n\t\t\tawait auth.changePassword(input);\n\t\t\tdone.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\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/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\n\nexport interface IUseForgotPasswordReturn {\n\tforgotPassword: (email: string) => Promise<void>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tsent: Ref<boolean>;\n}\n\nexport function useForgotPassword(client?: AuthClient): IUseForgotPasswordReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useForgotPassword');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst sent = ref(false);\n\n\tasync function forgotPassword(email: string) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tawait auth.forgotPassword(email);\n\t\t\tsent.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\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/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\nimport { persistToken } from '../storage';\n\nexport interface IUseLoginReturn {\n\tlogin: (input: ILoginInput) => Promise<ILoginResult | IMfaRequiredResult>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tdata: Ref<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.value.mfaToken, code).\n\tmfaPending: Ref<IMfaRequiredResult | null>;\n}\n\nexport function useLogin(client?: AuthClient): IUseLoginReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useLogin');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst data = ref<ILoginResult | null>(null);\n\t// Set when the account requires MFA: complete the login with\n\t// client.auth.mfa.verifyLogin(mfaPending.value.mfaToken, code).\n\tconst mfaPending = ref<IMfaRequiredResult | null>(null);\n\n\tasync function login(input: ILoginInput) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\tmfaPending.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.login(input);\n\t\t\tif (isMfaRequired(result)) {\n\t\t\t\tmfaPending.value = result;\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\tauth.setAccessToken(result.tokens.access);\n\t\t\tpersistToken(result.tokens.access);\n\t\t\tdata.value = result;\n\t\t\treturn result;\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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\treturn { login, isLoading, error, data, mfaPending };\n}\n","import type { AuthClient } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\nimport { clearToken } from '../storage';\n\nexport interface IUseLogoutReturn {\n\tlogout: (refreshToken?: string) => Promise<void>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n}\n\nexport function useLogout(client?: AuthClient): IUseLogoutReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useLogout');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function logout(refreshToken?: string) {\n\t\tisLoading.value = true;\n\t\terror.value = 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\terror.value = apiError;\n\t\t} finally {\n\t\t\tauth.setAccessToken(undefined);\n\t\t\tclearToken();\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\treturn { logout, isLoading, error };\n}\n","import type { AuthClient, ILoginResult } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\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: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tdata: Ref<ILoginResult | null>;\n}\n\nexport function useMfaLogin(client?: AuthClient): IUseMfaLoginReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useMfaLogin');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst data = ref<ILoginResult | null>(null);\n\n\tasync function verifyLogin(mfaToken: string, code: string) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.mfa.verifyLogin(mfaToken, code);\n\t\t\tauth.setAccessToken(result.tokens.access);\n\t\t\tpersistToken(result.tokens.access);\n\t\t\tdata.value = result;\n\t\t\treturn result;\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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\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/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\n\nexport interface IUseMfaSetupReturn {\n\t// Step 1: request enrollment — returns a data-URI QR code to scan and the\n\t// one-time backup codes generated at setup.\n\tsetup: () => Promise<IMfaSetupResult>;\n\tsetupData: Ref<IMfaSetupResult | null>;\n\t// Step 2: verify the first TOTP code to complete enrollment. The session\n\t// token is not rotated — MFA is enforced at login, so the current session\n\t// remains valid unchanged.\n\tverify: (code: string) => Promise<IMfaEnabledResult>;\n\tdisable: (code: string) => Promise<void>;\n\tregenerateBackupCodes: (code: string) => Promise<string[]>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n}\n\nexport function useMfaSetup(client?: AuthClient): IUseMfaSetupReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useMfaSetup');\n\tconst setupData = ref<IMfaSetupResult | null>(null);\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function run<T>(op: () => Promise<T>): Promise<T> {\n\t\tisLoading.value = true;\n\t\terror.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tfunction setup() {\n\t\treturn run(async () => {\n\t\t\tconst { result } = await auth.mfa.setup();\n\t\t\tsetupData.value = result;\n\t\t\treturn result;\n\t\t});\n\t}\n\n\tfunction verify(code: string) {\n\t\treturn run(async () => {\n\t\t\tconst { result } = await auth.mfa.verify(code);\n\t\t\treturn result;\n\t\t});\n\t}\n\n\tfunction disable(code: string) {\n\t\treturn run(async () => {\n\t\t\tawait auth.mfa.disable(code);\n\t\t});\n\t}\n\n\tfunction regenerateBackupCodes(code: string) {\n\t\treturn run(async () => {\n\t\t\tconst { result } = await auth.mfa.regenerateBackupCodes(code);\n\t\t\treturn result.backupCodes;\n\t\t});\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/vue';\nimport type { Ref } from 'vue';\nimport { onMounted, ref } from 'vue';\n\nexport interface IUseProfileReturn {\n\tuser: Ref<IUserDTO | null>;\n\trefresh: (opts?: { force?: boolean }) => 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: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n}\n\nexport function useProfile(client?: AuthClient): IUseProfileReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useProfile');\n\tconst user = ref<IUserDTO | null>(null);\n\tconst isLoading = ref(true);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function refresh(opts?: { force?: boolean }) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.getUser({ bust: opts?.force });\n\t\t\tuser.value = 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\terror.value = apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tasync function mutate<T>(op: () => Promise<T>): Promise<T> {\n\t\terror.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t}\n\t}\n\n\tfunction updateProfile(input: IUpdateProfileInput) {\n\t\treturn mutate(async () => {\n\t\t\tconst { result } = await auth.updateProfile(input);\n\t\t\tuser.value = result.user;\n\t\t\treturn result.user;\n\t\t});\n\t}\n\n\tfunction updatePreferences(input: IUpdatePreferencesInput) {\n\t\treturn mutate(async () => {\n\t\t\tconst { result } = await auth.updatePreferences(input);\n\t\t\tuser.value = result.user;\n\t\t\treturn result.user;\n\t\t});\n\t}\n\n\tfunction updateEmail(email: string) {\n\t\treturn mutate(async () => {\n\t\t\tawait auth.updateEmail(email);\n\t\t\tawait refresh();\n\t\t});\n\t}\n\n\tfunction updatePhone(phone: string) {\n\t\treturn mutate(async () => {\n\t\t\tawait auth.updatePhone(phone);\n\t\t\tawait refresh();\n\t\t});\n\t}\n\n\tonMounted(() => void refresh());\n\n\treturn { user, refresh, updateProfile, updatePreferences, updateEmail, updatePhone, isLoading, error };\n}\n","import type { AuthClient, IRegisterInput, IRegisterResult } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\nimport { persistToken } from '../storage';\n\nexport interface IUseRegisterReturn {\n\tregister: (input: IRegisterInput) => Promise<IRegisterResult>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tdata: Ref<IRegisterResult | null>;\n}\n\nexport function useRegister(client?: AuthClient): IUseRegisterReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useRegister');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst data = ref<IRegisterResult | null>(null);\n\n\tasync function register(input: IRegisterInput) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.register(input);\n\t\t\tauth.setAccessToken(result.tokens.access);\n\t\t\tpersistToken(result.tokens.access);\n\t\t\tdata.value = result;\n\t\t\treturn result;\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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\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/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\n\nexport interface IUseResetPasswordReturn {\n\tresetPassword: (input: IResetPasswordInput) => Promise<void>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tdone: Ref<boolean>;\n}\n\nexport function useResetPassword(client?: AuthClient): IUseResetPasswordReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useResetPassword');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst done = ref(false);\n\n\tasync function resetPassword(input: IResetPasswordInput) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tawait auth.resetPassword(input);\n\t\t\tdone.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\treturn { resetPassword, isLoading, error, done };\n}\n","import type { AuthClient, IUserDTO } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { onMounted, ref } from 'vue';\nimport { clearToken, readToken } from '../storage';\n\nexport interface IUseSessionReturn {\n\tuser: Ref<IUserDTO | null>;\n\tisLoading: Ref<boolean>;\n\tisAuthenticated: Ref<boolean>;\n\trefresh: (opts?: { force?: boolean }) => 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 = ref<IUserDTO | null>(null);\n\tconst isLoading = ref(true);\n\tconst isAuthenticated = ref(false);\n\n\tasync function refresh(opts?: { force?: boolean }) {\n\t\tisLoading.value = true;\n\t\ttry {\n\t\t\tconst { result } = await auth.getUser({ bust: opts?.force });\n\t\t\tuser.value = result.user;\n\t\t\tisAuthenticated.value = true;\n\t\t} catch {\n\t\t\tuser.value = null;\n\t\t\tisAuthenticated.value = false;\n\t\t\tauth.setAccessToken(undefined);\n\t\t\tclearToken();\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tasync function logout(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\tclearToken();\n\t\tuser.value = null;\n\t\tisAuthenticated.value = false;\n\t}\n\n\tconst token = readToken();\n\tif (token) auth.setAccessToken(token);\n\tonMounted(() => void refresh());\n\n\treturn { user, isLoading, isAuthenticated, refresh, logout };\n}\n","import type { AuthClient, ILoginEventDTO, IGetLoginHistoryInput } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { onMounted, ref } from 'vue';\n\nexport interface IUseLoginHistoryReturn {\n\tevents: Ref<ILoginEventDTO[]>;\n\tisLoading: Ref<boolean>;\n\tisLoadingMore: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\thasMore: Ref<boolean>;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n\tloadMore: () => Promise<void>;\n}\n\n// The caller's own login attempts, newest first, keyset-paginated. Same contract\n// as react-auth's useLoginHistory (and vue-audit's useAuditEvents). Unlike React,\n// a composable body runs once, so filters need no memoization — they're captured\n// at call time.\nexport function useLoginHistory(rawFilters?: IGetLoginHistoryInput): IUseLoginHistoryReturn;\nexport function useLoginHistory(\n\tclient: AuthClient | undefined,\n\trawFilters?: IGetLoginHistoryInput,\n): IUseLoginHistoryReturn;\nexport function useLoginHistory(\n\tclientOrFilters?: AuthClient | IGetLoginHistoryInput,\n\tmaybeFilters?: IGetLoginHistoryInput,\n): IUseLoginHistoryReturn {\n\t// The AuthClient isn't reliably an instanceof across bundle boundaries, so\n\t// detect the client arg structurally (it has getLoginHistory) rather than\n\t// by prototype.\n\tconst firstIsClient =\n\t\tclientOrFilters === undefined ||\n\t\ttypeof (clientOrFilters as AuthClient).getLoginHistory === 'function';\n\tconst explicit = firstIsClient ? (clientOrFilters as AuthClient | undefined) : undefined;\n\tconst filters = (firstIsClient ? maybeFilters : (clientOrFilters as IGetLoginHistoryInput)) ?? {};\n\tconst auth = useFonderieSubClient(explicit, (c) => c.auth, 'useLoginHistory');\n\n\tconst events = ref<ILoginEventDTO[]>([]);\n\tconst isLoading = ref(true);\n\tconst isLoadingMore = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst hasMore = ref(false);\n\tlet cursor: string | null = null;\n\n\tasync function refresh(opts?: { force?: boolean }) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.getLoginHistory(filters, { bust: opts?.force });\n\t\t\tevents.value = result.events;\n\t\t\tcursor = result.nextCursor;\n\t\t\thasMore.value = result.nextCursor !== null;\n\t\t} catch (err) {\n\t\t\terror.value =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tasync function loadMore() {\n\t\tif (!cursor || isLoadingMore.value) return;\n\t\tisLoadingMore.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.getLoginHistory({ ...filters, cursor });\n\t\t\tevents.value = [...events.value, ...result.events];\n\t\t\tcursor = result.nextCursor;\n\t\t\thasMore.value = result.nextCursor !== null;\n\t\t} catch (err) {\n\t\t\terror.value =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t} finally {\n\t\t\tisLoadingMore.value = false;\n\t\t}\n\t}\n\n\tonMounted(() => void refresh());\n\n\treturn { events, isLoading, isLoadingMore, error, hasMore, refresh, loadMore };\n}\n","import type { AuthClient, ISessionDTO } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { onMounted, ref } from 'vue';\n\nexport interface IUseSessionsReturn {\n\tsessions: Ref<ISessionDTO[]>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n\t// Revoke one session. Optimistically removes it; refetches on failure.\n\tterminate: (id: string) => Promise<void>;\n\t// Revoke every session except the current one.\n\tterminateOthers: () => Promise<void>;\n}\n\nfunction toApiError(err: unknown): FonderieApiError {\n\treturn err instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n}\n\n// The caller's live sessions (one flagged `current`) plus the terminate actions.\n// Same contract as react-auth's useSessions.\nexport function useSessions(client?: AuthClient): IUseSessionsReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useSessions');\n\tconst sessions = ref<ISessionDTO[]>([]);\n\tconst isLoading = ref(true);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function refresh(opts?: { force?: boolean }) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.listSessions({ bust: opts?.force });\n\t\t\tsessions.value = result.sessions;\n\t\t} catch (err) {\n\t\t\terror.value = toApiError(err);\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tasync function terminate(id: string) {\n\t\tconst prev = sessions.value;\n\t\tsessions.value = prev.filter((row) => row.id !== id); // optimistic\n\t\terror.value = null;\n\t\ttry {\n\t\t\tawait auth.terminateSession(id);\n\t\t} catch (err) {\n\t\t\tsessions.value = prev; // roll back the optimistic removal\n\t\t\terror.value = toApiError(err);\n\t\t\tthrow toApiError(err);\n\t\t}\n\t}\n\n\tasync function terminateOthers() {\n\t\terror.value = null;\n\t\ttry {\n\t\t\tawait auth.terminateOtherSessions();\n\t\t\t// The server is the source of truth for which survived — refetch (force)\n\t\t\t// rather than trust a local \"keep current\" guess.\n\t\t\tawait refresh({ force: true });\n\t\t} catch (err) {\n\t\t\terror.value = toApiError(err);\n\t\t\tthrow toApiError(err);\n\t\t}\n\t}\n\n\tonMounted(() => void refresh());\n\n\treturn { sessions, isLoading, error, refresh, terminate, terminateOthers };\n}\n","import type { AuthClient, IVerifyEmailResult } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\n\nexport interface IUseVerifyEmailReturn {\n\tverifyEmail: (pin: string) => Promise<IVerifyEmailResult>;\n\tresend: () => Promise<void>;\n\tresent: Ref<boolean>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tdata: Ref<IVerifyEmailResult | null>;\n}\n\nexport function useVerifyEmail(client?: AuthClient): IUseVerifyEmailReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useVerifyEmail');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst data = ref<IVerifyEmailResult | null>(null);\n\tconst resent = ref(false);\n\n\t// Re-sends the verification email — the other half of the same lifecycle,\n\t// so one composable owns both and screens don't split loading/error handling.\n\tasync function resend() {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\tresent.value = false;\n\t\ttry {\n\t\t\tawait auth.sendVerificationEmail();\n\t\t\tresent.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tasync function verifyEmail(pin: string) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.verifyEmail(pin);\n\t\t\tdata.value = result;\n\t\t\treturn result;\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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\treturn { verifyEmail, resend, resent, isLoading, error, data };\n}\n","import type { AuthClient } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { onMounted, ref } from 'vue';\n\nexport interface IUseAuthProvidersReturn {\n\t/** Sign-in methods this deployment can honour, e.g. ['email','google']. */\n\tproviders: Ref<string[]>;\n\t/** The common case: should this button be rendered at all? */\n\thas: (provider: string) => boolean;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | Error | null>;\n\trefresh: () => Promise<void>;\n}\n\n// Ask the API which sign-in methods it can honour, and render buttons from\n// that — never from a build-time flag. A flag stores the same fact the API\n// already holds and lets the two disagree; the failure is a user committing to\n// a redirect and landing on the provider's error page, which this app cannot\n// explain. Same contract as react-auth's useAuthProviders.\n//\n// Starts EMPTY rather than optimistic: a brief moment with no social buttons is\n// invisible, a button that appears and then fails is not.\nexport function useAuthProviders(client?: AuthClient): IUseAuthProvidersReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useAuthProviders');\n\tconst providers = ref<string[]>([]);\n\tconst isLoading = ref(true);\n\tconst error = ref<FonderieApiError | Error | null>(null);\n\n\tconst refresh = async (): Promise<void> => {\n\t\tisLoading.value = true;\n\t\ttry {\n\t\t\tconst { result } = await auth.providers();\n\t\t\tproviders.value = result.providers;\n\t\t\terror.value = null;\n\t\t} catch (err) {\n\t\t\t// Degrade to email-only rather than guessing: an unreachable API is\n\t\t\t// not evidence that a provider works.\n\t\t\tproviders.value = [];\n\t\t\terror.value = err instanceof Error ? err : new Error(String(err));\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t};\n\n\tonMounted(() => {\n\t\tvoid refresh();\n\t});\n\n\treturn {\n\t\tproviders,\n\t\thas: (provider: string) => providers.value.includes(provider),\n\t\tisLoading,\n\t\terror,\n\t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OAAO,KAAK;AAC9D;;;AC1DA,IAAAC,kBAAiC;AACjC,IAAAC,eAAqC;AAErC,IAAAA,eAA+B;","names":["import_client","import_vue","import_client","import_vue","import_client","import_vue","import_client","import_vue","import_client","import_vue","import_client","import_vue","import_client","import_vue","import_client","import_vue","import_client","import_vue","import_client","import_vue","import_vue","import_client","import_vue","import_client","import_vue","import_client","import_vue","import_client","import_vue"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/composables/useAccountData.ts","../src/storage.ts","../src/composables/useChangePassword.ts","../src/composables/useForgotPassword.ts","../src/composables/useLogin.ts","../src/composables/useLogout.ts","../src/composables/useMfaLogin.ts","../src/composables/useMfaSetup.ts","../src/composables/useProfile.ts","../src/composables/useRegister.ts","../src/composables/useResetPassword.ts","../src/composables/useSession.ts","../src/composables/useLoginHistory.ts","../src/composables/useSessions.ts","../src/composables/useVerifyEmail.ts","../src/composables/useAuthProviders.ts","../src/composables/useUnlinkOauth.ts"],"sourcesContent":["export type {\n\tAuthClient,\n\tIChangePasswordInput,\n\tIGetLoginHistoryInput,\n\tILoginEventDTO,\n\tILoginInput,\n\tILoginResult,\n\tIMfaEnabledResult,\n\tIMfaRequiredResult,\n\tIMfaSetupResult,\n\tIRegisterInput,\n\tIRegisterResult,\n\tIResetPasswordInput,\n\tISessionDTO,\n\tITokens,\n\tIUpdatePreferencesInput,\n\tIUpdateProfileInput,\n\tIUserDTO,\n\tIVerifyEmailResult,\n} from '@fonderie/client';\n\nexport { FonderieApiError, isMfaRequired } from '@fonderie/client';\n\nexport type {\n\tIUseAuthProvidersReturn,\n\tIUseUnlinkOauthReturn,\n\tIUseAccountDataReturn,\n\tIUseChangePasswordReturn,\n\tIUseForgotPasswordReturn,\n\tIUseLoginHistoryReturn,\n\tIUseLoginReturn,\n\tIUseLogoutReturn,\n\tIUseMfaLoginReturn,\n\tIUseMfaSetupReturn,\n\tIUseProfileReturn,\n\tIUseRegisterReturn,\n\tIUseResetPasswordReturn,\n\tIUseSessionReturn,\n\tIUseSessionsReturn,\n\tIUseVerifyEmailReturn,\n} from './composables';\nexport {\n\tuseAuthProviders,\n\tuseUnlinkOauth,\n\tuseAccountData,\n\tuseChangePassword,\n\tuseForgotPassword,\n\tuseLogin,\n\tuseLoginHistory,\n\tuseLogout,\n\tuseMfaLogin,\n\tuseMfaSetup,\n\tuseProfile,\n\tuseRegister,\n\tuseResetPassword,\n\tuseSession,\n\tuseSessions,\n\tuseVerifyEmail,\n} from './composables';\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/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\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: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n}\n\nexport function useAccountData(client?: AuthClient): IUseAccountDataReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useAccountData');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function run<T>(op: () => Promise<T>): Promise<T> {\n\t\tisLoading.value = true;\n\t\terror.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tfunction exportData() {\n\t\treturn run(async () => {\n\t\t\tconst { result } = await auth.exportData();\n\t\t\treturn result;\n\t\t});\n\t}\n\n\tfunction deleteUser() {\n\t\treturn run(async () => {\n\t\t\tawait auth.deleteUser();\n\t\t\tauth.setAccessToken(undefined);\n\t\t\tclearToken();\n\t\t});\n\t}\n\n\treturn { exportData, deleteUser, isLoading, error };\n}\n","export const TOKEN_KEY = 'fonderie_access_token';\n\nexport function persistToken(token: string) {\n\tlocalStorage.setItem(TOKEN_KEY, token);\n}\n\nexport function clearToken() {\n\tlocalStorage.removeItem(TOKEN_KEY);\n}\n\nexport function readToken(): string | null {\n\treturn localStorage.getItem(TOKEN_KEY);\n}\n","import type { AuthClient, IChangePasswordInput } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\n\nexport interface IUseChangePasswordReturn {\n\tchangePassword: (input: IChangePasswordInput) => Promise<void>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tdone: Ref<boolean>;\n}\n\nexport function useChangePassword(client?: AuthClient): IUseChangePasswordReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useChangePassword');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst done = ref(false);\n\n\tasync function changePassword(input: IChangePasswordInput) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\tdone.value = false;\n\t\ttry {\n\t\t\tawait auth.changePassword(input);\n\t\t\tdone.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\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/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\n\nexport interface IUseForgotPasswordReturn {\n\tforgotPassword: (email: string) => Promise<void>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tsent: Ref<boolean>;\n}\n\nexport function useForgotPassword(client?: AuthClient): IUseForgotPasswordReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useForgotPassword');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst sent = ref(false);\n\n\tasync function forgotPassword(email: string) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tawait auth.forgotPassword(email);\n\t\t\tsent.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\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/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\nimport { persistToken } from '../storage';\n\nexport interface IUseLoginReturn {\n\tlogin: (input: ILoginInput) => Promise<ILoginResult | IMfaRequiredResult>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tdata: Ref<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.value.mfaToken, code).\n\tmfaPending: Ref<IMfaRequiredResult | null>;\n}\n\nexport function useLogin(client?: AuthClient): IUseLoginReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useLogin');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst data = ref<ILoginResult | null>(null);\n\t// Set when the account requires MFA: complete the login with\n\t// client.auth.mfa.verifyLogin(mfaPending.value.mfaToken, code).\n\tconst mfaPending = ref<IMfaRequiredResult | null>(null);\n\n\tasync function login(input: ILoginInput) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\tmfaPending.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.login(input);\n\t\t\tif (isMfaRequired(result)) {\n\t\t\t\tmfaPending.value = result;\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\tauth.setAccessToken(result.tokens.access);\n\t\t\tpersistToken(result.tokens.access);\n\t\t\tdata.value = result;\n\t\t\treturn result;\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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\treturn { login, isLoading, error, data, mfaPending };\n}\n","import type { AuthClient } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\nimport { clearToken } from '../storage';\n\nexport interface IUseLogoutReturn {\n\tlogout: (refreshToken?: string) => Promise<void>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n}\n\nexport function useLogout(client?: AuthClient): IUseLogoutReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useLogout');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function logout(refreshToken?: string) {\n\t\tisLoading.value = true;\n\t\terror.value = 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\terror.value = apiError;\n\t\t} finally {\n\t\t\tauth.setAccessToken(undefined);\n\t\t\tclearToken();\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\treturn { logout, isLoading, error };\n}\n","import type { AuthClient, ILoginResult } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\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: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tdata: Ref<ILoginResult | null>;\n}\n\nexport function useMfaLogin(client?: AuthClient): IUseMfaLoginReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useMfaLogin');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst data = ref<ILoginResult | null>(null);\n\n\tasync function verifyLogin(mfaToken: string, code: string) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.mfa.verifyLogin(mfaToken, code);\n\t\t\tauth.setAccessToken(result.tokens.access);\n\t\t\tpersistToken(result.tokens.access);\n\t\t\tdata.value = result;\n\t\t\treturn result;\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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\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/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\n\nexport interface IUseMfaSetupReturn {\n\t// Step 1: request enrollment — returns a data-URI QR code to scan and the\n\t// one-time backup codes generated at setup.\n\tsetup: () => Promise<IMfaSetupResult>;\n\tsetupData: Ref<IMfaSetupResult | null>;\n\t// Step 2: verify the first TOTP code to complete enrollment. The session\n\t// token is not rotated — MFA is enforced at login, so the current session\n\t// remains valid unchanged.\n\tverify: (code: string) => Promise<IMfaEnabledResult>;\n\tdisable: (code: string) => Promise<void>;\n\tregenerateBackupCodes: (code: string) => Promise<string[]>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n}\n\nexport function useMfaSetup(client?: AuthClient): IUseMfaSetupReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useMfaSetup');\n\tconst setupData = ref<IMfaSetupResult | null>(null);\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function run<T>(op: () => Promise<T>): Promise<T> {\n\t\tisLoading.value = true;\n\t\terror.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tfunction setup() {\n\t\treturn run(async () => {\n\t\t\tconst { result } = await auth.mfa.setup();\n\t\t\tsetupData.value = result;\n\t\t\treturn result;\n\t\t});\n\t}\n\n\tfunction verify(code: string) {\n\t\treturn run(async () => {\n\t\t\tconst { result } = await auth.mfa.verify(code);\n\t\t\treturn result;\n\t\t});\n\t}\n\n\tfunction disable(code: string) {\n\t\treturn run(async () => {\n\t\t\tawait auth.mfa.disable(code);\n\t\t});\n\t}\n\n\tfunction regenerateBackupCodes(code: string) {\n\t\treturn run(async () => {\n\t\t\tconst { result } = await auth.mfa.regenerateBackupCodes(code);\n\t\t\treturn result.backupCodes;\n\t\t});\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/vue';\nimport type { Ref } from 'vue';\nimport { onMounted, ref } from 'vue';\n\nexport interface IUseProfileReturn {\n\tuser: Ref<IUserDTO | null>;\n\trefresh: (opts?: { force?: boolean }) => 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: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n}\n\nexport function useProfile(client?: AuthClient): IUseProfileReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useProfile');\n\tconst user = ref<IUserDTO | null>(null);\n\tconst isLoading = ref(true);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function refresh(opts?: { force?: boolean }) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.getUser({ bust: opts?.force });\n\t\t\tuser.value = 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\terror.value = apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tasync function mutate<T>(op: () => Promise<T>): Promise<T> {\n\t\terror.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t}\n\t}\n\n\tfunction updateProfile(input: IUpdateProfileInput) {\n\t\treturn mutate(async () => {\n\t\t\tconst { result } = await auth.updateProfile(input);\n\t\t\tuser.value = result.user;\n\t\t\treturn result.user;\n\t\t});\n\t}\n\n\tfunction updatePreferences(input: IUpdatePreferencesInput) {\n\t\treturn mutate(async () => {\n\t\t\tconst { result } = await auth.updatePreferences(input);\n\t\t\tuser.value = result.user;\n\t\t\treturn result.user;\n\t\t});\n\t}\n\n\tfunction updateEmail(email: string) {\n\t\treturn mutate(async () => {\n\t\t\tawait auth.updateEmail(email);\n\t\t\tawait refresh();\n\t\t});\n\t}\n\n\tfunction updatePhone(phone: string) {\n\t\treturn mutate(async () => {\n\t\t\tawait auth.updatePhone(phone);\n\t\t\tawait refresh();\n\t\t});\n\t}\n\n\tonMounted(() => void refresh());\n\n\treturn { user, refresh, updateProfile, updatePreferences, updateEmail, updatePhone, isLoading, error };\n}\n","import type { AuthClient, IRegisterInput, IRegisterResult } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\nimport { persistToken } from '../storage';\n\nexport interface IUseRegisterReturn {\n\tregister: (input: IRegisterInput) => Promise<IRegisterResult>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tdata: Ref<IRegisterResult | null>;\n}\n\nexport function useRegister(client?: AuthClient): IUseRegisterReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useRegister');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst data = ref<IRegisterResult | null>(null);\n\n\tasync function register(input: IRegisterInput) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.register(input);\n\t\t\tauth.setAccessToken(result.tokens.access);\n\t\t\tpersistToken(result.tokens.access);\n\t\t\tdata.value = result;\n\t\t\treturn result;\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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\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/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\n\nexport interface IUseResetPasswordReturn {\n\tresetPassword: (input: IResetPasswordInput) => Promise<void>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tdone: Ref<boolean>;\n}\n\nexport function useResetPassword(client?: AuthClient): IUseResetPasswordReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useResetPassword');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst done = ref(false);\n\n\tasync function resetPassword(input: IResetPasswordInput) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tawait auth.resetPassword(input);\n\t\t\tdone.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\treturn { resetPassword, isLoading, error, done };\n}\n","import type { AuthClient, IUserDTO } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { onMounted, ref } from 'vue';\nimport { clearToken, readToken } from '../storage';\n\nexport interface IUseSessionReturn {\n\tuser: Ref<IUserDTO | null>;\n\tisLoading: Ref<boolean>;\n\tisAuthenticated: Ref<boolean>;\n\trefresh: (opts?: { force?: boolean }) => 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 = ref<IUserDTO | null>(null);\n\tconst isLoading = ref(true);\n\tconst isAuthenticated = ref(false);\n\n\tasync function refresh(opts?: { force?: boolean }) {\n\t\tisLoading.value = true;\n\t\ttry {\n\t\t\tconst { result } = await auth.getUser({ bust: opts?.force });\n\t\t\tuser.value = result.user;\n\t\t\tisAuthenticated.value = true;\n\t\t} catch {\n\t\t\tuser.value = null;\n\t\t\tisAuthenticated.value = false;\n\t\t\tauth.setAccessToken(undefined);\n\t\t\tclearToken();\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tasync function logout(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\tclearToken();\n\t\tuser.value = null;\n\t\tisAuthenticated.value = false;\n\t}\n\n\tconst token = readToken();\n\tif (token) auth.setAccessToken(token);\n\tonMounted(() => void refresh());\n\n\treturn { user, isLoading, isAuthenticated, refresh, logout };\n}\n","import type { AuthClient, ILoginEventDTO, IGetLoginHistoryInput } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { onMounted, ref } from 'vue';\n\nexport interface IUseLoginHistoryReturn {\n\tevents: Ref<ILoginEventDTO[]>;\n\tisLoading: Ref<boolean>;\n\tisLoadingMore: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\thasMore: Ref<boolean>;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n\tloadMore: () => Promise<void>;\n}\n\n// The caller's own login attempts, newest first, keyset-paginated. Same contract\n// as react-auth's useLoginHistory (and vue-audit's useAuditEvents). Unlike React,\n// a composable body runs once, so filters need no memoization — they're captured\n// at call time.\nexport function useLoginHistory(rawFilters?: IGetLoginHistoryInput): IUseLoginHistoryReturn;\nexport function useLoginHistory(\n\tclient: AuthClient | undefined,\n\trawFilters?: IGetLoginHistoryInput,\n): IUseLoginHistoryReturn;\nexport function useLoginHistory(\n\tclientOrFilters?: AuthClient | IGetLoginHistoryInput,\n\tmaybeFilters?: IGetLoginHistoryInput,\n): IUseLoginHistoryReturn {\n\t// The AuthClient isn't reliably an instanceof across bundle boundaries, so\n\t// detect the client arg structurally (it has getLoginHistory) rather than\n\t// by prototype.\n\tconst firstIsClient =\n\t\tclientOrFilters === undefined ||\n\t\ttypeof (clientOrFilters as AuthClient).getLoginHistory === 'function';\n\tconst explicit = firstIsClient ? (clientOrFilters as AuthClient | undefined) : undefined;\n\tconst filters = (firstIsClient ? maybeFilters : (clientOrFilters as IGetLoginHistoryInput)) ?? {};\n\tconst auth = useFonderieSubClient(explicit, (c) => c.auth, 'useLoginHistory');\n\n\tconst events = ref<ILoginEventDTO[]>([]);\n\tconst isLoading = ref(true);\n\tconst isLoadingMore = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst hasMore = ref(false);\n\tlet cursor: string | null = null;\n\n\tasync function refresh(opts?: { force?: boolean }) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.getLoginHistory(filters, { bust: opts?.force });\n\t\t\tevents.value = result.events;\n\t\t\tcursor = result.nextCursor;\n\t\t\thasMore.value = result.nextCursor !== null;\n\t\t} catch (err) {\n\t\t\terror.value =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tasync function loadMore() {\n\t\tif (!cursor || isLoadingMore.value) return;\n\t\tisLoadingMore.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.getLoginHistory({ ...filters, cursor });\n\t\t\tevents.value = [...events.value, ...result.events];\n\t\t\tcursor = result.nextCursor;\n\t\t\thasMore.value = result.nextCursor !== null;\n\t\t} catch (err) {\n\t\t\terror.value =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t} finally {\n\t\t\tisLoadingMore.value = false;\n\t\t}\n\t}\n\n\tonMounted(() => void refresh());\n\n\treturn { events, isLoading, isLoadingMore, error, hasMore, refresh, loadMore };\n}\n","import type { AuthClient, ISessionDTO } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { onMounted, ref } from 'vue';\n\nexport interface IUseSessionsReturn {\n\tsessions: Ref<ISessionDTO[]>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n\t// Revoke one session. Optimistically removes it; refetches on failure.\n\tterminate: (id: string) => Promise<void>;\n\t// Revoke every session except the current one.\n\tterminateOthers: () => Promise<void>;\n}\n\nfunction toApiError(err: unknown): FonderieApiError {\n\treturn err instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n}\n\n// The caller's live sessions (one flagged `current`) plus the terminate actions.\n// Same contract as react-auth's useSessions.\nexport function useSessions(client?: AuthClient): IUseSessionsReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useSessions');\n\tconst sessions = ref<ISessionDTO[]>([]);\n\tconst isLoading = ref(true);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function refresh(opts?: { force?: boolean }) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.listSessions({ bust: opts?.force });\n\t\t\tsessions.value = result.sessions;\n\t\t} catch (err) {\n\t\t\terror.value = toApiError(err);\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tasync function terminate(id: string) {\n\t\tconst prev = sessions.value;\n\t\tsessions.value = prev.filter((row) => row.id !== id); // optimistic\n\t\terror.value = null;\n\t\ttry {\n\t\t\tawait auth.terminateSession(id);\n\t\t} catch (err) {\n\t\t\tsessions.value = prev; // roll back the optimistic removal\n\t\t\terror.value = toApiError(err);\n\t\t\tthrow toApiError(err);\n\t\t}\n\t}\n\n\tasync function terminateOthers() {\n\t\terror.value = null;\n\t\ttry {\n\t\t\tawait auth.terminateOtherSessions();\n\t\t\t// The server is the source of truth for which survived — refetch (force)\n\t\t\t// rather than trust a local \"keep current\" guess.\n\t\t\tawait refresh({ force: true });\n\t\t} catch (err) {\n\t\t\terror.value = toApiError(err);\n\t\t\tthrow toApiError(err);\n\t\t}\n\t}\n\n\tonMounted(() => void refresh());\n\n\treturn { sessions, isLoading, error, refresh, terminate, terminateOthers };\n}\n","import type { AuthClient, IVerifyEmailResult } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\n\nexport interface IUseVerifyEmailReturn {\n\tverifyEmail: (pin: string) => Promise<IVerifyEmailResult>;\n\tresend: () => Promise<void>;\n\tresent: Ref<boolean>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tdata: Ref<IVerifyEmailResult | null>;\n}\n\nexport function useVerifyEmail(client?: AuthClient): IUseVerifyEmailReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useVerifyEmail');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst data = ref<IVerifyEmailResult | null>(null);\n\tconst resent = ref(false);\n\n\t// Re-sends the verification email — the other half of the same lifecycle,\n\t// so one composable owns both and screens don't split loading/error handling.\n\tasync function resend() {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\tresent.value = false;\n\t\ttry {\n\t\t\tawait auth.sendVerificationEmail();\n\t\t\tresent.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tasync function verifyEmail(pin: string) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.verifyEmail(pin);\n\t\t\tdata.value = result;\n\t\t\treturn result;\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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\treturn { verifyEmail, resend, resent, isLoading, error, data };\n}\n","import type { AuthClient } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { onMounted, ref } from 'vue';\n\nexport interface IUseAuthProvidersReturn {\n\t/** Sign-in methods this deployment can honour, e.g. ['email','google']. */\n\tproviders: Ref<string[]>;\n\t/** The common case: should this button be rendered at all? */\n\thas: (provider: string) => boolean;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | Error | null>;\n\trefresh: () => Promise<void>;\n}\n\n// Ask the API which sign-in methods it can honour, and render buttons from\n// that — never from a build-time flag. A flag stores the same fact the API\n// already holds and lets the two disagree; the failure is a user committing to\n// a redirect and landing on the provider's error page, which this app cannot\n// explain. Same contract as react-auth's useAuthProviders.\n//\n// Starts EMPTY rather than optimistic: a brief moment with no social buttons is\n// invisible, a button that appears and then fails is not.\nexport function useAuthProviders(client?: AuthClient): IUseAuthProvidersReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useAuthProviders');\n\tconst providers = ref<string[]>([]);\n\tconst isLoading = ref(true);\n\tconst error = ref<FonderieApiError | Error | null>(null);\n\n\tconst refresh = async (): Promise<void> => {\n\t\tisLoading.value = true;\n\t\ttry {\n\t\t\tconst { result } = await auth.providers();\n\t\t\tproviders.value = result.providers;\n\t\t\terror.value = null;\n\t\t} catch (err) {\n\t\t\t// Degrade to email-only rather than guessing: an unreachable API is\n\t\t\t// not evidence that a provider works.\n\t\t\tproviders.value = [];\n\t\t\terror.value = err instanceof Error ? err : new Error(String(err));\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t};\n\n\tonMounted(() => {\n\t\tvoid refresh();\n\t});\n\n\treturn {\n\t\tproviders,\n\t\thas: (provider: string) => providers.value.includes(provider),\n\t\tisLoading,\n\t\terror,\n\t\trefresh,\n\t};\n}\n","import type { AuthClient } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\n\nexport interface IUseUnlinkOauthReturn {\n\tunlinkOauth: (provider: string) => Promise<void>;\n\tunlinked: Ref<boolean>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\t// True when the server refused because the account has no password — the one\n\t// failure a settings screen should handle rather than just display, by\n\t// sending the user to set a password first. A flag so screens don't have to\n\t// match on the error's reason string.\n\trequiresPassword: Ref<boolean>;\n}\n\n/**\n * Remove the OAuth provider linked to the signed-in account.\n *\n * Prefer gating the control on `user.hasPassword` so the case is never reached:\n * an account created BY the provider has no other credential, and unlinking it\n * would be account deletion. The server refuses regardless (409), which is what\n * `requiresPassword` reports.\n */\nexport function useUnlinkOauth(client?: AuthClient): IUseUnlinkOauthReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useUnlinkOauth');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst unlinked = ref(false);\n\tconst requiresPassword = ref(false);\n\n\tconst unlinkOauth = async (provider: string): Promise<void> => {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\trequiresPassword.value = false;\n\t\ttry {\n\t\t\tawait auth.unlinkOauth(provider);\n\t\t\tunlinked.value = 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\terror.value = apiError;\n\t\t\trequiresPassword.value = apiError.reason === 'PASSWORD_REQUIRED';\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t};\n\n\treturn { unlinkOauth, unlinked, isLoading, error, requiresPassword };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqBA,IAAAA,kBAAgD;;;ACpBhD,oBAAiC;AACjC,iBAAqC;AAErC,IAAAC,cAAoB;;;ACJb,IAAM,YAAY;AAElB,SAAS,aAAa,OAAe;AAC3C,eAAa,QAAQ,WAAW,KAAK;AACtC;AAEO,SAAS,aAAa;AAC5B,eAAa,WAAW,SAAS;AAClC;AAEO,SAAS,YAA2B;AAC1C,SAAO,aAAa,QAAQ,SAAS;AACtC;;;ADIO,SAAS,eAAe,QAA4C;AAC1E,QAAM,WAAO,iCAAqB,QAAQ,CAAC,MAAM,EAAE,MAAM,gBAAgB;AACzE,QAAM,gBAAY,iBAAI,KAAK;AAC3B,QAAM,YAAQ,iBAA6B,IAAI;AAE/C,iBAAe,IAAO,IAAkC;AACvD,cAAU,QAAQ;AAClB,UAAM,QAAQ;AACd,QAAI;AACH,aAAO,MAAM,GAAG;AAAA,IACjB,SAAS,KAAK;AACb,YAAM,WACL,eAAe,iCAAmB,MAAM,IAAI,+BAAiB,WAAW,OAAO,GAAG,GAAG,CAAC;AACvF,YAAM,QAAQ;AACd,YAAM;AAAA,IACP,UAAE;AACD,gBAAU,QAAQ;AAAA,IACnB;AAAA,EACD;AAEA,WAAS,aAAa;AACrB,WAAO,IAAI,YAAY;AACtB,YAAM,EAAE,OAAO,IAAI,MAAM,KAAK,WAAW;AACzC,aAAO;AAAA,IACR,CAAC;AAAA,EACF;AAEA,WAAS,aAAa;AACrB,WAAO,IAAI,YAAY;AACt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;AAElC,QAAM,cAAc,OAAO,aAAoC;AAC9D,cAAU,QAAQ;AAClB,UAAM,QAAQ;AACd,qBAAiB,QAAQ;AACzB,QAAI;AACH,YAAM,KAAK,YAAY,QAAQ;AAC/B,eAAS,QAAQ;AAAA,IAClB,SAAS,KAAK;AACb,YAAM,WACL,eAAe,mCAAmB,MAAM,IAAI,iCAAiB,WAAW,OAAO,GAAG,GAAG,CAAC;AACvF,YAAM,QAAQ;AACd,uBAAiB,QAAQ,SAAS,WAAW;AAC7C,YAAM;AAAA,IACP,UAAE;AACD,gBAAU,QAAQ;AAAA,IACnB;AAAA,EACD;AAEA,SAAO,EAAE,aAAa,UAAU,WAAW,OAAO,iBAAiB;AACpE;","names":["import_client","import_vue","import_client","import_vue","import_client","import_vue","import_client","import_vue","import_client","import_vue","import_client","import_vue","import_client","import_vue","import_client","import_vue","import_client","import_vue","import_client","import_vue","import_vue","import_client","import_vue","import_client","import_vue","import_client","import_vue","import_client","import_vue","import_client","import_vue"]}
package/dist/index.d.cts CHANGED
@@ -138,9 +138,37 @@ interface IUseVerifyEmailReturn {
138
138
  }
139
139
  declare function useVerifyEmail(client?: AuthClient): IUseVerifyEmailReturn;
140
140
 
141
+ interface IUseAuthProvidersReturn {
142
+ /** Sign-in methods this deployment can honour, e.g. ['email','google']. */
143
+ providers: Ref<string[]>;
144
+ /** The common case: should this button be rendered at all? */
145
+ has: (provider: string) => boolean;
146
+ isLoading: Ref<boolean>;
147
+ error: Ref<FonderieApiError | Error | null>;
148
+ refresh: () => Promise<void>;
149
+ }
150
+ declare function useAuthProviders(client?: AuthClient): IUseAuthProvidersReturn;
151
+
152
+ interface IUseUnlinkOauthReturn {
153
+ unlinkOauth: (provider: string) => Promise<void>;
154
+ unlinked: Ref<boolean>;
155
+ isLoading: Ref<boolean>;
156
+ error: Ref<FonderieApiError | null>;
157
+ requiresPassword: Ref<boolean>;
158
+ }
159
+ /**
160
+ * Remove the OAuth provider linked to the signed-in account.
161
+ *
162
+ * Prefer gating the control on `user.hasPassword` so the case is never reached:
163
+ * an account created BY the provider has no other credential, and unlinking it
164
+ * would be account deletion. The server refuses regardless (409), which is what
165
+ * `requiresPassword` reports.
166
+ */
167
+ declare function useUnlinkOauth(client?: AuthClient): IUseUnlinkOauthReturn;
168
+
141
169
  declare const TOKEN_KEY = "fonderie_access_token";
142
170
  declare function persistToken(token: string): void;
143
171
  declare function clearToken(): void;
144
172
  declare function readToken(): string | null;
145
173
 
146
- export { type IUseAccountDataReturn, type IUseChangePasswordReturn, type IUseForgotPasswordReturn, type IUseLoginHistoryReturn, type IUseLoginReturn, type IUseLogoutReturn, type IUseMfaLoginReturn, type IUseMfaSetupReturn, type IUseProfileReturn, type IUseRegisterReturn, type IUseResetPasswordReturn, type IUseSessionReturn, type IUseSessionsReturn, type IUseVerifyEmailReturn, TOKEN_KEY, clearToken, persistToken, readToken, useAccountData, useChangePassword, useForgotPassword, useLogin, useLoginHistory, useLogout, useMfaLogin, useMfaSetup, useProfile, useRegister, useResetPassword, useSession, useSessions, useVerifyEmail };
174
+ export { type IUseAccountDataReturn, type IUseAuthProvidersReturn, type IUseChangePasswordReturn, type IUseForgotPasswordReturn, type IUseLoginHistoryReturn, type IUseLoginReturn, type IUseLogoutReturn, type IUseMfaLoginReturn, type IUseMfaSetupReturn, type IUseProfileReturn, type IUseRegisterReturn, type IUseResetPasswordReturn, type IUseSessionReturn, type IUseSessionsReturn, type IUseUnlinkOauthReturn, type IUseVerifyEmailReturn, TOKEN_KEY, clearToken, persistToken, readToken, useAccountData, useAuthProviders, useChangePassword, useForgotPassword, useLogin, useLoginHistory, useLogout, useMfaLogin, useMfaSetup, useProfile, useRegister, useResetPassword, useSession, useSessions, useUnlinkOauth, useVerifyEmail };
package/dist/index.d.ts CHANGED
@@ -138,9 +138,37 @@ interface IUseVerifyEmailReturn {
138
138
  }
139
139
  declare function useVerifyEmail(client?: AuthClient): IUseVerifyEmailReturn;
140
140
 
141
+ interface IUseAuthProvidersReturn {
142
+ /** Sign-in methods this deployment can honour, e.g. ['email','google']. */
143
+ providers: Ref<string[]>;
144
+ /** The common case: should this button be rendered at all? */
145
+ has: (provider: string) => boolean;
146
+ isLoading: Ref<boolean>;
147
+ error: Ref<FonderieApiError | Error | null>;
148
+ refresh: () => Promise<void>;
149
+ }
150
+ declare function useAuthProviders(client?: AuthClient): IUseAuthProvidersReturn;
151
+
152
+ interface IUseUnlinkOauthReturn {
153
+ unlinkOauth: (provider: string) => Promise<void>;
154
+ unlinked: Ref<boolean>;
155
+ isLoading: Ref<boolean>;
156
+ error: Ref<FonderieApiError | null>;
157
+ requiresPassword: Ref<boolean>;
158
+ }
159
+ /**
160
+ * Remove the OAuth provider linked to the signed-in account.
161
+ *
162
+ * Prefer gating the control on `user.hasPassword` so the case is never reached:
163
+ * an account created BY the provider has no other credential, and unlinking it
164
+ * would be account deletion. The server refuses regardless (409), which is what
165
+ * `requiresPassword` reports.
166
+ */
167
+ declare function useUnlinkOauth(client?: AuthClient): IUseUnlinkOauthReturn;
168
+
141
169
  declare const TOKEN_KEY = "fonderie_access_token";
142
170
  declare function persistToken(token: string): void;
143
171
  declare function clearToken(): void;
144
172
  declare function readToken(): string | null;
145
173
 
146
- export { type IUseAccountDataReturn, type IUseChangePasswordReturn, type IUseForgotPasswordReturn, type IUseLoginHistoryReturn, type IUseLoginReturn, type IUseLogoutReturn, type IUseMfaLoginReturn, type IUseMfaSetupReturn, type IUseProfileReturn, type IUseRegisterReturn, type IUseResetPasswordReturn, type IUseSessionReturn, type IUseSessionsReturn, type IUseVerifyEmailReturn, TOKEN_KEY, clearToken, persistToken, readToken, useAccountData, useChangePassword, useForgotPassword, useLogin, useLoginHistory, useLogout, useMfaLogin, useMfaSetup, useProfile, useRegister, useResetPassword, useSession, useSessions, useVerifyEmail };
174
+ export { type IUseAccountDataReturn, type IUseAuthProvidersReturn, type IUseChangePasswordReturn, type IUseForgotPasswordReturn, type IUseLoginHistoryReturn, type IUseLoginReturn, type IUseLogoutReturn, type IUseMfaLoginReturn, type IUseMfaSetupReturn, type IUseProfileReturn, type IUseRegisterReturn, type IUseResetPasswordReturn, type IUseSessionReturn, type IUseSessionsReturn, type IUseUnlinkOauthReturn, type IUseVerifyEmailReturn, TOKEN_KEY, clearToken, persistToken, readToken, useAccountData, useAuthProviders, useChangePassword, useForgotPassword, useLogin, useLoginHistory, useLogout, useMfaLogin, useMfaSetup, useProfile, useRegister, useResetPassword, useSession, useSessions, useUnlinkOauth, useVerifyEmail };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/index.ts
2
- import { FonderieApiError as FonderieApiError15, isMfaRequired as isMfaRequired2 } from "@fonderie/client";
2
+ import { FonderieApiError as FonderieApiError16, isMfaRequired as isMfaRequired2 } from "@fonderie/client";
3
3
 
4
4
  // src/composables/useAccountData.ts
5
5
  import { FonderieApiError } from "@fonderie/client";
@@ -544,14 +544,73 @@ function useVerifyEmail(client) {
544
544
  import "@fonderie/client";
545
545
  import { useFonderieSubClient as useFonderieSubClient15 } from "@fonderie/vue";
546
546
  import { onMounted as onMounted5, ref as ref15 } from "vue";
547
+ function useAuthProviders(client) {
548
+ const auth = useFonderieSubClient15(client, (c) => c.auth, "useAuthProviders");
549
+ const providers = ref15([]);
550
+ const isLoading = ref15(true);
551
+ const error = ref15(null);
552
+ const refresh = async () => {
553
+ isLoading.value = true;
554
+ try {
555
+ const { result } = await auth.providers();
556
+ providers.value = result.providers;
557
+ error.value = null;
558
+ } catch (err) {
559
+ providers.value = [];
560
+ error.value = err instanceof Error ? err : new Error(String(err));
561
+ } finally {
562
+ isLoading.value = false;
563
+ }
564
+ };
565
+ onMounted5(() => {
566
+ void refresh();
567
+ });
568
+ return {
569
+ providers,
570
+ has: (provider) => providers.value.includes(provider),
571
+ isLoading,
572
+ error,
573
+ refresh
574
+ };
575
+ }
576
+
577
+ // src/composables/useUnlinkOauth.ts
578
+ import { FonderieApiError as FonderieApiError15 } from "@fonderie/client";
579
+ import { useFonderieSubClient as useFonderieSubClient16 } from "@fonderie/vue";
580
+ import { ref as ref16 } from "vue";
581
+ function useUnlinkOauth(client) {
582
+ const auth = useFonderieSubClient16(client, (c) => c.auth, "useUnlinkOauth");
583
+ const isLoading = ref16(false);
584
+ const error = ref16(null);
585
+ const unlinked = ref16(false);
586
+ const requiresPassword = ref16(false);
587
+ const unlinkOauth = async (provider) => {
588
+ isLoading.value = true;
589
+ error.value = null;
590
+ requiresPassword.value = false;
591
+ try {
592
+ await auth.unlinkOauth(provider);
593
+ unlinked.value = true;
594
+ } catch (err) {
595
+ const apiError = err instanceof FonderieApiError15 ? err : new FonderieApiError15("unknown", String(err), 0);
596
+ error.value = apiError;
597
+ requiresPassword.value = apiError.reason === "PASSWORD_REQUIRED";
598
+ throw apiError;
599
+ } finally {
600
+ isLoading.value = false;
601
+ }
602
+ };
603
+ return { unlinkOauth, unlinked, isLoading, error, requiresPassword };
604
+ }
547
605
  export {
548
- FonderieApiError15 as FonderieApiError,
606
+ FonderieApiError16 as FonderieApiError,
549
607
  TOKEN_KEY,
550
608
  clearToken,
551
609
  isMfaRequired2 as isMfaRequired,
552
610
  persistToken,
553
611
  readToken,
554
612
  useAccountData,
613
+ useAuthProviders,
555
614
  useChangePassword,
556
615
  useForgotPassword,
557
616
  useLogin,
@@ -564,6 +623,7 @@ export {
564
623
  useResetPassword,
565
624
  useSession,
566
625
  useSessions,
626
+ useUnlinkOauth,
567
627
  useVerifyEmail
568
628
  };
569
629
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/composables/useAccountData.ts","../src/storage.ts","../src/composables/useChangePassword.ts","../src/composables/useForgotPassword.ts","../src/composables/useLogin.ts","../src/composables/useLogout.ts","../src/composables/useMfaLogin.ts","../src/composables/useMfaSetup.ts","../src/composables/useProfile.ts","../src/composables/useRegister.ts","../src/composables/useResetPassword.ts","../src/composables/useSession.ts","../src/composables/useLoginHistory.ts","../src/composables/useSessions.ts","../src/composables/useVerifyEmail.ts","../src/composables/useAuthProviders.ts"],"sourcesContent":["export type {\n\tAuthClient,\n\tIChangePasswordInput,\n\tIGetLoginHistoryInput,\n\tILoginEventDTO,\n\tILoginInput,\n\tILoginResult,\n\tIMfaEnabledResult,\n\tIMfaRequiredResult,\n\tIMfaSetupResult,\n\tIRegisterInput,\n\tIRegisterResult,\n\tIResetPasswordInput,\n\tISessionDTO,\n\tITokens,\n\tIUpdatePreferencesInput,\n\tIUpdateProfileInput,\n\tIUserDTO,\n\tIVerifyEmailResult,\n} from '@fonderie/client';\n\nexport { FonderieApiError, isMfaRequired } from '@fonderie/client';\n\nexport type {\n\tIUseAccountDataReturn,\n\tIUseChangePasswordReturn,\n\tIUseForgotPasswordReturn,\n\tIUseLoginHistoryReturn,\n\tIUseLoginReturn,\n\tIUseLogoutReturn,\n\tIUseMfaLoginReturn,\n\tIUseMfaSetupReturn,\n\tIUseProfileReturn,\n\tIUseRegisterReturn,\n\tIUseResetPasswordReturn,\n\tIUseSessionReturn,\n\tIUseSessionsReturn,\n\tIUseVerifyEmailReturn,\n} from './composables';\nexport {\n\tuseAccountData,\n\tuseChangePassword,\n\tuseForgotPassword,\n\tuseLogin,\n\tuseLoginHistory,\n\tuseLogout,\n\tuseMfaLogin,\n\tuseMfaSetup,\n\tuseProfile,\n\tuseRegister,\n\tuseResetPassword,\n\tuseSession,\n\tuseSessions,\n\tuseVerifyEmail,\n} from './composables';\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/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\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: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n}\n\nexport function useAccountData(client?: AuthClient): IUseAccountDataReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useAccountData');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function run<T>(op: () => Promise<T>): Promise<T> {\n\t\tisLoading.value = true;\n\t\terror.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tfunction exportData() {\n\t\treturn run(async () => {\n\t\t\tconst { result } = await auth.exportData();\n\t\t\treturn result;\n\t\t});\n\t}\n\n\tfunction deleteUser() {\n\t\treturn run(async () => {\n\t\t\tawait auth.deleteUser();\n\t\t\tauth.setAccessToken(undefined);\n\t\t\tclearToken();\n\t\t});\n\t}\n\n\treturn { exportData, deleteUser, isLoading, error };\n}\n","export const TOKEN_KEY = 'fonderie_access_token';\n\nexport function persistToken(token: string) {\n\tlocalStorage.setItem(TOKEN_KEY, token);\n}\n\nexport function clearToken() {\n\tlocalStorage.removeItem(TOKEN_KEY);\n}\n\nexport function readToken(): string | null {\n\treturn localStorage.getItem(TOKEN_KEY);\n}\n","import type { AuthClient, IChangePasswordInput } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\n\nexport interface IUseChangePasswordReturn {\n\tchangePassword: (input: IChangePasswordInput) => Promise<void>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tdone: Ref<boolean>;\n}\n\nexport function useChangePassword(client?: AuthClient): IUseChangePasswordReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useChangePassword');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst done = ref(false);\n\n\tasync function changePassword(input: IChangePasswordInput) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\tdone.value = false;\n\t\ttry {\n\t\t\tawait auth.changePassword(input);\n\t\t\tdone.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\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/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\n\nexport interface IUseForgotPasswordReturn {\n\tforgotPassword: (email: string) => Promise<void>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tsent: Ref<boolean>;\n}\n\nexport function useForgotPassword(client?: AuthClient): IUseForgotPasswordReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useForgotPassword');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst sent = ref(false);\n\n\tasync function forgotPassword(email: string) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tawait auth.forgotPassword(email);\n\t\t\tsent.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\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/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\nimport { persistToken } from '../storage';\n\nexport interface IUseLoginReturn {\n\tlogin: (input: ILoginInput) => Promise<ILoginResult | IMfaRequiredResult>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tdata: Ref<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.value.mfaToken, code).\n\tmfaPending: Ref<IMfaRequiredResult | null>;\n}\n\nexport function useLogin(client?: AuthClient): IUseLoginReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useLogin');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst data = ref<ILoginResult | null>(null);\n\t// Set when the account requires MFA: complete the login with\n\t// client.auth.mfa.verifyLogin(mfaPending.value.mfaToken, code).\n\tconst mfaPending = ref<IMfaRequiredResult | null>(null);\n\n\tasync function login(input: ILoginInput) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\tmfaPending.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.login(input);\n\t\t\tif (isMfaRequired(result)) {\n\t\t\t\tmfaPending.value = result;\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\tauth.setAccessToken(result.tokens.access);\n\t\t\tpersistToken(result.tokens.access);\n\t\t\tdata.value = result;\n\t\t\treturn result;\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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\treturn { login, isLoading, error, data, mfaPending };\n}\n","import type { AuthClient } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\nimport { clearToken } from '../storage';\n\nexport interface IUseLogoutReturn {\n\tlogout: (refreshToken?: string) => Promise<void>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n}\n\nexport function useLogout(client?: AuthClient): IUseLogoutReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useLogout');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function logout(refreshToken?: string) {\n\t\tisLoading.value = true;\n\t\terror.value = 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\terror.value = apiError;\n\t\t} finally {\n\t\t\tauth.setAccessToken(undefined);\n\t\t\tclearToken();\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\treturn { logout, isLoading, error };\n}\n","import type { AuthClient, ILoginResult } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\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: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tdata: Ref<ILoginResult | null>;\n}\n\nexport function useMfaLogin(client?: AuthClient): IUseMfaLoginReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useMfaLogin');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst data = ref<ILoginResult | null>(null);\n\n\tasync function verifyLogin(mfaToken: string, code: string) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.mfa.verifyLogin(mfaToken, code);\n\t\t\tauth.setAccessToken(result.tokens.access);\n\t\t\tpersistToken(result.tokens.access);\n\t\t\tdata.value = result;\n\t\t\treturn result;\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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\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/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\n\nexport interface IUseMfaSetupReturn {\n\t// Step 1: request enrollment — returns a data-URI QR code to scan and the\n\t// one-time backup codes generated at setup.\n\tsetup: () => Promise<IMfaSetupResult>;\n\tsetupData: Ref<IMfaSetupResult | null>;\n\t// Step 2: verify the first TOTP code to complete enrollment. The session\n\t// token is not rotated — MFA is enforced at login, so the current session\n\t// remains valid unchanged.\n\tverify: (code: string) => Promise<IMfaEnabledResult>;\n\tdisable: (code: string) => Promise<void>;\n\tregenerateBackupCodes: (code: string) => Promise<string[]>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n}\n\nexport function useMfaSetup(client?: AuthClient): IUseMfaSetupReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useMfaSetup');\n\tconst setupData = ref<IMfaSetupResult | null>(null);\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function run<T>(op: () => Promise<T>): Promise<T> {\n\t\tisLoading.value = true;\n\t\terror.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tfunction setup() {\n\t\treturn run(async () => {\n\t\t\tconst { result } = await auth.mfa.setup();\n\t\t\tsetupData.value = result;\n\t\t\treturn result;\n\t\t});\n\t}\n\n\tfunction verify(code: string) {\n\t\treturn run(async () => {\n\t\t\tconst { result } = await auth.mfa.verify(code);\n\t\t\treturn result;\n\t\t});\n\t}\n\n\tfunction disable(code: string) {\n\t\treturn run(async () => {\n\t\t\tawait auth.mfa.disable(code);\n\t\t});\n\t}\n\n\tfunction regenerateBackupCodes(code: string) {\n\t\treturn run(async () => {\n\t\t\tconst { result } = await auth.mfa.regenerateBackupCodes(code);\n\t\t\treturn result.backupCodes;\n\t\t});\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/vue';\nimport type { Ref } from 'vue';\nimport { onMounted, ref } from 'vue';\n\nexport interface IUseProfileReturn {\n\tuser: Ref<IUserDTO | null>;\n\trefresh: (opts?: { force?: boolean }) => 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: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n}\n\nexport function useProfile(client?: AuthClient): IUseProfileReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useProfile');\n\tconst user = ref<IUserDTO | null>(null);\n\tconst isLoading = ref(true);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function refresh(opts?: { force?: boolean }) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.getUser({ bust: opts?.force });\n\t\t\tuser.value = 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\terror.value = apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tasync function mutate<T>(op: () => Promise<T>): Promise<T> {\n\t\terror.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t}\n\t}\n\n\tfunction updateProfile(input: IUpdateProfileInput) {\n\t\treturn mutate(async () => {\n\t\t\tconst { result } = await auth.updateProfile(input);\n\t\t\tuser.value = result.user;\n\t\t\treturn result.user;\n\t\t});\n\t}\n\n\tfunction updatePreferences(input: IUpdatePreferencesInput) {\n\t\treturn mutate(async () => {\n\t\t\tconst { result } = await auth.updatePreferences(input);\n\t\t\tuser.value = result.user;\n\t\t\treturn result.user;\n\t\t});\n\t}\n\n\tfunction updateEmail(email: string) {\n\t\treturn mutate(async () => {\n\t\t\tawait auth.updateEmail(email);\n\t\t\tawait refresh();\n\t\t});\n\t}\n\n\tfunction updatePhone(phone: string) {\n\t\treturn mutate(async () => {\n\t\t\tawait auth.updatePhone(phone);\n\t\t\tawait refresh();\n\t\t});\n\t}\n\n\tonMounted(() => void refresh());\n\n\treturn { user, refresh, updateProfile, updatePreferences, updateEmail, updatePhone, isLoading, error };\n}\n","import type { AuthClient, IRegisterInput, IRegisterResult } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\nimport { persistToken } from '../storage';\n\nexport interface IUseRegisterReturn {\n\tregister: (input: IRegisterInput) => Promise<IRegisterResult>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tdata: Ref<IRegisterResult | null>;\n}\n\nexport function useRegister(client?: AuthClient): IUseRegisterReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useRegister');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst data = ref<IRegisterResult | null>(null);\n\n\tasync function register(input: IRegisterInput) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.register(input);\n\t\t\tauth.setAccessToken(result.tokens.access);\n\t\t\tpersistToken(result.tokens.access);\n\t\t\tdata.value = result;\n\t\t\treturn result;\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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\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/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\n\nexport interface IUseResetPasswordReturn {\n\tresetPassword: (input: IResetPasswordInput) => Promise<void>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tdone: Ref<boolean>;\n}\n\nexport function useResetPassword(client?: AuthClient): IUseResetPasswordReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useResetPassword');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst done = ref(false);\n\n\tasync function resetPassword(input: IResetPasswordInput) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tawait auth.resetPassword(input);\n\t\t\tdone.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\treturn { resetPassword, isLoading, error, done };\n}\n","import type { AuthClient, IUserDTO } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { onMounted, ref } from 'vue';\nimport { clearToken, readToken } from '../storage';\n\nexport interface IUseSessionReturn {\n\tuser: Ref<IUserDTO | null>;\n\tisLoading: Ref<boolean>;\n\tisAuthenticated: Ref<boolean>;\n\trefresh: (opts?: { force?: boolean }) => 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 = ref<IUserDTO | null>(null);\n\tconst isLoading = ref(true);\n\tconst isAuthenticated = ref(false);\n\n\tasync function refresh(opts?: { force?: boolean }) {\n\t\tisLoading.value = true;\n\t\ttry {\n\t\t\tconst { result } = await auth.getUser({ bust: opts?.force });\n\t\t\tuser.value = result.user;\n\t\t\tisAuthenticated.value = true;\n\t\t} catch {\n\t\t\tuser.value = null;\n\t\t\tisAuthenticated.value = false;\n\t\t\tauth.setAccessToken(undefined);\n\t\t\tclearToken();\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tasync function logout(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\tclearToken();\n\t\tuser.value = null;\n\t\tisAuthenticated.value = false;\n\t}\n\n\tconst token = readToken();\n\tif (token) auth.setAccessToken(token);\n\tonMounted(() => void refresh());\n\n\treturn { user, isLoading, isAuthenticated, refresh, logout };\n}\n","import type { AuthClient, ILoginEventDTO, IGetLoginHistoryInput } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { onMounted, ref } from 'vue';\n\nexport interface IUseLoginHistoryReturn {\n\tevents: Ref<ILoginEventDTO[]>;\n\tisLoading: Ref<boolean>;\n\tisLoadingMore: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\thasMore: Ref<boolean>;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n\tloadMore: () => Promise<void>;\n}\n\n// The caller's own login attempts, newest first, keyset-paginated. Same contract\n// as react-auth's useLoginHistory (and vue-audit's useAuditEvents). Unlike React,\n// a composable body runs once, so filters need no memoization — they're captured\n// at call time.\nexport function useLoginHistory(rawFilters?: IGetLoginHistoryInput): IUseLoginHistoryReturn;\nexport function useLoginHistory(\n\tclient: AuthClient | undefined,\n\trawFilters?: IGetLoginHistoryInput,\n): IUseLoginHistoryReturn;\nexport function useLoginHistory(\n\tclientOrFilters?: AuthClient | IGetLoginHistoryInput,\n\tmaybeFilters?: IGetLoginHistoryInput,\n): IUseLoginHistoryReturn {\n\t// The AuthClient isn't reliably an instanceof across bundle boundaries, so\n\t// detect the client arg structurally (it has getLoginHistory) rather than\n\t// by prototype.\n\tconst firstIsClient =\n\t\tclientOrFilters === undefined ||\n\t\ttypeof (clientOrFilters as AuthClient).getLoginHistory === 'function';\n\tconst explicit = firstIsClient ? (clientOrFilters as AuthClient | undefined) : undefined;\n\tconst filters = (firstIsClient ? maybeFilters : (clientOrFilters as IGetLoginHistoryInput)) ?? {};\n\tconst auth = useFonderieSubClient(explicit, (c) => c.auth, 'useLoginHistory');\n\n\tconst events = ref<ILoginEventDTO[]>([]);\n\tconst isLoading = ref(true);\n\tconst isLoadingMore = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst hasMore = ref(false);\n\tlet cursor: string | null = null;\n\n\tasync function refresh(opts?: { force?: boolean }) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.getLoginHistory(filters, { bust: opts?.force });\n\t\t\tevents.value = result.events;\n\t\t\tcursor = result.nextCursor;\n\t\t\thasMore.value = result.nextCursor !== null;\n\t\t} catch (err) {\n\t\t\terror.value =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tasync function loadMore() {\n\t\tif (!cursor || isLoadingMore.value) return;\n\t\tisLoadingMore.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.getLoginHistory({ ...filters, cursor });\n\t\t\tevents.value = [...events.value, ...result.events];\n\t\t\tcursor = result.nextCursor;\n\t\t\thasMore.value = result.nextCursor !== null;\n\t\t} catch (err) {\n\t\t\terror.value =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t} finally {\n\t\t\tisLoadingMore.value = false;\n\t\t}\n\t}\n\n\tonMounted(() => void refresh());\n\n\treturn { events, isLoading, isLoadingMore, error, hasMore, refresh, loadMore };\n}\n","import type { AuthClient, ISessionDTO } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { onMounted, ref } from 'vue';\n\nexport interface IUseSessionsReturn {\n\tsessions: Ref<ISessionDTO[]>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n\t// Revoke one session. Optimistically removes it; refetches on failure.\n\tterminate: (id: string) => Promise<void>;\n\t// Revoke every session except the current one.\n\tterminateOthers: () => Promise<void>;\n}\n\nfunction toApiError(err: unknown): FonderieApiError {\n\treturn err instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n}\n\n// The caller's live sessions (one flagged `current`) plus the terminate actions.\n// Same contract as react-auth's useSessions.\nexport function useSessions(client?: AuthClient): IUseSessionsReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useSessions');\n\tconst sessions = ref<ISessionDTO[]>([]);\n\tconst isLoading = ref(true);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function refresh(opts?: { force?: boolean }) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.listSessions({ bust: opts?.force });\n\t\t\tsessions.value = result.sessions;\n\t\t} catch (err) {\n\t\t\terror.value = toApiError(err);\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tasync function terminate(id: string) {\n\t\tconst prev = sessions.value;\n\t\tsessions.value = prev.filter((row) => row.id !== id); // optimistic\n\t\terror.value = null;\n\t\ttry {\n\t\t\tawait auth.terminateSession(id);\n\t\t} catch (err) {\n\t\t\tsessions.value = prev; // roll back the optimistic removal\n\t\t\terror.value = toApiError(err);\n\t\t\tthrow toApiError(err);\n\t\t}\n\t}\n\n\tasync function terminateOthers() {\n\t\terror.value = null;\n\t\ttry {\n\t\t\tawait auth.terminateOtherSessions();\n\t\t\t// The server is the source of truth for which survived — refetch (force)\n\t\t\t// rather than trust a local \"keep current\" guess.\n\t\t\tawait refresh({ force: true });\n\t\t} catch (err) {\n\t\t\terror.value = toApiError(err);\n\t\t\tthrow toApiError(err);\n\t\t}\n\t}\n\n\tonMounted(() => void refresh());\n\n\treturn { sessions, isLoading, error, refresh, terminate, terminateOthers };\n}\n","import type { AuthClient, IVerifyEmailResult } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\n\nexport interface IUseVerifyEmailReturn {\n\tverifyEmail: (pin: string) => Promise<IVerifyEmailResult>;\n\tresend: () => Promise<void>;\n\tresent: Ref<boolean>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tdata: Ref<IVerifyEmailResult | null>;\n}\n\nexport function useVerifyEmail(client?: AuthClient): IUseVerifyEmailReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useVerifyEmail');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst data = ref<IVerifyEmailResult | null>(null);\n\tconst resent = ref(false);\n\n\t// Re-sends the verification email — the other half of the same lifecycle,\n\t// so one composable owns both and screens don't split loading/error handling.\n\tasync function resend() {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\tresent.value = false;\n\t\ttry {\n\t\t\tawait auth.sendVerificationEmail();\n\t\t\tresent.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tasync function verifyEmail(pin: string) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.verifyEmail(pin);\n\t\t\tdata.value = result;\n\t\t\treturn result;\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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\treturn { verifyEmail, resend, resent, isLoading, error, data };\n}\n","import type { AuthClient } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { onMounted, ref } from 'vue';\n\nexport interface IUseAuthProvidersReturn {\n\t/** Sign-in methods this deployment can honour, e.g. ['email','google']. */\n\tproviders: Ref<string[]>;\n\t/** The common case: should this button be rendered at all? */\n\thas: (provider: string) => boolean;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | Error | null>;\n\trefresh: () => Promise<void>;\n}\n\n// Ask the API which sign-in methods it can honour, and render buttons from\n// that — never from a build-time flag. A flag stores the same fact the API\n// already holds and lets the two disagree; the failure is a user committing to\n// a redirect and landing on the provider's error page, which this app cannot\n// explain. Same contract as react-auth's useAuthProviders.\n//\n// Starts EMPTY rather than optimistic: a brief moment with no social buttons is\n// invisible, a button that appears and then fails is not.\nexport function useAuthProviders(client?: AuthClient): IUseAuthProvidersReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useAuthProviders');\n\tconst providers = ref<string[]>([]);\n\tconst isLoading = ref(true);\n\tconst error = ref<FonderieApiError | Error | null>(null);\n\n\tconst refresh = async (): Promise<void> => {\n\t\tisLoading.value = true;\n\t\ttry {\n\t\t\tconst { result } = await auth.providers();\n\t\t\tproviders.value = result.providers;\n\t\t\terror.value = null;\n\t\t} catch (err) {\n\t\t\t// Degrade to email-only rather than guessing: an unreachable API is\n\t\t\t// not evidence that a provider works.\n\t\t\tproviders.value = [];\n\t\t\terror.value = err instanceof Error ? err : new Error(String(err));\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t};\n\n\tonMounted(() => {\n\t\tvoid refresh();\n\t});\n\n\treturn {\n\t\tproviders,\n\t\thas: (provider: string) => providers.value.includes(provider),\n\t\tisLoading,\n\t\terror,\n\t\trefresh,\n\t};\n}\n"],"mappings":";AAqBA,SAAS,oBAAAA,oBAAkB,iBAAAC,sBAAqB;;;ACpBhD,SAAS,wBAAwB;AACjC,SAAS,4BAA4B;AAErC,SAAS,WAAW;;;ACJb,IAAM,YAAY;AAElB,SAAS,aAAa,OAAe;AAC3C,eAAa,QAAQ,WAAW,KAAK;AACtC;AAEO,SAAS,aAAa;AAC5B,eAAa,WAAW,SAAS;AAClC;AAEO,SAAS,YAA2B;AAC1C,SAAO,aAAa,QAAQ,SAAS;AACtC;;;ADIO,SAAS,eAAe,QAA4C;AAC1E,QAAM,OAAO,qBAAqB,QAAQ,CAAC,MAAM,EAAE,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EA,SAAS,oBAAAE,0BAAwB;AACjC,SAAS,wBAAAC,8BAA4B;AAErC,SAAS,OAAAC,aAAW;AAWb,SAAS,eAAe,QAA4C;AAC1E,QAAM,OAAOD,uBAAqB,QAAQ,CAAC,MAAM,EAAE,MAAM,gBAAgB;AACzE,QAAM,YAAYC,MAAI,KAAK;AAC3B,QAAM,QAAQA,MAA6B,IAAI;AAC/C,QAAM,OAAOA,MAA+B,IAAI;AAChD,QAAM,SAASA,MAAI,KAAK;AAIxB,iBAAe,SAAS;AACvB,cAAU,QAAQ;AAClB,UAAM,QAAQ;AACd,WAAO,QAAQ;AACf,QAAI;AACH,YAAM,KAAK,sBAAsB;AACjC,aAAO,QAAQ;AAAA,IAChB,SAAS,KAAK;AACb,YAAM,WACL,eAAeF,qBAAmB,MAAM,IAAIA,mBAAiB,WAAW,OAAO,GAAG,GAAG,CAAC;AACvF,YAAM,QAAQ;AACd,YAAM;AAAA,IACP,UAAE;AACD,gBAAU,QAAQ;AAAA,IACnB;AAAA,EACD;AAEA,iBAAe,YAAY,KAAa;AACvC,cAAU,QAAQ;AAClB,UAAM,QAAQ;AACd,QAAI;AACH,YAAM,EAAE,OAAO,IAAI,MAAM,KAAK,YAAY,GAAG;AAC7C,WAAK,QAAQ;AACb,aAAO;AAAA,IACR,SAAS,KAAK;AACb,YAAM,WACL,eAAeA,qBAAmB,MAAM,IAAIA,mBAAiB,WAAW,OAAO,GAAG,GAAG,CAAC;AACvF,YAAM,QAAQ;AACd,YAAM;AAAA,IACP,UAAE;AACD,gBAAU,QAAQ;AAAA,IACnB;AAAA,EACD;AAEA,SAAO,EAAE,aAAa,QAAQ,QAAQ,WAAW,OAAO,KAAK;AAC9D;;;AC1DA,OAAiC;AACjC,SAAS,wBAAAG,8BAA4B;AAErC,SAAS,aAAAC,YAAW,OAAAC,aAAW;","names":["FonderieApiError","isMfaRequired","FonderieApiError","useFonderieSubClient","ref","FonderieApiError","useFonderieSubClient","ref","FonderieApiError","useFonderieSubClient","ref","useFonderieSubClient","ref","FonderieApiError","FonderieApiError","useFonderieSubClient","ref","useFonderieSubClient","ref","FonderieApiError","FonderieApiError","useFonderieSubClient","ref","useFonderieSubClient","ref","FonderieApiError","FonderieApiError","useFonderieSubClient","ref","FonderieApiError","useFonderieSubClient","ref","FonderieApiError","useFonderieSubClient","ref","useFonderieSubClient","ref","FonderieApiError","FonderieApiError","useFonderieSubClient","ref","useFonderieSubClient","onMounted","ref","useFonderieSubClient","ref","onMounted","FonderieApiError","useFonderieSubClient","onMounted","ref","FonderieApiError","useFonderieSubClient","onMounted","ref","FonderieApiError","useFonderieSubClient","ref","useFonderieSubClient","onMounted","ref"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/composables/useAccountData.ts","../src/storage.ts","../src/composables/useChangePassword.ts","../src/composables/useForgotPassword.ts","../src/composables/useLogin.ts","../src/composables/useLogout.ts","../src/composables/useMfaLogin.ts","../src/composables/useMfaSetup.ts","../src/composables/useProfile.ts","../src/composables/useRegister.ts","../src/composables/useResetPassword.ts","../src/composables/useSession.ts","../src/composables/useLoginHistory.ts","../src/composables/useSessions.ts","../src/composables/useVerifyEmail.ts","../src/composables/useAuthProviders.ts","../src/composables/useUnlinkOauth.ts"],"sourcesContent":["export type {\n\tAuthClient,\n\tIChangePasswordInput,\n\tIGetLoginHistoryInput,\n\tILoginEventDTO,\n\tILoginInput,\n\tILoginResult,\n\tIMfaEnabledResult,\n\tIMfaRequiredResult,\n\tIMfaSetupResult,\n\tIRegisterInput,\n\tIRegisterResult,\n\tIResetPasswordInput,\n\tISessionDTO,\n\tITokens,\n\tIUpdatePreferencesInput,\n\tIUpdateProfileInput,\n\tIUserDTO,\n\tIVerifyEmailResult,\n} from '@fonderie/client';\n\nexport { FonderieApiError, isMfaRequired } from '@fonderie/client';\n\nexport type {\n\tIUseAuthProvidersReturn,\n\tIUseUnlinkOauthReturn,\n\tIUseAccountDataReturn,\n\tIUseChangePasswordReturn,\n\tIUseForgotPasswordReturn,\n\tIUseLoginHistoryReturn,\n\tIUseLoginReturn,\n\tIUseLogoutReturn,\n\tIUseMfaLoginReturn,\n\tIUseMfaSetupReturn,\n\tIUseProfileReturn,\n\tIUseRegisterReturn,\n\tIUseResetPasswordReturn,\n\tIUseSessionReturn,\n\tIUseSessionsReturn,\n\tIUseVerifyEmailReturn,\n} from './composables';\nexport {\n\tuseAuthProviders,\n\tuseUnlinkOauth,\n\tuseAccountData,\n\tuseChangePassword,\n\tuseForgotPassword,\n\tuseLogin,\n\tuseLoginHistory,\n\tuseLogout,\n\tuseMfaLogin,\n\tuseMfaSetup,\n\tuseProfile,\n\tuseRegister,\n\tuseResetPassword,\n\tuseSession,\n\tuseSessions,\n\tuseVerifyEmail,\n} from './composables';\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/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\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: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n}\n\nexport function useAccountData(client?: AuthClient): IUseAccountDataReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useAccountData');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function run<T>(op: () => Promise<T>): Promise<T> {\n\t\tisLoading.value = true;\n\t\terror.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tfunction exportData() {\n\t\treturn run(async () => {\n\t\t\tconst { result } = await auth.exportData();\n\t\t\treturn result;\n\t\t});\n\t}\n\n\tfunction deleteUser() {\n\t\treturn run(async () => {\n\t\t\tawait auth.deleteUser();\n\t\t\tauth.setAccessToken(undefined);\n\t\t\tclearToken();\n\t\t});\n\t}\n\n\treturn { exportData, deleteUser, isLoading, error };\n}\n","export const TOKEN_KEY = 'fonderie_access_token';\n\nexport function persistToken(token: string) {\n\tlocalStorage.setItem(TOKEN_KEY, token);\n}\n\nexport function clearToken() {\n\tlocalStorage.removeItem(TOKEN_KEY);\n}\n\nexport function readToken(): string | null {\n\treturn localStorage.getItem(TOKEN_KEY);\n}\n","import type { AuthClient, IChangePasswordInput } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\n\nexport interface IUseChangePasswordReturn {\n\tchangePassword: (input: IChangePasswordInput) => Promise<void>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tdone: Ref<boolean>;\n}\n\nexport function useChangePassword(client?: AuthClient): IUseChangePasswordReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useChangePassword');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst done = ref(false);\n\n\tasync function changePassword(input: IChangePasswordInput) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\tdone.value = false;\n\t\ttry {\n\t\t\tawait auth.changePassword(input);\n\t\t\tdone.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\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/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\n\nexport interface IUseForgotPasswordReturn {\n\tforgotPassword: (email: string) => Promise<void>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tsent: Ref<boolean>;\n}\n\nexport function useForgotPassword(client?: AuthClient): IUseForgotPasswordReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useForgotPassword');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst sent = ref(false);\n\n\tasync function forgotPassword(email: string) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tawait auth.forgotPassword(email);\n\t\t\tsent.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\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/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\nimport { persistToken } from '../storage';\n\nexport interface IUseLoginReturn {\n\tlogin: (input: ILoginInput) => Promise<ILoginResult | IMfaRequiredResult>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tdata: Ref<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.value.mfaToken, code).\n\tmfaPending: Ref<IMfaRequiredResult | null>;\n}\n\nexport function useLogin(client?: AuthClient): IUseLoginReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useLogin');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst data = ref<ILoginResult | null>(null);\n\t// Set when the account requires MFA: complete the login with\n\t// client.auth.mfa.verifyLogin(mfaPending.value.mfaToken, code).\n\tconst mfaPending = ref<IMfaRequiredResult | null>(null);\n\n\tasync function login(input: ILoginInput) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\tmfaPending.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.login(input);\n\t\t\tif (isMfaRequired(result)) {\n\t\t\t\tmfaPending.value = result;\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\tauth.setAccessToken(result.tokens.access);\n\t\t\tpersistToken(result.tokens.access);\n\t\t\tdata.value = result;\n\t\t\treturn result;\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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\treturn { login, isLoading, error, data, mfaPending };\n}\n","import type { AuthClient } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\nimport { clearToken } from '../storage';\n\nexport interface IUseLogoutReturn {\n\tlogout: (refreshToken?: string) => Promise<void>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n}\n\nexport function useLogout(client?: AuthClient): IUseLogoutReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useLogout');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function logout(refreshToken?: string) {\n\t\tisLoading.value = true;\n\t\terror.value = 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\terror.value = apiError;\n\t\t} finally {\n\t\t\tauth.setAccessToken(undefined);\n\t\t\tclearToken();\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\treturn { logout, isLoading, error };\n}\n","import type { AuthClient, ILoginResult } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\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: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tdata: Ref<ILoginResult | null>;\n}\n\nexport function useMfaLogin(client?: AuthClient): IUseMfaLoginReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useMfaLogin');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst data = ref<ILoginResult | null>(null);\n\n\tasync function verifyLogin(mfaToken: string, code: string) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.mfa.verifyLogin(mfaToken, code);\n\t\t\tauth.setAccessToken(result.tokens.access);\n\t\t\tpersistToken(result.tokens.access);\n\t\t\tdata.value = result;\n\t\t\treturn result;\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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\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/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\n\nexport interface IUseMfaSetupReturn {\n\t// Step 1: request enrollment — returns a data-URI QR code to scan and the\n\t// one-time backup codes generated at setup.\n\tsetup: () => Promise<IMfaSetupResult>;\n\tsetupData: Ref<IMfaSetupResult | null>;\n\t// Step 2: verify the first TOTP code to complete enrollment. The session\n\t// token is not rotated — MFA is enforced at login, so the current session\n\t// remains valid unchanged.\n\tverify: (code: string) => Promise<IMfaEnabledResult>;\n\tdisable: (code: string) => Promise<void>;\n\tregenerateBackupCodes: (code: string) => Promise<string[]>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n}\n\nexport function useMfaSetup(client?: AuthClient): IUseMfaSetupReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useMfaSetup');\n\tconst setupData = ref<IMfaSetupResult | null>(null);\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function run<T>(op: () => Promise<T>): Promise<T> {\n\t\tisLoading.value = true;\n\t\terror.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tfunction setup() {\n\t\treturn run(async () => {\n\t\t\tconst { result } = await auth.mfa.setup();\n\t\t\tsetupData.value = result;\n\t\t\treturn result;\n\t\t});\n\t}\n\n\tfunction verify(code: string) {\n\t\treturn run(async () => {\n\t\t\tconst { result } = await auth.mfa.verify(code);\n\t\t\treturn result;\n\t\t});\n\t}\n\n\tfunction disable(code: string) {\n\t\treturn run(async () => {\n\t\t\tawait auth.mfa.disable(code);\n\t\t});\n\t}\n\n\tfunction regenerateBackupCodes(code: string) {\n\t\treturn run(async () => {\n\t\t\tconst { result } = await auth.mfa.regenerateBackupCodes(code);\n\t\t\treturn result.backupCodes;\n\t\t});\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/vue';\nimport type { Ref } from 'vue';\nimport { onMounted, ref } from 'vue';\n\nexport interface IUseProfileReturn {\n\tuser: Ref<IUserDTO | null>;\n\trefresh: (opts?: { force?: boolean }) => 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: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n}\n\nexport function useProfile(client?: AuthClient): IUseProfileReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useProfile');\n\tconst user = ref<IUserDTO | null>(null);\n\tconst isLoading = ref(true);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function refresh(opts?: { force?: boolean }) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.getUser({ bust: opts?.force });\n\t\t\tuser.value = 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\terror.value = apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tasync function mutate<T>(op: () => Promise<T>): Promise<T> {\n\t\terror.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t}\n\t}\n\n\tfunction updateProfile(input: IUpdateProfileInput) {\n\t\treturn mutate(async () => {\n\t\t\tconst { result } = await auth.updateProfile(input);\n\t\t\tuser.value = result.user;\n\t\t\treturn result.user;\n\t\t});\n\t}\n\n\tfunction updatePreferences(input: IUpdatePreferencesInput) {\n\t\treturn mutate(async () => {\n\t\t\tconst { result } = await auth.updatePreferences(input);\n\t\t\tuser.value = result.user;\n\t\t\treturn result.user;\n\t\t});\n\t}\n\n\tfunction updateEmail(email: string) {\n\t\treturn mutate(async () => {\n\t\t\tawait auth.updateEmail(email);\n\t\t\tawait refresh();\n\t\t});\n\t}\n\n\tfunction updatePhone(phone: string) {\n\t\treturn mutate(async () => {\n\t\t\tawait auth.updatePhone(phone);\n\t\t\tawait refresh();\n\t\t});\n\t}\n\n\tonMounted(() => void refresh());\n\n\treturn { user, refresh, updateProfile, updatePreferences, updateEmail, updatePhone, isLoading, error };\n}\n","import type { AuthClient, IRegisterInput, IRegisterResult } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\nimport { persistToken } from '../storage';\n\nexport interface IUseRegisterReturn {\n\tregister: (input: IRegisterInput) => Promise<IRegisterResult>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tdata: Ref<IRegisterResult | null>;\n}\n\nexport function useRegister(client?: AuthClient): IUseRegisterReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useRegister');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst data = ref<IRegisterResult | null>(null);\n\n\tasync function register(input: IRegisterInput) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.register(input);\n\t\t\tauth.setAccessToken(result.tokens.access);\n\t\t\tpersistToken(result.tokens.access);\n\t\t\tdata.value = result;\n\t\t\treturn result;\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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\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/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\n\nexport interface IUseResetPasswordReturn {\n\tresetPassword: (input: IResetPasswordInput) => Promise<void>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tdone: Ref<boolean>;\n}\n\nexport function useResetPassword(client?: AuthClient): IUseResetPasswordReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useResetPassword');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst done = ref(false);\n\n\tasync function resetPassword(input: IResetPasswordInput) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tawait auth.resetPassword(input);\n\t\t\tdone.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\treturn { resetPassword, isLoading, error, done };\n}\n","import type { AuthClient, IUserDTO } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { onMounted, ref } from 'vue';\nimport { clearToken, readToken } from '../storage';\n\nexport interface IUseSessionReturn {\n\tuser: Ref<IUserDTO | null>;\n\tisLoading: Ref<boolean>;\n\tisAuthenticated: Ref<boolean>;\n\trefresh: (opts?: { force?: boolean }) => 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 = ref<IUserDTO | null>(null);\n\tconst isLoading = ref(true);\n\tconst isAuthenticated = ref(false);\n\n\tasync function refresh(opts?: { force?: boolean }) {\n\t\tisLoading.value = true;\n\t\ttry {\n\t\t\tconst { result } = await auth.getUser({ bust: opts?.force });\n\t\t\tuser.value = result.user;\n\t\t\tisAuthenticated.value = true;\n\t\t} catch {\n\t\t\tuser.value = null;\n\t\t\tisAuthenticated.value = false;\n\t\t\tauth.setAccessToken(undefined);\n\t\t\tclearToken();\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tasync function logout(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\tclearToken();\n\t\tuser.value = null;\n\t\tisAuthenticated.value = false;\n\t}\n\n\tconst token = readToken();\n\tif (token) auth.setAccessToken(token);\n\tonMounted(() => void refresh());\n\n\treturn { user, isLoading, isAuthenticated, refresh, logout };\n}\n","import type { AuthClient, ILoginEventDTO, IGetLoginHistoryInput } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { onMounted, ref } from 'vue';\n\nexport interface IUseLoginHistoryReturn {\n\tevents: Ref<ILoginEventDTO[]>;\n\tisLoading: Ref<boolean>;\n\tisLoadingMore: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\thasMore: Ref<boolean>;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n\tloadMore: () => Promise<void>;\n}\n\n// The caller's own login attempts, newest first, keyset-paginated. Same contract\n// as react-auth's useLoginHistory (and vue-audit's useAuditEvents). Unlike React,\n// a composable body runs once, so filters need no memoization — they're captured\n// at call time.\nexport function useLoginHistory(rawFilters?: IGetLoginHistoryInput): IUseLoginHistoryReturn;\nexport function useLoginHistory(\n\tclient: AuthClient | undefined,\n\trawFilters?: IGetLoginHistoryInput,\n): IUseLoginHistoryReturn;\nexport function useLoginHistory(\n\tclientOrFilters?: AuthClient | IGetLoginHistoryInput,\n\tmaybeFilters?: IGetLoginHistoryInput,\n): IUseLoginHistoryReturn {\n\t// The AuthClient isn't reliably an instanceof across bundle boundaries, so\n\t// detect the client arg structurally (it has getLoginHistory) rather than\n\t// by prototype.\n\tconst firstIsClient =\n\t\tclientOrFilters === undefined ||\n\t\ttypeof (clientOrFilters as AuthClient).getLoginHistory === 'function';\n\tconst explicit = firstIsClient ? (clientOrFilters as AuthClient | undefined) : undefined;\n\tconst filters = (firstIsClient ? maybeFilters : (clientOrFilters as IGetLoginHistoryInput)) ?? {};\n\tconst auth = useFonderieSubClient(explicit, (c) => c.auth, 'useLoginHistory');\n\n\tconst events = ref<ILoginEventDTO[]>([]);\n\tconst isLoading = ref(true);\n\tconst isLoadingMore = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst hasMore = ref(false);\n\tlet cursor: string | null = null;\n\n\tasync function refresh(opts?: { force?: boolean }) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.getLoginHistory(filters, { bust: opts?.force });\n\t\t\tevents.value = result.events;\n\t\t\tcursor = result.nextCursor;\n\t\t\thasMore.value = result.nextCursor !== null;\n\t\t} catch (err) {\n\t\t\terror.value =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tasync function loadMore() {\n\t\tif (!cursor || isLoadingMore.value) return;\n\t\tisLoadingMore.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.getLoginHistory({ ...filters, cursor });\n\t\t\tevents.value = [...events.value, ...result.events];\n\t\t\tcursor = result.nextCursor;\n\t\t\thasMore.value = result.nextCursor !== null;\n\t\t} catch (err) {\n\t\t\terror.value =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t} finally {\n\t\t\tisLoadingMore.value = false;\n\t\t}\n\t}\n\n\tonMounted(() => void refresh());\n\n\treturn { events, isLoading, isLoadingMore, error, hasMore, refresh, loadMore };\n}\n","import type { AuthClient, ISessionDTO } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { onMounted, ref } from 'vue';\n\nexport interface IUseSessionsReturn {\n\tsessions: Ref<ISessionDTO[]>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n\t// Revoke one session. Optimistically removes it; refetches on failure.\n\tterminate: (id: string) => Promise<void>;\n\t// Revoke every session except the current one.\n\tterminateOthers: () => Promise<void>;\n}\n\nfunction toApiError(err: unknown): FonderieApiError {\n\treturn err instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n}\n\n// The caller's live sessions (one flagged `current`) plus the terminate actions.\n// Same contract as react-auth's useSessions.\nexport function useSessions(client?: AuthClient): IUseSessionsReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useSessions');\n\tconst sessions = ref<ISessionDTO[]>([]);\n\tconst isLoading = ref(true);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function refresh(opts?: { force?: boolean }) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.listSessions({ bust: opts?.force });\n\t\t\tsessions.value = result.sessions;\n\t\t} catch (err) {\n\t\t\terror.value = toApiError(err);\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tasync function terminate(id: string) {\n\t\tconst prev = sessions.value;\n\t\tsessions.value = prev.filter((row) => row.id !== id); // optimistic\n\t\terror.value = null;\n\t\ttry {\n\t\t\tawait auth.terminateSession(id);\n\t\t} catch (err) {\n\t\t\tsessions.value = prev; // roll back the optimistic removal\n\t\t\terror.value = toApiError(err);\n\t\t\tthrow toApiError(err);\n\t\t}\n\t}\n\n\tasync function terminateOthers() {\n\t\terror.value = null;\n\t\ttry {\n\t\t\tawait auth.terminateOtherSessions();\n\t\t\t// The server is the source of truth for which survived — refetch (force)\n\t\t\t// rather than trust a local \"keep current\" guess.\n\t\t\tawait refresh({ force: true });\n\t\t} catch (err) {\n\t\t\terror.value = toApiError(err);\n\t\t\tthrow toApiError(err);\n\t\t}\n\t}\n\n\tonMounted(() => void refresh());\n\n\treturn { sessions, isLoading, error, refresh, terminate, terminateOthers };\n}\n","import type { AuthClient, IVerifyEmailResult } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\n\nexport interface IUseVerifyEmailReturn {\n\tverifyEmail: (pin: string) => Promise<IVerifyEmailResult>;\n\tresend: () => Promise<void>;\n\tresent: Ref<boolean>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\tdata: Ref<IVerifyEmailResult | null>;\n}\n\nexport function useVerifyEmail(client?: AuthClient): IUseVerifyEmailReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useVerifyEmail');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst data = ref<IVerifyEmailResult | null>(null);\n\tconst resent = ref(false);\n\n\t// Re-sends the verification email — the other half of the same lifecycle,\n\t// so one composable owns both and screens don't split loading/error handling.\n\tasync function resend() {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\tresent.value = false;\n\t\ttry {\n\t\t\tawait auth.sendVerificationEmail();\n\t\t\tresent.value = 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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tasync function verifyEmail(pin: string) {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await auth.verifyEmail(pin);\n\t\t\tdata.value = result;\n\t\t\treturn result;\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\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\treturn { verifyEmail, resend, resent, isLoading, error, data };\n}\n","import type { AuthClient } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { onMounted, ref } from 'vue';\n\nexport interface IUseAuthProvidersReturn {\n\t/** Sign-in methods this deployment can honour, e.g. ['email','google']. */\n\tproviders: Ref<string[]>;\n\t/** The common case: should this button be rendered at all? */\n\thas: (provider: string) => boolean;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | Error | null>;\n\trefresh: () => Promise<void>;\n}\n\n// Ask the API which sign-in methods it can honour, and render buttons from\n// that — never from a build-time flag. A flag stores the same fact the API\n// already holds and lets the two disagree; the failure is a user committing to\n// a redirect and landing on the provider's error page, which this app cannot\n// explain. Same contract as react-auth's useAuthProviders.\n//\n// Starts EMPTY rather than optimistic: a brief moment with no social buttons is\n// invisible, a button that appears and then fails is not.\nexport function useAuthProviders(client?: AuthClient): IUseAuthProvidersReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useAuthProviders');\n\tconst providers = ref<string[]>([]);\n\tconst isLoading = ref(true);\n\tconst error = ref<FonderieApiError | Error | null>(null);\n\n\tconst refresh = async (): Promise<void> => {\n\t\tisLoading.value = true;\n\t\ttry {\n\t\t\tconst { result } = await auth.providers();\n\t\t\tproviders.value = result.providers;\n\t\t\terror.value = null;\n\t\t} catch (err) {\n\t\t\t// Degrade to email-only rather than guessing: an unreachable API is\n\t\t\t// not evidence that a provider works.\n\t\t\tproviders.value = [];\n\t\t\terror.value = err instanceof Error ? err : new Error(String(err));\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t};\n\n\tonMounted(() => {\n\t\tvoid refresh();\n\t});\n\n\treturn {\n\t\tproviders,\n\t\thas: (provider: string) => providers.value.includes(provider),\n\t\tisLoading,\n\t\terror,\n\t\trefresh,\n\t};\n}\n","import type { AuthClient } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/vue';\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\n\nexport interface IUseUnlinkOauthReturn {\n\tunlinkOauth: (provider: string) => Promise<void>;\n\tunlinked: Ref<boolean>;\n\tisLoading: Ref<boolean>;\n\terror: Ref<FonderieApiError | null>;\n\t// True when the server refused because the account has no password — the one\n\t// failure a settings screen should handle rather than just display, by\n\t// sending the user to set a password first. A flag so screens don't have to\n\t// match on the error's reason string.\n\trequiresPassword: Ref<boolean>;\n}\n\n/**\n * Remove the OAuth provider linked to the signed-in account.\n *\n * Prefer gating the control on `user.hasPassword` so the case is never reached:\n * an account created BY the provider has no other credential, and unlinking it\n * would be account deletion. The server refuses regardless (409), which is what\n * `requiresPassword` reports.\n */\nexport function useUnlinkOauth(client?: AuthClient): IUseUnlinkOauthReturn {\n\tconst auth = useFonderieSubClient(client, (c) => c.auth, 'useUnlinkOauth');\n\tconst isLoading = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\tconst unlinked = ref(false);\n\tconst requiresPassword = ref(false);\n\n\tconst unlinkOauth = async (provider: string): Promise<void> => {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\trequiresPassword.value = false;\n\t\ttry {\n\t\t\tawait auth.unlinkOauth(provider);\n\t\t\tunlinked.value = 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\terror.value = apiError;\n\t\t\trequiresPassword.value = apiError.reason === 'PASSWORD_REQUIRED';\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t};\n\n\treturn { unlinkOauth, unlinked, isLoading, error, requiresPassword };\n}\n"],"mappings":";AAqBA,SAAS,oBAAAA,oBAAkB,iBAAAC,sBAAqB;;;ACpBhD,SAAS,wBAAwB;AACjC,SAAS,4BAA4B;AAErC,SAAS,WAAW;;;ACJb,IAAM,YAAY;AAElB,SAAS,aAAa,OAAe;AAC3C,eAAa,QAAQ,WAAW,KAAK;AACtC;AAEO,SAAS,aAAa;AAC5B,eAAa,WAAW,SAAS;AAClC;AAEO,SAAS,YAA2B;AAC1C,SAAO,aAAa,QAAQ,SAAS;AACtC;;;ADIO,SAAS,eAAe,QAA4C;AAC1E,QAAM,OAAO,qBAAqB,QAAQ,CAAC,MAAM,EAAE,MAAM,gBAAgB;AACzE,QAAM,YAAY,IAAI,KAAK;AAC3B,QAAM,QAAQ,IAA6B,IAAI;AAE/C,iBAAe,IAAO,IAAkC;AACvD,cAAU,QAAQ;AAClB,UAAM,QAAQ;AACd,QAAI;AACH,aAAO,MAAM,GAAG;AAAA,IACjB,SAAS,KAAK;AACb,YAAM,WACL,eAAe,mBAAmB,MAAM,IAAI,iBAAiB,WAAW,OAAO,GAAG,GAAG,CAAC;AACvF,YAAM,QAAQ;AACd,YAAM;AAAA,IACP,UAAE;AACD,gBAAU,QAAQ;AAAA,IACnB;AAAA,EACD;AAEA,WAAS,aAAa;AACrB,WAAO,IAAI,YAAY;AACtB,YAAM,EAAE,OAAO,IAAI,MAAM,KAAK,WAAW;AACzC,aAAO;AAAA,IACR,CAAC;AAAA,EACF;AAEA,WAAS,aAAa;AACrB,WAAO,IAAI,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aAAqB,UAAU,MAAM,SAAS,QAAQ;AAAA,IAC5D;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;;;ACxDA,SAAS,oBAAAE,0BAAwB;AACjC,SAAS,wBAAAC,8BAA4B;AAErC,SAAS,OAAAC,aAAW;AAsBb,SAAS,eAAe,QAA4C;AAC1E,QAAM,OAAOD,uBAAqB,QAAQ,CAAC,MAAM,EAAE,MAAM,gBAAgB;AACzE,QAAM,YAAYC,MAAI,KAAK;AAC3B,QAAM,QAAQA,MAA6B,IAAI;AAC/C,QAAM,WAAWA,MAAI,KAAK;AAC1B,QAAM,mBAAmBA,MAAI,KAAK;AAElC,QAAM,cAAc,OAAO,aAAoC;AAC9D,cAAU,QAAQ;AAClB,UAAM,QAAQ;AACd,qBAAiB,QAAQ;AACzB,QAAI;AACH,YAAM,KAAK,YAAY,QAAQ;AAC/B,eAAS,QAAQ;AAAA,IAClB,SAAS,KAAK;AACb,YAAM,WACL,eAAeF,qBAAmB,MAAM,IAAIA,mBAAiB,WAAW,OAAO,GAAG,GAAG,CAAC;AACvF,YAAM,QAAQ;AACd,uBAAiB,QAAQ,SAAS,WAAW;AAC7C,YAAM;AAAA,IACP,UAAE;AACD,gBAAU,QAAQ;AAAA,IACnB;AAAA,EACD;AAEA,SAAO,EAAE,aAAa,UAAU,WAAW,OAAO,iBAAiB;AACpE;","names":["FonderieApiError","isMfaRequired","FonderieApiError","useFonderieSubClient","ref","FonderieApiError","useFonderieSubClient","ref","FonderieApiError","useFonderieSubClient","ref","useFonderieSubClient","ref","FonderieApiError","FonderieApiError","useFonderieSubClient","ref","useFonderieSubClient","ref","FonderieApiError","FonderieApiError","useFonderieSubClient","ref","useFonderieSubClient","ref","FonderieApiError","FonderieApiError","useFonderieSubClient","ref","FonderieApiError","useFonderieSubClient","ref","FonderieApiError","useFonderieSubClient","ref","useFonderieSubClient","ref","FonderieApiError","FonderieApiError","useFonderieSubClient","ref","useFonderieSubClient","onMounted","ref","useFonderieSubClient","ref","onMounted","FonderieApiError","useFonderieSubClient","onMounted","ref","FonderieApiError","useFonderieSubClient","onMounted","ref","FonderieApiError","useFonderieSubClient","ref","useFonderieSubClient","onMounted","ref","FonderieApiError","useFonderieSubClient","ref"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fonderie/vue-auth",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Vue composables for Fonderie auth \u2014 thin bindings over @fonderie/client.",
5
5
  "keywords": [
6
6
  "fonderiejs",