@arbidocs/react 0.3.107 → 0.3.109

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -168,11 +168,50 @@ declare function ArbiChat({ url, workspaceId, theme: themeOverrides, labels: lab
168
168
 
169
169
  declare function useArbi(): Arbi;
170
170
 
171
+ /**
172
+ * Types for a document's parsed content (`GET /v1/document/{id}/parsed-{stage}`).
173
+ *
174
+ * The SDK returns this endpoint untyped (`Record<string, unknown>`); these are
175
+ * the structural types the review viewer relies on. Kept dependency-free so both
176
+ * the `useParsedDocument` hook and `<DocumentReview>` can import them.
177
+ */
178
+ interface ParsedChunkMetadata {
179
+ page_number?: number;
180
+ /** Stable chunk id — the join key for citations (`CitationData.chunk_ids`). */
181
+ chunk_ext_id?: string;
182
+ chunk_pg_idx?: number;
183
+ chunk_doc_idx?: number;
184
+ doc_title?: string;
185
+ heading?: string | null;
186
+ heading_level?: number | null;
187
+ /** JSON mode only: "text" | "header" | "table" | "figure" | … */
188
+ element_type?: string;
189
+ /** JSON mode only: [x_min, y_min, x_max, y_max]. */
190
+ bbox?: [number, number, number, number];
191
+ }
192
+ interface ParsedChunk {
193
+ /** Markdown content of the chunk. */
194
+ content: string;
195
+ metadata: ParsedChunkMetadata;
196
+ }
197
+ interface ParsedDocumentMetadata {
198
+ total_number_of_pages?: number;
199
+ file_name?: string;
200
+ output_mode?: string;
201
+ }
202
+ interface ParsedDocument {
203
+ metadata?: ParsedDocumentMetadata;
204
+ footnotes?: Record<string, string>;
205
+ chunks: ParsedChunk[];
206
+ }
207
+
171
208
  declare const arbiQueryKeys: {
172
209
  workspaces: () => readonly ["arbi", "workspaces"];
173
210
  documents: (workspaceId: string) => readonly ["arbi", "documents", string];
174
211
  conversations: (workspaceId: string) => readonly ["arbi", "conversations", string];
175
212
  tags: (workspaceId: string) => readonly ["arbi", "tags", string];
213
+ thumbnails: (docIds: string[]) => readonly ["arbi", "thumbnails", string];
214
+ parsedDoc: (docId: string, stage: string) => readonly ["arbi", "parsedDoc", string, string];
176
215
  agents: () => readonly ["arbi", "agents"];
177
216
  sessions: () => readonly ["arbi", "sessions"];
178
217
  health: () => readonly ["arbi", "health"];
@@ -312,6 +351,22 @@ declare function useTags(workspaceId: string | undefined, options?: {
312
351
  created_at: string;
313
352
  updated_at: string;
314
353
  }[]>, Error>;
354
+ /**
355
+ * Batch-fetch first-page thumbnails for a set of documents. Returns a map of
356
+ * doc external id → `data:image/webp` URI (or `null` when no thumbnail exists).
357
+ * Cached for a few minutes since thumbnails are effectively immutable per doc.
358
+ */
359
+ declare function useThumbnails(docIds: string[], options?: {
360
+ enabled?: boolean;
361
+ }): _tanstack_react_query.UseQueryResult<NoInfer<Record<string, string | null>>, Error>;
362
+ /**
363
+ * Fetch a document's parsed content (chunks grouped by page) for the review
364
+ * viewer. `stage` defaults to `final` (fully processed); `marker`/`subchunk`
365
+ * expose earlier pipeline stages.
366
+ */
367
+ declare function useParsedDocument(docId: string | undefined, stage?: string, options?: {
368
+ enabled?: boolean;
369
+ }): _tanstack_react_query.UseQueryResult<NoInfer<ParsedDocument>, Error>;
315
370
  /** Send a streaming query to the RAG assistant. Returns a mutation. */
316
371
  declare function useAssistantQuery(): _tanstack_react_query.UseMutationResult<SSEStreamResult, Error, {
317
372
  question: string;
@@ -990,12 +1045,12 @@ declare function ProjectEntity({ name, label, icon, subscription, hasCollaborato
990
1045
  * `useArbiUiStore` when those props are omitted.
991
1046
  */
992
1047
 
993
- type DocResponse = components['schemas']['DocResponse'];
1048
+ type DocResponse$2 = components['schemas']['DocResponse'];
994
1049
  interface DocumentTableProps {
995
1050
  /** Workspace to load documents from (used when `documents` is not supplied). */
996
1051
  workspaceId?: string;
997
1052
  /** Explicit rows. When provided, `useDocuments` is not called. */
998
- documents?: DocResponse[];
1053
+ documents?: DocResponse$2[];
999
1054
  /** Called when a row (document) is opened — row click or name-pill click. */
1000
1055
  onOpenDocument?: (id: string) => void;
1001
1056
  /** Controlled selection (external ids). Falls back to the SDK ui store. */
@@ -1008,6 +1063,64 @@ interface DocumentTableProps {
1008
1063
  }
1009
1064
  declare function DocumentTable({ workspaceId, documents, onOpenDocument, selectedIds, onSelectionChange, height, className, }: DocumentTableProps): React__default.JSX.Element;
1010
1065
 
1066
+ /**
1067
+ * DocumentGallery — a reusable thumbnail-grid view of a workspace's documents.
1068
+ *
1069
+ * REUSE-FIRST: a sibling of `DocumentTable` sharing the exact same data sources
1070
+ * (`useDocuments` + `useTags` + the SDK-owned `useArbiUiStore` selection state)
1071
+ * and the promoted `DocumentEntity`/`TagEntity` pills. The only extra dependency
1072
+ * is `useThumbnails`, which batch-loads real first-page previews; documents with
1073
+ * no thumbnail fall back to a file-type icon.
1074
+ */
1075
+
1076
+ type DocResponse$1 = components['schemas']['DocResponse'];
1077
+ interface DocumentGalleryProps {
1078
+ /** Workspace to load documents from (used when `documents` is not supplied). */
1079
+ workspaceId?: string;
1080
+ /** Explicit rows. When provided, `useDocuments` is not called. */
1081
+ documents?: DocResponse$1[];
1082
+ /** Called when a card (document) is opened. */
1083
+ onOpenDocument?: (id: string) => void;
1084
+ /** Controlled selection (external ids). Falls back to the SDK ui store. */
1085
+ selectedIds?: string[];
1086
+ /** Called with the new selection (external ids). Falls back to the SDK ui store. */
1087
+ onSelectionChange?: (ids: string[]) => void;
1088
+ /** Min tile width in px — the grid auto-fills as many columns as fit. Default 180. */
1089
+ minTileWidth?: number;
1090
+ className?: string;
1091
+ }
1092
+ declare function DocumentGallery({ workspaceId, documents, onOpenDocument, selectedIds, onSelectionChange, minTileWidth, className, }: DocumentGalleryProps): React__default.JSX.Element;
1093
+
1094
+ /**
1095
+ * DocumentReview — a reusable, decoupled "review mode" viewer for a single
1096
+ * document. It renders the parsed content (chunks grouped by page, as markdown)
1097
+ * and overlays the document's AI findings: each tag citation highlights the
1098
+ * chunks it references and is listed in a findings rail that jumps to the
1099
+ * passage on click.
1100
+ *
1101
+ * REUSE-FIRST: reads purely from SDK data — `useParsedDocument` for the body,
1102
+ * the passed-in `doc.doctags[].citations` for findings, `useTags` for label
1103
+ * names, and `AiMarkdown` for rendering. No app store / react-pdf / Zustand
1104
+ * coupling; citation-jump is plain `scrollIntoView` on `data-chunk-id`.
1105
+ */
1106
+
1107
+ type DocResponse = components['schemas']['DocResponse'];
1108
+ interface DocumentReviewProps {
1109
+ /** Document to review. */
1110
+ docId: string;
1111
+ /** The document object (from `useDocuments`) — supplies title + AI findings
1112
+ * (`doctags[].citations`). Optional: without it the viewer is a plain reader. */
1113
+ doc?: DocResponse;
1114
+ /** Workspace id — used to resolve tag ids → human names for findings. */
1115
+ workspaceId?: string;
1116
+ /** Parse stage to render. Default `final`. */
1117
+ stage?: string;
1118
+ /** When provided, a close button is shown in the header. */
1119
+ onClose?: () => void;
1120
+ className?: string;
1121
+ }
1122
+ declare function DocumentReview({ docId, doc, workspaceId, stage, onClose, className, }: DocumentReviewProps): React__default.JSX.Element;
1123
+
1011
1124
  /**
1012
1125
  * SDK-owned UI store for cross-block coordination.
1013
1126
  *
@@ -1033,4 +1146,4 @@ declare const useArbiUiStore: zustand.UseBoundStore<zustand.StoreApi<ArbiUiState
1033
1146
 
1034
1147
  declare function cn(...inputs: ClassValue[]): string;
1035
1148
 
1036
- export { AiActionCard, AiAnswer, AiMarkdown, type AiRunOptions, type AiTaskStatus, ArbiChat, type ArbiChatLabels, ArbiChatPanel, type ArbiChatPanelProps, type ArbiChatProps, type ArbiChatTheme, ArbiProvider, type ArbiProviderProps, type ArbiUiState, ArtifactCanvas, AudIcon, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, DocQaPanel, DocSearch, DocumentEntity, type DocumentEntityProps, type DocumentLike, DocumentTable, type DocumentTableProps, EmlIcon, EntityPill, FILE_TYPE_COLORS, FileIcon, HoverCard, HoverCardContent, HoverCardTrigger, ImgIcon, Input, PdfIcon, ProjectEntity, type ProjectEntityProps, type ProjectRelation, type SearchChunk, TagEntity, type TagEntityProps, type TagLike, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VidIcon, arbiQueryKeys, badgeVariants, buttonVariants, cn, redlineStats, textToArtifact, toRedlineMarkdown, useAgents, useAiTask, useArbi, useArbiUiStore, useAssistantQuery, useConfigs, useConversations, useDeleteAgents, useDocuments, useHealth, useMemories, useSemanticSearch, useSessions, useTags, useTasks, useWorkspaceDocs, useWorkspaces };
1149
+ export { AiActionCard, AiAnswer, AiMarkdown, type AiRunOptions, type AiTaskStatus, ArbiChat, type ArbiChatLabels, ArbiChatPanel, type ArbiChatPanelProps, type ArbiChatProps, type ArbiChatTheme, ArbiProvider, type ArbiProviderProps, type ArbiUiState, ArtifactCanvas, AudIcon, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, DocQaPanel, DocSearch, DocumentEntity, type DocumentEntityProps, DocumentGallery, type DocumentGalleryProps, type DocumentLike, DocumentReview, type DocumentReviewProps, DocumentTable, type DocumentTableProps, EmlIcon, EntityPill, FILE_TYPE_COLORS, FileIcon, HoverCard, HoverCardContent, HoverCardTrigger, ImgIcon, Input, type ParsedChunk, type ParsedChunkMetadata, type ParsedDocument, type ParsedDocumentMetadata, PdfIcon, ProjectEntity, type ProjectEntityProps, type ProjectRelation, type SearchChunk, TagEntity, type TagEntityProps, type TagLike, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VidIcon, arbiQueryKeys, badgeVariants, buttonVariants, cn, redlineStats, textToArtifact, toRedlineMarkdown, useAgents, useAiTask, useArbi, useArbiUiStore, useAssistantQuery, useConfigs, useConversations, useDeleteAgents, useDocuments, useHealth, useMemories, useParsedDocument, useSemanticSearch, useSessions, useTags, useTasks, useThumbnails, useWorkspaceDocs, useWorkspaces };
package/dist/index.d.ts CHANGED
@@ -168,11 +168,50 @@ declare function ArbiChat({ url, workspaceId, theme: themeOverrides, labels: lab
168
168
 
169
169
  declare function useArbi(): Arbi;
170
170
 
171
+ /**
172
+ * Types for a document's parsed content (`GET /v1/document/{id}/parsed-{stage}`).
173
+ *
174
+ * The SDK returns this endpoint untyped (`Record<string, unknown>`); these are
175
+ * the structural types the review viewer relies on. Kept dependency-free so both
176
+ * the `useParsedDocument` hook and `<DocumentReview>` can import them.
177
+ */
178
+ interface ParsedChunkMetadata {
179
+ page_number?: number;
180
+ /** Stable chunk id — the join key for citations (`CitationData.chunk_ids`). */
181
+ chunk_ext_id?: string;
182
+ chunk_pg_idx?: number;
183
+ chunk_doc_idx?: number;
184
+ doc_title?: string;
185
+ heading?: string | null;
186
+ heading_level?: number | null;
187
+ /** JSON mode only: "text" | "header" | "table" | "figure" | … */
188
+ element_type?: string;
189
+ /** JSON mode only: [x_min, y_min, x_max, y_max]. */
190
+ bbox?: [number, number, number, number];
191
+ }
192
+ interface ParsedChunk {
193
+ /** Markdown content of the chunk. */
194
+ content: string;
195
+ metadata: ParsedChunkMetadata;
196
+ }
197
+ interface ParsedDocumentMetadata {
198
+ total_number_of_pages?: number;
199
+ file_name?: string;
200
+ output_mode?: string;
201
+ }
202
+ interface ParsedDocument {
203
+ metadata?: ParsedDocumentMetadata;
204
+ footnotes?: Record<string, string>;
205
+ chunks: ParsedChunk[];
206
+ }
207
+
171
208
  declare const arbiQueryKeys: {
172
209
  workspaces: () => readonly ["arbi", "workspaces"];
173
210
  documents: (workspaceId: string) => readonly ["arbi", "documents", string];
174
211
  conversations: (workspaceId: string) => readonly ["arbi", "conversations", string];
175
212
  tags: (workspaceId: string) => readonly ["arbi", "tags", string];
213
+ thumbnails: (docIds: string[]) => readonly ["arbi", "thumbnails", string];
214
+ parsedDoc: (docId: string, stage: string) => readonly ["arbi", "parsedDoc", string, string];
176
215
  agents: () => readonly ["arbi", "agents"];
177
216
  sessions: () => readonly ["arbi", "sessions"];
178
217
  health: () => readonly ["arbi", "health"];
@@ -312,6 +351,22 @@ declare function useTags(workspaceId: string | undefined, options?: {
312
351
  created_at: string;
313
352
  updated_at: string;
314
353
  }[]>, Error>;
354
+ /**
355
+ * Batch-fetch first-page thumbnails for a set of documents. Returns a map of
356
+ * doc external id → `data:image/webp` URI (or `null` when no thumbnail exists).
357
+ * Cached for a few minutes since thumbnails are effectively immutable per doc.
358
+ */
359
+ declare function useThumbnails(docIds: string[], options?: {
360
+ enabled?: boolean;
361
+ }): _tanstack_react_query.UseQueryResult<NoInfer<Record<string, string | null>>, Error>;
362
+ /**
363
+ * Fetch a document's parsed content (chunks grouped by page) for the review
364
+ * viewer. `stage` defaults to `final` (fully processed); `marker`/`subchunk`
365
+ * expose earlier pipeline stages.
366
+ */
367
+ declare function useParsedDocument(docId: string | undefined, stage?: string, options?: {
368
+ enabled?: boolean;
369
+ }): _tanstack_react_query.UseQueryResult<NoInfer<ParsedDocument>, Error>;
315
370
  /** Send a streaming query to the RAG assistant. Returns a mutation. */
316
371
  declare function useAssistantQuery(): _tanstack_react_query.UseMutationResult<SSEStreamResult, Error, {
317
372
  question: string;
@@ -990,12 +1045,12 @@ declare function ProjectEntity({ name, label, icon, subscription, hasCollaborato
990
1045
  * `useArbiUiStore` when those props are omitted.
991
1046
  */
992
1047
 
993
- type DocResponse = components['schemas']['DocResponse'];
1048
+ type DocResponse$2 = components['schemas']['DocResponse'];
994
1049
  interface DocumentTableProps {
995
1050
  /** Workspace to load documents from (used when `documents` is not supplied). */
996
1051
  workspaceId?: string;
997
1052
  /** Explicit rows. When provided, `useDocuments` is not called. */
998
- documents?: DocResponse[];
1053
+ documents?: DocResponse$2[];
999
1054
  /** Called when a row (document) is opened — row click or name-pill click. */
1000
1055
  onOpenDocument?: (id: string) => void;
1001
1056
  /** Controlled selection (external ids). Falls back to the SDK ui store. */
@@ -1008,6 +1063,64 @@ interface DocumentTableProps {
1008
1063
  }
1009
1064
  declare function DocumentTable({ workspaceId, documents, onOpenDocument, selectedIds, onSelectionChange, height, className, }: DocumentTableProps): React__default.JSX.Element;
1010
1065
 
1066
+ /**
1067
+ * DocumentGallery — a reusable thumbnail-grid view of a workspace's documents.
1068
+ *
1069
+ * REUSE-FIRST: a sibling of `DocumentTable` sharing the exact same data sources
1070
+ * (`useDocuments` + `useTags` + the SDK-owned `useArbiUiStore` selection state)
1071
+ * and the promoted `DocumentEntity`/`TagEntity` pills. The only extra dependency
1072
+ * is `useThumbnails`, which batch-loads real first-page previews; documents with
1073
+ * no thumbnail fall back to a file-type icon.
1074
+ */
1075
+
1076
+ type DocResponse$1 = components['schemas']['DocResponse'];
1077
+ interface DocumentGalleryProps {
1078
+ /** Workspace to load documents from (used when `documents` is not supplied). */
1079
+ workspaceId?: string;
1080
+ /** Explicit rows. When provided, `useDocuments` is not called. */
1081
+ documents?: DocResponse$1[];
1082
+ /** Called when a card (document) is opened. */
1083
+ onOpenDocument?: (id: string) => void;
1084
+ /** Controlled selection (external ids). Falls back to the SDK ui store. */
1085
+ selectedIds?: string[];
1086
+ /** Called with the new selection (external ids). Falls back to the SDK ui store. */
1087
+ onSelectionChange?: (ids: string[]) => void;
1088
+ /** Min tile width in px — the grid auto-fills as many columns as fit. Default 180. */
1089
+ minTileWidth?: number;
1090
+ className?: string;
1091
+ }
1092
+ declare function DocumentGallery({ workspaceId, documents, onOpenDocument, selectedIds, onSelectionChange, minTileWidth, className, }: DocumentGalleryProps): React__default.JSX.Element;
1093
+
1094
+ /**
1095
+ * DocumentReview — a reusable, decoupled "review mode" viewer for a single
1096
+ * document. It renders the parsed content (chunks grouped by page, as markdown)
1097
+ * and overlays the document's AI findings: each tag citation highlights the
1098
+ * chunks it references and is listed in a findings rail that jumps to the
1099
+ * passage on click.
1100
+ *
1101
+ * REUSE-FIRST: reads purely from SDK data — `useParsedDocument` for the body,
1102
+ * the passed-in `doc.doctags[].citations` for findings, `useTags` for label
1103
+ * names, and `AiMarkdown` for rendering. No app store / react-pdf / Zustand
1104
+ * coupling; citation-jump is plain `scrollIntoView` on `data-chunk-id`.
1105
+ */
1106
+
1107
+ type DocResponse = components['schemas']['DocResponse'];
1108
+ interface DocumentReviewProps {
1109
+ /** Document to review. */
1110
+ docId: string;
1111
+ /** The document object (from `useDocuments`) — supplies title + AI findings
1112
+ * (`doctags[].citations`). Optional: without it the viewer is a plain reader. */
1113
+ doc?: DocResponse;
1114
+ /** Workspace id — used to resolve tag ids → human names for findings. */
1115
+ workspaceId?: string;
1116
+ /** Parse stage to render. Default `final`. */
1117
+ stage?: string;
1118
+ /** When provided, a close button is shown in the header. */
1119
+ onClose?: () => void;
1120
+ className?: string;
1121
+ }
1122
+ declare function DocumentReview({ docId, doc, workspaceId, stage, onClose, className, }: DocumentReviewProps): React__default.JSX.Element;
1123
+
1011
1124
  /**
1012
1125
  * SDK-owned UI store for cross-block coordination.
1013
1126
  *
@@ -1033,4 +1146,4 @@ declare const useArbiUiStore: zustand.UseBoundStore<zustand.StoreApi<ArbiUiState
1033
1146
 
1034
1147
  declare function cn(...inputs: ClassValue[]): string;
1035
1148
 
1036
- export { AiActionCard, AiAnswer, AiMarkdown, type AiRunOptions, type AiTaskStatus, ArbiChat, type ArbiChatLabels, ArbiChatPanel, type ArbiChatPanelProps, type ArbiChatProps, type ArbiChatTheme, ArbiProvider, type ArbiProviderProps, type ArbiUiState, ArtifactCanvas, AudIcon, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, DocQaPanel, DocSearch, DocumentEntity, type DocumentEntityProps, type DocumentLike, DocumentTable, type DocumentTableProps, EmlIcon, EntityPill, FILE_TYPE_COLORS, FileIcon, HoverCard, HoverCardContent, HoverCardTrigger, ImgIcon, Input, PdfIcon, ProjectEntity, type ProjectEntityProps, type ProjectRelation, type SearchChunk, TagEntity, type TagEntityProps, type TagLike, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VidIcon, arbiQueryKeys, badgeVariants, buttonVariants, cn, redlineStats, textToArtifact, toRedlineMarkdown, useAgents, useAiTask, useArbi, useArbiUiStore, useAssistantQuery, useConfigs, useConversations, useDeleteAgents, useDocuments, useHealth, useMemories, useSemanticSearch, useSessions, useTags, useTasks, useWorkspaceDocs, useWorkspaces };
1149
+ export { AiActionCard, AiAnswer, AiMarkdown, type AiRunOptions, type AiTaskStatus, ArbiChat, type ArbiChatLabels, ArbiChatPanel, type ArbiChatPanelProps, type ArbiChatProps, type ArbiChatTheme, ArbiProvider, type ArbiProviderProps, type ArbiUiState, ArtifactCanvas, AudIcon, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, DocQaPanel, DocSearch, DocumentEntity, type DocumentEntityProps, DocumentGallery, type DocumentGalleryProps, type DocumentLike, DocumentReview, type DocumentReviewProps, DocumentTable, type DocumentTableProps, EmlIcon, EntityPill, FILE_TYPE_COLORS, FileIcon, HoverCard, HoverCardContent, HoverCardTrigger, ImgIcon, Input, type ParsedChunk, type ParsedChunkMetadata, type ParsedDocument, type ParsedDocumentMetadata, PdfIcon, ProjectEntity, type ProjectEntityProps, type ProjectRelation, type SearchChunk, TagEntity, type TagEntityProps, type TagLike, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VidIcon, arbiQueryKeys, badgeVariants, buttonVariants, cn, redlineStats, textToArtifact, toRedlineMarkdown, useAgents, useAiTask, useArbi, useArbiUiStore, useAssistantQuery, useConfigs, useConversations, useDeleteAgents, useDocuments, useHealth, useMemories, useParsedDocument, useSemanticSearch, useSessions, useTags, useTasks, useThumbnails, useWorkspaceDocs, useWorkspaces };