From 2c0200c45fa9f4f22eb2cdcc20e75ee5e6fedeab Mon Sep 17 00:00:00 2001 From: yoen-velt Date: Thu, 18 Dec 2025 17:18:09 -0500 Subject: [PATCH 1/6] Self hosting Comments Data --- .../app/api/velt/comments/delete/route.ts | 20 ++++ .../app/api/velt/comments/get/route.ts | 22 ++++ .../app/api/velt/comments/save/route.ts | 20 ++++ .../app/api/velt/comments/store.ts | 49 +++++++++ .../app/page.tsx | 5 + .../velt/VeltCommentDataProvider.ts | 101 ++++++++++++++++++ 6 files changed, 217 insertions(+) create mode 100644 apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/delete/route.ts create mode 100644 apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/get/route.ts create mode 100644 apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/save/route.ts create mode 100644 apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/store.ts create mode 100644 apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/velt/VeltCommentDataProvider.ts diff --git a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/delete/route.ts b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/delete/route.ts new file mode 100644 index 00000000..181391aa --- /dev/null +++ b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/delete/route.ts @@ -0,0 +1,20 @@ +import { NextRequest, NextResponse } from 'next/server'; +import { deleteComment } from '../store'; + +export async function POST(request: NextRequest) { + try { + const body = await request.json(); + const { commentAnnotationId } = body; + + console.log('[Velt API] DELETE comment:', commentAnnotationId); + + if (commentAnnotationId) { + deleteComment(commentAnnotationId); + } + + return NextResponse.json({ success: true }); + } catch (error) { + console.error('[Velt API] Error deleting comment:', error); + return NextResponse.json({ success: false, error: 'Failed to delete' }, { status: 500 }); + } +} diff --git a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/get/route.ts b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/get/route.ts new file mode 100644 index 00000000..4a66c235 --- /dev/null +++ b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/get/route.ts @@ -0,0 +1,22 @@ +import { NextRequest, NextResponse } from 'next/server'; +import { getComments } from '../store'; + +export async function POST(request: NextRequest) { + try { + const body = await request.json(); + const { organizationId, commentAnnotationIds, documentIds } = body; + + console.log('[Velt API] GET comments:', { organizationId, commentAnnotationIds, documentIds }); + + const result = getComments({ + organizationId, + commentAnnotationIds, + documentIds, + }); + + return NextResponse.json({ result, success: true }); + } catch (error) { + console.error('[Velt API] Error getting comments:', error); + return NextResponse.json({ result: {}, success: true }, { status: 200 }); + } +} diff --git a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/save/route.ts b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/save/route.ts new file mode 100644 index 00000000..8be6c86e --- /dev/null +++ b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/save/route.ts @@ -0,0 +1,20 @@ +import { NextRequest, NextResponse } from 'next/server'; +import { saveComments } from '../store'; + +export async function POST(request: NextRequest) { + try { + const body = await request.json(); + const { commentAnnotation } = body; + + console.log('[Velt API] SAVE comments:', commentAnnotation); + + if (commentAnnotation) { + saveComments(commentAnnotation); + } + + return NextResponse.json({ success: true }); + } catch (error) { + console.error('[Velt API] Error saving comments:', error); + return NextResponse.json({ success: false, error: 'Failed to save' }, { status: 500 }); + } +} diff --git a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/store.ts b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/store.ts new file mode 100644 index 00000000..8f083a60 --- /dev/null +++ b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/store.ts @@ -0,0 +1,49 @@ +// In-memory store for demo purposes +// Replace with your database (PostgreSQL, MongoDB, etc.) in production + +export type CommentAnnotation = { + annotationId: string; + documentId?: string; + organizationId?: string; + metadata?: unknown; + comments: Record; +}; + +// In-memory storage - data persists only while server is running +const commentStore: Map = new Map(); + +export function getComments(filters: { + organizationId?: string; + commentAnnotationIds?: string[]; + documentIds?: string[]; +}): Record { + const result: Record = {}; + + for (const [id, annotation] of commentStore.entries()) { + // Filter by annotation IDs if provided + if (filters.commentAnnotationIds?.length && !filters.commentAnnotationIds.includes(id)) { + continue; + } + // Filter by document IDs if provided + if (filters.documentIds?.length && annotation.documentId && !filters.documentIds.includes(annotation.documentId)) { + continue; + } + // Filter by organization if provided + if (filters.organizationId && annotation.organizationId && annotation.organizationId !== filters.organizationId) { + continue; + } + result[id] = annotation; + } + + return result; +} + +export function saveComments(annotations: Record): void { + for (const [id, annotation] of Object.entries(annotations)) { + commentStore.set(id, { ...annotation, annotationId: id }); + } +} + +export function deleteComment(annotationId: string): boolean { + return commentStore.delete(annotationId); +} diff --git a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/page.tsx b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/page.tsx index 80e7e9ae..7c10df8e 100644 --- a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/page.tsx +++ b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/page.tsx @@ -4,10 +4,14 @@ import { VeltProvider } from "@veltdev/react"; import { useVeltAuthProvider } from "@/components/velt/VeltInitializeUser"; import { VeltCollaboration } from "@/components/velt/VeltCollaboration"; import DocumentCanvas from '@/components/document/document-canvas' +import { commentDataProvider } from "@/components/velt/VeltCommentDataProvider"; // [Velt] Replace with your own API key from https://console.velt.dev const NEXT_PUBLIC_VELT_API_KEY = "6xTcUFtlYAlCdh11zrKB"; +// [Velt] Self-hosting: set to true to enable self-hosted comment storage +const SELF_HOSTING_ENABLED = true; + export default function Home() { // [Velt] Auth provider (reads from app/userAuth/useAppUser) const { authProvider } = useVeltAuthProvider(); @@ -17,6 +21,7 @@ export default function Home() { diff --git a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/velt/VeltCommentDataProvider.ts b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/velt/VeltCommentDataProvider.ts new file mode 100644 index 00000000..e7242e5e --- /dev/null +++ b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/velt/VeltCommentDataProvider.ts @@ -0,0 +1,101 @@ +// [Velt] Comment data provider for self-hosting comment content +// Docs: https://docs.velt.dev/self-host-data/comments + +const DATA_PROVIDER_URL = '/api/velt/comments'; + +const commentResolverConfig = { + resolveTimeout: 2000, + saveRetryConfig: { + retryCount: 3, + retryDelay: 2000 + }, + deleteRetryConfig: { + retryCount: 3, + retryDelay: 2000 + } +}; + +// Fetch comment annotations from your backend +const fetchCommentsFromDB = async (request: { + organizationId: string; + commentAnnotationIds?: string[]; + documentIds?: string[]; + folderId?: string; + allDocuments?: boolean; +}) => { + console.log('[Velt Self-Host] GET called:', request); + try { + const response = await fetch(`${DATA_PROVIDER_URL}/get`, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(request) + }); + if (!response.ok) { + console.warn('[Velt Self-Host] GET endpoint returned', response.status); + return { data: {}, success: true, statusCode: 200 }; // Return empty data on 404 + } + const data = await response.json(); + return { data: data.result || {}, success: true, statusCode: 200 }; + } catch (error) { + console.error('[Velt Self-Host] Error fetching comments:', error); + return { data: {}, success: true, statusCode: 200 }; // Graceful fallback + } +}; + +// Save comment annotations to your backend +const saveCommentsToDB = async (request: { + commentAnnotation: Record; + }>; +}) => { + console.log('[Velt Self-Host] SAVE called:', request); + try { + const response = await fetch(`${DATA_PROVIDER_URL}/save`, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(request) + }); + if (!response.ok) { + console.warn('[Velt Self-Host] SAVE endpoint returned', response.status); + return { success: true, statusCode: 200 }; // Graceful fallback + } + await response.json(); + return { success: true, statusCode: 200 }; + } catch (error) { + console.error('[Velt Self-Host] Error saving comments:', error); + return { success: true, statusCode: 200 }; // Graceful fallback + } +}; + +// Delete comment annotations from your backend +const deleteCommentsFromDB = async (request: { + commentAnnotationId: string; + metadata?: unknown; +}) => { + console.log('[Velt Self-Host] DELETE called:', request); + try { + const response = await fetch(`${DATA_PROVIDER_URL}/delete`, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(request) + }); + if (!response.ok) { + console.warn('[Velt Self-Host] DELETE endpoint returned', response.status); + return { success: true, statusCode: 200 }; // Graceful fallback + } + await response.json(); + return { success: true, statusCode: 200 }; + } catch (error) { + console.error('[Velt Self-Host] Error deleting comments:', error); + return { success: true, statusCode: 200 }; // Graceful fallback + } +}; + +export const commentDataProvider = { + get: fetchCommentsFromDB, + save: saveCommentsToDB, + delete: deleteCommentsFromDB, + config: commentResolverConfig +}; From dabc94d6a6a6ebca6ec280c3055eeb9b92fb331f Mon Sep 17 00:00:00 2001 From: yoen-velt Date: Thu, 18 Dec 2025 17:49:10 -0500 Subject: [PATCH 2/6] MongoDB database implementaiton --- .../app/api/velt/comments/delete/route.ts | 2 +- .../app/api/velt/comments/get/route.ts | 2 +- .../app/api/velt/comments/save/route.ts | 9 +- .../app/api/velt/comments/store.ts | 107 +++++++++++++----- .../package.json | 3 +- 5 files changed, 91 insertions(+), 32 deletions(-) diff --git a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/delete/route.ts b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/delete/route.ts index 181391aa..17844060 100644 --- a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/delete/route.ts +++ b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/delete/route.ts @@ -9,7 +9,7 @@ export async function POST(request: NextRequest) { console.log('[Velt API] DELETE comment:', commentAnnotationId); if (commentAnnotationId) { - deleteComment(commentAnnotationId); + await deleteComment(commentAnnotationId); } return NextResponse.json({ success: true }); diff --git a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/get/route.ts b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/get/route.ts index 4a66c235..aa7a2427 100644 --- a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/get/route.ts +++ b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/get/route.ts @@ -8,7 +8,7 @@ export async function POST(request: NextRequest) { console.log('[Velt API] GET comments:', { organizationId, commentAnnotationIds, documentIds }); - const result = getComments({ + const result = await getComments({ organizationId, commentAnnotationIds, documentIds, diff --git a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/save/route.ts b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/save/route.ts index 8be6c86e..7f4b665d 100644 --- a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/save/route.ts +++ b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/save/route.ts @@ -4,12 +4,15 @@ import { saveComments } from '../store'; export async function POST(request: NextRequest) { try { const body = await request.json(); - const { commentAnnotation } = body; + const { commentAnnotation, metadata } = body; - console.log('[Velt API] SAVE comments:', commentAnnotation); + console.log('[Velt API] SAVE comments:', { commentAnnotation, metadata }); if (commentAnnotation) { - saveComments(commentAnnotation); + // Extract documentId and organizationId from metadata + const documentId = metadata?.documentId; + const organizationId = metadata?.organizationId; + await saveComments(commentAnnotation, { documentId, organizationId }); } return NextResponse.json({ success: true }); diff --git a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/store.ts b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/store.ts index 8f083a60..7effcfa5 100644 --- a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/store.ts +++ b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/store.ts @@ -1,5 +1,7 @@ -// In-memory store for demo purposes -// Replace with your database (PostgreSQL, MongoDB, etc.) in production +// MongoDB store for Velt comments +// Docs: https://docs.velt.dev/self-host-data/comments + +import { MongoClient, Db } from 'mongodb'; export type CommentAnnotation = { annotationId: string; @@ -9,41 +11,94 @@ export type CommentAnnotation = { comments: Record; }; -// In-memory storage - data persists only while server is running -const commentStore: Map = new Map(); +// MongoDB connection string - replace with your own +const MONGODB_URI = process.env.MONGODB_URI || 'mongodb://localhost:27017'; +const DB_NAME = 'velt_comments'; +const COLLECTION_NAME = 'comment_annotations'; + +let client: MongoClient | null = null; +let db: Db | null = null; + +async function getDb(): Promise { + if (db) return db; -export function getComments(filters: { + client = new MongoClient(MONGODB_URI); + await client.connect(); + db = client.db(DB_NAME); + + // Create indexes for faster lookups + await db.collection(COLLECTION_NAME).createIndex({ annotationId: 1 }, { unique: true }); + await db.collection(COLLECTION_NAME).createIndex({ documentId: 1 }); + await db.collection(COLLECTION_NAME).createIndex({ organizationId: 1 }); + + console.log('[MongoDB] Connected to database:', DB_NAME); + return db; +} + +export async function getComments(filters: { organizationId?: string; commentAnnotationIds?: string[]; documentIds?: string[]; -}): Record { - const result: Record = {}; +}): Promise> { + const database = await getDb(); + const collection = database.collection(COLLECTION_NAME); - for (const [id, annotation] of commentStore.entries()) { - // Filter by annotation IDs if provided - if (filters.commentAnnotationIds?.length && !filters.commentAnnotationIds.includes(id)) { - continue; - } - // Filter by document IDs if provided - if (filters.documentIds?.length && annotation.documentId && !filters.documentIds.includes(annotation.documentId)) { - continue; - } - // Filter by organization if provided - if (filters.organizationId && annotation.organizationId && annotation.organizationId !== filters.organizationId) { - continue; - } - result[id] = annotation; + // Build query + const query: Record = {}; + + if (filters.commentAnnotationIds?.length) { + query.annotationId = { $in: filters.commentAnnotationIds }; + } + if (filters.documentIds?.length) { + query.documentId = { $in: filters.documentIds }; + } + if (filters.organizationId) { + query.organizationId = filters.organizationId; + } + + const annotations = await collection.find(query).toArray(); + + // Convert to Record format expected by Velt + const result: Record = {}; + for (const annotation of annotations) { + result[annotation.annotationId] = annotation; } return result; } -export function saveComments(annotations: Record): void { - for (const [id, annotation] of Object.entries(annotations)) { - commentStore.set(id, { ...annotation, annotationId: id }); +export async function saveComments( + annotations: Record, + context?: { documentId?: string; organizationId?: string } +): Promise { + const database = await getDb(); + const collection = database.collection(COLLECTION_NAME); + + const operations = Object.entries(annotations).map(([id, annotation]) => ({ + updateOne: { + filter: { annotationId: id }, + update: { + $set: { + ...annotation, + annotationId: id, + // Store documentId and organizationId at top level for querying + documentId: context?.documentId || annotation.documentId, + organizationId: context?.organizationId || annotation.organizationId, + } + }, + upsert: true + } + })); + + if (operations.length > 0) { + await collection.bulkWrite(operations); } } -export function deleteComment(annotationId: string): boolean { - return commentStore.delete(annotationId); +export async function deleteComment(annotationId: string): Promise { + const database = await getDb(); + const collection = database.collection(COLLECTION_NAME); + + const result = await collection.deleteOne({ annotationId }); + return result.deletedCount > 0; } diff --git a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/package.json b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/package.json index 2b568fd7..daf6c848 100644 --- a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/package.json +++ b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/package.json @@ -12,6 +12,7 @@ "@veltdev/react": "^4.6.5", "clsx": "^2", "lucide-react": "^0.454.0", + "mongodb": "^7.0.0", "next": "^15", "react": "^19", "react-dom": "^19", @@ -21,8 +22,8 @@ "devDependencies": { "@types/node": "^22", "@types/react": "^19", - "@veltdev/types": "^4.6.5", "@types/react-dom": "^19", + "@veltdev/types": "^4.6.5", "autoprefixer": "^10", "postcss": "^8", "tailwindcss": "^3.4.0", From 34f1bc0541192500f0646f544f861c5329c6e73b Mon Sep 17 00:00:00 2001 From: yoen-velt Date: Thu, 18 Dec 2025 18:03:35 -0500 Subject: [PATCH 3/6] MongoDB Atlas support --- .../app/api/velt/comments/store.ts | 39 ++++++++++++------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/store.ts b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/store.ts index 7effcfa5..405d900c 100644 --- a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/store.ts +++ b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/comments/store.ts @@ -11,28 +11,37 @@ export type CommentAnnotation = { comments: Record; }; -// MongoDB connection string - replace with your own +// MongoDB connection string +// Local: mongodb://localhost:27017 +// Production: Set MONGODB_URI env var (e.g., MongoDB Atlas connection string) const MONGODB_URI = process.env.MONGODB_URI || 'mongodb://localhost:27017'; + +if (!process.env.MONGODB_URI && process.env.NODE_ENV === 'production') { + console.warn('[MongoDB] WARNING: MONGODB_URI not set. Using localhost which will fail in production.'); +} const DB_NAME = 'velt_comments'; const COLLECTION_NAME = 'comment_annotations'; -let client: MongoClient | null = null; -let db: Db | null = null; +// Cache connection promise for serverless environments +let clientPromise: Promise | null = null; async function getDb(): Promise { - if (db) return db; - - client = new MongoClient(MONGODB_URI); - await client.connect(); - db = client.db(DB_NAME); - - // Create indexes for faster lookups - await db.collection(COLLECTION_NAME).createIndex({ annotationId: 1 }, { unique: true }); - await db.collection(COLLECTION_NAME).createIndex({ documentId: 1 }); - await db.collection(COLLECTION_NAME).createIndex({ organizationId: 1 }); + if (!clientPromise) { + const client = new MongoClient(MONGODB_URI); + clientPromise = client.connect(); + + // Create indexes on first connection + clientPromise.then(async (connectedClient) => { + const db = connectedClient.db(DB_NAME); + await db.collection(COLLECTION_NAME).createIndex({ annotationId: 1 }, { unique: true }).catch(() => {}); + await db.collection(COLLECTION_NAME).createIndex({ documentId: 1 }).catch(() => {}); + await db.collection(COLLECTION_NAME).createIndex({ organizationId: 1 }).catch(() => {}); + console.log('[MongoDB] Connected to database:', DB_NAME); + }); + } - console.log('[MongoDB] Connected to database:', DB_NAME); - return db; + const client = await clientPromise; + return client.db(DB_NAME); } export async function getComments(filters: { From 6591067e9d28117793a5d03e3ad48b3bd5c3c7eb Mon Sep 17 00:00:00 2001 From: yoen-velt Date: Fri, 19 Dec 2025 14:49:30 -0500 Subject: [PATCH 4/6] Removed open-envoy, renamed file path --- .../open-envoy-demo/.gitignore | 35 --- .../inline-comments/open-envoy-demo/README.md | 112 ------- .../app/api/velt/token/route.ts | 40 --- .../app/document/DocumentContext.tsx | 77 ----- .../app/document/useCurrentDocument.ts | 4 - .../open-envoy-demo/app/layout.tsx | 19 -- .../open-envoy-demo/app/page.tsx | 33 --- .../app/userAuth/AppProviders.tsx | 15 - .../app/userAuth/AppUserContext.tsx | 182 ------------ .../app/userAuth/useAppUser.ts | 3 - .../open-envoy-demo/components.json | 17 -- .../components/document/ActionModal.tsx | 227 -------------- .../components/document/Avatar.tsx | 20 -- .../components/document/CommentsSidebar.tsx | 39 --- .../components/document/DueBadge.tsx | 31 -- .../components/document/JobDetailModal.tsx | 278 ------------------ .../components/document/JobsTable.tsx | 117 -------- .../components/document/Pagination.tsx | 43 --- .../components/document/StatusBadge.tsx | 49 --- .../components/document/SummaryCards.tsx | 34 --- .../components/document/document-canvas.tsx | 114 ------- .../components/document/icons.tsx | 107 ------- .../components/document/jobs-data.ts | 252 ---------------- .../components/document/types.ts | 22 -- .../components/header/header.tsx | 14 - .../components/sidebar/sidebar.tsx | 233 --------------- .../components/velt/VeltCollaboration.tsx | 41 --- .../velt/VeltInitializeDocument.tsx | 23 -- .../components/velt/VeltInitializeUser.tsx | 54 ---- .../components/velt/VeltTools.tsx | 18 -- .../ui-customization/VeltCommentBubbleWf.tsx | 20 -- .../ui-customization/VeltCommentToolWf.tsx | 17 -- .../VeltNotificationsToolWf.tsx | 13 - .../ui-customization/VeltSidebarButtonWf.tsx | 15 - .../velt/ui-customization/index.tsx | 18 -- .../open-envoy-demo/hooks/.gitkeep | 0 .../open-envoy-demo/lib/utils.ts | 6 - .../open-envoy-demo/next.config.js | 4 - .../open-envoy-demo/package.json | 32 -- .../open-envoy-demo/postcss.config.js | 6 - .../open-envoy-demo/public/.gitkeep | 0 .../public/icons/bell-icon.svg | 5 - .../public/icons/inbox-icon.svg | 3 - .../public/icons/sidebar/accounts-payable.svg | 3 - .../public/icons/sidebar/activity.svg | 3 - .../public/icons/sidebar/all.svg | 3 - .../public/icons/sidebar/automation.svg | 3 - .../public/icons/sidebar/basic-expense.svg | 3 - .../public/icons/sidebar/copy.svg | 3 - .../public/icons/sidebar/divider.svg | 3 - .../public/icons/sidebar/documents.svg | 3 - .../public/icons/sidebar/folder.svg | 3 - .../public/icons/sidebar/help.svg | 3 - .../public/icons/sidebar/home.svg | 3 - .../public/icons/sidebar/inbox.svg | 3 - .../public/icons/sidebar/invoice-match.svg | 3 - .../public/icons/sidebar/notifications.svg | 3 - .../public/icons/sidebar/open-envoy-logo.svg | 21 -- .../public/icons/sidebar/search.svg | 3 - .../public/icons/sidebar/settings.svg | 3 - .../open-envoy-demo/styles/globals.css | 262 ----------------- .../open-envoy-demo/tailwind.config.js | 54 ---- .../open-envoy-demo/tsconfig.json | 40 --- .../dashboard-inline-comments-demo/.gitignore | 0 .../dashboard-inline-comments-demo/README.md | 0 .../app/api/velt/comments/delete/route.ts | 0 .../app/api/velt/comments/get/route.ts | 0 .../app/api/velt/comments/save/route.ts | 0 .../app/api/velt/comments/store.ts | 0 .../app/api/velt/token/route.ts | 0 .../app/document/DocumentContext.tsx | 0 .../app/document/useCurrentDocument.ts | 0 .../app/layout.tsx | 0 .../app/page.tsx | 0 .../app/userAuth/AppProviders.tsx | 0 .../app/userAuth/AppUserContext.tsx | 0 .../app/userAuth/useAppUser.ts | 0 .../components.json | 0 .../components/document/ActionModal.tsx | 0 .../components/document/Avatar.tsx | 0 .../components/document/CommentsSidebar.tsx | 0 .../components/document/DueBadge.tsx | 0 .../components/document/JobDetailModal.tsx | 0 .../components/document/JobsTable.tsx | 0 .../components/document/Pagination.tsx | 0 .../components/document/StatusBadge.tsx | 0 .../components/document/SummaryCards.tsx | 0 .../components/document/document-canvas.tsx | 0 .../components/document/icons.tsx | 0 .../components/document/jobs-data.ts | 0 .../components/document/types.ts | 0 .../components/header/header.tsx | 0 .../components/sidebar/sidebar.tsx | 0 .../components/velt/VeltCollaboration.tsx | 0 .../velt/VeltCommentDataProvider.ts | 0 .../velt/VeltInitializeDocument.tsx | 0 .../components/velt/VeltInitializeUser.tsx | 0 .../components/velt/VeltTools.tsx | 0 .../ui-customization/VeltCommentBubbleWf.tsx | 0 .../ui-customization/VeltCommentToolWf.tsx | 0 .../VeltCommentsSidebarHeaderWf.tsx | 0 .../ui-customization/VeltCustomization.tsx | 0 .../VeltNotificationsToolWf.tsx | 0 .../ui-customization/VeltSidebarButtonWf.tsx | 0 .../velt/ui-customization/styles.css | 0 .../hooks/.gitkeep | 0 .../lib/utils.ts | 0 .../next.config.js | 0 .../package.json | 0 .../postcss.config.js | 0 .../public/.gitkeep | 0 .../public/icons/bell-icon.svg | 0 .../public/icons/inbox-icon.svg | 0 .../public/icons/sidebar/accounts-payable.svg | 0 .../public/icons/sidebar/activity.svg | 0 .../public/icons/sidebar/all.svg | 0 .../public/icons/sidebar/automation.svg | 0 .../public/icons/sidebar/basic-expense.svg | 0 .../public/icons/sidebar/copy.svg | 0 .../public/icons/sidebar/divider.svg | 0 .../public/icons/sidebar/documents.svg | 0 .../public/icons/sidebar/folder.svg | 0 .../public/icons/sidebar/help.svg | 0 .../public/icons/sidebar/home.svg | 0 .../public/icons/sidebar/inbox.svg | 0 .../public/icons/sidebar/invoice-match.svg | 0 .../public/icons/sidebar/notifications.svg | 0 .../public/icons/sidebar/open-envoy-logo.svg | 0 .../public/icons/sidebar/search.svg | 0 .../public/icons/sidebar/settings.svg | 0 .../styles/globals.css | 0 .../tailwind.config.js | 0 .../tsconfig.json | 0 133 files changed, 2817 deletions(-) delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/.gitignore delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/README.md delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/api/velt/token/route.ts delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/document/DocumentContext.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/document/useCurrentDocument.ts delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/layout.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/page.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/userAuth/AppProviders.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/userAuth/AppUserContext.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/userAuth/useAppUser.ts delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components.json delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/ActionModal.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/Avatar.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/CommentsSidebar.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/DueBadge.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/JobDetailModal.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/JobsTable.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/Pagination.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/StatusBadge.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/SummaryCards.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/document-canvas.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/icons.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/jobs-data.ts delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/types.ts delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/header/header.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/sidebar/sidebar.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/velt/VeltCollaboration.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/velt/VeltInitializeDocument.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/velt/VeltInitializeUser.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/velt/VeltTools.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/velt/ui-customization/VeltCommentBubbleWf.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/velt/ui-customization/VeltCommentToolWf.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/velt/ui-customization/VeltNotificationsToolWf.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/velt/ui-customization/VeltSidebarButtonWf.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/velt/ui-customization/index.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/hooks/.gitkeep delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/lib/utils.ts delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/next.config.js delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/package.json delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/postcss.config.js delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/public/.gitkeep delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/public/icons/bell-icon.svg delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/public/icons/inbox-icon.svg delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/public/icons/sidebar/accounts-payable.svg delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/public/icons/sidebar/activity.svg delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/public/icons/sidebar/all.svg delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/public/icons/sidebar/automation.svg delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/public/icons/sidebar/basic-expense.svg delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/public/icons/sidebar/copy.svg delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/public/icons/sidebar/divider.svg delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/public/icons/sidebar/documents.svg delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/public/icons/sidebar/folder.svg delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/public/icons/sidebar/help.svg delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/public/icons/sidebar/home.svg delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/public/icons/sidebar/inbox.svg delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/public/icons/sidebar/invoice-match.svg delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/public/icons/sidebar/notifications.svg delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/public/icons/sidebar/open-envoy-logo.svg delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/public/icons/sidebar/search.svg delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/public/icons/sidebar/settings.svg delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/styles/globals.css delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/tailwind.config.js delete mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/tsconfig.json rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/.gitignore (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/README.md (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/app/api/velt/comments/delete/route.ts (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/app/api/velt/comments/get/route.ts (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/app/api/velt/comments/save/route.ts (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/app/api/velt/comments/store.ts (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/app/api/velt/token/route.ts (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/app/document/DocumentContext.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/app/document/useCurrentDocument.ts (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/app/layout.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/app/page.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/app/userAuth/AppProviders.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/app/userAuth/AppUserContext.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/app/userAuth/useAppUser.ts (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components.json (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components/document/ActionModal.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components/document/Avatar.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components/document/CommentsSidebar.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components/document/DueBadge.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components/document/JobDetailModal.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components/document/JobsTable.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components/document/Pagination.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components/document/StatusBadge.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components/document/SummaryCards.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components/document/document-canvas.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components/document/icons.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components/document/jobs-data.ts (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components/document/types.ts (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components/header/header.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components/sidebar/sidebar.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components/velt/VeltCollaboration.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components/velt/VeltCommentDataProvider.ts (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components/velt/VeltInitializeDocument.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components/velt/VeltInitializeUser.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components/velt/VeltTools.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components/velt/ui-customization/VeltCommentBubbleWf.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components/velt/ui-customization/VeltCommentToolWf.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components/velt/ui-customization/VeltCommentsSidebarHeaderWf.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components/velt/ui-customization/VeltCustomization.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components/velt/ui-customization/VeltNotificationsToolWf.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components/velt/ui-customization/VeltSidebarButtonWf.tsx (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/components/velt/ui-customization/styles.css (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/hooks/.gitkeep (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/lib/utils.ts (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/next.config.js (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/package.json (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/postcss.config.js (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/public/.gitkeep (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/public/icons/bell-icon.svg (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/public/icons/inbox-icon.svg (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/public/icons/sidebar/accounts-payable.svg (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/public/icons/sidebar/activity.svg (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/public/icons/sidebar/all.svg (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/public/icons/sidebar/automation.svg (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/public/icons/sidebar/basic-expense.svg (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/public/icons/sidebar/copy.svg (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/public/icons/sidebar/divider.svg (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/public/icons/sidebar/documents.svg (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/public/icons/sidebar/folder.svg (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/public/icons/sidebar/help.svg (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/public/icons/sidebar/home.svg (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/public/icons/sidebar/inbox.svg (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/public/icons/sidebar/invoice-match.svg (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/public/icons/sidebar/notifications.svg (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/public/icons/sidebar/open-envoy-logo.svg (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/public/icons/sidebar/search.svg (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/public/icons/sidebar/settings.svg (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/styles/globals.css (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/tailwind.config.js (100%) rename apps/react/comments/dashboard/{inline-comments => self-hosting}/dashboard-inline-comments-demo/tsconfig.json (100%) diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/.gitignore b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/.gitignore deleted file mode 100644 index 8f322f0d..00000000 --- a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/.gitignore +++ /dev/null @@ -1,35 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules -/.pnp -.pnp.js - -# testing -/coverage - -# next.js -/.next/ -/out/ - -# production -/build - -# misc -.DS_Store -*.pem - -# debug -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# local env files -.env*.local - -# vercel -.vercel - -# typescript -*.tsbuildinfo -next-env.d.ts diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/README.md b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/README.md deleted file mode 100644 index 9393b458..00000000 --- a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/README.md +++ /dev/null @@ -1,112 +0,0 @@ -# open-envoy-demo - -## Overview - -This demo showcases **inline-comments** for **comments** (dashboard) in **react**. - -## Path - -``` -apps/react/comments/dashboard/inline-comments/open-envoy-demo/ -``` - -## Package Name - -`@apps/react-comments-dashboard-inline-comments-open-envoy-demo` - -## Directory Structure - -``` -open-envoy-demo/ -├── app/ -│ ├── layout.tsx # Root layout -│ └── page.tsx # Main page -├── components/ -│ ├── header/ # Header components (Velt notifications, etc.) -│ │ └── header.tsx -│ ├── sidebar/ # Sidebar components -│ │ └── sidebar.tsx -│ └── document/ # Main document/canvas logic -│ └── document-canvas.tsx -├── hooks/ # Custom React hooks -├── lib/ # Utility functions -│ └── utils.ts -├── public/ # Static assets -├── styles/ # Global styles -│ └── globals.css -├── .npmrc # pnpm config to prevent Tailwind v4 hoisting -├── next.config.js -├── tailwind.config.js -├── tsconfig.json -├── components.json # shadcn/ui configuration -└── package.json -``` - -## Getting Started - -### Install Dependencies - -From the monorepo root: - -```bash -pnpm install -``` - -### Run Development Server - -```bash -cd apps/react/comments/dashboard/inline-comments/open-envoy-demo -pnpm dev -``` - -Or from the root: - -```bash -pnpm --filter @apps/react-comments-dashboard-inline-comments-open-envoy-demo dev -``` - -### Build for Production - -```bash -pnpm --filter @apps/react-comments-dashboard-inline-comments-open-envoy-demo build -``` - -## Structure - -- **Framework**: react -- **Feature**: comments -- **Document**: dashboard -- **Library**: inline-comments -- **Demo**: open-envoy-demo - -## Component Organization - -- **`components/header/`** - Contains Velt components like notifications, presence indicators, header buttons -- **`components/sidebar/`** - Contains sidebar-related components -- **`components/document/`** - Contains the main application logic and inline-comments integration -- **`hooks/`** - Custom React hooks for state management and side effects -- **`lib/`** - Utility functions and helpers - -## Important Configuration - -### .npmrc File -This demo includes a `.npmrc` file that prevents pnpm from hoisting Tailwind CSS v4 from other workspace packages. This is necessary because: -- This demo uses Tailwind CSS v3.4.x with traditional PostCSS configuration -- Other apps in the monorepo may use Tailwind CSS v4 -- Without the `.npmrc`, pnpm would hoist v4 and cause PostCSS errors - -**Do not delete the `.npmrc` file** - it ensures the correct Tailwind version is used. - -## Next Steps - -1. Add your inline-comments implementation in `components/document/` -2. Add Velt collaboration features in `components/header/` -3. Update this README with specific usage instructions -4. Add the demo to `master-sample-app` if it should be showcased -5. Update deployment configs (Vercel, GitHub Actions) if needed - -## Learn More - -- [Monorepo Structure Guide](../../../../../README_MONOREPO.md) -- [Structure Documentation](../../../../../docs/structure.md) -- [Velt Documentation](https://docs.velt.dev) diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/api/velt/token/route.ts b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/api/velt/token/route.ts deleted file mode 100644 index 17cc582b..00000000 --- a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/api/velt/token/route.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { NextRequest, NextResponse } from 'next/server'; - -// [Velt] API key and auth token from environment variables -const NEXT_PUBLIC_VELT_API_KEY = process.env.NEXT_PUBLIC_VELT_API_KEY || process.env.VELT_API_KEY || ''; -const VELT_AUTH_TOKEN = process.env.VELT_AUTH_TOKEN; - -export async function POST(req: NextRequest) { - try { - const { userId, organizationId, email, isAdmin } = await req.json(); - if (!userId || !organizationId) { - return NextResponse.json({ error: 'Missing userId or organizationId' }, { status: 400 }); - } - if (!VELT_AUTH_TOKEN) { - return NextResponse.json({ error: 'Server configuration error: missing VELT_AUTH_TOKEN' }, { status: 500 }); - } - const body = { - data: { - userId, - userProperties: { - organizationId, - ...(typeof isAdmin === 'boolean' ? { isAdmin } : {}), - ...(email ? { email } : {}), - }, - }, - }; - const res = await fetch('https://api.velt.dev/v2/auth/token/get', { - method: 'POST', - headers: { 'Content-Type': 'application/json', 'x-velt-api-key': NEXT_PUBLIC_VELT_API_KEY, 'x-velt-auth-token': VELT_AUTH_TOKEN }, - body: JSON.stringify(body), - }); - const json = await res.json(); - const token = json?.result?.data?.token; - if (!res.ok || !token) { - return NextResponse.json({ error: json?.error?.message || 'Failed to generate token' }, { status: 500 }); - } - return NextResponse.json({ token }); - } catch { - return NextResponse.json({ error: 'Internal error' }, { status: 500 }); - } -} diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/document/DocumentContext.tsx b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/document/DocumentContext.tsx deleted file mode 100644 index b09a9140..00000000 --- a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/document/DocumentContext.tsx +++ /dev/null @@ -1,77 +0,0 @@ -'use client'; -import { useMemo, useEffect, useState, useRef } from 'react'; - -/** - * ⚠️ IMPORTANT DISCLAIMER FOR DEVELOPERS ⚠️ - * - * This documentId logic using URL parameters is ONLY for demo sharing purposes. - * It allows users to share a link to a specific document in this demo app. - * - * IN YOUR REAL APPLICATION: - * - Use your own document ID system (e.g., from your database, CMS, or file system) - * - You do NOT need to use URLs as document IDs - * - You do NOT need to store document IDs in localStorage or URL params - * - Simply pass your existing document identifier to Velt - * - * Examples of real-world document IDs: - * - Database record ID: "user-doc-12345" - * - File path: "/projects/my-project/document.txt" - * - UUID: "550e8400-e29b-41d4-a716-446655440000" - * - Any unique identifier from your system - * - * The URL-based approach here is purely for convenience in this demo environment - * to enable sharing and collaboration testing. Do not feel obligated to replicate - * this pattern in your production application. - */ - -// [Velt] Minimal hard-coded current document hook -export type CurrentDocument = { - documentId: string | null; - documentName: string; -}; - -export function useCurrentDocument(): CurrentDocument { - const [documentId, setDocumentId] = useState(null); - const isInitialized = useRef(false); - - useEffect(() => { - // Prevent double initialization (React Strict Mode, HMR, etc.) - if (isInitialized.current) return; - - // 1. Check URL for documentId parameter first - const urlParams = new URLSearchParams(window.location.search); - let docId = urlParams.get('documentId'); - - if (docId) { - // Use document ID from URL (shareable link) - setDocumentId(docId); - localStorage.setItem('velt-demo-document-id', docId); - } else { - // 2. Check localStorage for existing document - const stored = localStorage.getItem('velt-demo-document-id'); - if (stored) { - docId = stored; - } else { - // 3. Generate new document ID - docId = `doc-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`; - localStorage.setItem('velt-demo-document-id', docId); - } - - // Update URL with document ID for shareability - const newUrl = `${window.location.pathname}?documentId=${docId}`; - window.history.pushState({}, '', newUrl); - - setDocumentId(docId); - } - - isInitialized.current = true; - }, []); - - return useMemo( - () => ({ - documentId: documentId, - documentName: "My Document", - }), - [documentId] - ); -} diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/document/useCurrentDocument.ts b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/document/useCurrentDocument.ts deleted file mode 100644 index b36de938..00000000 --- a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/document/useCurrentDocument.ts +++ /dev/null @@ -1,4 +0,0 @@ -'use client'; - -export { useCurrentDocument } from './DocumentContext'; -export type { CurrentDocument } from './DocumentContext'; diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/layout.tsx b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/layout.tsx deleted file mode 100644 index fb120b12..00000000 --- a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/layout.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import type { Metadata } from 'next' -import '../styles/globals.css' - -export const metadata: Metadata = { - title: 'open-envoy-demo', - description: 'inline-comments demo for comments', -} - -export default function RootLayout({ - children, -}: { - children: React.ReactNode -}) { - return ( - - {children} - - ) -} diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/page.tsx b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/page.tsx deleted file mode 100644 index 3de64af6..00000000 --- a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/page.tsx +++ /dev/null @@ -1,33 +0,0 @@ -'use client' - -import DocumentCanvas from '@/components/document/document-canvas' -import { VeltProvider } from '@veltdev/react' -import { VeltCollaboration } from '@/components/velt/VeltCollaboration' -import { AppProviders } from './userAuth/AppProviders' -import { useVeltAuthProvider } from '@/components/velt/VeltInitializeUser' - -function VeltWrapper({ children }: { children: React.ReactNode }) { - const { authProvider } = useVeltAuthProvider() - - return ( - - - {children} - - ) -} - -export default function Home() { - return ( - - -
- -
-
-
- ) -} diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/userAuth/AppProviders.tsx b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/userAuth/AppProviders.tsx deleted file mode 100644 index a17dc9e8..00000000 --- a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/userAuth/AppProviders.tsx +++ /dev/null @@ -1,15 +0,0 @@ -"use client"; - -import React from "react"; -import { AppUserProvider } from "./AppUserContext"; - -/** - * Client component wrapper for AppUserProvider - */ -export function AppProviders({ children }: { children: React.ReactNode }) { - return ( - - {children} - - ); -} diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/userAuth/AppUserContext.tsx b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/userAuth/AppUserContext.tsx deleted file mode 100644 index 6f157cc7..00000000 --- a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/userAuth/AppUserContext.tsx +++ /dev/null @@ -1,182 +0,0 @@ -"use client"; - -import type { User } from "@veltdev/types"; -import React, { useCallback, useContext, useEffect, useState } from "react"; - -/** - * ⚠️ IMPORTANT DISCLAIMER FOR DEVELOPERS ⚠️ - * - * This user authentication logic is ONLY for demo purposes. - * It generates random users and stores them in localStorage/sessionStorage to simulate - * a multi-user collaboration environment for demonstration. - * - * IN YOUR REAL APPLICATION: - * - Fetch the currently logged in user from YOUR existing authentication system - * - Use your own user management (Auth0, Firebase Auth, custom backend, etc.) - * - Simply pass your authenticated user object to Velt's identify() method - * - You do NOT need to generate random users or store users in localStorage - * - * Example of real-world usage: - * ```typescript - * // Get your authenticated user from your auth system - * const currentUser = await yourAuthSystem.getCurrentUser(); - * - * // Pass it to Velt via authProvider (see VeltInitializeUser.tsx for full implementation) - * const authProvider: VeltAuthProvider = { user: currentUser, generateToken: ... }; - * ``` - * - * The random user generation and storage logic here is purely for demo convenience - * to simulate multiple users without requiring actual authentication infrastructure. - * Do not replicate this pattern in your production application. - */ - -type AppUserContextValue = { - user: User | undefined; - login: (u: User) => void; - logout: () => void; - isUserLoggedIn?: boolean; -}; - -const AppUserContext = React.createContext( - undefined -); - -// Simple hash function to convert userId to a consistent number -function hashStringToIndex(str: string, arrayLength: number): number { - let hash = 0; - for (let i = 0; i < str.length; i++) { - const char = str.charCodeAt(i); - hash = ((hash << 5) - hash) + char; - hash = hash & hash; // Convert to 32-bit integer - } - return Math.abs(hash) % arrayLength; -} - -// Generate a deterministic hash from a string (for userId generation) -function hashString(str: string): string { - let hash = 0; - for (let i = 0; i < str.length; i++) { - const char = str.charCodeAt(i); - hash = ((hash << 5) - hash) + char; - hash = hash & hash; // Convert to 32-bit integer - } - // Convert to base36 and pad to ensure consistent length - return Math.abs(hash).toString(36).padStart(8, '0'); -} - -// Generate a random user with deterministic ID based on name -function generateRandomUser(): User { - const avatarColors = ['#FF6B6B', '#4ECDC4', '#45B7D1', '#FFA07A', '#98D8C8', '#F7DC6F', '#BB8FCE', '#85C1E2']; - - const firstNames = ['Alex', 'Sam', 'Jordan', 'Taylor', 'Casey', 'Morgan', 'Riley', 'Avery']; - const lastNames = ['Smith', 'Johnson', 'Williams', 'Brown', 'Jones', 'Garcia', 'Miller', 'Davis']; - - // Randomly select first and last name - const firstName = firstNames[Math.floor(Math.random() * firstNames.length)]; - const lastName = lastNames[Math.floor(Math.random() * lastNames.length)]; - const fullName = `${firstName} ${lastName}`; - - // Generate deterministic userId from the full name - // This ensures "Alex Smith" always gets the same ID - const userId = `user-${hashString(fullName)}`; - - // Use deterministic color based on userId for consistent photoUrl - const colorIndex = hashStringToIndex(userId, avatarColors.length); - const avatarColor = avatarColors[colorIndex]; - - return { - userId: userId, - name: fullName, - email: `${firstName.toLowerCase()}.${lastName.toLowerCase()}@example.com`, - organizationId: "sample-apps-demo-org", - photoUrl: `https://ui-avatars.com/api/?name=${encodeURIComponent(fullName)}&background=${avatarColor.substring(1)}&color=fff&size=128`, - }; -} - -export function AppUserProvider({ - children -}: { - children: React.ReactNode; -}) { - const [user, setUser] = useState(undefined); - const [isUserLoggedIn, setIsUserLoggedIn] = useState( - undefined - ); - - useEffect(() => { - if (typeof window === 'undefined') return; // Guard against SSR - - try { - // Detect if running in iframe (for master-sample-app dual view) - const isInIframe = window.self !== window.top; - - // Choose storage based on iframe context: - // - In iframe: use sessionStorage (each origin/port is isolated automatically) - // - Not in iframe: use localStorage (same user across tabs) - const storage = isInIframe ? sessionStorage : localStorage; - const STORAGE_KEY = 'velt-demo-user'; - - // Check storage for existing user - const stored = storage.getItem(STORAGE_KEY); - - let selectedUser: User; - if (stored) { - // Use existing user from storage - selectedUser = JSON.parse(stored); - } else { - // Generate NEW random user - selectedUser = generateRandomUser(); - storage.setItem(STORAGE_KEY, JSON.stringify(selectedUser)); - } - - setUser(selectedUser); - setIsUserLoggedIn(true); - } catch {} - }, []); - - const login = useCallback((next: User) => { - if (typeof window === 'undefined') return; - - try { - const isInIframe = window.self !== window.top; - const storage = isInIframe ? sessionStorage : localStorage; - const STORAGE_KEY = 'velt-demo-user'; - - setUser(next); - setIsUserLoggedIn(true); - storage.setItem(STORAGE_KEY, JSON.stringify(next)); - } catch {} - }, []); - - const logout = useCallback(() => { - if (typeof window === 'undefined') return; - - try { - const isInIframe = window.self !== window.top; - const storage = isInIframe ? sessionStorage : localStorage; - const STORAGE_KEY = 'velt-demo-user'; - - setUser(undefined); - setIsUserLoggedIn(false); - storage.removeItem(STORAGE_KEY); - } catch {} - }, []); - - // Memoize the context value to prevent unnecessary re-renders - const contextValue = React.useMemo( - () => ({ user, login, logout, isUserLoggedIn }), - [user, login, logout, isUserLoggedIn] - ); - - return ( - - {children} - - ); -} - -export function useAppUser() { - const ctx = useContext(AppUserContext); - if (!ctx) throw new Error("useAppUser must be used within AppUserProvider"); - return ctx; -} diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/userAuth/useAppUser.ts b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/userAuth/useAppUser.ts deleted file mode 100644 index aa7ef0aa..00000000 --- a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/app/userAuth/useAppUser.ts +++ /dev/null @@ -1,3 +0,0 @@ -'use client'; - -export { AppUserProvider, useAppUser } from './AppUserContext'; diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components.json b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components.json deleted file mode 100644 index 0ad98211..00000000 --- a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "$schema": "https://ui.shadcn.com/schema.json", - "style": "default", - "rsc": true, - "tsx": true, - "tailwind": { - "config": "tailwind.config.js", - "css": "styles/globals.css", - "baseColor": "slate", - "cssVariables": true, - "prefix": "" - }, - "aliases": { - "components": "@/components", - "utils": "@/lib/utils" - } -} diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/ActionModal.tsx b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/ActionModal.tsx deleted file mode 100644 index 0b9e4801..00000000 --- a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/ActionModal.tsx +++ /dev/null @@ -1,227 +0,0 @@ -'use client' - -import { useState } from 'react' -import { VeltCommentTool } from '@veltdev/react' - -interface ActionModalProps { - jobId: string - actionType: string - actionLabel: string - onClose: () => void - onSubmit: () => void -} - -const CloseIcon = () => ( - - - -) - -const CheckIcon = () => ( - - - -) - -export default function ActionModal({ jobId, actionType, actionLabel, onClose, onSubmit }: ActionModalProps) { - const [comment, setComment] = useState('') - const [isSubmitting, setIsSubmitting] = useState(false) - const [showSuccess, setShowSuccess] = useState(false) - - const actionTargetId = `action-${jobId}-${actionType}` - - // Get action-specific styling and messaging - const getActionConfig = () => { - switch (actionType) { - case 'approve': - return { - title: `Approve Job ${jobId}`, - description: 'Add an optional comment explaining your approval decision.', - buttonText: 'Approve', - buttonClass: 'bg-green-600 hover:bg-green-700 text-white', - iconColor: 'text-green-600', - } - case 'reject': - return { - title: `Reject Job ${jobId}`, - description: 'Please provide a reason for rejecting this job.', - buttonText: 'Reject', - buttonClass: 'bg-red-600 hover:bg-red-700 text-white', - iconColor: 'text-red-600', - required: true, - } - case 'dispute': - return { - title: `Resolve Dispute - Job ${jobId}`, - description: 'Add details about how this dispute was resolved.', - buttonText: 'Resolve Dispute', - buttonClass: 'bg-blue-600 hover:bg-blue-700 text-white', - iconColor: 'text-blue-600', - required: true, - } - case 'shortpay': - return { - title: `Short Pay - Job ${jobId}`, - description: 'Explain the reason for short payment and the adjusted amount.', - buttonText: 'Submit Short Pay', - buttonClass: 'bg-amber-600 hover:bg-amber-700 text-white', - iconColor: 'text-amber-600', - required: true, - } - case 'resolve': - return { - title: `Resolve Conflict - Job ${jobId}`, - description: 'Document how this conflict was resolved.', - buttonText: 'Resolve Conflict', - buttonClass: 'bg-blue-600 hover:bg-blue-700 text-white', - iconColor: 'text-blue-600', - required: true, - } - case 'submit': - return { - title: `Submit for Approval - Job ${jobId}`, - description: 'Add any notes for the approver.', - buttonText: 'Submit', - buttonClass: 'bg-blue-600 hover:bg-blue-700 text-white', - iconColor: 'text-blue-600', - } - default: - return { - title: `${actionLabel} - Job ${jobId}`, - description: 'Add a comment for this action.', - buttonText: actionLabel, - buttonClass: 'bg-blue-600 hover:bg-blue-700 text-white', - iconColor: 'text-blue-600', - } - } - } - - const config = getActionConfig() - - const handleSubmit = async () => { - if (config.required && !comment.trim()) { - return // Don't submit if comment is required but empty - } - - setIsSubmitting(true) - - // Simulate API call - await new Promise(resolve => setTimeout(resolve, 500)) - - setIsSubmitting(false) - setShowSuccess(true) - - // Show success for a moment then close - setTimeout(() => { - onSubmit() - }, 1500) - } - - if (showSuccess) { - return ( - <> -
-
-
-
- -
-

- {actionLabel} Complete -

-

- {comment.trim() - ? 'Your comment has been added to this job.' - : 'Action completed successfully.'} -

-
-
- - ) - } - - return ( - <> - {/* Backdrop */} -
- - {/* Modal */} -
-
e.stopPropagation()}> - {/* Header */} -
-

{config.title}

- -
- - {/* Content */} -
-

{config.description}

- - {/* Comment input - action comments are stored but not deletable */} -
- -
-