cozy-sharing 12.0.0 → 12.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 (49) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/components/ConfirmTrustedRecipientsDialog.js +11 -3
  3. package/dist/components/ConfirmTrustedRecipientsDialog.stories.js +39 -0
  4. package/dist/components/ContactSuggestion.js +3 -14
  5. package/dist/components/ContactSuggestion.spec.js +22 -104
  6. package/dist/components/Recipient/GroupRecipient.js +36 -5
  7. package/dist/components/Recipient/GroupRecipient.stories.js +3 -2
  8. package/dist/components/Recipient/GroupRecipientDetail.js +43 -0
  9. package/dist/components/Recipient/GroupRecipientDetail.stories.js +55 -0
  10. package/dist/components/Recipient/GroupRecipientDetailWithAccess.js +44 -0
  11. package/dist/components/Recipient/GroupRecipientDetailWithoutAccess.js +45 -0
  12. package/dist/components/Recipient/LinkRecipient.js +5 -1
  13. package/dist/components/Recipient/MemberRecipient.js +5 -1
  14. package/dist/components/Recipient/RecipientList.stories.js +3 -0
  15. package/dist/components/ShareAutosuggest.js +0 -3
  16. package/dist/components/ShareDialogCozyToCozy.js +9 -3
  17. package/dist/components/ShareDialogOnlyByLink.js +12 -4
  18. package/dist/components/ShareDialogTwoStepsConfirmationContainer.js +1 -0
  19. package/dist/components/ShareModal/SharingDetailsModal.js +7 -1
  20. package/dist/components/ShareRecipientsInput.js +23 -1
  21. package/dist/components/ShareRecipientsInput.spec.js +206 -115
  22. package/dist/components/WhoHasAccess.js +1 -3
  23. package/jest.config.js +2 -1
  24. package/locales/en.json +13 -0
  25. package/locales/fr.json +13 -0
  26. package/package.json +2 -2
  27. package/src/components/ConfirmTrustedRecipientsDialog.jsx +24 -13
  28. package/src/components/ConfirmTrustedRecipientsDialog.stories.jsx +45 -0
  29. package/src/components/ContactSuggestion.jsx +3 -17
  30. package/src/components/ContactSuggestion.spec.jsx +16 -99
  31. package/src/components/Recipient/GroupRecipient.jsx +51 -24
  32. package/src/components/Recipient/GroupRecipient.stories.jsx +3 -2
  33. package/src/components/Recipient/GroupRecipientDetail.jsx +50 -0
  34. package/src/components/Recipient/GroupRecipientDetail.stories.jsx +53 -0
  35. package/src/components/Recipient/GroupRecipientDetailWithAccess.jsx +57 -0
  36. package/src/components/Recipient/GroupRecipientDetailWithoutAccess.jsx +60 -0
  37. package/src/components/Recipient/LinkRecipient.jsx +3 -1
  38. package/src/components/Recipient/MemberRecipient.jsx +3 -1
  39. package/src/components/Recipient/RecipientList.stories.jsx +3 -0
  40. package/src/components/ShareAutosuggest.jsx +1 -6
  41. package/src/components/ShareDialogCozyToCozy.jsx +40 -36
  42. package/src/components/ShareDialogOnlyByLink.jsx +22 -8
  43. package/src/components/ShareDialogTwoStepsConfirmationContainer.jsx +1 -0
  44. package/src/components/ShareModal/SharingDetailsModal.jsx +10 -1
  45. package/src/components/ShareRecipientsInput.jsx +19 -1
  46. package/src/components/ShareRecipientsInput.spec.jsx +170 -108
  47. package/src/components/WhoHasAccess.jsx +1 -1
  48. package/src/components/__snapshots__/ContactSuggestion.spec.jsx.snap +0 -1192
  49. package/src/components/__snapshots__/ShareRecipientsInput.spec.jsx.snap +0 -99
@@ -4,6 +4,7 @@ var _excluded = ["showShareByLink", "documentType", "document"];
4
4
  import cx from 'classnames';
5
5
  import React from 'react';
6
6
  import Typography from 'cozy-ui/transpiled/react/Typography';
7
+ import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints';
7
8
  import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
8
9
  import { default as DumbShareByEmail } from './ShareByEmail';
9
10
  import { default as DumbShareByLink } from './ShareByLink';
