cozy-sharing 12.2.0 → 13.0.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 (73) hide show
  1. package/.storybook/preview.jsx +1 -0
  2. package/CHANGELOG.md +40 -0
  3. package/dist/components/Avatar/AvatarList.js +13 -2
  4. package/dist/components/Avatar/AvatarList.spec.js +11 -6
  5. package/dist/components/Avatar/AvatarList.stories.js +13 -1
  6. package/dist/components/Avatar/GroupAvatar.js +4 -2
  7. package/dist/components/ContactSuggestion.js +7 -3
  8. package/dist/components/ContactSuggestion.spec.js +7 -1
  9. package/dist/components/Recipient/GroupRecipient.js +14 -7
  10. package/dist/components/Recipient/GroupRecipientDetail.js +4 -2
  11. package/dist/components/Recipient/GroupRecipientDetailWithAccess.js +9 -11
  12. package/dist/components/Recipient/GroupRecipientDetailWithoutAccess.js +8 -4
  13. package/dist/components/Recipient/GroupRecipientPermissions.js +3 -6
  14. package/dist/components/Recipient/MemberRecipient.js +1 -2
  15. package/dist/components/Recipient/MemberRecipientPermissions.js +1 -1
  16. package/dist/components/ShareAutosuggest.js +16 -9
  17. package/dist/components/ShareAutosuggest.spec.js +38 -13
  18. package/dist/components/ShareAutosuggest.stories.js +61 -0
  19. package/dist/components/ShareByEmail.js +15 -15
  20. package/dist/components/ShareByEmail.spec.js +0 -6
  21. package/dist/components/ShareDialogCozyToCozy.js +1 -5
  22. package/dist/components/ShareDialogCozyToCozy.spec.js +0 -61
  23. package/dist/components/ShareDialogTwoStepsConfirmationContainer.js +1 -5
  24. package/dist/components/ShareDialogTwoStepsConfirmationContainer.spec.js +0 -61
  25. package/dist/components/ShareModal/EditableSharingModal.js +3 -10
  26. package/dist/components/ShareModal/EditableSharingModal.spec.js +0 -6
  27. package/dist/components/ShareModal.js +1 -8
  28. package/dist/components/ShareRecipientsInput.js +46 -49
  29. package/dist/components/ShareRecipientsInput.spec.js +120 -144
  30. package/dist/helpers/contacts.js +12 -1
  31. package/dist/helpers/recipients.js +16 -9
  32. package/dist/helpers/successMessage.js +58 -16
  33. package/dist/helpers/successMessage.spec.js +122 -57
  34. package/dist/queries/queries.js +37 -5
  35. package/dist/styles/autosuggest.styl +2 -1
  36. package/dist/stylesheet.css +2 -1
  37. package/locales/en.json +23 -10
  38. package/locales/fr.json +23 -8
  39. package/package.json +4 -4
  40. package/src/components/Avatar/AvatarList.jsx +33 -14
  41. package/src/components/Avatar/AvatarList.spec.jsx +11 -6
  42. package/src/components/Avatar/AvatarList.stories.jsx +19 -1
  43. package/src/components/Avatar/GroupAvatar.jsx +2 -2
  44. package/src/components/ContactSuggestion.jsx +9 -3
  45. package/src/components/ContactSuggestion.spec.jsx +10 -1
  46. package/src/components/Recipient/GroupRecipient.jsx +17 -10
  47. package/src/components/Recipient/GroupRecipientDetail.jsx +5 -2
  48. package/src/components/Recipient/GroupRecipientDetailWithAccess.jsx +9 -14
  49. package/src/components/Recipient/GroupRecipientDetailWithoutAccess.jsx +8 -3
  50. package/src/components/Recipient/GroupRecipientPermissions.jsx +3 -8
  51. package/src/components/Recipient/MemberRecipient.jsx +4 -3
  52. package/src/components/Recipient/MemberRecipientPermissions.jsx +1 -1
  53. package/src/components/ShareAutosuggest.jsx +16 -11
  54. package/src/components/ShareAutosuggest.spec.jsx +31 -10
  55. package/src/components/ShareAutosuggest.stories.jsx +63 -0
  56. package/src/components/ShareByEmail.jsx +11 -11
  57. package/src/components/ShareByEmail.spec.jsx +0 -4
  58. package/src/components/ShareDialogCozyToCozy.jsx +0 -4
  59. package/src/components/ShareDialogCozyToCozy.spec.jsx +0 -67
  60. package/src/components/ShareDialogTwoStepsConfirmationContainer.jsx +0 -4
  61. package/src/components/ShareDialogTwoStepsConfirmationContainer.spec.jsx +0 -67
  62. package/src/components/ShareModal/EditableSharingModal.jsx +3 -21
  63. package/src/components/ShareModal/EditableSharingModal.spec.jsx +0 -2
  64. package/src/components/ShareModal.jsx +1 -7
  65. package/src/components/ShareRecipientsInput.jsx +84 -52
  66. package/src/components/ShareRecipientsInput.spec.jsx +140 -145
  67. package/src/helpers/contacts.js +8 -0
  68. package/src/helpers/recipients.js +24 -15
  69. package/src/helpers/successMessage.js +71 -21
  70. package/src/helpers/successMessage.spec.js +129 -69
  71. package/src/queries/queries.js +36 -5
  72. package/src/styles/autosuggest.styl +2 -1
  73. package/test/AppLike.jsx +6 -3
