@box/activity-feed 1.15.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.
- package/LICENSE +379 -0
- package/README.md +57 -0
- package/dist/chunks/AssigneeList.js +125 -0
- package/dist/chunks/TaskDueDate.js +44 -0
- package/dist/chunks/TaskItemFooter.js +77 -0
- package/dist/chunks/TaskMessage.js +86 -0
- package/dist/chunks/TaskState.js +83 -0
- package/dist/chunks/activity-feed-list.js +21 -0
- package/dist/chunks/activity-feed.js +46 -0
- package/dist/chunks/app-activity-item.js +75 -0
- package/dist/chunks/editor.js +14 -0
- package/dist/chunks/empty-state.js +22 -0
- package/dist/chunks/header.js +63 -0
- package/dist/chunks/mock-collaboration-props.js +19379 -0
- package/dist/chunks/scroll.js +6 -0
- package/dist/chunks/task-button.js +44 -0
- package/dist/chunks/task-delete-confirmation-popover.js +50 -0
- package/dist/chunks/task-options-menu.js +58 -0
- package/dist/chunks/types.js +8 -0
- package/dist/chunks/version-item.module.js +10 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/lib/activity-feed.js +6 -0
- package/dist/esm/lib/components/activity-feed-list/activity-feed-list.js +2 -0
- package/dist/esm/lib/components/activity-feed-list/index.js +2 -0
- package/dist/esm/lib/components/app-activity-item/app-activity-item.js +2 -0
- package/dist/esm/lib/components/app-activity-item/index.js +2 -0
- package/dist/esm/lib/components/app-activity-item/messages.js +6 -0
- package/dist/esm/lib/components/editor/editor.js +2 -0
- package/dist/esm/lib/components/editor/index.js +2 -0
- package/dist/esm/lib/components/empty-state/empty-state.js +2 -0
- package/dist/esm/lib/components/empty-state/index.js +2 -0
- package/dist/esm/lib/components/empty-state/messages.js +12 -0
- package/dist/esm/lib/components/header/header-filter-options.js +30 -0
- package/dist/esm/lib/components/header/header.js +2 -0
- package/dist/esm/lib/components/header/messages.js +44 -0
- package/dist/esm/lib/components/header/task-button/index.js +2 -0
- package/dist/esm/lib/components/header/task-button/messages.js +24 -0
- package/dist/esm/lib/components/header/task-button/task-button.js +2 -0
- package/dist/esm/lib/components/task-item/TaskItem.js +81 -0
- package/dist/esm/lib/components/task-item/TaskItemFooter.js +2 -0
- package/dist/esm/lib/components/task-item/components/assignee-list/AssigneeList.js +2 -0
- package/dist/esm/lib/components/task-item/components/assignee-list/index.js +2 -0
- package/dist/esm/lib/components/task-item/components/task-due-date/TaskDueDate.js +2 -0
- package/dist/esm/lib/components/task-item/components/task-due-date/index.js +2 -0
- package/dist/esm/lib/components/task-item/components/task-message/MessageRenderer.js +21 -0
- package/dist/esm/lib/components/task-item/components/task-message/TaskMessage.js +2 -0
- package/dist/esm/lib/components/task-item/components/task-message/index.js +2 -0
- package/dist/esm/lib/components/task-item/components/task-message/messages.js +24 -0
- package/dist/esm/lib/components/task-item/components/task-message/task-delete-confirmation-popover.js +2 -0
- package/dist/esm/lib/components/task-item/components/task-message/task-options-menu.js +2 -0
- package/dist/esm/lib/components/task-item/components/task-state/TaskState.js +2 -0
- package/dist/esm/lib/components/task-item/components/task-state/index.js +2 -0
- package/dist/esm/lib/components/task-item/components/task-state/messages.js +20 -0
- package/dist/esm/lib/components/task-item/index.js +6 -0
- package/dist/esm/lib/components/task-item/messages.js +76 -0
- package/dist/esm/lib/components/task-item/utils/task-item-helpers.js +22 -0
- package/dist/esm/lib/components/user-avatar/getInitials.js +5 -0
- package/dist/esm/lib/components/user-avatar/index.js +2 -0
- package/dist/esm/lib/components/user-avatar/user-avatar.js +22 -0
- package/dist/esm/lib/components/version-item/delete-version-item/delete-version-item.js +41 -0
- package/dist/esm/lib/components/version-item/delete-version-item/index.js +2 -0
- package/dist/esm/lib/components/version-item/divider-version-item/divider-version-item.js +20 -0
- package/dist/esm/lib/components/version-item/divider-version-item/index.js +2 -0
- package/dist/esm/lib/components/version-item/index.js +2 -0
- package/dist/esm/lib/components/version-item/messages.js +36 -0
- package/dist/esm/lib/components/version-item/version-item.js +52 -0
- package/dist/esm/lib/scroll/create-activity-feed-scroll.js +18 -0
- package/dist/esm/lib/scroll/index.js +4 -0
- package/dist/esm/lib/scroll/use-activity-feed-scroll.js +7 -0
- package/dist/esm/lib/test-utils/mocks/index.js +6 -0
- package/dist/esm/lib/test-utils/mocks/mock-collaboration-props.js +2 -0
- package/dist/esm/lib/test-utils/mocks/mock-feed-items.js +187 -0
- package/dist/esm/lib/test-utils/mocks/mock-mention-context.js +7 -0
- package/dist/esm/lib/test-utils/mocks/mock-user-selector-props.js +9 -0
- package/dist/esm/lib/test-utils/mocks/mock-users.js +86 -0
- package/dist/esm/lib/types/ActivityItem.js +0 -0
- package/dist/esm/lib/types/common.js +0 -0
- package/dist/esm/lib/types/index.js +0 -0
- package/dist/i18n/bn-IN.js +55 -0
- package/dist/i18n/bn-IN.properties +106 -0
- package/dist/i18n/da-DK.js +55 -0
- package/dist/i18n/da-DK.properties +106 -0
- package/dist/i18n/de-DE.js +55 -0
- package/dist/i18n/de-DE.properties +106 -0
- package/dist/i18n/en-AU.js +55 -0
- package/dist/i18n/en-AU.properties +106 -0
- package/dist/i18n/en-CA.js +55 -0
- package/dist/i18n/en-CA.properties +106 -0
- package/dist/i18n/en-GB.js +55 -0
- package/dist/i18n/en-GB.properties +106 -0
- package/dist/i18n/en-US.js +55 -0
- package/dist/i18n/en-US.properties +106 -0
- package/dist/i18n/en-x-pseudo.js +55 -0
- package/dist/i18n/en-x-pseudo.properties +106 -0
- package/dist/i18n/es-419.js +55 -0
- package/dist/i18n/es-419.properties +106 -0
- package/dist/i18n/es-ES.js +55 -0
- package/dist/i18n/es-ES.properties +106 -0
- package/dist/i18n/fi-FI.js +55 -0
- package/dist/i18n/fi-FI.properties +106 -0
- package/dist/i18n/fr-CA.js +55 -0
- package/dist/i18n/fr-CA.properties +106 -0
- package/dist/i18n/fr-FR.js +55 -0
- package/dist/i18n/fr-FR.properties +106 -0
- package/dist/i18n/hi-IN.js +55 -0
- package/dist/i18n/hi-IN.properties +106 -0
- package/dist/i18n/it-IT.js +55 -0
- package/dist/i18n/it-IT.properties +106 -0
- package/dist/i18n/ja-JP.js +55 -0
- package/dist/i18n/ja-JP.properties +106 -0
- package/dist/i18n/json/src/lib/components/app-activity-item/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/empty-state/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/header/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/header/task-button/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/task-item/components/task-message/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/task-item/components/task-state/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/task-item/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/version-item/messages.json +1 -0
- package/dist/i18n/ko-KR.js +55 -0
- package/dist/i18n/ko-KR.properties +106 -0
- package/dist/i18n/nb-NO.js +55 -0
- package/dist/i18n/nb-NO.properties +106 -0
- package/dist/i18n/nl-NL.js +55 -0
- package/dist/i18n/nl-NL.properties +106 -0
- package/dist/i18n/pl-PL.js +55 -0
- package/dist/i18n/pl-PL.properties +106 -0
- package/dist/i18n/pt-BR.js +55 -0
- package/dist/i18n/pt-BR.properties +106 -0
- package/dist/i18n/ru-RU.js +55 -0
- package/dist/i18n/ru-RU.properties +106 -0
- package/dist/i18n/sv-SE.js +55 -0
- package/dist/i18n/sv-SE.properties +106 -0
- package/dist/i18n/tr-TR.js +55 -0
- package/dist/i18n/tr-TR.properties +106 -0
- package/dist/i18n/zh-CN.js +55 -0
- package/dist/i18n/zh-CN.properties +106 -0
- package/dist/i18n/zh-TW.js +55 -0
- package/dist/i18n/zh-TW.properties +106 -0
- package/dist/styles/AssigneeList.css +1 -0
- package/dist/styles/TaskDueDate.css +1 -0
- package/dist/styles/TaskItemFooter.css +1 -0
- package/dist/styles/TaskMessage.css +1 -0
- package/dist/styles/TaskState.css +1 -0
- package/dist/styles/activity-feed-list.css +1 -0
- package/dist/styles/activity-feed.css +1 -0
- package/dist/styles/app-activity-item.css +1 -0
- package/dist/styles/editor.css +1 -0
- package/dist/styles/empty-state.css +1 -0
- package/dist/styles/header.css +1 -0
- package/dist/styles/task-button.css +1 -0
- package/dist/styles/task-delete-confirmation-popover.css +1 -0
- package/dist/styles/task-options-menu.css +1 -0
- package/dist/styles/version-item.css +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/lib/activity-feed.d.ts +62 -0
- package/dist/types/lib/components/activity-feed-list/activity-feed-list.d.ts +7 -0
- package/dist/types/lib/components/activity-feed-list/index.d.ts +1 -0
- package/dist/types/lib/components/app-activity-item/app-activity-item.d.ts +13 -0
- package/dist/types/lib/components/app-activity-item/index.d.ts +1 -0
- package/dist/types/lib/components/app-activity-item/messages.d.ts +7 -0
- package/dist/types/lib/components/editor/editor.d.ts +3 -0
- package/dist/types/lib/components/editor/index.d.ts +1 -0
- package/dist/types/lib/components/empty-state/empty-state.d.ts +1 -0
- package/dist/types/lib/components/empty-state/index.d.ts +1 -0
- package/dist/types/lib/components/empty-state/messages.d.ts +12 -0
- package/dist/types/lib/components/header/header-filter-options.d.ts +16 -0
- package/dist/types/lib/components/header/header.d.ts +49 -0
- package/dist/types/lib/components/header/messages.d.ts +52 -0
- package/dist/types/lib/components/header/stories/shared.d.ts +13 -0
- package/dist/types/lib/components/header/task-button/index.d.ts +1 -0
- package/dist/types/lib/components/header/task-button/messages.d.ts +27 -0
- package/dist/types/lib/components/header/task-button/task-button.d.ts +8 -0
- package/dist/types/lib/components/task-item/TaskItem.d.ts +3 -0
- package/dist/types/lib/components/task-item/TaskItemFooter.d.ts +19 -0
- package/dist/types/lib/components/task-item/components/assignee-list/AssigneeList.d.ts +11 -0
- package/dist/types/lib/components/task-item/components/assignee-list/index.d.ts +1 -0
- package/dist/types/lib/components/task-item/components/task-due-date/TaskDueDate.d.ts +5 -0
- package/dist/types/lib/components/task-item/components/task-due-date/index.d.ts +1 -0
- package/dist/types/lib/components/task-item/components/task-message/MessageRenderer.d.ts +6 -0
- package/dist/types/lib/components/task-item/components/task-message/TaskMessage.d.ts +16 -0
- package/dist/types/lib/components/task-item/components/task-message/index.d.ts +3 -0
- package/dist/types/lib/components/task-item/components/task-message/messages.d.ts +28 -0
- package/dist/types/lib/components/task-item/components/task-message/task-delete-confirmation-popover.d.ts +11 -0
- package/dist/types/lib/components/task-item/components/task-message/task-options-menu.d.ts +13 -0
- package/dist/types/lib/components/task-item/components/task-message/types.d.ts +19 -0
- package/dist/types/lib/components/task-item/components/task-state/TaskState.d.ts +28 -0
- package/dist/types/lib/components/task-item/components/task-state/index.d.ts +2 -0
- package/dist/types/lib/components/task-item/components/task-state/messages.d.ts +23 -0
- package/dist/types/lib/components/task-item/index.d.ts +12 -0
- package/dist/types/lib/components/task-item/messages.d.ts +93 -0
- package/dist/types/lib/components/task-item/types.d.ts +106 -0
- package/dist/types/lib/components/task-item/utils/task-item-helpers.d.ts +4 -0
- package/dist/types/lib/components/user-avatar/getInitials.d.ts +1 -0
- package/dist/types/lib/components/user-avatar/index.d.ts +1 -0
- package/dist/types/lib/components/user-avatar/user-avatar.d.ts +11 -0
- package/dist/types/lib/components/version-item/delete-version-item/delete-version-item.d.ts +8 -0
- package/dist/types/lib/components/version-item/delete-version-item/index.d.ts +1 -0
- package/dist/types/lib/components/version-item/divider-version-item/divider-version-item.d.ts +5 -0
- package/dist/types/lib/components/version-item/divider-version-item/index.d.ts +1 -0
- package/dist/types/lib/components/version-item/index.d.ts +1 -0
- package/dist/types/lib/components/version-item/messages.d.ts +42 -0
- package/dist/types/lib/components/version-item/version-item.d.ts +23 -0
- package/dist/types/lib/scroll/create-activity-feed-scroll.d.ts +2 -0
- package/dist/types/lib/scroll/index.d.ts +4 -0
- package/dist/types/lib/scroll/types.d.ts +10 -0
- package/dist/types/lib/scroll/use-activity-feed-scroll.d.ts +6 -0
- package/dist/types/lib/stories/map-activity-item.d.ts +18 -0
- package/dist/types/lib/stories/shared.d.ts +15 -0
- package/dist/types/lib/test-utils/button-utils.d.ts +14 -0
- package/dist/types/lib/test-utils/index.d.ts +1 -0
- package/dist/types/lib/test-utils/mocks/index.d.ts +5 -0
- package/dist/types/lib/test-utils/mocks/mock-collaboration-props.d.ts +9 -0
- package/dist/types/lib/test-utils/mocks/mock-feed-items.d.ts +20 -0
- package/dist/types/lib/test-utils/mocks/mock-mention-context.d.ts +2 -0
- package/dist/types/lib/test-utils/mocks/mock-user-selector-props.d.ts +2 -0
- package/dist/types/lib/test-utils/mocks/mock-users.d.ts +55 -0
- package/dist/types/lib/test-utils/text-utils.d.ts +3 -0
- package/dist/types/lib/types/ActivityItem.d.ts +145 -0
- package/dist/types/lib/types/common.d.ts +82 -0
- package/dist/types/lib/types/index.d.ts +3 -0
- package/package.json +56 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { createActivityFeedScroll } from './create-activity-feed-scroll';
|
|
2
|
+
export type { ActivityFeedScrollHandle, InternalActivityFeedScrollHandle } from './types';
|
|
3
|
+
export { isAttachableActivityFeedScrollHandle } from './types';
|
|
4
|
+
export { useActivityFeedScroll } from './use-activity-feed-scroll';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Public handle: scroll a keyed list row into view (smooth). */
|
|
2
|
+
export interface ActivityFeedScrollHandle {
|
|
3
|
+
/** Scroll the row for `id` into view. Returns false when the row is not mounted. */
|
|
4
|
+
scrollTo: (id: string) => boolean;
|
|
5
|
+
}
|
|
6
|
+
/** Internal: same API plus container registration for `ActivityFeed.Root`. */
|
|
7
|
+
export interface InternalActivityFeedScrollHandle extends ActivityFeedScrollHandle {
|
|
8
|
+
attachContainer: (node: HTMLElement | null) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function isAttachableActivityFeedScrollHandle(value: unknown): value is InternalActivityFeedScrollHandle;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ActivityFeedScrollHandle } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a stable scroll handle for `ActivityFeed.Root` (`scrollTo={...}` prop).
|
|
4
|
+
* Rows must use React `key={item.id}` so the list can tag DOM nodes for lookup.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useActivityFeedScroll(): ActivityFeedScrollHandle;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TextMessageTypeV2 } from '@box/threaded-annotations';
|
|
2
|
+
import { AppActivityItemProps } from '../components/app-activity-item';
|
|
3
|
+
import { TaskItemProps } from '../components/task-item';
|
|
4
|
+
import { VersionItemProps } from '../components/version-item';
|
|
5
|
+
import { AppActivityFeedItem, TaskActivityItem, ThreadedActivityItem, VersionActivityItem } from '../types';
|
|
6
|
+
/** Map a server-shaped {@link ThreadedActivityItem} to a `ThreadedAnnotationsV2` message. */
|
|
7
|
+
export declare const toThreadedMessage: (item: ThreadedActivityItem) => TextMessageTypeV2;
|
|
8
|
+
/** Flatten a nested {@link ThreadedActivityItem} tree into a flat message list. */
|
|
9
|
+
export declare const flattenThreadMessages: (item: ThreadedActivityItem) => TextMessageTypeV2[];
|
|
10
|
+
/**
|
|
11
|
+
* Map a {@link TaskActivityItem} (server-shaped activity feed projection) to
|
|
12
|
+
* the full {@link TaskItemProps} shape consumed by `TaskItem`.
|
|
13
|
+
*/
|
|
14
|
+
export declare const toTaskItemProps: (item: TaskActivityItem) => TaskItemProps;
|
|
15
|
+
/** Map a {@link VersionActivityItem} to {@link VersionItemProps} (`trash` becomes `delete`). */
|
|
16
|
+
export declare const toVersionItemProps: (item: VersionActivityItem) => VersionItemProps;
|
|
17
|
+
/** Map an {@link AppActivityFeedItem} to {@link AppActivityItemProps}. */
|
|
18
|
+
export declare const toAppActivityItemProps: (item: AppActivityFeedItem) => AppActivityItemProps;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ActivityFeedItem } from '../types';
|
|
2
|
+
export interface InteractiveActivityFeedProps {
|
|
3
|
+
/** Optional item override. */
|
|
4
|
+
items?: ActivityFeedItem[];
|
|
5
|
+
/** Initial mention-me value. */
|
|
6
|
+
initialMentionMe?: boolean;
|
|
7
|
+
/** Initial show-resolved value. */
|
|
8
|
+
initialShowResolvedComments?: boolean;
|
|
9
|
+
/** Storybook-only: when set, scroll the row with this id into view on mount/change. */
|
|
10
|
+
scrollToItemId?: string;
|
|
11
|
+
/** Close callback. */
|
|
12
|
+
onClose: () => void;
|
|
13
|
+
}
|
|
14
|
+
/** Full Storybook harness for ActivityFeed. */
|
|
15
|
+
export declare const InteractiveActivityFeed: ({ initialMentionMe, initialShowResolvedComments, items, scrollToItemId, onClose, }: InteractiveActivityFeedProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { userEvent, within } from 'storybook/test';
|
|
2
|
+
export declare const waitForButtonByName: (canvas: ReturnType<typeof within>, name: string | RegExp, options?: {
|
|
3
|
+
timeout?: number;
|
|
4
|
+
}) => Promise<any>;
|
|
5
|
+
export declare const waitForButtonToDisappear: (canvas: ReturnType<typeof within>, name: string | RegExp) => Promise<void>;
|
|
6
|
+
export declare const clickButtonByName: (user: ReturnType<typeof userEvent.setup>, canvas: ReturnType<typeof within>, name: string | RegExp) => Promise<void>;
|
|
7
|
+
export declare const waitForMenuItemByName: (canvas: ReturnType<typeof within>, name: string | RegExp, options?: {
|
|
8
|
+
timeout?: number;
|
|
9
|
+
}) => Promise<any>;
|
|
10
|
+
export declare const clickMenuItemByName: (user: ReturnType<typeof userEvent.setup>, canvas: ReturnType<typeof within>, name: string | RegExp) => Promise<void>;
|
|
11
|
+
export declare const waitForMenuItemCheckboxByName: (canvas: ReturnType<typeof within>, name: string | RegExp, options?: {
|
|
12
|
+
timeout?: number;
|
|
13
|
+
}) => Promise<any>;
|
|
14
|
+
export declare const clickMenuItemCheckboxByName: (user: ReturnType<typeof userEvent.setup>, canvas: ReturnType<typeof within>, name: string | RegExp) => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './mocks';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CollaborationPopoverType } from '@box/collaboration-popover';
|
|
2
|
+
export declare const createMockCollaborationPopoverProps: () => {
|
|
3
|
+
onSubmit: () => Promise<void>;
|
|
4
|
+
onUserClick: import('storybook/test').Mock<(...args: any[]) => any>;
|
|
5
|
+
onClose: import('storybook/test').Mock<(...args: any[]) => any>;
|
|
6
|
+
onInviteTypeChange: import('storybook/test').Mock<(...args: any[]) => any>;
|
|
7
|
+
loading: boolean;
|
|
8
|
+
type: CollaborationPopoverType;
|
|
9
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ActivityFeedItem, AppActivityFeedItem, TaskActivityItem, ThreadedActivityItem, VersionActivityItem } from '../../types';
|
|
2
|
+
/** Threaded comment with one reply and a resolved sibling thread. */
|
|
3
|
+
export declare const MOCK_COMMENT_THREAD: ThreadedActivityItem;
|
|
4
|
+
export declare const MOCK_RESOLVED_COMMENT_THREAD: ThreadedActivityItem;
|
|
5
|
+
/** Annotation thread anchored to a page in the file. */
|
|
6
|
+
export declare const MOCK_ANNOTATION_THREAD: ThreadedActivityItem;
|
|
7
|
+
/** General task in progress, current user is one of the assignees. */
|
|
8
|
+
export declare const MOCK_TASK_IN_PROGRESS: TaskActivityItem;
|
|
9
|
+
/** Completed approval task, locked. */
|
|
10
|
+
export declare const MOCK_TASK_APPROVED: TaskActivityItem;
|
|
11
|
+
/** Box for Slack-style app activity. */
|
|
12
|
+
export declare const MOCK_APP_ACTIVITY_SHARED: AppActivityFeedItem;
|
|
13
|
+
/** Workflow-step app activity with plain text. */
|
|
14
|
+
export declare const MOCK_APP_ACTIVITY_WORKFLOW: AppActivityFeedItem;
|
|
15
|
+
/** Version uploaded by a user. */
|
|
16
|
+
export declare const MOCK_VERSION_UPLOADED: VersionActivityItem;
|
|
17
|
+
/** Version restored event. */
|
|
18
|
+
export declare const MOCK_VERSION_RESTORED: VersionActivityItem;
|
|
19
|
+
/** Mixed feed used by Default / Realistic stories. Ordered newest-first. */
|
|
20
|
+
export declare const MOCK_FEED_ITEMS: ActivityFeedItem[];
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { UserContactType } from '@box/user-selector';
|
|
2
|
+
export declare const MOCK_USERS: {
|
|
3
|
+
readonly LIAM_FOSTER: {
|
|
4
|
+
readonly avatarUrl: "/img/avatar.svg";
|
|
5
|
+
readonly email: "liam.foster@example.com";
|
|
6
|
+
readonly id: 1;
|
|
7
|
+
readonly name: "Liam Foster";
|
|
8
|
+
readonly value: "Liam Foster";
|
|
9
|
+
readonly isExternalUser: false;
|
|
10
|
+
};
|
|
11
|
+
readonly SARAH_CHEN: {
|
|
12
|
+
readonly email: "sarah.chen@example.com";
|
|
13
|
+
readonly id: 2;
|
|
14
|
+
readonly name: "Sarah Chen";
|
|
15
|
+
readonly value: "Sarah Chen";
|
|
16
|
+
readonly isExternalUser: true;
|
|
17
|
+
};
|
|
18
|
+
readonly ALEX_RODRIGUEZ: {
|
|
19
|
+
readonly email: "alex.rodriguez@example.com";
|
|
20
|
+
readonly id: 3;
|
|
21
|
+
readonly name: "Alex Rodriguez";
|
|
22
|
+
readonly value: "Alex Rodriguez";
|
|
23
|
+
readonly isExternalUser: false;
|
|
24
|
+
};
|
|
25
|
+
readonly EMMA_WILSON: {
|
|
26
|
+
readonly avatarUrl: "/img/avatar.svg";
|
|
27
|
+
readonly email: "emma.wilson@external.com";
|
|
28
|
+
readonly id: 4;
|
|
29
|
+
readonly name: "Emma Wilson";
|
|
30
|
+
readonly value: "Emma Wilson";
|
|
31
|
+
readonly isExternalUser: true;
|
|
32
|
+
};
|
|
33
|
+
readonly DAVID_THOMPSON: {
|
|
34
|
+
readonly email: "david.thompson@example.com";
|
|
35
|
+
readonly id: 12312312;
|
|
36
|
+
readonly name: "David Thompson";
|
|
37
|
+
readonly value: "David Thompson";
|
|
38
|
+
readonly isExternalUser: false;
|
|
39
|
+
};
|
|
40
|
+
readonly TEST_USER: {
|
|
41
|
+
readonly id: 1213123;
|
|
42
|
+
readonly name: "Test User";
|
|
43
|
+
readonly email: "test@box.com";
|
|
44
|
+
readonly isExternalUser: false;
|
|
45
|
+
readonly value: "Test User";
|
|
46
|
+
};
|
|
47
|
+
readonly CURRENT_USER: {
|
|
48
|
+
readonly email: "you@example.com";
|
|
49
|
+
readonly id: 999;
|
|
50
|
+
readonly name: "Test User";
|
|
51
|
+
readonly value: "Test User";
|
|
52
|
+
readonly isExternalUser: false;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export declare const MOCK_USER_SELECTOR_USERS: UserContactType[];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { within } from 'storybook/test';
|
|
2
|
+
export declare const waitForTextToAppear: (canvas: ReturnType<typeof within>, text: string, exact?: boolean, timeout?: number) => Promise<any>;
|
|
3
|
+
export declare const waitForTextToDisappear: (canvas: ReturnType<typeof within>, text: string) => Promise<void>;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { DocumentNode } from '@box/threaded-annotations';
|
|
2
|
+
import { ActivityAuthor, ActivityItemError, ActivityPermissions, ActivityStatus, AnnotationTarget } from './common';
|
|
3
|
+
/**
|
|
4
|
+
* Annotation or comment thread, rendered by `@box/threaded-annotations`.
|
|
5
|
+
*
|
|
6
|
+
* This is the canonical data contract for activity-feed consumers and is
|
|
7
|
+
* intentionally kept separate from `threaded-annotations`' `TextMessageType`
|
|
8
|
+
* so the two packages can evolve independently.
|
|
9
|
+
*
|
|
10
|
+
* Threads include their replies inline so consumers can pass the full tree
|
|
11
|
+
* directly to `ActivityFeed.List`.
|
|
12
|
+
*/
|
|
13
|
+
export type ThreadedActivityItem = {
|
|
14
|
+
/** Discriminator. `comment` for top-level comments, `annotation` for in-file pins. */
|
|
15
|
+
activityType: 'annotation' | 'comment';
|
|
16
|
+
/** Pointer to the in-file location for annotation threads. */
|
|
17
|
+
annotationTarget?: AnnotationTarget;
|
|
18
|
+
/** Author of the root message in the thread. */
|
|
19
|
+
author: ActivityAuthor;
|
|
20
|
+
/** TipTap document node for the message body. */
|
|
21
|
+
body: DocumentNode;
|
|
22
|
+
/** Unix timestamp (ms) when the root message was posted. */
|
|
23
|
+
createdAt: number;
|
|
24
|
+
/** Error attached to this item (e.g. failed post). */
|
|
25
|
+
error?: ActivityItemError;
|
|
26
|
+
/** File version id this thread is anchored to (when applicable). */
|
|
27
|
+
fileVersionId?: string;
|
|
28
|
+
/** Stable id for the root message of the thread. */
|
|
29
|
+
id: string;
|
|
30
|
+
/** When `true`, the message has been edited at least once. */
|
|
31
|
+
isEdited?: boolean;
|
|
32
|
+
/** When `true`, the message is optimistic and not yet acknowledged by the server. */
|
|
33
|
+
isPending?: boolean;
|
|
34
|
+
/** Unix timestamp (ms) of the last modification (edit or resolve). */
|
|
35
|
+
modifiedAt?: number;
|
|
36
|
+
/** Action permissions for the root message. */
|
|
37
|
+
permissions: ActivityPermissions;
|
|
38
|
+
/** Replies in posting order. */
|
|
39
|
+
replies: ThreadedActivityItem[];
|
|
40
|
+
/** Open / resolved lifecycle status. */
|
|
41
|
+
status?: ActivityStatus;
|
|
42
|
+
/** Total reply count from the server (may exceed `replies.length` when paginated). */
|
|
43
|
+
totalReplyCount?: number;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Box task item, rendered by `TaskItem`.
|
|
47
|
+
*
|
|
48
|
+
* Simplified server-shaped task projection. Project to `TaskItemProps`
|
|
49
|
+
* (mapping assignee status, completion rule, permissions, etc.) before
|
|
50
|
+
* rendering as a child of `ActivityFeed.List.Task`.
|
|
51
|
+
*/
|
|
52
|
+
export type TaskActivityItem = {
|
|
53
|
+
/** Discriminator. */
|
|
54
|
+
activityType: 'task';
|
|
55
|
+
/** People assigned to the task. */
|
|
56
|
+
assignees: TaskAssignee[];
|
|
57
|
+
/** Task creator. */
|
|
58
|
+
author: ActivityAuthor;
|
|
59
|
+
/** Completion rule (e.g. `ALL_ASSIGNEES`, `ANY_ASSIGNEE`). */
|
|
60
|
+
completionRule: string;
|
|
61
|
+
/** Unix timestamp (ms) when the task was created. */
|
|
62
|
+
createdAt: number;
|
|
63
|
+
/** Free-text description displayed in the card body. */
|
|
64
|
+
description?: string;
|
|
65
|
+
/** Unix timestamp (ms) of the due date, when set. */
|
|
66
|
+
dueAt?: number;
|
|
67
|
+
/** Stable task id. */
|
|
68
|
+
id: string;
|
|
69
|
+
/** When `true`, the task is optimistic and not yet acknowledged by the server. */
|
|
70
|
+
isPending?: boolean;
|
|
71
|
+
/** Display name for the task. */
|
|
72
|
+
name: string;
|
|
73
|
+
/** API permissions on the task resource. */
|
|
74
|
+
permissions: {
|
|
75
|
+
canDelete?: boolean;
|
|
76
|
+
canUpdate?: boolean;
|
|
77
|
+
};
|
|
78
|
+
/** Aggregate task status (e.g. `IN_PROGRESS`, `COMPLETED`). */
|
|
79
|
+
status: string;
|
|
80
|
+
};
|
|
81
|
+
/** Assignee row used by {@link TaskActivityItem}. */
|
|
82
|
+
export type TaskAssignee = {
|
|
83
|
+
/** Optional avatar URL for the assignee. */
|
|
84
|
+
avatarUrl?: string;
|
|
85
|
+
/** Unix timestamp (ms) when the assignee completed the task. */
|
|
86
|
+
completedAt?: number;
|
|
87
|
+
/** Assignee user id. */
|
|
88
|
+
id: string;
|
|
89
|
+
/** When `true`, applies external collaborator treatment. */
|
|
90
|
+
isExternal?: boolean;
|
|
91
|
+
/** Assignee display name. */
|
|
92
|
+
name: string;
|
|
93
|
+
/** Per-assignee status (e.g. `NOT_STARTED`, `APPROVED`). */
|
|
94
|
+
status: string;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* App-generated activity entry, rendered by `AppActivityItem`.
|
|
98
|
+
*
|
|
99
|
+
* Used for system-style messages such as "Box for Slack shared this file in #channel".
|
|
100
|
+
*/
|
|
101
|
+
export type AppActivityFeedItem = {
|
|
102
|
+
/** Discriminator. */
|
|
103
|
+
activityType: 'app_activity';
|
|
104
|
+
/** URL of the app icon shown in the avatar slot. */
|
|
105
|
+
appIconUrl: string;
|
|
106
|
+
/** App display name (e.g. "Box for Slack"). */
|
|
107
|
+
appName: string;
|
|
108
|
+
/** Author principal that performed the action. */
|
|
109
|
+
author: ActivityAuthor;
|
|
110
|
+
/** Unix timestamp (ms) of the activity. */
|
|
111
|
+
createdAt: number;
|
|
112
|
+
/** Stable id for the activity entry. */
|
|
113
|
+
id: string;
|
|
114
|
+
/** API-provided pre-sanitized HTML; renderer turns `<a>` into Blueprint links. */
|
|
115
|
+
renderedText: string;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Version marker, rendered by `VersionItem`.
|
|
119
|
+
*
|
|
120
|
+
* Used to show file lifecycle events (upload, restore, promote, trash) inside
|
|
121
|
+
* the feed timeline.
|
|
122
|
+
*/
|
|
123
|
+
export type VersionActivityItem = {
|
|
124
|
+
/** Action that produced this version event. `trash` is rendered as the delete variant. */
|
|
125
|
+
actionType: 'promote' | 'restore' | 'trash' | 'upload';
|
|
126
|
+
/** Discriminator. */
|
|
127
|
+
activityType: 'version';
|
|
128
|
+
/** User or app that performed the version action. */
|
|
129
|
+
author: ActivityAuthor;
|
|
130
|
+
/** Unix timestamp (ms) when the version event occurred. */
|
|
131
|
+
createdAt: number;
|
|
132
|
+
/** Stable id for the version entry. */
|
|
133
|
+
id: string;
|
|
134
|
+
/** Primary version number shown on the badge. */
|
|
135
|
+
versionNumber: number;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Discriminated union of every built-in activity item shape.
|
|
139
|
+
*
|
|
140
|
+
* Useful when iterating over a heterogeneous server payload and dispatching
|
|
141
|
+
* to the matching `ActivityFeed.List.*` row. Each row is the underlying
|
|
142
|
+
* primitive component re-exported as-is, so consumers project this shape
|
|
143
|
+
* into the row's prop signature at the call site.
|
|
144
|
+
*/
|
|
145
|
+
export type ActivityFeedItem = AppActivityFeedItem | TaskActivityItem | ThreadedActivityItem | VersionActivityItem;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* String discriminator for every activity feed item kind that the feed can render.
|
|
3
|
+
*
|
|
4
|
+
* Used by `ActivityFeedItem.activityType` to drive the renderer mapping inside
|
|
5
|
+
* `ActivityFeed.List`. New types must be added to this union together with a
|
|
6
|
+
* matching variant in `ActivityFeedItem` and a renderer in `ActivityFeed.List`.
|
|
7
|
+
*/
|
|
8
|
+
export type ActivityItemType = 'annotation' | 'app_activity' | 'comment' | 'task' | 'version';
|
|
9
|
+
/**
|
|
10
|
+
* Lifecycle status for threaded items (annotations and comments).
|
|
11
|
+
*
|
|
12
|
+
* - `open` — the thread is active and accepts replies / resolution actions.
|
|
13
|
+
* - `resolved` — the thread is resolved; UI shows the resolved banner.
|
|
14
|
+
*/
|
|
15
|
+
export type ActivityStatus = 'open' | 'resolved';
|
|
16
|
+
/**
|
|
17
|
+
* Minimal author shape used across every activity item type.
|
|
18
|
+
*
|
|
19
|
+
* Activity feed items intentionally use a stringly-typed `id` so the same
|
|
20
|
+
* shape can describe Box users, app-bot principals, and external collaborators.
|
|
21
|
+
*/
|
|
22
|
+
export type ActivityAuthor = {
|
|
23
|
+
/** Optional avatar URL. When omitted, the renderer falls back to initials. */
|
|
24
|
+
avatarUrl?: string;
|
|
25
|
+
/** Stable identifier for the author (Box user id, app id, or principal id). */
|
|
26
|
+
id: string;
|
|
27
|
+
/** When `true`, the renderer can apply "you" treatments (e.g. highlight). */
|
|
28
|
+
isCurrentUser?: boolean;
|
|
29
|
+
/** When `true`, the renderer applies external collaborator treatment (badge). */
|
|
30
|
+
isExternalUser?: boolean;
|
|
31
|
+
/** Display name shown in the UI. */
|
|
32
|
+
name: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Per-item action permissions.
|
|
36
|
+
*
|
|
37
|
+
* Only the actions that are `true` are shown in the UI; missing fields are
|
|
38
|
+
* treated as `false` so consumers can omit them safely.
|
|
39
|
+
*/
|
|
40
|
+
export type ActivityPermissions = {
|
|
41
|
+
/** Allows the delete action on the item. */
|
|
42
|
+
canDelete?: boolean;
|
|
43
|
+
/** Allows the edit action on the item. */
|
|
44
|
+
canEdit?: boolean;
|
|
45
|
+
/** Allows posting replies into the thread. */
|
|
46
|
+
canReply?: boolean;
|
|
47
|
+
/** Allows resolving / unresolving the thread. */
|
|
48
|
+
canResolve?: boolean;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Pointer to where an annotation lives in the underlying file.
|
|
52
|
+
*
|
|
53
|
+
* Used by `ThreadedActivityItem.annotationTarget` to render the badge for
|
|
54
|
+
* annotation threads (page number, highlighted excerpt, or timestamp).
|
|
55
|
+
*/
|
|
56
|
+
export type AnnotationTarget = {
|
|
57
|
+
page: number;
|
|
58
|
+
type: 'drawing' | 'point' | 'region';
|
|
59
|
+
} | {
|
|
60
|
+
highlightedText: string;
|
|
61
|
+
type: 'highlight';
|
|
62
|
+
} | {
|
|
63
|
+
timestamp: string;
|
|
64
|
+
type: 'frame';
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Error attached to a single activity item (e.g. a failed post / sync error).
|
|
68
|
+
*
|
|
69
|
+
* Renderers display the `title` and `message` as a banner and, when `action`
|
|
70
|
+
* is provided, a button that triggers `onAction` (e.g. retry).
|
|
71
|
+
*/
|
|
72
|
+
export type ActivityItemError = {
|
|
73
|
+
/** Optional retry / call-to-action button. */
|
|
74
|
+
action?: {
|
|
75
|
+
onAction: () => void;
|
|
76
|
+
text: string;
|
|
77
|
+
};
|
|
78
|
+
/** Body copy explaining the error. */
|
|
79
|
+
message: string;
|
|
80
|
+
/** Short error title shown above the message. */
|
|
81
|
+
title: string;
|
|
82
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type { DocumentNode } from '@box/threaded-annotations';
|
|
2
|
+
export type { ActivityFeedItem, AppActivityFeedItem, TaskActivityItem, TaskAssignee, ThreadedActivityItem, VersionActivityItem, } from './ActivityItem';
|
|
3
|
+
export type { ActivityAuthor, ActivityItemError, ActivityItemType, ActivityPermissions, ActivityStatus, AnnotationTarget, } from './common';
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@box/activity-feed",
|
|
3
|
+
"version": "1.15.0",
|
|
4
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
5
|
+
"peerDependencies": {
|
|
6
|
+
"@box/blueprint-web": "^14.16.2",
|
|
7
|
+
"@box/blueprint-web-assets": "^4.115.2",
|
|
8
|
+
"@box/collaboration-popover": "^1.61.3",
|
|
9
|
+
"@box/readable-time": "^1.40.3",
|
|
10
|
+
"@box/threaded-annotations": "^1.83.3",
|
|
11
|
+
"@box/user-selector": "^1.75.3",
|
|
12
|
+
"clsx": "^1.2.1",
|
|
13
|
+
"react": "^18.0.0",
|
|
14
|
+
"react-dom": "^18.0.0",
|
|
15
|
+
"react-intl": "^6.4.2"
|
|
16
|
+
},
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@box/blueprint-web": "^14.16.2",
|
|
22
|
+
"@box/blueprint-web-assets": "^4.115.2",
|
|
23
|
+
"@box/collaboration-popover": "^1.61.3",
|
|
24
|
+
"@box/eslint-plugin-blueprint": "1.1.18",
|
|
25
|
+
"@box/readable-time": "^1.40.3",
|
|
26
|
+
"@box/storybook-utils": "0.18.2",
|
|
27
|
+
"@box/threaded-annotations": "^1.83.3",
|
|
28
|
+
"@box/user-selector": "^1.75.3",
|
|
29
|
+
"react-intl": "^6.4.2"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist"
|
|
33
|
+
],
|
|
34
|
+
"main": "./dist/esm/index.js",
|
|
35
|
+
"module": "./dist/esm/index.js",
|
|
36
|
+
"types": "./dist/types/index.d.ts",
|
|
37
|
+
"exports": {
|
|
38
|
+
".": {
|
|
39
|
+
"require": "./dist/esm/index.js",
|
|
40
|
+
"import": "./dist/esm/index.js",
|
|
41
|
+
"types": "./dist/types/index.d.ts"
|
|
42
|
+
},
|
|
43
|
+
"./*": {
|
|
44
|
+
"require": "./dist/esm/*",
|
|
45
|
+
"import": "./dist/esm/*",
|
|
46
|
+
"types": "./dist/types/*"
|
|
47
|
+
},
|
|
48
|
+
"./i18n/*": {
|
|
49
|
+
"require": "./dist/i18n/*",
|
|
50
|
+
"import": "./dist/i18n/*"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"sideEffects": [
|
|
54
|
+
"**/*.css"
|
|
55
|
+
]
|
|
56
|
+
}
|