cozy-sharing 30.1.1 → 30.2.1
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.
- package/CHANGELOG.md +12 -0
- package/dist/components/FederatedFolder/DumbFederatedFolderModal.js +9 -3
- package/dist/components/FederatedFolder/FederatedFolderModal.js +9 -3
- package/dist/components/ShareByLink.js +115 -54
- package/dist/components/ShareDialogCozyToCozy.js +18 -3
- package/dist/components/ShareDialogOnlyByLink.js +6 -2
- package/dist/components/ShareModal/ShareModal.js +6 -5
- package/dist/components/ShareModal.js +13 -3
- package/dist/components/ShareModal.spec.js +4 -4
- package/dist/components/ShareRestrictionModal/ShareRestrictionModal.js +51 -64
- package/dist/components/ShareRestrictionModal/helpers.js +61 -12
- package/dist/components/SharedDrive/DumbSharedDriveModal.js +9 -3
- package/dist/components/SharedDrive/SharedDriveEditModal.js +14 -3
- package/dist/components/SharedFolder/DumbBatchSharedFolderModal.js +12 -4
- package/package.json +2 -2
- package/src/components/FederatedFolder/DumbFederatedFolderModal.jsx +8 -2
- package/src/components/FederatedFolder/FederatedFolderModal.jsx +11 -2
- package/src/components/ShareByLink.jsx +66 -25
- package/src/components/ShareDialogCozyToCozy.jsx +17 -2
- package/src/components/ShareDialogOnlyByLink.jsx +5 -1
- package/src/components/ShareModal/ShareModal.jsx +4 -2
- package/src/components/ShareModal.jsx +10 -0
- package/src/components/ShareModal.spec.js +7 -3
- package/src/components/ShareRestrictionModal/ShareRestrictionModal.jsx +42 -38
- package/src/components/ShareRestrictionModal/helpers.js +23 -4
- package/src/components/SharedDrive/DumbSharedDriveModal.jsx +8 -2
- package/src/components/SharedDrive/SharedDriveEditModal.jsx +20 -2
- package/src/components/SharedFolder/DumbBatchSharedFolderModal.jsx +10 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
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
|
+
## [30.2.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@30.2.0...cozy-sharing@30.2.1) (2026-04-20)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **cozy-sharing:** Preserve user gesture for Safari clipboard writes ([c3e9069](https://github.com/cozy/cozy-libs/commit/c3e9069e250880b9d6640c8ae7529b987af497dc))
|
|
11
|
+
|
|
12
|
+
# [30.2.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@30.1.1...cozy-sharing@30.2.0) (2026-04-20)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- **cozy-sharing:** Add props to tune the link sharing flow ([0bfc1b9](https://github.com/cozy/cozy-libs/commit/0bfc1b9d58c3c8ce709c0ab7057e028f012d6924))
|
|
17
|
+
|
|
6
18
|
## [30.1.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@30.1.0...cozy-sharing@30.1.1) (2026-04-07)
|
|
7
19
|
|
|
8
20
|
**Note:** Version bump only for package cozy-sharing
|
|
@@ -16,7 +16,9 @@ export var DumbFederatedFolderModal = withLocales(function (_ref) {
|
|
|
16
16
|
onClose = _ref.onClose,
|
|
17
17
|
onShare = _ref.onShare,
|
|
18
18
|
sharingLink = _ref.sharingLink,
|
|
19
|
-
showShareByEmail = _ref.showShareByEmail
|
|
19
|
+
showShareByEmail = _ref.showShareByEmail,
|
|
20
|
+
autoOpenShareRestriction = _ref.autoOpenShareRestriction,
|
|
21
|
+
showGenerateLinkButton = _ref.showGenerateLinkButton;
|
|
20
22
|
|
|
21
23
|
var _useI18n = useI18n(),
|
|
22
24
|
t = _useI18n.t;
|
|
@@ -38,7 +40,9 @@ export var DumbFederatedFolderModal = withLocales(function (_ref) {
|
|
|
38
40
|
addPeopleLabel: t('FederatedFolder.addPeople'),
|
|
39
41
|
addButtonLabel: t('FederatedFolder.add'),
|
|
40
42
|
shareLabel: t('FederatedFolder.share'),
|
|
41
|
-
showShareByEmail: showShareByEmail
|
|
43
|
+
showShareByEmail: showShareByEmail,
|
|
44
|
+
autoOpenShareRestriction: autoOpenShareRestriction,
|
|
45
|
+
showGenerateLinkButton: showGenerateLinkButton
|
|
42
46
|
});
|
|
43
47
|
});
|
|
44
48
|
DumbFederatedFolderModal.propTypes = {
|
|
@@ -54,6 +58,8 @@ DumbFederatedFolderModal.propTypes = {
|
|
|
54
58
|
onClose: PropTypes.func.isRequired,
|
|
55
59
|
onShare: PropTypes.func.isRequired,
|
|
56
60
|
sharingLink: PropTypes.string,
|
|
57
|
-
showShareByEmail: PropTypes.bool
|
|
61
|
+
showShareByEmail: PropTypes.bool,
|
|
62
|
+
autoOpenShareRestriction: PropTypes.bool,
|
|
63
|
+
showGenerateLinkButton: PropTypes.bool
|
|
58
64
|
};
|
|
59
65
|
export default DumbFederatedFolderModal;
|
|
@@ -13,7 +13,9 @@ import { useSharingContext } from '../../hooks/useSharingContext';
|
|
|
13
13
|
import { formatRecipients, mergeAndDeduplicateRecipients, moveRecipientToReadWrite, moveRecipientToReadOnly, RECIPIENT_INDEX_PREFIX } from '../SharedDrive/helpers';
|
|
14
14
|
export var FederatedFolderModal = withLocales(function (_ref) {
|
|
15
15
|
var onClose = _ref.onClose,
|
|
16
|
-
existingDocument = _ref.document
|
|
16
|
+
existingDocument = _ref.document,
|
|
17
|
+
autoOpenShareRestriction = _ref.autoOpenShareRestriction,
|
|
18
|
+
showGenerateLinkButton = _ref.showGenerateLinkButton;
|
|
17
19
|
var client = useClient();
|
|
18
20
|
|
|
19
21
|
var _useI18n = useI18n(),
|
|
@@ -230,11 +232,15 @@ export var FederatedFolderModal = withLocales(function (_ref) {
|
|
|
230
232
|
onClose: onClose,
|
|
231
233
|
onShare: onShare,
|
|
232
234
|
sharingLink: sharingLink,
|
|
233
|
-
showShareByEmail: !isSharedDrive
|
|
235
|
+
showShareByEmail: !isSharedDrive,
|
|
236
|
+
autoOpenShareRestriction: autoOpenShareRestriction,
|
|
237
|
+
showGenerateLinkButton: showGenerateLinkButton
|
|
234
238
|
});
|
|
235
239
|
});
|
|
236
240
|
FederatedFolderModal.propTypes = {
|
|
237
241
|
onClose: PropTypes.func.isRequired,
|
|
238
|
-
document: PropTypes.object.isRequired
|
|
242
|
+
document: PropTypes.object.isRequired,
|
|
243
|
+
autoOpenShareRestriction: PropTypes.bool,
|
|
244
|
+
showGenerateLinkButton: PropTypes.bool
|
|
239
245
|
};
|
|
240
246
|
export default FederatedFolderModal;
|
|
@@ -21,7 +21,11 @@ var ShareByLink = function ShareByLink(_ref) {
|
|
|
21
21
|
|
|
22
22
|
var link = _ref.link,
|
|
23
23
|
document = _ref.document,
|
|
24
|
-
documentType = _ref.documentType
|
|
24
|
+
documentType = _ref.documentType,
|
|
25
|
+
_ref$showGenerateLink = _ref.showGenerateLinkButton,
|
|
26
|
+
showGenerateLinkButton = _ref$showGenerateLink === void 0 ? false : _ref$showGenerateLink,
|
|
27
|
+
_ref$autoOpenShareRes = _ref.autoOpenShareRestriction,
|
|
28
|
+
autoOpenShareRestriction = _ref$autoOpenShareRes === void 0 ? false : _ref$autoOpenShareRes;
|
|
25
29
|
|
|
26
30
|
var _useI18n = useI18n(),
|
|
27
31
|
t = _useI18n.t;
|
|
@@ -45,8 +49,9 @@ var ShareByLink = function ShareByLink(_ref) {
|
|
|
45
49
|
setIsGenerating = _useState2[1];
|
|
46
50
|
|
|
47
51
|
var canShare = typeof ((_navigator = navigator) === null || _navigator === void 0 ? void 0 : _navigator.share) === 'function';
|
|
48
|
-
var
|
|
49
|
-
var
|
|
52
|
+
var showGenerateButton = showGenerateLinkButton && !link;
|
|
53
|
+
var showCopyAndSendButtons = !showGenerateButton && isMobile && canShare;
|
|
54
|
+
var showOnlyCopyButton = !showGenerateButton && (!isMobile || !canShare);
|
|
50
55
|
var isFederated = flag('drive.federated-shared-folder.enabled');
|
|
51
56
|
|
|
52
57
|
var _useReducer = useReducer(function (state) {
|
|
@@ -56,6 +61,14 @@ var ShareByLink = function ShareByLink(_ref) {
|
|
|
56
61
|
isEditDialogOpen = _useReducer2[0],
|
|
57
62
|
toggleEditDialogOpen = _useReducer2[1];
|
|
58
63
|
|
|
64
|
+
var showGenericError = function showGenericError() {
|
|
65
|
+
showAlert({
|
|
66
|
+
message: t("".concat(documentType, ".share.error.generic")),
|
|
67
|
+
severity: 'error',
|
|
68
|
+
variant: 'filled'
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
|
|
59
72
|
var handleGenerateLink = /*#__PURE__*/function () {
|
|
60
73
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
61
74
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
@@ -105,45 +118,53 @@ var ShareByLink = function ShareByLink(_ref) {
|
|
|
105
118
|
|
|
106
119
|
var generateLinkAndCopyLinkToClipboard = /*#__PURE__*/function () {
|
|
107
120
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
108
|
-
var
|
|
121
|
+
var generatedLink;
|
|
109
122
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
110
123
|
while (1) switch (_context2.prev = _context2.next) {
|
|
111
124
|
case 0:
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
if (linkToCopy) {
|
|
115
|
-
_context2.next = 5;
|
|
125
|
+
if (!link) {
|
|
126
|
+
_context2.next = 4;
|
|
116
127
|
break;
|
|
117
128
|
}
|
|
118
129
|
|
|
119
|
-
_context2.next =
|
|
120
|
-
return
|
|
130
|
+
_context2.next = 3;
|
|
131
|
+
return copyToClipboard(link, {
|
|
132
|
+
t: t,
|
|
133
|
+
showAlert: showAlert
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
case 3:
|
|
137
|
+
return _context2.abrupt("return");
|
|
121
138
|
|
|
122
139
|
case 4:
|
|
123
|
-
|
|
140
|
+
// Safari: the clipboard API must be invoked synchronously within the
|
|
141
|
+
// click handler, so we pass the pending link to `copyToClipboard`.
|
|
142
|
+
// The resolved URL is captured here so we can branch on success after
|
|
143
|
+
// the copy has completed, without re-awaiting the promise.
|
|
144
|
+
generatedLink = null;
|
|
145
|
+
_context2.next = 7;
|
|
146
|
+
return copyToClipboard(handleGenerateLink().then(function (generated) {
|
|
147
|
+
generatedLink = generated;
|
|
148
|
+
if (!generated) throw new Error('link-generation-failed');
|
|
149
|
+
return generated;
|
|
150
|
+
}), {
|
|
151
|
+
t: t,
|
|
152
|
+
showAlert: showAlert
|
|
153
|
+
});
|
|
124
154
|
|
|
125
|
-
case
|
|
126
|
-
if (
|
|
155
|
+
case 7:
|
|
156
|
+
if (generatedLink) {
|
|
127
157
|
_context2.next = 10;
|
|
128
158
|
break;
|
|
129
159
|
}
|
|
130
160
|
|
|
131
|
-
|
|
132
|
-
return
|
|
133
|
-
t: t,
|
|
134
|
-
showAlert: showAlert
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
case 8:
|
|
138
|
-
_context2.next = 11;
|
|
139
|
-
break;
|
|
161
|
+
showGenericError();
|
|
162
|
+
return _context2.abrupt("return");
|
|
140
163
|
|
|
141
164
|
case 10:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
variant: 'filled'
|
|
146
|
-
});
|
|
165
|
+
if (autoOpenShareRestriction) {
|
|
166
|
+
toggleEditDialogOpen();
|
|
167
|
+
}
|
|
147
168
|
|
|
148
169
|
case 11:
|
|
149
170
|
case "end":
|
|
@@ -157,75 +178,104 @@ var ShareByLink = function ShareByLink(_ref) {
|
|
|
157
178
|
};
|
|
158
179
|
}();
|
|
159
180
|
|
|
160
|
-
var
|
|
181
|
+
var generateLinkSilently = /*#__PURE__*/function () {
|
|
161
182
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
162
|
-
var
|
|
183
|
+
var generated;
|
|
163
184
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
164
185
|
while (1) switch (_context3.prev = _context3.next) {
|
|
186
|
+
case 0:
|
|
187
|
+
_context3.next = 2;
|
|
188
|
+
return handleGenerateLink();
|
|
189
|
+
|
|
190
|
+
case 2:
|
|
191
|
+
generated = _context3.sent;
|
|
192
|
+
|
|
193
|
+
if (generated) {
|
|
194
|
+
_context3.next = 6;
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
showGenericError();
|
|
199
|
+
return _context3.abrupt("return");
|
|
200
|
+
|
|
201
|
+
case 6:
|
|
202
|
+
if (autoOpenShareRestriction) {
|
|
203
|
+
toggleEditDialogOpen();
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
case 7:
|
|
207
|
+
case "end":
|
|
208
|
+
return _context3.stop();
|
|
209
|
+
}
|
|
210
|
+
}, _callee3);
|
|
211
|
+
}));
|
|
212
|
+
|
|
213
|
+
return function generateLinkSilently() {
|
|
214
|
+
return _ref4.apply(this, arguments);
|
|
215
|
+
};
|
|
216
|
+
}();
|
|
217
|
+
|
|
218
|
+
var shareLink = /*#__PURE__*/function () {
|
|
219
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
220
|
+
var linkToShare, shareData;
|
|
221
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
222
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
165
223
|
case 0:
|
|
166
224
|
linkToShare = link;
|
|
167
225
|
|
|
168
226
|
if (linkToShare) {
|
|
169
|
-
|
|
227
|
+
_context4.next = 5;
|
|
170
228
|
break;
|
|
171
229
|
}
|
|
172
230
|
|
|
173
|
-
|
|
231
|
+
_context4.next = 4;
|
|
174
232
|
return handleGenerateLink();
|
|
175
233
|
|
|
176
234
|
case 4:
|
|
177
|
-
linkToShare =
|
|
235
|
+
linkToShare = _context4.sent;
|
|
178
236
|
|
|
179
237
|
case 5:
|
|
180
238
|
if (linkToShare) {
|
|
181
|
-
|
|
239
|
+
_context4.next = 8;
|
|
182
240
|
break;
|
|
183
241
|
}
|
|
184
242
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
severity: 'error',
|
|
188
|
-
variant: 'filled'
|
|
189
|
-
});
|
|
190
|
-
return _context3.abrupt("return");
|
|
243
|
+
showGenericError();
|
|
244
|
+
return _context4.abrupt("return");
|
|
191
245
|
|
|
192
246
|
case 8:
|
|
193
|
-
|
|
247
|
+
_context4.prev = 8;
|
|
194
248
|
shareData = {
|
|
195
249
|
text: t("".concat(documentType, ".share.shareByLink.shareDescription"), {
|
|
196
250
|
name: document.name || ''
|
|
197
251
|
}),
|
|
198
252
|
url: linkToShare
|
|
199
253
|
};
|
|
200
|
-
|
|
254
|
+
_context4.next = 12;
|
|
201
255
|
return navigator.share(shareData);
|
|
202
256
|
|
|
203
257
|
case 12:
|
|
204
|
-
|
|
258
|
+
_context4.next = 17;
|
|
205
259
|
break;
|
|
206
260
|
|
|
207
261
|
case 14:
|
|
208
|
-
|
|
209
|
-
|
|
262
|
+
_context4.prev = 14;
|
|
263
|
+
_context4.t0 = _context4["catch"](8);
|
|
210
264
|
|
|
211
265
|
// Don't show error when user cancels the share dialog
|
|
212
|
-
if (
|
|
213
|
-
|
|
214
|
-
message: t("".concat(documentType, ".share.error.generic")),
|
|
215
|
-
severity: 'error',
|
|
216
|
-
variant: 'filled'
|
|
217
|
-
});
|
|
266
|
+
if (_context4.t0.name !== 'AbortError') {
|
|
267
|
+
showGenericError();
|
|
218
268
|
}
|
|
219
269
|
|
|
220
270
|
case 17:
|
|
221
271
|
case "end":
|
|
222
|
-
return
|
|
272
|
+
return _context4.stop();
|
|
223
273
|
}
|
|
224
|
-
},
|
|
274
|
+
}, _callee4, null, [[8, 14]]);
|
|
225
275
|
}));
|
|
226
276
|
|
|
227
277
|
return function shareLink() {
|
|
228
|
-
return
|
|
278
|
+
return _ref5.apply(this, arguments);
|
|
229
279
|
};
|
|
230
280
|
}();
|
|
231
281
|
|
|
@@ -257,6 +307,15 @@ var ShareByLink = function ShareByLink(_ref) {
|
|
|
257
307
|
}),
|
|
258
308
|
onClick: generateLinkAndCopyLinkToClipboard,
|
|
259
309
|
busy: isGenerating
|
|
310
|
+
}), showGenerateButton && /*#__PURE__*/React.createElement(Button, {
|
|
311
|
+
label: t("".concat(documentType, ".share.shareByLink.create")),
|
|
312
|
+
variant: "secondary",
|
|
313
|
+
size: "medium",
|
|
314
|
+
startIcon: /*#__PURE__*/React.createElement(Icon, {
|
|
315
|
+
icon: LinkIcon
|
|
316
|
+
}),
|
|
317
|
+
onClick: generateLinkSilently,
|
|
318
|
+
busy: isGenerating
|
|
260
319
|
}), isEditDialogOpen && /*#__PURE__*/React.createElement(ShareRestrictionModal, {
|
|
261
320
|
file: document,
|
|
262
321
|
onClose: toggleEditDialogOpen
|
|
@@ -266,6 +325,8 @@ var ShareByLink = function ShareByLink(_ref) {
|
|
|
266
325
|
ShareByLink.propTypes = {
|
|
267
326
|
link: PropTypes.string,
|
|
268
327
|
document: PropTypes.object.isRequired,
|
|
269
|
-
documentType: PropTypes.string.isRequired
|
|
328
|
+
documentType: PropTypes.string.isRequired,
|
|
329
|
+
showGenerateLinkButton: PropTypes.bool,
|
|
330
|
+
autoOpenShareRestriction: PropTypes.bool
|
|
270
331
|
};
|
|
271
332
|
export default ShareByLink;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["showShareByLink", "documentType", "document"];
|
|
3
|
+
var _excluded = ["showShareByLink", "showGenerateLinkButton", "autoOpenShareRestriction", "documentType", "document"];
|
|
4
4
|
import cx from 'classnames';
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
6
|
import Typography from 'cozy-ui/transpiled/react/Typography';
|
|
7
7
|
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints';
|
|
8
8
|
import { useI18n } from 'twake-i18n';
|
|
@@ -125,15 +125,30 @@ var SharingTitleFunction = function SharingTitleFunction(_ref2) {
|
|
|
125
125
|
|
|
126
126
|
var ShareDialogCozyToCozy = function ShareDialogCozyToCozy(_ref3) {
|
|
127
127
|
var showShareByLink = _ref3.showShareByLink,
|
|
128
|
+
showGenerateLinkButton = _ref3.showGenerateLinkButton,
|
|
129
|
+
autoOpenShareRestriction = _ref3.autoOpenShareRestriction,
|
|
128
130
|
documentType = _ref3.documentType,
|
|
129
131
|
document = _ref3.document,
|
|
130
132
|
props = _objectWithoutProperties(_ref3, _excluded);
|
|
131
133
|
|
|
134
|
+
var dialogActionsOnShare = useMemo(function () {
|
|
135
|
+
if (!showShareByLink) return null;
|
|
136
|
+
|
|
137
|
+
var BoundShareByLink = function BoundShareByLink(dialogActionProps) {
|
|
138
|
+
return /*#__PURE__*/React.createElement(DumbShareByLink, _extends({}, dialogActionProps, {
|
|
139
|
+
showGenerateLinkButton: showGenerateLinkButton,
|
|
140
|
+
autoOpenShareRestriction: autoOpenShareRestriction
|
|
141
|
+
}));
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
BoundShareByLink.displayName = 'BoundShareByLink';
|
|
145
|
+
return BoundShareByLink;
|
|
146
|
+
}, [showShareByLink, showGenerateLinkButton, autoOpenShareRestriction]);
|
|
132
147
|
return /*#__PURE__*/React.createElement(ShareDialogTwoStepsConfirmationContainer, _extends({}, props, {
|
|
133
148
|
documentType: documentType,
|
|
134
149
|
document: document,
|
|
135
150
|
dialogContentOnShare: SharingContent,
|
|
136
|
-
dialogActionsOnShare:
|
|
151
|
+
dialogActionsOnShare: dialogActionsOnShare,
|
|
137
152
|
dialogTitleOnShare: SharingTitleFunction({
|
|
138
153
|
documentType: documentType,
|
|
139
154
|
document: document
|
|
@@ -17,7 +17,9 @@ var ShareDialogOnlyByLink = function ShareDialogOnlyByLink(_ref) {
|
|
|
17
17
|
documentType = _ref.documentType,
|
|
18
18
|
link = _ref.link,
|
|
19
19
|
onClose = _ref.onClose,
|
|
20
|
-
permissions = _ref.permissions
|
|
20
|
+
permissions = _ref.permissions,
|
|
21
|
+
showGenerateLinkButton = _ref.showGenerateLinkButton,
|
|
22
|
+
autoOpenShareRestriction = _ref.autoOpenShareRestriction;
|
|
21
23
|
|
|
22
24
|
var _useI18n = useI18n(),
|
|
23
25
|
t = _useI18n.t;
|
|
@@ -52,7 +54,9 @@ var ShareDialogOnlyByLink = function ShareDialogOnlyByLink(_ref) {
|
|
|
52
54
|
}, /*#__PURE__*/React.createElement(DumbShareByLink, {
|
|
53
55
|
link: link,
|
|
54
56
|
document: document,
|
|
55
|
-
documentType: documentType
|
|
57
|
+
documentType: documentType,
|
|
58
|
+
showGenerateLinkButton: showGenerateLinkButton,
|
|
59
|
+
autoOpenShareRestriction: autoOpenShareRestriction
|
|
56
60
|
})))
|
|
57
61
|
});
|
|
58
62
|
};
|
|
@@ -61,10 +61,9 @@ export var ShareModal = withLocales(function (props) {
|
|
|
61
61
|
var isFederatedMode = flag('drive.federated-shared-folder.enabled');
|
|
62
62
|
|
|
63
63
|
if (isFederatedMode && allLoaded) {
|
|
64
|
-
return /*#__PURE__*/React.createElement(FederatedFolderModal, {
|
|
65
|
-
document: document
|
|
66
|
-
|
|
67
|
-
});
|
|
64
|
+
return /*#__PURE__*/React.createElement(FederatedFolderModal, _extends({
|
|
65
|
+
document: document
|
|
66
|
+
}, rest));
|
|
68
67
|
}
|
|
69
68
|
|
|
70
69
|
var isEditable = !byDocId[document.id] || isOwner(document.id) || canReshare(document.id);
|
|
@@ -86,6 +85,8 @@ export var ShareModal = withLocales(function (props) {
|
|
|
86
85
|
}, rest));
|
|
87
86
|
});
|
|
88
87
|
ShareModal.propTypes = {
|
|
88
|
+
autoOpenShareRestriction: PropTypes.bool,
|
|
89
89
|
document: PropTypes.object.isRequired,
|
|
90
|
-
onRevokeSuccess: PropTypes.func
|
|
90
|
+
onRevokeSuccess: PropTypes.func,
|
|
91
|
+
showGenerateLinkButton: PropTypes.bool
|
|
91
92
|
};
|
|
@@ -5,7 +5,8 @@ import ShareDialogCozyToCozy from './ShareDialogCozyToCozy';
|
|
|
5
5
|
import ShareDialogOnlyByLink from './ShareDialogOnlyByLink';
|
|
6
6
|
import { SharedDriveEditModal } from './SharedDrive/SharedDriveEditModal';
|
|
7
7
|
export var ShareModal = function ShareModal(_ref) {
|
|
8
|
-
var
|
|
8
|
+
var autoOpenShareRestriction = _ref.autoOpenShareRestriction,
|
|
9
|
+
createContact = _ref.createContact,
|
|
9
10
|
document = _ref.document,
|
|
10
11
|
_ref$documentType = _ref.documentType,
|
|
11
12
|
documentType = _ref$documentType === void 0 ? 'Document' : _ref$documentType,
|
|
@@ -22,6 +23,7 @@ export var ShareModal = function ShareModal(_ref) {
|
|
|
22
23
|
recipients = _ref.recipients,
|
|
23
24
|
sharing = _ref.sharing,
|
|
24
25
|
sharingDesc = _ref.sharingDesc,
|
|
26
|
+
showGenerateLinkButton = _ref.showGenerateLinkButton,
|
|
25
27
|
twoStepsConfirmationMethods = _ref.twoStepsConfirmationMethods;
|
|
26
28
|
|
|
27
29
|
if (isSharedDrive && !flag('drive.federated-shared-folder.enabled')) {
|
|
@@ -31,7 +33,9 @@ export var ShareModal = function ShareModal(_ref) {
|
|
|
31
33
|
recipients: recipients,
|
|
32
34
|
onShare: onShare,
|
|
33
35
|
onRevoke: onRevoke,
|
|
34
|
-
onClose: onClose
|
|
36
|
+
onClose: onClose,
|
|
37
|
+
autoOpenShareRestriction: autoOpenShareRestriction,
|
|
38
|
+
showGenerateLinkButton: showGenerateLinkButton
|
|
35
39
|
});
|
|
36
40
|
}
|
|
37
41
|
|
|
@@ -49,7 +53,9 @@ export var ShareModal = function ShareModal(_ref) {
|
|
|
49
53
|
documentType: documentType,
|
|
50
54
|
link: link,
|
|
51
55
|
onClose: onClose,
|
|
52
|
-
permissions: permissions
|
|
56
|
+
permissions: permissions,
|
|
57
|
+
showGenerateLinkButton: showGenerateLinkButton,
|
|
58
|
+
autoOpenShareRestriction: autoOpenShareRestriction
|
|
53
59
|
}) : /*#__PURE__*/React.createElement(ShareDialogCozyToCozy, {
|
|
54
60
|
createContact: createContact,
|
|
55
61
|
document: document,
|
|
@@ -69,11 +75,14 @@ export var ShareModal = function ShareModal(_ref) {
|
|
|
69
75
|
showShareByLink: showShareByLink,
|
|
70
76
|
showShareOnlyByLink: showShareOnlyByLink,
|
|
71
77
|
showWhoHasAccess: showWhoHasAccess,
|
|
78
|
+
showGenerateLinkButton: showGenerateLinkButton,
|
|
79
|
+
autoOpenShareRestriction: autoOpenShareRestriction,
|
|
72
80
|
twoStepsConfirmationMethods: twoStepsConfirmationMethods
|
|
73
81
|
});
|
|
74
82
|
};
|
|
75
83
|
export default ShareModal;
|
|
76
84
|
ShareModal.propTypes = {
|
|
85
|
+
autoOpenShareRestriction: PropTypes.bool,
|
|
77
86
|
createContact: PropTypes.func.isRequired,
|
|
78
87
|
document: PropTypes.object.isRequired,
|
|
79
88
|
documentType: PropTypes.string,
|
|
@@ -87,6 +96,7 @@ ShareModal.propTypes = {
|
|
|
87
96
|
permissions: PropTypes.array.isRequired,
|
|
88
97
|
recipients: PropTypes.array.isRequired,
|
|
89
98
|
sharingDesc: PropTypes.string,
|
|
99
|
+
showGenerateLinkButton: PropTypes.bool,
|
|
90
100
|
twoStepsConfirmationMethods: PropTypes.shape({
|
|
91
101
|
getRecipientsToBeConfirmed: PropTypes.func,
|
|
92
102
|
confirmRecipient: PropTypes.func,
|
|
@@ -5,12 +5,12 @@ import { ShareModal } from './ShareModal';
|
|
|
5
5
|
import AppLike from '../../test/AppLike';
|
|
6
6
|
jest.mock('./ShareDialogCozyToCozy', function () {
|
|
7
7
|
return function () {
|
|
8
|
-
return /*#__PURE__*/React.createElement(
|
|
8
|
+
return /*#__PURE__*/React.createElement("div", null, "ShareDialogCozyToCozy");
|
|
9
9
|
};
|
|
10
10
|
});
|
|
11
11
|
jest.mock('./ShareDialogOnlyByLink', function () {
|
|
12
12
|
return function () {
|
|
13
|
-
return /*#__PURE__*/React.createElement(
|
|
13
|
+
return /*#__PURE__*/React.createElement("div", null, "ShareDialogOnlyByLink");
|
|
14
14
|
};
|
|
15
15
|
});
|
|
16
16
|
jest.mock('cozy-flags');
|
|
@@ -43,8 +43,8 @@ describe('ShareModal component', function () {
|
|
|
43
43
|
expect(root.getByText('ShareDialogCozyToCozy'));
|
|
44
44
|
});
|
|
45
45
|
it('should render ShareDialogOnlyByLink if flag cozy.hide-sharing-cozy-to-cozy is true', function () {
|
|
46
|
-
flag.mockImplementation(function () {
|
|
47
|
-
return
|
|
46
|
+
flag.mockImplementation(function (name) {
|
|
47
|
+
return name === 'cozy.hide-sharing-cozy-to-cozy';
|
|
48
48
|
});
|
|
49
49
|
var root = setup({
|
|
50
50
|
documentType: 'Document'
|