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.
Files changed (117) hide show
  1. package/dist/explorer.css +1 -1
  2. package/dist/explorer.js +1 -1
  3. package/dist/openwith.js +1 -1
  4. package/dist/picker.js +1 -1
  5. package/dist/preview.css +1 -1
  6. package/dist/preview.js +1 -1
  7. package/dist/sharing.css +1 -1
  8. package/dist/sharing.js +1 -1
  9. package/dist/sidebar.js +1 -1
  10. package/dist/uploader.js +1 -1
  11. package/es/elements/common/content-answers/ContentAnswersOpenButton.scss +1 -1
  12. package/es/features/collaborator-avatars/CollaboratorList.js +5 -1
  13. package/es/features/collaborator-avatars/CollaboratorList.js.flow +12 -1
  14. package/es/features/collaborator-avatars/CollaboratorList.js.map +1 -1
  15. package/es/features/collaborator-avatars/CollaboratorList.scss +3 -0
  16. package/es/features/collaborator-avatars/CollaboratorListItem.js +26 -5
  17. package/es/features/collaborator-avatars/CollaboratorListItem.js.flow +33 -9
  18. package/es/features/collaborator-avatars/CollaboratorListItem.js.map +1 -1
  19. package/es/features/collaborator-avatars/CollaboratorListItem.scss +23 -0
  20. package/es/features/message-center/components/MessageCenter.js +1 -0
  21. package/es/features/message-center/components/MessageCenter.js.flow +2 -1
  22. package/es/features/message-center/components/MessageCenter.js.map +1 -1
  23. package/es/features/unified-share-modal/RemoveCollaboratorConfirmModal.js +44 -0
  24. package/es/features/unified-share-modal/RemoveCollaboratorConfirmModal.js.flow +67 -0
  25. package/es/features/unified-share-modal/RemoveCollaboratorConfirmModal.js.map +1 -0
  26. package/es/features/unified-share-modal/UnifiedShareForm.js +8 -3
  27. package/es/features/unified-share-modal/UnifiedShareForm.js.flow +5 -1
  28. package/es/features/unified-share-modal/UnifiedShareForm.js.map +1 -1
  29. package/es/features/unified-share-modal/UnifiedShareModal.js +54 -10
  30. package/es/features/unified-share-modal/UnifiedShareModal.js.flow +59 -11
  31. package/es/features/unified-share-modal/UnifiedShareModal.js.map +1 -1
  32. package/es/features/unified-share-modal/UnifiedShareModal.scss +9 -2
  33. package/es/features/unified-share-modal/flowTypes.js.flow +13 -0
  34. package/es/features/unified-share-modal/flowTypes.js.map +1 -1
  35. package/es/features/unified-share-modal/messages.js +8 -0
  36. package/es/features/unified-share-modal/messages.js.flow +10 -0
  37. package/es/features/unified-share-modal/messages.js.map +1 -1
  38. package/es/features/unified-share-modal/stories/UnifiedShareModal.stories.js +221 -4
  39. package/es/features/unified-share-modal/stories/UnifiedShareModal.stories.js.flow +208 -3
  40. package/es/features/unified-share-modal/stories/UnifiedShareModal.stories.js.map +1 -1
  41. package/es/src/elements/content-sidebar/stories/tests/MetadataSidebarRedesign-visual.stories.d.ts +4 -4
  42. package/i18n/bn-IN.js +2 -0
  43. package/i18n/bn-IN.properties +4 -0
  44. package/i18n/da-DK.js +2 -0
  45. package/i18n/da-DK.properties +4 -0
  46. package/i18n/de-DE.js +2 -0
  47. package/i18n/de-DE.properties +4 -0
  48. package/i18n/en-AU.js +2 -0
  49. package/i18n/en-AU.properties +4 -0
  50. package/i18n/en-CA.js +2 -0
  51. package/i18n/en-CA.properties +4 -0
  52. package/i18n/en-GB.js +2 -0
  53. package/i18n/en-GB.properties +4 -0
  54. package/i18n/en-US.js +2 -0
  55. package/i18n/en-US.properties +4 -0
  56. package/i18n/en-x-pseudo.js +1010 -1008
  57. package/i18n/en-x-pseudo.properties +1012 -1008
  58. package/i18n/es-419.js +2 -0
  59. package/i18n/es-419.properties +4 -0
  60. package/i18n/es-ES.js +2 -0
  61. package/i18n/es-ES.properties +4 -0
  62. package/i18n/fi-FI.js +2 -0
  63. package/i18n/fi-FI.properties +4 -0
  64. package/i18n/fr-CA.js +2 -0
  65. package/i18n/fr-CA.properties +4 -0
  66. package/i18n/fr-FR.js +2 -0
  67. package/i18n/fr-FR.properties +4 -0
  68. package/i18n/hi-IN.js +2 -0
  69. package/i18n/hi-IN.properties +4 -0
  70. package/i18n/it-IT.js +2 -0
  71. package/i18n/it-IT.properties +4 -0
  72. package/i18n/ja-JP.js +2 -0
  73. package/i18n/ja-JP.properties +4 -0
  74. package/i18n/ko-KR.js +2 -0
  75. package/i18n/ko-KR.properties +4 -0
  76. package/i18n/nb-NO.js +2 -0
  77. package/i18n/nb-NO.properties +4 -0
  78. package/i18n/nl-NL.js +2 -0
  79. package/i18n/nl-NL.properties +4 -0
  80. package/i18n/pl-PL.js +2 -0
  81. package/i18n/pl-PL.properties +4 -0
  82. package/i18n/pt-BR.js +2 -0
  83. package/i18n/pt-BR.properties +4 -0
  84. package/i18n/ru-RU.js +2 -0
  85. package/i18n/ru-RU.properties +4 -0
  86. package/i18n/sv-SE.js +2 -0
  87. package/i18n/sv-SE.properties +4 -0
  88. package/i18n/tr-TR.js +2 -0
  89. package/i18n/tr-TR.properties +4 -0
  90. package/i18n/zh-CN.js +2 -0
  91. package/i18n/zh-CN.properties +4 -0
  92. package/i18n/zh-TW.js +2 -0
  93. package/i18n/zh-TW.properties +4 -0
  94. package/package.json +18 -18
  95. package/src/elements/common/content-answers/ContentAnswersOpenButton.scss +1 -1
  96. package/src/features/collaborator-avatars/CollaboratorList.js +12 -1
  97. package/src/features/collaborator-avatars/CollaboratorList.scss +3 -0
  98. package/src/features/collaborator-avatars/CollaboratorListItem.js +33 -9
  99. package/src/features/collaborator-avatars/CollaboratorListItem.scss +23 -0
  100. package/src/features/collaborator-avatars/__tests__/CollaboratorList.test.js +11 -0
  101. package/src/features/collaborator-avatars/__tests__/CollaboratorListItem.test.js +51 -0
  102. package/src/features/collaborator-avatars/__tests__/__snapshots__/CollaboratorList.test.js.snap +110 -0
  103. package/src/features/collaborator-avatars/__tests__/__snapshots__/CollaboratorListItem.test.js.snap +310 -0
  104. package/src/features/message-center/__tests__/MessageCenter.integration.test.js +10 -0
  105. package/src/features/message-center/components/MessageCenter.js +2 -1
  106. package/src/features/unified-share-modal/README.md +12 -1
  107. package/src/features/unified-share-modal/RemoveCollaboratorConfirmModal.js +67 -0
  108. package/src/features/unified-share-modal/UnifiedShareForm.js +5 -1
  109. package/src/features/unified-share-modal/UnifiedShareModal.js +59 -11
  110. package/src/features/unified-share-modal/UnifiedShareModal.scss +9 -2
  111. package/src/features/unified-share-modal/__tests__/RemoveCollaboratorConfirmModal.test.js +64 -0
  112. package/src/features/unified-share-modal/__tests__/UnifiedShareForm.test.js +34 -1
  113. package/src/features/unified-share-modal/__tests__/UnifiedShareModal.test.js +74 -4
  114. package/src/features/unified-share-modal/__tests__/__snapshots__/UnifiedShareModal.test.js.snap +258 -0
  115. package/src/features/unified-share-modal/flowTypes.js +13 -0
  116. package/src/features/unified-share-modal/messages.js +10 -0
  117. 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: 'user',
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: 1234,
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: 1234,
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,