cozy-sharing 6.0.6 → 7.0.1

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 (158) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/ConfirmTrustedRecipientsDialog.js +1 -1
  3. package/dist/RefreshableSharings.spec.js +2 -2
  4. package/dist/ShareButton.js +1 -1
  5. package/dist/ShareButton.spec.js +1 -1
  6. package/dist/ShareButtonWithRecipients.js +3 -3
  7. package/dist/ShareModal.js +2 -2
  8. package/dist/SharedBadge.js +1 -1
  9. package/dist/SharedRecipients.js +1 -1
  10. package/dist/SharedRecipientsList.js +1 -1
  11. package/dist/SharedStatus.js +1 -1
  12. package/dist/SharingBanner/components/PublicBanner.js +1 -1
  13. package/dist/SharingBanner/components/PublicBanner.spec.js +3 -3
  14. package/dist/SharingBanner/components/SharingBanner.js +1 -1
  15. package/dist/SharingBanner/hooks/useSharingInfos.js +1 -1
  16. package/dist/SharingBanner/hooks/useSharingInfos.spec.js +1 -1
  17. package/dist/SharingBanner/index.js +3 -3
  18. package/dist/SharingBanner/test/AppLike.js +6 -6
  19. package/dist/SharingDetailsModal.js +8 -8
  20. package/dist/SharingOwnerAvatar.js +1 -1
  21. package/dist/SharingProvider.js +2 -2
  22. package/dist/SharingProvider.spec.js +4 -4
  23. package/dist/components/ContactSuggestion.js +4 -4
  24. package/dist/components/ContactSuggestion.spec.js +2 -2
  25. package/dist/components/CozyPassFingerprintDialogContent.js +4 -4
  26. package/dist/components/CozyPassFingerprintDialogContent.spec.js +2 -2
  27. package/dist/components/EditLinkPermissionDialog.js +5 -5
  28. package/dist/components/EditLinkPermissionDialog.spec.js +2 -2
  29. package/dist/components/EditableSharingModal.js +3 -3
  30. package/dist/components/EditableSharingModal.spec.js +4 -4
  31. package/dist/components/Recipient/AvatarPlusX.js +2 -2
  32. package/dist/components/Recipient/Identity.js +2 -2
  33. package/dist/components/Recipient/LinkRecipient.js +8 -8
  34. package/dist/components/Recipient/LinkRecipientPermissions.js +5 -5
  35. package/dist/components/Recipient/OwnerIdentity.js +1 -1
  36. package/dist/components/Recipient/OwnerRecipient.js +2 -2
  37. package/dist/components/Recipient/Recipient.js +6 -6
  38. package/dist/components/Recipient/Recipient.spec.js +2 -2
  39. package/dist/components/Recipient/RecipientConfirm.js +2 -2
  40. package/dist/components/Recipient/RecipientPermissions.js +5 -5
  41. package/dist/components/Recipient/RecipientPlusX.js +2 -2
  42. package/dist/components/Recipient/RecipientStatus.js +3 -3
  43. package/dist/components/Recipient/RecipientWithoutStatus.js +1 -1
  44. package/dist/components/Recipient/RecipientsAvatars.js +2 -2
  45. package/dist/components/Recipient/RecipientsAvatars.spec.js +1 -1
  46. package/dist/components/ShareAutosuggest.js +5 -5
  47. package/dist/components/ShareAutosuggest.spec.js +1 -1
  48. package/dist/components/ShareButton.js +3 -3
  49. package/dist/components/ShareByEmail.js +6 -6
  50. package/dist/components/ShareByEmail.spec.js +2 -2
  51. package/dist/components/ShareByLink.js +7 -7
  52. package/dist/components/ShareDialogCozyToCozy.js +3 -3
  53. package/dist/components/ShareDialogCozyToCozy.spec.js +3 -3
  54. package/dist/components/ShareDialogOnlyByLink.js +1 -1
  55. package/dist/components/ShareDialogTwoStepsConfirmationContainer.js +1 -1
  56. package/dist/components/ShareDialogTwoStepsConfirmationContainer.spec.js +3 -3
  57. package/dist/components/ShareModal.js +2 -2
  58. package/dist/components/ShareModal.spec.js +2 -2
  59. package/dist/components/ShareRecipientsInput.js +2 -2
  60. package/dist/components/ShareRecipientsInput.spec.js +1 -1
  61. package/dist/components/SharedBadge.js +3 -3
  62. package/dist/components/SharedDocuments.js +2 -2
  63. package/dist/components/SharedStatus.js +2 -2
  64. package/dist/components/SharedStatus.spec.js +1 -1
  65. package/dist/components/Sharesubmit.js +1 -1
  66. package/dist/components/Sharetypeselect.js +5 -5
  67. package/dist/components/Tooltip.js +1 -1
  68. package/dist/components/WhoHasAccess.js +5 -5
  69. package/dist/components/WhoHasAccessLight.js +2 -2
  70. package/dist/getSharedDocument.js +14 -5
  71. package/dist/getSharedDocument.spec.js +81 -10
  72. package/dist/helpers/sharings.js +1 -1
  73. package/dist/helpers/successMessage.js +1 -1
  74. package/dist/index.js +1 -1
  75. package/dist/state.js +2 -6
  76. package/package.json +2 -2
  77. package/preprocess.js +1 -0
  78. package/src/ConfirmTrustedRecipientsDialog.jsx +1 -1
  79. package/src/RefreshableSharings.spec.jsx +2 -2
  80. package/src/ShareButton.jsx +2 -2
  81. package/src/ShareButton.spec.jsx +2 -1
  82. package/src/ShareButtonWithRecipients.jsx +5 -3
  83. package/src/ShareModal.jsx +2 -2
  84. package/src/SharedBadge.jsx +1 -1
  85. package/src/SharedRecipients.jsx +1 -1
  86. package/src/SharedRecipientsList.jsx +1 -1
  87. package/src/SharedStatus.jsx +1 -1
  88. package/src/SharingBanner/components/PublicBanner.jsx +1 -2
  89. package/src/SharingBanner/components/PublicBanner.spec.jsx +5 -3
  90. package/src/SharingBanner/components/SharingBanner.jsx +1 -1
  91. package/src/SharingBanner/hooks/useSharingInfos.jsx +1 -1
  92. package/src/SharingBanner/hooks/useSharingInfos.spec.js +1 -1
  93. package/src/SharingBanner/index.jsx +3 -3
  94. package/src/SharingBanner/test/AppLike.jsx +7 -7
  95. package/src/SharingDetailsModal.jsx +3 -3
  96. package/src/SharingOwnerAvatar.jsx +1 -1
  97. package/src/SharingProvider.jsx +9 -9
  98. package/src/SharingProvider.spec.jsx +5 -5
  99. package/src/components/ConfirmTrustedRecipientsDialog.jsx +1 -1
  100. package/src/components/ContactSuggestion.jsx +4 -4
  101. package/src/components/ContactSuggestion.spec.jsx +2 -2
  102. package/src/components/CozyPassFingerprintDialogContent.jsx +4 -5
  103. package/src/components/CozyPassFingerprintDialogContent.spec.jsx +2 -2
  104. package/src/components/EditLinkPermissionDialog.jsx +5 -5
  105. package/src/components/EditLinkPermissionDialog.spec.jsx +3 -2
  106. package/src/components/EditableSharingModal.jsx +4 -3
  107. package/src/components/EditableSharingModal.spec.jsx +4 -4
  108. package/src/components/Recipient/AvatarPlusX.jsx +2 -2
  109. package/src/components/Recipient/Identity.jsx +2 -2
  110. package/src/components/Recipient/LinkRecipient.jsx +8 -8
  111. package/src/components/Recipient/LinkRecipientPermissions.jsx +5 -6
  112. package/src/components/Recipient/OwnerIdentity.jsx +1 -1
  113. package/src/components/Recipient/OwnerRecipient.jsx +2 -2
  114. package/src/components/Recipient/Recipient.jsx +6 -6
  115. package/src/components/Recipient/Recipient.spec.jsx +4 -2
  116. package/src/components/Recipient/RecipientAvatar.jsx +1 -1
  117. package/src/components/Recipient/RecipientConfirm.jsx +2 -2
  118. package/src/components/Recipient/RecipientPermissions.jsx +6 -6
  119. package/src/components/Recipient/RecipientPlusX.jsx +2 -2
  120. package/src/components/Recipient/RecipientStatus.jsx +3 -3
  121. package/src/components/Recipient/RecipientWithoutStatus.jsx +1 -1
  122. package/src/components/Recipient/RecipientsAvatars.jsx +3 -3
  123. package/src/components/Recipient/RecipientsAvatars.spec.jsx +2 -1
  124. package/src/components/ShareAutosuggest.jsx +5 -6
  125. package/src/components/ShareAutosuggest.spec.jsx +1 -1
  126. package/src/components/ShareButton.jsx +4 -4
  127. package/src/components/ShareByEmail.jsx +6 -7
  128. package/src/components/ShareByEmail.spec.jsx +3 -2
  129. package/src/components/ShareByLink.jsx +8 -7
  130. package/src/components/ShareDialogCozyToCozy.jsx +4 -5
  131. package/src/components/ShareDialogCozyToCozy.spec.jsx +5 -3
  132. package/src/components/ShareDialogOnlyByLink.jsx +2 -1
  133. package/src/components/ShareDialogTwoStepsConfirmationContainer.jsx +2 -1
  134. package/src/components/ShareDialogTwoStepsConfirmationContainer.spec.jsx +5 -3
  135. package/src/components/ShareModal.jsx +3 -3
  136. package/src/components/ShareModal.spec.js +4 -2
  137. package/src/components/ShareRecipientsInput.jsx +2 -2
  138. package/src/components/ShareRecipientsInput.spec.jsx +1 -1
  139. package/src/components/SharedBadge.jsx +4 -3
  140. package/src/components/SharedDocuments.jsx +3 -2
  141. package/src/components/SharedStatus.jsx +4 -3
  142. package/src/components/SharedStatus.spec.js +2 -1
  143. package/src/components/Sharesubmit.jsx +2 -1
  144. package/src/components/Sharetypeselect.jsx +5 -7
  145. package/src/components/Tooltip.jsx +2 -1
  146. package/src/components/WhoHasAccess.jsx +6 -5
  147. package/src/components/WhoHasAccessLight.jsx +3 -3
  148. package/src/components/useFetchDocumentPath.jsx +1 -0
  149. package/src/getSharedDocument.js +13 -5
  150. package/src/getSharedDocument.spec.js +26 -5
  151. package/src/helpers/permissions.js +1 -0
  152. package/src/helpers/sharings.js +1 -2
  153. package/src/helpers/successMessage.js +2 -1
  154. package/src/index.jsx +1 -1
  155. package/src/state.js +2 -6
  156. package/src/state.spec.js +0 -1
  157. package/src/withLocales.jsx +1 -0
  158. package/test/AppLike.jsx +2 -2
