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

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