Skip to content

Commit b36bc0d

Browse files
committed
feedback
1 parent 72a08ba commit b36bc0d

File tree

2 files changed

+42
-24
lines changed

2 files changed

+42
-24
lines changed

async-collaboration/comments/customize-behavior.mdx

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,57 +1090,77 @@ subscription?.unsubscribe()
10901090
10911091
#### markAsRead
10921092
1093-
Mark a comment annotation as read for the current user. This updates the `viewedBy` field of the comment annotation to include the current user.
1093+
- Mark a comment annotation as read for the current user. This updates the `viewedBy` field of the comment annotation to include the current user.
1094+
- Params: `annotationId: string`
1095+
- Returns: `Promise<void>`
10941096
10951097
<Tabs>
10961098
<Tab title="React / Next.js">
10971099
10981100
```jsx
1099-
// Using Hook
1101+
const markAsReadRequest = {
1102+
annotationId: 'ANNOTATION_ID'
1103+
};
1104+
1105+
// Hook
11001106
const { markAsRead } = useCommentUtils();
1101-
await markAsRead('ANNOTATION_ID');
1107+
await markAsRead(markAsReadRequest);
11021108

1103-
// Using API Method
1109+
// API Method
11041110
const commentElement = client.getCommentElement();
1105-
await commentElement.markAsRead('ANNOTATION_ID');
1111+
await commentElement.markAsRead(markAsReadRequest);
11061112
```
11071113
11081114
</Tab>
11091115
11101116
<Tab title="Other Frameworks">
11111117
11121118
```js
1119+
const markAsReadRequest = {
1120+
annotationId: 'ANNOTATION_ID'
1121+
};
1122+
11131123
const commentElement = Velt.getCommentElement();
1114-
await commentElement.markAsRead('ANNOTATION_ID');
1124+
await commentElement.markAsRead(markAsReadRequest);
11151125
```
11161126
11171127
</Tab>
11181128
</Tabs>
11191129
11201130
#### markAsUnread
11211131
1122-
Mark a comment annotation as unread for the current user. This removes the current user from the `viewedBy` field of the comment annotation.
1132+
- Mark a comment annotation as unread for the current user. This removes the current user from the `viewedBy` field of the comment annotation.
1133+
- Params: `annotationId: string`
1134+
- Returns: `Promise<void>`
11231135
11241136
<Tabs>
11251137
<Tab title="React / Next.js">
11261138
11271139
```jsx
1128-
// Using Hook
1140+
const markAsUnreadRequest = {
1141+
annotationId: 'ANNOTATION_ID'
1142+
};
1143+
1144+
// Hook
11291145
const { markAsUnread } = useCommentUtils();
1130-
await markAsUnread('ANNOTATION_ID');
1146+
await markAsUnread(markAsUnreadRequest);
11311147

1132-
// Using API Method
1148+
// API Method
11331149
const commentElement = client.getCommentElement();
1134-
await commentElement.markAsUnread('ANNOTATION_ID');
1150+
await commentElement.markAsUnread(markAsUnreadRequest);
11351151
```
11361152
11371153
</Tab>
11381154
11391155
<Tab title="Other Frameworks">
11401156
11411157
```js
1158+
const markAsUnreadRequest = {
1159+
annotationId: 'ANNOTATION_ID'
1160+
};
1161+
11421162
const commentElement = Velt.getCommentElement();
1143-
await commentElement.markAsUnread('ANNOTATION_ID');
1163+
await commentElement.markAsUnread(markAsUnreadRequest);
11441164
```
11451165
11461166
</Tab>

release-notes/version-4/sdk-changelog.mdx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,23 @@ commentElement.markAsRead("eUgq6G6zXxJmOT9eBXtT");
5050

5151
- [**Comments**]: You can now tag users by copy-pasting their email address. Previously, only manually typed emails worked for tagging users not on the contact list.
5252

53-
- [**Comments**]: Added `viewedBy` and `reactionAnnotations` fields to the client annotation object. You can now access read/unread status and reaction data for comment annotations.
53+
- [**Comments**]: Added `viewedBy` and `reactionAnnotations` fields to comment annotation objects returned via REST APIs including [Get Comment Annotations](/api-reference/rest-apis/v2/comments-feature/comment-annotations/get-comment-annotations-v2) and [Get Comments](/api-reference/rest-apis/v2/comments-feature/comments/get-comments). These fields provide enhanced visibility into user engagement and reactions.
54+
55+
**`viewedBy`**: An array of User objects representing who has seen and read the comment annotation. Use this to track engagement, identify which stakeholders have reviewed feedback, or build custom read receipt indicators.
56+
57+
**`reactionAnnotations`**: An array of complete ReactionAnnotation objects containing the full reaction data for each comment. Each object includes the reaction ID, icon, user information, and metadata. Use this to display reaction counts, show who reacted with what emoji, or build custom reaction analytics.
5458

5559
```typescript
56-
// Annotation
60+
// Comment Annotation Object
5761
{
5862
...
5963
comments: [
6064
{
6165
...
62-
reactionAnnotations?: ReactionAnnotation[];
66+
reactionAnnotations?: ReactionAnnotation[]; // Complete reaction objects with full details
6367
}
6468
],
65-
viewedBy?: User[];
69+
viewedBy?: User[]; // Users who have seen and read this annotation
6670
}
6771
```
6872

@@ -77,13 +81,7 @@ commentElement.markAsRead("eUgq6G6zXxJmOT9eBXtT");
7781

7882
### Improvements
7983

80-
- [**Comments**]: Improved comment anchoring with a new fallback mechanism. Pin, text, and area comments now use enhanced element detection for more accurate positioning on dynamic websites.
81-
82-
### Bug Fixes
83-
84-
- [**Comments**]: Fixed an issue where the comment cursor was not displaying correctly on SquareSpace websites. The cursor now appears properly based on DOM element visibility.
85-
86-
- [**Comments**]: Fixed an issue with comment positioning on image tags in SquareSpace websites. Container elements with static positioning are now conditionally set to relative positioning to ensure correct comment placement.
84+
- [**Comments**]: Released v2 improved version of comment anchoring that makes comment positioning more dynamic and robust on more dynamic websites. This includes enhanced element detection for pin, text, and area comments, improved cursor display based on DOM element visibility, and better handling of image tag positioning with conditional relative positioning for container elements.
8785

8886
</Update>
8987

@@ -94,7 +92,7 @@ commentElement.markAsRead("eUgq6G6zXxJmOT9eBXtT");
9492

9593
- [**Comments**]: Fixed an issue where draft comments with resolvers were incorrectly submitted before being finalized, causing data inconsistencies. Draft comments with resolvers now work properly and are only saved when explicitly published.
9694

97-
- [**Access Control**]: Fixed an issue where organization access permissions were not being set correctly during user identification. When users logged in, their organization-level permissions were failing to initialize properly. Organization access now gets assigned correctly during the identification process.
95+
- [**Access Control**]: Fixed an issue where organization access permissions were not being set correctly when using the permission provider. When users logged in, their organization-level permissions were failing to initialize properly. Organization access now gets assigned correctly during the identification process.
9896

9997
</Update>
10098

0 commit comments

Comments
 (0)