cozy-sharing 28.3.4 → 28.4.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 (40) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/components/FederatedFolder/DumbFederatedFolderModal.js +56 -0
  3. package/dist/components/FederatedFolder/FederatedFolderModal.js +150 -0
  4. package/dist/components/FederatedFolder/FederatedFolderModal.spec.js +543 -0
  5. package/dist/components/Recipient/LinkRecipient.js +1 -1
  6. package/dist/components/ShareAutosuggest.js +4 -1
  7. package/dist/components/ShareByEmail.js +105 -33
  8. package/dist/components/ShareByEmail.spec.js +111 -9
  9. package/dist/components/ShareByLink.js +3 -3
  10. package/dist/components/ShareModal/ShareModal.js +18 -2
  11. package/dist/components/ShareModal.js +1 -1
  12. package/dist/components/ShareRecipientsInput.js +5 -2
  13. package/dist/components/SharedDrive/DumbSharedDriveModal.js +39 -72
  14. package/dist/components/SharedDrive/SharedDriveModal.js +11 -5
  15. package/dist/components/SharedDrive/helpers.js +28 -2
  16. package/dist/components/SharedFolder/DumbBatchSharedFolderModal.js +159 -0
  17. package/dist/components/WhoHasAccess.js +1 -1
  18. package/dist/index.js +1 -0
  19. package/locales/en.json +13 -1
  20. package/locales/fr.json +15 -3
  21. package/locales/ru.json +13 -1
  22. package/locales/vi.json +13 -1
  23. package/package.json +3 -3
  24. package/src/components/FederatedFolder/DumbFederatedFolderModal.jsx +62 -0
  25. package/src/components/FederatedFolder/FederatedFolderModal.jsx +119 -0
  26. package/src/components/FederatedFolder/FederatedFolderModal.spec.jsx +376 -0
  27. package/src/components/Recipient/LinkRecipient.jsx +1 -1
  28. package/src/components/ShareAutosuggest.jsx +4 -1
  29. package/src/components/ShareByEmail.jsx +47 -8
  30. package/src/components/ShareByEmail.spec.jsx +96 -6
  31. package/src/components/ShareByLink.jsx +7 -3
  32. package/src/components/ShareModal/ShareModal.jsx +16 -1
  33. package/src/components/ShareModal.jsx +1 -1
  34. package/src/components/ShareRecipientsInput.jsx +5 -2
  35. package/src/components/SharedDrive/DumbSharedDriveModal.jsx +38 -88
  36. package/src/components/SharedDrive/SharedDriveModal.jsx +14 -4
  37. package/src/components/SharedDrive/helpers.js +33 -2
  38. package/src/components/SharedFolder/DumbBatchSharedFolderModal.jsx +174 -0
  39. package/src/components/WhoHasAccess.jsx +1 -1
  40. package/src/index.jsx +1 -0