@@ -2,18 +2,6 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import { getSuccessMessage, countNewRecipients } from './successMessage';
3
3
  describe('getSuccessMessage method', function () {
4
4
  var props = {
5
- contacts: {
6
- id: 'contacts',
7
- data: [],
8
- hasMore: false,
9
- fetchStatus: 'loaded'
10
- },
11
- contactGroups: {
12
- id: 'groups',
13
- data: [],
14
- hasMore: false,
15
- fetchStatus: 'loaded'
16
- },
17
5
  currentRecipients: [{
18
6
  email: 'sansa.stark@winterfell.westeros'
19
7
  }],
@@ -24,10 +12,13 @@ describe('getSuccessMessage method', function () {
24
12
  };
25
13
  it('should return a success message and its params for multiple recipients', function () {
26
14
  var recipientsAfter = [{
15
+ _type: 'io.cozy.contacts',
27
16
  email: 'jon.snow@thewall.westeros'
28
17
  }, {
18
+ _type: 'io.cozy.contacts',
29
19
  email: 'arya.stark@winterfell.westeros'
30
20
  }, {
21
+ _type: 'io.cozy.contacts',
31
22
  email: 'sansa.stark@winterfell.westeros'
32
23
  }];
33
24
 
@@ -36,9 +27,9 @@ describe('getSuccessMessage method', function () {
36
27
  message = _getSuccessMessage2[0],
37
28
  params = _getSuccessMessage2[1];
38
29
 
39
- expect(message).toEqual('Files.share.shareByEmail.genericSuccess');
30
+ expect(message).toEqual('Files.share.shareByEmail.contactSuccess');
40
31
  expect(params).toEqual({
41
- count: 2
32
+ smart_count: 2
42
33
  });
43
34
  });
44
35
  it('should return a success message and its params for one recipient with email', function () {
@@ -51,7 +42,7 @@ describe('getSuccessMessage method', function () {
51
42
  message = _getSuccessMessage4[0],
52
43
  params = _getSuccessMessage4[1];
53
44
 
54
- expect(message).toEqual('Files.share.shareByEmail.success');
45
+ expect(message).toEqual('Files.share.shareByEmail.singleContactSuccess');
55
46
  expect(params).toEqual({
56
47
  email: 'jon.snow@thewall.westeros'
57
48
  });
@@ -75,7 +66,7 @@ describe('getSuccessMessage method', function () {
75
66
  message = _getSuccessMessage6[0],
76
67
  params = _getSuccessMessage6[1];
77
68
 
78
- expect(message).toEqual('Files.share.shareByEmail.success');
69
+ expect(message).toEqual('Files.share.shareByEmail.singleContactSuccess');
79
70
  expect(params).toEqual({
80
71
  email: 'jon.snow@thewall.westeros'
81
72
  });
@@ -92,12 +83,12 @@ describe('getSuccessMessage method', function () {
92
83
  message = _getSuccessMessage8[0],
93
84
  params = _getSuccessMessage8[1];
94
85
 
95
- expect(message).toEqual('Files.share.shareByEmail.success');
86
+ expect(message).toEqual('Files.share.shareByEmail.singleContactSuccess');
96
87
  expect(params).toEqual({
97
88
  email: 'https://doranmartell.mycozy.cloud'
98
89
  });
99
90
  });
100
- it('should use generic success message if recipient has no email and no cozy', function () {
91
+ it('should use contact success message if recipient has no email and no cozy', function () {
101
92
  var recipientsBefore = props.currentRecipients;
102
93
 
103
94
  var _getSuccessMessage9 = getSuccessMessage(recipientsBefore, [{
@@ -107,13 +98,87 @@ describe('getSuccessMessage method', function () {
107
98
  message = _getSuccessMessage10[0],
108
99
  params = _getSuccessMessage10[1];
109
100
 
110
- expect(message).toEqual('Files.share.shareByEmail.genericSuccess');
101
+ expect(message).toEqual('Files.share.shareByEmail.contactSuccess');
111
102
  expect(params).toEqual({
112
- count: 1
103
+ smart_count: 1
104
+ });
105
+ });
106
+ it('should use single group success message if recipient is a group', function () {
107
+ var recipientsBefore = props.currentRecipients;
108
+
109
+ var _getSuccessMessage11 = getSuccessMessage(recipientsBefore, [{
110
+ _type: 'io.cozy.contacts.groups',
111
+ name: 'Stark family'
112
+ }], props.documentType),
113
+ _getSuccessMessage12 = _slicedToArray(_getSuccessMessage11, 2),
114
+ message = _getSuccessMessage12[0],
115
+ params = _getSuccessMessage12[1];
116
+
117
+ expect(message).toEqual('Files.share.shareByEmail.singleGroupSuccess');
118
+ expect(params).toEqual({
119
+ groupName: 'Stark family'
120
+ });
121
+ });
122
+ it('should use contact success message if recipient has only multiple contacts', function () {
123
+ var recipientsBefore = props.currentRecipients;
124
+
125
+ var _getSuccessMessage13 = getSuccessMessage(recipientsBefore, [{
126
+ _type: 'io.cozy.contacts'
127
+ }, {
128
+ _type: 'io.cozy.contacts'
129
+ }, {
130
+ _type: 'io.cozy.contacts'
131
+ }], props.documentType),
132
+ _getSuccessMessage14 = _slicedToArray(_getSuccessMessage13, 2),
133
+ message = _getSuccessMessage14[0],
134
+ params = _getSuccessMessage14[1];
135
+
136
+ expect(message).toEqual('Files.share.shareByEmail.contactSuccess');
137
+ expect(params).toEqual({
138
+ smart_count: 3
139
+ });
140
+ });
141
+ it('should use group success message if recipient has only multiple groups', function () {
142
+ var recipientsBefore = props.currentRecipients;
143
+
144
+ var _getSuccessMessage15 = getSuccessMessage(recipientsBefore, [{
145
+ _type: 'io.cozy.contacts.groups'
146
+ }, {
147
+ _type: 'io.cozy.contacts.groups'
148
+ }], props.documentType),
149
+ _getSuccessMessage16 = _slicedToArray(_getSuccessMessage15, 2),
150
+ message = _getSuccessMessage16[0],
151
+ params = _getSuccessMessage16[1];
152
+
153
+ expect(message).toEqual('Files.share.shareByEmail.groupSuccess');
154
+ expect(params).toEqual({
155
+ smart_count: 2
156
+ });
157
+ });
158
+ it('should use contact and group success message if recipient has multiple contacts and groups', function () {
159
+ var recipientsBefore = props.currentRecipients;
160
+
161
+ var _getSuccessMessage17 = getSuccessMessage(recipientsBefore, [{
162
+ _type: 'io.cozy.contacts'
163
+ }, {
164
+ _id: 'fcb16b9e-7421',
165
+ _type: 'io.cozy.contacts.groups'
166
+ }, {
167
+ _id: 'f45b16be-7523',
168
+ _type: 'io.cozy.contacts.groups'
169
+ }], props.documentType),
170
+ _getSuccessMessage18 = _slicedToArray(_getSuccessMessage17, 2),
171
+ message = _getSuccessMessage18[0],
172
+ params = _getSuccessMessage18[1];
173
+
174
+ expect(message).toEqual('Files.share.shareByEmail.contactAndGroupSuccess');
175
+ expect(params).toEqual({
176
+ nbContact: 1,
177
+ nbGroup: 2
113
178
  });
114
179
  });
115
180
  });
116
- describe('countNewRecipients function', function () {
181
+ describe('countNewRecipients', function () {
117
182
  var currentRecipients = [{
118
183
  email: 'arya.stark@winterfell.westeros'
119
184
  }, {
@@ -122,77 +187,77 @@ describe('countNewRecipients function', function () {
122
187
  email: 'jon.snow@thewall.westeros'
123
188
  }];
124
189
  var addedRecipients = [{
125
- id: '5d4916fa-e193',
190
+ _id: 'e8c0e15f-da7d',
191
+ _type: 'io.cozy.contacts',
192
+ fullname: 'Jon Snow',
126
193
  email: [{
127
194
  address: 'jon.snow@thewall.westeros',
128
- type: 'primary'
195
+ primary: true
196
+ }, {
197
+ address: 'jon.snow@winterfell.westeros',
198
+ primary: false
129
199
  }]
130
200
  }, {
131
- id: '4df64228-ce84',
132
- email: [{
133
- address: 'sansa.stark@winterfell.westeros',
134
- type: 'primary'
135
- }]
201
+ _id: 'fcb16b9e-7421',
202
+ _type: 'io.cozy.contacts'
136
203
  }, {
137
- id: 'ff955bb1-f696',
138
- email: [{
139
- address: 'bran.stark@winterfell.westeros',
140
- type: 'primary'
204
+ _id: 'f45b16be-7523',
205
+ _type: 'io.cozy.contacts',
206
+ cozy: [{
207
+ url: 'https://doranmartell.mycozy.cloud'
141
208
  }]
142
209
  }];
143
- it('should count only the new recipients using email', function () {
144
- var result = countNewRecipients(currentRecipients, addedRecipients);
145
- expect(result).toEqual(1);
146
- });
147
- it('should count the new recipients when there are no current recipients', function () {
148
- var result = countNewRecipients([], addedRecipients);
149
- expect(result).toEqual(3);
150
- });
151
- it('should return 0 if there is no new recipients', function () {
152
- var currentRecipients = [{
153
- email: 'arya.stark@winterfell.westeros'
154
- }, {
155
- email: 'sansa.stark@winterfell.westeros'
156
- }, {
157
- email: 'jon.snow@thewall.westeros'
158
- }, {
159
- email: 'bran.stark@winterfell.westeros'
160
- }];
210
+ it('should count the new recipients with email', function () {
161
211
  var result = countNewRecipients(currentRecipients, addedRecipients);
162
- expect(result).toEqual(0);
212
+ expect(result.contact).toEqual(2);
213
+ expect(result.group).toEqual(0);
163
214
  });
164
- it('should count the new recipients using cozy url', function () {
215
+ it('should count the new recipients with cozy url', function () {
165
216
  var currentRecipients = [{
166
217
  instance: 'https://bran.mycozy.cloud'
167
218
  }, {
168
219
  instance: 'https://jon.mycozy.cloud'
169
220
  }];
170
221
  var addedRecipients = [{
171
- id: '5d4916fa-e193',
222
+ _type: 'io.cozy.contacts',
172
223
  cozy: [{
173
224
  url: 'https://jon.mycozy.cloud',
174
225
  type: 'primary'
175
226
  }]
176
227
  }, {
177
- id: '4df64228-ce84',
228
+ _type: 'io.cozy.contacts',
178
229
  cozy: [{
179
230
  url: 'https://sansa.mycozy.cloud',
180
231
  type: 'primary'
181
232
  }]
182
233
  }, {
183
- id: 'ff955bb1-f696',
234
+ _type: 'io.cozy.contacts',
184
235
  cozy: [{
185
236
  url: 'https://bran.mycozy.cloud',
186
237
  type: 'primary'
187
238
  }]
188
239
  }, {
189
- id: '0761944a-c740',
240
+ _type: 'io.cozy.contacts',
190
241
  cozy: [{
191
242
  url: 'https://arya.mycozy.cloud',
192
243
  type: 'primary'
193
244
  }]
194
245
  }];
195
246
  var result = countNewRecipients(currentRecipients, addedRecipients);
196
- expect(result).toEqual(2);
247
+ expect(result.contact).toEqual(2);
248
+ expect(result.group).toEqual(0);
249
+ });
250
+ it('should count the new recipients with groups', function () {
251
+ var result = countNewRecipients(currentRecipients, [].concat(addedRecipients, [{
252
+ _id: 'f45b16be-7523',
253
+ _type: 'io.cozy.contacts.groups'
254
+ }]));
255
+ expect(result.contact).toEqual(2);
256
+ expect(result.group).toEqual(1);
257
+ });
258
+ it('should return 0 if there are no new recipients', function () {
259
+ var result = countNewRecipients(currentRecipients, []);
260
+ expect(result.contact).toEqual(0);
261
+ expect(result.group).toEqual(0);
197
262
  });
198
263
  });
@@ -20,7 +20,7 @@ export var buildSharingsByIdQuery = function buildSharingsByIdQuery(sharingId) {
20
20
  }
21
21
  };
22
22
  };
23
- export var buildContactsQuery = function buildContactsQuery() {
23
+ export var buildReachableContactsQuery = function buildReachableContactsQuery() {
24
24
  return {
25
25
  definition: Q(Contact.doctype).where({
26
26
  _id: {
@@ -49,15 +49,47 @@ export var buildContactsQuery = function buildContactsQuery() {
49
49
  }]
50
50
  }).indexFields(['_id']).limitBy(1000),
51
51
  options: {
52
- as: 'io.cozy.contacts'
52
+ as: 'io.cozy.contacts/reachable'
53
53
  }
54
54
  };
55
55
  };
56
- export var buildContactGroupsQuery = function buildContactGroupsQuery() {
56
+ export var buildContactGroupsByIdsQuery = function buildContactGroupsByIdsQuery(ids) {
57
57
  return {
58
- definition: Q(Group.doctype),
58
+ definition: Q(Group.doctype).getByIds(ids),
59
59
  options: {
60
- as: 'io.cozy.contacts.groups'
60
+ as: "io.cozy.contacts.groups/by-ids/".concat(ids.join('/')),
61
+ fetchPolicy: defaultFetchPolicy,
62
+ enabled: ids.length > 0
63
+ }
64
+ };
65
+ };
66
+ export var buildUnreachableContactsWithGroupsQuery = function buildUnreachableContactsWithGroupsQuery() {
67
+ return {
68
+ definition: Q(Contact.doctype).where({
69
+ _id: {
70
+ $gt: null
71
+ }
72
+ }).partialIndex({
73
+ trashed: {
74
+ $or: [{
75
+ $eq: false
76
+ }, {
77
+ $exists: false
78
+ }]
79
+ },
80
+ cozy: {
81
+ $size: 0
82
+ },
83
+ email: {
84
+ $size: 0
85
+ },
86
+ 'relationships.groups.data': {
87
+ $exists: true
88
+ }
89
+ }).indexFields(['_id']).limitBy(1000),
90
+ options: {
91
+ as: 'io.cozy.contacts/unreachable-with-groups',
92
+ fetchPolicy: defaultFetchPolicy
61
93
  }
62
94
  };
63
95
  };
@@ -33,6 +33,7 @@
33
33
  .recipientsContainer
34
34
  display flex
35
35
  flex-wrap wrap
36
+ align-items center
36
37
  padding .25rem .5rem
37
38
  border-radius .25rem
38
39
  border 1px solid var(--borderMainColor)
@@ -55,7 +56,7 @@
55
56
  &:hover
56
57
  &:focus
57
58
  border none
58
- &:only-child
59
+ &:first-child
59
60
  padding .25rem .5rem
60
61
 
61
62
  .recipientChip
@@ -425,6 +425,7 @@ input[type=text] {
425
425
  .autosuggest__recipientsContainer___1JYxA {
426
426
  display: flex;
427
427
  flex-wrap: wrap;
428
+ align-items: center;
428
429
  padding: 0.25rem 0.5rem;
429
430
  border-radius: 0.25rem;
430
431
  border: 1px solid var(--borderMainColor);
@@ -449,7 +450,7 @@ input[type=text] {
449
450
  .autosuggest__recipientsContainer___1JYxA input[type=email]:focus {
450
451
  border: none;
451
452
  }
452
- .autosuggest__recipientsContainer___1JYxA input[type=email]:only-child {
453
+ .autosuggest__recipientsContainer___1JYxA input[type=email]:first-child {
453
454
  padding: 0.25rem 0.5rem;
454
455
  }
455
456
  .autosuggest__recipientChip___d5I3R {
package/locales/en.json CHANGED
@@ -115,8 +115,11 @@
115
115
  "subtitle": "By email",
116
116
  "emailPlaceholder": "Add contacts or groups",
117
117
  "send": "Send",
118
- "genericSuccess": "You sent an invite to %{count} contacts.",
119
- "success": "You sent an invite to %{email}.",
118
+ "singleContactSuccess": "You sent an invite to %{email}.",
119
+ "contactSuccess": "You sent an invite to %{smart_count} contact. |||| You sent an invite to %{smart_count} contacts.",
120
+ "singleGroupSuccess": "You sent an invite to the members of the %{groupName} group.",
121
+ "groupSuccess": "You sent an invite to the members of %{smart_count} group. |||| You sent an invite to the members of %{smart_count} groups.",
122
+ "contactAndGroupSuccess": "You sent an invite to %{nbContact} contacts and the members of %{nbGroup} groups.",
120
123
  "comingsoon": "Coming soon! You will be able to share documents and photos in a single click with your family, your friends, and even your coworkers. Don't worry, we'll let you know when it's ready!",
121
124
  "onlyByLink": "This %{type} can only be shared by link, because",
122
125
  "type": {
@@ -180,8 +183,11 @@
180
183
  "email": "To:",
181
184
  "emailPlaceholder": "Enter the email address or name of the recipient",
182
185
  "send": "Send",
183
- "genericSuccess": "You sent an invite to %{count} contacts.",
184
- "success": "You sent an invite to %{email}.",
186
+ "singleContactSuccess": "You sent an invite to %{email}.",
187
+ "contactSuccess": "You sent an invite to %{smart_count} contact. |||| You sent an invite to %{smart_count} contacts.",
188
+ "singleGroupSuccess": "You sent an invite to the members of the %{groupName} group.",
189
+ "groupSuccess": "You sent an invite to the members of %{smart_count} group. |||| You sent an invite to the members of %{smart_count} groups.",
190
+ "contactAndGroupSuccess": "You sent an invite to %{nbContact} contacts and the members of %{nbGroup} groups.",
185
191
  "comingsoon": "Coming soon! You will be able to share documents and photos in a single click with your family, your friends, and even your coworkers. Don't worry, we'll let you know when it's ready!",
186
192
  "onlyByLink": "This %{type} can only be shared by link, because",
187
193
  "type": {
@@ -246,8 +252,11 @@
246
252
  "email": "email",
247
253
  "emailPlaceholder": "Enter the email address or name of the recipient",
248
254
  "send": "Send",
249
- "genericSuccess": "You sent an invite to %{count} contacts.",
250
- "success": "You sent an invite to %{email}.",
255
+ "singleContactSuccess": "You sent an invite to %{email}.",
256
+ "contactSuccess": "You sent an invite to %{smart_count} contact. |||| You sent an invite to %{smart_count} contacts.",
257
+ "singleGroupSuccess": "You sent an invite to the members of the %{groupName} group.",
258
+ "groupSuccess": "You sent an invite to the members of %{smart_count} group. |||| You sent an invite to the members of %{smart_count} groups.",
259
+ "contactAndGroupSuccess": "You sent an invite to %{nbContact} contacts and the members of %{nbGroup} groups.",
251
260
  "comingsoon": "Coming soon! You will be able to share documents and photos in a single click with your family, your friends, and even your coworkers. Don't worry, we'll let you know when it's ready!"
252
261
  },
253
262
  "unshare": {
@@ -307,8 +316,11 @@
307
316
  "email": "Send to:",
308
317
  "emailPlaceholder": "Enter the email address or name of the recipient",
309
318
  "send": "Send",
310
- "genericSuccess": "You sent an invite to %{count} contacts.",
311
- "success": "You sent an invite to %{email}.",
319
+ "singleContactSuccess": "You sent an invite to %{email}.",
320
+ "contactSuccess": "You sent an invite to %{smart_count} contact. |||| You sent an invite to %{smart_count} contacts.",
321
+ "singleGroupSuccess": "You sent an invite to the members of the %{groupName} group.",
322
+ "groupSuccess": "You sent an invite to the members of %{smart_count} group. |||| You sent an invite to the members of %{smart_count} groups.",
323
+ "contactAndGroupSuccess": "You sent an invite to %{nbContact} contacts and the members of %{nbGroup} groups.",
312
324
  "comingsoon": "Coming soon! You will be able to share documents and photos in a single click with your family, your friends, and even your coworkers. Don't worry, we'll let you know when it's ready!",
313
325
  "onlyByLink": "This %{type} can only be shared by link, because",
314
326
  "type": {
@@ -364,7 +376,7 @@
364
376
  }
365
377
  },
366
378
  "GroupRecipient": {
367
- "secondary": "%{nbMemberReady}/%{nbMember} members",
379
+ "secondary": "%{memberCount} member |||| %{memberCount} members",
368
380
  "secondary_you": "including you"
369
381
  },
370
382
  "RevokeGroupItem": {
@@ -387,7 +399,8 @@
387
399
  "status": {
388
400
  "mail-not-sent": "Invitation failed",
389
401
  "revoked": "Sharing revoked"
390
- }
402
+ },
403
+ "addEmail": "Enter an email address to invite the contact"
391
404
  }
392
405
  }
393
406
  }
package/locales/fr.json CHANGED
@@ -114,8 +114,11 @@
114
114
  "subtitle": "Par email",
115
115
  "emailPlaceholder": "Ajouter des contacts ou des groupes",
116
116
  "send": "Envoyer",
117
- "genericSuccess": "Vous avez invité %{count} contacts.",
118
- "success": "Vous avez envoyé une invitation à %{email}.",
117
+ "singleContactSuccess": "Vous avez envoyé une invitation à %{email}.",
118
+ "contactSuccess": "Vous avez invité %{smart_count} contact. |||| Vous avez invité %{smart_count} contacts.",
119
+ "singleGroupSuccess": "Vous avez invité les membres du groupe %{groupName}.",
120
+ "groupSuccess": "Vous avez invité les membres de %{smart_count} groupe. |||| Vous avez invité les membres de %{smart_count} groupes.",
121
+ "contactAndGroupSuccess": "Vous avez invité %{nbContact} contacts et les membres de %{nbGroup} groupes.",
119
122
  "comingsoon": "Bientôt disponible ! Vous pourrez partager un document et vos photos en un seul clic avec votre famille, vos amis, et même vos collaborateurs. Ne vous inquiétez pas, on vous prévient quand ce sera prêt !",
120
123
  "onlyByLink": "Ce %{type} ne peut être partagé que sous la forme d'un lien, car il",
121
124
  "type": {
@@ -179,7 +182,11 @@
179
182
  "email": "À :",
180
183
  "emailPlaceholder": "Saisissez le courriel ou le nom du destinataire.",
181
184
  "send": "Envoyer",
182
- "genericSuccess": "Vous avez invité %{count} contacts.",
185
+ "singleContactSuccess": "Vous avez envoyé une invitation à %{email}.",
186
+ "contactSuccess": "Vous avez invité %{smart_count} contact. |||| Vous avez invité %{smart_count} contacts.",
187
+ "singleGroupSuccess": "Vous avez invité les membres du groupe %{groupName}.",
188
+ "groupSuccess": "Vous avez invité les membres de %{smart_count} groupe. |||| Vous avez invité les membres de %{smart_count} groupes.",
189
+ "contactAndGroupSuccess": "Vous avez invité %{nbContact} contacts et les membres de %{nbGroup} groupes.",
183
190
  "success": "Vous avez envoyé une invitation à %{email}.",
184
191
  "comingsoon": "Bientôt disponible ! Vous pourrez partager un document et vos photos en un seul clic avec votre famille, vos amis, et même vos collaborateurs. Ne vous inquiétez pas, on vous prévient quand ce sera prêt !",
185
192
  "onlyByLink": "Ce %{type} ne peut être partagé que sous la forme d'un lien, car il",
@@ -245,7 +252,11 @@
245
252
  "email": "e-mail",
246
253
  "emailPlaceholder": "Saisissez l'email ou le nom du destinataire.",
247
254
  "send": "Envoyer",
248
- "genericSuccess": "Vous avez envoyé une invitation à %{count} contacts.",
255
+ "singleContactSuccess": "Vous avez envoyé une invitation à %{email}.",
256
+ "contactSuccess": "Vous avez invité %{smart_count} contact. |||| Vous avez invité %{smart_count} contacts.",
257
+ "singleGroupSuccess": "Vous avez invité les membres du groupe %{groupName}.",
258
+ "groupSuccess": "Vous avez invité les membres de %{smart_count} groupe. |||| Vous avez invité les membres de %{smart_count} groupes.",
259
+ "contactAndGroupSuccess": "Vous avez invité %{nbContact} contacts et les membres de %{nbGroup} groupes.",
249
260
  "success": "Vous avez envoyé une invitation à %{email}.",
250
261
  "comingsoon": "Bientôt disponible ! Vous pourrez partager vos documents et vos photos en un seul clic avec votre famille, vos amis et même vos collaborateurs. Ne vous inquiétez pas, on vous préviendra quand ce sera prêt !\n"
251
262
  },
@@ -305,8 +316,11 @@
305
316
  "email": "Envoyer à :",
306
317
  "emailPlaceholder": "Saisissez le courriel ou le nom du destinataire.",
307
318
  "send": "Envoyer",
308
- "genericSuccess": "Vous avez invité %{count} contacts.",
309
- "success": "Vous avez envoyé une invitation à %{email}.",
319
+ "singleContactSuccess": "Vous avez envoyé une invitation à %{email}.",
320
+ "contactSuccess": "Vous avez invité %{smart_count} contact. |||| Vous avez invité %{smart_count} contacts.",
321
+ "singleGroupSuccess": "Vous avez invité les membres du groupe %{groupName}.",
322
+ "groupSuccess": "Vous avez invité les membres de %{smart_count} groupe. |||| Vous avez invité les membres de %{smart_count} groupes.",
323
+ "contactAndGroupSuccess": "Vous avez invité %{nbContact} contacts et les membres de %{nbGroup} groupes.",
310
324
  "comingsoon": "Bientôt disponible ! Vous pourrez partager un document et vos photos en un seul clic avec votre famille, vos amis, et même vos collaborateurs. Ne vous inquiétez pas, on vous prévient quand ce sera prêt !",
311
325
  "onlyByLink": "Ce %{type} ne peut être partagé que sous la forme d'un lien, car il",
312
326
  "type": {
@@ -362,7 +376,7 @@
362
376
  }
363
377
  },
364
378
  "GroupRecipient": {
365
- "secondary": "%{nbMemberReady}/%{nbMember} membres",
379
+ "secondary": "%{memberCount} membre |||| %{memberCount} membres",
366
380
  "secondary_you": "dont vous"
367
381
  },
368
382
  "RevokeGroupItem": {
@@ -385,7 +399,8 @@
385
399
  "status": {
386
400
  "mail-not-sent": "Echec de l’invitation",
387
401
  "revoked": "Partage révoqué"
388
- }
402
+ },
403
+ "addEmail": "Renseigner un email pour pouvoir inviter le contact"
389
404
  }
390
405
  }
391
406
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-sharing",
3
- "version": "12.2.0",
3
+ "version": "13.0.0",
4
4
  "description": "Provides sharing login for React applications.",
5
5
  "main": "dist/index.js",
6
6
  "author": "Cozy",
@@ -50,7 +50,7 @@
50
50
  "babel-plugin-css-modules-transform": "1.6.2",
51
51
  "babel-plugin-inline-react-svg": "1.1.2",
52
52
  "cozy-client": "46.1.0",
53
- "cozy-ui": "^103.8.2",
53
+ "cozy-ui": "105.3.1",
54
54
  "enzyme": "3.11.0",
55
55
  "enzyme-adapter-react-16": "1.15.6",
56
56
  "enzyme-to-json": "3.6.2",
@@ -63,7 +63,7 @@
63
63
  "peerDependencies": {
64
64
  "cozy-client": ">=46.1.0",
65
65
  "cozy-realtime": "^3.11.0",
66
- "cozy-ui": ">=103.8.1",
66
+ "cozy-ui": ">=105.3.1",
67
67
  "prop-types": "^15.7.2",
68
68
  "react": "^16.12.0",
69
69
  "react-router": "^5.0.1"
@@ -71,5 +71,5 @@
71
71
  "sideEffects": [
72
72
  "*.css"
73
73
  ],
74
- "gitHead": "e48ad9475627e2be13c46e6b7be8a9f82215a392"
74
+ "gitHead": "ba86f000e46844edb26e07edec601bc7669fcda9"
75
75
  }
@@ -6,6 +6,7 @@ import Avatar from 'cozy-ui/transpiled/react/Avatar'
6
6
  import LinkIcon from 'cozy-ui/transpiled/react/Icons/Link'
7
7
 
8
8
  import { ExtraAvatar } from './ExtraAvatar'
9
+ import { GroupAvatar } from './GroupAvatar'
9
10
  import { MemberAvatar } from './MemberAvatar'
10
11
  import { getDisplayName } from '../../models'
11
12
  import styles from '../../styles/recipient.styl'
@@ -88,20 +89,38 @@ const AvatarList = ({
88
89
  />
89
90
  </span>
90
91
  )}
91
- {shownRecipients.map((recipient, idx) => (
92
- <span
93
- data-testid={`AvatarList-avatar${
94
- recipient.status === 'owner' ? '-owner' : ''
95
- }`}
96
- key={idx}
97
- >
98
- <MemberAvatar
99
- recipient={recipient}
100
- size={size}
101
- className={cx(styles['recipients-avatars--avatar'])}
102
- />
103
- </span>
104
- ))}
92
+ {shownRecipients.map(recipient => {
93
+ if (recipient.members) {
94
+ return (
95
+ <span
96
+ data-testid={`AvatarList-avatar${
97
+ recipient.status === 'owner' ? '-owner' : ''
98
+ }`}
99
+ key={recipient.index}
100
+ >
101
+ <GroupAvatar
102
+ size={size}
103
+ className={cx(styles['recipients-avatars--avatar'])}
104
+ />
105
+ </span>
106
+ )
107
+ }
108
+
109
+ return (
110
+ <span
111
+ data-testid={`AvatarList-avatar${
112
+ recipient.status === 'owner' ? '-owner' : ''
113
+ }`}
114
+ key={recipient.index}
115
+ >
116
+ <MemberAvatar
117
+ recipient={recipient}
118
+ size={size}
119
+ className={cx(styles['recipients-avatars--avatar'])}
120
+ />
121
+ </span>
122
+ )
123
+ })}
105
124
  </div>
106
125
  )
107
126
  }
@@ -14,7 +14,8 @@ const mockRecipients = new Array(MAX_DISPLAYED_RECIPIENTS - 1)
14
14
  .fill(
15
15
  {
16
16
  status: 'owner',
17
- public_name: 'cozy'
17
+ public_name: 'cozy',
18
+ index: 'sharing-123-member-0'
18
19
  },
19
20
  0,
20
21
  1
@@ -22,7 +23,8 @@ const mockRecipients = new Array(MAX_DISPLAYED_RECIPIENTS - 1)
22
23
  .fill(
23
24
  {
24
25
  status: 'pending',
25
- name: 'Mitch Young'
26
+ name: 'Mitch Young',
27
+ index: 'sharing-123-member-1'
26
28
  },
27
29
  1
28
30
  )
@@ -31,15 +33,18 @@ const mockMoreRecipientsThanMaxDisplayed = [
31
33
  ...mockRecipients,
32
34
  {
33
35
  status: 'mail-not-send',
34
- name: 'Lyn Webster'
36
+ name: 'Lyn Webster',
37
+ index: 'sharing-123-member-2'
35
38
  },
36
39
  {
37
40
  status: 'ready',
38
- name: 'Richelle Young'
41
+ name: 'Richelle Young',
42
+ index: 'sharing-123-member-3'
39
43
  },
40
44
  {
41
45
  status: 'ready',
42
- name: 'John Connor'
46
+ name: 'John Connor',
47
+ index: 'sharing-123-member-4'
43
48
  }
44
49
  ]
45
50
 
@@ -120,7 +125,7 @@ describe('AvatarList', () => {
120
125
  })
121
126
 
122
127
  describe('excludeMeAsOwnerFromRecipients', () => {
123
- test('excludeMeAsOwnerFromRecipients behavior', () => {
128
+ it('excludeMeAsOwnerFromRecipients behavior', () => {
124
129
  const recipients = [
125
130
  {
126
131
  status: 'owner',