@veltdev/sdk 4.2.0 → 4.2.1-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.
@@ -1,6 +1,6 @@
1
1
  // @ts-nocheck
2
2
  import { Observable } from "rxjs";
3
- import { Config } from "../models/data/config.data.model";
3
+ import { Config, DisableLogsConfig } from "../models/data/config.data.model";
4
4
  import { DocumentUser } from "../models/data/document-user.data.model";
5
5
  import { Location } from "../models/data/location.model";
6
6
  import { User, UserOptions } from "../models/data/user.data.model";
@@ -26,7 +26,7 @@ import { DocumentMetadata } from "../models/data/document-metadata.model";
26
26
  import { ReactionElement } from "../models/element/reaction-element.model";
27
27
  import { VeltEventMetadata } from "../models/data/event-metadata.data.model";
28
28
  import { CoreEventTypesMap } from "../models/data/core-events.data.model";
29
- import { Document, SetDocumentsRequestOptions, FetchDocumentsRequest, FetchFoldersRequest, UpdateDocumentsRequest } from "../models/data/document.data.model";
29
+ import { Document, SetDocumentsRequestOptions, FetchDocumentsRequest, FetchFoldersRequest, UpdateDocumentsRequest, UpdateLocationsRequest } from "../models/data/document.data.model";
30
30
  import { FetchDocumentsResponse, FetchFoldersResponse } from "../models/data/document-events.data.model";
31
31
  import { UserDataProvider } from "../models/data/user-resolver.data.model";
32
32
  import { VeltDataProvider } from "../models/data/provider.data.model";