@@ -64,8 +65,13 @@ var SharingContent = function SharingContent(_ref) {
64
65
  var _useI18n = useI18n(),
65
66
  t = _useI18n.t;
66
67
 
68
+ var _useBreakpoints = useBreakpoints(),
69
+ isMobile = _useBreakpoints.isMobile;
70
+
67
71
  return /*#__PURE__*/React.createElement("div", {
68
72
  className: cx(styles['share-modal-content'])
73
+ }, /*#__PURE__*/React.createElement("div", {
74
+ className: cx('u-pt-1-half', isMobile ? 'u-ph-1' : 'u-ph-2')
69
75
  }, showShareOnlyByLink && /*#__PURE__*/React.createElement("div", {
70
76
  className: styles['share-byemail-onlybylink']
71
77
  }, t("".concat(documentType, ".share.shareByEmail.onlyByLink"), {
@@ -84,8 +90,7 @@ var SharingContent = function SharingContent(_ref) {
84
90
  onShare: onShare,
85
91
  sharing: sharing,
86
92
  sharingDesc: sharingDesc
87
- }), showWhoHasAccess && /*#__PURE__*/React.createElement(WhoHasAccess, {
88
- className: "u-mt-half",
93
+ })), showWhoHasAccess && /*#__PURE__*/React.createElement(WhoHasAccess, {
89
94
  document: document,
90
95
  documentType: documentType,
91
96
  isOwner: isOwner,
@@ -139,7 +144,8 @@ var ShareDialogCozyToCozy = function ShareDialogCozyToCozy(_ref3) {
139
144
  dialogTitleOnShare: SharingTitleFunction({
140
145
  documentType: documentType,
141
146
  document: document
142
- })
147
+ }),
148
+ disableGutters: true
143
149
  }));
144
150
  };
145
151
 
@@ -1,6 +1,8 @@
1
+ import cx from 'classnames';
1
2
  import React from 'react';
2
3
  import { Dialog } from 'cozy-ui/transpiled/react/CozyDialogs';
3
4
  import Typography from 'cozy-ui/transpiled/react/Typography';
5
+ import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints';
4
6
  import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
5
7
  import { default as DumbShareByLink } from './ShareByLink';
6
8
  import WhoHasAccess from './WhoHasAccess';
@@ -22,7 +24,11 @@ var ShareDialogOnlyByLink = function ShareDialogOnlyByLink(_ref) {
22
24
  var _useI18n = useI18n(),
23
25
  t = _useI18n.t;
24
26
 
27
+ var _useBreakpoints = useBreakpoints(),
28
+ isMobile = _useBreakpoints.isMobile;
29
+
25
30
  return /*#__PURE__*/React.createElement(Dialog, {
31
+ disableGutters: true,
26
32
  disableEnforceFocus: true,
27
33
  open: true,
28
34
  onClose: onClose,
@@ -30,9 +36,9 @@ var ShareDialogOnlyByLink = function ShareDialogOnlyByLink(_ref) {
30
36
  name: document.name || document.attributes.name
31
37
  }),
32
38
  content: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography, {
33
- variant: "h6"
39
+ variant: "h6",
40
+ className: cx(isMobile ? 'u-ph-1 u-mt-1' : 'u-ph-2 u-mt-1-half')
34
41
  }, t('Share.contacts.whoHasAccess')), /*#__PURE__*/React.createElement(WhoHasAccess, {
35
- className: "u-mt-half",
36
42
  document: document,
37
43
  documentType: documentType,
38
44
  isOwner: isOwner,
@@ -43,12 +49,14 @@ var ShareDialogOnlyByLink = function ShareDialogOnlyByLink(_ref) {
43
49
  permissions: permissions,
44
50
  onUpdateShareLinkPermissions: onUpdateShareLinkPermissions,
45
51
  onRevokeLink: onRevokeLink
46
- }), /*#__PURE__*/React.createElement(DumbShareByLink, {
52
+ }), /*#__PURE__*/React.createElement("div", {
53
+ className: cx('u-mt-half', isMobile ? 'u-ph-1 u-mb-1' : 'u-ph-2 u-mb-1-half')
54
+ }, /*#__PURE__*/React.createElement(DumbShareByLink, {
47
55
  link: link,
48
56
  document: document,
49
57
  documentType: documentType,
50
58
  onEnable: onShareByLink
51
- }))
59
+ })))
52
60
  });
53
61
  };
54
62
 
