@box/threaded-annotations 1.85.1 → 1.86.0

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 (48) hide show
  1. package/dist/chunks/message-footer.js +49 -29
  2. package/dist/chunks/messages-view.js +48 -42
  3. package/dist/chunks/threaded-annotations2.js +39 -30
  4. package/dist/esm/lib/components/v2/message-editor/message-editor.js +2 -2
  5. package/dist/esm/lib/components/v2/text-message/messages.js +4 -0
  6. package/dist/esm/lib/components/v2/text-message/text-message.js +64 -54
  7. package/dist/esm/lib/v2/test-utils/mocks/mock-messages.js +2 -2
  8. package/dist/esm/lib/v2/threaded-annotations-context.js +31 -19
  9. package/dist/esm/lib/v2/threaded-annotations.js +0 -1
  10. package/dist/i18n/bn-IN.js +1 -0
  11. package/dist/i18n/da-DK.js +1 -0
  12. package/dist/i18n/de-DE.js +1 -0
  13. package/dist/i18n/en-AU.js +1 -0
  14. package/dist/i18n/en-CA.js +1 -0
  15. package/dist/i18n/en-GB.js +1 -0
  16. package/dist/i18n/en-US.js +1 -0
  17. package/dist/i18n/en-US.properties +2 -0
  18. package/dist/i18n/en-x-pseudo.js +44 -43
  19. package/dist/i18n/en-x-pseudo.properties +43 -43
  20. package/dist/i18n/es-419.js +1 -0
  21. package/dist/i18n/es-ES.js +1 -0
  22. package/dist/i18n/fi-FI.js +1 -0
  23. package/dist/i18n/fr-CA.js +1 -0
  24. package/dist/i18n/fr-FR.js +1 -0
  25. package/dist/i18n/hi-IN.js +1 -0
  26. package/dist/i18n/it-IT.js +1 -0
  27. package/dist/i18n/ja-JP.js +1 -0
  28. package/dist/i18n/json/src/lib/components/v2/text-message/messages.json +1 -1
  29. package/dist/i18n/ko-KR.js +1 -0
  30. package/dist/i18n/nb-NO.js +1 -0
  31. package/dist/i18n/nl-NL.js +1 -0
  32. package/dist/i18n/pl-PL.js +1 -0
  33. package/dist/i18n/pt-BR.js +1 -0
  34. package/dist/i18n/ru-RU.js +1 -0
  35. package/dist/i18n/sv-SE.js +1 -0
  36. package/dist/i18n/tr-TR.js +1 -0
  37. package/dist/i18n/zh-CN.js +1 -0
  38. package/dist/i18n/zh-TW.js +1 -0
  39. package/dist/styles/messages-view.css +1 -1
  40. package/dist/types/lib/components/v2/messages-view/messages-view.d.ts +6 -2
  41. package/dist/types/lib/components/v2/text-message/messages.d.ts +5 -0
  42. package/dist/types/lib/components/v2/text-message/subcomponents/message-footer.d.ts +3 -1
  43. package/dist/types/lib/components/v2/text-message/text-message.d.ts +6 -2
  44. package/dist/types/lib/v2/stories/shared.d.ts +1 -0
  45. package/dist/types/lib/v2/threaded-annotations-context.d.ts +19 -3
  46. package/dist/types/lib/v2/threaded-annotations.d.ts +14 -2
  47. package/dist/types/lib/v2/types/message-types.d.ts +2 -0
  48. package/package.json +11 -11
@@ -3,6 +3,7 @@ import { MessageEditorProps } from '../components/v2/message-editor/message-edit
3
3
  import { AnnotationBadgeTargetType } from './types/annotation-badge-types';
4
4
  import { TextMessageType } from './types/message-types';
5
5
  type MessageActionCallback = (content: JSONContent | null) => Promise<TextMessageType | void> | TextMessageType | void;
