4.0.0-beta.2

Overview

  • Introducing our next major release (4.0.0) in beta
  • Key improvements in this series willfocus on:
    • Advanced data querying capabilities
    • Enhanced security features
    • Powerful customization capabilities that will require significantly less code than before
  • In today’s release we are adding support for multiple document operations:
    • Subscribe to multiple documents simultaneously
    • Perform real-time CRUD operations across multiple documents at once

Steps to upgrade

  1. Deploy v3.0.87 to your product first.
  2. Enable ‘Advanced Queries and Filters’ in the Velt Console here. It will take 15 mins for this to be enabled.
  3. Deploy 4.0.0-beta.2 to your product.

New APIs

1. setDocuments

  • Set multiple documents at the same time. You can specify 30 documents at a time.
  • The first document in the list will be considered as the root document.
  • For features like comments, notifications, recorder, reactions etc. you will be able to read and write to multiple documents at the same time.
  • For features like cursors, presence, huddle, live state sync etc. it will default to the root document.
  • Sidebar will automatically show data from all the documents.

Using Hooks:

const { setDocuments } = useSetDocuments();
setDocuments(documents: Document[], options?: RequestOptions);

Using API:

client.setDocuments(documents: Document[], options?: RequestOptions);
Document: {
  id: string,
  metadata: DocumentMetadata
}

RequestOptions: {
  organizationId: string
}

2. getCommentAnnotations

  • Get all the comment annotations for all the specified documents.
  • You can specify 30 documents at a time.
  • If you don’t specify any query, it will return data from the documents specified in the setDocuments method.

Using Hooks:

const { data } = useGetCommentAnnotations(query); // initial data value while the request is in progress: null

Using API:

const commentElement = client.getCommentElement();
commentElement.getCommentAnnotations(query).subscribe((response) => {
  console.log(response.data);
});
RequestQuery {
  documentIds!: string[],
  locationIds!: string[],
  statusIds!: string[]
};

GetCommentAnnotationsResponse {
  data: Record<string, CommentAnnotation[]>; // Key: documentId, Value: CommentAnnotation[]
};

3. getCommentAnnotationsCount

  • Get the total and unread comment annotations count of all the comment annotations for all the specified documents.
  • You can specify 30 documents at a time.
  • If you don’t specify any query, it will return data from the documents specified in the setDocuments method.

Using Hooks:

const { data } = useCommentAnnotationsCount(query); // initial data value while the request is in progress: null

Using API:

const commentElement = client.getCommentElement();
commentElement.getCommentAnnotationsCount(query).subscribe((response) => {
  console.log(response.data);
});
RequestQuery {
  documentIds!: string[],
  locationIds!: string[],
  statusIds!: string[]
};

GetCommentAnnotationsCountResponse {
  data: Record<string, CommentAnnotationsCount>; // Key: documentId, Value: CommentAnnotationsCount
};

CommentAnnotationsCount {
  unread: number,
  total: number
}

4. Display comments from multiple documents on the same page

  • If you want to display comments from multiple documents on the same page, you can add data-velt-document-id attribute to the container that contains the document.
  • It will be used to identify which part of the DOM belongs to which document.