@@ -293,6 +293,7 @@ var ShareDialogTwoStepsConfirmationContainer = function ShareDialogTwoStepsConfi
293
293
  }
294
294
 
295
295
  return /*#__PURE__*/React.createElement(FixedDialog, {
296
+ disableGutters: true,
296
297
  disableEnforceFocus: true,
297
298
  open: true,
298
299
  onClose: onClose,
@@ -1,7 +1,9 @@
1
+ import cx from 'classnames';
1
2
  import PropTypes from 'prop-types';
2
3
  import React from 'react';
3
4
  import { Dialog } from 'cozy-ui/transpiled/react/CozyDialogs';
4
5
  import Divider from 'cozy-ui/transpiled/react/Divider';
6
+ import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints';
5
7
  import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
6
8
  import { getDisplayName } from '../../models';
7
9
  var styles = {
@@ -44,7 +46,11 @@ export var SharingDetailsModal = function SharingDetailsModal(_ref) {
44
46
  t = _useI18n.t,
45
47
  f = _useI18n.f;
46
48
 
49
+ var _useBreakpoints = useBreakpoints(),
50
+ isMobile = _useBreakpoints.isMobile;
51
+
47
52
  return /*#__PURE__*/React.createElement(Dialog, {
53
+ disableGutters: true,
48
54
  open: true,
49
55
  onClose: onClose,
50
56
  className: styles['share-modal'],
@@ -52,7 +58,7 @@ export var SharingDetailsModal = function SharingDetailsModal(_ref) {
52
58
  content: /*#__PURE__*/React.createElement("div", {
53
59
  className: styles['share-modal-content']
54
60
  }, /*#__PURE__*/React.createElement("div", {
55
- className: styles['share-details']
61
+ className: cx(styles['share-details'], isMobile ? 'u-ph-1 u-pt-1-half' : 'u-ph-2 u-pt-1')
56
62
  }, /*#__PURE__*/React.createElement(OwnerIdentity, {
57
63
  name: t("".concat(documentType, ".share.sharedBy"), {
58
64
  name: getDisplayName(owner)
@@ -1,5 +1,12 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
+
5
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
+
7
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
+
9
+ import get from 'lodash/get';
3
10
  import PropTypes from 'prop-types';
4
11
  import React, { useState, useEffect } from 'react';
5
12
  import ShareAutosuggest from './ShareAutosuggest';
@@ -35,7 +42,22 @@ var ShareRecipientsInput = function ShareRecipientsInput(_ref) {
35
42
  if (contacts.hasMore || contacts.fetchStatus === 'loading') {
36
43
  return contacts.data;
37
44
  } else {
38
- return [].concat(_toConsumableArray(contacts.data), _toConsumableArray(contactGroups.data));
45
+ var contactGroupsWithCount = contactGroups.data.map(function (contactGroup) {
46
+ return _objectSpread(_objectSpread({}, contactGroup), {}, {
47
+ membersCount: contacts.data.reduce(function (total, contact) {
48
+ if (get(contact, 'relationships.groups.data', []).map(function (group) {
49
+ return group._id;
50
+ }).includes(contactGroup._id)) {
51
+ return total + 1;
52
+ }
53
+
54
+ return total;
55
+ }, 0)
56
+ });
57
+ }).filter(function (contactGroup) {
58
+ return contactGroup.membersCount > 0;
59
+ });
60
+ return [].concat(_toConsumableArray(contacts.data), _toConsumableArray(contactGroupsWithCount));
39
61
  }
40
62
  };
41
63
 
@@ -1,119 +1,210 @@
1
- import { shallow } from 'enzyme';
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import { render, screen } from '@testing-library/react';
2
4
  import React from 'react';
3
5
  import ShareRecipientsInput from './ShareRecipientsInput';
4
- describe('ShareRecipientsInput component', function () {
5
- it('should match snapshot', function () {
6
- var props = {
7
- client: '',
8
- label: 'Recipients',
9
- contacts: {
10
- id: 'contacts',
11
- fetchStatus: 'loaded',
12
- hasMore: false,
13
- data: [{
14
- id: 'df563cc4-6440',
15
- _id: 'df563cc4-6440',
16
- _type: 'io.cozy.contacts',
17
- name: {
18
- givenName: 'Michale',
19
- familyName: 'Russel'
20
- }
21
- }, {
22
- id: '5a3b4ccf-c257',
23
- _id: '5a3b4ccf-c257',
24
- _type: 'io.cozy.contacts',
25
- name: {
26
- givenName: 'Teagan',
27
- familyName: 'Wolf'
28
- }
29
- }]
30
- },
31
- contactGroups: {
32
- id: 'groups',
33
- fetchStatus: 'loaded',
34
- hasMore: false,
35
- data: [{
36
- id: 'fe86af20-c6c5',
37
- name: "The Night's Watch",
38
- _id: 'fe86af20-c6c5',
39
- _type: 'io.cozy.contacts.groups'
40
- }, {
41
- id: '3d8193ab-2ce4',
42
- name: 'The North',
43
- _id: '3d8193ab-2ce4',
44
- _type: 'io.cozy.contacts.groups'
45
- }]
46
- },
47
- recipients: [{
48
- id: '5a3b4ccf-c257',
49
- name: {
50
- givenName: 'Teagan',
51
- familyName: 'Wolf'
52
- }
53
- }],
54
- onPick: jest.fn().mockName('onPick'),
55
- onRemove: jest.fn().mockName('onRemove'),
56
- placeholder: 'Enter recipients here'
57
- };
58
- var jsx = /*#__PURE__*/React.createElement(ShareRecipientsInput, props);
59
- var wrapper = shallow(jsx);
60
- expect(wrapper).toMatchSnapshot();
61
- });
62
- it('should include groups only if all contacts are loaded', function () {
63
- var props = {
64
- client: '',
65
- label: 'Recipients',
66
- contacts: {
67
- id: 'contacts',
68
- fetchStatus: 'loading',
69
- hasMore: false,
70
- data: [{
71
- id: 'df563cc4-6440',
72
- _id: 'df563cc4-6440',
73
- _type: 'io.cozy.contacts',
74
- name: {
75
- givenName: 'Michale',
76
- familyName: 'Russel'
77
- }
78
- }, {
79
- id: '5a3b4ccf-c257',
80
- _id: '5a3b4ccf-c257',
81
- _type: 'io.cozy.contacts',
82
- name: {
83
- givenName: 'Teagan',
84
- familyName: 'Wolf'
85
- }
86
- }]
87
- },
88
- contactGroups: {
89
- id: 'groups',
90
- fetchStatus: 'loaded',
91
- hasMore: false,
92
- data: [{
93
- id: 'fe86af20-c6c5',
94
- name: "The Night's Watch",
95
- _id: 'fe86af20-c6c5',
96
- _type: 'io.cozy.contacts.groups'
97
- }, {
98
- id: '3d8193ab-2ce4',
99
- name: 'The North',
100
- _id: '3d8193ab-2ce4',
101
- _type: 'io.cozy.contacts.groups'
102
- }]
103
- },
104
- recipients: [{
105
- id: '5a3b4ccf-c257',
106
- name: {
107
- givenName: 'Teagan',
108
- familyName: 'Wolf'
6
+ jest.mock('./ShareAutosuggest', function () {
7
+ return {
8
+ __esModule: true,
9
+ default: function _default(_ref) {
10
+ var contactsAndGroups = _ref.contactsAndGroups;
11
+ return /*#__PURE__*/React.createElement("ul", null, contactsAndGroups.map(function (contactOrGroup) {
12
+ if (contactOrGroup._type === 'io.cozy.contacts') {
13
+ return /*#__PURE__*/React.createElement("li", {
14
+ key: contactOrGroup.id
15
+ }, contactOrGroup.name.givenName, " ", contactOrGroup.name.familyName);
16
+ } else {
17
+ return /*#__PURE__*/React.createElement("li", {
18
+ key: contactOrGroup.id
19
+ }, contactOrGroup.name);
109
20
  }
110
- }],
111
- onPick: jest.fn().mockName('onPick'),
112
- onRemove: jest.fn().mockName('onRemove'),
113
- placeholder: 'Enter recipients here'
114
- };
115
- var jsx = /*#__PURE__*/React.createElement(ShareRecipientsInput, props);
116
- var wrapper = shallow(jsx);
117
- expect(wrapper).toMatchSnapshot();
118
- });
21
+ }));
22
+ }
23
+ };
24
+ });
25
+ describe('ShareRecipientsInput component', function () {
26
+ var setup = function setup(_ref2) {
27
+ var contacts = _ref2.contacts,
28
+ contactGroups = _ref2.contactGroups;
29
+ render( /*#__PURE__*/React.createElement(ShareRecipientsInput, {
30
+ contacts: contacts,
31
+ contactGroups: contactGroups,
32
+ onPick: function onPick() {},
33
+ onRemove: function onRemove() {},
34
+ placeholder: "Enter recipients here"
35
+ }));
36
+ };
37
+
38
+ it('should include groups and contacts when are loaded', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
39
+ var contacts, contactGroups;
40
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
41
+ while (1) switch (_context.prev = _context.next) {
42
+ case 0:
43
+ contacts = {
44
+ id: 'contacts',
45
+ fetchStatus: 'loaded',
46
+ hasMore: false,
47
+ data: [{
48
+ id: 'df563cc4-6440',
49
+ _id: 'df563cc4-6440',
50
+ _type: 'io.cozy.contacts',
51
+ name: {
52
+ givenName: 'Michale',
53
+ familyName: 'Russel'
54
+ }
55
+ }, {
56
+ id: '5a3b4ccf-c257',
57
+ _id: '5a3b4ccf-c257',
58
+ _type: 'io.cozy.contacts',
59
+ name: {
60
+ givenName: 'Teagan',
61
+ familyName: 'Wolf'
62
+ },
63
+ relationships: {
64
+ groups: {
65
+ data: [{
66
+ _id: 'fe86af20-c6c5',
67
+ _type: 'io.cozy.contacts.groups'
68
+ }]
69
+ }
70
+ }
71
+ }]
72
+ };
73
+ contactGroups = {
74
+ id: 'groups',
75
+ fetchStatus: 'loaded',
76
+ hasMore: false,
77
+ data: [{
78
+ id: 'fe86af20-c6c5',
79
+ name: "The Night's Watch",
80
+ _id: 'fe86af20-c6c5',
81
+ _type: 'io.cozy.contacts.groups'
82
+ }]
83
+ };
84
+ setup({
85
+ contacts: contacts,
86
+ contactGroups: contactGroups
87
+ });
88
+ expect(screen.getByText('Michale Russel')).toBeInTheDocument();
89
+ expect(screen.getByText('Teagan Wolf')).toBeInTheDocument();
90
+ expect(screen.getByText("The Night's Watch")).toBeInTheDocument();
91
+
92
+ case 6:
93
+ case "end":
94
+ return _context.stop();
95
+ }
96
+ }, _callee);
97
+ })));
98
+ it('should include groups only if all contacts are loaded', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
99
+ var contacts, contactGroups;
100
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
101
+ while (1) switch (_context2.prev = _context2.next) {
102
+ case 0:
103
+ contacts = {
104
+ id: 'contacts',
105
+ fetchStatus: 'loading',
106
+ hasMore: false,
107
+ data: [{
108
+ id: 'df563cc4-6440',
109
+ _id: 'df563cc4-6440',
110
+ _type: 'io.cozy.contacts',
111
+ name: {
112
+ givenName: 'Michale',
113
+ familyName: 'Russel'
114
+ }
115
+ }, {
116
+ id: '5a3b4ccf-c257',
117
+ _id: '5a3b4ccf-c257',
118
+ _type: 'io.cozy.contacts',
119
+ name: {
120
+ givenName: 'Teagan',
121
+ familyName: 'Wolf'
122
+ },
123
+ relationships: {
124
+ groups: {
125
+ data: [{
126
+ _id: 'fe86af20-c6c5',
127
+ _type: 'io.cozy.contacts.groups'
128
+ }]
129
+ }
130
+ }
131
+ }]
132
+ };
133
+ contactGroups = {
134
+ id: 'groups',
135
+ fetchStatus: 'loaded',
136
+ hasMore: false,
137
+ data: [{
138
+ id: 'fe86af20-c6c5',
139
+ name: "The Night's Watch",
140
+ _id: 'fe86af20-c6c5',
141
+ _type: 'io.cozy.contacts.groups'
142
+ }]
143
+ };
144
+ setup({
145
+ contacts: contacts,
146
+ contactGroups: contactGroups
147
+ });
148
+ expect(screen.getByText('Michale Russel')).toBeInTheDocument();
149
+ expect(screen.getByText('Teagan Wolf')).toBeInTheDocument();
150
+ expect(screen.queryByText("The Night's Watch")).toBeNull();
151
+
152
+ case 6:
153
+ case "end":
154
+ return _context2.stop();
155
+ }
156
+ }, _callee2);
157
+ })));
158
+ it('should include groups only if they have more than one member', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
159
+ var contacts, contactGroups;
160
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
161
+ while (1) switch (_context3.prev = _context3.next) {
162
+ case 0:
163
+ contacts = {
164
+ id: 'contacts',
165
+ fetchStatus: 'loaded',
166
+ hasMore: false,
167
+ data: [{
168
+ id: 'df563cc4-6440',
169
+ _id: 'df563cc4-6440',
170
+ _type: 'io.cozy.contacts',
171
+ name: {
172
+ givenName: 'Michale',
173
+ familyName: 'Russel'
174
+ }
175
+ }, {
176
+ id: '5a3b4ccf-c257',
177
+ _id: '5a3b4ccf-c257',
178
+ _type: 'io.cozy.contacts',
179
+ name: {
180
+ givenName: 'Teagan',
181
+ familyName: 'Wolf'
182
+ }
183
+ }]
184
+ };
185
+ contactGroups = {
186
+ id: 'groups',
187
+ fetchStatus: 'loaded',
188
+ hasMore: false,
189
+ data: [{
190
+ id: 'fe86af20-c6c5',
191
+ name: "The Night's Watch",
192
+ _id: 'fe86af20-c6c5',
193
+ _type: 'io.cozy.contacts.groups'
194
+ }]
195
+ };
196
+ setup({
197
+ contacts: contacts,
198
+ contactGroups: contactGroups
199
+ });
200
+ expect(screen.getByText('Michale Russel')).toBeInTheDocument();
201
+ expect(screen.getByText('Teagan Wolf')).toBeInTheDocument();
202
+ expect(screen.queryByText("The Night's Watch")).toBeNull();
203
+
204
+ case 6:
205
+ case "end":
206
+ return _context3.stop();
207
+ }
208
+ }, _callee3);
209
+ })));
119
210
  });
@@ -49,9 +49,7 @@ var WhoHasAccess = function WhoHasAccess(_ref2) {
49
49
  className: className
50
50
  }, /*#__PURE__*/React.createElement(RecipientWaitingForConfirmationAlert, {
51
51
  recipientsToBeConfirmed: recipientsToBeConfirmed
52
- }), /*#__PURE__*/React.createElement(List, {
53
- disablePadding: true
54
- }, link && /*#__PURE__*/React.createElement(LinkRecipient, {
52
+ }), /*#__PURE__*/React.createElement(List, null, link && /*#__PURE__*/React.createElement(LinkRecipient, {
55
53
  document: document,
56
54
  documentType: documentType,
57
55
  onRevoke: onRevoke,
package/jest.config.js CHANGED
@@ -2,7 +2,8 @@ module.exports = {
2
2
  collectCoverageFrom: [
3
3
  'src/**/*.{js,jsx}',
4
4
  '!**/node_modules/**',
5
- '!**/vendor/**'
5
+ '!**/vendor/**',
6
+ '!**/*.stories.{js,jsx,ts,tsx}'
6
7
  ],
7
8
  snapshotSerializers: ['enzyme-to-json/serializer'],
8
9
  testPathIgnorePatterns: ['node_modules', 'dist', '__tests__'],
package/locales/en.json CHANGED
@@ -376,5 +376,18 @@
376
376
  "title": "Remove me from sharing",
377
377
  "desc": "You keep the content but it won't be updated between your Cozy anymore."
378
378
  }
379
+ },
380
+ "GroupRecipientDetail": {
381
+ "subtitle": "Managed by %{ownerName}",
382
+ "withAccess": {
383
+ "title": "Access to item"
384
+ },
385
+ "withoutAccess": {
386
+ "title": "No access",
387
+ "status": {
388
+ "mail-not-sent": "Invitation failed",
389
+ "revoked": "Sharing revoked"
390
+ }
391
+ }
379
392
  }
380
393
  }
package/locales/fr.json CHANGED
@@ -374,5 +374,18 @@
374
374
  "title": "Quitter le partage",
375
375
  "desc": "Vous conserverez une copie mais vos changements ne seront plus synchronisés."
376
376
  }
377
+ },
378
+ "GroupRecipientDetail": {
379
+ "subtitle": "Géré par %{ownerName}",
380
+ "withAccess": {
381
+ "title": "Accès à l’élément"
382
+ },
383
+ "withoutAccess": {
384
+ "title": "Aucun accès",
385
+ "status": {
386
+ "mail-not-sent": "Echec de l’invitation",
387
+ "revoked": "Partage révoqué"
388
+ }
389
+ }
377
390
  }
378
391
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-sharing",
3
- "version": "12.0.0",
3
+ "version": "12.2.0",
4
4
  "description": "Provides sharing login for React applications.",
5
5
  "main": "dist/index.js",
6
6
  "author": "Cozy",
@@ -71,5 +71,5 @@
71
71
  "sideEffects": [
72
72
  "*.css"
73
73
  ],
74
- "gitHead": "ebef29fe4f3f3704c967ebfd2d330d9b95d6e25b"
74
+ "gitHead": "e48ad9475627e2be13c46e6b7be8a9f82215a392"
75
75
  }
