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
|
@@ -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,
|