@arbidocs/blocks 0.3.115 → 0.3.117

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
@@ -2,11 +2,11 @@ import { UseBoundStore, StoreApi } from 'zustand';
2
2
  import * as react from 'react';
3
3
  import react__default, { ReactNode } from 'react';
4
4
  import * as _arbidocs_react from '@arbidocs/react';
5
- import { AiRunOptions, useArbi, AiTaskStatus } from '@arbidocs/react';
5
+ import { AiRunOptions, UserMenuItem, NotifyVariant, useArbi, AiTaskStatus } from '@arbidocs/react';
6
6
  export { AiRunOptions, AiTaskStatus, ArtifactEvent, SearchChunk, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, redlineStats, textToArtifact, toRedlineMarkdown } from '@arbidocs/react';
7
7
  import { ColDef, GridOptions, GridApi, CellValueChangedEvent, GridState } from 'ag-grid-community';
8
8
  import { LucideIcon } from 'lucide-react';
9
- import { Data, Config, CustomField, Field, ComponentConfig } from '@measured/puck';
9
+ import { CustomField, Field, ComponentConfig, Data, Config } from '@measured/puck';
10
10
 
11
11
  /**
12
12
  * The reusable AI-native law-firm prompt library.
@@ -296,6 +296,10 @@ type ConnectionStatus = 'demo' | 'disconnected' | 'connecting' | 'authenticated'
296
296
  interface ArbiUser {
297
297
  name: string;
298
298
  email: string;
299
+ /** The user's external_id (usr-…), when known (live sessions). */
300
+ externalId?: string;
301
+ /** Avatar image URL / data-URL from the backend profile, when set. */
302
+ picture?: string | null;
299
303
  }
300
304
  /** A retrieval-augmented answer step surfaced from the agent loop. */