6
+ type MessageEditActionCallback = (id: string, content: JSONContent | null) => Promise<void> | void;
6
7
  interface ThreadedAnnotationsBaseProps {
7
8
  messages: TextMessageType[];
8
9
  isResolved?: boolean;
@@ -18,14 +19,25 @@ interface ThreadedAnnotationsBaseProps {
18
19
  * item is hidden. The consumer owns URL construction and clipboard writes.
19
20
  */
20
21
  onCopyLink?: (id: string) => void;
21
- onEdit?: (id: string) => void;
22
+ /**
23
+ * Called when the user saves an edited message. `content` is `null` when the editor was emptied.
24
+ * Required to enable the Edit action, together with `permissions.canEdit` and `!isEditDisabled`.
25
+ */
26
+ onEdit?: MessageEditActionCallback;
27
+ /**
28
+ * Maps an `onEdit` error to an inline editor message; return `undefined` for the default message.
29
+ * Always invoked, even if the editor unmounts mid-save, so use it to log or toast on failure.
30
+ */
31
+ onEditError?: (error: unknown) => string | undefined;
22
32
  onResolve?: (id: string) => void;
23
33
  onUnresolve?: (id: string) => void;
24
34
  onPost: MessageActionCallback;
25
35
  onPostError?: (error: unknown) => string | undefined;
26
36
  userSelectorProps: MessageEditorProps['userSelectorProps'];
27
- /** When true, globally disables replies hides reply buttons and blocks editor opening on click. */
37
+ /** When true, globally disables replies (hides reply buttons and blocks editor opening on click). */
28
38
  isReplyDisabled?: boolean;
39
+ /** When true, or when the thread is resolved, hides the Edit menu item and blocks EDIT dispatch. */
40
+ isEditDisabled?: boolean;
29
41
  /** Called when the editor is opened or closed. Receives `true` when opened, `false` when closed. */
30
42
  onEditorOpenChange?: (isOpen: boolean) => void;
31
43
  /** When true, collapses the editor and replies panel. */
@@ -7,6 +7,8 @@ export type TextMessageType = {
7
7
  /** The message content, structured as a TipTap document node. */
8
8
  message: DocumentNode;
9
9
  createdAt: number;
10
+ /** Unix timestamp (ms) of the last edit. Undefined if the message has not been edited. */
11
+ updatedAt?: number;
10
12
  /** The author of the message. */
11
13
  author: TextMessageAuthorType;
12
14
  permissions: Permissions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/threaded-annotations",
3
- "version": "1.85.1",
3
+ "version": "1.86.0",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "dependencies": {
6
6
  "@tanstack/react-virtual": "^3.10.8",
@@ -16,23 +16,23 @@
16
16
  "uuid": "^9.0.1"
17
17
  },
18
18
  "peerDependencies": {
19
- "@box/blueprint-web": "^14.26.1",
20
- "@box/blueprint-web-assets": "^4.116.5",
21
- "@box/collaboration-popover": "^1.61.28",
22
- "@box/readable-time": "^1.40.28",
23
- "@box/user-selector": "^1.75.28",
19
+ "@box/blueprint-web": "^14.27.0",
20
+ "@box/blueprint-web-assets": "^4.116.6",
21
+ "@box/collaboration-popover": "^1.61.30",
22
+ "@box/readable-time": "^1.40.30",
23
+ "@box/user-selector": "^1.75.30",
24
24
  "clsx": "^1.2.1",
25
25
  "react": "^18.0.0",
26
26
  "react-dom": "^18.0.0",
27
27
  "react-intl": "^6.4.2"
28
28
  },
29
29
  "devDependencies": {
30
- "@box/blueprint-web": "^14.26.1",
31
- "@box/blueprint-web-assets": "^4.116.5",
30
+ "@box/blueprint-web": "^14.27.0",
31
+ "@box/blueprint-web-assets": "^4.116.6",
32
32
  "@box/eslint-plugin-blueprint": "1.1.21",
33
- "@box/readable-time": "^1.40.28",
34
- "@box/storybook-utils": "^0.18.19",
35
- "@box/user-selector": "^1.75.28",
33
+ "@box/readable-time": "^1.40.30",
34
+ "@box/storybook-utils": "^0.18.20",
35
+ "@box/user-selector": "^1.75.30",
36
36
  "react": "^18.0.0",
37
37
  "react-dom": "^18.0.0"
38
38
  },