cozy-sharing 17.0.0 → 19.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 (55) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/dist/SharingProvider.spec.js +84 -80
  3. package/dist/components/Recipient/LinkRecipientPermissions.js +18 -129
  4. package/dist/components/Recipient/actions/editPermissionLink.js +71 -0
  5. package/dist/components/Recipient/actions/readOnlyPermissionLink.js +63 -0
  6. package/dist/components/ShareByLink.js +45 -185
  7. package/dist/components/ShareDialogCozyToCozy.js +2 -6
  8. package/dist/components/ShareDialogOnlyByLink.js +2 -8
  9. package/dist/components/ShareDialogTwoStepsConfirmationContainer.js +1 -3
  10. package/dist/components/ShareModal/EditableSharingModal.js +1 -7
  11. package/dist/components/ShareModal/EditableSharingModal.spec.js +49 -52
  12. package/dist/components/ShareModal/SharingDetailsModal.js +1 -1
  13. package/dist/components/ShareModal.js +0 -12
  14. package/dist/components/ShareRestrictionModal/BoxDate.js +77 -0
  15. package/dist/components/ShareRestrictionModal/BoxEditingRights.js +83 -0
  16. package/dist/components/ShareRestrictionModal/BoxPassword.js +138 -0
  17. package/dist/components/ShareRestrictionModal/ShareRestrictionContentModal.js +94 -0
  18. package/dist/components/ShareRestrictionModal/ShareRestrictionModal.js +260 -0
  19. package/dist/components/ShareRestrictionModal/helpers.js +275 -0
  20. package/dist/components/ShareRestrictionModal/helpers.spec.js +110 -0
  21. package/dist/components/SharedStatus.spec.js +20 -21
  22. package/dist/components/WhoHasAccess.js +1 -5
  23. package/jest.config.js +8 -3
  24. package/jestHelpers/setup.js +1 -8
  25. package/locales/en.json +28 -0
  26. package/locales/fr.json +29 -0
  27. package/package.json +13 -11
  28. package/src/SharingProvider.spec.jsx +88 -88
  29. package/src/components/Recipient/LinkRecipientPermissions.jsx +28 -137
  30. package/src/components/Recipient/actions/editPermissionLink.js +63 -0
  31. package/src/components/Recipient/actions/readOnlyPermissionLink.js +59 -0
  32. package/src/components/ShareByLink.jsx +20 -96
  33. package/src/components/ShareDialogCozyToCozy.jsx +1 -5
  34. package/src/components/ShareDialogOnlyByLink.jsx +0 -6
  35. package/src/components/ShareDialogTwoStepsConfirmationContainer.jsx +0 -2
  36. package/src/components/ShareModal/EditableSharingModal.jsx +1 -7
  37. package/src/components/ShareModal/EditableSharingModal.spec.jsx +50 -44
  38. package/src/components/ShareModal/SharingDetailsModal.jsx +1 -1
  39. package/src/components/ShareModal.jsx +0 -12
  40. package/src/components/ShareRestrictionModal/BoxDate.jsx +76 -0
  41. package/src/components/ShareRestrictionModal/BoxEditingRights.jsx +91 -0
  42. package/src/components/ShareRestrictionModal/BoxPassword.jsx +112 -0
  43. package/src/components/ShareRestrictionModal/ShareRestrictionContentModal.jsx +102 -0
  44. package/src/components/ShareRestrictionModal/ShareRestrictionModal.jsx +177 -0
  45. package/src/components/ShareRestrictionModal/helpers.js +193 -0
  46. package/src/components/ShareRestrictionModal/helpers.spec.js +78 -0
  47. package/src/components/SharedStatus.spec.js +32 -31
  48. package/src/components/WhoHasAccess.jsx +1 -5
  49. package/src/components/__snapshots__/SharedStatus.spec.js.snap +59 -129
  50. package/dist/RefreshableSharings.spec.js +0 -40
  51. package/dist/components/EditLinkPermissionDialog.js +0 -72
  52. package/dist/components/EditLinkPermissionDialog.spec.js +0 -48
  53. package/src/RefreshableSharings.spec.jsx +0 -43
  54. package/src/components/EditLinkPermissionDialog.jsx +0 -89
  55. package/src/components/EditLinkPermissionDialog.spec.jsx +0 -53
