@singi-labs/sifa-sdk 0.18.5 → 0.18.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/{network-map-Ds3OR7eJ.d.cts → network-map-3jIMzuUY.d.cts} +1 -1
  4. package/dist/{network-map-DZjcO7tM.d.ts → network-map-CqgdF6Gr.d.ts} +1 -1
  5. package/dist/{org-DmtI6C4A.d.cts → org-ANztvuTe.d.cts} +56 -3
  6. package/dist/{org-h8nhEeAJ.d.ts → org-DS183N90.d.ts} +56 -3
  7. package/dist/{org-settings-CZ_tmAYl.d.cts → org-settings-B8e01iZx.d.cts} +1 -1
  8. package/dist/{org-settings-CZ_tmAYl.d.ts → org-settings-B8e01iZx.d.ts} +1 -1
  9. package/dist/query/fetchers/index.cjs +29 -1
  10. package/dist/query/fetchers/index.cjs.map +1 -1
  11. package/dist/query/fetchers/index.d.cts +4 -4
  12. package/dist/query/fetchers/index.d.ts +4 -4
  13. package/dist/query/fetchers/index.js +27 -2
  14. package/dist/query/fetchers/index.js.map +1 -1
  15. package/dist/query/hooks/index.cjs +61 -1
  16. package/dist/query/hooks/index.cjs.map +1 -1
  17. package/dist/query/hooks/index.d.cts +4 -4
  18. package/dist/query/hooks/index.d.ts +4 -4
  19. package/dist/query/hooks/index.js +59 -2
  20. package/dist/query/hooks/index.js.map +1 -1
  21. package/dist/query/index.cjs +62 -1
  22. package/dist/query/index.cjs.map +1 -1
  23. package/dist/query/index.d.cts +6 -6
  24. package/dist/query/index.d.ts +6 -6
  25. package/dist/query/index.js +57 -2
  26. package/dist/query/index.js.map +1 -1
  27. package/dist/resume/index.cjs +4 -4
  28. package/dist/resume/index.cjs.map +1 -1
  29. package/dist/resume/index.d.cts +8 -3
  30. package/dist/resume/index.d.ts +8 -3
  31. package/dist/resume/index.js +4 -4
  32. package/dist/resume/index.js.map +1 -1
  33. package/dist/schemas/write/index.d.cts +1 -1
  34. package/dist/schemas/write/index.d.ts +1 -1
  35. package/dist/{use-org-notification-emails-Cz4cuTyg.d.ts → use-org-notification-emails-CNDrIUcS.d.ts} +16 -3
  36. package/dist/{use-org-notification-emails-CkCQJhy8.d.cts → use-org-notification-emails-D4JRlCX2.d.cts} +16 -3
  37. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/query/client.ts","../../src/query/config.tsx","../../src/query/fetchers/profile.ts","../../src/query/fetchers/get-profile-view.ts","../../src/logic/primary-position.ts","../../src/logic/profile-summary.ts","../../src/query/fetchers/profile-summary.ts","../../src/query/fetchers/profile-mutations.ts","../../src/query/fetchers/positions.ts","../../src/query/fetchers/education.ts","../../src/query/fetchers/skills.ts","../../src/query/fetchers/records.ts","../../src/query/fetchers/profile-locations.ts","../../src/query/fetchers/external-accounts.ts","../../src/query/fetchers/endorsements.ts","../../src/query/fetchers/received-endorsements.ts","../../src/query/fetchers/reciprocity.ts","../../src/query/fetchers/endorsement-inbox.ts","../../src/query/fetchers/confirmations.ts","../../src/query/fetchers/actor.ts","../../src/query/fetchers/keytrace-claims.ts","../../src/query/fetchers/marque-domains.ts","../../src/query/fetchers/publications.ts","../../src/query/fetchers/profile-items-hide.ts","../../src/query/fetchers/stats.ts","../../src/query/fetchers/apps.ts","../../src/query/fetchers/accounts.ts","../../src/query/fetchers/search.ts","../../src/query/fetchers/speakers.ts","../../src/schemas/entity.ts","../../src/query/fetchers/entities.ts","../../src/query/fetchers/discovery.ts","../../src/query/fetchers/follow.ts","../../src/query/fetchers/follow-extras.ts","../../src/query/fetchers/admin-feature-allowlists.ts","../../src/query/fetchers/admin-review-queues.ts","../../src/query/fetchers/activity.ts","../../src/query/fetchers/github-prs.ts","../../src/query/fetchers/endorsement.ts","../../src/query/fetchers/stream.ts","../../src/query/fetchers/reactions.ts","../../src/query/fetchers/quoted-posts.ts","../../src/query/fetchers/roadmap.ts","../../src/query/fetchers/destructive.ts","../../src/query/fetchers/repo-inventory.ts","../../src/query/fetchers/network-map.ts","../../src/query/keys.ts","../../src/query/hooks/use-profile.ts","../../src/query/hooks/use-get-profile-view.ts","../../src/query/hooks/use-profile-mutations.ts","../../src/query/hooks/use-create-position.ts","../../src/query/hooks/use-position-mutations.ts","../../src/query/hooks/use-education-mutations.ts","../../src/query/hooks/use-skill-mutations.ts","../../src/query/hooks/use-record-mutations.ts","../../src/query/hooks/use-location-mutations.ts","../../src/query/hooks/use-external-accounts.ts","../../src/query/hooks/use-endorsement-mutations.ts","../../src/query/hooks/use-received-endorsements.ts","../../src/query/hooks/use-reciprocity.ts","../../src/query/hooks/use-endorsement-inbox.ts","../../src/query/hooks/use-confirmations.ts","../../src/query/hooks/use-keytrace-claims.ts","../../src/query/hooks/use-marque-domains.ts","../../src/query/hooks/use-publication-mutations.ts","../../src/query/hooks/use-profile-items-hide.ts","../../src/query/hooks/use-stats.ts","../../src/query/hooks/use-apps.ts","../../src/query/hooks/use-accounts.ts","../../src/query/hooks/use-search.ts","../../src/query/hooks/use-entity-search.ts","../../src/query/hooks/use-discovery.ts","../../src/query/hooks/use-follow.ts","../../src/query/hooks/use-follow-extras.ts","../../src/query/hooks/use-feature-allowlist.ts","../../src/query/hooks/use-admin-review-queues.ts","../../src/query/hooks/use-activity.ts","../../src/query/hooks/use-github-prs.ts","../../src/query/hooks/use-endorsement.ts","../../src/query/hooks/use-stream.ts","../../src/query/hooks/use-reactions.ts","../../src/query/hooks/use-reaction-mutations.ts","../../src/query/hooks/use-roadmap.ts","../../src/query/hooks/use-roadmap-mutations.ts","../../src/query/hooks/use-destructive.ts","../../src/query/hooks/use-repo-inventory.ts","../../src/cards/adult-content.ts","../../src/query/fetchers/bsky-preferences.ts","../../src/query/hooks/use-bsky-content-prefs.ts","../../src/query/fetchers/org.ts","../../src/query/hooks/use-org-profile.ts","../../src/query/hooks/use-org-claim.ts","../../src/query/hooks/use-org-profile-settings.ts","../../src/query/hooks/use-org-domains.ts","../../src/query/hooks/use-org-notification-emails.ts"],"names":["createContext","useContext","z","EMPTY_SEARCH","buildListPath","useQuery","useQueryClient","useMutation","invalidateProfile","makeWriteHook","useState","useEffect","useInfiniteQuery"],"mappings":";;;;;;;;AA2CO,IAAM,QAAA,GAAN,cAAuB,KAAA,CAAM;AAAA,EACzB,MAAA;AAAA,EACA,IAAA;AAAA,EAET,WAAA,CAAY,OAAA,EAAiB,MAAA,EAAgB,IAAA,EAAgB;AAC3D,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,UAAA;AACZ,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AACd,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AAAA,EACd;AACF;AAEA,IAAM,kBAAA,GAAqB,GAAA;AAC3B,IAAM,sBAAA,GAAyB,CAAA;AAC/B,IAAM,4BAAA,GAA+B,CAAA;AAoB9B,SAAS,iBAAiB,KAAA,EAAuB;AACtD,EAAA,IAAI,OAAA,GAAU,KAAA;AACd,EAAA,IAAI;AACF,IAAA,OAAA,GAAU,mBAAmB,KAAK,CAAA;AAAA,EACpC,CAAA,CAAA,MAAQ;AAAA,EAER;AACA,EAAA,OAAO,mBAAmB,OAAO,CAAA;AACnC;AASA,eAAsB,QAAA,CACpB,MAAA,EACA,IAAA,EACA,OAAA,GAA2B,EAAC,EAChB;AACZ,EAAA,MAAM,OAAA,GAAU,MAAA,CAAO,KAAA,IAAS,UAAA,CAAW,KAAA;AAC3C,EAAA,MAAM,GAAA,GAAM,CAAA,EAAG,MAAA,CAAO,OAAO,GAAG,IAAI,CAAA,CAAA;AACpC,EAAA,MAAM,UAAA,GAAa,OAAA,CAAQ,UAAA,GAAa,sBAAA,GAAyB,CAAA;AAEjE,EAAA,KAAA,IAAS,OAAA,GAAU,CAAA,EAAG,OAAA,IAAW,UAAA,EAAY,OAAA,EAAA,EAAW;AACtD,IAAA,MAAM,SAAS,OAAA,CAAQ,MAAA,IAAU,YAAY,OAAA,CAA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"index.cjs","sourcesContent":["/**\n * Foundation HTTP client for talking to the Sifa AppView.\n *\n * Stateless. Consumers supply a {@link SifaApiConfig} per call (the React\n * hooks read it from context; non-React consumers pass it explicitly). No\n * singletons, no module-level state.\n */\n\n/** Configuration passed to every fetcher. */\nexport interface SifaApiConfig {\n /** Base URL of the sifa-api AppView, e.g. `https://api.sifa.id`. No trailing slash. */\n baseUrl: string;\n /**\n * Optional fetch implementation. Defaults to {@link globalThis.fetch}.\n * Lets Next.js consumers pass their cache-enhanced fetch; node/Expo\n * consumers can leave this unset.\n */\n fetch?: typeof fetch;\n}\n\n/** Options accepted by {@link apiFetch}. */\nexport interface ApiFetchOptions {\n method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';\n /** Request body. Serialized to JSON automatically. */\n body?: unknown;\n /** AbortSignal. Defaults to `AbortSignal.timeout(timeoutMs)` if `timeoutMs` is set. */\n signal?: AbortSignal;\n /** Per-call timeout in milliseconds. Default: 10_000. Ignored if `signal` is provided. */\n timeoutMs?: number;\n /** Retry on HTTP 429 up to 3 times with the server's `Retry-After` delay (capped at 3s). */\n retryOn429?: boolean;\n /** Additional headers. `Content-Type: application/json` is set automatically when `body` is present. */\n headers?: Record<string, string>;\n credentials?: RequestCredentials;\n cache?: RequestCache;\n /**\n * Next.js-specific cache hints. Ignored on non-Next runtimes. Passed\n * through transparently as part of {@link RequestInit}.\n */\n next?: { revalidate?: number | false; tags?: string[] };\n}\n\n/** Error thrown by {@link apiFetch} on non-2xx responses. */\nexport class ApiError extends Error {\n readonly status: number;\n readonly body: unknown;\n\n constructor(message: string, status: number, body?: unknown) {\n super(message);\n this.name = 'ApiError';\n this.status = status;\n this.body = body;\n }\n}\n\nconst DEFAULT_TIMEOUT_MS = 10_000;\nconst MAX_RATE_LIMIT_RETRIES = 3;\nconst RATE_LIMIT_RETRY_CAP_SECONDS = 3;\n\n/**\n * Encode a handle or DID for safe interpolation into a request path,\n * idempotently.\n *\n * Plain {@link encodeURIComponent} double-encodes an already-encoded\n * identifier: Next.js hands route params to RSC pages percent-encoded on a\n * hard navigation (`did%3Aplc%3A...`) but decoded on client-side navigation\n * (`did:plc:...`). Encoding the former again turns `%` into `%25`, so the\n * AppView reads `did%3A...` as a literal handle, finds no match, and 404s —\n * which is why DID profile links broke on direct visits but worked when\n * clicked within the app.\n *\n * AT identifiers (handles are domain names, DIDs are `did:method:...`) never\n * contain a literal `%`, so decoding a decoded value is a no-op. A malformed\n * percent sequence (lone `%`) makes {@link decodeURIComponent} throw; in that\n * case we keep the original value so behaviour matches the prior bare\n * `encodeURIComponent`.\n */\nexport function encodeIdentifier(value: string): string {\n let decoded = value;\n try {\n decoded = decodeURIComponent(value);\n } catch {\n // Malformed percent-encoding — fall back to the raw value.\n }\n return encodeURIComponent(decoded);\n}\n\n/**\n * Generic fetcher used by all SDK query and mutation functions.\n *\n * Returns parsed JSON typed as `T`. Throws {@link ApiError} on non-2xx\n * responses. Use {@link apiFetchOrNull} when 404 should resolve to `null`\n * instead.\n */\nexport async function apiFetch<T = unknown>(\n config: SifaApiConfig,\n path: string,\n options: ApiFetchOptions = {},\n): Promise<T> {\n const fetchFn = config.fetch ?? globalThis.fetch;\n const url = `${config.baseUrl}${path}`;\n const maxRetries = options.retryOn429 ? MAX_RATE_LIMIT_RETRIES : 0;\n\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n const signal = options.signal ?? AbortSignal.timeout(options.timeoutMs ?? DEFAULT_TIMEOUT_MS);\n\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n let body: BodyInit | undefined;\n if (options.body !== undefined) {\n headers['Content-Type'] ??= 'application/json';\n body = JSON.stringify(options.body);\n }\n\n // `next` is a Next.js extension to RequestInit; cast through.\n const init = {\n method: options.method ?? 'GET',\n headers,\n body,\n signal,\n credentials: options.credentials,\n cache: options.cache,\n ...(options.next ? { next: options.next } : {}),\n } as RequestInit;\n\n const res = await fetchFn(url, init);\n\n if (res.status === 429 && attempt < maxRetries) {\n const retryAfterRaw = res.headers.get('retry-after');\n const retryAfter = retryAfterRaw ? Number.parseInt(retryAfterRaw, 10) : 2;\n const waitSeconds = Math.min(\n Number.isFinite(retryAfter) ? retryAfter : 2,\n RATE_LIMIT_RETRY_CAP_SECONDS,\n );\n await new Promise((r) => setTimeout(r, waitSeconds * 1000));\n continue;\n }\n\n if (!res.ok) {\n let errBody: unknown;\n try {\n errBody = (await res.json()) as unknown;\n } catch {\n try {\n errBody = await res.text();\n } catch {\n errBody = undefined;\n }\n }\n throw new ApiError(`Sifa API ${res.status} on ${path}`, res.status, errBody);\n }\n\n // 204 and 205 are defined to carry no body, so res.json() throws on them.\n // apiWrite treats that throw as a failed write, which turned every\n // successful no-content response (roadmap unvote, remove reaction,\n // dismiss endorsement) into a reported error.\n if (res.status === 204 || res.status === 205) {\n return undefined as T;\n }\n\n return (await res.json()) as T;\n }\n\n throw new ApiError(`Sifa API exhausted retries on ${path}`, 429);\n}\n\n/**\n * Variant of {@link apiFetch} that resolves to `null` on HTTP 404 instead\n * of throwing. Useful for \"fetch by handle\" reads where missing is\n * expected (e.g. unknown profile).\n */\nexport async function apiFetchOrNull<T>(\n config: SifaApiConfig,\n path: string,\n options: ApiFetchOptions = {},\n): Promise<T | null> {\n try {\n return await apiFetch<T>(config, path, options);\n } catch (e) {\n if (e instanceof ApiError && e.status === 404) return null;\n throw e;\n }\n}\n\n/**\n * Result returned by record-write mutations (create / update / delete).\n *\n * Never throws -- writes against the user's PDS can fail in many ways\n * (network, PDS unreachable, rate limit) and the UI needs structured\n * results to render appropriate messages.\n */\nexport interface WriteResult {\n success: boolean;\n error?: string;\n /**\n * PDS hostname returned by sifa-api when a write failed at the user's\n * Personal Data Server (issue #167). Lets the UI render\n * \"Your data server (eurosky.social) isn't responding\" instead of a\n * generic \"Request failed (500)\".\n */\n pdsHost?: string;\n}\n\n/** Result returned by create mutations. Includes the newly created `rkey`. */\nexport interface CreateResult extends WriteResult {\n rkey?: string;\n}\n\ninterface ApiErrorBody {\n message?: string;\n pdsHost?: string;\n}\n\nfunction extractWriteError(data: unknown, status: number): { error: string; pdsHost?: string } {\n const body = (data ?? {}) as ApiErrorBody;\n return {\n error: body.message ?? `Request failed (${status})`,\n ...(body.pdsHost ? { pdsHost: body.pdsHost } : {}),\n };\n}\n\n/**\n * Write mutation against the Sifa AppView. Wraps {@link apiFetch} with the\n * never-throws contract used by all sifa-web mutations: returns a\n * structured {@link WriteResult} on both success and failure, and\n * preserves the `pdsHost` field when the AppView reports a PDS-side\n * failure (issue #167).\n *\n * On success: returns `{ success: true, ...payload }` where `payload` is\n * whatever the server returned in JSON (or `{}` for 204).\n *\n * On failure: returns `{ success: false, error, pdsHost? }`. Never throws.\n *\n * Use {@link apiWriteCreate} when you specifically need the `rkey` from a\n * create response folded into the result shape.\n */\nexport async function apiWrite<TExtra extends object = Record<never, never>>(\n config: SifaApiConfig,\n path: string,\n method: 'POST' | 'PUT' | 'DELETE' | 'PATCH',\n options: Omit<ApiFetchOptions, 'method'> = {},\n): Promise<WriteResult & TExtra> {\n try {\n const data = await apiFetch<TExtra>(config, path, {\n method,\n credentials: 'include',\n ...options,\n });\n return { success: true, ...(data ?? ({} as TExtra)) };\n } catch (e) {\n if (e instanceof ApiError) {\n return { success: false, ...extractWriteError(e.body, e.status) } as WriteResult & TExtra;\n }\n return { success: false, error: 'Network error' } as WriteResult & TExtra;\n }\n}\n\n/**\n * Write mutation that expects the server to return a record key (`rkey`)\n * in its response body. Wraps {@link apiWrite} and folds the `rkey` into\n * the result shape so consumers get `{ success, rkey?, error?, pdsHost? }`.\n *\n * If the server returns additional fields (e.g. `feedUrl` from external\n * account creation), pass them via the `TExtra` generic to keep them\n * typed.\n */\nexport function apiWriteCreate<TExtra extends object = Record<never, never>>(\n config: SifaApiConfig,\n path: string,\n body: unknown,\n options: Omit<ApiFetchOptions, 'method' | 'body'> = {},\n): Promise<CreateResult & TExtra> {\n return apiWrite<{ rkey?: string } & TExtra>(config, path, 'POST', {\n body,\n ...options,\n });\n}\n","'use client';\n\nimport { createContext, useContext, type ReactNode } from 'react';\n\nimport type { SifaApiConfig } from './client.js';\n\nconst SifaConfigContext = createContext<SifaApiConfig | null>(null);\n\nexport interface SifaProviderProps {\n config: SifaApiConfig;\n children: ReactNode;\n}\n\n/**\n * Provides the {@link SifaApiConfig} that hooks under it can read via\n * {@link useSifaConfig}. Wrap the React tree once; hooks consume it.\n *\n * @example\n * ```tsx\n * <QueryClientProvider client={queryClient}>\n * <SifaProvider config={{ baseUrl: process.env.NEXT_PUBLIC_API_URL! }}>\n * <App />\n * </SifaProvider>\n * </QueryClientProvider>\n * ```\n */\nexport function SifaProvider({ config, children }: SifaProviderProps) {\n return <SifaConfigContext.Provider value={config}>{children}</SifaConfigContext.Provider>;\n}\n\n/**\n * Read the SDK's {@link SifaApiConfig} from context. Throws if no\n * {@link SifaProvider} is mounted above.\n */\nexport function useSifaConfig(): SifaApiConfig {\n const ctx = useContext(SifaConfigContext);\n if (!ctx) {\n throw new Error(\n 'useSifaConfig must be used inside <SifaProvider>. Wrap your app once with <SifaProvider config={...}>.',\n );\n }\n return ctx;\n}\n","import type { Profile } from '../../types/index.js';\nimport {\n encodeIdentifier,\n apiFetch,\n apiFetchOrNull,\n type ApiFetchOptions,\n type SifaApiConfig,\n} from '../client.js';\n\n/**\n * Read the aggregated profile for a handle or DID.\n *\n * Returns `null` when the AppView has no profile for the given identifier\n * (HTTP 404). Throws {@link ApiError} on other non-2xx responses.\n *\n * Server-callable (Next.js RSC) and client-callable (Expo, browser).\n */\nexport function fetchProfile(\n config: SifaApiConfig,\n handleOrDid: string,\n options: ApiFetchOptions = {},\n): Promise<Profile | null> {\n const path = `/api/profile/${encodeIdentifier(handleOrDid)}`;\n return apiFetchOrNull<Profile>(config, path, {\n retryOn429: true,\n ...options,\n });\n}\n\n/**\n * Public AT Fund link for a profile, if one is configured. Returns `null`\n * on any error or when the response payload's `url` field is missing or\n * non-string.\n */\nexport async function fetchAtFundLink(\n config: SifaApiConfig,\n did: string,\n options: ApiFetchOptions = {},\n): Promise<string | null> {\n const path = `/api/profiles/${encodeIdentifier(did)}/at-fund-link`;\n try {\n const data = await apiFetch<{ url?: unknown }>(config, path, {\n next: { revalidate: 3600 },\n timeoutMs: 5000,\n ...options,\n });\n return typeof data.url === 'string' ? data.url : null;\n } catch {\n return null;\n }\n}\n","import type { ProfileView } from '../../types/profile-view.js';\nimport {\n ApiError,\n apiFetch,\n encodeIdentifier,\n type ApiFetchOptions,\n type SifaApiConfig,\n} from '../client.js';\n\n/**\n * Read the aggregated public profile view via the `id.sifa.getProfileView`\n * XRPC query. This is the AppView-only join (positions, education, skills,\n * endorsements, and more) exposed as a standard lexicon method, distinct from\n * the internal `/api/profile/*` REST surface.\n *\n * Returns `null` when the AppView has no profile for the actor\n * (`ProfileNotFound`). Throws {@link ApiError} on other non-2xx responses.\n *\n * Server-callable (Next.js RSC) and client-callable (Expo, browser).\n */\nexport async function fetchGetProfileView(\n config: SifaApiConfig,\n actor: string,\n options: ApiFetchOptions = {},\n): Promise<ProfileView | null> {\n const path = `/xrpc/id.sifa.getProfileView?actor=${encodeIdentifier(actor)}`;\n try {\n return await apiFetch<ProfileView>(config, path, { retryOn429: true, ...options });\n } catch (e) {\n if (\n e instanceof ApiError &&\n e.status === 400 &&\n typeof e.body === 'object' &&\n e.body !== null &&\n (e.body as { error?: unknown }).error === 'ProfileNotFound'\n ) {\n return null;\n }\n throw e;\n }\n}\n","/**\n * Canonical rule for picking the \"primary\" position to surface on profile cards,\n * social previews, and structured-data outputs.\n *\n * Without this shared helper, different surfaces (visible hero, OG image,\n * <meta description>, JSON-LD) re-derived \"primary\" inconsistently and diverged\n * for users with multiple concurrent roles.\n *\n * A `hidden` position is one the user chose not to show on their public profile.\n * It is never surfaced as the featured role — hidden wins over `primary`, so a\n * role flagged both hidden and primary is excluded rather than featured.\n *\n * Rules (in order):\n * 1. A position the user explicitly flagged `primary` AND that is still active AND not hidden.\n * 2. Otherwise, the active, non-hidden position with the most recent `startedAt`.\n * 3. Otherwise, undefined (no eligible position).\n */\n\nexport interface PrimaryPositionCandidate {\n startedAt?: string;\n endedAt?: string;\n primary?: boolean;\n hidden?: boolean;\n}\n\nexport function pickPrimaryPosition<T extends PrimaryPositionCandidate>(\n positions: readonly T[] | undefined,\n): T | undefined {\n if (!positions || positions.length === 0) return undefined;\n\n const active = positions.filter((p) => !p.endedAt && !p.hidden);\n if (active.length === 0) return undefined;\n\n const flagged = active.find((p) => p.primary === true);\n if (flagged) return flagged;\n\n return [...active].sort((a, b) => (b.startedAt ?? '').localeCompare(a.startedAt ?? ''))[0];\n}\n","/**\n * Compact professional summary derived from a {@link ProfileView}.\n *\n * The full `id.sifa.getProfileView` payload carries every section (all\n * positions, education, skills, publications, talks, and more). Third-party\n * surfaces that only want to show \"who is this, what do they do now\" — a badge,\n * a maintainer card, a byline — need a much smaller shape. This is that shape,\n * derived with the same canonical rules the Sifa web app uses (see\n * {@link pickPrimaryPosition}) so an embedded summary matches the profile page.\n *\n * Pure and I/O-free: pass it a view you already fetched. For the fetch +\n * summarize convenience, use `fetchProfileSummary` from `@singi-labs/sifa-sdk`.\n */\n\nimport type { ProfileView } from '../types/profile-view.js';\nimport { pickPrimaryPosition } from './primary-position.js';\n\nexport interface ProfileSummary {\n did: string;\n handle: string;\n displayName?: string;\n avatar?: string;\n pronouns?: string;\n headline?: string;\n /** Title of the current primary role, if the person has an active position. */\n currentTitle?: string;\n /** Current employer: the resolved entity name when linked, else the free-text company. */\n currentCompany?: string;\n /** Skill names in the order the AppView returns them, capped by `maxSkills`. */\n topSkills: string[];\n /** Whether the profile is claimed by its owner (vs an unclaimed placeholder). */\n claimed: boolean;\n}\n\nexport interface SummarizeProfileViewOptions {\n /** Maximum number of skills to include in `topSkills`. Default 5; negatives clamp to 0. */\n maxSkills?: number;\n}\n\nconst DEFAULT_MAX_SKILLS = 5;\n\nexport function summarizeProfileView(\n view: ProfileView,\n options: SummarizeProfileViewOptions = {},\n): ProfileSummary {\n const limit = Math.max(0, options.maxSkills ?? DEFAULT_MAX_SKILLS);\n const primary = pickPrimaryPosition(view.positions);\n\n return {\n did: view.did,\n handle: view.handle,\n displayName: view.displayName,\n avatar: view.avatar,\n pronouns: view.pronouns,\n headline: view.headline,\n currentTitle: primary?.title,\n currentCompany: primary ? (primary.entityName ?? primary.company) : undefined,\n topSkills: (view.skills ?? []).slice(0, limit).map((s) => s.name),\n claimed: view.claimed ?? false,\n };\n}\n","import {\n summarizeProfileView,\n type ProfileSummary,\n type SummarizeProfileViewOptions,\n} from '../../logic/profile-summary.js';\nimport { fetchGetProfileView } from './get-profile-view.js';\nimport type { ApiFetchOptions, SifaApiConfig } from '../client.js';\n\n/**\n * Fetch the aggregated public profile via `id.sifa.getProfileView` and reduce it\n * to a compact {@link ProfileSummary} (identity, headline, current role/employer,\n * top skills). Convenience over `fetchGetProfileView` + `summarizeProfileView`,\n * for third-party surfaces that only want the headline facts.\n *\n * Returns `null` when the AppView has no profile for the actor. Server-callable\n * (Next.js RSC) and client-callable (Expo, browser).\n */\nexport async function fetchProfileSummary(\n config: SifaApiConfig,\n actor: string,\n options: SummarizeProfileViewOptions & ApiFetchOptions = {},\n): Promise<ProfileSummary | null> {\n const { maxSkills, ...fetchOptions } = options;\n const view = await fetchGetProfileView(config, actor, fetchOptions);\n return view ? summarizeProfileView(view, { maxSkills }) : null;\n}\n","import { apiWrite, type ApiFetchOptions, type SifaApiConfig, type WriteResult } from '../client.js';\n\n/** Industry/domain entry on the profile self record. */\nexport interface ProfileIndustryInput {\n industry: string;\n domain?: string;\n}\n\n/**\n * Location payload accepted by `updateProfileSelf`.\n *\n * Accepts both shapes during the community.lexicon.location.address\n * migration. Prefer `locality` (new) over `city` (legacy) when sending.\n * The API's locationSchema is a Zod union that resolves either input.\n */\nexport interface ProfileSelfLocation {\n country: string;\n countryCode?: string;\n region?: string;\n city?: string;\n locality?: string;\n}\n\n/** Body accepted by {@link updateProfileSelf}. */\nexport interface UpdateProfileSelfInput {\n headline?: string;\n about?: string;\n /** Schema.org Person.givenName from id.sifa.profile.self.givenName. */\n givenName?: string;\n /** Schema.org Person.familyName from id.sifa.profile.self.familyName. */\n familyName?: string;\n /** Free-form phonetic respelling of the name from id.sifa.profile.self.namePronunciation. */\n namePronunciation?: string;\n industries?: ProfileIndustryInput[];\n location?: ProfileSelfLocation;\n website?: string;\n openTo?: string[];\n preferredWorkplace?: string[];\n availableFromUtc?: number;\n availableToUtc?: number;\n}\n\n/** Update the authenticated user's `id.sifa.profile.self` record. */\nexport function updateProfileSelf(\n config: SifaApiConfig,\n data: UpdateProfileSelfInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/self', 'PUT', { body: data, ...options });\n}\n\n/** Body accepted by {@link updateProfileOverride}. */\nexport interface UpdateProfileOverrideInput {\n headline?: string | null;\n about?: string | null;\n displayName?: string | null;\n pronouns?: string | null;\n}\n\n/**\n * Override aggregated profile fields with sifa-specific values. `null`\n * clears the override and falls back to the upstream PDS value.\n */\nexport function updateProfileOverride(\n config: SifaApiConfig,\n data: UpdateProfileOverrideInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/override', 'PUT', { body: data, ...options });\n}\n\n/** Extended result for {@link refreshPds}. */\nexport interface RefreshPdsResult extends WriteResult {\n displayName?: string | null;\n avatar?: string | null;\n}\n\n/**\n * Re-pull the authenticated user's `app.bsky.actor.profile` from their\n * PDS. Returns the freshly resolved `displayName` and `avatar` on\n * success so the UI can update without a full profile refetch.\n */\nexport function refreshPds(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<RefreshPdsResult> {\n return apiWrite<{ displayName?: string | null; avatar?: string | null }>(\n config,\n '/api/profile/refresh-pds',\n 'POST',\n options,\n );\n}\n\n/** Extended result for {@link uploadAvatar}. */\nexport interface UploadAvatarResult extends WriteResult {\n /** Publicly accessible URL of the newly uploaded avatar. */\n url?: string;\n}\n\n/**\n * Upload a new avatar via `multipart/form-data`. Pass either a `File`\n * (browser) or any `Blob` (Expo, node). The SDK leaves `Content-Type`\n * unset so the runtime can set the multipart boundary automatically.\n *\n * Never throws -- inspect `result.success` and `result.url`.\n */\nexport async function uploadAvatar(\n config: SifaApiConfig,\n file: Blob,\n options: ApiFetchOptions = {},\n): Promise<UploadAvatarResult> {\n const fetchFn = config.fetch ?? globalThis.fetch;\n const url = `${config.baseUrl}/api/profile/avatar`;\n const formData = new FormData();\n formData.append('file', file);\n\n try {\n const res = await fetchFn(url, {\n method: 'POST',\n credentials: options.credentials ?? 'include',\n body: formData,\n signal: options.signal ?? AbortSignal.timeout(options.timeoutMs ?? 30_000),\n headers: options.headers,\n });\n if (!res.ok) {\n const errBody = (await res.json().catch(() => ({}))) as {\n message?: string;\n pdsHost?: string;\n };\n const msg = errBody.message ?? `Request failed (${res.status})`;\n const pdsHost = errBody.pdsHost;\n return { success: false, error: msg, ...(pdsHost ? { pdsHost } : {}) };\n }\n const data = (await res.json()) as { url: string };\n return { success: true, url: data.url };\n } catch {\n return { success: false, error: 'Network error' };\n }\n}\n\n/** Delete the authenticated user's avatar override (revert to PDS avatar). */\nexport function deleteAvatarOverride(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/avatar', 'DELETE', options);\n}\n\n/** Extended result for {@link uploadNamePronunciationAudio}. */\nexport interface UploadPronunciationAudioResult extends WriteResult {\n /** Publicly accessible URL of the newly uploaded audio clip. */\n url?: string;\n}\n\n/**\n * Upload a name-pronunciation audio clip via `multipart/form-data`. Pass a\n * `File` (browser) or any `Blob` (Expo, node). The SDK leaves `Content-Type`\n * unset so the runtime sets the multipart boundary automatically.\n *\n * Never throws -- inspect `result.success` and `result.url`.\n */\nexport async function uploadNamePronunciationAudio(\n config: SifaApiConfig,\n file: Blob,\n options: ApiFetchOptions = {},\n): Promise<UploadPronunciationAudioResult> {\n const fetchFn = config.fetch ?? globalThis.fetch;\n const url = `${config.baseUrl}/api/profile/pronunciation-audio`;\n const formData = new FormData();\n formData.append('file', file);\n\n try {\n const res = await fetchFn(url, {\n method: 'POST',\n credentials: options.credentials ?? 'include',\n body: formData,\n signal: options.signal ?? AbortSignal.timeout(options.timeoutMs ?? 30_000),\n headers: options.headers,\n });\n if (!res.ok) {\n const errBody = (await res.json().catch(() => ({}))) as {\n message?: string;\n pdsHost?: string;\n };\n const msg = errBody.message ?? `Request failed (${res.status})`;\n const pdsHost = errBody.pdsHost;\n return { success: false, error: msg, ...(pdsHost ? { pdsHost } : {}) };\n }\n const data = (await res.json()) as { url: string };\n return { success: true, url: data.url };\n } catch {\n return { success: false, error: 'Network error' };\n }\n}\n\n/** Delete the name-pronunciation audio clip from the user's profile. */\nexport function deleteNamePronunciationAudio(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/pronunciation-audio', 'DELETE', options);\n}\n","import type { ProfilePosition, SkillRef } from '../../types/index.js';\nimport {\n apiWrite,\n apiWriteCreate,\n type ApiFetchOptions,\n type CreateResult,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\nexport type { CreateResult, WriteResult } from '../client.js';\n\n/**\n * Create a new `id.sifa.profile.position` record on the authenticated\n * user's PDS. The AppView signs and writes via the user's OAuth session.\n *\n * `data` should be a lexicon-shaped position record (without `createdAt`\n * or `rkey`; the AppView fills both). Validate with\n * `ProfilePositionRecordSchema.omit({ createdAt: true })` before calling\n * if you want client-side guarantees.\n *\n * Never throws -- inspect `result.success` and use `result.error` /\n * `result.pdsHost` for UI messaging.\n */\nexport function createPosition(\n config: SifaApiConfig,\n data: Record<string, unknown>,\n options: ApiFetchOptions = {},\n): Promise<CreateResult> {\n return apiWriteCreate(config, '/api/profile/position', data, options);\n}\n\n/** Update an existing position by `rkey`. */\nexport function updatePosition(\n config: SifaApiConfig,\n rkey: string,\n data: Record<string, unknown>,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/position/${encodeURIComponent(rkey)}`, 'PUT', {\n body: data,\n ...options,\n });\n}\n\n/** Delete a position by `rkey`. */\nexport function deletePosition(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/position/${encodeURIComponent(rkey)}`, 'DELETE', options);\n}\n\n/** Mark a position as the user's primary (current) role. */\nexport function setPositionPrimary(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/position/${encodeURIComponent(rkey)}/primary`,\n 'PUT',\n options,\n );\n}\n\n/** Clear the \"primary\" flag on a position. */\nexport function unsetPositionPrimary(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/position/${encodeURIComponent(rkey)}/primary`,\n 'DELETE',\n options,\n );\n}\n\n/**\n * Build the PUT-body for a position update. Strips `null` `location`\n * (so JSON.stringify drops it) and includes the provided `skills` list.\n */\nfunction buildPositionPayload(\n position: ProfilePosition,\n skills: SkillRef[],\n): Record<string, unknown> {\n return {\n company: position.company,\n title: position.title,\n description: position.description,\n startedAt: position.startedAt,\n endedAt: position.endedAt,\n location: position.location ?? undefined,\n // Carry the form-controlled optional fields the AppView merge would\n // otherwise clear when absent from the PUT body. Omitting them here made\n // every link/unlink strip employmentType, workplaceType, and entityRef\n // off the position (id.sifa.profile.position#skills round-trip).\n employmentType: position.employmentType,\n workplaceType: position.workplaceType,\n entityRef: position.entityRef,\n skills,\n };\n}\n\n/**\n * Add a skill link to a position. Idempotent: if the skill is already\n * linked, resolves to `{ success: true }` without a network call.\n *\n * Implementation note: the AppView only exposes whole-record PUTs, so\n * this helper rebuilds the position body with the new skills list.\n */\nexport function linkSkillToPosition(\n config: SifaApiConfig,\n position: ProfilePosition,\n skillRef: SkillRef,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n const currentSkills = position.skills ?? [];\n if (currentSkills.some((s) => s.uri === skillRef.uri)) {\n return Promise.resolve({ success: true });\n }\n return updatePosition(\n config,\n position.rkey,\n buildPositionPayload(position, [...currentSkills, skillRef]),\n options,\n );\n}\n\n/** Remove a skill link from a position. */\nexport function unlinkSkillFromPosition(\n config: SifaApiConfig,\n position: ProfilePosition,\n skillRef: SkillRef,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n const remaining = (position.skills ?? []).filter((s) => s.uri !== skillRef.uri);\n return updatePosition(config, position.rkey, buildPositionPayload(position, remaining), options);\n}\n","import {\n apiWrite,\n apiWriteCreate,\n type ApiFetchOptions,\n type CreateResult,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/**\n * Create a new `id.sifa.profile.education` record on the authenticated\n * user's PDS.\n */\nexport function createEducation(\n config: SifaApiConfig,\n data: Record<string, unknown>,\n options: ApiFetchOptions = {},\n): Promise<CreateResult> {\n return apiWriteCreate(config, '/api/profile/education', data, options);\n}\n\n/** Update an existing education record by `rkey`. */\nexport function updateEducation(\n config: SifaApiConfig,\n rkey: string,\n data: Record<string, unknown>,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/education/${encodeURIComponent(rkey)}`, 'PUT', {\n body: data,\n ...options,\n });\n}\n\n/** Delete an education record by `rkey`. */\nexport function deleteEducation(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/education/${encodeURIComponent(rkey)}`, 'DELETE', options);\n}\n","import {\n apiWrite,\n apiWriteCreate,\n type ApiFetchOptions,\n type CreateResult,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/**\n * Create a new `id.sifa.profile.skill` record on the authenticated\n * user's PDS.\n */\nexport function createSkill(\n config: SifaApiConfig,\n data: Record<string, unknown>,\n options: ApiFetchOptions = {},\n): Promise<CreateResult> {\n return apiWriteCreate(config, '/api/profile/skill', data, options);\n}\n\n/** Update an existing skill record by `rkey`. */\nexport function updateSkill(\n config: SifaApiConfig,\n rkey: string,\n data: Record<string, unknown>,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/skill/${encodeURIComponent(rkey)}`, 'PUT', {\n body: data,\n ...options,\n });\n}\n\n/** Outcome of a bulk sub-category assign. */\nexport interface SubCategoryBulkResult {\n /** Records written. */\n updated: number;\n /** Records that already carried the label, so no write was needed. */\n unchanged: number;\n /** Requested rkeys with no matching record on the PDS. */\n skipped: string[];\n}\n\n/**\n * Set (or clear) the sub-category on many skills in one request.\n *\n * A single call replaces one PUT per skill, which tripped the AppView's\n * per-IP rate limit on any sizeable profile (#324). An empty `subCategory`\n * clears the field.\n */\nexport function updateSkillSubCategories(\n config: SifaApiConfig,\n rkeys: string[],\n subCategory: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult & SubCategoryBulkResult> {\n return apiWrite<SubCategoryBulkResult>(config, '/api/profile/skills/subcategory', 'POST', {\n body: { rkeys, subCategory },\n ...options,\n });\n}\n\n/** Delete a skill record by `rkey`. */\nexport function deleteSkill(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/skill/${encodeURIComponent(rkey)}`, 'DELETE', options);\n}\n","import {\n apiWrite,\n apiWriteCreate,\n type ApiFetchOptions,\n type CreateResult,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/**\n * Generic record-create escape hatch. Most callers should prefer the\n * dedicated section helpers (`createPosition`, `createEducation`, etc.)\n * which take typed payloads and ship matching hooks. Use this when the\n * lexicon doesn't yet have a dedicated endpoint (certifications,\n * projects, publications, volunteering, honors, languages, courses).\n *\n * `collection` is a `id.sifa.profile.*` collection NSID. Routes to\n * `POST /api/profile/records/<collection>`.\n */\nexport function createRecord(\n config: SifaApiConfig,\n collection: string,\n data: Record<string, unknown>,\n options: ApiFetchOptions = {},\n): Promise<CreateResult> {\n return apiWriteCreate(\n config,\n `/api/profile/records/${encodeURIComponent(collection)}`,\n data,\n options,\n );\n}\n\n/** Generic record-update escape hatch. See {@link createRecord}. */\nexport function updateRecord(\n config: SifaApiConfig,\n collection: string,\n rkey: string,\n data: Record<string, unknown>,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n const path = `/api/profile/records/${encodeURIComponent(collection)}/${encodeURIComponent(rkey)}`;\n return apiWrite(config, path, 'PUT', { body: data, ...options });\n}\n\n/** Generic record-delete escape hatch. See {@link createRecord}. */\nexport function deleteRecord(\n config: SifaApiConfig,\n collection: string,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n const path = `/api/profile/records/${encodeURIComponent(collection)}/${encodeURIComponent(rkey)}`;\n return apiWrite(config, path, 'DELETE', options);\n}\n","import {\n apiWrite,\n apiWriteCreate,\n type ApiFetchOptions,\n type CreateResult,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/**\n * Address payload accepted by `/api/profile/location` endpoints.\n *\n * Accepts both shapes during the community.lexicon.location.address\n * migration. Prefer `country` + `locality` (new) over `countryCode` +\n * `city` (legacy). The API's `locationSchema` is a Zod union that\n * accepts either pair.\n */\nexport interface ProfileLocationAddress {\n /** Legacy alias for `country` (alpha-2). */\n countryCode?: string;\n /** community.lexicon.location.address field -- prefer over `countryCode`. */\n country?: string;\n region?: string;\n /** Legacy alias for `locality`. */\n city?: string;\n /** community.lexicon.location.address field -- prefer over `city`. */\n locality?: string;\n}\n\n/** Body accepted by {@link createProfileLocation} / {@link updateProfileLocation}. */\nexport interface ProfileLocationInput {\n address: ProfileLocationAddress;\n type: string;\n label?: string;\n isPrimary?: boolean;\n}\n\n/** Create a new profile location entry. */\nexport function createProfileLocation(\n config: SifaApiConfig,\n data: ProfileLocationInput,\n options: ApiFetchOptions = {},\n): Promise<CreateResult> {\n return apiWriteCreate(config, '/api/profile/location', data, options);\n}\n\n/** Update an existing profile location by `rkey`. */\nexport function updateProfileLocation(\n config: SifaApiConfig,\n rkey: string,\n data: ProfileLocationInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/location/${encodeURIComponent(rkey)}`, 'PUT', {\n body: data,\n ...options,\n });\n}\n\n/** Delete a profile location by `rkey`. */\nexport function deleteProfileLocation(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/location/${encodeURIComponent(rkey)}`, 'DELETE', options);\n}\n","import type { ExternalAccount } from '../../types/index.js';\nimport {\n apiFetch,\n encodeIdentifier,\n apiWrite,\n type ApiFetchOptions,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/** Body accepted by {@link createExternalAccount} / {@link updateExternalAccount}. */\nexport interface ExternalAccountInput {\n platform: string;\n url: string;\n label?: string;\n feedUrl?: string;\n}\n\n/** Extended create result for {@link createExternalAccount}. */\nexport interface CreateExternalAccountResult extends WriteResult {\n rkey?: string;\n feedUrl?: string | null;\n}\n\n/** Extended write result for {@link verifyExternalAccount}. */\nexport interface VerifyExternalAccountResult extends WriteResult {\n verified?: boolean;\n verifiedVia?: string;\n}\n\n/** List external accounts attached to a profile. Returns `[]` on error. */\nexport async function fetchExternalAccounts(\n config: SifaApiConfig,\n handleOrDid: string,\n options: ApiFetchOptions = {},\n): Promise<ExternalAccount[]> {\n const path = `/api/profile/${encodeIdentifier(handleOrDid)}/external-accounts`;\n try {\n const data = await apiFetch<{ accounts?: ExternalAccount[] }>(config, path, {\n credentials: 'include',\n ...options,\n });\n return data.accounts ?? [];\n } catch {\n return [];\n }\n}\n\n/**\n * Create a new external account record. Returns the newly-created `rkey`\n * and the server-resolved `feedUrl` (sifa-api inspects the target for\n * RSS feeds on platforms that publish them).\n */\nexport function createExternalAccount(\n config: SifaApiConfig,\n data: ExternalAccountInput,\n options: ApiFetchOptions = {},\n): Promise<CreateExternalAccountResult> {\n return apiWrite<{ rkey?: string; feedUrl?: string | null }>(\n config,\n '/api/profile/external-accounts',\n 'POST',\n { body: data, ...options },\n );\n}\n\n/** Update an existing external account by `rkey`. */\nexport function updateExternalAccount(\n config: SifaApiConfig,\n rkey: string,\n data: ExternalAccountInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/external-accounts/${encodeURIComponent(rkey)}`, 'PUT', {\n body: data,\n ...options,\n });\n}\n\n/** Delete an external account by `rkey`. */\nexport function deleteExternalAccount(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/external-accounts/${encodeURIComponent(rkey)}`,\n 'DELETE',\n options,\n );\n}\n\n/** Mark an external account as the user's primary. */\nexport function setExternalAccountPrimary(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/external-accounts/${encodeURIComponent(rkey)}/primary`,\n 'PUT',\n options,\n );\n}\n\n/** Clear the \"primary\" flag on an external account. */\nexport function unsetExternalAccountPrimary(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/external-accounts/${encodeURIComponent(rkey)}/primary`,\n 'DELETE',\n options,\n );\n}\n\n/**\n * Run server-side verification on an external account (e.g. inspect\n * the target for a keytrace claim). Returns `{ verified, verifiedVia }`\n * on success.\n */\nexport function verifyExternalAccount(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<VerifyExternalAccountResult> {\n return apiWrite<{ verified?: boolean; verifiedVia?: string }>(\n config,\n `/api/profile/external-accounts/${encodeURIComponent(rkey)}/verify`,\n 'POST',\n { body: {}, ...options },\n );\n}\n","import {\n apiWriteCreate,\n type ApiFetchOptions,\n type CreateResult,\n type SifaApiConfig,\n} from '../client.js';\n\n/** Body accepted by {@link createEndorsement}. */\nexport interface EndorsementInput {\n /** DID of the person being endorsed. */\n subjectDid: string;\n /**\n * AT-URI of the subject's `id.sifa.profile.skill` record. Omit to propose a\n * skill they have not listed; `skillName` then names what is proposed, and\n * the record is created when they accept.\n */\n skillUri?: string;\n /**\n * CID of that skill record, pinning the endorsement to the version endorsed.\n * Optional: the AppView resolves it when omitted, which is the common case\n * since only the firehose carries a CID. Never substitute another record's.\n */\n skillCid?: string;\n /**\n * Snapshot of the skill's name at endorsement time. Acts as the validity\n * anchor: if the subject later renames the skill, the mismatch is detectable.\n */\n skillName: string;\n comment?: string;\n}\n\n/** Body accepted by {@link confirmEndorsement}. */\nexport interface ConfirmEndorsementResult {\n /** Skill the endorsement resolved to, created if it was a proposal. */\n skillUri?: string;\n /** True when accepting added a new skill to the profile. */\n skillCreated?: boolean;\n}\n\nexport interface ConfirmEndorsementInput {\n endorsementUri: string;\n /**\n * Optional. When omitted the AppView resolves the CID itself, reading the\n * record from the endorser's PDS if it has none stored. Callers working from\n * the pending inbox should pass `cid` through when it is there and leave it\n * out when it is not, rather than substituting another record's CID.\n */\n endorsementCid?: string;\n}\n\n/**\n * Create an endorsement of another user's skill. The endorsed user\n * must confirm before the endorsement appears on their profile (the\n * endorsement record is on the endorser's PDS; a separate confirmation\n * record on the endorsed user's PDS gates display).\n */\nexport function createEndorsement(\n config: SifaApiConfig,\n data: EndorsementInput,\n options: ApiFetchOptions = {},\n): Promise<CreateResult> {\n return apiWriteCreate(config, '/api/endorsement', data, options);\n}\n\n/**\n * Confirm a received endorsement, writing a confirmation record to the\n * signed-in user's PDS. This is what makes the endorsement public: until the\n * confirmation exists, the endorsement is indexed but displays nowhere.\n */\nexport function confirmEndorsement(\n config: SifaApiConfig,\n data: ConfirmEndorsementInput,\n options: ApiFetchOptions = {},\n): Promise<CreateResult & ConfirmEndorsementResult> {\n return apiWriteCreate<ConfirmEndorsementResult>(\n config,\n '/api/endorsement/confirm',\n data,\n options,\n );\n}\n","import { encodeIdentifier, apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\nexport interface ReceivedEndorsement {\n endorserDid: string;\n /** Absent when the endorser has no Sifa profile yet. */\n endorserHandle?: string;\n endorserDisplayName?: string;\n endorserAvatar?: string;\n skillUri?: string;\n skillCid?: string;\n skillName: string;\n comment?: string;\n createdAt: string;\n}\n\nexport interface ReceivedEndorsementsPage {\n endorsements: ReceivedEndorsement[];\n cursor?: string;\n}\n\n/**\n * Confirmed endorsements a DID has received, newest first.\n *\n * Only confirmed ones exist here: the AppView inner-joins against the\n * confirmation records, so an endorsement the subject has not accepted is\n * absent rather than pending. Public -- no credentials needed.\n *\n * Returns an empty page on failure so a surface that merely decorates a page\n * cannot break it.\n */\nexport async function fetchReceivedEndorsements(\n config: SifaApiConfig,\n did: string,\n options: { limit?: number } & ApiFetchOptions = {},\n): Promise<ReceivedEndorsementsPage> {\n const { limit, ...fetchOptions } = options;\n const qs = limit ? `?limit=${limit}` : '';\n try {\n const data = await apiFetch<ReceivedEndorsementsPage>(\n config,\n `/api/endorsement/${encodeIdentifier(did)}${qs}`,\n { cache: 'no-store', timeoutMs: 5000, ...fetchOptions },\n );\n return { endorsements: data?.endorsements ?? [], cursor: data?.cursor };\n } catch {\n return { endorsements: [] };\n }\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\nexport interface ReciprocitySkill {\n name: string;\n uri: string;\n /** Absent until the firehose indexes the skill; the AppView resolves it. */\n cid?: string;\n}\n\nexport interface ReciprocityCandidate {\n did: string;\n handle: string;\n displayName?: string;\n avatar?: string;\n skills: ReciprocitySkill[];\n}\n\n/**\n * Someone the signed-in user follows on Sifa whose skills they could endorse.\n *\n * The AppView picks: it filters people already dismissed and anyone blocked,\n * requires at least one skill, and rotates the choice every twelve hours so\n * the same person is not offered indefinitely.\n *\n * `null` means there is nobody left to suggest -- a real state, not an error.\n * Failures also yield `null` so a broken suggestion never breaks the homepage.\n */\nexport async function fetchReciprocityCandidate(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<ReciprocityCandidate | null> {\n try {\n const data = await apiFetch<{ candidate: ReciprocityCandidate | null }>(\n config,\n '/api/endorsements/reciprocity-candidate',\n {\n cache: 'no-store',\n credentials: 'include',\n timeoutMs: 5000,\n ...options,\n },\n );\n return data?.candidate ?? null;\n } catch {\n return null;\n }\n}\n","import {\n apiFetch,\n apiWrite,\n type ApiFetchOptions,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/** A received endorsement the subject has neither confirmed nor dismissed. */\nexport interface PendingEndorsement {\n endorserDid: string;\n /**\n * Endorser's handle, when the AppView has resolved one. Absent when the\n * endorser has no Sifa profile yet -- an endorsement can come from any AT\n * Protocol app -- so the UI needs a fallback for having no name to show.\n */\n endorserHandle?: string;\n rkey: string;\n /**\n * AT-URI of the endorsement record. The confirm mutation needs a strongRef,\n * so the AppView hands this back rather than making callers rebuild it.\n */\n uri: string;\n /**\n * CID of the endorsement record, when the AppView has it. Often absent:\n * an endorsement written by another AT Protocol app can be indexed without\n * its CID ever reaching us. Pass it through to confirm when present; the\n * AppView resolves it from the endorser's PDS when it is not.\n */\n cid?: string;\n /** Absent when this endorsement proposes a skill the subject does not have. */\n skillUri?: string;\n skillCid?: string;\n /**\n * True when accepting this will add `skillName` to the profile as well as\n * publishing the endorsement. The UI must say so: it is a bigger action than\n * confirming an endorsement of a skill already listed.\n */\n proposesNewSkill?: boolean;\n skillName: string;\n comment?: string;\n createdAt: string;\n}\n\nexport interface PendingEndorsementsPage {\n endorsements: PendingEndorsement[];\n cursor?: string;\n}\n\n/** Body accepted by {@link dismissEndorsement}. */\nexport interface DismissEndorsementInput {\n endorserDid: string;\n rkey: string;\n}\n\n/**\n * Endorsements awaiting the signed-in user's decision. Requires credentials --\n * the AppView reads the subject DID from the session, not from a parameter, so\n * there is no way to read someone else's inbox.\n *\n * Returns an empty page on failure so a broken inbox degrades to \"nothing\n * pending\" rather than breaking the surface hosting it.\n */\nexport async function fetchPendingEndorsements(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<PendingEndorsementsPage> {\n try {\n const data = await apiFetch<PendingEndorsementsPage>(config, '/api/endorsements/pending', {\n cache: 'no-store',\n credentials: 'include',\n timeoutMs: 5000,\n ...options,\n });\n return { endorsements: data?.endorsements ?? [], cursor: data?.cursor };\n } catch {\n return { endorsements: [] };\n }\n}\n\n/**\n * Take a received endorsement out of the inbox.\n *\n * This writes nothing to any PDS. An endorsement only displays once the subject\n * has confirmed it, so declining is already the default state -- the dismissal\n * is a local flag that stops it reappearing, not a published rejection.\n */\nexport function dismissEndorsement(\n config: SifaApiConfig,\n data: DismissEndorsementInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/endorsement/dismiss', 'POST', { body: data, ...options });\n}\n","import {\n apiFetch,\n apiWrite,\n apiWriteCreate,\n type ApiFetchOptions,\n type CreateResult,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/** A claim naming the signed-in user that they have neither confirmed nor dismissed. */\nexport interface PendingConfirmation {\n /** DID of the person who wrote the claim. */\n claimerDid: string;\n /**\n * Claimer's handle, when the AppView has resolved one. Absent when they have\n * no Sifa profile: a claim can be written by any AT Protocol app, so the UI\n * needs a fallback for having no name to show.\n */\n claimerHandle?: string;\n claimerDisplayName?: string;\n claimerAvatar?: string;\n /** AT-URI of the record that names you. The confirm mutation needs a strongRef. */\n subjectUri: string;\n /**\n * CID of that record, when the AppView has it. Often absent, since a record\n * indexed from another app can arrive without one. Pass it through when\n * present; the AppView resolves it from the claimer's PDS when it is not.\n * Never substitute a different record's CID.\n */\n subjectCid?: string;\n relation: string;\n /** Name or title the subject record carries right now, for display and snapshotting. */\n subjectName: string;\n /** Role the claimer assigned you, for `projectMember`. Display only. */\n role?: string;\n title?: string;\n createdAt: string;\n}\n\nexport interface PendingConfirmationsPage {\n confirmations: PendingConfirmation[];\n cursor?: string;\n}\n\n/** A confirmation the signed-in user has already given. */\nexport interface GivenConfirmation {\n subjectUri: string;\n claimerDid: string;\n claimerHandle?: string;\n relation: string;\n /** The name as it stood when confirmed, so a rename shows as a difference. */\n subjectName: string;\n /** The name the record carries now. Absent when the claim no longer exists. */\n currentName?: string;\n /** The record changed materially after it was confirmed. */\n confirmedStale: boolean;\n /** They removed you from the record, or deleted it. Nothing left to withdraw. */\n claimWithdrawn: boolean;\n createdAt: string;\n}\n\n/** Body accepted by {@link createConfirmation}. */\nexport interface ConfirmationInput {\n subjectUri: string;\n subjectCid?: string;\n relation: string;\n /**\n * Snapshot of the subject's name at confirmation time. Stored in your own\n * repo, out of the claimer's reach, so a later rename is detectable.\n */\n subjectName?: string;\n}\n\n/** Body accepted by {@link dismissConfirmation} and {@link revokeConfirmation}. */\nexport interface ConfirmationSubjectInput {\n subjectUri: string;\n}\n\n/**\n * Claims awaiting the signed-in user's decision. Requires credentials -- the\n * AppView reads the subject DID from the session, not from a parameter, so\n * there is no way to read someone else's inbox.\n *\n * Returns an empty page on failure so a broken inbox degrades to \"nothing\n * pending\" rather than breaking the surface hosting it.\n */\nexport async function fetchPendingConfirmations(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<PendingConfirmationsPage> {\n try {\n const data = await apiFetch<PendingConfirmationsPage>(config, '/api/confirmations/pending', {\n cache: 'no-store',\n credentials: 'include',\n timeoutMs: 5000,\n ...options,\n });\n return { confirmations: data?.confirmations ?? [], cursor: data?.cursor };\n } catch {\n return { confirmations: [] };\n }\n}\n\n/**\n * Confirmations the signed-in user has already given.\n *\n * The surface for changing your mind. Without it a confirmation is one-way in\n * practice: the inbox lists only claims you have not answered, so once answered\n * there is nowhere to see it, let alone withdraw it.\n *\n * Returns an empty list on failure, matching the pending inbox: a broken list\n * should not break the page hosting it.\n */\nexport async function fetchGivenConfirmations(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<{ confirmations: GivenConfirmation[] }> {\n try {\n const data = await apiFetch<{ confirmations: GivenConfirmation[] }>(\n config,\n '/api/confirmations/mine',\n { cache: 'no-store', credentials: 'include', timeoutMs: 5000, ...options },\n );\n return { confirmations: data?.confirmations ?? [] };\n } catch {\n return { confirmations: [] };\n }\n}\n\n/**\n * Affirm that a record naming you is accurate, writing an `id.sifa.confirmation`\n * to your own PDS. Until this exists the claim renders as a bare handle with no\n * display name, avatar, or link back to you.\n *\n * Confirming does not put the claimer's record on your profile. That record\n * lives in their repository and they can rename it at will; keeping your own\n * entry is a separate, deliberate step.\n */\nexport function createConfirmation(\n config: SifaApiConfig,\n data: ConfirmationInput,\n options: ApiFetchOptions = {},\n): Promise<CreateResult> {\n return apiWriteCreate(config, '/api/confirmation', data, options);\n}\n\n/**\n * Take a claim out of the inbox without confirming it.\n *\n * This writes nothing to any PDS. A claim only gains your identity once you\n * have confirmed it, so declining is already the default state -- the dismissal\n * is a local flag that stops it reappearing, not a published rejection the\n * claimer can read.\n */\nexport function dismissConfirmation(\n config: SifaApiConfig,\n data: ConfirmationSubjectInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/confirmation/dismiss', 'POST', { body: data, ...options });\n}\n\n/**\n * Withdraw a confirmation you previously gave, deleting the record from your\n * PDS. The claim reverts to rendering as a bare handle.\n *\n * The usual reason is drift: the claimer renamed the project or changed the\n * role after you confirmed, so what you affirmed is no longer what is shown.\n * Also writes a dismissal, or the still-live claim returns to your inbox.\n */\nexport function revokeConfirmation(\n config: SifaApiConfig,\n data: ConfirmationSubjectInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/confirmation/revoke', 'POST', { body: data, ...options });\n}\n","import { apiFetch, apiFetchOrNull, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\nimport type { ActorCard, CoSpeaker } from '../../types/index.js';\n\n/**\n * Resolve any atproto handle (or DID) to a profile card, for the co-speaker\n * picker's \"not on Sifa\" path. Returns `null` when the identity can't be\n * resolved. The Sifa AppView resolves the handle to a DID and hydrates a card\n * (handle, displayName, avatar, and whether they have a claimed Sifa profile).\n */\nexport async function fetchResolveActor(\n config: SifaApiConfig,\n handleOrDid: string,\n options: ApiFetchOptions = {},\n): Promise<CoSpeaker | null> {\n const q = handleOrDid.trim().replace(/^@/, '');\n if (!q) return null;\n return apiFetchOrNull<CoSpeaker>(config, `/api/actor/resolve?q=${encodeURIComponent(q)}`, {\n cache: 'no-store',\n ...options,\n });\n}\n\n/**\n * Typeahead over indexed Sifa profiles by partial name or handle, for the\n * co-speaker, login and search comboboxes. Matches display name and handle only\n * (prefix + trigram), ranks prefix matches first, and returns actor cards.\n * Unlike `/api/search/profiles`, a partial of a dotted custom handle resolves\n * and a partial name surfaces its prefix match rather than an unrelated\n * account. Returns an empty array on a blank query or a failed request; use\n * {@link fetchResolveActor} on Enter to reach a handle that is not on Sifa.\n */\nexport async function fetchTypeaheadActors(\n config: SifaApiConfig,\n query: string,\n limit = 8,\n options: ApiFetchOptions = {},\n): Promise<ActorCard[]> {\n const q = query.trim().replace(/^@/, '');\n if (!q) return [];\n const params = new URLSearchParams({ q, limit: String(limit) });\n try {\n const res = await apiFetch<{ actors: ActorCard[] }>(\n config,\n `/api/actor/typeahead?${params.toString()}`,\n { cache: 'no-store', ...options },\n );\n return res.actors ?? [];\n } catch {\n return [];\n }\n}\n","import { apiWrite, type ApiFetchOptions, type SifaApiConfig, type WriteResult } from '../client.js';\n\n/**\n * Hide a keytrace claim (verified-account claim discovered on the\n * user's external accounts) from the user's profile. The claim itself\n * stays in the index; only its display is suppressed.\n */\nexport function hideKeytraceClaim(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/keytrace-claims/${encodeURIComponent(rkey)}/hide`,\n 'POST',\n options,\n );\n}\n\n/** Restore a previously-hidden keytrace claim. */\nexport function unhideKeytraceClaim(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/keytrace-claims/${encodeURIComponent(rkey)}/hide`,\n 'DELETE',\n options,\n );\n}\n","import { apiWrite, type ApiFetchOptions, type SifaApiConfig, type WriteResult } from '../client.js';\n\n/**\n * Make a Marque-registered domain public in the owner's Links section. Marque\n * domains are owner-only by default; this reveals one. `domain` is the\n * at.marque.domain rkey (the domain name itself).\n */\nexport function revealMarqueDomain(\n config: SifaApiConfig,\n domain: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/marque-domains/${encodeURIComponent(domain)}/reveal`,\n 'POST',\n options,\n );\n}\n\n/** Make a previously-revealed Marque domain owner-only again. */\nexport function unrevealMarqueDomain(\n config: SifaApiConfig,\n domain: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/marque-domains/${encodeURIComponent(domain)}/reveal`,\n 'DELETE',\n options,\n );\n}\n","import { apiWrite, type ApiFetchOptions, type SifaApiConfig, type WriteResult } from '../client.js';\n\n/** Extended result for {@link refreshOrcidPublications}. */\nexport interface RefreshOrcidPublicationsResult extends WriteResult {\n added?: number;\n removed?: number;\n}\n\n/**\n * Hide an ORCID-imported publication from the user's profile. The\n * `putCode` is the ORCID-side identifier; the underlying record stays\n * in the index, only its display is suppressed.\n */\nexport function hideOrcidPublication(\n config: SifaApiConfig,\n putCode: number,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/orcid-publications/${putCode}/hide`, 'POST', options);\n}\n\n/** Restore a previously-hidden ORCID publication. */\nexport function unhideOrcidPublication(\n config: SifaApiConfig,\n putCode: number,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/orcid-publications/${putCode}/hide`, 'DELETE', options);\n}\n\n/** Hide a standard (auto-imported) publication by its AT URI. */\nexport function hideStandardPublication(\n config: SifaApiConfig,\n uri: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/standard-publications/${encodeURIComponent(uri)}/hide`,\n 'POST',\n options,\n );\n}\n\n/** Restore a previously-hidden standard publication. */\nexport function unhideStandardPublication(\n config: SifaApiConfig,\n uri: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/standard-publications/${encodeURIComponent(uri)}/hide`,\n 'DELETE',\n options,\n );\n}\n\n/** Bulk-hide standard publications by AT URI list. */\nexport function bulkHideStandardPublications(\n config: SifaApiConfig,\n uris: string[],\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/standard-publications/bulk-hide', 'POST', {\n body: { uris },\n ...options,\n });\n}\n\n/** Bulk-unhide standard publications by AT URI list. */\nexport function bulkUnhideStandardPublications(\n config: SifaApiConfig,\n uris: string[],\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/standard-publications/bulk-hide', 'DELETE', {\n body: { uris },\n ...options,\n });\n}\n\n/** Hide an `id.sifa.profile.publication` (user-authored publication record). */\nexport function hideSifaPublication(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/publications/${rkey}/hide`, 'POST', options);\n}\n\n/** Restore a previously-hidden Sifa publication. */\nexport function unhideSifaPublication(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/publications/${rkey}/hide`, 'DELETE', options);\n}\n\n/**\n * Re-pull the authenticated user's ORCID publications. Returns counts\n * of added and removed records. The server returns `{ error: '...' }`\n * inline (not via HTTP status) on quota / linkage failures; the SDK\n * folds that into `{ success: false, error }` to keep the contract\n * consistent with other mutations.\n */\nexport async function refreshOrcidPublications(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<RefreshOrcidPublicationsResult> {\n const result = await apiWrite<{ added?: number; removed?: number; error?: string }>(\n config,\n '/api/profile/orcid-publications/refresh',\n 'POST',\n { body: {}, ...options },\n );\n if (result.success && result.error) {\n return { success: false, error: result.error };\n }\n return result;\n}\n","import { apiWrite, type ApiFetchOptions, type SifaApiConfig, type WriteResult } from '../client.js';\n\n/** Item types that can be hidden on the authenticated user's profile. */\nexport const HIDDEN_ITEM_TYPES = [\n 'position',\n 'education',\n 'certification',\n 'project',\n 'volunteering',\n 'publication',\n 'course',\n 'honor',\n 'language',\n 'externalAccount',\n] as const;\nexport type HiddenItemType = (typeof HIDDEN_ITEM_TYPES)[number];\n\n/** Source from which an item originates; disambiguates `item_id`. */\nexport const HIDDEN_ITEM_SOURCES = ['pds', 'standard', 'orcid'] as const;\nexport type HiddenItemSource = (typeof HIDDEN_ITEM_SOURCES)[number];\n\nexport interface HideProfileItemInput {\n itemType: HiddenItemType;\n source: HiddenItemSource;\n /** rkey for `pds`, AT-URI for `standard`, ORCID putCode as text for `orcid`. */\n itemId: string;\n}\n\nexport interface BulkHideProfileItemInput {\n itemType: HiddenItemType;\n source: HiddenItemSource;\n itemIds: string[];\n}\n\n/**\n * Hide one profile item. The underlying record stays on the user's PDS;\n * only its display on sifa.id is suppressed.\n */\nexport function hideProfileItem(\n config: SifaApiConfig,\n input: HideProfileItemInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/items/hide', 'POST', { ...options, body: input });\n}\n\n/** Restore a previously-hidden profile item. */\nexport function unhideProfileItem(\n config: SifaApiConfig,\n input: HideProfileItemInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/items/hide', 'DELETE', { ...options, body: input });\n}\n\n/** Bulk-hide profile items sharing the same `itemType` + `source`. */\nexport function bulkHideProfileItems(\n config: SifaApiConfig,\n input: BulkHideProfileItemInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/items/bulk-hide', 'POST', { ...options, body: input });\n}\n\n/** Bulk-unhide profile items sharing the same `itemType` + `source`. */\nexport function bulkUnhideProfileItems(\n config: SifaApiConfig,\n input: BulkHideProfileItemInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/items/bulk-hide', 'DELETE', { ...options, body: input });\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/** Public, aggregate stats shown on the homepage and similar surfaces. */\nexport interface StatsResponse {\n profileCount: number;\n avatars: string[];\n atproto: {\n userCount: number;\n growthPerSecond: number;\n timestamp: number;\n } | null;\n}\n\n/**\n * Homepage stats (profile count, avatar samples, ATproto growth). Public\n * endpoint -- safe to cache. Returns `null` on any error so callers can\n * render a graceful empty state.\n */\nexport async function fetchStats(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<StatsResponse | null> {\n try {\n return await apiFetch<StatsResponse>(config, '/api/stats', {\n next: { revalidate: 900 },\n ...options,\n });\n } catch {\n return null;\n }\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/** Catalog entry describing an ATproto app that Sifa surfaces activity for. */\nexport interface AppRegistryEntry {\n id: string;\n name: string;\n category: string;\n collectionPrefixes: string[];\n scanCollections: string[];\n urlPattern?: string;\n color: string;\n}\n\n/** Compact app representation returned by the hidden-apps endpoint. */\nexport interface HiddenApp {\n id: string;\n name: string;\n category: string;\n}\n\nexport interface FetchHiddenAppsOptions extends ApiFetchOptions {\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * `credentials: 'include'` does NOT propagate browser cookies in RSC,\n * so authenticated server fetches must forward the header explicitly.\n */\n cookieHeader?: string;\n}\n\n/**\n * Public app registry shown across discovery surfaces. Heavily cached.\n * Returns `[]` on any error.\n */\nexport async function fetchAppsRegistry(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<AppRegistryEntry[]> {\n try {\n return await apiFetch<AppRegistryEntry[]>(config, '/api/apps/registry', {\n next: { revalidate: 86400 },\n ...options,\n });\n } catch {\n return [];\n }\n}\n\n/**\n * Apps the authenticated user has chosen to hide from their activity feed.\n * Requires an authenticated session. Returns `[]` on any error (including\n * the unauthenticated case).\n */\nexport async function fetchHiddenApps(\n config: SifaApiConfig,\n options: FetchHiddenAppsOptions = {},\n): Promise<HiddenApp[]> {\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n const data = await apiFetch<{ apps: HiddenApp[] }>(config, '/api/profile/hidden-apps', {\n credentials: 'include',\n ...options,\n headers,\n });\n return data.apps;\n } catch {\n return [];\n }\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/** One account attached to the current browser, for the account switcher. */\nexport interface AccountSummary {\n did: string;\n handle: string | null;\n displayName: string | null;\n avatarUrl: string | null;\n /**\n * The org's uploaded logo blob CID, for a company account that set one on its\n * `/c/` page; null otherwise. The switcher resolves it to the same logo `/c/`\n * shows (via the shared company-logo resolution), so an uploaded logo appears\n * in the menu rather than the atproto avatar. Omitted by older api responses.\n */\n orgLogoBlob?: string | null;\n /** Whether this is the currently-active account. */\n active: boolean;\n}\n\nexport interface FetchAccountsOptions extends ApiFetchOptions {\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * `credentials: 'include'` does NOT propagate browser cookies in RSC,\n * so authenticated server fetches must forward the header explicitly.\n */\n cookieHeader?: string;\n}\n\n/**\n * Accounts attached to this browser (the account switcher). Requires an\n * authenticated session. Returns `[]` on any error, including the\n * unauthenticated case.\n */\nexport async function fetchAccounts(\n config: SifaApiConfig,\n options: FetchAccountsOptions = {},\n): Promise<AccountSummary[]> {\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n const data = await apiFetch<{ accounts: AccountSummary[] }>(config, '/api/auth/accounts', {\n credentials: 'include',\n ...options,\n headers,\n });\n return data.accounts;\n } catch {\n return [];\n }\n}\n\n/**\n * Make an already-attached account the active one. Keyed by DID (public); the\n * server maps it to the browser's session id. Browser-only: the endpoint\n * requires an Origin header, which browsers set automatically on POST. Callers\n * typically reload the app afterwards to reset session-seeded state.\n */\nexport async function switchAccount(\n config: SifaApiConfig,\n did: string,\n options: ApiFetchOptions = {},\n): Promise<void> {\n await apiFetch(config, '/oauth/switch', {\n method: 'POST',\n body: { did },\n credentials: 'include',\n ...options,\n });\n}\n","import type { SkillSuggestion } from '../../types/index.js';\nimport { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/** Profile entry returned by the search endpoint. */\nexport interface ProfileSearchResult {\n did?: string;\n handle: string;\n displayName?: string;\n headline?: string;\n avatar?: string;\n about?: string;\n currentRole?: string;\n currentCompany?: string;\n industry?: string;\n domain?: string;\n countryCode?: string;\n locationCountry?: string;\n preferredWorkplace?: string[];\n claimed?: boolean;\n blueskyVerified?: boolean;\n blueskyVerifiedAt?: string | null;\n}\n\nexport interface SearchFilters {\n q?: string;\n skill?: string;\n country?: string;\n industry?: string;\n domain?: string;\n workplace?: string;\n app?: string;\n /**\n * Open-to filter. Values are short tokens (e.g. \"fullTime\", \"mentor\",\n * \"collab\") matching `OPEN_TO_OPTIONS[].token` from the taxonomy. The\n * API expands tokens to lex values server-side. Multiple tokens are\n * OR-combined (profile matches if any selected token is set).\n */\n openTo?: string[];\n limit?: number;\n}\n\nexport interface SearchResponse {\n profiles: ProfileSearchResult[];\n total: number;\n limit: number;\n offset: number;\n}\n\n/** Skill typeahead suggestion. */\nexport interface SkillSearchResult {\n name: string;\n slug: string;\n category: string;\n userCount: number;\n}\n\nexport interface FilterOptions {\n countries: { countryCode: string; country: string; count: number }[];\n industries: { industry: string; count: number }[];\n apps: { appId: string; count: number }[];\n /**\n * Distribution of openTo selections across indexed profiles. Each entry\n * maps a short token (see {@link SearchFilters.openTo}) to the number of\n * profiles that have it set. Omitted from older API responses; treat\n * absence as \"no data\" rather than \"all zero\".\n */\n openTo?: { token: string; count: number }[];\n}\n\n/** Company entry returned by company search (workspace#299). */\nexport interface CompanySearchResult {\n /** Immutable catalogue id; the durable `/c/{publicId}` link. */\n publicId: string;\n name: string;\n domain: string | null;\n country: string | null;\n industry: string | null;\n logoUrl: string | null;\n employeeCount: number | null;\n}\n\nexport interface CompanySearchFilters {\n q?: string;\n /** ISO 3166-1 alpha-2. */\n country?: string;\n industry?: string;\n limit?: number;\n}\n\nexport interface CompanySearchResponse {\n results: CompanySearchResult[];\n hasMore: boolean;\n}\n\nconst EMPTY_SEARCH: SearchResponse = { profiles: [], total: 0, limit: 20, offset: 0 };\nconst EMPTY_FILTERS: FilterOptions = { countries: [], industries: [], apps: [], openTo: [] };\nconst EMPTY_COMPANY_SEARCH: CompanySearchResponse = { results: [], hasMore: false };\n\n/**\n * Search profiles by free-text query and optional filters. Returns an\n * empty result set when no filters are provided (matching sifa-web's\n * \"no input, no fetch\" behavior).\n */\nexport async function fetchSearchProfiles(\n config: SifaApiConfig,\n filters: SearchFilters,\n options: ApiFetchOptions = {},\n): Promise<SearchResponse> {\n const params = new URLSearchParams();\n if (filters.q) params.set('q', filters.q);\n if (filters.skill) params.set('skill', filters.skill);\n if (filters.country) params.set('country', filters.country);\n if (filters.industry) params.set('industry', filters.industry);\n if (filters.domain) params.set('domain', filters.domain);\n if (filters.workplace) params.set('workplace', filters.workplace);\n if (filters.app) params.set('app', filters.app);\n if (filters.openTo && filters.openTo.length > 0) {\n for (const token of filters.openTo) {\n if (token) params.append('openTo', token);\n }\n }\n if (filters.limit !== undefined) params.set('limit', String(filters.limit));\n\n if (params.size === 0) return EMPTY_SEARCH;\n\n return apiFetch<SearchResponse>(config, `/api/search/profiles?${params.toString()}`, {\n cache: 'no-store',\n ...options,\n });\n}\n\n/**\n * Company search over the entity catalogue (workspace#299).\n *\n * A category of its own rather than part of profile search: the two rank\n * differently and carry different filters, and a slow category should not hold\n * up the rest of a blended results page.\n *\n * An empty query returns nothing without a network call. The API rejects a\n * blank `q` rather than scanning ~200k rows, so asking would only spend a round\n * trip to be told no.\n */\nexport async function fetchSearchCompanies(\n config: SifaApiConfig,\n filters: CompanySearchFilters,\n options: ApiFetchOptions = {},\n): Promise<CompanySearchResponse> {\n const q = filters.q?.trim();\n if (!q) return EMPTY_COMPANY_SEARCH;\n\n const params = new URLSearchParams({ q });\n if (filters.country) params.set('country', filters.country);\n if (filters.industry) params.set('industry', filters.industry);\n if (filters.limit !== undefined) params.set('limit', String(filters.limit));\n\n return apiFetch<CompanySearchResponse>(config, `/api/search/companies?${params.toString()}`, {\n cache: 'no-store',\n ...options,\n });\n}\n\n/**\n * Skill typeahead. Returns up to 8 matches for the given prefix. Empty\n * input returns an empty array without hitting the server.\n */\nexport async function fetchSkillSuggestions(\n config: SifaApiConfig,\n query: string,\n options: ApiFetchOptions = {},\n): Promise<SkillSearchResult[]> {\n if (!query.trim()) return [];\n const path = `/api/search/skills?q=${encodeURIComponent(query)}&limit=8`;\n const data = await apiFetch<{ skills?: SkillSearchResult[] }>(config, path, {\n cache: 'no-store',\n ...options,\n });\n return data.skills ?? [];\n}\n\n/** Available filter facets (countries, industries, apps) for search UI. */\nexport async function fetchSearchFilters(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<FilterOptions> {\n try {\n return await apiFetch<FilterOptions>(config, '/api/search/filters', {\n next: { revalidate: 300 },\n ...options,\n });\n } catch {\n return EMPTY_FILTERS;\n }\n}\n\n/**\n * Canonical-skill search backing the position-editor and similar\n * skill-pickers. Hits `/api/skills/search` (the canonical-skills DB\n * lookup) which is distinct from {@link fetchSkillSuggestions}'s\n * `/api/search/skills` (the profile-skill typeahead).\n *\n * Returns `[]` on empty input (no network call) or any error.\n */\nexport async function searchSkills(\n config: SifaApiConfig,\n query: string,\n limit = 10,\n options: ApiFetchOptions = {},\n): Promise<SkillSuggestion[]> {\n if (!query.trim()) return [];\n const path = `/api/skills/search?q=${encodeURIComponent(query)}&limit=${limit}`;\n try {\n const data = await apiFetch<{ skills?: SkillSuggestion[] }>(config, path, {\n cache: 'no-store',\n ...options,\n });\n return data.skills ?? [];\n } catch {\n return [];\n }\n}\n","import type { PresentationLinkView } from '../../types/index.js';\nimport { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/**\n * Which claim a listed speaker makes about a topic. Phase 1 has no confirmed\n * data, so groups are named by the CLAIM, never a \"proven\" label:\n * - `spoke_about_it` — has a topic-matching delivery (or, with a topic set,\n * a matching presentation plus at least one delivery)\n * - `skilled` — holds the matching canonical skill but has no matching talk\n * (only appears when a topic is supplied)\n * - `open_to_speaking` — opted in but has never delivered (only appears when\n * no topic is supplied)\n */\nexport type SpeakerGroup = 'spoke_about_it' | 'skilled' | 'open_to_speaking';\n\n/** One person in the speaker directory. Everyone listed has opted in. */\nexport interface SpeakerCard {\n did: string;\n handle: string;\n displayName: string | null;\n avatar: string | null;\n headline: string | null;\n currentRole: string | null;\n currentCompany: string | null;\n deliveryCount: number;\n group: SpeakerGroup;\n matchedTopics: string[];\n /**\n * Self-reported event names from the speaker's own presentationDelivery\n * records — unconfirmed in Phase 1. `eventsSelfReported` is always true;\n * the web layer labels these as such.\n */\n recentEvents: string[];\n eventsSelfReported: boolean;\n /**\n * Up to 3 of the speaker's most-recent talks (self-reported), newest first.\n * `rkey` builds the talk-page URL via `buildTalkSlug(title, rkey)`. Optional:\n * absent from responses served before this field shipped, so consumers should\n * default to an empty list.\n */\n recentTalks?: { title: string; rkey: string }[];\n}\n\nexport interface SpeakersResponse {\n speakers: SpeakerCard[];\n}\n\n/** The reusable talk, or a standalone delivery when it has no parent talk. */\nexport interface TalkEvent {\n eventName: string | null;\n date: string | null;\n}\n\n/** Compact speaker card embedded in a talk row. */\nexport interface TalkSpeaker {\n did: string;\n handle: string;\n displayName: string | null;\n avatar: string | null;\n headline: string | null;\n currentRole: string | null;\n currentCompany: string | null;\n}\n\nexport interface TalkRow {\n /**\n * `presentation` = a reusable `id.sifa.profile.presentation` record.\n * `delivery` = a standalone presentationDelivery with no parent presentation.\n */\n kind: 'presentation' | 'delivery';\n rkey: string;\n title: string | null;\n snippet: string | null;\n links: PresentationLinkView[];\n writeupUri: string | null;\n speaker: TalkSpeaker;\n events: TalkEvent[];\n eventsSelfReported: boolean;\n deliveryCount: number;\n matchedTopics: string[];\n}\n\nexport interface TalksResponse {\n talks: TalkRow[];\n}\n\nexport interface SpeakerDirectoryFilters {\n /** Free-text topic (canonical skill name/slug/alias, talk title, or event). */\n topic?: string;\n /** Max rows to return; the API caps this at 50. */\n limit?: number;\n}\n\nconst EMPTY_SPEAKERS: SpeakersResponse = { speakers: [] };\nconst EMPTY_TALKS: TalksResponse = { talks: [] };\n\nfunction buildParams(filters: SpeakerDirectoryFilters): URLSearchParams {\n const params = new URLSearchParams();\n const topic = filters.topic?.trim();\n if (topic) params.set('topic', topic);\n if (filters.limit !== undefined) params.set('limit', String(filters.limit));\n return params;\n}\n\n/**\n * Speaker directory (Phase 1, read-only POC). Everyone returned has opted in to\n * speaking; past deliveries are a ranking signal, not an inclusion path. An\n * optional `topic` filters to people who hold the matching canonical skill,\n * have a matching presentation, or have a matching delivery. Results come\n * grouped and ordered by the API.\n *\n * Returns an empty list on any error so callers can render a graceful state.\n */\nexport async function fetchSpeakers(\n config: SifaApiConfig,\n filters: SpeakerDirectoryFilters = {},\n options: ApiFetchOptions = {},\n): Promise<SpeakersResponse> {\n const params = buildParams(filters);\n const query = params.toString();\n const path = query ? `/api/speakers?${query}` : '/api/speakers';\n try {\n return await apiFetch<SpeakersResponse>(config, path, {\n cache: 'no-store',\n ...options,\n });\n } catch {\n return EMPTY_SPEAKERS;\n }\n}\n\n/**\n * Talk directory (Phase 1, read-only POC). Lists talks by opted-in speakers,\n * delivered-first, then latest delivery date. Same optional `topic` filter as\n * {@link fetchSpeakers}. Returns an empty list on any error.\n */\nexport async function fetchTalks(\n config: SifaApiConfig,\n filters: SpeakerDirectoryFilters = {},\n options: ApiFetchOptions = {},\n): Promise<TalksResponse> {\n const params = buildParams(filters);\n const query = params.toString();\n const path = query ? `/api/talks?${query}` : '/api/talks';\n try {\n return await apiFetch<TalksResponse>(config, path, {\n cache: 'no-store',\n ...options,\n });\n } catch {\n return EMPTY_TALKS;\n }\n}\n","import { z } from 'zod';\n\n/**\n * Organization entity-resolution payloads (#159). Shared by the typeahead,\n * selection, and grow-on-demand import-search endpoints on sifa-api.\n */\n\n/**\n * A nullable string constrained to an http(s) URL. Rejects `javascript:` and\n * other script-bearing schemes at the SDK boundary so a hostile API response\n * cannot smuggle an XSS payload into a rendered `href`/`src`. Note: Wikidata\n * entity URIs are canonically `http://`, so both http and https are allowed.\n */\nconst httpUrlNullable = z\n .string()\n .refine((s) => /^https?:\\/\\//i.test(s), { message: 'must be an http(s) URL' })\n .nullable();\n\nconst searchResultCommon = {\n kind: z.string(),\n name: z.string(),\n domain: z.string().nullable(),\n country: z.string().nullable(),\n logoUrl: httpUrlNullable,\n parentName: z.string().nullable(),\n};\n\n/**\n * A single typeahead row. Discriminated on `source`: a curated `entity` row\n * carries `entityId`, a `pdl` staging row carries `pdlId`. The union guarantees\n * the identifier for the row's source is always present, so a stable React key\n * can never be `entity:undefined`. The disambiguation fields\n * (domain/country/parentName) drive the dropdown display.\n */\nexport const EntitySearchResultSchema = z.discriminatedUnion('source', [\n z.object({\n source: z.literal('entity'),\n entityId: z.number().int().positive(),\n ...searchResultCommon,\n }),\n z.object({\n source: z.literal('pdl'),\n pdlId: z.string().min(1),\n ...searchResultCommon,\n }),\n]);\nexport type EntitySearchResult = z.infer<typeof EntitySearchResultSchema>;\n\n/** Response of `GET /api/entities/search`. */\nexport const EntitySearchResponseSchema = z.object({\n results: z.array(EntitySearchResultSchema),\n hasMore: z.boolean(),\n});\nexport type EntitySearchResponse = z.infer<typeof EntitySearchResponseSchema>;\n\n/**\n * Body of `POST /api/entities/select`: promote a PDL row OR bump an entity.\n * Exactly one of `entityId`/`pdlId` must be present -- supplying both is\n * ambiguous (the server would have to silently pick one) and is rejected.\n */\nexport const EntitySelectRequestSchema = z\n .object({\n entityId: z.number().int().positive().optional(),\n pdlId: z.string().min(1).optional(),\n })\n .refine((v) => (v.entityId != null) !== (v.pdlId != null), {\n message: 'exactly one of entityId or pdlId is required',\n });\nexport type EntitySelectRequest = z.infer<typeof EntitySelectRequestSchema>;\n\n/** Response of `POST /api/entities/select`. `entityRef` is the portable\n * Wikidata/ROR/LEI URI to write to the position record, or null for a\n * PDL-only entity (its resolution stays AppView-side). */\nexport const EntitySelectResponseSchema = z.object({\n entityId: z.number().int().positive(),\n slug: z.string(),\n kind: z.string(),\n canonicalName: z.string(),\n domain: z.string().nullable(),\n /**\n * The entity's website, gated to sources trustworthy enough to prefill into a\n * record the user signs. Narrower than `domain`, which is a display value and\n * may come from a crawl. Null when the entity has no such source.\n */\n website: httpUrlNullable.default(null),\n /** Which tier `website` came from. Crawled is never an accepted source. */\n websiteTier: z.enum(['org', 'curated']).nullable().default(null),\n entityRef: httpUrlNullable,\n});\nexport type EntitySelectResponse = z.infer<typeof EntitySelectResponseSchema>;\n\n/** Response of `POST /api/entities/import-search`. */\nexport const EntityImportSearchResponseSchema = z.object({\n results: z.array(EntitySearchResultSchema),\n});\nexport type EntityImportSearchResponse = z.infer<typeof EntityImportSearchResponseSchema>;\n\n/**\n * Body of the domain grow-on-demand endpoints (`POST /api/entities/resolve-domain`\n * and `POST /api/entities/mint-domain`). The server re-validates the value as a\n * registrable domain; 253 is the max DNS name length.\n */\nexport const EntityResolveDomainRequestSchema = z.object({\n domain: z.string().min(1).max(253),\n});\nexport type EntityResolveDomainRequest = z.infer<typeof EntityResolveDomainRequestSchema>;\n\n/**\n * Response of `POST /api/entities/resolve-domain` (grow-on-demand Branch 1). Any\n * notable companies whose official website is the domain, imported from Wikidata.\n * `canMint` is true when nothing notable matched AND the domain is eligible for\n * the user-initiated mint-from-domain path -- it drives the \"Add <domain>\"\n * affordance.\n */\nexport const EntityResolveDomainResponseSchema = z.object({\n results: z.array(EntitySearchResultSchema),\n canMint: z.boolean(),\n});\nexport type EntityResolveDomainResponse = z.infer<typeof EntityResolveDomainResponseSchema>;\n\n/**\n * Response of `POST /api/entities/mint-domain` (grow-on-demand Branch 2). The\n * linkable entity minted from (or already resolved for) the domain. A non-2xx\n * status (e.g. the domain is not mintable, a confusable look-alike, or the site\n * yielded nothing usable) surfaces as a thrown error, not a null result.\n *\n * `pending` is true when the entity is a fresh hidden-pending mint: the\n * requesting user's own link resolves to it immediately, but it stays out of\n * other users' typeahead + aggregation until an admin approves it. Clients should\n * reflect this (\"added -- pending review\") rather than \"added & live\".\n */\nexport const EntityMintDomainResponseSchema = z.object({\n result: EntitySearchResultSchema,\n pending: z.boolean(),\n});\nexport type EntityMintDomainResponse = z.infer<typeof EntityMintDomainResponseSchema>;\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\nimport {\n EntitySearchResponseSchema,\n EntitySelectResponseSchema,\n EntityImportSearchResponseSchema,\n EntityResolveDomainResponseSchema,\n EntityMintDomainResponseSchema,\n type EntitySearchResponse,\n type EntitySearchResult,\n type EntitySelectRequest,\n type EntitySelectResponse,\n type EntityResolveDomainResponse,\n type EntityMintDomainResponse,\n} from '../../schemas/entity.js';\n\nconst EMPTY_SEARCH: EntitySearchResponse = { results: [], hasMore: false };\n\n/**\n * Organization typeahead. Returns curated entities first, then the PDL crawl,\n * deduped by domain. Empty input returns an empty result without a network call.\n */\nexport async function fetchEntitySearch(\n config: SifaApiConfig,\n query: string,\n limit?: number,\n options: ApiFetchOptions = {},\n): Promise<EntitySearchResponse> {\n if (!query.trim()) return EMPTY_SEARCH;\n const params = new URLSearchParams({ q: query });\n if (limit !== undefined) params.set('limit', String(limit));\n const data = await apiFetch<unknown>(config, `/api/entities/search?${params.toString()}`, {\n cache: 'no-store',\n ...options,\n });\n return EntitySearchResponseSchema.parse(data);\n}\n\n/**\n * Record a selection: promote a PDL row into a canonical entity (dedupe by\n * domain) or bump an existing entity's usage counter. Returns the entity plus\n * its portable `entityRef` (null for PDL-only entities). Requires a session.\n */\nexport async function selectEntity(\n config: SifaApiConfig,\n body: EntitySelectRequest,\n options: ApiFetchOptions = {},\n): Promise<EntitySelectResponse> {\n const data = await apiFetch<unknown>(config, '/api/entities/select', {\n method: 'POST',\n body,\n credentials: 'include',\n ...options,\n });\n return EntitySelectResponseSchema.parse(data);\n}\n\n/**\n * Grow-on-demand: when the local typeahead misses, resolve the query live via\n * Wikidata, import the org-class matches, and return them. Requires a session.\n * Empty input returns an empty array without a network call.\n */\nexport async function importSearchEntities(\n config: SifaApiConfig,\n query: string,\n options: ApiFetchOptions = {},\n): Promise<EntitySearchResult[]> {\n if (!query.trim()) return [];\n const data = await apiFetch<unknown>(config, '/api/entities/import-search', {\n method: 'POST',\n body: { q: query },\n credentials: 'include',\n ...options,\n });\n return EntityImportSearchResponseSchema.parse(data).results;\n}\n\n/**\n * Grow-on-demand by domain, Branch 1: when a domain-shaped typeahead query\n * misses locally, resolve any notable company whose official website is that\n * domain (Wikidata reverse P856), importing the matches. Read-only w.r.t.\n * minting. `canMint` tells the caller whether to offer the user-initiated\n * \"Add <domain>\" affordance. Requires a session.\n */\nexport async function resolveEntityDomain(\n config: SifaApiConfig,\n domain: string,\n options: ApiFetchOptions = {},\n): Promise<EntityResolveDomainResponse> {\n const data = await apiFetch<unknown>(config, '/api/entities/resolve-domain', {\n method: 'POST',\n body: { domain },\n credentials: 'include',\n ...options,\n });\n return EntityResolveDomainResponseSchema.parse(data);\n}\n\n/**\n * Grow-on-demand by domain, Branch 2 (user-initiated): mint a crawled-tier\n * entity from the domain's own homepage (or resolve it to a notable company if\n * one exists). Throws on a non-2xx response (domain not mintable, or the site\n * yielded nothing usable). Requires a session.\n */\nexport async function mintEntityDomain(\n config: SifaApiConfig,\n domain: string,\n options: ApiFetchOptions = {},\n): Promise<EntityMintDomainResponse> {\n const data = await apiFetch<unknown>(config, '/api/entities/mint-domain', {\n method: 'POST',\n body: { domain },\n credentials: 'include',\n ...options,\n });\n return EntityMintDomainResponseSchema.parse(data);\n}\n","import { encodeIdentifier, apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/** Lightweight profile representation used by discovery endpoints. */\nexport interface SimilarProfile {\n did: string;\n handle: string;\n displayName?: string | null;\n avatar?: string | null;\n headline?: string | null;\n currentRole?: string | null;\n currentCompany?: string | null;\n industry?: string | null;\n domain?: string | null;\n}\n\nexport interface SuggestionProfile {\n did: string;\n handle: string;\n displayName?: string;\n headline?: string;\n avatarUrl?: string;\n source: string;\n dismissed: boolean;\n blueskyVerified?: boolean;\n}\n\nexport interface SuggestionsResponse {\n onSifa: SuggestionProfile[];\n notOnSifa: SuggestionProfile[];\n cursor?: string;\n}\n\nexport interface FeaturedProfile {\n did: string;\n handle: string;\n displayName?: string;\n avatar?: string;\n pronouns?: string;\n headline?: string;\n about?: string;\n currentRole?: string;\n currentCompany?: string;\n locationCountry?: string;\n locationRegion?: string;\n /** Legacy alias for `locationLocality`; emitted by sifa-api during the additive response window. */\n locationCity?: string;\n /** community.lexicon.location.address field name -- prefer over `locationCity`. */\n locationLocality?: string;\n countryCode?: string;\n location?: string;\n website?: string;\n openTo?: string[];\n preferredWorkplace?: string[];\n availableFromUtc?: number;\n availableToUtc?: number;\n followersCount?: number;\n atprotoFollowersCount?: number;\n pdsProvider?: { name: string; host: string } | null;\n claimed: boolean;\n featuredDate: string;\n}\n\n/** Profiles similar to the given DID (matchmaking). Returns `[]` on error. */\nexport async function fetchSimilarProfiles(\n config: SifaApiConfig,\n did: string,\n opts: { limit?: number } & ApiFetchOptions = {},\n): Promise<SimilarProfile[]> {\n const limit = opts.limit ?? 5;\n const path = `/api/discover/similar/${encodeIdentifier(did)}?limit=${limit}`;\n try {\n const data = await apiFetch<{ profiles?: SimilarProfile[] }>(config, path, {\n next: { revalidate: 300 },\n timeoutMs: 5000,\n ...opts,\n });\n return data.profiles ?? [];\n } catch {\n return [];\n }\n}\n\nexport interface FetchSuggestionsOptions extends ApiFetchOptions {\n source?: string;\n includeDismissed?: boolean;\n cursor?: string;\n limit?: number;\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * `credentials: 'include'` does NOT propagate browser cookies in RSC,\n * so authenticated server fetches must forward the header explicitly.\n */\n cookieHeader?: string;\n}\n\n/** Discovery suggestions feed. Resolves to empty arrays on error. */\nexport async function fetchSuggestions(\n config: SifaApiConfig,\n opts: FetchSuggestionsOptions = {},\n): Promise<SuggestionsResponse> {\n const params = new URLSearchParams();\n if (opts.source) params.set('source', opts.source);\n if (opts.includeDismissed) params.set('include_dismissed', 'true');\n if (opts.cursor) params.set('cursor', opts.cursor);\n if (opts.limit) params.set('limit', String(opts.limit));\n\n const qs = params.toString();\n const headers: Record<string, string> = { ...(opts.headers ?? {}) };\n if (opts.cookieHeader) headers.cookie = opts.cookieHeader;\n\n try {\n return await apiFetch<SuggestionsResponse>(config, `/api/suggestions${qs ? `?${qs}` : ''}`, {\n credentials: 'include',\n cache: 'no-store',\n timeoutMs: 8000,\n ...opts,\n headers,\n });\n } catch {\n return { onSifa: [], notOnSifa: [] };\n }\n}\n\n/** Count of pending suggestions since an optional timestamp. */\nexport async function fetchSuggestionCount(\n config: SifaApiConfig,\n since?: string,\n options: ApiFetchOptions = {},\n): Promise<number> {\n const params = since ? `?since=${encodeURIComponent(since)}` : '';\n try {\n const data = await apiFetch<{ count?: number }>(config, `/api/suggestions/count${params}`, {\n credentials: 'include',\n cache: 'no-store',\n ...options,\n });\n return data.count ?? 0;\n } catch {\n return 0;\n }\n}\n\n/** Featured profile (rotated by sifa-api). Returns `null` when none. */\nexport async function fetchFeaturedProfile(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<FeaturedProfile | null> {\n try {\n return await apiFetch<FeaturedProfile>(config, '/api/featured-profile', {\n next: { revalidate: 900 },\n ...options,\n });\n } catch {\n return null;\n }\n}\n","import {\n apiFetch,\n encodeIdentifier,\n apiWrite,\n type ApiFetchOptions,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\nimport type { FollowFeedPage } from '../../schemas/feed.js';\n\nexport interface FollowProfile {\n did: string;\n handle: string;\n displayName?: string;\n headline?: string;\n avatarUrl?: string;\n source: string;\n claimed: boolean;\n followedAt: string;\n blueskyVerified?: boolean;\n blueskyVerifiedAt?: string | null;\n}\n\nexport interface FollowingResponse {\n follows: FollowProfile[];\n cursor?: string;\n}\n\n/** People the authenticated user follows. Empty on error. */\nexport async function fetchFollowing(\n config: SifaApiConfig,\n opts: { source?: string; cursor?: string; limit?: number } & ApiFetchOptions = {},\n): Promise<FollowingResponse> {\n const params = new URLSearchParams();\n if (opts.source) params.set('source', opts.source);\n if (opts.cursor) params.set('cursor', opts.cursor);\n if (opts.limit) params.set('limit', String(opts.limit));\n const qs = params.toString();\n\n try {\n return await apiFetch<FollowingResponse>(config, `/api/following${qs ? `?${qs}` : ''}`, {\n credentials: 'include',\n cache: 'no-store',\n ...opts,\n });\n } catch {\n return { follows: [] };\n }\n}\n\n/**\n * Result of {@link followUser}. Extends {@link WriteResult} with the\n * follow `rkey` returned by sifa-api on success. Self-follow + invalid\n * handle surface as `success: false` with the server-provided message;\n * dup-follow is idempotent (sifa-api E7) and resolves as `success: true`.\n */\nexport interface FollowUserResult extends WriteResult {\n rkey?: string;\n /** DID of the followed subject (server-resolved from the handle). */\n subjectDid?: string;\n}\n\n/**\n * Create an `id.sifa.graph.follow` record on the caller's PDS via the\n * AppView. Idempotent on duplicate (server catches the unique-violation\n * and returns 200, per sifa-api#673 E7).\n */\nexport function followUser(\n config: SifaApiConfig,\n handle: string,\n opts: { note?: string } & Omit<ApiFetchOptions, 'method' | 'body'> = {},\n): Promise<FollowUserResult> {\n const { note, ...rest } = opts;\n return apiWrite<{ rkey?: string; subjectDid?: string }>(\n config,\n `/api/follow/${encodeIdentifier(handle)}`,\n 'POST',\n {\n body: note !== undefined ? { note } : undefined,\n ...rest,\n },\n );\n}\n\n/** Delete the authenticated viewer's `id.sifa.graph.follow` for `handle`. */\nexport function unfollowUser(\n config: SifaApiConfig,\n handle: string,\n opts: Omit<ApiFetchOptions, 'method' | 'body'> = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/follow/${encodeIdentifier(handle)}`, 'DELETE', opts);\n}\n\nexport interface FollowListPage {\n follows: FollowProfile[];\n cursor: string | null;\n}\n\nexport interface FetchFollowListOptions extends ApiFetchOptions {\n cursor?: string;\n limit?: number;\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls\n * (mirrors {@link FetchActivityFeedOptions}; required for authenticated\n * server fetches because `credentials: 'include'` does not propagate\n * cookies from RSC).\n */\n cookieHeader?: string;\n}\n\nfunction buildListPath(prefix: string, opts: FetchFollowListOptions): string {\n const params = new URLSearchParams();\n if (opts.cursor) params.set('cursor', opts.cursor);\n if (opts.limit) params.set('limit', String(opts.limit));\n const qs = params.toString();\n return `${prefix}${qs ? `?${qs}` : ''}`;\n}\n\n/**\n * Paginated list of `handle`'s followers. Returns an empty page on error\n * so the UI can render a graceful \"no followers yet\" state.\n */\nexport async function getFollowers(\n config: SifaApiConfig,\n handle: string,\n opts: FetchFollowListOptions = {},\n): Promise<FollowListPage> {\n const headers: Record<string, string> = { ...(opts.headers ?? {}) };\n if (opts.cookieHeader) headers.cookie = opts.cookieHeader;\n try {\n const res = await apiFetch<{ follows: FollowProfile[]; cursor?: string | null }>(\n config,\n buildListPath(`/api/profile/${encodeIdentifier(handle)}/followers`, opts),\n { credentials: 'include', cache: 'no-store', ...opts, headers },\n );\n return { follows: res.follows, cursor: res.cursor ?? null };\n } catch {\n return { follows: [], cursor: null };\n }\n}\n\n/** Paginated list of who `handle` follows. */\nexport async function getFollowing(\n config: SifaApiConfig,\n handle: string,\n opts: FetchFollowListOptions = {},\n): Promise<FollowListPage> {\n const headers: Record<string, string> = { ...(opts.headers ?? {}) };\n if (opts.cookieHeader) headers.cookie = opts.cookieHeader;\n try {\n const res = await apiFetch<{ follows: FollowProfile[]; cursor?: string | null }>(\n config,\n buildListPath(`/api/profile/${encodeIdentifier(handle)}/following`, opts),\n { credentials: 'include', cache: 'no-store', ...opts, headers },\n );\n return { follows: res.follows, cursor: res.cursor ?? null };\n } catch {\n return { follows: [], cursor: null };\n }\n}\n\n/**\n * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).\n * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere\n * Stream are two distinct surfaces with different data paths (Barazo API\n * for Timeline, live PDS reads + Valkey for Stream). These collapsed feed\n * types are no longer consumed. Scheduled for removal in next major bump.\n */\nexport interface FetchFollowingFeedOptions extends ApiFetchOptions {\n cursor?: string;\n limit?: number;\n /**\n * Comma-separated category filter (per sifa-api#673 TR10). Forwarded\n * as-is; the server validates allowed values.\n */\n categories?: string[];\n cookieHeader?: string;\n}\n\n/**\n * V5 home feed: Sifa events + curated ATmosphere creation events filtered\n * by the authenticated viewer's followees. Composite cursor (per E5/TR4).\n * Returns an empty page on error.\n *\n * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).\n * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere\n * Stream are two distinct surfaces with different data paths (Barazo API\n * for Timeline, live PDS reads + Valkey for Stream). This fetcher is no\n * longer consumed. Scheduled for removal in next major bump.\n */\nexport async function getFollowingFeed(\n config: SifaApiConfig,\n opts: FetchFollowingFeedOptions = {},\n): Promise<FollowFeedPage> {\n const params = new URLSearchParams();\n if (opts.cursor) params.set('cursor', opts.cursor);\n if (opts.limit) params.set('limit', String(opts.limit));\n if (opts.categories && opts.categories.length > 0) {\n params.set('categories', opts.categories.join(','));\n }\n const qs = params.toString();\n\n const headers: Record<string, string> = { ...(opts.headers ?? {}) };\n if (opts.cookieHeader) headers.cookie = opts.cookieHeader;\n\n try {\n const res = await apiFetch<{ items: FollowFeedPage['items']; cursor?: string | null }>(\n config,\n `/api/following/feed${qs ? `?${qs}` : ''}`,\n { credentials: 'include', cache: 'no-store', ...opts, headers },\n );\n return { items: res.items ?? [], cursor: res.cursor ?? null };\n } catch {\n return { items: [], cursor: null };\n }\n}\n","import { encodeIdentifier, apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\nimport type { FollowProfileItem } from '../../schemas/follow-profile.js';\n\n/**\n * Options shared by the cursor-paginated follow-graph endpoints introduced in\n * `sifa-api#674` (mutuals + bluesky-suggestions). Mirrors\n * `FetchFollowListOptions` in `./follow.ts` but the response wrapper here uses\n * the `{ items, cursor }` shape (not `{ follows, cursor }`).\n */\nexport interface FetchFollowProfilePageOptions extends ApiFetchOptions {\n cursor?: string;\n limit?: number;\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls\n * (mirrors `FetchFollowListOptions`; required for authenticated server\n * fetches because `credentials: 'include'` does not propagate cookies from\n * RSC).\n */\n cookieHeader?: string;\n}\n\n/** Page of {@link FollowProfileItem} rows with an opaque next-page cursor. */\nexport interface FollowProfilePageResponse {\n items: FollowProfileItem[];\n cursor: string | null;\n}\n\nfunction buildListPath(prefix: string, opts: FetchFollowProfilePageOptions): string {\n const params = new URLSearchParams();\n if (opts.cursor) params.set('cursor', opts.cursor);\n if (opts.limit) params.set('limit', String(opts.limit));\n const qs = params.toString();\n return `${prefix}${qs ? `?${qs}` : ''}`;\n}\n\nasync function fetchFollowProfilePage(\n config: SifaApiConfig,\n path: string,\n opts: FetchFollowProfilePageOptions,\n): Promise<FollowProfilePageResponse> {\n const headers: Record<string, string> = { ...(opts.headers ?? {}) };\n if (opts.cookieHeader) headers.cookie = opts.cookieHeader;\n try {\n const res = await apiFetch<{ items?: FollowProfileItem[]; cursor?: string | null }>(\n config,\n path,\n { credentials: 'include', cache: 'no-store', ...opts, headers },\n );\n return { items: res.items ?? [], cursor: res.cursor ?? null };\n } catch {\n return { items: [], cursor: null };\n }\n}\n\n/**\n * Cursor-paginated list of mutual sifa-source follows for `handleOrDid`\n * (X↔Y both follow each other on Sifa). Backed by\n * `GET /api/profile/{handleOrDid}/mutuals` from `sifa-api#674`. Public —\n * does not require auth. Returns an empty page on error.\n */\nexport async function getMutuals(\n config: SifaApiConfig,\n handleOrDid: string,\n opts: FetchFollowProfilePageOptions = {},\n): Promise<FollowProfilePageResponse> {\n return fetchFollowProfilePage(\n config,\n buildListPath(`/api/profile/${encodeIdentifier(handleOrDid)}/mutuals`, opts),\n opts,\n );\n}\n\n/**\n * Cursor-paginated list of Sifa users the viewer follows on Bluesky but NOT\n * on Sifa, filtered to people active on Sifa. Backed by\n * `GET /api/me/bluesky-suggestions` from `sifa-api#674`. Auth-required.\n * Returns an empty page on error.\n */\nexport async function getBlueskySuggestions(\n config: SifaApiConfig,\n opts: FetchFollowProfilePageOptions = {},\n): Promise<FollowProfilePageResponse> {\n return fetchFollowProfilePage(config, buildListPath('/api/me/bluesky-suggestions', opts), opts);\n}\n","import {\n apiFetch,\n encodeIdentifier,\n apiWrite,\n type ApiFetchOptions,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\nimport type { FeatureAllowlistEntry, FeatureFlag } from '../../schemas/follow-profile.js';\n\n/**\n * Options for {@link listFeatureAllowlist}. Supports the same `cookieHeader`\n * passthrough as the other admin reads for RSC contexts.\n */\nexport interface ListFeatureAllowlistOptions extends ApiFetchOptions {\n cookieHeader?: string;\n}\n\n/** Response shape of `GET /api/admin/feature-allowlists/:flag`. */\nexport interface FeatureAllowlistResponse {\n items: FeatureAllowlistEntry[];\n}\n\n/**\n * List all DIDs on the given feature flag's allowlist. Admin-gated server-\n * side (caller must be an admin). Returns an empty list on error so the UI\n * can render a graceful empty state.\n */\nexport async function listFeatureAllowlist(\n config: SifaApiConfig,\n flag: FeatureFlag,\n opts: ListFeatureAllowlistOptions = {},\n): Promise<FeatureAllowlistResponse> {\n const headers: Record<string, string> = { ...(opts.headers ?? {}) };\n if (opts.cookieHeader) headers.cookie = opts.cookieHeader;\n try {\n const res = await apiFetch<{ items?: FeatureAllowlistEntry[] }>(\n config,\n `/api/admin/feature-allowlists/${encodeURIComponent(flag)}`,\n { credentials: 'include', cache: 'no-store', ...opts, headers },\n );\n return { items: res.items ?? [] };\n } catch {\n return { items: [] };\n }\n}\n\n/**\n * Add (or upsert the note for) a DID on the given flag's allowlist. Maps to\n * `POST /api/admin/feature-allowlists/{flag}`. Returns a {@link WriteResult};\n * never throws.\n */\nexport function addFeatureAllowlist(\n config: SifaApiConfig,\n flag: FeatureFlag,\n did: string,\n opts: { note?: string } & Omit<ApiFetchOptions, 'method' | 'body'> = {},\n): Promise<WriteResult> {\n const { note, ...rest } = opts;\n return apiWrite(config, `/api/admin/feature-allowlists/${encodeURIComponent(flag)}`, 'POST', {\n body: note !== undefined ? { did, note } : { did },\n ...rest,\n });\n}\n\n/**\n * Remove a DID from the given flag's allowlist. Maps to\n * `DELETE /api/admin/feature-allowlists/{flag}/{did}`. Returns a\n * {@link WriteResult}; never throws.\n */\nexport function removeFeatureAllowlist(\n config: SifaApiConfig,\n flag: FeatureFlag,\n did: string,\n opts: Omit<ApiFetchOptions, 'method' | 'body'> = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/admin/feature-allowlists/${encodeURIComponent(flag)}/${encodeIdentifier(did)}`,\n 'DELETE',\n opts,\n );\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/**\n * Options for {@link getAdminReviewQueues}. Supports the same `cookieHeader`\n * passthrough as the other admin reads for RSC contexts.\n */\nexport interface GetAdminReviewQueuesOptions extends ApiFetchOptions {\n cookieHeader?: string;\n}\n\n/** Response shape of `GET /api/admin/stats/review-queues`. */\nexport interface AdminReviewQueues {\n ideas: number;\n nameCorrections: number;\n pendingCompanies: number;\n /** Sum of the three queues. */\n total: number;\n generatedAt: string;\n}\n\n/**\n * Open counts for the three admin review queues (ideas, pending companies,\n * name corrections) plus their total.\n *\n * Unlike {@link listFeatureAllowlist} this does NOT swallow errors: a zeroed\n * payload would render as \"all queues clear\" in the admin nav, which is worse\n * than rendering nothing. Callers decide how to degrade.\n */\nexport async function getAdminReviewQueues(\n config: SifaApiConfig,\n opts: GetAdminReviewQueuesOptions = {},\n): Promise<AdminReviewQueues> {\n const headers: Record<string, string> = { ...(opts.headers ?? {}) };\n if (opts.cookieHeader) headers.cookie = opts.cookieHeader;\n\n const res = await apiFetch<Partial<AdminReviewQueues>>(config, '/api/admin/stats/review-queues', {\n credentials: 'include',\n cache: 'no-store',\n ...opts,\n headers,\n });\n\n const ideas = res.ideas ?? 0;\n const nameCorrections = res.nameCorrections ?? 0;\n const pendingCompanies = res.pendingCompanies ?? 0;\n\n return {\n ideas,\n nameCorrections,\n pendingCompanies,\n // Derived rather than trusted so an API that predates the field still\n // yields a usable pill count.\n total: res.total ?? ideas + nameCorrections + pendingCompanies,\n generatedAt: res.generatedAt ?? '',\n };\n}\n","import type { ActivityLabel } from '../../cards/adult-content.js';\nimport { encodeIdentifier, apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\nimport type { QuotedPostResult } from './quoted-posts.js';\n\n/**\n * Liveness of an activity card's destination, as reported by sifa-api's\n * `/api/activity` enrichment (see sifa-api `url-health-checker`). How liveness\n * is measured depends on the card's health strategy (see `resolveCardHealth`):\n * first-party permalinks (`record`) are checked by record existence on the PDS;\n * foreign/derived targets (`url`) by HTTP reachability (HEAD, then GET).\n *\n * ok -- record exists, or the URL returned 2xx/3xx\n * broken -- confirmed dead (record deleted, or >=2 consecutive 4xx / >=5 consecutive 5xx)\n * unverifiable -- 403/429, PDS unreachable, or network error; NOT dead\n * unknown -- newly seen, not yet checked\n *\n * Consumers should only suppress UI on `'broken'`. All other values\n * (including missing) mean \"render normally\".\n */\nexport type ActivityItemLinkHealth = 'ok' | 'broken' | 'unverifiable' | 'unknown';\n\nexport interface HeatmapDay {\n date: string;\n total: number;\n apps: { appId: string; count: number }[];\n}\n\nexport interface HeatmapResponse {\n days: HeatmapDay[];\n appTotals: { appId: string; appName: string; total: number }[];\n thresholds: [number, number, number, number];\n}\n\nexport interface ActivityItem {\n uri: string;\n cid: string;\n collection: string;\n rkey: string;\n record: Record<string, unknown>;\n appId: string;\n appName: string;\n category: string;\n indexedAt: string;\n /**\n * Set by the server when an `app.bsky.embed.record` quote was already\n * resolved upstream (AppView path). Mutually exclusive with `quotedPostUri`.\n */\n quotedPost?: QuotedPostResult;\n /**\n * Set by the server when an `app.bsky.embed.record` quote needs client-side\n * resolution (PDS path). Pass batches to {@link resolveQuotedPosts}.\n * Mutually exclusive with `quotedPost`.\n */\n quotedPostUri?: string;\n /**\n * Reachability of the card's external destination as last checked by\n * sifa-api. Undefined for legacy responses; treat as 'unknown'.\n * See {@link ActivityItemLinkHealth}.\n */\n linkHealth?: ActivityItemLinkHealth;\n /**\n * Content labels from `app.bsky.feed.defs#postView.labels`. Set by\n * sifa-api for Bluesky posts; undefined for other sources and legacy\n * responses. Pass items to {@link hasAdultContent} to decide whether to\n * gate media. See {@link ActivityLabel}.\n */\n labels?: ActivityLabel[];\n}\n\nexport interface ActivityTeaserResponse {\n items: ActivityItem[];\n blueskyGated?: boolean;\n backfillPending?: boolean;\n failedApps?: string[];\n}\n\nexport interface ActivityFeedResponse {\n items: ActivityItem[];\n cursor: string | null;\n hasMore: boolean;\n availableCategories?: string[];\n blueskyGated?: boolean;\n failedApps?: string[];\n}\n\n/**\n * Per-day activity counts for a profile across all ATproto apps. Returns\n * `null` on any error so callers can render a graceful empty state.\n */\nexport async function fetchHeatmapData(\n config: SifaApiConfig,\n handleOrDid: string,\n days: number,\n options: ApiFetchOptions = {},\n): Promise<HeatmapResponse | null> {\n const path = `/api/activity/${encodeIdentifier(handleOrDid)}/heatmap?days=${days}`;\n try {\n return await apiFetch<HeatmapResponse>(config, path, {\n next: { revalidate: 900, tags: [`heatmap-${handleOrDid}`] },\n ...options,\n });\n } catch {\n return null;\n }\n}\n\nexport interface FetchActivityTeaserOptions extends ApiFetchOptions {\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * Required for authenticated server fetches because `credentials: 'include'`\n * does not propagate browser cookies in RSC.\n */\n cookieHeader?: string;\n}\n\n/**\n * Recent activity teaser for a profile (homepage-sized slice). Caps the\n * upstream wait so the SSR path cannot hang. Returns `null` on any error.\n */\nexport async function fetchActivityTeaser(\n config: SifaApiConfig,\n handleOrDid: string,\n options: FetchActivityTeaserOptions = {},\n): Promise<ActivityTeaserResponse | null> {\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n return await apiFetch<ActivityTeaserResponse>(\n config,\n `/api/activity/${encodeIdentifier(handleOrDid)}/teaser`,\n {\n credentials: 'include',\n timeoutMs: 8000,\n next: { revalidate: 300, tags: [`activity-teaser-${handleOrDid}`] },\n ...options,\n headers,\n },\n );\n } catch {\n return null;\n }\n}\n\nexport interface FetchActivityFeedOptions extends ApiFetchOptions {\n category?: string;\n limit?: number;\n cursor?: string;\n cookieHeader?: string;\n}\n\n/**\n * Paginated activity feed for a profile. Always fresh (`cache: 'no-store'`).\n * Returns `null` on any error.\n */\nexport async function fetchActivityFeed(\n config: SifaApiConfig,\n handleOrDid: string,\n options: FetchActivityFeedOptions = {},\n): Promise<ActivityFeedResponse | null> {\n const params = new URLSearchParams();\n if (options.category) params.set('category', options.category);\n if (options.limit) params.set('limit', String(options.limit));\n if (options.cursor) params.set('cursor', options.cursor);\n const qs = params.toString();\n\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n return await apiFetch<ActivityFeedResponse>(\n config,\n `/api/activity/${encodeIdentifier(handleOrDid)}${qs ? `?${qs}` : ''}`,\n {\n credentials: 'include',\n cache: 'no-store',\n ...options,\n headers,\n },\n );\n } catch {\n return null;\n }\n}\n","import { z } from 'zod';\n\nimport { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/**\n * A single merged pull request ingested from GitHub, as served by sifa-api's\n * `GET /api/me/github/pull-requests`. Mirrors the `github_contributions` row.\n */\nexport const GithubPullRequestSchema = z.object({\n prNumber: z.number(),\n repoOwner: z.string(),\n repoName: z.string(),\n title: z.string(),\n url: z.string(),\n language: z.string().nullable(),\n additions: z.number(),\n deletions: z.number(),\n /** ISO 8601 merge timestamp. */\n mergedAt: z.string(),\n});\nexport type GithubPullRequest = z.infer<typeof GithubPullRequestSchema>;\n\nexport const MyGithubPullRequestsResponseSchema = z.object({\n items: z.array(GithubPullRequestSchema),\n hasMore: z.boolean(),\n});\nexport type MyGithubPullRequestsResponse = z.infer<typeof MyGithubPullRequestsResponseSchema>;\n\nexport interface FetchMyGithubPullRequestsOptions extends ApiFetchOptions {\n limit?: number;\n offset?: number;\n /** Forwarded as the `cookie` header for server-side (SSR) calls. */\n cookieHeader?: string;\n}\n\n/**\n * Fetch the authenticated viewer's own ingested merged PRs (newest first).\n * Auth-scoped: relies on the session cookie (`credentials: 'include'`), so it\n * returns the caller's PRs, not a public handle's. Backs the GitHub importer.\n */\nexport async function fetchMyGithubPullRequests(\n config: SifaApiConfig,\n options: FetchMyGithubPullRequestsOptions = {},\n): Promise<MyGithubPullRequestsResponse> {\n const { limit, offset, cookieHeader, ...fetchOptions } = options;\n\n const params = new URLSearchParams();\n if (limit !== undefined) params.set('limit', String(limit));\n if (offset !== undefined) params.set('offset', String(offset));\n const qs = params.toString();\n\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (cookieHeader) headers.cookie = cookieHeader;\n\n const data = await apiFetch<unknown>(\n config,\n `/api/me/github/pull-requests${qs ? `?${qs}` : ''}`,\n {\n credentials: 'include',\n cache: 'no-store',\n ...fetchOptions,\n headers,\n },\n );\n\n return MyGithubPullRequestsResponseSchema.parse(data);\n}\n","import { encodeIdentifier, apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/**\n * Counts confirmed endorsements received by a DID. The backend's\n * `GET /api/endorsement/:did` already returns only confirmed endorsements\n * (via inner join with `endorsementConfirmations`), so this helper just\n * returns the array length. Failures return 0 so callers can route safely.\n *\n * Public endpoint -- no credentials needed.\n */\nexport async function fetchEndorsementCount(\n config: SifaApiConfig,\n did: string,\n options: ApiFetchOptions = {},\n): Promise<number> {\n const path = `/api/endorsement/${encodeIdentifier(did)}`;\n try {\n const data = await apiFetch<unknown>(config, path, {\n cache: 'no-store',\n timeoutMs: 5000,\n ...options,\n });\n if (typeof data !== 'object' || data === null || !('endorsements' in data)) {\n return 0;\n }\n const endorsements = data.endorsements;\n return Array.isArray(endorsements) ? endorsements.length : 0;\n } catch {\n return 0;\n }\n}\n","import { encodeIdentifier, apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\nexport interface FetchNetworkStreamCountOptions extends ApiFetchOptions {\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * Required for authenticated server fetches because `credentials: 'include'`\n * does not propagate browser cookies in RSC.\n *\n * When omitted, the request falls back to `credentials: 'include'` so\n * client-side calls work without extra plumbing.\n */\n cookieHeader?: string;\n}\n\n/**\n * Counts items in the authenticated user's network stream digest. The\n * underlying `GET /api/stream/network` endpoint may 404 while the feature\n * is in development; in that case (and on any other error) this returns\n * 0 so callers can route safely to a fallback experience.\n */\nexport async function fetchNetworkStreamCount(\n config: SifaApiConfig,\n did: string,\n options: FetchNetworkStreamCountOptions = {},\n): Promise<number> {\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n const data = await apiFetch<unknown>(\n config,\n `/api/stream/network?did=${encodeIdentifier(did)}`,\n {\n cache: 'no-store',\n timeoutMs: 5000,\n ...(options.cookieHeader ? {} : { credentials: 'include' }),\n ...options,\n headers,\n },\n );\n if (typeof data !== 'object' || data === null || !('items' in data)) {\n return 0;\n }\n const items = data.items;\n return Array.isArray(items) ? items.length : 0;\n } catch {\n return 0;\n }\n}\n","import {\n apiFetch,\n apiWrite,\n type ApiFetchOptions,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/** Per-URI reaction state for the authenticated viewer. */\nexport interface ReactionStatus {\n reacted: boolean;\n rkey?: string;\n collection?: string;\n}\n\n/** Result of checking whether the authenticated viewer has an account on a given app. */\nexport interface AccountCheckResult {\n hasAccount: boolean;\n appName: string;\n appUrl: string;\n}\n\nexport interface FetchReactionStatusOptions extends ApiFetchOptions {\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * Required for authenticated server fetches because `credentials: 'include'`\n * does not propagate browser cookies in RSC.\n */\n cookieHeader?: string;\n}\n\n/**\n * Batch-look up reaction status for multiple URIs. Returns `{}` for an\n * empty input list (no network call) and `null` on any error.\n */\nexport async function fetchReactionStatus(\n config: SifaApiConfig,\n uris: string[],\n options: FetchReactionStatusOptions = {},\n): Promise<Record<string, ReactionStatus> | null> {\n if (uris.length === 0) return {};\n\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n return await apiFetch<Record<string, ReactionStatus>>(\n config,\n `/api/reactions/status?uris=${encodeURIComponent(uris.join(','))}`,\n {\n credentials: 'include',\n ...options,\n headers,\n },\n );\n } catch {\n return null;\n }\n}\n\nexport interface CheckAppAccountOptions extends ApiFetchOptions {\n cookieHeader?: string;\n}\n\n/**\n * Check whether the authenticated viewer has an account on a given app.\n * Returns `null` on any error.\n */\nexport async function checkAppAccount(\n config: SifaApiConfig,\n appId: string,\n options: CheckAppAccountOptions = {},\n): Promise<AccountCheckResult | null> {\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n return await apiFetch<AccountCheckResult>(\n config,\n `/api/reactions/account-check/${encodeURIComponent(appId)}`,\n {\n credentials: 'include',\n ...options,\n headers,\n },\n );\n } catch {\n return null;\n }\n}\n\n/** Result of a successful {@link createReaction}. */\nexport interface ReactionResult {\n uri: string;\n rkey: string;\n}\n\n/** Structured error returned by {@link createReaction} on failure. */\nexport interface ReactionError {\n type: 'scope_insufficient' | 'error';\n /** When `type === 'scope_insufficient'`, the lexicon scope the user must re-authorize for. */\n requiredScope?: string;\n}\n\n/**\n * Create a reaction (like / star) on a target ATproto record.\n *\n * Returns a discriminated-union result instead of the generic\n * {@link WriteResult} shape because reactions have a distinct\n * \"scope insufficient\" failure that callers handle differently from\n * other errors (it triggers an OAuth scope-upgrade flow rather than\n * an error toast).\n *\n * Never throws.\n */\nexport async function createReaction(\n config: SifaApiConfig,\n targetUri: string,\n appId: string,\n targetCid?: string,\n options: ApiFetchOptions = {},\n): Promise<{ ok: true; data: ReactionResult } | { ok: false; error: ReactionError }> {\n const fetchFn = config.fetch ?? globalThis.fetch;\n const url = `${config.baseUrl}/api/reactions`;\n\n try {\n const res = await fetchFn(url, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...(options.headers ?? {}) },\n credentials: options.credentials ?? 'include',\n body: JSON.stringify({ targetUri, appId, targetCid }),\n signal: options.signal ?? AbortSignal.timeout(options.timeoutMs ?? 10_000),\n });\n\n if (!res.ok) {\n if (res.status === 403) {\n try {\n const body = (await res.json()) as { error?: string; requiredScope?: string };\n if (body.error === 'ScopeInsufficient') {\n return {\n ok: false,\n error: { type: 'scope_insufficient', requiredScope: body.requiredScope },\n };\n }\n } catch {\n // Fall through to generic error\n }\n }\n return { ok: false, error: { type: 'error' } };\n }\n\n const data = (await res.json()) as ReactionResult;\n return { ok: true, data };\n } catch {\n return { ok: false, error: { type: 'error' } };\n }\n}\n\n/**\n * Delete a reaction (like / star) on a target ATproto record. Returns\n * `{ success: true }` on 2xx, `{ success: false, error }` on failure.\n */\nexport function deleteReaction(\n config: SifaApiConfig,\n targetUri: string,\n appId: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/reactions', 'DELETE', {\n body: { targetUri, appId },\n ...options,\n });\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\nexport interface QuotedPostAuthor {\n did: string;\n handle: string;\n displayName?: string;\n avatar?: string;\n}\n\nexport interface QuotedPostImage {\n thumb: string;\n fullsize: string;\n alt?: string;\n}\n\nexport interface QuotedPostView {\n uri: string;\n cid: string;\n author: QuotedPostAuthor;\n text: string;\n createdAt: string;\n images?: QuotedPostImage[];\n}\n\nexport type QuotedPostResult =\n | { status: 'ok'; record: QuotedPostView }\n | { status: 'deleted'; uri: string }\n | { status: 'unavailable'; uri: string };\n\n/** Max URIs per request to `POST /api/quoted-posts/resolve` (mirrors server cap). */\nexport const QUOTED_POSTS_BATCH_MAX = 20;\n\nexport interface ResolveQuotedPostsOptions extends ApiFetchOptions {\n /** Cookie header for Next.js RSC server-side calls; ignored in browsers. */\n cookieHeader?: string;\n}\n\n/**\n * Resolve a batch of AT-URIs to their quoted-post snapshots via the Sifa AppView.\n *\n * Auto-deduplicates input URIs and splits requests into chunks of\n * {@link QUOTED_POSTS_BATCH_MAX} so callers can pass an arbitrary-length array.\n * Each chunk is fired in parallel. The server caches results in Valkey, so\n * repeated calls for the same URI are cheap.\n *\n * Returns a map of `uri -> QuotedPostResult`. URIs that fail (network error,\n * non-2xx, or the server omitting them) are absent from the map; the caller\n * should render a skeleton or tombstone for those.\n */\nexport async function resolveQuotedPosts(\n config: SifaApiConfig,\n uris: string[],\n options: ResolveQuotedPostsOptions = {},\n): Promise<Record<string, QuotedPostResult>> {\n if (uris.length === 0) return {};\n\n const unique = [...new Set(uris)];\n const batches: string[][] = [];\n for (let i = 0; i < unique.length; i += QUOTED_POSTS_BATCH_MAX) {\n batches.push(unique.slice(i, i + QUOTED_POSTS_BATCH_MAX));\n }\n\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n const results: Record<string, QuotedPostResult> = {};\n await Promise.all(\n batches.map(async (batch) => {\n try {\n const data = await apiFetch<Record<string, QuotedPostResult>>(\n config,\n '/api/quoted-posts/resolve',\n {\n method: 'POST',\n body: { uris: batch },\n credentials: 'include',\n timeoutMs: 8000,\n ...options,\n headers,\n },\n );\n Object.assign(results, data);\n } catch {\n // Leave failed URIs absent so the consumer can render a fallback.\n }\n }),\n );\n\n return results;\n}\n","import {\n apiFetch,\n apiWrite,\n type ApiFetchOptions,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/** Voter on a roadmap item. */\nexport interface RoadmapVoter {\n did: string;\n avatarUrl?: string;\n}\n\n/** Map of item key -> vote tally and voter list. */\nexport type RoadmapVotesResponse = Record<string, { count: number; voters: RoadmapVoter[] }>;\n\n/**\n * Public roadmap vote tallies, keyed by item. Returns `{}` on any error.\n */\nexport async function fetchRoadmapVotes(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<RoadmapVotesResponse> {\n try {\n return await apiFetch<RoadmapVotesResponse>(config, '/api/roadmap/votes', {\n cache: 'no-store',\n ...options,\n });\n } catch {\n return {};\n }\n}\n\nexport interface FetchMyRoadmapVotesOptions extends ApiFetchOptions {\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * Required for authenticated server fetches because `credentials: 'include'`\n * does not propagate browser cookies in RSC.\n */\n cookieHeader?: string;\n}\n\n/**\n * Roadmap items the authenticated user has voted on. Returns `[]` on any\n * error or when the response payload is shaped unexpectedly.\n */\nexport async function fetchMyRoadmapVotes(\n config: SifaApiConfig,\n options: FetchMyRoadmapVotesOptions = {},\n): Promise<string[]> {\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n const data = await apiFetch<{ voted?: string[] }>(config, '/api/roadmap/votes/me', {\n credentials: 'include',\n ...options,\n headers,\n });\n return data.voted ?? [];\n } catch {\n return [];\n }\n}\n\n/** Result of a successful {@link castRoadmapVote} -- the created upvote record. */\nexport interface RoadmapVoteResult {\n uri: string;\n rkey: string;\n}\n\n/** Structured error returned by {@link castRoadmapVote} on failure. */\nexport interface RoadmapVoteError {\n type: 'scope_insufficient' | 'error';\n /**\n * When `type === 'scope_insufficient'`, the lexicon collection the user must\n * re-authorize for (e.g. `app.userinput.upvote`). sifa-web maps this to an\n * OAuth scope-upgrade flow (`/oauth/reauth?scope=repo:<collection>`).\n */\n requiredScope?: string;\n}\n\n/**\n * Discriminated-union result of {@link castRoadmapVote}. Exported so the\n * `useCastRoadmapVote` hook and SDK consumers can type mutation handlers\n * against a single source of truth.\n */\nexport type CastRoadmapVoteResult =\n { ok: true; data: RoadmapVoteResult } | { ok: false; error: RoadmapVoteError };\n\n/**\n * Cast a vote on a roadmap item by its key.\n *\n * Writes an `app.userinput.upvote` record into the viewer's PDS (server-side,\n * via their OAuth session). Returns a discriminated-union result rather than\n * the generic {@link WriteResult} because a first-time voter's PDS grant may\n * not yet include the `app.userinput.upvote` collection: the AppView responds\n * 403 `ScopeInsufficient`, which the caller handles by triggering an OAuth\n * scope upgrade rather than showing an error. Mirrors {@link createReaction}.\n *\n * Never throws.\n */\nexport async function castRoadmapVote(\n config: SifaApiConfig,\n key: string,\n options: ApiFetchOptions = {},\n): Promise<CastRoadmapVoteResult> {\n const fetchFn = config.fetch ?? globalThis.fetch;\n const url = `${config.baseUrl}/api/roadmap/votes/${encodeURIComponent(key)}`;\n\n try {\n const res = await fetchFn(url, {\n method: 'POST',\n // No body: the item key is in the URL. Do NOT declare a JSON content-type\n // for an empty body — Fastify rejects that with a 400 before the handler\n // runs. Only forward caller-provided headers.\n ...(options.headers ? { headers: options.headers } : {}),\n credentials: options.credentials ?? 'include',\n signal: options.signal ?? AbortSignal.timeout(options.timeoutMs ?? 10_000),\n });\n\n if (!res.ok) {\n if (res.status === 403) {\n try {\n const body = (await res.json()) as { error?: string; requiredScope?: string };\n if (body.error === 'ScopeInsufficient') {\n return {\n ok: false,\n error: { type: 'scope_insufficient', requiredScope: body.requiredScope },\n };\n }\n } catch {\n // Fall through to generic error.\n }\n }\n return { ok: false, error: { type: 'error' } };\n }\n\n const data = (await res.json()) as RoadmapVoteResult;\n return { ok: true, data };\n } catch {\n return { ok: false, error: { type: 'error' } };\n }\n}\n\n/** Retract a previously-cast roadmap vote. */\nexport function retractRoadmapVote(\n config: SifaApiConfig,\n key: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/roadmap/votes/${encodeURIComponent(key)}`, 'DELETE', options);\n}\n","import {\n apiFetch,\n apiWrite,\n type ApiFetchOptions,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/**\n * What the server managed to remove from the user's PDS.\n *\n * The wipe runs per collection, so it can partly succeed: `success: true` means\n * the account action completed, NOT that the PDS is clean. A UI that ignores\n * this can tell someone their data is gone while it is still on their data\n * server, so treat a non-empty `remaining` as \"not deleted\".\n *\n * Absent when the PDS was not touched (`deletePdsData: false`).\n */\nexport interface PdsWipeOutcome {\n /** Collections whose records were removed. */\n deleted: string[];\n /** Collections whose records are still on the PDS. Non-empty means not done. */\n remaining: string[];\n /**\n * The server could not enumerate the repo, so it does not know what survived.\n * Without this, that case is indistinguishable from \"nothing to delete\".\n */\n unknown: boolean;\n}\n\n/**\n * What a PDS wipe could not remove with the grant the session holds today.\n *\n * Read this BEFORE the destructive step. Deleting an account destroys the\n * session, so a missing scope cannot be granted afterwards -- there is nobody\n * left to ask. A non-empty `needsScopeFor` means the wipe would strand those\n * records on the user's data server.\n */\nexport interface WipePreview {\n /** id.sifa.* collections the current grant cannot delete. */\n needsScopeFor: string[];\n /**\n * The server could not enumerate the repo, so the gap list is not\n * authoritative. Distinct from an empty list, which means \"nothing to ask for\".\n */\n unknown?: boolean;\n}\n\n/**\n * Ask which id.sifa.* collections the current grant cannot delete.\n *\n * Unlike most read fetchers in this file's neighbourhood, a failure is NOT\n * flattened into an empty result: an empty gap list reads as \"a wipe will be\n * clean\", and a caller must not promise that on the strength of a request that\n * never arrived. Let it throw and warn.\n */\nexport function fetchWipePreview(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<WipePreview> {\n return apiFetch<WipePreview>(config, '/api/profile/wipe-preview', {\n credentials: 'include',\n ...options,\n });\n}\n\n/** Extended write result for {@link resetProfile}. */\nexport interface ResetProfileResult extends WriteResult {\n /** Present when `deletePdsData: true`. See {@link PdsWipeOutcome}. */\n pds?: PdsWipeOutcome;\n}\n\n/** Extended write result for {@link deleteAccount}. */\nexport interface DeleteAccountResult extends WriteResult {\n /** The deleted handle, returned by the server for confirmation UIs. */\n handle?: string;\n /** Present when `deletePdsData: true`. See {@link PdsWipeOutcome}. */\n pds?: PdsWipeOutcome;\n}\n\n/**\n * Reset the authenticated user's Sifa profile.\n *\n * `deletePdsData: true` also deletes the corresponding records on the\n * user's PDS. `deletePdsData: false` only removes the AppView's\n * indexed state -- the records on the PDS are left intact and could be\n * re-indexed later.\n *\n * Destructive. Server enforces session check + attestation; the SDK\n * does not gate on additional confirmation. Wrap call sites in your\n * own modal if you want a UX confirmation step.\n */\nexport function resetProfile(\n config: SifaApiConfig,\n deletePdsData: boolean,\n options: ApiFetchOptions = {},\n): Promise<ResetProfileResult> {\n return apiWrite<{ ok?: boolean; pds?: PdsWipeOutcome }>(config, '/api/profile/reset', 'DELETE', {\n body: { deletePdsData },\n ...options,\n });\n}\n\n/**\n * Delete the authenticated user's account. Returns the deleted handle\n * on success (used by the post-delete confirmation screen).\n *\n * `deletePdsData: true` also deletes the corresponding records on the\n * user's PDS; `false` leaves the PDS records intact.\n *\n * Destructive. Same caveat as {@link resetProfile}.\n */\nexport function deleteAccount(\n config: SifaApiConfig,\n deletePdsData: boolean,\n options: ApiFetchOptions = {},\n): Promise<DeleteAccountResult> {\n return apiWrite<{ ok?: boolean; handle?: string; pds?: PdsWipeOutcome }>(\n config,\n '/api/profile/account',\n 'DELETE',\n {\n body: { deletePdsData },\n ...options,\n },\n );\n}\n","import type { RepoDeleteResult, RepoInventory } from '../../repo/types.js';\nimport { apiFetch, apiWrite, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/**\n * Read what the user's PDS actually holds under id.sifa.*.\n *\n * A failure is not flattened into an empty inventory. Zero records reads as\n * \"Sifa has stored nothing about you\", and a request that never arrived must\n * not be allowed to say that. Let it throw.\n */\nexport function fetchRepoInventory(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<RepoInventory> {\n return apiFetch<RepoInventory>(config, '/api/me/repo-inventory', {\n credentials: 'include',\n ...options,\n });\n}\n\nexport interface RepoDeleteInput {\n collection: string;\n /** The records to remove. Omit and set `all` to remove the whole collection. */\n rkeys?: string[];\n /**\n * Remove every record in the collection, including ones written between the\n * inventory read and this call. A UI offering \"delete all of X\" must send\n * this rather than the rkeys it happened to see, or a record created in\n * between silently survives a delete the user believes was complete.\n */\n all?: boolean;\n}\n\n/**\n * Delete records from the user's own repo.\n *\n * The returned `success` means the request was accepted, NOT that the records\n * are gone: read `results` for that, per record. `needsScopeUpgrade` means\n * nothing was attempted and the user has to grant the scope first.\n *\n * Destructive and not undoable -- a deleted record's CID cannot be restored.\n * The server enforces the id.sifa.* boundary and the session check; the SDK\n * adds no confirmation step, so wrap call sites in one.\n */\nexport function deleteRepoRecords(\n config: SifaApiConfig,\n input: RepoDeleteInput,\n options: ApiFetchOptions = {},\n): Promise<RepoDeleteResult & { success: boolean; error?: string }> {\n return apiWrite<RepoDeleteResult>(config, '/api/me/repo-delete', 'POST', {\n body: input,\n ...options,\n });\n}\n\n/**\n * URL of the raw-record download.\n *\n * A URL rather than a fetcher: the response is a file the browser saves, and\n * routing it through fetch would buffer the whole repo in memory to hand it\n * straight back to a download anchor.\n */\nexport function repoExportUrl(config: SifaApiConfig): string {\n return `${config.baseUrl}/api/me/repo-export`;\n}\n","import { apiFetch, apiFetchOrNull, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/** A node in the personal network graph. */\nexport interface NetworkMapNode {\n did: string;\n handle: string;\n displayName: string;\n avatar: string | null;\n /** Number of edges this node participates in within the rendered graph. */\n degree: number;\n /** Phase 2: community detection cluster id. */\n cluster?: number;\n /** Phase 2: pre-computed layout coordinates. */\n x?: number;\n y?: number;\n}\n\n/** A directed edge in the personal network graph. */\nexport interface NetworkMapEdge {\n source: string;\n target: string;\n mutual: boolean;\n /** Networks this edge was observed in, e.g. `['sifa', 'bluesky']`. */\n sources: string[];\n}\n\n/** The graph payload itself, decoupled from response metadata. */\nexport interface NetworkMapGraphData {\n nodes: NetworkMapNode[];\n edges: NetworkMapEdge[];\n /** Phase 2: cluster metadata for legend rendering. */\n clusters?: Array<{ id: number; label: string; color: string }>;\n}\n\n/** Cached graph response. */\nexport interface NetworkMapResponse {\n generatedAt: string;\n expiresAt: string;\n graph: NetworkMapGraphData;\n stats: {\n totalNodes: number;\n totalEdges: number;\n mutualCount: number;\n sources: Record<string, number>;\n };\n}\n\n/** Async job tracking generation progress. */\nexport interface NetworkMapGenerationJob {\n jobId: string;\n did: string;\n status: 'pending' | 'complete' | 'failed';\n /** 0..100 */\n progress: number;\n createdAt: string;\n completedAt?: string;\n error?: string;\n /**\n * Queue position when the job is still pending and not yet picked up\n * by the worker. 0 = next to run. Absent for in-flight or terminal\n * jobs (and for any backend that doesn't yet report position).\n */\n position?: number;\n /**\n * Estimated remaining seconds, derived server-side from the median\n * historical duration for the user's follow-count bucket multiplied\n * by `position + 1`. Absent when no historical data exists yet.\n */\n etaSeconds?: number;\n}\n\n/** Returned by `initiateNetworkMapGeneration` when a new job was started or one was already running. */\nexport interface NetworkMapPendingJob {\n jobId: string;\n status: 'pending' | 'cached';\n}\n\n/** Discriminate the union returned by `initiateNetworkMapGeneration`. */\nexport function isNetworkMapResponse(\n value: NetworkMapPendingJob | NetworkMapResponse,\n): value is NetworkMapResponse {\n return 'graph' in value;\n}\n\n/**\n * Kick off a personal network-map computation. The backend returns the\n * cached map immediately when fresh, otherwise it returns a job id that\n * the caller polls via `checkNetworkMapJobStatus`.\n */\nexport async function initiateNetworkMapGeneration(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<NetworkMapPendingJob | NetworkMapResponse> {\n return apiFetch<NetworkMapPendingJob | NetworkMapResponse>(config, '/api/network-map/generate', {\n method: 'POST',\n credentials: 'include',\n ...options,\n });\n}\n\n/**\n * Poll the status of an in-flight generation job. Throws on 404 (unknown\n * or expired job) — callers may want to treat that as terminal failure.\n */\nexport async function checkNetworkMapJobStatus(\n config: SifaApiConfig,\n jobId: string,\n options: ApiFetchOptions = {},\n): Promise<NetworkMapGenerationJob> {\n return apiFetch<NetworkMapGenerationJob>(\n config,\n `/api/network-map/status/${encodeURIComponent(jobId)}`,\n {\n credentials: 'include',\n ...options,\n },\n );\n}\n\n/**\n * Fetch the most recent cached network map for the authenticated user.\n * Returns `null` when no map has ever been generated (404).\n */\nexport async function fetchNetworkMap(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<NetworkMapResponse | null> {\n return apiFetchOrNull<NetworkMapResponse>(config, '/api/network-map', {\n credentials: 'include',\n cache: 'no-store',\n ...options,\n });\n}\n","/**\n * Query key factory for TanStack Query.\n *\n * Keys are read-only tuples; the hierarchy matches the SDK's fetcher\n * grouping. Use these instead of inline arrays so consumers can target\n * `queryClient.invalidateQueries({ queryKey: keys.profile.all() })` and\n * similar patterns without typos.\n *\n * Convention: every leaf key starts with the namespace ('sifa') so\n * consumers can invalidate everything Sifa-related in one call.\n */\nexport const sifaQueryKeys = {\n all: () => ['sifa'] as const,\n\n profile: {\n all: () => ['sifa', 'profile'] as const,\n byHandle: (handleOrDid: string) => ['sifa', 'profile', handleOrDid] as const,\n atFundLink: (did: string) => ['sifa', 'profile', 'at-fund-link', did] as const,\n view: (actor: string) => ['sifa', 'profile', 'view', actor] as const,\n externalAccounts: (handleOrDid: string) =>\n ['sifa', 'profile', 'external-accounts', handleOrDid] as const,\n },\n\n position: {\n all: () => ['sifa', 'position'] as const,\n byOwner: (did: string) => ['sifa', 'position', 'by-owner', did] as const,\n },\n\n search: {\n all: () => ['sifa', 'search'] as const,\n profiles: (filters: Record<string, unknown>) =>\n ['sifa', 'search', 'profiles', filters] as const,\n companies: (filters: Record<string, unknown>) =>\n ['sifa', 'search', 'companies', filters] as const,\n skills: (query: string) => ['sifa', 'search', 'skills', query] as const,\n canonicalSkills: (query: string, limit: number) =>\n ['sifa', 'search', 'canonical-skills', query, limit] as const,\n filters: () => ['sifa', 'search', 'filters'] as const,\n },\n\n entity: {\n all: () => ['sifa', 'entity'] as const,\n search: (query: string, limit: number) => ['sifa', 'entity', 'search', query, limit] as const,\n },\n\n discovery: {\n all: () => ['sifa', 'discovery'] as const,\n similar: (did: string, limit: number) => ['sifa', 'discovery', 'similar', did, limit] as const,\n suggestions: (opts: Record<string, unknown>) =>\n ['sifa', 'discovery', 'suggestions', opts] as const,\n suggestionCount: (since: string | undefined) =>\n ['sifa', 'discovery', 'suggestion-count', since ?? null] as const,\n featured: () => ['sifa', 'discovery', 'featured'] as const,\n },\n\n follow: {\n all: () => ['sifa', 'follow'] as const,\n following: (opts: Record<string, unknown>) => ['sifa', 'follow', 'following', opts] as const,\n followers: (handle: string) => ['sifa', 'follow', 'followers', handle] as const,\n followingOf: (handle: string) => ['sifa', 'follow', 'following-of', handle] as const,\n feed: (opts: Record<string, unknown>) => ['sifa', 'follow', 'feed', opts] as const,\n mutuals: (handle: string) => ['sifa', 'follow', 'mutuals', handle] as const,\n blueskySuggestions: () => ['sifa', 'follow', 'bluesky-suggestions'] as const,\n },\n\n admin: {\n all: () => ['sifa', 'admin'] as const,\n featureAllowlist: (flag: string) => ['sifa', 'admin', 'feature-allowlist', flag] as const,\n reviewQueues: () => ['sifa', 'admin', 'review-queues'] as const,\n },\n\n stats: {\n all: () => ['sifa', 'stats'] as const,\n homepage: () => ['sifa', 'stats', 'homepage'] as const,\n },\n\n apps: {\n all: () => ['sifa', 'apps'] as const,\n registry: () => ['sifa', 'apps', 'registry'] as const,\n hidden: () => ['sifa', 'apps', 'hidden'] as const,\n },\n\n auth: {\n all: () => ['sifa', 'auth'] as const,\n // Session-scoped: the AppView reads the account list from the browser's\n // cookies, so there is only ever one list per client.\n accounts: () => ['sifa', 'auth', 'accounts'] as const,\n },\n\n activity: {\n all: () => ['sifa', 'activity'] as const,\n heatmap: (handleOrDid: string, days: number) =>\n ['sifa', 'activity', 'heatmap', handleOrDid, days] as const,\n teaser: (handleOrDid: string) => ['sifa', 'activity', 'teaser', handleOrDid] as const,\n feed: (handleOrDid: string, opts: Record<string, unknown>) =>\n ['sifa', 'activity', 'feed', handleOrDid, opts] as const,\n },\n\n github: {\n all: () => ['sifa', 'github'] as const,\n myPullRequests: (opts: { limit?: number; offset?: number }) =>\n ['sifa', 'github', 'my-pull-requests', opts] as const,\n },\n\n endorsement: {\n all: () => ['sifa', 'endorsement'] as const,\n count: (did: string) => ['sifa', 'endorsement', 'count', did] as const,\n // Scoped to the session rather than a DID -- the AppView reads the subject\n // from the session cookie, so there is only ever one inbox per client.\n pending: () => ['sifa', 'endorsement', 'pending'] as const,\n // Also session-scoped: the AppView picks the candidate from the viewer's\n // own follows, dismissals and blocks.\n reciprocity: () => ['sifa', 'endorsement', 'reciprocity'] as const,\n received: (did: string) => ['sifa', 'endorsement', 'received', did] as const,\n },\n\n confirmation: {\n all: () => ['sifa', 'confirmation'] as const,\n // Scoped to the session for the same reason as the endorsement inbox: the\n // AppView reads the subject from the session cookie, so there is only ever\n // one inbox per client.\n pending: () => ['sifa', 'confirmation', 'pending'] as const,\n /** Confirmations this session has given, for the withdraw surface. */\n given: () => ['sifa', 'confirmation', 'given'] as const,\n },\n\n stream: {\n all: () => ['sifa', 'stream'] as const,\n networkCount: (did: string) => ['sifa', 'stream', 'network-count', did] as const,\n },\n\n reactions: {\n all: () => ['sifa', 'reactions'] as const,\n status: (uris: string[]) => ['sifa', 'reactions', 'status', uris] as const,\n accountCheck: (appId: string) => ['sifa', 'reactions', 'account-check', appId] as const,\n },\n\n roadmap: {\n all: () => ['sifa', 'roadmap'] as const,\n votes: () => ['sifa', 'roadmap', 'votes'] as const,\n myVotes: () => ['sifa', 'roadmap', 'my-votes'] as const,\n },\n\n bskyPreferences: {\n all: () => ['sifa', 'bsky-preferences'] as const,\n contentLabels: () => ['sifa', 'bsky-preferences', 'content-labels'] as const,\n },\n\n repoInventory: {\n all: () => ['sifa', 'repo-inventory'] as const,\n list: () => ['sifa', 'repo-inventory', 'list'] as const,\n },\n destructive: {\n all: () => ['sifa', 'destructive'] as const,\n wipePreview: () => ['sifa', 'destructive', 'wipe-preview'] as const,\n },\n} as const;\n\nexport type SifaQueryKey =\n | ReturnType<typeof sifaQueryKeys.all>\n | ReturnType<typeof sifaQueryKeys.profile.all>\n | ReturnType<typeof sifaQueryKeys.profile.byHandle>\n | ReturnType<typeof sifaQueryKeys.profile.atFundLink>\n | ReturnType<typeof sifaQueryKeys.profile.externalAccounts>\n | ReturnType<typeof sifaQueryKeys.position.all>\n | ReturnType<typeof sifaQueryKeys.position.byOwner>\n | ReturnType<typeof sifaQueryKeys.search.all>\n | ReturnType<typeof sifaQueryKeys.search.profiles>\n | ReturnType<typeof sifaQueryKeys.search.canonicalSkills>\n | ReturnType<typeof sifaQueryKeys.search.skills>\n | ReturnType<typeof sifaQueryKeys.search.filters>\n | ReturnType<typeof sifaQueryKeys.entity.all>\n | ReturnType<typeof sifaQueryKeys.entity.search>\n | ReturnType<typeof sifaQueryKeys.discovery.all>\n | ReturnType<typeof sifaQueryKeys.discovery.similar>\n | ReturnType<typeof sifaQueryKeys.discovery.suggestions>\n | ReturnType<typeof sifaQueryKeys.discovery.suggestionCount>\n | ReturnType<typeof sifaQueryKeys.discovery.featured>\n | ReturnType<typeof sifaQueryKeys.follow.all>\n | ReturnType<typeof sifaQueryKeys.follow.following>\n | ReturnType<typeof sifaQueryKeys.follow.followers>\n | ReturnType<typeof sifaQueryKeys.follow.followingOf>\n | ReturnType<typeof sifaQueryKeys.follow.feed>\n | ReturnType<typeof sifaQueryKeys.follow.mutuals>\n | ReturnType<typeof sifaQueryKeys.follow.blueskySuggestions>\n | ReturnType<typeof sifaQueryKeys.admin.all>\n | ReturnType<typeof sifaQueryKeys.admin.featureAllowlist>\n | ReturnType<typeof sifaQueryKeys.admin.reviewQueues>\n | ReturnType<typeof sifaQueryKeys.stats.all>\n | ReturnType<typeof sifaQueryKeys.stats.homepage>\n | ReturnType<typeof sifaQueryKeys.apps.all>\n | ReturnType<typeof sifaQueryKeys.apps.registry>\n | ReturnType<typeof sifaQueryKeys.apps.hidden>\n | ReturnType<typeof sifaQueryKeys.activity.all>\n | ReturnType<typeof sifaQueryKeys.activity.heatmap>\n | ReturnType<typeof sifaQueryKeys.activity.teaser>\n | ReturnType<typeof sifaQueryKeys.activity.feed>\n | ReturnType<typeof sifaQueryKeys.endorsement.all>\n | ReturnType<typeof sifaQueryKeys.endorsement.count>\n | ReturnType<typeof sifaQueryKeys.endorsement.pending>\n | ReturnType<typeof sifaQueryKeys.endorsement.reciprocity>\n | ReturnType<typeof sifaQueryKeys.endorsement.received>\n | ReturnType<typeof sifaQueryKeys.confirmation.all>\n | ReturnType<typeof sifaQueryKeys.confirmation.pending>\n | ReturnType<typeof sifaQueryKeys.confirmation.given>\n | ReturnType<typeof sifaQueryKeys.stream.all>\n | ReturnType<typeof sifaQueryKeys.stream.networkCount>\n | ReturnType<typeof sifaQueryKeys.reactions.all>\n | ReturnType<typeof sifaQueryKeys.reactions.status>\n | ReturnType<typeof sifaQueryKeys.reactions.accountCheck>\n | ReturnType<typeof sifaQueryKeys.roadmap.all>\n | ReturnType<typeof sifaQueryKeys.roadmap.votes>\n | ReturnType<typeof sifaQueryKeys.roadmap.myVotes>\n | ReturnType<typeof sifaQueryKeys.bskyPreferences.all>\n | ReturnType<typeof sifaQueryKeys.bskyPreferences.contentLabels>\n | ReturnType<typeof sifaQueryKeys.destructive.all>\n | ReturnType<typeof sifaQueryKeys.destructive.wipePreview>\n | ReturnType<typeof sifaQueryKeys.repoInventory.all>\n | ReturnType<typeof sifaQueryKeys.repoInventory.list>;\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport type { Profile } from '../../types/index.js';\nimport { useSifaConfig } from '../config.js';\nimport { fetchAtFundLink, fetchProfile } from '../fetchers/profile.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * React hook that reads an aggregated profile by handle or DID via\n * TanStack Query. Returns `null` data when the profile does not exist.\n *\n * Pass `{ enabled: false }` (or an empty `handleOrDid`) to defer the\n * fetch.\n */\nexport function useProfile(\n handleOrDid: string | undefined | null,\n options?: Omit<\n UseQueryOptions<\n Profile | null,\n Error,\n Profile | null,\n ReturnType<typeof sifaQueryKeys.profile.byHandle>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.profile.byHandle(handleOrDid ?? ''),\n queryFn: () => fetchProfile(config, handleOrDid ?? ''),\n enabled: Boolean(handleOrDid) && (options?.enabled ?? true),\n ...options,\n });\n}\n\n/**\n * React hook for a profile's AT Fund link. Returns `null` data on error\n * or when the profile has no link configured.\n */\nexport function useAtFundLink(\n did: string | undefined | null,\n options?: Omit<\n UseQueryOptions<\n string | null,\n Error,\n string | null,\n ReturnType<typeof sifaQueryKeys.profile.atFundLink>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.profile.atFundLink(did ?? ''),\n queryFn: () => fetchAtFundLink(config, did ?? ''),\n enabled: Boolean(did) && (options?.enabled ?? true),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport type { ProfileView } from '../../types/profile-view.js';\nimport { useSifaConfig } from '../config.js';\nimport { fetchGetProfileView } from '../fetchers/get-profile-view.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * React hook that reads the aggregated public profile view via the\n * `id.sifa.getProfileView` XRPC query. Returns `null` data when the profile\n * does not exist.\n *\n * Pass `{ enabled: false }` (or an empty `actor`) to defer the fetch.\n */\nexport function useGetProfileView(\n actor: string | undefined | null,\n options?: Omit<\n UseQueryOptions<\n ProfileView | null,\n Error,\n ProfileView | null,\n ReturnType<typeof sifaQueryKeys.profile.view>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.profile.view(actor ?? ''),\n queryFn: () => fetchGetProfileView(config, actor ?? ''),\n enabled: Boolean(actor) && (options?.enabled ?? true),\n ...options,\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport { type WriteResult } from '../client.js';\nimport {\n deleteAvatarOverride,\n deleteNamePronunciationAudio,\n refreshPds,\n updateProfileOverride,\n updateProfileSelf,\n uploadAvatar,\n uploadNamePronunciationAudio,\n type RefreshPdsResult,\n type UpdateProfileOverrideInput,\n type UpdateProfileSelfInput,\n type UploadAvatarResult,\n type UploadPronunciationAudioResult,\n} from '../fetchers/profile-mutations.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Invalidate the owner's profile cache after a profile-edit mutation\n * succeeds. Shared helper for the hooks in this file -- the owner DID\n * (or handle) is required so the mutation can target the correct cache\n * entry.\n */\nasync function invalidateProfile(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n}\n\n/**\n * React hook for updating the authenticated user's profile self record.\n * On success, invalidates the owner's profile cache.\n *\n * The owner identifier (handle or DID) is required so the mutation can\n * target the right profile cache entry for invalidation.\n */\nexport function useUpdateProfileSelf(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, UpdateProfileSelfInput>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (data: UpdateProfileSelfInput) => updateProfileSelf(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for updating the authenticated user's profile override fields. */\nexport function useUpdateProfileOverride(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, UpdateProfileOverrideInput>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (data: UpdateProfileOverrideInput) => updateProfileOverride(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for re-pulling the authenticated user's PDS-side profile. */\nexport function useRefreshPds(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<RefreshPdsResult, Error, void>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: () => refreshPds(config),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/**\n * React hook for uploading a new avatar. Pass a `File` (browser) or\n * `Blob` (Expo) as the mutation variable.\n */\nexport function useUploadAvatar(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<UploadAvatarResult, Error, Blob>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (file: Blob) => uploadAvatar(config, file),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for deleting the avatar override (revert to PDS avatar). */\nexport function useDeleteAvatarOverride(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, void>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: () => deleteAvatarOverride(config),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/**\n * React hook for uploading a name-pronunciation audio clip. Pass a `File`\n * (browser) or `Blob` (Expo) as the mutation variable.\n */\nexport function useUploadNamePronunciationAudio(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<UploadPronunciationAudioResult, Error, Blob>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (file: Blob) => uploadNamePronunciationAudio(config, file),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for deleting the name-pronunciation audio clip. */\nexport function useDeleteNamePronunciationAudio(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, void>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: () => deleteNamePronunciationAudio(config),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport { createPosition, type CreateResult } from '../fetchers/positions.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * React hook for creating a new position record. On success, invalidates\n * the owner's profile cache so the new position is reflected on the next\n * read.\n *\n * The owner DID is required so the mutation can target the correct\n * profile cache entry for invalidation.\n */\nexport function useCreatePosition(\n ownerDid: string,\n options?: Omit<UseMutationOptions<CreateResult, Error, Record<string, unknown>>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (data: Record<string, unknown>) => createPosition(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.profile.byHandle(ownerDid) });\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.position.byOwner(ownerDid) });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n deletePosition,\n linkSkillToPosition,\n setPositionPrimary,\n unlinkSkillFromPosition,\n unsetPositionPrimary,\n updatePosition,\n} from '../fetchers/positions.js';\nimport { sifaQueryKeys } from '../keys.js';\nimport type { ProfilePosition, SkillRef } from '../../types/index.js';\n\nasync function invalidatePositionCaches(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.position.byOwner(ownerHandleOrDid),\n });\n}\n\n/** Variables for {@link useUpdatePosition}. */\nexport interface UpdatePositionVariables {\n rkey: string;\n data: Record<string, unknown>;\n}\n\n/** React hook for updating a position record. */\nexport function useUpdatePosition(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, UpdatePositionVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ rkey, data }: UpdatePositionVariables) => updatePosition(config, rkey, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidatePositionCaches(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for deleting a position record. Variable: the `rkey` string. */\nexport function useDeletePosition(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (rkey: string) => deletePosition(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidatePositionCaches(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for marking a position as primary. Variable: the `rkey` string. */\nexport function useSetPositionPrimary(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (rkey: string) => setPositionPrimary(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidatePositionCaches(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for clearing the primary flag on a position. */\nexport function useUnsetPositionPrimary(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (rkey: string) => unsetPositionPrimary(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidatePositionCaches(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** Variables for {@link useLinkSkillToPosition} / {@link useUnlinkSkillFromPosition}. */\nexport interface PositionSkillLinkVariables {\n position: ProfilePosition;\n skillRef: SkillRef;\n}\n\n/** React hook for linking a skill to a position. Idempotent. */\nexport function useLinkSkillToPosition(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, PositionSkillLinkVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ position, skillRef }: PositionSkillLinkVariables) =>\n linkSkillToPosition(config, position, skillRef),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidatePositionCaches(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for unlinking a skill from a position. */\nexport function useUnlinkSkillFromPosition(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, PositionSkillLinkVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ position, skillRef }: PositionSkillLinkVariables) =>\n unlinkSkillFromPosition(config, position, skillRef),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidatePositionCaches(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type CreateResult, type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport { createEducation, deleteEducation, updateEducation } from '../fetchers/education.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateProfile(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n}\n\n/** React hook for creating an education record. */\nexport function useCreateEducation(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<CreateResult, Error, Record<string, unknown>>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (data: Record<string, unknown>) => createEducation(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** Variables for {@link useUpdateEducation}. */\nexport interface UpdateEducationVariables {\n rkey: string;\n data: Record<string, unknown>;\n}\n\n/** React hook for updating an education record. */\nexport function useUpdateEducation(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, UpdateEducationVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ rkey, data }: UpdateEducationVariables) => updateEducation(config, rkey, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for deleting an education record. Variable: the `rkey` string. */\nexport function useDeleteEducation(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (rkey: string) => deleteEducation(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type CreateResult, type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n createSkill,\n deleteSkill,\n updateSkill,\n updateSkillSubCategories,\n type SubCategoryBulkResult,\n} from '../fetchers/skills.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateProfile(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n}\n\n/** React hook for creating a skill record. */\nexport function useCreateSkill(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<CreateResult, Error, Record<string, unknown>>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (data: Record<string, unknown>) => createSkill(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** Variables for {@link useUpdateSkill}. */\nexport interface UpdateSkillVariables {\n rkey: string;\n data: Record<string, unknown>;\n}\n\n/** React hook for updating a skill record. */\nexport function useUpdateSkill(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, UpdateSkillVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ rkey, data }: UpdateSkillVariables) => updateSkill(config, rkey, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** Variables for {@link useUpdateSkillSubCategories}. */\nexport interface UpdateSkillSubCategoriesVariables {\n rkeys: string[];\n subCategory: string;\n}\n\n/**\n * React hook for setting (or clearing) the sub-category on many skills in a\n * single request. An empty `subCategory` clears the field.\n */\nexport function useUpdateSkillSubCategories(\n ownerHandleOrDid: string,\n options?: Omit<\n UseMutationOptions<\n WriteResult & SubCategoryBulkResult,\n Error,\n UpdateSkillSubCategoriesVariables\n >,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ rkeys, subCategory }: UpdateSkillSubCategoriesVariables) =>\n updateSkillSubCategories(config, rkeys, subCategory),\n // `...options` comes first so a caller-supplied onSuccess cannot replace the\n // wrapper below and silently skip profile invalidation; the wrapper calls it\n // instead. The older skill hooks in this file spread options last and still\n // carry that bug.\n ...options,\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for deleting a skill record. Variable: the `rkey` string. */\nexport function useDeleteSkill(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (rkey: string) => deleteSkill(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type CreateResult, type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport { createRecord, deleteRecord, updateRecord } from '../fetchers/records.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateProfile(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n}\n\n/** Variables for {@link useCreateRecord}. */\nexport interface CreateRecordVariables {\n collection: string;\n data: Record<string, unknown>;\n}\n\n/**\n * Generic record-create escape hatch for collections without a\n * dedicated section helper (certifications, projects, publications,\n * volunteering, honors, languages, courses). Prefer the typed helpers\n * when one exists for the section.\n */\nexport function useCreateRecord(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<CreateResult, Error, CreateRecordVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ collection, data }: CreateRecordVariables) =>\n createRecord(config, collection, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** Variables for {@link useUpdateRecord}. */\nexport interface UpdateRecordVariables {\n collection: string;\n rkey: string;\n data: Record<string, unknown>;\n}\n\n/** Generic record-update escape hatch. See {@link useCreateRecord}. */\nexport function useUpdateRecord(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, UpdateRecordVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ collection, rkey, data }: UpdateRecordVariables) =>\n updateRecord(config, collection, rkey, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** Variables for {@link useDeleteRecord}. */\nexport interface DeleteRecordVariables {\n collection: string;\n rkey: string;\n}\n\n/** Generic record-delete escape hatch. See {@link useCreateRecord}. */\nexport function useDeleteRecord(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, DeleteRecordVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ collection, rkey }: DeleteRecordVariables) =>\n deleteRecord(config, collection, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type CreateResult, type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n createProfileLocation,\n deleteProfileLocation,\n updateProfileLocation,\n type ProfileLocationInput,\n} from '../fetchers/profile-locations.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateProfile(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n}\n\n/** React hook for creating a profile location record. */\nexport function useCreateProfileLocation(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<CreateResult, Error, ProfileLocationInput>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (data: ProfileLocationInput) => createProfileLocation(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** Variables for {@link useUpdateProfileLocation}. */\nexport interface UpdateProfileLocationVariables {\n rkey: string;\n data: ProfileLocationInput;\n}\n\n/** React hook for updating a profile location record. */\nexport function useUpdateProfileLocation(\n ownerHandleOrDid: string,\n options?: Omit<\n UseMutationOptions<WriteResult, Error, UpdateProfileLocationVariables>,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ rkey, data }: UpdateProfileLocationVariables) =>\n updateProfileLocation(config, rkey, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for deleting a profile location record. Variable: the `rkey` string. */\nexport function useDeleteProfileLocation(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (rkey: string) => deleteProfileLocation(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport {\n useMutation,\n useQuery,\n useQueryClient,\n type UseMutationOptions,\n type UseQueryOptions,\n} from '@tanstack/react-query';\n\nimport type { ExternalAccount } from '../../types/index.js';\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n createExternalAccount,\n deleteExternalAccount,\n fetchExternalAccounts,\n setExternalAccountPrimary,\n unsetExternalAccountPrimary,\n updateExternalAccount,\n verifyExternalAccount,\n type CreateExternalAccountResult,\n type ExternalAccountInput,\n type VerifyExternalAccountResult,\n} from '../fetchers/external-accounts.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateProfileAndExternalAccounts(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.externalAccounts(ownerHandleOrDid),\n });\n}\n\n/** React hook for reading the external-accounts list. Returns `[]` data on error. */\nexport function useExternalAccounts(\n handleOrDid: string | undefined | null,\n options?: Omit<\n UseQueryOptions<\n ExternalAccount[],\n Error,\n ExternalAccount[],\n ReturnType<typeof sifaQueryKeys.profile.externalAccounts>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.profile.externalAccounts(handleOrDid ?? ''),\n queryFn: () => fetchExternalAccounts(config, handleOrDid ?? ''),\n enabled: Boolean(handleOrDid) && (options?.enabled ?? true),\n ...options,\n });\n}\n\n/** React hook for creating an external account. */\nexport function useCreateExternalAccount(\n ownerHandleOrDid: string,\n options?: Omit<\n UseMutationOptions<CreateExternalAccountResult, Error, ExternalAccountInput>,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (data: ExternalAccountInput) => createExternalAccount(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** Variables for {@link useUpdateExternalAccount}. */\nexport interface UpdateExternalAccountVariables {\n rkey: string;\n data: ExternalAccountInput;\n}\n\n/** React hook for updating an external account. */\nexport function useUpdateExternalAccount(\n ownerHandleOrDid: string,\n options?: Omit<\n UseMutationOptions<WriteResult, Error, UpdateExternalAccountVariables>,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ rkey, data }: UpdateExternalAccountVariables) =>\n updateExternalAccount(config, rkey, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for deleting an external account. Variable: the `rkey` string. */\nexport function useDeleteExternalAccount(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (rkey: string) => deleteExternalAccount(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for marking an external account primary. */\nexport function useSetExternalAccountPrimary(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (rkey: string) => setExternalAccountPrimary(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for clearing the primary flag on an external account. */\nexport function useUnsetExternalAccountPrimary(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (rkey: string) => unsetExternalAccountPrimary(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for running server-side verification of an external account. */\nexport function useVerifyExternalAccount(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<VerifyExternalAccountResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (rkey: string) => verifyExternalAccount(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type CreateResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport { createEndorsement, type EndorsementInput } from '../fetchers/endorsements.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * React hook for creating an endorsement of another user's skill. The\n * mutation needs the endorsed user's handle/DID (not the endorser's)\n * so the endorsed profile + their endorsement count caches get\n * invalidated; pass `null` to skip endorsed-profile invalidation\n * (e.g., if you only know the skill URI).\n */\nexport function useCreateEndorsement(\n endorsedHandleOrDid: string | null,\n options?: Omit<UseMutationOptions<CreateResult, Error, EndorsementInput>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (data: EndorsementInput) => createEndorsement(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success && endorsedHandleOrDid) {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(endorsedHandleOrDid),\n });\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.endorsement.count(endorsedHandleOrDid),\n });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchReceivedEndorsements,\n type ReceivedEndorsementsPage,\n} from '../fetchers/received-endorsements.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/** Confirmed endorsements a DID has received, newest first. */\nexport function useReceivedEndorsements(\n did: string | undefined | null,\n options?: { limit?: number } & Omit<\n UseQueryOptions<\n ReceivedEndorsementsPage,\n Error,\n ReceivedEndorsementsPage,\n ReturnType<typeof sifaQueryKeys.endorsement.received>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n const { limit, ...queryOptions } = options ?? {};\n return useQuery({\n queryKey: sifaQueryKeys.endorsement.received(did ?? ''),\n queryFn: () => fetchReceivedEndorsements(config, did ?? '', { limit }),\n enabled: Boolean(did) && (queryOptions.enabled ?? true),\n ...queryOptions,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport { fetchReciprocityCandidate, type ReciprocityCandidate } from '../fetchers/reciprocity.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Someone the signed-in user could endorse. `null` when there is nobody left.\n *\n * Session-scoped like the pending inbox: the AppView reads the viewer from the\n * session, so the key takes no DID. Invalidate it after dismissing to pull the\n * next person in without a reload.\n */\nexport function useReciprocityCandidate(\n options?: Omit<\n UseQueryOptions<\n ReciprocityCandidate | null,\n Error,\n ReciprocityCandidate | null,\n ReturnType<typeof sifaQueryKeys.endorsement.reciprocity>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.endorsement.reciprocity(),\n queryFn: () => fetchReciprocityCandidate(config),\n ...options,\n });\n}\n","'use client';\n\nimport {\n useMutation,\n useQuery,\n useQueryClient,\n type UseMutationOptions,\n type UseQueryOptions,\n} from '@tanstack/react-query';\n\nimport { type CreateResult, type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport { confirmEndorsement, type ConfirmEndorsementInput } from '../fetchers/endorsements.js';\nimport {\n dismissEndorsement,\n fetchPendingEndorsements,\n type DismissEndorsementInput,\n type PendingEndorsementsPage,\n} from '../fetchers/endorsement-inbox.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Endorsements awaiting the signed-in user's decision. Returns an empty page\n * when signed out or on error, so callers can render \"nothing pending\" without\n * special-casing either.\n */\nexport function usePendingEndorsements(\n options?: Omit<\n UseQueryOptions<\n PendingEndorsementsPage,\n Error,\n PendingEndorsementsPage,\n ReturnType<typeof sifaQueryKeys.endorsement.pending>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.endorsement.pending(),\n queryFn: () => fetchPendingEndorsements(config),\n ...options,\n });\n}\n\n/**\n * Confirm a received endorsement. On success the endorsement leaves the inbox\n * and starts displaying, so both the inbox and the subject's own profile and\n * count caches are invalidated.\n *\n * `subjectHandleOrDid` is the confirming user (the endorsement's subject);\n * pass `null` to skip profile invalidation.\n */\nexport function useConfirmEndorsement(\n subjectHandleOrDid: string | null,\n options?: Omit<UseMutationOptions<CreateResult, Error, ConfirmEndorsementInput>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (data: ConfirmEndorsementInput) => confirmEndorsement(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.endorsement.pending(),\n });\n if (subjectHandleOrDid) {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(subjectHandleOrDid),\n });\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.endorsement.count(subjectHandleOrDid),\n });\n }\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/**\n * Dismiss a received endorsement. Only the inbox is invalidated -- a dismissal\n * changes nothing that displays anywhere, so no profile cache is affected.\n */\nexport function useDismissEndorsement(\n options?: Omit<UseMutationOptions<WriteResult, Error, DismissEndorsementInput>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (data: DismissEndorsementInput) => dismissEndorsement(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.endorsement.pending(),\n });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport {\n useMutation,\n useQuery,\n useQueryClient,\n type UseMutationOptions,\n type UseQueryOptions,\n} from '@tanstack/react-query';\n\nimport { type CreateResult, type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n createConfirmation,\n dismissConfirmation,\n fetchGivenConfirmations,\n fetchPendingConfirmations,\n revokeConfirmation,\n type ConfirmationInput,\n type ConfirmationSubjectInput,\n type GivenConfirmation,\n type PendingConfirmationsPage,\n} from '../fetchers/confirmations.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Claims naming the signed-in user that await their decision. Returns an empty\n * page when signed out or on error, so callers can render \"nothing pending\"\n * without special-casing either.\n */\nexport function usePendingConfirmations(\n options?: Omit<\n UseQueryOptions<\n PendingConfirmationsPage,\n Error,\n PendingConfirmationsPage,\n ReturnType<typeof sifaQueryKeys.confirmation.pending>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.confirmation.pending(),\n queryFn: () => fetchPendingConfirmations(config),\n ...options,\n });\n}\n\n/**\n * Confirmations the signed-in user has already given, with whether each has\n * drifted since. Returns an empty list when signed out or on error.\n */\nexport function useGivenConfirmations(\n options?: Omit<\n UseQueryOptions<\n { confirmations: GivenConfirmation[] },\n Error,\n { confirmations: GivenConfirmation[] },\n ReturnType<typeof sifaQueryKeys.confirmation.given>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.confirmation.given(),\n queryFn: () => fetchGivenConfirmations(config),\n ...options,\n });\n}\n\n/**\n * Affirm a claim naming you. On success it leaves the inbox and starts\n * rendering with your name and avatar on the claimer's profile, so both the\n * inbox and the claimer's profile cache are invalidated.\n *\n * `claimerHandleOrDid` is whose profile the claim displays on; pass `null` to\n * skip profile invalidation. Note this is the claimer, not the confirming\n * user: confirming changes what renders on *their* profile, not yours.\n */\nexport function useCreateConfirmation(\n claimerHandleOrDid: string | null,\n options?: Omit<UseMutationOptions<CreateResult, Error, ConfirmationInput>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (data: ConfirmationInput) => createConfirmation(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.confirmation.pending(),\n });\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.confirmation.given(),\n });\n if (claimerHandleOrDid) {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(claimerHandleOrDid),\n });\n }\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/**\n * Dismiss a claim naming you. Only the inbox is invalidated -- a dismissal\n * changes nothing that displays anywhere, so no profile cache is affected.\n */\nexport function useDismissConfirmation(\n options?: Omit<UseMutationOptions<WriteResult, Error, ConfirmationSubjectInput>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (data: ConfirmationSubjectInput) => dismissConfirmation(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.confirmation.pending(),\n });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/**\n * Withdraw a confirmation you previously gave. Unlike a dismissal this does\n * change what displays, so the claimer's profile cache is invalidated too.\n */\nexport function useRevokeConfirmation(\n claimerHandleOrDid: string | null,\n options?: Omit<UseMutationOptions<WriteResult, Error, ConfirmationSubjectInput>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (data: ConfirmationSubjectInput) => revokeConfirmation(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.confirmation.pending(),\n });\n if (claimerHandleOrDid) {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(claimerHandleOrDid),\n });\n }\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport { hideKeytraceClaim, unhideKeytraceClaim } from '../fetchers/keytrace-claims.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateProfile(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n}\n\n/** React hook for hiding a keytrace claim. Variable: the claim `rkey` string. */\nexport function useHideKeytraceClaim(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (rkey: string) => hideKeytraceClaim(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for unhiding a previously-hidden keytrace claim. */\nexport function useUnhideKeytraceClaim(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (rkey: string) => unhideKeytraceClaim(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport { revealMarqueDomain, unrevealMarqueDomain } from '../fetchers/marque-domains.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateProfile(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n}\n\n/** React hook for revealing (making public) a Marque domain. Variable: the domain string. */\nexport function useRevealMarqueDomain(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (domain: string) => revealMarqueDomain(config, domain),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for hiding a previously-revealed Marque domain again. */\nexport function useUnrevealMarqueDomain(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (domain: string) => unrevealMarqueDomain(config, domain),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n bulkHideStandardPublications,\n bulkUnhideStandardPublications,\n hideOrcidPublication,\n hideSifaPublication,\n hideStandardPublication,\n refreshOrcidPublications,\n unhideOrcidPublication,\n unhideSifaPublication,\n unhideStandardPublication,\n type RefreshOrcidPublicationsResult,\n} from '../fetchers/publications.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateProfile(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n}\n\nfunction makeWriteHook<TVariable>(\n fetcher: (config: ReturnType<typeof useSifaConfig>, v: TVariable) => Promise<WriteResult>,\n) {\n return function useHook(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, TVariable>, 'mutationFn'>,\n ) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (v: TVariable) => fetcher(config, v),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n };\n}\n\n/** React hook for hiding an ORCID publication. Variable: the `putCode` number. */\nexport const useHideOrcidPublication = makeWriteHook<number>((config, putCode) =>\n hideOrcidPublication(config, putCode),\n);\n\n/** React hook for unhiding an ORCID publication. Variable: the `putCode` number. */\nexport const useUnhideOrcidPublication = makeWriteHook<number>((config, putCode) =>\n unhideOrcidPublication(config, putCode),\n);\n\n/** React hook for hiding a standard publication. Variable: the AT URI string. */\nexport const useHideStandardPublication = makeWriteHook<string>((config, uri) =>\n hideStandardPublication(config, uri),\n);\n\n/** React hook for unhiding a standard publication. Variable: the AT URI string. */\nexport const useUnhideStandardPublication = makeWriteHook<string>((config, uri) =>\n unhideStandardPublication(config, uri),\n);\n\n/** React hook for bulk-hiding standard publications. Variable: the URI list. */\nexport const useBulkHideStandardPublications = makeWriteHook<string[]>((config, uris) =>\n bulkHideStandardPublications(config, uris),\n);\n\n/** React hook for bulk-unhiding standard publications. Variable: the URI list. */\nexport const useBulkUnhideStandardPublications = makeWriteHook<string[]>((config, uris) =>\n bulkUnhideStandardPublications(config, uris),\n);\n\n/** React hook for hiding a Sifa-authored publication. Variable: the `rkey` string. */\nexport const useHideSifaPublication = makeWriteHook<string>((config, rkey) =>\n hideSifaPublication(config, rkey),\n);\n\n/** React hook for unhiding a Sifa-authored publication. Variable: the `rkey` string. */\nexport const useUnhideSifaPublication = makeWriteHook<string>((config, rkey) =>\n unhideSifaPublication(config, rkey),\n);\n\n/** React hook for re-pulling ORCID publications. */\nexport function useRefreshOrcidPublications(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<RefreshOrcidPublicationsResult, Error, void>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: () => refreshOrcidPublications(config),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n bulkHideProfileItems,\n bulkUnhideProfileItems,\n hideProfileItem,\n unhideProfileItem,\n type BulkHideProfileItemInput,\n type HideProfileItemInput,\n} from '../fetchers/profile-items-hide.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateProfile(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n}\n\nfunction makeWriteHook<TVariable>(\n fetcher: (config: ReturnType<typeof useSifaConfig>, v: TVariable) => Promise<WriteResult>,\n) {\n return function useHook(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, TVariable>, 'mutationFn'>,\n ) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (v: TVariable) => fetcher(config, v),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n };\n}\n\n/**\n * Hide one profile item across any supported section. The underlying\n * record stays on the user's PDS; only its display on sifa.id is\n * suppressed.\n */\nexport const useHideProfileItem = makeWriteHook<HideProfileItemInput>((config, input) =>\n hideProfileItem(config, input),\n);\n\n/** Restore a previously-hidden profile item. */\nexport const useUnhideProfileItem = makeWriteHook<HideProfileItemInput>((config, input) =>\n unhideProfileItem(config, input),\n);\n\n/** Bulk-hide profile items sharing the same `itemType` + `source`. */\nexport const useBulkHideProfileItems = makeWriteHook<BulkHideProfileItemInput>((config, input) =>\n bulkHideProfileItems(config, input),\n);\n\n/** Bulk-unhide profile items sharing the same `itemType` + `source`. */\nexport const useBulkUnhideProfileItems = makeWriteHook<BulkHideProfileItemInput>((config, input) =>\n bulkUnhideProfileItems(config, input),\n);\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport { fetchStats, type StatsResponse } from '../fetchers/stats.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * React hook for the public homepage stats. Returns `null` data on error.\n */\nexport function useStats(\n options?: Omit<\n UseQueryOptions<\n StatsResponse | null,\n Error,\n StatsResponse | null,\n ReturnType<typeof sifaQueryKeys.stats.homepage>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.stats.homepage(),\n queryFn: () => fetchStats(config),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchAppsRegistry,\n fetchHiddenApps,\n type AppRegistryEntry,\n type HiddenApp,\n} from '../fetchers/apps.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/** React hook for the public app registry. */\nexport function useAppsRegistry(\n options?: Omit<\n UseQueryOptions<\n AppRegistryEntry[],\n Error,\n AppRegistryEntry[],\n ReturnType<typeof sifaQueryKeys.apps.registry>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.apps.registry(),\n queryFn: () => fetchAppsRegistry(config),\n ...options,\n });\n}\n\n/**\n * React hook for the authenticated user's hidden-apps list. Requires a\n * client-side session (relies on `credentials: 'include'`).\n */\nexport function useHiddenApps(\n options?: Omit<\n UseQueryOptions<HiddenApp[], Error, HiddenApp[], ReturnType<typeof sifaQueryKeys.apps.hidden>>,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.apps.hidden(),\n queryFn: () => fetchHiddenApps(config),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport { fetchAccounts, type AccountSummary } from '../fetchers/accounts.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * React hook for the accounts attached to this browser (the account switcher).\n * Requires a client-side session (relies on `credentials: 'include'`).\n * Returns `[]` when unauthenticated.\n */\nexport function useAccounts(\n options?: Omit<\n UseQueryOptions<\n AccountSummary[],\n Error,\n AccountSummary[],\n ReturnType<typeof sifaQueryKeys.auth.accounts>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.auth.accounts(),\n queryFn: () => fetchAccounts(config),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport type { SkillSuggestion } from '../../types/index.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchSearchCompanies,\n fetchSearchFilters,\n fetchSearchProfiles,\n fetchSkillSuggestions,\n searchSkills,\n type CompanySearchFilters,\n type CompanySearchResponse,\n type FilterOptions,\n type SearchFilters,\n type SearchResponse,\n type SkillSearchResult,\n} from '../fetchers/search.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nexport function useSearchProfiles(\n filters: SearchFilters,\n options?: Omit<\n UseQueryOptions<\n SearchResponse,\n Error,\n SearchResponse,\n ReturnType<typeof sifaQueryKeys.search.profiles>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.search.profiles(filters as Record<string, unknown>),\n queryFn: () => fetchSearchProfiles(config, filters),\n ...options,\n });\n}\n\nexport function useSkillSuggestions(\n query: string,\n options?: Omit<\n UseQueryOptions<\n SkillSearchResult[],\n Error,\n SkillSearchResult[],\n ReturnType<typeof sifaQueryKeys.search.skills>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.search.skills(query),\n queryFn: () => fetchSkillSuggestions(config, query),\n enabled: query.trim().length > 0 && (options?.enabled ?? true),\n ...options,\n });\n}\n\n/**\n * Canonical-skill search hook. Hits `/api/skills/search` (the\n * canonical-skills DB lookup, distinct from {@link useSkillSuggestions}'s\n * `/api/search/skills` profile-skill typeahead). Skips the network call\n * when the query is empty.\n */\nexport function useCanonicalSkillSearch(\n query: string,\n limit = 10,\n options?: Omit<\n UseQueryOptions<\n SkillSuggestion[],\n Error,\n SkillSuggestion[],\n ReturnType<typeof sifaQueryKeys.search.canonicalSkills>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.search.canonicalSkills(query, limit),\n queryFn: () => searchSkills(config, query, limit),\n enabled: query.trim().length > 0 && (options?.enabled ?? true),\n ...options,\n });\n}\n\nexport function useSearchFilters(\n options?: Omit<\n UseQueryOptions<\n FilterOptions,\n Error,\n FilterOptions,\n ReturnType<typeof sifaQueryKeys.search.filters>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.search.filters(),\n queryFn: () => fetchSearchFilters(config),\n ...options,\n });\n}\n\n/**\n * Company search (workspace#299). Separate hook from `useSearchProfiles` so a\n * blended results page can render each category as it resolves instead of\n * waiting for the slowest.\n */\nexport function useSearchCompanies(\n filters: CompanySearchFilters,\n options?: Omit<\n UseQueryOptions<\n CompanySearchResponse,\n Error,\n CompanySearchResponse,\n ReturnType<typeof sifaQueryKeys.search.companies>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.search.companies(filters as Record<string, unknown>),\n queryFn: () => fetchSearchCompanies(config, filters),\n ...options,\n });\n}\n","'use client';\n\nimport { useEffect, useState } from 'react';\nimport {\n useMutation,\n useQuery,\n type UseMutationOptions,\n type UseQueryOptions,\n} from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchEntitySearch,\n importSearchEntities,\n mintEntityDomain,\n resolveEntityDomain,\n selectEntity,\n} from '../fetchers/entities.js';\nimport { sifaQueryKeys } from '../keys.js';\nimport type {\n EntityMintDomainResponse,\n EntityResolveDomainResponse,\n EntitySearchResponse,\n EntitySearchResult,\n EntitySelectRequest,\n EntitySelectResponse,\n} from '../../schemas/entity.js';\n\n/** Debounce a rapidly-changing value (e.g. a typeahead input). */\nexport function useDebouncedValue<T>(value: T, delayMs = 250): T {\n const [debounced, setDebounced] = useState(value);\n useEffect(() => {\n const timer = setTimeout(() => setDebounced(value), delayMs);\n return () => clearTimeout(timer);\n }, [value, delayMs]);\n return debounced;\n}\n\nexport interface UseEntitySearchOptions {\n /** Max rows to request (default 5). */\n limit?: number;\n /** Debounce delay in ms (default 250). */\n debounceMs?: number;\n enabled?: boolean;\n}\n\n/**\n * Debounced organization typeahead. The query is debounced internally, so\n * consumers can pass the raw input value on every keystroke. Skips the network\n * call while the (trimmed, debounced) query is empty.\n */\nexport function useEntitySearch(\n query: string,\n opts: UseEntitySearchOptions = {},\n queryOptions?: Omit<\n UseQueryOptions<\n EntitySearchResponse,\n Error,\n EntitySearchResponse,\n ReturnType<typeof sifaQueryKeys.entity.search>\n >,\n 'queryKey' | 'queryFn' | 'enabled'\n >,\n) {\n const config = useSifaConfig();\n const { limit = 5, debounceMs = 250, enabled = true } = opts;\n const debounced = useDebouncedValue(query.trim(), debounceMs);\n return useQuery({\n queryKey: sifaQueryKeys.entity.search(debounced, limit),\n queryFn: () => fetchEntitySearch(config, debounced, limit),\n enabled: enabled && debounced.length > 0,\n ...queryOptions,\n });\n}\n\n/** Mutation: record a selection (promote a PDL row or bump an entity). */\nexport function useSelectEntity(\n options?: Omit<\n UseMutationOptions<EntitySelectResponse, Error, EntitySelectRequest>,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n return useMutation({\n mutationFn: (body: EntitySelectRequest) => selectEntity(config, body),\n ...options,\n });\n}\n\n/** Mutation: grow-on-demand Wikidata import for a typeahead miss. */\nexport function useImportSearchEntities(\n options?: Omit<UseMutationOptions<EntitySearchResult[], Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n return useMutation({\n mutationFn: (query: string) => importSearchEntities(config, query),\n ...options,\n });\n}\n\n/**\n * Mutation: grow-on-demand by domain, Branch 1. Resolve a domain-shaped\n * typeahead miss to any notable company (Wikidata reverse P856). The response's\n * `canMint` flag drives the \"Add <domain>\" affordance.\n */\nexport function useResolveEntityDomain(\n options?: Omit<UseMutationOptions<EntityResolveDomainResponse, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n return useMutation({\n mutationFn: (domain: string) => resolveEntityDomain(config, domain),\n ...options,\n });\n}\n\n/**\n * Mutation: grow-on-demand by domain, Branch 2 (user-initiated). Mint a\n * crawled-tier entity from the domain's homepage. Rejects when the domain is not\n * mintable or the site yields nothing usable.\n */\nexport function useMintEntityDomain(\n options?: Omit<UseMutationOptions<EntityMintDomainResponse, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n return useMutation({\n mutationFn: (domain: string) => mintEntityDomain(config, domain),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchFeaturedProfile,\n fetchSimilarProfiles,\n fetchSuggestionCount,\n fetchSuggestions,\n type FeaturedProfile,\n type FetchSuggestionsOptions,\n type SimilarProfile,\n type SuggestionsResponse,\n} from '../fetchers/discovery.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nexport function useSimilarProfiles(\n did: string | undefined | null,\n opts: { limit?: number } = {},\n options?: Omit<\n UseQueryOptions<\n SimilarProfile[],\n Error,\n SimilarProfile[],\n ReturnType<typeof sifaQueryKeys.discovery.similar>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n const limit = opts.limit ?? 5;\n return useQuery({\n queryKey: sifaQueryKeys.discovery.similar(did ?? '', limit),\n queryFn: () => fetchSimilarProfiles(config, did ?? '', { limit }),\n enabled: Boolean(did) && (options?.enabled ?? true),\n ...options,\n });\n}\n\nexport function useSuggestions(\n opts: Omit<\n FetchSuggestionsOptions,\n keyof Omit<FetchSuggestionsOptions, 'source' | 'includeDismissed' | 'cursor' | 'limit'>\n > = {},\n options?: Omit<\n UseQueryOptions<\n SuggestionsResponse,\n Error,\n SuggestionsResponse,\n ReturnType<typeof sifaQueryKeys.discovery.suggestions>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.discovery.suggestions(opts as Record<string, unknown>),\n queryFn: () => fetchSuggestions(config, opts),\n ...options,\n });\n}\n\nexport function useSuggestionCount(\n since?: string,\n options?: Omit<\n UseQueryOptions<\n number,\n Error,\n number,\n ReturnType<typeof sifaQueryKeys.discovery.suggestionCount>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.discovery.suggestionCount(since),\n queryFn: () => fetchSuggestionCount(config, since),\n ...options,\n });\n}\n\nexport function useFeaturedProfile(\n options?: Omit<\n UseQueryOptions<\n FeaturedProfile | null,\n Error,\n FeaturedProfile | null,\n ReturnType<typeof sifaQueryKeys.discovery.featured>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.discovery.featured(),\n queryFn: () => fetchFeaturedProfile(config),\n ...options,\n });\n}\n","'use client';\n\nimport {\n useInfiniteQuery,\n useMutation,\n useQuery,\n useQueryClient,\n type InfiniteData,\n type UseInfiniteQueryOptions,\n type UseMutationOptions,\n type UseQueryOptions,\n} from '@tanstack/react-query';\n\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchFollowing,\n followUser,\n getFollowers,\n getFollowing,\n getFollowingFeed,\n unfollowUser,\n type FetchFollowListOptions,\n type FetchFollowingFeedOptions,\n type FollowListPage,\n type FollowProfile,\n type FollowUserResult,\n type FollowingResponse,\n} from '../fetchers/follow.js';\nimport type { FollowFeedPage } from '../../schemas/feed.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Legacy \"people I follow\" query. Kept as-is for back-compat with sifa-web\n * call sites that pre-date the V5 feed work. New code should use\n * {@link useFollowingList} (paginated per-profile) or\n * {@link useFollowingFeed} (V5 feed).\n */\nexport function useFollowing(\n opts: { source?: string; cursor?: string; limit?: number } = {},\n options?: Omit<\n UseQueryOptions<\n FollowingResponse,\n Error,\n FollowingResponse,\n ReturnType<typeof sifaQueryKeys.follow.following>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.follow.following(opts as Record<string, unknown>),\n queryFn: () => fetchFollowing(config, opts),\n ...options,\n });\n}\n\n/** Variables for {@link useFollow}. */\nexport interface FollowVariables {\n handle: string;\n /** Server-resolved DID of the subject, when known. Used for optimistic cache writes. */\n subjectDid?: string;\n /** Optional Sifa-only \"why I followed\" note (max 200 graphemes). */\n note?: string;\n}\n\n/** Variables for {@link useUnfollow}. */\nexport interface UnfollowVariables {\n handle: string;\n}\n\n/**\n * Mutation hook for following a handle. Optimistically marks the\n * follow-state cache as `true` and rolls back on failure (per\n * sifa-api#673 TR8 / iter-1 plan TR8). Invalidates the followers /\n * following lists and the V5 feed on success so they refetch.\n *\n * Optimistic cache entry: `sifaQueryKeys.follow.followers(handle)`\n * receives the viewer prepended to the list shape; the optimistic update\n * is intentionally conservative — it only flips per-handle state and\n * doesn't try to invent rich `FollowProfile` fields.\n */\nexport function useFollow(\n options?: Omit<UseMutationOptions<FollowUserResult, Error, FollowVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ handle, note }: FollowVariables) => followUser(config, handle, { note }),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.follow.all() });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n onError: async (error, variables, onMutateResult, context) => {\n // Rollback: refetch the affected lists so stale optimistic state is reset.\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.follow.all() });\n await options?.onError?.(error, variables, onMutateResult, context);\n },\n });\n}\n\n/**\n * Mutation hook for unfollowing a handle. Optimistic + rollback mirror\n * of {@link useFollow}.\n */\nexport function useUnfollow(\n options?: Omit<UseMutationOptions<WriteResult, Error, UnfollowVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ handle }: UnfollowVariables) => unfollowUser(config, handle),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.follow.all() });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n onError: async (error, variables, onMutateResult, context) => {\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.follow.all() });\n await options?.onError?.(error, variables, onMutateResult, context);\n },\n });\n}\n\n/** Infinite-query hook for `handle`'s followers list. */\nexport function useFollowers(\n handle: string,\n opts: Omit<FetchFollowListOptions, 'cursor'> = {},\n options?: Omit<\n UseInfiniteQueryOptions<\n FollowListPage,\n Error,\n InfiniteData<FollowListPage>,\n ReturnType<typeof sifaQueryKeys.follow.followers>,\n string | undefined\n >,\n 'queryKey' | 'queryFn' | 'initialPageParam' | 'getNextPageParam'\n >,\n) {\n const config = useSifaConfig();\n return useInfiniteQuery({\n queryKey: sifaQueryKeys.follow.followers(handle),\n queryFn: ({ pageParam }) => getFollowers(config, handle, { ...opts, cursor: pageParam }),\n initialPageParam: undefined as string | undefined,\n getNextPageParam: (lastPage: FollowListPage) => lastPage.cursor ?? undefined,\n enabled: handle.length > 0,\n ...options,\n });\n}\n\n/** Infinite-query hook for who `handle` follows. */\nexport function useFollowingList(\n handle: string,\n opts: Omit<FetchFollowListOptions, 'cursor'> = {},\n options?: Omit<\n UseInfiniteQueryOptions<\n FollowListPage,\n Error,\n InfiniteData<FollowListPage>,\n ReturnType<typeof sifaQueryKeys.follow.followingOf>,\n string | undefined\n >,\n 'queryKey' | 'queryFn' | 'initialPageParam' | 'getNextPageParam'\n >,\n) {\n const config = useSifaConfig();\n return useInfiniteQuery({\n queryKey: sifaQueryKeys.follow.followingOf(handle),\n queryFn: ({ pageParam }) => getFollowing(config, handle, { ...opts, cursor: pageParam }),\n initialPageParam: undefined as string | undefined,\n getNextPageParam: (lastPage: FollowListPage) => lastPage.cursor ?? undefined,\n enabled: handle.length > 0,\n ...options,\n });\n}\n\n/**\n * Infinite-query hook for the V5 home feed (authenticated viewer).\n *\n * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).\n * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere\n * Stream are two distinct surfaces with different data paths (Barazo API\n * for Timeline, live PDS reads + Valkey for Stream). This hook is no\n * longer consumed. Scheduled for removal in next major bump.\n */\nexport function useFollowingFeed(\n opts: Omit<FetchFollowingFeedOptions, 'cursor'> = {},\n options?: Omit<\n UseInfiniteQueryOptions<\n FollowFeedPage,\n Error,\n InfiniteData<FollowFeedPage>,\n ReturnType<typeof sifaQueryKeys.follow.feed>,\n string | undefined\n >,\n 'queryKey' | 'queryFn' | 'initialPageParam' | 'getNextPageParam'\n >,\n) {\n const config = useSifaConfig();\n // Drop AbortSignal/fetch-only fields from the key so cache identity stays stable across renders.\n const keyOpts: Record<string, unknown> = {\n limit: opts.limit,\n categories: opts.categories,\n };\n return useInfiniteQuery({\n queryKey: sifaQueryKeys.follow.feed(keyOpts),\n queryFn: ({ pageParam }) => getFollowingFeed(config, { ...opts, cursor: pageParam }),\n initialPageParam: undefined as string | undefined,\n getNextPageParam: (lastPage: FollowFeedPage) => lastPage.cursor ?? undefined,\n ...options,\n });\n}\n\n// Re-export for convenience so consumers only need one import path for the type.\nexport type { FollowProfile };\n","'use client';\n\nimport {\n useInfiniteQuery,\n type InfiniteData,\n type UseInfiniteQueryOptions,\n} from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n getBlueskySuggestions,\n getMutuals,\n type FetchFollowProfilePageOptions,\n type FollowProfilePageResponse,\n} from '../fetchers/follow-extras.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Infinite-query hook for the mutuals list of `handleOrDid`. Backed by\n * {@link getMutuals} (`GET /api/profile/{handleOrDid}/mutuals`). Disabled\n * when `handleOrDid` is empty so component-mount with a lazy handle doesn't\n * fire a wasted request.\n */\nexport function useMutuals(\n handleOrDid: string,\n opts: Omit<FetchFollowProfilePageOptions, 'cursor'> = {},\n options?: Omit<\n UseInfiniteQueryOptions<\n FollowProfilePageResponse,\n Error,\n InfiniteData<FollowProfilePageResponse>,\n ReturnType<typeof sifaQueryKeys.follow.mutuals>,\n string | undefined\n >,\n 'queryKey' | 'queryFn' | 'initialPageParam' | 'getNextPageParam'\n >,\n) {\n const config = useSifaConfig();\n return useInfiniteQuery({\n queryKey: sifaQueryKeys.follow.mutuals(handleOrDid),\n queryFn: ({ pageParam }) => getMutuals(config, handleOrDid, { ...opts, cursor: pageParam }),\n initialPageParam: undefined as string | undefined,\n getNextPageParam: (lastPage: FollowProfilePageResponse) => lastPage.cursor ?? undefined,\n enabled: handleOrDid.length > 0,\n ...options,\n });\n}\n\n/**\n * Infinite-query hook for the authenticated viewer's Bluesky-follow\n * suggestions (people the viewer follows on Bluesky but not Sifa).\n * Backed by {@link getBlueskySuggestions}.\n */\nexport function useBlueskySuggestions(\n opts: Omit<FetchFollowProfilePageOptions, 'cursor'> = {},\n options?: Omit<\n UseInfiniteQueryOptions<\n FollowProfilePageResponse,\n Error,\n InfiniteData<FollowProfilePageResponse>,\n ReturnType<typeof sifaQueryKeys.follow.blueskySuggestions>,\n string | undefined\n >,\n 'queryKey' | 'queryFn' | 'initialPageParam' | 'getNextPageParam'\n >,\n) {\n const config = useSifaConfig();\n return useInfiniteQuery({\n queryKey: sifaQueryKeys.follow.blueskySuggestions(),\n queryFn: ({ pageParam }) => getBlueskySuggestions(config, { ...opts, cursor: pageParam }),\n initialPageParam: undefined as string | undefined,\n getNextPageParam: (lastPage: FollowProfilePageResponse) => lastPage.cursor ?? undefined,\n ...options,\n });\n}\n","'use client';\n\nimport {\n useMutation,\n useQuery,\n useQueryClient,\n type UseMutationOptions,\n type UseQueryOptions,\n} from '@tanstack/react-query';\n\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n addFeatureAllowlist,\n listFeatureAllowlist,\n removeFeatureAllowlist,\n type FeatureAllowlistResponse,\n} from '../fetchers/admin-feature-allowlists.js';\nimport type { FeatureAllowlistEntry, FeatureFlag } from '../../schemas/follow-profile.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Read hook for the admin allowlist of a given feature flag. Admin-gated on\n * the server; non-admins get an empty list (the fetcher swallows 403).\n */\nexport function useFeatureAllowlist(\n flag: FeatureFlag,\n options?: Omit<\n UseQueryOptions<\n FeatureAllowlistResponse,\n Error,\n FeatureAllowlistResponse,\n ReturnType<typeof sifaQueryKeys.admin.featureAllowlist>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.admin.featureAllowlist(flag),\n queryFn: () => listFeatureAllowlist(config, flag),\n ...options,\n });\n}\n\n/** Snapshot of the previous cache entry; returned from `onMutate` for rollback. */\ninterface AllowlistMutationContext {\n previous: FeatureAllowlistResponse | undefined;\n}\n\n/** Variables for {@link useAddFeatureAllowlist}. */\nexport interface AddFeatureAllowlistVariables {\n did: string;\n note?: string;\n}\n\n/**\n * Mutation hook to add (or upsert) a DID on the given flag's allowlist.\n * Optimistically prepends a synthesized entry to the cache so admin UIs feel\n * instant; rolls back if the server reports failure.\n */\nexport function useAddFeatureAllowlist(\n flag: FeatureFlag,\n options?: Omit<\n UseMutationOptions<WriteResult, Error, AddFeatureAllowlistVariables, AllowlistMutationContext>,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n const key = sifaQueryKeys.admin.featureAllowlist(flag);\n\n return useMutation<WriteResult, Error, AddFeatureAllowlistVariables, AllowlistMutationContext>({\n mutationFn: ({ did, note }) => addFeatureAllowlist(config, flag, did, { note }),\n onMutate: async ({ did, note }) => {\n await queryClient.cancelQueries({ queryKey: key });\n const previous = queryClient.getQueryData<FeatureAllowlistResponse>(key);\n const optimisticEntry: FeatureAllowlistEntry = {\n did,\n addedAt: new Date().toISOString(),\n note: note ?? null,\n };\n const next: FeatureAllowlistResponse = previous\n ? { items: [optimisticEntry, ...previous.items.filter((e) => e.did !== did)] }\n : { items: [optimisticEntry] };\n queryClient.setQueryData<FeatureAllowlistResponse>(key, next);\n return { previous };\n },\n onSuccess: async (result, variables, onMutateResult, context) => {\n // The fetcher's never-throws contract (see {@link apiWrite}) means a\n // server-side failure surfaces here as `result.success === false`, not\n // as an `onError`. Roll back the optimistic insert in that case.\n if (!result.success && onMutateResult?.previous) {\n queryClient.setQueryData(key, onMutateResult.previous);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n onError: async (error, variables, onMutateResult, context) => {\n if (onMutateResult?.previous) {\n queryClient.setQueryData(key, onMutateResult.previous);\n }\n await options?.onError?.(error, variables, onMutateResult, context);\n },\n onSettled: async (result, error, variables, onMutateResult, context) => {\n await queryClient.invalidateQueries({ queryKey: key });\n await options?.onSettled?.(result, error, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/** Variables for {@link useRemoveFeatureAllowlist}. */\nexport interface RemoveFeatureAllowlistVariables {\n did: string;\n}\n\n/**\n * Mutation hook to remove a DID from the given flag's allowlist.\n * Optimistically removes the row from the cache; rolls back if the server\n * reports failure.\n */\nexport function useRemoveFeatureAllowlist(\n flag: FeatureFlag,\n options?: Omit<\n UseMutationOptions<\n WriteResult,\n Error,\n RemoveFeatureAllowlistVariables,\n AllowlistMutationContext\n >,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n const key = sifaQueryKeys.admin.featureAllowlist(flag);\n\n return useMutation<WriteResult, Error, RemoveFeatureAllowlistVariables, AllowlistMutationContext>(\n {\n mutationFn: ({ did }) => removeFeatureAllowlist(config, flag, did),\n onMutate: async ({ did }) => {\n await queryClient.cancelQueries({ queryKey: key });\n const previous = queryClient.getQueryData<FeatureAllowlistResponse>(key);\n if (previous) {\n queryClient.setQueryData<FeatureAllowlistResponse>(key, {\n items: previous.items.filter((e) => e.did !== did),\n });\n }\n return { previous };\n },\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (!result.success && onMutateResult?.previous) {\n queryClient.setQueryData(key, onMutateResult.previous);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n onError: async (error, variables, onMutateResult, context) => {\n if (onMutateResult?.previous) {\n queryClient.setQueryData(key, onMutateResult.previous);\n }\n await options?.onError?.(error, variables, onMutateResult, context);\n },\n onSettled: async (result, error, variables, onMutateResult, context) => {\n await queryClient.invalidateQueries({ queryKey: key });\n await options?.onSettled?.(result, error, variables, onMutateResult, context);\n },\n ...options,\n },\n );\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport { getAdminReviewQueues, type AdminReviewQueues } from '../fetchers/admin-review-queues.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/** Default staleness for the queue counts, matching the API cache TTL. */\nconst REVIEW_QUEUES_STALE_TIME_MS = 60_000;\n\n/**\n * Read hook for the open counts of the three admin review queues. Shared by\n * the admin nav pill and the review-queues page so both render one number\n * from one request.\n *\n * Admin-gated on the server; non-admins get an error rather than zeroes.\n */\nexport function useAdminReviewQueues(\n options?: Omit<\n UseQueryOptions<\n AdminReviewQueues,\n Error,\n AdminReviewQueues,\n ReturnType<typeof sifaQueryKeys.admin.reviewQueues>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.admin.reviewQueues(),\n queryFn: () => getAdminReviewQueues(config),\n staleTime: REVIEW_QUEUES_STALE_TIME_MS,\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchActivityFeed,\n fetchActivityTeaser,\n fetchHeatmapData,\n type ActivityFeedResponse,\n type ActivityTeaserResponse,\n type FetchActivityFeedOptions,\n type HeatmapResponse,\n} from '../fetchers/activity.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nexport function useHeatmapData(\n handleOrDid: string | undefined | null,\n days: number,\n options?: Omit<\n UseQueryOptions<\n HeatmapResponse | null,\n Error,\n HeatmapResponse | null,\n ReturnType<typeof sifaQueryKeys.activity.heatmap>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.activity.heatmap(handleOrDid ?? '', days),\n queryFn: () => fetchHeatmapData(config, handleOrDid ?? '', days),\n enabled: Boolean(handleOrDid) && (options?.enabled ?? true),\n ...options,\n });\n}\n\nexport function useActivityTeaser(\n handleOrDid: string | undefined | null,\n options?: Omit<\n UseQueryOptions<\n ActivityTeaserResponse | null,\n Error,\n ActivityTeaserResponse | null,\n ReturnType<typeof sifaQueryKeys.activity.teaser>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.activity.teaser(handleOrDid ?? ''),\n queryFn: () => fetchActivityTeaser(config, handleOrDid ?? ''),\n enabled: Boolean(handleOrDid) && (options?.enabled ?? true),\n ...options,\n });\n}\n\nexport function useActivityFeed(\n handleOrDid: string | undefined | null,\n opts: Pick<FetchActivityFeedOptions, 'category' | 'limit' | 'cursor'> = {},\n options?: Omit<\n UseQueryOptions<\n ActivityFeedResponse | null,\n Error,\n ActivityFeedResponse | null,\n ReturnType<typeof sifaQueryKeys.activity.feed>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.activity.feed(handleOrDid ?? '', opts as Record<string, unknown>),\n queryFn: () => fetchActivityFeed(config, handleOrDid ?? '', opts),\n enabled: Boolean(handleOrDid) && (options?.enabled ?? true),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchMyGithubPullRequests,\n type MyGithubPullRequestsResponse,\n} from '../fetchers/github-prs.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nexport interface UseMyGithubPullRequestsParams {\n limit?: number;\n offset?: number;\n}\n\n/**\n * The authenticated viewer's own ingested merged PRs (newest first). Auth-scoped\n * via the session cookie. Backs the sifa-web GitHub importer (issue #302).\n */\nexport function useMyGithubPullRequests(\n params: UseMyGithubPullRequestsParams = {},\n options?: Omit<\n UseQueryOptions<\n MyGithubPullRequestsResponse,\n Error,\n MyGithubPullRequestsResponse,\n ReturnType<typeof sifaQueryKeys.github.myPullRequests>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.github.myPullRequests(params),\n queryFn: () => fetchMyGithubPullRequests(config, params),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport { fetchEndorsementCount } from '../fetchers/endorsement.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/** Count of confirmed endorsements for a DID. Returns 0 on error. */\nexport function useEndorsementCount(\n did: string | undefined | null,\n options?: Omit<\n UseQueryOptions<number, Error, number, ReturnType<typeof sifaQueryKeys.endorsement.count>>,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.endorsement.count(did ?? ''),\n queryFn: () => fetchEndorsementCount(config, did ?? ''),\n enabled: Boolean(did) && (options?.enabled ?? true),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport { fetchNetworkStreamCount } from '../fetchers/stream.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Count of items in the authenticated user's network stream digest.\n * Returns 0 on error (including when the endpoint isn't yet shipped).\n */\nexport function useNetworkStreamCount(\n did: string | undefined | null,\n options?: Omit<\n UseQueryOptions<number, Error, number, ReturnType<typeof sifaQueryKeys.stream.networkCount>>,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.stream.networkCount(did ?? ''),\n queryFn: () => fetchNetworkStreamCount(config, did ?? ''),\n enabled: Boolean(did) && (options?.enabled ?? true),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n checkAppAccount,\n fetchReactionStatus,\n type AccountCheckResult,\n type ReactionStatus,\n} from '../fetchers/reactions.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Batch-look up reaction status for multiple URIs. Skips the network call\n * when `uris` is empty.\n */\nexport function useReactionStatus(\n uris: string[],\n options?: Omit<\n UseQueryOptions<\n Record<string, ReactionStatus> | null,\n Error,\n Record<string, ReactionStatus> | null,\n ReturnType<typeof sifaQueryKeys.reactions.status>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.reactions.status(uris),\n queryFn: () => fetchReactionStatus(config, uris),\n ...options,\n });\n}\n\n/** Check whether the authenticated viewer has an account on the given app. */\nexport function useAppAccountCheck(\n appId: string | undefined | null,\n options?: Omit<\n UseQueryOptions<\n AccountCheckResult | null,\n Error,\n AccountCheckResult | null,\n ReturnType<typeof sifaQueryKeys.reactions.accountCheck>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.reactions.accountCheck(appId ?? ''),\n queryFn: () => checkAppAccount(config, appId ?? ''),\n enabled: Boolean(appId) && (options?.enabled ?? true),\n ...options,\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n createReaction,\n deleteReaction,\n type ReactionError,\n type ReactionResult,\n} from '../fetchers/reactions.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/** Variables for {@link useCreateReaction}. */\nexport interface CreateReactionVariables {\n targetUri: string;\n appId: string;\n targetCid?: string;\n}\n\ntype CreateReactionMutationResult =\n { ok: true; data: ReactionResult } | { ok: false; error: ReactionError };\n\n/**\n * React hook for creating a reaction. Returns the discriminated-union\n * result so the caller can detect `scope_insufficient` and trigger an\n * OAuth scope-upgrade flow.\n *\n * Invalidates the entire `sifaQueryKeys.reactions.all()` subtree on\n * success (any cached `useReactionStatus` view that includes the new\n * URI needs a refresh).\n */\nexport function useCreateReaction(\n options?: Omit<\n UseMutationOptions<CreateReactionMutationResult, Error, CreateReactionVariables>,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ targetUri, appId, targetCid }: CreateReactionVariables) =>\n createReaction(config, targetUri, appId, targetCid),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.ok) {\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.reactions.all() });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** Variables for {@link useDeleteReaction}. */\nexport interface DeleteReactionVariables {\n targetUri: string;\n appId: string;\n}\n\n/** React hook for deleting a reaction. */\nexport function useDeleteReaction(\n options?: Omit<UseMutationOptions<WriteResult, Error, DeleteReactionVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ targetUri, appId }: DeleteReactionVariables) =>\n deleteReaction(config, targetUri, appId),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.reactions.all() });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchMyRoadmapVotes,\n fetchRoadmapVotes,\n type RoadmapVotesResponse,\n} from '../fetchers/roadmap.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/** Public roadmap vote tallies. Returns `{}` data on error. */\nexport function useRoadmapVotes(\n options?: Omit<\n UseQueryOptions<\n RoadmapVotesResponse,\n Error,\n RoadmapVotesResponse,\n ReturnType<typeof sifaQueryKeys.roadmap.votes>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.roadmap.votes(),\n queryFn: () => fetchRoadmapVotes(config),\n ...options,\n });\n}\n\n/** Roadmap items the authenticated viewer has voted on. Returns `[]` data on error. */\nexport function useMyRoadmapVotes(\n options?: Omit<\n UseQueryOptions<string[], Error, string[], ReturnType<typeof sifaQueryKeys.roadmap.myVotes>>,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.roadmap.myVotes(),\n queryFn: () => fetchMyRoadmapVotes(config),\n ...options,\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n castRoadmapVote,\n retractRoadmapVote,\n type CastRoadmapVoteResult,\n} from '../fetchers/roadmap.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateRoadmap(queryClient: ReturnType<typeof useQueryClient>): Promise<void> {\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.roadmap.all() });\n}\n\n/**\n * React hook for casting a roadmap vote. Variable: the item key.\n *\n * Returns the discriminated-union result so callers can detect\n * `scope_insufficient` and trigger an OAuth scope-upgrade flow\n * (see {@link castRoadmapVote}).\n */\nexport function useCastRoadmapVote(\n options?: Omit<UseMutationOptions<CastRoadmapVoteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (key: string) => castRoadmapVote(config, key),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.ok) {\n await invalidateRoadmap(queryClient);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for retracting a previously-cast roadmap vote. */\nexport function useRetractRoadmapVote(\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (key: string) => retractRoadmapVote(config, key),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateRoadmap(queryClient);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport {\n useMutation,\n useQuery,\n useQueryClient,\n type UseMutationOptions,\n type UseQueryOptions,\n} from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n deleteAccount,\n fetchWipePreview,\n resetProfile,\n type DeleteAccountResult,\n type ResetProfileResult,\n type WipePreview,\n} from '../fetchers/destructive.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Read which id.sifa.* collections the current grant cannot delete, so a\n * delete-account UI can ask for the missing scope BEFORE the destructive step.\n *\n * Not cached: the whole point is to reflect the grant as it stands right now,\n * and the grant changes underneath this hook when the user returns from the\n * consent screen. A stale \"no gaps\" here is the failure this exists to prevent.\n */\nexport function useWipePreview(\n options?: Omit<\n UseQueryOptions<\n WipePreview,\n Error,\n WipePreview,\n ReturnType<typeof sifaQueryKeys.destructive.wipePreview>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.destructive.wipePreview(),\n queryFn: () => fetchWipePreview(config),\n staleTime: 0,\n gcTime: 0,\n ...options,\n });\n}\n\n/**\n * React hook for resetting the authenticated user's Sifa profile.\n * Variable: `deletePdsData` boolean.\n *\n * Invalidates the entire `sifaQueryKeys.all()` subtree on success\n * (everything Sifa-related needs a refresh after a reset).\n */\nexport function useResetProfile(\n options?: Omit<UseMutationOptions<ResetProfileResult, Error, boolean>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (deletePdsData: boolean) => resetProfile(config, deletePdsData),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.all() });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/**\n * React hook for deleting the authenticated user's account. Variable:\n * `deletePdsData` boolean. Returns the deleted handle on success.\n *\n * On success, clears the entire query cache (the user is logged out\n * and nothing they previously cached should be retained).\n */\nexport function useDeleteAccount(\n options?: Omit<UseMutationOptions<DeleteAccountResult, Error, boolean>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (deletePdsData: boolean) => deleteAccount(config, deletePdsData),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n queryClient.clear();\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport {\n useMutation,\n useQuery,\n useQueryClient,\n type UseMutationOptions,\n type UseQueryOptions,\n} from '@tanstack/react-query';\n\nimport type { RepoDeleteResult, RepoInventory } from '../../repo/types.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n deleteRepoRecords,\n fetchRepoInventory,\n type RepoDeleteInput,\n} from '../fetchers/repo-inventory.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Read the id.sifa.* records in the authenticated user's repo.\n *\n * Not cached client-side: this is a page about what exists right now, and a\n * user who deletes a record, navigates away and comes back must not be shown\n * it again from cache. The server caches the PDS read briefly, which is where\n * that cost belongs.\n */\nexport function useRepoInventory(\n options?: Omit<\n UseQueryOptions<\n RepoInventory,\n Error,\n RepoInventory,\n ReturnType<typeof sifaQueryKeys.repoInventory.list>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.repoInventory.list(),\n queryFn: () => fetchRepoInventory(config),\n staleTime: 0,\n gcTime: 0,\n ...options,\n });\n}\n\n/**\n * Delete records from the authenticated user's repo.\n *\n * Invalidates the whole Sifa key subtree, not just the inventory: the records\n * being removed are the ones the profile is built from, so anything showing\n * profile content is stale the moment this succeeds.\n */\nexport function useDeleteRepoRecords(\n options?: Omit<\n UseMutationOptions<\n RepoDeleteResult & { success: boolean; error?: string },\n Error,\n RepoDeleteInput\n >,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (input: RepoDeleteInput) => deleteRepoRecords(config, input),\n onSuccess: async (result, variables, onMutateResult, context) => {\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.all() });\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","/**\n * Adult-content gating for Bluesky activity items.\n *\n * Bluesky's official moderation labeler attaches content labels to\n * `app.bsky.feed.defs#postView.labels`. The four sex-and-violence labels\n * below are the ones we hide by default on Sifa: media is replaced with an\n * `<AdultContentWarning>` placeholder card in sifa-web. Authenticated\n * viewers can reveal per-card; anonymous viewers cannot.\n *\n * The list mirrors Bluesky's own globalLabelStrings; if the official set\n * grows (e.g. a new `extreme-violence` label), update this constant.\n *\n * Why a constant + predicate live in the SDK: the same logic needs to run\n * in sifa-web today and sifa-app tomorrow, and the API only forwards the\n * raw labels — the hide decision is a client concern.\n */\n\nexport const ADULT_CONTENT_LABELS = ['porn', 'sexual', 'nudity', 'graphic-media'] as const;\n\nexport type AdultContentLabel = (typeof ADULT_CONTENT_LABELS)[number];\n\n/**\n * A single label entry as emitted by `app.bsky.feed.defs#postView.labels`.\n * Matches `com.atproto.label.defs#label` (the on-wire shape after the AppView\n * resolves a `postView`). `neg: true` marks a retraction.\n */\nexport interface ActivityLabel {\n val: string;\n src: string;\n uri: string;\n cts?: string;\n neg?: boolean;\n}\n\n/**\n * Return true if the item carries at least one adult-content label that is\n * not negated. Items without a `labels` field (every non-Bluesky source,\n * legacy responses) are treated as safe.\n */\nexport function hasAdultContent(item: { labels?: ActivityLabel[] }): boolean {\n const labels = item.labels;\n if (!labels || labels.length === 0) return false;\n return labels.some(\n (label) => !label.neg && (ADULT_CONTENT_LABELS as readonly string[]).includes(label.val),\n );\n}\n","import { ADULT_CONTENT_LABELS, type AdultContentLabel } from '../../cards/adult-content.js';\nimport {\n apiFetch,\n apiWrite,\n type ApiFetchOptions,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/**\n * Visibility values defined by `app.bsky.actor.defs#contentLabelPref`.\n * `null` means the viewer has no explicit pref for that label — call sites\n * decide a default (Sifa hides by default; Bluesky's own client defaults\n * to `warn` for adult labels on new accounts).\n */\nexport type BskyContentLabelVisibility = 'ignore' | 'warn' | 'hide';\n\nexport type BskyContentLabelPrefs = Record<AdultContentLabel, BskyContentLabelVisibility | null>;\n\nexport interface BskyContentLabelPrefsResponse {\n contentLabels: BskyContentLabelPrefs;\n}\n\nexport interface BskyPrefsScopeError {\n error: 'InsufficientScope';\n message?: string;\n needsScope: 'bsky-preferences';\n}\n\n/**\n * Read the viewer's Bluesky content-label preferences via sifa-api's\n * proxy. Returns `null` when the viewer's OAuth grant doesn't include the\n * read scope — sifa-web treats this as \"needs scope upgrade\" and triggers\n * a granular re-auth.\n *\n * Any other failure (network, upstream PDS error) also resolves to `null`\n * so callers always have a safe default (hide everything).\n */\nexport async function fetchBskyContentLabelPrefs(\n config: SifaApiConfig,\n options: ApiFetchOptions & { onNeedsScope?: () => void } = {},\n): Promise<BskyContentLabelPrefs | null> {\n const { onNeedsScope, ...fetchOptions } = options;\n try {\n const res = await apiFetch<BskyContentLabelPrefsResponse>(\n config,\n '/api/bsky/preferences/content-labels',\n { credentials: 'include', ...fetchOptions },\n );\n return res.contentLabels;\n } catch (err) {\n if (\n err &&\n typeof err === 'object' &&\n 'status' in err &&\n (err as { status: number }).status === 403\n ) {\n onNeedsScope?.();\n }\n return null;\n }\n}\n\nexport interface UpdateBskyContentLabelPrefsBody {\n contentLabels: Array<{\n label: AdultContentLabel;\n visibility: BskyContentLabelVisibility;\n }>;\n}\n\n/**\n * Update one or more of the viewer's adult content-label preferences. The\n * sifa-api endpoint merges these into the viewer's existing prefs and\n * writes the whole array back to their PDS — entries we don't touch are\n * preserved.\n *\n * On insufficient-scope returns `{ success: false, error: ..., needsScope }`\n * so the caller can drive a granular re-auth.\n */\nexport async function updateBskyContentLabelPrefs(\n config: SifaApiConfig,\n body: UpdateBskyContentLabelPrefsBody,\n): Promise<\n WriteResult & { contentLabels?: BskyContentLabelPrefs; needsScope?: 'bsky-preferences' }\n> {\n const result = await apiWrite<{\n contentLabels?: BskyContentLabelPrefs;\n needsScope?: 'bsky-preferences';\n }>(config, '/api/bsky/preferences/content-labels', 'PUT', {\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(body),\n });\n return result;\n}\n\n/**\n * Compute the effective visibility for a Bluesky adult label.\n *\n * - Anonymous viewer (no prefs): always `hide` — matches Bluesky's logged-out\n * behaviour; sifa-web won't even render a Show button.\n * - Authenticated viewer with no explicit pref: `hide` by default, so Sifa\n * stays safe-by-default and matches the gate that ships in sifa-web#1240\n * today.\n * - Authenticated viewer with an explicit pref: use it directly.\n *\n * Returns `'ignore'` to mean \"render media inline\", `'warn'` and `'hide'`\n * both mean \"placeholder card + reveal button\" — Sifa doesn't distinguish\n * the two today, but keeping them separate matches the lexicon and lets the\n * UI evolve (e.g. blur for warn, full hide for hide) without an SDK change.\n */\nexport function effectiveContentVisibility(\n label: AdultContentLabel,\n prefs: BskyContentLabelPrefs | null,\n isAuthenticated: boolean,\n): BskyContentLabelVisibility {\n if (!isAuthenticated) return 'hide';\n const value = prefs?.[label] ?? null;\n return value ?? 'hide';\n}\n\n/**\n * Whether a labeled item should render its media inline. Convenience over\n * `effectiveContentVisibility` for the common \"any adult label hides\n * everything\" case in BlueskyPostCard.\n */\nexport function shouldGateAdultMedia(\n labels: ReadonlyArray<{ val: string; neg?: boolean }> | undefined,\n prefs: BskyContentLabelPrefs | null,\n isAuthenticated: boolean,\n): boolean {\n if (!labels || labels.length === 0) return false;\n for (const label of labels) {\n if (label.neg) continue;\n if (!(ADULT_CONTENT_LABELS as readonly string[]).includes(label.val)) continue;\n const visibility = effectiveContentVisibility(\n label.val as AdultContentLabel,\n prefs,\n isAuthenticated,\n );\n if (visibility !== 'ignore') return true;\n }\n return false;\n}\n","'use client';\n\nimport { useMutation, useQuery, useQueryClient, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchBskyContentLabelPrefs,\n updateBskyContentLabelPrefs,\n type BskyContentLabelPrefs,\n type UpdateBskyContentLabelPrefsBody,\n} from '../fetchers/bsky-preferences.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Read the viewer's Bluesky adult content-label preferences. The fetcher\n * returns `null` when the OAuth grant doesn't include the read scope\n * (sifa-api responds 403 with `needsScope: 'bsky-preferences'`); call\n * sites should treat `null` as \"needs scope upgrade\" and route through\n * the granular re-auth flow before retrying.\n *\n * Pass `enabled: false` for anonymous viewers — TanStack will skip the\n * fetch entirely and the gate will fall through to its default-hide path.\n */\nexport function useBskyContentLabelPrefs(\n options?: Omit<\n UseQueryOptions<\n BskyContentLabelPrefs | null,\n Error,\n BskyContentLabelPrefs | null,\n ReturnType<typeof sifaQueryKeys.bskyPreferences.contentLabels>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.bskyPreferences.contentLabels(),\n queryFn: () => fetchBskyContentLabelPrefs(config),\n // Prefs change rarely; long stale time keeps the gate snappy on\n // navigation. Invalidation after a write is explicit.\n staleTime: 5 * 60_000,\n ...options,\n });\n}\n\n/**\n * Mutation that updates one or more adult-content prefs on the viewer's\n * PDS via sifa-api, then writes the merged result back into the prefs\n * cache so the next render reflects the change without a refetch.\n */\nexport function useUpdateBskyContentLabelPrefs() {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (body: UpdateBskyContentLabelPrefsBody) =>\n updateBskyContentLabelPrefs(config, body),\n onSuccess: (result) => {\n if (result.success && result.contentLabels) {\n queryClient.setQueryData<BskyContentLabelPrefs | null>(\n sifaQueryKeys.bskyPreferences.contentLabels(),\n result.contentLabels,\n );\n } else {\n // Even on failure, drop the cached value so the next read tries\n // again — a 403 might mean a fresh scope grant succeeded but the\n // local cache still reflects the pre-grant state.\n void queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.bskyPreferences.all(),\n });\n }\n },\n });\n}\n","import { apiWrite, type ApiFetchOptions, type SifaApiConfig, type WriteResult } from '../client.js';\nimport type { OrgClaimRequestInput } from '../../schemas/write/org-claim.js';\nimport type {\n OrgDomainChallengeRequestInput,\n OrgDomainVerifyRequestInput,\n OrgNotificationEmailRequestInput,\n OrgProfileUpdateRequestInput,\n} from '../../schemas/write/org-settings.js';\n\n/** How a single entity binding was resolved during a claim. */\nexport interface OrgClaimBinding {\n entityId: number;\n entityRef: string;\n validatedBy: string | null;\n status: 'active' | 'pending';\n dissolved: boolean;\n}\n\n/** The public org-profile echo returned by claim / update endpoints (no `contact`). */\nexport interface OrgProfileEcho {\n name: string;\n description: string | null;\n website: string | null;\n entityRefs: string[];\n}\n\n/** Response body of `POST /api/org/claim`. */\nexport interface OrgClaimResult {\n orgDid: string;\n status: 'active' | 'review';\n bindings: OrgClaimBinding[];\n orgProfile: OrgProfileEcho;\n}\n\n/** Response body of `PUT /api/org/profile`. */\nexport interface OrgProfileUpdateResult {\n ok: boolean;\n orgProfile: OrgProfileEcho;\n}\n\n/** Response body of `POST /api/org/domains/challenge`. */\nexport interface OrgDomainChallengeResult {\n domain: string;\n txtRecordName: string;\n txtRecordValue: string;\n}\n\n/** Response body of `POST /api/org/domains/verify` (happy path). */\nexport interface OrgDomainVerifyResult {\n status: 'verified' | 'pending';\n domain: string;\n}\n\n/** Response body of `POST /api/org/notification-emails`. */\nexport interface OrgNotificationEmailAddResult {\n ok: boolean;\n status: string;\n}\n\n/** Response body of `DELETE /api/org/notification-emails`. */\nexport interface OrgNotificationEmailRemoveResult {\n ok: boolean;\n removed: number;\n}\n\n/**\n * Finalize an org profile claim (`POST /api/org/claim`). Auth-gated (org-claim\n * JIT scope) and floor-checked server-side. Never throws -- returns the\n * structured {@link OrgClaimResult} folded into a {@link WriteResult} on success,\n * or `{ success: false, error, pdsHost? }` on failure.\n */\nexport function submitOrgClaim(\n config: SifaApiConfig,\n body: OrgClaimRequestInput,\n options: Omit<ApiFetchOptions, 'method' | 'body'> = {},\n): Promise<WriteResult & Partial<OrgClaimResult>> {\n return apiWrite<Partial<OrgClaimResult>>(config, '/api/org/claim', 'POST', { body, ...options });\n}\n\n/**\n * Edit the org record (`PUT /api/org/profile`). Fresh-from-body server-side PUT\n * (a cleared optional field is dropped, no spread-merge). Never throws.\n */\nexport function updateOrgProfile(\n config: SifaApiConfig,\n body: OrgProfileUpdateRequestInput,\n options: Omit<ApiFetchOptions, 'method' | 'body'> = {},\n): Promise<WriteResult & Partial<OrgProfileUpdateResult>> {\n return apiWrite<Partial<OrgProfileUpdateResult>>(config, '/api/org/profile', 'PUT', {\n body,\n ...options,\n });\n}\n\n/**\n * Issue a one-time DNS TXT domain challenge (`POST /api/org/domains/challenge`).\n * Returns the TXT record name + value the org must publish. Never throws.\n */\nexport function requestOrgDomainChallenge(\n config: SifaApiConfig,\n body: OrgDomainChallengeRequestInput,\n options: Omit<ApiFetchOptions, 'method' | 'body'> = {},\n): Promise<WriteResult & Partial<OrgDomainChallengeResult>> {\n return apiWrite<Partial<OrgDomainChallengeResult>>(config, '/api/org/domains/challenge', 'POST', {\n body,\n ...options,\n });\n}\n\n/**\n * Verify a DNS TXT domain challenge (`POST /api/org/domains/verify`). On success\n * `status` is `verified` or `pending`. Expired / confusable / not-found map to\n * non-2xx server responses and surface as `{ success: false, error }`. Never\n * throws.\n */\nexport function verifyOrgDomain(\n config: SifaApiConfig,\n body: OrgDomainVerifyRequestInput,\n options: Omit<ApiFetchOptions, 'method' | 'body'> = {},\n): Promise<WriteResult & Partial<OrgDomainVerifyResult>> {\n return apiWrite<Partial<OrgDomainVerifyResult>>(config, '/api/org/domains/verify', 'POST', {\n body,\n ...options,\n });\n}\n\n/**\n * Add an org notification email (`POST /api/org/notification-emails`). The\n * address must use a domain the org controls (checked server-side). An\n * individual verification email is enqueued through the (dormant) sending\n * pipeline. Never throws.\n */\nexport function addOrgNotificationEmail(\n config: SifaApiConfig,\n body: OrgNotificationEmailRequestInput,\n options: Omit<ApiFetchOptions, 'method' | 'body'> = {},\n): Promise<WriteResult & Partial<OrgNotificationEmailAddResult>> {\n return apiWrite<Partial<OrgNotificationEmailAddResult>>(\n config,\n '/api/org/notification-emails',\n 'POST',\n { body, ...options },\n );\n}\n\n/**\n * Remove an org notification email (`DELETE /api/org/notification-emails`).\n * Never throws.\n */\nexport function removeOrgNotificationEmail(\n config: SifaApiConfig,\n body: OrgNotificationEmailRequestInput,\n options: Omit<ApiFetchOptions, 'method' | 'body'> = {},\n): Promise<WriteResult & Partial<OrgNotificationEmailRemoveResult>> {\n return apiWrite<Partial<OrgNotificationEmailRemoveResult>>(\n config,\n '/api/org/notification-emails',\n 'DELETE',\n { body, ...options },\n );\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport type { OrgFloorVerdict, Profile } from '../../types/index.js';\nimport { useSifaConfig } from '../config.js';\nimport { fetchProfile } from '../fetchers/profile.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Read the server-computed org rendering-floor verdict for a handle or DID.\n *\n * The verdict rides the profile resolve (`GET /api/profile/:handleOrDid`), so\n * this hook reuses the `profile.byHandle` query key -- it shares the cache with\n * {@link useProfile} and never triggers a second round-trip. Returns\n * `OrgFloorVerdict | null` (`null` when the profile is missing or predates the\n * `org` field).\n */\nexport function useOrgProfile(\n handleOrDid: string | undefined | null,\n options?: Omit<\n UseQueryOptions<\n Profile | null,\n Error,\n OrgFloorVerdict | null,\n ReturnType<typeof sifaQueryKeys.profile.byHandle>\n >,\n 'queryKey' | 'queryFn' | 'select'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.profile.byHandle(handleOrDid ?? ''),\n queryFn: () => fetchProfile(config, handleOrDid ?? ''),\n enabled: Boolean(handleOrDid) && (options?.enabled ?? true),\n select: (profile) => profile?.org ?? null,\n ...options,\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport type { WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport { submitOrgClaim, type OrgClaimResult } from '../fetchers/org.js';\nimport type { OrgClaimRequestInput } from '../../schemas/write/org-claim.js';\nimport { sifaQueryKeys } from '../keys.js';\n\ntype OrgClaimMutationResult = WriteResult & Partial<OrgClaimResult>;\n\n/**\n * Finalize an org profile claim (`POST /api/org/claim`). Pass the org's\n * handle/DID so the profile cache (which carries the org floor verdict) is\n * invalidated on success; pass `null` to skip invalidation.\n */\nexport function useOrgClaim(\n handleOrDid: string | null,\n options?: Omit<\n UseMutationOptions<OrgClaimMutationResult, Error, OrgClaimRequestInput>,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (body: OrgClaimRequestInput) => submitOrgClaim(config, body),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success && handleOrDid) {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(handleOrDid),\n });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport type { WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport { updateOrgProfile, type OrgProfileUpdateResult } from '../fetchers/org.js';\nimport type { OrgProfileUpdateRequestInput } from '../../schemas/write/org-settings.js';\nimport { sifaQueryKeys } from '../keys.js';\n\ntype OrgProfileUpdateMutationResult = WriteResult & Partial<OrgProfileUpdateResult>;\n\n/**\n * Edit the org record (`PUT /api/org/profile`). Pass the org's handle/DID to\n * invalidate the profile cache (org floor verdict + fields) on success.\n */\nexport function useUpdateOrgProfile(\n handleOrDid: string | null,\n options?: Omit<\n UseMutationOptions<OrgProfileUpdateMutationResult, Error, OrgProfileUpdateRequestInput>,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (body: OrgProfileUpdateRequestInput) => updateOrgProfile(config, body),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success && handleOrDid) {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(handleOrDid),\n });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useMutation, type UseMutationOptions } from '@tanstack/react-query';\n\nimport type { WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n requestOrgDomainChallenge,\n verifyOrgDomain,\n type OrgDomainChallengeResult,\n type OrgDomainVerifyResult,\n} from '../fetchers/org.js';\nimport type {\n OrgDomainChallengeRequestInput,\n OrgDomainVerifyRequestInput,\n} from '../../schemas/write/org-settings.js';\n\ntype OrgDomainChallengeMutationResult = WriteResult & Partial<OrgDomainChallengeResult>;\ntype OrgDomainVerifyMutationResult = WriteResult & Partial<OrgDomainVerifyResult>;\n\n/**\n * Issue a one-time DNS TXT domain challenge (`POST /api/org/domains/challenge`).\n * The result carries the TXT record name + value for the org to publish.\n */\nexport function useOrgDomainChallenge(\n options?: Omit<\n UseMutationOptions<OrgDomainChallengeMutationResult, Error, OrgDomainChallengeRequestInput>,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n return useMutation({\n mutationFn: (body: OrgDomainChallengeRequestInput) => requestOrgDomainChallenge(config, body),\n ...options,\n });\n}\n\n/**\n * Verify a DNS TXT domain challenge (`POST /api/org/domains/verify`). On success\n * `status` is `verified` or `pending`; other outcomes surface as\n * `{ success: false }`.\n */\nexport function useOrgDomainVerify(\n options?: Omit<\n UseMutationOptions<OrgDomainVerifyMutationResult, Error, OrgDomainVerifyRequestInput>,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n return useMutation({\n mutationFn: (body: OrgDomainVerifyRequestInput) => verifyOrgDomain(config, body),\n ...options,\n });\n}\n","'use client';\n\nimport { useMutation, type UseMutationOptions } from '@tanstack/react-query';\n\nimport type { WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n addOrgNotificationEmail,\n removeOrgNotificationEmail,\n type OrgNotificationEmailAddResult,\n type OrgNotificationEmailRemoveResult,\n} from '../fetchers/org.js';\nimport type { OrgNotificationEmailRequestInput } from '../../schemas/write/org-settings.js';\n\ntype OrgNotificationEmailAddMutationResult = WriteResult & Partial<OrgNotificationEmailAddResult>;\ntype OrgNotificationEmailRemoveMutationResult = WriteResult &\n Partial<OrgNotificationEmailRemoveResult>;\n\n/**\n * Add an org notification email (`POST /api/org/notification-emails`). The\n * address must use a domain the org controls (checked server-side). Sending is\n * gated behind the dormant email pipeline until activated.\n */\nexport function useAddOrgNotificationEmail(\n options?: Omit<\n UseMutationOptions<\n OrgNotificationEmailAddMutationResult,\n Error,\n OrgNotificationEmailRequestInput\n >,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n return useMutation({\n mutationFn: (body: OrgNotificationEmailRequestInput) => addOrgNotificationEmail(config, body),\n ...options,\n });\n}\n\n/**\n * Remove an org notification email (`DELETE /api/org/notification-emails`).\n */\nexport function useRemoveOrgNotificationEmail(\n options?: Omit<\n UseMutationOptions<\n OrgNotificationEmailRemoveMutationResult,\n Error,\n OrgNotificationEmailRequestInput\n >,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n return useMutation({\n mutationFn: (body: OrgNotificationEmailRequestInput) =>\n removeOrgNotificationEmail(config, body),\n ...options,\n });\n}\n"]}
1
+ {"version":3,"sources":["../../src/query/client.ts","../../src/query/config.tsx","../../src/query/fetchers/profile.ts","../../src/query/fetchers/get-profile-view.ts","../../src/logic/primary-position.ts","../../src/logic/profile-summary.ts","../../src/query/fetchers/profile-summary.ts","../../src/query/fetchers/profile-mutations.ts","../../src/query/fetchers/positions.ts","../../src/query/fetchers/education.ts","../../src/query/fetchers/skills.ts","../../src/query/fetchers/records.ts","../../src/query/fetchers/profile-locations.ts","../../src/query/fetchers/external-accounts.ts","../../src/query/fetchers/endorsements.ts","../../src/query/fetchers/received-endorsements.ts","../../src/query/fetchers/reciprocity.ts","../../src/query/fetchers/endorsement-inbox.ts","../../src/query/fetchers/confirmations.ts","../../src/query/fetchers/actor.ts","../../src/query/fetchers/keytrace-claims.ts","../../src/query/fetchers/marque-domains.ts","../../src/query/fetchers/publications.ts","../../src/query/fetchers/profile-items-hide.ts","../../src/query/fetchers/activity-items-hide.ts","../../src/query/fetchers/stats.ts","../../src/query/fetchers/apps.ts","../../src/query/fetchers/accounts.ts","../../src/query/fetchers/search.ts","../../src/query/fetchers/speakers.ts","../../src/schemas/entity.ts","../../src/query/fetchers/entities.ts","../../src/query/fetchers/discovery.ts","../../src/query/fetchers/follow.ts","../../src/query/fetchers/follow-extras.ts","../../src/query/fetchers/admin-feature-allowlists.ts","../../src/query/fetchers/admin-review-queues.ts","../../src/query/fetchers/activity.ts","../../src/query/fetchers/github-prs.ts","../../src/query/fetchers/endorsement.ts","../../src/query/fetchers/stream.ts","../../src/query/fetchers/reactions.ts","../../src/query/fetchers/quoted-posts.ts","../../src/query/fetchers/roadmap.ts","../../src/query/fetchers/destructive.ts","../../src/query/fetchers/repo-inventory.ts","../../src/query/fetchers/network-map.ts","../../src/query/keys.ts","../../src/query/hooks/use-profile.ts","../../src/query/hooks/use-get-profile-view.ts","../../src/query/hooks/use-profile-mutations.ts","../../src/query/hooks/use-create-position.ts","../../src/query/hooks/use-position-mutations.ts","../../src/query/hooks/use-education-mutations.ts","../../src/query/hooks/use-skill-mutations.ts","../../src/query/hooks/use-record-mutations.ts","../../src/query/hooks/use-location-mutations.ts","../../src/query/hooks/use-external-accounts.ts","../../src/query/hooks/use-endorsement-mutations.ts","../../src/query/hooks/use-received-endorsements.ts","../../src/query/hooks/use-reciprocity.ts","../../src/query/hooks/use-endorsement-inbox.ts","../../src/query/hooks/use-confirmations.ts","../../src/query/hooks/use-keytrace-claims.ts","../../src/query/hooks/use-marque-domains.ts","../../src/query/hooks/use-publication-mutations.ts","../../src/query/hooks/use-profile-items-hide.ts","../../src/query/hooks/use-activity-items-hide.ts","../../src/query/hooks/use-stats.ts","../../src/query/hooks/use-apps.ts","../../src/query/hooks/use-accounts.ts","../../src/query/hooks/use-search.ts","../../src/query/hooks/use-entity-search.ts","../../src/query/hooks/use-discovery.ts","../../src/query/hooks/use-follow.ts","../../src/query/hooks/use-follow-extras.ts","../../src/query/hooks/use-feature-allowlist.ts","../../src/query/hooks/use-admin-review-queues.ts","../../src/query/hooks/use-activity.ts","../../src/query/hooks/use-github-prs.ts","../../src/query/hooks/use-endorsement.ts","../../src/query/hooks/use-stream.ts","../../src/query/hooks/use-reactions.ts","../../src/query/hooks/use-reaction-mutations.ts","../../src/query/hooks/use-roadmap.ts","../../src/query/hooks/use-roadmap-mutations.ts","../../src/query/hooks/use-destructive.ts","../../src/query/hooks/use-repo-inventory.ts","../../src/cards/adult-content.ts","../../src/query/fetchers/bsky-preferences.ts","../../src/query/hooks/use-bsky-content-prefs.ts","../../src/query/fetchers/org.ts","../../src/query/hooks/use-org-profile.ts","../../src/query/hooks/use-org-claim.ts","../../src/query/hooks/use-org-profile-settings.ts","../../src/query/hooks/use-org-domains.ts","../../src/query/hooks/use-org-notification-emails.ts"],"names":["createContext","useContext","z","EMPTY_SEARCH","buildListPath","useQuery","useQueryClient","useMutation","invalidateProfile","makeWriteHook","useState","useEffect","useInfiniteQuery"],"mappings":";;;;;;;;AA2CO,IAAM,QAAA,GAAN,cAAuB,KAAA,CAAM;AAAA,EACzB,MAAA;AAAA,EACA,IAAA;AAAA,EAET,WAAA,CAAY,OAAA,EAAiB,MAAA,EAAgB,IAAA,EAAgB;AAC3D,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,UAAA;AACZ,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AACd,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AAAA,EACd;AACF;AAEA,IAAM,kBAAA,GAAqB,GAAA;AAC3B,IAAM,sBAAA,GAAyB,CAAA;AAC/B,IAAM,4BAAA,GA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AA,KAA2C,uBAAA,CAAwB,QAAQ,IAAI,CAAA;AAAA,IAC5F,GAAG;AAAA,GACJ,CAAA;AACH;AAKO,SAAS,8BACd,OAAA,EAQA;AACA,EAAA,MAAM,SAAS,aAAA,EAAc;AAC7B,EAAA,OAAOA,sBAAAA,CAAY;AAAA,IACjB,UAAA,EAAY,CAAC,IAAA,KACX,0BAAA,CAA2B,QAAQ,IAAI,CAAA;AAAA,IACzC,GAAG;AAAA,GACJ,CAAA;AACH","file":"index.cjs","sourcesContent":["/**\n * Foundation HTTP client for talking to the Sifa AppView.\n *\n * Stateless. Consumers supply a {@link SifaApiConfig} per call (the React\n * hooks read it from context; non-React consumers pass it explicitly). No\n * singletons, no module-level state.\n */\n\n/** Configuration passed to every fetcher. */\nexport interface SifaApiConfig {\n /** Base URL of the sifa-api AppView, e.g. `https://api.sifa.id`. No trailing slash. */\n baseUrl: string;\n /**\n * Optional fetch implementation. Defaults to {@link globalThis.fetch}.\n * Lets Next.js consumers pass their cache-enhanced fetch; node/Expo\n * consumers can leave this unset.\n */\n fetch?: typeof fetch;\n}\n\n/** Options accepted by {@link apiFetch}. */\nexport interface ApiFetchOptions {\n method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';\n /** Request body. Serialized to JSON automatically. */\n body?: unknown;\n /** AbortSignal. Defaults to `AbortSignal.timeout(timeoutMs)` if `timeoutMs` is set. */\n signal?: AbortSignal;\n /** Per-call timeout in milliseconds. Default: 10_000. Ignored if `signal` is provided. */\n timeoutMs?: number;\n /** Retry on HTTP 429 up to 3 times with the server's `Retry-After` delay (capped at 3s). */\n retryOn429?: boolean;\n /** Additional headers. `Content-Type: application/json` is set automatically when `body` is present. */\n headers?: Record<string, string>;\n credentials?: RequestCredentials;\n cache?: RequestCache;\n /**\n * Next.js-specific cache hints. Ignored on non-Next runtimes. Passed\n * through transparently as part of {@link RequestInit}.\n */\n next?: { revalidate?: number | false; tags?: string[] };\n}\n\n/** Error thrown by {@link apiFetch} on non-2xx responses. */\nexport class ApiError extends Error {\n readonly status: number;\n readonly body: unknown;\n\n constructor(message: string, status: number, body?: unknown) {\n super(message);\n this.name = 'ApiError';\n this.status = status;\n this.body = body;\n }\n}\n\nconst DEFAULT_TIMEOUT_MS = 10_000;\nconst MAX_RATE_LIMIT_RETRIES = 3;\nconst RATE_LIMIT_RETRY_CAP_SECONDS = 3;\n\n/**\n * Encode a handle or DID for safe interpolation into a request path,\n * idempotently.\n *\n * Plain {@link encodeURIComponent} double-encodes an already-encoded\n * identifier: Next.js hands route params to RSC pages percent-encoded on a\n * hard navigation (`did%3Aplc%3A...`) but decoded on client-side navigation\n * (`did:plc:...`). Encoding the former again turns `%` into `%25`, so the\n * AppView reads `did%3A...` as a literal handle, finds no match, and 404s —\n * which is why DID profile links broke on direct visits but worked when\n * clicked within the app.\n *\n * AT identifiers (handles are domain names, DIDs are `did:method:...`) never\n * contain a literal `%`, so decoding a decoded value is a no-op. A malformed\n * percent sequence (lone `%`) makes {@link decodeURIComponent} throw; in that\n * case we keep the original value so behaviour matches the prior bare\n * `encodeURIComponent`.\n */\nexport function encodeIdentifier(value: string): string {\n let decoded = value;\n try {\n decoded = decodeURIComponent(value);\n } catch {\n // Malformed percent-encoding — fall back to the raw value.\n }\n return encodeURIComponent(decoded);\n}\n\n/**\n * Generic fetcher used by all SDK query and mutation functions.\n *\n * Returns parsed JSON typed as `T`. Throws {@link ApiError} on non-2xx\n * responses. Use {@link apiFetchOrNull} when 404 should resolve to `null`\n * instead.\n */\nexport async function apiFetch<T = unknown>(\n config: SifaApiConfig,\n path: string,\n options: ApiFetchOptions = {},\n): Promise<T> {\n const fetchFn = config.fetch ?? globalThis.fetch;\n const url = `${config.baseUrl}${path}`;\n const maxRetries = options.retryOn429 ? MAX_RATE_LIMIT_RETRIES : 0;\n\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n const signal = options.signal ?? AbortSignal.timeout(options.timeoutMs ?? DEFAULT_TIMEOUT_MS);\n\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n let body: BodyInit | undefined;\n if (options.body !== undefined) {\n headers['Content-Type'] ??= 'application/json';\n body = JSON.stringify(options.body);\n }\n\n // `next` is a Next.js extension to RequestInit; cast through.\n const init = {\n method: options.method ?? 'GET',\n headers,\n body,\n signal,\n credentials: options.credentials,\n cache: options.cache,\n ...(options.next ? { next: options.next } : {}),\n } as RequestInit;\n\n const res = await fetchFn(url, init);\n\n if (res.status === 429 && attempt < maxRetries) {\n const retryAfterRaw = res.headers.get('retry-after');\n const retryAfter = retryAfterRaw ? Number.parseInt(retryAfterRaw, 10) : 2;\n const waitSeconds = Math.min(\n Number.isFinite(retryAfter) ? retryAfter : 2,\n RATE_LIMIT_RETRY_CAP_SECONDS,\n );\n await new Promise((r) => setTimeout(r, waitSeconds * 1000));\n continue;\n }\n\n if (!res.ok) {\n let errBody: unknown;\n try {\n errBody = (await res.json()) as unknown;\n } catch {\n try {\n errBody = await res.text();\n } catch {\n errBody = undefined;\n }\n }\n throw new ApiError(`Sifa API ${res.status} on ${path}`, res.status, errBody);\n }\n\n // 204 and 205 are defined to carry no body, so res.json() throws on them.\n // apiWrite treats that throw as a failed write, which turned every\n // successful no-content response (roadmap unvote, remove reaction,\n // dismiss endorsement) into a reported error.\n if (res.status === 204 || res.status === 205) {\n return undefined as T;\n }\n\n return (await res.json()) as T;\n }\n\n throw new ApiError(`Sifa API exhausted retries on ${path}`, 429);\n}\n\n/**\n * Variant of {@link apiFetch} that resolves to `null` on HTTP 404 instead\n * of throwing. Useful for \"fetch by handle\" reads where missing is\n * expected (e.g. unknown profile).\n */\nexport async function apiFetchOrNull<T>(\n config: SifaApiConfig,\n path: string,\n options: ApiFetchOptions = {},\n): Promise<T | null> {\n try {\n return await apiFetch<T>(config, path, options);\n } catch (e) {\n if (e instanceof ApiError && e.status === 404) return null;\n throw e;\n }\n}\n\n/**\n * Result returned by record-write mutations (create / update / delete).\n *\n * Never throws -- writes against the user's PDS can fail in many ways\n * (network, PDS unreachable, rate limit) and the UI needs structured\n * results to render appropriate messages.\n */\nexport interface WriteResult {\n success: boolean;\n error?: string;\n /**\n * PDS hostname returned by sifa-api when a write failed at the user's\n * Personal Data Server (issue #167). Lets the UI render\n * \"Your data server (eurosky.social) isn't responding\" instead of a\n * generic \"Request failed (500)\".\n */\n pdsHost?: string;\n}\n\n/** Result returned by create mutations. Includes the newly created `rkey`. */\nexport interface CreateResult extends WriteResult {\n rkey?: string;\n}\n\ninterface ApiErrorBody {\n message?: string;\n pdsHost?: string;\n}\n\nfunction extractWriteError(data: unknown, status: number): { error: string; pdsHost?: string } {\n const body = (data ?? {}) as ApiErrorBody;\n return {\n error: body.message ?? `Request failed (${status})`,\n ...(body.pdsHost ? { pdsHost: body.pdsHost } : {}),\n };\n}\n\n/**\n * Write mutation against the Sifa AppView. Wraps {@link apiFetch} with the\n * never-throws contract used by all sifa-web mutations: returns a\n * structured {@link WriteResult} on both success and failure, and\n * preserves the `pdsHost` field when the AppView reports a PDS-side\n * failure (issue #167).\n *\n * On success: returns `{ success: true, ...payload }` where `payload` is\n * whatever the server returned in JSON (or `{}` for 204).\n *\n * On failure: returns `{ success: false, error, pdsHost? }`. Never throws.\n *\n * Use {@link apiWriteCreate} when you specifically need the `rkey` from a\n * create response folded into the result shape.\n */\nexport async function apiWrite<TExtra extends object = Record<never, never>>(\n config: SifaApiConfig,\n path: string,\n method: 'POST' | 'PUT' | 'DELETE' | 'PATCH',\n options: Omit<ApiFetchOptions, 'method'> = {},\n): Promise<WriteResult & TExtra> {\n try {\n const data = await apiFetch<TExtra>(config, path, {\n method,\n credentials: 'include',\n ...options,\n });\n return { success: true, ...(data ?? ({} as TExtra)) };\n } catch (e) {\n if (e instanceof ApiError) {\n return { success: false, ...extractWriteError(e.body, e.status) } as WriteResult & TExtra;\n }\n return { success: false, error: 'Network error' } as WriteResult & TExtra;\n }\n}\n\n/**\n * Write mutation that expects the server to return a record key (`rkey`)\n * in its response body. Wraps {@link apiWrite} and folds the `rkey` into\n * the result shape so consumers get `{ success, rkey?, error?, pdsHost? }`.\n *\n * If the server returns additional fields (e.g. `feedUrl` from external\n * account creation), pass them via the `TExtra` generic to keep them\n * typed.\n */\nexport function apiWriteCreate<TExtra extends object = Record<never, never>>(\n config: SifaApiConfig,\n path: string,\n body: unknown,\n options: Omit<ApiFetchOptions, 'method' | 'body'> = {},\n): Promise<CreateResult & TExtra> {\n return apiWrite<{ rkey?: string } & TExtra>(config, path, 'POST', {\n body,\n ...options,\n });\n}\n","'use client';\n\nimport { createContext, useContext, type ReactNode } from 'react';\n\nimport type { SifaApiConfig } from './client.js';\n\nconst SifaConfigContext = createContext<SifaApiConfig | null>(null);\n\nexport interface SifaProviderProps {\n config: SifaApiConfig;\n children: ReactNode;\n}\n\n/**\n * Provides the {@link SifaApiConfig} that hooks under it can read via\n * {@link useSifaConfig}. Wrap the React tree once; hooks consume it.\n *\n * @example\n * ```tsx\n * <QueryClientProvider client={queryClient}>\n * <SifaProvider config={{ baseUrl: process.env.NEXT_PUBLIC_API_URL! }}>\n * <App />\n * </SifaProvider>\n * </QueryClientProvider>\n * ```\n */\nexport function SifaProvider({ config, children }: SifaProviderProps) {\n return <SifaConfigContext.Provider value={config}>{children}</SifaConfigContext.Provider>;\n}\n\n/**\n * Read the SDK's {@link SifaApiConfig} from context. Throws if no\n * {@link SifaProvider} is mounted above.\n */\nexport function useSifaConfig(): SifaApiConfig {\n const ctx = useContext(SifaConfigContext);\n if (!ctx) {\n throw new Error(\n 'useSifaConfig must be used inside <SifaProvider>. Wrap your app once with <SifaProvider config={...}>.',\n );\n }\n return ctx;\n}\n","import type { Profile } from '../../types/index.js';\nimport {\n encodeIdentifier,\n apiFetch,\n apiFetchOrNull,\n type ApiFetchOptions,\n type SifaApiConfig,\n} from '../client.js';\n\n/**\n * Read the aggregated profile for a handle or DID.\n *\n * Returns `null` when the AppView has no profile for the given identifier\n * (HTTP 404). Throws {@link ApiError} on other non-2xx responses.\n *\n * Server-callable (Next.js RSC) and client-callable (Expo, browser).\n */\nexport function fetchProfile(\n config: SifaApiConfig,\n handleOrDid: string,\n options: ApiFetchOptions = {},\n): Promise<Profile | null> {\n const path = `/api/profile/${encodeIdentifier(handleOrDid)}`;\n return apiFetchOrNull<Profile>(config, path, {\n retryOn429: true,\n ...options,\n });\n}\n\n/**\n * Public AT Fund link for a profile, if one is configured. Returns `null`\n * on any error or when the response payload's `url` field is missing or\n * non-string.\n */\nexport async function fetchAtFundLink(\n config: SifaApiConfig,\n did: string,\n options: ApiFetchOptions = {},\n): Promise<string | null> {\n const path = `/api/profiles/${encodeIdentifier(did)}/at-fund-link`;\n try {\n const data = await apiFetch<{ url?: unknown }>(config, path, {\n next: { revalidate: 3600 },\n timeoutMs: 5000,\n ...options,\n });\n return typeof data.url === 'string' ? data.url : null;\n } catch {\n return null;\n }\n}\n","import type { ProfileView } from '../../types/profile-view.js';\nimport {\n ApiError,\n apiFetch,\n encodeIdentifier,\n type ApiFetchOptions,\n type SifaApiConfig,\n} from '../client.js';\n\n/**\n * Read the aggregated public profile view via the `id.sifa.getProfileView`\n * XRPC query. This is the AppView-only join (positions, education, skills,\n * endorsements, and more) exposed as a standard lexicon method, distinct from\n * the internal `/api/profile/*` REST surface.\n *\n * Returns `null` when the AppView has no profile for the actor\n * (`ProfileNotFound`). Throws {@link ApiError} on other non-2xx responses.\n *\n * Server-callable (Next.js RSC) and client-callable (Expo, browser).\n */\nexport async function fetchGetProfileView(\n config: SifaApiConfig,\n actor: string,\n options: ApiFetchOptions = {},\n): Promise<ProfileView | null> {\n const path = `/xrpc/id.sifa.getProfileView?actor=${encodeIdentifier(actor)}`;\n try {\n return await apiFetch<ProfileView>(config, path, { retryOn429: true, ...options });\n } catch (e) {\n if (\n e instanceof ApiError &&\n e.status === 400 &&\n typeof e.body === 'object' &&\n e.body !== null &&\n (e.body as { error?: unknown }).error === 'ProfileNotFound'\n ) {\n return null;\n }\n throw e;\n }\n}\n","/**\n * Canonical rule for picking the \"primary\" position to surface on profile cards,\n * social previews, and structured-data outputs.\n *\n * Without this shared helper, different surfaces (visible hero, OG image,\n * <meta description>, JSON-LD) re-derived \"primary\" inconsistently and diverged\n * for users with multiple concurrent roles.\n *\n * A `hidden` position is one the user chose not to show on their public profile.\n * It is never surfaced as the featured role — hidden wins over `primary`, so a\n * role flagged both hidden and primary is excluded rather than featured.\n *\n * Rules (in order):\n * 1. A position the user explicitly flagged `primary` AND that is still active AND not hidden.\n * 2. Otherwise, the active, non-hidden position with the most recent `startedAt`.\n * 3. Otherwise, undefined (no eligible position).\n */\n\nexport interface PrimaryPositionCandidate {\n startedAt?: string;\n endedAt?: string;\n primary?: boolean;\n hidden?: boolean;\n}\n\nexport function pickPrimaryPosition<T extends PrimaryPositionCandidate>(\n positions: readonly T[] | undefined,\n): T | undefined {\n if (!positions || positions.length === 0) return undefined;\n\n const active = positions.filter((p) => !p.endedAt && !p.hidden);\n if (active.length === 0) return undefined;\n\n const flagged = active.find((p) => p.primary === true);\n if (flagged) return flagged;\n\n return [...active].sort((a, b) => (b.startedAt ?? '').localeCompare(a.startedAt ?? ''))[0];\n}\n","/**\n * Compact professional summary derived from a {@link ProfileView}.\n *\n * The full `id.sifa.getProfileView` payload carries every section (all\n * positions, education, skills, publications, talks, and more). Third-party\n * surfaces that only want to show \"who is this, what do they do now\" — a badge,\n * a maintainer card, a byline — need a much smaller shape. This is that shape,\n * derived with the same canonical rules the Sifa web app uses (see\n * {@link pickPrimaryPosition}) so an embedded summary matches the profile page.\n *\n * Pure and I/O-free: pass it a view you already fetched. For the fetch +\n * summarize convenience, use `fetchProfileSummary` from `@singi-labs/sifa-sdk`.\n */\n\nimport type { ProfileView } from '../types/profile-view.js';\nimport { pickPrimaryPosition } from './primary-position.js';\n\nexport interface ProfileSummary {\n did: string;\n handle: string;\n displayName?: string;\n avatar?: string;\n pronouns?: string;\n headline?: string;\n /** Title of the current primary role, if the person has an active position. */\n currentTitle?: string;\n /** Current employer: the resolved entity name when linked, else the free-text company. */\n currentCompany?: string;\n /** Skill names in the order the AppView returns them, capped by `maxSkills`. */\n topSkills: string[];\n /** Whether the profile is claimed by its owner (vs an unclaimed placeholder). */\n claimed: boolean;\n}\n\nexport interface SummarizeProfileViewOptions {\n /** Maximum number of skills to include in `topSkills`. Default 5; negatives clamp to 0. */\n maxSkills?: number;\n}\n\nconst DEFAULT_MAX_SKILLS = 5;\n\nexport function summarizeProfileView(\n view: ProfileView,\n options: SummarizeProfileViewOptions = {},\n): ProfileSummary {\n const limit = Math.max(0, options.maxSkills ?? DEFAULT_MAX_SKILLS);\n const primary = pickPrimaryPosition(view.positions);\n\n return {\n did: view.did,\n handle: view.handle,\n displayName: view.displayName,\n avatar: view.avatar,\n pronouns: view.pronouns,\n headline: view.headline,\n currentTitle: primary?.title,\n currentCompany: primary ? (primary.entityName ?? primary.company) : undefined,\n topSkills: (view.skills ?? []).slice(0, limit).map((s) => s.name),\n claimed: view.claimed ?? false,\n };\n}\n","import {\n summarizeProfileView,\n type ProfileSummary,\n type SummarizeProfileViewOptions,\n} from '../../logic/profile-summary.js';\nimport { fetchGetProfileView } from './get-profile-view.js';\nimport type { ApiFetchOptions, SifaApiConfig } from '../client.js';\n\n/**\n * Fetch the aggregated public profile via `id.sifa.getProfileView` and reduce it\n * to a compact {@link ProfileSummary} (identity, headline, current role/employer,\n * top skills). Convenience over `fetchGetProfileView` + `summarizeProfileView`,\n * for third-party surfaces that only want the headline facts.\n *\n * Returns `null` when the AppView has no profile for the actor. Server-callable\n * (Next.js RSC) and client-callable (Expo, browser).\n */\nexport async function fetchProfileSummary(\n config: SifaApiConfig,\n actor: string,\n options: SummarizeProfileViewOptions & ApiFetchOptions = {},\n): Promise<ProfileSummary | null> {\n const { maxSkills, ...fetchOptions } = options;\n const view = await fetchGetProfileView(config, actor, fetchOptions);\n return view ? summarizeProfileView(view, { maxSkills }) : null;\n}\n","import { apiWrite, type ApiFetchOptions, type SifaApiConfig, type WriteResult } from '../client.js';\n\n/** Industry/domain entry on the profile self record. */\nexport interface ProfileIndustryInput {\n industry: string;\n domain?: string;\n}\n\n/**\n * Location payload accepted by `updateProfileSelf`.\n *\n * Accepts both shapes during the community.lexicon.location.address\n * migration. Prefer `locality` (new) over `city` (legacy) when sending.\n * The API's locationSchema is a Zod union that resolves either input.\n */\nexport interface ProfileSelfLocation {\n country: string;\n countryCode?: string;\n region?: string;\n city?: string;\n locality?: string;\n}\n\n/** Body accepted by {@link updateProfileSelf}. */\nexport interface UpdateProfileSelfInput {\n headline?: string;\n about?: string;\n /** Schema.org Person.givenName from id.sifa.profile.self.givenName. */\n givenName?: string;\n /** Schema.org Person.familyName from id.sifa.profile.self.familyName. */\n familyName?: string;\n /** Free-form phonetic respelling of the name from id.sifa.profile.self.namePronunciation. */\n namePronunciation?: string;\n industries?: ProfileIndustryInput[];\n location?: ProfileSelfLocation;\n website?: string;\n openTo?: string[];\n preferredWorkplace?: string[];\n availableFromUtc?: number;\n availableToUtc?: number;\n}\n\n/** Update the authenticated user's `id.sifa.profile.self` record. */\nexport function updateProfileSelf(\n config: SifaApiConfig,\n data: UpdateProfileSelfInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/self', 'PUT', { body: data, ...options });\n}\n\n/** Body accepted by {@link updateProfileOverride}. */\nexport interface UpdateProfileOverrideInput {\n headline?: string | null;\n about?: string | null;\n displayName?: string | null;\n pronouns?: string | null;\n}\n\n/**\n * Override aggregated profile fields with sifa-specific values. `null`\n * clears the override and falls back to the upstream PDS value.\n */\nexport function updateProfileOverride(\n config: SifaApiConfig,\n data: UpdateProfileOverrideInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/override', 'PUT', { body: data, ...options });\n}\n\n/** Extended result for {@link refreshPds}. */\nexport interface RefreshPdsResult extends WriteResult {\n displayName?: string | null;\n avatar?: string | null;\n}\n\n/**\n * Re-pull the authenticated user's `app.bsky.actor.profile` from their\n * PDS. Returns the freshly resolved `displayName` and `avatar` on\n * success so the UI can update without a full profile refetch.\n */\nexport function refreshPds(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<RefreshPdsResult> {\n return apiWrite<{ displayName?: string | null; avatar?: string | null }>(\n config,\n '/api/profile/refresh-pds',\n 'POST',\n options,\n );\n}\n\n/** Extended result for {@link uploadAvatar}. */\nexport interface UploadAvatarResult extends WriteResult {\n /** Publicly accessible URL of the newly uploaded avatar. */\n url?: string;\n}\n\n/**\n * Upload a new avatar via `multipart/form-data`. Pass either a `File`\n * (browser) or any `Blob` (Expo, node). The SDK leaves `Content-Type`\n * unset so the runtime can set the multipart boundary automatically.\n *\n * Never throws -- inspect `result.success` and `result.url`.\n */\nexport async function uploadAvatar(\n config: SifaApiConfig,\n file: Blob,\n options: ApiFetchOptions = {},\n): Promise<UploadAvatarResult> {\n const fetchFn = config.fetch ?? globalThis.fetch;\n const url = `${config.baseUrl}/api/profile/avatar`;\n const formData = new FormData();\n formData.append('file', file);\n\n try {\n const res = await fetchFn(url, {\n method: 'POST',\n credentials: options.credentials ?? 'include',\n body: formData,\n signal: options.signal ?? AbortSignal.timeout(options.timeoutMs ?? 30_000),\n headers: options.headers,\n });\n if (!res.ok) {\n const errBody = (await res.json().catch(() => ({}))) as {\n message?: string;\n pdsHost?: string;\n };\n const msg = errBody.message ?? `Request failed (${res.status})`;\n const pdsHost = errBody.pdsHost;\n return { success: false, error: msg, ...(pdsHost ? { pdsHost } : {}) };\n }\n const data = (await res.json()) as { url: string };\n return { success: true, url: data.url };\n } catch {\n return { success: false, error: 'Network error' };\n }\n}\n\n/** Delete the authenticated user's avatar override (revert to PDS avatar). */\nexport function deleteAvatarOverride(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/avatar', 'DELETE', options);\n}\n\n/** Extended result for {@link uploadNamePronunciationAudio}. */\nexport interface UploadPronunciationAudioResult extends WriteResult {\n /** Publicly accessible URL of the newly uploaded audio clip. */\n url?: string;\n}\n\n/**\n * Upload a name-pronunciation audio clip via `multipart/form-data`. Pass a\n * `File` (browser) or any `Blob` (Expo, node). The SDK leaves `Content-Type`\n * unset so the runtime sets the multipart boundary automatically.\n *\n * Never throws -- inspect `result.success` and `result.url`.\n */\nexport async function uploadNamePronunciationAudio(\n config: SifaApiConfig,\n file: Blob,\n options: ApiFetchOptions = {},\n): Promise<UploadPronunciationAudioResult> {\n const fetchFn = config.fetch ?? globalThis.fetch;\n const url = `${config.baseUrl}/api/profile/pronunciation-audio`;\n const formData = new FormData();\n formData.append('file', file);\n\n try {\n const res = await fetchFn(url, {\n method: 'POST',\n credentials: options.credentials ?? 'include',\n body: formData,\n signal: options.signal ?? AbortSignal.timeout(options.timeoutMs ?? 30_000),\n headers: options.headers,\n });\n if (!res.ok) {\n const errBody = (await res.json().catch(() => ({}))) as {\n message?: string;\n pdsHost?: string;\n };\n const msg = errBody.message ?? `Request failed (${res.status})`;\n const pdsHost = errBody.pdsHost;\n return { success: false, error: msg, ...(pdsHost ? { pdsHost } : {}) };\n }\n const data = (await res.json()) as { url: string };\n return { success: true, url: data.url };\n } catch {\n return { success: false, error: 'Network error' };\n }\n}\n\n/** Delete the name-pronunciation audio clip from the user's profile. */\nexport function deleteNamePronunciationAudio(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/pronunciation-audio', 'DELETE', options);\n}\n","import type { ProfilePosition, SkillRef } from '../../types/index.js';\nimport {\n apiWrite,\n apiWriteCreate,\n type ApiFetchOptions,\n type CreateResult,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\nexport type { CreateResult, WriteResult } from '../client.js';\n\n/**\n * Create a new `id.sifa.profile.position` record on the authenticated\n * user's PDS. The AppView signs and writes via the user's OAuth session.\n *\n * `data` should be a lexicon-shaped position record (without `createdAt`\n * or `rkey`; the AppView fills both). Validate with\n * `ProfilePositionRecordSchema.omit({ createdAt: true })` before calling\n * if you want client-side guarantees.\n *\n * Never throws -- inspect `result.success` and use `result.error` /\n * `result.pdsHost` for UI messaging.\n */\nexport function createPosition(\n config: SifaApiConfig,\n data: Record<string, unknown>,\n options: ApiFetchOptions = {},\n): Promise<CreateResult> {\n return apiWriteCreate(config, '/api/profile/position', data, options);\n}\n\n/** Update an existing position by `rkey`. */\nexport function updatePosition(\n config: SifaApiConfig,\n rkey: string,\n data: Record<string, unknown>,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/position/${encodeURIComponent(rkey)}`, 'PUT', {\n body: data,\n ...options,\n });\n}\n\n/** Delete a position by `rkey`. */\nexport function deletePosition(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/position/${encodeURIComponent(rkey)}`, 'DELETE', options);\n}\n\n/** Mark a position as the user's primary (current) role. */\nexport function setPositionPrimary(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/position/${encodeURIComponent(rkey)}/primary`,\n 'PUT',\n options,\n );\n}\n\n/** Clear the \"primary\" flag on a position. */\nexport function unsetPositionPrimary(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/position/${encodeURIComponent(rkey)}/primary`,\n 'DELETE',\n options,\n );\n}\n\n/**\n * Build the PUT-body for a position update. Strips `null` `location`\n * (so JSON.stringify drops it) and includes the provided `skills` list.\n */\nfunction buildPositionPayload(\n position: ProfilePosition,\n skills: SkillRef[],\n): Record<string, unknown> {\n return {\n company: position.company,\n title: position.title,\n description: position.description,\n startedAt: position.startedAt,\n endedAt: position.endedAt,\n location: position.location ?? undefined,\n // Carry the form-controlled optional fields the AppView merge would\n // otherwise clear when absent from the PUT body. Omitting them here made\n // every link/unlink strip employmentType, workplaceType, and entityRef\n // off the position (id.sifa.profile.position#skills round-trip).\n employmentType: position.employmentType,\n workplaceType: position.workplaceType,\n entityRef: position.entityRef,\n skills,\n };\n}\n\n/**\n * Add a skill link to a position. Idempotent: if the skill is already\n * linked, resolves to `{ success: true }` without a network call.\n *\n * Implementation note: the AppView only exposes whole-record PUTs, so\n * this helper rebuilds the position body with the new skills list.\n */\nexport function linkSkillToPosition(\n config: SifaApiConfig,\n position: ProfilePosition,\n skillRef: SkillRef,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n const currentSkills = position.skills ?? [];\n if (currentSkills.some((s) => s.uri === skillRef.uri)) {\n return Promise.resolve({ success: true });\n }\n return updatePosition(\n config,\n position.rkey,\n buildPositionPayload(position, [...currentSkills, skillRef]),\n options,\n );\n}\n\n/** Remove a skill link from a position. */\nexport function unlinkSkillFromPosition(\n config: SifaApiConfig,\n position: ProfilePosition,\n skillRef: SkillRef,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n const remaining = (position.skills ?? []).filter((s) => s.uri !== skillRef.uri);\n return updatePosition(config, position.rkey, buildPositionPayload(position, remaining), options);\n}\n","import {\n apiWrite,\n apiWriteCreate,\n type ApiFetchOptions,\n type CreateResult,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/**\n * Create a new `id.sifa.profile.education` record on the authenticated\n * user's PDS.\n */\nexport function createEducation(\n config: SifaApiConfig,\n data: Record<string, unknown>,\n options: ApiFetchOptions = {},\n): Promise<CreateResult> {\n return apiWriteCreate(config, '/api/profile/education', data, options);\n}\n\n/** Update an existing education record by `rkey`. */\nexport function updateEducation(\n config: SifaApiConfig,\n rkey: string,\n data: Record<string, unknown>,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/education/${encodeURIComponent(rkey)}`, 'PUT', {\n body: data,\n ...options,\n });\n}\n\n/** Delete an education record by `rkey`. */\nexport function deleteEducation(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/education/${encodeURIComponent(rkey)}`, 'DELETE', options);\n}\n","import {\n apiWrite,\n apiWriteCreate,\n type ApiFetchOptions,\n type CreateResult,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/**\n * Create a new `id.sifa.profile.skill` record on the authenticated\n * user's PDS.\n */\nexport function createSkill(\n config: SifaApiConfig,\n data: Record<string, unknown>,\n options: ApiFetchOptions = {},\n): Promise<CreateResult> {\n return apiWriteCreate(config, '/api/profile/skill', data, options);\n}\n\n/** Update an existing skill record by `rkey`. */\nexport function updateSkill(\n config: SifaApiConfig,\n rkey: string,\n data: Record<string, unknown>,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/skill/${encodeURIComponent(rkey)}`, 'PUT', {\n body: data,\n ...options,\n });\n}\n\n/** Outcome of a bulk sub-category assign. */\nexport interface SubCategoryBulkResult {\n /** Records written. */\n updated: number;\n /** Records that already carried the label, so no write was needed. */\n unchanged: number;\n /** Requested rkeys with no matching record on the PDS. */\n skipped: string[];\n}\n\n/**\n * Set (or clear) the sub-category on many skills in one request.\n *\n * A single call replaces one PUT per skill, which tripped the AppView's\n * per-IP rate limit on any sizeable profile (#324). An empty `subCategory`\n * clears the field.\n */\nexport function updateSkillSubCategories(\n config: SifaApiConfig,\n rkeys: string[],\n subCategory: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult & SubCategoryBulkResult> {\n return apiWrite<SubCategoryBulkResult>(config, '/api/profile/skills/subcategory', 'POST', {\n body: { rkeys, subCategory },\n ...options,\n });\n}\n\n/** Delete a skill record by `rkey`. */\nexport function deleteSkill(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/skill/${encodeURIComponent(rkey)}`, 'DELETE', options);\n}\n","import {\n apiWrite,\n apiWriteCreate,\n type ApiFetchOptions,\n type CreateResult,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/**\n * Generic record-create escape hatch. Most callers should prefer the\n * dedicated section helpers (`createPosition`, `createEducation`, etc.)\n * which take typed payloads and ship matching hooks. Use this when the\n * lexicon doesn't yet have a dedicated endpoint (certifications,\n * projects, publications, volunteering, honors, languages, courses).\n *\n * `collection` is a `id.sifa.profile.*` collection NSID. Routes to\n * `POST /api/profile/records/<collection>`.\n */\nexport function createRecord(\n config: SifaApiConfig,\n collection: string,\n data: Record<string, unknown>,\n options: ApiFetchOptions = {},\n): Promise<CreateResult> {\n return apiWriteCreate(\n config,\n `/api/profile/records/${encodeURIComponent(collection)}`,\n data,\n options,\n );\n}\n\n/** Generic record-update escape hatch. See {@link createRecord}. */\nexport function updateRecord(\n config: SifaApiConfig,\n collection: string,\n rkey: string,\n data: Record<string, unknown>,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n const path = `/api/profile/records/${encodeURIComponent(collection)}/${encodeURIComponent(rkey)}`;\n return apiWrite(config, path, 'PUT', { body: data, ...options });\n}\n\n/** Generic record-delete escape hatch. See {@link createRecord}. */\nexport function deleteRecord(\n config: SifaApiConfig,\n collection: string,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n const path = `/api/profile/records/${encodeURIComponent(collection)}/${encodeURIComponent(rkey)}`;\n return apiWrite(config, path, 'DELETE', options);\n}\n","import {\n apiWrite,\n apiWriteCreate,\n type ApiFetchOptions,\n type CreateResult,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/**\n * Address payload accepted by `/api/profile/location` endpoints.\n *\n * Accepts both shapes during the community.lexicon.location.address\n * migration. Prefer `country` + `locality` (new) over `countryCode` +\n * `city` (legacy). The API's `locationSchema` is a Zod union that\n * accepts either pair.\n */\nexport interface ProfileLocationAddress {\n /** Legacy alias for `country` (alpha-2). */\n countryCode?: string;\n /** community.lexicon.location.address field -- prefer over `countryCode`. */\n country?: string;\n region?: string;\n /** Legacy alias for `locality`. */\n city?: string;\n /** community.lexicon.location.address field -- prefer over `city`. */\n locality?: string;\n}\n\n/** Body accepted by {@link createProfileLocation} / {@link updateProfileLocation}. */\nexport interface ProfileLocationInput {\n address: ProfileLocationAddress;\n type: string;\n label?: string;\n isPrimary?: boolean;\n}\n\n/** Create a new profile location entry. */\nexport function createProfileLocation(\n config: SifaApiConfig,\n data: ProfileLocationInput,\n options: ApiFetchOptions = {},\n): Promise<CreateResult> {\n return apiWriteCreate(config, '/api/profile/location', data, options);\n}\n\n/** Update an existing profile location by `rkey`. */\nexport function updateProfileLocation(\n config: SifaApiConfig,\n rkey: string,\n data: ProfileLocationInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/location/${encodeURIComponent(rkey)}`, 'PUT', {\n body: data,\n ...options,\n });\n}\n\n/** Delete a profile location by `rkey`. */\nexport function deleteProfileLocation(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/location/${encodeURIComponent(rkey)}`, 'DELETE', options);\n}\n","import type { ExternalAccount } from '../../types/index.js';\nimport {\n apiFetch,\n encodeIdentifier,\n apiWrite,\n type ApiFetchOptions,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/** Body accepted by {@link createExternalAccount} / {@link updateExternalAccount}. */\nexport interface ExternalAccountInput {\n platform: string;\n url: string;\n label?: string;\n feedUrl?: string;\n}\n\n/** Extended create result for {@link createExternalAccount}. */\nexport interface CreateExternalAccountResult extends WriteResult {\n rkey?: string;\n feedUrl?: string | null;\n}\n\n/** Extended write result for {@link verifyExternalAccount}. */\nexport interface VerifyExternalAccountResult extends WriteResult {\n verified?: boolean;\n verifiedVia?: string;\n}\n\n/** List external accounts attached to a profile. Returns `[]` on error. */\nexport async function fetchExternalAccounts(\n config: SifaApiConfig,\n handleOrDid: string,\n options: ApiFetchOptions = {},\n): Promise<ExternalAccount[]> {\n const path = `/api/profile/${encodeIdentifier(handleOrDid)}/external-accounts`;\n try {\n const data = await apiFetch<{ accounts?: ExternalAccount[] }>(config, path, {\n credentials: 'include',\n ...options,\n });\n return data.accounts ?? [];\n } catch {\n return [];\n }\n}\n\n/**\n * Create a new external account record. Returns the newly-created `rkey`\n * and the server-resolved `feedUrl` (sifa-api inspects the target for\n * RSS feeds on platforms that publish them).\n */\nexport function createExternalAccount(\n config: SifaApiConfig,\n data: ExternalAccountInput,\n options: ApiFetchOptions = {},\n): Promise<CreateExternalAccountResult> {\n return apiWrite<{ rkey?: string; feedUrl?: string | null }>(\n config,\n '/api/profile/external-accounts',\n 'POST',\n { body: data, ...options },\n );\n}\n\n/** Update an existing external account by `rkey`. */\nexport function updateExternalAccount(\n config: SifaApiConfig,\n rkey: string,\n data: ExternalAccountInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/external-accounts/${encodeURIComponent(rkey)}`, 'PUT', {\n body: data,\n ...options,\n });\n}\n\n/** Delete an external account by `rkey`. */\nexport function deleteExternalAccount(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/external-accounts/${encodeURIComponent(rkey)}`,\n 'DELETE',\n options,\n );\n}\n\n/** Mark an external account as the user's primary. */\nexport function setExternalAccountPrimary(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/external-accounts/${encodeURIComponent(rkey)}/primary`,\n 'PUT',\n options,\n );\n}\n\n/** Clear the \"primary\" flag on an external account. */\nexport function unsetExternalAccountPrimary(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/external-accounts/${encodeURIComponent(rkey)}/primary`,\n 'DELETE',\n options,\n );\n}\n\n/**\n * Run server-side verification on an external account (e.g. inspect\n * the target for a keytrace claim). Returns `{ verified, verifiedVia }`\n * on success.\n */\nexport function verifyExternalAccount(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<VerifyExternalAccountResult> {\n return apiWrite<{ verified?: boolean; verifiedVia?: string }>(\n config,\n `/api/profile/external-accounts/${encodeURIComponent(rkey)}/verify`,\n 'POST',\n { body: {}, ...options },\n );\n}\n","import {\n apiWriteCreate,\n type ApiFetchOptions,\n type CreateResult,\n type SifaApiConfig,\n} from '../client.js';\n\n/** Body accepted by {@link createEndorsement}. */\nexport interface EndorsementInput {\n /** DID of the person being endorsed. */\n subjectDid: string;\n /**\n * AT-URI of the subject's `id.sifa.profile.skill` record. Omit to propose a\n * skill they have not listed; `skillName` then names what is proposed, and\n * the record is created when they accept.\n */\n skillUri?: string;\n /**\n * CID of that skill record, pinning the endorsement to the version endorsed.\n * Optional: the AppView resolves it when omitted, which is the common case\n * since only the firehose carries a CID. Never substitute another record's.\n */\n skillCid?: string;\n /**\n * Snapshot of the skill's name at endorsement time. Acts as the validity\n * anchor: if the subject later renames the skill, the mismatch is detectable.\n */\n skillName: string;\n comment?: string;\n}\n\n/** Body accepted by {@link confirmEndorsement}. */\nexport interface ConfirmEndorsementResult {\n /** Skill the endorsement resolved to, created if it was a proposal. */\n skillUri?: string;\n /** True when accepting added a new skill to the profile. */\n skillCreated?: boolean;\n}\n\nexport interface ConfirmEndorsementInput {\n endorsementUri: string;\n /**\n * Optional. When omitted the AppView resolves the CID itself, reading the\n * record from the endorser's PDS if it has none stored. Callers working from\n * the pending inbox should pass `cid` through when it is there and leave it\n * out when it is not, rather than substituting another record's CID.\n */\n endorsementCid?: string;\n}\n\n/**\n * Create an endorsement of another user's skill. The endorsed user\n * must confirm before the endorsement appears on their profile (the\n * endorsement record is on the endorser's PDS; a separate confirmation\n * record on the endorsed user's PDS gates display).\n */\nexport function createEndorsement(\n config: SifaApiConfig,\n data: EndorsementInput,\n options: ApiFetchOptions = {},\n): Promise<CreateResult> {\n return apiWriteCreate(config, '/api/endorsement', data, options);\n}\n\n/**\n * Confirm a received endorsement, writing a confirmation record to the\n * signed-in user's PDS. This is what makes the endorsement public: until the\n * confirmation exists, the endorsement is indexed but displays nowhere.\n */\nexport function confirmEndorsement(\n config: SifaApiConfig,\n data: ConfirmEndorsementInput,\n options: ApiFetchOptions = {},\n): Promise<CreateResult & ConfirmEndorsementResult> {\n return apiWriteCreate<ConfirmEndorsementResult>(\n config,\n '/api/endorsement/confirm',\n data,\n options,\n );\n}\n","import { encodeIdentifier, apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\nexport interface ReceivedEndorsement {\n endorserDid: string;\n /** Absent when the endorser has no Sifa profile yet. */\n endorserHandle?: string;\n endorserDisplayName?: string;\n endorserAvatar?: string;\n skillUri?: string;\n skillCid?: string;\n skillName: string;\n comment?: string;\n createdAt: string;\n}\n\nexport interface ReceivedEndorsementsPage {\n endorsements: ReceivedEndorsement[];\n cursor?: string;\n}\n\n/**\n * Confirmed endorsements a DID has received, newest first.\n *\n * Only confirmed ones exist here: the AppView inner-joins against the\n * confirmation records, so an endorsement the subject has not accepted is\n * absent rather than pending. Public -- no credentials needed.\n *\n * Returns an empty page on failure so a surface that merely decorates a page\n * cannot break it.\n */\nexport async function fetchReceivedEndorsements(\n config: SifaApiConfig,\n did: string,\n options: { limit?: number } & ApiFetchOptions = {},\n): Promise<ReceivedEndorsementsPage> {\n const { limit, ...fetchOptions } = options;\n const qs = limit ? `?limit=${limit}` : '';\n try {\n const data = await apiFetch<ReceivedEndorsementsPage>(\n config,\n `/api/endorsement/${encodeIdentifier(did)}${qs}`,\n { cache: 'no-store', timeoutMs: 5000, ...fetchOptions },\n );\n return { endorsements: data?.endorsements ?? [], cursor: data?.cursor };\n } catch {\n return { endorsements: [] };\n }\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\nexport interface ReciprocitySkill {\n name: string;\n uri: string;\n /** Absent until the firehose indexes the skill; the AppView resolves it. */\n cid?: string;\n}\n\nexport interface ReciprocityCandidate {\n did: string;\n handle: string;\n displayName?: string;\n avatar?: string;\n skills: ReciprocitySkill[];\n}\n\n/**\n * Someone the signed-in user follows on Sifa whose skills they could endorse.\n *\n * The AppView picks: it filters people already dismissed and anyone blocked,\n * requires at least one skill, and rotates the choice every twelve hours so\n * the same person is not offered indefinitely.\n *\n * `null` means there is nobody left to suggest -- a real state, not an error.\n * Failures also yield `null` so a broken suggestion never breaks the homepage.\n */\nexport async function fetchReciprocityCandidate(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<ReciprocityCandidate | null> {\n try {\n const data = await apiFetch<{ candidate: ReciprocityCandidate | null }>(\n config,\n '/api/endorsements/reciprocity-candidate',\n {\n cache: 'no-store',\n credentials: 'include',\n timeoutMs: 5000,\n ...options,\n },\n );\n return data?.candidate ?? null;\n } catch {\n return null;\n }\n}\n","import {\n apiFetch,\n apiWrite,\n type ApiFetchOptions,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/** A received endorsement the subject has neither confirmed nor dismissed. */\nexport interface PendingEndorsement {\n endorserDid: string;\n /**\n * Endorser's handle, when the AppView has resolved one. Absent when the\n * endorser has no Sifa profile yet -- an endorsement can come from any AT\n * Protocol app -- so the UI needs a fallback for having no name to show.\n */\n endorserHandle?: string;\n rkey: string;\n /**\n * AT-URI of the endorsement record. The confirm mutation needs a strongRef,\n * so the AppView hands this back rather than making callers rebuild it.\n */\n uri: string;\n /**\n * CID of the endorsement record, when the AppView has it. Often absent:\n * an endorsement written by another AT Protocol app can be indexed without\n * its CID ever reaching us. Pass it through to confirm when present; the\n * AppView resolves it from the endorser's PDS when it is not.\n */\n cid?: string;\n /** Absent when this endorsement proposes a skill the subject does not have. */\n skillUri?: string;\n skillCid?: string;\n /**\n * True when accepting this will add `skillName` to the profile as well as\n * publishing the endorsement. The UI must say so: it is a bigger action than\n * confirming an endorsement of a skill already listed.\n */\n proposesNewSkill?: boolean;\n skillName: string;\n comment?: string;\n createdAt: string;\n}\n\nexport interface PendingEndorsementsPage {\n endorsements: PendingEndorsement[];\n cursor?: string;\n}\n\n/** Body accepted by {@link dismissEndorsement}. */\nexport interface DismissEndorsementInput {\n endorserDid: string;\n rkey: string;\n}\n\n/**\n * Endorsements awaiting the signed-in user's decision. Requires credentials --\n * the AppView reads the subject DID from the session, not from a parameter, so\n * there is no way to read someone else's inbox.\n *\n * Returns an empty page on failure so a broken inbox degrades to \"nothing\n * pending\" rather than breaking the surface hosting it.\n */\nexport async function fetchPendingEndorsements(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<PendingEndorsementsPage> {\n try {\n const data = await apiFetch<PendingEndorsementsPage>(config, '/api/endorsements/pending', {\n cache: 'no-store',\n credentials: 'include',\n timeoutMs: 5000,\n ...options,\n });\n return { endorsements: data?.endorsements ?? [], cursor: data?.cursor };\n } catch {\n return { endorsements: [] };\n }\n}\n\n/**\n * Take a received endorsement out of the inbox.\n *\n * This writes nothing to any PDS. An endorsement only displays once the subject\n * has confirmed it, so declining is already the default state -- the dismissal\n * is a local flag that stops it reappearing, not a published rejection.\n */\nexport function dismissEndorsement(\n config: SifaApiConfig,\n data: DismissEndorsementInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/endorsement/dismiss', 'POST', { body: data, ...options });\n}\n","import {\n apiFetch,\n apiWrite,\n apiWriteCreate,\n type ApiFetchOptions,\n type CreateResult,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/** A claim naming the signed-in user that they have neither confirmed nor dismissed. */\nexport interface PendingConfirmation {\n /** DID of the person who wrote the claim. */\n claimerDid: string;\n /**\n * Claimer's handle, when the AppView has resolved one. Absent when they have\n * no Sifa profile: a claim can be written by any AT Protocol app, so the UI\n * needs a fallback for having no name to show.\n */\n claimerHandle?: string;\n claimerDisplayName?: string;\n claimerAvatar?: string;\n /** AT-URI of the record that names you. The confirm mutation needs a strongRef. */\n subjectUri: string;\n /**\n * CID of that record, when the AppView has it. Often absent, since a record\n * indexed from another app can arrive without one. Pass it through when\n * present; the AppView resolves it from the claimer's PDS when it is not.\n * Never substitute a different record's CID.\n */\n subjectCid?: string;\n relation: string;\n /** Name or title the subject record carries right now, for display and snapshotting. */\n subjectName: string;\n /** Role the claimer assigned you, for `projectMember`. Display only. */\n role?: string;\n title?: string;\n createdAt: string;\n}\n\nexport interface PendingConfirmationsPage {\n confirmations: PendingConfirmation[];\n cursor?: string;\n}\n\n/** A confirmation the signed-in user has already given. */\nexport interface GivenConfirmation {\n subjectUri: string;\n claimerDid: string;\n claimerHandle?: string;\n relation: string;\n /** The name as it stood when confirmed, so a rename shows as a difference. */\n subjectName: string;\n /** The name the record carries now. Absent when the claim no longer exists. */\n currentName?: string;\n /** The record changed materially after it was confirmed. */\n confirmedStale: boolean;\n /** They removed you from the record, or deleted it. Nothing left to withdraw. */\n claimWithdrawn: boolean;\n createdAt: string;\n}\n\n/** Body accepted by {@link createConfirmation}. */\nexport interface ConfirmationInput {\n subjectUri: string;\n subjectCid?: string;\n relation: string;\n /**\n * Snapshot of the subject's name at confirmation time. Stored in your own\n * repo, out of the claimer's reach, so a later rename is detectable.\n */\n subjectName?: string;\n}\n\n/** Body accepted by {@link dismissConfirmation} and {@link revokeConfirmation}. */\nexport interface ConfirmationSubjectInput {\n subjectUri: string;\n}\n\n/**\n * Claims awaiting the signed-in user's decision. Requires credentials -- the\n * AppView reads the subject DID from the session, not from a parameter, so\n * there is no way to read someone else's inbox.\n *\n * Returns an empty page on failure so a broken inbox degrades to \"nothing\n * pending\" rather than breaking the surface hosting it.\n */\nexport async function fetchPendingConfirmations(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<PendingConfirmationsPage> {\n try {\n const data = await apiFetch<PendingConfirmationsPage>(config, '/api/confirmations/pending', {\n cache: 'no-store',\n credentials: 'include',\n timeoutMs: 5000,\n ...options,\n });\n return { confirmations: data?.confirmations ?? [], cursor: data?.cursor };\n } catch {\n return { confirmations: [] };\n }\n}\n\n/**\n * Confirmations the signed-in user has already given.\n *\n * The surface for changing your mind. Without it a confirmation is one-way in\n * practice: the inbox lists only claims you have not answered, so once answered\n * there is nowhere to see it, let alone withdraw it.\n *\n * Returns an empty list on failure, matching the pending inbox: a broken list\n * should not break the page hosting it.\n */\nexport async function fetchGivenConfirmations(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<{ confirmations: GivenConfirmation[] }> {\n try {\n const data = await apiFetch<{ confirmations: GivenConfirmation[] }>(\n config,\n '/api/confirmations/mine',\n { cache: 'no-store', credentials: 'include', timeoutMs: 5000, ...options },\n );\n return { confirmations: data?.confirmations ?? [] };\n } catch {\n return { confirmations: [] };\n }\n}\n\n/**\n * Affirm that a record naming you is accurate, writing an `id.sifa.confirmation`\n * to your own PDS. Until this exists the claim renders as a bare handle with no\n * display name, avatar, or link back to you.\n *\n * Confirming does not put the claimer's record on your profile. That record\n * lives in their repository and they can rename it at will; keeping your own\n * entry is a separate, deliberate step.\n */\nexport function createConfirmation(\n config: SifaApiConfig,\n data: ConfirmationInput,\n options: ApiFetchOptions = {},\n): Promise<CreateResult> {\n return apiWriteCreate(config, '/api/confirmation', data, options);\n}\n\n/**\n * Take a claim out of the inbox without confirming it.\n *\n * This writes nothing to any PDS. A claim only gains your identity once you\n * have confirmed it, so declining is already the default state -- the dismissal\n * is a local flag that stops it reappearing, not a published rejection the\n * claimer can read.\n */\nexport function dismissConfirmation(\n config: SifaApiConfig,\n data: ConfirmationSubjectInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/confirmation/dismiss', 'POST', { body: data, ...options });\n}\n\n/**\n * Withdraw a confirmation you previously gave, deleting the record from your\n * PDS. The claim reverts to rendering as a bare handle.\n *\n * The usual reason is drift: the claimer renamed the project or changed the\n * role after you confirmed, so what you affirmed is no longer what is shown.\n * Also writes a dismissal, or the still-live claim returns to your inbox.\n */\nexport function revokeConfirmation(\n config: SifaApiConfig,\n data: ConfirmationSubjectInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/confirmation/revoke', 'POST', { body: data, ...options });\n}\n","import { apiFetch, apiFetchOrNull, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\nimport type { ActorCard, CoSpeaker } from '../../types/index.js';\n\n/**\n * Resolve any atproto handle (or DID) to a profile card, for the co-speaker\n * picker's \"not on Sifa\" path. Returns `null` when the identity can't be\n * resolved. The Sifa AppView resolves the handle to a DID and hydrates a card\n * (handle, displayName, avatar, and whether they have a claimed Sifa profile).\n */\nexport async function fetchResolveActor(\n config: SifaApiConfig,\n handleOrDid: string,\n options: ApiFetchOptions = {},\n): Promise<CoSpeaker | null> {\n const q = handleOrDid.trim().replace(/^@/, '');\n if (!q) return null;\n return apiFetchOrNull<CoSpeaker>(config, `/api/actor/resolve?q=${encodeURIComponent(q)}`, {\n cache: 'no-store',\n ...options,\n });\n}\n\n/**\n * Typeahead over indexed Sifa profiles by partial name or handle, for the\n * co-speaker, login and search comboboxes. Matches display name and handle only\n * (prefix + trigram), ranks prefix matches first, and returns actor cards.\n * Unlike `/api/search/profiles`, a partial of a dotted custom handle resolves\n * and a partial name surfaces its prefix match rather than an unrelated\n * account. Returns an empty array on a blank query or a failed request; use\n * {@link fetchResolveActor} on Enter to reach a handle that is not on Sifa.\n */\nexport async function fetchTypeaheadActors(\n config: SifaApiConfig,\n query: string,\n limit = 8,\n options: ApiFetchOptions = {},\n): Promise<ActorCard[]> {\n const q = query.trim().replace(/^@/, '');\n if (!q) return [];\n const params = new URLSearchParams({ q, limit: String(limit) });\n try {\n const res = await apiFetch<{ actors: ActorCard[] }>(\n config,\n `/api/actor/typeahead?${params.toString()}`,\n { cache: 'no-store', ...options },\n );\n return res.actors ?? [];\n } catch {\n return [];\n }\n}\n","import { apiWrite, type ApiFetchOptions, type SifaApiConfig, type WriteResult } from '../client.js';\n\n/**\n * Hide a keytrace claim (verified-account claim discovered on the\n * user's external accounts) from the user's profile. The claim itself\n * stays in the index; only its display is suppressed.\n */\nexport function hideKeytraceClaim(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/keytrace-claims/${encodeURIComponent(rkey)}/hide`,\n 'POST',\n options,\n );\n}\n\n/** Restore a previously-hidden keytrace claim. */\nexport function unhideKeytraceClaim(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/keytrace-claims/${encodeURIComponent(rkey)}/hide`,\n 'DELETE',\n options,\n );\n}\n","import { apiWrite, type ApiFetchOptions, type SifaApiConfig, type WriteResult } from '../client.js';\n\n/**\n * Make a Marque-registered domain public in the owner's Links section. Marque\n * domains are owner-only by default; this reveals one. `domain` is the\n * at.marque.domain rkey (the domain name itself).\n */\nexport function revealMarqueDomain(\n config: SifaApiConfig,\n domain: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/marque-domains/${encodeURIComponent(domain)}/reveal`,\n 'POST',\n options,\n );\n}\n\n/** Make a previously-revealed Marque domain owner-only again. */\nexport function unrevealMarqueDomain(\n config: SifaApiConfig,\n domain: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/marque-domains/${encodeURIComponent(domain)}/reveal`,\n 'DELETE',\n options,\n );\n}\n","import { apiWrite, type ApiFetchOptions, type SifaApiConfig, type WriteResult } from '../client.js';\n\n/** Extended result for {@link refreshOrcidPublications}. */\nexport interface RefreshOrcidPublicationsResult extends WriteResult {\n added?: number;\n removed?: number;\n}\n\n/**\n * Hide an ORCID-imported publication from the user's profile. The\n * `putCode` is the ORCID-side identifier; the underlying record stays\n * in the index, only its display is suppressed.\n */\nexport function hideOrcidPublication(\n config: SifaApiConfig,\n putCode: number,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/orcid-publications/${putCode}/hide`, 'POST', options);\n}\n\n/** Restore a previously-hidden ORCID publication. */\nexport function unhideOrcidPublication(\n config: SifaApiConfig,\n putCode: number,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/orcid-publications/${putCode}/hide`, 'DELETE', options);\n}\n\n/** Hide a standard (auto-imported) publication by its AT URI. */\nexport function hideStandardPublication(\n config: SifaApiConfig,\n uri: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/standard-publications/${encodeURIComponent(uri)}/hide`,\n 'POST',\n options,\n );\n}\n\n/** Restore a previously-hidden standard publication. */\nexport function unhideStandardPublication(\n config: SifaApiConfig,\n uri: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/standard-publications/${encodeURIComponent(uri)}/hide`,\n 'DELETE',\n options,\n );\n}\n\n/** Bulk-hide standard publications by AT URI list. */\nexport function bulkHideStandardPublications(\n config: SifaApiConfig,\n uris: string[],\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/standard-publications/bulk-hide', 'POST', {\n body: { uris },\n ...options,\n });\n}\n\n/** Bulk-unhide standard publications by AT URI list. */\nexport function bulkUnhideStandardPublications(\n config: SifaApiConfig,\n uris: string[],\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/standard-publications/bulk-hide', 'DELETE', {\n body: { uris },\n ...options,\n });\n}\n\n/** Hide an `id.sifa.profile.publication` (user-authored publication record). */\nexport function hideSifaPublication(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/publications/${rkey}/hide`, 'POST', options);\n}\n\n/** Restore a previously-hidden Sifa publication. */\nexport function unhideSifaPublication(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/publications/${rkey}/hide`, 'DELETE', options);\n}\n\n/**\n * Re-pull the authenticated user's ORCID publications. Returns counts\n * of added and removed records. The server returns `{ error: '...' }`\n * inline (not via HTTP status) on quota / linkage failures; the SDK\n * folds that into `{ success: false, error }` to keep the contract\n * consistent with other mutations.\n */\nexport async function refreshOrcidPublications(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<RefreshOrcidPublicationsResult> {\n const result = await apiWrite<{ added?: number; removed?: number; error?: string }>(\n config,\n '/api/profile/orcid-publications/refresh',\n 'POST',\n { body: {}, ...options },\n );\n if (result.success && result.error) {\n return { success: false, error: result.error };\n }\n return result;\n}\n","import { apiWrite, type ApiFetchOptions, type SifaApiConfig, type WriteResult } from '../client.js';\n\n/** Item types that can be hidden on the authenticated user's profile. */\nexport const HIDDEN_ITEM_TYPES = [\n 'position',\n 'education',\n 'certification',\n 'project',\n 'volunteering',\n 'publication',\n 'course',\n 'honor',\n 'language',\n 'externalAccount',\n] as const;\nexport type HiddenItemType = (typeof HIDDEN_ITEM_TYPES)[number];\n\n/** Source from which an item originates; disambiguates `item_id`. */\nexport const HIDDEN_ITEM_SOURCES = ['pds', 'standard', 'orcid'] as const;\nexport type HiddenItemSource = (typeof HIDDEN_ITEM_SOURCES)[number];\n\nexport interface HideProfileItemInput {\n itemType: HiddenItemType;\n source: HiddenItemSource;\n /** rkey for `pds`, AT-URI for `standard`, ORCID putCode as text for `orcid`. */\n itemId: string;\n}\n\nexport interface BulkHideProfileItemInput {\n itemType: HiddenItemType;\n source: HiddenItemSource;\n itemIds: string[];\n}\n\n/**\n * Hide one profile item. The underlying record stays on the user's PDS;\n * only its display on sifa.id is suppressed.\n */\nexport function hideProfileItem(\n config: SifaApiConfig,\n input: HideProfileItemInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/items/hide', 'POST', { ...options, body: input });\n}\n\n/** Restore a previously-hidden profile item. */\nexport function unhideProfileItem(\n config: SifaApiConfig,\n input: HideProfileItemInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/items/hide', 'DELETE', { ...options, body: input });\n}\n\n/** Bulk-hide profile items sharing the same `itemType` + `source`. */\nexport function bulkHideProfileItems(\n config: SifaApiConfig,\n input: BulkHideProfileItemInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/items/bulk-hide', 'POST', { ...options, body: input });\n}\n\n/** Bulk-unhide profile items sharing the same `itemType` + `source`. */\nexport function bulkUnhideProfileItems(\n config: SifaApiConfig,\n input: BulkHideProfileItemInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/items/bulk-hide', 'DELETE', { ...options, body: input });\n}\n","import {\n apiFetch,\n apiWrite,\n type ApiFetchOptions,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\nexport interface HideActivityItemInput {\n /** AT-URI of the record, or the item URL for externally-sourced items. */\n uri: string;\n /** Collection NSID (or synthetic collection, e.g. `fediverse.post`). */\n collection: string;\n /**\n * Registry app id the item belongs to. Optional, and used only to take the\n * item out of the owner's OG-image activity spine, which is computed from\n * per-(day, app) counts and never sees a URI.\n */\n appId?: string;\n /** UTC day the item was created (`YYYY-MM-DD`), for the same reason. */\n activityDate?: string;\n}\n\nexport interface UnhideActivityItemInput {\n uri: string;\n}\n\n/** One activity item the authenticated user has hidden from their profile. */\nexport interface HiddenActivityItem {\n uri: string;\n collection: string;\n appId: string | null;\n activityDate: string | null;\n hiddenAt: string;\n}\n\nexport interface FetchHiddenActivityItemsOptions extends ApiFetchOptions {\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * `credentials: 'include'` does NOT propagate browser cookies in RSC.\n */\n cookieHeader?: string;\n}\n\n/**\n * Hide one activity item from the authenticated user's profile. The record\n * stays on their PDS and stays readable by every other app; only its\n * appearance on sifa.id is suppressed.\n */\nexport function hideActivityItem(\n config: SifaApiConfig,\n input: HideActivityItemInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/activity/items/hide', 'POST', { ...options, body: input });\n}\n\n/** Restore a previously-hidden activity item. */\nexport function unhideActivityItem(\n config: SifaApiConfig,\n input: UnhideActivityItemInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/activity/items/hide', 'DELETE', { ...options, body: input });\n}\n\n/**\n * Everything the authenticated user has hidden, newest hide first. Returns\n * `[]` on any error so a settings page can still render.\n */\nexport async function fetchHiddenActivityItems(\n config: SifaApiConfig,\n options: FetchHiddenActivityItemsOptions = {},\n): Promise<HiddenActivityItem[]> {\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n const data = await apiFetch<{ items: HiddenActivityItem[] }>(\n config,\n '/api/activity/hidden-items',\n { credentials: 'include', ...options, headers },\n );\n return data.items;\n } catch {\n return [];\n }\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/** Public, aggregate stats shown on the homepage and similar surfaces. */\nexport interface StatsResponse {\n profileCount: number;\n avatars: string[];\n atproto: {\n userCount: number;\n growthPerSecond: number;\n timestamp: number;\n } | null;\n}\n\n/**\n * Homepage stats (profile count, avatar samples, ATproto growth). Public\n * endpoint -- safe to cache. Returns `null` on any error so callers can\n * render a graceful empty state.\n */\nexport async function fetchStats(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<StatsResponse | null> {\n try {\n return await apiFetch<StatsResponse>(config, '/api/stats', {\n next: { revalidate: 900 },\n ...options,\n });\n } catch {\n return null;\n }\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/** Catalog entry describing an ATproto app that Sifa surfaces activity for. */\nexport interface AppRegistryEntry {\n id: string;\n name: string;\n category: string;\n collectionPrefixes: string[];\n scanCollections: string[];\n urlPattern?: string;\n color: string;\n}\n\n/** Compact app representation returned by the hidden-apps endpoint. */\nexport interface HiddenApp {\n id: string;\n name: string;\n category: string;\n}\n\nexport interface FetchHiddenAppsOptions extends ApiFetchOptions {\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * `credentials: 'include'` does NOT propagate browser cookies in RSC,\n * so authenticated server fetches must forward the header explicitly.\n */\n cookieHeader?: string;\n}\n\n/**\n * Public app registry shown across discovery surfaces. Heavily cached.\n * Returns `[]` on any error.\n */\nexport async function fetchAppsRegistry(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<AppRegistryEntry[]> {\n try {\n return await apiFetch<AppRegistryEntry[]>(config, '/api/apps/registry', {\n next: { revalidate: 86400 },\n ...options,\n });\n } catch {\n return [];\n }\n}\n\n/**\n * Apps the authenticated user has chosen to hide from their activity feed.\n * Requires an authenticated session. Returns `[]` on any error (including\n * the unauthenticated case).\n */\nexport async function fetchHiddenApps(\n config: SifaApiConfig,\n options: FetchHiddenAppsOptions = {},\n): Promise<HiddenApp[]> {\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n const data = await apiFetch<{ apps: HiddenApp[] }>(config, '/api/profile/hidden-apps', {\n credentials: 'include',\n ...options,\n headers,\n });\n return data.apps;\n } catch {\n return [];\n }\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/** One account attached to the current browser, for the account switcher. */\nexport interface AccountSummary {\n did: string;\n handle: string | null;\n displayName: string | null;\n avatarUrl: string | null;\n /**\n * The org's uploaded logo blob CID, for a company account that set one on its\n * `/c/` page; null otherwise. The switcher resolves it to the same logo `/c/`\n * shows (via the shared company-logo resolution), so an uploaded logo appears\n * in the menu rather than the atproto avatar. Omitted by older api responses.\n */\n orgLogoBlob?: string | null;\n /** Whether this is the currently-active account. */\n active: boolean;\n}\n\nexport interface FetchAccountsOptions extends ApiFetchOptions {\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * `credentials: 'include'` does NOT propagate browser cookies in RSC,\n * so authenticated server fetches must forward the header explicitly.\n */\n cookieHeader?: string;\n}\n\n/**\n * Accounts attached to this browser (the account switcher). Requires an\n * authenticated session. Returns `[]` on any error, including the\n * unauthenticated case.\n */\nexport async function fetchAccounts(\n config: SifaApiConfig,\n options: FetchAccountsOptions = {},\n): Promise<AccountSummary[]> {\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n const data = await apiFetch<{ accounts: AccountSummary[] }>(config, '/api/auth/accounts', {\n credentials: 'include',\n ...options,\n headers,\n });\n return data.accounts;\n } catch {\n return [];\n }\n}\n\n/**\n * Make an already-attached account the active one. Keyed by DID (public); the\n * server maps it to the browser's session id. Browser-only: the endpoint\n * requires an Origin header, which browsers set automatically on POST. Callers\n * typically reload the app afterwards to reset session-seeded state.\n */\nexport async function switchAccount(\n config: SifaApiConfig,\n did: string,\n options: ApiFetchOptions = {},\n): Promise<void> {\n await apiFetch(config, '/oauth/switch', {\n method: 'POST',\n body: { did },\n credentials: 'include',\n ...options,\n });\n}\n","import type { SkillSuggestion } from '../../types/index.js';\nimport { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/** Profile entry returned by the search endpoint. */\nexport interface ProfileSearchResult {\n did?: string;\n handle: string;\n displayName?: string;\n headline?: string;\n avatar?: string;\n about?: string;\n currentRole?: string;\n currentCompany?: string;\n industry?: string;\n domain?: string;\n countryCode?: string;\n locationCountry?: string;\n preferredWorkplace?: string[];\n claimed?: boolean;\n blueskyVerified?: boolean;\n blueskyVerifiedAt?: string | null;\n}\n\nexport interface SearchFilters {\n q?: string;\n skill?: string;\n country?: string;\n industry?: string;\n domain?: string;\n workplace?: string;\n app?: string;\n /**\n * Open-to filter. Values are short tokens (e.g. \"fullTime\", \"mentor\",\n * \"collab\") matching `OPEN_TO_OPTIONS[].token` from the taxonomy. The\n * API expands tokens to lex values server-side. Multiple tokens are\n * OR-combined (profile matches if any selected token is set).\n */\n openTo?: string[];\n limit?: number;\n}\n\nexport interface SearchResponse {\n profiles: ProfileSearchResult[];\n total: number;\n limit: number;\n offset: number;\n}\n\n/** Skill typeahead suggestion. */\nexport interface SkillSearchResult {\n name: string;\n slug: string;\n category: string;\n userCount: number;\n}\n\nexport interface FilterOptions {\n countries: { countryCode: string; country: string; count: number }[];\n industries: { industry: string; count: number }[];\n apps: { appId: string; count: number }[];\n /**\n * Distribution of openTo selections across indexed profiles. Each entry\n * maps a short token (see {@link SearchFilters.openTo}) to the number of\n * profiles that have it set. Omitted from older API responses; treat\n * absence as \"no data\" rather than \"all zero\".\n */\n openTo?: { token: string; count: number }[];\n}\n\n/** Company entry returned by company search (workspace#299). */\nexport interface CompanySearchResult {\n /** Immutable catalogue id; the durable `/c/{publicId}` link. */\n publicId: string;\n name: string;\n domain: string | null;\n country: string | null;\n industry: string | null;\n logoUrl: string | null;\n employeeCount: number | null;\n}\n\nexport interface CompanySearchFilters {\n q?: string;\n /** ISO 3166-1 alpha-2. */\n country?: string;\n industry?: string;\n limit?: number;\n}\n\nexport interface CompanySearchResponse {\n results: CompanySearchResult[];\n hasMore: boolean;\n}\n\nconst EMPTY_SEARCH: SearchResponse = { profiles: [], total: 0, limit: 20, offset: 0 };\nconst EMPTY_FILTERS: FilterOptions = { countries: [], industries: [], apps: [], openTo: [] };\nconst EMPTY_COMPANY_SEARCH: CompanySearchResponse = { results: [], hasMore: false };\n\n/**\n * Search profiles by free-text query and optional filters. Returns an\n * empty result set when no filters are provided (matching sifa-web's\n * \"no input, no fetch\" behavior).\n */\nexport async function fetchSearchProfiles(\n config: SifaApiConfig,\n filters: SearchFilters,\n options: ApiFetchOptions = {},\n): Promise<SearchResponse> {\n const params = new URLSearchParams();\n if (filters.q) params.set('q', filters.q);\n if (filters.skill) params.set('skill', filters.skill);\n if (filters.country) params.set('country', filters.country);\n if (filters.industry) params.set('industry', filters.industry);\n if (filters.domain) params.set('domain', filters.domain);\n if (filters.workplace) params.set('workplace', filters.workplace);\n if (filters.app) params.set('app', filters.app);\n if (filters.openTo && filters.openTo.length > 0) {\n for (const token of filters.openTo) {\n if (token) params.append('openTo', token);\n }\n }\n if (filters.limit !== undefined) params.set('limit', String(filters.limit));\n\n if (params.size === 0) return EMPTY_SEARCH;\n\n return apiFetch<SearchResponse>(config, `/api/search/profiles?${params.toString()}`, {\n cache: 'no-store',\n ...options,\n });\n}\n\n/**\n * Company search over the entity catalogue (workspace#299).\n *\n * A category of its own rather than part of profile search: the two rank\n * differently and carry different filters, and a slow category should not hold\n * up the rest of a blended results page.\n *\n * An empty query returns nothing without a network call. The API rejects a\n * blank `q` rather than scanning ~200k rows, so asking would only spend a round\n * trip to be told no.\n */\nexport async function fetchSearchCompanies(\n config: SifaApiConfig,\n filters: CompanySearchFilters,\n options: ApiFetchOptions = {},\n): Promise<CompanySearchResponse> {\n const q = filters.q?.trim();\n if (!q) return EMPTY_COMPANY_SEARCH;\n\n const params = new URLSearchParams({ q });\n if (filters.country) params.set('country', filters.country);\n if (filters.industry) params.set('industry', filters.industry);\n if (filters.limit !== undefined) params.set('limit', String(filters.limit));\n\n return apiFetch<CompanySearchResponse>(config, `/api/search/companies?${params.toString()}`, {\n cache: 'no-store',\n ...options,\n });\n}\n\n/**\n * Skill typeahead. Returns up to 8 matches for the given prefix. Empty\n * input returns an empty array without hitting the server.\n */\nexport async function fetchSkillSuggestions(\n config: SifaApiConfig,\n query: string,\n options: ApiFetchOptions = {},\n): Promise<SkillSearchResult[]> {\n if (!query.trim()) return [];\n const path = `/api/search/skills?q=${encodeURIComponent(query)}&limit=8`;\n const data = await apiFetch<{ skills?: SkillSearchResult[] }>(config, path, {\n cache: 'no-store',\n ...options,\n });\n return data.skills ?? [];\n}\n\n/** Available filter facets (countries, industries, apps) for search UI. */\nexport async function fetchSearchFilters(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<FilterOptions> {\n try {\n return await apiFetch<FilterOptions>(config, '/api/search/filters', {\n next: { revalidate: 300 },\n ...options,\n });\n } catch {\n return EMPTY_FILTERS;\n }\n}\n\n/**\n * Canonical-skill search backing the position-editor and similar\n * skill-pickers. Hits `/api/skills/search` (the canonical-skills DB\n * lookup) which is distinct from {@link fetchSkillSuggestions}'s\n * `/api/search/skills` (the profile-skill typeahead).\n *\n * Returns `[]` on empty input (no network call) or any error.\n */\nexport async function searchSkills(\n config: SifaApiConfig,\n query: string,\n limit = 10,\n options: ApiFetchOptions = {},\n): Promise<SkillSuggestion[]> {\n if (!query.trim()) return [];\n const path = `/api/skills/search?q=${encodeURIComponent(query)}&limit=${limit}`;\n try {\n const data = await apiFetch<{ skills?: SkillSuggestion[] }>(config, path, {\n cache: 'no-store',\n ...options,\n });\n return data.skills ?? [];\n } catch {\n return [];\n }\n}\n","import type { PresentationLinkView } from '../../types/index.js';\nimport { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/**\n * Which claim a listed speaker makes about a topic. Phase 1 has no confirmed\n * data, so groups are named by the CLAIM, never a \"proven\" label:\n * - `spoke_about_it` — has a topic-matching delivery (or, with a topic set,\n * a matching presentation plus at least one delivery)\n * - `skilled` — holds the matching canonical skill but has no matching talk\n * (only appears when a topic is supplied)\n * - `open_to_speaking` — opted in but has never delivered (only appears when\n * no topic is supplied)\n */\nexport type SpeakerGroup = 'spoke_about_it' | 'skilled' | 'open_to_speaking';\n\n/** One person in the speaker directory. Everyone listed has opted in. */\nexport interface SpeakerCard {\n did: string;\n handle: string;\n displayName: string | null;\n avatar: string | null;\n headline: string | null;\n currentRole: string | null;\n currentCompany: string | null;\n deliveryCount: number;\n group: SpeakerGroup;\n matchedTopics: string[];\n /**\n * Self-reported event names from the speaker's own presentationDelivery\n * records — unconfirmed in Phase 1. `eventsSelfReported` is always true;\n * the web layer labels these as such.\n */\n recentEvents: string[];\n eventsSelfReported: boolean;\n /**\n * Up to 3 of the speaker's most-recent talks (self-reported), newest first.\n * `rkey` builds the talk-page URL via `buildTalkSlug(title, rkey)`. Optional:\n * absent from responses served before this field shipped, so consumers should\n * default to an empty list.\n */\n recentTalks?: { title: string; rkey: string }[];\n}\n\nexport interface SpeakersResponse {\n speakers: SpeakerCard[];\n}\n\n/** The reusable talk, or a standalone delivery when it has no parent talk. */\nexport interface TalkEvent {\n eventName: string | null;\n date: string | null;\n}\n\n/** Compact speaker card embedded in a talk row. */\nexport interface TalkSpeaker {\n did: string;\n handle: string;\n displayName: string | null;\n avatar: string | null;\n headline: string | null;\n currentRole: string | null;\n currentCompany: string | null;\n}\n\nexport interface TalkRow {\n /**\n * `presentation` = a reusable `id.sifa.profile.presentation` record.\n * `delivery` = a standalone presentationDelivery with no parent presentation.\n */\n kind: 'presentation' | 'delivery';\n rkey: string;\n title: string | null;\n snippet: string | null;\n links: PresentationLinkView[];\n writeupUri: string | null;\n speaker: TalkSpeaker;\n events: TalkEvent[];\n eventsSelfReported: boolean;\n deliveryCount: number;\n matchedTopics: string[];\n}\n\nexport interface TalksResponse {\n talks: TalkRow[];\n}\n\nexport interface SpeakerDirectoryFilters {\n /** Free-text topic (canonical skill name/slug/alias, talk title, or event). */\n topic?: string;\n /** Max rows to return; the API caps this at 50. */\n limit?: number;\n}\n\nconst EMPTY_SPEAKERS: SpeakersResponse = { speakers: [] };\nconst EMPTY_TALKS: TalksResponse = { talks: [] };\n\nfunction buildParams(filters: SpeakerDirectoryFilters): URLSearchParams {\n const params = new URLSearchParams();\n const topic = filters.topic?.trim();\n if (topic) params.set('topic', topic);\n if (filters.limit !== undefined) params.set('limit', String(filters.limit));\n return params;\n}\n\n/**\n * Speaker directory (Phase 1, read-only POC). Everyone returned has opted in to\n * speaking; past deliveries are a ranking signal, not an inclusion path. An\n * optional `topic` filters to people who hold the matching canonical skill,\n * have a matching presentation, or have a matching delivery. Results come\n * grouped and ordered by the API.\n *\n * Returns an empty list on any error so callers can render a graceful state.\n */\nexport async function fetchSpeakers(\n config: SifaApiConfig,\n filters: SpeakerDirectoryFilters = {},\n options: ApiFetchOptions = {},\n): Promise<SpeakersResponse> {\n const params = buildParams(filters);\n const query = params.toString();\n const path = query ? `/api/speakers?${query}` : '/api/speakers';\n try {\n return await apiFetch<SpeakersResponse>(config, path, {\n cache: 'no-store',\n ...options,\n });\n } catch {\n return EMPTY_SPEAKERS;\n }\n}\n\n/**\n * Talk directory (Phase 1, read-only POC). Lists talks by opted-in speakers,\n * delivered-first, then latest delivery date. Same optional `topic` filter as\n * {@link fetchSpeakers}. Returns an empty list on any error.\n */\nexport async function fetchTalks(\n config: SifaApiConfig,\n filters: SpeakerDirectoryFilters = {},\n options: ApiFetchOptions = {},\n): Promise<TalksResponse> {\n const params = buildParams(filters);\n const query = params.toString();\n const path = query ? `/api/talks?${query}` : '/api/talks';\n try {\n return await apiFetch<TalksResponse>(config, path, {\n cache: 'no-store',\n ...options,\n });\n } catch {\n return EMPTY_TALKS;\n }\n}\n","import { z } from 'zod';\n\n/**\n * Organization entity-resolution payloads (#159). Shared by the typeahead,\n * selection, and grow-on-demand import-search endpoints on sifa-api.\n */\n\n/**\n * A nullable string constrained to an http(s) URL. Rejects `javascript:` and\n * other script-bearing schemes at the SDK boundary so a hostile API response\n * cannot smuggle an XSS payload into a rendered `href`/`src`. Note: Wikidata\n * entity URIs are canonically `http://`, so both http and https are allowed.\n */\nconst httpUrlNullable = z\n .string()\n .refine((s) => /^https?:\\/\\//i.test(s), { message: 'must be an http(s) URL' })\n .nullable();\n\nconst searchResultCommon = {\n kind: z.string(),\n name: z.string(),\n domain: z.string().nullable(),\n country: z.string().nullable(),\n logoUrl: httpUrlNullable,\n parentName: z.string().nullable(),\n};\n\n/**\n * A single typeahead row. Discriminated on `source`: a curated `entity` row\n * carries `entityId`, a `pdl` staging row carries `pdlId`. The union guarantees\n * the identifier for the row's source is always present, so a stable React key\n * can never be `entity:undefined`. The disambiguation fields\n * (domain/country/parentName) drive the dropdown display.\n */\nexport const EntitySearchResultSchema = z.discriminatedUnion('source', [\n z.object({\n source: z.literal('entity'),\n entityId: z.number().int().positive(),\n ...searchResultCommon,\n }),\n z.object({\n source: z.literal('pdl'),\n pdlId: z.string().min(1),\n ...searchResultCommon,\n }),\n]);\nexport type EntitySearchResult = z.infer<typeof EntitySearchResultSchema>;\n\n/** Response of `GET /api/entities/search`. */\nexport const EntitySearchResponseSchema = z.object({\n results: z.array(EntitySearchResultSchema),\n hasMore: z.boolean(),\n});\nexport type EntitySearchResponse = z.infer<typeof EntitySearchResponseSchema>;\n\n/**\n * Body of `POST /api/entities/select`: promote a PDL row OR bump an entity.\n * Exactly one of `entityId`/`pdlId` must be present -- supplying both is\n * ambiguous (the server would have to silently pick one) and is rejected.\n */\nexport const EntitySelectRequestSchema = z\n .object({\n entityId: z.number().int().positive().optional(),\n pdlId: z.string().min(1).optional(),\n })\n .refine((v) => (v.entityId != null) !== (v.pdlId != null), {\n message: 'exactly one of entityId or pdlId is required',\n });\nexport type EntitySelectRequest = z.infer<typeof EntitySelectRequestSchema>;\n\n/** Response of `POST /api/entities/select`. `entityRef` is the portable\n * Wikidata/ROR/LEI URI to write to the position record, or null for a\n * PDL-only entity (its resolution stays AppView-side). */\nexport const EntitySelectResponseSchema = z.object({\n entityId: z.number().int().positive(),\n slug: z.string(),\n kind: z.string(),\n canonicalName: z.string(),\n domain: z.string().nullable(),\n /**\n * The entity's website, gated to sources trustworthy enough to prefill into a\n * record the user signs. Narrower than `domain`, which is a display value and\n * may come from a crawl. Null when the entity has no such source.\n */\n website: httpUrlNullable.default(null),\n /** Which tier `website` came from. Crawled is never an accepted source. */\n websiteTier: z.enum(['org', 'curated']).nullable().default(null),\n entityRef: httpUrlNullable,\n});\nexport type EntitySelectResponse = z.infer<typeof EntitySelectResponseSchema>;\n\n/** Response of `POST /api/entities/import-search`. */\nexport const EntityImportSearchResponseSchema = z.object({\n results: z.array(EntitySearchResultSchema),\n});\nexport type EntityImportSearchResponse = z.infer<typeof EntityImportSearchResponseSchema>;\n\n/**\n * Body of the domain grow-on-demand endpoints (`POST /api/entities/resolve-domain`\n * and `POST /api/entities/mint-domain`). The server re-validates the value as a\n * registrable domain; 253 is the max DNS name length.\n */\nexport const EntityResolveDomainRequestSchema = z.object({\n domain: z.string().min(1).max(253),\n});\nexport type EntityResolveDomainRequest = z.infer<typeof EntityResolveDomainRequestSchema>;\n\n/**\n * Response of `POST /api/entities/resolve-domain` (grow-on-demand Branch 1). Any\n * notable companies whose official website is the domain, imported from Wikidata.\n * `canMint` is true when nothing notable matched AND the domain is eligible for\n * the user-initiated mint-from-domain path -- it drives the \"Add <domain>\"\n * affordance.\n */\nexport const EntityResolveDomainResponseSchema = z.object({\n results: z.array(EntitySearchResultSchema),\n canMint: z.boolean(),\n});\nexport type EntityResolveDomainResponse = z.infer<typeof EntityResolveDomainResponseSchema>;\n\n/**\n * Response of `POST /api/entities/mint-domain` (grow-on-demand Branch 2). The\n * linkable entity minted from (or already resolved for) the domain. A non-2xx\n * status (e.g. the domain is not mintable, a confusable look-alike, or the site\n * yielded nothing usable) surfaces as a thrown error, not a null result.\n *\n * `pending` is true when the entity is a fresh hidden-pending mint: the\n * requesting user's own link resolves to it immediately, but it stays out of\n * other users' typeahead + aggregation until an admin approves it. Clients should\n * reflect this (\"added -- pending review\") rather than \"added & live\".\n */\nexport const EntityMintDomainResponseSchema = z.object({\n result: EntitySearchResultSchema,\n pending: z.boolean(),\n});\nexport type EntityMintDomainResponse = z.infer<typeof EntityMintDomainResponseSchema>;\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\nimport {\n EntitySearchResponseSchema,\n EntitySelectResponseSchema,\n EntityImportSearchResponseSchema,\n EntityResolveDomainResponseSchema,\n EntityMintDomainResponseSchema,\n type EntitySearchResponse,\n type EntitySearchResult,\n type EntitySelectRequest,\n type EntitySelectResponse,\n type EntityResolveDomainResponse,\n type EntityMintDomainResponse,\n} from '../../schemas/entity.js';\n\nconst EMPTY_SEARCH: EntitySearchResponse = { results: [], hasMore: false };\n\n/**\n * Organization typeahead. Returns curated entities first, then the PDL crawl,\n * deduped by domain. Empty input returns an empty result without a network call.\n */\nexport async function fetchEntitySearch(\n config: SifaApiConfig,\n query: string,\n limit?: number,\n options: ApiFetchOptions = {},\n): Promise<EntitySearchResponse> {\n if (!query.trim()) return EMPTY_SEARCH;\n const params = new URLSearchParams({ q: query });\n if (limit !== undefined) params.set('limit', String(limit));\n const data = await apiFetch<unknown>(config, `/api/entities/search?${params.toString()}`, {\n cache: 'no-store',\n ...options,\n });\n return EntitySearchResponseSchema.parse(data);\n}\n\n/**\n * Record a selection: promote a PDL row into a canonical entity (dedupe by\n * domain) or bump an existing entity's usage counter. Returns the entity plus\n * its portable `entityRef` (null for PDL-only entities). Requires a session.\n */\nexport async function selectEntity(\n config: SifaApiConfig,\n body: EntitySelectRequest,\n options: ApiFetchOptions = {},\n): Promise<EntitySelectResponse> {\n const data = await apiFetch<unknown>(config, '/api/entities/select', {\n method: 'POST',\n body,\n credentials: 'include',\n ...options,\n });\n return EntitySelectResponseSchema.parse(data);\n}\n\n/**\n * Grow-on-demand: when the local typeahead misses, resolve the query live via\n * Wikidata, import the org-class matches, and return them. Requires a session.\n * Empty input returns an empty array without a network call.\n */\nexport async function importSearchEntities(\n config: SifaApiConfig,\n query: string,\n options: ApiFetchOptions = {},\n): Promise<EntitySearchResult[]> {\n if (!query.trim()) return [];\n const data = await apiFetch<unknown>(config, '/api/entities/import-search', {\n method: 'POST',\n body: { q: query },\n credentials: 'include',\n ...options,\n });\n return EntityImportSearchResponseSchema.parse(data).results;\n}\n\n/**\n * Grow-on-demand by domain, Branch 1: when a domain-shaped typeahead query\n * misses locally, resolve any notable company whose official website is that\n * domain (Wikidata reverse P856), importing the matches. Read-only w.r.t.\n * minting. `canMint` tells the caller whether to offer the user-initiated\n * \"Add <domain>\" affordance. Requires a session.\n */\nexport async function resolveEntityDomain(\n config: SifaApiConfig,\n domain: string,\n options: ApiFetchOptions = {},\n): Promise<EntityResolveDomainResponse> {\n const data = await apiFetch<unknown>(config, '/api/entities/resolve-domain', {\n method: 'POST',\n body: { domain },\n credentials: 'include',\n ...options,\n });\n return EntityResolveDomainResponseSchema.parse(data);\n}\n\n/**\n * Grow-on-demand by domain, Branch 2 (user-initiated): mint a crawled-tier\n * entity from the domain's own homepage (or resolve it to a notable company if\n * one exists). Throws on a non-2xx response (domain not mintable, or the site\n * yielded nothing usable). Requires a session.\n */\nexport async function mintEntityDomain(\n config: SifaApiConfig,\n domain: string,\n options: ApiFetchOptions = {},\n): Promise<EntityMintDomainResponse> {\n const data = await apiFetch<unknown>(config, '/api/entities/mint-domain', {\n method: 'POST',\n body: { domain },\n credentials: 'include',\n ...options,\n });\n return EntityMintDomainResponseSchema.parse(data);\n}\n","import { encodeIdentifier, apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/** Lightweight profile representation used by discovery endpoints. */\nexport interface SimilarProfile {\n did: string;\n handle: string;\n displayName?: string | null;\n avatar?: string | null;\n headline?: string | null;\n currentRole?: string | null;\n currentCompany?: string | null;\n industry?: string | null;\n domain?: string | null;\n}\n\nexport interface SuggestionProfile {\n did: string;\n handle: string;\n displayName?: string;\n headline?: string;\n avatarUrl?: string;\n source: string;\n dismissed: boolean;\n blueskyVerified?: boolean;\n}\n\nexport interface SuggestionsResponse {\n onSifa: SuggestionProfile[];\n notOnSifa: SuggestionProfile[];\n cursor?: string;\n}\n\nexport interface FeaturedProfile {\n did: string;\n handle: string;\n displayName?: string;\n avatar?: string;\n pronouns?: string;\n headline?: string;\n about?: string;\n currentRole?: string;\n currentCompany?: string;\n locationCountry?: string;\n locationRegion?: string;\n /** Legacy alias for `locationLocality`; emitted by sifa-api during the additive response window. */\n locationCity?: string;\n /** community.lexicon.location.address field name -- prefer over `locationCity`. */\n locationLocality?: string;\n countryCode?: string;\n location?: string;\n website?: string;\n openTo?: string[];\n preferredWorkplace?: string[];\n availableFromUtc?: number;\n availableToUtc?: number;\n followersCount?: number;\n atprotoFollowersCount?: number;\n pdsProvider?: { name: string; host: string } | null;\n claimed: boolean;\n featuredDate: string;\n}\n\n/** Profiles similar to the given DID (matchmaking). Returns `[]` on error. */\nexport async function fetchSimilarProfiles(\n config: SifaApiConfig,\n did: string,\n opts: { limit?: number } & ApiFetchOptions = {},\n): Promise<SimilarProfile[]> {\n const limit = opts.limit ?? 5;\n const path = `/api/discover/similar/${encodeIdentifier(did)}?limit=${limit}`;\n try {\n const data = await apiFetch<{ profiles?: SimilarProfile[] }>(config, path, {\n next: { revalidate: 300 },\n timeoutMs: 5000,\n ...opts,\n });\n return data.profiles ?? [];\n } catch {\n return [];\n }\n}\n\nexport interface FetchSuggestionsOptions extends ApiFetchOptions {\n source?: string;\n includeDismissed?: boolean;\n cursor?: string;\n limit?: number;\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * `credentials: 'include'` does NOT propagate browser cookies in RSC,\n * so authenticated server fetches must forward the header explicitly.\n */\n cookieHeader?: string;\n}\n\n/** Discovery suggestions feed. Resolves to empty arrays on error. */\nexport async function fetchSuggestions(\n config: SifaApiConfig,\n opts: FetchSuggestionsOptions = {},\n): Promise<SuggestionsResponse> {\n const params = new URLSearchParams();\n if (opts.source) params.set('source', opts.source);\n if (opts.includeDismissed) params.set('include_dismissed', 'true');\n if (opts.cursor) params.set('cursor', opts.cursor);\n if (opts.limit) params.set('limit', String(opts.limit));\n\n const qs = params.toString();\n const headers: Record<string, string> = { ...(opts.headers ?? {}) };\n if (opts.cookieHeader) headers.cookie = opts.cookieHeader;\n\n try {\n return await apiFetch<SuggestionsResponse>(config, `/api/suggestions${qs ? `?${qs}` : ''}`, {\n credentials: 'include',\n cache: 'no-store',\n timeoutMs: 8000,\n ...opts,\n headers,\n });\n } catch {\n return { onSifa: [], notOnSifa: [] };\n }\n}\n\n/** Count of pending suggestions since an optional timestamp. */\nexport async function fetchSuggestionCount(\n config: SifaApiConfig,\n since?: string,\n options: ApiFetchOptions = {},\n): Promise<number> {\n const params = since ? `?since=${encodeURIComponent(since)}` : '';\n try {\n const data = await apiFetch<{ count?: number }>(config, `/api/suggestions/count${params}`, {\n credentials: 'include',\n cache: 'no-store',\n ...options,\n });\n return data.count ?? 0;\n } catch {\n return 0;\n }\n}\n\n/** Featured profile (rotated by sifa-api). Returns `null` when none. */\nexport async function fetchFeaturedProfile(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<FeaturedProfile | null> {\n try {\n return await apiFetch<FeaturedProfile>(config, '/api/featured-profile', {\n next: { revalidate: 900 },\n ...options,\n });\n } catch {\n return null;\n }\n}\n","import {\n apiFetch,\n encodeIdentifier,\n apiWrite,\n type ApiFetchOptions,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\nimport type { FollowFeedPage } from '../../schemas/feed.js';\n\nexport interface FollowProfile {\n did: string;\n handle: string;\n displayName?: string;\n headline?: string;\n avatarUrl?: string;\n source: string;\n claimed: boolean;\n followedAt: string;\n blueskyVerified?: boolean;\n blueskyVerifiedAt?: string | null;\n}\n\nexport interface FollowingResponse {\n follows: FollowProfile[];\n cursor?: string;\n}\n\n/** People the authenticated user follows. Empty on error. */\nexport async function fetchFollowing(\n config: SifaApiConfig,\n opts: { source?: string; cursor?: string; limit?: number } & ApiFetchOptions = {},\n): Promise<FollowingResponse> {\n const params = new URLSearchParams();\n if (opts.source) params.set('source', opts.source);\n if (opts.cursor) params.set('cursor', opts.cursor);\n if (opts.limit) params.set('limit', String(opts.limit));\n const qs = params.toString();\n\n try {\n return await apiFetch<FollowingResponse>(config, `/api/following${qs ? `?${qs}` : ''}`, {\n credentials: 'include',\n cache: 'no-store',\n ...opts,\n });\n } catch {\n return { follows: [] };\n }\n}\n\n/**\n * Result of {@link followUser}. Extends {@link WriteResult} with the\n * follow `rkey` returned by sifa-api on success. Self-follow + invalid\n * handle surface as `success: false` with the server-provided message;\n * dup-follow is idempotent (sifa-api E7) and resolves as `success: true`.\n */\nexport interface FollowUserResult extends WriteResult {\n rkey?: string;\n /** DID of the followed subject (server-resolved from the handle). */\n subjectDid?: string;\n}\n\n/**\n * Create an `id.sifa.graph.follow` record on the caller's PDS via the\n * AppView. Idempotent on duplicate (server catches the unique-violation\n * and returns 200, per sifa-api#673 E7).\n */\nexport function followUser(\n config: SifaApiConfig,\n handle: string,\n opts: { note?: string } & Omit<ApiFetchOptions, 'method' | 'body'> = {},\n): Promise<FollowUserResult> {\n const { note, ...rest } = opts;\n return apiWrite<{ rkey?: string; subjectDid?: string }>(\n config,\n `/api/follow/${encodeIdentifier(handle)}`,\n 'POST',\n {\n body: note !== undefined ? { note } : undefined,\n ...rest,\n },\n );\n}\n\n/** Delete the authenticated viewer's `id.sifa.graph.follow` for `handle`. */\nexport function unfollowUser(\n config: SifaApiConfig,\n handle: string,\n opts: Omit<ApiFetchOptions, 'method' | 'body'> = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/follow/${encodeIdentifier(handle)}`, 'DELETE', opts);\n}\n\nexport interface FollowListPage {\n follows: FollowProfile[];\n cursor: string | null;\n}\n\nexport interface FetchFollowListOptions extends ApiFetchOptions {\n cursor?: string;\n limit?: number;\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls\n * (mirrors {@link FetchActivityFeedOptions}; required for authenticated\n * server fetches because `credentials: 'include'` does not propagate\n * cookies from RSC).\n */\n cookieHeader?: string;\n}\n\nfunction buildListPath(prefix: string, opts: FetchFollowListOptions): string {\n const params = new URLSearchParams();\n if (opts.cursor) params.set('cursor', opts.cursor);\n if (opts.limit) params.set('limit', String(opts.limit));\n const qs = params.toString();\n return `${prefix}${qs ? `?${qs}` : ''}`;\n}\n\n/**\n * Paginated list of `handle`'s followers. Returns an empty page on error\n * so the UI can render a graceful \"no followers yet\" state.\n */\nexport async function getFollowers(\n config: SifaApiConfig,\n handle: string,\n opts: FetchFollowListOptions = {},\n): Promise<FollowListPage> {\n const headers: Record<string, string> = { ...(opts.headers ?? {}) };\n if (opts.cookieHeader) headers.cookie = opts.cookieHeader;\n try {\n const res = await apiFetch<{ follows: FollowProfile[]; cursor?: string | null }>(\n config,\n buildListPath(`/api/profile/${encodeIdentifier(handle)}/followers`, opts),\n { credentials: 'include', cache: 'no-store', ...opts, headers },\n );\n return { follows: res.follows, cursor: res.cursor ?? null };\n } catch {\n return { follows: [], cursor: null };\n }\n}\n\n/** Paginated list of who `handle` follows. */\nexport async function getFollowing(\n config: SifaApiConfig,\n handle: string,\n opts: FetchFollowListOptions = {},\n): Promise<FollowListPage> {\n const headers: Record<string, string> = { ...(opts.headers ?? {}) };\n if (opts.cookieHeader) headers.cookie = opts.cookieHeader;\n try {\n const res = await apiFetch<{ follows: FollowProfile[]; cursor?: string | null }>(\n config,\n buildListPath(`/api/profile/${encodeIdentifier(handle)}/following`, opts),\n { credentials: 'include', cache: 'no-store', ...opts, headers },\n );\n return { follows: res.follows, cursor: res.cursor ?? null };\n } catch {\n return { follows: [], cursor: null };\n }\n}\n\n/**\n * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).\n * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere\n * Stream are two distinct surfaces with different data paths (Barazo API\n * for Timeline, live PDS reads + Valkey for Stream). These collapsed feed\n * types are no longer consumed. Scheduled for removal in next major bump.\n */\nexport interface FetchFollowingFeedOptions extends ApiFetchOptions {\n cursor?: string;\n limit?: number;\n /**\n * Comma-separated category filter (per sifa-api#673 TR10). Forwarded\n * as-is; the server validates allowed values.\n */\n categories?: string[];\n cookieHeader?: string;\n}\n\n/**\n * V5 home feed: Sifa events + curated ATmosphere creation events filtered\n * by the authenticated viewer's followees. Composite cursor (per E5/TR4).\n * Returns an empty page on error.\n *\n * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).\n * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere\n * Stream are two distinct surfaces with different data paths (Barazo API\n * for Timeline, live PDS reads + Valkey for Stream). This fetcher is no\n * longer consumed. Scheduled for removal in next major bump.\n */\nexport async function getFollowingFeed(\n config: SifaApiConfig,\n opts: FetchFollowingFeedOptions = {},\n): Promise<FollowFeedPage> {\n const params = new URLSearchParams();\n if (opts.cursor) params.set('cursor', opts.cursor);\n if (opts.limit) params.set('limit', String(opts.limit));\n if (opts.categories && opts.categories.length > 0) {\n params.set('categories', opts.categories.join(','));\n }\n const qs = params.toString();\n\n const headers: Record<string, string> = { ...(opts.headers ?? {}) };\n if (opts.cookieHeader) headers.cookie = opts.cookieHeader;\n\n try {\n const res = await apiFetch<{ items: FollowFeedPage['items']; cursor?: string | null }>(\n config,\n `/api/following/feed${qs ? `?${qs}` : ''}`,\n { credentials: 'include', cache: 'no-store', ...opts, headers },\n );\n return { items: res.items ?? [], cursor: res.cursor ?? null };\n } catch {\n return { items: [], cursor: null };\n }\n}\n","import { encodeIdentifier, apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\nimport type { FollowProfileItem } from '../../schemas/follow-profile.js';\n\n/**\n * Options shared by the cursor-paginated follow-graph endpoints introduced in\n * `sifa-api#674` (mutuals + bluesky-suggestions). Mirrors\n * `FetchFollowListOptions` in `./follow.ts` but the response wrapper here uses\n * the `{ items, cursor }` shape (not `{ follows, cursor }`).\n */\nexport interface FetchFollowProfilePageOptions extends ApiFetchOptions {\n cursor?: string;\n limit?: number;\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls\n * (mirrors `FetchFollowListOptions`; required for authenticated server\n * fetches because `credentials: 'include'` does not propagate cookies from\n * RSC).\n */\n cookieHeader?: string;\n}\n\n/** Page of {@link FollowProfileItem} rows with an opaque next-page cursor. */\nexport interface FollowProfilePageResponse {\n items: FollowProfileItem[];\n cursor: string | null;\n}\n\nfunction buildListPath(prefix: string, opts: FetchFollowProfilePageOptions): string {\n const params = new URLSearchParams();\n if (opts.cursor) params.set('cursor', opts.cursor);\n if (opts.limit) params.set('limit', String(opts.limit));\n const qs = params.toString();\n return `${prefix}${qs ? `?${qs}` : ''}`;\n}\n\nasync function fetchFollowProfilePage(\n config: SifaApiConfig,\n path: string,\n opts: FetchFollowProfilePageOptions,\n): Promise<FollowProfilePageResponse> {\n const headers: Record<string, string> = { ...(opts.headers ?? {}) };\n if (opts.cookieHeader) headers.cookie = opts.cookieHeader;\n try {\n const res = await apiFetch<{ items?: FollowProfileItem[]; cursor?: string | null }>(\n config,\n path,\n { credentials: 'include', cache: 'no-store', ...opts, headers },\n );\n return { items: res.items ?? [], cursor: res.cursor ?? null };\n } catch {\n return { items: [], cursor: null };\n }\n}\n\n/**\n * Cursor-paginated list of mutual sifa-source follows for `handleOrDid`\n * (X↔Y both follow each other on Sifa). Backed by\n * `GET /api/profile/{handleOrDid}/mutuals` from `sifa-api#674`. Public —\n * does not require auth. Returns an empty page on error.\n */\nexport async function getMutuals(\n config: SifaApiConfig,\n handleOrDid: string,\n opts: FetchFollowProfilePageOptions = {},\n): Promise<FollowProfilePageResponse> {\n return fetchFollowProfilePage(\n config,\n buildListPath(`/api/profile/${encodeIdentifier(handleOrDid)}/mutuals`, opts),\n opts,\n );\n}\n\n/**\n * Cursor-paginated list of Sifa users the viewer follows on Bluesky but NOT\n * on Sifa, filtered to people active on Sifa. Backed by\n * `GET /api/me/bluesky-suggestions` from `sifa-api#674`. Auth-required.\n * Returns an empty page on error.\n */\nexport async function getBlueskySuggestions(\n config: SifaApiConfig,\n opts: FetchFollowProfilePageOptions = {},\n): Promise<FollowProfilePageResponse> {\n return fetchFollowProfilePage(config, buildListPath('/api/me/bluesky-suggestions', opts), opts);\n}\n","import {\n apiFetch,\n encodeIdentifier,\n apiWrite,\n type ApiFetchOptions,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\nimport type { FeatureAllowlistEntry, FeatureFlag } from '../../schemas/follow-profile.js';\n\n/**\n * Options for {@link listFeatureAllowlist}. Supports the same `cookieHeader`\n * passthrough as the other admin reads for RSC contexts.\n */\nexport interface ListFeatureAllowlistOptions extends ApiFetchOptions {\n cookieHeader?: string;\n}\n\n/** Response shape of `GET /api/admin/feature-allowlists/:flag`. */\nexport interface FeatureAllowlistResponse {\n items: FeatureAllowlistEntry[];\n}\n\n/**\n * List all DIDs on the given feature flag's allowlist. Admin-gated server-\n * side (caller must be an admin). Returns an empty list on error so the UI\n * can render a graceful empty state.\n */\nexport async function listFeatureAllowlist(\n config: SifaApiConfig,\n flag: FeatureFlag,\n opts: ListFeatureAllowlistOptions = {},\n): Promise<FeatureAllowlistResponse> {\n const headers: Record<string, string> = { ...(opts.headers ?? {}) };\n if (opts.cookieHeader) headers.cookie = opts.cookieHeader;\n try {\n const res = await apiFetch<{ items?: FeatureAllowlistEntry[] }>(\n config,\n `/api/admin/feature-allowlists/${encodeURIComponent(flag)}`,\n { credentials: 'include', cache: 'no-store', ...opts, headers },\n );\n return { items: res.items ?? [] };\n } catch {\n return { items: [] };\n }\n}\n\n/**\n * Add (or upsert the note for) a DID on the given flag's allowlist. Maps to\n * `POST /api/admin/feature-allowlists/{flag}`. Returns a {@link WriteResult};\n * never throws.\n */\nexport function addFeatureAllowlist(\n config: SifaApiConfig,\n flag: FeatureFlag,\n did: string,\n opts: { note?: string } & Omit<ApiFetchOptions, 'method' | 'body'> = {},\n): Promise<WriteResult> {\n const { note, ...rest } = opts;\n return apiWrite(config, `/api/admin/feature-allowlists/${encodeURIComponent(flag)}`, 'POST', {\n body: note !== undefined ? { did, note } : { did },\n ...rest,\n });\n}\n\n/**\n * Remove a DID from the given flag's allowlist. Maps to\n * `DELETE /api/admin/feature-allowlists/{flag}/{did}`. Returns a\n * {@link WriteResult}; never throws.\n */\nexport function removeFeatureAllowlist(\n config: SifaApiConfig,\n flag: FeatureFlag,\n did: string,\n opts: Omit<ApiFetchOptions, 'method' | 'body'> = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/admin/feature-allowlists/${encodeURIComponent(flag)}/${encodeIdentifier(did)}`,\n 'DELETE',\n opts,\n );\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/**\n * Options for {@link getAdminReviewQueues}. Supports the same `cookieHeader`\n * passthrough as the other admin reads for RSC contexts.\n */\nexport interface GetAdminReviewQueuesOptions extends ApiFetchOptions {\n cookieHeader?: string;\n}\n\n/** Response shape of `GET /api/admin/stats/review-queues`. */\nexport interface AdminReviewQueues {\n ideas: number;\n nameCorrections: number;\n pendingCompanies: number;\n /** Sum of the three queues. */\n total: number;\n generatedAt: string;\n}\n\n/**\n * Open counts for the three admin review queues (ideas, pending companies,\n * name corrections) plus their total.\n *\n * Unlike {@link listFeatureAllowlist} this does NOT swallow errors: a zeroed\n * payload would render as \"all queues clear\" in the admin nav, which is worse\n * than rendering nothing. Callers decide how to degrade.\n */\nexport async function getAdminReviewQueues(\n config: SifaApiConfig,\n opts: GetAdminReviewQueuesOptions = {},\n): Promise<AdminReviewQueues> {\n const headers: Record<string, string> = { ...(opts.headers ?? {}) };\n if (opts.cookieHeader) headers.cookie = opts.cookieHeader;\n\n const res = await apiFetch<Partial<AdminReviewQueues>>(config, '/api/admin/stats/review-queues', {\n credentials: 'include',\n cache: 'no-store',\n ...opts,\n headers,\n });\n\n const ideas = res.ideas ?? 0;\n const nameCorrections = res.nameCorrections ?? 0;\n const pendingCompanies = res.pendingCompanies ?? 0;\n\n return {\n ideas,\n nameCorrections,\n pendingCompanies,\n // Derived rather than trusted so an API that predates the field still\n // yields a usable pill count.\n total: res.total ?? ideas + nameCorrections + pendingCompanies,\n generatedAt: res.generatedAt ?? '',\n };\n}\n","import type { ActivityLabel } from '../../cards/adult-content.js';\nimport { encodeIdentifier, apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\nimport type { QuotedPostResult } from './quoted-posts.js';\n\n/**\n * Liveness of an activity card's destination, as reported by sifa-api's\n * `/api/activity` enrichment (see sifa-api `url-health-checker`). How liveness\n * is measured depends on the card's health strategy (see `resolveCardHealth`):\n * first-party permalinks (`record`) are checked by record existence on the PDS;\n * foreign/derived targets (`url`) by HTTP reachability (HEAD, then GET).\n *\n * ok -- record exists, or the URL returned 2xx/3xx\n * broken -- confirmed dead (record deleted, or >=2 consecutive 4xx / >=5 consecutive 5xx)\n * unverifiable -- 403/429, PDS unreachable, or network error; NOT dead\n * unknown -- newly seen, not yet checked\n *\n * Consumers should only suppress UI on `'broken'`. All other values\n * (including missing) mean \"render normally\".\n */\nexport type ActivityItemLinkHealth = 'ok' | 'broken' | 'unverifiable' | 'unknown';\n\nexport interface HeatmapDay {\n date: string;\n total: number;\n apps: { appId: string; count: number }[];\n}\n\nexport interface HeatmapResponse {\n days: HeatmapDay[];\n appTotals: { appId: string; appName: string; total: number }[];\n thresholds: [number, number, number, number];\n}\n\nexport interface ActivityItem {\n uri: string;\n cid: string;\n collection: string;\n rkey: string;\n record: Record<string, unknown>;\n appId: string;\n appName: string;\n category: string;\n indexedAt: string;\n /**\n * Set by the server when an `app.bsky.embed.record` quote was already\n * resolved upstream (AppView path). Mutually exclusive with `quotedPostUri`.\n */\n quotedPost?: QuotedPostResult;\n /**\n * Set by the server when an `app.bsky.embed.record` quote needs client-side\n * resolution (PDS path). Pass batches to {@link resolveQuotedPosts}.\n * Mutually exclusive with `quotedPost`.\n */\n quotedPostUri?: string;\n /**\n * Reachability of the card's external destination as last checked by\n * sifa-api. Undefined for legacy responses; treat as 'unknown'.\n * See {@link ActivityItemLinkHealth}.\n */\n linkHealth?: ActivityItemLinkHealth;\n /**\n * Content labels from `app.bsky.feed.defs#postView.labels`. Set by\n * sifa-api for Bluesky posts; undefined for other sources and legacy\n * responses. Pass items to {@link hasAdultContent} to decide whether to\n * gate media. See {@link ActivityLabel}.\n */\n labels?: ActivityLabel[];\n /**\n * The owner has hidden this item from their profile. Only ever set on the\n * owner's own view of their feed -- every other surface omits hidden items\n * rather than flagging them -- so a card can offer an unhide in place.\n */\n hidden?: boolean;\n}\n\nexport interface ActivityTeaserResponse {\n items: ActivityItem[];\n blueskyGated?: boolean;\n backfillPending?: boolean;\n failedApps?: string[];\n}\n\nexport interface ActivityFeedResponse {\n items: ActivityItem[];\n cursor: string | null;\n hasMore: boolean;\n availableCategories?: string[];\n blueskyGated?: boolean;\n failedApps?: string[];\n}\n\n/**\n * Per-day activity counts for a profile across all ATproto apps. Returns\n * `null` on any error so callers can render a graceful empty state.\n */\nexport async function fetchHeatmapData(\n config: SifaApiConfig,\n handleOrDid: string,\n days: number,\n options: ApiFetchOptions = {},\n): Promise<HeatmapResponse | null> {\n const path = `/api/activity/${encodeIdentifier(handleOrDid)}/heatmap?days=${days}`;\n try {\n return await apiFetch<HeatmapResponse>(config, path, {\n next: { revalidate: 900, tags: [`heatmap-${handleOrDid}`] },\n ...options,\n });\n } catch {\n return null;\n }\n}\n\nexport interface FetchActivityTeaserOptions extends ApiFetchOptions {\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * Required for authenticated server fetches because `credentials: 'include'`\n * does not propagate browser cookies in RSC.\n */\n cookieHeader?: string;\n}\n\n/**\n * Recent activity teaser for a profile (homepage-sized slice). Caps the\n * upstream wait so the SSR path cannot hang. Returns `null` on any error.\n */\nexport async function fetchActivityTeaser(\n config: SifaApiConfig,\n handleOrDid: string,\n options: FetchActivityTeaserOptions = {},\n): Promise<ActivityTeaserResponse | null> {\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n return await apiFetch<ActivityTeaserResponse>(\n config,\n `/api/activity/${encodeIdentifier(handleOrDid)}/teaser`,\n {\n credentials: 'include',\n timeoutMs: 8000,\n next: { revalidate: 300, tags: [`activity-teaser-${handleOrDid}`] },\n ...options,\n headers,\n },\n );\n } catch {\n return null;\n }\n}\n\nexport interface FetchActivityFeedOptions extends ApiFetchOptions {\n category?: string;\n limit?: number;\n cursor?: string;\n cookieHeader?: string;\n}\n\n/**\n * Paginated activity feed for a profile. Always fresh (`cache: 'no-store'`).\n * Returns `null` on any error.\n */\nexport async function fetchActivityFeed(\n config: SifaApiConfig,\n handleOrDid: string,\n options: FetchActivityFeedOptions = {},\n): Promise<ActivityFeedResponse | null> {\n const params = new URLSearchParams();\n if (options.category) params.set('category', options.category);\n if (options.limit) params.set('limit', String(options.limit));\n if (options.cursor) params.set('cursor', options.cursor);\n const qs = params.toString();\n\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n return await apiFetch<ActivityFeedResponse>(\n config,\n `/api/activity/${encodeIdentifier(handleOrDid)}${qs ? `?${qs}` : ''}`,\n {\n credentials: 'include',\n cache: 'no-store',\n ...options,\n headers,\n },\n );\n } catch {\n return null;\n }\n}\n","import { z } from 'zod';\n\nimport { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/**\n * A single merged pull request ingested from GitHub, as served by sifa-api's\n * `GET /api/me/github/pull-requests`. Mirrors the `github_contributions` row.\n */\nexport const GithubPullRequestSchema = z.object({\n prNumber: z.number(),\n repoOwner: z.string(),\n repoName: z.string(),\n title: z.string(),\n url: z.string(),\n language: z.string().nullable(),\n additions: z.number(),\n deletions: z.number(),\n /** ISO 8601 merge timestamp. */\n mergedAt: z.string(),\n});\nexport type GithubPullRequest = z.infer<typeof GithubPullRequestSchema>;\n\nexport const MyGithubPullRequestsResponseSchema = z.object({\n items: z.array(GithubPullRequestSchema),\n hasMore: z.boolean(),\n});\nexport type MyGithubPullRequestsResponse = z.infer<typeof MyGithubPullRequestsResponseSchema>;\n\nexport interface FetchMyGithubPullRequestsOptions extends ApiFetchOptions {\n limit?: number;\n offset?: number;\n /** Forwarded as the `cookie` header for server-side (SSR) calls. */\n cookieHeader?: string;\n}\n\n/**\n * Fetch the authenticated viewer's own ingested merged PRs (newest first).\n * Auth-scoped: relies on the session cookie (`credentials: 'include'`), so it\n * returns the caller's PRs, not a public handle's. Backs the GitHub importer.\n */\nexport async function fetchMyGithubPullRequests(\n config: SifaApiConfig,\n options: FetchMyGithubPullRequestsOptions = {},\n): Promise<MyGithubPullRequestsResponse> {\n const { limit, offset, cookieHeader, ...fetchOptions } = options;\n\n const params = new URLSearchParams();\n if (limit !== undefined) params.set('limit', String(limit));\n if (offset !== undefined) params.set('offset', String(offset));\n const qs = params.toString();\n\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (cookieHeader) headers.cookie = cookieHeader;\n\n const data = await apiFetch<unknown>(\n config,\n `/api/me/github/pull-requests${qs ? `?${qs}` : ''}`,\n {\n credentials: 'include',\n cache: 'no-store',\n ...fetchOptions,\n headers,\n },\n );\n\n return MyGithubPullRequestsResponseSchema.parse(data);\n}\n","import { encodeIdentifier, apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/**\n * Counts confirmed endorsements received by a DID. The backend's\n * `GET /api/endorsement/:did` already returns only confirmed endorsements\n * (via inner join with `endorsementConfirmations`), so this helper just\n * returns the array length. Failures return 0 so callers can route safely.\n *\n * Public endpoint -- no credentials needed.\n */\nexport async function fetchEndorsementCount(\n config: SifaApiConfig,\n did: string,\n options: ApiFetchOptions = {},\n): Promise<number> {\n const path = `/api/endorsement/${encodeIdentifier(did)}`;\n try {\n const data = await apiFetch<unknown>(config, path, {\n cache: 'no-store',\n timeoutMs: 5000,\n ...options,\n });\n if (typeof data !== 'object' || data === null || !('endorsements' in data)) {\n return 0;\n }\n const endorsements = data.endorsements;\n return Array.isArray(endorsements) ? endorsements.length : 0;\n } catch {\n return 0;\n }\n}\n","import { encodeIdentifier, apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\nexport interface FetchNetworkStreamCountOptions extends ApiFetchOptions {\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * Required for authenticated server fetches because `credentials: 'include'`\n * does not propagate browser cookies in RSC.\n *\n * When omitted, the request falls back to `credentials: 'include'` so\n * client-side calls work without extra plumbing.\n */\n cookieHeader?: string;\n}\n\n/**\n * Counts items in the authenticated user's network stream digest. The\n * underlying `GET /api/stream/network` endpoint may 404 while the feature\n * is in development; in that case (and on any other error) this returns\n * 0 so callers can route safely to a fallback experience.\n */\nexport async function fetchNetworkStreamCount(\n config: SifaApiConfig,\n did: string,\n options: FetchNetworkStreamCountOptions = {},\n): Promise<number> {\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n const data = await apiFetch<unknown>(\n config,\n `/api/stream/network?did=${encodeIdentifier(did)}`,\n {\n cache: 'no-store',\n timeoutMs: 5000,\n ...(options.cookieHeader ? {} : { credentials: 'include' }),\n ...options,\n headers,\n },\n );\n if (typeof data !== 'object' || data === null || !('items' in data)) {\n return 0;\n }\n const items = data.items;\n return Array.isArray(items) ? items.length : 0;\n } catch {\n return 0;\n }\n}\n","import {\n apiFetch,\n apiWrite,\n type ApiFetchOptions,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/** Per-URI reaction state for the authenticated viewer. */\nexport interface ReactionStatus {\n reacted: boolean;\n rkey?: string;\n collection?: string;\n}\n\n/** Result of checking whether the authenticated viewer has an account on a given app. */\nexport interface AccountCheckResult {\n hasAccount: boolean;\n appName: string;\n appUrl: string;\n}\n\nexport interface FetchReactionStatusOptions extends ApiFetchOptions {\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * Required for authenticated server fetches because `credentials: 'include'`\n * does not propagate browser cookies in RSC.\n */\n cookieHeader?: string;\n}\n\n/**\n * Batch-look up reaction status for multiple URIs. Returns `{}` for an\n * empty input list (no network call) and `null` on any error.\n */\nexport async function fetchReactionStatus(\n config: SifaApiConfig,\n uris: string[],\n options: FetchReactionStatusOptions = {},\n): Promise<Record<string, ReactionStatus> | null> {\n if (uris.length === 0) return {};\n\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n return await apiFetch<Record<string, ReactionStatus>>(\n config,\n `/api/reactions/status?uris=${encodeURIComponent(uris.join(','))}`,\n {\n credentials: 'include',\n ...options,\n headers,\n },\n );\n } catch {\n return null;\n }\n}\n\nexport interface CheckAppAccountOptions extends ApiFetchOptions {\n cookieHeader?: string;\n}\n\n/**\n * Check whether the authenticated viewer has an account on a given app.\n * Returns `null` on any error.\n */\nexport async function checkAppAccount(\n config: SifaApiConfig,\n appId: string,\n options: CheckAppAccountOptions = {},\n): Promise<AccountCheckResult | null> {\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n return await apiFetch<AccountCheckResult>(\n config,\n `/api/reactions/account-check/${encodeURIComponent(appId)}`,\n {\n credentials: 'include',\n ...options,\n headers,\n },\n );\n } catch {\n return null;\n }\n}\n\n/** Result of a successful {@link createReaction}. */\nexport interface ReactionResult {\n uri: string;\n rkey: string;\n}\n\n/** Structured error returned by {@link createReaction} on failure. */\nexport interface ReactionError {\n type: 'scope_insufficient' | 'error';\n /** When `type === 'scope_insufficient'`, the lexicon scope the user must re-authorize for. */\n requiredScope?: string;\n}\n\n/**\n * Create a reaction (like / star) on a target ATproto record.\n *\n * Returns a discriminated-union result instead of the generic\n * {@link WriteResult} shape because reactions have a distinct\n * \"scope insufficient\" failure that callers handle differently from\n * other errors (it triggers an OAuth scope-upgrade flow rather than\n * an error toast).\n *\n * Never throws.\n */\nexport async function createReaction(\n config: SifaApiConfig,\n targetUri: string,\n appId: string,\n targetCid?: string,\n options: ApiFetchOptions = {},\n): Promise<{ ok: true; data: ReactionResult } | { ok: false; error: ReactionError }> {\n const fetchFn = config.fetch ?? globalThis.fetch;\n const url = `${config.baseUrl}/api/reactions`;\n\n try {\n const res = await fetchFn(url, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...(options.headers ?? {}) },\n credentials: options.credentials ?? 'include',\n body: JSON.stringify({ targetUri, appId, targetCid }),\n signal: options.signal ?? AbortSignal.timeout(options.timeoutMs ?? 10_000),\n });\n\n if (!res.ok) {\n if (res.status === 403) {\n try {\n const body = (await res.json()) as { error?: string; requiredScope?: string };\n if (body.error === 'ScopeInsufficient') {\n return {\n ok: false,\n error: { type: 'scope_insufficient', requiredScope: body.requiredScope },\n };\n }\n } catch {\n // Fall through to generic error\n }\n }\n return { ok: false, error: { type: 'error' } };\n }\n\n const data = (await res.json()) as ReactionResult;\n return { ok: true, data };\n } catch {\n return { ok: false, error: { type: 'error' } };\n }\n}\n\n/**\n * Delete a reaction (like / star) on a target ATproto record. Returns\n * `{ success: true }` on 2xx, `{ success: false, error }` on failure.\n */\nexport function deleteReaction(\n config: SifaApiConfig,\n targetUri: string,\n appId: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/reactions', 'DELETE', {\n body: { targetUri, appId },\n ...options,\n });\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\nexport interface QuotedPostAuthor {\n did: string;\n handle: string;\n displayName?: string;\n avatar?: string;\n}\n\nexport interface QuotedPostImage {\n thumb: string;\n fullsize: string;\n alt?: string;\n}\n\nexport interface QuotedPostView {\n uri: string;\n cid: string;\n author: QuotedPostAuthor;\n text: string;\n createdAt: string;\n images?: QuotedPostImage[];\n}\n\nexport type QuotedPostResult =\n | { status: 'ok'; record: QuotedPostView }\n | { status: 'deleted'; uri: string }\n | { status: 'unavailable'; uri: string };\n\n/** Max URIs per request to `POST /api/quoted-posts/resolve` (mirrors server cap). */\nexport const QUOTED_POSTS_BATCH_MAX = 20;\n\nexport interface ResolveQuotedPostsOptions extends ApiFetchOptions {\n /** Cookie header for Next.js RSC server-side calls; ignored in browsers. */\n cookieHeader?: string;\n}\n\n/**\n * Resolve a batch of AT-URIs to their quoted-post snapshots via the Sifa AppView.\n *\n * Auto-deduplicates input URIs and splits requests into chunks of\n * {@link QUOTED_POSTS_BATCH_MAX} so callers can pass an arbitrary-length array.\n * Each chunk is fired in parallel. The server caches results in Valkey, so\n * repeated calls for the same URI are cheap.\n *\n * Returns a map of `uri -> QuotedPostResult`. URIs that fail (network error,\n * non-2xx, or the server omitting them) are absent from the map; the caller\n * should render a skeleton or tombstone for those.\n */\nexport async function resolveQuotedPosts(\n config: SifaApiConfig,\n uris: string[],\n options: ResolveQuotedPostsOptions = {},\n): Promise<Record<string, QuotedPostResult>> {\n if (uris.length === 0) return {};\n\n const unique = [...new Set(uris)];\n const batches: string[][] = [];\n for (let i = 0; i < unique.length; i += QUOTED_POSTS_BATCH_MAX) {\n batches.push(unique.slice(i, i + QUOTED_POSTS_BATCH_MAX));\n }\n\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n const results: Record<string, QuotedPostResult> = {};\n await Promise.all(\n batches.map(async (batch) => {\n try {\n const data = await apiFetch<Record<string, QuotedPostResult>>(\n config,\n '/api/quoted-posts/resolve',\n {\n method: 'POST',\n body: { uris: batch },\n credentials: 'include',\n timeoutMs: 8000,\n ...options,\n headers,\n },\n );\n Object.assign(results, data);\n } catch {\n // Leave failed URIs absent so the consumer can render a fallback.\n }\n }),\n );\n\n return results;\n}\n","import {\n apiFetch,\n apiWrite,\n type ApiFetchOptions,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/** Voter on a roadmap item. */\nexport interface RoadmapVoter {\n did: string;\n avatarUrl?: string;\n}\n\n/** Map of item key -> vote tally and voter list. */\nexport type RoadmapVotesResponse = Record<string, { count: number; voters: RoadmapVoter[] }>;\n\n/**\n * Public roadmap vote tallies, keyed by item. Returns `{}` on any error.\n */\nexport async function fetchRoadmapVotes(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<RoadmapVotesResponse> {\n try {\n return await apiFetch<RoadmapVotesResponse>(config, '/api/roadmap/votes', {\n cache: 'no-store',\n ...options,\n });\n } catch {\n return {};\n }\n}\n\nexport interface FetchMyRoadmapVotesOptions extends ApiFetchOptions {\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * Required for authenticated server fetches because `credentials: 'include'`\n * does not propagate browser cookies in RSC.\n */\n cookieHeader?: string;\n}\n\n/**\n * Roadmap items the authenticated user has voted on. Returns `[]` on any\n * error or when the response payload is shaped unexpectedly.\n */\nexport async function fetchMyRoadmapVotes(\n config: SifaApiConfig,\n options: FetchMyRoadmapVotesOptions = {},\n): Promise<string[]> {\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n const data = await apiFetch<{ voted?: string[] }>(config, '/api/roadmap/votes/me', {\n credentials: 'include',\n ...options,\n headers,\n });\n return data.voted ?? [];\n } catch {\n return [];\n }\n}\n\n/** Result of a successful {@link castRoadmapVote} -- the created upvote record. */\nexport interface RoadmapVoteResult {\n uri: string;\n rkey: string;\n}\n\n/** Structured error returned by {@link castRoadmapVote} on failure. */\nexport interface RoadmapVoteError {\n type: 'scope_insufficient' | 'error';\n /**\n * When `type === 'scope_insufficient'`, the lexicon collection the user must\n * re-authorize for (e.g. `app.userinput.upvote`). sifa-web maps this to an\n * OAuth scope-upgrade flow (`/oauth/reauth?scope=repo:<collection>`).\n */\n requiredScope?: string;\n}\n\n/**\n * Discriminated-union result of {@link castRoadmapVote}. Exported so the\n * `useCastRoadmapVote` hook and SDK consumers can type mutation handlers\n * against a single source of truth.\n */\nexport type CastRoadmapVoteResult =\n { ok: true; data: RoadmapVoteResult } | { ok: false; error: RoadmapVoteError };\n\n/**\n * Cast a vote on a roadmap item by its key.\n *\n * Writes an `app.userinput.upvote` record into the viewer's PDS (server-side,\n * via their OAuth session). Returns a discriminated-union result rather than\n * the generic {@link WriteResult} because a first-time voter's PDS grant may\n * not yet include the `app.userinput.upvote` collection: the AppView responds\n * 403 `ScopeInsufficient`, which the caller handles by triggering an OAuth\n * scope upgrade rather than showing an error. Mirrors {@link createReaction}.\n *\n * Never throws.\n */\nexport async function castRoadmapVote(\n config: SifaApiConfig,\n key: string,\n options: ApiFetchOptions = {},\n): Promise<CastRoadmapVoteResult> {\n const fetchFn = config.fetch ?? globalThis.fetch;\n const url = `${config.baseUrl}/api/roadmap/votes/${encodeURIComponent(key)}`;\n\n try {\n const res = await fetchFn(url, {\n method: 'POST',\n // No body: the item key is in the URL. Do NOT declare a JSON content-type\n // for an empty body — Fastify rejects that with a 400 before the handler\n // runs. Only forward caller-provided headers.\n ...(options.headers ? { headers: options.headers } : {}),\n credentials: options.credentials ?? 'include',\n signal: options.signal ?? AbortSignal.timeout(options.timeoutMs ?? 10_000),\n });\n\n if (!res.ok) {\n if (res.status === 403) {\n try {\n const body = (await res.json()) as { error?: string; requiredScope?: string };\n if (body.error === 'ScopeInsufficient') {\n return {\n ok: false,\n error: { type: 'scope_insufficient', requiredScope: body.requiredScope },\n };\n }\n } catch {\n // Fall through to generic error.\n }\n }\n return { ok: false, error: { type: 'error' } };\n }\n\n const data = (await res.json()) as RoadmapVoteResult;\n return { ok: true, data };\n } catch {\n return { ok: false, error: { type: 'error' } };\n }\n}\n\n/** Retract a previously-cast roadmap vote. */\nexport function retractRoadmapVote(\n config: SifaApiConfig,\n key: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/roadmap/votes/${encodeURIComponent(key)}`, 'DELETE', options);\n}\n","import {\n apiFetch,\n apiWrite,\n type ApiFetchOptions,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/**\n * What the server managed to remove from the user's PDS.\n *\n * The wipe runs per collection, so it can partly succeed: `success: true` means\n * the account action completed, NOT that the PDS is clean. A UI that ignores\n * this can tell someone their data is gone while it is still on their data\n * server, so treat a non-empty `remaining` as \"not deleted\".\n *\n * Absent when the PDS was not touched (`deletePdsData: false`).\n */\nexport interface PdsWipeOutcome {\n /** Collections whose records were removed. */\n deleted: string[];\n /** Collections whose records are still on the PDS. Non-empty means not done. */\n remaining: string[];\n /**\n * The server could not enumerate the repo, so it does not know what survived.\n * Without this, that case is indistinguishable from \"nothing to delete\".\n */\n unknown: boolean;\n}\n\n/**\n * What a PDS wipe could not remove with the grant the session holds today.\n *\n * Read this BEFORE the destructive step. Deleting an account destroys the\n * session, so a missing scope cannot be granted afterwards -- there is nobody\n * left to ask. A non-empty `needsScopeFor` means the wipe would strand those\n * records on the user's data server.\n */\nexport interface WipePreview {\n /** id.sifa.* collections the current grant cannot delete. */\n needsScopeFor: string[];\n /**\n * The server could not enumerate the repo, so the gap list is not\n * authoritative. Distinct from an empty list, which means \"nothing to ask for\".\n */\n unknown?: boolean;\n}\n\n/**\n * Ask which id.sifa.* collections the current grant cannot delete.\n *\n * Unlike most read fetchers in this file's neighbourhood, a failure is NOT\n * flattened into an empty result: an empty gap list reads as \"a wipe will be\n * clean\", and a caller must not promise that on the strength of a request that\n * never arrived. Let it throw and warn.\n */\nexport function fetchWipePreview(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<WipePreview> {\n return apiFetch<WipePreview>(config, '/api/profile/wipe-preview', {\n credentials: 'include',\n ...options,\n });\n}\n\n/** Extended write result for {@link resetProfile}. */\nexport interface ResetProfileResult extends WriteResult {\n /** Present when `deletePdsData: true`. See {@link PdsWipeOutcome}. */\n pds?: PdsWipeOutcome;\n}\n\n/** Extended write result for {@link deleteAccount}. */\nexport interface DeleteAccountResult extends WriteResult {\n /** The deleted handle, returned by the server for confirmation UIs. */\n handle?: string;\n /** Present when `deletePdsData: true`. See {@link PdsWipeOutcome}. */\n pds?: PdsWipeOutcome;\n}\n\n/**\n * Reset the authenticated user's Sifa profile.\n *\n * `deletePdsData: true` also deletes the corresponding records on the\n * user's PDS. `deletePdsData: false` only removes the AppView's\n * indexed state -- the records on the PDS are left intact and could be\n * re-indexed later.\n *\n * Destructive. Server enforces session check + attestation; the SDK\n * does not gate on additional confirmation. Wrap call sites in your\n * own modal if you want a UX confirmation step.\n */\nexport function resetProfile(\n config: SifaApiConfig,\n deletePdsData: boolean,\n options: ApiFetchOptions = {},\n): Promise<ResetProfileResult> {\n return apiWrite<{ ok?: boolean; pds?: PdsWipeOutcome }>(config, '/api/profile/reset', 'DELETE', {\n body: { deletePdsData },\n ...options,\n });\n}\n\n/**\n * Delete the authenticated user's account. Returns the deleted handle\n * on success (used by the post-delete confirmation screen).\n *\n * `deletePdsData: true` also deletes the corresponding records on the\n * user's PDS; `false` leaves the PDS records intact.\n *\n * Destructive. Same caveat as {@link resetProfile}.\n */\nexport function deleteAccount(\n config: SifaApiConfig,\n deletePdsData: boolean,\n options: ApiFetchOptions = {},\n): Promise<DeleteAccountResult> {\n return apiWrite<{ ok?: boolean; handle?: string; pds?: PdsWipeOutcome }>(\n config,\n '/api/profile/account',\n 'DELETE',\n {\n body: { deletePdsData },\n ...options,\n },\n );\n}\n","import type { RepoDeleteResult, RepoInventory } from '../../repo/types.js';\nimport { apiFetch, apiWrite, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/**\n * Read what the user's PDS actually holds under id.sifa.*.\n *\n * A failure is not flattened into an empty inventory. Zero records reads as\n * \"Sifa has stored nothing about you\", and a request that never arrived must\n * not be allowed to say that. Let it throw.\n */\nexport function fetchRepoInventory(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<RepoInventory> {\n return apiFetch<RepoInventory>(config, '/api/me/repo-inventory', {\n credentials: 'include',\n ...options,\n });\n}\n\nexport interface RepoDeleteInput {\n collection: string;\n /** The records to remove. Omit and set `all` to remove the whole collection. */\n rkeys?: string[];\n /**\n * Remove every record in the collection, including ones written between the\n * inventory read and this call. A UI offering \"delete all of X\" must send\n * this rather than the rkeys it happened to see, or a record created in\n * between silently survives a delete the user believes was complete.\n */\n all?: boolean;\n}\n\n/**\n * Delete records from the user's own repo.\n *\n * The returned `success` means the request was accepted, NOT that the records\n * are gone: read `results` for that, per record. `needsScopeUpgrade` means\n * nothing was attempted and the user has to grant the scope first.\n *\n * Destructive and not undoable -- a deleted record's CID cannot be restored.\n * The server enforces the id.sifa.* boundary and the session check; the SDK\n * adds no confirmation step, so wrap call sites in one.\n */\nexport function deleteRepoRecords(\n config: SifaApiConfig,\n input: RepoDeleteInput,\n options: ApiFetchOptions = {},\n): Promise<RepoDeleteResult & { success: boolean; error?: string }> {\n return apiWrite<RepoDeleteResult>(config, '/api/me/repo-delete', 'POST', {\n body: input,\n ...options,\n });\n}\n\n/**\n * URL of the raw-record download.\n *\n * A URL rather than a fetcher: the response is a file the browser saves, and\n * routing it through fetch would buffer the whole repo in memory to hand it\n * straight back to a download anchor.\n */\nexport function repoExportUrl(config: SifaApiConfig): string {\n return `${config.baseUrl}/api/me/repo-export`;\n}\n","import { apiFetch, apiFetchOrNull, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/** A node in the personal network graph. */\nexport interface NetworkMapNode {\n did: string;\n handle: string;\n displayName: string;\n avatar: string | null;\n /** Number of edges this node participates in within the rendered graph. */\n degree: number;\n /** Phase 2: community detection cluster id. */\n cluster?: number;\n /** Phase 2: pre-computed layout coordinates. */\n x?: number;\n y?: number;\n}\n\n/** A directed edge in the personal network graph. */\nexport interface NetworkMapEdge {\n source: string;\n target: string;\n mutual: boolean;\n /** Networks this edge was observed in, e.g. `['sifa', 'bluesky']`. */\n sources: string[];\n}\n\n/** The graph payload itself, decoupled from response metadata. */\nexport interface NetworkMapGraphData {\n nodes: NetworkMapNode[];\n edges: NetworkMapEdge[];\n /** Phase 2: cluster metadata for legend rendering. */\n clusters?: Array<{ id: number; label: string; color: string }>;\n}\n\n/** Cached graph response. */\nexport interface NetworkMapResponse {\n generatedAt: string;\n expiresAt: string;\n graph: NetworkMapGraphData;\n stats: {\n totalNodes: number;\n totalEdges: number;\n mutualCount: number;\n sources: Record<string, number>;\n };\n}\n\n/** Async job tracking generation progress. */\nexport interface NetworkMapGenerationJob {\n jobId: string;\n did: string;\n status: 'pending' | 'complete' | 'failed';\n /** 0..100 */\n progress: number;\n createdAt: string;\n completedAt?: string;\n error?: string;\n /**\n * Queue position when the job is still pending and not yet picked up\n * by the worker. 0 = next to run. Absent for in-flight or terminal\n * jobs (and for any backend that doesn't yet report position).\n */\n position?: number;\n /**\n * Estimated remaining seconds, derived server-side from the median\n * historical duration for the user's follow-count bucket multiplied\n * by `position + 1`. Absent when no historical data exists yet.\n */\n etaSeconds?: number;\n}\n\n/** Returned by `initiateNetworkMapGeneration` when a new job was started or one was already running. */\nexport interface NetworkMapPendingJob {\n jobId: string;\n status: 'pending' | 'cached';\n}\n\n/** Discriminate the union returned by `initiateNetworkMapGeneration`. */\nexport function isNetworkMapResponse(\n value: NetworkMapPendingJob | NetworkMapResponse,\n): value is NetworkMapResponse {\n return 'graph' in value;\n}\n\n/**\n * Kick off a personal network-map computation. The backend returns the\n * cached map immediately when fresh, otherwise it returns a job id that\n * the caller polls via `checkNetworkMapJobStatus`.\n */\nexport async function initiateNetworkMapGeneration(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<NetworkMapPendingJob | NetworkMapResponse> {\n return apiFetch<NetworkMapPendingJob | NetworkMapResponse>(config, '/api/network-map/generate', {\n method: 'POST',\n credentials: 'include',\n ...options,\n });\n}\n\n/**\n * Poll the status of an in-flight generation job. Throws on 404 (unknown\n * or expired job) — callers may want to treat that as terminal failure.\n */\nexport async function checkNetworkMapJobStatus(\n config: SifaApiConfig,\n jobId: string,\n options: ApiFetchOptions = {},\n): Promise<NetworkMapGenerationJob> {\n return apiFetch<NetworkMapGenerationJob>(\n config,\n `/api/network-map/status/${encodeURIComponent(jobId)}`,\n {\n credentials: 'include',\n ...options,\n },\n );\n}\n\n/**\n * Fetch the most recent cached network map for the authenticated user.\n * Returns `null` when no map has ever been generated (404).\n */\nexport async function fetchNetworkMap(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<NetworkMapResponse | null> {\n return apiFetchOrNull<NetworkMapResponse>(config, '/api/network-map', {\n credentials: 'include',\n cache: 'no-store',\n ...options,\n });\n}\n","/**\n * Query key factory for TanStack Query.\n *\n * Keys are read-only tuples; the hierarchy matches the SDK's fetcher\n * grouping. Use these instead of inline arrays so consumers can target\n * `queryClient.invalidateQueries({ queryKey: keys.profile.all() })` and\n * similar patterns without typos.\n *\n * Convention: every leaf key starts with the namespace ('sifa') so\n * consumers can invalidate everything Sifa-related in one call.\n */\nexport const sifaQueryKeys = {\n all: () => ['sifa'] as const,\n\n profile: {\n all: () => ['sifa', 'profile'] as const,\n byHandle: (handleOrDid: string) => ['sifa', 'profile', handleOrDid] as const,\n atFundLink: (did: string) => ['sifa', 'profile', 'at-fund-link', did] as const,\n view: (actor: string) => ['sifa', 'profile', 'view', actor] as const,\n externalAccounts: (handleOrDid: string) =>\n ['sifa', 'profile', 'external-accounts', handleOrDid] as const,\n },\n\n position: {\n all: () => ['sifa', 'position'] as const,\n byOwner: (did: string) => ['sifa', 'position', 'by-owner', did] as const,\n },\n\n search: {\n all: () => ['sifa', 'search'] as const,\n profiles: (filters: Record<string, unknown>) =>\n ['sifa', 'search', 'profiles', filters] as const,\n companies: (filters: Record<string, unknown>) =>\n ['sifa', 'search', 'companies', filters] as const,\n skills: (query: string) => ['sifa', 'search', 'skills', query] as const,\n canonicalSkills: (query: string, limit: number) =>\n ['sifa', 'search', 'canonical-skills', query, limit] as const,\n filters: () => ['sifa', 'search', 'filters'] as const,\n },\n\n entity: {\n all: () => ['sifa', 'entity'] as const,\n search: (query: string, limit: number) => ['sifa', 'entity', 'search', query, limit] as const,\n },\n\n discovery: {\n all: () => ['sifa', 'discovery'] as const,\n similar: (did: string, limit: number) => ['sifa', 'discovery', 'similar', did, limit] as const,\n suggestions: (opts: Record<string, unknown>) =>\n ['sifa', 'discovery', 'suggestions', opts] as const,\n suggestionCount: (since: string | undefined) =>\n ['sifa', 'discovery', 'suggestion-count', since ?? null] as const,\n featured: () => ['sifa', 'discovery', 'featured'] as const,\n },\n\n follow: {\n all: () => ['sifa', 'follow'] as const,\n following: (opts: Record<string, unknown>) => ['sifa', 'follow', 'following', opts] as const,\n followers: (handle: string) => ['sifa', 'follow', 'followers', handle] as const,\n followingOf: (handle: string) => ['sifa', 'follow', 'following-of', handle] as const,\n feed: (opts: Record<string, unknown>) => ['sifa', 'follow', 'feed', opts] as const,\n mutuals: (handle: string) => ['sifa', 'follow', 'mutuals', handle] as const,\n blueskySuggestions: () => ['sifa', 'follow', 'bluesky-suggestions'] as const,\n },\n\n admin: {\n all: () => ['sifa', 'admin'] as const,\n featureAllowlist: (flag: string) => ['sifa', 'admin', 'feature-allowlist', flag] as const,\n reviewQueues: () => ['sifa', 'admin', 'review-queues'] as const,\n },\n\n stats: {\n all: () => ['sifa', 'stats'] as const,\n homepage: () => ['sifa', 'stats', 'homepage'] as const,\n },\n\n apps: {\n all: () => ['sifa', 'apps'] as const,\n registry: () => ['sifa', 'apps', 'registry'] as const,\n hidden: () => ['sifa', 'apps', 'hidden'] as const,\n },\n\n auth: {\n all: () => ['sifa', 'auth'] as const,\n // Session-scoped: the AppView reads the account list from the browser's\n // cookies, so there is only ever one list per client.\n accounts: () => ['sifa', 'auth', 'accounts'] as const,\n },\n\n activity: {\n all: () => ['sifa', 'activity'] as const,\n heatmap: (handleOrDid: string, days: number) =>\n ['sifa', 'activity', 'heatmap', handleOrDid, days] as const,\n teaser: (handleOrDid: string) => ['sifa', 'activity', 'teaser', handleOrDid] as const,\n feed: (handleOrDid: string, opts: Record<string, unknown>) =>\n ['sifa', 'activity', 'feed', handleOrDid, opts] as const,\n // Session-scoped: the AppView reads the caller's own hides from their\n // cookie, so there is only ever one list per client.\n hiddenItems: () => ['sifa', 'activity', 'hidden-items'] as const,\n },\n\n github: {\n all: () => ['sifa', 'github'] as const,\n myPullRequests: (opts: { limit?: number; offset?: number }) =>\n ['sifa', 'github', 'my-pull-requests', opts] as const,\n },\n\n endorsement: {\n all: () => ['sifa', 'endorsement'] as const,\n count: (did: string) => ['sifa', 'endorsement', 'count', did] as const,\n // Scoped to the session rather than a DID -- the AppView reads the subject\n // from the session cookie, so there is only ever one inbox per client.\n pending: () => ['sifa', 'endorsement', 'pending'] as const,\n // Also session-scoped: the AppView picks the candidate from the viewer's\n // own follows, dismissals and blocks.\n reciprocity: () => ['sifa', 'endorsement', 'reciprocity'] as const,\n received: (did: string) => ['sifa', 'endorsement', 'received', did] as const,\n },\n\n confirmation: {\n all: () => ['sifa', 'confirmation'] as const,\n // Scoped to the session for the same reason as the endorsement inbox: the\n // AppView reads the subject from the session cookie, so there is only ever\n // one inbox per client.\n pending: () => ['sifa', 'confirmation', 'pending'] as const,\n /** Confirmations this session has given, for the withdraw surface. */\n given: () => ['sifa', 'confirmation', 'given'] as const,\n },\n\n stream: {\n all: () => ['sifa', 'stream'] as const,\n networkCount: (did: string) => ['sifa', 'stream', 'network-count', did] as const,\n },\n\n reactions: {\n all: () => ['sifa', 'reactions'] as const,\n status: (uris: string[]) => ['sifa', 'reactions', 'status', uris] as const,\n accountCheck: (appId: string) => ['sifa', 'reactions', 'account-check', appId] as const,\n },\n\n roadmap: {\n all: () => ['sifa', 'roadmap'] as const,\n votes: () => ['sifa', 'roadmap', 'votes'] as const,\n myVotes: () => ['sifa', 'roadmap', 'my-votes'] as const,\n },\n\n bskyPreferences: {\n all: () => ['sifa', 'bsky-preferences'] as const,\n contentLabels: () => ['sifa', 'bsky-preferences', 'content-labels'] as const,\n },\n\n repoInventory: {\n all: () => ['sifa', 'repo-inventory'] as const,\n list: () => ['sifa', 'repo-inventory', 'list'] as const,\n },\n destructive: {\n all: () => ['sifa', 'destructive'] as const,\n wipePreview: () => ['sifa', 'destructive', 'wipe-preview'] as const,\n },\n} as const;\n\nexport type SifaQueryKey =\n | ReturnType<typeof sifaQueryKeys.all>\n | ReturnType<typeof sifaQueryKeys.profile.all>\n | ReturnType<typeof sifaQueryKeys.profile.byHandle>\n | ReturnType<typeof sifaQueryKeys.profile.atFundLink>\n | ReturnType<typeof sifaQueryKeys.profile.externalAccounts>\n | ReturnType<typeof sifaQueryKeys.position.all>\n | ReturnType<typeof sifaQueryKeys.position.byOwner>\n | ReturnType<typeof sifaQueryKeys.search.all>\n | ReturnType<typeof sifaQueryKeys.search.profiles>\n | ReturnType<typeof sifaQueryKeys.search.canonicalSkills>\n | ReturnType<typeof sifaQueryKeys.search.skills>\n | ReturnType<typeof sifaQueryKeys.search.filters>\n | ReturnType<typeof sifaQueryKeys.entity.all>\n | ReturnType<typeof sifaQueryKeys.entity.search>\n | ReturnType<typeof sifaQueryKeys.discovery.all>\n | ReturnType<typeof sifaQueryKeys.discovery.similar>\n | ReturnType<typeof sifaQueryKeys.discovery.suggestions>\n | ReturnType<typeof sifaQueryKeys.discovery.suggestionCount>\n | ReturnType<typeof sifaQueryKeys.discovery.featured>\n | ReturnType<typeof sifaQueryKeys.follow.all>\n | ReturnType<typeof sifaQueryKeys.follow.following>\n | ReturnType<typeof sifaQueryKeys.follow.followers>\n | ReturnType<typeof sifaQueryKeys.follow.followingOf>\n | ReturnType<typeof sifaQueryKeys.follow.feed>\n | ReturnType<typeof sifaQueryKeys.follow.mutuals>\n | ReturnType<typeof sifaQueryKeys.follow.blueskySuggestions>\n | ReturnType<typeof sifaQueryKeys.admin.all>\n | ReturnType<typeof sifaQueryKeys.admin.featureAllowlist>\n | ReturnType<typeof sifaQueryKeys.admin.reviewQueues>\n | ReturnType<typeof sifaQueryKeys.stats.all>\n | ReturnType<typeof sifaQueryKeys.stats.homepage>\n | ReturnType<typeof sifaQueryKeys.apps.all>\n | ReturnType<typeof sifaQueryKeys.apps.registry>\n | ReturnType<typeof sifaQueryKeys.apps.hidden>\n | ReturnType<typeof sifaQueryKeys.activity.all>\n | ReturnType<typeof sifaQueryKeys.activity.heatmap>\n | ReturnType<typeof sifaQueryKeys.activity.teaser>\n | ReturnType<typeof sifaQueryKeys.activity.feed>\n | ReturnType<typeof sifaQueryKeys.activity.hiddenItems>\n | ReturnType<typeof sifaQueryKeys.endorsement.all>\n | ReturnType<typeof sifaQueryKeys.endorsement.count>\n | ReturnType<typeof sifaQueryKeys.endorsement.pending>\n | ReturnType<typeof sifaQueryKeys.endorsement.reciprocity>\n | ReturnType<typeof sifaQueryKeys.endorsement.received>\n | ReturnType<typeof sifaQueryKeys.confirmation.all>\n | ReturnType<typeof sifaQueryKeys.confirmation.pending>\n | ReturnType<typeof sifaQueryKeys.confirmation.given>\n | ReturnType<typeof sifaQueryKeys.stream.all>\n | ReturnType<typeof sifaQueryKeys.stream.networkCount>\n | ReturnType<typeof sifaQueryKeys.reactions.all>\n | ReturnType<typeof sifaQueryKeys.reactions.status>\n | ReturnType<typeof sifaQueryKeys.reactions.accountCheck>\n | ReturnType<typeof sifaQueryKeys.roadmap.all>\n | ReturnType<typeof sifaQueryKeys.roadmap.votes>\n | ReturnType<typeof sifaQueryKeys.roadmap.myVotes>\n | ReturnType<typeof sifaQueryKeys.bskyPreferences.all>\n | ReturnType<typeof sifaQueryKeys.bskyPreferences.contentLabels>\n | ReturnType<typeof sifaQueryKeys.destructive.all>\n | ReturnType<typeof sifaQueryKeys.destructive.wipePreview>\n | ReturnType<typeof sifaQueryKeys.repoInventory.all>\n | ReturnType<typeof sifaQueryKeys.repoInventory.list>;\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport type { Profile } from '../../types/index.js';\nimport { useSifaConfig } from '../config.js';\nimport { fetchAtFundLink, fetchProfile } from '../fetchers/profile.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * React hook that reads an aggregated profile by handle or DID via\n * TanStack Query. Returns `null` data when the profile does not exist.\n *\n * Pass `{ enabled: false }` (or an empty `handleOrDid`) to defer the\n * fetch.\n */\nexport function useProfile(\n handleOrDid: string | undefined | null,\n options?: Omit<\n UseQueryOptions<\n Profile | null,\n Error,\n Profile | null,\n ReturnType<typeof sifaQueryKeys.profile.byHandle>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.profile.byHandle(handleOrDid ?? ''),\n queryFn: () => fetchProfile(config, handleOrDid ?? ''),\n enabled: Boolean(handleOrDid) && (options?.enabled ?? true),\n ...options,\n });\n}\n\n/**\n * React hook for a profile's AT Fund link. Returns `null` data on error\n * or when the profile has no link configured.\n */\nexport function useAtFundLink(\n did: string | undefined | null,\n options?: Omit<\n UseQueryOptions<\n string | null,\n Error,\n string | null,\n ReturnType<typeof sifaQueryKeys.profile.atFundLink>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.profile.atFundLink(did ?? ''),\n queryFn: () => fetchAtFundLink(config, did ?? ''),\n enabled: Boolean(did) && (options?.enabled ?? true),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport type { ProfileView } from '../../types/profile-view.js';\nimport { useSifaConfig } from '../config.js';\nimport { fetchGetProfileView } from '../fetchers/get-profile-view.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * React hook that reads the aggregated public profile view via the\n * `id.sifa.getProfileView` XRPC query. Returns `null` data when the profile\n * does not exist.\n *\n * Pass `{ enabled: false }` (or an empty `actor`) to defer the fetch.\n */\nexport function useGetProfileView(\n actor: string | undefined | null,\n options?: Omit<\n UseQueryOptions<\n ProfileView | null,\n Error,\n ProfileView | null,\n ReturnType<typeof sifaQueryKeys.profile.view>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.profile.view(actor ?? ''),\n queryFn: () => fetchGetProfileView(config, actor ?? ''),\n enabled: Boolean(actor) && (options?.enabled ?? true),\n ...options,\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport { type WriteResult } from '../client.js';\nimport {\n deleteAvatarOverride,\n deleteNamePronunciationAudio,\n refreshPds,\n updateProfileOverride,\n updateProfileSelf,\n uploadAvatar,\n uploadNamePronunciationAudio,\n type RefreshPdsResult,\n type UpdateProfileOverrideInput,\n type UpdateProfileSelfInput,\n type UploadAvatarResult,\n type UploadPronunciationAudioResult,\n} from '../fetchers/profile-mutations.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Invalidate the owner's profile cache after a profile-edit mutation\n * succeeds. Shared helper for the hooks in this file -- the owner DID\n * (or handle) is required so the mutation can target the correct cache\n * entry.\n */\nasync function invalidateProfile(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n}\n\n/**\n * React hook for updating the authenticated user's profile self record.\n * On success, invalidates the owner's profile cache.\n *\n * The owner identifier (handle or DID) is required so the mutation can\n * target the right profile cache entry for invalidation.\n */\nexport function useUpdateProfileSelf(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, UpdateProfileSelfInput>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (data: UpdateProfileSelfInput) => updateProfileSelf(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for updating the authenticated user's profile override fields. */\nexport function useUpdateProfileOverride(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, UpdateProfileOverrideInput>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (data: UpdateProfileOverrideInput) => updateProfileOverride(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for re-pulling the authenticated user's PDS-side profile. */\nexport function useRefreshPds(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<RefreshPdsResult, Error, void>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: () => refreshPds(config),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/**\n * React hook for uploading a new avatar. Pass a `File` (browser) or\n * `Blob` (Expo) as the mutation variable.\n */\nexport function useUploadAvatar(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<UploadAvatarResult, Error, Blob>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (file: Blob) => uploadAvatar(config, file),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for deleting the avatar override (revert to PDS avatar). */\nexport function useDeleteAvatarOverride(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, void>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: () => deleteAvatarOverride(config),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/**\n * React hook for uploading a name-pronunciation audio clip. Pass a `File`\n * (browser) or `Blob` (Expo) as the mutation variable.\n */\nexport function useUploadNamePronunciationAudio(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<UploadPronunciationAudioResult, Error, Blob>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (file: Blob) => uploadNamePronunciationAudio(config, file),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for deleting the name-pronunciation audio clip. */\nexport function useDeleteNamePronunciationAudio(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, void>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: () => deleteNamePronunciationAudio(config),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport { createPosition, type CreateResult } from '../fetchers/positions.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * React hook for creating a new position record. On success, invalidates\n * the owner's profile cache so the new position is reflected on the next\n * read.\n *\n * The owner DID is required so the mutation can target the correct\n * profile cache entry for invalidation.\n */\nexport function useCreatePosition(\n ownerDid: string,\n options?: Omit<UseMutationOptions<CreateResult, Error, Record<string, unknown>>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (data: Record<string, unknown>) => createPosition(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.profile.byHandle(ownerDid) });\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.position.byOwner(ownerDid) });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n deletePosition,\n linkSkillToPosition,\n setPositionPrimary,\n unlinkSkillFromPosition,\n unsetPositionPrimary,\n updatePosition,\n} from '../fetchers/positions.js';\nimport { sifaQueryKeys } from '../keys.js';\nimport type { ProfilePosition, SkillRef } from '../../types/index.js';\n\nasync function invalidatePositionCaches(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.position.byOwner(ownerHandleOrDid),\n });\n}\n\n/** Variables for {@link useUpdatePosition}. */\nexport interface UpdatePositionVariables {\n rkey: string;\n data: Record<string, unknown>;\n}\n\n/** React hook for updating a position record. */\nexport function useUpdatePosition(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, UpdatePositionVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ rkey, data }: UpdatePositionVariables) => updatePosition(config, rkey, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidatePositionCaches(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for deleting a position record. Variable: the `rkey` string. */\nexport function useDeletePosition(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (rkey: string) => deletePosition(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidatePositionCaches(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for marking a position as primary. Variable: the `rkey` string. */\nexport function useSetPositionPrimary(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (rkey: string) => setPositionPrimary(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidatePositionCaches(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for clearing the primary flag on a position. */\nexport function useUnsetPositionPrimary(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (rkey: string) => unsetPositionPrimary(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidatePositionCaches(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** Variables for {@link useLinkSkillToPosition} / {@link useUnlinkSkillFromPosition}. */\nexport interface PositionSkillLinkVariables {\n position: ProfilePosition;\n skillRef: SkillRef;\n}\n\n/** React hook for linking a skill to a position. Idempotent. */\nexport function useLinkSkillToPosition(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, PositionSkillLinkVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ position, skillRef }: PositionSkillLinkVariables) =>\n linkSkillToPosition(config, position, skillRef),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidatePositionCaches(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for unlinking a skill from a position. */\nexport function useUnlinkSkillFromPosition(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, PositionSkillLinkVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ position, skillRef }: PositionSkillLinkVariables) =>\n unlinkSkillFromPosition(config, position, skillRef),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidatePositionCaches(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type CreateResult, type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport { createEducation, deleteEducation, updateEducation } from '../fetchers/education.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateProfile(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n}\n\n/** React hook for creating an education record. */\nexport function useCreateEducation(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<CreateResult, Error, Record<string, unknown>>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (data: Record<string, unknown>) => createEducation(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** Variables for {@link useUpdateEducation}. */\nexport interface UpdateEducationVariables {\n rkey: string;\n data: Record<string, unknown>;\n}\n\n/** React hook for updating an education record. */\nexport function useUpdateEducation(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, UpdateEducationVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ rkey, data }: UpdateEducationVariables) => updateEducation(config, rkey, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for deleting an education record. Variable: the `rkey` string. */\nexport function useDeleteEducation(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (rkey: string) => deleteEducation(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type CreateResult, type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n createSkill,\n deleteSkill,\n updateSkill,\n updateSkillSubCategories,\n type SubCategoryBulkResult,\n} from '../fetchers/skills.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateProfile(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n}\n\n/** React hook for creating a skill record. */\nexport function useCreateSkill(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<CreateResult, Error, Record<string, unknown>>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (data: Record<string, unknown>) => createSkill(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** Variables for {@link useUpdateSkill}. */\nexport interface UpdateSkillVariables {\n rkey: string;\n data: Record<string, unknown>;\n}\n\n/** React hook for updating a skill record. */\nexport function useUpdateSkill(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, UpdateSkillVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ rkey, data }: UpdateSkillVariables) => updateSkill(config, rkey, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** Variables for {@link useUpdateSkillSubCategories}. */\nexport interface UpdateSkillSubCategoriesVariables {\n rkeys: string[];\n subCategory: string;\n}\n\n/**\n * React hook for setting (or clearing) the sub-category on many skills in a\n * single request. An empty `subCategory` clears the field.\n */\nexport function useUpdateSkillSubCategories(\n ownerHandleOrDid: string,\n options?: Omit<\n UseMutationOptions<\n WriteResult & SubCategoryBulkResult,\n Error,\n UpdateSkillSubCategoriesVariables\n >,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ rkeys, subCategory }: UpdateSkillSubCategoriesVariables) =>\n updateSkillSubCategories(config, rkeys, subCategory),\n // `...options` comes first so a caller-supplied onSuccess cannot replace the\n // wrapper below and silently skip profile invalidation; the wrapper calls it\n // instead. The older skill hooks in this file spread options last and still\n // carry that bug.\n ...options,\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for deleting a skill record. Variable: the `rkey` string. */\nexport function useDeleteSkill(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (rkey: string) => deleteSkill(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type CreateResult, type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport { createRecord, deleteRecord, updateRecord } from '../fetchers/records.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateProfile(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n}\n\n/** Variables for {@link useCreateRecord}. */\nexport interface CreateRecordVariables {\n collection: string;\n data: Record<string, unknown>;\n}\n\n/**\n * Generic record-create escape hatch for collections without a\n * dedicated section helper (certifications, projects, publications,\n * volunteering, honors, languages, courses). Prefer the typed helpers\n * when one exists for the section.\n */\nexport function useCreateRecord(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<CreateResult, Error, CreateRecordVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ collection, data }: CreateRecordVariables) =>\n createRecord(config, collection, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** Variables for {@link useUpdateRecord}. */\nexport interface UpdateRecordVariables {\n collection: string;\n rkey: string;\n data: Record<string, unknown>;\n}\n\n/** Generic record-update escape hatch. See {@link useCreateRecord}. */\nexport function useUpdateRecord(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, UpdateRecordVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ collection, rkey, data }: UpdateRecordVariables) =>\n updateRecord(config, collection, rkey, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** Variables for {@link useDeleteRecord}. */\nexport interface DeleteRecordVariables {\n collection: string;\n rkey: string;\n}\n\n/** Generic record-delete escape hatch. See {@link useCreateRecord}. */\nexport function useDeleteRecord(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, DeleteRecordVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ collection, rkey }: DeleteRecordVariables) =>\n deleteRecord(config, collection, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type CreateResult, type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n createProfileLocation,\n deleteProfileLocation,\n updateProfileLocation,\n type ProfileLocationInput,\n} from '../fetchers/profile-locations.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateProfile(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n}\n\n/** React hook for creating a profile location record. */\nexport function useCreateProfileLocation(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<CreateResult, Error, ProfileLocationInput>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (data: ProfileLocationInput) => createProfileLocation(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** Variables for {@link useUpdateProfileLocation}. */\nexport interface UpdateProfileLocationVariables {\n rkey: string;\n data: ProfileLocationInput;\n}\n\n/** React hook for updating a profile location record. */\nexport function useUpdateProfileLocation(\n ownerHandleOrDid: string,\n options?: Omit<\n UseMutationOptions<WriteResult, Error, UpdateProfileLocationVariables>,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ rkey, data }: UpdateProfileLocationVariables) =>\n updateProfileLocation(config, rkey, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for deleting a profile location record. Variable: the `rkey` string. */\nexport function useDeleteProfileLocation(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (rkey: string) => deleteProfileLocation(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport {\n useMutation,\n useQuery,\n useQueryClient,\n type UseMutationOptions,\n type UseQueryOptions,\n} from '@tanstack/react-query';\n\nimport type { ExternalAccount } from '../../types/index.js';\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n createExternalAccount,\n deleteExternalAccount,\n fetchExternalAccounts,\n setExternalAccountPrimary,\n unsetExternalAccountPrimary,\n updateExternalAccount,\n verifyExternalAccount,\n type CreateExternalAccountResult,\n type ExternalAccountInput,\n type VerifyExternalAccountResult,\n} from '../fetchers/external-accounts.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateProfileAndExternalAccounts(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.externalAccounts(ownerHandleOrDid),\n });\n}\n\n/** React hook for reading the external-accounts list. Returns `[]` data on error. */\nexport function useExternalAccounts(\n handleOrDid: string | undefined | null,\n options?: Omit<\n UseQueryOptions<\n ExternalAccount[],\n Error,\n ExternalAccount[],\n ReturnType<typeof sifaQueryKeys.profile.externalAccounts>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.profile.externalAccounts(handleOrDid ?? ''),\n queryFn: () => fetchExternalAccounts(config, handleOrDid ?? ''),\n enabled: Boolean(handleOrDid) && (options?.enabled ?? true),\n ...options,\n });\n}\n\n/** React hook for creating an external account. */\nexport function useCreateExternalAccount(\n ownerHandleOrDid: string,\n options?: Omit<\n UseMutationOptions<CreateExternalAccountResult, Error, ExternalAccountInput>,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (data: ExternalAccountInput) => createExternalAccount(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** Variables for {@link useUpdateExternalAccount}. */\nexport interface UpdateExternalAccountVariables {\n rkey: string;\n data: ExternalAccountInput;\n}\n\n/** React hook for updating an external account. */\nexport function useUpdateExternalAccount(\n ownerHandleOrDid: string,\n options?: Omit<\n UseMutationOptions<WriteResult, Error, UpdateExternalAccountVariables>,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ rkey, data }: UpdateExternalAccountVariables) =>\n updateExternalAccount(config, rkey, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for deleting an external account. Variable: the `rkey` string. */\nexport function useDeleteExternalAccount(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (rkey: string) => deleteExternalAccount(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for marking an external account primary. */\nexport function useSetExternalAccountPrimary(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (rkey: string) => setExternalAccountPrimary(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for clearing the primary flag on an external account. */\nexport function useUnsetExternalAccountPrimary(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (rkey: string) => unsetExternalAccountPrimary(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for running server-side verification of an external account. */\nexport function useVerifyExternalAccount(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<VerifyExternalAccountResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (rkey: string) => verifyExternalAccount(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type CreateResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport { createEndorsement, type EndorsementInput } from '../fetchers/endorsements.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * React hook for creating an endorsement of another user's skill. The\n * mutation needs the endorsed user's handle/DID (not the endorser's)\n * so the endorsed profile + their endorsement count caches get\n * invalidated; pass `null` to skip endorsed-profile invalidation\n * (e.g., if you only know the skill URI).\n */\nexport function useCreateEndorsement(\n endorsedHandleOrDid: string | null,\n options?: Omit<UseMutationOptions<CreateResult, Error, EndorsementInput>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (data: EndorsementInput) => createEndorsement(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success && endorsedHandleOrDid) {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(endorsedHandleOrDid),\n });\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.endorsement.count(endorsedHandleOrDid),\n });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchReceivedEndorsements,\n type ReceivedEndorsementsPage,\n} from '../fetchers/received-endorsements.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/** Confirmed endorsements a DID has received, newest first. */\nexport function useReceivedEndorsements(\n did: string | undefined | null,\n options?: { limit?: number } & Omit<\n UseQueryOptions<\n ReceivedEndorsementsPage,\n Error,\n ReceivedEndorsementsPage,\n ReturnType<typeof sifaQueryKeys.endorsement.received>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n const { limit, ...queryOptions } = options ?? {};\n return useQuery({\n queryKey: sifaQueryKeys.endorsement.received(did ?? ''),\n queryFn: () => fetchReceivedEndorsements(config, did ?? '', { limit }),\n enabled: Boolean(did) && (queryOptions.enabled ?? true),\n ...queryOptions,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport { fetchReciprocityCandidate, type ReciprocityCandidate } from '../fetchers/reciprocity.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Someone the signed-in user could endorse. `null` when there is nobody left.\n *\n * Session-scoped like the pending inbox: the AppView reads the viewer from the\n * session, so the key takes no DID. Invalidate it after dismissing to pull the\n * next person in without a reload.\n */\nexport function useReciprocityCandidate(\n options?: Omit<\n UseQueryOptions<\n ReciprocityCandidate | null,\n Error,\n ReciprocityCandidate | null,\n ReturnType<typeof sifaQueryKeys.endorsement.reciprocity>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.endorsement.reciprocity(),\n queryFn: () => fetchReciprocityCandidate(config),\n ...options,\n });\n}\n","'use client';\n\nimport {\n useMutation,\n useQuery,\n useQueryClient,\n type UseMutationOptions,\n type UseQueryOptions,\n} from '@tanstack/react-query';\n\nimport { type CreateResult, type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport { confirmEndorsement, type ConfirmEndorsementInput } from '../fetchers/endorsements.js';\nimport {\n dismissEndorsement,\n fetchPendingEndorsements,\n type DismissEndorsementInput,\n type PendingEndorsementsPage,\n} from '../fetchers/endorsement-inbox.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Endorsements awaiting the signed-in user's decision. Returns an empty page\n * when signed out or on error, so callers can render \"nothing pending\" without\n * special-casing either.\n */\nexport function usePendingEndorsements(\n options?: Omit<\n UseQueryOptions<\n PendingEndorsementsPage,\n Error,\n PendingEndorsementsPage,\n ReturnType<typeof sifaQueryKeys.endorsement.pending>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.endorsement.pending(),\n queryFn: () => fetchPendingEndorsements(config),\n ...options,\n });\n}\n\n/**\n * Confirm a received endorsement. On success the endorsement leaves the inbox\n * and starts displaying, so both the inbox and the subject's own profile and\n * count caches are invalidated.\n *\n * `subjectHandleOrDid` is the confirming user (the endorsement's subject);\n * pass `null` to skip profile invalidation.\n */\nexport function useConfirmEndorsement(\n subjectHandleOrDid: string | null,\n options?: Omit<UseMutationOptions<CreateResult, Error, ConfirmEndorsementInput>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (data: ConfirmEndorsementInput) => confirmEndorsement(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.endorsement.pending(),\n });\n if (subjectHandleOrDid) {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(subjectHandleOrDid),\n });\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.endorsement.count(subjectHandleOrDid),\n });\n }\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/**\n * Dismiss a received endorsement. Only the inbox is invalidated -- a dismissal\n * changes nothing that displays anywhere, so no profile cache is affected.\n */\nexport function useDismissEndorsement(\n options?: Omit<UseMutationOptions<WriteResult, Error, DismissEndorsementInput>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (data: DismissEndorsementInput) => dismissEndorsement(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.endorsement.pending(),\n });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport {\n useMutation,\n useQuery,\n useQueryClient,\n type UseMutationOptions,\n type UseQueryOptions,\n} from '@tanstack/react-query';\n\nimport { type CreateResult, type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n createConfirmation,\n dismissConfirmation,\n fetchGivenConfirmations,\n fetchPendingConfirmations,\n revokeConfirmation,\n type ConfirmationInput,\n type ConfirmationSubjectInput,\n type GivenConfirmation,\n type PendingConfirmationsPage,\n} from '../fetchers/confirmations.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Claims naming the signed-in user that await their decision. Returns an empty\n * page when signed out or on error, so callers can render \"nothing pending\"\n * without special-casing either.\n */\nexport function usePendingConfirmations(\n options?: Omit<\n UseQueryOptions<\n PendingConfirmationsPage,\n Error,\n PendingConfirmationsPage,\n ReturnType<typeof sifaQueryKeys.confirmation.pending>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.confirmation.pending(),\n queryFn: () => fetchPendingConfirmations(config),\n ...options,\n });\n}\n\n/**\n * Confirmations the signed-in user has already given, with whether each has\n * drifted since. Returns an empty list when signed out or on error.\n */\nexport function useGivenConfirmations(\n options?: Omit<\n UseQueryOptions<\n { confirmations: GivenConfirmation[] },\n Error,\n { confirmations: GivenConfirmation[] },\n ReturnType<typeof sifaQueryKeys.confirmation.given>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.confirmation.given(),\n queryFn: () => fetchGivenConfirmations(config),\n ...options,\n });\n}\n\n/**\n * Affirm a claim naming you. On success it leaves the inbox and starts\n * rendering with your name and avatar on the claimer's profile, so both the\n * inbox and the claimer's profile cache are invalidated.\n *\n * `claimerHandleOrDid` is whose profile the claim displays on; pass `null` to\n * skip profile invalidation. Note this is the claimer, not the confirming\n * user: confirming changes what renders on *their* profile, not yours.\n */\nexport function useCreateConfirmation(\n claimerHandleOrDid: string | null,\n options?: Omit<UseMutationOptions<CreateResult, Error, ConfirmationInput>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (data: ConfirmationInput) => createConfirmation(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.confirmation.pending(),\n });\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.confirmation.given(),\n });\n if (claimerHandleOrDid) {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(claimerHandleOrDid),\n });\n }\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/**\n * Dismiss a claim naming you. Only the inbox is invalidated -- a dismissal\n * changes nothing that displays anywhere, so no profile cache is affected.\n */\nexport function useDismissConfirmation(\n options?: Omit<UseMutationOptions<WriteResult, Error, ConfirmationSubjectInput>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (data: ConfirmationSubjectInput) => dismissConfirmation(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.confirmation.pending(),\n });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/**\n * Withdraw a confirmation you previously gave. Unlike a dismissal this does\n * change what displays, so the claimer's profile cache is invalidated too.\n */\nexport function useRevokeConfirmation(\n claimerHandleOrDid: string | null,\n options?: Omit<UseMutationOptions<WriteResult, Error, ConfirmationSubjectInput>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (data: ConfirmationSubjectInput) => revokeConfirmation(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.confirmation.pending(),\n });\n if (claimerHandleOrDid) {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(claimerHandleOrDid),\n });\n }\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport { hideKeytraceClaim, unhideKeytraceClaim } from '../fetchers/keytrace-claims.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateProfile(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n}\n\n/** React hook for hiding a keytrace claim. Variable: the claim `rkey` string. */\nexport function useHideKeytraceClaim(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (rkey: string) => hideKeytraceClaim(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for unhiding a previously-hidden keytrace claim. */\nexport function useUnhideKeytraceClaim(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (rkey: string) => unhideKeytraceClaim(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport { revealMarqueDomain, unrevealMarqueDomain } from '../fetchers/marque-domains.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateProfile(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n}\n\n/** React hook for revealing (making public) a Marque domain. Variable: the domain string. */\nexport function useRevealMarqueDomain(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (domain: string) => revealMarqueDomain(config, domain),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for hiding a previously-revealed Marque domain again. */\nexport function useUnrevealMarqueDomain(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (domain: string) => unrevealMarqueDomain(config, domain),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n bulkHideStandardPublications,\n bulkUnhideStandardPublications,\n hideOrcidPublication,\n hideSifaPublication,\n hideStandardPublication,\n refreshOrcidPublications,\n unhideOrcidPublication,\n unhideSifaPublication,\n unhideStandardPublication,\n type RefreshOrcidPublicationsResult,\n} from '../fetchers/publications.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateProfile(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n}\n\nfunction makeWriteHook<TVariable>(\n fetcher: (config: ReturnType<typeof useSifaConfig>, v: TVariable) => Promise<WriteResult>,\n) {\n return function useHook(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, TVariable>, 'mutationFn'>,\n ) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (v: TVariable) => fetcher(config, v),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n };\n}\n\n/** React hook for hiding an ORCID publication. Variable: the `putCode` number. */\nexport const useHideOrcidPublication = makeWriteHook<number>((config, putCode) =>\n hideOrcidPublication(config, putCode),\n);\n\n/** React hook for unhiding an ORCID publication. Variable: the `putCode` number. */\nexport const useUnhideOrcidPublication = makeWriteHook<number>((config, putCode) =>\n unhideOrcidPublication(config, putCode),\n);\n\n/** React hook for hiding a standard publication. Variable: the AT URI string. */\nexport const useHideStandardPublication = makeWriteHook<string>((config, uri) =>\n hideStandardPublication(config, uri),\n);\n\n/** React hook for unhiding a standard publication. Variable: the AT URI string. */\nexport const useUnhideStandardPublication = makeWriteHook<string>((config, uri) =>\n unhideStandardPublication(config, uri),\n);\n\n/** React hook for bulk-hiding standard publications. Variable: the URI list. */\nexport const useBulkHideStandardPublications = makeWriteHook<string[]>((config, uris) =>\n bulkHideStandardPublications(config, uris),\n);\n\n/** React hook for bulk-unhiding standard publications. Variable: the URI list. */\nexport const useBulkUnhideStandardPublications = makeWriteHook<string[]>((config, uris) =>\n bulkUnhideStandardPublications(config, uris),\n);\n\n/** React hook for hiding a Sifa-authored publication. Variable: the `rkey` string. */\nexport const useHideSifaPublication = makeWriteHook<string>((config, rkey) =>\n hideSifaPublication(config, rkey),\n);\n\n/** React hook for unhiding a Sifa-authored publication. Variable: the `rkey` string. */\nexport const useUnhideSifaPublication = makeWriteHook<string>((config, rkey) =>\n unhideSifaPublication(config, rkey),\n);\n\n/** React hook for re-pulling ORCID publications. */\nexport function useRefreshOrcidPublications(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<RefreshOrcidPublicationsResult, Error, void>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: () => refreshOrcidPublications(config),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n bulkHideProfileItems,\n bulkUnhideProfileItems,\n hideProfileItem,\n unhideProfileItem,\n type BulkHideProfileItemInput,\n type HideProfileItemInput,\n} from '../fetchers/profile-items-hide.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateProfile(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n}\n\nfunction makeWriteHook<TVariable>(\n fetcher: (config: ReturnType<typeof useSifaConfig>, v: TVariable) => Promise<WriteResult>,\n) {\n return function useHook(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, TVariable>, 'mutationFn'>,\n ) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (v: TVariable) => fetcher(config, v),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n };\n}\n\n/**\n * Hide one profile item across any supported section. The underlying\n * record stays on the user's PDS; only its display on sifa.id is\n * suppressed.\n */\nexport const useHideProfileItem = makeWriteHook<HideProfileItemInput>((config, input) =>\n hideProfileItem(config, input),\n);\n\n/** Restore a previously-hidden profile item. */\nexport const useUnhideProfileItem = makeWriteHook<HideProfileItemInput>((config, input) =>\n unhideProfileItem(config, input),\n);\n\n/** Bulk-hide profile items sharing the same `itemType` + `source`. */\nexport const useBulkHideProfileItems = makeWriteHook<BulkHideProfileItemInput>((config, input) =>\n bulkHideProfileItems(config, input),\n);\n\n/** Bulk-unhide profile items sharing the same `itemType` + `source`. */\nexport const useBulkUnhideProfileItems = makeWriteHook<BulkHideProfileItemInput>((config, input) =>\n bulkUnhideProfileItems(config, input),\n);\n","'use client';\n\nimport {\n useMutation,\n useQuery,\n useQueryClient,\n type UseMutationOptions,\n type UseQueryOptions,\n} from '@tanstack/react-query';\n\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchHiddenActivityItems,\n hideActivityItem,\n unhideActivityItem,\n type HiddenActivityItem,\n type HideActivityItemInput,\n type UnhideActivityItemInput,\n} from '../fetchers/activity-items-hide.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Everything the authenticated user has hidden from their activity, for the\n * unhide list in settings.\n */\nexport function useHiddenActivityItems(\n options?: Omit<\n UseQueryOptions<\n HiddenActivityItem[],\n Error,\n HiddenActivityItem[],\n ReturnType<typeof sifaQueryKeys.activity.hiddenItems>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.activity.hiddenItems(),\n queryFn: () => fetchHiddenActivityItems(config),\n ...options,\n });\n}\n\nfunction makeHideHook<TVariable>(\n fetcher: (config: ReturnType<typeof useSifaConfig>, v: TVariable) => Promise<WriteResult>,\n) {\n return function useHook(\n options?: Omit<UseMutationOptions<WriteResult, Error, TVariable>, 'mutationFn'>,\n ) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (v: TVariable) => fetcher(config, v),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n // Every activity surface changes at once: the feed, the teaser on the\n // profile, the heatmap, and the hidden list itself.\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.activity.all() });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n };\n}\n\n/**\n * Hide one activity item from the caller's own profile. The record stays on\n * their PDS; only its appearance on sifa.id is suppressed.\n */\nexport const useHideActivityItem = makeHideHook<HideActivityItemInput>((config, input) =>\n hideActivityItem(config, input),\n);\n\n/** Restore a previously-hidden activity item. */\nexport const useUnhideActivityItem = makeHideHook<UnhideActivityItemInput>((config, input) =>\n unhideActivityItem(config, input),\n);\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport { fetchStats, type StatsResponse } from '../fetchers/stats.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * React hook for the public homepage stats. Returns `null` data on error.\n */\nexport function useStats(\n options?: Omit<\n UseQueryOptions<\n StatsResponse | null,\n Error,\n StatsResponse | null,\n ReturnType<typeof sifaQueryKeys.stats.homepage>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.stats.homepage(),\n queryFn: () => fetchStats(config),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchAppsRegistry,\n fetchHiddenApps,\n type AppRegistryEntry,\n type HiddenApp,\n} from '../fetchers/apps.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/** React hook for the public app registry. */\nexport function useAppsRegistry(\n options?: Omit<\n UseQueryOptions<\n AppRegistryEntry[],\n Error,\n AppRegistryEntry[],\n ReturnType<typeof sifaQueryKeys.apps.registry>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.apps.registry(),\n queryFn: () => fetchAppsRegistry(config),\n ...options,\n });\n}\n\n/**\n * React hook for the authenticated user's hidden-apps list. Requires a\n * client-side session (relies on `credentials: 'include'`).\n */\nexport function useHiddenApps(\n options?: Omit<\n UseQueryOptions<HiddenApp[], Error, HiddenApp[], ReturnType<typeof sifaQueryKeys.apps.hidden>>,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.apps.hidden(),\n queryFn: () => fetchHiddenApps(config),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport { fetchAccounts, type AccountSummary } from '../fetchers/accounts.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * React hook for the accounts attached to this browser (the account switcher).\n * Requires a client-side session (relies on `credentials: 'include'`).\n * Returns `[]` when unauthenticated.\n */\nexport function useAccounts(\n options?: Omit<\n UseQueryOptions<\n AccountSummary[],\n Error,\n AccountSummary[],\n ReturnType<typeof sifaQueryKeys.auth.accounts>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.auth.accounts(),\n queryFn: () => fetchAccounts(config),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport type { SkillSuggestion } from '../../types/index.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchSearchCompanies,\n fetchSearchFilters,\n fetchSearchProfiles,\n fetchSkillSuggestions,\n searchSkills,\n type CompanySearchFilters,\n type CompanySearchResponse,\n type FilterOptions,\n type SearchFilters,\n type SearchResponse,\n type SkillSearchResult,\n} from '../fetchers/search.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nexport function useSearchProfiles(\n filters: SearchFilters,\n options?: Omit<\n UseQueryOptions<\n SearchResponse,\n Error,\n SearchResponse,\n ReturnType<typeof sifaQueryKeys.search.profiles>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.search.profiles(filters as Record<string, unknown>),\n queryFn: () => fetchSearchProfiles(config, filters),\n ...options,\n });\n}\n\nexport function useSkillSuggestions(\n query: string,\n options?: Omit<\n UseQueryOptions<\n SkillSearchResult[],\n Error,\n SkillSearchResult[],\n ReturnType<typeof sifaQueryKeys.search.skills>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.search.skills(query),\n queryFn: () => fetchSkillSuggestions(config, query),\n enabled: query.trim().length > 0 && (options?.enabled ?? true),\n ...options,\n });\n}\n\n/**\n * Canonical-skill search hook. Hits `/api/skills/search` (the\n * canonical-skills DB lookup, distinct from {@link useSkillSuggestions}'s\n * `/api/search/skills` profile-skill typeahead). Skips the network call\n * when the query is empty.\n */\nexport function useCanonicalSkillSearch(\n query: string,\n limit = 10,\n options?: Omit<\n UseQueryOptions<\n SkillSuggestion[],\n Error,\n SkillSuggestion[],\n ReturnType<typeof sifaQueryKeys.search.canonicalSkills>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.search.canonicalSkills(query, limit),\n queryFn: () => searchSkills(config, query, limit),\n enabled: query.trim().length > 0 && (options?.enabled ?? true),\n ...options,\n });\n}\n\nexport function useSearchFilters(\n options?: Omit<\n UseQueryOptions<\n FilterOptions,\n Error,\n FilterOptions,\n ReturnType<typeof sifaQueryKeys.search.filters>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.search.filters(),\n queryFn: () => fetchSearchFilters(config),\n ...options,\n });\n}\n\n/**\n * Company search (workspace#299). Separate hook from `useSearchProfiles` so a\n * blended results page can render each category as it resolves instead of\n * waiting for the slowest.\n */\nexport function useSearchCompanies(\n filters: CompanySearchFilters,\n options?: Omit<\n UseQueryOptions<\n CompanySearchResponse,\n Error,\n CompanySearchResponse,\n ReturnType<typeof sifaQueryKeys.search.companies>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.search.companies(filters as Record<string, unknown>),\n queryFn: () => fetchSearchCompanies(config, filters),\n ...options,\n });\n}\n","'use client';\n\nimport { useEffect, useState } from 'react';\nimport {\n useMutation,\n useQuery,\n type UseMutationOptions,\n type UseQueryOptions,\n} from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchEntitySearch,\n importSearchEntities,\n mintEntityDomain,\n resolveEntityDomain,\n selectEntity,\n} from '../fetchers/entities.js';\nimport { sifaQueryKeys } from '../keys.js';\nimport type {\n EntityMintDomainResponse,\n EntityResolveDomainResponse,\n EntitySearchResponse,\n EntitySearchResult,\n EntitySelectRequest,\n EntitySelectResponse,\n} from '../../schemas/entity.js';\n\n/** Debounce a rapidly-changing value (e.g. a typeahead input). */\nexport function useDebouncedValue<T>(value: T, delayMs = 250): T {\n const [debounced, setDebounced] = useState(value);\n useEffect(() => {\n const timer = setTimeout(() => setDebounced(value), delayMs);\n return () => clearTimeout(timer);\n }, [value, delayMs]);\n return debounced;\n}\n\nexport interface UseEntitySearchOptions {\n /** Max rows to request (default 5). */\n limit?: number;\n /** Debounce delay in ms (default 250). */\n debounceMs?: number;\n enabled?: boolean;\n}\n\n/**\n * Debounced organization typeahead. The query is debounced internally, so\n * consumers can pass the raw input value on every keystroke. Skips the network\n * call while the (trimmed, debounced) query is empty.\n */\nexport function useEntitySearch(\n query: string,\n opts: UseEntitySearchOptions = {},\n queryOptions?: Omit<\n UseQueryOptions<\n EntitySearchResponse,\n Error,\n EntitySearchResponse,\n ReturnType<typeof sifaQueryKeys.entity.search>\n >,\n 'queryKey' | 'queryFn' | 'enabled'\n >,\n) {\n const config = useSifaConfig();\n const { limit = 5, debounceMs = 250, enabled = true } = opts;\n const debounced = useDebouncedValue(query.trim(), debounceMs);\n return useQuery({\n queryKey: sifaQueryKeys.entity.search(debounced, limit),\n queryFn: () => fetchEntitySearch(config, debounced, limit),\n enabled: enabled && debounced.length > 0,\n ...queryOptions,\n });\n}\n\n/** Mutation: record a selection (promote a PDL row or bump an entity). */\nexport function useSelectEntity(\n options?: Omit<\n UseMutationOptions<EntitySelectResponse, Error, EntitySelectRequest>,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n return useMutation({\n mutationFn: (body: EntitySelectRequest) => selectEntity(config, body),\n ...options,\n });\n}\n\n/** Mutation: grow-on-demand Wikidata import for a typeahead miss. */\nexport function useImportSearchEntities(\n options?: Omit<UseMutationOptions<EntitySearchResult[], Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n return useMutation({\n mutationFn: (query: string) => importSearchEntities(config, query),\n ...options,\n });\n}\n\n/**\n * Mutation: grow-on-demand by domain, Branch 1. Resolve a domain-shaped\n * typeahead miss to any notable company (Wikidata reverse P856). The response's\n * `canMint` flag drives the \"Add <domain>\" affordance.\n */\nexport function useResolveEntityDomain(\n options?: Omit<UseMutationOptions<EntityResolveDomainResponse, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n return useMutation({\n mutationFn: (domain: string) => resolveEntityDomain(config, domain),\n ...options,\n });\n}\n\n/**\n * Mutation: grow-on-demand by domain, Branch 2 (user-initiated). Mint a\n * crawled-tier entity from the domain's homepage. Rejects when the domain is not\n * mintable or the site yields nothing usable.\n */\nexport function useMintEntityDomain(\n options?: Omit<UseMutationOptions<EntityMintDomainResponse, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n return useMutation({\n mutationFn: (domain: string) => mintEntityDomain(config, domain),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchFeaturedProfile,\n fetchSimilarProfiles,\n fetchSuggestionCount,\n fetchSuggestions,\n type FeaturedProfile,\n type FetchSuggestionsOptions,\n type SimilarProfile,\n type SuggestionsResponse,\n} from '../fetchers/discovery.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nexport function useSimilarProfiles(\n did: string | undefined | null,\n opts: { limit?: number } = {},\n options?: Omit<\n UseQueryOptions<\n SimilarProfile[],\n Error,\n SimilarProfile[],\n ReturnType<typeof sifaQueryKeys.discovery.similar>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n const limit = opts.limit ?? 5;\n return useQuery({\n queryKey: sifaQueryKeys.discovery.similar(did ?? '', limit),\n queryFn: () => fetchSimilarProfiles(config, did ?? '', { limit }),\n enabled: Boolean(did) && (options?.enabled ?? true),\n ...options,\n });\n}\n\nexport function useSuggestions(\n opts: Omit<\n FetchSuggestionsOptions,\n keyof Omit<FetchSuggestionsOptions, 'source' | 'includeDismissed' | 'cursor' | 'limit'>\n > = {},\n options?: Omit<\n UseQueryOptions<\n SuggestionsResponse,\n Error,\n SuggestionsResponse,\n ReturnType<typeof sifaQueryKeys.discovery.suggestions>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.discovery.suggestions(opts as Record<string, unknown>),\n queryFn: () => fetchSuggestions(config, opts),\n ...options,\n });\n}\n\nexport function useSuggestionCount(\n since?: string,\n options?: Omit<\n UseQueryOptions<\n number,\n Error,\n number,\n ReturnType<typeof sifaQueryKeys.discovery.suggestionCount>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.discovery.suggestionCount(since),\n queryFn: () => fetchSuggestionCount(config, since),\n ...options,\n });\n}\n\nexport function useFeaturedProfile(\n options?: Omit<\n UseQueryOptions<\n FeaturedProfile | null,\n Error,\n FeaturedProfile | null,\n ReturnType<typeof sifaQueryKeys.discovery.featured>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.discovery.featured(),\n queryFn: () => fetchFeaturedProfile(config),\n ...options,\n });\n}\n","'use client';\n\nimport {\n useInfiniteQuery,\n useMutation,\n useQuery,\n useQueryClient,\n type InfiniteData,\n type UseInfiniteQueryOptions,\n type UseMutationOptions,\n type UseQueryOptions,\n} from '@tanstack/react-query';\n\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchFollowing,\n followUser,\n getFollowers,\n getFollowing,\n getFollowingFeed,\n unfollowUser,\n type FetchFollowListOptions,\n type FetchFollowingFeedOptions,\n type FollowListPage,\n type FollowProfile,\n type FollowUserResult,\n type FollowingResponse,\n} from '../fetchers/follow.js';\nimport type { FollowFeedPage } from '../../schemas/feed.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Legacy \"people I follow\" query. Kept as-is for back-compat with sifa-web\n * call sites that pre-date the V5 feed work. New code should use\n * {@link useFollowingList} (paginated per-profile) or\n * {@link useFollowingFeed} (V5 feed).\n */\nexport function useFollowing(\n opts: { source?: string; cursor?: string; limit?: number } = {},\n options?: Omit<\n UseQueryOptions<\n FollowingResponse,\n Error,\n FollowingResponse,\n ReturnType<typeof sifaQueryKeys.follow.following>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.follow.following(opts as Record<string, unknown>),\n queryFn: () => fetchFollowing(config, opts),\n ...options,\n });\n}\n\n/** Variables for {@link useFollow}. */\nexport interface FollowVariables {\n handle: string;\n /** Server-resolved DID of the subject, when known. Used for optimistic cache writes. */\n subjectDid?: string;\n /** Optional Sifa-only \"why I followed\" note (max 200 graphemes). */\n note?: string;\n}\n\n/** Variables for {@link useUnfollow}. */\nexport interface UnfollowVariables {\n handle: string;\n}\n\n/**\n * Mutation hook for following a handle. Optimistically marks the\n * follow-state cache as `true` and rolls back on failure (per\n * sifa-api#673 TR8 / iter-1 plan TR8). Invalidates the followers /\n * following lists and the V5 feed on success so they refetch.\n *\n * Optimistic cache entry: `sifaQueryKeys.follow.followers(handle)`\n * receives the viewer prepended to the list shape; the optimistic update\n * is intentionally conservative — it only flips per-handle state and\n * doesn't try to invent rich `FollowProfile` fields.\n */\nexport function useFollow(\n options?: Omit<UseMutationOptions<FollowUserResult, Error, FollowVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ handle, note }: FollowVariables) => followUser(config, handle, { note }),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.follow.all() });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n onError: async (error, variables, onMutateResult, context) => {\n // Rollback: refetch the affected lists so stale optimistic state is reset.\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.follow.all() });\n await options?.onError?.(error, variables, onMutateResult, context);\n },\n });\n}\n\n/**\n * Mutation hook for unfollowing a handle. Optimistic + rollback mirror\n * of {@link useFollow}.\n */\nexport function useUnfollow(\n options?: Omit<UseMutationOptions<WriteResult, Error, UnfollowVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ handle }: UnfollowVariables) => unfollowUser(config, handle),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.follow.all() });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n onError: async (error, variables, onMutateResult, context) => {\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.follow.all() });\n await options?.onError?.(error, variables, onMutateResult, context);\n },\n });\n}\n\n/** Infinite-query hook for `handle`'s followers list. */\nexport function useFollowers(\n handle: string,\n opts: Omit<FetchFollowListOptions, 'cursor'> = {},\n options?: Omit<\n UseInfiniteQueryOptions<\n FollowListPage,\n Error,\n InfiniteData<FollowListPage>,\n ReturnType<typeof sifaQueryKeys.follow.followers>,\n string | undefined\n >,\n 'queryKey' | 'queryFn' | 'initialPageParam' | 'getNextPageParam'\n >,\n) {\n const config = useSifaConfig();\n return useInfiniteQuery({\n queryKey: sifaQueryKeys.follow.followers(handle),\n queryFn: ({ pageParam }) => getFollowers(config, handle, { ...opts, cursor: pageParam }),\n initialPageParam: undefined as string | undefined,\n getNextPageParam: (lastPage: FollowListPage) => lastPage.cursor ?? undefined,\n enabled: handle.length > 0,\n ...options,\n });\n}\n\n/** Infinite-query hook for who `handle` follows. */\nexport function useFollowingList(\n handle: string,\n opts: Omit<FetchFollowListOptions, 'cursor'> = {},\n options?: Omit<\n UseInfiniteQueryOptions<\n FollowListPage,\n Error,\n InfiniteData<FollowListPage>,\n ReturnType<typeof sifaQueryKeys.follow.followingOf>,\n string | undefined\n >,\n 'queryKey' | 'queryFn' | 'initialPageParam' | 'getNextPageParam'\n >,\n) {\n const config = useSifaConfig();\n return useInfiniteQuery({\n queryKey: sifaQueryKeys.follow.followingOf(handle),\n queryFn: ({ pageParam }) => getFollowing(config, handle, { ...opts, cursor: pageParam }),\n initialPageParam: undefined as string | undefined,\n getNextPageParam: (lastPage: FollowListPage) => lastPage.cursor ?? undefined,\n enabled: handle.length > 0,\n ...options,\n });\n}\n\n/**\n * Infinite-query hook for the V5 home feed (authenticated viewer).\n *\n * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).\n * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere\n * Stream are two distinct surfaces with different data paths (Barazo API\n * for Timeline, live PDS reads + Valkey for Stream). This hook is no\n * longer consumed. Scheduled for removal in next major bump.\n */\nexport function useFollowingFeed(\n opts: Omit<FetchFollowingFeedOptions, 'cursor'> = {},\n options?: Omit<\n UseInfiniteQueryOptions<\n FollowFeedPage,\n Error,\n InfiniteData<FollowFeedPage>,\n ReturnType<typeof sifaQueryKeys.follow.feed>,\n string | undefined\n >,\n 'queryKey' | 'queryFn' | 'initialPageParam' | 'getNextPageParam'\n >,\n) {\n const config = useSifaConfig();\n // Drop AbortSignal/fetch-only fields from the key so cache identity stays stable across renders.\n const keyOpts: Record<string, unknown> = {\n limit: opts.limit,\n categories: opts.categories,\n };\n return useInfiniteQuery({\n queryKey: sifaQueryKeys.follow.feed(keyOpts),\n queryFn: ({ pageParam }) => getFollowingFeed(config, { ...opts, cursor: pageParam }),\n initialPageParam: undefined as string | undefined,\n getNextPageParam: (lastPage: FollowFeedPage) => lastPage.cursor ?? undefined,\n ...options,\n });\n}\n\n// Re-export for convenience so consumers only need one import path for the type.\nexport type { FollowProfile };\n","'use client';\n\nimport {\n useInfiniteQuery,\n type InfiniteData,\n type UseInfiniteQueryOptions,\n} from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n getBlueskySuggestions,\n getMutuals,\n type FetchFollowProfilePageOptions,\n type FollowProfilePageResponse,\n} from '../fetchers/follow-extras.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Infinite-query hook for the mutuals list of `handleOrDid`. Backed by\n * {@link getMutuals} (`GET /api/profile/{handleOrDid}/mutuals`). Disabled\n * when `handleOrDid` is empty so component-mount with a lazy handle doesn't\n * fire a wasted request.\n */\nexport function useMutuals(\n handleOrDid: string,\n opts: Omit<FetchFollowProfilePageOptions, 'cursor'> = {},\n options?: Omit<\n UseInfiniteQueryOptions<\n FollowProfilePageResponse,\n Error,\n InfiniteData<FollowProfilePageResponse>,\n ReturnType<typeof sifaQueryKeys.follow.mutuals>,\n string | undefined\n >,\n 'queryKey' | 'queryFn' | 'initialPageParam' | 'getNextPageParam'\n >,\n) {\n const config = useSifaConfig();\n return useInfiniteQuery({\n queryKey: sifaQueryKeys.follow.mutuals(handleOrDid),\n queryFn: ({ pageParam }) => getMutuals(config, handleOrDid, { ...opts, cursor: pageParam }),\n initialPageParam: undefined as string | undefined,\n getNextPageParam: (lastPage: FollowProfilePageResponse) => lastPage.cursor ?? undefined,\n enabled: handleOrDid.length > 0,\n ...options,\n });\n}\n\n/**\n * Infinite-query hook for the authenticated viewer's Bluesky-follow\n * suggestions (people the viewer follows on Bluesky but not Sifa).\n * Backed by {@link getBlueskySuggestions}.\n */\nexport function useBlueskySuggestions(\n opts: Omit<FetchFollowProfilePageOptions, 'cursor'> = {},\n options?: Omit<\n UseInfiniteQueryOptions<\n FollowProfilePageResponse,\n Error,\n InfiniteData<FollowProfilePageResponse>,\n ReturnType<typeof sifaQueryKeys.follow.blueskySuggestions>,\n string | undefined\n >,\n 'queryKey' | 'queryFn' | 'initialPageParam' | 'getNextPageParam'\n >,\n) {\n const config = useSifaConfig();\n return useInfiniteQuery({\n queryKey: sifaQueryKeys.follow.blueskySuggestions(),\n queryFn: ({ pageParam }) => getBlueskySuggestions(config, { ...opts, cursor: pageParam }),\n initialPageParam: undefined as string | undefined,\n getNextPageParam: (lastPage: FollowProfilePageResponse) => lastPage.cursor ?? undefined,\n ...options,\n });\n}\n","'use client';\n\nimport {\n useMutation,\n useQuery,\n useQueryClient,\n type UseMutationOptions,\n type UseQueryOptions,\n} from '@tanstack/react-query';\n\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n addFeatureAllowlist,\n listFeatureAllowlist,\n removeFeatureAllowlist,\n type FeatureAllowlistResponse,\n} from '../fetchers/admin-feature-allowlists.js';\nimport type { FeatureAllowlistEntry, FeatureFlag } from '../../schemas/follow-profile.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Read hook for the admin allowlist of a given feature flag. Admin-gated on\n * the server; non-admins get an empty list (the fetcher swallows 403).\n */\nexport function useFeatureAllowlist(\n flag: FeatureFlag,\n options?: Omit<\n UseQueryOptions<\n FeatureAllowlistResponse,\n Error,\n FeatureAllowlistResponse,\n ReturnType<typeof sifaQueryKeys.admin.featureAllowlist>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.admin.featureAllowlist(flag),\n queryFn: () => listFeatureAllowlist(config, flag),\n ...options,\n });\n}\n\n/** Snapshot of the previous cache entry; returned from `onMutate` for rollback. */\ninterface AllowlistMutationContext {\n previous: FeatureAllowlistResponse | undefined;\n}\n\n/** Variables for {@link useAddFeatureAllowlist}. */\nexport interface AddFeatureAllowlistVariables {\n did: string;\n note?: string;\n}\n\n/**\n * Mutation hook to add (or upsert) a DID on the given flag's allowlist.\n * Optimistically prepends a synthesized entry to the cache so admin UIs feel\n * instant; rolls back if the server reports failure.\n */\nexport function useAddFeatureAllowlist(\n flag: FeatureFlag,\n options?: Omit<\n UseMutationOptions<WriteResult, Error, AddFeatureAllowlistVariables, AllowlistMutationContext>,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n const key = sifaQueryKeys.admin.featureAllowlist(flag);\n\n return useMutation<WriteResult, Error, AddFeatureAllowlistVariables, AllowlistMutationContext>({\n mutationFn: ({ did, note }) => addFeatureAllowlist(config, flag, did, { note }),\n onMutate: async ({ did, note }) => {\n await queryClient.cancelQueries({ queryKey: key });\n const previous = queryClient.getQueryData<FeatureAllowlistResponse>(key);\n const optimisticEntry: FeatureAllowlistEntry = {\n did,\n addedAt: new Date().toISOString(),\n note: note ?? null,\n };\n const next: FeatureAllowlistResponse = previous\n ? { items: [optimisticEntry, ...previous.items.filter((e) => e.did !== did)] }\n : { items: [optimisticEntry] };\n queryClient.setQueryData<FeatureAllowlistResponse>(key, next);\n return { previous };\n },\n onSuccess: async (result, variables, onMutateResult, context) => {\n // The fetcher's never-throws contract (see {@link apiWrite}) means a\n // server-side failure surfaces here as `result.success === false`, not\n // as an `onError`. Roll back the optimistic insert in that case.\n if (!result.success && onMutateResult?.previous) {\n queryClient.setQueryData(key, onMutateResult.previous);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n onError: async (error, variables, onMutateResult, context) => {\n if (onMutateResult?.previous) {\n queryClient.setQueryData(key, onMutateResult.previous);\n }\n await options?.onError?.(error, variables, onMutateResult, context);\n },\n onSettled: async (result, error, variables, onMutateResult, context) => {\n await queryClient.invalidateQueries({ queryKey: key });\n await options?.onSettled?.(result, error, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/** Variables for {@link useRemoveFeatureAllowlist}. */\nexport interface RemoveFeatureAllowlistVariables {\n did: string;\n}\n\n/**\n * Mutation hook to remove a DID from the given flag's allowlist.\n * Optimistically removes the row from the cache; rolls back if the server\n * reports failure.\n */\nexport function useRemoveFeatureAllowlist(\n flag: FeatureFlag,\n options?: Omit<\n UseMutationOptions<\n WriteResult,\n Error,\n RemoveFeatureAllowlistVariables,\n AllowlistMutationContext\n >,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n const key = sifaQueryKeys.admin.featureAllowlist(flag);\n\n return useMutation<WriteResult, Error, RemoveFeatureAllowlistVariables, AllowlistMutationContext>(\n {\n mutationFn: ({ did }) => removeFeatureAllowlist(config, flag, did),\n onMutate: async ({ did }) => {\n await queryClient.cancelQueries({ queryKey: key });\n const previous = queryClient.getQueryData<FeatureAllowlistResponse>(key);\n if (previous) {\n queryClient.setQueryData<FeatureAllowlistResponse>(key, {\n items: previous.items.filter((e) => e.did !== did),\n });\n }\n return { previous };\n },\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (!result.success && onMutateResult?.previous) {\n queryClient.setQueryData(key, onMutateResult.previous);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n onError: async (error, variables, onMutateResult, context) => {\n if (onMutateResult?.previous) {\n queryClient.setQueryData(key, onMutateResult.previous);\n }\n await options?.onError?.(error, variables, onMutateResult, context);\n },\n onSettled: async (result, error, variables, onMutateResult, context) => {\n await queryClient.invalidateQueries({ queryKey: key });\n await options?.onSettled?.(result, error, variables, onMutateResult, context);\n },\n ...options,\n },\n );\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport { getAdminReviewQueues, type AdminReviewQueues } from '../fetchers/admin-review-queues.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/** Default staleness for the queue counts, matching the API cache TTL. */\nconst REVIEW_QUEUES_STALE_TIME_MS = 60_000;\n\n/**\n * Read hook for the open counts of the three admin review queues. Shared by\n * the admin nav pill and the review-queues page so both render one number\n * from one request.\n *\n * Admin-gated on the server; non-admins get an error rather than zeroes.\n */\nexport function useAdminReviewQueues(\n options?: Omit<\n UseQueryOptions<\n AdminReviewQueues,\n Error,\n AdminReviewQueues,\n ReturnType<typeof sifaQueryKeys.admin.reviewQueues>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.admin.reviewQueues(),\n queryFn: () => getAdminReviewQueues(config),\n staleTime: REVIEW_QUEUES_STALE_TIME_MS,\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchActivityFeed,\n fetchActivityTeaser,\n fetchHeatmapData,\n type ActivityFeedResponse,\n type ActivityTeaserResponse,\n type FetchActivityFeedOptions,\n type HeatmapResponse,\n} from '../fetchers/activity.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nexport function useHeatmapData(\n handleOrDid: string | undefined | null,\n days: number,\n options?: Omit<\n UseQueryOptions<\n HeatmapResponse | null,\n Error,\n HeatmapResponse | null,\n ReturnType<typeof sifaQueryKeys.activity.heatmap>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.activity.heatmap(handleOrDid ?? '', days),\n queryFn: () => fetchHeatmapData(config, handleOrDid ?? '', days),\n enabled: Boolean(handleOrDid) && (options?.enabled ?? true),\n ...options,\n });\n}\n\nexport function useActivityTeaser(\n handleOrDid: string | undefined | null,\n options?: Omit<\n UseQueryOptions<\n ActivityTeaserResponse | null,\n Error,\n ActivityTeaserResponse | null,\n ReturnType<typeof sifaQueryKeys.activity.teaser>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.activity.teaser(handleOrDid ?? ''),\n queryFn: () => fetchActivityTeaser(config, handleOrDid ?? ''),\n enabled: Boolean(handleOrDid) && (options?.enabled ?? true),\n ...options,\n });\n}\n\nexport function useActivityFeed(\n handleOrDid: string | undefined | null,\n opts: Pick<FetchActivityFeedOptions, 'category' | 'limit' | 'cursor'> = {},\n options?: Omit<\n UseQueryOptions<\n ActivityFeedResponse | null,\n Error,\n ActivityFeedResponse | null,\n ReturnType<typeof sifaQueryKeys.activity.feed>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.activity.feed(handleOrDid ?? '', opts as Record<string, unknown>),\n queryFn: () => fetchActivityFeed(config, handleOrDid ?? '', opts),\n enabled: Boolean(handleOrDid) && (options?.enabled ?? true),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchMyGithubPullRequests,\n type MyGithubPullRequestsResponse,\n} from '../fetchers/github-prs.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nexport interface UseMyGithubPullRequestsParams {\n limit?: number;\n offset?: number;\n}\n\n/**\n * The authenticated viewer's own ingested merged PRs (newest first). Auth-scoped\n * via the session cookie. Backs the sifa-web GitHub importer (issue #302).\n */\nexport function useMyGithubPullRequests(\n params: UseMyGithubPullRequestsParams = {},\n options?: Omit<\n UseQueryOptions<\n MyGithubPullRequestsResponse,\n Error,\n MyGithubPullRequestsResponse,\n ReturnType<typeof sifaQueryKeys.github.myPullRequests>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.github.myPullRequests(params),\n queryFn: () => fetchMyGithubPullRequests(config, params),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport { fetchEndorsementCount } from '../fetchers/endorsement.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/** Count of confirmed endorsements for a DID. Returns 0 on error. */\nexport function useEndorsementCount(\n did: string | undefined | null,\n options?: Omit<\n UseQueryOptions<number, Error, number, ReturnType<typeof sifaQueryKeys.endorsement.count>>,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.endorsement.count(did ?? ''),\n queryFn: () => fetchEndorsementCount(config, did ?? ''),\n enabled: Boolean(did) && (options?.enabled ?? true),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport { fetchNetworkStreamCount } from '../fetchers/stream.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Count of items in the authenticated user's network stream digest.\n * Returns 0 on error (including when the endpoint isn't yet shipped).\n */\nexport function useNetworkStreamCount(\n did: string | undefined | null,\n options?: Omit<\n UseQueryOptions<number, Error, number, ReturnType<typeof sifaQueryKeys.stream.networkCount>>,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.stream.networkCount(did ?? ''),\n queryFn: () => fetchNetworkStreamCount(config, did ?? ''),\n enabled: Boolean(did) && (options?.enabled ?? true),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n checkAppAccount,\n fetchReactionStatus,\n type AccountCheckResult,\n type ReactionStatus,\n} from '../fetchers/reactions.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Batch-look up reaction status for multiple URIs. Skips the network call\n * when `uris` is empty.\n */\nexport function useReactionStatus(\n uris: string[],\n options?: Omit<\n UseQueryOptions<\n Record<string, ReactionStatus> | null,\n Error,\n Record<string, ReactionStatus> | null,\n ReturnType<typeof sifaQueryKeys.reactions.status>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.reactions.status(uris),\n queryFn: () => fetchReactionStatus(config, uris),\n ...options,\n });\n}\n\n/** Check whether the authenticated viewer has an account on the given app. */\nexport function useAppAccountCheck(\n appId: string | undefined | null,\n options?: Omit<\n UseQueryOptions<\n AccountCheckResult | null,\n Error,\n AccountCheckResult | null,\n ReturnType<typeof sifaQueryKeys.reactions.accountCheck>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.reactions.accountCheck(appId ?? ''),\n queryFn: () => checkAppAccount(config, appId ?? ''),\n enabled: Boolean(appId) && (options?.enabled ?? true),\n ...options,\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n createReaction,\n deleteReaction,\n type ReactionError,\n type ReactionResult,\n} from '../fetchers/reactions.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/** Variables for {@link useCreateReaction}. */\nexport interface CreateReactionVariables {\n targetUri: string;\n appId: string;\n targetCid?: string;\n}\n\ntype CreateReactionMutationResult =\n { ok: true; data: ReactionResult } | { ok: false; error: ReactionError };\n\n/**\n * React hook for creating a reaction. Returns the discriminated-union\n * result so the caller can detect `scope_insufficient` and trigger an\n * OAuth scope-upgrade flow.\n *\n * Invalidates the entire `sifaQueryKeys.reactions.all()` subtree on\n * success (any cached `useReactionStatus` view that includes the new\n * URI needs a refresh).\n */\nexport function useCreateReaction(\n options?: Omit<\n UseMutationOptions<CreateReactionMutationResult, Error, CreateReactionVariables>,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ targetUri, appId, targetCid }: CreateReactionVariables) =>\n createReaction(config, targetUri, appId, targetCid),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.ok) {\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.reactions.all() });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** Variables for {@link useDeleteReaction}. */\nexport interface DeleteReactionVariables {\n targetUri: string;\n appId: string;\n}\n\n/** React hook for deleting a reaction. */\nexport function useDeleteReaction(\n options?: Omit<UseMutationOptions<WriteResult, Error, DeleteReactionVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: ({ targetUri, appId }: DeleteReactionVariables) =>\n deleteReaction(config, targetUri, appId),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.reactions.all() });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchMyRoadmapVotes,\n fetchRoadmapVotes,\n type RoadmapVotesResponse,\n} from '../fetchers/roadmap.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/** Public roadmap vote tallies. Returns `{}` data on error. */\nexport function useRoadmapVotes(\n options?: Omit<\n UseQueryOptions<\n RoadmapVotesResponse,\n Error,\n RoadmapVotesResponse,\n ReturnType<typeof sifaQueryKeys.roadmap.votes>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.roadmap.votes(),\n queryFn: () => fetchRoadmapVotes(config),\n ...options,\n });\n}\n\n/** Roadmap items the authenticated viewer has voted on. Returns `[]` data on error. */\nexport function useMyRoadmapVotes(\n options?: Omit<\n UseQueryOptions<string[], Error, string[], ReturnType<typeof sifaQueryKeys.roadmap.myVotes>>,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.roadmap.myVotes(),\n queryFn: () => fetchMyRoadmapVotes(config),\n ...options,\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n castRoadmapVote,\n retractRoadmapVote,\n type CastRoadmapVoteResult,\n} from '../fetchers/roadmap.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateRoadmap(queryClient: ReturnType<typeof useQueryClient>): Promise<void> {\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.roadmap.all() });\n}\n\n/**\n * React hook for casting a roadmap vote. Variable: the item key.\n *\n * Returns the discriminated-union result so callers can detect\n * `scope_insufficient` and trigger an OAuth scope-upgrade flow\n * (see {@link castRoadmapVote}).\n */\nexport function useCastRoadmapVote(\n options?: Omit<UseMutationOptions<CastRoadmapVoteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (key: string) => castRoadmapVote(config, key),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.ok) {\n await invalidateRoadmap(queryClient);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/** React hook for retracting a previously-cast roadmap vote. */\nexport function useRetractRoadmapVote(\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (key: string) => retractRoadmapVote(config, key),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateRoadmap(queryClient);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport {\n useMutation,\n useQuery,\n useQueryClient,\n type UseMutationOptions,\n type UseQueryOptions,\n} from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n deleteAccount,\n fetchWipePreview,\n resetProfile,\n type DeleteAccountResult,\n type ResetProfileResult,\n type WipePreview,\n} from '../fetchers/destructive.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Read which id.sifa.* collections the current grant cannot delete, so a\n * delete-account UI can ask for the missing scope BEFORE the destructive step.\n *\n * Not cached: the whole point is to reflect the grant as it stands right now,\n * and the grant changes underneath this hook when the user returns from the\n * consent screen. A stale \"no gaps\" here is the failure this exists to prevent.\n */\nexport function useWipePreview(\n options?: Omit<\n UseQueryOptions<\n WipePreview,\n Error,\n WipePreview,\n ReturnType<typeof sifaQueryKeys.destructive.wipePreview>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.destructive.wipePreview(),\n queryFn: () => fetchWipePreview(config),\n staleTime: 0,\n gcTime: 0,\n ...options,\n });\n}\n\n/**\n * React hook for resetting the authenticated user's Sifa profile.\n * Variable: `deletePdsData` boolean.\n *\n * Invalidates the entire `sifaQueryKeys.all()` subtree on success\n * (everything Sifa-related needs a refresh after a reset).\n */\nexport function useResetProfile(\n options?: Omit<UseMutationOptions<ResetProfileResult, Error, boolean>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (deletePdsData: boolean) => resetProfile(config, deletePdsData),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.all() });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n\n/**\n * React hook for deleting the authenticated user's account. Variable:\n * `deletePdsData` boolean. Returns the deleted handle on success.\n *\n * On success, clears the entire query cache (the user is logged out\n * and nothing they previously cached should be retained).\n */\nexport function useDeleteAccount(\n options?: Omit<UseMutationOptions<DeleteAccountResult, Error, boolean>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (deletePdsData: boolean) => deleteAccount(config, deletePdsData),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n queryClient.clear();\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport {\n useMutation,\n useQuery,\n useQueryClient,\n type UseMutationOptions,\n type UseQueryOptions,\n} from '@tanstack/react-query';\n\nimport type { RepoDeleteResult, RepoInventory } from '../../repo/types.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n deleteRepoRecords,\n fetchRepoInventory,\n type RepoDeleteInput,\n} from '../fetchers/repo-inventory.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Read the id.sifa.* records in the authenticated user's repo.\n *\n * Not cached client-side: this is a page about what exists right now, and a\n * user who deletes a record, navigates away and comes back must not be shown\n * it again from cache. The server caches the PDS read briefly, which is where\n * that cost belongs.\n */\nexport function useRepoInventory(\n options?: Omit<\n UseQueryOptions<\n RepoInventory,\n Error,\n RepoInventory,\n ReturnType<typeof sifaQueryKeys.repoInventory.list>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.repoInventory.list(),\n queryFn: () => fetchRepoInventory(config),\n staleTime: 0,\n gcTime: 0,\n ...options,\n });\n}\n\n/**\n * Delete records from the authenticated user's repo.\n *\n * Invalidates the whole Sifa key subtree, not just the inventory: the records\n * being removed are the ones the profile is built from, so anything showing\n * profile content is stale the moment this succeeds.\n */\nexport function useDeleteRepoRecords(\n options?: Omit<\n UseMutationOptions<\n RepoDeleteResult & { success: boolean; error?: string },\n Error,\n RepoDeleteInput\n >,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied handler would otherwise replace the\n // one below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (input: RepoDeleteInput) => deleteRepoRecords(config, input),\n onSuccess: async (result, variables, onMutateResult, context) => {\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.all() });\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","/**\n * Adult-content gating for Bluesky activity items.\n *\n * Bluesky's official moderation labeler attaches content labels to\n * `app.bsky.feed.defs#postView.labels`. The four sex-and-violence labels\n * below are the ones we hide by default on Sifa: media is replaced with an\n * `<AdultContentWarning>` placeholder card in sifa-web. Authenticated\n * viewers can reveal per-card; anonymous viewers cannot.\n *\n * The list mirrors Bluesky's own globalLabelStrings; if the official set\n * grows (e.g. a new `extreme-violence` label), update this constant.\n *\n * Why a constant + predicate live in the SDK: the same logic needs to run\n * in sifa-web today and sifa-app tomorrow, and the API only forwards the\n * raw labels — the hide decision is a client concern.\n */\n\nexport const ADULT_CONTENT_LABELS = ['porn', 'sexual', 'nudity', 'graphic-media'] as const;\n\nexport type AdultContentLabel = (typeof ADULT_CONTENT_LABELS)[number];\n\n/**\n * A single label entry as emitted by `app.bsky.feed.defs#postView.labels`.\n * Matches `com.atproto.label.defs#label` (the on-wire shape after the AppView\n * resolves a `postView`). `neg: true` marks a retraction.\n */\nexport interface ActivityLabel {\n val: string;\n src: string;\n uri: string;\n cts?: string;\n neg?: boolean;\n}\n\n/**\n * Return true if the item carries at least one adult-content label that is\n * not negated. Items without a `labels` field (every non-Bluesky source,\n * legacy responses) are treated as safe.\n */\nexport function hasAdultContent(item: { labels?: ActivityLabel[] }): boolean {\n const labels = item.labels;\n if (!labels || labels.length === 0) return false;\n return labels.some(\n (label) => !label.neg && (ADULT_CONTENT_LABELS as readonly string[]).includes(label.val),\n );\n}\n","import { ADULT_CONTENT_LABELS, type AdultContentLabel } from '../../cards/adult-content.js';\nimport {\n apiFetch,\n apiWrite,\n type ApiFetchOptions,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/**\n * Visibility values defined by `app.bsky.actor.defs#contentLabelPref`.\n * `null` means the viewer has no explicit pref for that label — call sites\n * decide a default (Sifa hides by default; Bluesky's own client defaults\n * to `warn` for adult labels on new accounts).\n */\nexport type BskyContentLabelVisibility = 'ignore' | 'warn' | 'hide';\n\nexport type BskyContentLabelPrefs = Record<AdultContentLabel, BskyContentLabelVisibility | null>;\n\nexport interface BskyContentLabelPrefsResponse {\n contentLabels: BskyContentLabelPrefs;\n}\n\nexport interface BskyPrefsScopeError {\n error: 'InsufficientScope';\n message?: string;\n needsScope: 'bsky-preferences';\n}\n\n/**\n * Read the viewer's Bluesky content-label preferences via sifa-api's\n * proxy. Returns `null` when the viewer's OAuth grant doesn't include the\n * read scope — sifa-web treats this as \"needs scope upgrade\" and triggers\n * a granular re-auth.\n *\n * Any other failure (network, upstream PDS error) also resolves to `null`\n * so callers always have a safe default (hide everything).\n */\nexport async function fetchBskyContentLabelPrefs(\n config: SifaApiConfig,\n options: ApiFetchOptions & { onNeedsScope?: () => void } = {},\n): Promise<BskyContentLabelPrefs | null> {\n const { onNeedsScope, ...fetchOptions } = options;\n try {\n const res = await apiFetch<BskyContentLabelPrefsResponse>(\n config,\n '/api/bsky/preferences/content-labels',\n { credentials: 'include', ...fetchOptions },\n );\n return res.contentLabels;\n } catch (err) {\n if (\n err &&\n typeof err === 'object' &&\n 'status' in err &&\n (err as { status: number }).status === 403\n ) {\n onNeedsScope?.();\n }\n return null;\n }\n}\n\nexport interface UpdateBskyContentLabelPrefsBody {\n contentLabels: Array<{\n label: AdultContentLabel;\n visibility: BskyContentLabelVisibility;\n }>;\n}\n\n/**\n * Update one or more of the viewer's adult content-label preferences. The\n * sifa-api endpoint merges these into the viewer's existing prefs and\n * writes the whole array back to their PDS — entries we don't touch are\n * preserved.\n *\n * On insufficient-scope returns `{ success: false, error: ..., needsScope }`\n * so the caller can drive a granular re-auth.\n */\nexport async function updateBskyContentLabelPrefs(\n config: SifaApiConfig,\n body: UpdateBskyContentLabelPrefsBody,\n): Promise<\n WriteResult & { contentLabels?: BskyContentLabelPrefs; needsScope?: 'bsky-preferences' }\n> {\n const result = await apiWrite<{\n contentLabels?: BskyContentLabelPrefs;\n needsScope?: 'bsky-preferences';\n }>(config, '/api/bsky/preferences/content-labels', 'PUT', {\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(body),\n });\n return result;\n}\n\n/**\n * Compute the effective visibility for a Bluesky adult label.\n *\n * - Anonymous viewer (no prefs): always `hide` — matches Bluesky's logged-out\n * behaviour; sifa-web won't even render a Show button.\n * - Authenticated viewer with no explicit pref: `hide` by default, so Sifa\n * stays safe-by-default and matches the gate that ships in sifa-web#1240\n * today.\n * - Authenticated viewer with an explicit pref: use it directly.\n *\n * Returns `'ignore'` to mean \"render media inline\", `'warn'` and `'hide'`\n * both mean \"placeholder card + reveal button\" — Sifa doesn't distinguish\n * the two today, but keeping them separate matches the lexicon and lets the\n * UI evolve (e.g. blur for warn, full hide for hide) without an SDK change.\n */\nexport function effectiveContentVisibility(\n label: AdultContentLabel,\n prefs: BskyContentLabelPrefs | null,\n isAuthenticated: boolean,\n): BskyContentLabelVisibility {\n if (!isAuthenticated) return 'hide';\n const value = prefs?.[label] ?? null;\n return value ?? 'hide';\n}\n\n/**\n * Whether a labeled item should render its media inline. Convenience over\n * `effectiveContentVisibility` for the common \"any adult label hides\n * everything\" case in BlueskyPostCard.\n */\nexport function shouldGateAdultMedia(\n labels: ReadonlyArray<{ val: string; neg?: boolean }> | undefined,\n prefs: BskyContentLabelPrefs | null,\n isAuthenticated: boolean,\n): boolean {\n if (!labels || labels.length === 0) return false;\n for (const label of labels) {\n if (label.neg) continue;\n if (!(ADULT_CONTENT_LABELS as readonly string[]).includes(label.val)) continue;\n const visibility = effectiveContentVisibility(\n label.val as AdultContentLabel,\n prefs,\n isAuthenticated,\n );\n if (visibility !== 'ignore') return true;\n }\n return false;\n}\n","'use client';\n\nimport { useMutation, useQuery, useQueryClient, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchBskyContentLabelPrefs,\n updateBskyContentLabelPrefs,\n type BskyContentLabelPrefs,\n type UpdateBskyContentLabelPrefsBody,\n} from '../fetchers/bsky-preferences.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Read the viewer's Bluesky adult content-label preferences. The fetcher\n * returns `null` when the OAuth grant doesn't include the read scope\n * (sifa-api responds 403 with `needsScope: 'bsky-preferences'`); call\n * sites should treat `null` as \"needs scope upgrade\" and route through\n * the granular re-auth flow before retrying.\n *\n * Pass `enabled: false` for anonymous viewers — TanStack will skip the\n * fetch entirely and the gate will fall through to its default-hide path.\n */\nexport function useBskyContentLabelPrefs(\n options?: Omit<\n UseQueryOptions<\n BskyContentLabelPrefs | null,\n Error,\n BskyContentLabelPrefs | null,\n ReturnType<typeof sifaQueryKeys.bskyPreferences.contentLabels>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.bskyPreferences.contentLabels(),\n queryFn: () => fetchBskyContentLabelPrefs(config),\n // Prefs change rarely; long stale time keeps the gate snappy on\n // navigation. Invalidation after a write is explicit.\n staleTime: 5 * 60_000,\n ...options,\n });\n}\n\n/**\n * Mutation that updates one or more adult-content prefs on the viewer's\n * PDS via sifa-api, then writes the merged result back into the prefs\n * cache so the next render reflects the change without a refetch.\n */\nexport function useUpdateBskyContentLabelPrefs() {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (body: UpdateBskyContentLabelPrefsBody) =>\n updateBskyContentLabelPrefs(config, body),\n onSuccess: (result) => {\n if (result.success && result.contentLabels) {\n queryClient.setQueryData<BskyContentLabelPrefs | null>(\n sifaQueryKeys.bskyPreferences.contentLabels(),\n result.contentLabels,\n );\n } else {\n // Even on failure, drop the cached value so the next read tries\n // again — a 403 might mean a fresh scope grant succeeded but the\n // local cache still reflects the pre-grant state.\n void queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.bskyPreferences.all(),\n });\n }\n },\n });\n}\n","import { apiWrite, type ApiFetchOptions, type SifaApiConfig, type WriteResult } from '../client.js';\nimport type { OrgClaimRequestInput } from '../../schemas/write/org-claim.js';\nimport type {\n OrgDomainChallengeRequestInput,\n OrgDomainVerifyRequestInput,\n OrgNotificationEmailRequestInput,\n OrgProfileUpdateRequestInput,\n} from '../../schemas/write/org-settings.js';\n\n/** How a single entity binding was resolved during a claim. */\nexport interface OrgClaimBinding {\n entityId: number;\n entityRef: string;\n validatedBy: string | null;\n status: 'active' | 'pending';\n dissolved: boolean;\n}\n\n/** The public org-profile echo returned by claim / update endpoints (no `contact`). */\nexport interface OrgProfileEcho {\n name: string;\n description: string | null;\n website: string | null;\n entityRefs: string[];\n}\n\n/** Response body of `POST /api/org/claim`. */\nexport interface OrgClaimResult {\n orgDid: string;\n status: 'active' | 'review';\n bindings: OrgClaimBinding[];\n orgProfile: OrgProfileEcho;\n}\n\n/** Response body of `PUT /api/org/profile`. */\nexport interface OrgProfileUpdateResult {\n ok: boolean;\n orgProfile: OrgProfileEcho;\n}\n\n/** Response body of `POST /api/org/domains/challenge`. */\nexport interface OrgDomainChallengeResult {\n domain: string;\n txtRecordName: string;\n txtRecordValue: string;\n}\n\n/** Response body of `POST /api/org/domains/verify` (happy path). */\nexport interface OrgDomainVerifyResult {\n status: 'verified' | 'pending';\n domain: string;\n}\n\n/** Response body of `POST /api/org/notification-emails`. */\nexport interface OrgNotificationEmailAddResult {\n ok: boolean;\n status: string;\n}\n\n/** Response body of `DELETE /api/org/notification-emails`. */\nexport interface OrgNotificationEmailRemoveResult {\n ok: boolean;\n removed: number;\n}\n\n/**\n * Finalize an org profile claim (`POST /api/org/claim`). Auth-gated (org-claim\n * JIT scope) and floor-checked server-side. Never throws -- returns the\n * structured {@link OrgClaimResult} folded into a {@link WriteResult} on success,\n * or `{ success: false, error, pdsHost? }` on failure.\n */\nexport function submitOrgClaim(\n config: SifaApiConfig,\n body: OrgClaimRequestInput,\n options: Omit<ApiFetchOptions, 'method' | 'body'> = {},\n): Promise<WriteResult & Partial<OrgClaimResult>> {\n return apiWrite<Partial<OrgClaimResult>>(config, '/api/org/claim', 'POST', { body, ...options });\n}\n\n/**\n * Edit the org record (`PUT /api/org/profile`). Fresh-from-body server-side PUT\n * (a cleared optional field is dropped, no spread-merge). Never throws.\n */\nexport function updateOrgProfile(\n config: SifaApiConfig,\n body: OrgProfileUpdateRequestInput,\n options: Omit<ApiFetchOptions, 'method' | 'body'> = {},\n): Promise<WriteResult & Partial<OrgProfileUpdateResult>> {\n return apiWrite<Partial<OrgProfileUpdateResult>>(config, '/api/org/profile', 'PUT', {\n body,\n ...options,\n });\n}\n\n/**\n * Issue a one-time DNS TXT domain challenge (`POST /api/org/domains/challenge`).\n * Returns the TXT record name + value the org must publish. Never throws.\n */\nexport function requestOrgDomainChallenge(\n config: SifaApiConfig,\n body: OrgDomainChallengeRequestInput,\n options: Omit<ApiFetchOptions, 'method' | 'body'> = {},\n): Promise<WriteResult & Partial<OrgDomainChallengeResult>> {\n return apiWrite<Partial<OrgDomainChallengeResult>>(config, '/api/org/domains/challenge', 'POST', {\n body,\n ...options,\n });\n}\n\n/**\n * Verify a DNS TXT domain challenge (`POST /api/org/domains/verify`). On success\n * `status` is `verified` or `pending`. Expired / confusable / not-found map to\n * non-2xx server responses and surface as `{ success: false, error }`. Never\n * throws.\n */\nexport function verifyOrgDomain(\n config: SifaApiConfig,\n body: OrgDomainVerifyRequestInput,\n options: Omit<ApiFetchOptions, 'method' | 'body'> = {},\n): Promise<WriteResult & Partial<OrgDomainVerifyResult>> {\n return apiWrite<Partial<OrgDomainVerifyResult>>(config, '/api/org/domains/verify', 'POST', {\n body,\n ...options,\n });\n}\n\n/**\n * Add an org notification email (`POST /api/org/notification-emails`). The\n * address must use a domain the org controls (checked server-side). An\n * individual verification email is enqueued through the (dormant) sending\n * pipeline. Never throws.\n */\nexport function addOrgNotificationEmail(\n config: SifaApiConfig,\n body: OrgNotificationEmailRequestInput,\n options: Omit<ApiFetchOptions, 'method' | 'body'> = {},\n): Promise<WriteResult & Partial<OrgNotificationEmailAddResult>> {\n return apiWrite<Partial<OrgNotificationEmailAddResult>>(\n config,\n '/api/org/notification-emails',\n 'POST',\n { body, ...options },\n );\n}\n\n/**\n * Remove an org notification email (`DELETE /api/org/notification-emails`).\n * Never throws.\n */\nexport function removeOrgNotificationEmail(\n config: SifaApiConfig,\n body: OrgNotificationEmailRequestInput,\n options: Omit<ApiFetchOptions, 'method' | 'body'> = {},\n): Promise<WriteResult & Partial<OrgNotificationEmailRemoveResult>> {\n return apiWrite<Partial<OrgNotificationEmailRemoveResult>>(\n config,\n '/api/org/notification-emails',\n 'DELETE',\n { body, ...options },\n );\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport type { OrgFloorVerdict, Profile } from '../../types/index.js';\nimport { useSifaConfig } from '../config.js';\nimport { fetchProfile } from '../fetchers/profile.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Read the server-computed org rendering-floor verdict for a handle or DID.\n *\n * The verdict rides the profile resolve (`GET /api/profile/:handleOrDid`), so\n * this hook reuses the `profile.byHandle` query key -- it shares the cache with\n * {@link useProfile} and never triggers a second round-trip. Returns\n * `OrgFloorVerdict | null` (`null` when the profile is missing or predates the\n * `org` field).\n */\nexport function useOrgProfile(\n handleOrDid: string | undefined | null,\n options?: Omit<\n UseQueryOptions<\n Profile | null,\n Error,\n OrgFloorVerdict | null,\n ReturnType<typeof sifaQueryKeys.profile.byHandle>\n >,\n 'queryKey' | 'queryFn' | 'select'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.profile.byHandle(handleOrDid ?? ''),\n queryFn: () => fetchProfile(config, handleOrDid ?? ''),\n enabled: Boolean(handleOrDid) && (options?.enabled ?? true),\n select: (profile) => profile?.org ?? null,\n ...options,\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport type { WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport { submitOrgClaim, type OrgClaimResult } from '../fetchers/org.js';\nimport type { OrgClaimRequestInput } from '../../schemas/write/org-claim.js';\nimport { sifaQueryKeys } from '../keys.js';\n\ntype OrgClaimMutationResult = WriteResult & Partial<OrgClaimResult>;\n\n/**\n * Finalize an org profile claim (`POST /api/org/claim`). Pass the org's\n * handle/DID so the profile cache (which carries the org floor verdict) is\n * invalidated on success; pass `null` to skip invalidation.\n */\nexport function useOrgClaim(\n handleOrDid: string | null,\n options?: Omit<\n UseMutationOptions<OrgClaimMutationResult, Error, OrgClaimRequestInput>,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (body: OrgClaimRequestInput) => submitOrgClaim(config, body),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success && handleOrDid) {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(handleOrDid),\n });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport type { WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport { updateOrgProfile, type OrgProfileUpdateResult } from '../fetchers/org.js';\nimport type { OrgProfileUpdateRequestInput } from '../../schemas/write/org-settings.js';\nimport { sifaQueryKeys } from '../keys.js';\n\ntype OrgProfileUpdateMutationResult = WriteResult & Partial<OrgProfileUpdateResult>;\n\n/**\n * Edit the org record (`PUT /api/org/profile`). Pass the org's handle/DID to\n * invalidate the profile cache (org floor verdict + fields) on success.\n */\nexport function useUpdateOrgProfile(\n handleOrDid: string | null,\n options?: Omit<\n UseMutationOptions<OrgProfileUpdateMutationResult, Error, OrgProfileUpdateRequestInput>,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n // Spread first: a consumer-supplied onSuccess would otherwise replace the\n // handler below and silently drop cache invalidation (#453).\n ...options,\n mutationFn: (body: OrgProfileUpdateRequestInput) => updateOrgProfile(config, body),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success && handleOrDid) {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(handleOrDid),\n });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n });\n}\n","'use client';\n\nimport { useMutation, type UseMutationOptions } from '@tanstack/react-query';\n\nimport type { WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n requestOrgDomainChallenge,\n verifyOrgDomain,\n type OrgDomainChallengeResult,\n type OrgDomainVerifyResult,\n} from '../fetchers/org.js';\nimport type {\n OrgDomainChallengeRequestInput,\n OrgDomainVerifyRequestInput,\n} from '../../schemas/write/org-settings.js';\n\ntype OrgDomainChallengeMutationResult = WriteResult & Partial<OrgDomainChallengeResult>;\ntype OrgDomainVerifyMutationResult = WriteResult & Partial<OrgDomainVerifyResult>;\n\n/**\n * Issue a one-time DNS TXT domain challenge (`POST /api/org/domains/challenge`).\n * The result carries the TXT record name + value for the org to publish.\n */\nexport function useOrgDomainChallenge(\n options?: Omit<\n UseMutationOptions<OrgDomainChallengeMutationResult, Error, OrgDomainChallengeRequestInput>,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n return useMutation({\n mutationFn: (body: OrgDomainChallengeRequestInput) => requestOrgDomainChallenge(config, body),\n ...options,\n });\n}\n\n/**\n * Verify a DNS TXT domain challenge (`POST /api/org/domains/verify`). On success\n * `status` is `verified` or `pending`; other outcomes surface as\n * `{ success: false }`.\n */\nexport function useOrgDomainVerify(\n options?: Omit<\n UseMutationOptions<OrgDomainVerifyMutationResult, Error, OrgDomainVerifyRequestInput>,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n return useMutation({\n mutationFn: (body: OrgDomainVerifyRequestInput) => verifyOrgDomain(config, body),\n ...options,\n });\n}\n","'use client';\n\nimport { useMutation, type UseMutationOptions } from '@tanstack/react-query';\n\nimport type { WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n addOrgNotificationEmail,\n removeOrgNotificationEmail,\n type OrgNotificationEmailAddResult,\n type OrgNotificationEmailRemoveResult,\n} from '../fetchers/org.js';\nimport type { OrgNotificationEmailRequestInput } from '../../schemas/write/org-settings.js';\n\ntype OrgNotificationEmailAddMutationResult = WriteResult & Partial<OrgNotificationEmailAddResult>;\ntype OrgNotificationEmailRemoveMutationResult = WriteResult &\n Partial<OrgNotificationEmailRemoveResult>;\n\n/**\n * Add an org notification email (`POST /api/org/notification-emails`). The\n * address must use a domain the org controls (checked server-side). Sending is\n * gated behind the dormant email pipeline until activated.\n */\nexport function useAddOrgNotificationEmail(\n options?: Omit<\n UseMutationOptions<\n OrgNotificationEmailAddMutationResult,\n Error,\n OrgNotificationEmailRequestInput\n >,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n return useMutation({\n mutationFn: (body: OrgNotificationEmailRequestInput) => addOrgNotificationEmail(config, body),\n ...options,\n });\n}\n\n/**\n * Remove an org notification email (`DELETE /api/org/notification-emails`).\n */\nexport function useRemoveOrgNotificationEmail(\n options?: Omit<\n UseMutationOptions<\n OrgNotificationEmailRemoveMutationResult,\n Error,\n OrgNotificationEmailRequestInput\n >,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n return useMutation({\n mutationFn: (body: OrgNotificationEmailRequestInput) =>\n removeOrgNotificationEmail(config, body),\n ...options,\n });\n}\n"]}