@veltdev/sdk 4.5.6-beta.9 → 4.5.6
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.
- package/app/client/snippyly.model.d.ts +4 -1
- package/app/models/data/anchor-record.data.model.d.ts +109 -0
- package/app/models/data/comment-annotation.data.model.d.ts +1 -0
- package/app/models/data/comment.data.model.d.ts +2 -0
- package/app/models/data/resolver.data.model.d.ts +1 -0
- package/app/models/data/target-element.data.model.d.ts +5 -0
- package/app/models/data/target-text-range.data.model.d.ts +5 -0
- package/app/models/data/user.data.model.d.ts +23 -0
- package/app/models/element/comment-element.model.d.ts +20 -0
- package/app/utils/enums.d.ts +1 -0
- package/models.d.ts +1 -0
- package/package.json +1 -1
- package/velt.js +92 -92
|
@@ -3,7 +3,7 @@ import { Observable } from "rxjs";
|
|
|
3
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
|
-
import { User, UserOptions, VeltAuthProvider } from "../models/data/user.data.model";
|
|
6
|
+
import { User, UserOptions, VeltAuthProvider, VeltPermissionProvider } from "../models/data/user.data.model";
|
|
7
7
|
import { CustomCss } from "../models/data/custom-css.data.model";
|
|
8
8
|
import { AreaElement } from "../models/element/area-element.model";
|
|
9
9
|
import { ArrowElement } from "../models/element/arrow-element.model";
|
|
@@ -100,6 +100,9 @@ export declare class Snippyly {
|
|
|
100
100
|
* To set the data provider.
|
|
101
101
|
*/
|
|
102
102
|
setDataProviders: (dataProvider: VeltDataProvider) => void;
|
|
103
|
+
|
|
104
|
+
setPermissionProvider: (permissionProvider: VeltPermissionProvider) => void;
|
|
105
|
+
|
|
103
106
|
/**
|
|
104
107
|
* To set the encryption provider.
|
|
105
108
|
*/
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content hash for secure, privacy-preserving element validation.
|
|
3
|
+
*/
|
|
4
|
+
export interface ContentHash {
|
|
5
|
+
/** MD5 hash value (base36 encoded, ~12 characters) */
|
|
6
|
+
value: string;
|
|
7
|
+
/** Hashing algorithm (always 'md5') */
|
|
8
|
+
algorithm: 'md5';
|
|
9
|
+
/** Source of hash (always 'textContent') */
|
|
10
|
+
source: 'textContent';
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Robust anchor record for reliable DOM element re-location.
|
|
14
|
+
*
|
|
15
|
+
* Survives:
|
|
16
|
+
* - Page reloads
|
|
17
|
+
* - Framework re-renders (React, Vue, Angular)
|
|
18
|
+
* - Dynamic ID changes
|
|
19
|
+
* - Minor DOM restructuring
|
|
20
|
+
*
|
|
21
|
+
* Does not survive:
|
|
22
|
+
* - Major redesigns
|
|
23
|
+
* - Content reordering (sort, filter)
|
|
24
|
+
* - Element removal
|
|
25
|
+
*
|
|
26
|
+
* **Resolution Strategy (priority order):**
|
|
27
|
+
* 1. id (90) - Stable, non-dynamic ID
|
|
28
|
+
* 2. css (80/60) - Attribute selector
|
|
29
|
+
* 3. robustXPath (50) - Attribute-based path
|
|
30
|
+
* 4. containerHints (40) - Scoped search
|
|
31
|
+
* 5. xPath variants (32-28) - Structural fallback
|
|
32
|
+
* 6. contentHash (15) - Hash-based scan
|
|
33
|
+
*
|
|
34
|
+
* **Validation boosts:** tagName (+10), contentHash (+30)
|
|
35
|
+
*
|
|
36
|
+
* **Security:** No plaintext storage, MD5 hash only.
|
|
37
|
+
*/
|
|
38
|
+
export interface AnchorRecord {
|
|
39
|
+
/** Schema version (current: "1.0") */
|
|
40
|
+
version: '1.0';
|
|
41
|
+
/**
|
|
42
|
+
* Stable element ID (non-dynamic only).
|
|
43
|
+
*
|
|
44
|
+
* Excluded patterns:
|
|
45
|
+
* - yui_* (YUI framework)
|
|
46
|
+
*/
|
|
47
|
+
id?: string;
|
|
48
|
+
/** Tag name (uppercase, e.g., 'DIV', 'BUTTON') */
|
|
49
|
+
tagName: string;
|
|
50
|
+
/**
|
|
51
|
+
* CSS selector from stable attributes.
|
|
52
|
+
*
|
|
53
|
+
* Example: `[data-testid='submit-btn'][role='button']`
|
|
54
|
+
*/
|
|
55
|
+
elementSelector?: string;
|
|
56
|
+
/**
|
|
57
|
+
* XPath variants (in order of stability):
|
|
58
|
+
*
|
|
59
|
+
* 1. robustXPath - Attribute-based (MOST STABLE)
|
|
60
|
+
* - Prioritizes: data-* > role > stable ID > aria-* > position
|
|
61
|
+
* - Example: `//div[@role='main']/.../li[5]/span`
|
|
62
|
+
* - Ignores dynamic IDs
|
|
63
|
+
* - Stops at landmarks (main, nav, etc.)
|
|
64
|
+
*
|
|
65
|
+
* 2. xPath - Basic XPath (uses IDs when available)
|
|
66
|
+
* 3. cfXPath - Positional with class hints
|
|
67
|
+
* 4. fXPath - Pure positional (most fragile)
|
|
68
|
+
*/
|
|
69
|
+
robustXPath?: string;
|
|
70
|
+
xPath?: string;
|
|
71
|
+
fXPath?: string;
|
|
72
|
+
cfXPath?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Content hash for secure validation.
|
|
75
|
+
*/
|
|
76
|
+
contentHash?: ContentHash;
|
|
77
|
+
/** Creation timestamp (milliseconds since epoch) */
|
|
78
|
+
createdAt?: number;
|
|
79
|
+
/** Parent element anchor record */
|
|
80
|
+
parent?: AnchorRecord;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Result of anchor resolution.
|
|
84
|
+
*/
|
|
85
|
+
export interface AnchorResolution {
|
|
86
|
+
/** Resolved element (null if not found) */
|
|
87
|
+
element: Element | null;
|
|
88
|
+
/**
|
|
89
|
+
* Resolution method used.
|
|
90
|
+
* Values: 'id', 'css', 'robustXPath', 'xPath', 'cfXPath', 'fXPath', 'contentHash', 'ancestor+tag'
|
|
91
|
+
*/
|
|
92
|
+
matchedBy?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Confidence score (0-120+).
|
|
95
|
+
*
|
|
96
|
+
* - 90+: High (unique ID)
|
|
97
|
+
* - 80-89: Good (unique CSS, stable attributes)
|
|
98
|
+
* - 40-79: Moderate (scoped search, multiple candidates)
|
|
99
|
+
* - 15-39: Low (XPath, hash-based fallback)
|
|
100
|
+
*/
|
|
101
|
+
score?: number;
|
|
102
|
+
/**
|
|
103
|
+
* Score breakdown.
|
|
104
|
+
*/
|
|
105
|
+
scoreBreakdown?: {
|
|
106
|
+
method: string;
|
|
107
|
+
score: number;
|
|
108
|
+
}[];
|
|
109
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Attachment } from "./attachment.model";
|
|
2
2
|
import { AutocompleteGroupReplaceData, AutocompleteReplaceData, AutocompleteUserContactReplaceData } from "./autocomplete.data.model";
|
|
3
|
+
import { ReactionAnnotation } from "./reaction-annotation.data.model";
|
|
3
4
|
import { RecordedData } from "./recorder.model";
|
|
4
5
|
import { User } from "./user.data.model";
|
|
5
6
|
export declare class Comment {
|
|
@@ -86,4 +87,5 @@ export declare class Comment {
|
|
|
86
87
|
*
|
|
87
88
|
*/
|
|
88
89
|
isEdited?: boolean;
|
|
90
|
+
reactionAnnotations?: ReactionAnnotation[];
|
|
89
91
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AnchorRecord } from './anchor-record.data.model';
|
|
1
2
|
export declare class TargetElement {
|
|
2
3
|
/**
|
|
3
4
|
* Xpath of target element
|
|
@@ -19,4 +20,8 @@ export declare class TargetElement {
|
|
|
19
20
|
* Relative left position of cursor on target element
|
|
20
21
|
*/
|
|
21
22
|
leftPercentage: number;
|
|
23
|
+
/**
|
|
24
|
+
* Robust anchor descriptor for the element
|
|
25
|
+
*/
|
|
26
|
+
anchor?: AnchorRecord | null;
|
|
22
27
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AnchorRecord } from "./anchor-record.data.model";
|
|
1
2
|
export declare class TargetTextRange {
|
|
2
3
|
/**
|
|
3
4
|
* Xpath of common Ancestor Container
|
|
@@ -11,6 +12,10 @@ export declare class TargetTextRange {
|
|
|
11
12
|
* Full xpath of common Ancestor Container with class names
|
|
12
13
|
*/
|
|
13
14
|
commonAncestorContainerCFXpath?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Anchor of common Ancestor Container
|
|
17
|
+
*/
|
|
18
|
+
commonAncestorContainerAnchor?: AnchorRecord;
|
|
14
19
|
/**
|
|
15
20
|
* Selected text
|
|
16
21
|
*/
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { ResolverResponse } from "./resolver.data.model";
|
|
1
2
|
import { UserContact } from "./user-contact.data.model";
|
|
3
|
+
import { UserPermissionAccessRole } from "./user-resolver.data.model";
|
|
2
4
|
export declare class User {
|
|
3
5
|
/**
|
|
4
6
|
* Unique user identifier that you use to identify your user.
|
|
@@ -109,3 +111,24 @@ export interface VeltAuthProvider {
|
|
|
109
111
|
retryConfig?: AuthRetryConfig;
|
|
110
112
|
generateToken?: () => Promise<string>;
|
|
111
113
|
}
|
|
114
|
+
export interface VeltPermissionProvider {
|
|
115
|
+
onResourceAccessRequired: (requests: Array<PermissionQuery>) => Promise<ResolverResponse<PermissionResult[]>>;
|
|
116
|
+
retryConfig?: AuthRetryConfig;
|
|
117
|
+
forceRefresh?: boolean;
|
|
118
|
+
}
|
|
119
|
+
export interface PermissionQuery {
|
|
120
|
+
userId: string;
|
|
121
|
+
resource: {
|
|
122
|
+
id: string;
|
|
123
|
+
type: 'folder' | 'document' | 'organization';
|
|
124
|
+
source: 'setDocuments' | 'identify' | 'getNotifications' | 'setNotifications';
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
export interface PermissionResult {
|
|
128
|
+
userId: string;
|
|
129
|
+
resourceId: string;
|
|
130
|
+
type: 'folder' | 'document' | 'organization';
|
|
131
|
+
accessRole?: UserPermissionAccessRole;
|
|
132
|
+
expiresAt?: number;
|
|
133
|
+
hasAccess: boolean;
|
|
134
|
+
}
|
|
@@ -1244,6 +1244,16 @@ export declare class CommentElement {
|
|
|
1244
1244
|
*/
|
|
1245
1245
|
public disableForceCloseAllOnEsc: () => void;
|
|
1246
1246
|
|
|
1247
|
+
/**
|
|
1248
|
+
* To mark comment annotation as read
|
|
1249
|
+
*/
|
|
1250
|
+
public markAsRead: (annotationId: string) => Promise<void>;
|
|
1251
|
+
|
|
1252
|
+
/**
|
|
1253
|
+
* To mark comment annotation as unread
|
|
1254
|
+
*/
|
|
1255
|
+
public markAsUnread: (annotationId: string) => Promise<void>;
|
|
1256
|
+
|
|
1247
1257
|
constructor();
|
|
1248
1258
|
/**
|
|
1249
1259
|
* Subscribe to comments on the current document.
|
|
@@ -2466,4 +2476,14 @@ export declare class CommentElement {
|
|
|
2466
2476
|
* To disable force close all on esc
|
|
2467
2477
|
*/
|
|
2468
2478
|
private _disableForceCloseAllOnEsc;
|
|
2479
|
+
|
|
2480
|
+
/**
|
|
2481
|
+
* To mark comment annotation as read
|
|
2482
|
+
*/
|
|
2483
|
+
private _markAsRead;
|
|
2484
|
+
|
|
2485
|
+
/**
|
|
2486
|
+
* To mark comment annotation as unread
|
|
2487
|
+
*/
|
|
2488
|
+
private _markAsUnread;
|
|
2469
2489
|
}
|
package/app/utils/enums.d.ts
CHANGED
|
@@ -70,6 +70,7 @@ export declare const RecorderEventTypes: {
|
|
|
70
70
|
readonly RECORDING_STOPPED: "recordingStopped";
|
|
71
71
|
};
|
|
72
72
|
export declare const CoreEventTypes: {
|
|
73
|
+
readonly PERMISSION_PROVIDER: "permissionProvider";
|
|
73
74
|
readonly VELT_BUTTON_CLICK: "veltButtonClick";
|
|
74
75
|
readonly USER_UPDATE: "userUpdate";
|
|
75
76
|
readonly INIT_UPDATE: "initUpdate";
|
package/models.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './app/utils/enums';
|
|
2
|
+
export * from './app/models/data/anchor-record.data.model';
|
|
2
3
|
export * from './app/models/data/attachment.model';
|
|
3
4
|
export * from './app/models/data/area-annotation.data.model';
|
|
4
5
|
export * from './app/models/data/arrow-annotation.data.model';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veltdev/sdk",
|
|
3
|
-
"version": "4.5.6
|
|
3
|
+
"version": "4.5.6",
|
|
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": [
|