@@ -0,0 +1,275 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import { getSharingLink } from 'cozy-client/dist/models/sharing';
4
+ import minilog from 'cozy-minilog';
5
+ var log = minilog('ShareRestrictionModal/helpers');
6
+ export var WRITE_PERMS = ['GET', 'POST', 'PUT', 'PATCH'];
7
+ export var READ_ONLY_PERMS = ['GET'];
8
+ /**
9
+ * Copy a string to the clipboard
10
+ *
11
+ * @param {string} value - The string saved to the clipboard
12
+ * @param {object} [options]
13
+ * @param {number} options.t - Translation function
14
+ * @param {Function} options.showAlert - Function to display an alert
15
+ */
16
+
17
+ export var copyToClipboard = /*#__PURE__*/function () {
18
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(value) {
19
+ var _ref2,
20
+ t,
21
+ showAlert,
22
+ _args = arguments;
23
+
24
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
25
+ while (1) switch (_context.prev = _context.next) {
26
+ case 0:
27
+ _ref2 = _args.length > 1 && _args[1] !== undefined ? _args[1] : {}, t = _ref2.t, showAlert = _ref2.showAlert;
28
+
29
+ if (value) {
30
+ _context.next = 3;
31
+ break;
32
+ }
33
+
34
+ return _context.abrupt("return", false);
35
+
36
+ case 3:
37
+ _context.prev = 3;
38
+ _context.next = 6;
39
+ return navigator.clipboard.writeText(value);
40
+
41
+ case 6:
42
+ showAlert({
43
+ message: t('copyReminderContent.success'),
44
+ severity: 'success',
45
+ variant: 'filled'
46
+ });
47
+ _context.next = 13;
48
+ break;
49
+
50
+ case 9:
51
+ _context.prev = 9;
52
+ _context.t0 = _context["catch"](3);
53
+ showAlert({
54
+ message: t('copyReminderContent.error'),
55
+ severity: 'error',
56
+ variant: 'filled'
57
+ });
58
+ log.error("Error in 'copyToClipboard' function when trying to copy to clipboard", _context.t0);
59
+
60
+ case 13:
61
+ case "end":
62
+ return _context.stop();
63
+ }
64
+ }, _callee, null, [[3, 9]]);
65
+ }));
66
+
67
+ return function copyToClipboard(_x) {
68
+ return _ref.apply(this, arguments);
69
+ };
70
+ }();
71
+ /**
72
+ * Make a TTL string from a date
73
+ * @param {Date|string} selectedDate
74
+ * @returns {string} - TTL string in seconds (e.g. '1234s')
75
+ */
76
+
77
+ export var makeTTL = function makeTTL(selectedDate) {
78
+ if (!selectedDate) return;
79
+
80
+ try {
81
+ var selectedDateConverted = selectedDate;
82
+
83
+ if (typeof selectedDate === 'string') {
84
+ var _selectedDateConverte;
85
+
86
+ selectedDateConverted = new Date(selectedDate);
87
+
88
+ if (((_selectedDateConverte = selectedDateConverted) === null || _selectedDateConverte === void 0 ? void 0 : _selectedDateConverte.toString()) === 'Invalid Date') {
89
+ throw new Error("Invalid date: ".concat(selectedDate));
90
+ }
91
+ }
92
+
93
+ if (selectedDateConverted instanceof Date) {
94
+ var now = new Date();
95
+ var ttl = selectedDateConverted > now ? "".concat(Math.round((selectedDateConverted - now) / 1000), "s") : undefined;
96
+ return ttl;
97
+ }
98
+
99
+ throw new Error("Invalid date: ".concat(selectedDate));
100
+ } catch (error) {
101
+ log.error(error);
102
+ return;
103
+ }
104
+ };
105
+ /**
106
+ * forwardFile - Triggers the download of one or multiple files by the browser
107
+ * @param {object} options
108
+ * @param {import('cozy-client/types/CozyClient').default} options.client
109
+ * @param {import('cozy-client/types/types').IOCozyFile} options.file File to download
110
+ * @param {Function} options.t i18n function
111
+ * @param {string} options.ttl Time to live of the sharing link
112
+ * @param {string} options.password Password of the sharing link
113
+ * @param {Function} options.showAlert - Function to display an alert
114
+ */
115
+
116
+ export var forwardFile = /*#__PURE__*/function () {
117
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
118
+ var client, file, t, ttl, password, showAlert, url, isZipFile, shareData;
119
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
120
+ while (1) switch (_context2.prev = _context2.next) {
121
+ case 0:
122
+ client = _ref3.client, file = _ref3.file, t = _ref3.t, ttl = _ref3.ttl, password = _ref3.password, showAlert = _ref3.showAlert;
123
+ _context2.prev = 1;
124
+ _context2.next = 4;
125
+ return getSharingLink(client, [file._id], {
126
+ ttl: ttl,
127
+ password: password
128
+ });
129
+
130
+ case 4:
131
+ url = _context2.sent;
132
+ isZipFile = file.class === 'zip';
133
+ shareData = {
134
+ title: t('shareFile.title', {
135
+ name: file.name,
136
+ smart_count: isZipFile ? 2 : 1
137
+ }),
138
+ text: t('shareFile.text', {
139
+ name: file.name,
140
+ smart_count: isZipFile ? 2 : 1
141
+ }),
142
+ url: url
143
+ };
144
+ navigator.share(shareData);
145
+ _context2.next = 13;
146
+ break;
147
+
148
+ case 10:
149
+ _context2.prev = 10;
150
+ _context2.t0 = _context2["catch"](1);
151
+ showAlert({
152
+ message: t('shareFile.error'),
153
+ severity: 'error',
154
+ variant: 'filled'
155
+ });
156
+
157
+ case 13:
158
+ case "end":
159
+ return _context2.stop();
160
+ }
161
+ }, _callee2, null, [[1, 10]]);
162
+ }));
163
+
164
+ return function forwardFile(_x2) {
165
+ return _ref4.apply(this, arguments);
166
+ };
167
+ }();
168
+ /**
169
+ * updatePermissions - Updates the permissions of a file
170
+ * @param {object} options
171
+ * @param {import('cozy-client/types/types').IOCozyFile} options.file File to update permissions
172
+ * @param {Function} options.t i18n function
173
+ * @param {string} options.documentType - Type of the document
174
+ * @param {'readOnly'|'write'} options.editingRights - Editing rights
175
+ * @param {Function} options.updateDocumentPermissions - Function to update permissions
176
+ * @param {Function} options.showAlert - Function to display an alert
177
+ */
178
+
179
+ export var updatePermissions = /*#__PURE__*/function () {
180
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref5) {
181
+ var file, t, editingRights, documentType, updateDocumentPermissions, showAlert;
182
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
183
+ while (1) switch (_context3.prev = _context3.next) {
184
+ case 0:
185
+ file = _ref5.file, t = _ref5.t, editingRights = _ref5.editingRights, documentType = _ref5.documentType, updateDocumentPermissions = _ref5.updateDocumentPermissions, showAlert = _ref5.showAlert;
186
+ _context3.t0 = editingRights;
187
+ _context3.next = _context3.t0 === 'readOnly' ? 4 : _context3.t0 === 'write' ? 13 : 22;
188
+ break;
189
+
190
+ case 4:
191
+ _context3.prev = 4;
192
+ return _context3.abrupt("return", updateDocumentPermissions(file, READ_ONLY_PERMS));
193
+
194
+ case 8:
195
+ _context3.prev = 8;
196
+ _context3.t1 = _context3["catch"](4);
197
+ showAlert({
198
+ message: t("".concat(documentType, ".share.shareByLink.permserror")),
199
+ severity: 'error',
200
+ variant: 'filled'
201
+ });
202
+ log.error("Error in 'readOnlyPermissionLink' function when trying to change permission", _context3.t1);
203
+
204
+ case 12:
205
+ return _context3.abrupt("break", 22);
206
+
207
+ case 13:
208
+ _context3.prev = 13;
209
+ return _context3.abrupt("return", updateDocumentPermissions(file, WRITE_PERMS));
210
+
211
+ case 17:
212
+ _context3.prev = 17;
213
+ _context3.t2 = _context3["catch"](13);
214
+ showAlert({
215
+ message: t("".concat(documentType, ".share.shareByLink.permserror")),
216
+ severity: 'error',
217
+ variant: 'filled'
218
+ });
219
+ log.error("Error in 'editPermissionLink' function when trying to change permission", _context3.t2);
220
+
221
+ case 21:
222
+ return _context3.abrupt("break", 22);
223
+
224
+ case 22:
225
+ case "end":
226
+ return _context3.stop();
227
+ }
228
+ }, _callee3, null, [[4, 8], [13, 17]]);
229
+ }));
230
+
231
+ return function updatePermissions(_x3) {
232
+ return _ref6.apply(this, arguments);
233
+ };
234
+ }();
235
+ /**
236
+ * revokePermissions - Revokes the permissions of a file
237
+ * @param {object} options
238
+ * @param {import('cozy-client/types/types').IOCozyFile} options.file File to revoke permissions
239
+ * @param {Function} options.t i18n function
240
+ * @param {string} options.documentType - Type of the document
241
+ * @param {Function} options.revokeSharingLink - Function to revoke permissions
242
+ * @param {Function} options.showAlert - Function to display an alert
243
+ */
244
+
245
+ export var revokePermissions = /*#__PURE__*/function () {
246
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref7) {
247
+ var file, t, documentType, revokeSharingLink, showAlert;
248
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
249
+ while (1) switch (_context4.prev = _context4.next) {
250
+ case 0:
251
+ file = _ref7.file, t = _ref7.t, documentType = _ref7.documentType, revokeSharingLink = _ref7.revokeSharingLink, showAlert = _ref7.showAlert;
252
+ _context4.prev = 1;
253
+ return _context4.abrupt("return", revokeSharingLink(file));
254
+
255
+ case 5:
256
+ _context4.prev = 5;
257
+ _context4.t0 = _context4["catch"](1);
258
+ showAlert({
259
+ message: t("".concat(documentType, ".share.error.revoke")),
260
+ severity: 'error',
261
+ variant: 'filled'
262
+ });
263
+ log.error("Error in 'revokePermissions' function when trying to revoke sharing link", _context4.t0);
264
+
265
+ case 9:
266
+ case "end":
267
+ return _context4.stop();
268
+ }
269
+ }, _callee4, null, [[1, 5]]);
270
+ }));
271
+
272
+ return function revokePermissions(_x4) {
273
+ return _ref8.apply(this, arguments);
274
+ };
275
+ }();
@@ -0,0 +1,110 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import { makeTTL, revokePermissions, updatePermissions } from './helpers';
4
+ describe('ShareRestrictionModal/helpers', function () {
5
+ describe('makeTTL', function () {
6
+ it('sould return undefined', function () {
7
+ expect(makeTTL()).toBeUndefined();
8
+ expect(makeTTL(123)).toBeUndefined();
9
+ expect(makeTTL('abc')).toBeUndefined();
10
+ expect(makeTTL(new Date('2023-01-01T00:00:00.000Z'))).toBeUndefined();
11
+ expect(makeTTL(new Date('abc'))).toBeUndefined();
12
+ expect(makeTTL('2023-01-01T00:00:00.000Z')).toBeUndefined();
13
+ });
14
+ it('sould return TTL in seconds', function () {
15
+ expect(makeTTL(new Date('2100-01-01T00:00:00.000Z'))).toBeDefined();
16
+ expect(makeTTL('2100-01-01T00:00:00.000Z')).toBeDefined();
17
+ });
18
+ });
19
+ describe('updatePermissions', function () {
20
+ var documentType = 'Files';
21
+ it('should call updateDocumentPermissions with "readOnly" permission', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
22
+ var updateDocumentPermissions, file, editingRights;
23
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
24
+ while (1) switch (_context.prev = _context.next) {
25
+ case 0:
26
+ updateDocumentPermissions = jest.fn();
27
+ file = {
28
+ _id: '123'
29
+ };
30
+ editingRights = 'readOnly';
31
+ _context.next = 5;
32
+ return updatePermissions({
33
+ file: file,
34
+ t: jest.fn(),
35
+ editingRights: editingRights,
36
+ documentType: documentType,
37
+ updateDocumentPermissions: updateDocumentPermissions,
38
+ showAlert: jest.fn()
39
+ });
40
+
41
+ case 5:
42
+ expect(updateDocumentPermissions).toHaveBeenCalledWith(file, ['GET']);
43
+
44
+ case 6:
45
+ case "end":
46
+ return _context.stop();
47
+ }
48
+ }, _callee);
49
+ })));
50
+ it('should call updateDocumentPermissions with "write" permissions', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
51
+ var updateDocumentPermissions, file, editingRights;
52
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
53
+ while (1) switch (_context2.prev = _context2.next) {
54
+ case 0:
55
+ updateDocumentPermissions = jest.fn();
56
+ file = {
57
+ _id: '123'
58
+ };
59
+ editingRights = 'write';
60
+ _context2.next = 5;
61
+ return updatePermissions({
62
+ file: file,
63
+ t: jest.fn(),
64
+ editingRights: editingRights,
65
+ documentType: documentType,
66
+ updateDocumentPermissions: updateDocumentPermissions,
67
+ showAlert: jest.fn()
68
+ });
69
+
70
+ case 5:
71
+ expect(updateDocumentPermissions).toHaveBeenCalledWith(file, ['GET', 'POST', 'PUT', 'PATCH']);
72
+
73
+ case 6:
74
+ case "end":
75
+ return _context2.stop();
76
+ }
77
+ }, _callee2);
78
+ })));
79
+ });
80
+ describe('revokePermissions', function () {
81
+ var documentType = 'Files';
82
+ it('should call revokeSharingLink', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
83
+ var revokeSharingLink, file;
84
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
85
+ while (1) switch (_context3.prev = _context3.next) {
86
+ case 0:
87
+ revokeSharingLink = jest.fn();
88
+ file = {
89
+ _id: '123'
90
+ };
91
+ _context3.next = 4;
92
+ return revokePermissions({
93
+ file: file,
94
+ t: jest.fn(),
95
+ documentType: documentType,
96
+ revokeSharingLink: revokeSharingLink,
97
+ showAlert: jest.fn()
98
+ });
99
+
100
+ case 4:
101
+ expect(revokeSharingLink).toHaveBeenCalledWith(file);
102
+
103
+ case 5:
104
+ case "end":
105
+ return _context3.stop();
106
+ }
107
+ }, _callee3);
108
+ })));
109
+ });
110
+ });
@@ -1,24 +1,19 @@
1
- import { mount } from 'enzyme';
1
+ import { render } from '@testing-library/react';
2
2
  import React from 'react';
