@veltdev/sdk-dev 6.0.0-beta.9 → 6.0.1

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.
Files changed (94) hide show
  1. package/app/client/snippyly.model.d.ts +12 -3
  2. package/app/models/data/comment-events.data.model.d.ts +39 -0
  3. package/app/models/data/config.data.model.d.ts +154 -0
  4. package/app/models/data/notification.model.d.ts +14 -0
  5. package/app/models/data/reaction-resolver.data.model.d.ts +1 -0
  6. package/app/models/data/selection.model.d.ts +10 -8
  7. package/app/models/data/suggestion.data.model.d.ts +52 -2
  8. package/app/models/data/user-resolver.data.model.d.ts +11 -9
  9. package/app/models/data/user.data.model.d.ts +21 -18
  10. package/app/models/element/activity-element.model.d.ts +0 -1
  11. package/app/models/element/area-element.model.d.ts +0 -1
  12. package/app/models/element/arrow-element.model.d.ts +1 -2
  13. package/app/models/element/autocomplete-element.model.d.ts +0 -1
  14. package/app/models/element/comment-element.model.d.ts +103 -77
  15. package/app/models/element/contact-element.model.d.ts +1 -2
  16. package/app/models/element/crdt-element.model.d.ts +1 -1
  17. package/app/models/element/cursor-element.model.d.ts +1 -2
  18. package/app/models/element/huddle-element.model.d.ts +1 -2
  19. package/app/models/element/live-state-sync-element.model.d.ts +1 -1
  20. package/app/models/element/notification-element.model.d.ts +33 -2
  21. package/app/models/element/presence-element.model.d.ts +32 -11
  22. package/app/models/element/reaction-element.model.d.ts +1 -1
  23. package/app/models/element/recorder-element.model.d.ts +21 -2
  24. package/app/models/element/rewriter-element.model.d.ts +43 -1
  25. package/app/models/element/selection-element.model.d.ts +1 -1
  26. package/app/models/element/suggestion-element.model.d.ts +0 -1
  27. package/app/models/element/tag-element.model.d.ts +7 -8
  28. package/app/models/element/views-element.model.d.ts +1 -1
  29. package/app/utils/constants.d.ts +1 -0
  30. package/app/utils/enums.d.ts +97 -83
  31. package/chunk-26SHKRTG.js +1 -0
  32. package/chunk-3YCIOKO7.js +167 -0
  33. package/{chunk-SKP3Z3DQ.js → chunk-4O7F5WPS.js} +1 -1
  34. package/{chunk-YBQBSGLX.js → chunk-6MGKRXSY.js} +1 -1
  35. package/{chunk-USRSVPHC.js → chunk-7M7HPFJW.js} +1 -1
  36. package/{chunk-IXZIBE27.js → chunk-BP5ABAKN.js} +1 -1
  37. package/{chunk-7W553TUZ.js → chunk-CMV6XYEA.js} +1 -1
  38. package/{chunk-N4SGYLNB.js → chunk-CN3MG4V7.js} +1 -1
  39. package/{chunk-SALUJBOS.js → chunk-DVLF6ZJF.js} +1 -1
  40. package/chunk-EWNEUCZN.js +2 -0
  41. package/{chunk-TXOYHDVN.js → chunk-FXVG7I7B.js} +1 -1
  42. package/{chunk-JFRM6MNS.js → chunk-JD2Q4WUT.js} +1 -1
  43. package/chunk-JMH4W4CX.js +1 -0
  44. package/{chunk-6SOP2T3L.js → chunk-KPEMFTQE.js} +1 -1
  45. package/chunk-LSGQWTXT.js +13 -0
  46. package/{chunk-447SWJD2.js → chunk-MJHVVJAE.js} +1 -1
  47. package/{chunk-2HGBJS2C.js → chunk-NWDWX5YO.js} +1 -1
  48. package/{chunk-XMYVEF74.js → chunk-O7QMGDXD.js} +1 -1
  49. package/chunk-OMM2AMDX.js +1 -0
  50. package/{chunk-WANCOUQO.js → chunk-OO7EO3BV.js} +1 -1
  51. package/{chunk-ZVY2YW2G.js → chunk-P6UVM6B7.js} +1 -1
  52. package/{chunk-Y6QKEGWK.js → chunk-PNALREKY.js} +1 -1
  53. package/{chunk-7ZOGXD6Z.js → chunk-Q3SFRIYZ.js} +1 -1
  54. package/{chunk-BG6MNCDK.js → chunk-QEJJ3QNA.js} +1 -1
  55. package/{chunk-QE2MK6NF.js → chunk-QYUV5PXV.js} +1 -1
  56. package/{chunk-AOHSD4YE.js → chunk-RF3TL6SQ.js} +6 -6
  57. package/chunk-THHKSZTD.js +1 -0
  58. package/{chunk-Q7BPHHBS.js → chunk-W6OGMNHQ.js} +1 -1
  59. package/{chunk-J6J7I3SW.js → chunk-WQRY6Y6C.js} +1 -1
  60. package/{chunk-25GEE4UD.js → chunk-WW7AGQRC.js} +1 -1
  61. package/chunk-XDHXV3V6.js +93 -0
  62. package/{chunk-UJMFCXYS.js → chunk-YBCNVNZM.js} +1 -1
  63. package/{chunk-2KJNXU43.js → chunk-YQEMM6AB.js} +1 -1
  64. package/package.json +1 -1
  65. package/types.d.ts +22 -22
  66. package/velt-activity-log.js +1 -1
  67. package/velt-area.js +1 -1
  68. package/velt-arrow.js +2 -2
  69. package/velt-comment.js +8 -8
  70. package/velt-crdt.js +1 -1
  71. package/velt-cursor.js +2 -2
  72. package/velt-huddle.js +3 -3
  73. package/velt-live-state-sync.js +2 -2
  74. package/velt-notification.js +1 -1
  75. package/velt-presence.js +1 -1
  76. package/velt-reaction.js +1 -1
  77. package/velt-recorder.js +1 -1
  78. package/velt-rewriter.js +2 -2
  79. package/velt-selection.js +1 -1
  80. package/velt-tag.js +1 -1
  81. package/velt-user-invite.js +1 -1
  82. package/velt-user-request.js +1 -1
  83. package/velt-video-player.js +1 -1
  84. package/velt-views.js +3 -3
  85. package/velt.d.ts +2 -3
  86. package/velt.js +264 -20
  87. package/chunk-5B5CQEDX.js +0 -1
  88. package/chunk-5FKOPJVO.js +0 -93
  89. package/chunk-APIRNTKO.js +0 -1
  90. package/chunk-AVMLJMVU.js +0 -1
  91. package/chunk-BLIJMW4Z.js +0 -13
  92. package/chunk-BY627CV6.js +0 -1
  93. package/chunk-DX4SZFHQ.js +0 -1
  94. package/chunk-JWLHBAMV.js +0 -167
@@ -1,8 +1,8 @@
1
- // @ts-nocheck
2
1
  import { Observable } from "rxjs";
3
2
  import { PresenceUser } from "../data/presence-user.data.model";
4
3
  import { GetPresenceDataResponse, PresenceEventTypesMap } from "../data/presence-events.data.model";
5
4
  import { PresenceRequestQuery } from "../data/presence-actions.data.model";
5
+ import { FlockOptions } from "../data/flock-options.model";
6
6
 
