@veltdev/sdk 5.0.0-beta.5 → 5.0.0-beta.7

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.
@@ -54,6 +54,7 @@ export interface CommentSuggestionEventData {
54
54
  }
55
55
  export type CommentEventTypesMap = {
56
56
  [CommentEventTypes.ADD_COMMENT_ANNOTATION]: AddCommentAnnotationEvent;
57
+ [CommentEventTypes.ADD_COMMENT_ANNOTATION_DRAFT]: AddCommentAnnotationDraftEvent;
57
58
  [CommentEventTypes.APPROVE_COMMENT_ANNOTATION]: ApproveCommentAnnotationEvent;
58
59
  [CommentEventTypes.ACCEPT_COMMENT_ANNOTATION]: AcceptCommentAnnotationEvent;
59
60
  [CommentEventTypes.REJECT_COMMENT_ANNOTATION]: RejectCommentAnnotationEvent;
@@ -97,6 +98,10 @@ export interface DeleteAttachmentEvent {
97
98
  attachment: Attachment;
98
99
  metadata: VeltEventMetadata;
99
100
  }
101
+ export interface AddCommentAnnotationDraftEvent {
102
+ metadata: VeltEventMetadata;
103
+ addContext: (context: Record<string, unknown>) => void;
104
+ }
100
105
  export interface AddCommentAnnotationEvent {
101
106
  annotationId: string;
102
107
  commentAnnotation: CommentAnnotation;
@@ -1,3 +1,4 @@
1
+ import { Location } from './location.model';
1
2
  export interface IUnreadCommentsMap {
2
3
  [annotationId: string]: number;
3
4
  }
@@ -14,3 +15,28 @@ export interface TransformContext {
14
15
  inverseScale?: number;
15
16
  };
16
17
  }
18
+ /**
19
+ * Context data returned by the comment context provider.
20
+ * This is a flexible object that can contain custom properties.
21
+ */
22
+ export interface CommentContext {
23
+ /**
24
+ * Optional comment type. When set to 'manual', the comment will be treated as a manual comment
25
+ * and the target element will be removed.
26
+ */
27
+ commentType?: 'manual' | string;
28
+ /**
29
+ * Allow additional custom properties
30
+ */
31
+ [key: string]: unknown;
32
+ }
33
+ export type CommentContextProviderResponse = CommentContext | null | undefined;
34
+ /**
35
+ * A function that provides custom context for comments.
36
+ * Can return the context synchronously or asynchronously via a Promise.
37
+ *
38
+ * @param documentId - The ID of the document
39
+ * @param location - Optional location information
40
+ * @returns The comment context object or a Promise that resolves to it
41
+ */
42
+ export type CommentContextProvider = (documentId: string, location?: Location) => CommentContextProviderResponse | Promise<CommentContextProviderResponse>;
@@ -8,7 +8,7 @@ import { AutocompleteData } from "../data/autocomplete.data.model";
8
8
  import { CommentSidebarCustomActionEventData, CommentSidebarData, CommentSidebarDataOptions } from "../data/comment-sidebar-config.model";
9
9
  export { ReactionMap } from '../data/reaction-annotation.data.model';
10
10
  import { AcceptCommentAnnotationRequest, AddAttachmentRequest, AddAttachmentResponse, AddCommentAnnotationRequest, AddCommentRequest, AddReactionRequest, ApproveCommentAnnotationRequest, AssignUserRequest, AssignUserEvent, CopyLinkRequest, DeleteAttachmentRequest, DeleteCommentAnnotationRequest, CommentRequestQuery, CommentRequestQuery, DeleteCommentRequest, DeleteReactionRequest, DeleteRecordingRequest, GetAttachmentRequest, GetCommentRequest, GetLinkRequest, GetRecordingRequest, RejectCommentAnnotationRequest, ResolveCommentAnnotationRequest, SubscribeCommentAnnotationRequest, UnsubscribeCommentAnnotationRequest, ToggleReactionRequest, UpdateAccessRequest, UpdateCommentRequest, UpdatePriorityRequest, UpdateStatusRequest, FetchCommentAnnotationsRequest } from "../data/comment-actions.data.model";
11
- import { UnreadCommentsCount, TransformContext } from "../data/comment-utils.data.model";
11
+ import { CommentContextProvider, UnreadCommentsCount, TransformContext } from "../data/comment-utils.data.model";
12
12
  import { CommentSidebarSystemFiltersOperator, SidebarButtonCountType } from "../../utils/enums";
13
13
  import { UploadFileData } from "../data/attachment.model";
14
14
 
@@ -329,7 +329,7 @@ export declare class CommentElement {
329
329
  * @description Sets the comment context provider
330
330
  * @param provider
331
331
  */
332
- public setContextProvider: (provider: (documentId: string, location?: any) => any) => void;
332
+ public setContextProvider: (provider: CommentContextProvider | null) => void;
333
333
 
334
334
  /**
335
335
  * To enable suggestion mode
@@ -29,6 +29,7 @@ export declare enum ResolverActions {
29
29
  }
30
30
  export declare const CommentEventTypes: {
31
31
  readonly ADD_COMMENT_ANNOTATION: "addCommentAnnotation";
32
+ readonly ADD_COMMENT_ANNOTATION_DRAFT: "addCommentAnnotationDraft";
32
33
  readonly DELETE_COMMENT_ANNOTATION: "deleteCommentAnnotation";
33
34
  readonly APPROVE_COMMENT_ANNOTATION: "approveCommentAnnotation";
34
35
  readonly ACCEPT_COMMENT_ANNOTATION: "acceptCommentAnnotation";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veltdev/sdk",
3
- "version": "5.0.0-beta.5",
3
+ "version": "5.0.0-beta.7",
4
4
  "description": "Velt is an SDK to add collaborative features to your product within minutes. Example: Comments like Figma, Frame.io, Google docs or sheets, Recording like Loom, Huddles like Slack and much more.",
5
5
  "homepage": "https://velt.dev",
6
6
  "keywords": [