@papermap/papermap 1.1.0 → 1.1.1

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.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React$1 from 'react';
3
+ import React__default, { ReactNode, RefObject } from 'react';
2
4
  import { Layout } from 'react-grid-layout';
3
5
  import { LucideIcon } from 'lucide-react';
4
- import * as React$1 from 'react';
5
- import React__default, { RefObject } from 'react';
6
6
  import * as class_variance_authority_types from 'class-variance-authority/types';
7
7
  import { VariantProps } from 'class-variance-authority';
8
8
  import * as zustand from 'zustand';
@@ -11,33 +11,380 @@ import * as axios from 'axios';
11
11
  import { AxiosInstance } from 'axios';
12
12
  import { DriveStep } from 'driver.js';
13
13
 
14
+ /** Matches main-app embedded layout (`EmbeddedLayout` / `?theme=`). */
15
+ type PapermapColorScheme = 'light' | 'dark' | 'system';
16
+
17
+ /**
18
+ * Host-supplied avatar nodes for chat message rows.
19
+ *
20
+ * A supplied node is rendered **as-is** inside a 32px-square layout slot — the
21
+ * default circle background, rounding and color are NOT applied to it, so host
22
+ * colors, gradients, images and borders are preserved across light and dark
23
+ * themes. Provide a self-contained node (e.g.
24
+ * `<img className="h-full w-full rounded-full object-cover" />` or a styled
25
+ * element using `h-full w-full`). Any slot left undefined falls back to the
26
+ * built-in icon inside the default circle.
27
+ */
28
+ interface PaperChatAvatars {
29
+ /** Replaces the built-in `User` avatar on user-role rows. */
30
+ user?: React__default.ReactNode;
31
+ /** Replaces the built-in `LogoStandAlone` avatar on assistant-role rows. */
32
+ assistant?: React__default.ReactNode;
33
+ /** Replaces the built-in `ThinkingLogo` loader shown while the assistant generates. */
34
+ thinking?: React__default.ReactNode;
35
+ }
36
+ declare function ChatAssistant({ hideChartArea, inline: inlineProp, showAvatars: showAvatarsProp, avatars, greetingMessage, }: {
37
+ hideChartArea?: boolean;
38
+ /** Sheet side panel: same as main app `inline={true}`; overrides store `assistantInline` when passed. */
39
+ inline?: boolean;
40
+ /**
41
+ * Force the user / assistant avatars to render even when `inline` (or the store's
42
+ * `assistantInline`) is true. Without this, inline mode hides avatars for a compact
43
+ * column layout. Side and dialog variants opt in so the brand/identity stays visible
44
+ * in those chrome-rich surfaces.
45
+ */
46
+ showAvatars?: boolean;
47
+ /** Override the user / assistant / thinking avatar icons. */
48
+ avatars?: PaperChatAvatars;
49
+ /**
50
+ * Optional welcome line rendered as the first assistant bubble before any
51
+ * real messages have been exchanged. Skipped automatically once the user
52
+ * sends a message or a chat is loaded with history.
53
+ */
54
+ greetingMessage?: string;
55
+ }): react_jsx_runtime.JSX.Element;
56
+
57
+ type PaperChatDialogLauncherPosition = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
58
+ interface PaperChatDialogInnerProps {
59
+ hideChartArea?: boolean;
60
+ /** Primary label in the dialog header (report / slash-command style). */
61
+ dialogTitle?: string;
62
+ /** Secondary line under the title. */
63
+ dialogSubtitle?: string;
64
+ /** Controlled open state. Omit to manage open state internally (floating launcher toggles). */
65
+ dialogOpen?: boolean;
66
+ onDialogOpenChange?: (open: boolean) => void;
67
+ /** When false, hide the floating launcher (e.g. fully controlled from the host). Default true. */
68
+ showDialogLauncher?: boolean;
69
+ /** `aria-label` / `title` on the floating launcher. */
70
+ dialogLauncherAriaLabel?: string;
71
+ /** Viewport corner for the floating launcher (`fixed` inset). Default `bottom-right`. */
72
+ dialogLauncherPosition?: PaperChatDialogLauncherPosition;
73
+ className?: string;
74
+ /** Optional portal target for the sheet chart overlay (same as side panel). */
75
+ chartOverlayPortalRef?: React__default.RefObject<HTMLDivElement | null>;
76
+ onAssistantClose?: () => void;
77
+ /** Render user / assistant avatars inside the embedded chat. Defaults to `true`. */
78
+ showAvatars?: boolean;
79
+ /** Override the user / assistant / thinking avatar icons. */
80
+ avatars?: PaperChatAvatars;
81
+ /**
82
+ * Custom trigger node replacing the default floating launcher button. Wrapped
83
+ * with a `data-paper-dialog-launcher` element that toggles the dialog on click
84
+ * so any node (icon, branded button, etc.) keeps the open/close UX.
85
+ */
86
+ trigger?: React__default.ReactNode;
87
+ /** Controlled expand/collapse state for the dialog popup. */
88
+ expanded?: boolean;
89
+ /** Uncontrolled initial expanded state. Default `false`. */
90
+ defaultExpanded?: boolean;
91
+ /** Fires when the dialog toggles between default and expanded size. */
92
+ onExpandedChange?: (expanded: boolean) => void;
93
+ /**
94
+ * Greeting message rendered as the first assistant bubble before the user
95
+ * sends anything. Plain string for now; mirrors a live-chat widget welcome.
96
+ */
97
+ greetingMessage?: string;
98
+ }
99
+ /**
100
+ * Report-style chat: floating launcher button + modal shell matching the main app’s
101
+ * in-editor slash chat (header chip, MessageSquare icon, full assistant + composer).
102
+ */
103
+ declare function PaperChatDialogInner({ hideChartArea, dialogTitle, dialogSubtitle, dialogOpen: dialogOpenProp, onDialogOpenChange, showDialogLauncher, dialogLauncherAriaLabel, dialogLauncherPosition, className, chartOverlayPortalRef, onAssistantClose, showAvatars, avatars, trigger, expanded: expandedProp, defaultExpanded, onExpandedChange, greetingMessage, }: PaperChatDialogInnerProps): react_jsx_runtime.JSX.Element;
104
+
105
+ type PaperChatVariant = 'default' | 'side' | 'floating' | 'dialog';
106
+ /** Docking edge for `variant="side"` (viewport-anchored left/right rail). */
107
+ type PaperChatSidePosition = 'left' | 'right';
108
+ type PaperChatSideContentInsetMode = 'none' | 'auto';
109
+
110
+ /**
111
+ * Controls handed to {@link PaperChatProps.renderSidePanelOpenTrigger}. The
112
+ * host's open state remains the source of truth — `show` and `toggle` simply
113
+ * forward to the `onOpenChange` callback.
114
+ */
115
+ interface SidePanelTriggerControls {
116
+ open: boolean;
117
+ show: () => void;
118
+ toggle: () => void;
119
+ }
14
120
  interface PaperChatProps {
121
+ variant?: PaperChatVariant;
15
122
  token?: string;
16
123
  workspaceId?: string;
17
124
  dashboardId?: string;
18
125
  apiUrl?: string;
19
- /**
20
- * Called whenever the toolbar height changes (including multiline expansion).
21
- * Host apps can use this to add bottom padding/margin to their chart area,
22
- * mirroring how the main app dashboard layout reacts to toolbar height.
23
- */
126
+ hideChartArea?: boolean;
24
127
  onToolbarHeightChange?: (height: number) => void;
25
128
  placeholder?: string;
26
129
  shortcutKey?: string;
27
130
  autoFade?: boolean;
28
131
  fadeDelay?: number;
29
132
  className?: string;
133
+ showToolbar?: boolean;
134
+ onAssistantClose?: () => void;
135
+ initialChatScroll?: 'top' | 'bottom';
136
+ isViewer?: boolean;
137
+ assistantInline?: boolean;
30
138
  /**
31
- * Controls whether the fixed bottom chat toolbar (input + quick actions) is rendered.
32
- * Defaults to `true`.
139
+ * Whether to render user / assistant avatars (User icon and Papermap logo)
140
+ * in chat message rows. Defaults to visible across every variant; pass
141
+ * `false` to hide them.
33
142
  */
34
- showToolbar?: boolean;
143
+ showAvatars?: boolean;
35
144
  /**
36
- * Called after the floating assistant panel is closed (e.g. to refetch dashboard charts).
145
+ * Override the user / assistant / thinking avatar icons. Each slot replaces
146
+ * only the icon — the surrounding circle wrapper stays. Useful for
147
+ * white-labeling the chat with the host product's brand.
37
148
  */
38
- onAssistantClose?: () => void;
149
+ avatars?: PaperChatAvatars;
150
+ /**
151
+ * Color scheme when this component creates `PapermapProvider` (main-app embedded `?theme=` parity).
152
+ */
153
+ theme?: PapermapColorScheme;
154
+ /**
155
+ * Which edge the side rail attaches to (border + shadow face the main area).
156
+ * - `"left"` (default): dock to the viewport left edge.
157
+ * - `"right"`: dock to the viewport right edge.
158
+ */
159
+ sidePosition?: PaperChatSidePosition;
160
+ /**
161
+ * Whether the side rail participates in document flow vs overlaying the page.
162
+ * - `"none"` (default): on `md+` the rail is viewport-fixed and overlays host content.
163
+ * - `"auto"`: on `md+` the rail is **in-flow** — place `PaperChat` as a flex sibling next to your
164
+ * main surface (`flex` row, `min-h-0`, main `flex-1 min-w-0 overflow-auto`) so content resizes
165
+ * with the panel. Below `md`, behavior matches `"none"` (slide-over sheet). Hosts should not rely
166
+ * on `body` padding for insetting; the package no longer sets `--papermap-side-inset-*` for this mode.
167
+ */
168
+ sideContentInsetMode?: PaperChatSideContentInsetMode;
169
+ /**
170
+ * Whether the chat surface is open — use with **`onOpenChange`** for
171
+ * **`variant="side"`** (rail), **`variant="floating"`** (overlay), and
172
+ * **`variant="dialog"`** (modal). When omitted, each variant falls back to
173
+ * its own defaults (side: closed; floating: use `visible`; dialog:
174
+ * internal state or `dialogOpen`).
175
+ */
176
+ open?: boolean;
177
+ /**
178
+ * Fires when the surface opens or closes. Use for **`side`**, **`floating`**,
179
+ * and **`dialog`** instead of legacy `onClose` / `onDialogOpenChange`.
180
+ */
181
+ onOpenChange?: (open: boolean) => void;
182
+ onChartVisibilityChange?: (visible: boolean) => void;
183
+ /**
184
+ * Mount node for the sheet chart overlay (`createPortal`). Omit to use `document.body` (no host ref).
185
+ */
186
+ chartOverlayPortalRef?: React__default.RefObject<HTMLDivElement | null>;
187
+ onPendingSheetEditsChange?: (edits: {
188
+ edit_session_id?: string;
189
+ }[]) => void;
190
+ clearPendingSheetEditsRef?: React__default.MutableRefObject<(() => void) | null>;
191
+ /**
192
+ * Render-prop for a custom open trigger shown when `variant === 'side'` and
193
+ * `open === false`. The returned node mounts inside the side wrapper; if you
194
+ * need the trigger to escape the wrapper (e.g. as a floating action button),
195
+ * style it with `fixed` / `absolute` positioning.
196
+ *
197
+ * Omit to render no trigger — keep the existing pattern where the host
198
+ * renders its own open affordance outside `PaperChat`.
199
+ */
200
+ renderSidePanelOpenTrigger?: (controls: SidePanelTriggerControls) => React__default.ReactNode;
201
+ /**
202
+ * @deprecated Use **`open`** for `variant="floating"`. When both are set,
203
+ * `open` takes precedence.
204
+ */
205
+ visible?: boolean;
206
+ /**
207
+ * @deprecated Use **`onOpenChange(false)`** for `variant="floating"`. Still
208
+ * invoked after `onOpenChange` when the overlay requests close, if provided.
209
+ */
210
+ onClose?: () => void;
211
+ historyOpen?: boolean;
212
+ onCloseHistory?: () => void;
213
+ /** Header title inside the modal (default: `Chat`). Prefer `title`. */
214
+ title?: string;
215
+ /** @deprecated Use **`title`**. */
216
+ dialogTitle?: string;
217
+ /** Subtitle under the title. Prefer `subtitle`. */
218
+ subtitle?: string;
219
+ /** @deprecated Use **`subtitle`**. */
220
+ dialogSubtitle?: string;
221
+ /**
222
+ * @deprecated Use **`open`** for controlled dialog state. When both are set,
223
+ * `open` takes precedence.
224
+ */
225
+ dialogOpen?: boolean;
226
+ /**
227
+ * @deprecated Use **`onOpenChange`**. When both are set, `onOpenChange` is
228
+ * preferred.
229
+ */
230
+ onDialogOpenChange?: (open: boolean) => void;
231
+ /** Whether to show the floating launcher. Default `true`. Prefer `showLauncher`. */
232
+ showLauncher?: boolean;
233
+ /** @deprecated Use **`showLauncher`**. */
234
+ showDialogLauncher?: boolean;
235
+ /** Accessible name for the launcher. Prefer `launcherAriaLabel`. */
236
+ launcherAriaLabel?: string;
237
+ /** @deprecated Use **`launcherAriaLabel`**. */
238
+ dialogLauncherAriaLabel?: string;
239
+ /** Viewport corner for the launcher. Prefer `launcherPosition`. */
240
+ launcherPosition?: PaperChatDialogLauncherPosition;
241
+ /** @deprecated Use **`launcherPosition`**. */
242
+ dialogLauncherPosition?: PaperChatDialogLauncherPosition;
243
+ /**
244
+ * Custom trigger node for the `dialog` and `side` variants. The plugin
245
+ * wraps the node with the open/close handler so any element (icon, branded
246
+ * button, link, etc.) keeps the built-in toggle UX and accessibility.
247
+ * Ignored for `default` / `floating` variants.
248
+ */
249
+ trigger?: React__default.ReactNode;
250
+ /** Custom avatar node for assistant message rows. Equivalent to `avatars.assistant`. */
251
+ assistantAvatar?: React__default.ReactNode;
252
+ /** Custom avatar node for user message rows. Equivalent to `avatars.user`. */
253
+ userAvatar?: React__default.ReactNode;
254
+ /**
255
+ * Greeting/welcome line rendered as the first assistant bubble before any
256
+ * real messages have been exchanged. Applies to `side` and `dialog`
257
+ * variants (where the conversation surface is always mounted).
258
+ */
259
+ greetingMessage?: string;
260
+ /** Controlled expanded state for `side` and `dialog` variants. */
261
+ expanded?: boolean;
262
+ /** Uncontrolled initial expanded state. Default `false`. */
263
+ defaultExpanded?: boolean;
264
+ /** Fires when the side panel or dialog toggles between default and expanded size. */
265
+ onExpandedChange?: (expanded: boolean) => void;
266
+ }
267
+ declare function PaperChat({ variant, token, workspaceId, dashboardId, apiUrl, onToolbarHeightChange, onAssistantClose, initialChatScroll, isViewer, assistantInline, theme, showToolbar, showAvatars, avatars, sidePosition, sideContentInsetMode, open, onOpenChange, onChartVisibilityChange, chartOverlayPortalRef, onPendingSheetEditsChange, clearPendingSheetEditsRef, renderSidePanelOpenTrigger, visible, onClose, historyOpen, onCloseHistory, hideChartArea, title, dialogTitle, subtitle, dialogSubtitle, dialogOpen, onDialogOpenChange, showLauncher, showDialogLauncher, launcherAriaLabel, dialogLauncherAriaLabel, launcherPosition, dialogLauncherPosition, trigger, assistantAvatar, userAvatar, greetingMessage, expanded, defaultExpanded, onExpandedChange, ...uiProps }: PaperChatProps): react_jsx_runtime.JSX.Element;
268
+
269
+ type PendingSheetEditLike = {
270
+ edit_session_id?: string;
271
+ };
272
+ interface PaperChatSidePanelProps {
273
+ token?: string;
274
+ workspaceId?: string;
275
+ dashboardId?: string;
276
+ apiUrl?: string;
277
+ initialChatScroll?: 'top' | 'bottom';
278
+ isViewer?: boolean;
279
+ assistantInline?: boolean;
280
+ /** Color scheme when this component creates `PapermapProvider`. */
281
+ theme?: PapermapColorScheme;
282
+ hideChartArea?: boolean;
283
+ open: boolean;
284
+ onOpenChange: (open: boolean) => void;
285
+ onChartVisibilityChange?: (visible: boolean) => void;
286
+ /**
287
+ * Optional mount node for the sheet chart overlay portal. When omitted, the overlay portals to
288
+ * `document.body` so side-panel + dialog embeds work without a host ref.
289
+ */
290
+ chartOverlayPortalRef?: React__default.RefObject<HTMLDivElement | null>;
291
+ onPendingSheetEditsChange?: (edits: PendingSheetEditLike[]) => void;
292
+ clearPendingSheetEditsRef?: React__default.MutableRefObject<(() => void) | null>;
293
+ /** When embedded in a modal (e.g. `PaperChat` variant `dialog`), use full width and skip rail animation. */
294
+ embedInDialog?: boolean;
295
+ /** Hide the panel title row when the host supplies chrome (e.g. report-style dialog header). */
296
+ hideHeader?: boolean;
297
+ /**
298
+ * Which screen edge the sheet rail attaches to (borders/shadow face the main content).
299
+ * Ignored when `embedInDialog` is true.
300
+ */
301
+ sidePosition?: 'left' | 'right';
302
+ /**
303
+ * When true (e.g. `PaperChat` `sideContentInsetMode="auto"`), the desktop rail is laid out in-flow
304
+ * inside a flex host; width clamps use the smaller of viewport and the host column width, and the
305
+ * chart overlay reserves the live rail width instead of a fixed constant.
306
+ */
307
+ layoutFlowRail?: boolean;
308
+ /**
309
+ * Dialog embed only: whether chat chrome or the portaled chart overlay stacks above (focus-driven).
310
+ */
311
+ embedDialogStackLeader?: 'chat' | 'chart';
312
+ /** Ref to the floating chart dock root for embed stacking hit-testing. */
313
+ embedChartDockRef?: React__default.MutableRefObject<HTMLDivElement | null>;
314
+ /** Dialog embed: sync expanded/history fullscreen overlay foreground for Radix stack tiers. */
315
+ onEmbedChartForegroundChange?: (foreground: boolean) => void;
316
+ /**
317
+ * Whether to render user / assistant avatars (User icon and Papermap logo)
318
+ * in message bubbles. Defaults to `true` for this surface — the side rail
319
+ * and dialog modal are chrome-rich and benefit from identity affordances.
320
+ * Set `false` to hide them.
321
+ */
322
+ showAvatars?: boolean;
323
+ /** Override the user / assistant / thinking avatar icons. */
324
+ avatars?: PaperChatAvatars;
325
+ /**
326
+ * Greeting / welcome message rendered as the first assistant bubble before
327
+ * the user sends anything. Mirrors a live-chat widget welcome line.
328
+ */
329
+ greetingMessage?: string;
330
+ /** Controlled expanded state — when true, the panel grows beyond default width. */
331
+ expanded?: boolean;
332
+ /** Uncontrolled initial expanded state. Default `false`. */
333
+ defaultExpanded?: boolean;
334
+ /** Fires when the panel toggles between default and expanded width. */
335
+ onExpandedChange?: (expanded: boolean) => void;
336
+ /** Hide the built-in expand/collapse toggle in the header. Default `false`. */
337
+ hideExpandToggle?: boolean;
338
+ }
339
+ declare function PaperChatSidePanel({ token, workspaceId, dashboardId, apiUrl, initialChatScroll, isViewer, assistantInline, theme, ...panelProps }: PaperChatSidePanelProps): react_jsx_runtime.JSX.Element;
340
+ /** Backward-compatible alias. Prefer `PaperChatSidePanel`. */
341
+ declare function ChatSidePanel(props: PaperChatSidePanelProps): react_jsx_runtime.JSX.Element;
342
+
343
+ interface PaperChatFloatingChartOverlayProps {
344
+ token?: string;
345
+ workspaceId?: string;
346
+ dashboardId?: string;
347
+ apiUrl?: string;
348
+ initialChatScroll?: 'top' | 'bottom';
349
+ isViewer?: boolean;
350
+ assistantInline?: boolean;
351
+ /** Color scheme when this component creates `PapermapProvider`. */
352
+ theme?: PapermapColorScheme;
353
+ visible: boolean;
354
+ onClose: () => void;
355
+ /** Sheet page: charts history list in this overlay instead of the chat column */
356
+ historyOpen?: boolean;
357
+ onCloseHistory?: () => void;
358
+ /**
359
+ * When true (e.g. `PaperChat` variant `dialog`), use the same z-index layer as {@link ChartDialog}
360
+ * (`PAPERMAP_CHAT_DIALOG_Z`) with `fixed` positioning. Prefer portaling to `document.body` in the host.
361
+ */
362
+ stackWithChartDialog?: boolean;
363
+ /**
364
+ * When portaling to `document.body` next to {@link ChatSidePanel}, inset the overlay so it only
365
+ * covers the main area — not the chat rail (`CHAT_SIDE_PANEL_WIDTH_PX`).
366
+ */
367
+ besideRail?: boolean;
368
+ /**
369
+ * When set with `besideRail`, padding matches this width (e.g. in-flow rail after drag/expand)
370
+ * instead of the default `CHAT_SIDE_PANEL_WIDTH_PX`.
371
+ */
372
+ besideRailReservedWidthPx?: number;
373
+ /** Which edge the side panel is on — must match `ChatSidePanel` `sidePosition`. */
374
+ sidePosition?: 'left' | 'right';
375
+ /** When false and `besideRail`, do not reserve rail width (panel collapsed). */
376
+ sideRailOpen?: boolean;
377
+ /** Merged onto the chart overlay card shell (rounded panel). */
378
+ className?: string;
379
+ /** Dialog embed: z-index tier vs chat (from `PaperChatDialogInner`). */
380
+ embedDialogStackLeader?: 'chat' | 'chart';
381
+ embedChartDockRef?: React__default.MutableRefObject<HTMLDivElement | null>;
382
+ /** Dialog embed: expanded or history fullscreen should stack above chat and lower dialog chrome. */
383
+ onEmbedChartForegroundChange?: (foreground: boolean) => void;
39
384
  }
