cozy-sharing 32.1.2 → 32.3.2

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 (36) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/components/FederatedFolder/FederatedFolderModal.js +96 -22
  3. package/dist/components/FederatedFolder/FederatedFolderModal.spec.js +137 -219
  4. package/dist/components/Recipient/RecipientList.js +0 -15
  5. package/dist/components/ShareAutosuggest.js +1 -0
  6. package/dist/components/ShareAutosuggest.spec.js +12 -4
  7. package/dist/components/ShareDialogCozyToCozy.spec.js +55 -8
  8. package/dist/components/ShareDiscardChangesModal.js +35 -0
  9. package/dist/components/ShareModal/ShareModal.js +8 -8
  10. package/dist/components/ShareRecipientsInput.js +13 -3
  11. package/dist/components/ShareRecipientsInput.spec.js +63 -4
  12. package/dist/state.js +6 -1
  13. package/locales/en.json +10 -5
  14. package/locales/fr.json +10 -5
  15. package/locales/ru.json +10 -5
  16. package/locales/vi.json +10 -5
  17. package/package.json +2 -2
  18. package/src/components/FederatedFolder/FederatedFolderModal.jsx +230 -138
  19. package/src/components/FederatedFolder/FederatedFolderModal.spec.jsx +59 -134
  20. package/src/components/Recipient/RecipientList.jsx +0 -18
  21. package/src/components/ShareAutosuggest.jsx +1 -0
  22. package/src/components/ShareAutosuggest.spec.jsx +10 -5
  23. package/src/components/ShareDialogCozyToCozy.spec.jsx +50 -4
  24. package/src/components/ShareDiscardChangesModal.jsx +40 -0
  25. package/src/components/ShareModal/ShareModal.jsx +5 -5
  26. package/src/components/ShareRecipientsInput.jsx +11 -6
  27. package/src/components/ShareRecipientsInput.spec.jsx +59 -0
  28. package/src/state.js +5 -1
  29. package/dist/components/SharedDrive/SharedDriveRecipient.js +0 -61
  30. package/dist/components/SharedDrive/SharedDriveRecipientPermissions.js +0 -109
  31. package/dist/components/SharedDrive/SharedDriveRecipientStatus.js +0 -22
  32. package/dist/components/SharedFolder/DumbBatchSharedFolderModal.js +0 -145
  33. package/src/components/SharedDrive/SharedDriveRecipient.jsx +0 -62
  34. package/src/components/SharedDrive/SharedDriveRecipientPermissions.jsx +0 -78
  35. package/src/components/SharedDrive/SharedDriveRecipientStatus.jsx +0 -23
  36. package/src/components/SharedFolder/DumbBatchSharedFolderModal.jsx +0 -161