3
3
  import { SharedStatus } from './SharedStatus';
4
4
  import AppLike from '../../test/AppLike';
5
5
  describe('SharedStatus component', function () {
6
- var WrappingComponent = function WrappingComponent(_ref) {
7
- var children = _ref.children;
8
- return /*#__PURE__*/React.createElement(AppLike, null, children);
9
- };
10
-
11
6
  it('should just render a span if no sharing', function () {
12
- var component = mount( /*#__PURE__*/React.createElement(SharedStatus, {
7
+ var _render = render( /*#__PURE__*/React.createElement(AppLike, null, /*#__PURE__*/React.createElement(SharedStatus, {
13
8
  docId: "1",
14
9
  recipients: []
15
- }), {
16
- wrappingComponent: WrappingComponent
17
- });
18
- expect(component).toMatchSnapshot();
10
+ }))),
11
+ container = _render.container;
12
+
13
+ expect(container).toMatchSnapshot();
19
14
  });
20
15
  it('should have the right display if there is several recipients', function () {
21
- var component = mount( /*#__PURE__*/React.createElement(SharedStatus, {
16
+ var _render2 = render( /*#__PURE__*/React.createElement(AppLike, null, /*#__PURE__*/React.createElement(SharedStatus, {
22
17
  docId: "1",
23
18
  recipients: [{
24
19
  _id: 1,
@@ -27,19 +22,23 @@ describe('SharedStatus component', function () {
27
22
  _id: 2,
28
23
  name: '2'
29
24
  }]
30
- }), {
31
- wrappingComponent: WrappingComponent
32
- });
33
- expect(component).toMatchSnapshot();
25
+ }))),
26
+ container = _render2.container,
27
+ getByText = _render2.getByText;
28
+
29
+ expect(container).toMatchSnapshot();
30
+ expect(getByText('2 members')).toBeTruthy();
34
31
  });
35
32
  it('should display the link if there is a link', function () {
36
- var component = mount( /*#__PURE__*/React.createElement(SharedStatus, {
33
+ var _render3 = render( /*#__PURE__*/React.createElement(AppLike, null, /*#__PURE__*/React.createElement(SharedStatus, {
37
34
  docId: "1",
38
35
  recipients: [],
39
36
  link: true
40
- }), {
41
- wrappingComponent: WrappingComponent
42
- });
43
- expect(component).toMatchSnapshot();
37
+ }))),
38
+ container = _render3.container,
39
+ getByText = _render3.getByText;
40
+
41
+ expect(container).toMatchSnapshot();
42
+ expect(getByText('Shared by link')).toBeTruthy();
44
43
  });
45
44
  });
@@ -40,9 +40,7 @@ var WhoHasAccess = function WhoHasAccess(_ref2) {
40
40
  onRevokeSelf = _ref2.onRevokeSelf,
41
41
  verifyRecipient = _ref2.verifyRecipient,
42
42
  link = _ref2.link,
43
- permissions = _ref2.permissions,
44
- onUpdateShareLinkPermissions = _ref2.onUpdateShareLinkPermissions,
45
- onRevokeLink = _ref2.onRevokeLink;
43
+ permissions = _ref2.permissions;
46
44
  var previousLink = usePrevious(link);
47
45
  var linkHasBeenJustCreated = link && previousLink === null;
48
46
  return /*#__PURE__*/React.createElement("div", {
@@ -56,8 +54,6 @@ var WhoHasAccess = function WhoHasAccess(_ref2) {
56
54
  onRevokeSelf: onRevokeSelf,
57
55
  link: link,
58
56
  permissions: permissions,
59
- onChangePermissions: onUpdateShareLinkPermissions,
60
- onDisable: onRevokeLink,
61
57
  fadeIn: linkHasBeenJustCreated
62
58
  }), /*#__PURE__*/React.createElement(OwnerRecipient, {
63
59
  recipients: recipients
package/jest.config.js CHANGED
@@ -5,8 +5,11 @@ module.exports = {
5
5
  '!**/vendor/**',
6
6
  '!**/*.stories.{js,jsx,ts,tsx}'
7
7
  ],
8
- snapshotSerializers: ['enzyme-to-json/serializer'],
9
- testPathIgnorePatterns: ['node_modules', 'dist', '__tests__'],
8
+ testPathIgnorePatterns: [
9
+ '<rootDir>/node_modules/',
10
+ '<rootDir>/dist/',
11
+ '<rootDir>/__tests__/'
12
+ ],
10
13
  roots: ['<rootDir>/src'],
11
14
  testURL: 'http://localhost/',
12
15
  moduleFileExtensions: ['js', 'jsx', 'json', 'styl'],
@@ -19,6 +22,8 @@ module.exports = {
19
22
  '^cozy-logger$': 'cozy-logger/dist/index.js',
20
23
  '^cozy-client$': 'cozy-client/dist/index.js'
21
24
  },
22
- transformIgnorePatterns: ['node_modules/(?!cozy-ui)'],
25
+ transformIgnorePatterns: [
26
+ '<rootDir>/node_modules/(?!(cozy-ui|cozy-harvest-lib))'
27
+ ],
23
28
  setupFilesAfterEnv: ['<rootDir>/jestHelpers/setup.js']
24
29
  }
@@ -1,8 +1 @@
1
- import Enzyme from 'enzyme'
2
- import Adapter from 'enzyme-adapter-react-16'
3
- import '@testing-library/jest-dom/extend-expect'
4
-
5
- jest.mock('cozy-logger', () => ({
6
- namespace: () => () => {}
7
- }))
8
- Enzyme.configure({ adapter: new Adapter() })
1
+ import '@testing-library/jest-dom'
package/locales/en.json CHANGED
@@ -416,5 +416,33 @@
416
416
  },
417
417
  "addEmail": "Enter an email address to invite the contact"
418
418
  }
419
+ },
420
+ "ShareRestrictionModal": {
421
+ "action": {
422
+ "confirm": "Confirm"
423
+ },
424
+ "invalidPasswordMessage": "%{smart_count} character is missing |||| %{smart_count} characters are missings"
425
+ },
426
+ "BoxDate": {
427
+ "label": "Deadline",
428
+ "text": "Remove access after a deadline"
429
+ },
430
+ "BoxPassword": {
431
+ "label": "Password",
432
+ "text": "Limit access with a password"
433
+ },
434
+ "BoxEditingRights": {
435
+ "editSubText": "People with access to the link can modify the content",
436
+ "readOnlySubText": "People who have access to the link can only view the content",
437
+ "text": "Editing rights"
438
+ },
439
+ "copyReminderContent": {
440
+ "success": "Copied to clipboard",
441
+ "error": "Cannot copy to clipboard"
442
+ },
443
+ "shareFile": {
444
+ "error": "Problem with link recovery: %{error}",
445
+ "text": "Link to my document %{name}: |||| Link to my documents %{name}: ",
446
+ "title": "Link to my document %{name} |||| Link to my documents %{name}"
419
447
  }
420
448
  }
package/locales/fr.json CHANGED
@@ -414,5 +414,34 @@
414
414
  },