@@ -1,8 +1,10 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import getSharedDocument from './getSharedDocument';
4
- describe('Getting the shared document id', function () {
5
- var mockClient = {
4
+
5
+ function setupClient() {
6
+ var verbs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
7
+ return {
6
8
  collection: function collection() {
7
9
  return {
8
10
  getOwnPermissions: jest.fn().mockReturnValue({
@@ -11,14 +13,14 @@ describe('Getting the shared document id', function () {
11
13
  permissions: {
12
14
  collection: {
13
15
  type: 'io.cozy.photos.albums',
14
- verbs: ['GET'],
16
+ verbs: verbs,
15
17
  values: ['myshareid']
16
18
  },
17
19
  files: {
18
20
  selector: 'referenced_by',
19
21
  type: 'io.cozy.files',
20
22
  values: ['io.cozy.photos.albums/myshareid'],
21
- verbs: ['GET']
23
+ verbs: verbs
22
24
  }
23
25
  }
24
26
  }
@@ -27,22 +29,91 @@ describe('Getting the shared document id', function () {
27
29
  };
28
30
  }
29
31
  };
32
+ }
33
+
34
+ describe('Getting the shared document', function () {
30
35
  it('should get the id', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
31
- var id;
36
+ var client, _yield$getSharedDocum, id;
37
+
32
38
  return _regeneratorRuntime.wrap(function _callee$(_context) {
33
39
  while (1) switch (_context.prev = _context.next) {
34
40
  case 0:
35
- _context.next = 2;
36
- return getSharedDocument(mockClient);
41
+ client = setupClient(['GET']);
42
+ _context.next = 3;
43
+ return getSharedDocument(client);
37
44
 
38
- case 2:
39
- id = _context.sent;
45
+ case 3:
46
+ _yield$getSharedDocum = _context.sent;
47
+ id = _yield$getSharedDocum.id;
40
48
  expect(id).toEqual('myshareid');
41
49
 
42
- case 4:
50
+ case 6:
43
51
  case "end":
44
52
  return _context.stop();
45
53
  }
46
54
  }, _callee);
47
55
  })));
56
+ it('should return isReadOnly is true when we have only a GET permission', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
57
+ var client, _yield$getSharedDocum2, isReadOnly;
58
+
59
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
60
+ while (1) switch (_context2.prev = _context2.next) {
61
+ case 0:
62
+ client = setupClient(['GET']);
63
+ _context2.next = 3;
64
+ return getSharedDocument(client);
65
+
66
+ case 3:
67
+ _yield$getSharedDocum2 = _context2.sent;
68
+ isReadOnly = _yield$getSharedDocum2.isReadOnly;
69
+ expect(isReadOnly).toBeTruthy();
70
+
71
+ case 6:
72
+ case "end":
73
+ return _context2.stop();
74
+ }
75
+ }, _callee2);
76
+ })));
77
+ it('should return isReadOnly is false when we have an ALL permission', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
78
+ var client, _yield$getSharedDocum3, isReadOnly;
79
+
80
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
81
+ while (1) switch (_context3.prev = _context3.next) {
82
+ case 0:
83
+ client = setupClient(['ALL']);
84
+ _context3.next = 3;
85
+ return getSharedDocument(client);
86
+
87
+ case 3:
88
+ _yield$getSharedDocum3 = _context3.sent;
89
+ isReadOnly = _yield$getSharedDocum3.isReadOnly;
90
+ expect(isReadOnly).toBeFalsy();
91
+
92
+ case 6:
93
+ case "end":
94
+ return _context3.stop();
95
+ }
96
+ }, _callee3);
97
+ })));
98
+ it('should return isReadOnly is false when we have a PATCH permission', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
99
+ var client, _yield$getSharedDocum4, isReadOnly;
100
+
101
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
102
+ while (1) switch (_context4.prev = _context4.next) {
103
+ case 0:
104
+ client = setupClient(['GET', 'PATCH', 'PUT']);
105
+ _context4.next = 3;
106
+ return getSharedDocument(client);
107
+
108
+ case 3:
109
+ _yield$getSharedDocum4 = _context4.sent;
110
+ isReadOnly = _yield$getSharedDocum4.isReadOnly;
111
+ expect(isReadOnly).toBeFalsy();
112
+
113
+ case 6:
114
+ case "end":
115
+ return _context4.stop();
116
+ }
117
+ }, _callee4);
118
+ })));
48
119
  });