package/CHANGELOG.md CHANGED
@@ -3,6 +3,30 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [32.3.2](https://github.com/cozy/cozy-libs/compare/cozy-sharing@32.3.1...cozy-sharing@32.3.2) (2026-05-26)
7
+
8
+ ### Bug Fixes
9
+
10
+ - Show readonly modal when shared drive is read only ([e935b38](https://github.com/cozy/cozy-libs/commit/e935b38aa443d68b7d17dc8c82e8a9e1e23e2460))
11
+
12
+ ## [32.3.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@32.3.0...cozy-sharing@32.3.1) (2026-05-22)
13
+
14
+ ### Bug Fixes
15
+
16
+ - **cozy-sharing:** Filter out owner from the list of suggested users ([cb312ee](https://github.com/cozy/cozy-libs/commit/cb312ee6e412d021aff4a44830229404478ba316))
17
+
18
+ # [32.3.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@32.2.0...cozy-sharing@32.3.0) (2026-05-21)
19
+
20
+ ### Features
21
+
22
+ - **sharing:** Update sharing dialog close actions ([0624f97](https://github.com/cozy/cozy-libs/commit/0624f972fa681f199724a0bc10cfffe1f31c9657))
23
+
24
+ # [32.2.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@32.1.2...cozy-sharing@32.2.0) (2026-05-21)
25
+
26
+ ### Features
27
+
28
+ - **cozy-sharing:** Add autoFocus to the share recipient input ([0919284](https://github.com/cozy/cozy-libs/commit/09192847eb6659692b5950094095eb07e5be30ad))
29
+
6
30
  ## [32.1.2](https://github.com/cozy/cozy-libs/compare/cozy-sharing@32.1.1...cozy-sharing@32.1.2) (2026-05-19)
7
31
 
8
32
  **Note:** Version bump only for package cozy-sharing
@@ -2,16 +2,24 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import PropTypes from 'prop-types';
5
- import React, { useEffect, useState } from 'react';
5
+ import React, { useCallback, useEffect, useMemo, useState } from 'react';
6
6
  import { useClient } from 'cozy-client';
7
+ import Button from 'cozy-ui/transpiled/react/Buttons';
8
+ import { FixedDialog } from 'cozy-ui/transpiled/react/CozyDialogs';
9
+ import Typography from 'cozy-ui/transpiled/react/Typography';
7
10
  import { useAlert } from 'cozy-ui/transpiled/react/providers/Alert';
11
+ import ConfirmDialogProvider, { useConfirmDialog } from 'cozy-ui/transpiled/react/providers/ConfirmDialog';
8
12
  import { useI18n } from 'twake-i18n';
9
13
  import { getOrCreateFromArray } from '../../helpers/contacts';
10
14
  import withLocales from '../../hoc/withLocales';
11
15
  import { usePendingRecipients } from '../../hooks/usePendingRecipients';
12
16
  import { useSharingContext } from '../../hooks/useSharingContext';
13
- import { DumbBatchSharedFolderModal } from '../SharedFolder/DumbBatchSharedFolderModal';
14
- export var FederatedFolderModal = withLocales(function (_ref) {
17
+ import AntivirusAlert from '../AntivirusAlert';
18
+ import { default as DumbShareByEmail } from '../ShareByEmail';
19
+ import ShareByLink from '../ShareByLink';
20
+ import WhoHasAccess from '../WhoHasAccess';
21
+
22
+ var FederatedFolderModalContent = function FederatedFolderModalContent(_ref) {
15
23
  var onClose = _ref.onClose,
16
24
  existingDocument = _ref.document,
17
25
  autoOpenShareRestriction = _ref.autoOpenShareRestriction,
@@ -34,6 +42,10 @@ export var FederatedFolderModal = withLocales(function (_ref) {
34
42
  var _useAlert = useAlert(),
35
43
  showAlert = _useAlert.showAlert;
36
44
 
45
+ var _useConfirmDialog = useConfirmDialog(),
46
+ showConfirmDialog = _useConfirmDialog.showConfirmDialog,
47
+ closeConfirmDialog = _useConfirmDialog.closeConfirmDialog;
48
+
37
49
  var _useState = useState(null),
38
50
  _useState2 = _slicedToArray(_useState, 2),
39
51
  sharingLink = _useState2[0],
@@ -66,7 +78,33 @@ export var FederatedFolderModal = withLocales(function (_ref) {
66
78
  frozenRecipients = _useState8[0],
67
79
  setFrozenRecipients = _useState8[1];
68
80
 
69
- var documentPermissions = existingDocument ? getDocumentPermissions(existingDocument._id) : [];
81
+ var handleCloseRequest = useCallback(function () {
82
+ if (pendingRecipients.length === 0) {
83
+ onClose();
84
+ return;
85
+ }
86
+
87
+ showConfirmDialog({
88
+ title: t('ShareDiscardChangesModal.title'),
89
+ actions: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
90
+ variant: "secondary",
91
+ label: t('ShareDiscardChangesModal.cancel'),
92
+ className: "u-fz-small",
93
+ onClick: closeConfirmDialog
94
+ }), /*#__PURE__*/React.createElement(Button, {
95
+ variant: "primary",
96
+ label: t('ShareDiscardChangesModal.discard'),
97
+ className: "u-fz-small",
98
+ onClick: function onClick() {
99
+ closeConfirmDialog();
100
+ onClose();
101
+ }
102
+ }))
103
+ });
104
+ }, [closeConfirmDialog, onClose, pendingRecipients.length, showConfirmDialog, t]);
105
+ var documentPermissions = useMemo(function () {
106
+ return existingDocument ? getDocumentPermissions(existingDocument._id) : [];
107
+ }, [existingDocument, getDocumentPermissions]);
70
108
  useEffect(function () {
71
109
  var fetchSharingLink = /*#__PURE__*/function () {
72
110
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
@@ -121,7 +159,7 @@ export var FederatedFolderModal = withLocales(function (_ref) {
121
159
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
122
160
  while (1) switch (_context2.prev = _context2.next) {
123
161
  case 0:
124
- if (!(pendingRecipients.length === 0)) {
162
+ if (!(isSending || pendingRecipients.length === 0)) {
125
163
  _context2.next = 3;
126
164
  break;
127
165
  }
@@ -193,25 +231,61 @@ export var FederatedFolderModal = withLocales(function (_ref) {
193
231
  var modalTitle = t('FederatedFolder.shareTitle', {
194
232
  name: folderName
195
233
  });
196
- var isSharedDrive = Boolean(existingDocument === null || existingDocument === void 0 ? void 0 : existingDocument.driveId);
197
- return /*#__PURE__*/React.createElement(DumbBatchSharedFolderModal, {
234
+ return /*#__PURE__*/React.createElement(FixedDialog, {
235
+ open: true,
236
+ disableGutters: true,
237
+ onClose: handleCloseRequest,
198
238
  title: modalTitle,
199
- document: isSending ? frozenDoc : existingDocument,
200
- recipients: isSending ? frozenRecipients : existingRecipients,
201
- currentRecipients: isSending ? frozenRecipients : existingRecipients,
202
- onRevoke: revoke,
203
- onSend: onSend,
204
- onClose: onClose,
205
- sharingLink: sharingLink,
206
- shareLabel: t('FederatedFolder.share'),
207
- showShareByEmail: !isSharedDrive,
208
- autoOpenShareRestriction: autoOpenShareRestriction,
209
- showGenerateLinkButton: showGenerateLinkButton,
210
- pendingRecipients: pendingRecipients,
211
- onPendingRecipientsChange: setPendingRecipients,
212
- selectedOption: selectedOption,
213
- onSelectedOptionChange: setSelectedOption
239
+ classes: {
240
+ paper: 'u-ov-visible'
241
+ },
242
+ componentsProps: {
243
+ dialogContent: {
244
+ className: 'u-ov-visible'
245
+ }
246
+ },
247
+ content: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
248
+ className: "u-ph-2"
249
+ }, /*#__PURE__*/React.createElement(AntivirusAlert, {
250
+ document: isSending ? frozenDoc : existingDocument
251
+ }), /*#__PURE__*/React.createElement(Typography, {
252
+ variant: "h6",
253
+ className: "u-mt-1-half u-mb-half"
254
+ }, t('Share.contacts.addUsers')), /*#__PURE__*/React.createElement(DumbShareByEmail, {
255
+ currentRecipients: isSending ? frozenRecipients : existingRecipients,
256
+ document: isSending ? frozenDoc : existingDocument,
257
+ documentType: "Files",
258
+ pendingRecipients: pendingRecipients,
259
+ onPendingRecipientsChange: setPendingRecipients,
260
+ selectedOption: selectedOption,
261
+ onSelectedOptionChange: setSelectedOption
262
+ })), /*#__PURE__*/React.createElement(WhoHasAccess, {
263
+ isOwner: true,
264
+ isSharedDrive: true,
265
+ recipients: isSending ? frozenRecipients : existingRecipients,
266
+ document: isSending ? frozenDoc : existingDocument,
267
+ documentType: "Files",
268
+ className: "u-w-100",
269
+ onRevoke: revoke,
270
+ link: sharingLink
271
+ })),
272
+ actions: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ShareByLink, {
273
+ link: sharingLink,
274
+ document: isSending ? frozenDoc : existingDocument,
275
+ documentType: "Files",
276
+ showGenerateLinkButton: showGenerateLinkButton,
277
+ autoOpenShareRestriction: autoOpenShareRestriction
278
+ }), /*#__PURE__*/React.createElement(Button, {
279
+ variant: "primary",
280
+ label: t('FederatedFolder.share'),
281
+ disabled: isSending,
282
+ onClick: onSend
283
+ }))
214
284
  });
285
+ };
286
+
287
+ export var FederatedFolderModal = withLocales(function (props) {
288
+ return /*#__PURE__*/React.createElement(ConfirmDialogProvider, null, /*#__PURE__*/React.createElement(FederatedFolderModalContent, props));
215
289
  });
216
290
  FederatedFolderModal.propTypes = {
217
291
  onClose: PropTypes.func.isRequired,