@veltdev/types 5.0.2 → 5.0.4

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.
@@ -58,15 +58,19 @@ export interface CommentVisibilityConfig {
58
58
  annotationId?: string;
59
59
  /** Organization ID for 'organizationPrivate' type visibility */
60
60
  organizationId?: string;
61
+ /** Organization IDs for 'organizationPrivate' type visibility — the comment is visible to ALL listed organizations. Merged with `organizationId` and de-duplicated. */
62
+ organizationIds?: string[];
61
63
  /** User IDs for 'restricted' type visibility - array of user IDs who can see the comment */
62
64
  userIds?: string[];
63
65
  }
64
66
  /**
65
67
  * Configuration for private mode (enablePrivateMode/disablePrivateMode).
66
- * Same as CommentVisibilityConfig but without annotationId and organizationId,
67
- * since private mode applies to all new comments.
68
+ * Same as CommentVisibilityConfig but without annotationId, since private mode
69
+ * applies to all new comments. For 'organizationPrivate', `organizationId` and
70
+ * `organizationIds` are merged and de-duplicated; when neither is provided the
71
+ * current user's organization is used.
68
72
  */
69
- export type PrivateModeConfig = Omit<CommentVisibilityConfig, 'annotationId' | 'organizationId'>;
73
+ export type PrivateModeConfig = Omit<CommentVisibilityConfig, 'annotationId'>;
70
74
  export interface AddCommentAnnotationRequest {
71
75
  annotation: CommentAnnotation;
72
76
  options?: RequestOptions;
@@ -15,6 +15,13 @@ import { CommentAnnotationViews } from "./views.data.model";
15
15
  export interface CommentAnnotationVisibilityConfig {
16
16
  type: CommentVisibilityType;
17
17
  organizationId?: string;
18
+ /** Organization IDs for 'organizationPrivate' visibility — mirrors CommentVisibilityConfig.organizationIds (display-only). */
19
+ organizationIds?: string[];
20
+ /**
21
+ * User IDs that can see the comment (display-only mirror of the self tokens in
22
+ * `context.accessFields`). For non-public comments this ALWAYS includes the author's
23
+ * userId, reflecting the author self-token invariant (AC-002).
24
+ */
18
25
  userIds?: string[];
19
26
  }
20
27
  /**
@@ -1,4 +1,4 @@
1
- import { ResolverActions } from "../../utils/enums";
1
+ import { ResolverActions, CommentResolverSaveEvent } from "../../utils/enums";
2
2
  import { PartialAttachment } from "./attachment-resolver.data.model";
3
3
  import { BaseMetadata } from "./base-metadata.data.model";
4
4
  import { CommentAnnotation } from "./comment-annotation.data.model";
@@ -25,9 +25,21 @@ export interface SaveCommentResolverRequest {
25
25
  commentAnnotation: {
26
26
  [key: string]: PartialCommentAnnotation;
27
27
  };
28
- event?: ResolverActions;
28
+ /**
29
+ * The save event. One of the 4 core PII events (`ResolverActions`) or, when the customer
30
+ * opts in via `ResolverConfig.additionalSaveEvents`, a non-core annotation-level event
31
+ * (`CommentResolverSaveEvent`). See specs/comment-resolver iteration-2.
32
+ */
33
+ event?: ResolverActions | CommentResolverSaveEvent;
29
34
  metadata?: BaseMetadata;
30
35
  commentId?: string;
36
+ /**
37
+ * The comment the action occurred on, resolved from `commentId` against the
38
+ * payload's `commentAnnotation[*].comments` map. Convenience field so the
39
+ * customer backend does not have to re-derive the target comment from
40
+ * `commentId`. Omitted when `commentId` is absent or no matching comment is found.
41
+ */
42
+ targetComment?: PartialComment;
31
43
  }
32
44
  export interface PartialUser {
33
45
  userId: string;
@@ -53,7 +65,7 @@ export interface PartialCommentAnnotationResult {
53
65
  [annotationId: string]: PartialCommentAnnotation;
54
66
  } | null;
55
67
  originalData: CommentAnnotation | null;
56
- eventType?: ResolverActions;
68
+ eventType?: ResolverActions | CommentResolverSaveEvent;
57
69
  }