@@ -0,0 +1,543 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _extends from "@babel/runtime/helpers/extends";
3
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
+ import { fireEvent, render, waitFor } from '@testing-library/react';
5
+ import React from 'react';
6
+ import { createMockClient } from 'cozy-client';
7
+ import { FederatedFolderModal } from './FederatedFolderModal';
8
+ import AppLike from '../SharingBanner/test/AppLike';
9
+ var mockShare = jest.fn();
10
+ var mockGetSharingLink = jest.fn();
11
+ var mockShowAlert = jest.fn();
12
+ var mockOnClose = jest.fn();
13
+ jest.mock('../../hooks/useSharingContext', function () {
14
+ return {
15
+ useSharingContext: function useSharingContext() {
16
+ return {
17
+ share: mockShare,
18
+ getSharingLink: mockGetSharingLink,
19
+ getDocumentPermissions: jest.fn().mockReturnValue([])
20
+ };
21
+ }
22
+ };
23
+ });
24
+ jest.mock('cozy-ui/transpiled/react/providers/Alert', function () {
25
+ return {
26
+ useAlert: function useAlert() {
27
+ return {
28
+ showAlert: mockShowAlert
29
+ };
30
+ }
31
+ };
32
+ });
33
+ jest.mock('../../hoc/withLocales', function () {
34
+ return function (Component) {
35
+ return Component;
36
+ };
37
+ });
38
+ jest.mock('./DumbFederatedFolderModal', function () {
39
+ return {
40
+ DumbFederatedFolderModal: function DumbFederatedFolderModal(_ref) {
41
+ var title = _ref.title,
42
+ createContact = _ref.createContact,
43
+ recipients = _ref.recipients,
44
+ readOnlyRecipients = _ref.readOnlyRecipients,
45
+ onRevoke = _ref.onRevoke,
46
+ onSetType = _ref.onSetType,
47
+ onSend = _ref.onSend,
48
+ onClose = _ref.onClose,
49
+ onShare = _ref.onShare,
50
+ sharingLink = _ref.sharingLink;
51
+ return /*#__PURE__*/React.createElement("div", {
52
+ "data-testid": "dumb-modal"
53
+ }, /*#__PURE__*/React.createElement("span", {
54
+ "data-testid": "title"
55
+ }, title), /*#__PURE__*/React.createElement("span", {
56
+ "data-testid": "sharing-link"
57
+ }, sharingLink), /*#__PURE__*/React.createElement("span", {
58
+ "data-testid": "recipients-count"
59
+ }, recipients.length), /*#__PURE__*/React.createElement("span", {
60
+ "data-testid": "readOnly-recipients-count"
61
+ }, readOnlyRecipients ? readOnlyRecipients.length : 0), /*#__PURE__*/React.createElement("button", {
62
+ "data-testid": "btn-share",
63
+ onClick: function onClick() {
64
+ return onShare({
65
+ recipients: [{
66
+ _id: 'r1',
67
+ displayName: 'Alice'
68
+ }],
69
+ readOnlyRecipients: [{
70
+ _id: 'r2',
71
+ displayName: 'Bob'
72
+ }]
73
+ });
74
+ }
75
+ }, "Share"), /*#__PURE__*/React.createElement("button", {
76
+ "data-testid": "btn-send",
77
+ onClick: onSend
78
+ }, "Send"), /*#__PURE__*/React.createElement("button", {
79
+ "data-testid": "btn-set-type-two-way",
80
+ onClick: function onClick() {
81
+ return onSetType('virtual-shared-drive-sharing-r2', 'two-way');
82
+ }
83
+ }, "Set Two-Way"), /*#__PURE__*/React.createElement("button", {
84
+ "data-testid": "btn-set-type-one-way",
85
+ onClick: function onClick() {
86
+ return onSetType('virtual-shared-drive-sharing-r1', 'one-way');
87
+ }
88
+ }, "Set One-Way"), /*#__PURE__*/React.createElement("button", {
89
+ "data-testid": "btn-revoke",
90
+ onClick: function onClick() {
91
+ return onRevoke('virtual-shared-drive-sharing-r1');
92
+ }
93
+ }, "Revoke"), /*#__PURE__*/React.createElement("button", {
94
+ "data-testid": "btn-close",
95
+ onClick: onClose
96
+ }, "Close"), /*#__PURE__*/React.createElement("button", {
97
+ "data-testid": "btn-create-contact",
98
+ onClick: function onClick() {
99
+ return createContact({
100
+ email: 'test@example.com'
101
+ });
102
+ }
103
+ }, "Create Contact"));
104
+ }
105
+ };
106
+ });
107
+ var mockDocument = {
108
+ _id: 'folder-123',
109
+ name: 'My Test Folder',
110
+ path: '/test/folder'
111
+ };
112
+
113
+ var createSharingContextValue = function createSharingContextValue() {
114
+ return {
115
+ refresh: jest.fn(),
116
+ hasWriteAccess: jest.fn(),
117
+ getRecipients: jest.fn(),
118
+ getSharingLink: mockGetSharingLink,
119
+ getDocumentPermissions: jest.fn().mockReturnValue([]),
120
+ share: mockShare
121
+ };
122
+ };
123
+
124
+ var createTestClient = function createTestClient() {
125
+ var client = createMockClient({
126
+ queries: {
127
+ 'io.cozy.contacts/reachable': {
128
+ doctype: 'io.cozy.contacts',
129
+ data: []
130
+ },
131
+ 'io.cozy.contacts/groups': {
132
+ doctype: 'io.cozy.contacts.groups',
133
+ data: []
134
+ },
135
+ 'io.cozy.contacts/unreachable-with-groups': {
136
+ doctype: 'io.cozy.contacts',
137
+ data: []
138
+ }
139
+ }
140
+ });
141
+ client.create = jest.fn().mockResolvedValue({
142
+ data: {}
143
+ });
144
+ return client;
145
+ };
146
+
147
+ describe('FederatedFolderModal', function () {
148
+ var client;
149
+ var sharingContextValue;
150
+ beforeEach(function () {
151
+ jest.clearAllMocks();
152
+ mockGetSharingLink.mockReturnValue('https://example.com/share/abc123');
153
+ client = createTestClient();
154
+ sharingContextValue = createSharingContextValue();
155
+ });
156
+
157
+ var setup = function setup() {
158
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
159
+ return render( /*#__PURE__*/React.createElement(AppLike, {
160
+ client: client,
161
+ sharingContextValue: sharingContextValue
162
+ }, /*#__PURE__*/React.createElement(FederatedFolderModal, _extends({
163
+ document: mockDocument,
164
+ onClose: mockOnClose
165
+ }, props))));
166
+ };
167
+
168
+ describe('initialization', function () {
169
+ it('should pass document name as title', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
170
+ var _setup, getByTestId;
171
+
172
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
173
+ while (1) switch (_context.prev = _context.next) {
174
+ case 0:
175
+ _setup = setup(), getByTestId = _setup.getByTestId;
176
+ _context.next = 3;
177
+ return waitFor(function () {
178
+ expect(getByTestId('title').textContent).toBe('Share "My Test Folder"');
179
+ });
180
+
181
+ case 3:
182
+ case "end":
183
+ return _context.stop();
184
+ }
185
+ }, _callee);
186
+ })));
187
+ it('should pass default title when document has no name', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
188
+ var documentWithoutName, _setup2, getByTestId;
189
+
190
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
191
+ while (1) switch (_context2.prev = _context2.next) {
192
+ case 0:
193
+ documentWithoutName = {
194
+ _id: 'folder-456',
195
+ path: '/test'
196
+ };
197
+ _setup2 = setup({
198
+ document: documentWithoutName
199
+ }), getByTestId = _setup2.getByTestId;
200
+ _context2.next = 4;
201
+ return waitFor(function () {
202
+ expect(getByTestId('title').textContent).toBe('Share ""');
203
+ });
204
+
205
+ case 4:
206
+ case "end":
207
+ return _context2.stop();
208
+ }
209
+ }, _callee2);
210
+ })));
211
+ it('should pass sharing link to DumbFederatedFolderModal', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
212
+ var _setup3, getByTestId;
213
+
214
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
215
+ while (1) switch (_context3.prev = _context3.next) {
216
+ case 0:
217
+ _setup3 = setup(), getByTestId = _setup3.getByTestId;
218
+ _context3.next = 3;
219
+ return waitFor(function () {
220
+ expect(getByTestId('sharing-link').textContent).toBe('https://example.com/share/abc123');
221
+ });
222
+
223
+ case 3:
224
+ case "end":
225
+ return _context3.stop();
226
+ }
227
+ }, _callee3);
228
+ })));
229
+ it('should pass null sharing link when document is undefined', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
230
+ var _setup4, getByTestId;
231
+
232
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
233
+ while (1) switch (_context4.prev = _context4.next) {
234
+ case 0:
235
+ _setup4 = setup({
236
+ document: undefined
237
+ }), getByTestId = _setup4.getByTestId;
238
+ _context4.next = 3;
239
+ return waitFor(function () {
240
+ expect(getByTestId('sharing-link').textContent).toBe('');
241
+ });
242
+
243
+ case 3:
244
+ case "end":
245
+ return _context4.stop();
246
+ }
247
+ }, _callee4);
248
+ })));
249
+ });
250
+ describe('onShare callback', function () {
251
+ it('should update recipients when onShare is called', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
252
+ var _setup5, getByTestId;
253
+
254
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
255
+ while (1) switch (_context5.prev = _context5.next) {
256
+ case 0:
257
+ _setup5 = setup(), getByTestId = _setup5.getByTestId;
258
+ _context5.next = 3;
259
+ return waitFor(function () {
260
+ expect(getByTestId('recipients-count').textContent).toBe('0');
261
+ });
262
+
263
+ case 3:
264
+ fireEvent.click(getByTestId('btn-share'));
265
+ _context5.next = 6;
266
+ return waitFor(function () {
267
+ expect(getByTestId('recipients-count').textContent).toBe('2');
268
+ });
269
+
270
+ case 6:
271
+ case "end":
272
+ return _context5.stop();
273
+ }
274
+ }, _callee5);
275
+ })));
276
+ });
277
+ describe('onSend callback', function () {
278
+ it('should call share with correct parameters', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
279
+ var _setup6, getByTestId;
280
+
281
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
282
+ while (1) switch (_context6.prev = _context6.next) {
283
+ case 0:
284
+ mockShare.mockResolvedValueOnce({});
285
+ _setup6 = setup(), getByTestId = _setup6.getByTestId;
286
+ _context6.next = 4;
287
+ return waitFor(function () {
288
+ expect(getByTestId('btn-send')).toBeTruthy();
289
+ });
290
+
291
+ case 4:
292
+ fireEvent.click(getByTestId('btn-share'));
293
+ fireEvent.click(getByTestId('btn-send'));
294
+ _context6.next = 8;
295
+ return waitFor(function () {
296
+ expect(mockShare).toHaveBeenCalledWith({
297
+ description: 'My Test Folder',
298
+ document: mockDocument,
299
+ recipients: [{
300
+ _id: 'r1',
301
+ displayName: 'Alice'
302
+ }],
303
+ readOnlyRecipients: [{
304
+ _id: 'r2',
305
+ displayName: 'Bob'
306
+ }],
307
+ sharedDrive: true,
308
+ openSharing: false
309
+ });
310
+ });
311
+
312
+ case 8:
313
+ case "end":
314
+ return _context6.stop();
315
+ }
316
+ }, _callee6);
317
+ })));
318
+ it('should show success alert and close modal on successful share', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
319
+ var _setup7, getByTestId;
320
+
321
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
322
+ while (1) switch (_context7.prev = _context7.next) {
323
+ case 0:
324
+ mockShare.mockResolvedValueOnce({});
325
+ _setup7 = setup(), getByTestId = _setup7.getByTestId;
326
+ _context7.next = 4;
327
+ return waitFor(function () {
328
+ expect(getByTestId('btn-send')).toBeTruthy();
329
+ });
330
+
331
+ case 4:
332
+ fireEvent.click(getByTestId('btn-send'));
333
+ _context7.next = 7;
334
+ return waitFor(function () {
335
+ expect(mockShowAlert).toHaveBeenCalledWith({
336
+ message: 'Folder has been shared',
337
+ severity: 'success',
338
+ variant: 'filled'
339
+ });
340
+ expect(mockOnClose).toHaveBeenCalled();
341
+ });
342
+
343
+ case 7:
344
+ case "end":
345
+ return _context7.stop();
346
+ }
347
+ }, _callee7);
348
+ })));
349
+ it('should show error alert when share fails', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
350
+ var _setup8, getByTestId;
351
+
352
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
353
+ while (1) switch (_context8.prev = _context8.next) {
354
+ case 0:
355
+ mockShare.mockRejectedValueOnce(new Error('Share failed'));
356
+ _setup8 = setup(), getByTestId = _setup8.getByTestId;
357
+ _context8.next = 4;
358
+ return waitFor(function () {
359
+ expect(getByTestId('btn-send')).toBeTruthy();
360
+ });
361
+
362
+ case 4:
363
+ fireEvent.click(getByTestId('btn-send'));
364
+ _context8.next = 7;
365
+ return waitFor(function () {
366
+ expect(mockShowAlert).toHaveBeenCalledWith({
367
+ message: 'Error while sharing folder',
368
+ severity: 'error',
369
+ variant: 'filled'
370
+ });
371
+ expect(mockOnClose).not.toHaveBeenCalled();
372
+ });
373
+
374
+ case 7:
375
+ case "end":
376
+ return _context8.stop();
377
+ }
378
+ }, _callee8);
379
+ })));
380
+ });
381
+ describe('onSetType callback', function () {
382
+ it('should move recipient from readOnlyRecipients to recipients when setting two-way', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
383
+ var _setup9, getByTestId;
384
+
385
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
386
+ while (1) switch (_context9.prev = _context9.next) {
387
+ case 0:
388
+ _setup9 = setup(), getByTestId = _setup9.getByTestId;
389
+ _context9.next = 3;
390
+ return waitFor(function () {
391
+ expect(getByTestId('btn-share')).toBeTruthy();
392
+ });
393
+
394
+ case 3:
395
+ fireEvent.click(getByTestId('btn-share')); // After btn-share: combined recipients = 2 (1 readWrite + 1 readOnly)
396
+
397
+ _context9.next = 6;
398
+ return waitFor(function () {
399
+ expect(getByTestId('recipients-count').textContent).toBe('2');
400
+ expect(getByTestId('readOnly-recipients-count').textContent).toBe('1');
401
+ });
402
+
403
+ case 6:
404
+ fireEvent.click(getByTestId('btn-set-type-two-way')); // After setting two-way: Bob moves from readOnlyRecipients to recipients
405
+
406
+ _context9.next = 9;
407
+ return waitFor(function () {
408
+ expect(getByTestId('recipients-count').textContent).toBe('2');
409
+ expect(getByTestId('readOnly-recipients-count').textContent).toBe('0');
410
+ });
411
+
412
+ case 9:
413
+ case "end":
414
+ return _context9.stop();
415
+ }
416
+ }, _callee9);
417
+ })));
418
+ it('should move recipient from recipients to readOnlyRecipients when setting one-way', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
419
+ var _setup10, getByTestId;
420
+
421
+ return _regeneratorRuntime.wrap(function _callee10$(_context10) {
422
+ while (1) switch (_context10.prev = _context10.next) {
423
+ case 0:
424
+ _setup10 = setup(), getByTestId = _setup10.getByTestId;
425
+ _context10.next = 3;
426
+ return waitFor(function () {
427
+ expect(getByTestId('btn-share')).toBeTruthy();
428
+ });
429
+
430
+ case 3:
431
+ fireEvent.click(getByTestId('btn-share')); // After btn-share: combined recipients = 2 (1 readWrite + 1 readOnly)
432
+
433
+ _context10.next = 6;
434
+ return waitFor(function () {
435
+ expect(getByTestId('recipients-count').textContent).toBe('2');
436
+ expect(getByTestId('readOnly-recipients-count').textContent).toBe('1');
437
+ });
438
+
439
+ case 6:
440
+ fireEvent.click(getByTestId('btn-set-type-one-way')); // After setting one-way: Alice moves from recipients to readOnlyRecipients
441
+ // Combined count stays at 2, but readOnlyRecipients increases from 1 to 2
442
+
443
+ _context10.next = 9;
444
+ return waitFor(function () {
445
+ expect(getByTestId('recipients-count').textContent).toBe('2');
446
+ expect(getByTestId('readOnly-recipients-count').textContent).toBe('2');
447
+ });
448
+
449
+ case 9:
450
+ case "end":
451
+ return _context10.stop();
452
+ }
453
+ }, _callee10);
454
+ })));
455
+ });
456
+ describe('onRevoke callback', function () {
457
+ it('should remove recipient from both lists', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
458
+ var _setup11, getByTestId;
459
+
460
+ return _regeneratorRuntime.wrap(function _callee11$(_context11) {
461
+ while (1) switch (_context11.prev = _context11.next) {
462
+ case 0:
463
+ _setup11 = setup(), getByTestId = _setup11.getByTestId;
464
+ _context11.next = 3;
465
+ return waitFor(function () {
466
+ expect(getByTestId('btn-share')).toBeTruthy();
467
+ });
468
+
469
+ case 3:
470
+ fireEvent.click(getByTestId('btn-share'));
471
+ _context11.next = 6;
472
+ return waitFor(function () {
473
+ expect(getByTestId('recipients-count').textContent).toBe('2');
474
+ });
475
+
476
+ case 6:
477
+ fireEvent.click(getByTestId('btn-revoke'));
478
+ _context11.next = 9;
479
+ return waitFor(function () {
480
+ expect(getByTestId('recipients-count').textContent).toBe('1');
481
+ });
482
+
483
+ case 9:
484
+ case "end":
485
+ return _context11.stop();
486
+ }
487
+ }, _callee11);
488
+ })));
489
+ });
490
+ describe('onClose callback', function () {
491
+ it('should call onClose when close button is clicked', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
492
+ var _setup12, getByTestId;
493
+
494
+ return _regeneratorRuntime.wrap(function _callee12$(_context12) {
495
+ while (1) switch (_context12.prev = _context12.next) {
496
+ case 0:
497
+ _setup12 = setup(), getByTestId = _setup12.getByTestId;
498
+ _context12.next = 3;
499
+ return waitFor(function () {
500
+ expect(getByTestId('btn-close')).toBeTruthy();
501
+ });
502
+
503
+ case 3:
504
+ fireEvent.click(getByTestId('btn-close'));
505
+ expect(mockOnClose).toHaveBeenCalled();
506
+
507
+ case 5:
508
+ case "end":
509
+ return _context12.stop();
510
+ }
511
+ }, _callee12);
512
+ })));
513
+ });
514
+ describe('createContact callback', function () {
515
+ it('should call client.create when creating a contact', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
516
+ var _setup13, getByTestId;
517
+
518
+ return _regeneratorRuntime.wrap(function _callee13$(_context13) {
519
+ while (1) switch (_context13.prev = _context13.next) {
520
+ case 0:
521
+ _setup13 = setup(), getByTestId = _setup13.getByTestId;
522
+ _context13.next = 3;
523
+ return waitFor(function () {
524
+ expect(getByTestId('btn-create-contact')).toBeTruthy();
525
+ });
526
+
527
+ case 3:
528
+ fireEvent.click(getByTestId('btn-create-contact'));
529
+ _context13.next = 6;
530
+ return waitFor(function () {
531
+ expect(client.create).toHaveBeenCalledWith('io.cozy.contacts', {
532
+ email: 'test@example.com'
533
+ });
534
+ });
535
+
536
+ case 6:
537
+ case "end":
538
+ return _context13.stop();
539
+ }
540
+ }, _callee13);
541
+ })));
542
+ });
543
+ });
@@ -34,7 +34,7 @@ var LinkRecipient = function LinkRecipient(props) {
34
34
  link = props.link,
35
35
  fadeIn = props.fadeIn,
36
36
  document = props.document;
37
- var permissions = getDocumentPermissions(document._id);
37
+ var permissions = getDocumentPermissions(document === null || document === void 0 ? void 0 : document._id);
38
38
  var hasPassword = checkIsPermissionHasPassword(permissions);
39
39
  var expiresDate = getPermissionExpiresDate(permissions);
40
40
  var dateFormatted = expiresDate ? f(expiresDate, lang === 'fr' ? 'dd/LL/yyyy' : 'LL/dd/yyyy') : null;
@@ -25,6 +25,7 @@ import { cozyUrlMatch, emailMatch, groupNameMatch, fullnameMatch } from '../sugg
25
25
 
26
26
  var ShareAutocomplete = function ShareAutocomplete(_ref) {
27
27
  var loading = _ref.loading,
28
+ disabled = _ref.disabled,
28
29
  contactsAndGroups = _ref.contactsAndGroups,
29
30
  recipients = _ref.recipients,
30
31
  onPick = _ref.onPick,
@@ -205,13 +206,15 @@ var ShareAutocomplete = function ShareAutocomplete(_ref) {
205
206
  value: inputValue,
206
207
  type: 'email',
207
208
  placeholder: placeholder,
208
- className: styles['suggestionInput']
209
+ className: styles['suggestionInput'],
210
+ disabled: disabled
209
211
  }
210
212
  });
211
213
  };
212
214
 
213
215
  ShareAutocomplete.propTypes = {
214
216
  loading: PropTypes.bool,
217
+ disabled: PropTypes.bool,
215
218
  contactsAndGroups: PropTypes.array,
216
219
  recipients: PropTypes.array.isRequired,
217
220
  onPick: PropTypes.func.isRequired,