@@ -76,6 +76,8 @@ export declare class Snippyly {
76
76
  */
77
77
  updateDocuments: (request: UpdateDocumentsRequest) => Promise<any>;
78
78
 
79
+ updateLocations: (request: UpdateLocationsRequest) => Promise<any>;
80
+
79
81
  /**
80
82
  * To fetch folders
81
83
  */
@@ -120,25 +122,25 @@ export declare class Snippyly {
120
122
  /**
121
123
  * Get the Presence Element Object to access the raw presence data.
122
124
  *
123
- * This is for Pros who dont want to use Snippyly Presence web component and want to design their own UI.
125
+ * This is for Pros who don't want to use Snippyly Presence web component and want to design their own UI.
124
126
  */
125
127
  getPresenceElement: () => PresenceElement;
126
128
  /**
127
129
  * Get the Cursor Element Object to access the raw cursor data.
128
130
  *
129
- * This is for Pros who dont want to use Snippyly Presence web component and want to design their own UI.
131
+ * This is for Pros who don't want to use Snippyly Presence web component and want to design their own UI.
130
132
  */
131
133
  getCursorElement: () => CursorElement;
132
134
  /**
133
135
  * Get the Comment Element Object to access the raw comment data.
134
136
  *
135
- * This is for Pros who dont want to use Snippyly Comment web component and want to design their own UI.
137
+ * This is for Pros who don't want to use Snippyly Comment web component and want to design their own UI.
136
138
  */
137
139
  getCommentElement: () => CommentElement;
138
140
  /**
139
141
  * Get the Tag Pin Annotation Object to access the raw tag data.
140
142
  *
141
- * This is for Pros who dont want to use Snippyly Tag web component and want to design their own UI.
143
+ * This is for Pros who don't want to use Snippyly Tag web component and want to design their own UI.
142
144
  */
143
145
  getTagElement: () => TagElement;
144
146
  /**
@@ -258,11 +260,10 @@ export declare class Snippyly {
258
260
  setLanguage: (language: string) => void;
259
261
 
260
262
  /**
261
- * To set the translations for the language.
262
- * @param language Language code
263
- * @param translations Translations object
263
+ * To set translations for multiple languages
264
+ * @param translations Object containing translations for multiple languages
264
265
  */
265
- setTranslations: (language: string, translations: { [key: string]: string }) => void;
266
+ setTranslations: (translations: { [language: string]: { [key: string]: string } }) => void;
266
267
 
267
268
  /**
268
269
  * To enable auto translation.
@@ -308,5 +309,5 @@ export declare class Snippyly {
308
309
  /**
309
310
  * To disable logs.
310
311
  */
311
- disableLogs: () => void;
312
+ disableLogs: (config?: DisableLogsConfig) => void;
312
313
  }
@@ -1,10 +1,12 @@
1
+ import { ResolverActions } from "../../utils/enums";
1
2
  import { BaseMetadata } from "./base-metadata.data.model";
2
3
  import { CommentAnnotation } from "./comment-annotation.data.model";
4
+ import { ResolverConfig, ResolverResponse } from "./resolver.data.model";
3
5
  export interface CommentAnnotationDataProvider {
4
- get: (request: GetCommentRequest) => Promise<Record<string, PartialCommentAnnotation>>;
5
- save: (request: SaveCommentRequest) => Promise<void>;
6
- delete: (request: DeleteCommentRequest) => Promise<void>;
7
- resolveTimeout?: number;
6
+ get: (request: GetCommentRequest) => Promise<ResolverResponse<Record<string, PartialCommentAnnotation>>>;
7
+ save: (request: SaveCommentRequest) => Promise<ResolverResponse<undefined>>;
8
+ delete: (request: DeleteCommentRequest) => Promise<ResolverResponse<undefined>>;
9
+ config?: ResolverConfig;
8
10
  }
9
11
  export interface GetCommentRequest {
10
12
  organizationId: string;
@@ -16,11 +18,14 @@ export interface GetCommentRequest {
16
18
  export interface DeleteCommentRequest {
17
19
  commentAnnotationId: string;
18
20
  metadata?: BaseMetadata;
21
+ event?: ResolverActions;
19
22
  }
20
23
  export interface SaveCommentRequest {
21
24
  commentAnnotation: {
22
25
  [key: string]: PartialCommentAnnotation;
23
26
  };
27
+ event?: ResolverActions;
28
+ commentId?: string;
24
29
  }
25
30
  export interface PartialComment {
26
31
  commentId: string | number;
@@ -32,6 +37,7 @@ export interface PartialCommentAnnotationResult {
32
37
  [annotationId: string]: PartialCommentAnnotation;
33
38
  } | null;
34
39
  originalData: CommentAnnotation | null;
40
+ eventType?: ResolverActions;
35
41
  }
36
42
  export interface PartialCommentAnnotation {
37
43
  annotationId: string;
@@ -58,3 +58,7 @@ export interface AdvancedQueries {
58
58
  advancedQueriesEnabled: boolean;
59
59
  advancedQueriesEnabledTime: number;
60
60
  }
61
+ export interface DisableLogsConfig {
62
+ warnings?: boolean;
63
+ suppressAll?: boolean;
64
+ }
@@ -9,12 +9,22 @@ export interface SetDocumentsRequestOptions {
9
9
  allDocuments?: boolean;
10
10
  locationId?: string;
11
11
  }
12
- export interface UpdateDocumentsRequest {
12
+ export interface UpdateDocumentsRequest<T = unknown> {
13
13
  organizationId?: string;
14
- documents?: {
15
- documentId: string;
16
- [key: string]: any;
17
- }[];
14
+ documents?: UpdateDocumentMetadata<T>[];
15
+ }
16
+ export interface UpdateDocumentMetadata<T = unknown> {
17
+ documentId: string;
18
+ [key: string]: T | string;
19
+ }
20
+ export interface UpdateLocationsRequest<T = unknown> {
21
+ organizationId?: string;
22
+ documentIds?: string[];
23
+ locations?: UpdateLocationMetadata<T>[];
24
+ }
25
+ export interface UpdateLocationMetadata<T = unknown> {
26
+ id: string;
27
+ [key: string]: T | string;
18
28
  }
19
29
  export interface FetchDocumentsRequest {
20
30
  organizationId?: string;
@@ -22,6 +32,12 @@ export interface FetchDocumentsRequest {
22
32
  folderId?: string;
23
33
  allDocuments?: boolean;
24
34
  }
35
+ export interface FetchLocationsRequest {
36
+ organizationId?: string;
37
+ documentIds?: string[];
38
+ folderId?: string;
39
+ allDocuments?: boolean;
40
+ }
25
41
  export interface FetchFoldersRequest {
26
42
  organizationId?: string;
27
43
  folderId?: string;
@@ -1,3 +1,4 @@
1
+ import { BaseMetadata } from "./base-metadata.data.model";
1
2
  import { Location } from "./location.model";
2
3
  import { PageInfo } from "./page-info.model";
3
4
  export declare class LocationMetadata {
@@ -5,6 +6,10 @@ export declare class LocationMetadata {
5
6
  * Unique location id generated from client location information
6
7
  */
7
8
  locationId?: number;
9
+ /**
10
+ * Location id generated from velt location information
11
+ */
12
+ veltLocationId?: string;
8
13
  /**
9
14
  * Location object provided by a client
10
15
  */
@@ -13,4 +18,13 @@ export declare class LocationMetadata {
13
18
  * Page metadata
14
19
  */
15
20
  pageInfo?: PageInfo;
21
+ /**
22
+ * Location metadata
23
+ */
24
+ metadata?: BaseMetadata;
25
+ }
26
+ export interface LocationMetadatas {
27
+ [documentId: string]: {
28
+ [locationId: string]: LocationMetadata;
29
+ };
16
30
  }
@@ -6,6 +6,7 @@ export declare class MediaPreviewConfig {
6
6
  video?: {
7
7
  enabled?: boolean;
8
8
  deviceId?: string;
9
+ track?: MediaStreamTrack;
9
10
  };
10
11
  screen?: {
11
12
  enabled?: boolean;
@@ -1,6 +1,8 @@
1
1
  import { CommentAnnotationDataProvider } from "./comment-resolver.data.model";
2
+ import { ReactionAnnotationDataProvider } from "./reaction-resolver.data.model";
2
3
  import { UserDataProvider } from "./user-resolver.data.model";
3
4
  export interface VeltDataProvider {
4
5
  comment?: CommentAnnotationDataProvider;
5
6
  user?: UserDataProvider;
7
+ reaction?: ReactionAnnotationDataProvider;
6
8
  }
@@ -49,6 +49,7 @@ export declare class ReactionAnnotation {
49
49
  pageInfo?: PageInfo;
50
50
  from?: User;
51
51
  icon?: string;
52
+ isReactionResolverUsed?: boolean;
52
53
  iconUrl?: string;
53
54
  iconEmoji?: string;
54
55
  metadata?: ReactionMetadata;
@@ -0,0 +1,39 @@
1
+ import { BaseMetadata } from "./base-metadata.data.model";
2
+ import { ReactionAnnotation } from "./reaction-annotation.data.model";
3
+ import { ResolverResponse, ResolverConfig } from "./resolver.data.model";
4
+ import { ResolverActions } from "../../utils/enums";
5
+ export interface ReactionAnnotationDataProvider {
6
+ get: (request: GetReactionRequest) => Promise<ResolverResponse<Record<string, PartialReactionAnnotation>>>;
7
+ save: (request: SaveReactionRequest) => Promise<ResolverResponse<undefined>>;
8
+ delete: (request: DeleteReactionRequest) => Promise<ResolverResponse<undefined>>;
9
+ config?: ResolverConfig;
10
+ }
11
+ export interface GetReactionRequest {
12
+ organizationId: string;
13
+ reactionAnnotationIds?: string[];
14
+ documentIds?: string[];
15
+ folderId?: string;
16
+ allDocuments?: boolean;
17
+ }
18
+ export interface DeleteReactionRequest {
19
+ reactionAnnotationId: string;
20
+ metadata?: BaseMetadata;
21
+ event?: ResolverActions;
22
+ }
23
+ export interface SaveReactionRequest {
24
+ reactionAnnotation: {
25
+ [key: string]: PartialReactionAnnotation;
26
+ };
27
+ event?: ResolverActions;
28
+ }
29
+ export interface PartialReactionAnnotationResult {
30
+ strippedData: {
31
+ [annotationId: string]: PartialReactionAnnotation;
32
+ } | null;
33
+ originalData: ReactionAnnotation | null;
34
+ }
35
+ export interface PartialReactionAnnotation {
36
+ annotationId: string;
37
+ metadata?: BaseMetadata;
38
+ icon?: string;
39
+ }
@@ -0,0 +1,21 @@
1
+ export interface ResolverConfig {
2
+ resolveTimeout?: number;
3
+ saveRetryConfig?: RetryConfig;
4
+ deleteRetryConfig?: RetryConfig;
5
+ }
6
+ export interface ResolverResponse<T> {
7
+ data?: T;
8
+ success: boolean;
9
+ message?: string;
10
+ timestamp?: number;
11
+ statusCode: number;
12
+ }
13
+ export interface RetryConfig {
14
+ retryCount?: number;
15
+ retryDelay?: number;
16
+ revertOnFailure?: boolean;
17
+ }
18
+ export interface ResolverResponseConfig {
19
+ revertOnFailure?: boolean;
20
+ isSuccess?: boolean;
21
+ }
@@ -1,5 +1,5 @@
1
1
  import { User } from "./user.data.model";
2
2
  export interface UserDataProvider {
3
- getUsers(userIds: string[]): Promise<Record<string, User>>;
3
+ get(userIds: string[]): Promise<Record<string, User>>;
4
4
  resolveTimeout?: number;
5
5
  }
@@ -1093,6 +1093,16 @@ export declare class CommentElement {
1093
1093
  */
1094
1094
  public fetchCommentAnnotations: (fetchCommentAnnotationsRequest: FetchCommentAnnotationsRequest) => Promise<FetchCommentAnnotationsResponse>;
1095
1095
 
1096
+ /**
1097
+ * To enable svg as img
1098
+ */
1099
+ public enableSvgAsImg: () => void;
1100
+
1101
+ /**
1102
+ * To disable svg as img
1103
+ */
1104
+ public disableSvgAsImg: () => void;
1105
+
1096
1106
  constructor();
1097
1107
  /**
1098
1108
  * Subscribe to comments on the current document.
@@ -2167,4 +2177,14 @@ export declare class CommentElement {
2167
2177
  * To fetch comment annotations
2168
2178
  */
2169
2179
  private _fetchCommentAnnotations;
2180
+
2181
+ /**
2182
+ * To enable svg as img
2183
+ */
2184
+ private _enableSvgAsImg;
2185
+
2186
+ /**
2187
+ * To disable svg as img
2188
+ */
2189
+ private _disableSvgAsImg;
2170
2190
  }
@@ -250,6 +250,7 @@ export declare class Constants {
250
250
  VELT_SHADOW_DOM_INTERNAL: string;
251
251
  };
252
252
  static ATTRIBUTES: {
253
+ VELT_COMMENT_CONTAINER: string;
253
254
  VELT_TARGET_COMMENT_ELEMENT_ID: string;
254
255
  VELT_COMMENT_TYPE: string;
255
256
  TARGET_INLINE_COMMENT_ELEMENT_ID: string;
@@ -316,6 +317,7 @@ export declare class Constants {
316
317
  VELT_COMMENT_DIALOG_PORTAL_INTERNAL: string;
317
318
  ANNOTATION_ID: string;
318
319
  MULTI_THREAD_ANNOTATION_ID: string;
320
+ SLATE_EDITOR: string;
319
321
  };
320
322
  static INJECTION_STYLE_PROPS: {
321
323
  /**
@@ -16,6 +16,15 @@ export declare enum CommentStatus {
16
16
  SUBSCRIBED = "subscribed",
17
17
  UNSUBSCRIBED = "unsubscribed"
18
18
  }
19
+ export declare enum ResolverActions {
20
+ COMMENT_ANNOTATION_ADD = "comment_annotation.add",
21
+ COMMENT_ANNOTATION_DELETE = "comment_annotation.delete",
22
+ COMMENT_ADD = "comment.add",
23
+ COMMENT_DELETE = "comment.delete",
24
+ COMMENT_UPDATE = "comment.update",
25
+ REACTION_ADD = "reaction.add",
26
+ REACTION_DELETE = "reaction.delete"
27
+ }
19
28
  export declare const CommentEventTypes: {
20
29
  readonly ADD_COMMENT_ANNOTATION: "addCommentAnnotation";
21
30
  readonly DELETE_COMMENT_ANNOTATION: "deleteCommentAnnotation";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veltdev/sdk",
3
- "version": "4.2.0",
3
+ "version": "4.2.1-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": [