box-ui-elements 17.2.0-beta.2 → 17.2.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/explorer.js +16 -16
- package/dist/openwith.js +6 -6
- package/dist/picker.js +10 -10
- package/dist/preview.js +12 -12
- package/dist/sharing.js +8 -8
- package/dist/sidebar.js +9 -9
- package/dist/uploader.js +6 -6
- package/es/api/APIFactory.js +27 -0
- package/es/api/APIFactory.js.flow +26 -0
- package/es/api/APIFactory.js.map +1 -1
- package/es/api/Feed.js +225 -52
- package/es/api/Feed.js.flow +191 -26
- package/es/api/Feed.js.map +1 -1
- package/es/api/FileActivities.js +119 -0
- package/es/api/FileActivities.js.flow +88 -0
- package/es/api/FileActivities.js.map +1 -0
- package/es/api/Item.js +21 -18
- package/es/api/Item.js.flow +22 -15
- package/es/api/Item.js.map +1 -1
- package/es/api/fixtures.js +46 -1
- package/es/api/fixtures.js.flow +39 -1
- package/es/api/fixtures.js.map +1 -1
- package/es/common/types/feed.js +1 -1
- package/es/common/types/feed.js.flow +38 -0
- package/es/common/types/feed.js.map +1 -1
- package/es/components/pill-selector-dropdown/PillSelectorDropdown.stories.js +1 -1
- package/es/components/pill-selector-dropdown/PillSelectorDropdown.stories.js.flow +1 -1
- package/es/components/pill-selector-dropdown/PillSelectorDropdown.stories.js.map +1 -1
- package/es/constants.js +7 -0
- package/es/constants.js.flow +7 -0
- package/es/constants.js.map +1 -1
- package/es/elements/content-explorer/ContentExplorer.js +5 -18
- package/es/elements/content-explorer/ContentExplorer.js.flow +6 -16
- package/es/elements/content-explorer/ContentExplorer.js.map +1 -1
- package/es/elements/content-picker/ContentPicker.js +5 -8
- package/es/elements/content-picker/ContentPicker.js.flow +6 -9
- package/es/elements/content-picker/ContentPicker.js.map +1 -1
- package/es/elements/content-sharing/hooks/useSharedLink.js +1 -0
- package/es/elements/content-sharing/hooks/useSharedLink.js.flow +1 -0
- package/es/elements/content-sharing/hooks/useSharedLink.js.map +1 -1
- package/es/elements/content-sharing/types.js.flow +2 -1
- package/es/elements/content-sidebar/ActivitySidebar.js +6 -2
- package/es/elements/content-sidebar/ActivitySidebar.js.flow +11 -1
- package/es/elements/content-sidebar/ActivitySidebar.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActiveState.js +2 -0
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActiveState.js.flow +3 -0
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActiveState.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityFeed.js +2 -0
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityFeed.js.flow +3 -0
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityFeed.js.map +1 -1
- package/es/features/unified-share-modal/UnifiedShareForm.js +8 -7
- package/es/features/unified-share-modal/UnifiedShareForm.js.flow +10 -8
- package/es/features/unified-share-modal/UnifiedShareForm.js.map +1 -1
- package/es/features/unified-share-modal/messages.js +1 -1
- package/es/features/unified-share-modal/messages.js.flow +2 -1
- package/es/features/unified-share-modal/messages.js.map +1 -1
- package/es/utils/fields.js +1 -1
- package/es/utils/fields.js.flow +1 -1
- package/es/utils/fields.js.map +1 -1
- package/i18n/en-US.js +1 -1
- package/i18n/en-US.properties +1 -1
- package/i18n/en-x-pseudo.js +1 -1
- package/package.json +1 -1
- package/src/api/APIFactory.js +26 -0
- package/src/api/Feed.js +191 -26
- package/src/api/FileActivities.js +88 -0
- package/src/api/Item.js +22 -15
- package/src/api/__tests__/Feed.test.js +94 -2
- package/src/api/__tests__/FileActivities.test.js +95 -0
- package/src/api/__tests__/Item.test.js +14 -12
- package/src/api/fixtures.js +39 -1
- package/src/common/types/feed.js +38 -0
- package/src/components/pill-selector-dropdown/PillSelectorDropdown.stories.js +1 -1
- package/src/constants.js +7 -0
- package/src/elements/content-explorer/ContentExplorer.js +6 -16
- package/src/elements/content-explorer/__tests__/ContentExplorer.test.js +2 -2
- package/src/elements/content-picker/ContentPicker.js +6 -9
- package/src/elements/content-sharing/hooks/useSharedLink.js +1 -0
- package/src/elements/content-sharing/types.js +2 -1
- package/src/elements/content-sidebar/ActivitySidebar.js +11 -1
- package/src/elements/content-sidebar/__tests__/ActivitySidebar.test.js +9 -4
- package/src/elements/content-sidebar/__tests__/__snapshots__/ActivitySidebar.test.js.snap +1 -0
- package/src/elements/content-sidebar/activity-feed/activity-feed/ActiveState.js +3 -0
- package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityFeed.js +3 -0
- package/src/features/unified-share-modal/UnifiedShareForm.js +10 -8
- package/src/features/unified-share-modal/messages.js +2 -1
- package/src/utils/fields.js +1 -1
package/es/api/Feed.js
CHANGED
|
@@ -53,8 +53,8 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
53
53
|
* @file Helper for activity feed API's
|
|
54
54
|
* @author Box
|
|
55
55
|
*/
|
|
56
|
-
import uniqueId from 'lodash/uniqueId';
|
|
57
56
|
import noop from 'lodash/noop';
|
|
57
|
+
import uniqueId from 'lodash/uniqueId';
|
|
58
58
|
import { getBadItemError, getBadUserError, getMissingItemTextOrStatus, isUserCorrectableError } from '../utils/error';
|
|
59
59
|
import commonMessages from '../elements/common/messages';
|
|
60
60
|
import messages from './messages';
|
|
@@ -64,13 +64,14 @@ import Base from './Base';
|
|
|
64
64
|
import AnnotationsAPI from './Annotations';
|
|
65
65
|
import CommentsAPI from './Comments';
|
|
66
66
|
import ThreadedCommentsAPI from './ThreadedComments';
|
|
67
|
+
import FileActivitiesAPI from './FileActivities';
|
|
67
68
|
import VersionsAPI from './Versions';
|
|
68
69
|
import TasksNewAPI from './tasks/TasksNew';
|
|
69
70
|
import GroupsAPI from './Groups';
|
|
70
71
|
import TaskCollaboratorsAPI from './tasks/TaskCollaborators';
|
|
71
72
|
import TaskLinksAPI from './tasks/TaskLinks';
|
|
72
73
|
import AppActivityAPI from './AppActivity';
|
|
73
|
-
import { 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, 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 } from '../constants';
|
|
74
|
+
import { 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 } from '../constants';
|
|
74
75
|
var TASK_NEW_INITIAL_STATUS = TASK_NEW_NOT_STARTED;
|
|
75
76
|
|
|
76
77
|
var getItemWithFilteredReplies = function getItemWithFilteredReplies(item, replyId) {
|
|
@@ -96,6 +97,114 @@ var getItemWithPendingReply = function getItemWithPendingReply(item, reply) {
|
|
|
96
97
|
}, rest);
|
|
97
98
|
};
|
|
98
99
|
|
|
100
|
+
var parseReplies = function parseReplies(replies) {
|
|
101
|
+
var parsedReplies = _toConsumableArray(replies);
|
|
102
|
+
|
|
103
|
+
return parsedReplies.map(function (reply) {
|
|
104
|
+
return _objectSpread({}, reply, {
|
|
105
|
+
tagged_message: reply.tagged_message || reply.message || ''
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export var getParsedFileActivitiesResponse = function getParsedFileActivitiesResponse(response) {
|
|
111
|
+
if (!response || !response.entries || !response.entries.length) {
|
|
112
|
+
return {
|
|
113
|
+
entries: []
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
var data = response.entries;
|
|
118
|
+
var parsedData = data.map(function (item) {
|
|
119
|
+
if (!item.source) {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
var source = _objectSpread({}, item.source);
|
|
124
|
+
|
|
125
|
+
switch (item.activity_type) {
|
|
126
|
+
case FILE_ACTIVITY_TYPE_TASK:
|
|
127
|
+
{
|
|
128
|
+
var _taskItem$assigned_to;
|
|
129
|
+
|
|
130
|
+
var taskItem = _objectSpread({}, source[FILE_ACTIVITY_TYPE_TASK]); // UAA follows a lowercased enum naming convention, convert to uppercase to align with task api
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
if ((_taskItem$assigned_to = taskItem.assigned_to) === null || _taskItem$assigned_to === void 0 ? void 0 : _taskItem$assigned_to.entries) {
|
|
134
|
+
var assignedToEntries = taskItem.assigned_to.entries.map(function (entry) {
|
|
135
|
+
var assignedToEntry = _objectSpread({}, entry);
|
|
136
|
+
|
|
137
|
+
assignedToEntry.role = entry.role.toUpperCase();
|
|
138
|
+
assignedToEntry.status = entry.status.toUpperCase();
|
|
139
|
+
return assignedToEntry;
|
|
140
|
+
}); // $FlowFixMe Using the toUpperCase method makes Flow assume role and status is a string type, which is incompatible with string literal
|
|
141
|
+
|
|
142
|
+
taskItem.assigned_to.entries = assignedToEntries;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (taskItem.completion_rule) {
|
|
146
|
+
taskItem.completion_rule = taskItem.completion_rule.toUpperCase();
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (taskItem.status) {
|
|
150
|
+
taskItem.status = taskItem.status.toUpperCase();
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (taskItem.task_type) {
|
|
154
|
+
taskItem.task_type = taskItem.task_type.toUpperCase();
|
|
155
|
+
} // $FlowFixMe File Activities only returns a created_by user, Flow type fix is needed
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
taskItem.created_by = {
|
|
159
|
+
target: taskItem.created_by
|
|
160
|
+
};
|
|
161
|
+
return taskItem;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
case FILE_ACTIVITY_TYPE_COMMENT:
|
|
165
|
+
{
|
|
166
|
+
var commentItem = _objectSpread({}, source[FILE_ACTIVITY_TYPE_COMMENT]);
|
|
167
|
+
|
|
168
|
+
if (commentItem.replies && commentItem.replies.length) {
|
|
169
|
+
var replies = parseReplies(commentItem.replies);
|
|
170
|
+
commentItem.replies = replies;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
commentItem.tagged_message = commentItem.tagged_message || commentItem.message || '';
|
|
174
|
+
return commentItem;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
case FILE_ACTIVITY_TYPE_ANNOTATION:
|
|
178
|
+
{
|
|
179
|
+
var annotationItem = _objectSpread({}, source[FILE_ACTIVITY_TYPE_ANNOTATION]);
|
|
180
|
+
|
|
181
|
+
if (annotationItem.replies && annotationItem.replies.length) {
|
|
182
|
+
var _replies = parseReplies(annotationItem.replies);
|
|
183
|
+
|
|
184
|
+
annotationItem.replies = _replies;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return annotationItem;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
case FILE_ACTIVITY_TYPE_APP_ACTIVITY:
|
|
191
|
+
{
|
|
192
|
+
return _objectSpread({}, source[FILE_ACTIVITY_TYPE_APP_ACTIVITY]);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
default:
|
|
196
|
+
{
|
|
197
|
+
return null;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}).filter(function (item) {
|
|
201
|
+
return !!item;
|
|
202
|
+
});
|
|
203
|
+
return {
|
|
204
|
+
entries: parsedData
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
|
|
99
208
|
var Feed =
|
|
100
209
|
/*#__PURE__*/
|
|
101
210
|
function (_Base) {
|
|
@@ -133,6 +242,10 @@ function (_Base) {
|
|
|
133
242
|
* @property {ThreadedCommentsAPI}
|
|
134
243
|
*/
|
|
135
244
|
|
|
245
|
+
/**
|
|
246
|
+
* @property {FileActivitiesAPI}
|
|
247
|
+
*/
|
|
248
|
+
|
|
136
249
|
/**
|
|
137
250
|
* @property {BoxItem}
|
|
138
251
|
*/
|
|
@@ -1332,7 +1445,9 @@ function (_Base) {
|
|
|
1332
1445
|
_ref5$shouldShowTasks = _ref5.shouldShowTasks,
|
|
1333
1446
|
shouldShowTasks = _ref5$shouldShowTasks === void 0 ? true : _ref5$shouldShowTasks,
|
|
1334
1447
|
_ref5$shouldShowVersi = _ref5.shouldShowVersions,
|
|
1335
|
-
shouldShowVersions = _ref5$shouldShowVersi === void 0 ? true : _ref5$shouldShowVersi
|
|
1448
|
+
shouldShowVersions = _ref5$shouldShowVersi === void 0 ? true : _ref5$shouldShowVersi,
|
|
1449
|
+
_ref5$shouldUseUAA = _ref5.shouldUseUAA,
|
|
1450
|
+
shouldUseUAA = _ref5$shouldUseUAA === void 0 ? false : _ref5$shouldUseUAA;
|
|
1336
1451
|
|
|
1337
1452
|
var id = file.id,
|
|
1338
1453
|
_file$permissions = file.permissions,
|
|
@@ -1356,32 +1471,66 @@ function (_Base) {
|
|
|
1356
1471
|
|
|
1357
1472
|
this.file = file;
|
|
1358
1473
|
this.errors = [];
|
|
1359
|
-
this.errorCallback = onError;
|
|
1360
|
-
|
|
1474
|
+
this.errorCallback = onError; // Using the UAA File Activities endpoint replaces the need for these calls
|
|
1475
|
+
|
|
1476
|
+
var annotationsPromise = !shouldUseUAA && shouldShowAnnotations ? this.fetchAnnotations(permissions, shouldShowReplies) : Promise.resolve();
|
|
1477
|
+
|
|
1478
|
+
var commentsPromise = function commentsPromise() {
|
|
1479
|
+
if (shouldUseUAA) {
|
|
1480
|
+
return Promise.resolve();
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
return shouldShowReplies ? _this2.fetchThreadedComments(permissions) : _this2.fetchComments(permissions);
|
|
1484
|
+
};
|
|
1485
|
+
|
|
1486
|
+
var tasksPromise = !shouldUseUAA && shouldShowTasks ? this.fetchTasksNew() : Promise.resolve();
|
|
1487
|
+
var appActivityPromise = !shouldUseUAA && shouldShowAppActivity ? this.fetchAppActivity(permissions) : Promise.resolve();
|
|
1361
1488
|
var versionsPromise = shouldShowVersions ? this.fetchVersions() : Promise.resolve();
|
|
1362
1489
|
var currentVersionPromise = shouldShowVersions ? this.fetchCurrentVersion() : Promise.resolve();
|
|
1363
|
-
var
|
|
1364
|
-
var tasksPromise = shouldShowTasks ? this.fetchTasksNew() : Promise.resolve();
|
|
1365
|
-
var appActivityPromise = shouldShowAppActivity ? this.fetchAppActivity(permissions) : Promise.resolve();
|
|
1366
|
-
Promise.all([versionsPromise, currentVersionPromise, commentsPromise, tasksPromise, appActivityPromise, annotationsPromise]).then(function (_ref6) {
|
|
1367
|
-
var _ref7 = _toArray(_ref6),
|
|
1368
|
-
versions = _ref7[0],
|
|
1369
|
-
currentVersion = _ref7[1],
|
|
1370
|
-
feedItems = _ref7.slice(2);
|
|
1371
|
-
|
|
1372
|
-
var versionsWithCurrent = currentVersion ? _this2.versionsAPI.addCurrentVersion(currentVersion, versions, _this2.file) : undefined;
|
|
1373
|
-
var sortedFeedItems = sortFeedItems.apply(void 0, [versionsWithCurrent].concat(_toConsumableArray(feedItems)));
|
|
1490
|
+
var fileActivitiesPromise = shouldUseUAA ? this.fetchFileActivities(permissions, [FILE_ACTIVITY_TYPE_ANNOTATION, FILE_ACTIVITY_TYPE_APP_ACTIVITY, FILE_ACTIVITY_TYPE_COMMENT, FILE_ACTIVITY_TYPE_TASK]) : Promise.resolve();
|
|
1374
1491
|
|
|
1492
|
+
var handleFeedItems = function handleFeedItems(feedItems) {
|
|
1375
1493
|
if (!_this2.isDestroyed()) {
|
|
1376
|
-
_this2.setCachedItems(id,
|
|
1494
|
+
_this2.setCachedItems(id, feedItems);
|
|
1377
1495
|
|
|
1378
1496
|
if (_this2.errors.length) {
|
|
1379
|
-
errorCallback(
|
|
1497
|
+
errorCallback(feedItems, _this2.errors);
|
|
1380
1498
|
} else {
|
|
1381
|
-
successCallback(
|
|
1499
|
+
successCallback(feedItems);
|
|
1382
1500
|
}
|
|
1383
1501
|
}
|
|
1384
|
-
}
|
|
1502
|
+
};
|
|
1503
|
+
|
|
1504
|
+
if (shouldUseUAA) {
|
|
1505
|
+
Promise.all([versionsPromise, currentVersionPromise, fileActivitiesPromise]).then(function (_ref6) {
|
|
1506
|
+
var _ref7 = _toArray(_ref6),
|
|
1507
|
+
versions = _ref7[0],
|
|
1508
|
+
currentVersion = _ref7[1],
|
|
1509
|
+
feedItems = _ref7.slice(2);
|
|
1510
|
+
|
|
1511
|
+
if (!feedItems || !feedItems.length) {
|
|
1512
|
+
return;
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
var fileActivitiesResponse = feedItems[0];
|
|
1516
|
+
var versionsWithCurrent = currentVersion ? _this2.versionsAPI.addCurrentVersion(currentVersion, versions, _this2.file) : undefined;
|
|
1517
|
+
var parsedFeedItems = getParsedFileActivitiesResponse(fileActivitiesResponse); // $FlowFixMe Does not need to be sorted once we include versions in the file activities call
|
|
1518
|
+
|
|
1519
|
+
var sortedFeedItems = sortFeedItems(versionsWithCurrent, parsedFeedItems);
|
|
1520
|
+
handleFeedItems(sortedFeedItems);
|
|
1521
|
+
});
|
|
1522
|
+
} else {
|
|
1523
|
+
Promise.all([versionsPromise, currentVersionPromise, commentsPromise(), tasksPromise, appActivityPromise, annotationsPromise]).then(function (_ref8) {
|
|
1524
|
+
var _ref9 = _toArray(_ref8),
|
|
1525
|
+
versions = _ref9[0],
|
|
1526
|
+
currentVersion = _ref9[1],
|
|
1527
|
+
feedItems = _ref9.slice(2);
|
|
1528
|
+
|
|
1529
|
+
var versionsWithCurrent = currentVersion ? _this2.versionsAPI.addCurrentVersion(currentVersion, versions, _this2.file) : undefined;
|
|
1530
|
+
var sortedFeedItems = sortFeedItems.apply(void 0, [versionsWithCurrent].concat(_toConsumableArray(feedItems)));
|
|
1531
|
+
handleFeedItems(sortedFeedItems);
|
|
1532
|
+
});
|
|
1533
|
+
}
|
|
1385
1534
|
})
|
|
1386
1535
|
}, {
|
|
1387
1536
|
key: "fetchAnnotations",
|
|
@@ -1474,6 +1623,30 @@ function (_Base) {
|
|
|
1474
1623
|
});
|
|
1475
1624
|
});
|
|
1476
1625
|
}
|
|
1626
|
+
/**
|
|
1627
|
+
* Fetches the file activities for a file
|
|
1628
|
+
*
|
|
1629
|
+
* @param {BoxItemPermission} permissions - the file permissions
|
|
1630
|
+
* @param {FileActivityTypes[]} activityTypes - the activity types to filter by
|
|
1631
|
+
* @return {Promise} - the file comments
|
|
1632
|
+
*/
|
|
1633
|
+
|
|
1634
|
+
}, {
|
|
1635
|
+
key: "fetchFileActivities",
|
|
1636
|
+
value: function fetchFileActivities(permissions, activityTypes) {
|
|
1637
|
+
var _this7 = this;
|
|
1638
|
+
|
|
1639
|
+
this.fileActivitiesAPI = new FileActivitiesAPI(this.options);
|
|
1640
|
+
return new Promise(function (resolve) {
|
|
1641
|
+
_this7.fileActivitiesAPI.getActivities({
|
|
1642
|
+
errorCallback: _this7.fetchFeedItemErrorCallback.bind(_this7, resolve),
|
|
1643
|
+
fileID: _this7.file.id,
|
|
1644
|
+
permissions: permissions,
|
|
1645
|
+
successCallback: resolve,
|
|
1646
|
+
activityTypes: activityTypes
|
|
1647
|
+
});
|
|
1648
|
+
});
|
|
1649
|
+
}
|
|
1477
1650
|
/**
|
|
1478
1651
|
* Fetches replies (comments) of a comment or annotation
|
|
1479
1652
|
*
|
|
@@ -1488,7 +1661,7 @@ function (_Base) {
|
|
|
1488
1661
|
}, {
|
|
1489
1662
|
key: "fetchReplies",
|
|
1490
1663
|
value: function fetchReplies(file, commentFeedItemId, commentFeedItemType, successCallback, errorCallback) {
|
|
1491
|
-
var
|
|
1664
|
+
var _this8 = this;
|
|
1492
1665
|
|
|
1493
1666
|
var id = file.id,
|
|
1494
1667
|
permissions = file.permissions;
|
|
@@ -1503,10 +1676,10 @@ function (_Base) {
|
|
|
1503
1676
|
isRepliesLoading: true
|
|
1504
1677
|
}, commentFeedItemId);
|
|
1505
1678
|
|
|
1506
|
-
var successCallbackFn = function successCallbackFn(
|
|
1507
|
-
var entries =
|
|
1679
|
+
var successCallbackFn = function successCallbackFn(_ref10) {
|
|
1680
|
+
var entries = _ref10.entries;
|
|
1508
1681
|
|
|
1509
|
-
|
|
1682
|
+
_this8.updateFeedItem({
|
|
1510
1683
|
isRepliesLoading: false,
|
|
1511
1684
|
replies: entries,
|
|
1512
1685
|
total_reply_count: entries.length
|
|
@@ -1516,7 +1689,7 @@ function (_Base) {
|
|
|
1516
1689
|
};
|
|
1517
1690
|
|
|
1518
1691
|
var errorCallbackFn = function errorCallbackFn(error, code) {
|
|
1519
|
-
|
|
1692
|
+
_this8.fetchRepliesErrorCallback(error, code, commentFeedItemId);
|
|
1520
1693
|
};
|
|
1521
1694
|
|
|
1522
1695
|
if (commentFeedItemType === FEED_ITEM_TYPE_ANNOTATION) {
|
|
@@ -1542,11 +1715,11 @@ function (_Base) {
|
|
|
1542
1715
|
}, {
|
|
1543
1716
|
key: "fetchVersions",
|
|
1544
1717
|
value: function fetchVersions() {
|
|
1545
|
-
var
|
|
1718
|
+
var _this9 = this;
|
|
1546
1719
|
|
|
1547
1720
|
this.versionsAPI = new VersionsAPI(this.options);
|
|
1548
1721
|
return new Promise(function (resolve) {
|
|
1549
|
-
|
|
1722
|
+
_this9.versionsAPI.getVersions(_this9.file.id, resolve, _this9.fetchFeedItemErrorCallback.bind(_this9, resolve), undefined, undefined, FEED_FILE_VERSIONS_FIELDS_TO_FETCH);
|
|
1550
1723
|
});
|
|
1551
1724
|
}
|
|
1552
1725
|
/**
|
|
@@ -1558,14 +1731,14 @@ function (_Base) {
|
|
|
1558
1731
|
}, {
|
|
1559
1732
|
key: "fetchCurrentVersion",
|
|
1560
1733
|
value: function fetchCurrentVersion() {
|
|
1561
|
-
var
|
|
1734
|
+
var _this10 = this;
|
|
1562
1735
|
|
|
1563
1736
|
this.versionsAPI = new VersionsAPI(this.options);
|
|
1564
1737
|
return new Promise(function (resolve) {
|
|
1565
|
-
var
|
|
1566
|
-
file_version =
|
|
1738
|
+
var _this10$file$file_ver = _this10.file.file_version,
|
|
1739
|
+
file_version = _this10$file$file_ver === void 0 ? {} : _this10$file$file_ver;
|
|
1567
1740
|
|
|
1568
|
-
|
|
1741
|
+
_this10.versionsAPI.getVersion(_this10.file.id, file_version.id, resolve, _this10.fetchFeedItemErrorCallback.bind(_this10, resolve));
|
|
1569
1742
|
});
|
|
1570
1743
|
}
|
|
1571
1744
|
/**
|
|
@@ -1577,17 +1750,17 @@ function (_Base) {
|
|
|
1577
1750
|
}, {
|
|
1578
1751
|
key: "fetchTasksNew",
|
|
1579
1752
|
value: function fetchTasksNew() {
|
|
1580
|
-
var
|
|
1753
|
+
var _this11 = this;
|
|
1581
1754
|
|
|
1582
1755
|
this.tasksNewAPI = new TasksNewAPI(this.options);
|
|
1583
1756
|
return new Promise(function (resolve) {
|
|
1584
|
-
|
|
1757
|
+
_this11.tasksNewAPI.getTasksForFile({
|
|
1585
1758
|
file: {
|
|
1586
|
-
id:
|
|
1759
|
+
id: _this11.file.id
|
|
1587
1760
|
},
|
|
1588
1761
|
successCallback: resolve,
|
|
1589
1762
|
errorCallback: function errorCallback(err, code) {
|
|
1590
|
-
return
|
|
1763
|
+
return _this11.fetchFeedItemErrorCallback(resolve, err, code);
|
|
1591
1764
|
}
|
|
1592
1765
|
});
|
|
1593
1766
|
});
|
|
@@ -1635,7 +1808,7 @@ function (_Base) {
|
|
|
1635
1808
|
* @return {Promise<TaskAssignment>}
|
|
1636
1809
|
*/
|
|
1637
1810
|
value: function createTaskCollaboratorsforGroup(file, task, assignee) {
|
|
1638
|
-
var
|
|
1811
|
+
var _this12 = this;
|
|
1639
1812
|
|
|
1640
1813
|
if (!file.id) {
|
|
1641
1814
|
throw getBadItemError();
|
|
@@ -1643,9 +1816,9 @@ function (_Base) {
|
|
|
1643
1816
|
|
|
1644
1817
|
this.file = file;
|
|
1645
1818
|
return new Promise(function (resolve, reject) {
|
|
1646
|
-
var taskCollaboratorsAPI = new TaskCollaboratorsAPI(
|
|
1819
|
+
var taskCollaboratorsAPI = new TaskCollaboratorsAPI(_this12.options);
|
|
1647
1820
|
|
|
1648
|
-
|
|
1821
|
+
_this12.taskCollaboratorsAPI.push(taskCollaboratorsAPI);
|
|
1649
1822
|
|
|
1650
1823
|
taskCollaboratorsAPI.createTaskCollaboratorsforGroup({
|
|
1651
1824
|
file: file,
|
|
@@ -1671,7 +1844,7 @@ function (_Base) {
|
|
|
1671
1844
|
}, {
|
|
1672
1845
|
key: "createTaskCollaborator",
|
|
1673
1846
|
value: function createTaskCollaborator(file, task, assignee) {
|
|
1674
|
-
var
|
|
1847
|
+
var _this13 = this;
|
|
1675
1848
|
|
|
1676
1849
|
if (!file.id) {
|
|
1677
1850
|
throw getBadItemError();
|
|
@@ -1679,9 +1852,9 @@ function (_Base) {
|
|
|
1679
1852
|
|
|
1680
1853
|
this.file = file;
|
|
1681
1854
|
return new Promise(function (resolve, reject) {
|
|
1682
|
-
var taskCollaboratorsAPI = new TaskCollaboratorsAPI(
|
|
1855
|
+
var taskCollaboratorsAPI = new TaskCollaboratorsAPI(_this13.options);
|
|
1683
1856
|
|
|
1684
|
-
|
|
1857
|
+
_this13.taskCollaboratorsAPI.push(taskCollaboratorsAPI);
|
|
1685
1858
|
|
|
1686
1859
|
taskCollaboratorsAPI.createTaskCollaborator({
|
|
1687
1860
|
file: file,
|
|
@@ -1707,7 +1880,7 @@ function (_Base) {
|
|
|
1707
1880
|
}, {
|
|
1708
1881
|
key: "deleteTaskCollaborator",
|
|
1709
1882
|
value: function deleteTaskCollaborator(file, task, assignee) {
|
|
1710
|
-
var
|
|
1883
|
+
var _this14 = this;
|
|
1711
1884
|
|
|
1712
1885
|
if (!file.id) {
|
|
1713
1886
|
throw getBadItemError();
|
|
@@ -1715,9 +1888,9 @@ function (_Base) {
|
|
|
1715
1888
|
|
|
1716
1889
|
this.file.id = file.id;
|
|
1717
1890
|
return new Promise(function (resolve, reject) {
|
|
1718
|
-
var taskCollaboratorsAPI = new TaskCollaboratorsAPI(
|
|
1891
|
+
var taskCollaboratorsAPI = new TaskCollaboratorsAPI(_this14.options);
|
|
1719
1892
|
|
|
1720
|
-
|
|
1893
|
+
_this14.taskCollaboratorsAPI.push(taskCollaboratorsAPI);
|
|
1721
1894
|
|
|
1722
1895
|
taskCollaboratorsAPI.deleteTaskCollaborator({
|
|
1723
1896
|
file: file,
|
|
@@ -1744,7 +1917,7 @@ function (_Base) {
|
|
|
1744
1917
|
}, {
|
|
1745
1918
|
key: "createTaskLink",
|
|
1746
1919
|
value: function createTaskLink(file, task) {
|
|
1747
|
-
var
|
|
1920
|
+
var _this15 = this;
|
|
1748
1921
|
|
|
1749
1922
|
if (!file.id) {
|
|
1750
1923
|
throw getBadItemError();
|
|
@@ -1752,9 +1925,9 @@ function (_Base) {
|
|
|
1752
1925
|
|
|
1753
1926
|
this.file = file;
|
|
1754
1927
|
return new Promise(function (resolve, reject) {
|
|
1755
|
-
var taskLinksAPI = new TaskLinksAPI(
|
|
1928
|
+
var taskLinksAPI = new TaskLinksAPI(_this15.options);
|
|
1756
1929
|
|
|
1757
|
-
|
|
1930
|
+
_this15.taskLinksAPI.push(taskLinksAPI);
|
|
1758
1931
|
|
|
1759
1932
|
taskLinksAPI.createTaskLink({
|
|
1760
1933
|
file: file,
|
|
@@ -1817,7 +1990,7 @@ function (_Base) {
|
|
|
1817
1990
|
* @return {void}
|
|
1818
1991
|
*/
|
|
1819
1992
|
value: function createReply(file, currentUser, parentId, parentType, text, successCallback, errorCallback) {
|
|
1820
|
-
var
|
|
1993
|
+
var _this16 = this;
|
|
1821
1994
|
|
|
1822
1995
|
var id = file.id,
|
|
1823
1996
|
permissions = file.permissions;
|
|
@@ -1838,11 +2011,11 @@ function (_Base) {
|
|
|
1838
2011
|
this.modifyFeedItemRepliesCountBy(parentId, 1);
|
|
1839
2012
|
|
|
1840
2013
|
var successCallbackFn = function successCallbackFn(comment) {
|
|
1841
|
-
|
|
2014
|
+
_this16.createReplySuccessCallback(comment, parentId, uuid, successCallback);
|
|
1842
2015
|
};
|
|
1843
2016
|
|
|
1844
2017
|
var errorCallbackFn = function errorCallbackFn(error, code) {
|
|
1845
|
-
|
|
2018
|
+
_this16.createReplyErrorCallback(error, code, parentId, uuid);
|
|
1846
2019
|
};
|
|
1847
2020
|
|
|
1848
2021
|
if (parentType === FEED_ITEM_TYPE_ANNOTATION) {
|
|
@@ -1903,11 +2076,11 @@ function (_Base) {
|
|
|
1903
2076
|
}, {
|
|
1904
2077
|
key: "fetchAppActivity",
|
|
1905
2078
|
value: function fetchAppActivity(permissions) {
|
|
1906
|
-
var
|
|
2079
|
+
var _this17 = this;
|
|
1907
2080
|
|
|
1908
2081
|
this.appActivityAPI = new AppActivityAPI(this.options);
|
|
1909
2082
|
return new Promise(function (resolve) {
|
|
1910
|
-
|
|
2083
|
+
_this17.appActivityAPI.getAppActivity(_this17.file.id, permissions, resolve, _this17.fetchFeedItemErrorCallback.bind(_this17, resolve));
|
|
1911
2084
|
});
|
|
1912
2085
|
}
|
|
1913
2086
|
/**
|