box-ui-elements 23.1.0 → 23.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/explorer.css +1 -1
- package/dist/explorer.js +1 -1
- package/dist/openwith.js +1 -1
- package/dist/picker.js +1 -1
- package/dist/preview.css +1 -1
- package/dist/preview.js +1 -1
- package/dist/sharing.css +1 -1
- package/dist/sharing.js +1 -1
- package/dist/sidebar.js +1 -1
- package/dist/uploader.js +1 -1
- package/es/elements/common/content-answers/ContentAnswersOpenButton.scss +1 -1
- package/es/features/collaborator-avatars/CollaboratorList.js +5 -1
- package/es/features/collaborator-avatars/CollaboratorList.js.flow +12 -1
- package/es/features/collaborator-avatars/CollaboratorList.js.map +1 -1
- package/es/features/collaborator-avatars/CollaboratorList.scss +3 -0
- package/es/features/collaborator-avatars/CollaboratorListItem.js +26 -5
- package/es/features/collaborator-avatars/CollaboratorListItem.js.flow +33 -9
- package/es/features/collaborator-avatars/CollaboratorListItem.js.map +1 -1
- package/es/features/collaborator-avatars/CollaboratorListItem.scss +23 -0
- package/es/features/message-center/components/MessageCenter.js +1 -0
- package/es/features/message-center/components/MessageCenter.js.flow +2 -1
- package/es/features/message-center/components/MessageCenter.js.map +1 -1
- package/es/features/unified-share-modal/RemoveCollaboratorConfirmModal.js +44 -0
- package/es/features/unified-share-modal/RemoveCollaboratorConfirmModal.js.flow +67 -0
- package/es/features/unified-share-modal/RemoveCollaboratorConfirmModal.js.map +1 -0
- package/es/features/unified-share-modal/UnifiedShareForm.js +8 -3
- package/es/features/unified-share-modal/UnifiedShareForm.js.flow +5 -1
- package/es/features/unified-share-modal/UnifiedShareForm.js.map +1 -1
- package/es/features/unified-share-modal/UnifiedShareModal.js +54 -10
- package/es/features/unified-share-modal/UnifiedShareModal.js.flow +59 -11
- package/es/features/unified-share-modal/UnifiedShareModal.js.map +1 -1
- package/es/features/unified-share-modal/UnifiedShareModal.scss +9 -2
- package/es/features/unified-share-modal/flowTypes.js.flow +13 -0
- package/es/features/unified-share-modal/flowTypes.js.map +1 -1
- package/es/features/unified-share-modal/messages.js +8 -0
- package/es/features/unified-share-modal/messages.js.flow +10 -0
- package/es/features/unified-share-modal/messages.js.map +1 -1
- package/es/features/unified-share-modal/stories/UnifiedShareModal.stories.js +221 -4
- package/es/features/unified-share-modal/stories/UnifiedShareModal.stories.js.flow +208 -3
- package/es/features/unified-share-modal/stories/UnifiedShareModal.stories.js.map +1 -1
- package/es/src/elements/content-sidebar/stories/tests/MetadataSidebarRedesign-visual.stories.d.ts +4 -4
- package/i18n/bn-IN.js +2 -0
- package/i18n/bn-IN.properties +4 -0
- package/i18n/da-DK.js +2 -0
- package/i18n/da-DK.properties +4 -0
- package/i18n/de-DE.js +2 -0
- package/i18n/de-DE.properties +4 -0
- package/i18n/en-AU.js +2 -0
- package/i18n/en-AU.properties +4 -0
- package/i18n/en-CA.js +2 -0
- package/i18n/en-CA.properties +4 -0
- package/i18n/en-GB.js +2 -0
- package/i18n/en-GB.properties +4 -0
- package/i18n/en-US.js +2 -0
- package/i18n/en-US.properties +4 -0
- package/i18n/en-x-pseudo.js +1010 -1008
- package/i18n/en-x-pseudo.properties +1012 -1008
- package/i18n/es-419.js +2 -0
- package/i18n/es-419.properties +4 -0
- package/i18n/es-ES.js +2 -0
- package/i18n/es-ES.properties +4 -0
- package/i18n/fi-FI.js +2 -0
- package/i18n/fi-FI.properties +4 -0
- package/i18n/fr-CA.js +2 -0
- package/i18n/fr-CA.properties +4 -0
- package/i18n/fr-FR.js +2 -0
- package/i18n/fr-FR.properties +4 -0
- package/i18n/hi-IN.js +2 -0
- package/i18n/hi-IN.properties +4 -0
- package/i18n/it-IT.js +2 -0
- package/i18n/it-IT.properties +4 -0
- package/i18n/ja-JP.js +2 -0
- package/i18n/ja-JP.properties +4 -0
- package/i18n/ko-KR.js +2 -0
- package/i18n/ko-KR.properties +4 -0
- package/i18n/nb-NO.js +2 -0
- package/i18n/nb-NO.properties +4 -0
- package/i18n/nl-NL.js +2 -0
- package/i18n/nl-NL.properties +4 -0
- package/i18n/pl-PL.js +2 -0
- package/i18n/pl-PL.properties +4 -0
- package/i18n/pt-BR.js +2 -0
- package/i18n/pt-BR.properties +4 -0
- package/i18n/ru-RU.js +2 -0
- package/i18n/ru-RU.properties +4 -0
- package/i18n/sv-SE.js +2 -0
- package/i18n/sv-SE.properties +4 -0
- package/i18n/tr-TR.js +2 -0
- package/i18n/tr-TR.properties +4 -0
- package/i18n/zh-CN.js +2 -0
- package/i18n/zh-CN.properties +4 -0
- package/i18n/zh-TW.js +2 -0
- package/i18n/zh-TW.properties +4 -0
- package/package.json +18 -18
- package/src/elements/common/content-answers/ContentAnswersOpenButton.scss +1 -1
- package/src/features/collaborator-avatars/CollaboratorList.js +12 -1
- package/src/features/collaborator-avatars/CollaboratorList.scss +3 -0
- package/src/features/collaborator-avatars/CollaboratorListItem.js +33 -9
- package/src/features/collaborator-avatars/CollaboratorListItem.scss +23 -0
- package/src/features/collaborator-avatars/__tests__/CollaboratorList.test.js +11 -0
- package/src/features/collaborator-avatars/__tests__/CollaboratorListItem.test.js +51 -0
- package/src/features/collaborator-avatars/__tests__/__snapshots__/CollaboratorList.test.js.snap +110 -0
- package/src/features/collaborator-avatars/__tests__/__snapshots__/CollaboratorListItem.test.js.snap +310 -0
- package/src/features/message-center/__tests__/MessageCenter.integration.test.js +10 -0
- package/src/features/message-center/components/MessageCenter.js +2 -1
- package/src/features/unified-share-modal/README.md +12 -1
- package/src/features/unified-share-modal/RemoveCollaboratorConfirmModal.js +67 -0
- package/src/features/unified-share-modal/UnifiedShareForm.js +5 -1
- package/src/features/unified-share-modal/UnifiedShareModal.js +59 -11
- package/src/features/unified-share-modal/UnifiedShareModal.scss +9 -2
- package/src/features/unified-share-modal/__tests__/RemoveCollaboratorConfirmModal.test.js +64 -0
- package/src/features/unified-share-modal/__tests__/UnifiedShareForm.test.js +34 -1
- package/src/features/unified-share-modal/__tests__/UnifiedShareModal.test.js +74 -4
- package/src/features/unified-share-modal/__tests__/__snapshots__/UnifiedShareModal.test.js.snap +258 -0
- package/src/features/unified-share-modal/flowTypes.js +13 -0
- package/src/features/unified-share-modal/messages.js +10 -0
- package/src/features/unified-share-modal/stories/UnifiedShareModal.stories.js +208 -3
|
@@ -129,7 +129,7 @@ const contacts = [{
|
|
|
129
129
|
collabID: '8',
|
|
130
130
|
name: 'Wenbo',
|
|
131
131
|
email: 'w@example.com',
|
|
132
|
-
type: '
|
|
132
|
+
type: 'pending',
|
|
133
133
|
hasCustomAvatar: false,
|
|
134
134
|
translatedRole: 'Editor',
|
|
135
135
|
userID: '8'
|
|
@@ -181,7 +181,7 @@ export const basic = () => {
|
|
|
181
181
|
const collaborators = contacts.slice().map(contact => {
|
|
182
182
|
// convert the existing contact entries to compatible collaborator entries in this example
|
|
183
183
|
const collaborator = {
|
|
184
|
-
collabID:
|
|
184
|
+
collabID: contact.collabID,
|
|
185
185
|
email: contact.email,
|
|
186
186
|
id: contact.id,
|
|
187
187
|
name: contact.name || '',
|
|
@@ -192,7 +192,8 @@ export const basic = () => {
|
|
|
192
192
|
executeAt: contact.isExternalUser ? 'November 27, 2022' : ''
|
|
193
193
|
},
|
|
194
194
|
hasCustomAvatar: false,
|
|
195
|
-
imageURL: null
|
|
195
|
+
imageURL: null,
|
|
196
|
+
translatedRole: contact.translatedRole
|
|
196
197
|
};
|
|
197
198
|
return collaborator;
|
|
198
199
|
});
|
|
@@ -775,7 +776,7 @@ export const withFormOnly = () => {
|
|
|
775
776
|
const collaborators = contacts.slice().map(contact => {
|
|
776
777
|
// convert the existing contact entries to compatible collaborator entries in this example
|
|
777
778
|
const collaborator = {
|
|
778
|
-
collabID:
|
|
779
|
+
collabID: contact.collabID,
|
|
779
780
|
email: contact.email,
|
|
780
781
|
expiration: {
|
|
781
782
|
executeAt: contact.isExternalUser ? 'November 27, 2022' : ''
|
|
@@ -946,6 +947,222 @@ export const withFormOnly = () => {
|
|
|
946
947
|
}
|
|
947
948
|
});
|
|
948
949
|
};
|
|
950
|
+
export const withRemoveCollaborators = () => {
|
|
951
|
+
const currentUserId = '0';
|
|
952
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
953
|
+
const [sharedLink, setSharedLink] = React.useState(DEFAULT_SHARED_LINK_STATE);
|
|
954
|
+
const [isSubmitting, setIsSubmitting] = React.useState(false);
|
|
955
|
+
const [collaboratorsList, setCollaboratorsList] = React.useState(INITIAL_STATE.collaboratorsList);
|
|
956
|
+
const closeModal = () => {
|
|
957
|
+
setIsOpen(false);
|
|
958
|
+
setSharedLink(DEFAULT_SHARED_LINK_STATE);
|
|
959
|
+
setCollaboratorsList({
|
|
960
|
+
collaborators: []
|
|
961
|
+
});
|
|
962
|
+
};
|
|
963
|
+
const fakeRequest = () => {
|
|
964
|
+
// submitting is used to disable input fields, and not to show the loading indicator
|
|
965
|
+
setIsSubmitting(true);
|
|
966
|
+
return new Promise(resolve => {
|
|
967
|
+
setTimeout(() => {
|
|
968
|
+
setIsSubmitting(false);
|
|
969
|
+
resolve();
|
|
970
|
+
}, 500);
|
|
971
|
+
});
|
|
972
|
+
};
|
|
973
|
+
const getInitialData = () => {
|
|
974
|
+
const initialPromise = fakeRequest();
|
|
975
|
+
const fetchCollaborators = new Promise(resolved => {
|
|
976
|
+
setTimeout(() => {
|
|
977
|
+
const collaborators = contacts.slice().map(contact => {
|
|
978
|
+
// convert the existing contact entries to compatible collaborator entries in this example
|
|
979
|
+
const collaborator = {
|
|
980
|
+
collabID: contact.collabID,
|
|
981
|
+
email: contact.email,
|
|
982
|
+
id: contact.id,
|
|
983
|
+
name: contact.name || '',
|
|
984
|
+
type: contact.type,
|
|
985
|
+
isExternalCollab: contact.isExternalUser || false,
|
|
986
|
+
userID: parseInt(contact.id, 10),
|
|
987
|
+
expiration: {
|
|
988
|
+
executeAt: contact.isExternalUser ? 'November 27, 2022' : ''
|
|
989
|
+
},
|
|
990
|
+
hasCustomAvatar: false,
|
|
991
|
+
imageURL: null,
|
|
992
|
+
translatedRole: contact.translatedRole,
|
|
993
|
+
isRemovable: currentUserId !== contact.userID
|
|
994
|
+
};
|
|
995
|
+
return collaborator;
|
|
996
|
+
});
|
|
997
|
+
setCollaboratorsList({
|
|
998
|
+
collaborators
|
|
999
|
+
});
|
|
1000
|
+
resolved();
|
|
1001
|
+
}, 1000);
|
|
1002
|
+
});
|
|
1003
|
+
return Promise.all([initialPromise, fetchCollaborators]);
|
|
1004
|
+
};
|
|
1005
|
+
return /*#__PURE__*/React.createElement("div", null, isOpen && /*#__PURE__*/React.createElement(UnifiedShareModal, {
|
|
1006
|
+
canInvite: true,
|
|
1007
|
+
changeSharedLinkAccessLevel: newLevel => {
|
|
1008
|
+
return fakeRequest().then(() => {
|
|
1009
|
+
const newSharedLink = _objectSpread(_objectSpread({}, sharedLink), {}, {
|
|
1010
|
+
accessLevel: newLevel
|
|
1011
|
+
});
|
|
1012
|
+
setSharedLink(newSharedLink);
|
|
1013
|
+
return newSharedLink;
|
|
1014
|
+
});
|
|
1015
|
+
},
|
|
1016
|
+
changeSharedLinkPermissionLevel: newLevel => {
|
|
1017
|
+
return fakeRequest().then(() => {
|
|
1018
|
+
const newSharedLink = _objectSpread(_objectSpread({}, sharedLink), {}, {
|
|
1019
|
+
permissionLevel: newLevel
|
|
1020
|
+
});
|
|
1021
|
+
setSharedLink(newSharedLink);
|
|
1022
|
+
return newSharedLink;
|
|
1023
|
+
});
|
|
1024
|
+
},
|
|
1025
|
+
collaboratorsList: collaboratorsList,
|
|
1026
|
+
collaborationRestrictionWarning: "Collaboration invitations can only be sent to people within Box Corporate",
|
|
1027
|
+
currentUserID: currentUserId,
|
|
1028
|
+
getCollaboratorContacts: () => {
|
|
1029
|
+
return Promise.resolve(contacts);
|
|
1030
|
+
},
|
|
1031
|
+
getSharedLinkContacts: () => {
|
|
1032
|
+
return Promise.resolve(contacts);
|
|
1033
|
+
},
|
|
1034
|
+
getInitialData: getInitialData,
|
|
1035
|
+
inviteePermissions: [{
|
|
1036
|
+
default: false,
|
|
1037
|
+
text: 'Co-owner',
|
|
1038
|
+
value: 'Co-owner'
|
|
1039
|
+
}, {
|
|
1040
|
+
default: true,
|
|
1041
|
+
text: 'Editor',
|
|
1042
|
+
value: 'Editor'
|
|
1043
|
+
}, {
|
|
1044
|
+
default: false,
|
|
1045
|
+
text: 'Viewer Uploader',
|
|
1046
|
+
value: 'Viewer Uploader'
|
|
1047
|
+
}, {
|
|
1048
|
+
default: false,
|
|
1049
|
+
text: 'Previewer Uploader',
|
|
1050
|
+
value: 'Previewer Uploader'
|
|
1051
|
+
}, {
|
|
1052
|
+
default: false,
|
|
1053
|
+
text: 'Viewer',
|
|
1054
|
+
value: 'Viewer'
|
|
1055
|
+
}, {
|
|
1056
|
+
default: false,
|
|
1057
|
+
text: 'Previewer',
|
|
1058
|
+
value: 'Previewer'
|
|
1059
|
+
}, {
|
|
1060
|
+
default: false,
|
|
1061
|
+
text: 'Uploader',
|
|
1062
|
+
value: 'Uploader'
|
|
1063
|
+
}],
|
|
1064
|
+
isOpen: isOpen,
|
|
1065
|
+
isToggleEnabled: true,
|
|
1066
|
+
item: ITEM,
|
|
1067
|
+
onAddLink: () => {
|
|
1068
|
+
fakeRequest().then(() => {
|
|
1069
|
+
setSharedLink({
|
|
1070
|
+
accessLevel: 'peopleInYourCompany',
|
|
1071
|
+
allowedAccessLevels: {
|
|
1072
|
+
peopleWithTheLink: true,
|
|
1073
|
+
peopleInYourCompany: true,
|
|
1074
|
+
peopleInThisItem: true
|
|
1075
|
+
},
|
|
1076
|
+
canChangeAccessLevel: true,
|
|
1077
|
+
enterpriseName: 'Box',
|
|
1078
|
+
expirationTimestamp: 1509173940,
|
|
1079
|
+
isDownloadAllowed: true,
|
|
1080
|
+
isDownloadSettingAvailable: true,
|
|
1081
|
+
isEditAllowed: true,
|
|
1082
|
+
isEditSettingAvailable: true,
|
|
1083
|
+
isNewSharedLink: true,
|
|
1084
|
+
isPreviewAllowed: true,
|
|
1085
|
+
permissionLevel: 'canViewDownload',
|
|
1086
|
+
url: 'https://box.com/s/abcdefg'
|
|
1087
|
+
});
|
|
1088
|
+
});
|
|
1089
|
+
},
|
|
1090
|
+
onRemoveLink: () => {
|
|
1091
|
+
fakeRequest().then(() => {
|
|
1092
|
+
setSharedLink(DEFAULT_SHARED_LINK_STATE);
|
|
1093
|
+
closeModal();
|
|
1094
|
+
});
|
|
1095
|
+
},
|
|
1096
|
+
onRemoveCollaborator: async collaborator => {
|
|
1097
|
+
await fakeRequest();
|
|
1098
|
+
const collaborators = collaboratorsList.collaborators.filter(({
|
|
1099
|
+
collabID
|
|
1100
|
+
}) => collabID !== collaborator.collabID);
|
|
1101
|
+
setCollaboratorsList({
|
|
1102
|
+
collaborators
|
|
1103
|
+
});
|
|
1104
|
+
},
|
|
1105
|
+
onRequestClose: closeModal
|
|
1106
|
+
/* eslint-disable-next-line no-alert */,
|
|
1107
|
+
onSettingsClick: () => alert('hi!'),
|
|
1108
|
+
recommendedSharingTooltipCalloutName: "",
|
|
1109
|
+
sendInvites: () => fakeRequest().then(() => {
|
|
1110
|
+
closeModal();
|
|
1111
|
+
}),
|
|
1112
|
+
sendInvitesError: "",
|
|
1113
|
+
sendSharedLink: () => fakeRequest().then(() => {
|
|
1114
|
+
closeModal();
|
|
1115
|
+
}),
|
|
1116
|
+
sendSharedLinkError: "",
|
|
1117
|
+
sharedLink: sharedLink,
|
|
1118
|
+
showCalloutForUser: true,
|
|
1119
|
+
showUpgradeOptions: true,
|
|
1120
|
+
submitting: isSubmitting,
|
|
1121
|
+
suggestedCollaborators: {
|
|
1122
|
+
'2': {
|
|
1123
|
+
id: '2',
|
|
1124
|
+
userScore: 0.1,
|
|
1125
|
+
name: 'David',
|
|
1126
|
+
email: 'dt@example.com',
|
|
1127
|
+
type: 'user'
|
|
1128
|
+
},
|
|
1129
|
+
'5': {
|
|
1130
|
+
id: '5',
|
|
1131
|
+
userScore: 0.2,
|
|
1132
|
+
name: 'Will',
|
|
1133
|
+
email: 'wy@example.com',
|
|
1134
|
+
type: 'user'
|
|
1135
|
+
},
|
|
1136
|
+
'1': {
|
|
1137
|
+
id: '1',
|
|
1138
|
+
userScore: 0.5,
|
|
1139
|
+
name: 'Jeff',
|
|
1140
|
+
email: 'jt@example.com',
|
|
1141
|
+
type: 'user'
|
|
1142
|
+
},
|
|
1143
|
+
'3': {
|
|
1144
|
+
id: '3',
|
|
1145
|
+
userScore: 2,
|
|
1146
|
+
name: 'Yang',
|
|
1147
|
+
email: 'yz@example.com',
|
|
1148
|
+
type: 'user'
|
|
1149
|
+
}
|
|
1150
|
+
},
|
|
1151
|
+
trackingProps: {
|
|
1152
|
+
collaboratorListTracking: {},
|
|
1153
|
+
inviteCollabsEmailTracking: {},
|
|
1154
|
+
inviteCollabTracking: {},
|
|
1155
|
+
modalTracking: {},
|
|
1156
|
+
removeLinkConfirmModalTracking: {},
|
|
1157
|
+
removeCollaboratorConfirmModalTracking: {},
|
|
1158
|
+
sharedLinkEmailTracking: {},
|
|
1159
|
+
sharedLinkTracking: {}
|
|
1160
|
+
},
|
|
1161
|
+
canRemoveCollaborators: true
|
|
1162
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
1163
|
+
onClick: () => setIsOpen(true)
|
|
1164
|
+
}, "Open USM Modal"));
|
|
1165
|
+
};
|
|
949
1166
|
export default {
|
|
950
1167
|
title: 'Features/UnifiedShareModal',
|
|
951
1168
|
component: UnifiedShareModal
|
|
@@ -140,7 +140,7 @@ const contacts: Array<contactType> = [
|
|
|
140
140
|
collabID: '8',
|
|
141
141
|
name: 'Wenbo',
|
|
142
142
|
email: 'w@example.com',
|
|
143
|
-
type: '
|
|
143
|
+
type: 'pending',
|
|
144
144
|
hasCustomAvatar: false,
|
|
145
145
|
translatedRole: 'Editor',
|
|
146
146
|
userID: '8',
|
|
@@ -199,7 +199,7 @@ export const basic = () => {
|
|
|
199
199
|
const collaborators: Array<collaboratorType> = contacts.slice().map(contact => {
|
|
200
200
|
// convert the existing contact entries to compatible collaborator entries in this example
|
|
201
201
|
const collaborator: collaboratorType = {
|
|
202
|
-
collabID:
|
|
202
|
+
collabID: contact.collabID,
|
|
203
203
|
email: contact.email,
|
|
204
204
|
id: contact.id,
|
|
205
205
|
name: contact.name || '',
|
|
@@ -209,6 +209,7 @@ export const basic = () => {
|
|
|
209
209
|
expiration: { executeAt: contact.isExternalUser ? 'November 27, 2022' : '' },
|
|
210
210
|
hasCustomAvatar: false,
|
|
211
211
|
imageURL: null,
|
|
212
|
+
translatedRole: contact.translatedRole,
|
|
212
213
|
};
|
|
213
214
|
|
|
214
215
|
return collaborator;
|
|
@@ -766,7 +767,7 @@ export const withFormOnly = () => {
|
|
|
766
767
|
const collaborators: Array<collaboratorType> = contacts.slice().map(contact => {
|
|
767
768
|
// convert the existing contact entries to compatible collaborator entries in this example
|
|
768
769
|
const collaborator: collaboratorType = {
|
|
769
|
-
collabID:
|
|
770
|
+
collabID: contact.collabID,
|
|
770
771
|
email: contact.email,
|
|
771
772
|
expiration: { executeAt: contact.isExternalUser ? 'November 27, 2022' : '' },
|
|
772
773
|
imageURL: null,
|
|
@@ -920,6 +921,210 @@ export const withFormOnly = () => {
|
|
|
920
921
|
);
|
|
921
922
|
};
|
|
922
923
|
|
|
924
|
+
export const withRemoveCollaborators = () => {
|
|
925
|
+
const currentUserId = '0';
|
|
926
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
927
|
+
const [sharedLink, setSharedLink] = React.useState<sharedLinkType>(DEFAULT_SHARED_LINK_STATE);
|
|
928
|
+
const [isSubmitting, setIsSubmitting] = React.useState(false);
|
|
929
|
+
const [collaboratorsList, setCollaboratorsList] = React.useState<collaboratorsListType>(
|
|
930
|
+
INITIAL_STATE.collaboratorsList,
|
|
931
|
+
);
|
|
932
|
+
|
|
933
|
+
const closeModal = () => {
|
|
934
|
+
setIsOpen(false);
|
|
935
|
+
setSharedLink(DEFAULT_SHARED_LINK_STATE);
|
|
936
|
+
setCollaboratorsList({ collaborators: [] });
|
|
937
|
+
};
|
|
938
|
+
|
|
939
|
+
const fakeRequest = () => {
|
|
940
|
+
// submitting is used to disable input fields, and not to show the loading indicator
|
|
941
|
+
setIsSubmitting(true);
|
|
942
|
+
return new Promise(resolve => {
|
|
943
|
+
setTimeout(() => {
|
|
944
|
+
setIsSubmitting(false);
|
|
945
|
+
resolve();
|
|
946
|
+
}, 500);
|
|
947
|
+
});
|
|
948
|
+
};
|
|
949
|
+
|
|
950
|
+
const getInitialData = () => {
|
|
951
|
+
const initialPromise = fakeRequest();
|
|
952
|
+
const fetchCollaborators = new Promise(resolved => {
|
|
953
|
+
setTimeout(() => {
|
|
954
|
+
const collaborators: Array<collaboratorType> = contacts.slice().map(contact => {
|
|
955
|
+
// convert the existing contact entries to compatible collaborator entries in this example
|
|
956
|
+
const collaborator: collaboratorType = {
|
|
957
|
+
collabID: contact.collabID,
|
|
958
|
+
email: contact.email,
|
|
959
|
+
id: contact.id,
|
|
960
|
+
name: contact.name || '',
|
|
961
|
+
type: contact.type,
|
|
962
|
+
isExternalCollab: contact.isExternalUser || false,
|
|
963
|
+
userID: parseInt(contact.id, 10),
|
|
964
|
+
expiration: { executeAt: contact.isExternalUser ? 'November 27, 2022' : '' },
|
|
965
|
+
hasCustomAvatar: false,
|
|
966
|
+
imageURL: null,
|
|
967
|
+
translatedRole: contact.translatedRole,
|
|
968
|
+
isRemovable: currentUserId !== contact.userID,
|
|
969
|
+
};
|
|
970
|
+
|
|
971
|
+
return collaborator;
|
|
972
|
+
});
|
|
973
|
+
|
|
974
|
+
setCollaboratorsList({
|
|
975
|
+
collaborators,
|
|
976
|
+
});
|
|
977
|
+
resolved();
|
|
978
|
+
}, 1000);
|
|
979
|
+
});
|
|
980
|
+
return Promise.all([initialPromise, fetchCollaborators]);
|
|
981
|
+
};
|
|
982
|
+
|
|
983
|
+
return (
|
|
984
|
+
<div>
|
|
985
|
+
{isOpen && (
|
|
986
|
+
<UnifiedShareModal
|
|
987
|
+
canInvite
|
|
988
|
+
changeSharedLinkAccessLevel={newLevel => {
|
|
989
|
+
return fakeRequest().then(() => {
|
|
990
|
+
const newSharedLink = {
|
|
991
|
+
...sharedLink,
|
|
992
|
+
accessLevel: newLevel,
|
|
993
|
+
};
|
|
994
|
+
setSharedLink(newSharedLink);
|
|
995
|
+
return newSharedLink;
|
|
996
|
+
});
|
|
997
|
+
}}
|
|
998
|
+
changeSharedLinkPermissionLevel={newLevel => {
|
|
999
|
+
return fakeRequest().then(() => {
|
|
1000
|
+
const newSharedLink = {
|
|
1001
|
+
...sharedLink,
|
|
1002
|
+
permissionLevel: newLevel,
|
|
1003
|
+
};
|
|
1004
|
+
setSharedLink(newSharedLink);
|
|
1005
|
+
return newSharedLink;
|
|
1006
|
+
});
|
|
1007
|
+
}}
|
|
1008
|
+
collaboratorsList={collaboratorsList}
|
|
1009
|
+
collaborationRestrictionWarning="Collaboration invitations can only be sent to people within Box Corporate"
|
|
1010
|
+
currentUserID={currentUserId}
|
|
1011
|
+
getCollaboratorContacts={() => {
|
|
1012
|
+
return Promise.resolve(contacts);
|
|
1013
|
+
}}
|
|
1014
|
+
getSharedLinkContacts={() => {
|
|
1015
|
+
return Promise.resolve(contacts);
|
|
1016
|
+
}}
|
|
1017
|
+
getInitialData={getInitialData}
|
|
1018
|
+
inviteePermissions={[
|
|
1019
|
+
{ default: false, text: 'Co-owner', value: 'Co-owner' },
|
|
1020
|
+
{ default: true, text: 'Editor', value: 'Editor' },
|
|
1021
|
+
{ default: false, text: 'Viewer Uploader', value: 'Viewer Uploader' },
|
|
1022
|
+
{ default: false, text: 'Previewer Uploader', value: 'Previewer Uploader' },
|
|
1023
|
+
{ default: false, text: 'Viewer', value: 'Viewer' },
|
|
1024
|
+
{ default: false, text: 'Previewer', value: 'Previewer' },
|
|
1025
|
+
{ default: false, text: 'Uploader', value: 'Uploader' },
|
|
1026
|
+
]}
|
|
1027
|
+
isOpen={isOpen}
|
|
1028
|
+
isToggleEnabled
|
|
1029
|
+
item={ITEM}
|
|
1030
|
+
onAddLink={() => {
|
|
1031
|
+
fakeRequest().then(() => {
|
|
1032
|
+
setSharedLink({
|
|
1033
|
+
accessLevel: 'peopleInYourCompany',
|
|
1034
|
+
allowedAccessLevels: {
|
|
1035
|
+
peopleWithTheLink: true,
|
|
1036
|
+
peopleInYourCompany: true,
|
|
1037
|
+
peopleInThisItem: true,
|
|
1038
|
+
},
|
|
1039
|
+
canChangeAccessLevel: true,
|
|
1040
|
+
enterpriseName: 'Box',
|
|
1041
|
+
expirationTimestamp: 1509173940,
|
|
1042
|
+
isDownloadAllowed: true,
|
|
1043
|
+
isDownloadSettingAvailable: true,
|
|
1044
|
+
isEditAllowed: true,
|
|
1045
|
+
isEditSettingAvailable: true,
|
|
1046
|
+
isNewSharedLink: true,
|
|
1047
|
+
isPreviewAllowed: true,
|
|
1048
|
+
permissionLevel: 'canViewDownload',
|
|
1049
|
+
url: 'https://box.com/s/abcdefg',
|
|
1050
|
+
});
|
|
1051
|
+
});
|
|
1052
|
+
}}
|
|
1053
|
+
onRemoveLink={() => {
|
|
1054
|
+
fakeRequest().then(() => {
|
|
1055
|
+
setSharedLink(DEFAULT_SHARED_LINK_STATE);
|
|
1056
|
+
closeModal();
|
|
1057
|
+
});
|
|
1058
|
+
}}
|
|
1059
|
+
onRemoveCollaborator={async (collaborator: collaboratorType) => {
|
|
1060
|
+
await fakeRequest();
|
|
1061
|
+
const collaborators = collaboratorsList.collaborators.filter(
|
|
1062
|
+
({ collabID }) => collabID !== collaborator.collabID,
|
|
1063
|
+
);
|
|
1064
|
+
setCollaboratorsList({ collaborators });
|
|
1065
|
+
}}
|
|
1066
|
+
onRequestClose={closeModal}
|
|
1067
|
+
/* eslint-disable-next-line no-alert */
|
|
1068
|
+
onSettingsClick={() => alert('hi!')}
|
|
1069
|
+
recommendedSharingTooltipCalloutName=""
|
|
1070
|
+
sendInvites={() =>
|
|
1071
|
+
fakeRequest().then(() => {
|
|
1072
|
+
closeModal();
|
|
1073
|
+
})
|
|
1074
|
+
}
|
|
1075
|
+
sendInvitesError=""
|
|
1076
|
+
sendSharedLink={() =>
|
|
1077
|
+
fakeRequest().then(() => {
|
|
1078
|
+
closeModal();
|
|
1079
|
+
})
|
|
1080
|
+
}
|
|
1081
|
+
sendSharedLinkError=""
|
|
1082
|
+
sharedLink={sharedLink}
|
|
1083
|
+
showCalloutForUser
|
|
1084
|
+
showUpgradeOptions
|
|
1085
|
+
submitting={isSubmitting}
|
|
1086
|
+
suggestedCollaborators={{
|
|
1087
|
+
'2': {
|
|
1088
|
+
id: '2',
|
|
1089
|
+
userScore: 0.1,
|
|
1090
|
+
name: 'David',
|
|
1091
|
+
email: 'dt@example.com',
|
|
1092
|
+
type: 'user',
|
|
1093
|
+
},
|
|
1094
|
+
'5': {
|
|
1095
|
+
id: '5',
|
|
1096
|
+
userScore: 0.2,
|
|
1097
|
+
name: 'Will',
|
|
1098
|
+
email: 'wy@example.com',
|
|
1099
|
+
type: 'user',
|
|
1100
|
+
},
|
|
1101
|
+
'1': {
|
|
1102
|
+
id: '1',
|
|
1103
|
+
userScore: 0.5,
|
|
1104
|
+
name: 'Jeff',
|
|
1105
|
+
email: 'jt@example.com',
|
|
1106
|
+
type: 'user',
|
|
1107
|
+
},
|
|
1108
|
+
'3': { id: '3', userScore: 2, name: 'Yang', email: 'yz@example.com', type: 'user' },
|
|
1109
|
+
}}
|
|
1110
|
+
trackingProps={{
|
|
1111
|
+
collaboratorListTracking: {},
|
|
1112
|
+
inviteCollabsEmailTracking: {},
|
|
1113
|
+
inviteCollabTracking: {},
|
|
1114
|
+
modalTracking: {},
|
|
1115
|
+
removeLinkConfirmModalTracking: {},
|
|
1116
|
+
removeCollaboratorConfirmModalTracking: {},
|
|
1117
|
+
sharedLinkEmailTracking: {},
|
|
1118
|
+
sharedLinkTracking: {},
|
|
1119
|
+
}}
|
|
1120
|
+
canRemoveCollaborators
|
|
1121
|
+
/>
|
|
1122
|
+
)}
|
|
1123
|
+
<Button onClick={() => setIsOpen(true)}>Open USM Modal</Button>
|
|
1124
|
+
</div>
|
|
1125
|
+
);
|
|
1126
|
+
};
|
|
1127
|
+
|
|
923
1128
|
export default {
|
|
924
1129
|
title: 'Features/UnifiedShareModal',
|
|
925
1130
|
component: UnifiedShareModal,
|