import type { WasAuthStore } from '../session/authStore.js'; import type { SharedCollectionReader } from '../storage/sharedCollectionReader.js'; import { type SyncRollup } from '../storage/syncStatusStore.js'; /** * The bound auth store from the nearest {@link WasSessionProvider}. Throws a * helpful error when used outside a provider. * * @returns {WasAuthStore} */ export declare function useAuthStore(): WasAuthStore; /** * The current session state (status/phase/expiry/reconnect flags). Re-renders * only when one of the selected fields changes. `authenticating` and * `accessExpired` are conveniences DERIVED here (`phase !== null` and * `status === 'reconnect'`); the store keeps only `phase` and `status`. * * @returns {object} */ export declare function useSession(): { status: ReturnType['status']; onboarding: ReturnType['onboarding']; writerId: string; authenticating: boolean; phase: ReturnType['phase']; error: string | null; controllerDid: string | null; expires: string | null; accessExpired: boolean; reconnecting: boolean; }; /** * The login action plus the state the login page renders. `authenticating` is * the in-flight flag, derived from `phase` (the `status` stays `local` during * login); `status` is exposed so a login page can redirect once it reads * `connected`. `login` * accepts `{ adopt }` -- `'merge'` (default) migrates data created in `local` * into the connected replica, `'leave'` sets it aside untouched. * * @returns {object} */ export declare function useLogin(): { login: (options?: { adopt?: 'merge' | 'leave'; }) => Promise<{ firstRun: boolean; } | null>; authenticating: boolean; status: ReturnType['status']; phase: ReturnType['phase']; error: string | null; }; /** * The logout action; accepts `{ wipe }` to delete the connected replica rather * than keep it on the device. * * @returns {(options?: { wipe?: boolean }) => Promise} */ export declare function useLogout(): (options?: { wipe?: boolean; }) => Promise; /** * The clear-data action: deletes the local replica, discards the anonymous * seed, and mints a fresh anonymous seed/DID + replica (the `local`-mode * "Clear data" affordance). * * @returns {() => Promise} */ export declare function useClearData(): () => Promise; /** * Whether the anonymous `local` replica currently holds any documents -- the * check a login affordance runs at decision time (e.g. on the login button * click) to choose between opening the adoption dialog and calling `login()` * directly. Returns the async check, not a subscription. * * @returns {() => Promise} */ export declare function useHasLocalData(): () => Promise; /** * The read-only reader over one wallet-owned collection the wallet shared with * this app, looked up by its `sharedCollections` config `key`. Returns * `undefined` until replication has bootstrapped, and stays `undefined` when the * wallet declined the share (or removed it), so a component must handle its * absence rather than assume the grant. * * @param key {string} the shared-collection config key * @returns {SharedCollectionReader | undefined} */ export declare function useSharedCollection(key: string): SharedCollectionReader | undefined; /** * The expired-access reconnect: the banner flags plus the reconnect action. * `accessExpired` is derived from the session status (`status === 'reconnect'`), * which the store keeps as its single source of truth. * * @returns {object} */ export declare function useReconnect(): { accessExpired: boolean; reconnecting: boolean; reconnect: () => Promise; }; /** * The aggregate replication rollup: no sync running, or error > syncing > * synced. Re-exported from the sync-status store, where the derivation lives. */ export type { SyncRollup }; /** * The aggregate sync status over the per-collection replication statuses (the * sync-status store keys them by the registry's logical collection key). A thin * subscription over that store: it reads the collection statuses and defers the * offline / error > syncing > synced precedence to {@link deriveSyncRollup}. * * @returns {{ state: SyncRollup, label: string, title: string }} */ export declare function useSyncStatus(): { state: SyncRollup; label: string; title: string; }; //# sourceMappingURL=hooks.d.ts.map