Hiyve Components - v1.0.0
    Preparing search index...

    Function usePublicFiles

    • Access the tenant's public file pool and a copy-to-private helper.

      Parameters

      • Optionaloptions: { brandOrgId?: string; enabled?: boolean; userId?: string }

      Returns {
          copyToPrivate: (
              fileId: string,
              opts?: { location?: string; roomName?: string },
          ) => Promise<UserFile>;
          error: Error | null;
          files: UserFile[];
          isLoading: boolean;
          refresh: () => Promise<void>;
      }

      Public files are role-gated on the server (caller must hold the public-files role on their UserProfile). The hook is stateless — results are fetched via the underlying Hiyve client (same backend as useUserFiles) and held in local React state, not the HiyveStore.

      Pass userId to authenticate the fetch (usually the current authenticated user's email). Set enabled: false to skip fetching — typical use is enabled: hasPublicFilesRole && activeScope === 'public-files'.

      Files are read-only through this hook; copyToPrivate asks the server to clone a public file into the caller's private file library (copy-on-write).