301
305
  interface AssistantStep {
@@ -1082,6 +1086,64 @@ interface AppNavSection {
1082
1086
  items: AppNavItem[];
1083
1087
  }
1084
1088
 
1089
+ interface AppShellProps {
1090
+ /** Nav sections to render (already filtered/ordered by the app). */
1091
+ sections: AppNavSection[];
1092
+ /** Footer nav items pinned to the bottom of the sidebar (e.g. Settings). */
1093
+ footerItems?: AppNavItem[];
1094
+ /** Brand mark shown in the sidebar header. */
1095
+ logo?: ReactNode;
1096
+ /** Where the logo links to (omit to render the logo without a link). */
1097
+ logoHref?: string;
1098
+ logoLabel?: string;
1099
+ /** Extra content below the footer nav (e.g. a connection-status pill). */
1100
+ sidebarFooter?: ReactNode;
1101
+ /** Topbar content, rendered to the right of the mobile hamburger. */
1102
+ topbar?: ReactNode;
1103
+ /** Optional docked panel on the far right (e.g. an AI chat rail). */
1104
+ rightRail?: ReactNode;
1105
+ /** Main scroll region content (typically a router `<Outlet/>` wrapper). */
1106
+ children: ReactNode;
1107
+ /** Extra classes for the `<main>` scroll region (e.g. a slim-scrollbar util). */
1108
+ mainClassName?: string;
1109
+ /** Testid namespace for the shell/topbar/sidebar. Default "app". */
1110
+ testIdPrefix?: string;
1111
+ }
1112
+ declare function AppShell({ sections, footerItems, logo, logoHref, logoLabel, sidebarFooter, topbar, rightRail, children, mainClassName, testIdPrefix, }: AppShellProps): react.JSX.Element;
1113
+
1114
+ interface AppHeaderUser {
1115
+ name: string;
1116
+ email?: string | null;
1117
+ picture?: string | null;
1118
+ }
1119
+ interface AppHeaderProps {
1120
+ /** Open the command palette (⌘K). Bound to the search trigger. */
1121
+ onSearch: () => void;
1122
+ /** Open the palette in ask mode (defaults to `onSearch`). */
1123
+ onAsk?: () => void;
1124
+ searchPlaceholder?: string;
1125
+ searchKbd?: string;
1126
+ askLabel?: string;
1127
+ /** Right-cluster content before the action buttons (e.g. a running-timer). */
1128
+ leading?: ReactNode;
1129
+ /** Extra icon buttons between Ask AI and the bell (e.g. a chat toggle). */
1130
+ actions?: ReactNode;
1131
+ user: AppHeaderUser;
1132
+ /** Account actions above sign-out (e.g. Settings). */
1133
+ userItems?: UserMenuItem[];
1134
+ onLogout: () => void;
1135
+ /** Called with a notification's href when an entry is clicked. */
1136
+ onNotificationNavigate?: (href: string) => void;
1137
+ /** Override per-variant notification glyph colours (e.g. brand accent). */
1138
+ notificationTones?: Partial<Record<NotifyVariant, string>>;
1139
+ classNames?: {
1140
+ search?: string;
1141
+ askButton?: string;
1142
+ };
1143
+ testIdPrefix?: string;
1144
+ }
1145
+ declare function AppHeader({ onSearch, onAsk, searchPlaceholder, searchKbd, askLabel, leading, actions, user, userItems, onLogout, onNotificationNavigate, notificationTones, classNames, testIdPrefix, }: AppHeaderProps): react.JSX.Element;
1146
+
1085
1147
  /**
1086
1148
  * Shared studio types — the persistence contract, page metadata and the AI
1087
1149
  * prompt-builder signature the firm supplies. Firm-agnostic: a firm app wires
@@ -1129,6 +1191,95 @@ type BuildPrompt = (a: {
1129
1191
  current: string;
1130
1192
  }) => string;
1131
1193
 
1194
+ interface AiFieldsConfig {
1195
+ /** The marketing workspace the AI grounds on. */
1196
+ workspaceId: string;
1197
+ /** Turns a field's kind/label/current text into an instruction. */
1198
+ buildPrompt: BuildPrompt;
1199
+ /** Default prompt kind when a field does not specify one. */
1200
+ defaultKind?: string;
1201
+ /** Testid namespace for the field + write button. */
1202
+ testIdPrefix?: string;
1203
+ }
1204
+ interface AiFields {
1205
+ aiText: (label: string, placeholder?: string) => CustomField<string>;
1206
+ aiTextarea: (label: string, placeholder?: string, kind?: string) => CustomField<string>;
1207
+ }
1208
+ declare function createAiFields(cfg: AiFieldsConfig): AiFields;
1209
+
1210
+ /**
1211
+ * Shared field helpers for the block registry. Every block config — the built-ins
1212
+ * in {@link createArbiBlocksConfig} and the website blocks in
1213
+ * {@link file://./websiteBlocks.tsx} — builds its Puck fields from this one kit so
1214
+ * the AI-or-plain copy fallback, the icon `select`, the tone/bool radios and the
1215
+ * stable render-time testid are declared once.
1216
+ */
1217
+
1218
+ declare const iconMap: Record<string, LucideIcon>;
1219
+ /** The bundle of field helpers a block config needs. */
1220
+ interface BlockKit {
1221
+ /** Single-line copy: AI-authorable when a firm supplies aiFields, else plain text. */
1222
+ textField: (label: string, placeholder?: string) => Field;
1223
+ /** Multi-line copy: AI-authorable when a firm supplies aiFields, else plain textarea. */
1224
+ textareaField: (label: string, placeholder?: string, kind?: string) => Field;
1225
+ /** Image source: a workspace-asset picker when a firm supplies imageField, else a URL input. */
1226
+ imageField: (label: string) => Field;
1227
+ /** A Yes/No radio. */
1228
+ boolRadio: (label: string) => Field;
1229
+ /** A `select` over {@link iconMap} names. */
1230
+ iconField: (label?: string) => Field;
1231
+ /** Resolve an icon name to its Lucide component. */
1232
+ resolveIcon: (name?: string) => LucideIcon | undefined;
1233
+ /** Stable, e2e-locatable testid derived from a block's Puck id. */
1234
+ blockTestId: (id: string) => string;
1235
+ /**
1236
+ * Optional firm override for the eyebrow style on heading-bearing blocks
1237
+ * (Hero, Section heading). Lets a consumer render a brand accent (e.g. a brass
1238
+ * eyebrow) without forking the blocks. Undefined → the default token classes.
1239
+ */
1240
+ eyebrowClassName?: string;
1241
+ }
1242
+ /** Build the shared field helpers, closing over the firm's optional AI + image fields. */
1243
+ declare function createBlockKit(ai?: AiFields, image?: (label: string) => Field, eyebrowClassName?: string): BlockKit;
1244
+
1245
+ /**
1246
+ * Live-widget block factory for @arbidocs/blocks.
1247
+ *
1248
+ * Mirrors the other `create*Blocks` factories: it only WIRES pre-built block
1249
+ * components (from {@link ./liveWidgetRuntime}) into Puck `ComponentConfig`s, so
1250
+ * it exports a single function and defines no components of its own — keeping it
1251
+ * fast-refresh clean. The blocks gate on the live-data flag ({@link ./liveData}),
1252
+ * rendering real ARBI data inside an authenticated app tree and a placeholder in
1253
+ * the editor/public. They read the SHARED `@arbidocs/react` hooks, so any client
1254
+ * with an ARBI workspace gets them; a client supplies only *composition* via
1255
+ * `createArbiBlocksConfig({ liveWidgets: true })`.
1256
+ */
1257
+
1258
+ /**
1259
+ * Build the live-widget block set, closing over the shared {@link BlockKit} for
1260
+ * stable testids. Registered under a "Widgets" category when a consumer opts in
1261
+ * with `createArbiBlocksConfig({ liveWidgets: true })`.
1262
+ */
1263
+ declare function createLiveWidgets(kit: BlockKit): Record<string, ComponentConfig>;
1264
+
1265
+ /** Marks the subtree as an authenticated app tree, so live widgets resolve data. */
1266
+ declare function LiveDataProvider({ children }: {
1267
+ children: ReactNode;
1268
+ }): react.JSX.Element;
1269
+ /**
1270
+ * What a live widget shows when it can't (or shouldn't) resolve data: a labelled,
1271
+ * dashed card. Used in the Studio canvas and the public renderer so authoring a
1272
+ * dashboard is WYSIWYG-ish without leaking live back-office data.
1273
+ */
1274
+ declare function WidgetPlaceholder({ label, icon: Icon, testId, }: {
1275
+ label: string;
1276
+ icon?: LucideIcon;
1277
+ testId?: string;
1278
+ }): react.JSX.Element;
1279
+
1280
+ /** Whether live widgets may resolve backend data here (false in editor/public). */
1281
+ declare function useLiveDataActive(): boolean;
1282
+
1132
1283
  /**
1133
1284
  * Publish-time asset materialization.
1134
1285
  *
@@ -1207,8 +1358,27 @@ interface PageRendererProps {
1207
1358
  body: string;
1208
1359
  };
1209
1360
  testIdPrefix?: string;
1361
+ /**
1362
+ * Render inside a {@link LiveDataProvider}, so live-widget blocks resolve real
1363
+ * ARBI data. Only pass this when mounting the renderer INSIDE the authenticated
1364
+ * app tree (providers + a selected workspace present); on the public site leave
1365
+ * it off and widgets render placeholders.
1366
+ */
1367
+ liveData?: boolean;
1368
+ /**
1369
+ * Render this page verbatim instead of loading a slug from persistence — for an
1370
+ * in-code page (e.g. a config-authored in-app board) that isn't a published
1371
+ * studio document. The slug is ignored.
1372
+ */
1373
+ initialData?: Data;
1374
+ /**
1375
+ * Apply the persisted studio theme to the document (default true). Turn OFF for
1376
+ * an in-app renderer so it keeps the ambient app theme instead of repainting the
1377
+ * whole document with the marketing palette.
1378
+ */
1379
+ applyTheme?: boolean;
1210
1380
  }
1211
- declare function PageRenderer({ config, persistence, defaultTheme, live, slug: slugProp, emptyState, testIdPrefix, }: PageRendererProps): react.JSX.Element;
1381
+ declare function PageRenderer({ config, persistence, defaultTheme, live, slug: slugProp, emptyState, testIdPrefix, liveData, initialData, applyTheme, }: PageRendererProps): react.JSX.Element;
1212
1382
 