58
70
  export interface PartialTargetTextRange {
59
71
  text: string;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * A single organization / team entry, used to populate the "Selected Teams" picker
3
+ * in the comment visibility banner.
4
+ *
5
+ * Provided by the customer via `contactElement.updateOrgList({ orgList: [...] })`.
6
+ */
7
+ export declare class OrgContact {
8
+ /**
9
+ * Unique organization identifier that you use to identify the team / organization.
10
+ */
11
+ id: string;
12
+ /**
13
+ * The team / organization's display name (shown in the "Selected Teams" picker).
14
+ */
15
+ name?: string;
16
+ }
17
+ /**
18
+ * Config accepted by `updateOrgList`.
19
+ */
20
+ export interface UpdateOrgListConfig {
21
+ /**
22
+ * The list of organizations / teams to offer in the "Selected Teams" picker.
23
+ */
24
+ orgList: OrgContact[];
25
+ }
@@ -1,6 +1,20 @@
1
+ import { CommentResolverSaveEvent } from "../../utils/enums";
1
2
  export interface ResolverEndpointConfig {
2
3
  url: string;
3
- headers?: Record<string, string>;
4
+ /**
5
+ * Request headers. Either a static object (captured once) OR an async function
6
+ * resolved on EVERY request — use the function form to forward a short-lived
7
+ * per-user token (re-evaluated per retry attempt, so each retry gets a fresh token).
8
+ */
9
+ headers?: Record<string, string> | (() => Promise<Record<string, string>>);
10
+ /**
11
+ * Forwarded to `fetch()` so cookie/session auth works for resolver endpoints.
12
+ * When unset the `credentials` key is omitted from the request, so `fetch` keeps
13
+ * its browser default of `'same-origin'` — byte-identical to the prior behavior
14
+ * (same-origin cookies are still sent). Set `'include'` for cross-origin cookie/
15
+ * session auth, or `'omit'` to explicitly suppress credentials.
16
+ */
17
+ credentials?: 'include' | 'same-origin' | 'omit';
4
18
  }
5
19
  export interface ResolverConfig {
6
20
  resolveTimeout?: number;
@@ -10,10 +24,21 @@ export interface ResolverConfig {
10
24
  resolveUsersConfig?: ResolveUsersConfig;
11
25
  fieldsToRemove?: string[];
12
26
  additionalFields?: string[];
27
+ /**
28
+ * Opt-in list of additional (non-core) annotation-level save events the customer
29
+ * wants delivered to the existing save endpoint, beyond the 4 core PII events
30
+ * (add/update/delete). Each entry's `event` is a `CommentResolverSaveEvent`.
31
+ * Array-of-objects for forward-extensibility. Absent/empty ⇒ iteration-1 behavior
32
+ * (no extra events) — see specs/comment-resolver iteration-2.
33
+ */
34
+ additionalSaveEvents?: AdditionalSaveEventConfig[];
13
35
  getConfig?: ResolverEndpointConfig;
14
36
  saveConfig?: ResolverEndpointConfig;
15
37
  deleteConfig?: ResolverEndpointConfig;
16
38
  }
39
+ export interface AdditionalSaveEventConfig {
40
+ event: CommentResolverSaveEvent;
41
+ }
17
42
  export interface ResolveUsersConfig {
18
43
  organization?: boolean;
19
44
  folder?: boolean;
@@ -541,7 +541,9 @@ export declare class CommentElement {
541
541
  /**
542
542
  * To enable private mode with visibility configuration.
543
543
  * All new comments will be created with the specified visibility.
544
- * @param config PrivateModeConfig with type and optional userIds
544
+ * @param config PrivateModeConfig with type, optional userIds (restricted), and
545
+ * optional organizationId/organizationIds (organizationPrivate; merged + de-duplicated,
546
+ * defaults to the current user's organization when neither is provided)
545
547
  */
546
548
  public enablePrivateMode: (config: PrivateModeConfig) => void;
547
549
 
@@ -1892,7 +1894,9 @@ export declare class CommentElement {
1892
1894
  /**
1893
1895
  * To enable private mode with visibility configuration.
1894
1896
  * All new comments will be created with the specified visibility.
1895
- * @param config PrivateModeConfig with type and optional userIds
1897
+ * @param config PrivateModeConfig with type, optional userIds (restricted), and
1898
+ * optional organizationId/organizationIds (organizationPrivate; merged + de-duplicated,
1899
+ * defaults to the current user's organization when neither is provided)
1896
1900
  */
1897
1901
  private _enablePrivateMode;
1898
1902
 
@@ -48,6 +48,12 @@ export declare class ContactElement {
48
48
  */
49
49
  public updateContactList: (userContacts: UserContact[], config?: { merge: boolean }) => void;
50
50
 
51
+ /**
52
+ * Update the list of organizations / teams offered by the "Selected Teams" visibility picker.
53
+ * @param config { orgList: { id: string, name?: string }[] }
54
+ */
55
+ public updateOrgList: (config: { orgList: { id: string; name?: string }[] }) => void;
56
+
51
57
  /**
52
58
  * Get contact list.
53
59
  */
@@ -96,6 +102,12 @@ export declare class ContactElement {
96
102
  */
97
103
  private _updateContactList;
98
104
 
105
+ /**
106
+ * Update the list of organizations / teams offered by the "Selected Teams" visibility picker.
107
+ * @param config { orgList: { id: string, name?: string }[] }
108
+ */
109
+ private _updateOrgList;
110
+
99
111
  /**
100
112
  * Get contact list.
101
113
  */
@@ -464,6 +464,7 @@ export declare class Constants {
464
464
  VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_CONTENT_ITEM_ICON: string;
465
465
  VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_CONTENT_ITEM_LABEL: string;
466
466
  VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_CONTENT_USER_PICKER: string;
467
+ VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_CONTENT_ORG_PICKER: string;
467
468
  VELT_COMMENT_COMPOSER: string;
468
469
  VELT_SKELETON_LOADER: string;
469
470
  VELT_SHADOW_DOM_INTERNAL: string;
@@ -33,6 +33,31 @@ export declare enum ResolverActions {
33
33
  RECORDER_ANNOTATION_DELETE = "recorder_annotation.delete",
34
34
  ACTIVITY_SAVE = "activity.save"
35
35
  }
36
+ /**
37
+ * Opt-in additional (non-core) comment save events for the Comment Annotations Resolver
38
+ * (specs/comment-resolver iteration-2). Values mirror the non-core `CommentActivityActionTypes`
39
+ * (single source of truth — enforced by a unit test). A self-hosting customer lists these in
40
+ * `ResolverConfig.additionalSaveEvents` to also receive annotation-level events (status change,
41
+ * priority change, assign, …) on the existing save endpoint. The 4 core events keep using
42
+ * `ResolverActions`. Kept in enums.ts (a leaf module) to avoid a
43
+ * resolver.data.model ↔ comment-resolver.data.model import cycle.
44
+ */
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
+ }
36
61
  export declare const CommentEventTypes: {
37
62
  readonly ADD_COMMENT_ANNOTATION: "addCommentAnnotation";
38
63
  readonly ADD_COMMENT_ANNOTATION_DRAFT: "addCommentAnnotationDraft";
package/models.d.ts CHANGED
@@ -62,6 +62,7 @@ export * from './app/models/data/target-element.data.model';
62
62
  export * from './app/models/data/target-text-range.data.model';
63
63
  export * from './app/models/data/toast.data.model';
64
64
  export * from './app/models/data/transcription.data.model';
65
+ export * from './app/models/data/org-contact.data.model';
65
66
  export * from './app/models/data/user-contact.data.model';
66
67
  export * from './app/models/data/user-contact-us.data.model';
67
68
  export * from './app/models/data/user-feedback.data.model';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veltdev/types",
3
- "version": "5.0.2",
3
+ "version": "5.0.4",
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": [