415
415
  "addEmail": "Renseigner un email pour pouvoir inviter le contact"
416
416
  }
417
+ },
418
+ "ShareRestrictionModal": {
419
+ "title": "Lien de partage",
420
+ "action": {
421
+ "confirm": "Valider"
422
+ },
423
+ "invalidPasswordMessage": "Il manque %{smart_count} caractère |||| Il manque %{smart_count} caractères"
424
+ },
425
+ "BoxDate": {
426
+ "label": "Date limite",
427
+ "text": "Restreindre l'accès après une date limite"
428
+ },
429
+ "BoxPassword": {
430
+ "label": "Mot de passe",
431
+ "text": "Limiter l'accès par un mot de passe"
432
+ },
433
+ "BoxEditingRights": {
434
+ "editSubText": "Les personnes ayant accès au lien peuvent modifier le contenu",
435
+ "readOnlySubText": "Les personnes ayant accès au lien peuvent uniquement consulter le contenu",
436
+ "text": "Droit d’édition"
437
+ },
438
+ "copyReminderContent": {
439
+ "success": "Copié dans le presse-papier",
440
+ "error": "Impossible de copier dans le presse-papier"
441
+ },
442
+ "shareFile": {
443
+ "error": "Problème avec la récupération du lien : %{error}",
444
+ "text": "Voici un lien vers mon document %{name} : |||| Voici un lien contenant mes documents %{name} : ",
445
+ "title": "Lien vers mon document %{name} |||| Lien vers mes documents %{name}"
417
446
  }