1213
1383
  interface StudioPersistenceConfig {
1214
1384
  /** The public marketing workspace that backs the site builder. */
@@ -1228,22 +1398,6 @@ interface StudioPersistenceConfig {
1228
1398
  }
1229
1399
  declare function createStudioPersistence(cfg: StudioPersistenceConfig): StudioPersistence;
1230
1400
 
1231
- interface AiFieldsConfig {
1232
- /** The marketing workspace the AI grounds on. */
1233
- workspaceId: string;
1234
- /** Turns a field's kind/label/current text into an instruction. */
1235
- buildPrompt: BuildPrompt;
1236
- /** Default prompt kind when a field does not specify one. */
1237
- defaultKind?: string;
1238
- /** Testid namespace for the field + write button. */
1239
- testIdPrefix?: string;
1240
- }
1241
- interface AiFields {
1242
- aiText: (label: string, placeholder?: string) => CustomField<string>;
1243
- aiTextarea: (label: string, placeholder?: string, kind?: string) => CustomField<string>;
1244
- }
1245
- declare function createAiFields(cfg: AiFieldsConfig): AiFields;
1246
-
1247
1401
  interface ImageFieldConfig {
1248
1402
  /** The workspace uploads/generations are saved to, and assets are picked from. */
1249
1403
  workspaceId: string;
@@ -1307,41 +1461,6 @@ interface SectionProps {
1307
1461
  }
1308
1462
  declare function Section({ children, tone, padding, maxWidth, texture, className, }: SectionProps): react.JSX.Element;
1309
1463
 
1310
- /**
1311
- * Shared field helpers for the block registry. Every block config — the built-ins
1312
- * in {@link createArbiBlocksConfig} and the website blocks in
1313
- * {@link file://./websiteBlocks.tsx} — builds its Puck fields from this one kit so
1314
- * the AI-or-plain copy fallback, the icon `select`, the tone/bool radios and the
1315
- * stable render-time testid are declared once.
1316
- */
1317
-
1318
- declare const iconMap: Record<string, LucideIcon>;
1319
- /** The bundle of field helpers a block config needs. */
1320
- interface BlockKit {
1321
- /** Single-line copy: AI-authorable when a firm supplies aiFields, else plain text. */
1322
- textField: (label: string, placeholder?: string) => Field;
1323
- /** Multi-line copy: AI-authorable when a firm supplies aiFields, else plain textarea. */
1324
- textareaField: (label: string, placeholder?: string, kind?: string) => Field;
1325
- /** Image source: a workspace-asset picker when a firm supplies imageField, else a URL input. */
1326
- imageField: (label: string) => Field;
1327
- /** A Yes/No radio. */
1328
- boolRadio: (label: string) => Field;
1329
- /** A `select` over {@link iconMap} names. */
1330
- iconField: (label?: string) => Field;
1331
- /** Resolve an icon name to its Lucide component. */
1332
- resolveIcon: (name?: string) => LucideIcon | undefined;
1333
- /** Stable, e2e-locatable testid derived from a block's Puck id. */
1334
- blockTestId: (id: string) => string;
1335
- /**
1336
- * Optional firm override for the eyebrow style on heading-bearing blocks
1337
- * (Hero, Section heading). Lets a consumer render a brand accent (e.g. a brass
1338
- * eyebrow) without forking the blocks. Undefined → the default token classes.
1339
- */
1340
- eyebrowClassName?: string;
1341
- }
1342
- /** Build the shared field helpers, closing over the firm's optional AI + image fields. */
1343
- declare function createBlockKit(ai?: AiFields, image?: (label: string) => Field, eyebrowClassName?: string): BlockKit;
1344
-
1345
1464
  interface ArbiBlocksConfigOptions {
1346
1465
  /**
1347
1466
  * Firm AI fields from {@link createAiFields}. When present, every string copy
@@ -1370,6 +1489,14 @@ interface ArbiBlocksConfigOptions {
1370
1489
  * heading) — e.g. a brand accent like a brass eyebrow. Undefined → token default.
1371
1490
  */
1372
1491
  eyebrowClassName?: string;
1492
+ /**
1493
+ * Register the live-widget blocks (a "Widgets" category) that read shared ARBI
1494
+ * hooks — Agent activity, Live metric. They render placeholders in the editor
1495
+ * and on the public site, resolving real data only inside an authenticated
1496
+ * in-app renderer (`PageRenderer liveData`). Opt-in so a pure marketing builder
1497
+ * doesn't surface back-office widgets.
1498
+ */
1499
+ liveWidgets?: boolean;
1373
1500
  }
1374
1501
 
1375
1502
  declare function createArbiBlocksConfig(opts?: ArbiBlocksConfigOptions): Config;
@@ -1563,4 +1690,4 @@ interface AgentsPanelProps {
1563
1690
  }
1564
1691
  declare function AgentsPanel({ store, testIdPrefix }: AgentsPanelProps): react.JSX.Element;
1565
1692
 
1566
- export { ASSET_REF_PREFIX, Accordion, type AccordionItem, type AccordionProps, type AgentSelectionStore, AgentsPanel, type AgentsPanelProps, type AiFields, type AiFieldsConfig, type AppNavItem, type AppNavSection, type ApplyThemeOptions, type ArbiBlocksConfigOptions, type ArbiMode, type ArbiUser, type AssetMaterializer, AssetResolverProvider, type AssistantCitation, type AssistantMessage, type AssistantStep, AvatarBlock, type AvatarBlockProps, Banner, type BannerProps, type BannerTone, BlockImage, type BlockImageProps, type BlockKit, type BuildPrompt, type BuilderModule, CTABanner, type CTABannerProps, Callout, type CalloutProps, type CalloutVariant, type ColorToken, type Column, Columns, type ColumnsProps, ConnectionProvider, type ConnectionStatus, type ContactField, ContactForm, type ContactFormProps, Container, type ContainerProps, DataTable, DataTableBlock, type DataTableBlockColumn, type DataTableBlockProps, EmptyState, type ExportedModule, FAQ, type FAQProps, type FaqItem, FeatureGrid, type FeatureGridProps, type FeatureItem, type FirmArbiConfig, Footer, type FooterColumn, type FooterLink, type FooterProps, Gallery, type GalleryImage, type GalleryProps, GridView, type GridViewEmptyState, type GridViewProps, type GridViewSelection, Hero, type HeroCta, type HeroProps, type ImageFieldConfig, type ImageFieldFactory, LegalArbiProvider, ListBlock, type ListBlockProps, type ListItem, type LoadResult, LogoCloud, type LogoCloudProps, type LogoItem, type MaterializeOptions, type MatterContext, MediaText, type MediaTextProps, MetricCard, type MetricCardProps, ModuleManager, type ModuleManagerProps, type ModuleRegistry, type ModuleStoreBundle, type NavLink, Navbar, type NavbarProps, PageHeader, PageRenderer, type PageRendererProps, type PersistVia, type PricingPlan, PricingTable, type PricingTableProps, type PromptConfig, type PromptLibrary, type Prompts, type ResolvedModule, RichTextBlock, type RichTextBlockProps, Section, SectionHeading, type SectionProps, Spacer, type SpacerProps, StatGroup, type StatGroupProps, type StatItem, type StepItem, Steps, type StepsProps, StudioEditor, type StudioEditorProps, type StudioPageMeta, type StudioPersistence, type StudioPersistenceConfig, THEME_STYLE_ID, type TabItem, Tabs, type TabsProps, TeamGrid, type TeamGridProps, type TeamMember, Testimonial, TestimonialGrid, type TestimonialGridProps, type TestimonialItem, type TestimonialProps, type ThemeBundle, ThemeEditor, type ThemeEditorProps, type ThemeEmitMode, type ThemeFonts, type ThemePreset, type ThemeState, type ThemeStoreConfig, type ThemeTokens, Toolbar, type UseImageGen, VerticalBuilder, type VerticalBuilderProps, type VerticalConfig, type VerticalExport, type VerticalExportConfig, type VideoAspect, VideoEmbed, type VideoEmbedProps, applyStoredTheme, applyThemeVars, asAssetRef, assetRefId, clearThemeVars, createAgentSelectionStore, createAiFields, createArbiBlocksConfig, createArbiMaterializer, createBlockKit, createImageField, createModuleRegistry, createModuleStore, createPromptLibrary, createSiteBlocks, createStudioPersistence, createThemeStore, createVerticalExport, createWebsiteBlocks, daysUntil, fmtDate, fmtDateTime, fromNow, gbp, hrs, iconMap, initials, isAssetRef, isAuthenticated, materializePageData, matterToContext, pct, tid, toEmbedUrl, toHslTriplet, useAssetResolverActive, useConnection, useFirmAiTask, useImageGen, useSemanticSearch, useWorkspaceDocs };
1693
+ export { ASSET_REF_PREFIX, Accordion, type AccordionItem, type AccordionProps, type AgentSelectionStore, AgentsPanel, type AgentsPanelProps, type AiFields, type AiFieldsConfig, AppHeader, type AppHeaderProps, type AppHeaderUser, type AppNavItem, type AppNavSection, AppShell, type AppShellProps, type ApplyThemeOptions, type ArbiBlocksConfigOptions, type ArbiMode, type ArbiUser, type AssetMaterializer, AssetResolverProvider, type AssistantCitation, type AssistantMessage, type AssistantStep, AvatarBlock, type AvatarBlockProps, Banner, type BannerProps, type BannerTone, BlockImage, type BlockImageProps, type BlockKit, type BuildPrompt, type BuilderModule, CTABanner, type CTABannerProps, Callout, type CalloutProps, type CalloutVariant, type ColorToken, type Column, Columns, type ColumnsProps, ConnectionProvider, type ConnectionStatus, type ContactField, ContactForm, type ContactFormProps, Container, type ContainerProps, DataTable, DataTableBlock, type DataTableBlockColumn, type DataTableBlockProps, EmptyState, type ExportedModule, FAQ, type FAQProps, type FaqItem, FeatureGrid, type FeatureGridProps, type FeatureItem, type FirmArbiConfig, Footer, type FooterColumn, type FooterLink, type FooterProps, Gallery, type GalleryImage, type GalleryProps, GridView, type GridViewEmptyState, type GridViewProps, type GridViewSelection, Hero, type HeroCta, type HeroProps, type ImageFieldConfig, type ImageFieldFactory, LegalArbiProvider, ListBlock, type ListBlockProps, type ListItem, LiveDataProvider, type LoadResult, LogoCloud, type LogoCloudProps, type LogoItem, type MaterializeOptions, type MatterContext, MediaText, type MediaTextProps, MetricCard, type MetricCardProps, ModuleManager, type ModuleManagerProps, type ModuleRegistry, type ModuleStoreBundle, type NavLink, Navbar, type NavbarProps, PageHeader, PageRenderer, type PageRendererProps, type PersistVia, type PricingPlan, PricingTable, type PricingTableProps, type PromptConfig, type PromptLibrary, type Prompts, type ResolvedModule, RichTextBlock, type RichTextBlockProps, Section, SectionHeading, type SectionProps, Spacer, type SpacerProps, StatGroup, type StatGroupProps, type StatItem, type StepItem, Steps, type StepsProps, StudioEditor, type StudioEditorProps, type StudioPageMeta, type StudioPersistence, type StudioPersistenceConfig, THEME_STYLE_ID, type TabItem, Tabs, type TabsProps, TeamGrid, type TeamGridProps, type TeamMember, Testimonial, TestimonialGrid, type TestimonialGridProps, type TestimonialItem, type TestimonialProps, type ThemeBundle, ThemeEditor, type ThemeEditorProps, type ThemeEmitMode, type ThemeFonts, type ThemePreset, type ThemeState, type ThemeStoreConfig, type ThemeTokens, Toolbar, type UseImageGen, VerticalBuilder, type VerticalBuilderProps, type VerticalConfig, type VerticalExport, type VerticalExportConfig, type VideoAspect, VideoEmbed, type VideoEmbedProps, WidgetPlaceholder, applyStoredTheme, applyThemeVars, asAssetRef, assetRefId, clearThemeVars, createAgentSelectionStore, createAiFields, createArbiBlocksConfig, createArbiMaterializer, createBlockKit, createImageField, createLiveWidgets, createModuleRegistry, createModuleStore, createPromptLibrary, createSiteBlocks, createStudioPersistence, createThemeStore, createVerticalExport, createWebsiteBlocks, daysUntil, fmtDate, fmtDateTime, fromNow, gbp, hrs, iconMap, initials, isAssetRef, isAuthenticated, materializePageData, matterToContext, pct, tid, toEmbedUrl, toHslTriplet, useAssetResolverActive, useConnection, useFirmAiTask, useImageGen, useLiveDataActive, useSemanticSearch, useWorkspaceDocs };
package/dist/index.d.ts CHANGED
@@ -2,11 +2,11 @@ import { UseBoundStore, StoreApi } from 'zustand';
2
2
  import * as react from 'react';
3
3
  import react__default, { ReactNode } from 'react';
4
4
  import * as _arbidocs_react from '@arbidocs/react';
5
- import { AiRunOptions, useArbi, AiTaskStatus } from '@arbidocs/react';
5
+ import { AiRunOptions, UserMenuItem, NotifyVariant, useArbi, AiTaskStatus } from '@arbidocs/react';
6
6
  export { AiRunOptions, AiTaskStatus, ArtifactEvent, SearchChunk, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, redlineStats, textToArtifact, toRedlineMarkdown } from '@arbidocs/react';
7
7
  import { ColDef, GridOptions, GridApi, CellValueChangedEvent, GridState } from 'ag-grid-community';
8
8
  import { LucideIcon } from 'lucide-react';
9
- import { Data, Config, CustomField, Field, ComponentConfig } from '@measured/puck';
9
+ import { CustomField, Field, ComponentConfig, Data, Config } from '@measured/puck';
10
10
 
11
11
  /**
12
12
  * The reusable AI-native law-firm prompt library.
@@ -296,6 +296,10 @@ type ConnectionStatus = 'demo' | 'disconnected' | 'connecting' | 'authenticated'
296
296
  interface ArbiUser {
297
297
  name: string;
298
298
  email: string;
299
+ /** The user's external_id (usr-…), when known (live sessions). */
300
+ externalId?: string;
301
+ /** Avatar image URL / data-URL from the backend profile, when set. */
302
+ picture?: string | null;
299
303
  }
300
304
  /** A retrieval-augmented answer step surfaced from the agent loop. */
301
305
  interface AssistantStep {
@@ -1082,6 +1086,64 @@ interface AppNavSection {
1082
1086
  items: AppNavItem[];
1083
1087
  }
1084
1088
 
1089
+ interface AppShellProps {
1090
+ /** Nav sections to render (already filtered/ordered by the app). */
1091
+ sections: AppNavSection[];
1092
+ /** Footer nav items pinned to the bottom of the sidebar (e.g. Settings). */
1093
+ footerItems?: AppNavItem[];
1094
+ /** Brand mark shown in the sidebar header. */
1095
+ logo?: ReactNode;
1096
+ /** Where the logo links to (omit to render the logo without a link). */
1097
+ logoHref?: string;
1098
+ logoLabel?: string;
1099
+ /** Extra content below the footer nav (e.g. a connection-status pill). */
1100
+ sidebarFooter?: ReactNode;
1101
+ /** Topbar content, rendered to the right of the mobile hamburger. */
1102
+ topbar?: ReactNode;
1103
+ /** Optional docked panel on the far right (e.g. an AI chat rail). */
1104
+ rightRail?: ReactNode;
1105
+ /** Main scroll region content (typically a router `<Outlet/>` wrapper). */
1106
+ children: ReactNode;
1107
+ /** Extra classes for the `<main>` scroll region (e.g. a slim-scrollbar util). */
1108
+ mainClassName?: string;
1109
+ /** Testid namespace for the shell/topbar/sidebar. Default "app". */
1110
+ testIdPrefix?: string;
1111
+ }
1112
+ declare function AppShell({ sections, footerItems, logo, logoHref, logoLabel, sidebarFooter, topbar, rightRail, children, mainClassName, testIdPrefix, }: AppShellProps): react.JSX.Element;
1113
+
1114
+ interface AppHeaderUser {
1115
+ name: string;
1116
+ email?: string | null;
1117
+ picture?: string | null;
1118
+ }
1119
+ interface AppHeaderProps {
1120
+ /** Open the command palette (⌘K). Bound to the search trigger. */
1121
+ onSearch: () => void;
1122
+ /** Open the palette in ask mode (defaults to `onSearch`). */
1123
+ onAsk?: () => void;
1124
+ searchPlaceholder?: string;
1125
+ searchKbd?: string;
1126
+ askLabel?: string;
1127
+ /** Right-cluster content before the action buttons (e.g. a running-timer). */
1128
+ leading?: ReactNode;
1129
+ /** Extra icon buttons between Ask AI and the bell (e.g. a chat toggle). */
1130
+ actions?: ReactNode;
1131
+ user: AppHeaderUser;
1132
+ /** Account actions above sign-out (e.g. Settings). */
1133
+ userItems?: UserMenuItem[];
1134
+ onLogout: () => void;
1135
+ /** Called with a notification's href when an entry is clicked. */
1136
+ onNotificationNavigate?: (href: string) => void;
1137
+ /** Override per-variant notification glyph colours (e.g. brand accent). */
1138
+ notificationTones?: Partial<Record<NotifyVariant, string>>;
1139
+ classNames?: {
1140
+ search?: string;
1141
+ askButton?: string;
1142
+ };
1143
+ testIdPrefix?: string;
1144
+ }
1145
+ declare function AppHeader({ onSearch, onAsk, searchPlaceholder, searchKbd, askLabel, leading, actions, user, userItems, onLogout, onNotificationNavigate, notificationTones, classNames, testIdPrefix, }: AppHeaderProps): react.JSX.Element;
1146
+
1085
1147
  /**
1086
1148
  * Shared studio types — the persistence contract, page metadata and the AI
1087
1149
  * prompt-builder signature the firm supplies. Firm-agnostic: a firm app wires
@@ -1129,6 +1191,95 @@ type BuildPrompt = (a: {
1129
1191
  current: string;
1130
1192
  }) => string;
1131
1193
 
1194
+ interface AiFieldsConfig {
1195
+ /** The marketing workspace the AI grounds on. */
1196
+ workspaceId: string;
1197
+ /** Turns a field's kind/label/current text into an instruction. */
1198
+ buildPrompt: BuildPrompt;
1199
+ /** Default prompt kind when a field does not specify one. */
1200
+ defaultKind?: string;
1201
+ /** Testid namespace for the field + write button. */
1202
+ testIdPrefix?: string;
1203
+ }
1204
+ interface AiFields {
1205
+ aiText: (label: string, placeholder?: string) => CustomField<string>;
1206
+ aiTextarea: (label: string, placeholder?: string, kind?: string) => CustomField<string>;
1207
+ }
1208
+ declare function createAiFields(cfg: AiFieldsConfig): AiFields;
1209
+
1210
+ /**
1211
+ * Shared field helpers for the block registry. Every block config — the built-ins
1212
+ * in {@link createArbiBlocksConfig} and the website blocks in
1213
+ * {@link file://./websiteBlocks.tsx} — builds its Puck fields from this one kit so
1214
+ * the AI-or-plain copy fallback, the icon `select`, the tone/bool radios and the
1215
+ * stable render-time testid are declared once.
1216
+ */
1217
+
1218
+ declare const iconMap: Record<string, LucideIcon>;
1219
+ /** The bundle of field helpers a block config needs. */
1220
+ interface BlockKit {
1221
+ /** Single-line copy: AI-authorable when a firm supplies aiFields, else plain text. */
1222
+ textField: (label: string, placeholder?: string) => Field;
1223
+ /** Multi-line copy: AI-authorable when a firm supplies aiFields, else plain textarea. */
1224
+ textareaField: (label: string, placeholder?: string, kind?: string) => Field;
1225
+ /** Image source: a workspace-asset picker when a firm supplies imageField, else a URL input. */
1226
+ imageField: (label: string) => Field;
1227
+ /** A Yes/No radio. */
1228
+ boolRadio: (label: string) => Field;
1229
+ /** A `select` over {@link iconMap} names. */
1230
+ iconField: (label?: string) => Field;
1231
+ /** Resolve an icon name to its Lucide component. */
1232
+ resolveIcon: (name?: string) => LucideIcon | undefined;
1233
+ /** Stable, e2e-locatable testid derived from a block's Puck id. */
1234
+ blockTestId: (id: string) => string;
1235
+ /**
1236
+ * Optional firm override for the eyebrow style on heading-bearing blocks
1237
+ * (Hero, Section heading). Lets a consumer render a brand accent (e.g. a brass
1238
+ * eyebrow) without forking the blocks. Undefined → the default token classes.
1239
+ */
1240
+ eyebrowClassName?: string;
1241
+ }
1242
+ /** Build the shared field helpers, closing over the firm's optional AI + image fields. */
1243
+ declare function createBlockKit(ai?: AiFields, image?: (label: string) => Field, eyebrowClassName?: string): BlockKit;
1244
+
1245
+ /**
1246
+ * Live-widget block factory for @arbidocs/blocks.
1247
+ *
1248
+ * Mirrors the other `create*Blocks` factories: it only WIRES pre-built block
1249
+ * components (from {@link ./liveWidgetRuntime}) into Puck `ComponentConfig`s, so
1250
+ * it exports a single function and defines no components of its own — keeping it
1251
+ * fast-refresh clean. The blocks gate on the live-data flag ({@link ./liveData}),
1252
+ * rendering real ARBI data inside an authenticated app tree and a placeholder in
1253
+ * the editor/public. They read the SHARED `@arbidocs/react` hooks, so any client
1254
+ * with an ARBI workspace gets them; a client supplies only *composition* via
1255
+ * `createArbiBlocksConfig({ liveWidgets: true })`.
1256
+ */
1257
+
1258
+ /**
1259
+ * Build the live-widget block set, closing over the shared {@link BlockKit} for
1260
+ * stable testids. Registered under a "Widgets" category when a consumer opts in
1261
+ * with `createArbiBlocksConfig({ liveWidgets: true })`.
1262
+ */
1263
+ declare function createLiveWidgets(kit: BlockKit): Record<string, ComponentConfig>;
1264
+
1265
+ /** Marks the subtree as an authenticated app tree, so live widgets resolve data. */
1266
+ declare function LiveDataProvider({ children }: {
1267
+ children: ReactNode;
1268
+ }): react.JSX.Element;
1269
+ /**
1270
+ * What a live widget shows when it can't (or shouldn't) resolve data: a labelled,
1271
+ * dashed card. Used in the Studio canvas and the public renderer so authoring a
1272
+ * dashboard is WYSIWYG-ish without leaking live back-office data.
1273
+ */
1274
+ declare function WidgetPlaceholder({ label, icon: Icon, testId, }: {
1275
+ label: string;
1276
+ icon?: LucideIcon;
1277
+ testId?: string;
1278
+ }): react.JSX.Element;
1279
+
1280
+ /** Whether live widgets may resolve backend data here (false in editor/public). */
1281
+ declare function useLiveDataActive(): boolean;
1282
+
1132
1283
  /**
1133
1284
  * Publish-time asset materialization.
1134
1285
  *
@@ -1207,8 +1358,27 @@ interface PageRendererProps {
1207
1358
  body: string;
1208
1359
  };
1209
1360
  testIdPrefix?: string;
1361
+ /**
1362
+ * Render inside a {@link LiveDataProvider}, so live-widget blocks resolve real
1363
+ * ARBI data. Only pass this when mounting the renderer INSIDE the authenticated
1364
+ * app tree (providers + a selected workspace present); on the public site leave
1365
+ * it off and widgets render placeholders.
1366
+ */
1367
+ liveData?: boolean;
1368
+ /**
1369
+ * Render this page verbatim instead of loading a slug from persistence — for an
1370
+ * in-code page (e.g. a config-authored in-app board) that isn't a published
1371
+ * studio document. The slug is ignored.
1372
+ */
1373
+ initialData?: Data;
1374
+ /**
1375
+ * Apply the persisted studio theme to the document (default true). Turn OFF for
1376
+ * an in-app renderer so it keeps the ambient app theme instead of repainting the
1377
+ * whole document with the marketing palette.
1378
+ */
1379
+ applyTheme?: boolean;
1210
1380
  }
