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
@@ -0,0 +1,44 @@
1
+ # ShareModal architecture
2
+
3
+ ```mermaid
4
+ flowchart TD
5
+ ShareModal --> ShareModalConditions{isReadOnly}
6
+ ShareModalConditions --> |yes| SharingDetailsModal
7
+ ShareModalConditions --> |no| EditableSharingModal
8
+ SharingDetailsModal --> WhoHasAccess
9
+ EditableSharingModal --> DumbShareModal
10
+ DumbShareModal --> DumbShareModalConditions{isOnlyByLink}
11
+ DumbShareModalConditions --> |yes| ShareDialogOnlyByLink
12
+ DumbShareModalConditions --> |no| ShareDialogCozyToCozy
13
+ ShareDialogOnlyByLink --> WhoHasAccess
14
+ ShareDialogOnlyByLink --> DumbShareByLink
15
+ ShareDialogCozyToCozy --> ShareDialogTwoStepsConfirmationContainer
16
+ ShareDialogTwoStepsConfirmationContainer --> |dialogContentOnShare|SharingContent
17
+ ShareDialogTwoStepsConfirmationContainer --> |dialogTitleOnShare|SharingTitleFunction
18
+ ShareDialogTwoStepsConfirmationContainer --> |dialogActionsOnShare|DumbShareByLink
19
+ SharingContent --> WhoHasAccess
20
+ SharingContent --> ShareByEmail
21
+ ConfirmTrustedRecipientsDialog --> DumbConfirmTrustedRecipientsDialog
22
+ DumbConfirmTrustedRecipientsDialog --> ShareDialogTwoStepsConfirmationContainer
23
+ ShareByEmail --> ShareRecipientsInput
24
+ ShareRecipientsInput --> ShareAutosuggest
25
+ ```
26
+
27
+ ### Specific case of `ShareDialogTwoStepsConfirmationContainer`
28
+
29
+ #### Content
30
+
31
+ ```mermaid
32
+ flowchart TD
33
+ A(status === 'error') --> |yes|ErrorContent
34
+ A --> |no| B(status === 'loading')
35
+ B --> |yes|LoadingContent
36
+ B --> |no| C(status === 'sharing')
37
+ C --> |yes|DialogContentOnShare
38
+ DialogContentOnShare --> SharingContent
39
+ C --> |no|D(status === 'confirmingRecipient')
40
+ D --> |yes|ConfirmationDialogContent
41
+ D --> |no|E(status === 'rejectingRecipient')
42
+ E --> |yes|RejectDialogContent
43
+ E --> |no|F[null]
44
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-sharing",
3
- "version": "10.2.0",
3
+ "version": "10.3.0",
4
4
  "description": "Provides sharing login for React applications.",
5
5
  "main": "dist/index.js",
6
6
  "author": "Cozy",
@@ -60,5 +60,5 @@
60
60
  "sideEffects": [
61
61
  "*.css"
62
62
  ],
63
- "gitHead": "b90bf90c604284a0f77a89ed394ee3a9b25be889"
63
+ "gitHead": "4f5a6b23fb9df75f5f564f5d41667e922742b05b"
64
64
  }
@@ -2,7 +2,7 @@ import React from 'react'
2
2
 
3
3
  import { default as DumbConfirmTrustedRecipientsDialog } from './components/ConfirmTrustedRecipientsDialog'
4
4
  import SharingContext from './context'
5
- import withLocales from './withLocales'
5
+ import withLocales from './hoc/withLocales'
6
6
 
7
7
  export const ConfirmTrustedRecipientsDialog = withLocales(
8
8
  ({ document, ...rest }) => (
@@ -8,7 +8,7 @@ import {
8
8
  SharedWithMeButton
9
9
  } from './components/ShareButton'
10
10
  import SharingContext from './context'
11
- import withLocales from './withLocales'
11
+ import withLocales from './hoc/withLocales'
12
12
 
13
13
  export const ShareButton = withLocales(({ docId, useShortLabel, ...rest }) => {
14
14
  const { t } = useI18n()
@@ -16,7 +16,7 @@ jest.mock('cozy-ui/transpiled/react/providers/I18n', () => ({
16
16
  useI18n: jest.fn().mockReturnValue({ t: jest.fn() })
17
17
  }))
18
18
 
19
- jest.mock('./withLocales', () =>
19
+ jest.mock('./hoc/withLocales', () =>
20
20
  // eslint-disable-next-line react/display-name
21
21
  Component => props => <>{Component(props)}</>
22
22
  )
@@ -2,7 +2,7 @@ import React from 'react'
2
2
 
3
3
  import { default as DumbSharedBadge } from './components/SharedBadge'
4
4
  import SharingContext from './context'
5
- import withLocales from './withLocales'
5
+ import withLocales from './hoc/withLocales'
6
6
 
7
7
  export const SharedBadge = withLocales(({ docId, ...rest }) => (
8
8
  <SharingContext.Consumer>
@@ -2,7 +2,7 @@ import React from 'react'
2
2
 
3
3
  import RecipientsAvatars from './components/Recipient/RecipientsAvatars'
4
4
  import SharingContext from './context'
5
- import withLocales from './withLocales'
5
+ import withLocales from './hoc/withLocales'
6
6
 
7
7
  export const SharedRecipients = withLocales(({ docId, onClick, ...rest }) => (
8
8
  <SharingContext.Consumer>
@@ -2,7 +2,7 @@ import React from 'react'
2
2
 
3
3
  import { default as RecipientsList } from './components/WhoHasAccessLight'
4
4
  import SharingContext from './context'
5
- import withLocales from './withLocales'
5
+ import withLocales from './hoc/withLocales'
6
6
 
7
7
  export const SharedRecipientsList = withLocales(({ docId, ...rest }) => (
8
8
  <SharingContext.Consumer>
@@ -2,7 +2,7 @@ import React from 'react'
2
2
 
3
3
  import RecipientsAvatars from './components/Recipient/RecipientsAvatars'
4
4
  import SharingContext from './context'
5
- import withLocales from './withLocales'
5
+ import withLocales from './hoc/withLocales'
6
6
 
7
7
  export const SharedStatus = withLocales(
8
8
  ({ docId, className, noSharedClassName, onClick, showMeAsOwner }) => (
@@ -2,7 +2,7 @@ import React from 'react'
2
2
 
3
3
  import RecipientAvatar from './components/Recipient/RecipientAvatar'
4
4
  import SharingContext from './context'
5
- import withLocales from './withLocales'
5
+ import withLocales from './hoc/withLocales'
6
6
 
7
7
  export const SharingOwnerAvatar = withLocales(({ docId, ...rest }) => (
8
8
  <SharingContext.Consumer>
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12">
2
+ <polyline fill="none" stroke="#95999D" stroke-width="2" points="33 36 38 41 43 36" transform="translate(-32 -32)" stroke-linecap="round" stroke-linejoin="round"/>
3
+ </svg>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <defs></defs>
4
+ <g id="16px" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" transform="translate(-224.000000, -192.000000)">
5
+ <g id="slices" transform="translate(32.000000, 32.000000)"></g>
6
+ <path d="M237,193 L240,193 L240,195 L224,195 L224,193 L227,193 L227,192 L229,192 L229,193 L235,193 L235,192 L237,192 L237,193 Z M224,196 L240,196 L240,206.997527 C240,207.551177 239.555369,208 238.999128,208 L225.000872,208 C224.448106,208 224,207.544239 224,206.997527 L224,196 Z M226,198 L226,206 L238,206 L238,198 L226,198 Z M232,201 L237,201 L237,205 L232,205 L232,201 Z" id="calendar" fill="#95999D"></path>
7
+ </g>
8
+ </svg>
@@ -0,0 +1,59 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <svg
3
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
4
+ xmlns:cc="http://creativecommons.org/ns#"
5
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
6
+ xmlns:svg="http://www.w3.org/2000/svg"
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
9
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
10
+ width="16"
11
+ height="16"
12
+ viewBox="0 0 16 16"
13
+ version="1.1"
14
+ id="svg6"
15
+ sodipodi:docname="icon-check-blue.svg"
16
+ inkscape:version="0.92.2 (5c3e80d, 2017-08-06)">
17
+ <metadata
18
+ id="metadata12">
19
+ <rdf:RDF>
20
+ <cc:Work
21
+ rdf:about="">
22
+ <dc:format>image/svg+xml</dc:format>
23
+ <dc:type
24
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
25
+ </cc:Work>
26
+ </rdf:RDF>
27
+ </metadata>
28
+ <defs
29
+ id="defs10" />
30
+ <sodipodi:namedview
31
+ pagecolor="#ffffff"
32
+ bordercolor="#666666"
33
+ borderopacity="1"
34
+ objecttolerance="10"
35
+ gridtolerance="10"
36
+ guidetolerance="10"
37
+ inkscape:pageopacity="0"
38
+ inkscape:pageshadow="2"
39
+ inkscape:window-width="1296"
40
+ inkscape:window-height="770"
41
+ id="namedview8"
42
+ showgrid="false"
43
+ inkscape:zoom="14.75"
44
+ inkscape:cx="-0.98305085"
45
+ inkscape:cy="8"
46
+ inkscape:window-x="67"
47
+ inkscape:window-y="27"
48
+ inkscape:window-maximized="0"
49
+ inkscape:current-layer="svg6" />
50
+ <g
51
+ transform="translate(-32 -128)"
52
+ id="g4"
53
+ style="stroke:none;stroke-opacity:1;fill:#297ef0;fill-opacity:1">
54
+ <path
55
+ d="M33.7071068,138.292893 C33.3165825,137.902369 32.6834175,137.902369 32.2928932,138.292893 C31.9023689,138.683418 31.9023689,139.316582 32.2928932,139.707107 L35.2928932,142.707107 C35.6834175,143.097631 36.3165825,143.097631 36.7071068,142.707107 L47.7071068,131.707107 C48.0976311,131.316582 48.0976311,130.683418 47.7071068,130.292893 C47.3165825,129.902369 46.6834175,129.902369 46.2928932,130.292893 L36,140.585786 L33.7071068,138.292893 Z"
56
+ id="path2"
57
+ style="stroke:none;stroke-opacity:1;fill:#297ef0;fill-opacity:1" />
58
+ </g>
59
+ </svg>
@@ -0,0 +1,5 @@
1
+ <svg width="16" height="16"
2
+ xmlns="http://www.w3.org/2000/svg"
3
+ xmlns:xlink="http://www.w3.org/1999/xlink">
4
+ <path fill="#32363F" fill-rule="nonzero" d="M8 6.586l5.293-5.293a1 1 0 0 1 1.414 1.414L9.414 8l5.293 5.293a1 1 0 0 1-1.414 1.414L8 9.414l-5.293 5.293a1 1 0 1 1-1.414-1.414L6.586 8 1.293 2.707a1 1 0 1 1 1.414-1.414L8 6.586z" />
5
+ </svg>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <defs>
4
+ <path d="M8.87940867,3.87953579 C8.48888438,4.27006009 7.8557194,4.27006009 7.46519511,3.87953579 C7.07467081,3.4890115 7.07467081,2.85584652 7.46519511,2.46532223 L9.05304103,0.877476309 C10.2226142,-0.292096843 12.1218341,-0.292252339 13.289659,0.875572597 L14.4691583,2.05507187 C15.6394269,3.22534048 15.6355011,5.12344332 14.4628542,6.29609024 L10.9986358,9.7603087 C9.4643126,11.2946319 6.92867661,11.3430173 5.46519511,9.87953579 C5.07467081,9.4890115 5.07467081,8.85584652 5.46519511,8.46532223 C5.8557194,8.07479794 6.48888438,8.07479794 6.87940867,8.46532223 C7.54950929,9.13542285 8.81932532,9.11119201 9.5844222,8.34609513 L13.0486407,4.88187668 C13.4415455,4.48897179 13.4428522,3.85719292 13.0549447,3.46928543 L11.8754455,2.28978616 C11.488721,1.90306165 10.855831,1.90311347 10.4672546,2.29168987 L8.87940867,3.87953579 Z M6.46519511,11.4653222 C6.8557194,11.0747979 7.48888438,11.0747979 7.87940867,11.4653222 C8.26993296,11.8558465 8.26993296,12.4890115 7.87940867,12.8795358 L6.29156275,14.4673817 C5.12198959,15.6369549 3.22276968,15.6371104 2.05494474,14.4692854 L0.875445471,13.2897862 C-0.294823143,12.1195175 -0.290897366,10.2214147 0.881749556,9.04876778 L4.34596801,5.58454933 C5.88029117,4.05022616 8.41592716,4.00184073 9.87940867,5.46532223 C10.269933,5.85584652 10.269933,6.4890115 9.87940867,6.87953579 C9.48888438,7.27006009 8.8557194,7.27006009 8.46519511,6.87953579 C7.79509448,6.20943517 6.52527845,6.23366601 5.76018157,6.99876289 L2.29596312,10.4629813 C1.90305823,10.8558862 1.90175154,11.4876651 2.28965903,11.8755726 L3.4691583,13.0550719 C3.85588281,13.4417964 4.48877278,13.4417446 4.87734918,13.0531682 L6.46519511,11.4653222 Z" id="link-1-path-1"></path>
5
+ </defs>
6
+ <g id="🍦-icons" stroke="none" stroke-width="1" fill-rule="evenodd">
7
+ <g id="icons/16/link">
8
+ <mask id="mask-2">
9
+ <use xlink:href="#link-1-path-1"></use>
10
+ </mask>
11
+ <use id="Mask" fill-rule="nonzero" xlink:href="#link-1-path-1"></use>
12
+ </g>
13
+ </g>
14
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
2
+ <path fill="#95999D" fill-rule="evenodd" d="M201.5,99.5 L192,109.025391 L192,112 L195.03772,112 L204.5,102.5 L201.5,99.5 Z M206.912154,96.9121541 C206.132243,96.1322429 204.869144,96.1308556 204.089264,96.9107361 L203,98 L206.030762,101 L207.092271,99.9252663 C207.869738,99.1381134 207.863777,97.8637772 207.087846,97.0878459 L206.912154,96.9121541 Z M199,110 L204.997071,110 C205.550973,110 206,110.443865 206,111 C206,111.552285 205.553689,112 205.002455,112 L197,112 L199,110 Z" transform="translate(-192 -96)"/>
3
+ </svg>
@@ -7,7 +7,7 @@ import Paper from 'cozy-ui/transpiled/react/Paper'
7
7
  import Typography from 'cozy-ui/transpiled/react/Typography'
8
8
  import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
9
9
 
10
- import styles from './CozyPassFingerprintDialogContent.styl'
10
+ import styles from '../styles/CozyPassFingerprintDialogContent.styl'
11
11
 
12
12
  /**
13
13
  * CozyPassFingerprintDialogContent can be use as a content for ShareModal when
@@ -2,7 +2,7 @@ import classNames from 'classnames'
2
2
  import PropTypes from 'prop-types'
3
3
  import React from 'react'
4
4
 
5
- import styles from './recipient.styl'
5
+ import styles from '../../styles/recipient.styl'
6
6
 
7
7
  const Identity = ({ name, details }) => (
8
8
  <div className={classNames(styles['recipient-idents'], 'u-ml-1')}>
@@ -13,8 +13,8 @@ import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
13
13
 
14
14
  import LinkRecipientPermissions from './LinkRecipientPermissions'
15
15
  import RecipientConfirm from './RecipientConfirm'
16
- import styles from './recipient.styl'
17
16
  import { FADE_IN_DURATION } from '../../helpers/recipients'
17
+ import styles from '../../styles/recipient.styl'
18
18
 
19
19
  const LinkRecipient = props => {
20
20
  const { t } = useI18n()
@@ -3,8 +3,8 @@ import React from 'react'
3
3
  import Avatar from 'cozy-ui/transpiled/react/Avatar'
4
4
 
5
5
  import Identity from './Identity'
6
- import styles from './recipient.styl'
7
6
  import { getDisplayName, getInitials } from '../../models'
7
+ import styles from '../../styles/recipient.styl'
8
8
 
9
9
  const OwnerIdentity = ({ url, size, ...rest }) => (
10
10
  <div className={styles['avatar']}>
@@ -4,7 +4,7 @@ import React from 'react'
4
4
  import Button from 'cozy-ui/transpiled/react/deprecated/Button'
5
5
  import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
6
6
 
7
- import modalStyles from '../../share.styl'
7
+ import modalStyles from '../../styles/share.styl'
8
8
 
9
9
  /**
10
10
  * Displays the confirmation interface that allows to confirm or reject a recipient
@@ -0,0 +1,45 @@
1
+ import React from 'react'
2
+
3
+ import Recipient from './Recipient'
4
+ import { usePrevious } from '../../helpers/hooks'
5
+ import { filterAndReworkRecipients } from '../../helpers/recipients'
6
+
7
+ const RecipientList = ({
8
+ recipients,
9
+ recipientsToBeConfirmed,
10
+ isOwner,
11
+ document,
12
+ documentType,
13
+ onRevoke,
14
+ onRevokeSelf,
15
+ verifyRecipient
16
+ }) => {
17
+ const previousRecipients = usePrevious(recipients)
18
+ const recipientsToDisplay = filterAndReworkRecipients(
19
+ recipients,
20
+ previousRecipients
21
+ )
22
+
23
+ return recipientsToDisplay.map(recipient => {
24
+ const recipientConfirmationData = recipientsToBeConfirmed.find(
25
+ user => user.email === recipient.email
26
+ )
27
+
28
+ return (
29
+ <Recipient
30
+ {...recipient}
31
+ key={`key_r_${recipient.index}`}
32
+ isOwner={isOwner}
33
+ document={document}
34
+ documentType={documentType}
35
+ onRevoke={onRevoke}
36
+ onRevokeSelf={onRevokeSelf}
37
+ recipientConfirmationData={recipientConfirmationData}
38
+ verifyRecipient={verifyRecipient}
39
+ fadeIn={recipient.hasBeenJustAdded}
40
+ />
41
+ )
42
+ })
43
+ }
44
+
45
+ export { RecipientList }
@@ -3,8 +3,8 @@ import React from 'react'
3
3
 
4
4
  import AvatarPlusX from './AvatarPlusX'
5
5
  import Identity from './Identity'
6
- import styles from './recipient.styl'
7
6
  import { getDisplayName } from '../../models'
7
+ import styles from '../../styles/recipient.styl'
8
8
 
9
9
  const RecipientPlusX = ({ extraRecipients }, { t }) => (
10
10
  <div className={styles['recipient']}>
@@ -8,7 +8,7 @@ import Typography from 'cozy-ui/transpiled/react/Typography'
8
8
  import { Media, Img, Bd } from 'cozy-ui/transpiled/react/deprecated/Media'
9
9
  import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
10
10
 
11
- import styles from './recipient.styl'
11
+ import styles from '../../styles/recipient.styl'
12
12
 
13
13
  const RecipientStatus = ({ status, isMe, instance }) => {
14
14
  const { t } = useI18n()
@@ -3,8 +3,8 @@ import React from 'react'
3
3
  import Avatar from 'cozy-ui/transpiled/react/Avatar'
4
4
 
5
5
  import Identity from './Identity'
6
- import styles from './recipient.styl'
7
6
  import { getDisplayName, getInitials } from '../../models'
7
+ import styles from '../../styles/recipient.styl'
8
8
 
9
9
  const RecipientWithoutStatus = ({ instance, ...rest }) => {
10
10
  const name = getDisplayName(rest)
@@ -7,8 +7,8 @@ import LinkIcon from 'cozy-ui/transpiled/react/Icons/Link'
7
7
 
8
8
  import AvatarPlusX from './AvatarPlusX'
9
9
  import RecipientAvatar from './RecipientAvatar'
10
- import styles from './recipient.styl'
11
10
  import { getDisplayName } from '../../models'
11
+ import styles from '../../styles/recipient.styl'
12
12
 
13
13
  export const MAX_DISPLAYED_RECIPIENTS = 3
14
14
 
@@ -8,9 +8,9 @@ import { Spinner } from 'cozy-ui/transpiled/react/Spinner'
8
8
  import palette from 'cozy-ui/transpiled/react/palette'
9
9
 
10
10
  import ContactSuggestion from './ContactSuggestion'
11
- import styles from './autosuggest.styl'
12
11
  import { extractEmails, validateEmail } from '../helpers/email'
13
12
  import { getDisplayName, getInitials, Contact } from '../models'
13
+ import styles from '../styles/autosuggest.styl'
14
14
  import {
15
15
  cozyUrlMatch,
16
16
  emailMatch,
@@ -5,7 +5,7 @@ import Icon from 'cozy-ui/transpiled/react/Icon'
5
5
  import ShareIcon from 'cozy-ui/transpiled/react/Icons/Share'
6
6
  import { Button } from 'cozy-ui/transpiled/react/deprecated/Button'
7
7
 
8
- import styles from './button.styl'
8
+ import styles from '../styles/button.styl'
9
9
 
10
10
  export const ShareButton = ({ label, onClick, className, ...props }) => (
11
11
  <Button
@@ -15,8 +15,8 @@ import { hasReachRecipientsLimit } from '../helpers/recipients'
15
15
  import { getSuccessMessage } from '../helpers/successMessage'
16
16
  import { Group } from '../models'
17
17
  import { contactsResponseType, groupsResponseType } from '../propTypes'
18
- import styles from '../share.styl'
19
18
  import { isReadOnlySharing } from '../state'
19
+ import styles from '../styles/share.styl'
20
20
 
21
21
  export const ShareByEmail = ({
22
22
  contacts,
@@ -8,7 +8,7 @@ import { default as DumbShareByEmail } from './ShareByEmail'
8
8
  import { default as DumbShareByLink } from './ShareByLink'
9
9
  import ShareDialogTwoStepsConfirmationContainer from './ShareDialogTwoStepsConfirmationContainer'
10
10
  import WhoHasAccess from './WhoHasAccess'
11
- import styles from '../share.styl'
11
+ import styles from '../styles/share.styl'
12
12
 
13
13
  /**
14
14
  * Displays the sharing interface that can be used when ShareDialogCozyToCozy is in sharing state
@@ -3,11 +3,11 @@ import React from 'react'
3
3
 
4
4
  import { useClient, useQueryAll } from 'cozy-client'
5
5
 
6
- import { default as DumbShareModal } from './ShareModal'
7
- import { useFetchDocumentPath } from './useFetchDocumentPath'
8
- import SharingContext from '../context'
9
- import { Contact } from '../models'
10
- import { buildContactsQuery, buildGroupsQuery } from '../queries/queries'
6
+ import SharingContext from '../../context'
7
+ import { useFetchDocumentPath } from '../../hooks/useFetchDocumentPath'
8
+ import { Contact } from '../../models'
9
+ import { buildContactsQuery, buildGroupsQuery } from '../../queries/queries'
10
+ import { default as DumbShareModal } from '../ShareModal'
11
11
 
12
12
  export const EditableSharingModal = ({ document, ...rest }) => {
13
13
  const client = useClient()
@@ -5,13 +5,13 @@ import { createMockClient } from 'cozy-client'
5
5
  import { BreakpointsProvider } from 'cozy-ui/transpiled/react/providers/Breakpoints'
6
6
 
7
7
  import { EditableSharingModal } from './EditableSharingModal'
8
- import { default as DumbShareModal } from './ShareModal'
9
- import { useFetchDocumentPath } from './useFetchDocumentPath'
10
- import AppLike from '../../test/AppLike'
11
- import { SharingProvider } from '../SharingProvider'
12
- import { receivePaths } from '../state'
8
+ import AppLike from '../../../test/AppLike'
9
+ import { SharingProvider } from '../../SharingProvider'
10
+ import { useFetchDocumentPath } from '../../hooks/useFetchDocumentPath'
11
+ import { receivePaths } from '../../state'
12
+ import { default as DumbShareModal } from '../ShareModal'
13
13
 
14
- jest.mock('./useFetchDocumentPath', () => ({
14
+ jest.mock('../../hooks/useFetchDocumentPath', () => ({
15
15
  useFetchDocumentPath: jest.fn()
16
16
  }))
17
17
 
@@ -0,0 +1,45 @@
1
+ import omit from 'lodash/omit'
2
+ import React from 'react'
3
+ import { useLocation } from 'react-router'
4
+
5
+ import EditableSharingModal from './EditableSharingModal'
6
+ import { SharingDetailsModal } from './SharingDetailsModal'
7
+ import withLocales from '../../hoc/withLocales'
8
+ import { useSharingContext } from '../../hooks/useSharingContext'
9
+
10
+ export const ShareModal = withLocales(props => {
11
+ const location = useLocation?.()
12
+ const locationProps = location?.state?.modalProps
13
+ const document = locationProps?.document || props.document
14
+ const rest = omit(locationProps || props, 'document')
15
+
16
+ const {
17
+ byDocId,
18
+ isOwner,
19
+ canReshare,
20
+ documentType,
21
+ getOwner,
22
+ getSharingType,
23
+ getRecipients,
24
+ revokeSelf
25
+ } = useSharingContext()
26
+
27
+ const isEditable =
28
+ !byDocId[document.id] || isOwner(document.id) || canReshare(document.id)
29
+
30
+ if (isEditable) {
31
+ return <EditableSharingModal document={document} {...rest} />
32
+ }
33
+
34
+ return (
35
+ <SharingDetailsModal
36
+ document={document}
37
+ documentType={documentType}
38
+ owner={getOwner(document.id)}
39
+ sharingType={getSharingType(document.id)}
40
+ recipients={getRecipients(document.id)}
41
+ onRevoke={revokeSelf}
42
+ {...rest}
43
+ />
44
+ )
45
+ })
@@ -5,10 +5,10 @@ import { Dialog } from 'cozy-ui/transpiled/react/CozyDialogs'
5
5
  import Divider from 'cozy-ui/transpiled/react/Divider'
6
6
  import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
7
7
 
8
- import OwnerIdentity from './components/Recipient/OwnerIdentity'
9
- import WhoHasAccess from './components/WhoHasAccess'
10
- import { getDisplayName } from './models'
11
- import styles from './share.styl'
8
+ import { getDisplayName } from '../../models'
9
+ import styles from '../../styles/share.styl'
10
+ import OwnerIdentity from '../Recipient/OwnerIdentity'
11
+ import WhoHasAccess from '../WhoHasAccess'
12
12
 
13
13
  export const SharingDetailsModal = ({
14
14
  onClose,
@@ -5,7 +5,7 @@ import Icon from 'cozy-ui/transpiled/react/Icon'
5
5
  import ShareIcon from 'cozy-ui/transpiled/react/Icons/Share'
6
6
  import palette from 'cozy-ui/transpiled/react/palette'
7
7
 
8
- import styles from './badge.styl'
8
+ import styles from '../styles/badge.styl'
9
9
 
10
10
  const SharedBadge = ({ byMe, className, small, xsmall }) => (
11
11
  <div
@@ -5,9 +5,9 @@ import palette from 'cozy-ui/transpiled/react/palette'
5
5
  import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
6
6
 
7
7
  import { SharingTooltip, TooltipRecipientList } from './Tooltip'
8
- import styles from './status.styl'
9
- import LinkIcon from '../../assets/icons/icon-link.svg'
8
+ import LinkIcon from '../assets/icons/icon-link.svg'
10
9
  import { getDisplayName } from '../models'
10
+ import styles from '../styles/status.styl'
11
11
 
12
12
  export const SharedStatus = ({ className, docId, recipients, link }) => {
13
13
  const { t } = useI18n()
@@ -9,7 +9,7 @@ import SelectBox, { components } from 'cozy-ui/transpiled/react/SelectBox'
9
9
  import palette from 'cozy-ui/transpiled/react/palette'
10
10
 
11
11
  import logger from '../logger'
12
- import styles from '../share.styl'
12
+ import styles from '../styles/share.styl'
13
13
 
14
14
  const DropdownIndicator = props => (
15
15
  <components.DropdownIndicator {...props}>
@@ -8,7 +8,7 @@ import Button, { ButtonLink } from 'cozy-ui/transpiled/react/deprecated/Button'
8
8
  import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
9
9
 
10
10
  import CozyHomeLinkIcon from './CozyHomeLinkIcon'
11
- import styles from './publicBanner.styl'
11
+ import styles from '../../../styles/publicBanner.styl'
12
12
 
13
13
  const HOME_LINK_HREF = 'https://manager.cozycloud.cc/cozy/create'
14
14
 
@@ -2,8 +2,8 @@ import { useState, useEffect } from 'react'
2
2
 
3
3
  import { useClient, models } from 'cozy-client'
4
4
 
5
- import logger from '../../logger'
6
- import { buildSharingsByIdQuery } from '../../queries/queries'
5
+ import logger from '../../../logger'
6
+ import { buildSharingsByIdQuery } from '../../../queries/queries'
7
7
  import getQueryParameter from '../helpers/QueryParameter'
8
8
 
9
9
  const getSharingId = permission => {
@@ -3,7 +3,7 @@ import React from 'react'
3
3
 
4
4
  import { SharingBanner } from './components/SharingBanner'
5
5
  import { useSharingInfos } from './hooks/useSharingInfos'
6
- import withLocales from '../withLocales'
6
+ import withLocales from '../../hoc/withLocales'
7
7
 
8
8
  const Plugin = ({ previewPath }) => {
9
9
  const sharingInfos = useSharingInfos(previewPath)
@@ -11,8 +11,8 @@ import FabProvider from './FabProvider'
11
11
  import { ModalContext } from './ModalContext'
12
12
  import { RouterContext } from './RouterContext'
13
13
  import { ThumbnailSizeContextProvider } from './ThumbnailSizeContext'
14
- import langEn from '../../../locales/en.json'
15
- import SharingContext from '../../context'
14
+ import langEn from '../../../../locales/en.json'
15
+ import SharingContext from '../../../context'
16
16
 
17
17
  const mockStore = createStore(() => ({
18
18
  mobile: {
@@ -2,7 +2,7 @@ import PropTypes from 'prop-types'
2
2
  import React from 'react'
3
3
  import ReactTooltip from 'react-tooltip'
4
4
 
5
- import styles from './tooltip.styl'
5
+ import styles from '../styles/tooltip.styl'
6
6
 
7
7
  export const SharingTooltip = props => (
8
8
  <ReactTooltip