7
7
  export declare class PresenceElement {
8
8
 
@@ -21,15 +21,27 @@ export declare class PresenceElement {
21
21
  setInactivityTime: (time: number) => void;
22
22
 
23
23
  /**
24
- * Enables follow along mode globally
25
- * @param options {FollowOptions: {useHistoryAPI: boolean, onNavigate: (url: PageInfo) => void}}}
24
+ * Enable flock mode globally
25
+ * @param options FlockOptions
26
26
  */
27
- enableFollowAlongMode: (useHistoryAPI: boolean) => any;
27
+ enableFlockMode: (options?: FlockOptions) => void;
28
28
 
29
29
  /**
30
- * To disable follow along mode
30
+ * Disable flock mode globally
31
31
  */
32
- disableFollowAlongMode: () => any;
32
+ disableFlockMode: () => void;
33
+
34
+ /**
35
+ * Start/join a flock session by following the given user
36
+ * @param userId The leader user ID
37
+ * @param name The leader user name
38
+ */
39
+ startFollowingUser: (userId: string, name: string) => void;
40
+
41
+ /**
42
+ * Exit the flock session / stop following
43
+ */
44
+ stopFollowingUser: () => void;
33
45
 
34
46
  /**
35
47
  * To enable adding self to the presence list
@@ -81,15 +93,24 @@ export declare class PresenceElement {
81
93
  private _setInactivityTime;
82
94
 
83
95
  /**
84
- * Enables follow along mode globally
85
- * @param options {FollowOptions: {useHistoryAPI: boolean, onNavigate: (url: PageInfo) => void}}}
96
+ * Enable flock mode globally
97
+ */
98
+ private _enableFlockMode;
99
+
100
+ /**
101
+ * Disable flock mode globally
102
+ */
103
+ private _disableFlockMode;
104
+
105
+ /**
106
+ * Start/join a flock session by following the given user
86
107
  */
87
- private _enableFollowAlongMode;
108
+ private _startFollowingUser;
88
109
 
89
110
  /**
90
- * To disable follow along mode
111
+ * Exit the flock session / stop following
91
112
  */
92
- private _disableFollowAlongMode;
113
+ private _stopFollowingUser;
93
114
 
94
115
  /**
95
116
  * To enable adding self to the presence list
@@ -1,4 +1,4 @@
1
- // @ts-nocheck
1
+ import { ReactionMap } from '../data/reaction-annotation.data.model';
2
2
  export { ReactionMap } from '../data/reaction-annotation.data.model';
3
3
 
4
4
  export declare class ReactionElement {
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  import { Observable } from "rxjs";
3
2
  import { RecorderData, RecorderRequestQuery, GetRecordingDataResponse, GetRecordingsResponse, DeleteRecordingsResponse } from "../data/recorder-annotation.data.model";
4
3
  import { RecorderEventTypesMap } from "../data/recorder-events.data.model";
@@ -6,13 +5,23 @@ import { RecordedData, RecorderQualityConstraints, RecorderEncodingOptions, Reco
6
5
 
7
6
  export declare class RecorderElement {
8
7
 
9
- initRecording: (type: string, panelId?: string) => any;
8
+ initRecording: (type: string, panelId?: string) => Promise<void>;
10
9
 
11
10
  /**
12
11
  * @deprecated Use on('recordingDone') method instead
13
12
  */
14
13
  onRecordedData: () => Observable<RecordedData | null>;
15
14
 
15
+ /**
16
+ * To enable dark mode in recording
17
+ */
18
+ enableDarkMode: () => void;
19
+
20
+ /**
21
+ * To disable dark mode in recording
22
+ */
23
+ disableDarkMode: () => void;
24
+
16
25
  /**
17
26
  * To enable recording countdown
18
27
  */
@@ -173,6 +182,16 @@ export declare class RecorderElement {
173
182
  */
174
183
  private _onRecordedData;
175
184
 
185
+ /**
186
+ * To enable dark mode in recording
187
+ */
188
+ private _enableDarkMode;
189
+
190
+ /**
191
+ * To disable dark mode in recording
192
+ */
193
+ private _disableDarkMode;
194
+
176
195
  /**
177
196
  * To enable dark mode in comments
178
197
  */
@@ -1,4 +1,6 @@
1
- // @ts-nocheck
1
+ import { Observable } from "rxjs";
2
+ import { RewriterAskAiRequest, RewriterAskAiResponse, RewriterReplaceTextRequest, RewriterReplaceTextResponse, RewriterAddCommentRequest, RewriterAddCommentResponse, RewriterEventTypesMap } from "../data/rewriter-events.data.model";
3
+
2
4
  export declare class RewriterElement {
3
5
  /**
4
6
  * To enable rewriter feature
@@ -19,6 +21,26 @@ export declare class RewriterElement {
19
21
  * To disable the default rewriter UI on text selection
20
22
  */
21
23
  disableDefaultUI: () => void;
24
+
25
+ /**
26
+ * Subscribe to rewriter events
27
+ */
28
+ on: <T extends keyof RewriterEventTypesMap>(action: T) => Observable<RewriterEventTypesMap[T]>;
29
+
30
+ /**
31
+ * Call AI with the currently selected text
32
+ */
33
+ askAi: (request: RewriterAskAiRequest) => Promise<RewriterAskAiResponse>;
34
+
35
+ /**
36
+ * Replace the selected text in the DOM with the given text
37
+ */
38
+ replaceText: (request: RewriterReplaceTextRequest) => Promise<RewriterReplaceTextResponse>;
39
+
40
+ /**
41
+ * Add a comment annotation on the selected text with the given text as comment body
42
+ */
43
+ addComment: (request: RewriterAddCommentRequest) => Promise<RewriterAddCommentResponse>;
22
44
  constructor();
23
45
 
24
46
  /**
@@ -40,4 +62,24 @@ export declare class RewriterElement {
40
62
  * To disable the default rewriter UI on text selection
41
63
  */
42
64
  private _disableDefaultUI;
65
+
66
+ /**
67
+ * Subscribe to rewriter events
68
+ */
69
+ private _on;
70
+
71
+ /**
72
+ * Call AI with the currently selected text
73
+ */
74
+ private _askAi;
75
+
76
+ /**
77
+ * Replace the selected text in the DOM with the given text
78
+ */
79
+ private _replaceText;
80
+
81
+ /**
82
+ * Add a comment annotation on the selected text with the given text as comment body
83
+ */
84
+ private _addComment;
43
85
  }
@@ -1,4 +1,4 @@
1
- // @ts-nocheck
1
+ import { Observable } from "rxjs";
2
2
  import { LiveSelectionData, UserIndicatorPosition, UserIndicatorType } from "../data/selection.model";
3
3
  export declare class SelectionElement {
4
4
  /**
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  import { Observable } from "rxjs";
3
2
  import { SuggestionEventType } from "../../utils/enums";
4
3
  import { SuggestionEventTypesMap } from "../data/suggestion-events.data.model";
@@ -1,31 +1,30 @@
1
- // @ts-nocheck
2
1
  import { Observable } from "rxjs";
3
- import { TagPinAnnotation } from "../data/tag-annotation.data.model";
2
+ import { TagAnnotation } from "../data/tag-annotation.data.model";
4
3
  export declare class TagElement {
5
4
  /**
6
5
  * Subscribe to tags on the current document.
7
6
  *
8
- * Returns Observable<TagPinAnnotation[] | null>.
7
+ * Returns Observable<TagAnnotation[] | null>.
9
8
  */
10
- getAllTagAnnotations: (documentId?: string, documentParams?: object) => Observable<TagPinAnnotation[] | null>;
9
+ getAllTagAnnotations: (documentId?: string, documentParams?: object) => Observable<TagAnnotation[] | null>;
11
10
 
12
11
  /**
13
12
  * To delete selected tags
14
13
  */
15
- deleteTag: () => any;
14
+ deleteTag: () => void;
16
15
 
17
16
  /**
18
17
  * To allow text selection in specific elements only
19
18
  * @param elementIds Element ids to be allowed
20
19
  */
21
- allowedElementIds: (elementIds: string[]) => any;
20
+ allowedElementIds: (elementIds: string[]) => void;
22
21
 
23
22
  /**
24
23
  * To add tags on specific elements
25
24
  *
26
25
  * @param elementId ID of html element
27
26
  */
28
- attachTag: (elementId: string) => any;
27
+ attachTag: (elementId: string) => void;
29
28
 
30
29
  /**
31
30
  * Subscribe to add tag mode change.
@@ -37,7 +36,7 @@ export declare class TagElement {
37
36
  /**
38
37
  * Subscribe to tags on the current document.
39
38
  *
40
- * Returns Observable<TagPinAnnotation[] | null>.
39
+ * Returns Observable<TagAnnotation[] | null>.
41
40
  */
42
41
  private _getAllTagAnnotations;
43
42
 
@@ -1,4 +1,4 @@
1
- // @ts-nocheck
1
+ import { Observable } from "rxjs";
2
2
  import { ViewsByUser, ViewsByDate } from "../data/views.data.model";
3
3
 
4
4
  export declare class ViewsElement {
@@ -12,6 +12,7 @@ export declare class Constants {
12
12
  static LISTENER_CONTEXT_BATCH_SIZE: number;
13
13
  static DEFAULT_VELT_CONTEXT: string;
14
14
  static VISIBILITY_SELF_PREFIX: string;
15
+ static VISIBILITY_ORG_PREFIX: string;
15
16
  static FIREBASE_PARTIAL_PATH_ORGANIZATIONS: string;
16
17
  static FIREBASE_PARTIAL_PATH_FOLDERS: string;
17
18
  static FIREBASE_PARTIAL_PATH_DOCS: string;
@@ -1,38 +1,40 @@
1
- export declare enum CommentStatus {
2
- NEWLY_ADDED = "newlyAdded",
3
- ADDED = "added",
4
- UPDATED = "updated",
5
- DELETED = "deleted",
6
- APPROVED = "approved",
7
- ASSIGNED = "assigned",
8
- STATUS_CHANGED = "statusChanged",
9
- PRIORITY_CHANGED = "priorityChanged",
10
- ACCESS_MODE_CHANGED = "accessModeChanged",
11
- CUSTOM_LIST_CHANGED = "customListChanged",
12
- ACCEPTED = "accepted",
13
- REJECTED = "rejected",
14
- REACTION_ADDED = "reactionAdded",
15
- REACTION_DELETED = "reactionDeleted",
16
- SUBSCRIBED = "subscribed",
17
- UNSUBSCRIBED = "unsubscribed",
18
- SUGGESTION_ACCEPTED = "suggestionAccepted",
19
- SUGGESTION_REJECTED = "suggestionRejected"
20
- }
21
- export declare enum ResolverActions {
22
- COMMENT_ANNOTATION_ADD = "comment_annotation.add",
23
- COMMENT_ANNOTATION_DELETE = "comment_annotation.delete",
24
- COMMENT_ADD = "comment.add",
25
- COMMENT_DELETE = "comment.delete",
26
- COMMENT_UPDATE = "comment.update",
27
- REACTION_ADD = "reaction.add",
28
- REACTION_DELETE = "reaction.delete",
29
- ATTACHMENT_ADD = "attachment.add",
30
- ATTACHMENT_DELETE = "attachment.delete",
31
- RECORDER_ANNOTATION_ADD = "recorder_annotation.add",
32
- RECORDER_ANNOTATION_UPDATE = "recorder_annotation.update",
33
- RECORDER_ANNOTATION_DELETE = "recorder_annotation.delete",
34
- ACTIVITY_SAVE = "activity.save"
35
- }
1
+ export declare const CommentStatus: {
2
+ readonly NEWLY_ADDED: "newlyAdded";
3
+ readonly ADDED: "added";
4
+ readonly UPDATED: "updated";
5
+ readonly DELETED: "deleted";
6
+ readonly APPROVED: "approved";
7
+ readonly ASSIGNED: "assigned";
8
+ readonly STATUS_CHANGED: "statusChanged";
9
+ readonly PRIORITY_CHANGED: "priorityChanged";
10
+ readonly ACCESS_MODE_CHANGED: "accessModeChanged";
11
+ readonly CUSTOM_LIST_CHANGED: "customListChanged";
12
+ readonly ACCEPTED: "accepted";
13
+ readonly REJECTED: "rejected";
14
+ readonly REACTION_ADDED: "reactionAdded";
15
+ readonly REACTION_DELETED: "reactionDeleted";
16
+ readonly SUBSCRIBED: "subscribed";
17
+ readonly UNSUBSCRIBED: "unsubscribed";
18
+ readonly SUGGESTION_ACCEPTED: "suggestionAccepted";
19
+ readonly SUGGESTION_REJECTED: "suggestionRejected";
20
+ };
21
+ export type CommentStatus = (typeof CommentStatus)[keyof typeof CommentStatus];
22
+ export declare const ResolverActions: {
23
+ readonly COMMENT_ANNOTATION_ADD: "comment_annotation.add";
24
+ readonly COMMENT_ANNOTATION_DELETE: "comment_annotation.delete";
25
+ readonly COMMENT_ADD: "comment.add";
26
+ readonly COMMENT_DELETE: "comment.delete";
27
+ readonly COMMENT_UPDATE: "comment.update";
28
+ readonly REACTION_ADD: "reaction.add";
29
+ readonly REACTION_DELETE: "reaction.delete";
30
+ readonly ATTACHMENT_ADD: "attachment.add";
31
+ readonly ATTACHMENT_DELETE: "attachment.delete";
32
+ readonly RECORDER_ANNOTATION_ADD: "recorder_annotation.add";
33
+ readonly RECORDER_ANNOTATION_UPDATE: "recorder_annotation.update";
34
+ readonly RECORDER_ANNOTATION_DELETE: "recorder_annotation.delete";
35
+ readonly ACTIVITY_SAVE: "activity.save";
36
+ };
37
+ export type ResolverActions = (typeof ResolverActions)[keyof typeof ResolverActions];
36
38
  /**
37
39
  * Opt-in additional (non-core) comment save events for the Comment Annotations Resolver
38
40
  * (specs/comment-resolver iteration-2). Values mirror the non-core `CommentActivityActionTypes`
@@ -42,22 +44,23 @@ export declare enum ResolverActions {
42
44
  * `ResolverActions`. Kept in enums.ts (a leaf module) to avoid a
43
45
  * resolver.data.model ↔ comment-resolver.data.model import cycle.
44
46
  */
45
- export declare enum CommentResolverSaveEvent {
46
- STATUS_CHANGE = "comment_annotation.status_change",
47
- PRIORITY_CHANGE = "comment_annotation.priority_change",
48
- ASSIGN = "comment_annotation.assign",
49
- ACCESS_MODE_CHANGE = "comment_annotation.access_mode_change",
50
- CUSTOM_LIST_CHANGE = "comment_annotation.custom_list_change",
51
- APPROVE = "comment_annotation.approve",
52
- ACCEPT = "comment.accept",
53
- REJECT = "comment.reject",
54
- SUGGESTION_ACCEPT = "comment_annotation.suggestion_accept",
55
- SUGGESTION_REJECT = "comment_annotation.suggestion_reject",
56
- REACTION_ADD = "comment.reaction_add",
57
- REACTION_DELETE = "comment.reaction_delete",
58
- SUBSCRIBE = "comment_annotation.subscribe",
59
- UNSUBSCRIBE = "comment_annotation.unsubscribe"
60
- }
47
+ export declare const CommentResolverSaveEvent: {
48
+ readonly STATUS_CHANGE: "comment_annotation.status_change";
49
+ readonly PRIORITY_CHANGE: "comment_annotation.priority_change";
50
+ readonly ASSIGN: "comment_annotation.assign";
51
+ readonly ACCESS_MODE_CHANGE: "comment_annotation.access_mode_change";
52
+ readonly CUSTOM_LIST_CHANGE: "comment_annotation.custom_list_change";
53
+ readonly APPROVE: "comment_annotation.approve";
54
+ readonly ACCEPT: "comment.accept";
55
+ readonly REJECT: "comment.reject";
56
+ readonly SUGGESTION_ACCEPT: "comment_annotation.suggestion_accept";
57
+ readonly SUGGESTION_REJECT: "comment_annotation.suggestion_reject";
58
+ readonly REACTION_ADD: "comment.reaction_add";
59
+ readonly REACTION_DELETE: "comment.reaction_delete";
60
+ readonly SUBSCRIBE: "comment_annotation.subscribe";
61
+ readonly UNSUBSCRIBE: "comment_annotation.unsubscribe";
62
+ };
63
+ export type CommentResolverSaveEvent = (typeof CommentResolverSaveEvent)[keyof typeof CommentResolverSaveEvent];
61
64
  export declare const CommentEventTypes: {
62
65
  readonly ADD_COMMENT_ANNOTATION: "addCommentAnnotation";
63
66
  readonly ADD_COMMENT_ANNOTATION_DRAFT: "addCommentAnnotationDraft";
@@ -95,6 +98,11 @@ export declare const CommentEventTypes: {
95
98
  readonly COMMENT_TOOL_CLICKED: "commentToolClicked";
96
99
  readonly SIDEBAR_BUTTON_CLICK: "sidebarButtonClick";
97
100
  readonly SIDEBAR_BUTTON_CLICKED: "sidebarButtonClicked";
101
+ readonly SIDEBAR_OPEN: "sidebarOpen";
102
+ readonly SIDEBAR_CLOSE: "sidebarClose";
103
+ readonly FULLSCREEN_CLICK: "fullscreenClick";
104
+ readonly COMMENT_CLICK: "commentClick";
105
+ readonly COMMENT_NAVIGATION_BUTTON_CLICK: "commentNavigationButtonClick";
98
106
  readonly ATTACHMENT_DOWNLOAD_CLICKED: "attachmentDownloadClicked";
99
107
  readonly COMMENT_SAVED: "commentSaved";
100
108
  readonly COMMENT_SAVE_TRIGGERED: "commentSaveTriggered";
@@ -200,11 +208,12 @@ export declare enum ArrowStatus {
200
208
  UPDATED = "updated",
201
209
  DELETED = "deleted"
202
210
  }
203
- export declare enum AreaStatus {
204
- ADDED = "added",
205
- UPDATED = "updated",
206
- DELETED = "deleted"
207
- }
211
+ export declare const AreaStatus: {
212
+ readonly ADDED: "added";
213
+ readonly UPDATED: "updated";
214
+ readonly DELETED: "deleted";
215
+ };
216
+ export type AreaStatus = (typeof AreaStatus)[keyof typeof AreaStatus];
208
217
  export declare enum DocumentViewsStatus {
209
218
  FIRST_VIEWED = "firstViewed"
210
219
  }
@@ -277,19 +286,21 @@ export declare enum Roles {
277
286
  ADMIN = "Admin",
278
287
  COMMENTER = "Commenter"
279
288
  }
280
- export declare enum DocumentAccessType {
281
- PUBLIC = "public",
282
- RESTRICTED = "restricted",
283
- ORGANIZATION_PRIVATE = "organizationPrivate"
284
- }
289
+ export declare const DocumentAccessType: {
290
+ readonly PUBLIC: "public";
291
+ readonly RESTRICTED: "restricted";
292
+ readonly ORGANIZATION_PRIVATE: "organizationPrivate";
293
+ };
294
+ export type DocumentAccessType = (typeof DocumentAccessType)[keyof typeof DocumentAccessType];
285
295
  export declare enum DetectionStrategy {
286
296
  DEFAULT = "default",
287
297
  DYNAMIC_ID = "dynamicId"
288
298
  }
289
- export declare enum CommentAccessMode {
290
- PUBLIC = "public",
291
- PRIVATE = "private"
292
- }
299
+ export declare const CommentAccessMode: {
300
+ readonly PUBLIC: "public";
301
+ readonly PRIVATE: "private";
302
+ };
303
+ export type CommentAccessMode = (typeof CommentAccessMode)[keyof typeof CommentAccessMode];
293
304
  export declare enum UnreadIndicatorMode {
294
305
  MINIMAL = "minimal",
295
306
  VERBOSE = "verbose"
@@ -302,25 +313,27 @@ export declare enum CommentCountType {
302
313
  TOTAL = "total",
303
314
  UNREAD = "unread"
304
315
  }
305
- export declare enum ServerConnectionState {
306
- ONLINE = "online",
307
- OFFLINE = "offline",
308
- PENDING_INIT = "pendingInit",
309
- PENDING_DATA = "pendingData"
310
- }
311
- export declare enum ContactListScopeForOrganizationUsers {
312
- ALL = "all",
313
- ORGANIZATION = "organization",
314
- ORGANIZATION_USER_GROUP = "organizationUserGroup",
315
- DOCUMENT = "document",
316
- FOLDER = "folder"
317
- }
316
+ export declare const ServerConnectionState: {
317
+ readonly ONLINE: "online";
318
+ readonly OFFLINE: "offline";
319
+ readonly PENDING_INIT: "pendingInit";
320
+ readonly PENDING_DATA: "pendingData";
321
+ };
322
+ export type ServerConnectionState = (typeof ServerConnectionState)[keyof typeof ServerConnectionState];
323
+ export declare const ContactListScopeForOrganizationUsers: {
324
+ readonly ALL: "all";
325
+ readonly ORGANIZATION: "organization";
326
+ readonly ORGANIZATION_USER_GROUP: "organizationUserGroup";
327
+ readonly DOCUMENT: "document";
328
+ readonly FOLDER: "folder";
329
+ };
330
+ export type ContactListScopeForOrganizationUsers = (typeof ContactListScopeForOrganizationUsers)[keyof typeof ContactListScopeForOrganizationUsers];
318
331
  export type RecorderMode = 'audio' | 'video' | 'screen' | 'all' | string;
319
332
  export type RecorderType = 'audio' | 'video' | 'screen';
320
333
  export type RecorderFileFormat = 'mp3' | 'mp4' | 'webm';
321
334
  export type RecorderLayoutMode = 'floating' | 'thread';
322
335
  export type SupportedMimeType = 'audio' | 'video';
323
- export type FirebaseRegion = 'usCentral1' | 'asiaSouthEast1' | 'europeWest1' | 'australiaSouthEast1';
336
+ export type FirebaseRegion = 'usCentral1' | 'asiaSouthEast1' | 'europeWest1' | 'australiaSouthEast1' | 'asiaNorthEast1';
324
337
  export type VideoEventType = 'play' | 'pause' | 'ratechange' | 'seeked' | 'timeupdate' | 'volumechange';
325
338
  export type RewriterType = 'copywriter' | 'generic';
326
339
  export type RecorderStatusType = 'started' | 'paused' | 'resumed' | 'stopped' | 'error' | null;
@@ -354,10 +367,11 @@ export type InlineSortingCriteria = 'createdFirst' | 'createdLast' | 'updatedFir
354
367
  export type NotificationPanelMode = 'popover' | 'sidebar';
355
368
  export type SidebarActionButtonType = 'default' | 'toggle';
356
369
  export type SidebarButtonCountType = 'default' | 'filter';
357
- export declare enum CommentSidebarSystemFiltersOperator {
358
- AND = "and",
359
- OR = "or"
360
- }
370
+ export declare const CommentSidebarSystemFiltersOperator: {
371
+ readonly AND: "and";
372
+ readonly OR: "or";
373
+ };
374
+ export type CommentSidebarSystemFiltersOperator = (typeof CommentSidebarSystemFiltersOperator)[keyof typeof CommentSidebarSystemFiltersOperator];
361
375
  /**
362
376
  * Type for notification settings accordion types
363
377
  */
@@ -0,0 +1 @@
1
+ import{ca as ie}from"./chunk-RF3TL6SQ.js";import{$ as K,$e as R,Cf as $,Ch as E,Df as _,Dh as V,Ee as N,Ef as A,Ff as T,Fi as Q,Gi as ee,Hi as re,L as w,Mf as L,Od as W,Pi as se,Vf as M,_e as U,a as f,af as I,b as y,be as v,ca as P,da as x,g,ki as X,l as D,li as q,oi as H,qh as b,qi as Y,tf as S,th as j,ti as Z,uf as l,uh as B,v as G,wh as J,xh as z,zh as F}from"./chunk-3YCIOKO7.js";var p="public",ye=(()=>{let O=class O{constructor(e,r,s,i,t,o,c,a,n,d){this.authService=e,this.docService=r,this.loggingService=s,this.commonDbService=i,this.usersService=t,this.commentUtilsService=o,this.coreActionsService=c,this.functions=a,this.configService=n,this.contactService=d,this.endpointsService=x(H),this.currentUserPermissions$=new D(null),this.permissionsCache$=new D(null),this.permissionProvider$=new D(null),this.clientResolverProdWarned=!1,this.clientResolverNoResolverWarned=!1,this.requestKeyedPermissionsCache=new Map,this.inFlightPermissionsRequests=new Map,this.permissionsCacheGeneration=0,this.REVOKE_DELAY_MS=3e3,this.pendingRevokeRequests=new Map,this.pendingRevokeTimeoutId=null,this.pendingRevokeUniqueId="",this.pendingRevokeUserId="";try{this.docService.setUserPermissionService(this),this.authService.setUserPermissionService(this),this.commentUtilsService.setUserPermissionService(this),this.contactService.setUserPermissionService(this)}catch(h){this.loggingService.catch("Error in UserPermissionService constructor:",h)}}ngOnDestroy(){try{this.pendingRevokeTimeoutId&&(clearTimeout(this.pendingRevokeTimeoutId),this.pendingRevokeTimeoutId=null)}catch(e){this.loggingService.catch("Error in UserPermissionService ngOnDestroy:",e)}}collectRevokeRequest(e,r,s,i,t,o){try{return e.find(a=>a.resourceId===s&&a.type===i&&a.organizationId===t&&a.userId===o)?(r.push({userId:o,resourceId:s,organizationId:t,type:i,hasAccess:!1}),e.filter(a=>!(a.resourceId===s&&a.type===i&&a.organizationId===t&&a.userId===o))):e}catch(c){return this.loggingService.catch("Error in UsersPermissionService collectRevokeRequest:",c),e}}hasUserContextAccess({userId:e,accessFields:r}){try{if(!this.getIsContextEnabled()||r.includes(N.DEFAULT_VELT_CONTEXT))return!0;let s=r.filter(t=>!L(t));if(!s.length){if(r.some(c=>c.startsWith(N.VISIBILITY_ORG_PREFIX)))return!0;let o=`${N.VISIBILITY_SELF_PREFIX}${$(e).toString()}`;return r.includes(o)}let i=this.contactService.getUserAccessFieldsByUserId(e);return i?.length?s.every(t=>i.includes(t)):!0}catch(s){return this.loggingService.catch("Error in UserPermissionService hasUserContextAccess:",s),!1}}organizationDetails(e){return g(this,null,function*(){try{let r=yield this.commonDbService?.getData({feature:"organizationMetadata",properties:{organizationId:e,suppressError:!0}});return r&&r?.errorCode?{errorCode:l.PERMISSION_DENIED,error:!0}:r&&!r?.metadata?{errorCode:l.DOES_NOT_EXIST,error:!0}:{error:!1}}catch(r){return this.loggingService.catch("Error in UserPermissionService organizationDetails:",r),{errorCode:l.SOMETHING_WENT_WRONG,error:!0}}})}documentDetails(s){return g(this,arguments,function*({documentId:e,organizationId:r}){try{let i=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:e,organizationId:r,suppressError:!0}});if(i&&i?.errorCode)return{errorCode:l.PERMISSION_DENIED,error:!0};if(i&&!i?.metadata)return{errorCode:l.DOES_NOT_EXIST,error:!0};let t=this.docService.getDocumentMetadata(e)??{};this.docService.setDocumentMetadata(e,f(f({},t),i?.metadata??{}));let o,c=i?.metadata?.veltFolderId;if(c)try{o=(yield this.commonDbService?.getData({feature:"folderMetadata",properties:{folderId:c,organizationId:r}}))?.folderIamConfig?.accessType}catch(a){this.loggingService.catch("Error fetching folder accessType for document:",a)}return o||(o=i?.docIamConfig?.accessType),{error:!1,accessType:o}}catch(i){return this.loggingService.catch("Error in UserPermissionService documentDetails:",i),{errorCode:l.SOMETHING_WENT_WRONG,error:!0}}})}folderDetails(s){return g(this,arguments,function*({folderId:e,organizationId:r}){try{let i=yield this.commonDbService?.getData({feature:"folderMetadata",properties:{folderId:e,organizationId:r,suppressError:!0}});return i&&i?.errorCode?{errorCode:l.PERMISSION_DENIED,error:!0}:i&&!i?.metadata?{errorCode:l.DOES_NOT_EXIST,error:!0}:{error:!1,accessType:i?.folderIamConfig?.accessType}}catch(i){return this.loggingService.catch("Error in UserPermissionService folderDetails:",i),{errorCode:l.SOMETHING_WENT_WRONG,error:!0}}})}getUserPermissions(e){return g(this,null,function*(){let r=this.permissionsCacheGeneration;try{if(!this.authService.getUser())return this.loggingService.catch("User not set. [source: getUserPermissions]",void 0,void 0,!0),{};let s=this.authService.getUser()?.userId,i=this.extractResourceIds(e);if(!i.clientOrganizationId||!i.organizationId)return this.loggingService.catch("Client organization id or organization id not set during getUserPermissions",void 0,void 0,!0),{};let t=yield this.validateResources(i),[o,c]=yield this.fetchUserPermissionsFromDB(i),a=this.authService.getUser()?.userId;if(s!==a)return{};let n=this.buildPermissionsResponse(i,t,o,c);if(Object.keys(n).length>0){if(!e)this.setCurrentUserPermissions(n);else if(this.permissionsCacheGeneration===r){let d=this.buildPermissionsCacheKey(e);d!==null&&this.requestKeyedPermissionsCache.set(d,JSON.parse(JSON.stringify(n)))}}return n}catch(s){return this.loggingService.catch("Error in UserPermissionService getUserPermissions:",s),{}}})}getUserPermissionsFromCacheOrFetch(e){return g(this,null,function*(){try{if(!e)return yield this.getUserPermissions(e);let r=this.buildPermissionsCacheKey(e);if(r===null)return yield this.getUserPermissions(e);let s=this.permissionsCacheGeneration,i=this.requestKeyedPermissionsCache.get(r);if(i)return JSON.parse(JSON.stringify(i));let t=this.inFlightPermissionsRequests.get(r);if(t){let a=yield t;return this.permissionsCacheGeneration!==s?yield this.getUserPermissions(e):JSON.parse(JSON.stringify(a))}let o=this.getUserPermissions(e);this.inFlightPermissionsRequests.set(r,o),o.finally(()=>{this.inFlightPermissionsRequests.get(r)===o&&this.inFlightPermissionsRequests.delete(r)}).catch(()=>{});let c=yield o;return this.permissionsCacheGeneration!==s?yield this.getUserPermissions(e):JSON.parse(JSON.stringify(c))}catch(r){return this.loggingService.catch("Error in UserPermissionService getUserPermissionsFromCacheOrFetch:",r),{}}})}clearRequestKeyedPermissionsCache(){try{this.requestKeyedPermissionsCache.clear(),this.inFlightPermissionsRequests.clear(),this.permissionsCacheGeneration++}catch(e){this.loggingService.catch("Error in UserPermissionService clearRequestKeyedPermissionsCache:",e)}}invalidateAllPermissionsState(){try{this.requestKeyedPermissionsCache.clear(),this.inFlightPermissionsRequests.clear(),this.permissionsCacheGeneration++}catch(e){this.loggingService.catch("Error in UserPermissionService invalidateAllPermissionsState:",e)}}buildPermissionsCacheKey(e){try{let r={};return Object.keys(e).sort().forEach(s=>{let i=e[s];i!==void 0&&(r[s]=Array.isArray(i)?[...i].sort():i)}),r.__userId=this.authService.getUser()?.userId??null,JSON.stringify(r)}catch(r){return this.loggingService.catch("Error in UserPermissionService buildPermissionsCacheKey:",r),null}}extractResourceIds(e){let r=this.docService.getDocumentPaths(),s=this.docService.getDocumentIds();if(e){let o=e.organizationId??r?.clientOrganizationId;return{folderIds:e.folderIds??[],documentIds:e.documentIds??[],clientOrganizationId:o,organizationId:o?A(o):void 0}}let i=r?.clientOrganizationId;return{folderIds:r?.folderId?[r.folderId]:[],documentIds:s.map(o=>o.clientDocumentId),clientOrganizationId:i,organizationId:i?A(i):void 0}}validateResources(e){return g(this,null,function*(){let{folderIds:r,documentIds:s,organizationId:i,clientOrganizationId:t}=e,o=[],c=[],a=r.length>0||s.length>0;i&&!a&&(o.push(this.organizationDetails(i)),c.push({id:t??"",type:"organization"})),r.forEach(u=>{o.push(this.folderDetails({folderId:T(u),organizationId:i??""})),c.push({id:u,type:"folder"})}),s.forEach(u=>{o.push(this.documentDetails({documentId:_(u),organizationId:i??""})),c.push({id:u,type:"document"})});let[n,d]=yield Promise.all([Promise.allSettled(o),this.getDefaultDocumentAccessType()]),h=this.processValidationResults(n,c);return y(f({},this.suppressResolverGrantedFailures(h,t)),{defaultDocumentAccessType:d})})}suppressResolverGrantedFailures(e,r){try{let s=this.authService.getUser()?.userId;if(!s)return e;let i=this.getPermissionsCache()??[];if(i.length===0)return e;let t=(n,d,h)=>i.some(u=>u?.userId===s&&u?.resourceId===n&&u?.type===d&&(!h||u?.organizationId===h)&&u?.hasAccess===!0),o=e.failedDocumentIds.filter(n=>!(n.errorCode===l.PERMISSION_DENIED&&t(n.id,I.DOCUMENT,r))),c=e.failedFolderIds.filter(n=>!(n.errorCode===l.PERMISSION_DENIED&&t(n.id,I.FOLDER,r))),a=e.failedOrganizationId;return a&&a.errorCode===l.PERMISSION_DENIED&&r&&t(r,I.ORGANIZATION,r)&&(a=void 0),{failedFolderIds:c,failedDocumentIds:o,failedOrganizationId:a,folderAccessTypes:e.folderAccessTypes,documentAccessTypes:e.documentAccessTypes}}catch(s){return this.loggingService.catch("Error in UserPermissionService suppressResolverGrantedFailures:",s),e}}getDefaultDocumentAccessType(){return g(this,null,function*(){try{return(yield this.commonDbService?.getData({feature:"apiKeyMetadata",properties:{}}))?.defaultDocumentAccessType}catch(e){this.loggingService.catch("Error fetching defaultDocumentAccessType:",e);return}})}processValidationResults(e,r){let s=[],i=[],t,o={},c={};for(let a=0;a<e.length;a++){let n=e[a],d=r[a];if(n.status==="rejected"||n.status==="fulfilled"&&n.value.error){let u=n.status==="fulfilled"?n.value.errorCode??l.SOMETHING_WENT_WRONG:l.SOMETHING_WENT_WRONG,m={id:d.id,errorCode:u};switch(d.type){case"organization":if(t=m,u===l.DOES_NOT_EXIST)throw new Error(`Organization with id '${d.id}' does not exist`);break;case"folder":s.push(m);break;case"document":i.push(m);break}}else if(n.status==="fulfilled")switch(d.type){case"folder":n.value.accessType&&(o[d.id]=n.value.accessType);break;case"document":n.value.accessType&&(c[d.id]=n.value.accessType);break}}return{failedFolderIds:s,failedDocumentIds:i,failedOrganizationId:t,folderAccessTypes:o,documentAccessTypes:c}}fetchUserPermissionsFromDB(e){return g(this,null,function*(){let{folderIds:r,documentIds:s,organizationId:i}=e,t=[this.authService.getUser()?.userId??""],o=[...r.map(n=>T(n)),...s.map(n=>_(n)),i??""],[c,a]=yield Promise.allSettled([this.usersService.getUsersFromDBWithBatching({userIds:t,organizationId:i}),this.usersService.getTemporaryUsersFromDBWithBatching({userIds:t,organizationId:i,resourceIds:o})]);return[c.status==="fulfilled"?c.value:[],a.status==="fulfilled"?a.value:[]]})}buildPermissionsResponse(e,r,s,i){let{folderIds:t,documentIds:o,clientOrganizationId:c,organizationId:a}=e,{failedFolderIds:n,failedDocumentIds:d,failedOrganizationId:h}=r,u={};return this.processRegularUserPermissions(u,s,t,o,c??"",a??"",n,d,h,r.folderAccessTypes,r.documentAccessTypes,r.defaultDocumentAccessType),this.ensureCurrentUserFailuresRecorded(u,c??"",n,d,h,r.folderAccessTypes,r.documentAccessTypes,r.defaultDocumentAccessType),this.processTemporaryUserPermissions(u,i),this.processContextPermissions(u),u}processContextPermissions(e){try{let r=this.authService.getUser()?.userId;if(r){let s=this.contactService.getUserAccessFieldsByUserId(r);s?.length&&(e[r]||(e[r]={}),e[r].context={accessFields:s})}}catch(r){this.loggingService.catch("Error in UserPermissionService processContextPermissions:",r);return}}processRegularUserPermissions(e,r,s,i,t,o,c,a,n,d,h,u){for(let m of r)for(let C of m)C?.user?.userId&&(e[C.user.userId]=y(f({},s.length&&{folders:this.buildFolderPermissions(s,C,c,d,u)}),{documents:this.buildDocumentPermissions(i,C,a,h,u),organization:{[t]:this.buildOrganizationPermission(o,C,n)}}))}ensureCurrentUserFailuresRecorded(e,r,s,i,t,o,c,a){try{let n=this.authService.getUser()?.userId;if(!n)return;let d=!!t&&!!r,h=(s?.length??0)>0,u=(i?.length??0)>0;if(!d&&!h&&!u)return;if(e[n]||(e[n]={}),d&&(e[n].organization||(e[n].organization={}),e[n].organization[r]||(e[n].organization[r]={error:this.getErrorMessage(t.errorCode,"organization"),errorCode:t.errorCode})),h){e[n].folders||(e[n].folders={});for(let m of s)e[n].folders[m.id]||(e[n].folders[m.id]=f({error:this.getErrorMessage(m.errorCode,"folder"),errorCode:m.errorCode},m.errorCode===l.PERMISSION_DENIED&&{accessType:o[m.id]??a??p}))}if(u){e[n].documents||(e[n].documents={});for(let m of i)e[n].documents[m.id]||(e[n].documents[m.id]=f({error:this.getErrorMessage(m.errorCode,"document"),errorCode:m.errorCode},m.errorCode===l.PERMISSION_DENIED&&{accessType:c[m.id]??a??p}))}}catch(n){this.loggingService.catch("Error in UserPermissionService ensureCurrentUserFailuresRecorded:",n)}}getErrorMessage(e,r){try{switch(this.loggingService.log(`Error in UserPermissionService getErrorMessage: ${e} ${r}`),e){case l.DOES_NOT_EXIST:return`${r} does not exist`;case l.PERMISSION_DENIED:return`User does not have access to ${r}`;case l.SOMETHING_WENT_WRONG:return"Something went wrong";default:return"Something went wrong"}}catch(s){return this.loggingService.catch("Error in UserPermissionService getErrorMessage:",s),"Something went wrong"}}buildFolderPermissions(e,r,s,i,t){return e.reduce((o,c)=>{let a=s.find(n=>n.id===c);return a?o[c]=f({error:this.getErrorMessage(a.errorCode,"folder"),errorCode:a.errorCode},a.errorCode===l.PERMISSION_DENIED&&{accessType:i[c]??t??p}):o[c]={accessRole:r.viewerFolderIds?.includes(T(c))?S.VIEWER:S.EDITOR,accessType:i[c]??t??p},o},{})}buildDocumentPermissions(e,r,s,i,t){return e.reduce((o,c)=>{let a=s.find(n=>n.id===c);return a?o[c]=f({error:this.getErrorMessage(a.errorCode,"document"),errorCode:a.errorCode},a.errorCode===l.PERMISSION_DENIED&&{accessType:i[c]??t??p}):o[c]={accessRole:r.viewerDocumentIds?.includes(_(c))?S.VIEWER:S.EDITOR,accessType:i[c]??t??p},o},{})}buildOrganizationPermission(e,r,s){return s?{error:this.getErrorMessage(s.errorCode,"organization"),errorCode:s.errorCode}:{accessRole:r.viewerOrganizationIds?.includes(e)?S.VIEWER:S.EDITOR}}processTemporaryUserPermissions(e,r){for(let s of r)if(s?.userId)switch(this.ensureUserPermissionStructure(e,s.userId),s.type){case"folder":this.addTemporaryFolderPermission(e,s);break;case"document":this.addTemporaryDocumentPermission(e,s);break;case"organization":this.addTemporaryOrganizationPermission(e,s);break}}ensureUserPermissionStructure(e,r){e[r]||(e[r]={})}addTemporaryFolderPermission(e,r){let{userId:s,resourceId:i,role:t,expiresAt:o}=r;e[s].folders||(e[s].folders={}),e[s].folders[i]={accessRole:t??S.EDITOR,expiresAt:o}}addTemporaryDocumentPermission(e,r){let{userId:s,resourceId:i,role:t,expiresAt:o}=r;e[s].documents||(e[s].documents={}),e[s].documents[i]={accessRole:t??S.EDITOR,expiresAt:o}}addTemporaryOrganizationPermission(e,r){let{userId:s,resourceId:i,role:t,expiresAt:o}=r;e[s].organization||(e[s].organization={}),e[s].organization[i]={accessRole:t??S.EDITOR,expiresAt:o}}hasEditAccess({organizationId:e,folderId:r,documentId:s}){try{let i=!0,t=this.getCurrentUserPermissionsWithServerIds(),o=this.authService.getUser()?.userId??"";return t&&(e&&typeof e=="string"&&t?.[o]?.organization?.[e]&&(t?.[o]?.organization?.[e]?.accessRole===S.VIEWER||t?.[o]?.organization?.[e]?.errorCode===l.PERMISSION_DENIED)&&(i=!1),r&&typeof r=="string"&&t?.[o]?.folders?.[r]&&(t?.[o]?.folders?.[r]?.accessRole===S.VIEWER||t?.[o]?.folders?.[r]?.errorCode===l.PERMISSION_DENIED)&&(i=!1),s&&typeof s=="string"&&t?.[o]?.documents?.[s]&&(t?.[o]?.documents?.[s]?.accessRole===S.VIEWER||t?.[o]?.documents?.[s]?.errorCode===l.PERMISSION_DENIED)&&(i=!1)),i}catch{return!0}}getCurrentUserPermissions$(){return this.currentUserPermissions$.asObservable().pipe(w(b))}getCurrentUserPermissions(){return this.currentUserPermissions$.value}refactorPermissionsWithServerIds(e){try{let r=JSON.parse(JSON.stringify(e??{})),s=this.authService.getUser()?.userId??"";if(r?.[s]){let i=this.docService.getDocumentPaths()?.clientOrganizationId??"";if(r?.[s]?.organization?.[i]){let t=A(i);r[s].organization&&(r[s].organization[t]=r[s].organization[i],delete r[s].organization[i])}r?.[s]?.folders&&(r[s].folders=Object.fromEntries(Object.entries(r?.[s]?.folders??{}).map(([t,o])=>[T(t),o]))),r?.[s]?.documents&&(r[s].documents=Object.fromEntries(Object.entries(r?.[s]?.documents??{}).map(([t,o])=>[_(t),o])))}return r}catch(r){return this.loggingService.catch("Error in UsersPermissionService refactorPermissionsWithServerIds:",r),e}}getCurrentUserPermissionsWithServerIds$(){return this.currentUserPermissions$.asObservable().pipe(G(e=>this.refactorPermissionsWithServerIds(e)),w(b))}getCurrentUserPermissionsWithServerIds(){return this.refactorPermissionsWithServerIds(this.currentUserPermissions$.value)}setCurrentUserPermissions(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setCurrentUserPermissions","color: green;");let r=null;e&&(r=JSON.parse(JSON.stringify(e))),this.currentUserPermissions$.next(r)}catch(r){this.loggingService.catch("Error in UsersPermissionService setCurrentUserPermissions:",r)}}getIsContextEnabled(){return this.loggingService.log("%c[WB] Calling FUNCTION: getIsContextEnabled","color: green;"),this.permissionProvider$.value?.isContextEnabled??!1}setPermissionProvider(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setPermissionProvider","color: green;"),this.clientResolverProdWarned=!1,this.clientResolverNoResolverWarned=!1,this.permissionProvider$.next(e)}catch(r){this.loggingService.catch("Error in UsersPermissionService setPermissionProvider:",r)}}get isRevokeAccessOnDocumentUnsetEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===U.DOCUMENT_UNSET)??!1}get isRevokeAccessOnUserLogoutEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===U.USER_LOGOUT)??!1}get isRevokeOrganizationAccessOnUserLogoutEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===U.USER_LOGOUT&&e.revokeOrganizationAccess)??!1}get isRevokeOrganizationAccessOnDocumentUnsetEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===U.DOCUMENT_UNSET&&e.revokeOrganizationAccess)??!1}getPermissionProviderRetryConfig(){return this.permissionProvider$.value?.retryConfig??{retryCount:0,retryDelay:0}}revokeAccessOnUserLogout(){return g(this,null,function*(){let e=M();try{if(this.isRevokeAccessOnUserLogoutEnabled){let r=[],s=this.authService.getUser()?.userId??"";if((this.getPermissionsCache()??[]).forEach(t=>{t.userId===s&&t.hasAccess&&(t.type===I.ORGANIZATION?this.isRevokeOrganizationAccessOnUserLogoutEnabled&&r.push(y(f({},t),{hasAccess:!1})):r.push(y(f({},t),{hasAccess:!1})))}),r.length>0){this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_FORMED,timestamp:new Date().getTime(),uniqueId:e,methodName:R.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{requests:r}}),this.setPermissionsCache([]),this.clearRequestKeyedPermissionsCache(),this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_TRIGGERED,timestamp:new Date().getTime(),uniqueId:e,methodName:R.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{requests:r}});let t=yield this.revokeAccess({requests:r,userId:this.authService.getUser()?.userId??""});t.success?this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_RESULT,timestamp:new Date().getTime(),uniqueId:e,methodName:R.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{result:{data:t,success:!0,statusCode:200}}}):this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:R.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{result:{data:t,success:!1,statusCode:500}}})}}}catch(r){this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:R.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{error:r}}),this.loggingService.catch("Error in UsersPermissionService revokeAccessOnUserLogout:",r)}})}getRevokeKey(e){try{return`${e.userId}_${e.resourceId}_${e.type}_${e.organizationId}`}catch(r){return this.loggingService.catch("Error in UsersPermissionService getRevokeKey:",r),""}}cancelPendingRevokes(e){try{e.forEach(r=>{let s=this.getRevokeKey({userId:r.userId,resourceId:r.resource.id,type:r.resource.type,organizationId:r.resource.organizationId});this.pendingRevokeRequests.has(s)&&this.pendingRevokeRequests.delete(s)}),this.pendingRevokeRequests.size===0&&this.pendingRevokeTimeoutId&&(clearTimeout(this.pendingRevokeTimeoutId),this.pendingRevokeTimeoutId=null)}catch(r){this.loggingService.catch("Error in UsersPermissionService cancelPendingRevokes:",r)}}flushPendingRevokes(){return g(this,null,function*(){let e=this.pendingRevokeUniqueId,r=this.pendingRevokeUserId;try{let s=Array.from(this.pendingRevokeRequests.values());if(this.pendingRevokeRequests.clear(),this.pendingRevokeTimeoutId=null,this.pendingRevokeUniqueId="",this.pendingRevokeUserId="",s.length===0)return;let i=this.getPermissionsCache()??[];s.forEach(c=>{i=i.filter(a=>!(a.resourceId===c.resourceId&&a.type===c.type&&a.organizationId===c.organizationId&&a.userId===c.userId))}),this.setPermissionsCache(i);let t=this.docService.getDocContext(),o=yield this.revokeAccess({requests:s,userId:r,currentContext:t});o.success?this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_RESULT,timestamp:new Date().getTime(),uniqueId:e,methodName:R.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{result:{data:o,success:!0,statusCode:200}}}):this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:R.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{result:{data:o,success:!1,statusCode:500}}})}catch(s){this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:R.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{error:s}}),this.loggingService.catch("Error in UsersPermissionService flushPendingRevokes:",s)}})}revokeAccessOnDocumentUnset(i){return g(this,arguments,function*({documentIds:e,folderId:r,context:s}){let t=M();try{if(this.isRevokeAccessOnDocumentUnsetEnabled){let o=[],c=this.docService.getOrganizationConfig()?.clientOrganizationId??"",a=this.authService.getUser()?.userId??"",n=this.getPermissionsCache()??[];e.forEach(d=>{n=this.collectRevokeRequest(n,o,d.clientDocumentId,I.DOCUMENT,c,a)}),r&&(n=this.collectRevokeRequest(n,o,r,I.FOLDER,c,a)),c&&this.isRevokeOrganizationAccessOnDocumentUnsetEnabled&&(n=this.collectRevokeRequest(n,o,c,I.ORGANIZATION,c,a)),s&&this.getIsContextEnabled()&&J({input:s}).forEach(h=>{let u=JSON.stringify(h.access);n=this.collectRevokeRequest(n,o,u,I.CONTEXT,c,a)}),this.setPermissionsCache(n),o.length>0&&(this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_FORMED,timestamp:new Date().getTime(),uniqueId:t,methodName:R.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{requests:o}}),this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_TRIGGERED,timestamp:new Date().getTime(),uniqueId:t,methodName:R.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{requests:o}}),o.forEach(d=>{this.pendingRevokeRequests.set(this.getRevokeKey(d),d)}),this.pendingRevokeUniqueId=t,this.pendingRevokeUserId=a,this.pendingRevokeTimeoutId&&clearTimeout(this.pendingRevokeTimeoutId),this.pendingRevokeTimeoutId=setTimeout(()=>this.flushPendingRevokes(),this.REVOKE_DELAY_MS))}}catch(o){this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:t,methodName:R.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{error:o}}),this.loggingService.catch("Error in UsersPermissionService revokeAccessOnDocumentUnset:",o)}})}getAccess(s){return g(this,arguments,function*({requests:e,userId:r}){let i={retryConfig:this.getPermissionProviderRetryConfig()};return this.isClientDevResolverActive()?i.clientResolvedResults=yield this.resolveClientSide(e):this.getPermissionProvider()?.dev&&this.warnNoResolverOnce(),this.sendGetAccessToProxy({requests:e,userId:r,metadata:i})})}sendGetAccessToProxy(i){return g(this,arguments,function*({requests:e,userId:r,metadata:s}){let t=V(this.functions,F({url:this.endpointsService.getCloudFunctionUrl("sdkProxy"),apiProxyDomain:this.configService?.getApiProxyDomain()}));return yield z({methodName:"getAccess",data:{type:"getAccess",data:e,metadata:s},getSdkProxy:t,userId:r})})}isClientDevResolverActive(){return!!this.getPermissionProvider()?.dev&&this.isClientDevResolverConfigured()}resolveClientSidePermissions(e){return g(this,null,function*(){if(!this.isClientDevResolverActive())throw new Error("Client-side dev permission resolver is not active");return this.resolveClientSide(e)})}isClientDevResolverConfigured(){let e=this.getPermissionProvider();return e?!!e.endpointConfig?.url?.trim()||typeof e.resolvePermissions=="function":!1}resolveClientSide(e){return g(this,null,function*(){this.warnClientResolverEnabledOnce();let r=this.getPermissionProvider(),s=this.getPermissionProviderRetryConfig(),i=r?.resolveTimeout??6e4,t=yield j(()=>this.withResolverTimeout(()=>this.invokeResolver(e,r),i),"clientPermissionResolver",{retryCount:s?.retryCount??0,retryDelay:s?.retryDelay??0});if(!t||!t.success||t.statusCode!==200)throw new Error(t?.message??"Client permission resolver failed");let o=t.data;if(!Array.isArray(o))throw new Error("Client permission resolver returned a malformed payload");return o})}invokeResolver(e,r){return g(this,null,function*(){let s={data:{requests:e}},i=r.endpointConfig?.url?.trim();if(i)return B(i,r.endpointConfig?.headers,s,!0,r.endpointConfig?.credentials);let t=yield r.resolvePermissions(s);if(Array.isArray(t))return{data:t,success:!0,statusCode:200};let o=t,c=o?.statusCode??(o?.success===!1?500:200),a=o?.success!==!1&&c===200;return{data:Array.isArray(o?.data)?o.data:void 0,success:a,statusCode:a?200:c===200?500:c,message:o?.message}})}withResolverTimeout(e,r){return g(this,null,function*(){if(!r||r<=0)return e();let s,i=new Promise((t,o)=>{s=setTimeout(()=>o(new Error("Client permission resolver timed out")),r)});try{return yield Promise.race([e(),i])}finally{s&&clearTimeout(s)}})}warnClientResolverEnabledOnce(){this.clientResolverProdWarned||(this.clientResolverProdWarned=!0,console.warn("[Velt] Client-side dev permission resolver is enabled (dev: true). Permissions are resolved in the browser for local development only \u2014 DO NOT use this in production. Production API keys ignore browser-resolved results and fall back to the server-side permission provider."))}warnNoResolverOnce(){this.clientResolverNoResolverWarned||(this.clientResolverNoResolverWarned=!0,console.warn("[Velt] setPermissionProvider was called with dev: true but no endpointConfig.url or resolvePermissions callback was provided. Falling back to the server-side permission provider."))}revokeAccess(i){return g(this,arguments,function*({requests:e,userId:r,currentContext:s}){let t=V(this.functions,F({url:this.endpointsService.getCloudFunctionUrl("sdkProxy"),apiProxyDomain:this.configService?.getApiProxyDomain()}));return yield z({methodName:"revokeAccess",data:{type:"revokeAccess",data:e,metadata:f({retryConfig:this.getPermissionProviderRetryConfig()},s?.access&&{currentContext:s})},getSdkProxy:t,userId:r})})}onResourceAccessRequired(o){return g(this,arguments,function*({requests:e,uniqueId:r,methodName:s,userId:i,fromCache:t=!0}){try{if(!e?.length)return;let c=[],a=this.getPermissionsCache()??[];if(!this.forceRefreshPermissions()&&t&&(e.forEach(n=>{let d=a?.find(h=>h.resourceId===n.resource.id&&h.type===n.resource.type&&h.userId===n.userId&&h.organizationId===n.resource.organizationId);d&&c.push(d)}),c.length>0&&(e=e.filter(n=>!c.find(d=>d.resourceId===n.resource.id&&d.type===n.resource.type&&d.userId===n.userId&&d.organizationId===n.resource.organizationId)))),e.length>0){this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:r,methodName:s,source:"internal",payload:{requests:e,fromCache:t,clientResolved:this.isClientDevResolverActive()}});let n=yield this.getAccess({requests:e,userId:this.authService.getUser()?.userId??i??""});return this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.RESOURCE_ACCESS_RESULT,timestamp:new Date().getTime(),uniqueId:r,methodName:s,source:"internal",payload:{result:n,clientResolved:this.isClientDevResolverActive()}}),n?.success&&n?.data?.length&&(this.setPermissionsCache([...a,...n.data]),n.data=[...c,...n.data]),n}else if(c.length>0)return this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.RESOURCE_ACCESS_RESULT_FROM_CACHE,timestamp:new Date().getTime(),methodName:s,source:"internal",uniqueId:r,payload:{results:{data:c,success:!0,statusCode:200}}}),{data:c,success:!0,statusCode:200};return}catch(c){this.loggingService.catch("Error in UsersPermissionService onResourceAccessRequired:",c),this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.RESOURCE_ACCESS_ERROR,timestamp:new Date().getTime(),methodName:s,source:"internal",uniqueId:r,payload:{error:c,requests:e,fromCache:t}});return}})}getPermissionsCache(){return this.forceRefreshPermissions()?[]:this.permissionsCache$.getValue()}forceRefreshPermissions(){return this.getPermissionProvider()?.forceRefresh??!1}setPermissionsCache(e){try{let r=new Map;e.forEach(i=>{let t=`${i.userId}_${i.resourceId}_${i.organizationId}_${i.type}`;r.set(t,i)});let s=JSON.parse(JSON.stringify(Array.from(r.values())));this.permissionsCache$.next(s)}catch(r){this.loggingService.catch("Error in UsersPermissionService setPermissionsCache:",r)}}isPermissionProviderAvailable(){try{return!!this.permissionProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersPermissionService isPermissionProviderAvailable:",e),!1}}getPermissionProvider(){try{return this.permissionProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersPermissionService getPermissionProvider:",e),null}}getPermissionProvider$(){return this.permissionProvider$.asObservable()}};O.\u0275fac=function(r){return new(r||O)(P(Z),P(Q),P(X),P(se),P(ee),P(re),P(Y),P(W),P(q),P(ie))},O.\u0275prov=K({token:O,factory:O.\u0275fac,providedIn:"root"});let k=O;return k})();export{ye as a};