box-ui-elements 18.0.0 → 18.1.0-beta.2
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/dist/explorer.js +1 -1
- package/dist/openwith.js +1 -1
- package/dist/picker.js +1 -1
- package/dist/preview.js +1 -1
- package/dist/sharing.js +1 -1
- package/dist/sidebar.js +1 -1
- package/dist/uploader.js +1 -1
- package/es/api/Feed.js +10 -3
- package/es/api/Feed.js.flow +23 -7
- package/es/api/Feed.js.map +1 -1
- package/es/api/FileActivities.js +17 -7
- package/es/api/FileActivities.js.flow +27 -8
- package/es/api/FileActivities.js.map +1 -1
- package/i18n/ja-JP.js +1 -1
- package/i18n/ja-JP.properties +1 -1
- package/package.json +1 -1
- package/src/api/Feed.js +23 -7
- package/src/api/FileActivities.js +27 -8
- package/src/api/__tests__/Feed.test.js +19 -8
- package/src/api/__tests__/FileActivities.test.js +16 -3
package/es/api/Feed.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/Feed.js"],"names":["noop","uniqueId","getBadItemError","getBadUserError","getMissingItemTextOrStatus","isUserCorrectableError","commonMessages","messages","sortFeedItems","FEED_FILE_VERSIONS_FIELDS_TO_FETCH","Base","AnnotationsAPI","CommentsAPI","ThreadedCommentsAPI","FileActivitiesAPI","VersionsAPI","TasksNewAPI","GroupsAPI","TaskCollaboratorsAPI","TaskLinksAPI","AppActivityAPI","ERROR_CODE_CREATE_TASK","ERROR_CODE_UPDATE_TASK","ERROR_CODE_GROUP_EXCEEDS_LIMIT","FEED_ITEM_TYPE_ANNOTATION","FEED_ITEM_TYPE_COMMENT","FEED_ITEM_TYPE_TASK","FILE_ACTIVITY_TYPE_ANNOTATION","FILE_ACTIVITY_TYPE_APP_ACTIVITY","FILE_ACTIVITY_TYPE_COMMENT","FILE_ACTIVITY_TYPE_TASK","HTTP_STATUS_CODE_CONFLICT","IS_ERROR_DISPLAYED","TASK_NEW_APPROVED","TASK_NEW_COMPLETED","TASK_NEW_REJECTED","TASK_NEW_NOT_STARTED","TYPED_ID_FEED_PREFIX","TASK_MAX_GROUP_ASSIGNEES","TASK_NEW_INITIAL_STATUS","getItemWithFilteredReplies","item","replyId","replies","rest","filter","id","getItemWithPendingReply","reply","parseReplies","parsedReplies","map","tagged_message","message","getParsedFileActivitiesResponse","response","entries","length","data","parsedData","source","activity_type","taskItem","assigned_to","assignedToEntries","entry","assignedToEntry","role","toUpperCase","status","completion_rule","task_type","created_by","target","commentItem","annotationItem","Feed","options","file","annotationId","text","permissions","successCallback","errorCallback","annotationsAPI","feedItemChanges","updateFeedItem","isPending","updateAnnotation","annotation","total_reply_count","annotationBase","isDestroyed","e","code","updateCommentErrorCallback","createFeedError","commentUpdateErrorMessage","feedErrorCallback","error","parentId","updateReplyItem","repliesFetchErrorMessage","successCallBack","deleteAnnotation","deleteFeedItem","bind","deleteCommentErrorCallback","resolve","comment","taskId","taskCollaboratorId","taskCollaboratorStatus","collaboratorsApi","taskCollaboratorsAPI","push","taskCollaboratorPayload","handleError","errorMessage","taskApproveErrorMessage","taskCompleteErrorMessage","taskRejectErrorMessage","taskActionErrorTitle","updateTaskCollaborator","taskCollaborator","taskCollab","updateTaskCollaboratorSuccessCallback","updatedCollaborator","tasksNewAPI","getTask","task","groupInfoPromises","addedAssignees","assignee","type","groupId","getGroupCount","group","Promise","all","groupCounts","hasAnyGroupCountExceeded","some","groupInfo","total_count","warning","reject","updateTaskWithDeps","taskData","commentId","commentsAPI","deleteComment","threadedCommentsAPI","fileId","deleteReplySuccessCallback","deleteReplyErrorCallback","modifyFeedItemRepliesCountBy","deleteReplyItem","commentDeleteErrorMessage","currentUser","assignees","taskType","dueAt","completionRule","uuid","dueAtString","dueAtDate","Date","toISOString","pendingTask","created_at","due_at","description","avatar_url","can_delete","can_update","limit","next_marker","can_create_task_collaborator","can_create_task_link","task_links","taskPayload","then","createTaskWithDeps","taskWithDepsData","addPendingItem","catch","deleteTask","taskDeleteErrorMessage","cachedItems","getCachedItems","feedItems","items","feedItem","setCachedItems","errors","hasError","console","itemBase","date","pendingFeedItem","modified_at","feedItemsWithPendingItem","commentBase","pendingReply","updatedFeedItems","commentData","commentCreateConflictMessage","commentCreateErrorMessage","updates","replyUpdates","getItemWithUpdatedReply","updatedItem","hasMention","taggedMessage","createComment","createCommentSuccessCallback","createCommentErrorCallback","updateComment","undefined","updateReplyErrorCallback","n","find","itemId","newReplyCount","appActivityId","appActivityAPI","deleteAppActivity","deleteAppActivityErrorCallback","appActivityDeleteErrorMessage","taskLinksAPI","newAnnotation","cache","getCache","cacheKey","getCacheKey","get","set","shouldRefreshCache","onError","shouldShowAnnotations","shouldShowAppActivity","shouldShowReplies","shouldShowTasks","shouldShowVersions","shouldUseUAA","annotationsPromise","fetchAnnotations","commentsPromise","fetchThreadedComments","fetchComments","tasksPromise","fetchTasksNew","appActivityPromise","fetchAppActivity","versionsPromise","fetchVersions","currentVersionPromise","fetchCurrentVersion","fileActivitiesPromise","fetchFileActivities","handleFeedItems","versions","currentVersion","fileActivitiesResponse","versionsWithCurrent","versionsAPI","addCurrentVersion","parsedFeedItems","sortedFeedItems","shouldFetchReplies","getAnnotations","fetchFeedItemErrorCallback","getComments","getComment","fetchThreadedCommentSuccessCallback","activityTypes","fileActivitiesAPI","getActivities","fileID","commentFeedItemId","commentFeedItemType","isRepliesLoading","successCallbackFn","errorCallbackFn","fetchRepliesErrorCallback","getAnnotationReplies","getCommentReplies","getVersions","file_version","getVersion","getTasksForFile","err","shouldDisplayError","createTaskCollaboratorsforGroup","createTaskCollaborator","user","deleteTaskCollaborator","createTaskLink","title","errorOccured","parentType","addPendingReply","createReplySuccessCallback","createReplyErrorCallback","createAnnotationReply","createCommentReply","Array","isArray","forEach","api","destroy","getAppActivity","destroyTaskCollaborators","destroyTaskLinks"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAKA,OAAOA,IAAP,MAAi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J,cAAL,GAAsB,IAAI9M,cAAJ,CAAmB,KAAKyD,OAAxB,CAAtB;AAEA,aAAO,IAAI6D,OAAJ,CAAY,UAAA9B,OAAO,EAAI;AAC1B,QAAA,OAAI,CAACsH,cAAL,CAAoBsF,cAApB,CACI,OAAI,CAAC1O,IAAL,CAAUhC,EADd,EAEImC,WAFJ,EAGI2B,OAHJ,EAII,OAAI,CAACoK,0BAAL,CAAgCtK,IAAhC,CAAqC,OAArC,EAA2CE,OAA3C,CAJJ;AAMH,OAPM,CAAP;AAQH;AAED;;;;;;;;;;;;;AAiDA;;;;;8BAKU;AACN;;AAEA,UAAI,KAAKxB,cAAT,EAAyB;AACrB,aAAKA,cAAL,CAAoBmO,OAApB;AACA,eAAO,KAAKnO,cAAZ;AACH;;AAED,UAAI,KAAKkE,WAAT,EAAsB;AAClB,aAAKA,WAAL,CAAiBiK,OAAjB;AACA,eAAO,KAAKjK,WAAZ;AACH;;AAED,UAAI,KAAKE,mBAAT,EAA8B;AAC1B,aAAKA,mBAAL,CAAyB+J,OAAzB;AACA,eAAO,KAAK/J,mBAAZ;AACH;;AAED,UAAI,KAAKkH,WAAT,EAAsB;AAClB,aAAKA,WAAL,CAAiB6C,OAAjB;AACA,eAAO,KAAK7C,WAAZ;AACH;;AAED,UAAI,KAAKxC,cAAT,EAAyB;AACrB,aAAKA,cAAL,CAAoBqF,OAApB;AACA,eAAO,KAAKrF,cAAZ;AACH;;AAED,UAAI,KAAKlG,WAAT,EAAsB;AAClB,aAAKA,WAAL,CAAiBuL,OAAjB;AACA,eAAO,KAAKvL,WAAZ;AACH;;AAED,WAAKyL,wBAAL;AACA,WAAKC,gBAAL;AACH;;;;EAvlEchT,I;;AA0lEnB,eAAekE,IAAf","sourcesContent":["/**\n * @flow\n * @file Helper for activity feed API's\n * @author Box\n */\nimport noop from 'lodash/noop';\nimport uniqueId from 'lodash/uniqueId';\nimport type { MessageDescriptor } from 'react-intl';\nimport { getBadItemError, getBadUserError, getMissingItemTextOrStatus, isUserCorrectableError } from '../utils/error';\nimport commonMessages from '../elements/common/messages';\nimport messages from './messages';\nimport { sortFeedItems } from '../utils/sorter';\nimport { FEED_FILE_VERSIONS_FIELDS_TO_FETCH } from '../utils/fields';\nimport Base from './Base';\nimport AnnotationsAPI from './Annotations';\nimport CommentsAPI from './Comments';\nimport ThreadedCommentsAPI from './ThreadedComments';\nimport FileActivitiesAPI from './FileActivities';\nimport VersionsAPI from './Versions';\nimport TasksNewAPI from './tasks/TasksNew';\nimport GroupsAPI from './Groups';\nimport TaskCollaboratorsAPI from './tasks/TaskCollaborators';\nimport TaskLinksAPI from './tasks/TaskLinks';\nimport AppActivityAPI from './AppActivity';\nimport {\n ERROR_CODE_CREATE_TASK,\n ERROR_CODE_UPDATE_TASK,\n ERROR_CODE_GROUP_EXCEEDS_LIMIT,\n FEED_ITEM_TYPE_ANNOTATION,\n FEED_ITEM_TYPE_COMMENT,\n FEED_ITEM_TYPE_TASK,\n FILE_ACTIVITY_TYPE_ANNOTATION,\n FILE_ACTIVITY_TYPE_APP_ACTIVITY,\n FILE_ACTIVITY_TYPE_COMMENT,\n FILE_ACTIVITY_TYPE_TASK,\n HTTP_STATUS_CODE_CONFLICT,\n IS_ERROR_DISPLAYED,\n TASK_NEW_APPROVED,\n TASK_NEW_COMPLETED,\n TASK_NEW_REJECTED,\n TASK_NEW_NOT_STARTED,\n TYPED_ID_FEED_PREFIX,\n TASK_MAX_GROUP_ASSIGNEES,\n} from '../constants';\nimport type {\n TaskCompletionRule,\n TaskCollabAssignee,\n TaskCollabStatus,\n TaskLink,\n TaskNew,\n TaskType,\n TaskPayload,\n TaskUpdatePayload,\n} from '../common/types/tasks';\nimport type { ElementsXhrError, ErrorResponseData, APIOptions } from '../common/types/api';\nimport type {\n SelectorItems,\n SelectorItem,\n UserMini,\n GroupMini,\n BoxItem,\n BoxItemPermission,\n BoxItemVersion,\n FileVersions,\n User,\n} from '../common/types/core';\nimport type {\n Annotation,\n AnnotationPermission,\n Annotations,\n AppActivityItems,\n BoxCommentPermission,\n Comment,\n CommentFeedItemType,\n Comments,\n FeedItem,\n FeedItems,\n FeedItemStatus,\n FileActivity,\n FileActivityTypes,\n Task,\n Tasks,\n ThreadedComments as ThreadedCommentsType,\n} from '../common/types/feed';\n\nconst TASK_NEW_INITIAL_STATUS = TASK_NEW_NOT_STARTED;\n\ntype FeedItemsCache = {\n errors: ErrorResponseData[],\n items: FeedItems,\n};\n\ntype ErrorCallback = (e: ElementsXhrError, code: string, contextInfo?: Object) => void;\n\nconst getItemWithFilteredReplies = <T: { replies?: Array<Comment> }>(item: T, replyId: string): T => {\n const { replies = [], ...rest } = item;\n return { replies: replies.filter(({ id }) => id !== replyId), ...rest };\n};\n\nconst getItemWithPendingReply = <T: { replies?: Array<Comment> }>(item: T, reply: Comment): T => {\n const { replies = [], ...rest } = item;\n return { replies: [...replies, reply], ...rest };\n};\n\nconst parseReplies = (replies: Comment[]): Comment[] => {\n const parsedReplies = [...replies];\n\n return parsedReplies.map(reply => {\n return { ...reply, tagged_message: reply.tagged_message || reply.message || '' };\n });\n};\n\nexport const getParsedFileActivitiesResponse = (response?: { entries: FileActivity[] }) => {\n if (!response || !response.entries || !response.entries.length) {\n return { entries: [] };\n }\n\n const data = response.entries;\n\n const parsedData: Array<Object> = data\n .map(item => {\n if (!item.source) {\n return null;\n }\n\n const source = { ...item.source };\n\n switch (item.activity_type) {\n case FILE_ACTIVITY_TYPE_TASK: {\n const taskItem = { ...source[FILE_ACTIVITY_TYPE_TASK] };\n // UAA follows a lowercased enum naming convention, convert to uppercase to align with task api\n if (taskItem.assigned_to?.entries) {\n const assignedToEntries = taskItem.assigned_to.entries.map(entry => {\n const assignedToEntry = { ...entry };\n\n assignedToEntry.role = entry.role.toUpperCase();\n assignedToEntry.status = entry.status.toUpperCase();\n\n return assignedToEntry;\n });\n // $FlowFixMe Using the toUpperCase method makes Flow assume role and status is a string type, which is incompatible with string literal\n taskItem.assigned_to.entries = assignedToEntries;\n }\n if (taskItem.completion_rule) {\n taskItem.completion_rule = taskItem.completion_rule.toUpperCase();\n }\n if (taskItem.status) {\n taskItem.status = taskItem.status.toUpperCase();\n }\n if (taskItem.task_type) {\n taskItem.task_type = taskItem.task_type.toUpperCase();\n }\n // $FlowFixMe File Activities only returns a created_by user, Flow type fix is needed\n taskItem.created_by = { target: taskItem.created_by };\n\n return taskItem;\n }\n case FILE_ACTIVITY_TYPE_COMMENT: {\n const commentItem = { ...source[FILE_ACTIVITY_TYPE_COMMENT] };\n\n if (commentItem.replies && commentItem.replies.length) {\n const replies = parseReplies(commentItem.replies);\n\n commentItem.replies = replies;\n }\n\n commentItem.tagged_message = commentItem.tagged_message || commentItem.message || '';\n\n return commentItem;\n }\n case FILE_ACTIVITY_TYPE_ANNOTATION: {\n const annotationItem = { ...source[FILE_ACTIVITY_TYPE_ANNOTATION] };\n\n if (annotationItem.replies && annotationItem.replies.length) {\n const replies = parseReplies(annotationItem.replies);\n\n annotationItem.replies = replies;\n }\n\n return annotationItem;\n }\n case FILE_ACTIVITY_TYPE_APP_ACTIVITY: {\n return { ...source[FILE_ACTIVITY_TYPE_APP_ACTIVITY] };\n }\n\n default: {\n return null;\n }\n }\n })\n .filter(item => !!item);\n\n return { entries: parsedData };\n};\n\nclass Feed extends Base {\n /**\n * @property {AnnotationsAPI}\n */\n annotationsAPI: AnnotationsAPI;\n\n /**\n * @property {VersionsAPI}\n */\n versionsAPI: VersionsAPI;\n\n /**\n * @property {CommentsAPI}\n */\n commentsAPI: CommentsAPI;\n\n /**\n * @property {AppActivityAPI}\n */\n appActivityAPI: AppActivityAPI;\n\n /**\n * @property {TasksNewAPI}\n */\n tasksNewAPI: TasksNewAPI;\n\n /**\n * @property {TaskCollaboratorsAPI}\n */\n taskCollaboratorsAPI: TaskCollaboratorsAPI[];\n\n /**\n * @property {TaskLinksAPI}\n */\n taskLinksAPI: TaskLinksAPI[];\n\n /**\n * @property {ThreadedCommentsAPI}\n */\n threadedCommentsAPI: ThreadedCommentsAPI;\n\n /**\n * @property {FileActivitiesAPI}\n */\n fileActivitiesAPI: FileActivitiesAPI;\n\n /**\n * @property {BoxItem}\n */\n file: BoxItem;\n\n /**\n * @property {ElementsXhrError}\n */\n errors: ElementsXhrError[];\n\n constructor(options: APIOptions) {\n super(options);\n this.taskCollaboratorsAPI = [];\n this.taskLinksAPI = [];\n this.errors = [];\n }\n\n /**\n * Creates pending card on create_start action, then updates card on next call\n * @param {BoxItem} file - The file to which the annotation is assigned\n * @param {Object} currentUser - the user who performed the action\n * @param {Annotation} annotation - the current annotation to be created\n * @param {string} id - unique id for the incoming annotation\n * @param {boolean} isPending - indicates the current creation process of the annotation\n */\n addAnnotation(file: BoxItem, currentUser: User, annotation: Annotation, id: string, isPending: boolean): void {\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n\n // Add the pending interstitial card\n if (isPending) {\n const newAnnotation = {\n ...annotation,\n created_by: currentUser,\n id,\n type: FEED_ITEM_TYPE_ANNOTATION,\n };\n\n this.addPendingItem(this.file.id, currentUser, newAnnotation);\n\n return;\n }\n // Create action has completed, so update the existing pending item\n this.updateFeedItem({ ...annotation, isPending: false }, id);\n }\n\n updateAnnotation = (\n file: BoxItem,\n annotationId: string,\n text?: string,\n status?: FeedItemStatus,\n permissions: AnnotationPermission,\n successCallback: (annotation: Annotation) => void,\n errorCallback: ErrorCallback,\n ): void => {\n if (!file.id) {\n throw getBadItemError();\n }\n if (!text && !status) {\n throw getMissingItemTextOrStatus();\n }\n\n this.annotationsAPI = new AnnotationsAPI(this.options);\n\n this.file = file;\n this.errorCallback = errorCallback;\n\n const feedItemChanges = {};\n if (text) {\n feedItemChanges.message = text;\n }\n if (status) {\n feedItemChanges.status = status;\n }\n this.updateFeedItem({ ...feedItemChanges, isPending: true }, annotationId);\n\n this.annotationsAPI.updateAnnotation(\n this.file.id,\n annotationId,\n permissions,\n feedItemChanges,\n (annotation: Annotation) => {\n const { replies, total_reply_count, ...annotationBase } = annotation;\n this.updateFeedItem(\n {\n // Do not update replies and total_reply_count props as their current values are not included in the response\n ...annotationBase,\n isPending: false,\n },\n annotationId,\n );\n if (!this.isDestroyed()) {\n successCallback(annotation);\n }\n },\n (e: ErrorResponseData, code: string) => {\n this.updateCommentErrorCallback(e, code, annotationId);\n },\n );\n };\n\n /**\n * Error callback for updating a comment\n *\n * @param {ElementsXhrError} e - the error returned by the API\n * @param {string} code - the error code\n * @param {string} id - the id of either an annotation or comment\n * @return {void}\n */\n updateCommentErrorCallback = (e: ElementsXhrError, code: string, id: string) => {\n this.updateFeedItem(this.createFeedError(messages.commentUpdateErrorMessage), id);\n this.feedErrorCallback(true, e, code);\n };\n\n /**\n * Error callback for updating a reply\n *\n * @param {ElementsXhrError} error - the error returned by the API\n * @param {string} code - the error code\n * @param {string} id - the id of the reply (comment)\n * @param {string} parentId - the id of either the parent item (an annotation or comment)\n * @return {void}\n */\n updateReplyErrorCallback = (error: ElementsXhrError, code: string, id: string, parentId: string) => {\n this.updateReplyItem(this.createFeedError(messages.commentUpdateErrorMessage), parentId, id);\n this.feedErrorCallback(true, error, code);\n };\n\n /**\n * Error callback for fetching replies\n *\n * @param {ElementsXhrError} error - the error returned by the API\n * @param {string} code - the error code\n * @param {string} id - the id of either an annotation or comment\n * @return {void}\n */\n fetchRepliesErrorCallback = (error: ElementsXhrError, code: string, id: string) => {\n this.updateFeedItem(this.createFeedError(messages.repliesFetchErrorMessage), id);\n this.feedErrorCallback(true, error, code);\n };\n\n deleteAnnotation = (\n file: BoxItem,\n annotationId: string,\n permissions: AnnotationPermission,\n successCallBack: Function,\n errorCallback: Function,\n ): void => {\n this.annotationsAPI = new AnnotationsAPI(this.options);\n\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n this.errorCallback = errorCallback;\n\n this.updateFeedItem({ isPending: true }, annotationId);\n this.annotationsAPI.deleteAnnotation(\n this.file.id,\n annotationId,\n permissions,\n this.deleteFeedItem.bind(this, annotationId, successCallBack),\n (error: ElementsXhrError, code: string) => {\n // Reusing comment error handler since annotations are treated as comments to user\n this.deleteCommentErrorCallback(error, code, annotationId);\n },\n );\n };\n\n /**\n * Creates a key for the cache\n *\n * @param {string} id folder id\n * @return {string} key\n */\n getCacheKey(id: string): string {\n return `${TYPED_ID_FEED_PREFIX}${id}`;\n }\n\n /**\n * Gets the items from the cache\n *\n * @param {string} id the cache id\n */\n getCachedItems(id: string): ?FeedItemsCache {\n const cache = this.getCache();\n const cacheKey = this.getCacheKey(id);\n return cache.get(cacheKey);\n }\n\n /**\n * Sets the items in the cache\n *\n * @param {string} id - the cache id\n * @param {Array} items - the feed items to cache\n */\n setCachedItems(id: string, items: FeedItems) {\n const cache = this.getCache();\n const cacheKey = this.getCacheKey(id);\n cache.set(cacheKey, {\n errors: this.errors,\n items,\n });\n }\n\n /**\n * Gets the feed items\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {boolean} shouldRefreshCache - Optionally updates the cache\n * @param {Function} successCallback - the success callback which is called after data fetching is complete\n * @param {Function} errorCallback - the error callback which is called after data fetching is complete if there was an error\n * @param {Function} onError - the function to be called immediately after an error occurs\n * @param {Object} [options]- feature flips, etc\n * @param {Object} [options.shouldShowAppActivity] - feature flip the new app activity api\n */\n feedItems(\n file: BoxItem,\n shouldRefreshCache: boolean,\n successCallback: Function,\n errorCallback: (feedItems: FeedItems, errors: ElementsXhrError[]) => void,\n onError: ErrorCallback,\n {\n shouldShowAnnotations = false,\n shouldShowAppActivity = false,\n shouldShowReplies = false,\n shouldShowTasks = true,\n shouldShowVersions = true,\n shouldUseUAA = false,\n }: {\n shouldShowAnnotations?: boolean,\n shouldShowAppActivity?: boolean,\n shouldShowReplies?: boolean,\n shouldShowTasks?: boolean,\n shouldShowVersions?: boolean,\n shouldUseUAA?: boolean,\n } = {},\n ): void {\n const { id, permissions = {} } = file;\n const cachedItems = this.getCachedItems(id);\n if (cachedItems) {\n const { errors, items } = cachedItems;\n if (errors.length) {\n errorCallback(items, errors);\n } else {\n successCallback(items);\n }\n\n if (!shouldRefreshCache) {\n return;\n }\n }\n\n this.file = file;\n this.errors = [];\n this.errorCallback = onError;\n\n // Using the UAA File Activities endpoint replaces the need for these calls\n const annotationsPromise =\n !shouldUseUAA && shouldShowAnnotations\n ? this.fetchAnnotations(permissions, shouldShowReplies)\n : Promise.resolve();\n const commentsPromise = () => {\n if (shouldUseUAA) {\n return Promise.resolve();\n }\n\n return shouldShowReplies ? this.fetchThreadedComments(permissions) : this.fetchComments(permissions);\n };\n const tasksPromise = !shouldUseUAA && shouldShowTasks ? this.fetchTasksNew() : Promise.resolve();\n const appActivityPromise =\n !shouldUseUAA && shouldShowAppActivity ? this.fetchAppActivity(permissions) : Promise.resolve();\n\n const versionsPromise = shouldShowVersions ? this.fetchVersions() : Promise.resolve();\n const currentVersionPromise = shouldShowVersions ? this.fetchCurrentVersion() : Promise.resolve();\n const fileActivitiesPromise = shouldUseUAA\n ? this.fetchFileActivities(permissions, [\n FILE_ACTIVITY_TYPE_ANNOTATION,\n FILE_ACTIVITY_TYPE_APP_ACTIVITY,\n FILE_ACTIVITY_TYPE_COMMENT,\n FILE_ACTIVITY_TYPE_TASK,\n ])\n : Promise.resolve();\n\n const handleFeedItems = (feedItems: FeedItems) => {\n if (!this.isDestroyed()) {\n this.setCachedItems(id, feedItems);\n if (this.errors.length) {\n errorCallback(feedItems, this.errors);\n } else {\n successCallback(feedItems);\n }\n }\n };\n\n if (shouldUseUAA) {\n Promise.all([versionsPromise, currentVersionPromise, fileActivitiesPromise]).then(\n ([versions: ?FileVersions, currentVersion: ?BoxItemVersion, ...feedItems]) => {\n if (!feedItems || !feedItems.length) {\n return;\n }\n\n const fileActivitiesResponse = feedItems[0];\n const versionsWithCurrent = currentVersion\n ? this.versionsAPI.addCurrentVersion(currentVersion, versions, this.file)\n : undefined;\n const parsedFeedItems = getParsedFileActivitiesResponse(fileActivitiesResponse);\n // $FlowFixMe Does not need to be sorted once we include versions in the file activities call\n const sortedFeedItems = sortFeedItems(versionsWithCurrent, parsedFeedItems);\n handleFeedItems(sortedFeedItems);\n },\n );\n } else {\n Promise.all([\n versionsPromise,\n currentVersionPromise,\n commentsPromise(),\n tasksPromise,\n appActivityPromise,\n annotationsPromise,\n ]).then(([versions: ?FileVersions, currentVersion: ?BoxItemVersion, ...feedItems]) => {\n const versionsWithCurrent = currentVersion\n ? this.versionsAPI.addCurrentVersion(currentVersion, versions, this.file)\n : undefined;\n const sortedFeedItems = sortFeedItems(versionsWithCurrent, ...feedItems);\n handleFeedItems(sortedFeedItems);\n });\n }\n }\n\n fetchAnnotations(permissions: BoxItemPermission, shouldFetchReplies?: boolean): Promise<?Annotations> {\n this.annotationsAPI = new AnnotationsAPI(this.options);\n return new Promise(resolve => {\n this.annotationsAPI.getAnnotations(\n this.file.id,\n undefined,\n permissions,\n resolve,\n this.fetchFeedItemErrorCallback.bind(this, resolve),\n undefined,\n undefined,\n shouldFetchReplies,\n );\n });\n }\n\n /**\n * Fetches the comments for a file\n *\n * @param {Object} permissions - the file permissions\n * @return {Promise} - the file comments\n */\n fetchComments(permissions: BoxItemPermission): Promise<?Comments> {\n this.commentsAPI = new CommentsAPI(this.options);\n return new Promise(resolve => {\n this.commentsAPI.getComments(\n this.file.id,\n permissions,\n resolve,\n this.fetchFeedItemErrorCallback.bind(this, resolve),\n );\n });\n }\n\n /**\n * Fetches a comment for a file\n *\n * @param {BoxItem} file - The file to which the comment belongs to\n * @param {string} commentId - comment id\n * @param {Function} successCallback\n * @param {ErrorCallback} errorCallback\n * @return {Promise} - the file comments\n */\n fetchThreadedComment(\n file: BoxItem,\n commentId: string,\n successCallback: (comment: Comment) => void,\n errorCallback: ErrorCallback,\n ): Promise<?Comment> {\n const { id, permissions } = file;\n if (!id || !permissions) {\n throw getBadItemError();\n }\n\n this.threadedCommentsAPI = new ThreadedCommentsAPI(this.options);\n return new Promise(resolve => {\n this.threadedCommentsAPI.getComment({\n commentId,\n errorCallback,\n fileId: id,\n permissions,\n successCallback: this.fetchThreadedCommentSuccessCallback.bind(this, resolve, successCallback),\n });\n });\n }\n\n /**\n * Callback for successful fetch of a comment\n *\n * @param {Function} resolve - resolve function\n * @param {Function} successCallback - success callback\n * @param {Comment} comment - comment data\n * @return {void}\n */\n fetchThreadedCommentSuccessCallback = (resolve: Function, successCallback: Function, comment: Comment): void => {\n successCallback(comment);\n resolve();\n };\n\n /**\n * Fetches the comments with replies for a file\n *\n * @param {Object} permissions - the file permissions\n * @return {Promise} - the file comments\n */\n fetchThreadedComments(permissions: BoxItemPermission): Promise<?ThreadedCommentsType> {\n this.threadedCommentsAPI = new ThreadedCommentsAPI(this.options);\n return new Promise(resolve => {\n this.threadedCommentsAPI.getComments({\n errorCallback: this.fetchFeedItemErrorCallback.bind(this, resolve),\n fileId: this.file.id,\n permissions,\n successCallback: resolve,\n });\n });\n }\n\n /**\n * Fetches the file activities for a file\n *\n * @param {BoxItemPermission} permissions - the file permissions\n * @param {FileActivityTypes[]} activityTypes - the activity types to filter by\n * @return {Promise} - the file comments\n */\n fetchFileActivities(permissions: BoxItemPermission, activityTypes: FileActivityTypes[]): Promise<Object> {\n this.fileActivitiesAPI = new FileActivitiesAPI(this.options);\n return new Promise(resolve => {\n this.fileActivitiesAPI.getActivities({\n errorCallback: this.fetchFeedItemErrorCallback.bind(this, resolve),\n fileID: this.file.id,\n permissions,\n successCallback: resolve,\n activityTypes,\n });\n });\n }\n\n /**\n * Fetches replies (comments) of a comment or annotation\n *\n * @param {BoxItem} file - The file to which the comment or annotation belongs to\n * @param {string} commentFeedItemId - ID of the comment or annotation\n * @param {CommentFeedItemType} commentFeedItemType - Type of the comment or annotation\n * @param {Function} successCallback\n * @param {ErrorCallback} errorCallback\n * @return {void}\n */\n fetchReplies(\n file: BoxItem,\n commentFeedItemId: string,\n commentFeedItemType: CommentFeedItemType,\n successCallback: (comments: Array<Comment>) => void,\n errorCallback: ErrorCallback,\n ): void {\n const { id, permissions } = file;\n if (!id || !permissions) {\n throw getBadItemError();\n }\n\n this.file = file;\n this.errorCallback = errorCallback;\n\n this.updateFeedItem({ isRepliesLoading: true }, commentFeedItemId);\n\n const successCallbackFn = ({ entries }: ThreadedCommentsType) => {\n this.updateFeedItem(\n { isRepliesLoading: false, replies: entries, total_reply_count: entries.length },\n commentFeedItemId,\n );\n successCallback(entries);\n };\n const errorCallbackFn = (error: ErrorResponseData, code: string) => {\n this.fetchRepliesErrorCallback(error, code, commentFeedItemId);\n };\n\n if (commentFeedItemType === FEED_ITEM_TYPE_ANNOTATION) {\n this.annotationsAPI = new AnnotationsAPI(this.options);\n\n this.annotationsAPI.getAnnotationReplies(\n file.id,\n commentFeedItemId,\n permissions,\n successCallbackFn,\n errorCallbackFn,\n );\n } else if (commentFeedItemType === FEED_ITEM_TYPE_COMMENT) {\n this.threadedCommentsAPI = new ThreadedCommentsAPI(this.options);\n\n this.threadedCommentsAPI.getCommentReplies({\n fileId: file.id,\n commentId: commentFeedItemId,\n permissions,\n successCallback: successCallbackFn,\n errorCallback: errorCallbackFn,\n });\n }\n }\n\n /**\n * Fetches the versions for a file\n *\n * @return {Promise} - the file versions\n */\n fetchVersions(): Promise<?FileVersions> {\n this.versionsAPI = new VersionsAPI(this.options);\n\n return new Promise(resolve => {\n this.versionsAPI.getVersions(\n this.file.id,\n resolve,\n this.fetchFeedItemErrorCallback.bind(this, resolve),\n undefined,\n undefined,\n FEED_FILE_VERSIONS_FIELDS_TO_FETCH,\n );\n });\n }\n\n /**\n * Fetches the current version for a file\n *\n * @return {Promise} - the file versions\n */\n fetchCurrentVersion(): Promise<?BoxItemVersion> {\n this.versionsAPI = new VersionsAPI(this.options);\n\n return new Promise(resolve => {\n const { file_version = {} } = this.file;\n this.versionsAPI.getVersion(\n this.file.id,\n file_version.id,\n resolve,\n this.fetchFeedItemErrorCallback.bind(this, resolve),\n );\n });\n }\n\n /**\n * Fetches the tasks for a file\n *\n * @return {Promise} - the feed items\n */\n fetchTasksNew(): Promise<?Tasks> {\n this.tasksNewAPI = new TasksNewAPI(this.options);\n\n return new Promise(resolve => {\n this.tasksNewAPI.getTasksForFile({\n file: { id: this.file.id },\n successCallback: resolve,\n errorCallback: (err, code) => this.fetchFeedItemErrorCallback(resolve, err, code),\n });\n });\n }\n\n /**\n * Error callback for fetching feed items.\n * Should only call the error callback if the response is a 401, 429 or >= 500\n *\n * @param {Function} resolve - the function which will be called on error\n * @param {Object} e - the axios error\n * @param {string} code - the error code\n * @return {void}\n */\n fetchFeedItemErrorCallback(resolve: Function, e: ElementsXhrError, code: string) {\n const { status } = e;\n const shouldDisplayError = isUserCorrectableError(status);\n this.feedErrorCallback(shouldDisplayError, e, code);\n resolve();\n }\n\n /**\n * Updates a task assignment\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {string} taskId - ID of task to be updated\n * @param {string} taskCollaboratorId - Task assignment ID\n * @param {TaskCollabStatus} taskCollaboratorStatus - New task assignment status\n * @param {Function} successCallback - the function which will be called on success\n * @param {Function} errorCallback - the function which will be called on error\n * @return {void}\n */\n updateTaskCollaborator = (\n file: BoxItem,\n taskId: string,\n taskCollaboratorId: string,\n taskCollaboratorStatus: TaskCollabStatus,\n successCallback: Function,\n errorCallback: ErrorCallback,\n ): void => {\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n this.errorCallback = errorCallback;\n this.updateFeedItem({ isPending: true }, taskId);\n const collaboratorsApi = new TaskCollaboratorsAPI(this.options);\n this.taskCollaboratorsAPI.push(collaboratorsApi);\n const taskCollaboratorPayload = {\n id: taskCollaboratorId,\n status: taskCollaboratorStatus,\n };\n const handleError = (e: ElementsXhrError, code: string) => {\n let errorMessage;\n switch (taskCollaboratorStatus) {\n case TASK_NEW_APPROVED:\n errorMessage = messages.taskApproveErrorMessage;\n break;\n case TASK_NEW_COMPLETED:\n errorMessage = messages.taskCompleteErrorMessage;\n break;\n case TASK_NEW_REJECTED:\n errorMessage = messages.taskRejectErrorMessage;\n break;\n default:\n errorMessage = messages.taskCompleteErrorMessage;\n }\n this.updateFeedItem(this.createFeedError(errorMessage, messages.taskActionErrorTitle), taskId);\n this.feedErrorCallback(true, e, code);\n };\n collaboratorsApi.updateTaskCollaborator({\n file,\n taskCollaborator: taskCollaboratorPayload,\n successCallback: (taskCollab: TaskCollabAssignee) => {\n this.updateTaskCollaboratorSuccessCallback(taskId, file, taskCollab, successCallback, handleError);\n },\n errorCallback: handleError,\n });\n };\n\n /**\n * Updates the task assignment state of the updated task\n *\n * @param {string} taskId - Box task id\n * @param {TaskAssignment} updatedCollaborator - New task assignment from API\n * @param {Function} successCallback - the function which will be called on success\n * @return {void}\n */\n updateTaskCollaboratorSuccessCallback = (\n taskId: string,\n file: { id: string },\n updatedCollaborator: TaskCollabAssignee,\n successCallback: Function,\n errorCallback: Function,\n ): void => {\n this.tasksNewAPI = new TasksNewAPI(this.options);\n this.tasksNewAPI.getTask({\n id: taskId,\n file,\n successCallback: task => {\n this.updateFeedItem({ ...task, isPending: false }, taskId);\n successCallback(updatedCollaborator);\n },\n errorCallback,\n });\n };\n\n /**\n * Updates a task in the new API\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {string} task - The update task payload object\n * @param {Function} successCallback - the function which will be called on success\n * @param {Function} errorCallback - the function which will be called on error\n * @return {void}\n */\n updateTaskNew = async (\n file: BoxItem,\n task: TaskUpdatePayload,\n successCallback: () => void = noop,\n errorCallback: ErrorCallback = noop,\n ) => {\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n this.errorCallback = errorCallback;\n this.tasksNewAPI = new TasksNewAPI(this.options);\n this.updateFeedItem({ isPending: true }, task.id);\n\n try {\n // create request for the size of each group by ID\n // TODO: use async/await for both creating and editing tasks\n const groupInfoPromises: Array<Promise<any>> = task.addedAssignees\n .filter(\n (assignee: SelectorItem<UserMini | GroupMini>) => assignee.item && assignee.item.type === 'group',\n )\n .map(assignee => assignee.id)\n .map(groupId => {\n return new GroupsAPI(this.options).getGroupCount({\n file,\n group: { id: groupId },\n });\n });\n\n const groupCounts: Array<{ total_count: number }> = await Promise.all(groupInfoPromises);\n const hasAnyGroupCountExceeded: boolean = groupCounts.some(\n groupInfo => groupInfo.total_count > TASK_MAX_GROUP_ASSIGNEES,\n );\n const warning = {\n code: ERROR_CODE_GROUP_EXCEEDS_LIMIT,\n type: 'warning',\n };\n\n if (hasAnyGroupCountExceeded) {\n this.feedErrorCallback(false, warning, ERROR_CODE_GROUP_EXCEEDS_LIMIT);\n return;\n }\n\n await new Promise((resolve, reject) => {\n this.tasksNewAPI.updateTaskWithDeps({\n file,\n task,\n successCallback: resolve,\n errorCallback: reject,\n });\n });\n\n await new Promise((resolve, reject) => {\n this.tasksNewAPI.getTask({\n file,\n id: task.id,\n successCallback: (taskData: Task) => {\n this.updateFeedItem(\n {\n ...taskData,\n isPending: false,\n },\n task.id,\n );\n\n resolve();\n },\n errorCallback: (e: ElementsXhrError) => {\n this.updateFeedItem({ isPending: false }, task.id);\n this.feedErrorCallback(false, e, ERROR_CODE_UPDATE_TASK);\n reject();\n },\n });\n });\n\n // everything succeeded, so call the passed in success callback\n if (!this.isDestroyed()) {\n successCallback();\n }\n } catch (e) {\n this.updateFeedItem({ isPending: false }, task.id);\n this.feedErrorCallback(false, e, ERROR_CODE_UPDATE_TASK);\n }\n };\n\n /**\n * Deletes a comment.\n *\n * @param {BoxItem} file - The file to which the comment belongs to\n * @param {string} commentId - Comment ID\n * @param {BoxCommentPermission} permissions - Permissions for the comment\n * @param {Function} successCallback - the function which will be called on success\n * @param {Function} errorCallback - the function which will be called on error\n * @return {void}\n */\n deleteComment = (\n file: BoxItem,\n commentId: string,\n permissions: BoxCommentPermission,\n successCallback: Function,\n errorCallback: ErrorCallback,\n ): void => {\n this.commentsAPI = new CommentsAPI(this.options);\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n this.errorCallback = errorCallback;\n this.updateFeedItem({ isPending: true }, commentId);\n\n this.commentsAPI.deleteComment({\n file,\n commentId,\n permissions,\n successCallback: this.deleteFeedItem.bind(this, commentId, successCallback),\n errorCallback: (e: ElementsXhrError, code: string) => {\n this.deleteCommentErrorCallback(e, code, commentId);\n },\n });\n };\n\n /**\n * Deletes a threaded comment (using ThreadedComments API).\n *\n * @param {BoxItem} file - The file to which the comment belongs to\n * @param {string} commentId - Comment ID\n * @param {BoxCommentPermission} permissions - Permissions for the comment\n * @param {Function} successCallback - the function which will be called on success\n * @param {Function} errorCallback - the function which will be called on error\n * @return {void}\n */\n deleteThreadedComment = (\n file: BoxItem,\n commentId: string,\n permissions: BoxCommentPermission,\n successCallback: Function,\n errorCallback: ErrorCallback,\n ): void => {\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n this.errorCallback = errorCallback;\n this.updateFeedItem({ isPending: true }, commentId);\n\n this.threadedCommentsAPI = new ThreadedCommentsAPI(this.options);\n\n this.threadedCommentsAPI.deleteComment({\n fileId: file.id,\n commentId,\n permissions,\n successCallback: this.deleteFeedItem.bind(this, commentId, successCallback),\n errorCallback: (e: ElementsXhrError, code: string) => {\n this.deleteCommentErrorCallback(e, code, commentId);\n },\n });\n };\n\n /**\n * Deletes a reply (using ThreadedComments API).\n *\n * @param {BoxItem} file - The file to which the comment belongs to\n * @param {string} id - id of the reply (comment)\n * @param {string} parentId - id of the parent feed item\n * @param {BoxCommentPermission} permissions - Permissions for the comment\n * @param {Function} successCallback - the function which will be called on success\n * @param {Function} errorCallback - the function which will be called on error\n * @return {void}\n */\n deleteReply = (\n file: BoxItem,\n id: string,\n parentId: string,\n permissions: BoxCommentPermission,\n successCallback: () => void,\n errorCallback: ErrorCallback,\n ): void => {\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n this.errorCallback = errorCallback;\n this.updateReplyItem({ isPending: true }, parentId, id);\n\n this.threadedCommentsAPI = new ThreadedCommentsAPI(this.options);\n\n this.threadedCommentsAPI.deleteComment({\n fileId: file.id,\n commentId: id,\n permissions,\n successCallback: this.deleteReplySuccessCallback.bind(this, id, parentId, successCallback),\n errorCallback: (e: ElementsXhrError, code: string) => {\n this.deleteReplyErrorCallback(e, code, id, parentId);\n },\n });\n };\n\n /**\n * Callback for successful deletion of a reply.\n *\n * @param {string} id - ID of the reply\n * @param {string} parentId - ID of the parent feed item\n * @param {Function} successCallback - success callback\n * @return {void}\n */\n deleteReplySuccessCallback = (id: string, parentId: string, successCallback: Function): void => {\n this.modifyFeedItemRepliesCountBy(parentId, -1);\n this.deleteReplyItem(id, parentId, successCallback);\n };\n\n /**\n * Error callback for deleting a comment\n *\n * @param {ElementsXhrError} e - the error returned by the API\n * @param {string} code - the error code\n * @param {string} commentId - the comment id\n * @return {void}\n */\n deleteCommentErrorCallback = (e: ElementsXhrError, code: string, commentId: string) => {\n this.updateFeedItem(this.createFeedError(messages.commentDeleteErrorMessage), commentId);\n this.feedErrorCallback(true, e, code);\n };\n\n /**\n * Error callback for deleting a reply\n *\n * @param {ElementsXhrError} error - the error returned by the API\n * @param {string} code - the error code\n * @param {string} id - the reply (comment) id\n * @param {string} parentId - the comment id of the parent feed item\n * @return {void}\n */\n deleteReplyErrorCallback = (error: ElementsXhrError, code: string, id: string, parentId: string) => {\n this.updateReplyItem(this.createFeedError(messages.commentDeleteErrorMessage), parentId, id);\n this.feedErrorCallback(true, error, code);\n };\n\n /**\n * Creates a task.\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {Object} currentUser - the user who performed the action\n * @param {string} message - Task text\n * @param {Array} assignees - List of assignees\n * @param {number} dueAt - Task's due date\n * @param {Function} successCallback - the function which will be called on success\n * @param {Function} errorCallback - the function which will be called on error\n * @return {void}\n */\n createTaskNew = (\n file: BoxItem,\n currentUser: User,\n message: string,\n assignees: SelectorItems<>,\n taskType: TaskType,\n dueAt: ?string,\n completionRule: TaskCompletionRule,\n successCallback: Function,\n errorCallback: ErrorCallback,\n ): void => {\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n this.errorCallback = errorCallback;\n const uuid = uniqueId('task_');\n let dueAtString;\n if (dueAt) {\n const dueAtDate: Date = new Date(dueAt);\n dueAtString = dueAtDate.toISOString();\n }\n\n // TODO: make pending task generator a function\n const pendingTask: TaskNew = {\n created_by: {\n type: 'task_collaborator',\n target: currentUser,\n id: uniqueId(),\n role: 'CREATOR',\n status: TASK_NEW_INITIAL_STATUS,\n },\n completion_rule: completionRule,\n created_at: new Date().toISOString(),\n due_at: dueAtString,\n id: uuid,\n description: message,\n type: FEED_ITEM_TYPE_TASK,\n assigned_to: {\n entries: assignees.map((assignee: SelectorItem<UserMini | GroupMini>) => ({\n id: uniqueId(),\n target: { ...assignee, avatar_url: '', type: 'user' },\n status: TASK_NEW_INITIAL_STATUS,\n permissions: {\n can_delete: false,\n can_update: false,\n },\n role: 'ASSIGNEE',\n type: 'task_collaborator',\n })),\n limit: 10,\n next_marker: null,\n },\n permissions: {\n can_update: false,\n can_delete: false,\n can_create_task_collaborator: false,\n can_create_task_link: false,\n },\n task_links: {\n entries: [\n {\n id: uniqueId(),\n type: 'task_link',\n target: {\n type: 'file',\n ...file,\n },\n permissions: {\n can_delete: false,\n can_update: false,\n },\n },\n ],\n limit: 1,\n next_marker: null,\n },\n task_type: taskType,\n status: TASK_NEW_NOT_STARTED,\n };\n\n const taskPayload: TaskPayload = {\n description: message,\n due_at: dueAtString,\n task_type: taskType,\n completion_rule: completionRule,\n };\n\n // create request for the size of each group by ID\n const groupInfoPromises: Array<Promise<any>> = assignees\n .filter((assignee: SelectorItem<UserMini | GroupMini>) => (assignee.item && assignee.item.type) === 'group')\n .map(assignee => assignee.id)\n .map(groupId => {\n return new GroupsAPI(this.options).getGroupCount({\n file,\n group: { id: groupId },\n });\n });\n\n // Fetch each group size in parallel --> return an array of group sizes\n Promise.all(groupInfoPromises)\n .then((groupCounts: Array<{ total_count: number }>) => {\n const hasAnyGroupCountExceeded: boolean = groupCounts.some(\n groupInfo => groupInfo.total_count > TASK_MAX_GROUP_ASSIGNEES,\n );\n const warning = {\n code: ERROR_CODE_GROUP_EXCEEDS_LIMIT,\n type: 'warning',\n };\n if (hasAnyGroupCountExceeded) {\n this.feedErrorCallback(false, warning, ERROR_CODE_GROUP_EXCEEDS_LIMIT);\n return;\n }\n\n this.tasksNewAPI = new TasksNewAPI(this.options);\n this.tasksNewAPI.createTaskWithDeps({\n file,\n task: taskPayload,\n assignees,\n successCallback: (taskWithDepsData: any) => {\n this.addPendingItem(this.file.id, currentUser, pendingTask);\n this.updateFeedItem(\n {\n ...taskWithDepsData,\n task_links: {\n entries: taskWithDepsData.task_links,\n next_marker: null,\n limit: 1,\n },\n assigned_to: {\n entries: taskWithDepsData.assigned_to,\n next_marker: null,\n limit: taskWithDepsData.assigned_to.length,\n },\n isPending: false,\n },\n uuid,\n );\n successCallback(taskWithDepsData);\n },\n errorCallback: (e: ElementsXhrError, code: string) => {\n this.feedErrorCallback(false, e, code);\n },\n });\n })\n .catch(error => {\n this.feedErrorCallback(false, error, ERROR_CODE_CREATE_TASK);\n });\n };\n\n /**\n * Creates a task group via the API.\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {Task|TaskUpdatePayload} task - The newly created or existing task from the API\n * @param {SelectorItem} assignee - The user assigned to this task\n * @param {Function} errorCallback - Task create error callback\n * @return {Promise<TaskAssignment>}\n */\n createTaskCollaboratorsforGroup(\n file: BoxItem,\n task: Task | TaskUpdatePayload,\n assignee: SelectorItem<UserMini | GroupMini>,\n ): Promise<Array<TaskCollabAssignee>> {\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n return new Promise((resolve, reject) => {\n const taskCollaboratorsAPI = new TaskCollaboratorsAPI(this.options);\n this.taskCollaboratorsAPI.push(taskCollaboratorsAPI);\n taskCollaboratorsAPI.createTaskCollaboratorsforGroup({\n file,\n task,\n group: assignee,\n successCallback: resolve,\n errorCallback: (e: ElementsXhrError) => {\n reject(e);\n },\n });\n });\n }\n\n /**\n * Creates a task collaborator via the API.\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {Task|TaskUpdatePayload} task - The newly created or existing task from the API\n * @param {SelectorItem} assignee - The user assigned to this task\n * @param {Function} errorCallback - Task create error callback\n * @return {Promise<TaskAssignment>}\n */\n createTaskCollaborator(\n file: BoxItem,\n task: Task | TaskUpdatePayload,\n assignee: SelectorItem<UserMini | GroupMini>,\n ): Promise<TaskCollabAssignee> {\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n return new Promise((resolve, reject) => {\n const taskCollaboratorsAPI = new TaskCollaboratorsAPI(this.options);\n this.taskCollaboratorsAPI.push(taskCollaboratorsAPI);\n\n taskCollaboratorsAPI.createTaskCollaborator({\n file,\n task,\n user: assignee,\n successCallback: resolve,\n errorCallback: (e: ElementsXhrError) => {\n reject(e);\n },\n });\n });\n }\n\n /**\n * Deletes a task collaborator via the API.\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {Task|TaskUpdatePayload} task - The newly deleted or existing task from the API\n * @param {TaskCollabAssignee} assignee - The user assigned to this task\n * @param {Function} errorCallback - Task delete error callback\n * @return {Promise<TaskAssignment>}\n */\n deleteTaskCollaborator(\n file: BoxItem,\n task: Task | TaskUpdatePayload,\n assignee: TaskCollabAssignee,\n ): Promise<TaskCollabAssignee> {\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file.id = file.id;\n return new Promise((resolve, reject) => {\n const taskCollaboratorsAPI = new TaskCollaboratorsAPI(this.options);\n this.taskCollaboratorsAPI.push(taskCollaboratorsAPI);\n\n taskCollaboratorsAPI.deleteTaskCollaborator({\n file,\n task,\n taskCollaborator: { id: assignee.id },\n successCallback: resolve,\n errorCallback: (e: ElementsXhrError) => {\n reject(e);\n },\n });\n });\n }\n\n /**\n * Creates a task link via the API.\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {Task} task - The newly created task from the API\n * @param {Function} errorCallback - Task create error callback\n * @return {Promise<TaskAssignment}\n */\n createTaskLink(file: BoxItem, task: Task): Promise<TaskLink> {\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n return new Promise((resolve, reject) => {\n const taskLinksAPI = new TaskLinksAPI(this.options);\n this.taskLinksAPI.push(taskLinksAPI);\n\n taskLinksAPI.createTaskLink({\n file,\n task,\n successCallback: resolve,\n errorCallback: reject,\n });\n });\n }\n\n /**\n * Deletes a task in the new API\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {string} taskId - The task's id\n * @param {Function} successCallback - the function which will be called on success\n * @param {Function} errorCallback - the function which will be called on error\n * @return {void}\n */\n deleteTaskNew = (\n file: BoxItem,\n task: TaskNew,\n successCallback: (taskId: string) => void = noop,\n errorCallback: ErrorCallback = noop,\n ) => {\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n this.errorCallback = errorCallback;\n this.tasksNewAPI = new TasksNewAPI(this.options);\n this.updateFeedItem({ isPending: true }, task.id);\n\n this.tasksNewAPI.deleteTask({\n file,\n task,\n successCallback: this.deleteFeedItem.bind(this, task.id, successCallback),\n errorCallback: (e: ElementsXhrError, code: string) => {\n this.updateFeedItem(this.createFeedError(messages.taskDeleteErrorMessage), task.id);\n this.feedErrorCallback(true, e, code);\n },\n });\n };\n\n /**\n * Deletes a feed item from the cache\n *\n * @param {string} id - The id of the feed item to be deleted\n * @param {Function} successCallback - function to be called after the delete\n */\n deleteFeedItem = (id: string, successCallback: Function = noop) => {\n const cachedItems = this.getCachedItems(this.file.id);\n if (cachedItems) {\n const feedItems = cachedItems.items.filter(feedItem => feedItem.id !== id);\n this.setCachedItems(this.file.id, feedItems);\n\n if (!this.isDestroyed()) {\n successCallback(id);\n }\n }\n };\n\n /**\n * Deletes a reply from the cache\n *\n * @param {string} id - The id of the feed item to be deleted\n * @param {string} parentId - The id of the parent feed item\n * @param {Function} successCallback - function to be called after the delete\n */\n deleteReplyItem = (\n id: string,\n parentId: string,\n successCallback: (id: string, parentId: string) => void = noop,\n ) => {\n const cachedItems = this.getCachedItems(this.file.id) || { items: [], errors: [] };\n const feedItems = cachedItems.items.map(item => {\n if (item.id !== parentId) {\n return item;\n }\n if (item.type === FEED_ITEM_TYPE_ANNOTATION) {\n return getItemWithFilteredReplies<Annotation>(item, id);\n }\n if (item.type === FEED_ITEM_TYPE_COMMENT) {\n return getItemWithFilteredReplies<Comment>(item, id);\n }\n return item;\n });\n this.setCachedItems(this.file.id, feedItems);\n\n if (!this.isDestroyed()) {\n successCallback(id, parentId);\n }\n };\n\n /**\n * Network error callback\n *\n * @param {boolean} hasError - true if the UI should display an error\n * @param {ElementsXhrError} e - the error returned by the API\n * @param {string} code - the error code for the error which occured\n * @return {void}\n */\n feedErrorCallback = (hasError: boolean = false, e: ElementsXhrError, code: string): void => {\n if (hasError) {\n this.errors.push({ ...e, code });\n }\n\n if (!this.isDestroyed() && this.errorCallback) {\n this.errorCallback(e, code, {\n error: e,\n [IS_ERROR_DISPLAYED]: hasError,\n });\n }\n\n console.error(e); // eslint-disable-line no-console\n };\n\n /**\n * Add a placeholder pending feed item.\n *\n * @param {string} id - the file id\n * @param {Object} currentUser - the user who performed the action\n * @param {Object} itemBase - Base properties for item to be added to the feed as pending.\n * @return {void}\n */\n addPendingItem = (id: string, currentUser: User, itemBase: Object): Comment | Task | TaskNew | BoxItemVersion => {\n if (!currentUser) {\n throw getBadUserError();\n }\n\n const date = new Date().toISOString();\n const pendingFeedItem = {\n created_at: date,\n created_by: currentUser,\n modified_at: date,\n isPending: true,\n ...itemBase,\n };\n const cachedItems = this.getCachedItems(this.file.id);\n const feedItems = cachedItems ? cachedItems.items : [];\n const feedItemsWithPendingItem = [...feedItems, pendingFeedItem];\n this.setCachedItems(id, feedItemsWithPendingItem);\n\n return pendingFeedItem;\n };\n\n /**\n * Add a placeholder pending comment (reply).\n *\n * @param {string} parentId - id of parent comment or annotation\n * @param {Object} currentUser - the user who performed the action\n * @param {Object} commentBase - Base properties for reply (comment) to be added to the feed as pending.\n * @return {Comment} - newly created pending reply\n */\n addPendingReply = (parentId: string, currentUser: User, commentBase: Object): Comment => {\n if (!this.file.id) {\n throw getBadItemError();\n }\n if (!currentUser) {\n throw getBadUserError();\n }\n\n const date = new Date().toISOString();\n const pendingReply: Comment = {\n created_at: date,\n created_by: currentUser,\n modified_at: date,\n isPending: true,\n ...commentBase,\n };\n\n const cachedItems = this.getCachedItems(this.file.id);\n if (cachedItems) {\n const updatedFeedItems = cachedItems.items.map(item => {\n if (item.id === parentId && item.type === FEED_ITEM_TYPE_COMMENT) {\n return getItemWithPendingReply<Comment>(item, pendingReply);\n }\n if (item.id === parentId && item.type === FEED_ITEM_TYPE_ANNOTATION) {\n return getItemWithPendingReply<Annotation>(item, pendingReply);\n }\n return item;\n });\n\n this.setCachedItems(this.file.id, updatedFeedItems);\n }\n\n return pendingReply;\n };\n\n /**\n * Callback for successful creation of a Comment.\n *\n * @param {Comment} commentData - API returned Comment\n * @param {string} id - ID of the feed item to update with the new comment data\n * @return {void}\n */\n createCommentSuccessCallback = (commentData: Comment, id: string, successCallback: Function): void => {\n const { message = '', tagged_message = '' } = commentData;\n // Comment component uses tagged_message only\n commentData.tagged_message = tagged_message || message;\n\n this.updateFeedItem(\n {\n ...commentData,\n isPending: false,\n },\n id,\n );\n\n if (!this.isDestroyed()) {\n successCallback(commentData);\n }\n };\n\n /**\n * Callback for failed creation of a Comment.\n *\n * @param {Object} e - The axios error\n * @param {string} code - the error code\n * @param {string} id - ID of the feed item to update\n * @return {void}\n */\n createCommentErrorCallback = (e: ElementsXhrError, code: string, id: string) => {\n const errorMessage =\n e.status === HTTP_STATUS_CODE_CONFLICT\n ? messages.commentCreateConflictMessage\n : messages.commentCreateErrorMessage;\n this.updateFeedItem(this.createFeedError(errorMessage), id);\n this.feedErrorCallback(false, e, code);\n };\n\n /**\n * Callback for successful creation of a Comment.\n *\n * @param {Comment} commentData - API returned Comment\n * @param {string} parentId - ID of the parent feed item\n * @param {string} id - ID of the reply to update with the new comment data\n * @param {Function} successCallback - success callback\n * @return {void}\n */\n createReplySuccessCallback = (\n commentData: Comment,\n parentId: string,\n id: string,\n successCallback: Function,\n ): void => {\n this.updateReplyItem(\n {\n ...commentData,\n isPending: false,\n },\n parentId,\n id,\n );\n\n if (!this.isDestroyed()) {\n successCallback(commentData);\n }\n };\n\n /**\n * Callback for failed creation of a reply.\n *\n * @param {ElementsXhrError} error - The axios error\n * @param {string} code - the error code\n * @param {string} parentId - ID of the parent feed item\n * @param {string} id - ID of the feed item to update\n * @return {void}\n */\n createReplyErrorCallback = (error: ElementsXhrError, code: string, parentId: string, id: string) => {\n const errorMessage =\n error.status === HTTP_STATUS_CODE_CONFLICT\n ? messages.commentCreateConflictMessage\n : messages.commentCreateErrorMessage;\n this.updateReplyItem(this.createFeedError(errorMessage), parentId, id);\n this.feedErrorCallback(false, error, code);\n };\n\n /**\n * Constructs an error object that renders to an inline feed error\n *\n * @param {string} message - The error message body.\n * @param {string} title - The error message title.\n * @return {Object} An error message object\n */\n createFeedError(message: MessageDescriptor, title: MessageDescriptor = commonMessages.errorOccured) {\n return {\n error: { message, title },\n };\n }\n\n /**\n * Replace a feed item with new feed item data.\n *\n * @param {Object} updates - The new data to be applied to the feed item.\n * @param {string} id - ID of the feed item to replace.\n * @return {void}\n */\n updateFeedItem = (updates: Object, id: string): ?FeedItems => {\n if (!this.file.id) {\n throw getBadItemError();\n }\n\n const cachedItems = this.getCachedItems(this.file.id);\n if (cachedItems) {\n const updatedFeedItems = cachedItems.items.map((item: FeedItem) => {\n if (item.id === id) {\n return {\n ...item,\n ...updates,\n };\n }\n\n return item;\n });\n\n this.setCachedItems(this.file.id, updatedFeedItems);\n return updatedFeedItems;\n }\n\n return null;\n };\n\n /**\n * Replace a reply of feed item with new comment data.\n *\n * @param {Object} replyUpdates - New data to be applied to the reply.\n * @param {string} parentId - ID of the parent feed item.\n * @param {string} id - ID of the reply to replace.\n * @return {void}\n */\n updateReplyItem = (replyUpdates: Object, parentId: string, id: string) => {\n if (!this.file.id) {\n throw getBadItemError();\n }\n\n const getItemWithUpdatedReply = <T: { replies?: Array<Comment> }>(\n item: T,\n replyId: string,\n updates: Object,\n ): T => {\n const updatedItem: T = { ...item };\n if (updatedItem.replies) {\n updatedItem.replies = updatedItem.replies.map(reply => {\n if (reply.id === replyId) {\n return {\n ...reply,\n ...updates,\n };\n }\n return reply;\n });\n }\n return updatedItem;\n };\n\n const cachedItems = this.getCachedItems(this.file.id);\n if (cachedItems) {\n const updatedFeedItems = cachedItems.items.map((item: FeedItem) => {\n if (item.id === parentId && item.type === FEED_ITEM_TYPE_COMMENT) {\n return getItemWithUpdatedReply<Comment>(item, id, replyUpdates);\n }\n if (item.id === parentId && item.type === FEED_ITEM_TYPE_ANNOTATION) {\n return getItemWithUpdatedReply<Annotation>(item, id, replyUpdates);\n }\n return item;\n });\n\n this.setCachedItems(this.file.id, updatedFeedItems);\n }\n };\n\n /**\n * Create a comment, and make a pending item to be replaced once the API is successful.\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {Object} currentUser - the user who performed the action\n * @param {string} text - the comment text\n * @param {boolean} hasMention - true if there is an @mention in the text\n * @param {Function} successCallback - the success callback\n * @param {Function} errorCallback - the error callback\n * @return {void}\n */\n createComment = (\n file: BoxItem,\n currentUser: User,\n text: string,\n hasMention: boolean,\n successCallback: Function,\n errorCallback: ErrorCallback,\n ): void => {\n const uuid = uniqueId('comment_');\n const commentData = {\n id: uuid,\n tagged_message: text,\n type: FEED_ITEM_TYPE_COMMENT,\n };\n\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n this.errorCallback = errorCallback;\n this.addPendingItem(this.file.id, currentUser, commentData);\n\n const message = {};\n if (hasMention) {\n message.taggedMessage = text;\n } else {\n message.message = text;\n }\n\n this.commentsAPI = new CommentsAPI(this.options);\n\n this.commentsAPI.createComment({\n file,\n ...message,\n successCallback: (comment: Comment) => {\n this.createCommentSuccessCallback(comment, uuid, successCallback);\n },\n errorCallback: (e: ErrorResponseData, code: string) => {\n this.createCommentErrorCallback(e, code, uuid);\n },\n });\n };\n\n /**\n * Create a threaded comment (using ThreadedComments API),\n * and make a pending item to be replaced once the API is successful.\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {Object} currentUser - the user who performed the action\n * @param {string} text - the comment text\n * @param {Function} successCallback - the success callback\n * @param {Function} errorCallback - the error callback\n * @return {void}\n */\n createThreadedComment = (\n file: BoxItem,\n currentUser: User,\n text: string,\n successCallback: Function,\n errorCallback: ErrorCallback,\n ): void => {\n if (!file.id) {\n throw getBadItemError();\n }\n\n const uuid = uniqueId('comment_');\n const commentData = {\n id: uuid,\n tagged_message: text,\n type: FEED_ITEM_TYPE_COMMENT,\n };\n\n this.file = file;\n this.errorCallback = errorCallback;\n this.addPendingItem(this.file.id, currentUser, commentData);\n\n this.threadedCommentsAPI = new ThreadedCommentsAPI(this.options);\n\n this.threadedCommentsAPI.createComment({\n file,\n message: text,\n successCallback: (comment: Comment) => {\n this.createCommentSuccessCallback(comment, uuid, successCallback);\n },\n errorCallback: (e: ErrorResponseData, code: string) => {\n this.createCommentErrorCallback(e, code, uuid);\n },\n });\n };\n\n /**\n * Create a reply to annotation or comment, and make a pending item to be replaced once the API is successful.\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {Object} currentUser - the user who performed the action\n * @param {string} parentId - id of the parent item\n * @param {CommentFeedItemType} parentType - type of the parent item\n * @param {string} text - the comment text\n * @param {Function} successCallback - the success callback\n * @param {Function} errorCallback - the error callback\n * @return {void}\n */\n createReply(\n file: BoxItem,\n currentUser: User,\n parentId: string,\n parentType: CommentFeedItemType,\n text: string,\n successCallback: Function,\n errorCallback: ErrorCallback,\n ): void {\n const { id, permissions } = file;\n if (!id || !permissions) {\n throw getBadItemError();\n }\n\n const uuid = uniqueId('comment_');\n const commentData = {\n id: uuid,\n tagged_message: text,\n type: FEED_ITEM_TYPE_COMMENT,\n };\n\n this.file = file;\n this.errorCallback = errorCallback;\n this.addPendingReply(parentId, currentUser, commentData);\n this.modifyFeedItemRepliesCountBy(parentId, 1);\n\n const successCallbackFn = (comment: Comment) => {\n this.createReplySuccessCallback(comment, parentId, uuid, successCallback);\n };\n const errorCallbackFn = (error: ErrorResponseData, code: string) => {\n this.createReplyErrorCallback(error, code, parentId, uuid);\n };\n\n if (parentType === FEED_ITEM_TYPE_ANNOTATION) {\n this.annotationsAPI = new AnnotationsAPI(this.options);\n\n this.annotationsAPI.createAnnotationReply(\n file.id,\n parentId,\n permissions,\n text,\n successCallbackFn,\n errorCallbackFn,\n );\n } else if (parentType === FEED_ITEM_TYPE_COMMENT) {\n this.threadedCommentsAPI = new ThreadedCommentsAPI(this.options);\n\n this.threadedCommentsAPI.createCommentReply({\n fileId: file.id,\n commentId: parentId,\n permissions,\n message: text,\n successCallback: successCallbackFn,\n errorCallback: errorCallbackFn,\n });\n }\n }\n\n /**\n * Update a comment\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {string} commentId - Comment ID\n * @param {string} text - the comment text\n * @param {boolean} hasMention - true if there is an @mention in the text\n * @param {BoxCommentPermission} permissions - Permissions to attach to the app activity items\n * @param {Function} successCallback - the success callback\n * @param {Function} errorCallback - the error callback\n * @return {void}\n */\n updateComment = (\n file: BoxItem,\n commentId: string,\n text: string,\n hasMention: boolean,\n permissions: BoxCommentPermission,\n successCallback: Function,\n errorCallback: ErrorCallback,\n ): void => {\n const commentData = {\n tagged_message: text,\n };\n\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n this.errorCallback = errorCallback;\n this.updateFeedItem({ ...commentData, isPending: true }, commentId);\n\n const message = {};\n if (hasMention) {\n message.tagged_message = text;\n } else {\n message.message = text;\n }\n\n this.commentsAPI = new CommentsAPI(this.options);\n\n this.commentsAPI.updateComment({\n file,\n commentId,\n permissions,\n ...message,\n successCallback: (comment: Comment) => {\n // use the request payload instead of response in the\n // feed item update because response may not contain\n // the tagged version of the message\n this.updateFeedItem(\n {\n ...message,\n isPending: false,\n },\n commentId,\n );\n if (!this.isDestroyed()) {\n successCallback(comment);\n }\n },\n errorCallback: (e: ErrorResponseData, code: string) => {\n this.updateCommentErrorCallback(e, code, commentId);\n },\n });\n };\n\n /**\n * Update a threaded comment\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {string} commentId - Comment ID\n * @param {string} text - the comment text\n * @param {FeedItemStatus} status - status of the comment\n * @param {BoxCommentPermission} permissions - Permissions to attach to the app activity items\n * @param {Function} successCallback - the success callback\n * @param {Function} errorCallback - the error callback\n * @return {void}\n */\n updateThreadedComment = (\n file: BoxItem,\n commentId: string,\n text?: string,\n status?: FeedItemStatus,\n permissions: BoxCommentPermission,\n successCallback: Function,\n errorCallback: ErrorCallback,\n ): void => {\n if (!file.id) {\n throw getBadItemError();\n }\n if (!text && !status) {\n throw getMissingItemTextOrStatus();\n }\n\n const commentData = {};\n if (text) {\n commentData.tagged_message = text;\n }\n if (status) {\n commentData.status = status;\n }\n\n this.file = file;\n this.errorCallback = errorCallback;\n this.updateFeedItem({ ...commentData, isPending: true }, commentId);\n\n this.threadedCommentsAPI = new ThreadedCommentsAPI(this.options);\n\n this.threadedCommentsAPI.updateComment({\n fileId: file.id,\n commentId,\n permissions,\n message: text,\n status,\n successCallback: (comment: Comment) => {\n const { replies, total_reply_count, ...commentBase } = comment;\n this.updateFeedItem(\n {\n // Do not update replies and total_reply_count props as their current values are not included in the response\n ...commentBase,\n isPending: false,\n },\n commentId,\n );\n if (!this.isDestroyed()) {\n successCallback(comment);\n }\n },\n errorCallback: (e: ErrorResponseData, code: string) => {\n this.updateCommentErrorCallback(e, code, commentId);\n },\n });\n };\n\n /**\n * Update a reply\n *\n * @param {BoxItem} file - The file to which the reply with its parent is assigned\n * @param {string} id - id of the reply\n * @param {string} parentId - id of the parent item\n * @param {string} text - the updated text\n * @param {BoxCommentPermission} permissions - Permissions to attach to the app activity items\n * @param {Function} successCallback - the success callback\n * @param {Function} errorCallback - the error callback\n * @return {void}\n */\n updateReply = (\n file: BoxItem,\n id: string,\n parentId: string,\n text: string,\n permissions: BoxCommentPermission,\n successCallback: (comment: Comment) => void,\n errorCallback: ErrorCallback,\n ): void => {\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n this.errorCallback = errorCallback;\n this.updateReplyItem({ tagged_message: text, isPending: true }, parentId, id);\n\n this.threadedCommentsAPI = new ThreadedCommentsAPI(this.options);\n\n this.threadedCommentsAPI.updateComment({\n fileId: file.id,\n commentId: id,\n permissions,\n message: text,\n undefined,\n successCallback: (comment: Comment) => {\n this.updateReplyItem(\n {\n ...comment,\n isPending: false,\n },\n parentId,\n id,\n );\n if (!this.isDestroyed()) {\n successCallback(comment);\n }\n },\n errorCallback: (error: ErrorResponseData, code: string) => {\n this.updateReplyErrorCallback(error, code, id, parentId);\n },\n });\n };\n\n /**\n * Modify feed item replies count\n *\n * @param {string} id - id of the item\n * @param {number} n - number to modify the count by\n * @return {void}\n */\n modifyFeedItemRepliesCountBy = (id: string, n: number) => {\n if (!this.file.id) {\n throw getBadItemError();\n }\n\n const { items: feedItems = [] } = this.getCachedItems(this.file.id) || {};\n const feedItem = feedItems.find(({ id: itemId }) => itemId === id);\n\n if (!feedItem || (feedItem.type !== 'annotation' && feedItem.type !== 'comment')) {\n return;\n }\n\n const newReplyCount = (feedItem.total_reply_count || 0) + n;\n if (newReplyCount >= 0) {\n this.updateFeedItem({ total_reply_count: newReplyCount }, id);\n }\n };\n\n destroyTaskCollaborators() {\n if (Array.isArray(this.taskCollaboratorsAPI)) {\n this.taskCollaboratorsAPI.forEach(api => api.destroy());\n this.taskCollaboratorsAPI = [];\n }\n }\n\n destroyTaskLinks() {\n if (Array.isArray(this.taskLinksAPI)) {\n this.taskLinksAPI.forEach(api => api.destroy());\n this.taskLinksAPI = [];\n }\n }\n\n /**\n * Fetches app activities for a file\n * @param {BoxItemPermission} permissions - Permissions to attach to the app activity items\n *\n * @return {Promise} - the feed items\n */\n fetchAppActivity(permissions: BoxItemPermission): Promise<?AppActivityItems> {\n this.appActivityAPI = new AppActivityAPI(this.options);\n\n return new Promise(resolve => {\n this.appActivityAPI.getAppActivity(\n this.file.id,\n permissions,\n resolve,\n this.fetchFeedItemErrorCallback.bind(this, resolve),\n );\n });\n }\n\n /**\n * Deletes an app activity item.\n *\n * @param {BoxItem} file - The file to which the app activity belongs to\n * @param {string} appActivityId - The app activity item id to delete\n * @param {Function} successCallback - the function which will be called on success\n * @param {Function} errorCallback - the function which will be called on error\n * @return {void}\n */\n deleteAppActivity = (\n file: BoxItem,\n appActivityId: string,\n successCallback: Function,\n errorCallback: ErrorCallback,\n ): void => {\n const { id } = file;\n if (!id) {\n throw getBadItemError();\n }\n\n this.appActivityAPI = new AppActivityAPI(this.options);\n\n this.file = file;\n this.errorCallback = errorCallback;\n this.updateFeedItem({ isPending: true }, appActivityId);\n\n this.appActivityAPI.deleteAppActivity({\n id,\n appActivityId,\n successCallback: this.deleteFeedItem.bind(this, appActivityId, successCallback),\n errorCallback: (e: ElementsXhrError, code: string) => {\n this.deleteAppActivityErrorCallback(e, code, appActivityId);\n },\n });\n };\n\n /**\n * Error callback for deleting an app activity item\n *\n * @param {ElementsXhrError} e - the error returned by the API\n * @param {string} code - the error code\n * @param {string} id - the app activity id\n * @return {void}\n */\n deleteAppActivityErrorCallback = (e: ElementsXhrError, code: string, id: string) => {\n this.updateFeedItem(this.createFeedError(messages.appActivityDeleteErrorMessage), id);\n this.feedErrorCallback(true, e, code);\n };\n\n /**\n * Destroys all the task feed API's\n *\n * @return {void}\n */\n destroy() {\n super.destroy();\n\n if (this.annotationsAPI) {\n this.annotationsAPI.destroy();\n delete this.annotationsAPI;\n }\n\n if (this.commentsAPI) {\n this.commentsAPI.destroy();\n delete this.commentsAPI;\n }\n\n if (this.threadedCommentsAPI) {\n this.threadedCommentsAPI.destroy();\n delete this.threadedCommentsAPI;\n }\n\n if (this.versionsAPI) {\n this.versionsAPI.destroy();\n delete this.versionsAPI;\n }\n\n if (this.appActivityAPI) {\n this.appActivityAPI.destroy();\n delete this.appActivityAPI;\n }\n\n if (this.tasksNewAPI) {\n this.tasksNewAPI.destroy();\n delete this.tasksNewAPI;\n }\n\n this.destroyTaskCollaborators();\n this.destroyTaskLinks();\n }\n}\n\nexport default Feed;\n"],"file":"Feed.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/api/Feed.js"],"names":["noop","uniqueId","getBadItemError","getBadUserError","getMissingItemTextOrStatus","isUserCorrectableError","commonMessages","messages","sortFeedItems","FEED_FILE_VERSIONS_FIELDS_TO_FETCH","Base","AnnotationsAPI","CommentsAPI","ThreadedCommentsAPI","FileActivitiesAPI","VersionsAPI","TasksNewAPI","GroupsAPI","TaskCollaboratorsAPI","TaskLinksAPI","AppActivityAPI","ERROR_CODE_CREATE_TASK","ERROR_CODE_UPDATE_TASK","ERROR_CODE_GROUP_EXCEEDS_LIMIT","FEED_ITEM_TYPE_ANNOTATION","FEED_ITEM_TYPE_COMMENT","FEED_ITEM_TYPE_TASK","FILE_ACTIVITY_TYPE_ANNOTATION","FILE_ACTIVITY_TYPE_APP_ACTIVITY","FILE_ACTIVITY_TYPE_COMMENT","FILE_ACTIVITY_TYPE_TASK","HTTP_STATUS_CODE_CONFLICT","IS_ERROR_DISPLAYED","PERMISSION_CAN_VIEW_ANNOTATIONS","TASK_NEW_APPROVED","TASK_NEW_COMPLETED","TASK_NEW_REJECTED","TASK_NEW_NOT_STARTED","TYPED_ID_FEED_PREFIX","TASK_MAX_GROUP_ASSIGNEES","TASK_NEW_INITIAL_STATUS","getItemWithFilteredReplies","item","replyId","replies","rest","filter","id","getItemWithPendingReply","reply","parseReplies","parsedReplies","map","tagged_message","message","getParsedFileActivitiesResponse","response","entries","length","data","parsedData","source","activity_type","taskItem","assigned_to","assignedToEntries","entry","assignedToEntry","role","toUpperCase","status","completion_rule","task_type","created_by","target","commentItem","annotationItem","Feed","options","file","annotationId","text","permissions","successCallback","errorCallback","annotationsAPI","feedItemChanges","updateFeedItem","isPending","updateAnnotation","annotation","total_reply_count","annotationBase","isDestroyed","e","code","updateCommentErrorCallback","createFeedError","commentUpdateErrorMessage","feedErrorCallback","error","parentId","updateReplyItem","repliesFetchErrorMessage","successCallBack","deleteAnnotation","deleteFeedItem","bind","deleteCommentErrorCallback","resolve","comment","taskId","taskCollaboratorId","taskCollaboratorStatus","collaboratorsApi","taskCollaboratorsAPI","push","taskCollaboratorPayload","handleError","errorMessage","taskApproveErrorMessage","taskCompleteErrorMessage","taskRejectErrorMessage","taskActionErrorTitle","updateTaskCollaborator","taskCollaborator","taskCollab","updateTaskCollaboratorSuccessCallback","updatedCollaborator","tasksNewAPI","getTask","task","groupInfoPromises","addedAssignees","assignee","type","groupId","getGroupCount","group","Promise","all","groupCounts","hasAnyGroupCountExceeded","some","groupInfo","total_count","warning","reject","updateTaskWithDeps","taskData","commentId","commentsAPI","deleteComment","threadedCommentsAPI","fileId","deleteReplySuccessCallback","deleteReplyErrorCallback","modifyFeedItemRepliesCountBy","deleteReplyItem","commentDeleteErrorMessage","currentUser","assignees","taskType","dueAt","completionRule","uuid","dueAtString","dueAtDate","Date","toISOString","pendingTask","created_at","due_at","description","avatar_url","can_delete","can_update","limit","next_marker","can_create_task_collaborator","can_create_task_link","task_links","taskPayload","then","createTaskWithDeps","taskWithDepsData","addPendingItem","catch","deleteTask","taskDeleteErrorMessage","cachedItems","getCachedItems","feedItems","items","feedItem","setCachedItems","errors","hasError","console","itemBase","date","pendingFeedItem","modified_at","feedItemsWithPendingItem","commentBase","pendingReply","updatedFeedItems","commentData","commentCreateConflictMessage","commentCreateErrorMessage","updates","replyUpdates","getItemWithUpdatedReply","updatedItem","hasMention","taggedMessage","createComment","createCommentSuccessCallback","createCommentErrorCallback","updateComment","undefined","updateReplyErrorCallback","n","find","itemId","newReplyCount","appActivityId","appActivityAPI","deleteAppActivity","deleteAppActivityErrorCallback","appActivityDeleteErrorMessage","taskLinksAPI","newAnnotation","cache","getCache","cacheKey","getCacheKey","get","set","shouldRefreshCache","onError","shouldShowAnnotations","shouldShowAppActivity","shouldShowReplies","shouldShowTasks","shouldShowVersions","shouldUseUAA","annotationsPromise","fetchAnnotations","commentsPromise","fetchThreadedComments","fetchComments","tasksPromise","fetchTasksNew","appActivityPromise","fetchAppActivity","versionsPromise","fetchVersions","currentVersionPromise","fetchCurrentVersion","annotationActivityType","appActivityActivityType","taskActivityType","filteredActivityTypes","fileActivitiesPromise","fetchFileActivities","handleFeedItems","versions","currentVersion","fileActivitiesResponse","versionsWithCurrent","versionsAPI","addCurrentVersion","parsedFeedItems","sortedFeedItems","shouldFetchReplies","getAnnotations","fetchFeedItemErrorCallback","getComments","getComment","fetchThreadedCommentSuccessCallback","activityTypes","fileActivitiesAPI","getActivities","fileID","commentFeedItemId","commentFeedItemType","isRepliesLoading","successCallbackFn","errorCallbackFn","fetchRepliesErrorCallback","getAnnotationReplies","getCommentReplies","getVersions","file_version","getVersion","getTasksForFile","err","shouldDisplayError","createTaskCollaboratorsforGroup","createTaskCollaborator","user","deleteTaskCollaborator","createTaskLink","title","errorOccured","parentType","addPendingReply","createReplySuccessCallback","createReplyErrorCallback","createAnnotationReply","createCommentReply","Array","isArray","forEach","api","destroy","getAppActivity","destroyTaskCollaborators","destroyTaskLinks"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAKA,OAAOA,IAAP,MAAiB,aAAjB;AACA,OAAOC,QAAP,MAAqB,iBAArB;AAEA,SAASC,eAAT,EAA0BC,eAA1B,EAA2CC,0BAA3C,EAAuEC,sBAAvE,QAAqG,gBAArG;AACA,OAAOC,cAAP,MAA2B,6BAA3B;AACA,OAAOC,QAAP,MAAqB,YAArB;AACA,SAASC,aAAT,QAA8B,iBAA9B;AACA,SAASC,kCAAT,QAAmD,iBAAnD;AACA,OAAOC,IAAP,MAAiB,QAAjB;AACA,OAAOC,cAAP,MAA2B,eAA3B;AACA,OAAOC,WAAP,MAAwB,YAAxB;AACA,OAAOC,mBAAP,MAAgC,oBAAhC;AACA,OAAOC,iBAAP,MAA8B,kBAA9B;AACA,OAAOC,WAAP,MAAwB,YAAxB;AACA,OAAOC,WAAP,MAAwB,kBAAxB;AACA,OAAOC,SAAP,MAAsB,UAAtB;AACA,OAAOC,oBAAP,MAAiC,2BAAj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,cAAL,CAAoB0F,cAApB,CACI,OAAI,CAAC9O,IAAL,CAAUhC,EADd,EAEImC,WAFJ,EAGI2B,OAHJ,EAII,OAAI,CAACwK,0BAAL,CAAgC1K,IAAhC,CAAqC,OAArC,EAA2CE,OAA3C,CAJJ;AAMH,OAPM,CAAP;AAQH;AAED;;;;;;;;;;;;;AAiDA;;;;;8BAKU;AACN;;AAEA,UAAI,KAAKxB,cAAT,EAAyB;AACrB,aAAKA,cAAL,CAAoBuO,OAApB;AACA,eAAO,KAAKvO,cAAZ;AACH;;AAED,UAAI,KAAKkE,WAAT,EAAsB;AAClB,aAAKA,WAAL,CAAiBqK,OAAjB;AACA,eAAO,KAAKrK,WAAZ;AACH;;AAED,UAAI,KAAKE,mBAAT,EAA8B;AAC1B,aAAKA,mBAAL,CAAyBmK,OAAzB;AACA,eAAO,KAAKnK,mBAAZ;AACH;;AAED,UAAI,KAAKsH,WAAT,EAAsB;AAClB,aAAKA,WAAL,CAAiB6C,OAAjB;AACA,eAAO,KAAK7C,WAAZ;AACH;;AAED,UAAI,KAAK5C,cAAT,EAAyB;AACrB,aAAKA,cAAL,CAAoByF,OAApB;AACA,eAAO,KAAKzF,cAAZ;AACH;;AAED,UAAI,KAAKlG,WAAT,EAAsB;AAClB,aAAKA,WAAL,CAAiB2L,OAAjB;AACA,eAAO,KAAK3L,WAAZ;AACH;;AAED,WAAK6L,wBAAL;AACA,WAAKC,gBAAL;AACH;;;;EAtmEcrT,I;;AAymEnB,eAAemE,IAAf","sourcesContent":["/**\n * @flow\n * @file Helper for activity feed API's\n * @author Box\n */\nimport noop from 'lodash/noop';\nimport uniqueId from 'lodash/uniqueId';\nimport type { MessageDescriptor } from 'react-intl';\nimport { getBadItemError, getBadUserError, getMissingItemTextOrStatus, isUserCorrectableError } from '../utils/error';\nimport commonMessages from '../elements/common/messages';\nimport messages from './messages';\nimport { sortFeedItems } from '../utils/sorter';\nimport { FEED_FILE_VERSIONS_FIELDS_TO_FETCH } from '../utils/fields';\nimport Base from './Base';\nimport AnnotationsAPI from './Annotations';\nimport CommentsAPI from './Comments';\nimport ThreadedCommentsAPI from './ThreadedComments';\nimport FileActivitiesAPI from './FileActivities';\nimport VersionsAPI from './Versions';\nimport TasksNewAPI from './tasks/TasksNew';\nimport GroupsAPI from './Groups';\nimport TaskCollaboratorsAPI from './tasks/TaskCollaborators';\nimport TaskLinksAPI from './tasks/TaskLinks';\nimport AppActivityAPI from './AppActivity';\nimport {\n ERROR_CODE_CREATE_TASK,\n ERROR_CODE_UPDATE_TASK,\n ERROR_CODE_GROUP_EXCEEDS_LIMIT,\n FEED_ITEM_TYPE_ANNOTATION,\n FEED_ITEM_TYPE_COMMENT,\n FEED_ITEM_TYPE_TASK,\n FILE_ACTIVITY_TYPE_ANNOTATION,\n FILE_ACTIVITY_TYPE_APP_ACTIVITY,\n FILE_ACTIVITY_TYPE_COMMENT,\n FILE_ACTIVITY_TYPE_TASK,\n HTTP_STATUS_CODE_CONFLICT,\n IS_ERROR_DISPLAYED,\n PERMISSION_CAN_VIEW_ANNOTATIONS,\n TASK_NEW_APPROVED,\n TASK_NEW_COMPLETED,\n TASK_NEW_REJECTED,\n TASK_NEW_NOT_STARTED,\n TYPED_ID_FEED_PREFIX,\n TASK_MAX_GROUP_ASSIGNEES,\n} from '../constants';\nimport type {\n TaskCompletionRule,\n TaskCollabAssignee,\n TaskCollabStatus,\n TaskLink,\n TaskNew,\n TaskType,\n TaskPayload,\n TaskUpdatePayload,\n} from '../common/types/tasks';\nimport type { ElementsXhrError, ErrorResponseData, APIOptions } from '../common/types/api';\nimport type {\n SelectorItems,\n SelectorItem,\n UserMini,\n GroupMini,\n BoxItem,\n BoxItemPermission,\n BoxItemVersion,\n FileVersions,\n User,\n} from '../common/types/core';\nimport type {\n Annotation,\n AnnotationPermission,\n Annotations,\n AppActivityItems,\n BoxCommentPermission,\n Comment,\n CommentFeedItemType,\n Comments,\n FeedItem,\n FeedItems,\n FeedItemStatus,\n FileActivity,\n FileActivityTypes,\n Task,\n Tasks,\n ThreadedComments as ThreadedCommentsType,\n} from '../common/types/feed';\n\nconst TASK_NEW_INITIAL_STATUS = TASK_NEW_NOT_STARTED;\n\ntype FeedItemsCache = {\n errors: ErrorResponseData[],\n items: FeedItems,\n};\n\ntype ErrorCallback = (e: ElementsXhrError, code: string, contextInfo?: Object) => void;\n\nconst getItemWithFilteredReplies = <T: { replies?: Array<Comment> }>(item: T, replyId: string): T => {\n const { replies = [], ...rest } = item;\n return { replies: replies.filter(({ id }) => id !== replyId), ...rest };\n};\n\nconst getItemWithPendingReply = <T: { replies?: Array<Comment> }>(item: T, reply: Comment): T => {\n const { replies = [], ...rest } = item;\n return { replies: [...replies, reply], ...rest };\n};\n\nconst parseReplies = (replies: Comment[]): Comment[] => {\n const parsedReplies = [...replies];\n\n return parsedReplies.map(reply => {\n return { ...reply, tagged_message: reply.tagged_message || reply.message || '' };\n });\n};\n\nexport const getParsedFileActivitiesResponse = (response?: { entries: FileActivity[] }) => {\n if (!response || !response.entries || !response.entries.length) {\n return { entries: [] };\n }\n\n const data = response.entries;\n\n const parsedData: Array<Object> = data\n .map(item => {\n if (!item.source) {\n return null;\n }\n\n const source = { ...item.source };\n\n switch (item.activity_type) {\n case FILE_ACTIVITY_TYPE_TASK: {\n const taskItem = { ...source[FILE_ACTIVITY_TYPE_TASK] };\n // UAA follows a lowercased enum naming convention, convert to uppercase to align with task api\n if (taskItem.assigned_to?.entries) {\n const assignedToEntries = taskItem.assigned_to.entries.map(entry => {\n const assignedToEntry = { ...entry };\n\n assignedToEntry.role = entry.role.toUpperCase();\n assignedToEntry.status = entry.status.toUpperCase();\n\n return assignedToEntry;\n });\n // $FlowFixMe Using the toUpperCase method makes Flow assume role and status is a string type, which is incompatible with string literal\n taskItem.assigned_to.entries = assignedToEntries;\n }\n if (taskItem.completion_rule) {\n taskItem.completion_rule = taskItem.completion_rule.toUpperCase();\n }\n if (taskItem.status) {\n taskItem.status = taskItem.status.toUpperCase();\n }\n if (taskItem.task_type) {\n taskItem.task_type = taskItem.task_type.toUpperCase();\n }\n // $FlowFixMe File Activities only returns a created_by user, Flow type fix is needed\n taskItem.created_by = { target: taskItem.created_by };\n\n return taskItem;\n }\n case FILE_ACTIVITY_TYPE_COMMENT: {\n const commentItem = { ...source[FILE_ACTIVITY_TYPE_COMMENT] };\n\n if (commentItem.replies && commentItem.replies.length) {\n const replies = parseReplies(commentItem.replies);\n\n commentItem.replies = replies;\n }\n\n commentItem.tagged_message = commentItem.tagged_message || commentItem.message || '';\n\n return commentItem;\n }\n case FILE_ACTIVITY_TYPE_ANNOTATION: {\n const annotationItem = { ...source[FILE_ACTIVITY_TYPE_ANNOTATION] };\n\n if (annotationItem.replies && annotationItem.replies.length) {\n const replies = parseReplies(annotationItem.replies);\n\n annotationItem.replies = replies;\n }\n\n return annotationItem;\n }\n case FILE_ACTIVITY_TYPE_APP_ACTIVITY: {\n return { ...source[FILE_ACTIVITY_TYPE_APP_ACTIVITY] };\n }\n\n default: {\n return null;\n }\n }\n })\n .filter(item => !!item);\n\n return { entries: parsedData };\n};\n\nclass Feed extends Base {\n /**\n * @property {AnnotationsAPI}\n */\n annotationsAPI: AnnotationsAPI;\n\n /**\n * @property {VersionsAPI}\n */\n versionsAPI: VersionsAPI;\n\n /**\n * @property {CommentsAPI}\n */\n commentsAPI: CommentsAPI;\n\n /**\n * @property {AppActivityAPI}\n */\n appActivityAPI: AppActivityAPI;\n\n /**\n * @property {TasksNewAPI}\n */\n tasksNewAPI: TasksNewAPI;\n\n /**\n * @property {TaskCollaboratorsAPI}\n */\n taskCollaboratorsAPI: TaskCollaboratorsAPI[];\n\n /**\n * @property {TaskLinksAPI}\n */\n taskLinksAPI: TaskLinksAPI[];\n\n /**\n * @property {ThreadedCommentsAPI}\n */\n threadedCommentsAPI: ThreadedCommentsAPI;\n\n /**\n * @property {FileActivitiesAPI}\n */\n fileActivitiesAPI: FileActivitiesAPI;\n\n /**\n * @property {BoxItem}\n */\n file: BoxItem;\n\n /**\n * @property {ElementsXhrError}\n */\n errors: ElementsXhrError[];\n\n constructor(options: APIOptions) {\n super(options);\n this.taskCollaboratorsAPI = [];\n this.taskLinksAPI = [];\n this.errors = [];\n }\n\n /**\n * Creates pending card on create_start action, then updates card on next call\n * @param {BoxItem} file - The file to which the annotation is assigned\n * @param {Object} currentUser - the user who performed the action\n * @param {Annotation} annotation - the current annotation to be created\n * @param {string} id - unique id for the incoming annotation\n * @param {boolean} isPending - indicates the current creation process of the annotation\n */\n addAnnotation(file: BoxItem, currentUser: User, annotation: Annotation, id: string, isPending: boolean): void {\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n\n // Add the pending interstitial card\n if (isPending) {\n const newAnnotation = {\n ...annotation,\n created_by: currentUser,\n id,\n type: FEED_ITEM_TYPE_ANNOTATION,\n };\n\n this.addPendingItem(this.file.id, currentUser, newAnnotation);\n\n return;\n }\n // Create action has completed, so update the existing pending item\n this.updateFeedItem({ ...annotation, isPending: false }, id);\n }\n\n updateAnnotation = (\n file: BoxItem,\n annotationId: string,\n text?: string,\n status?: FeedItemStatus,\n permissions: AnnotationPermission,\n successCallback: (annotation: Annotation) => void,\n errorCallback: ErrorCallback,\n ): void => {\n if (!file.id) {\n throw getBadItemError();\n }\n if (!text && !status) {\n throw getMissingItemTextOrStatus();\n }\n\n this.annotationsAPI = new AnnotationsAPI(this.options);\n\n this.file = file;\n this.errorCallback = errorCallback;\n\n const feedItemChanges = {};\n if (text) {\n feedItemChanges.message = text;\n }\n if (status) {\n feedItemChanges.status = status;\n }\n this.updateFeedItem({ ...feedItemChanges, isPending: true }, annotationId);\n\n this.annotationsAPI.updateAnnotation(\n this.file.id,\n annotationId,\n permissions,\n feedItemChanges,\n (annotation: Annotation) => {\n const { replies, total_reply_count, ...annotationBase } = annotation;\n this.updateFeedItem(\n {\n // Do not update replies and total_reply_count props as their current values are not included in the response\n ...annotationBase,\n isPending: false,\n },\n annotationId,\n );\n if (!this.isDestroyed()) {\n successCallback(annotation);\n }\n },\n (e: ErrorResponseData, code: string) => {\n this.updateCommentErrorCallback(e, code, annotationId);\n },\n );\n };\n\n /**\n * Error callback for updating a comment\n *\n * @param {ElementsXhrError} e - the error returned by the API\n * @param {string} code - the error code\n * @param {string} id - the id of either an annotation or comment\n * @return {void}\n */\n updateCommentErrorCallback = (e: ElementsXhrError, code: string, id: string) => {\n this.updateFeedItem(this.createFeedError(messages.commentUpdateErrorMessage), id);\n this.feedErrorCallback(true, e, code);\n };\n\n /**\n * Error callback for updating a reply\n *\n * @param {ElementsXhrError} error - the error returned by the API\n * @param {string} code - the error code\n * @param {string} id - the id of the reply (comment)\n * @param {string} parentId - the id of either the parent item (an annotation or comment)\n * @return {void}\n */\n updateReplyErrorCallback = (error: ElementsXhrError, code: string, id: string, parentId: string) => {\n this.updateReplyItem(this.createFeedError(messages.commentUpdateErrorMessage), parentId, id);\n this.feedErrorCallback(true, error, code);\n };\n\n /**\n * Error callback for fetching replies\n *\n * @param {ElementsXhrError} error - the error returned by the API\n * @param {string} code - the error code\n * @param {string} id - the id of either an annotation or comment\n * @return {void}\n */\n fetchRepliesErrorCallback = (error: ElementsXhrError, code: string, id: string) => {\n this.updateFeedItem(this.createFeedError(messages.repliesFetchErrorMessage), id);\n this.feedErrorCallback(true, error, code);\n };\n\n deleteAnnotation = (\n file: BoxItem,\n annotationId: string,\n permissions: AnnotationPermission,\n successCallBack: Function,\n errorCallback: Function,\n ): void => {\n this.annotationsAPI = new AnnotationsAPI(this.options);\n\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n this.errorCallback = errorCallback;\n\n this.updateFeedItem({ isPending: true }, annotationId);\n this.annotationsAPI.deleteAnnotation(\n this.file.id,\n annotationId,\n permissions,\n this.deleteFeedItem.bind(this, annotationId, successCallBack),\n (error: ElementsXhrError, code: string) => {\n // Reusing comment error handler since annotations are treated as comments to user\n this.deleteCommentErrorCallback(error, code, annotationId);\n },\n );\n };\n\n /**\n * Creates a key for the cache\n *\n * @param {string} id folder id\n * @return {string} key\n */\n getCacheKey(id: string): string {\n return `${TYPED_ID_FEED_PREFIX}${id}`;\n }\n\n /**\n * Gets the items from the cache\n *\n * @param {string} id the cache id\n */\n getCachedItems(id: string): ?FeedItemsCache {\n const cache = this.getCache();\n const cacheKey = this.getCacheKey(id);\n return cache.get(cacheKey);\n }\n\n /**\n * Sets the items in the cache\n *\n * @param {string} id - the cache id\n * @param {Array} items - the feed items to cache\n */\n setCachedItems(id: string, items: FeedItems) {\n const cache = this.getCache();\n const cacheKey = this.getCacheKey(id);\n cache.set(cacheKey, {\n errors: this.errors,\n items,\n });\n }\n\n /**\n * Gets the feed items\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {boolean} shouldRefreshCache - Optionally updates the cache\n * @param {Function} successCallback - the success callback which is called after data fetching is complete\n * @param {Function} errorCallback - the error callback which is called after data fetching is complete if there was an error\n * @param {Function} onError - the function to be called immediately after an error occurs\n * @param {Object} [options]- feature flips, etc\n * @param {Object} [options.shouldShowAppActivity] - feature flip the new app activity api\n */\n feedItems(\n file: BoxItem,\n shouldRefreshCache: boolean,\n successCallback: Function,\n errorCallback: (feedItems: FeedItems, errors: ElementsXhrError[]) => void,\n onError: ErrorCallback,\n {\n shouldShowAnnotations = false,\n shouldShowAppActivity = false,\n shouldShowReplies = false,\n shouldShowTasks = true,\n shouldShowVersions = true,\n shouldUseUAA = false,\n }: {\n shouldShowAnnotations?: boolean,\n shouldShowAppActivity?: boolean,\n shouldShowReplies?: boolean,\n shouldShowTasks?: boolean,\n shouldShowVersions?: boolean,\n shouldUseUAA?: boolean,\n } = {},\n ): void {\n const { id, permissions = {} } = file;\n const cachedItems = this.getCachedItems(id);\n if (cachedItems) {\n const { errors, items } = cachedItems;\n if (errors.length) {\n errorCallback(items, errors);\n } else {\n successCallback(items);\n }\n\n if (!shouldRefreshCache) {\n return;\n }\n }\n\n this.file = file;\n this.errors = [];\n this.errorCallback = onError;\n\n // Using the UAA File Activities endpoint replaces the need for these calls\n const annotationsPromise =\n !shouldUseUAA && shouldShowAnnotations\n ? this.fetchAnnotations(permissions, shouldShowReplies)\n : Promise.resolve();\n const commentsPromise = () => {\n if (shouldUseUAA) {\n return Promise.resolve();\n }\n\n return shouldShowReplies ? this.fetchThreadedComments(permissions) : this.fetchComments(permissions);\n };\n const tasksPromise = !shouldUseUAA && shouldShowTasks ? this.fetchTasksNew() : Promise.resolve();\n const appActivityPromise =\n !shouldUseUAA && shouldShowAppActivity ? this.fetchAppActivity(permissions) : Promise.resolve();\n\n const versionsPromise = shouldShowVersions ? this.fetchVersions() : Promise.resolve();\n const currentVersionPromise = shouldShowVersions ? this.fetchCurrentVersion() : Promise.resolve();\n\n const annotationActivityType =\n shouldShowAnnotations && permissions[PERMISSION_CAN_VIEW_ANNOTATIONS]\n ? [FILE_ACTIVITY_TYPE_ANNOTATION]\n : [];\n const appActivityActivityType = shouldShowAppActivity ? [FILE_ACTIVITY_TYPE_APP_ACTIVITY] : [];\n const taskActivityType = shouldShowTasks ? [FILE_ACTIVITY_TYPE_TASK] : [];\n const filteredActivityTypes = [\n ...annotationActivityType,\n ...appActivityActivityType,\n FILE_ACTIVITY_TYPE_COMMENT,\n ...taskActivityType,\n ];\n\n const fileActivitiesPromise = shouldUseUAA\n ? this.fetchFileActivities(permissions, filteredActivityTypes, shouldShowReplies)\n : Promise.resolve();\n\n const handleFeedItems = (feedItems: FeedItems) => {\n if (!this.isDestroyed()) {\n this.setCachedItems(id, feedItems);\n if (this.errors.length) {\n errorCallback(feedItems, this.errors);\n } else {\n successCallback(feedItems);\n }\n }\n };\n\n if (shouldUseUAA) {\n Promise.all([versionsPromise, currentVersionPromise, fileActivitiesPromise]).then(\n ([versions: ?FileVersions, currentVersion: ?BoxItemVersion, ...feedItems]) => {\n if (!feedItems || !feedItems.length) {\n return;\n }\n\n const fileActivitiesResponse = feedItems[0];\n const versionsWithCurrent = currentVersion\n ? this.versionsAPI.addCurrentVersion(currentVersion, versions, this.file)\n : undefined;\n const parsedFeedItems = getParsedFileActivitiesResponse(fileActivitiesResponse);\n // $FlowFixMe Does not need to be sorted once we include versions in the file activities call\n const sortedFeedItems = sortFeedItems(versionsWithCurrent, parsedFeedItems);\n handleFeedItems(sortedFeedItems);\n },\n );\n } else {\n Promise.all([\n versionsPromise,\n currentVersionPromise,\n commentsPromise(),\n tasksPromise,\n appActivityPromise,\n annotationsPromise,\n ]).then(([versions: ?FileVersions, currentVersion: ?BoxItemVersion, ...feedItems]) => {\n const versionsWithCurrent = currentVersion\n ? this.versionsAPI.addCurrentVersion(currentVersion, versions, this.file)\n : undefined;\n const sortedFeedItems = sortFeedItems(versionsWithCurrent, ...feedItems);\n handleFeedItems(sortedFeedItems);\n });\n }\n }\n\n fetchAnnotations(permissions: BoxItemPermission, shouldFetchReplies?: boolean): Promise<?Annotations> {\n this.annotationsAPI = new AnnotationsAPI(this.options);\n return new Promise(resolve => {\n this.annotationsAPI.getAnnotations(\n this.file.id,\n undefined,\n permissions,\n resolve,\n this.fetchFeedItemErrorCallback.bind(this, resolve),\n undefined,\n undefined,\n shouldFetchReplies,\n );\n });\n }\n\n /**\n * Fetches the comments for a file\n *\n * @param {Object} permissions - the file permissions\n * @return {Promise} - the file comments\n */\n fetchComments(permissions: BoxItemPermission): Promise<?Comments> {\n this.commentsAPI = new CommentsAPI(this.options);\n return new Promise(resolve => {\n this.commentsAPI.getComments(\n this.file.id,\n permissions,\n resolve,\n this.fetchFeedItemErrorCallback.bind(this, resolve),\n );\n });\n }\n\n /**\n * Fetches a comment for a file\n *\n * @param {BoxItem} file - The file to which the comment belongs to\n * @param {string} commentId - comment id\n * @param {Function} successCallback\n * @param {ErrorCallback} errorCallback\n * @return {Promise} - the file comments\n */\n fetchThreadedComment(\n file: BoxItem,\n commentId: string,\n successCallback: (comment: Comment) => void,\n errorCallback: ErrorCallback,\n ): Promise<?Comment> {\n const { id, permissions } = file;\n if (!id || !permissions) {\n throw getBadItemError();\n }\n\n this.threadedCommentsAPI = new ThreadedCommentsAPI(this.options);\n return new Promise(resolve => {\n this.threadedCommentsAPI.getComment({\n commentId,\n errorCallback,\n fileId: id,\n permissions,\n successCallback: this.fetchThreadedCommentSuccessCallback.bind(this, resolve, successCallback),\n });\n });\n }\n\n /**\n * Callback for successful fetch of a comment\n *\n * @param {Function} resolve - resolve function\n * @param {Function} successCallback - success callback\n * @param {Comment} comment - comment data\n * @return {void}\n */\n fetchThreadedCommentSuccessCallback = (resolve: Function, successCallback: Function, comment: Comment): void => {\n successCallback(comment);\n resolve();\n };\n\n /**\n * Fetches the comments with replies for a file\n *\n * @param {Object} permissions - the file permissions\n * @return {Promise} - the file comments\n */\n fetchThreadedComments(permissions: BoxItemPermission): Promise<?ThreadedCommentsType> {\n this.threadedCommentsAPI = new ThreadedCommentsAPI(this.options);\n return new Promise(resolve => {\n this.threadedCommentsAPI.getComments({\n errorCallback: this.fetchFeedItemErrorCallback.bind(this, resolve),\n fileId: this.file.id,\n permissions,\n successCallback: resolve,\n });\n });\n }\n\n /**\n * Fetches the file activities for a file\n *\n * @param {BoxItemPermission} permissions - the file permissions\n * @param {FileActivityTypes[]} activityTypes - the activity types to filter by\n * @param {boolean} shouldShowReplies - specify if replies should be included in the response\n * @return {Promise} - the file comments\n */\n fetchFileActivities(\n permissions: BoxItemPermission,\n activityTypes: FileActivityTypes[],\n shouldShowReplies?: boolean = false,\n ): Promise<Object> {\n this.fileActivitiesAPI = new FileActivitiesAPI(this.options);\n return new Promise(resolve => {\n this.fileActivitiesAPI.getActivities({\n errorCallback: this.fetchFeedItemErrorCallback.bind(this, resolve),\n fileID: this.file.id,\n permissions,\n successCallback: resolve,\n activityTypes,\n shouldShowReplies,\n });\n });\n }\n\n /**\n * Fetches replies (comments) of a comment or annotation\n *\n * @param {BoxItem} file - The file to which the comment or annotation belongs to\n * @param {string} commentFeedItemId - ID of the comment or annotation\n * @param {CommentFeedItemType} commentFeedItemType - Type of the comment or annotation\n * @param {Function} successCallback\n * @param {ErrorCallback} errorCallback\n * @return {void}\n */\n fetchReplies(\n file: BoxItem,\n commentFeedItemId: string,\n commentFeedItemType: CommentFeedItemType,\n successCallback: (comments: Array<Comment>) => void,\n errorCallback: ErrorCallback,\n ): void {\n const { id, permissions } = file;\n if (!id || !permissions) {\n throw getBadItemError();\n }\n\n this.file = file;\n this.errorCallback = errorCallback;\n\n this.updateFeedItem({ isRepliesLoading: true }, commentFeedItemId);\n\n const successCallbackFn = ({ entries }: ThreadedCommentsType) => {\n this.updateFeedItem(\n { isRepliesLoading: false, replies: entries, total_reply_count: entries.length },\n commentFeedItemId,\n );\n successCallback(entries);\n };\n const errorCallbackFn = (error: ErrorResponseData, code: string) => {\n this.fetchRepliesErrorCallback(error, code, commentFeedItemId);\n };\n\n if (commentFeedItemType === FEED_ITEM_TYPE_ANNOTATION) {\n this.annotationsAPI = new AnnotationsAPI(this.options);\n\n this.annotationsAPI.getAnnotationReplies(\n file.id,\n commentFeedItemId,\n permissions,\n successCallbackFn,\n errorCallbackFn,\n );\n } else if (commentFeedItemType === FEED_ITEM_TYPE_COMMENT) {\n this.threadedCommentsAPI = new ThreadedCommentsAPI(this.options);\n\n this.threadedCommentsAPI.getCommentReplies({\n fileId: file.id,\n commentId: commentFeedItemId,\n permissions,\n successCallback: successCallbackFn,\n errorCallback: errorCallbackFn,\n });\n }\n }\n\n /**\n * Fetches the versions for a file\n *\n * @return {Promise} - the file versions\n */\n fetchVersions(): Promise<?FileVersions> {\n this.versionsAPI = new VersionsAPI(this.options);\n\n return new Promise(resolve => {\n this.versionsAPI.getVersions(\n this.file.id,\n resolve,\n this.fetchFeedItemErrorCallback.bind(this, resolve),\n undefined,\n undefined,\n FEED_FILE_VERSIONS_FIELDS_TO_FETCH,\n );\n });\n }\n\n /**\n * Fetches the current version for a file\n *\n * @return {Promise} - the file versions\n */\n fetchCurrentVersion(): Promise<?BoxItemVersion> {\n this.versionsAPI = new VersionsAPI(this.options);\n\n return new Promise(resolve => {\n const { file_version = {} } = this.file;\n this.versionsAPI.getVersion(\n this.file.id,\n file_version.id,\n resolve,\n this.fetchFeedItemErrorCallback.bind(this, resolve),\n );\n });\n }\n\n /**\n * Fetches the tasks for a file\n *\n * @return {Promise} - the feed items\n */\n fetchTasksNew(): Promise<?Tasks> {\n this.tasksNewAPI = new TasksNewAPI(this.options);\n\n return new Promise(resolve => {\n this.tasksNewAPI.getTasksForFile({\n file: { id: this.file.id },\n successCallback: resolve,\n errorCallback: (err, code) => this.fetchFeedItemErrorCallback(resolve, err, code),\n });\n });\n }\n\n /**\n * Error callback for fetching feed items.\n * Should only call the error callback if the response is a 401, 429 or >= 500\n *\n * @param {Function} resolve - the function which will be called on error\n * @param {Object} e - the axios error\n * @param {string} code - the error code\n * @return {void}\n */\n fetchFeedItemErrorCallback(resolve: Function, e: ElementsXhrError, code: string) {\n const { status } = e;\n const shouldDisplayError = isUserCorrectableError(status);\n this.feedErrorCallback(shouldDisplayError, e, code);\n resolve();\n }\n\n /**\n * Updates a task assignment\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {string} taskId - ID of task to be updated\n * @param {string} taskCollaboratorId - Task assignment ID\n * @param {TaskCollabStatus} taskCollaboratorStatus - New task assignment status\n * @param {Function} successCallback - the function which will be called on success\n * @param {Function} errorCallback - the function which will be called on error\n * @return {void}\n */\n updateTaskCollaborator = (\n file: BoxItem,\n taskId: string,\n taskCollaboratorId: string,\n taskCollaboratorStatus: TaskCollabStatus,\n successCallback: Function,\n errorCallback: ErrorCallback,\n ): void => {\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n this.errorCallback = errorCallback;\n this.updateFeedItem({ isPending: true }, taskId);\n const collaboratorsApi = new TaskCollaboratorsAPI(this.options);\n this.taskCollaboratorsAPI.push(collaboratorsApi);\n const taskCollaboratorPayload = {\n id: taskCollaboratorId,\n status: taskCollaboratorStatus,\n };\n const handleError = (e: ElementsXhrError, code: string) => {\n let errorMessage;\n switch (taskCollaboratorStatus) {\n case TASK_NEW_APPROVED:\n errorMessage = messages.taskApproveErrorMessage;\n break;\n case TASK_NEW_COMPLETED:\n errorMessage = messages.taskCompleteErrorMessage;\n break;\n case TASK_NEW_REJECTED:\n errorMessage = messages.taskRejectErrorMessage;\n break;\n default:\n errorMessage = messages.taskCompleteErrorMessage;\n }\n this.updateFeedItem(this.createFeedError(errorMessage, messages.taskActionErrorTitle), taskId);\n this.feedErrorCallback(true, e, code);\n };\n collaboratorsApi.updateTaskCollaborator({\n file,\n taskCollaborator: taskCollaboratorPayload,\n successCallback: (taskCollab: TaskCollabAssignee) => {\n this.updateTaskCollaboratorSuccessCallback(taskId, file, taskCollab, successCallback, handleError);\n },\n errorCallback: handleError,\n });\n };\n\n /**\n * Updates the task assignment state of the updated task\n *\n * @param {string} taskId - Box task id\n * @param {TaskAssignment} updatedCollaborator - New task assignment from API\n * @param {Function} successCallback - the function which will be called on success\n * @return {void}\n */\n updateTaskCollaboratorSuccessCallback = (\n taskId: string,\n file: { id: string },\n updatedCollaborator: TaskCollabAssignee,\n successCallback: Function,\n errorCallback: Function,\n ): void => {\n this.tasksNewAPI = new TasksNewAPI(this.options);\n this.tasksNewAPI.getTask({\n id: taskId,\n file,\n successCallback: task => {\n this.updateFeedItem({ ...task, isPending: false }, taskId);\n successCallback(updatedCollaborator);\n },\n errorCallback,\n });\n };\n\n /**\n * Updates a task in the new API\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {string} task - The update task payload object\n * @param {Function} successCallback - the function which will be called on success\n * @param {Function} errorCallback - the function which will be called on error\n * @return {void}\n */\n updateTaskNew = async (\n file: BoxItem,\n task: TaskUpdatePayload,\n successCallback: () => void = noop,\n errorCallback: ErrorCallback = noop,\n ) => {\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n this.errorCallback = errorCallback;\n this.tasksNewAPI = new TasksNewAPI(this.options);\n this.updateFeedItem({ isPending: true }, task.id);\n\n try {\n // create request for the size of each group by ID\n // TODO: use async/await for both creating and editing tasks\n const groupInfoPromises: Array<Promise<any>> = task.addedAssignees\n .filter(\n (assignee: SelectorItem<UserMini | GroupMini>) => assignee.item && assignee.item.type === 'group',\n )\n .map(assignee => assignee.id)\n .map(groupId => {\n return new GroupsAPI(this.options).getGroupCount({\n file,\n group: { id: groupId },\n });\n });\n\n const groupCounts: Array<{ total_count: number }> = await Promise.all(groupInfoPromises);\n const hasAnyGroupCountExceeded: boolean = groupCounts.some(\n groupInfo => groupInfo.total_count > TASK_MAX_GROUP_ASSIGNEES,\n );\n const warning = {\n code: ERROR_CODE_GROUP_EXCEEDS_LIMIT,\n type: 'warning',\n };\n\n if (hasAnyGroupCountExceeded) {\n this.feedErrorCallback(false, warning, ERROR_CODE_GROUP_EXCEEDS_LIMIT);\n return;\n }\n\n await new Promise((resolve, reject) => {\n this.tasksNewAPI.updateTaskWithDeps({\n file,\n task,\n successCallback: resolve,\n errorCallback: reject,\n });\n });\n\n await new Promise((resolve, reject) => {\n this.tasksNewAPI.getTask({\n file,\n id: task.id,\n successCallback: (taskData: Task) => {\n this.updateFeedItem(\n {\n ...taskData,\n isPending: false,\n },\n task.id,\n );\n\n resolve();\n },\n errorCallback: (e: ElementsXhrError) => {\n this.updateFeedItem({ isPending: false }, task.id);\n this.feedErrorCallback(false, e, ERROR_CODE_UPDATE_TASK);\n reject();\n },\n });\n });\n\n // everything succeeded, so call the passed in success callback\n if (!this.isDestroyed()) {\n successCallback();\n }\n } catch (e) {\n this.updateFeedItem({ isPending: false }, task.id);\n this.feedErrorCallback(false, e, ERROR_CODE_UPDATE_TASK);\n }\n };\n\n /**\n * Deletes a comment.\n *\n * @param {BoxItem} file - The file to which the comment belongs to\n * @param {string} commentId - Comment ID\n * @param {BoxCommentPermission} permissions - Permissions for the comment\n * @param {Function} successCallback - the function which will be called on success\n * @param {Function} errorCallback - the function which will be called on error\n * @return {void}\n */\n deleteComment = (\n file: BoxItem,\n commentId: string,\n permissions: BoxCommentPermission,\n successCallback: Function,\n errorCallback: ErrorCallback,\n ): void => {\n this.commentsAPI = new CommentsAPI(this.options);\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n this.errorCallback = errorCallback;\n this.updateFeedItem({ isPending: true }, commentId);\n\n this.commentsAPI.deleteComment({\n file,\n commentId,\n permissions,\n successCallback: this.deleteFeedItem.bind(this, commentId, successCallback),\n errorCallback: (e: ElementsXhrError, code: string) => {\n this.deleteCommentErrorCallback(e, code, commentId);\n },\n });\n };\n\n /**\n * Deletes a threaded comment (using ThreadedComments API).\n *\n * @param {BoxItem} file - The file to which the comment belongs to\n * @param {string} commentId - Comment ID\n * @param {BoxCommentPermission} permissions - Permissions for the comment\n * @param {Function} successCallback - the function which will be called on success\n * @param {Function} errorCallback - the function which will be called on error\n * @return {void}\n */\n deleteThreadedComment = (\n file: BoxItem,\n commentId: string,\n permissions: BoxCommentPermission,\n successCallback: Function,\n errorCallback: ErrorCallback,\n ): void => {\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n this.errorCallback = errorCallback;\n this.updateFeedItem({ isPending: true }, commentId);\n\n this.threadedCommentsAPI = new ThreadedCommentsAPI(this.options);\n\n this.threadedCommentsAPI.deleteComment({\n fileId: file.id,\n commentId,\n permissions,\n successCallback: this.deleteFeedItem.bind(this, commentId, successCallback),\n errorCallback: (e: ElementsXhrError, code: string) => {\n this.deleteCommentErrorCallback(e, code, commentId);\n },\n });\n };\n\n /**\n * Deletes a reply (using ThreadedComments API).\n *\n * @param {BoxItem} file - The file to which the comment belongs to\n * @param {string} id - id of the reply (comment)\n * @param {string} parentId - id of the parent feed item\n * @param {BoxCommentPermission} permissions - Permissions for the comment\n * @param {Function} successCallback - the function which will be called on success\n * @param {Function} errorCallback - the function which will be called on error\n * @return {void}\n */\n deleteReply = (\n file: BoxItem,\n id: string,\n parentId: string,\n permissions: BoxCommentPermission,\n successCallback: () => void,\n errorCallback: ErrorCallback,\n ): void => {\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n this.errorCallback = errorCallback;\n this.updateReplyItem({ isPending: true }, parentId, id);\n\n this.threadedCommentsAPI = new ThreadedCommentsAPI(this.options);\n\n this.threadedCommentsAPI.deleteComment({\n fileId: file.id,\n commentId: id,\n permissions,\n successCallback: this.deleteReplySuccessCallback.bind(this, id, parentId, successCallback),\n errorCallback: (e: ElementsXhrError, code: string) => {\n this.deleteReplyErrorCallback(e, code, id, parentId);\n },\n });\n };\n\n /**\n * Callback for successful deletion of a reply.\n *\n * @param {string} id - ID of the reply\n * @param {string} parentId - ID of the parent feed item\n * @param {Function} successCallback - success callback\n * @return {void}\n */\n deleteReplySuccessCallback = (id: string, parentId: string, successCallback: Function): void => {\n this.modifyFeedItemRepliesCountBy(parentId, -1);\n this.deleteReplyItem(id, parentId, successCallback);\n };\n\n /**\n * Error callback for deleting a comment\n *\n * @param {ElementsXhrError} e - the error returned by the API\n * @param {string} code - the error code\n * @param {string} commentId - the comment id\n * @return {void}\n */\n deleteCommentErrorCallback = (e: ElementsXhrError, code: string, commentId: string) => {\n this.updateFeedItem(this.createFeedError(messages.commentDeleteErrorMessage), commentId);\n this.feedErrorCallback(true, e, code);\n };\n\n /**\n * Error callback for deleting a reply\n *\n * @param {ElementsXhrError} error - the error returned by the API\n * @param {string} code - the error code\n * @param {string} id - the reply (comment) id\n * @param {string} parentId - the comment id of the parent feed item\n * @return {void}\n */\n deleteReplyErrorCallback = (error: ElementsXhrError, code: string, id: string, parentId: string) => {\n this.updateReplyItem(this.createFeedError(messages.commentDeleteErrorMessage), parentId, id);\n this.feedErrorCallback(true, error, code);\n };\n\n /**\n * Creates a task.\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {Object} currentUser - the user who performed the action\n * @param {string} message - Task text\n * @param {Array} assignees - List of assignees\n * @param {number} dueAt - Task's due date\n * @param {Function} successCallback - the function which will be called on success\n * @param {Function} errorCallback - the function which will be called on error\n * @return {void}\n */\n createTaskNew = (\n file: BoxItem,\n currentUser: User,\n message: string,\n assignees: SelectorItems<>,\n taskType: TaskType,\n dueAt: ?string,\n completionRule: TaskCompletionRule,\n successCallback: Function,\n errorCallback: ErrorCallback,\n ): void => {\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n this.errorCallback = errorCallback;\n const uuid = uniqueId('task_');\n let dueAtString;\n if (dueAt) {\n const dueAtDate: Date = new Date(dueAt);\n dueAtString = dueAtDate.toISOString();\n }\n\n // TODO: make pending task generator a function\n const pendingTask: TaskNew = {\n created_by: {\n type: 'task_collaborator',\n target: currentUser,\n id: uniqueId(),\n role: 'CREATOR',\n status: TASK_NEW_INITIAL_STATUS,\n },\n completion_rule: completionRule,\n created_at: new Date().toISOString(),\n due_at: dueAtString,\n id: uuid,\n description: message,\n type: FEED_ITEM_TYPE_TASK,\n assigned_to: {\n entries: assignees.map((assignee: SelectorItem<UserMini | GroupMini>) => ({\n id: uniqueId(),\n target: { ...assignee, avatar_url: '', type: 'user' },\n status: TASK_NEW_INITIAL_STATUS,\n permissions: {\n can_delete: false,\n can_update: false,\n },\n role: 'ASSIGNEE',\n type: 'task_collaborator',\n })),\n limit: 10,\n next_marker: null,\n },\n permissions: {\n can_update: false,\n can_delete: false,\n can_create_task_collaborator: false,\n can_create_task_link: false,\n },\n task_links: {\n entries: [\n {\n id: uniqueId(),\n type: 'task_link',\n target: {\n type: 'file',\n ...file,\n },\n permissions: {\n can_delete: false,\n can_update: false,\n },\n },\n ],\n limit: 1,\n next_marker: null,\n },\n task_type: taskType,\n status: TASK_NEW_NOT_STARTED,\n };\n\n const taskPayload: TaskPayload = {\n description: message,\n due_at: dueAtString,\n task_type: taskType,\n completion_rule: completionRule,\n };\n\n // create request for the size of each group by ID\n const groupInfoPromises: Array<Promise<any>> = assignees\n .filter((assignee: SelectorItem<UserMini | GroupMini>) => (assignee.item && assignee.item.type) === 'group')\n .map(assignee => assignee.id)\n .map(groupId => {\n return new GroupsAPI(this.options).getGroupCount({\n file,\n group: { id: groupId },\n });\n });\n\n // Fetch each group size in parallel --> return an array of group sizes\n Promise.all(groupInfoPromises)\n .then((groupCounts: Array<{ total_count: number }>) => {\n const hasAnyGroupCountExceeded: boolean = groupCounts.some(\n groupInfo => groupInfo.total_count > TASK_MAX_GROUP_ASSIGNEES,\n );\n const warning = {\n code: ERROR_CODE_GROUP_EXCEEDS_LIMIT,\n type: 'warning',\n };\n if (hasAnyGroupCountExceeded) {\n this.feedErrorCallback(false, warning, ERROR_CODE_GROUP_EXCEEDS_LIMIT);\n return;\n }\n\n this.tasksNewAPI = new TasksNewAPI(this.options);\n this.tasksNewAPI.createTaskWithDeps({\n file,\n task: taskPayload,\n assignees,\n successCallback: (taskWithDepsData: any) => {\n this.addPendingItem(this.file.id, currentUser, pendingTask);\n this.updateFeedItem(\n {\n ...taskWithDepsData,\n task_links: {\n entries: taskWithDepsData.task_links,\n next_marker: null,\n limit: 1,\n },\n assigned_to: {\n entries: taskWithDepsData.assigned_to,\n next_marker: null,\n limit: taskWithDepsData.assigned_to.length,\n },\n isPending: false,\n },\n uuid,\n );\n successCallback(taskWithDepsData);\n },\n errorCallback: (e: ElementsXhrError, code: string) => {\n this.feedErrorCallback(false, e, code);\n },\n });\n })\n .catch(error => {\n this.feedErrorCallback(false, error, ERROR_CODE_CREATE_TASK);\n });\n };\n\n /**\n * Creates a task group via the API.\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {Task|TaskUpdatePayload} task - The newly created or existing task from the API\n * @param {SelectorItem} assignee - The user assigned to this task\n * @param {Function} errorCallback - Task create error callback\n * @return {Promise<TaskAssignment>}\n */\n createTaskCollaboratorsforGroup(\n file: BoxItem,\n task: Task | TaskUpdatePayload,\n assignee: SelectorItem<UserMini | GroupMini>,\n ): Promise<Array<TaskCollabAssignee>> {\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n return new Promise((resolve, reject) => {\n const taskCollaboratorsAPI = new TaskCollaboratorsAPI(this.options);\n this.taskCollaboratorsAPI.push(taskCollaboratorsAPI);\n taskCollaboratorsAPI.createTaskCollaboratorsforGroup({\n file,\n task,\n group: assignee,\n successCallback: resolve,\n errorCallback: (e: ElementsXhrError) => {\n reject(e);\n },\n });\n });\n }\n\n /**\n * Creates a task collaborator via the API.\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {Task|TaskUpdatePayload} task - The newly created or existing task from the API\n * @param {SelectorItem} assignee - The user assigned to this task\n * @param {Function} errorCallback - Task create error callback\n * @return {Promise<TaskAssignment>}\n */\n createTaskCollaborator(\n file: BoxItem,\n task: Task | TaskUpdatePayload,\n assignee: SelectorItem<UserMini | GroupMini>,\n ): Promise<TaskCollabAssignee> {\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n return new Promise((resolve, reject) => {\n const taskCollaboratorsAPI = new TaskCollaboratorsAPI(this.options);\n this.taskCollaboratorsAPI.push(taskCollaboratorsAPI);\n\n taskCollaboratorsAPI.createTaskCollaborator({\n file,\n task,\n user: assignee,\n successCallback: resolve,\n errorCallback: (e: ElementsXhrError) => {\n reject(e);\n },\n });\n });\n }\n\n /**\n * Deletes a task collaborator via the API.\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {Task|TaskUpdatePayload} task - The newly deleted or existing task from the API\n * @param {TaskCollabAssignee} assignee - The user assigned to this task\n * @param {Function} errorCallback - Task delete error callback\n * @return {Promise<TaskAssignment>}\n */\n deleteTaskCollaborator(\n file: BoxItem,\n task: Task | TaskUpdatePayload,\n assignee: TaskCollabAssignee,\n ): Promise<TaskCollabAssignee> {\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file.id = file.id;\n return new Promise((resolve, reject) => {\n const taskCollaboratorsAPI = new TaskCollaboratorsAPI(this.options);\n this.taskCollaboratorsAPI.push(taskCollaboratorsAPI);\n\n taskCollaboratorsAPI.deleteTaskCollaborator({\n file,\n task,\n taskCollaborator: { id: assignee.id },\n successCallback: resolve,\n errorCallback: (e: ElementsXhrError) => {\n reject(e);\n },\n });\n });\n }\n\n /**\n * Creates a task link via the API.\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {Task} task - The newly created task from the API\n * @param {Function} errorCallback - Task create error callback\n * @return {Promise<TaskAssignment}\n */\n createTaskLink(file: BoxItem, task: Task): Promise<TaskLink> {\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n return new Promise((resolve, reject) => {\n const taskLinksAPI = new TaskLinksAPI(this.options);\n this.taskLinksAPI.push(taskLinksAPI);\n\n taskLinksAPI.createTaskLink({\n file,\n task,\n successCallback: resolve,\n errorCallback: reject,\n });\n });\n }\n\n /**\n * Deletes a task in the new API\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {string} taskId - The task's id\n * @param {Function} successCallback - the function which will be called on success\n * @param {Function} errorCallback - the function which will be called on error\n * @return {void}\n */\n deleteTaskNew = (\n file: BoxItem,\n task: TaskNew,\n successCallback: (taskId: string) => void = noop,\n errorCallback: ErrorCallback = noop,\n ) => {\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n this.errorCallback = errorCallback;\n this.tasksNewAPI = new TasksNewAPI(this.options);\n this.updateFeedItem({ isPending: true }, task.id);\n\n this.tasksNewAPI.deleteTask({\n file,\n task,\n successCallback: this.deleteFeedItem.bind(this, task.id, successCallback),\n errorCallback: (e: ElementsXhrError, code: string) => {\n this.updateFeedItem(this.createFeedError(messages.taskDeleteErrorMessage), task.id);\n this.feedErrorCallback(true, e, code);\n },\n });\n };\n\n /**\n * Deletes a feed item from the cache\n *\n * @param {string} id - The id of the feed item to be deleted\n * @param {Function} successCallback - function to be called after the delete\n */\n deleteFeedItem = (id: string, successCallback: Function = noop) => {\n const cachedItems = this.getCachedItems(this.file.id);\n if (cachedItems) {\n const feedItems = cachedItems.items.filter(feedItem => feedItem.id !== id);\n this.setCachedItems(this.file.id, feedItems);\n\n if (!this.isDestroyed()) {\n successCallback(id);\n }\n }\n };\n\n /**\n * Deletes a reply from the cache\n *\n * @param {string} id - The id of the feed item to be deleted\n * @param {string} parentId - The id of the parent feed item\n * @param {Function} successCallback - function to be called after the delete\n */\n deleteReplyItem = (\n id: string,\n parentId: string,\n successCallback: (id: string, parentId: string) => void = noop,\n ) => {\n const cachedItems = this.getCachedItems(this.file.id) || { items: [], errors: [] };\n const feedItems = cachedItems.items.map(item => {\n if (item.id !== parentId) {\n return item;\n }\n if (item.type === FEED_ITEM_TYPE_ANNOTATION) {\n return getItemWithFilteredReplies<Annotation>(item, id);\n }\n if (item.type === FEED_ITEM_TYPE_COMMENT) {\n return getItemWithFilteredReplies<Comment>(item, id);\n }\n return item;\n });\n this.setCachedItems(this.file.id, feedItems);\n\n if (!this.isDestroyed()) {\n successCallback(id, parentId);\n }\n };\n\n /**\n * Network error callback\n *\n * @param {boolean} hasError - true if the UI should display an error\n * @param {ElementsXhrError} e - the error returned by the API\n * @param {string} code - the error code for the error which occured\n * @return {void}\n */\n feedErrorCallback = (hasError: boolean = false, e: ElementsXhrError, code: string): void => {\n if (hasError) {\n this.errors.push({ ...e, code });\n }\n\n if (!this.isDestroyed() && this.errorCallback) {\n this.errorCallback(e, code, {\n error: e,\n [IS_ERROR_DISPLAYED]: hasError,\n });\n }\n\n console.error(e); // eslint-disable-line no-console\n };\n\n /**\n * Add a placeholder pending feed item.\n *\n * @param {string} id - the file id\n * @param {Object} currentUser - the user who performed the action\n * @param {Object} itemBase - Base properties for item to be added to the feed as pending.\n * @return {void}\n */\n addPendingItem = (id: string, currentUser: User, itemBase: Object): Comment | Task | TaskNew | BoxItemVersion => {\n if (!currentUser) {\n throw getBadUserError();\n }\n\n const date = new Date().toISOString();\n const pendingFeedItem = {\n created_at: date,\n created_by: currentUser,\n modified_at: date,\n isPending: true,\n ...itemBase,\n };\n const cachedItems = this.getCachedItems(this.file.id);\n const feedItems = cachedItems ? cachedItems.items : [];\n const feedItemsWithPendingItem = [...feedItems, pendingFeedItem];\n this.setCachedItems(id, feedItemsWithPendingItem);\n\n return pendingFeedItem;\n };\n\n /**\n * Add a placeholder pending comment (reply).\n *\n * @param {string} parentId - id of parent comment or annotation\n * @param {Object} currentUser - the user who performed the action\n * @param {Object} commentBase - Base properties for reply (comment) to be added to the feed as pending.\n * @return {Comment} - newly created pending reply\n */\n addPendingReply = (parentId: string, currentUser: User, commentBase: Object): Comment => {\n if (!this.file.id) {\n throw getBadItemError();\n }\n if (!currentUser) {\n throw getBadUserError();\n }\n\n const date = new Date().toISOString();\n const pendingReply: Comment = {\n created_at: date,\n created_by: currentUser,\n modified_at: date,\n isPending: true,\n ...commentBase,\n };\n\n const cachedItems = this.getCachedItems(this.file.id);\n if (cachedItems) {\n const updatedFeedItems = cachedItems.items.map(item => {\n if (item.id === parentId && item.type === FEED_ITEM_TYPE_COMMENT) {\n return getItemWithPendingReply<Comment>(item, pendingReply);\n }\n if (item.id === parentId && item.type === FEED_ITEM_TYPE_ANNOTATION) {\n return getItemWithPendingReply<Annotation>(item, pendingReply);\n }\n return item;\n });\n\n this.setCachedItems(this.file.id, updatedFeedItems);\n }\n\n return pendingReply;\n };\n\n /**\n * Callback for successful creation of a Comment.\n *\n * @param {Comment} commentData - API returned Comment\n * @param {string} id - ID of the feed item to update with the new comment data\n * @return {void}\n */\n createCommentSuccessCallback = (commentData: Comment, id: string, successCallback: Function): void => {\n const { message = '', tagged_message = '' } = commentData;\n // Comment component uses tagged_message only\n commentData.tagged_message = tagged_message || message;\n\n this.updateFeedItem(\n {\n ...commentData,\n isPending: false,\n },\n id,\n );\n\n if (!this.isDestroyed()) {\n successCallback(commentData);\n }\n };\n\n /**\n * Callback for failed creation of a Comment.\n *\n * @param {Object} e - The axios error\n * @param {string} code - the error code\n * @param {string} id - ID of the feed item to update\n * @return {void}\n */\n createCommentErrorCallback = (e: ElementsXhrError, code: string, id: string) => {\n const errorMessage =\n e.status === HTTP_STATUS_CODE_CONFLICT\n ? messages.commentCreateConflictMessage\n : messages.commentCreateErrorMessage;\n this.updateFeedItem(this.createFeedError(errorMessage), id);\n this.feedErrorCallback(false, e, code);\n };\n\n /**\n * Callback for successful creation of a Comment.\n *\n * @param {Comment} commentData - API returned Comment\n * @param {string} parentId - ID of the parent feed item\n * @param {string} id - ID of the reply to update with the new comment data\n * @param {Function} successCallback - success callback\n * @return {void}\n */\n createReplySuccessCallback = (\n commentData: Comment,\n parentId: string,\n id: string,\n successCallback: Function,\n ): void => {\n this.updateReplyItem(\n {\n ...commentData,\n isPending: false,\n },\n parentId,\n id,\n );\n\n if (!this.isDestroyed()) {\n successCallback(commentData);\n }\n };\n\n /**\n * Callback for failed creation of a reply.\n *\n * @param {ElementsXhrError} error - The axios error\n * @param {string} code - the error code\n * @param {string} parentId - ID of the parent feed item\n * @param {string} id - ID of the feed item to update\n * @return {void}\n */\n createReplyErrorCallback = (error: ElementsXhrError, code: string, parentId: string, id: string) => {\n const errorMessage =\n error.status === HTTP_STATUS_CODE_CONFLICT\n ? messages.commentCreateConflictMessage\n : messages.commentCreateErrorMessage;\n this.updateReplyItem(this.createFeedError(errorMessage), parentId, id);\n this.feedErrorCallback(false, error, code);\n };\n\n /**\n * Constructs an error object that renders to an inline feed error\n *\n * @param {string} message - The error message body.\n * @param {string} title - The error message title.\n * @return {Object} An error message object\n */\n createFeedError(message: MessageDescriptor, title: MessageDescriptor = commonMessages.errorOccured) {\n return {\n error: { message, title },\n };\n }\n\n /**\n * Replace a feed item with new feed item data.\n *\n * @param {Object} updates - The new data to be applied to the feed item.\n * @param {string} id - ID of the feed item to replace.\n * @return {void}\n */\n updateFeedItem = (updates: Object, id: string): ?FeedItems => {\n if (!this.file.id) {\n throw getBadItemError();\n }\n\n const cachedItems = this.getCachedItems(this.file.id);\n if (cachedItems) {\n const updatedFeedItems = cachedItems.items.map((item: FeedItem) => {\n if (item.id === id) {\n return {\n ...item,\n ...updates,\n };\n }\n\n return item;\n });\n\n this.setCachedItems(this.file.id, updatedFeedItems);\n return updatedFeedItems;\n }\n\n return null;\n };\n\n /**\n * Replace a reply of feed item with new comment data.\n *\n * @param {Object} replyUpdates - New data to be applied to the reply.\n * @param {string} parentId - ID of the parent feed item.\n * @param {string} id - ID of the reply to replace.\n * @return {void}\n */\n updateReplyItem = (replyUpdates: Object, parentId: string, id: string) => {\n if (!this.file.id) {\n throw getBadItemError();\n }\n\n const getItemWithUpdatedReply = <T: { replies?: Array<Comment> }>(\n item: T,\n replyId: string,\n updates: Object,\n ): T => {\n const updatedItem: T = { ...item };\n if (updatedItem.replies) {\n updatedItem.replies = updatedItem.replies.map(reply => {\n if (reply.id === replyId) {\n return {\n ...reply,\n ...updates,\n };\n }\n return reply;\n });\n }\n return updatedItem;\n };\n\n const cachedItems = this.getCachedItems(this.file.id);\n if (cachedItems) {\n const updatedFeedItems = cachedItems.items.map((item: FeedItem) => {\n if (item.id === parentId && item.type === FEED_ITEM_TYPE_COMMENT) {\n return getItemWithUpdatedReply<Comment>(item, id, replyUpdates);\n }\n if (item.id === parentId && item.type === FEED_ITEM_TYPE_ANNOTATION) {\n return getItemWithUpdatedReply<Annotation>(item, id, replyUpdates);\n }\n return item;\n });\n\n this.setCachedItems(this.file.id, updatedFeedItems);\n }\n };\n\n /**\n * Create a comment, and make a pending item to be replaced once the API is successful.\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {Object} currentUser - the user who performed the action\n * @param {string} text - the comment text\n * @param {boolean} hasMention - true if there is an @mention in the text\n * @param {Function} successCallback - the success callback\n * @param {Function} errorCallback - the error callback\n * @return {void}\n */\n createComment = (\n file: BoxItem,\n currentUser: User,\n text: string,\n hasMention: boolean,\n successCallback: Function,\n errorCallback: ErrorCallback,\n ): void => {\n const uuid = uniqueId('comment_');\n const commentData = {\n id: uuid,\n tagged_message: text,\n type: FEED_ITEM_TYPE_COMMENT,\n };\n\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n this.errorCallback = errorCallback;\n this.addPendingItem(this.file.id, currentUser, commentData);\n\n const message = {};\n if (hasMention) {\n message.taggedMessage = text;\n } else {\n message.message = text;\n }\n\n this.commentsAPI = new CommentsAPI(this.options);\n\n this.commentsAPI.createComment({\n file,\n ...message,\n successCallback: (comment: Comment) => {\n this.createCommentSuccessCallback(comment, uuid, successCallback);\n },\n errorCallback: (e: ErrorResponseData, code: string) => {\n this.createCommentErrorCallback(e, code, uuid);\n },\n });\n };\n\n /**\n * Create a threaded comment (using ThreadedComments API),\n * and make a pending item to be replaced once the API is successful.\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {Object} currentUser - the user who performed the action\n * @param {string} text - the comment text\n * @param {Function} successCallback - the success callback\n * @param {Function} errorCallback - the error callback\n * @return {void}\n */\n createThreadedComment = (\n file: BoxItem,\n currentUser: User,\n text: string,\n successCallback: Function,\n errorCallback: ErrorCallback,\n ): void => {\n if (!file.id) {\n throw getBadItemError();\n }\n\n const uuid = uniqueId('comment_');\n const commentData = {\n id: uuid,\n tagged_message: text,\n type: FEED_ITEM_TYPE_COMMENT,\n };\n\n this.file = file;\n this.errorCallback = errorCallback;\n this.addPendingItem(this.file.id, currentUser, commentData);\n\n this.threadedCommentsAPI = new ThreadedCommentsAPI(this.options);\n\n this.threadedCommentsAPI.createComment({\n file,\n message: text,\n successCallback: (comment: Comment) => {\n this.createCommentSuccessCallback(comment, uuid, successCallback);\n },\n errorCallback: (e: ErrorResponseData, code: string) => {\n this.createCommentErrorCallback(e, code, uuid);\n },\n });\n };\n\n /**\n * Create a reply to annotation or comment, and make a pending item to be replaced once the API is successful.\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {Object} currentUser - the user who performed the action\n * @param {string} parentId - id of the parent item\n * @param {CommentFeedItemType} parentType - type of the parent item\n * @param {string} text - the comment text\n * @param {Function} successCallback - the success callback\n * @param {Function} errorCallback - the error callback\n * @return {void}\n */\n createReply(\n file: BoxItem,\n currentUser: User,\n parentId: string,\n parentType: CommentFeedItemType,\n text: string,\n successCallback: Function,\n errorCallback: ErrorCallback,\n ): void {\n const { id, permissions } = file;\n if (!id || !permissions) {\n throw getBadItemError();\n }\n\n const uuid = uniqueId('comment_');\n const commentData = {\n id: uuid,\n tagged_message: text,\n type: FEED_ITEM_TYPE_COMMENT,\n };\n\n this.file = file;\n this.errorCallback = errorCallback;\n this.addPendingReply(parentId, currentUser, commentData);\n this.modifyFeedItemRepliesCountBy(parentId, 1);\n\n const successCallbackFn = (comment: Comment) => {\n this.createReplySuccessCallback(comment, parentId, uuid, successCallback);\n };\n const errorCallbackFn = (error: ErrorResponseData, code: string) => {\n this.createReplyErrorCallback(error, code, parentId, uuid);\n };\n\n if (parentType === FEED_ITEM_TYPE_ANNOTATION) {\n this.annotationsAPI = new AnnotationsAPI(this.options);\n\n this.annotationsAPI.createAnnotationReply(\n file.id,\n parentId,\n permissions,\n text,\n successCallbackFn,\n errorCallbackFn,\n );\n } else if (parentType === FEED_ITEM_TYPE_COMMENT) {\n this.threadedCommentsAPI = new ThreadedCommentsAPI(this.options);\n\n this.threadedCommentsAPI.createCommentReply({\n fileId: file.id,\n commentId: parentId,\n permissions,\n message: text,\n successCallback: successCallbackFn,\n errorCallback: errorCallbackFn,\n });\n }\n }\n\n /**\n * Update a comment\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {string} commentId - Comment ID\n * @param {string} text - the comment text\n * @param {boolean} hasMention - true if there is an @mention in the text\n * @param {BoxCommentPermission} permissions - Permissions to attach to the app activity items\n * @param {Function} successCallback - the success callback\n * @param {Function} errorCallback - the error callback\n * @return {void}\n */\n updateComment = (\n file: BoxItem,\n commentId: string,\n text: string,\n hasMention: boolean,\n permissions: BoxCommentPermission,\n successCallback: Function,\n errorCallback: ErrorCallback,\n ): void => {\n const commentData = {\n tagged_message: text,\n };\n\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n this.errorCallback = errorCallback;\n this.updateFeedItem({ ...commentData, isPending: true }, commentId);\n\n const message = {};\n if (hasMention) {\n message.tagged_message = text;\n } else {\n message.message = text;\n }\n\n this.commentsAPI = new CommentsAPI(this.options);\n\n this.commentsAPI.updateComment({\n file,\n commentId,\n permissions,\n ...message,\n successCallback: (comment: Comment) => {\n // use the request payload instead of response in the\n // feed item update because response may not contain\n // the tagged version of the message\n this.updateFeedItem(\n {\n ...message,\n isPending: false,\n },\n commentId,\n );\n if (!this.isDestroyed()) {\n successCallback(comment);\n }\n },\n errorCallback: (e: ErrorResponseData, code: string) => {\n this.updateCommentErrorCallback(e, code, commentId);\n },\n });\n };\n\n /**\n * Update a threaded comment\n *\n * @param {BoxItem} file - The file to which the task is assigned\n * @param {string} commentId - Comment ID\n * @param {string} text - the comment text\n * @param {FeedItemStatus} status - status of the comment\n * @param {BoxCommentPermission} permissions - Permissions to attach to the app activity items\n * @param {Function} successCallback - the success callback\n * @param {Function} errorCallback - the error callback\n * @return {void}\n */\n updateThreadedComment = (\n file: BoxItem,\n commentId: string,\n text?: string,\n status?: FeedItemStatus,\n permissions: BoxCommentPermission,\n successCallback: Function,\n errorCallback: ErrorCallback,\n ): void => {\n if (!file.id) {\n throw getBadItemError();\n }\n if (!text && !status) {\n throw getMissingItemTextOrStatus();\n }\n\n const commentData = {};\n if (text) {\n commentData.tagged_message = text;\n }\n if (status) {\n commentData.status = status;\n }\n\n this.file = file;\n this.errorCallback = errorCallback;\n this.updateFeedItem({ ...commentData, isPending: true }, commentId);\n\n this.threadedCommentsAPI = new ThreadedCommentsAPI(this.options);\n\n this.threadedCommentsAPI.updateComment({\n fileId: file.id,\n commentId,\n permissions,\n message: text,\n status,\n successCallback: (comment: Comment) => {\n const { replies, total_reply_count, ...commentBase } = comment;\n this.updateFeedItem(\n {\n // Do not update replies and total_reply_count props as their current values are not included in the response\n ...commentBase,\n isPending: false,\n },\n commentId,\n );\n if (!this.isDestroyed()) {\n successCallback(comment);\n }\n },\n errorCallback: (e: ErrorResponseData, code: string) => {\n this.updateCommentErrorCallback(e, code, commentId);\n },\n });\n };\n\n /**\n * Update a reply\n *\n * @param {BoxItem} file - The file to which the reply with its parent is assigned\n * @param {string} id - id of the reply\n * @param {string} parentId - id of the parent item\n * @param {string} text - the updated text\n * @param {BoxCommentPermission} permissions - Permissions to attach to the app activity items\n * @param {Function} successCallback - the success callback\n * @param {Function} errorCallback - the error callback\n * @return {void}\n */\n updateReply = (\n file: BoxItem,\n id: string,\n parentId: string,\n text: string,\n permissions: BoxCommentPermission,\n successCallback: (comment: Comment) => void,\n errorCallback: ErrorCallback,\n ): void => {\n if (!file.id) {\n throw getBadItemError();\n }\n\n this.file = file;\n this.errorCallback = errorCallback;\n this.updateReplyItem({ tagged_message: text, isPending: true }, parentId, id);\n\n this.threadedCommentsAPI = new ThreadedCommentsAPI(this.options);\n\n this.threadedCommentsAPI.updateComment({\n fileId: file.id,\n commentId: id,\n permissions,\n message: text,\n undefined,\n successCallback: (comment: Comment) => {\n this.updateReplyItem(\n {\n ...comment,\n isPending: false,\n },\n parentId,\n id,\n );\n if (!this.isDestroyed()) {\n successCallback(comment);\n }\n },\n errorCallback: (error: ErrorResponseData, code: string) => {\n this.updateReplyErrorCallback(error, code, id, parentId);\n },\n });\n };\n\n /**\n * Modify feed item replies count\n *\n * @param {string} id - id of the item\n * @param {number} n - number to modify the count by\n * @return {void}\n */\n modifyFeedItemRepliesCountBy = (id: string, n: number) => {\n if (!this.file.id) {\n throw getBadItemError();\n }\n\n const { items: feedItems = [] } = this.getCachedItems(this.file.id) || {};\n const feedItem = feedItems.find(({ id: itemId }) => itemId === id);\n\n if (!feedItem || (feedItem.type !== 'annotation' && feedItem.type !== 'comment')) {\n return;\n }\n\n const newReplyCount = (feedItem.total_reply_count || 0) + n;\n if (newReplyCount >= 0) {\n this.updateFeedItem({ total_reply_count: newReplyCount }, id);\n }\n };\n\n destroyTaskCollaborators() {\n if (Array.isArray(this.taskCollaboratorsAPI)) {\n this.taskCollaboratorsAPI.forEach(api => api.destroy());\n this.taskCollaboratorsAPI = [];\n }\n }\n\n destroyTaskLinks() {\n if (Array.isArray(this.taskLinksAPI)) {\n this.taskLinksAPI.forEach(api => api.destroy());\n this.taskLinksAPI = [];\n }\n }\n\n /**\n * Fetches app activities for a file\n * @param {BoxItemPermission} permissions - Permissions to attach to the app activity items\n *\n * @return {Promise} - the feed items\n */\n fetchAppActivity(permissions: BoxItemPermission): Promise<?AppActivityItems> {\n this.appActivityAPI = new AppActivityAPI(this.options);\n\n return new Promise(resolve => {\n this.appActivityAPI.getAppActivity(\n this.file.id,\n permissions,\n resolve,\n this.fetchFeedItemErrorCallback.bind(this, resolve),\n );\n });\n }\n\n /**\n * Deletes an app activity item.\n *\n * @param {BoxItem} file - The file to which the app activity belongs to\n * @param {string} appActivityId - The app activity item id to delete\n * @param {Function} successCallback - the function which will be called on success\n * @param {Function} errorCallback - the function which will be called on error\n * @return {void}\n */\n deleteAppActivity = (\n file: BoxItem,\n appActivityId: string,\n successCallback: Function,\n errorCallback: ErrorCallback,\n ): void => {\n const { id } = file;\n if (!id) {\n throw getBadItemError();\n }\n\n this.appActivityAPI = new AppActivityAPI(this.options);\n\n this.file = file;\n this.errorCallback = errorCallback;\n this.updateFeedItem({ isPending: true }, appActivityId);\n\n this.appActivityAPI.deleteAppActivity({\n id,\n appActivityId,\n successCallback: this.deleteFeedItem.bind(this, appActivityId, successCallback),\n errorCallback: (e: ElementsXhrError, code: string) => {\n this.deleteAppActivityErrorCallback(e, code, appActivityId);\n },\n });\n };\n\n /**\n * Error callback for deleting an app activity item\n *\n * @param {ElementsXhrError} e - the error returned by the API\n * @param {string} code - the error code\n * @param {string} id - the app activity id\n * @return {void}\n */\n deleteAppActivityErrorCallback = (e: ElementsXhrError, code: string, id: string) => {\n this.updateFeedItem(this.createFeedError(messages.appActivityDeleteErrorMessage), id);\n this.feedErrorCallback(true, e, code);\n };\n\n /**\n * Destroys all the task feed API's\n *\n * @return {void}\n */\n destroy() {\n super.destroy();\n\n if (this.annotationsAPI) {\n this.annotationsAPI.destroy();\n delete this.annotationsAPI;\n }\n\n if (this.commentsAPI) {\n this.commentsAPI.destroy();\n delete this.commentsAPI;\n }\n\n if (this.threadedCommentsAPI) {\n this.threadedCommentsAPI.destroy();\n delete this.threadedCommentsAPI;\n }\n\n if (this.versionsAPI) {\n this.versionsAPI.destroy();\n delete this.versionsAPI;\n }\n\n if (this.appActivityAPI) {\n this.appActivityAPI.destroy();\n delete this.appActivityAPI;\n }\n\n if (this.tasksNewAPI) {\n this.tasksNewAPI.destroy();\n delete this.tasksNewAPI;\n }\n\n this.destroyTaskCollaborators();\n this.destroyTaskLinks();\n }\n}\n\nexport default Feed;\n"],"file":"Feed.js"}
|