@dtducas/wh-forge-viewer 3.0.0-beta.1 → 3.0.0-beta.2

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.ts CHANGED
@@ -1343,6 +1343,45 @@ declare module '@dtducas/wh-forge-viewer' {
1343
1343
  propertyDatabase: boolean;
1344
1344
  }
1345
1345
 
1346
+ // ── Comments Panel ──────────────────────────────────────────────────────
1347
+
1348
+ export interface ICommentReply {
1349
+ id: string;
1350
+ text: string;
1351
+ authorName?: string;
1352
+ createdAt: number;
1353
+ }
1354
+
1355
+ /** Single comment item displayed in the CommentsPanel */
1356
+ export interface ICommentItem {
1357
+ id: string;
1358
+ text: string;
1359
+ authorName?: string;
1360
+ authorCompany?: string;
1361
+ createdAt: number;
1362
+ status?: 'open' | 'resolved';
1363
+ /** Zero-based page/sheet index this comment is linked to */
1364
+ pageIndex?: number;
1365
+ replies?: ICommentReply[];
1366
+ }
1367
+
1368
+ export interface ICommentsPanelProps {
1369
+ items: ICommentItem[];
1370
+ onClose: () => void;
1371
+ onItemClick?: (id: string) => void;
1372
+ selectedItemId?: string;
1373
+ /** If provided, shows a text input at the bottom for creating new comments */
1374
+ onAddComment?: (text: string) => void;
1375
+ /** If provided, shows a Reply button on each thread */
1376
+ onReplyToComment?: (commentId: string, text: string) => void;
1377
+ /** If provided, shows a Resolve button on open threads */
1378
+ onResolveComment?: (commentId: string) => void;
1379
+ /** If provided, shows a Reopen button on resolved threads */
1380
+ onReopenComment?: (commentId: string) => void;
1381
+ }
1382
+
1383
+ export function CommentsPanel(props: ICommentsPanelProps): JSX.Element;
1384
+
1346
1385
  // ── Markups Panel ─────────────────────────────────────────────────────────
1347
1386
 
1348
1387
  /** Single markup item displayed in the MarkupsPanel */