@@ -1,6 +1,9 @@
1
+ import cx from 'classnames'
1
2
  import React from 'react'
2
3
 
4
+ import List from 'cozy-ui/transpiled/react/List'
3
5
  import Typography from 'cozy-ui/transpiled/react/Typography'
6
+ import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints'
4
7
  import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
5
8
 
6
9
  import MemberRecipient from './Recipient/MemberRecipient'
@@ -11,24 +14,32 @@ import ShareDialogTwoStepsConfirmationContainer from './ShareDialogTwoStepsConfi
11
14
  */
12
15
  const SharingContent = ({ recipientsToBeConfirmed, verifyRecipient }) => {
13
16
  const { t } = useI18n()
17
+ const { isMobile } = useBreakpoints()
14
18
 
15
19
  return (
16
20
  <>
17
- <Typography variant="body1" className="u-mb-2">
21
+ <Typography
22
+ variant="body1"
23
+ className={cx(
24
+ 'u-mb-half',
25
+ isMobile ? 'u-ph-1 u-mt-1' : 'u-ph-2 u-mt-1-half'
26
+ )}
27
+ >
18
28
  {t(`ConfirmRecipientModal.intruction`)}
19
29
  </Typography>
20
-
21
- {recipientsToBeConfirmed.map(recipientConfirmationData => {
22
- return (
23
- <MemberRecipient
24
- {...recipientConfirmationData}
25
- key={`key_r_${recipientConfirmationData.id}`}
26
- isOwner={false}
27
- recipientConfirmationData={recipientConfirmationData}
28
- verifyRecipient={verifyRecipient}
29
- />
30
- )
31
- })}
30
+ <List className={isMobile ? 'u-mb-half' : 'u-mb-1'}>
31
+ {recipientsToBeConfirmed.map(recipientConfirmationData => {
32
+ return (
33
+ <MemberRecipient
34
+ {...recipientConfirmationData}
35
+ key={`key_r_${recipientConfirmationData.id}`}
36
+ isOwner={false}
37
+ recipientConfirmationData={recipientConfirmationData}
38
+ verifyRecipient={verifyRecipient}
39
+ />
40
+ )
41
+ })}
42
+ </List>
32
43
  </>
33
44
  )
34
45
  }
