cozy-sharing 10.2.0 → 10.3.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 (138) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/ConfirmTrustedRecipientsDialog.js +1 -1
  3. package/dist/ShareButton.js +1 -1
  4. package/dist/ShareButton.spec.js +1 -1
  5. package/dist/SharedBadge.js +1 -1
  6. package/dist/SharedRecipients.js +1 -1
  7. package/dist/SharedRecipientsList.js +1 -1
  8. package/dist/SharedStatus.js +1 -1
  9. package/dist/SharingOwnerAvatar.js +1 -1
  10. package/dist/components/CozyPassFingerprintDialogContent.js +1 -1
  11. package/dist/components/Recipient/Identity.js +17 -17
  12. package/dist/components/Recipient/LinkRecipient.js +18 -18
  13. package/dist/components/Recipient/OwnerIdentity.js +18 -18
  14. package/dist/components/Recipient/RecipientConfirm.js +25 -25
  15. package/dist/components/Recipient/RecipientList.js +36 -0
  16. package/dist/components/Recipient/RecipientPlusX.js +18 -18
  17. package/dist/components/Recipient/RecipientStatus.js +17 -17
  18. package/dist/components/Recipient/RecipientWithoutStatus.js +18 -18
  19. package/dist/components/Recipient/RecipientsAvatars.js +18 -18
  20. package/dist/components/ShareAutosuggest.js +12 -12
  21. package/dist/components/ShareButton.js +2 -2
  22. package/dist/components/ShareByEmail.js +26 -26
  23. package/dist/components/ShareDialogCozyToCozy.js +25 -25
  24. package/dist/components/{EditableSharingModal.js → ShareModal/EditableSharingModal.js} +5 -5
  25. package/dist/components/{EditableSharingModal.spec.js → ShareModal/EditableSharingModal.spec.js} +6 -6
  26. package/dist/components/ShareModal/ShareModal.js +43 -0
  27. package/dist/{SharingDetailsModal.js → components/ShareModal/SharingDetailsModal.js} +28 -28
  28. package/dist/components/SharedBadge.js +6 -6
  29. package/dist/components/SharedStatus.js +4 -4
  30. package/dist/components/Sharetypeselect.js +25 -25
  31. package/dist/{SharingBanner → components/SharingBanner}/components/PublicBanner.js +1 -1
  32. package/dist/{SharingBanner → components/SharingBanner}/hooks/useSharingInfos.js +2 -2
  33. package/dist/{SharingBanner → components/SharingBanner}/index.js +1 -1
  34. package/dist/{SharingBanner → components/SharingBanner}/test/AppLike.js +2 -2
  35. package/dist/components/Tooltip.js +2 -2
  36. package/dist/components/WhoHasAccess.js +10 -20
  37. package/dist/components/WhoHasAccessLight.js +19 -1
  38. package/dist/{withLocales.js → hoc/withLocales.js} +2 -2
  39. package/dist/index.js +5 -5
  40. package/dist/{SharingBanner/components → styles}/publicBanner.styl +5 -5
  41. package/dist/stylesheet.css +340 -340
  42. package/docs/share-modal-architecture.md +44 -0
  43. package/package.json +2 -2
  44. package/src/ConfirmTrustedRecipientsDialog.jsx +1 -1
  45. package/src/ShareButton.jsx +1 -1
  46. package/src/ShareButton.spec.jsx +1 -1
  47. package/src/SharedBadge.jsx +1 -1
  48. package/src/SharedRecipients.jsx +1 -1
  49. package/src/SharedRecipientsList.jsx +1 -1
  50. package/src/SharedStatus.jsx +1 -1
  51. package/src/SharingOwnerAvatar.jsx +1 -1
  52. package/src/assets/icons/icon-arrow-down.svg +3 -0
  53. package/src/assets/icons/icon-calendar-16.svg +8 -0
  54. package/src/assets/icons/icon-check-blue.svg +59 -0
  55. package/src/assets/icons/icon-cross-bold.svg +5 -0
  56. package/src/assets/icons/icon-link.svg +14 -0
  57. package/src/assets/icons/icon-pen-16.svg +3 -0
  58. package/src/components/CozyPassFingerprintDialogContent.jsx +1 -1
  59. package/src/components/Recipient/Identity.jsx +1 -1
  60. package/src/components/Recipient/LinkRecipient.jsx +1 -1
  61. package/src/components/Recipient/OwnerIdentity.jsx +1 -1
  62. package/src/components/Recipient/RecipientConfirm.jsx +1 -1
  63. package/src/components/Recipient/RecipientList.jsx +45 -0
  64. package/src/components/Recipient/RecipientPlusX.jsx +1 -1
  65. package/src/components/Recipient/RecipientStatus.jsx +1 -1
  66. package/src/components/Recipient/RecipientWithoutStatus.jsx +1 -1
  67. package/src/components/Recipient/RecipientsAvatars.jsx +1 -1
  68. package/src/components/ShareAutosuggest.jsx +1 -1
  69. package/src/components/ShareButton.jsx +1 -1
  70. package/src/components/ShareByEmail.jsx +1 -1
  71. package/src/components/ShareDialogCozyToCozy.jsx +1 -1
  72. package/src/components/{EditableSharingModal.jsx → ShareModal/EditableSharingModal.jsx} +5 -5
  73. package/src/components/{EditableSharingModal.spec.jsx → ShareModal/EditableSharingModal.spec.jsx} +6 -6
  74. package/src/components/ShareModal/ShareModal.jsx +45 -0
  75. package/src/{SharingDetailsModal.jsx → components/ShareModal/SharingDetailsModal.jsx} +4 -4
  76. package/src/components/SharedBadge.jsx +1 -1
  77. package/src/components/SharedStatus.jsx +2 -2
  78. package/src/components/Sharetypeselect.jsx +1 -1
  79. package/src/{SharingBanner → components/SharingBanner}/components/PublicBanner.jsx +1 -1
  80. package/src/{SharingBanner → components/SharingBanner}/hooks/useSharingInfos.jsx +2 -2
  81. package/src/{SharingBanner → components/SharingBanner}/index.jsx +1 -1
  82. package/src/{SharingBanner → components/SharingBanner}/test/AppLike.jsx +2 -2
  83. package/src/components/Tooltip.jsx +1 -1
  84. package/src/components/WhoHasAccess.jsx +11 -29
  85. package/src/components/WhoHasAccessLight.jsx +1 -1
  86. package/src/{withLocales.jsx → hoc/withLocales.jsx} +2 -2
  87. package/src/index.jsx +6 -5
  88. package/src/{SharingBanner/components → styles}/publicBanner.styl +5 -5
  89. package/dist/ShareModal.js +0 -50
  90. package/src/ShareModal.jsx +0 -51
  91. /package/{assets → dist/assets}/icons/icon-arrow-down.svg +0 -0
  92. /package/{assets → dist/assets}/icons/icon-calendar-16.svg +0 -0
  93. /package/{assets → dist/assets}/icons/icon-check-blue.svg +0 -0
  94. /package/{assets → dist/assets}/icons/icon-cross-bold.svg +0 -0
  95. /package/{assets → dist/assets}/icons/icon-link.svg +0 -0
  96. /package/{assets → dist/assets}/icons/icon-pen-16.svg +0 -0
  97. /package/dist/{SharingBanner → components/SharingBanner}/components/CozyHomeLinkIcon.js +0 -0
  98. /package/dist/{SharingBanner → components/SharingBanner}/components/PublicBanner.spec.js +0 -0
  99. /package/dist/{SharingBanner → components/SharingBanner}/components/SharingBanner.js +0 -0
  100. /package/dist/{SharingBanner → components/SharingBanner}/helpers/QueryParameter.js +0 -0
  101. /package/dist/{SharingBanner → components/SharingBanner}/helpers/QueryParameter.spec.js +0 -0
  102. /package/dist/{SharingBanner → components/SharingBanner}/hooks/useSharingInfos.spec.js +0 -0
  103. /package/dist/{SharingBanner → components/SharingBanner}/test/AcceptingSharingContext.js +0 -0
  104. /package/dist/{SharingBanner → components/SharingBanner}/test/FabProvider.js +0 -0
  105. /package/dist/{SharingBanner → components/SharingBanner}/test/ModalContext.js +0 -0
  106. /package/dist/{SharingBanner → components/SharingBanner}/test/RouterContext.js +0 -0
  107. /package/dist/{SharingBanner → components/SharingBanner}/test/ThumbnailSizeContext.js +0 -0
  108. /package/dist/{components → hooks}/useFetchDocumentPath.js +0 -0
  109. /package/dist/{components → styles}/CozyPassFingerprintDialogContent.styl +0 -0
  110. /package/dist/{components → styles}/actionmenu.styl +0 -0
  111. /package/dist/{components → styles}/autosuggest.styl +0 -0
  112. /package/dist/{components → styles}/badge.styl +0 -0
  113. /package/dist/{components → styles}/button.styl +0 -0
  114. /package/dist/{components/Recipient → styles}/recipient.styl +0 -0
  115. /package/dist/{share.styl → styles/share.styl} +0 -0
  116. /package/dist/{components → styles}/status.styl +0 -0
  117. /package/dist/{components → styles}/tooltip.styl +0 -0
  118. /package/src/{SharingBanner → components/SharingBanner}/components/CozyHomeLinkIcon.jsx +0 -0
  119. /package/src/{SharingBanner → components/SharingBanner}/components/PublicBanner.spec.jsx +0 -0
  120. /package/src/{SharingBanner → components/SharingBanner}/components/SharingBanner.jsx +0 -0
  121. /package/src/{SharingBanner → components/SharingBanner}/helpers/QueryParameter.js +0 -0
  122. /package/src/{SharingBanner → components/SharingBanner}/helpers/QueryParameter.spec.js +0 -0
  123. /package/src/{SharingBanner → components/SharingBanner}/hooks/useSharingInfos.spec.js +0 -0
  124. /package/src/{SharingBanner → components/SharingBanner}/test/AcceptingSharingContext.jsx +0 -0
  125. /package/src/{SharingBanner → components/SharingBanner}/test/FabProvider.jsx +0 -0
  126. /package/src/{SharingBanner → components/SharingBanner}/test/ModalContext.jsx +0 -0
  127. /package/src/{SharingBanner → components/SharingBanner}/test/RouterContext.jsx +0 -0
  128. /package/src/{SharingBanner → components/SharingBanner}/test/ThumbnailSizeContext.jsx +0 -0
  129. /package/src/{components → hooks}/useFetchDocumentPath.jsx +0 -0
  130. /package/src/{components → styles}/CozyPassFingerprintDialogContent.styl +0 -0
  131. /package/src/{components → styles}/actionmenu.styl +0 -0
  132. /package/src/{components → styles}/autosuggest.styl +0 -0
  133. /package/src/{components → styles}/badge.styl +0 -0
  134. /package/src/{components → styles}/button.styl +0 -0
  135. /package/src/{components/Recipient → styles}/recipient.styl +0 -0
  136. /package/src/{share.styl → styles/share.styl} +0 -0
  137. /package/src/{components → styles}/status.styl +0 -0
  138. /package/src/{components → styles}/tooltip.styl +0 -0