1211
- declare function PageRenderer({ config, persistence, defaultTheme, live, slug: slugProp, emptyState, testIdPrefix, }: PageRendererProps): react.JSX.Element;
1381
+ declare function PageRenderer({ config, persistence, defaultTheme, live, slug: slugProp, emptyState, testIdPrefix, liveData, initialData, applyTheme, }: PageRendererProps): react.JSX.Element;
1212
1382
 
1213
1383
  interface StudioPersistenceConfig {
1214
1384
  /** The public marketing workspace that backs the site builder. */
@@ -1228,22 +1398,6 @@ interface StudioPersistenceConfig {
1228
1398
  }
1229
1399
  declare function createStudioPersistence(cfg: StudioPersistenceConfig): StudioPersistence;
1230
1400
 
1231
- interface AiFieldsConfig {
1232
- /** The marketing workspace the AI grounds on. */
1233
- workspaceId: string;
1234
- /** Turns a field's kind/label/current text into an instruction. */
1235
- buildPrompt: BuildPrompt;
1236
- /** Default prompt kind when a field does not specify one. */
1237
- defaultKind?: string;
1238
- /** Testid namespace for the field + write button. */
1239
- testIdPrefix?: string;
1240
- }
1241
- interface AiFields {
1242
- aiText: (label: string, placeholder?: string) => CustomField<string>;
1243
- aiTextarea: (label: string, placeholder?: string, kind?: string) => CustomField<string>;
1244
- }
1245
- declare function createAiFields(cfg: AiFieldsConfig): AiFields;
1246
-
1247
1401
  interface ImageFieldConfig {
1248
1402
  /** The workspace uploads/generations are saved to, and assets are picked from. */
1249
1403
  workspaceId: string;
@@ -1307,41 +1461,6 @@ interface SectionProps {
1307
1461
  }
1308
1462
  declare function Section({ children, tone, padding, maxWidth, texture, className, }: SectionProps): react.JSX.Element;
1309
1463
 
1310
- /**
1311
- * Shared field helpers for the block registry. Every block config — the built-ins
1312
- * in {@link createArbiBlocksConfig} and the website blocks in
1313
- * {@link file://./websiteBlocks.tsx} — builds its Puck fields from this one kit so
1314
- * the AI-or-plain copy fallback, the icon `select`, the tone/bool radios and the
1315
- * stable render-time testid are declared once.
1316
- */
1317
-
1318
- declare const iconMap: Record<string, LucideIcon>;
1319
- /** The bundle of field helpers a block config needs. */
1320
- interface BlockKit {
1321
- /** Single-line copy: AI-authorable when a firm supplies aiFields, else plain text. */
1322
- textField: (label: string, placeholder?: string) => Field;
1323
- /** Multi-line copy: AI-authorable when a firm supplies aiFields, else plain textarea. */
1324
- textareaField: (label: string, placeholder?: string, kind?: string) => Field;
1325
- /** Image source: a workspace-asset picker when a firm supplies imageField, else a URL input. */
1326
- imageField: (label: string) => Field;
1327
- /** A Yes/No radio. */
1328
- boolRadio: (label: string) => Field;
1329
- /** A `select` over {@link iconMap} names. */
1330
- iconField: (label?: string) => Field;
1331
- /** Resolve an icon name to its Lucide component. */
1332
- resolveIcon: (name?: string) => LucideIcon | undefined;
1333
- /** Stable, e2e-locatable testid derived from a block's Puck id. */
1334
- blockTestId: (id: string) => string;
1335
- /**
1336
- * Optional firm override for the eyebrow style on heading-bearing blocks
1337
- * (Hero, Section heading). Lets a consumer render a brand accent (e.g. a brass
1338
- * eyebrow) without forking the blocks. Undefined → the default token classes.
1339
- */
1340
- eyebrowClassName?: string;
1341
- }
1342
- /** Build the shared field helpers, closing over the firm's optional AI + image fields. */
1343
- declare function createBlockKit(ai?: AiFields, image?: (label: string) => Field, eyebrowClassName?: string): BlockKit;
1344
-
1345
1464
  interface ArbiBlocksConfigOptions {
1346
1465
  /**
1347
1466
  * Firm AI fields from {@link createAiFields}. When present, every string copy
@@ -1370,6 +1489,14 @@ interface ArbiBlocksConfigOptions {
1370
1489
  * heading) — e.g. a brand accent like a brass eyebrow. Undefined → token default.
1371
1490
  */
1372
1491
  eyebrowClassName?: string;
1492
+ /**
1493
+ * Register the live-widget blocks (a "Widgets" category) that read shared ARBI
1494
+ * hooks — Agent activity, Live metric. They render placeholders in the editor
1495
+ * and on the public site, resolving real data only inside an authenticated
1496
+ * in-app renderer (`PageRenderer liveData`). Opt-in so a pure marketing builder
1497
+ * doesn't surface back-office widgets.
1498
+ */
1499
+ liveWidgets?: boolean;
1373
1500
  }
1374
1501
 
1375
1502
  declare function createArbiBlocksConfig(opts?: ArbiBlocksConfigOptions): Config;
@@ -1563,4 +1690,4 @@ interface AgentsPanelProps {
1563
1690
  }
1564
1691
  declare function AgentsPanel({ store, testIdPrefix }: AgentsPanelProps): react.JSX.Element;
1565
1692
 
1566
- export { ASSET_REF_PREFIX, Accordion, type AccordionItem, type AccordionProps, type AgentSelectionStore, AgentsPanel, type AgentsPanelProps, type AiFields, type AiFieldsConfig, type AppNavItem, type AppNavSection, type ApplyThemeOptions, type ArbiBlocksConfigOptions, type ArbiMode, type ArbiUser, type AssetMaterializer, AssetResolverProvider, type AssistantCitation, type AssistantMessage, type AssistantStep, AvatarBlock, type AvatarBlockProps, Banner, type BannerProps, type BannerTone, BlockImage, type BlockImageProps, type BlockKit, type BuildPrompt, type BuilderModule, CTABanner, type CTABannerProps, Callout, type CalloutProps, type CalloutVariant, type ColorToken, type Column, Columns, type ColumnsProps, ConnectionProvider, type ConnectionStatus, type ContactField, ContactForm, type ContactFormProps, Container, type ContainerProps, DataTable, DataTableBlock, type DataTableBlockColumn, type DataTableBlockProps, EmptyState, type ExportedModule, FAQ, type FAQProps, type FaqItem, FeatureGrid, type FeatureGridProps, type FeatureItem, type FirmArbiConfig, Footer, type FooterColumn, type FooterLink, type FooterProps, Gallery, type GalleryImage, type GalleryProps, GridView, type GridViewEmptyState, type GridViewProps, type GridViewSelection, Hero, type HeroCta, type HeroProps, type ImageFieldConfig, type ImageFieldFactory, LegalArbiProvider, ListBlock, type ListBlockProps, type ListItem, type LoadResult, LogoCloud, type LogoCloudProps, type LogoItem, type MaterializeOptions, type MatterContext, MediaText, type MediaTextProps, MetricCard, type MetricCardProps, ModuleManager, type ModuleManagerProps, type ModuleRegistry, type ModuleStoreBundle, type NavLink, Navbar, type NavbarProps, PageHeader, PageRenderer, type PageRendererProps, type PersistVia, type PricingPlan, PricingTable, type PricingTableProps, type PromptConfig, type PromptLibrary, type Prompts, type ResolvedModule, RichTextBlock, type RichTextBlockProps, Section, SectionHeading, type SectionProps, Spacer, type SpacerProps, StatGroup, type StatGroupProps, type StatItem, type StepItem, Steps, type StepsProps, StudioEditor, type StudioEditorProps, type StudioPageMeta, type StudioPersistence, type StudioPersistenceConfig, THEME_STYLE_ID, type TabItem, Tabs, type TabsProps, TeamGrid, type TeamGridProps, type TeamMember, Testimonial, TestimonialGrid, type TestimonialGridProps, type TestimonialItem, type TestimonialProps, type ThemeBundle, ThemeEditor, type ThemeEditorProps, type ThemeEmitMode, type ThemeFonts, type ThemePreset, type ThemeState, type ThemeStoreConfig, type ThemeTokens, Toolbar, type UseImageGen, VerticalBuilder, type VerticalBuilderProps, type VerticalConfig, type VerticalExport, type VerticalExportConfig, type VideoAspect, VideoEmbed, type VideoEmbedProps, applyStoredTheme, applyThemeVars, asAssetRef, assetRefId, clearThemeVars, createAgentSelectionStore, createAiFields, createArbiBlocksConfig, createArbiMaterializer, createBlockKit, createImageField, createModuleRegistry, createModuleStore, createPromptLibrary, createSiteBlocks, createStudioPersistence, createThemeStore, createVerticalExport, createWebsiteBlocks, daysUntil, fmtDate, fmtDateTime, fromNow, gbp, hrs, iconMap, initials, isAssetRef, isAuthenticated, materializePageData, matterToContext, pct, tid, toEmbedUrl, toHslTriplet, useAssetResolverActive, useConnection, useFirmAiTask, useImageGen, useSemanticSearch, useWorkspaceDocs };
1693
+ export { ASSET_REF_PREFIX, Accordion, type AccordionItem, type AccordionProps, type AgentSelectionStore, AgentsPanel, type AgentsPanelProps, type AiFields, type AiFieldsConfig, AppHeader, type AppHeaderProps, type AppHeaderUser, type AppNavItem, type AppNavSection, AppShell, type AppShellProps, type ApplyThemeOptions, type ArbiBlocksConfigOptions, type ArbiMode, type ArbiUser, type AssetMaterializer, AssetResolverProvider, type AssistantCitation, type AssistantMessage, type AssistantStep, AvatarBlock, type AvatarBlockProps, Banner, type BannerProps, type BannerTone, BlockImage, type BlockImageProps, type BlockKit, type BuildPrompt, type BuilderModule, CTABanner, type CTABannerProps, Callout, type CalloutProps, type CalloutVariant, type ColorToken, type Column, Columns, type ColumnsProps, ConnectionProvider, type ConnectionStatus, type ContactField, ContactForm, type ContactFormProps, Container, type ContainerProps, DataTable, DataTableBlock, type DataTableBlockColumn, type DataTableBlockProps, EmptyState, type ExportedModule, FAQ, type FAQProps, type FaqItem, FeatureGrid, type FeatureGridProps, type FeatureItem, type FirmArbiConfig, Footer, type FooterColumn, type FooterLink, type FooterProps, Gallery, type GalleryImage, type GalleryProps, GridView, type GridViewEmptyState, type GridViewProps, type GridViewSelection, Hero, type HeroCta, type HeroProps, type ImageFieldConfig, type ImageFieldFactory, LegalArbiProvider, ListBlock, type ListBlockProps, type ListItem, LiveDataProvider, type LoadResult, LogoCloud, type LogoCloudProps, type LogoItem, type MaterializeOptions, type MatterContext, MediaText, type MediaTextProps, MetricCard, type MetricCardProps, ModuleManager, type ModuleManagerProps, type ModuleRegistry, type ModuleStoreBundle, type NavLink, Navbar, type NavbarProps, PageHeader, PageRenderer, type PageRendererProps, type PersistVia, type PricingPlan, PricingTable, type PricingTableProps, type PromptConfig, type PromptLibrary, type Prompts, type ResolvedModule, RichTextBlock, type RichTextBlockProps, Section, SectionHeading, type SectionProps, Spacer, type SpacerProps, StatGroup, type StatGroupProps, type StatItem, type StepItem, Steps, type StepsProps, StudioEditor, type StudioEditorProps, type StudioPageMeta, type StudioPersistence, type StudioPersistenceConfig, THEME_STYLE_ID, type TabItem, Tabs, type TabsProps, TeamGrid, type TeamGridProps, type TeamMember, Testimonial, TestimonialGrid, type TestimonialGridProps, type TestimonialItem, type TestimonialProps, type ThemeBundle, ThemeEditor, type ThemeEditorProps, type ThemeEmitMode, type ThemeFonts, type ThemePreset, type ThemeState, type ThemeStoreConfig, type ThemeTokens, Toolbar, type UseImageGen, VerticalBuilder, type VerticalBuilderProps, type VerticalConfig, type VerticalExport, type VerticalExportConfig, type VideoAspect, VideoEmbed, type VideoEmbedProps, WidgetPlaceholder, applyStoredTheme, applyThemeVars, asAssetRef, assetRefId, clearThemeVars, createAgentSelectionStore, createAiFields, createArbiBlocksConfig, createArbiMaterializer, createBlockKit, createImageField, createLiveWidgets, createModuleRegistry, createModuleStore, createPromptLibrary, createSiteBlocks, createStudioPersistence, createThemeStore, createVerticalExport, createWebsiteBlocks, daysUntil, fmtDate, fmtDateTime, fromNow, gbp, hrs, iconMap, initials, isAssetRef, isAuthenticated, materializePageData, matterToContext, pct, tid, toEmbedUrl, toHslTriplet, useAssetResolverActive, useConnection, useFirmAiTask, useImageGen, useLiveDataActive, useSemanticSearch, useWorkspaceDocs };