@@ -1433,11 +1472,17 @@ declare module '@dtducas/wh-forge-viewer' {
1433
1472
  export interface ICollabAdapter {
1434
1473
  broadcastPatches(patches: ICanvasPatch[], room: ICollabRoom): Promise<void>;
1435
1474
  fetchScene(room: ICollabRoom): Promise<IFetchSceneResult>;
1436
- onRemotePatches(room: ICollabRoom, cb: (patches: ICanvasPatch[]) => void): () => void;
1475
+ onRemotePatches(
1476
+ room: ICollabRoom,
1477
+ cb: (patches: ICanvasPatch[]) => void,
1478
+ ): () => void;
1437
1479
  joinRoom(room: ICollabRoom): void | Promise<void>;
1438
1480
  leaveRoom(room: ICollabRoom): void | Promise<void>;
1439
1481
  /** Optional: subscribe to server-initiated full-scene replacements (e.g. version restore). */
1440
- onRemoteSceneReplace?(room: ICollabRoom, cb: (scene: ICanvasMarkupSceneV2) => void): () => void;
1482
+ onRemoteSceneReplace?(
1483
+ room: ICollabRoom,
1484
+ cb: (scene: ICanvasMarkupSceneV2) => void,
1485
+ ): () => void;
1441
1486
  /**
1442
1487
  * Optional: drain the durable outbox for a room.
1443
1488
  * Called after bootstrap to replay unACKed patches from a previous session.
@@ -1447,7 +1492,12 @@ declare module '@dtducas/wh-forge-viewer' {
1447
1492
  onReconnect?(cb: () => void): () => void;
1448
1493
  }
1449
1494
 
1450
- export type TCollabStatus = 'idle' | 'joining' | 'connected' | 'disconnected' | 'error';
1495
+ export type TCollabStatus =
1496
+ | 'idle'
1497
+ | 'joining'
1498
+ | 'connected'
1499
+ | 'disconnected'
1500
+ | 'error';
1451
1501
 
1452
1502
  export interface ICollabStatusEvent {
1453
1503
  status: TCollabStatus;
@@ -1506,6 +1556,24 @@ declare module '@dtducas/wh-forge-viewer' {
1506
1556
  markupItems?: IMarkupPanelItem[];
1507
1557
  /** Called when user clicks a markup row in the Markups panel. */
1508
1558
  onMarkupItemClick?: (id: string) => void;
1559
+ /**
1560
+ * Comment items to display in the Comments side panel.
1561
+ * Build from your server-side comment thread data.
1562
+ * @default []
1563
+ */
1564
+ commentItems?: ICommentItem[];
1565
+ /** Called when user clicks a comment row in the Comments panel. */
1566
+ onCommentItemClick?: (id: string) => void;
1567
+ /** ID of the currently selected comment — highlights the row in the panel. */
1568
+ selectedCommentId?: string;
1569
+ /** If provided, shows a text input at the bottom of the Comments panel for creating new comments. */
1570
+ onAddComment?: (text: string) => void;
1571
+ /** If provided, shows a Reply button on each comment thread. */
1572
+ onReplyToComment?: (commentId: string, text: string) => void;
1573
+ /** If provided, shows a Resolve button on open comment threads. */
1574
+ onResolveComment?: (commentId: string) => void;
1575
+ /** If provided, shows a Reopen button on resolved comment threads. */
1576
+ onReopenComment?: (commentId: string) => void;
1509
1577
  /**
1510
1578
  * Called when a shape is selected or deselected on the canvas.
1511
1579
  * Receives the shape `entityId` on selection, or `null` on deselect / toolbar close.
@@ -1607,7 +1675,10 @@ declare module '@dtducas/wh-forge-viewer' {
1607
1675
  * }
1608
1676
  * ```
1609
1677
  */
1610
- getExportViewablePages?: () => Array<{ pageIndex: number; viewableGuid: string }>;
1678
+ getExportViewablePages?: () => Array<{
1679
+ pageIndex: number;
1680
+ viewableGuid: string;
1681
+ }>;
1611
1682
 
1612
1683
  /**
1613
1684
  * Async callback to fetch canvas-scene/2 data for ALL pages from the server
@@ -1671,6 +1742,81 @@ declare module '@dtducas/wh-forge-viewer' {
1671
1742
  * ```
1672
1743
  */
1673
1744
  exportFontConfig?: IExportFontConfig;
1745
+
1746
+ // ── Submit Reply (consultant-reply mode) ───────────────────────────────
1747
+ /**
1748
+ * When provided, shows the "Submit Reply" button in the sidebar and renders
1749
+ * the SubmitPanel. Pass null/undefined to hide the panel entirely.
1750
+ */
1751
+ submitConfig?: ISubmitConfig;
1752
+ /** When true, the submit panel is read-only (reply already submitted). */
1753
+ submitLocked?: boolean;
1754
+ /** When true, shows "Replaced PDF" badge in the submit panel. */
1755
+ submitReplaced?: boolean;
1756
+ /** Pre-loaded status value from an existing draft. */
1757
+ submitInitialStatus?: string | null;
1758
+ /** Pre-loaded comment from an existing draft. */
1759
+ submitInitialComment?: string;
1760
+ /** Full audit log entries for the submit panel history section. */
1761
+ submitHistory?: IMarkupReplyHistoryEntry[];
1762
+ /** Whether a save is currently in progress. */
1763
+ submitIsSaving?: boolean;
1764
+ /** Error message from the last save attempt. */
1765
+ submitSaveError?: string | null;
1766
+ /** When true, triggers the "Saved ✓" flash on the save button. */
1767
+ submitSavedFlash?: boolean;
1768
+ /** Called with { status, comment, hasMarkup } when user clicks Save Draft. */
1769
+ onSubmitSave?: (payload: ISubmitSavePayload) => void;
1770
+ /**
1771
+ * Async function to check whether markup shapes exist for the given viewableGUID.
1772
+ * Called on save. If omitted, hasMarkup defaults to false.
1773
+ */
1774
+ checkSubmitHasMarkup?: (viewableGUID: string) => Promise<boolean>;
1775
+ /**
1776
+ * Which sidebar panel to open on initial render.
1777
+ * Pass 'submit' to open the Submit Reply panel by default.
1778
+ */
1779
+ defaultActiveSidebarPanel?:
1780
+ | 'sheets'
1781
+ | 'markup'
1782
+ | 'comments'
1783
+ | 'submit'
1784
+ | null;
1785
+ /**
1786
+ * Optional React content rendered at the top of the Markups panel, below the controls bar.
1787
+ * Use to inject per-user/company visibility filter UI into the panel.
1788
+ */
1789
+ markupsPanelExtraContent?: React.ReactNode;
1790
+ }
1791
+
1792
+ /** One entry in the audit log for a markup reply. */
1793
+ export interface IMarkupReplyHistoryEntry {
1794
+ status: string | null;
1795
+ comment: string;
1796
+ hasMarkup: boolean;
1797
+ savedAt: string;
1798
+ savedBy: string;
1799
+ savedByName?: string;
1800
+ }
1801
+
1802
+ /** Configuration for the consultant reply Submit panel. */
1803
+ export interface ISubmitConfig {
1804
+ drawingItemId: string;
1805
+ rfaRef: string;
1806
+ rev: string;
1807
+ companyId: string;
1808
+ companyShortName: string;
1809
+ s3KeyPdf: string;
1810
+ statusOptions: string[];
1811
+ /** Map of status label → hex color for the custom dropdown. */
1812
+ statusColors?: Record<string, string>;
1813
+ }
1814
+
1815
+ /** Payload passed to onSubmitSave when user saves a draft reply. */
1816
+ export interface ISubmitSavePayload {
1817
+ status: string | null;
1818
+ comment: string;
1819
+ hasMarkup: boolean;
1674
1820
  }
1675
1821
 
1676
1822
  /**