@@ -0,0 +1,45 @@
1
+ import ConfirmTrustedRecipientsDialog from './ConfirmTrustedRecipientsDialog'
2
+
3
+ const meta = {
4
+ component: ConfirmTrustedRecipientsDialog,
5
+ args: {
6
+ recipientsToBeConfirmed: [
7
+ {
8
+ instance: 'https://example.com',
9
+ isOwner: false,
10
+ status: 'ready',
11
+ recipientConfirmationData: null,
12
+ verifyRecipient: () => {},
13
+ fadeIn: true,
14
+ type: 'two-way',
15
+ onRevoke: () => {},
16
+ onRevokeSelf: () => {}
17
+ }
18
+ ]
19
+ }
20
+ }
21
+
22
+ export default meta
23
+
24
+ export const Default = {
25
+ name: 'Default',
26
+ args: {
27
+ twoStepsConfirmationMethods: {
28
+ getRecipientsToBeConfirmed: () => [
29
+ {
30
+ name: 'John Doe',
31
+ instance: 'https://example.com',
32
+ isOwner: false,
33
+ status: 'ready'
34
+ },
35
+ {
36
+ name: 'Alice Doe',
37
+ instance: 'https://example.com',
38
+ isOwner: false,
39
+ status: 'ready'
40
+ }
41
+ ]
42
+ },
43
+ verifyRecipient: () => {}
44
+ }
45
+ }