418
447
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-sharing",
3
- "version": "17.0.0",
3
+ "version": "19.0.0",
4
4
  "description": "Provides sharing login for React applications.",
5
5
  "main": "dist/index.js",
6
6
  "author": "Cozy",
@@ -19,7 +19,7 @@
19
19
  "build:doc:react": "(cd ../.. && TARGET=cozy-sharing yarn build:doc:react)",
20
20
  "deploy:doc": "(cd ../.. && yarn deploy:doc)",
21
21
  "prepublishOnly": "yarn build",
22
- "test": "env NODE_ENV=test jest --env=jest-environment-jsdom-sixteen",
22
+ "test": "env NODE_ENV=test jest",
23
23
  "lint": "cd .. && yarn eslint --ext js,jsx packages/cozy-sharing",
24
24
  "start": "yarn build --watch",
25
25
  "watch": "yarn run start",
@@ -32,6 +32,7 @@
32
32
  "classnames": "^2.2.6",
33
33
  "cozy-device-helper": "^3.7.1",
34
34
  "cozy-doctypes": "^1.97.1",
35
+ "date-fns": "2.30.0",
35
36
  "lodash": "^4.17.19",
36
37
  "react-autosuggest": "^10.1.0",
37
38
  "react-tooltip": "^3.11.1",