@@ -6,9 +6,8 @@ import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
6
6
 
7
7
  import LinkRecipient from './Recipient/LinkRecipient'
8
8
  import OwnerRecipient from './Recipient/OwnerRecipient'
9
- import Recipient from './Recipient/Recipient'
9
+ import { RecipientList } from './Recipient/RecipientList'
10
10
  import { usePrevious } from '../helpers/hooks'
11
- import { filterAndReworkRecipients } from '../helpers/recipients'
12
11
 
13
12
  /**
14
13
  * Displays a warning if some contacts are waiting for confirmation of their sharing
@@ -43,15 +42,8 @@ const WhoHasAccess = ({
43
42
  onRevokeLink
44
43
  }) => {
45
44
  const previousLink = usePrevious(link)
46
- const previousRecipients = usePrevious(recipients)
47
-
48
45
  const linkHasBeenJustCreated = link && previousLink === null
49
46
 
50
- const recipientsToDisplay = filterAndReworkRecipients(
51
- recipients,
52
- previousRecipients
53
- )
54
-
55
47
  return (
56
48
  <div className={className}>
57
49
  <RecipientWaitingForConfirmationAlert
@@ -74,26 +66,16 @@ const WhoHasAccess = ({
74
66
 
75
67
  <OwnerRecipient recipients={recipients} />
76
68
 
77
- {recipientsToDisplay.map(recipient => {
78
- const recipientConfirmationData = recipientsToBeConfirmed.find(
79
- user => user.email === recipient.email
80
- )
81
-
82
- return (
83
- <Recipient
84
- {...recipient}
85
- key={`key_r_${recipient.index}`}
86
- isOwner={isOwner}
87
- document={document}
88
- documentType={documentType}
89
- onRevoke={onRevoke}
90
- onRevokeSelf={onRevokeSelf}
91
- recipientConfirmationData={recipientConfirmationData}
92
- verifyRecipient={verifyRecipient}
93
- fadeIn={recipient.hasBeenJustAdded}
94
- />
95
- )
96
- })}
69
+ <RecipientList
70
+ recipients={recipients}
71
+ recipientsToBeConfirmed={recipientsToBeConfirmed}
72
+ isOwner={isOwner}
73
+ document={document}
74
+ documentType={documentType}
75
+ onRevoke={onRevoke}
76
+ onRevokeSelf={onRevokeSelf}
77
+ verifyRecipient={verifyRecipient}
78
+ />
97
79
  </List>
98
80
  </div>
99
81
  )
@@ -3,7 +3,7 @@ import React from 'react'
3
3
 
4
4
  import RecipientPlusX from './Recipient/RecipientPlusX'
5
5
  import RecipientWithoutStatus from './Recipient/RecipientWithoutStatus'
6
- import styles from './recipient.styl'
6
+ import styles from '../styles/recipient.styl'
7
7
 
8
8
  const MAX_DISPLAYED_RECIPIENTS = 2
9
9
 
@@ -3,8 +3,8 @@ import React from 'react'
3
3
  import { I18n, translate } from 'cozy-ui/transpiled/react/providers/I18n'
4
4
 
5
5
  const locales = {
6
- en: require(`../locales/en.json`),
7
- fr: require(`../locales/fr.json`)
6
+ en: require(`../../locales/en.json`),
7
+ fr: require(`../../locales/fr.json`)
8
8
  }
9
9
 
10
10
  /**
package/src/index.jsx CHANGED
@@ -1,12 +1,14 @@
1
1
  import SharingProvider from './SharingProvider'
2
2
  import SharingContext from './context'
3
- import withLocales from './withLocales'
3
+ import withLocales from './hoc/withLocales'
4
4
 
5
5
  export default SharingProvider
6
6
 
7
7
  export { SharingContext, withLocales }
8
8
 
9
9
  export { useSharingContext } from './hooks/useSharingContext'
10
+ export { useFetchDocumentPath } from './hooks/useFetchDocumentPath'
11
+
10
12
  export { SharedDocument } from './SharedDocument'
11
13
  export { SharedStatus } from './SharedStatus'
12
14
  export { SharedBadge } from './SharedBadge'
@@ -14,12 +16,11 @@ export { SharingOwnerAvatar } from './SharingOwnerAvatar'
14
16
  export { SharedRecipients } from './SharedRecipients'
15
17
  export { SharedRecipientsList } from './SharedRecipientsList'
16
18
  export { ShareButton } from './ShareButton'
17
- export { ShareModal } from './ShareModal'
19
+ export { ShareModal } from './components/ShareModal/ShareModal'
18
20
  export { RefreshableSharings } from './RefreshableSharings'
19
- export { useFetchDocumentPath } from './components/useFetchDocumentPath'
20
21
  export { CozyPassFingerprintDialogContent } from './components/CozyPassFingerprintDialogContent'
21
- export { SharingBannerPlugin } from './SharingBanner'
22
- export { useSharingInfos } from './SharingBanner/hooks/useSharingInfos'
22
+ export { SharingBannerPlugin } from './components/SharingBanner'
23
+ export { useSharingInfos } from './components/SharingBanner/hooks/useSharingInfos'
23
24
  export { ConfirmTrustedRecipientsDialog } from './ConfirmTrustedRecipientsDialog'
24
25
  export { ShareButtonWithRecipients } from './ShareButtonWithRecipients'
25
26
  export { DOCUMENT_TYPE } from './helpers/documentType'
@@ -6,9 +6,9 @@
6
6
  img
7
7
  @extend $avatar
8
8
  @extend $circle
9
- width rem(16)
10
- height rem(16)
11
- min-width rem(16)
12
- min-height rem(16)
9
+ width rem(16)
10
+ height rem(16)
11
+ min-width rem(16)
12
+ min-height rem(16)
13
13
  font-size rem(7)
14
- vertical-align text-bottom
14
+ vertical-align text-bottom
@@ -1,50 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["document"];
4
- import omit from 'lodash/omit';
5
- import React from 'react';
6
- import { useLocation } from 'react-router';
7
- import { SharingDetailsModal } from './SharingDetailsModal';
8
- import EditableSharingModal from './components/EditableSharingModal';
9
- import SharingContext from './context';
10
- import withLocales from './withLocales';
11
-
12
- var SharingModal = function SharingModal(_ref) {
13
- var document = _ref.document,
14
- rest = _objectWithoutProperties(_ref, _excluded);
15
-
16
- return /*#__PURE__*/React.createElement(SharingContext.Consumer, null, function (_ref2) {
17
- var documentType = _ref2.documentType,
18
- getOwner = _ref2.getOwner,
19
- getSharingType = _ref2.getSharingType,
20
- getRecipients = _ref2.getRecipients,
21
- revokeSelf = _ref2.revokeSelf;
22
- return /*#__PURE__*/React.createElement(SharingDetailsModal, _extends({
23
- document: document,
24
- documentType: documentType,
25
- owner: getOwner(document.id),
26
- sharingType: getSharingType(document.id),
27
- recipients: getRecipients(document.id),
28
- onRevoke: revokeSelf
29
- }, rest));
30
- });
31
- };
32
-
33
- export var ShareModal = withLocales(function (props) {
34
- var _location$state;
35
-
36
- var location = useLocation === null || useLocation === void 0 ? void 0 : useLocation();
37
- var locationProps = location === null || location === void 0 || (_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.modalProps;
38
- var document = (locationProps === null || locationProps === void 0 ? void 0 : locationProps.document) || props.document;
39
- var rest = omit(locationProps || props, 'document');
40
- return /*#__PURE__*/React.createElement(SharingContext.Consumer, null, function (_ref3) {
41
- var byDocId = _ref3.byDocId,
42
- isOwner = _ref3.isOwner,
43
- canReshare = _ref3.canReshare;
44
- return !byDocId[document.id] || isOwner(document.id) || canReshare(document.id) ? /*#__PURE__*/React.createElement(EditableSharingModal, _extends({
45
- document: document
46
- }, rest)) : /*#__PURE__*/React.createElement(SharingModal, _extends({
47
- document: document
48
- }, rest));
49
- });
50
- });
@@ -1,51 +0,0 @@
1
- import omit from 'lodash/omit'
2
- import React from 'react'
3
- import { useLocation } from 'react-router'
4
-
5
- import { SharingDetailsModal } from './SharingDetailsModal'
6
- import EditableSharingModal from './components/EditableSharingModal'
7
- import SharingContext from './context'
8
- import withLocales from './withLocales'
9
-
10
- const SharingModal = ({ document, ...rest }) => (
11
- <SharingContext.Consumer>
12
- {({
13
- documentType,
14
- getOwner,
15
- getSharingType,
16
- getRecipients,
17
- revokeSelf
18
- }) => (
19
- <SharingDetailsModal
20
- document={document}
21
- documentType={documentType}
22
- owner={getOwner(document.id)}
23
- sharingType={getSharingType(document.id)}
24
- recipients={getRecipients(document.id)}
25
- onRevoke={revokeSelf}
26
- {...rest}
27
- />
28
- )}
29
- </SharingContext.Consumer>
30
- )
31
-
32
- export const ShareModal = withLocales(props => {
33
- const location = useLocation?.()
34
- const locationProps = location?.state?.modalProps
35
- const document = locationProps?.document || props.document
36
- const rest = omit(locationProps || props, 'document')
37
-
38
- return (
39
- <SharingContext.Consumer>
40
- {({ byDocId, isOwner, canReshare }) =>
41
- !byDocId[document.id] ||
42
- isOwner(document.id) ||
43
- canReshare(document.id) ? (
44
- <EditableSharingModal document={document} {...rest} />
45
- ) : (
46
- <SharingModal document={document} {...rest} />
47
- )
48
- }
49
- </SharingContext.Consumer>
50
- )
51
- })
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes