@veltdev/sdk 4.7.6 → 5.0.0-beta.10

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.
@@ -41,9 +41,29 @@ export interface CopyLinkRequest {
41
41
  annotationId: string;
42
42
  options?: RequestOptions;
43
43
  }
44
+ /**
45
+ * Visibility type for comment annotations.
46
+ * - 'public': Visible to everyone (default:velt)
47
+ * - 'organization': Visible only to users in the specified organization
48
+ * - 'self': Visible only to specified users (private comments)
49
+ */
50
+ export type CommentVisibilityType = 'public' | 'organization' | 'self';
51
+ /**
52
+ * Configuration for comment visibility/access control.
53
+ */
54
+ export interface CommentVisibilityConfig {
55
+ /** The type of visibility for the comment */
56
+ type: CommentVisibilityType;
57
+ /** Organization ID for 'organization' type visibility */
58
+ organizationId?: string;
59
+ /** User IDs for 'self' type visibility - array of user IDs who can see the comment */
60
+ userIds?: string[];
61
+ }
44
62
  export interface AddCommentAnnotationRequest {
45
63
  annotation: CommentAnnotation;
46
64
  options?: RequestOptions;
65
+ /** Optional visibility configuration for the comment */
66
+ visibility?: CommentVisibilityConfig;
47
67
  }