@@ -52,23 +53,24 @@
52
53
  "babel-jest": "26.6.3",
53
54
  "babel-plugin-css-modules-transform": "1.6.2",
54
55
  "babel-plugin-inline-react-svg": "1.1.2",
55
- "cozy-client": "^51.4.0",
56
- "cozy-ui": "^113.9.0",
57
- "enzyme": "3.11.0",
58
- "enzyme-adapter-react-16": "1.15.6",
59
- "enzyme-to-json": "3.6.2",
56
+ "cozy-client": "^52.1.0",
57
+ "cozy-device-helper": "^3.7.1",
58
+ "cozy-intent": "^2.29.1",
59
+ "cozy-minilog": "^3.9.1",
60
+ "cozy-ui": "^116.0.0",
60
61
  "jest": "26.6.3",
62
+ "jest-environment-jsdom": "26.6.2",
61
63
  "react": "16.12.0",
62
64
  "react-dom": "16.13.0",
63
65
  "react-router": "^5.0.1",
64
66
  "storybook": "7.6.0"
65
67
  },
66
68
  "peerDependencies": {
67
- "cozy-client": ">=51.4.0",
69
+ "cozy-client": ">=52.1.0",
68
70
  "cozy-device-helper": ">=3.7.1",
69
71
  "cozy-intent": ">=2.29.1",
70
- "cozy-realtime": "^3.11.0",
71
- "cozy-ui": ">=113.5.0",
72
+ "cozy-minilog": ">=3.9.1",
73
+ "cozy-ui": ">=116.0.0",
72
74
  "prop-types": "^15.7.2",
73
75
  "react": "^16.12.0",
74
76
  "react-router": "^5.0.1"
@@ -76,5 +78,5 @@
76
78
  "sideEffects": [
77
79
  "*.css"
78
80
  ],
79
- "gitHead": "e119955a4934470d07c763ac51e95149f469f55f"
81
+ "gitHead": "74889d160e15166c4aa132e4fc8c77ebe95c62ae"
80
82
  }