@@ -1,9 +1,9 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import { Q } from 'cozy-client';
4
+ import { fetchFilesPaths } from './files';
4
5
  import { updateInternalObjectFromRealtime, normalizeDocFromRealtime } from './realtime';
5
6
  import { addSharing, updateSharing } from '../state';
6
- import { fetchFilesPaths } from './files';
7
7
  export var getSharingObject = function getSharingObject(internalSharing, sharing) {
8
8
  if (internalSharing) {
9
9
  return updateInternalObjectFromRealtime(internalSharing, sharing);
@@ -1,5 +1,5 @@
1
- import { Contact } from '../models';
2
1
  import { models } from 'cozy-client';
2
+ import { Contact } from '../models';
3
3
  export var countNewRecipients = function countNewRecipients(currentRecipients, newRecipients) {
4
4
  return newRecipients.filter(function (contact) {
5
5
  var email = models.contact.getPrimaryEmail(contact);
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
+ import SharingProvider from './SharingProvider';
1
2
  import SharingContext from './context';
2
3
  import withLocales from './withLocales';
3
- import SharingProvider from './SharingProvider';
4
4
  export default SharingProvider;
5
5
  export { SharingContext, withLocales };
6
6
  export { SharedDocument } from './SharedDocument';
package/dist/state.js CHANGED
@@ -461,9 +461,7 @@ var getApps = function getApps(state) {
461
461
 
462
462
  export var hasSharedParent = function hasSharedParent(state, documentPath) {
463
463
  if (!state.sharedPaths) {
464
- // eslint-disable-next-line
465
- console.log('hasSharedParent should not occur', state, documentPath);
466
- return false;
464
+ return false; // hasSharedParent should not occur
467
465
  }
468
466
 
469
467
  return state.sharedPaths.some(function (path) {
@@ -472,9 +470,7 @@ export var hasSharedParent = function hasSharedParent(state, documentPath) {
472
470
  };
473
471
  export var hasSharedChild = function hasSharedChild(state, documentPath) {
474
472
  if (!state.sharedPaths) {
475
- // eslint-disable-next-line
476
- console.log('hasSharedChild should not occur', state, documentPath);
477
- return false;
473
+ return false; // hasSharedChild should not occur
478
474
  }
479
475
 
480
476
  var ret = state.sharedPaths.some(function (path) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-sharing",
3
- "version": "6.0.6",
3
+ "version": "7.0.1",
4
4
  "description": "Provides sharing login for React applications.",
5
5
  "main": "dist/index.js",
6
6
  "author": "Cozy",
@@ -61,5 +61,5 @@
61
61
  "sideEffects": [
62
62
  "*.css"
63
63
  ],
64
- "gitHead": "94b2b5a6a105edfc6fc7a20204291d2191ba2ba1"
64
+ "gitHead": "ac43bba079492607aa8af9bd337e5c8bb1b00364"
65
65
  }
package/preprocess.js CHANGED
@@ -1,4 +1,5 @@
1
1
  const stylus = require('stylus')
2
+
2
3
  const cozyStylusPlugin = require('cozy-ui/stylus')
3
4
 
4
5
  const renderStylus = function (css, filename) {
@@ -1,8 +1,8 @@
1
1
  import React from 'react'
2
2
 
3
+ import { default as DumbConfirmTrustedRecipientsDialog } from './components/ConfirmTrustedRecipientsDialog'
3
4
  import SharingContext from './context'
4
5
  import withLocales from './withLocales'
5
- import { default as DumbConfirmTrustedRecipientsDialog } from './components/ConfirmTrustedRecipientsDialog'
6
6
 
7
7
  export const ConfirmTrustedRecipientsDialog = withLocales(
8
8
  ({ document, ...rest }) => (
@@ -1,11 +1,11 @@
1
- import React from 'react'
2
1
  import { mount } from 'enzyme'
2
+ import React from 'react'
3
3
 
4
4
  import { createMockClient } from 'cozy-client'
5
5
 
6
- import AppLike from '../test/AppLike'
7
6
  import { RefreshableSharings } from './RefreshableSharings'
8
7
  import { SharingProvider } from './SharingProvider'
8
+ import AppLike from '../test/AppLike'
9
9
 
10
10
  const DumbComponent = () => {
11
11
  return <div>test </div>
@@ -2,13 +2,13 @@ import React from 'react'
2
2
 
3
3
  import { useI18n } from 'cozy-ui/transpiled/react/I18n'
4
4
 
5
- import SharingContext from './context'
6
- import withLocales from './withLocales'
7
5
  import {
8
6
  default as DumbShareButton,
9
7
  SharedByMeButton,
10
8
  SharedWithMeButton
11
9
  } from './components/ShareButton'
10
+ import SharingContext from './context'
11
+ import withLocales from './withLocales'
12
12
 
13
13
  export const ShareButton = withLocales(({ docId, useShortLabel, ...rest }) => {
14
14
  const { t } = useI18n()
@@ -1,5 +1,6 @@
1
- import React from 'react'
2
1
  import { render } from '@testing-library/react'
2
+ import React from 'react'
3
+
3
4
  import { ShareButton } from './ShareButton'
4
5
 
5
6
  jest.mock('cozy-ui/transpiled/react/Button', () => ({
@@ -1,10 +1,12 @@
1
1
  import React from 'react'
2
+
3
+ import Grid from 'cozy-ui/transpiled/react/MuiCozyTheme/Grid'
4
+ import Skeleton from 'cozy-ui/transpiled/react/Skeleton'
5
+ import useBreakpoints from 'cozy-ui/transpiled/react/hooks/useBreakpoints'
6
+
2
7
  import { ShareButton } from './ShareButton'
3
8
  import { SharedRecipients } from './SharedRecipients'
4
- import useBreakpoints from 'cozy-ui/transpiled/react/hooks/useBreakpoints'
5
9
  import SharingContext from './context'
6
- import Grid from 'cozy-ui/transpiled/react/MuiCozyTheme/Grid'
7
- import Skeleton from 'cozy-ui/transpiled/react/Skeleton'
8
10
 
9
11
  export const ShareButtonWithRecipients = ({ docId, onClick, ...props }) => {
10
12
  const { isMobile } = useBreakpoints()
@@ -1,11 +1,11 @@
1
- import React from 'react'
2
1
  import omit from 'lodash/omit'
2
+ import React from 'react'
3
3
  import { useLocation } from 'react-router'
4
4
 
5
+ import { SharingDetailsModal } from './SharingDetailsModal'
5
6
  import EditableSharingModal from './components/EditableSharingModal'
6
7
  import SharingContext from './context'
7
8
  import withLocales from './withLocales'
8
- import { SharingDetailsModal } from './SharingDetailsModal'
9
9
 
10
10
  const SharingModal = ({ document, ...rest }) => (
11
11
  <SharingContext.Consumer>
@@ -1,8 +1,8 @@
1
1
  import React from 'react'
2
2
 
3
+ import { default as DumbSharedBadge } from './components/SharedBadge'
3
4
  import SharingContext from './context'
4
5
  import withLocales from './withLocales'
5
- import { default as DumbSharedBadge } from './components/SharedBadge'
6
6
 
7
7
  export const SharedBadge = withLocales(({ docId, ...rest }) => (
8
8
  <SharingContext.Consumer>
@@ -1,8 +1,8 @@
1
1
  import React from 'react'
2
2
 
3
+ import RecipientsAvatars from './components/Recipient/RecipientsAvatars'
3
4
  import SharingContext from './context'
4
5
  import withLocales from './withLocales'
5
- import RecipientsAvatars from './components/Recipient/RecipientsAvatars'
6
6
 
7
7
  export const SharedRecipients = withLocales(({ docId, onClick, ...rest }) => (
8
8
  <SharingContext.Consumer>
@@ -1,8 +1,8 @@
1
1
  import React from 'react'
2
2
 
3
+ import { default as RecipientsList } from './components/WhoHasAccessLight'
3
4
  import SharingContext from './context'
4
5
  import withLocales from './withLocales'
5
- import { default as RecipientsList } from './components/WhoHasAccessLight'
6
6
 
7
7
  export const SharedRecipientsList = withLocales(({ docId, ...rest }) => (
8
8
  <SharingContext.Consumer>
@@ -1,8 +1,8 @@
1
1
  import React from 'react'
2
2
 
3
+ import RecipientsAvatars from './components/Recipient/RecipientsAvatars'
3
4
  import SharingContext from './context'
4
5
  import withLocales from './withLocales'
5
- import RecipientsAvatars from './components/Recipient/RecipientsAvatars'
6
6
 
7
7
  export const SharedStatus = withLocales(
8
8
  ({ docId, className, noSharedClassName, onClick, showMeAsOwner }) => (
@@ -1,5 +1,5 @@
1
- import React from 'react'
2
1
  import PropTypes from 'prop-types'
2
+ import React from 'react'
3
3
  import snarkdown from 'snarkdown'
4
4
 
5
5
  import { useClient } from 'cozy-client'
@@ -8,7 +8,6 @@ import Button, { ButtonLink } from 'cozy-ui/transpiled/react/Button'
8
8
  import { useI18n } from 'cozy-ui/transpiled/react/I18n'
9
9
 
10
10
  import CozyHomeLinkIcon from './CozyHomeLinkIcon'
11
-
12
11
  import styles from './publicBanner.styl'
13
12
 
14
13
  const HOME_LINK_HREF = 'https://manager.cozycloud.cc/cozy/create'
@@ -1,8 +1,10 @@
1
- import React from 'react'
2
1
  import { render } from '@testing-library/react'
3
- import { SharingBannerCozyToCozy } from './PublicBanner'
4
- import { useI18n } from 'cozy-ui/transpiled/react/I18n'
2
+ import React from 'react'
3
+
5
4
  import { useClient } from 'cozy-client'
5
+ import { useI18n } from 'cozy-ui/transpiled/react/I18n'
6
+
7
+ import { SharingBannerCozyToCozy } from './PublicBanner'
6
8
 
7
9
  jest.mock('cozy-ui/transpiled/react/I18n')
8
10
  jest.mock('cozy-client')
@@ -1,5 +1,5 @@
1
- import React, { useState, useCallback } from 'react'
2
1
  import PropTypes from 'prop-types'
2
+ import React, { useState, useCallback } from 'react'
3
3
 
4
4
  import { SharingBannerByLink, SharingBannerCozyToCozy } from './PublicBanner'
5
5
 
@@ -2,9 +2,9 @@ import { useState, useEffect } from 'react'
2
2
 
3
3
  import { useClient, models } from 'cozy-client'
4
4
 
5
- import getQueryParameter from '../helpers/QueryParameter'
6
5
  import logger from '../../logger'
7
6
  import { buildSharingsByIdQuery } from '../../queries/queries'
7
+ import getQueryParameter from '../helpers/QueryParameter'
8
8
 
9
9
  const getSharingId = permission => {
10
10
  const sourceId = permission.data.attributes.source_id
@@ -1,5 +1,5 @@
1
- import React from 'react'
2
1
  import { renderHook, act } from '@testing-library/react-hooks'
2
+ import React from 'react'
3
3
 
4
4
  import { createMockClient } from 'cozy-client'
5
5
 
@@ -1,9 +1,9 @@
1
- import React from 'react'
2
1
  import PropTypes from 'prop-types'
2
+ import React from 'react'
3
3
 
4
- import withLocales from '../withLocales'
5
- import { useSharingInfos } from './hooks/useSharingInfos'
6
4
  import { SharingBanner } from './components/SharingBanner'
5
+ import { useSharingInfos } from './hooks/useSharingInfos'
6
+ import withLocales from '../withLocales'
7
7
 
8
8
  const Plugin = ({ previewPath }) => {
9
9
  const sharingInfos = useSharingInfos(previewPath)
@@ -1,18 +1,18 @@
1
1
  import React from 'react'
2
- import { CozyProvider } from 'cozy-client'
3
2
  import { Provider } from 'react-redux'
4
3
  import { createStore } from 'redux'
5
4
 
5
+ import { CozyProvider } from 'cozy-client'
6
6
  import { I18n } from 'cozy-ui/transpiled/react/I18n'
7
- import SharingContext from '../../context'
8
-
9
- import langEn from '../../../locales/en.json'
10
- import { ThumbnailSizeContextProvider } from './ThumbnailSizeContext'
11
7
  import { BreakpointsProvider } from 'cozy-ui/transpiled/react/hooks/useBreakpoints'
12
- import { ModalContext } from './ModalContext'
13
- import { RouterContext } from './RouterContext'
8
+
14
9
  import { AcceptingSharingProvider } from './AcceptingSharingContext'
15
10
  import FabProvider from './FabProvider'
11
+ import { ModalContext } from './ModalContext'
12
+ import { RouterContext } from './RouterContext'
13
+ import { ThumbnailSizeContextProvider } from './ThumbnailSizeContext'
14
+ import langEn from '../../../locales/en.json'
15
+ import SharingContext from '../../context'
16
16
 
17
17
  const mockStore = createStore(() => ({
18
18
  mobile: {
@@ -1,14 +1,14 @@
1
- import styles from './share.styl'
2
- import React from 'react'
3
1
  import PropTypes from 'prop-types'
2
+ import React from 'react'
4
3
 
5
- import { useI18n } from 'cozy-ui/transpiled/react/I18n'
6
4
  import { Dialog } from 'cozy-ui/transpiled/react/CozyDialogs'
5
+ import { useI18n } from 'cozy-ui/transpiled/react/I18n'
7
6
  import Divider from 'cozy-ui/transpiled/react/MuiCozyTheme/Divider'
8
7
 
9
8
  import OwnerIdentity from './components/Recipient/OwnerIdentity'
10
9
  import WhoHasAccess from './components/WhoHasAccess'
11
10
  import { getDisplayName } from './models'
11
+ import styles from './share.styl'
12
12
 
13
13
  export const SharingDetailsModal = ({
14
14
  onClose,
@@ -1,8 +1,8 @@
1
1
  import React from 'react'
2
2
 
3
+ import RecipientAvatar from './components/Recipient/RecipientAvatar'
3
4
  import SharingContext from './context'
4
5
  import withLocales from './withLocales'
5
- import RecipientAvatar from './components/Recipient/RecipientAvatar'
6
6
 
7
7
  export const SharingOwnerAvatar = withLocales(({ docId, ...rest }) => (
8
8
  <SharingContext.Consumer>
@@ -3,6 +3,15 @@ import React, { Component } from 'react'
3
3
  import { withClient } from 'cozy-client'
4
4
 
5
5
  import SharingContext from './context'
6
+ import { fetchNextPermissions } from './fetchNextPermissions'
7
+ import { fetchFilesPaths } from './helpers/files'
8
+ import {
9
+ getSharingObject,
10
+ createSharingInStore,
11
+ updateSharingInStore
12
+ } from './helpers/sharings'
13
+ import { SynchronousJobQueue } from './helpers/synchronousJobQueue'
14
+ import { fetchApps } from './queries/queries'
6
15
  import reducer, {
7
16
  receiveSharings,
8
17
  addSharing,
@@ -28,15 +37,6 @@ import reducer, {
28
37
  hasSharedParent,
29
38
  hasSharedChild
30
39
  } from './state'
31
- import { fetchNextPermissions } from './fetchNextPermissions'
32
- import { fetchFilesPaths } from './helpers/files'
33
- import { SynchronousJobQueue } from './helpers/synchronousJobQueue'
34
- import {
35
- getSharingObject,
36
- createSharingInStore,
37
- updateSharingInStore
38
- } from './helpers/sharings'
39
- import { fetchApps } from './queries/queries'
40
40
 
41
41
  const SHARING_DOCTYPE = 'io.cozy.sharings'
42
42
  const PERMISSION_DOCTYPE = 'io.cozy.permissions'
@@ -1,13 +1,13 @@
1
- import React from 'react'
2
- import { mount } from 'enzyme'
3
1
  import { act } from '@testing-library/react'
2
+ import { mount } from 'enzyme'
3
+ import React from 'react'
4
+
4
5
  import { createMockClient } from 'cozy-client'
5
6
 
6
- import SharingContext from './context'
7
7
  import { SharingProvider } from './SharingProvider'
8
- import AppLike from '../test/AppLike'
9
-
8
+ import SharingContext from './context'
10
9
  import { receiveSharings } from './state'
10
+ import AppLike from '../test/AppLike'
11
11
 
12
12
  const AppWrapper = ({ children, client }) => {
13
13
  return (
@@ -1,9 +1,9 @@
1
1
  import React from 'react'
2
+
2
3
  import { useI18n } from 'cozy-ui/transpiled/react/I18n'
3
4
  import Typography from 'cozy-ui/transpiled/react/Typography'
4
5
 
5
6
  import Recipient from './Recipient/Recipient'
6
-
7
7
  import ShareDialogTwoStepsConfirmationContainer from './ShareDialogTwoStepsConfirmationContainer'
8
8
 
9
9
  /**
@@ -1,13 +1,13 @@
1
- import React from 'react'
2
- import PropTypes from 'prop-types'
3
1
  import get from 'lodash/get'
2
+ import PropTypes from 'prop-types'
3
+ import React from 'react'
4
4
 
5
5
  import { models } from 'cozy-client'
6
- import { useI18n } from 'cozy-ui/transpiled/react/I18n'
7
6
  import Avatar from 'cozy-ui/transpiled/react/Avatar'
7
+ import { useI18n } from 'cozy-ui/transpiled/react/I18n'
8
+ import ListItemText from 'cozy-ui/transpiled/react/ListItemText'
8
9
  import ListItem from 'cozy-ui/transpiled/react/MuiCozyTheme/ListItem'
9
10
  import ListItemIcon from 'cozy-ui/transpiled/react/MuiCozyTheme/ListItemIcon'
10
- import ListItemText from 'cozy-ui/transpiled/react/ListItemText'
11
11
 
12
12
  import { Contact, Group, getDisplayName, getInitials } from '../models'
13
13
 
@@ -1,9 +1,9 @@
1
- import React from 'react'
2
1
  import { mount } from 'enzyme'
2
+ import React from 'react'
3
3
 
4
+ import { ContactSuggestion } from './ContactSuggestion'
4
5
  import AppLike from '../../test/AppLike'
5
6
 
6
- import { ContactSuggestion } from './ContactSuggestion'
7
7
  const WrappingComponent = ({ children }) => <AppLike>{children}</AppLike>
8
8
 
9
9
  describe('ContactSuggestion component', () => {
@@ -1,13 +1,12 @@
1
- import React from 'react'
1
+ import cx from 'classnames'
2
2
  import PropTypes from 'prop-types'
3
+ import React from 'react'
4
+ import snarkdown from 'snarkdown'
3
5
 
6
+ import { useI18n } from 'cozy-ui/transpiled/react/I18n'
4
7
  import Paper from 'cozy-ui/transpiled/react/Paper'
5
8
  import Typography from 'cozy-ui/transpiled/react/Typography'
6
9
 
7
- import { useI18n } from 'cozy-ui/transpiled/react/I18n'
8
- import snarkdown from 'snarkdown'
9
-
10
- import cx from 'classnames'
11
10
  import styles from './CozyPassFingerprintDialogContent.styl'
12
11
 
13
12
  /**
@@ -1,10 +1,10 @@
1
- import React from 'react'
2
1
  import { render } from '@testing-library/react'
2
+ import React from 'react'
3
3
 
4
4
  import { createMockClient } from 'cozy-client'
5
- import AppLike from '../../test/AppLike'
6
5
 
7
6
  import { CozyPassFingerprintDialogContent } from './CozyPassFingerprintDialogContent'
7
+ import AppLike from '../../test/AppLike'
8
8
 
9
9
  describe('CozyPassFingerprintDialogContent', () => {
10
10
  const client = createMockClient({})
@@ -1,12 +1,12 @@
1
- import React, { useState } from 'react'
2
1
  import PropTypes from 'prop-types'
2
+ import React, { useState } from 'react'
3
3
 
4
- import { useI18n } from 'cozy-ui/transpiled/react/I18n'
5
- import { ConfirmDialog } from 'cozy-ui/transpiled/react/CozyDialogs'
6
4
  import Button from 'cozy-ui/transpiled/react/Buttons'
7
- import Radio from 'cozy-ui/transpiled/react/Radios'
8
- import RadioGroup from 'cozy-ui/transpiled/react/RadioGroup'
5
+ import { ConfirmDialog } from 'cozy-ui/transpiled/react/CozyDialogs'
9
6
  import FormControlLabel from 'cozy-ui/transpiled/react/FormControlLabel'
7
+ import { useI18n } from 'cozy-ui/transpiled/react/I18n'
8
+ import RadioGroup from 'cozy-ui/transpiled/react/RadioGroup'
9
+ import Radio from 'cozy-ui/transpiled/react/Radios'
10
10
 
11
11
  const EditLinkPermissionDialog = ({
12
12
  open,
@@ -1,9 +1,10 @@
1
- import React from 'react'
2
1
  import { render, fireEvent } from '@testing-library/react'
2
+ import React from 'react'
3
3
 
4
4
  import { createMockClient } from 'cozy-client'
5
- import AppLike from '../../test/AppLike'
5
+
6
6
  import EditLinkPermissionDialog from './EditLinkPermissionDialog'
7
+ import AppLike from '../../test/AppLike'
7
8
 
8
9
  describe('EditLinkPermissionDialog', () => {
9
10
  const client = createMockClient({})
@@ -1,11 +1,12 @@
1
- import React from 'react'
2
1
  import PropTypes from 'prop-types'
2
+ import React from 'react'
3
+
3
4
  import { useClient, useQueryAll } from 'cozy-client'
4
5
 
5
- import { Contact } from '../models'
6
- import SharingContext from '../context'
7
6
  import { default as DumbShareModal } from './ShareModal'
8
7
  import { useFetchDocumentPath } from './useFetchDocumentPath'
8
+ import SharingContext from '../context'
9
+ import { Contact } from '../models'
9
10
  import { buildContactsQuery, buildGroupsQuery } from '../queries/queries'
10
11
 
11
12
  export const EditableSharingModal = ({ document, ...rest }) => {