40
- declare function PaperChat({ token, workspaceId, dashboardId, apiUrl, onToolbarHeightChange, onAssistantClose, showToolbar, ...uiProps }: PaperChatProps): react_jsx_runtime.JSX.Element;
385
+ declare function PaperChatFloatingChartOverlay({ token, workspaceId, dashboardId, apiUrl, initialChatScroll, isViewer, assistantInline, theme, ...overlayProps }: PaperChatFloatingChartOverlayProps): react_jsx_runtime.JSX.Element;
386
+ /** Backward-compatible alias. Prefer `PaperChatFloatingChartOverlay`. */
387
+ declare function FloatingChartOverlay(props: PaperChatFloatingChartOverlayProps): react_jsx_runtime.JSX.Element;
41
388
 
42
389
  /** One row of tabular chart data (column keys depend on the query). */
43
390
  type ChartDataRow = Record<string, unknown>;
@@ -183,8 +530,9 @@ interface PaperCardProps {
183
530
  /**
184
531
  * Visual theme for the chart card. When set, renders in the specified
185
532
  * mode independent of the host app. Omit to inherit the host page's theme.
533
+ * When the card creates its own `PapermapProvider`, this also sets the provider color scheme.
186
534
  */
187
- theme?: 'light' | 'dark';
535
+ theme?: 'light' | 'dark' | 'system';
188
536
  /**
189
537
  * Called when the user clicks the edit button on the chart card.
190
538
  * In streaming variant, if not provided, the built-in StreamingChartDialog opens.
@@ -210,7 +558,7 @@ interface PaperCardProps {
210
558
  wide?: boolean;
211
559
  /** Hide the chart variation selector. Defaults to true. */
212
560
  hideVariants?: boolean;
213
- /** Show the toolbar with edit/delete/maximize buttons. Defaults to true. */
561
+ /** Show the card chrome toolbar (maximize, edit, delete). Main app `ChartCard` uses `showChatToolbar`. Default true. */
214
562
  showToolbar?: boolean;
215
563
  /** When true, chart toolbar actions are visually disabled during layout editing. */
216
564
  isEditMode?: boolean;
@@ -234,8 +582,6 @@ interface PaperCardProps {
234
582
  }
235
583
  declare function PaperCard({ token: tokenProp, workspaceId: workspaceIdProp, dashboardId: dashboardIdProp, apiUrl: apiUrlProp, id, onSave, onPinnedToDashboard, onAssistantClosed, chartId, chart: chartProp, theme, onEditClick, onDelete, isViewer, wide, hideVariants, showToolbar, isEditMode, className, variant, hideStreamingEmptySubtext, dashboardTheme, }: PaperCardProps): react_jsx_runtime.JSX.Element;
236
584
 
237
- declare function ChatAssistant(): react_jsx_runtime.JSX.Element;
238
-
239
585
  interface AgentThought {
240
586
  type: 'agent_thought';
241
587
  content: string;
@@ -243,6 +589,24 @@ interface AgentThought {
243
589
  iteration: number;
244
590
  timestamp: string;
245
591
  }
592
+ /** Native model reasoning (OpenAI summaries, Claude extended thinking) */
593
+ interface Reasoning {
594
+ type: 'reasoning';
595
+ content: string;
596
+ is_complete: boolean;
597
+ iteration: number;
598
+ timestamp: string;
599
+ }
600
+ /** SSE payload when the agent requires user confirmation before executing a tool */
601
+ interface ConfirmationRequired {
602
+ type: 'confirmation_required';
603
+ confirmation_id: string;
604
+ tool_display_name: string;
605
+ message: string;
606
+ action_description: string;
607
+ timeout_seconds: number;
608
+ timestamp: string;
609
+ }
246
610
  interface FinalResponse {
247
611
  type: 'final_response';
248
612
  response_data: {
@@ -268,7 +632,7 @@ interface ToolCall {
268
632
  tool_name: string;
269
633
  tool_display_name: string;
270
634
  args_preview: string;
271
- status: 'announced' | 'streaming' | 'ready' | 'executing' | 'success' | 'error';
635
+ status: 'announced' | 'streaming' | 'ready' | 'confirmation_pending' | 'executing' | 'success' | 'error' | 'denied';
272
636
  output?: string;
273
637
  code?: string;
274
638
  isStreamingArgs?: boolean;
@@ -277,13 +641,17 @@ interface ToolCall {
277
641
  duration_ms?: number;
278
642
  error_message?: string;
279
643
  tool_call_id?: string;
644
+ /** Present while status is `confirmation_pending` */
645
+ confirmationData?: ConfirmationRequired;
280
646
  timestamp: string;
281
647
  }
282
648
  interface TimelineEvent {
283
- type: 'thought' | 'tool';
649
+ type: 'thought' | 'reasoning' | 'tool';
284
650
  timestamp: string;
285
651
  iteration?: number;
286
652
  thoughtData?: AgentThought;
653
+ /** For native model reasoning */
654
+ reasoningData?: Reasoning;
287
655
  toolData?: ToolCall;
288
656
  }
289
657
  interface StreamState {
@@ -298,10 +666,11 @@ interface StreamState {
298
666
  isStreaming: boolean;
299
667
  }
300
668
 
301
- declare function StreamingTimeline({ timeline, collapseThreshold, recentFullCount, }: {
669
+ declare function StreamingTimeline({ timeline, collapseThreshold, recentFullCount, onConfirmationResponse, }: {
302
670
  timeline: TimelineEvent[];
303
671
  collapseThreshold?: number;
304
672
  recentFullCount?: number;
673
+ onConfirmationResponse?: (confirmationId: string, confirmed: boolean, message?: string) => Promise<void>;
305
674
  }): react_jsx_runtime.JSX.Element | null;
306
675
 
307
676
  interface AgentThoughtDisplayProps {
@@ -317,15 +686,90 @@ interface ToolCallDisplayProps {
317
686
  className?: string;
318
687
  showAll?: boolean;
319
688
  isLatest?: boolean;
689
+ onConfirmationResponse?: (confirmationId: string, confirmed: boolean, message?: string) => Promise<void>;
320
690
  }
321
- declare function ToolCallDisplay({ toolCalls, className, showAll, isLatest, }: ToolCallDisplayProps): react_jsx_runtime.JSX.Element | null;
691
+ declare function ToolCallDisplay({ toolCalls, className, showAll, isLatest, onConfirmationResponse, }: ToolCallDisplayProps): react_jsx_runtime.JSX.Element | null;
322
692
 
323
- declare function RecentConversations(): react_jsx_runtime.JSX.Element;
693
+ declare function RecentConversations({ embedInPanel }?: {
694
+ embedInPanel?: boolean;
695
+ }): react_jsx_runtime.JSX.Element;
324
696
 
325
697
  declare function ChartHistory(): react_jsx_runtime.JSX.Element;
326
698
 
327
699
  declare function SavedMemory(): react_jsx_runtime.JSX.Element;
328
700
 
701
+ /**
702
+ * In the main app, workspace/dashboard selection lives in Redux. The plugin
703
+ * provides the same `WorkspaceSelector` API (`dashboardTheme` only) and
704
+ * supplies selection state and callbacks through this context (see PaperBoard).
705
+ */
706
+ type WorkspaceSelectorControl = {
707
+ workspaceId: string;
708
+ dashboardId: string;
709
+ onSelect: (next: {
710
+ workspaceId: string;
711
+ dashboardId: string;
712
+ }) => void;
713
+ isViewer?: boolean;
714
+ };
715
+ declare function WorkspaceSelectorProvider({ value, children, }: {
716
+ value: WorkspaceSelectorControl;
717
+ children: ReactNode;
718
+ }): react_jsx_runtime.JSX.Element;
719
+
720
+ declare function DashboardAppHeader({ dashboardTheme, showWorkspaceSelector, workspaceSelectorValue, user, onLogout, billingHref, settingsHref, logoutUrl, appHeaderRightSlot, className,
721
+ /**
722
+ * When false, the header does not use `position: sticky` — use with a parent flex column where
723
+ * the scroll region is a sibling below the header (main-app `AuthenticatedLayout` pattern).
724
+ */
725
+ sticky, }: {
726
+ dashboardTheme?: DashboardTheme | null;
727
+ showWorkspaceSelector: boolean;
728
+ workspaceSelectorValue: WorkspaceSelectorControl;
729
+ user?: {
730
+ name?: string | null;
731
+ email?: string | null;
732
+ } | null;
733
+ onLogout?: () => void;
734
+ billingHref?: string;
735
+ settingsHref?: string;
736
+ logoutUrl?: string;
737
+ appHeaderRightSlot?: ReactNode;
738
+ className?: string;
739
+ sticky?: boolean;
740
+ }): react_jsx_runtime.JSX.Element;
741
+
742
+ declare function UserNav({ dashboardTheme, user: userProp, onLogout, billingHref, settingsHref, logoutUrl, }: {
743
+ dashboardTheme?: DashboardTheme | null;
744
+ user?: {
745
+ name?: string | null;
746
+ email?: string | null;
747
+ } | null;
748
+ /** Called when user picks Log out; if omitted, navigates to `logoutUrl` or Papermap home. */
749
+ onLogout?: () => void;
750
+ /** Defaults: `/billing` and `/settings` on the hosted web app. */
751
+ billingHref?: string;
752
+ settingsHref?: string;
753
+ logoutUrl?: string;
754
+ }): react_jsx_runtime.JSX.Element;
755
+
756
+ /**
757
+ * Main app: [IntegrationsBar](papermap/src/components/IntegrationsBar.tsx) — Slack in the package;
758
+ * WhatsApp is main-app-only (omitted to avoid a large second port).
759
+ */
760
+ declare function IntegrationsBar({ dashboardTheme, }: Readonly<{
761
+ dashboardTheme?: DashboardTheme | null;
762
+ }>): react_jsx_runtime.JSX.Element;
763
+
764
+ /**
765
+ * Same surface API as the main app `src/components/dashboard/workspace-selector.tsx`:
766
+ * `dashboardTheme` for scoped styling. Selection state and `onSelect` are provided by
767
+ * {@link WorkspaceSelectorProvider} (wired from PaperBoard).
768
+ */
769
+ declare function WorkspaceSelector({ dashboardTheme }: {
770
+ dashboardTheme?: DashboardTheme;
771
+ }): react_jsx_runtime.JSX.Element;
772
+
329
773
  interface PaperDashboardSelectProps {
330
774
  workspaceId: string;
331
775
  dashboardId: string;
@@ -355,17 +799,52 @@ interface DashboardTabNavigationProps {
355
799
  className?: string;
356
800
  items: DashboardNavbarItem[];
357
801
  dashboardTheme?: DashboardTheme;
358
- /** Renders on the right (e.g. `PaperDashboardSelect`). */
359
- rightSlot?: React.ReactNode;
802
+ /** Sticky offset below the app header. Main app uses `top-14` (3.5rem) under a 14 (`h-14`) top bar. */
803
+ stickyTopClassName?: string;
804
+ /** When false, tabs are not `position: sticky` (stack below the header; scroll is a sibling below). */
805
+ sticky?: boolean;
806
+ rightSlot?: ReactNode;
360
807
  }
361
808
  /**
362
809
  * Top tab bar styled like the main app `TabNavigation` (embedded layout navbar), without Next.js `Link`.
810
+ *
811
+ * **Active tab:** each item’s `href` pathname is compared to `window.location.pathname`. In a single-page
812
+ * embed where every tab would share the same path, no tab may appear active unless the host uses distinct
813
+ * paths or supplies custom `items` / a future `activeNavId`-style override.
363
814
  */
364
- declare function DashboardTabNavigation({ className, items, dashboardTheme, rightSlot, }: DashboardTabNavigationProps): react_jsx_runtime.JSX.Element;
815
+ declare function DashboardTabNavigation({ className, items, dashboardTheme, stickyTopClassName,
816
+ /** When false, tabs are not `position: sticky` (stack below a fixed top bar; scroll is a sibling below). */
817
+ sticky, rightSlot, }: DashboardTabNavigationProps): react_jsx_runtime.JSX.Element;
818
+
819
+ type CreatedDashboard = {
820
+ dashboard_id: string;
821
+ title: string;
822
+ };
823
+ type CreateDashboardDialogProps = {
824
+ open: boolean;
825
+ onOpenChange: (open: boolean) => void;
826
+ workspaceId: string;
827
+ onSuccess: (dashboard: CreatedDashboard) => void;
828
+ };
829
+ declare function CreateDashboardDialog({ open, onOpenChange, workspaceId, onSuccess, }: CreateDashboardDialogProps): react_jsx_runtime.JSX.Element;
830
+
831
+ type CreatedUnifiedWorkspace = {
832
+ workspace_id: string;
833
+ name: string;
834
+ default_dashboard: string;
835
+ };
836
+ type CreateUnifiedWorkspaceDialogProps = {
837
+ open: boolean;
838
+ onOpenChange: (open: boolean) => void;
839
+ /** Called after API success with IDs so the host can navigate / invalidate queries. */
840
+ onSuccess: (workspace: CreatedUnifiedWorkspace) => void;
841
+ };
842
+ declare function CreateUnifiedWorkspaceDialog({ open, onOpenChange, onSuccess, }: CreateUnifiedWorkspaceDialogProps): react_jsx_runtime.JSX.Element;
365
843
 
366
844
  interface TChartMeta {
367
845
  title?: string;
368
846
  subtitle?: string;
847
+ description?: string;
369
848
  footer?: string;
370
849
  variant?: string;
371
850
  showLegend?: boolean;
@@ -410,6 +889,9 @@ interface ChartViewProps {
410
889
  dashboardTheme?: DashboardTheme;
411
890
  /** When true, ignore `dashboardTheme` (e.g. dialog with `skipDashboardTheme`). */
412
891
  skipDashboardTheme?: boolean;
892
+ /** When provided, renders a camera/screenshot control next to chart variations (main-app parity). */
893
+ onScreenshot?: () => void;
894
+ isScreenshotting?: boolean;
413
895
  }
414
896
  declare function ChartView(props: ChartViewProps): react_jsx_runtime.JSX.Element;
415
897
 
@@ -428,9 +910,10 @@ interface ChartDialogProps {
428
910
  visualizationConfig: Record<string, any>;
429
911
  onMetaChange: (key: 'title' | 'description' | 'footer' | 'subtitle', value: string) => void;
430
912
  variant?: string;
913
+ hideChartArea?: boolean;
431
914
  /**
432
- * Optional hook for the **minimize** control only: invoked immediately before `onOpenChange(false)`.
433
- * Backdrop click and Escape call **only** `onOpenChange(false)` (Radix default).
915
+ * Optional callback (main app passes it from chat but does not invoke it from the dialog minimize control).
916
+ * Minimize calls `onOpenChange(false)` only, matching the main Papermap `ChartDialog`.
434
917
  */
435
918
  onClose?: () => void;
436
919
  /**
@@ -447,6 +930,18 @@ interface ChartDialogProps {
447
930
  * When true, do not apply `dashboardTheme` to the dialog shell or inner `ChartView` (e.g. `ChatAssistant`).
448
931
  */
449
932
  skipDashboardTheme?: boolean;
933
+ /**
934
+ * Package-only: near-full viewport sizing for expanded `ChatAssistant` / streaming hosts.
935
+ * The main app `ChartDialog` has no equivalent prop; default `false` matches main-app layout.
936
+ */
937
+ fullBleed?: boolean;
938
+ /** Color scheme when this component creates `PapermapProvider`. */
939
+ theme?: PapermapColorScheme;
940
+ /**
941
+ * Hide the floating screenshot control (main app keeps it on maximize dialogs from grid/chat paths).
942
+ * `FloatingChartOverlay` omits chart screenshots in the embed package.
943
+ */
944
+ hideScreenshotButton?: boolean;
450
945
  }
451
946
  declare function ChartDialog(props: ChartDialogProps): react_jsx_runtime.JSX.Element;
452
947
 
@@ -464,12 +959,12 @@ declare function StreamingChartDialog({ isOpen, onOpenChange, chartId, onClose,
464
959
 
465
960
  interface DataTableProps {
466
961
  data: any[];
467
- dashboardTheme?: any;
962
+ dashboardTheme?: DashboardTheme | null;
468
963
  }
469
964
  declare function DataTable({ data, dashboardTheme }: DataTableProps): react_jsx_runtime.JSX.Element;
470
965
 
471
966
  declare const buttonVariants: (props?: ({
472
- variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
967
+ variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
473
968
  size?: "default" | "sm" | "lg" | "icon" | null | undefined;
474
969
  } & class_variance_authority_types.ClassProp) | undefined) => string;
475
970
  interface ButtonProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
@@ -508,7 +1003,11 @@ interface FeedbackButtonsProps {
508
1003
  }
509
1004
  declare function FeedbackButtons({ onFeedback, className, isLoading, selectedFeedback, loadingType, }: FeedbackButtonsProps): react_jsx_runtime.JSX.Element;
510
1005
 
511
- declare function ModelSelector(): react_jsx_runtime.JSX.Element;
1006
+ interface ModelSelectorProps {
1007
+ /** `icon` = sparkles only; `compact` = sparkles + current model label (main toolbar when expanded / multiline). */
1008
+ variant?: 'icon' | 'compact';
1009
+ }
1010
+ declare function ModelSelector({ variant }: ModelSelectorProps): react_jsx_runtime.JSX.Element;
512
1011
 
513
1012
  interface StreamingChatPanelProps {
514
1013
  className?: string;
@@ -561,8 +1060,19 @@ declare function createChartService(client: AxiosInstance): {
561
1060
  getDashboards: (params: {
562
1061
  workspace_id: string;
563
1062
  }) => Promise<any>;
1063
+ getDashboardsPaginated: (params: {
1064
+ workspace_id: string;
1065
+ page?: number;
1066
+ per_page?: number;
1067
+ search_term?: string;
1068
+ }) => Promise<any>;
564
1069
  getDashboardById: (dashboardId: string) => Promise<any>;
565
1070
  updateDashboardLayout: (dashboardId: string, layout: TLayout[]) => Promise<any>;
1071
+ createDashboard: (payload: {
1072
+ title: string;
1073
+ description?: string;
1074
+ workspace_id: string;
1075
+ }) => Promise<any>;
566
1076
  createChat: (data: {
567
1077
  name: string;
568
1078
  dashboard_id: string;
@@ -600,6 +1110,12 @@ declare function createChartService(client: AxiosInstance): {
600
1110
  removeBookmark: (bookmarkId: string) => Promise<any>;
601
1111
  updateResponseLabel: (llm_data_id: string, label: "positive" | "negative") => Promise<any>;
602
1112
  branchConversation: (dashboard_id: string, llm_data_id: string) => Promise<any>;
1113
+ submitToolConfirmation: (data: {
1114
+ request_id: string;
1115
+ confirmation_id: string;
1116
+ confirmed: boolean;
1117
+ message?: string;
1118
+ }) => Promise<any>;
603
1119
  getModels: () => Promise<any>;
604
1120
  generateProactiveDashboard: (payload: {
605
1121
  workspace_id: string;
@@ -608,6 +1124,66 @@ declare function createChartService(client: AxiosInstance): {
608
1124
  }) => Promise<any>;
609
1125
  };
610
1126
 
1127
+ interface SlackIntegrationStatus {
1128
+ connected: boolean;
1129
+ team_name?: string;
1130
+ team_id?: string;
1131
+ connected_at?: string;
1132
+ scopes?: string[];
1133
+ requires_reauth?: boolean;
1134
+ error_code?: string;
1135
+ error_message?: string;
1136
+ error_timestamp?: string;
1137
+ can_reactivate?: boolean;
1138
+ }
1139
+ interface SlackDisconnectResponse {
1140
+ success: boolean;
1141
+ message: string;
1142
+ count: number;
1143
+ }
1144
+ interface SlackReactivateResponse {
1145
+ success: boolean;
1146
+ message: string;
1147
+ status: {
1148
+ status: string;
1149
+ team_name?: string;
1150
+ team_id?: string;
1151
+ requires_reauth?: boolean;
1152
+ error_code?: string;
1153
+ };
1154
+ }
1155
+ interface WorkspaceAccess {
1156
+ workspace_id: string;
1157
+ name: string;
1158
+ workspace_type: string;
1159
+ allowed: boolean;
1160
+ }
1161
+ interface WorkspaceAccessSettings {
1162
+ team_id: string;
1163
+ team_name: string;
1164
+ total_workspaces: number;
1165
+ allowed_workspaces: number;
1166
+ updated_at: string | null;
1167
+ updated_by_user_id: string | null;
1168
+ }
1169
+ interface WorkspaceAccessResponse {
1170
+ success: boolean;
1171
+ workspaces: WorkspaceAccess[];
1172
+ settings: WorkspaceAccessSettings;
1173
+ }
1174
+
1175
+ /**
1176
+ * Slack API (matches [slack.service](papermap/src/services/slack.service.ts)); uses the Papermap API client and embed token.
1177
+ */
1178
+ declare function createSlackService(client: AxiosInstance, baseUrl: string): {
1179
+ getStatus(): Promise<SlackIntegrationStatus>;
1180
+ initiateOAuth(rawToken: string): Promise<void>;
1181
+ disconnect(): Promise<SlackDisconnectResponse>;
1182
+ reactivate(): Promise<SlackReactivateResponse>;
1183
+ getWorkspaceAccess(teamId: string): Promise<WorkspaceAccessResponse>;
1184
+ updateWorkspaceAccess(teamId: string, allowedWorkspaceIds: string[]): Promise<WorkspaceAccessResponse>;
1185
+ };
1186
+
611
1187
  /** Plain JSON object (not array, not null). */
612
1188
  type JsonObject = Record<string, unknown>;
613
1189
  /** Workspace `meta` fields used for dashboard theming (matches main app). */
@@ -646,6 +1222,7 @@ declare function createWorkspaceService(client: AxiosInstance): {
646
1222
  getWorkspace: (workspaceId: string) => Promise<any>;
647
1223
  updateWorkspace: (workspaceId: string, workspace: JsonObject) => Promise<any>;
648
1224
  verifyDatabaseConnection: (workspaceId: string) => Promise<any>;
1225
+ createUnifiedWorkspace: (name?: string) => Promise<any>;
649
1226
  };
650
1227
 
651
1228
  type PapermapHttpServices = {
@@ -653,6 +1230,9 @@ type PapermapHttpServices = {
653
1230
  streamingSvc: ReturnType<typeof createStreamingService>;
654
1231
  chartSvc: ReturnType<typeof createChartService>;
655
1232
  workspaceSvc: ReturnType<typeof createWorkspaceService>;
1233
+ slackSvc: ReturnType<typeof createSlackService>;
1234
+ /** Raw embed token (used for Slack OAuth redirect). */
1235
+ token: string;
656
1236
  baseUrl: string;
657
1237
  };
658
1238
  declare function createPapermapServices(config: {
@@ -666,6 +1246,7 @@ type MessageProgressEvent = {
666
1246
  };
667
1247
  interface Message {
668
1248
  id?: string;
1249
+ /** Preferred id for bookmark / feedback / branch APIs when both are present (matches main app). */
669
1250
  llm_data_id?: string;
670
1251
  content: string;
671
1252
  role: 'user' | 'assistant' | 'error' | 'branch';
@@ -747,6 +1328,21 @@ interface PapermapStoreConfig {
747
1328
  * `PapermapProvider` supplies a shared instance when `observability` options are passed.
748
1329
  */
749
1330
  observability?: PapermapObservability;
1331
+ /**
1332
+ * ChatAssistant scroll: `top` mimics main-app onboarding (open at top, less aggressive bottom follow).
1333
+ * Omit or `bottom` for default bottom-anchored chat scrolling.
1334
+ */
1335
+ initialChatScroll?: 'top' | 'bottom';
1336
+ /**
1337
+ * When true, bookmark actions in chat are hidden (mirrors main app viewer role).
1338
+ * `PapermapProvider` / `PaperChat` forward this; hosts using only metadata can pass without an API role fetch.
1339
+ */
1340
+ isViewer?: boolean;
1341
+ /**
1342
+ * When true, `ChatAssistant` uses column-friendly layout (no floating card chrome). Hosts embed via
1343
+ * `PapermapProvider` + a sized parent, or pass from `PaperChat` when it creates the provider.
1344
+ */
1345
+ assistantInline?: boolean;
750
1346
  }
751
1347
  type Services = PapermapHttpServices;
752
1348
  interface Refs {
@@ -802,6 +1398,30 @@ interface PapermapState {
802
1398
  sseIsStreaming: boolean;
803
1399
  sseIsComplete: boolean;
804
1400
  sseError: string | null;
1401
+ /**
1402
+ * Bound to `useAnalyticsStream().submitConfirmation` while an SSE request is active.
1403
+ * Used by `StreamingTimeline` / tool confirmation UI.
1404
+ */
1405
+ sseSubmitConfirmation: ((confirmationId: string, confirmed: boolean, message?: string) => Promise<void>) | null;
1406
+ /** Workspace role: hide bookmark affordances when true. Synced from `PapermapStoreConfig.isViewer`. */
1407
+ isViewer: boolean;
1408
+ /** Column / side-panel layout for `ChatAssistant` (see `PapermapStoreConfig.assistantInline`). */
1409
+ assistantInline: boolean;
1410
+ /**
1411
+ * Bottom toolbar height (PaperChat input strip), measured via ResizeObserver.
1412
+ * Feeds `getAssistantDimensions` expanded height like main app `useChartStore().toolbarHeight`.
1413
+ */
1414
+ toolbarHeight: number;
1415
+ /**
1416
+ * Sheet / floating chart overlay open — mirrors main `sheetChartUiOpen` on `ChatAssistant`
1417
+ * so the inline “Show Chart” chip hides when the overlay is already up.
1418
+ */
1419
+ sheetChartUiOpen: boolean;
1420
+ /**
1421
+ * Registered by `ChatSidePanelInner` so inline `ChatAssistant` can open `FloatingChartOverlay`
1422
+ * instead of only toggling the split chart column.
1423
+ */
1424
+ externalShowChartHandler: ((visible: boolean) => void) | null;
805
1425
  }
806
1426
  interface PapermapActions {
807
1427
  setMessages: (messages: Message[] | ((prev: Message[]) => Message[])) => void;
@@ -825,10 +1445,21 @@ interface PapermapActions {
825
1445
  updateChartVisuals: (v: Record<string, unknown>) => void;
826
1446
  updateLatestChart: (result: unknown) => void;
827
1447
  clearLatestChart: () => void;
1448
+ /**
1449
+ * Merge one chart meta field into `allMeta` (dialog title edits, etc.). Matches main `updateChartMeta` field-wise merge.
1450
+ */
1451
+ patchChartMeta: (key: 'title' | 'description' | 'footer' | 'subtitle', value: string) => void;
828
1452
  setUseSSEStreaming: (v: boolean) => void;
829
1453
  setSseRequestId: (v: string | null) => void;
830
1454
  setSseChatId: (v: string | null) => void;
831
1455
  clearStreamingState: () => void;
1456
+ /** Called from `SSESync` to wire tool Allow/Deny into the analytics stream hook */
1457
+ setSseSubmitConfirmation: (fn: ((confirmationId: string, confirmed: boolean, message?: string) => Promise<void>) | null) => void;
1458
+ setIsViewer: (v: boolean) => void;
1459
+ setAssistantInline: (v: boolean) => void;
1460
+ setToolbarHeight: (v: number) => void;
1461
+ setSheetChartUiOpen: (v: boolean) => void;
1462
+ setExternalShowChartHandler: (fn: ((visible: boolean) => void) | null) => void;
832
1463
  syncSseDisplay: (data: {
833
1464
  thoughts: AgentThought[];
834
1465
  toolCalls: ToolCall[];
@@ -851,6 +1482,8 @@ interface PapermapActions {
851
1482
  getConfig: () => PapermapStoreConfig;
852
1483
  }
853
1484
  type PapermapStore = PapermapState & PapermapActions;
1485
+ /** Default assistant bubble when a thread has no messages yet (API empty or before load). */
1486
+ declare const PAPERMAP_CHAT_GREETING_MESSAGE: Message;
854
1487
  declare function createPapermapStore(config: PapermapStoreConfig, injectedServices?: PapermapHttpServices): zustand.StoreApi<PapermapStore>;
855
1488
  type PapermapStoreApi = ReturnType<typeof createPapermapStore>;
856
1489
  interface OpenPapermapChatAssistantOptions {
@@ -876,7 +1509,7 @@ interface OpenPapermapChatAssistantOptions {
876
1509
  * open in edit mode for that chart.
877
1510
  *
878
1511
  * When chart is provided (e.g. from ChartCard), primes the store like the main
879
- * app openEditChartModal: setMessages([]), updateAllMeta(chart.meta),
1512
+ * app openEditChartModal: setMessages([greeting]), updateAllMeta(chart.meta),
880
1513
  * updateChartData/Type/Visuals(chart.chart_response), then set editChatId and open.
881
1514
  * ConversationLoader still runs loadConversations() for messages; variant shows
882
1515
  * immediately from chart.meta.
@@ -884,7 +1517,7 @@ interface OpenPapermapChatAssistantOptions {
884
1517
  declare function openPapermapChatAssistant(storeApi: PapermapStoreApi, options?: OpenPapermapChatAssistantOptions): void;
885
1518
 
886
1519
  /** Mirrors `package.json` version; run `npm run sync:sdk-version` or `npm run build` to refresh. */
887
- declare const PAPERMAP_SDK_VERSION: "1.1.0";
1520
+ declare const PAPERMAP_SDK_VERSION: "1.1.1";
888
1521
  /** Contract revision for hosts that gate advanced features; bump only for breaking contract changes. */
889
1522
  declare const PAPERMAP_PLUGIN_CONTRACT_VERSION: 1;
890
1523
  type PapermapCapability = 'chat' | 'charts' | 'dashboard' | 'streaming' | 'workspace' | (string & {});
@@ -941,6 +1574,12 @@ type PapermapConnectionValue = {
941
1574
  };
942
1575
  type PapermapProviderProps = Omit<PapermapStoreConfig, 'observability'> & {
943
1576
  children: React__default.ReactNode;
1577
+ /**
1578
+ * Color scheme for the plugin UI (`light` / `dark` / `system`), matching main-app embedded
1579
+ * `?theme=` and `EmbeddedThemeProvider` (`next-themes` + `document.documentElement` class sync).
1580
+ * Default `light`.
1581
+ */
1582
+ theme?: PapermapColorScheme;
944
1583
  /** Optional structured telemetry; forwarded to the Zustand store and SSE bridge. */
945
1584
  observability?: PapermapObservabilityOptions;
946
1585
  /** Optional plugin manifest + lifecycle (v1 contract). Safe to omit for all existing embeds. */
@@ -953,12 +1592,12 @@ type PapermapProviderProps = Omit<PapermapStoreConfig, 'observability'> & {
953
1592
  * provider creates a **new** Zustand store and **new** `QueryClient`. Chat UI state and TanStack Query
954
1593
  * cache from the previous boundary are not carried over, which avoids stale tenant/workspace data.
955
1594
  *
956
- * **Stable props:** Changing only `initialModel`, `onModelChange`, `observability`, `plugin`, or
1595
+ * **Stable props:** Changing only `initialModel`, `initialChatScroll`, `isViewer`, `assistantInline`, `theme`, `onModelChange`, `observability`, `plugin`, or
957
1596
  * `children` does **not** reset the store or query cache (except `observability.mirrorToConsoleInDev`,
958
1597
  * which recreates the telemetry facade). `onModelChange` / `onTelemetry` / `onError` may be inline —
959
1598
  * the latest callback is always invoked via refs.
960
1599
  */
961
- declare function PapermapProvider({ children, token, workspaceId, dashboardId, apiUrl, initialModel, onModelChange, observability: observabilityProp, plugin, }: PapermapProviderProps): react_jsx_runtime.JSX.Element;
1600
+ declare function PapermapProvider({ children, token, workspaceId, dashboardId, apiUrl, initialModel, initialChatScroll, isViewer, assistantInline, onModelChange, observability: observabilityProp, plugin, theme, }: PapermapProviderProps): react_jsx_runtime.JSX.Element;
962
1601
  declare function usePapermapStore<T>(selector: (state: PapermapStore) => T): T;
963
1602
  /**
964
1603
  * Access the raw store API (for refs, services, imperative calls).
@@ -1008,6 +1647,13 @@ interface UseAnalyticsStreamOptions {
1008
1647
  onError?: (error: string) => void;
1009
1648
  onThought?: (thought: AgentThought) => void;
1010
1649
  onToolCall?: (toolCall: ToolCall) => void;
1650
+ /** HTTP implementation — typically `chartSvc.submitToolConfirmation` from the store */
1651
+ submitToolConfirmationRequest?: (data: {
1652
+ request_id: string;
1653
+ confirmation_id: string;
1654
+ confirmed: boolean;
1655
+ message?: string;
1656
+ }) => Promise<unknown>;
1011
1657
  }
1012
1658
  /**
1013
1659
  * Adapted from papermap's useAnalyticsStream.
@@ -1016,6 +1662,7 @@ interface UseAnalyticsStreamOptions {
1016
1662
  declare function useAnalyticsStream(requestId: string | null, authHeaders: Record<string, string>, apiUrl: string, options?: UseAnalyticsStreamOptions): {
1017
1663
  disconnect: () => void;
1018
1664
  markRequestAsCompleted: (reqId: string) => void;
1665
+ submitConfirmation: (confirmationId: string, confirmed: boolean, message?: string) => Promise<void>;
1019
1666
  thoughts: AgentThought[];
1020
1667
  toolCalls: ToolCall[];
1021
1668
  timeline: TimelineEvent[];
@@ -1078,7 +1725,16 @@ declare const papermapQueryKeys: {
1078
1725
  readonly chartCards: (workspaceId: string, dashboardId: string, apiUrl?: string) => readonly ["papermap", string, "ws", string, "dash", string, "chartCards"];
1079
1726
  readonly dashboardsForWorkspace: (workspaceId: string, apiUrl?: string) => readonly ["papermap", string, "ws", string, "dashboards"];
1080
1727
  readonly workspacesList: (apiUrl?: string) => readonly ["papermap", string, "workspaces", "list"];
1728
+ /** Infinite workspace list with optional search (matches main app workspace selector). */
1729
+ readonly workspacesInfinite: (apiUrl: string | undefined, searchTerm: string | undefined) => readonly ["papermap", string, "workspaces", "infinite", string];
1730
+ /** Paginated dashboards for a workspace with optional search. */
1731
+ readonly dashboardsPaginated: (workspaceId: string | undefined, apiUrl: string | undefined, page: number, perPage: number, searchTerm: string | undefined) => readonly ["papermap", string, "ws", string, "dashboardsPaginated", number, number, string];
1081
1732
  readonly models: (apiUrl: string | undefined, token: string) => readonly ["papermap", string, "models", string];
1733
+ readonly slack: {
1734
+ readonly all: (apiUrl: string | undefined) => readonly ["papermap", string, "slack"];
1735
+ readonly status: (apiUrl: string | undefined) => readonly ["papermap", string, "slack", "status"];
1736
+ readonly workspaceAccess: (apiUrl: string | undefined, teamId: string) => readonly ["papermap", string, "slack", "workspace-access", string];
1737
+ };
1082
1738
  };
1083
1739
 
1084
1740
  interface PaperBoardProps {
@@ -1090,7 +1746,17 @@ interface PaperBoardProps {
1090
1746
  layouts?: PaperBoardLayouts;
1091
1747
  onLayoutsChange?: (layouts: PaperBoardLayouts) => void;
1092
1748
  isEditMode?: boolean;
1749
+ /**
1750
+ * Show the **dashboard** toolbar (generate, screenshot, edit layout, theme, etc.) in the page header.
1751
+ * Main app `TGridDashboard.showToolbar`. Default `true`.
1752
+ */
1093
1753
  showToolbar?: boolean;
1754
+ /**
1755
+ * Show **per-chart** controls (maximize, edit, delete) on each `PaperCard`. Independent of `showToolbar`.
1756
+ * Main app `TGridDashboard.showChatToolbar` on `ChartCard`. When omitted, matches `showToolbar` so
1757
+ * `showToolbar={false}` still hides both toolbars.
1758
+ */
1759
+ showChatToolbar?: boolean;
1094
1760
  showScreenshot?: boolean;
1095
1761
  showGenerateDashboard?: boolean;
1096
1762
  editLayout?: boolean;
@@ -1149,8 +1815,31 @@ interface PaperBoardProps {
1149
1815
  workspaceId: string;
1150
1816
  dashboardId: string;
1151
1817
  }) => void;
1818
+ /** Color scheme when this component creates `PapermapProvider` (embedded `?theme=` parity). */
1819
+ theme?: PapermapColorScheme;
1820
+ /**
1821
+ * When true, render main-app-style top bar (logo, workspace selector, integrations, user)
1822
+ * and tab navigation above the `PageHeader` and grid. Default `false` for embeds; set `true` for full-app chrome.
1823
+ */
1824
+ showAppChrome?: boolean;
1825
+ /**
1826
+ * Override default tab items (Papermap web app deep links with workspace/dashboard query params).
1827
+ * When omitted, items are built from the workspace API entity (see `buildDashboardNavItems`).
1828
+ */
1829
+ navItems?: DashboardNavbarItem[];
1830
+ /** Shown in the user menu; optional when using embed tokens without a user profile. */
1831
+ user?: {
1832
+ name?: string | null;
1833
+ email?: string | null;
1834
+ } | null;
1835
+ onLogout?: () => void;
1836
+ billingHref?: string;
1837
+ settingsHref?: string;
1838
+ /** Default: Papermap web app origin. */
1839
+ logoutUrl?: string;
1840
+ appHeaderRightSlot?: ReactNode;
1152
1841
  }
1153
- declare function PaperBoard({ token, workspaceId, dashboardId, apiUrl, showWorkspaceDashboardSelect, onWorkspaceDashboardChange, ...rest }: PaperBoardProps): react_jsx_runtime.JSX.Element;
1842
+ declare function PaperBoard({ token, workspaceId, dashboardId, apiUrl, theme, showWorkspaceDashboardSelect, onWorkspaceDashboardChange, showAppChrome, navItems: navItemsProp, user: userProp, onLogout, billingHref, settingsHref, logoutUrl, appHeaderRightSlot, ...rest }: PaperBoardProps): react_jsx_runtime.JSX.Element;
1154
1843
 
1155
1844
  declare function readDashboardTourCompleted(key: string): boolean;
1156
1845
  declare function markDashboardTourCompleted(key: string): void;
@@ -1163,6 +1852,23 @@ type BuildDashboardTourStepsOptions = {
1163
1852
  */
1164
1853
  declare function buildDashboardTourSteps({ showToolbar, showChatAssistant, }: BuildDashboardTourStepsOptions): TourStep[];
1165
1854
 
1855
+ type BuildDashboardNavItemsParams = {
1856
+ workspaceId: string;
1857
+ dashboardId: string;
1858
+ /** From workspace entity */
1859
+ workspaceType?: string;
1860
+ /** Present when Google Sheet source exists */
1861
+ sheet?: string;
1862
+ isAdmin?: boolean;
1863
+ /** When true, user is read-only; hides editor-only tabs (matches main app viewer gating). */
1864
+ isViewer: boolean;
1865
+ };
1866
+ /**
1867
+ * Main app: [src/navigation/sidebar/sidebarItems.tsx](papermap/src/navigation/sidebar/sidebarItems.tsx).
1868
+ * Links open the hosted Papermap web app with `workspace_id` / `dashboard_id` query params.
1869
+ */
1870
+ declare function buildDashboardNavItems(params: BuildDashboardNavItemsParams): DashboardNavbarItem[];
1871
+
1166
1872
  type ThemePreset = 'default' | 'lime' | 'blue' | 'green' | 'purple' | 'ocean' | 'sunset' | 'dark' | 'minimal';
1167
1873
 
1168
1874
  type ThemeSaveMeta = {
@@ -1242,4 +1948,4 @@ declare function resolveChartFetchChatId(params: {
1242
1948
  dashboardId?: string;
1243
1949
  }): string | undefined;
1244
1950
 
1245
- export { type AgentThought, AgentThoughtDisplay, BookmarkButton, BranchButton, ButtonWithTooltip, CHART_CARD_CHAT_MAP_KEY, CHAT_MODAL_TAB, type ChartCardIdLink, type ChartCardStorageNamespace, type ChartDataRow, ChartDialog, ChartHistory, type ChartResponse, ChartView, type ChartVisualizationConfig, ChatAssistant, type ChatModalTabType, type ConversationHistory, type DashboardNavbarItem, DashboardTabNavigation, type DashboardTabNavigationProps, type DashboardTheme, DataTable, type DecodedToken, FeedbackButtons, type FinalResponse, type JsonObject, LogoStandAlone, type Message, type MessageProgressEvent, ModelSelector, MorphGradient, type OpenPapermapChatAssistantOptions, PAPERMAP_PLUGIN_CONTRACT_VERSION, PAPERMAP_SDK_VERSION, PaperBoard, type TLayout as PaperBoardLayoutItem, type PaperBoardLayouts, PaperCard, type PaperCardProps, PaperChat, type PaperChatProps, PaperDashboardSelect, type PaperDashboardSelectProps, type PapermapActions, type PapermapCapability, PapermapProvider as PapermapConfigProvider, type PapermapConnectionValue, type PapermapHttpServices, type PapermapObservability, type PapermapObservabilityOptions, type PapermapPluginContext, type PapermapPluginLifecycle, type PapermapPluginManifest, type PapermapPluginRegistration, PapermapProvider, type PapermapState, type PapermapStore, type PapermapStoreApi, type PapermapStoreConfig, type PapermapTelemetryEvent, type PapermapTelemetryLevel, RecentConversations, SavedMemory, type StreamState, StreamingChartDialog, StreamingChatPanel, StreamingTimeline, type TChartMeta$1 as TChartMeta, type TChartResponse, ThemeCustomizationSettings, type ThemeCustomizationSettingsProps, type ThemePreset, type ThemeSaveMeta, type TimelineEvent, type ToolCall, ToolCallDisplay, type TourStep, type UseTourOptions, type WorkspaceEntity, type WorkspaceMeta, buildAuthHeaders, buildDashboardTourSteps, checkPluginPeerCompatibility, createApiClient, createPapermapObservability, createPapermapServices, createPapermapStore, createPluginContext, decodeToken, defaultTheme, getChartCardIdLink, markDashboardTourCompleted, openPapermapChatAssistant, papermapApiBaseSegment, papermapQueryKeys, parseSemverPrefix, presetDisplayNames, readDashboardTourCompleted, removeChartCardIdLink, resolveChartFetchChatId, resolveDashboardThemeFromWorkspace, themePresetList, themePresets, unwrapWorkspacePayload, upsertChartCardIdLink, useAnalyticsStream, useAutoFade, useAutoResize, useKeyboardShortcuts, usePapermapConnection, usePapermapConnectionOptional, usePapermapStore, usePapermapStoreApi, usePapermapStoreApiOptional, useTour };
1951
+ export { type AgentThought, AgentThoughtDisplay, BookmarkButton, BranchButton, type BuildDashboardNavItemsParams, ButtonWithTooltip, CHART_CARD_CHAT_MAP_KEY, CHAT_MODAL_TAB, type ChartCardIdLink, type ChartCardStorageNamespace, type ChartDataRow, ChartDialog, ChartHistory, type ChartResponse, ChartView, type ChartVisualizationConfig, ChatAssistant, type ChatModalTabType, ChatSidePanel, type ConversationHistory, CreateDashboardDialog, type CreateDashboardDialogProps, CreateUnifiedWorkspaceDialog, type CreateUnifiedWorkspaceDialogProps, type CreatedDashboard, type CreatedUnifiedWorkspace, DashboardAppHeader, type DashboardNavbarItem, DashboardTabNavigation, type DashboardTabNavigationProps, type DashboardTheme, DataTable, type DecodedToken, FeedbackButtons, type FinalResponse, FloatingChartOverlay, IntegrationsBar, type JsonObject, LogoStandAlone, type Message, type MessageProgressEvent, ModelSelector, MorphGradient, type OpenPapermapChatAssistantOptions, PAPERMAP_CHAT_GREETING_MESSAGE, PAPERMAP_PLUGIN_CONTRACT_VERSION, PAPERMAP_SDK_VERSION, PaperBoard, type TLayout as PaperBoardLayoutItem, type PaperBoardLayouts, PaperCard, type PaperCardProps, PaperChat, type PaperChatAvatars, PaperChatDialogInner, type PaperChatDialogInnerProps, type PaperChatDialogLauncherPosition, PaperChatFloatingChartOverlay, type PaperChatFloatingChartOverlayProps, type PaperChatProps, PaperChatSidePanel, type PaperChatSidePanelProps, type PaperChatSidePosition, type PaperChatVariant, PaperDashboardSelect, type PaperDashboardSelectProps, type PapermapActions, type PapermapCapability, type PapermapColorScheme, PapermapProvider as PapermapConfigProvider, type PapermapConnectionValue, type PapermapHttpServices, type PapermapObservability, type PapermapObservabilityOptions, type PapermapPluginContext, type PapermapPluginLifecycle, type PapermapPluginManifest, type PapermapPluginRegistration, PapermapProvider, type PapermapState, type PapermapStore, type PapermapStoreApi, type PapermapStoreConfig, type PapermapTelemetryEvent, type PapermapTelemetryLevel, RecentConversations, SavedMemory, type StreamState, StreamingChartDialog, StreamingChatPanel, StreamingTimeline, type TChartMeta$1 as TChartMeta, type TChartResponse, ThemeCustomizationSettings, type ThemeCustomizationSettingsProps, type ThemePreset, type ThemeSaveMeta, type TimelineEvent, type ToolCall, ToolCallDisplay, type TourStep, type UseTourOptions, UserNav, type WorkspaceEntity, type WorkspaceMeta, WorkspaceSelector, type WorkspaceSelectorControl, WorkspaceSelectorProvider, buildAuthHeaders, buildDashboardNavItems, buildDashboardTourSteps, checkPluginPeerCompatibility, createApiClient, createPapermapObservability, createPapermapServices, createPapermapStore, createPluginContext, decodeToken, defaultTheme, getChartCardIdLink, markDashboardTourCompleted, openPapermapChatAssistant, papermapApiBaseSegment, papermapQueryKeys, parseSemverPrefix, presetDisplayNames, readDashboardTourCompleted, removeChartCardIdLink, resolveChartFetchChatId, resolveDashboardThemeFromWorkspace, themePresetList, themePresets, unwrapWorkspacePayload, upsertChartCardIdLink, useAnalyticsStream, useAutoFade, useAutoResize, useKeyboardShortcuts, usePapermapConnection, usePapermapConnectionOptional, usePapermapStore, usePapermapStoreApi, usePapermapStoreApiOptional, useTour };