@veltdev/sdk 1.0.23 → 1.0.25

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.
@@ -7,6 +7,7 @@ import { User, UserOptions } from "../models/data/user.data.model";
7
7
  import { CommentElement } from "../models/element/comment-element.model";
8
8
  import { ContactElement } from "../models/element/contact-element.model";
9
9
  import { CursorElement } from "../models/element/cursor-element.model";
10
+ import { LiveStateSyncElement } from "../models/element/live-state-sync-element.model";
10
11
  import { PresenceElement } from "../models/element/presence-element.model";
11
12
  import { RecorderElement } from "../models/element/recorder-element.model";
12
13
  import { RewriterElement } from "../models/element/rewriter-element.model";
@@ -97,6 +98,10 @@ export declare class Snippyly {
97
98
  * Get the Rewriter Object.
98
99
  */
99
100
  getRewriterElement: () => RewriterElement;
101
+ /**
102
+ * Get the LiveStateSync Object.
103
+ */
104
+ getLiveStateSyncElement: () => LiveStateSyncElement;
100
105
  /**
101
106
  * To signout a user
102
107
  */
@@ -92,4 +92,6 @@ export declare class DocumentPaths {
92
92
  */
93
93
  flock?: string;
94
94
  syncVideoPlayer?: string;
95
+ liveState?: string;
96
+ liveStateSingleEditorMode?: string;
95
97
  }
@@ -1,7 +1,21 @@
1
- import { LiveStateData } from "./live-state-data.data.model";
1
+ import { LiveStateData, SingleEditorLiveStateData } from "./live-state-data.data.model";
2
2
  export declare class LiveStateDataMap {
3
3
  /**
4
4
  * Map of all unique LiveStateData set by you on the given document.
5
5
  */
6
- [liveStateDataId: string]: LiveStateData;
6
+ custom?: {
7
+ [liveStateDataId: string]: LiveStateData;
8
+ };
9
+ /**
10
+ * Map of all unique LiveStateData set by the default editor on the given document.
11
+ */
12
+ default?: {
13
+ singleEditor?: SingleEditorLiveStateData;
14
+ autoSyncState?: {
15
+ current?: LiveStateData;
16
+ history?: {
17
+ [liveStateDataId: string]: LiveStateData;
18
+ };
19
+ };
20
+ };
7
21
  }
@@ -1,4 +1,10 @@
1
+ import { User } from "./user.data.model";
1
2
  export declare class LiveStateData {
3
+ /**
4
+ * Unique identifier to identify the document you are syncing.
5
+ * This id is md5 of liveStateDataId.
6
+ */
7
+ id: string;
2
8
  /**
3
9
  * Unique identifier to identify the state data you are syncing.
4
10
  */
@@ -8,4 +14,15 @@ export declare class LiveStateData {
8
14
  *
9
15
  */
10
16
  data: string | number | boolean | JSON;
17
+ lastUpdated: any;
18
+ updatedBy: User;
19
+ }
20
+ export declare class SingleEditorLiveStateData {
21
+ editor?: User | null;
22
+ requestEditorAccess?: {
23
+ user: User;
24
+ requestedAt: any;
25
+ status: 'pending' | 'accepted' | 'rejected';
26
+ waitTime: number;
27
+ } | null;
11
28
  }
@@ -0,0 +1,118 @@
1
+ // @ts-nocheck
2
+
3
+ /**
4
+ * Represents the synchronization element for live state.
5
+ */
6
+ export declare class LiveStateSyncElement {
7
+
8
+ /**
9
+ * Gets live state data based on the provided ID.
10
+ */
11
+ getLiveStateData: (liveStateDataId?: string) => Observable<any>;
12
+
13
+ /**
14
+ * Gets live state data as an observable based on the provided ID.
15
+ * @deprecated Use `getLiveStateData` instead
16
+ */
17
+ getLiveStateData$: (liveStateDataId?: string) => Observable<any>;
18
+
19
+ /**
20
+ * Sets live state data for the provided ID and data.
21
+ */
22
+ setLiveStateData: (liveStateDataId: string, liveStateData: any) => any;
23
+
24
+ /**
25
+ * Enables the single editor mode.
26
+ */
27
+ enableSingleEditorMode: () => void;
28
+
29
+ /**
30
+ * Disables the single editor mode.
31
+ */
32
+ disableSingleEditorMode: () => void;
33
+
34
+ /**
35
+ * Checks if the current user is an editor. Returns an observable.
36
+ * @deprecated Use `isUserEditor` instead
37
+ */
38
+ isUserEditor$: () => Observable<boolean | null>;
39
+
40
+ /**
41
+ * Checks if the current user is an editor. Returns an observable.
42
+ */
43
+ isUserEditor: () => Observable<boolean | null>;
44
+
45
+ /**
46
+ * Sets the current user as an editor.
47
+ */
48
+ setUserAsEditor: () => void;
49
+
50
+ /**
51
+ * Resets the user access.
52
+ */
53
+ resetUserAccess: () => void;
54
+
55
+ /**
56
+ * To disable elements inside specific elements only when single editor mode is on
57
+ * @param elementIds Element ids
58
+ */
59
+ allowedElementIds: (elementIds: string[]) => void;
60
+
61
+ /**
62
+ * Constructor for LiveStateSyncElement.
63
+ */
64
+ constructor();
65
+
66
+ /**
67
+ * Private method for getting live state data as an observable.
68
+ */
69
+ private _getLiveStateData;
70
+
71
+ /**
72
+ * Private method for getting live state data as an observable.
73
+ * @deprecated Use `_getLiveStateData` instead
74
+ */
75
+ private _getLiveStateData$;
76
+
77
+ /**
78
+ * Private method for setting live state data.
79
+ */
80
+ private _setLiveStateData;
81
+
82
+ /**
83
+ * Private method to enable single editor mode.
84
+ */
85
+ private _enableSingleEditorMode;
86
+
87
+ /**
88
+ * Private method to disable single editor mode.
89
+ */
90
+ private _disableSingleEditorMode;
91
+
92
+ /**
93
+ * Private method to check if the user is an editor.
94
+ * @deprecated Use `_isUserEditor` instead
95
+ */
96
+ private _isUserEditor$;
97
+
98
+ /**
99
+ * Private method to check if the user is an editor.
100
+ */
101
+ private _isUserEditor;
102
+
103
+ /**
104
+ * Private method to set user as an editor.
105
+ */
106
+ private _setUserAsEditor;
107
+
108
+ /**
109
+ * Private method to reset user access.
110
+ */
111
+ private _resetUserAccess;
112
+
113
+ /**
114
+ * To disable elements inside specific elements only when single editor mode is on
115
+ * @param elementIds Element ids
116
+ */
117
+ private _allowedElementIds;
118
+ }
@@ -25,6 +25,7 @@ export declare class Constants {
25
25
  static FIREBASE_PARTIAL_PATH_RECORDER: string;
26
26
  static FIREBASE_PARTIAL_PATH_FOLLOW_ALONG: string;
27
27
  static FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER: string;
28
+ static FIREBASE_PARTIAL_PATH_LIVE_STATE: string;
28
29
  static FIREBASE_PARTIAL_PATH_IAM: string;
29
30
  static FIREBASE_PARTIAL_PATH_USERS: string;
30
31
  static FIREBASE_PARTIAL_PATH_USER_REQUESTS: string;
@@ -233,6 +234,10 @@ export declare class Constants {
233
234
  SYNC_VIDEO_PLAYER: string;
234
235
  VELT_INLINE_COMMENT_ID: string;
235
236
  VELT_PDF_VIEWER: string;
237
+ VELT_SYNC_STATE: string;
238
+ VELT_SYNC_ACCESS: string;
239
+ VELT_SYNC_ACCESS_AUTO: string;
240
+ VELT_SYNC_ACCESS_DISABLED: string;
236
241
  };
237
242
  static INJECTION_STYLE_PROPS: {
238
243
  /**
@@ -291,6 +296,7 @@ export declare class Constants {
291
296
  static VELT_COLOR: string;
292
297
  static VELT_MIN_ARROW_LENGTH: number;
293
298
  static VELT_ARROW_VIEWPORT_PADDING: number;
299
+ static LIVE_STATE_REQUEST_EDITOR_ACCESS_WAIT_TIME: number;
294
300
  static CURSOR: {
295
301
  COMMENT_PIN: string;
296
302
  TAG_PIN: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veltdev/sdk",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "description": "",
5
5
  "main": "velt.js",
6
6
  "scripts": {