48
68
  export interface ApproveCommentAnnotationRequest {
49
69
  annotationId: string;
@@ -210,12 +230,3 @@ export interface FetchCommentAnnotationsRequest {
210
230
  userIds?: string[];
211
231
  mentionedUserIds?: string[];
212
232
  }
213
- export interface SubmitCommentRequest {
214
- targetComposerElementId: string;
215
- }
216
- export interface ClearComposerRequest {
217
- targetComposerElementId: string;
218
- }
219
- export interface GetComposerDataRequest {
220
- targetComposerElementId: string;
221
- }
@@ -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;
@@ -79,10 +80,10 @@ export type CommentEventTypesMap = {
79
80
  [CommentEventTypes.COMMENT_SIDEBAR_DATA_UPDATE]: CommentSidebarDataUpdateEvent;
80
81
  [CommentEventTypes.AUTOCOMPLETE_SEARCH]: AutocompleteSearchEvent;
81
82
  [CommentEventTypes.COMPOSER_CLICKED]: ComposerClickedEvent;
83
+ [CommentEventTypes.COMPOSER_TEXT_CHANGE]: ComposerTextChangeEvent;
82
84
  [CommentEventTypes.LINK_CLICKED]: LinkClickedEvent;
83
85
  [CommentEventTypes.COMMENT_PIN_CLICKED]: CommentPinClickedEvent;
84
86
  [CommentEventTypes.COMMENT_BUBBLE_CLICKED]: CommentBubbleClickedEvent;
85
- [CommentEventTypes.COMPOSER_TEXT_CHANGE]: ComposerTextChangeEvent;
86
87
  };
87
88
  export interface AddAttachmentEvent {
88
89
  annotationId: string;
@@ -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;
@@ -273,7 +278,5 @@ export interface CommentBubbleClickedEvent {
273
278
  }
274
279
  export interface ComposerTextChangeEvent {
275
280
  text: string;
276
- annotation: CommentAnnotation;
277
- targetComposerElementId: string;
278
281
  metadata?: VeltEventMetadata;
279
282
  }
@@ -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>;
@@ -53,6 +53,14 @@ export declare class Config {
53
53
  * The domain of the API proxy.
54
54
  */
55
55
  apiProxyDomain?: string;
56
+ /**
57
+ * Controls whether global Velt styles are loaded.
58
+ * When true (default), global styles are applied.
59
+ * When false, global styles are not loaded - useful for custom styling.
60
+ *
61
+ * Default: true
62
+ */
63
+ globalStyles?: boolean;
56
64
  }
57
65
  export interface ExtendedFirebaseOptions extends FirebaseOptions {
58
66
  storeDbId: string;
@@ -6,6 +6,8 @@ export interface CustomFilter {
6
6
  }
7
7
  export interface CustomPriority extends CustomFilter {
8
8
  lightColor?: string;
9
+ svg?: string;
10
+ iconUrl?: string;
9
11
  }
10
12
  export interface CustomStatus extends CustomFilter {
11
13
  type: StatusType;
@@ -1,16 +1,16 @@
1
1
  // @ts-nocheck
2
2
  import { Observable } from "rxjs";
3
- import { CommentAnnotation, CommentOnElementConfig, CommentSelectionChangeData, ManualCommentAnnotationConfig, UpdateContextConfig } from "../data/comment-annotation.data.model";
4
- import { AcceptCommentAnnotationEvent, AddCommentAnnotationEvent, AddCommentEvent, AddReactionEvent, ApproveCommentAnnotationEvent, CommentAddEventData, CommentEventTypesMap, CommentUpdateEventData, ComposerTextChangeEvent, CopyLinkEvent, DeleteAttachmentEvent, DeleteCommentAnnotationEvent, DeleteCommentEvent, DeleteReactionEvent, DeleteRecordingEvent, FetchCommentAnnotationsResponse, GetCommentAnnotationsCountResponse, GetCommentAnnotationsResponse, GetLinkEvent, RejectCommentAnnotationEvent, ToggleReactionEvent, UpdateAccessEvent, UpdateCommentEvent, UpdatePriorityEvent, UpdateStatusEvent } from "../data/comment-events.data.model";
5
- import { CustomCategory, CustomPriority, CustomStatus } from "../data/custom-filter.data.model";
6
- import { CustomAnnotationDropdownData } from "../data/custom-chip-dropdown.data.model";
3
+ import { CommentSidebarSystemFiltersOperator, SidebarButtonCountType } from "../../utils/enums";
4
+ import { UploadFileData } from "../data/attachment.model";
7
5
  import { AutocompleteData } from "../data/autocomplete.data.model";
6
+ import { AcceptCommentAnnotationRequest, AddAttachmentRequest, AddAttachmentResponse, AddCommentAnnotationRequest, AddCommentRequest, AddReactionRequest, ApproveCommentAnnotationRequest, AssignUserEvent, AssignUserRequest, CommentRequestQuery, CommentVisibilityConfig, CopyLinkRequest, DeleteAttachmentRequest, DeleteCommentAnnotationRequest, DeleteCommentRequest, DeleteReactionRequest, DeleteRecordingRequest, FetchCommentAnnotationsRequest, GetAttachmentRequest, GetCommentRequest, GetLinkRequest, GetRecordingRequest, RejectCommentAnnotationRequest, ResolveCommentAnnotationRequest, SubscribeCommentAnnotationRequest, ToggleReactionRequest, UnsubscribeCommentAnnotationRequest, UpdateAccessRequest, UpdateCommentRequest, UpdatePriorityRequest, UpdateStatusRequest } from "../data/comment-actions.data.model";
7
+ import { CommentAnnotation, CommentOnElementConfig, CommentSelectionChangeData, ManualCommentAnnotationConfig, UpdateContextConfig } from "../data/comment-annotation.data.model";
8
+ import { AcceptCommentAnnotationEvent, AddCommentAnnotationEvent, AddCommentEvent, AddReactionEvent, ApproveCommentAnnotationEvent, CommentAddEventData, CommentEventTypesMap, CommentUpdateEventData, CopyLinkEvent, DeleteAttachmentEvent, DeleteCommentAnnotationEvent, DeleteCommentEvent, DeleteReactionEvent, DeleteRecordingEvent, FetchCommentAnnotationsResponse, GetCommentAnnotationsCountResponse, GetCommentAnnotationsResponse, GetLinkEvent, RejectCommentAnnotationEvent, ToggleReactionEvent, UpdateAccessEvent, UpdateCommentEvent, UpdatePriorityEvent, UpdateStatusEvent } from "../data/comment-events.data.model";
8
9
  import { CommentSidebarCustomActionEventData, CommentSidebarData, CommentSidebarDataOptions } from "../data/comment-sidebar-config.model";
10
+ import { CommentContextProvider, TransformContext, UnreadCommentsCount } from "../data/comment-utils.data.model";
11
+ import { CustomAnnotationDropdownData } from "../data/custom-chip-dropdown.data.model";
12
+ import { CustomCategory, CustomPriority, CustomStatus } from "../data/custom-filter.data.model";
9
13
  export { ReactionMap } from '../data/reaction-annotation.data.model';
10
- import { AcceptCommentAnnotationRequest, AddAttachmentRequest, AddAttachmentResponse, AddCommentAnnotationRequest, AddCommentRequest, AddReactionRequest, ApproveCommentAnnotationRequest, AssignUserRequest, AssignUserEvent, ClearComposerRequest, CommentRequestQuery, CopyLinkRequest, DeleteAttachmentRequest, DeleteCommentAnnotationRequest, DeleteCommentRequest, DeleteReactionRequest, DeleteRecordingRequest, FetchCommentAnnotationsRequest, GetAttachmentRequest, GetCommentRequest, GetComposerDataRequest, GetLinkRequest, GetRecordingRequest, RejectCommentAnnotationRequest, ResolveCommentAnnotationRequest, SubmitCommentRequest, SubscribeCommentAnnotationRequest, ToggleReactionRequest, UnsubscribeCommentAnnotationRequest, UpdateAccessRequest, UpdateCommentRequest, UpdatePriorityRequest, UpdateStatusRequest } from "../data/comment-actions.data.model";
11
- import { UnreadCommentsCount, TransformContext } from "../data/comment-utils.data.model";
12
- import { AssignToType, CommentSidebarSystemFiltersOperator, SidebarButtonCountType } from "../../utils/enums";
13
- import { UploadFileData } from "../data/attachment.model";
14
14
 
15
15
  export declare class CommentElement {
16
16
  /**
@@ -85,28 +85,6 @@ export declare class CommentElement {
85
85
  */
86
86
  toggleCommentSidebar: () => any;
87
87
 
88
- /**
89
- * To enable context in page mode composer feature
90
- * When enabled, clicking comment tool will open sidebar with page mode composer and pass context
91
- */
92
- enableContextInPageModeComposer: () => void;
93
-
94
- /**
95
- * To disable context in page mode composer feature
96
- */
97
- disableContextInPageModeComposer: () => void;
98
-
99
- /**
100
- * To clear page mode composer context
101
- */
102
- clearPageModeComposerContext: () => void;
103
-
104
- /**
105
- * To set assign to type for comment dialog
106
- * @param type 'dropdown' | 'checkbox'
107
- */
108
- setAssignToType: (type: AssignToType) => void;
109
-
110
88
  /**
111
89
  * To enable moderator mode
112
90
  */
@@ -351,7 +329,7 @@ export declare class CommentElement {
351
329
  * @description Sets the comment context provider
352
330
  * @param provider
353
331
  */
354
- public setContextProvider: (provider: (documentId: string, location?: any) => any) => void;
332
+ public setContextProvider: (provider: CommentContextProvider | null) => void;
355
333
 
356
334
  /**
357
335
  * To enable suggestion mode
@@ -845,6 +823,14 @@ export declare class CommentElement {
845
823
  */
846
824
  public updateContext: (annotationId: string, context: any, config?: UpdateContextConfig) => Promise<any>;
847
825
 
826
+ /**
827
+ * Updates the visibility of a comment annotation.
828
+ * @param annotationId Annotation Id
829
+ * @param visibility Visibility configuration (public, organization, or self)
830
+ * @returns Promise<any>
831
+ */
832
+ public updateVisibility: (annotationId: string, visibility: CommentVisibilityConfig) => Promise<any>;
833
+
848
834
  /**
849
835
  * Subscribe to selected comments
850
836
  * @returns list of selected comments
@@ -1286,6 +1272,13 @@ export declare class CommentElement {
1286
1272
  */
1287
1273
  public disableScreenshot: () => void;
1288
1274
 
1275
+ /**
1276
+ * To programmatically submit a comment from a velt-comment-composer.
1277
+ * Finds the composer within the element identified by referenceId and submits its content.
1278
+ * @param referenceId The ID of the HTML element containing the velt-comment-composer
1279
+ */
1280
+ public submitComment: (referenceId: string) => void;
1281
+
1289
1282
  /**
1290
1283
  * To enable paginated contact list
1291
1284
  */
@@ -1296,26 +1289,6 @@ export declare class CommentElement {
1296
1289
  */
1297
1290
  public disablePaginatedContactList: () => void;
1298
1291
 
1299
- /**
1300
- * Programmatically trigger comment submission for a composer with the given targetComposerElementId
1301
- * @param request SubmitCommentRequest containing targetComposerElementId
1302
- */
1303
- public submitComment: (request: SubmitCommentRequest) => void;
1304
-
1305
- /**
1306
- * Programmatically clear the composer state for the given targetComposerElementId
1307
- * @param request ClearComposerRequest containing targetComposerElementId
1308
- */
1309
- public clearComposer: (request: ClearComposerRequest) => void;
1310
-
1311
- /**
1312
- * Get the current composer data for a given targetComposerElementId
1313
- * Returns the same data as COMPOSER_TEXT_CHANGE event but as a one-time fetch
1314
- * @param request GetComposerDataRequest containing targetComposerElementId
1315
- * @returns The composer data or null if not found
1316
- */
1317
- public getComposerData: (request: GetComposerDataRequest) => ComposerTextChangeEvent | null;
1318
-
1319
1292
  constructor();
1320
1293
  /**
1321
1294
  * Subscribe to comments on the current document.
@@ -2117,6 +2090,14 @@ export declare class CommentElement {
2117
2090
  */
2118
2091
  private _updateContext;
2119
2092
 
2093
+ /**
2094
+ * Updates the visibility of a comment annotation.
2095
+ * @param annotationId Annotation Id
2096
+ * @param visibility Visibility configuration (public, organization, or self)
2097
+ * @returns Promise<any>
2098
+ */
2099
+ private _updateVisibility;
2100
+
2120
2101
  /**
2121
2102
  * Subscribe to selected comments
2122
2103
  * @returns list of selected comments
@@ -2570,43 +2551,9 @@ export declare class CommentElement {
2570
2551
  private _disablePaginatedContactList;
2571
2552
 
2572
2553
  /**
2573
- * Programmatically trigger comment submission for a composer with the given targetComposerElementId
2574
- * @param request SubmitCommentRequest containing targetComposerElementId
2554
+ * To programmatically submit a comment from a velt-comment-composer.
2555
+ * Finds the composer within the element identified by referenceId and submits its content.
2556
+ * @param referenceId The ID of the HTML element containing the velt-comment-composer
2575
2557
  */
2576
2558
  private _submitComment;
2577
-
2578
- /**
2579
- * Programmatically clear the composer state for the given targetComposerElementId
2580
- * @param request ClearComposerRequest containing targetComposerElementId
2581
- */
2582
- private _clearComposer;
2583
-
2584
- /**
2585
- * Get the current composer data for a given targetComposerElementId
2586
- * Returns the same data as COMPOSER_TEXT_CHANGE event but as a one-time fetch
2587
- * @param request GetComposerDataRequest containing targetComposerElementId
2588
- * @returns The composer data or null if not found
2589
- */
2590
- private _getComposerData;
2591
-
2592
- /**
2593
- * To enable context in page mode composer feature
2594
- */
2595
- private _enableContextInPageModeComposer;
2596
-
2597
- /**
2598
- * To disable context in page mode composer feature
2599
- */
2600
- private _disableContextInPageModeComposer;
2601
-
2602
- /**
2603
- * To clear page mode composer context
2604
- */
2605
- private _clearPageModeComposerContext;
2606
-
2607
- /**
2608
- * To set assign to type for comment dialog
2609
- * @param type 'dropdown' | 'checkbox'
2610
- */
2611
- private _setAssignToType;
2612
2559
  }
@@ -11,6 +11,7 @@ export declare class Constants {
11
11
  static LISTENER_BATCH_SIZE: number;
12
12
  static LISTENER_CONTEXT_BATCH_SIZE: number;
13
13
  static DEFAULT_VELT_CONTEXT: string;
14
+ static VISIBILITY_SELF_PREFIX: string;
14
15
  static FIREBASE_PARTIAL_PATH_ORGANIZATIONS: string;
15
16
  static FIREBASE_PARTIAL_PATH_FOLDERS: string;
16
17
  static FIREBASE_PARTIAL_PATH_DOCS: string;
@@ -244,16 +245,6 @@ export declare class Constants {
244
245
  VELT_WIREFRAME: string;
245
246
  VELT_AUTOCOMPLETE: string;
246
247
  VELT_AUTOCOMPLETE_CHIP: string;
247
- VELT_COMMENT_DIALOG_HEADER: string;
248
- VELT_COMMENT_DIALOG_BODY: string;
249
- VELT_COMMENT_DIALOG_FOOTER: string;
250
- VELT_COMMENT_DIALOG_PRIORITY: string;
251
- VELT_COMMENT_DIALOG_STATUS: string;
252
- VELT_COMMENT_DIALOG_COPY_LINK: string;
253
- VELT_COMMENT_DIALOG_RESOLVE_BUTTON: string;
254
- VELT_COMMENT_DIALOG_OPTIONS: string;
255
- VELT_COMMENT_DIALOG_BODY_THREAD_CARD: string;
256
- VELT_COMMENT_DIALOG_PRIVATE_BANNER: string;
257
248
  VELT_COMMENT_COMPOSER: string;
258
249
  VELT_SKELETON_LOADER: string;
259
250
  VELT_SHADOW_DOM_INTERNAL: string;
@@ -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";
@@ -54,10 +55,10 @@ export declare const CommentEventTypes: {
54
55
  readonly COMMENT_SIDEBAR_DATA_UPDATE: "commentSidebarDataUpdate";
55
56
  readonly AUTOCOMPLETE_SEARCH: "autocompleteSearch";
56
57
  readonly COMPOSER_CLICKED: "composerClicked";
58
+ readonly COMPOSER_TEXT_CHANGE: "composerTextChange";
57
59
  readonly LINK_CLICKED: "linkClicked";
58
60
  readonly COMMENT_PIN_CLICKED: "commentPinClicked";
59
61
  readonly COMMENT_BUBBLE_CLICKED: "commentBubbleClicked";
60
- readonly COMPOSER_TEXT_CHANGE: "composerTextChange";
61
62
  };
62
63
  export declare const RecorderEventTypes: {
63
64
  readonly TRANSCRIPTION_DONE: "transcriptionDone";
@@ -186,7 +187,6 @@ export declare enum AnalyticsFeatures {
186
187
  COMMENT_SIDEBAR = "commentSidebar"
187
188
  }
188
189
  export type FeatureType = 'area' | 'arrow' | 'audioHuddle' | 'comment' | 'cursor' | 'huddle' | 'liveStateSync' | 'presence' | 'recorder' | 'rewriter' | 'tag' | 'liveSelection' | 'notification' | 'reaction' | 'multiThread';
189
- export type AssignToType = 'dropdown' | 'checkbox';
190
190
  export declare enum DeviceType {
191
191
  DESKTOP = "Desktop",
192
192
  MOBILE = "Mobile",
@@ -279,10 +279,10 @@ export type OverlayOriginY = 'top' | 'center' | 'bottom';
279
279
  export type OverlayOriginX = 'start' | 'center' | 'end';
280
280
  export type SubtitlesMode = 'floating' | 'embed';
281
281
  export type RecorderVariant = 'default' | 'embed';
282
- export type ReactionPinType = 'timeline' | 'comment' | 'standalone';
282
+ export type ReactionPinType = 'timeline' | 'comment';
283
283
  export type SidebarPosition = 'left' | 'right';
284
284
  export type SidebarSortingCriteria = 'date' | 'unread' | null;
285
- export type SidebarFilterCriteria = 'all' | 'read' | 'unread' | 'resolved' | 'open' | 'assignedToMe' | 'reset' | null;
285
+ export type SidebarFilterCriteria = 'all' | 'read' | 'unread' | 'resolved' | 'open' | 'reset' | null;
286
286
  export type SidebarFilterSearchType = 'people' | 'assigned' | 'tagged' | 'involved' | 'pages' | 'documents' | 'statuses' | 'priorities' | 'categories' | 'versions' | string;
287
287
  export type InlineSortingCriteria = 'createdFirst' | 'createdLast' | 'updatedFirst' | 'updatedLast';
288
288
  export type NotificationPanelMode = 'popover' | 'sidebar';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veltdev/sdk",
3
- "version": "4.7.6",
3
+ "version": "5.0.0-beta.10",
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": [
@@ -36,7 +36,7 @@
36
36
  "scripts": {
37
37
  "test": "echo \"Error: no test specified\" && exit 1",
38
38
  "version:update": "node ../update-npm-package.mjs",
39
- "publish:sdk": "npm publish --access public --tag v4-7-6"
39
+ "publish:sdk": "npm publish --access public"
40
40
  },
41
41
  "author": "",
42
42
  "license": "ISC",