cozy-sharing 11.1.0 → 12.1.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.
- package/.storybook/preview.jsx +11 -5
- package/CHANGELOG.md +29 -0
- package/dist/SharingProvider.js +111 -62
- package/dist/components/ConfirmTrustedRecipientsDialog.js +11 -3
- package/dist/components/ConfirmTrustedRecipientsDialog.stories.js +39 -0
- package/dist/components/Recipient/GroupRecipient.js +36 -5
- package/dist/components/Recipient/GroupRecipient.stories.js +3 -2
- package/dist/components/Recipient/GroupRecipientDetail.js +43 -0
- package/dist/components/Recipient/GroupRecipientDetail.stories.js +55 -0
- package/dist/components/Recipient/GroupRecipientDetailWithAccess.js +44 -0
- package/dist/components/Recipient/GroupRecipientDetailWithoutAccess.js +45 -0
- package/dist/components/Recipient/GroupRecipientPermissions.js +70 -8
- package/dist/components/Recipient/LinkRecipient.js +5 -1
- package/dist/components/Recipient/MemberRecipient.js +5 -1
- package/dist/components/Recipient/RecipientList.stories.js +3 -0
- package/dist/components/Recipient/actions/permission.js +4 -7
- package/dist/components/ShareDialogCozyToCozy.js +9 -3
- package/dist/components/ShareDialogOnlyByLink.js +12 -4
- package/dist/components/ShareDialogTwoStepsConfirmationContainer.js +1 -0
- package/dist/components/ShareModal/SharingDetailsModal.js +7 -1
- package/dist/components/WhoHasAccess.js +1 -3
- package/dist/state.js +27 -0
- package/locales/en.json +13 -0
- package/locales/fr.json +13 -0
- package/package.json +5 -5
- package/src/SharingProvider.jsx +15 -0
- package/src/components/ConfirmTrustedRecipientsDialog.jsx +24 -13
- package/src/components/ConfirmTrustedRecipientsDialog.stories.jsx +45 -0
- package/src/components/Recipient/GroupRecipient.jsx +51 -24
- package/src/components/Recipient/GroupRecipient.stories.jsx +3 -2
- package/src/components/Recipient/GroupRecipientDetail.jsx +50 -0
- package/src/components/Recipient/GroupRecipientDetail.stories.jsx +53 -0
- package/src/components/Recipient/GroupRecipientDetailWithAccess.jsx +57 -0
- package/src/components/Recipient/GroupRecipientDetailWithoutAccess.jsx +60 -0
- package/src/components/Recipient/GroupRecipientPermissions.jsx +35 -6
- package/src/components/Recipient/LinkRecipient.jsx +3 -1
- package/src/components/Recipient/MemberRecipient.jsx +3 -1
- package/src/components/Recipient/RecipientList.stories.jsx +3 -0
- package/src/components/Recipient/actions/permission.js +3 -6
- package/src/components/ShareDialogCozyToCozy.jsx +40 -36
- package/src/components/ShareDialogOnlyByLink.jsx +22 -8
- package/src/components/ShareDialogTwoStepsConfirmationContainer.jsx +1 -0
- package/src/components/ShareModal/SharingDetailsModal.jsx +10 -1
- package/src/components/WhoHasAccess.jsx +1 -1
- package/src/state.js +28 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Avatar from 'cozy-ui/transpiled/react/Avatar';
|
|
3
|
+
import Icon from 'cozy-ui/transpiled/react/Icon';
|
|
4
|
+
import ToTheCloudIcon from 'cozy-ui/transpiled/react/Icons/ToTheCloud';
|
|
5
|
+
import List from 'cozy-ui/transpiled/react/List';
|
|
6
|
+
import ListItem from 'cozy-ui/transpiled/react/ListItem';
|
|
7
|
+
import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon';
|
|
8
|
+
import ListItemText from 'cozy-ui/transpiled/react/ListItemText';
|
|
9
|
+
import Typography from 'cozy-ui/transpiled/react/Typography';
|
|
10
|
+
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
|
|
11
|
+
import { getInitials, getDisplayName } from '../../models';
|
|
12
|
+
|
|
13
|
+
var GroupRecipientDetailWithAccess = function GroupRecipientDetailWithAccess(_ref) {
|
|
14
|
+
var withAccess = _ref.withAccess;
|
|
15
|
+
|
|
16
|
+
var _useI18n = useI18n(),
|
|
17
|
+
t = _useI18n.t;
|
|
18
|
+
|
|
19
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Typography, {
|
|
20
|
+
variant: "subtitle2"
|
|
21
|
+
}, t('GroupRecipientDetail.withAccess.title')), /*#__PURE__*/React.createElement(List, null, withAccess.map(function (recipient) {
|
|
22
|
+
var name = getDisplayName(recipient);
|
|
23
|
+
return /*#__PURE__*/React.createElement(ListItem, {
|
|
24
|
+
disableGutters: true,
|
|
25
|
+
key: recipient.index
|
|
26
|
+
}, /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(Avatar, {
|
|
27
|
+
text: getInitials(recipient),
|
|
28
|
+
textId: name
|
|
29
|
+
})), /*#__PURE__*/React.createElement(ListItemText, {
|
|
30
|
+
primary: name,
|
|
31
|
+
secondary: recipient.instance ? /*#__PURE__*/React.createElement("div", {
|
|
32
|
+
className: "u-flex u-flex-items-center"
|
|
33
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
34
|
+
icon: ToTheCloudIcon,
|
|
35
|
+
size: 10,
|
|
36
|
+
style: {
|
|
37
|
+
marginRight: '0.25rem'
|
|
38
|
+
}
|
|
39
|
+
}), recipient.instance) : null
|
|
40
|
+
}));
|
|
41
|
+
})));
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { GroupRecipientDetailWithAccess };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Avatar from 'cozy-ui/transpiled/react/Avatar';
|
|
3
|
+
import Icon from 'cozy-ui/transpiled/react/Icon';
|
|
4
|
+
import ForbiddenIcon from 'cozy-ui/transpiled/react/Icons/Forbidden';
|
|
5
|
+
import List from 'cozy-ui/transpiled/react/List';
|
|
6
|
+
import ListItem from 'cozy-ui/transpiled/react/ListItem';
|
|
7
|
+
import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon';
|
|
8
|
+
import ListItemText from 'cozy-ui/transpiled/react/ListItemText';
|
|
9
|
+
import Typography from 'cozy-ui/transpiled/react/Typography';
|
|
10
|
+
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
|
|
11
|
+
import { getInitials, getDisplayName } from '../../models';
|
|
12
|
+
|
|
13
|
+
var GroupRecipientDetailWithoutAccess = function GroupRecipientDetailWithoutAccess(_ref) {
|
|
14
|
+
var withoutAccess = _ref.withoutAccess;
|
|
15
|
+
|
|
16
|
+
var _useI18n = useI18n(),
|
|
17
|
+
t = _useI18n.t;
|
|
18
|
+
|
|
19
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Typography, {
|
|
20
|
+
variant: "subtitle2"
|
|
21
|
+
}, t('GroupRecipientDetail.withoutAccess.title')), /*#__PURE__*/React.createElement(List, null, withoutAccess.map(function (recipient) {
|
|
22
|
+
var icon = recipient.status === 'revoked' ? ForbiddenIcon : null;
|
|
23
|
+
var name = getDisplayName(recipient);
|
|
24
|
+
return /*#__PURE__*/React.createElement(ListItem, {
|
|
25
|
+
disableGutters: true,
|
|
26
|
+
key: recipient.index
|
|
27
|
+
}, /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(Avatar, {
|
|
28
|
+
text: getInitials(recipient),
|
|
29
|
+
textId: name
|
|
30
|
+
})), /*#__PURE__*/React.createElement(ListItemText, {
|
|
31
|
+
primary: name,
|
|
32
|
+
secondary: /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
className: "u-flex u-flex-items-center"
|
|
34
|
+
}, icon ? /*#__PURE__*/React.createElement(Icon, {
|
|
35
|
+
icon: icon,
|
|
36
|
+
size: 10,
|
|
37
|
+
style: {
|
|
38
|
+
marginRight: '0.25rem'
|
|
39
|
+
}
|
|
40
|
+
}) : null, t("GroupRecipientDetail.withoutAccess.status.".concat(recipient.status)))
|
|
41
|
+
}));
|
|
42
|
+
})));
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { GroupRecipientDetailWithoutAccess };
|
|
@@ -1,16 +1,27 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
4
|
import React, { useState, useRef } from 'react';
|
|
3
5
|
import { useClient } from 'cozy-client';
|
|
4
6
|
import ActionsMenu from 'cozy-ui/transpiled/react/ActionsMenu';
|
|
5
7
|
import { makeActions, divider } from 'cozy-ui/transpiled/react/ActionsMenu/Actions';
|
|
8
|
+
import ActionsMenuMobileHeader from 'cozy-ui/transpiled/react/ActionsMenu/ActionsMenuMobileHeader';
|
|
6
9
|
import DropdownButton from 'cozy-ui/transpiled/react/DropdownButton';
|
|
10
|
+
import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon';
|
|
11
|
+
import ListItemText from 'cozy-ui/transpiled/react/ListItemText';
|
|
12
|
+
import Spinner from 'cozy-ui/transpiled/react/Spinner';
|
|
7
13
|
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
|
|
8
14
|
import { permission } from './actions/permission';
|
|
9
|
-
import { revokeGroup } from './actions/revokeGroup';
|
|
15
|
+
import { revokeGroup as revokeGroupAction } from './actions/revokeGroup';
|
|
16
|
+
import { useSharingContext } from '../../hooks/useSharingContext';
|
|
17
|
+
import { GroupAvatar } from '../Avatar/GroupAvatar';
|
|
10
18
|
|
|
11
19
|
var GroupRecipientPermissions = function GroupRecipientPermissions(_ref) {
|
|
12
|
-
var
|
|
20
|
+
var name = _ref.name,
|
|
21
|
+
isOwner = _ref.isOwner,
|
|
13
22
|
instance = _ref.instance,
|
|
23
|
+
sharingId = _ref.sharingId,
|
|
24
|
+
groupIndex = _ref.groupIndex,
|
|
14
25
|
_ref$read_only = _ref.read_only,
|
|
15
26
|
isReadOnly = _ref$read_only === void 0 ? false : _ref$read_only,
|
|
16
27
|
className = _ref.className;
|
|
@@ -21,13 +32,22 @@ var GroupRecipientPermissions = function GroupRecipientPermissions(_ref) {
|
|
|
21
32
|
var buttonRef = useRef();
|
|
22
33
|
var client = useClient();
|
|
23
34
|
|
|
35
|
+
var _useSharingContext = useSharingContext(),
|
|
36
|
+
revokeGroup = _useSharingContext.revokeGroup,
|
|
37
|
+
revokeSelf = _useSharingContext.revokeSelf;
|
|
38
|
+
|
|
24
39
|
var _useState = useState(false),
|
|
25
40
|
_useState2 = _slicedToArray(_useState, 2),
|
|
26
41
|
isMenuDisplayed = _useState2[0],
|
|
27
42
|
setMenuDisplayed = _useState2[1];
|
|
28
43
|
|
|
44
|
+
var _useState3 = useState(false),
|
|
45
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
46
|
+
revoking = _useState4[0],
|
|
47
|
+
setRevoking = _useState4[1];
|
|
48
|
+
|
|
29
49
|
var instanceMatchesClient = instance !== undefined && instance === client.options.uri;
|
|
30
|
-
var shouldShowMenu = instanceMatchesClient && !isOwner || isOwner;
|
|
50
|
+
var shouldShowMenu = !revoking && (instanceMatchesClient && !isOwner || isOwner);
|
|
31
51
|
|
|
32
52
|
var toggleMenu = function toggleMenu() {
|
|
33
53
|
return setMenuDisplayed(!isMenuDisplayed);
|
|
@@ -37,11 +57,46 @@ var GroupRecipientPermissions = function GroupRecipientPermissions(_ref) {
|
|
|
37
57
|
return setMenuDisplayed(false);
|
|
38
58
|
};
|
|
39
59
|
|
|
40
|
-
var handleRevocation = function
|
|
41
|
-
|
|
60
|
+
var handleRevocation = /*#__PURE__*/function () {
|
|
61
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
62
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
63
|
+
while (1) switch (_context.prev = _context.next) {
|
|
64
|
+
case 0:
|
|
65
|
+
setRevoking(true);
|
|
66
|
+
|
|
67
|
+
if (!isOwner) {
|
|
68
|
+
_context.next = 6;
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
_context.next = 4;
|
|
73
|
+
return revokeGroup(document, sharingId, groupIndex);
|
|
74
|
+
|
|
75
|
+
case 4:
|
|
76
|
+
_context.next = 8;
|
|
77
|
+
break;
|
|
78
|
+
|
|
79
|
+
case 6:
|
|
80
|
+
_context.next = 8;
|
|
81
|
+
return revokeSelf(document);
|
|
82
|
+
|
|
83
|
+
case 8:
|
|
84
|
+
setRevoking(false);
|
|
85
|
+
|
|
86
|
+
case 9:
|
|
87
|
+
case "end":
|
|
88
|
+
return _context.stop();
|
|
89
|
+
}
|
|
90
|
+
}, _callee);
|
|
91
|
+
}));
|
|
92
|
+
|
|
93
|
+
return function handleRevocation() {
|
|
94
|
+
return _ref2.apply(this, arguments);
|
|
95
|
+
};
|
|
96
|
+
}();
|
|
42
97
|
|
|
43
98
|
var type = isReadOnly ? 'one-way' : 'two-way';
|
|
44
|
-
var actions = makeActions([permission, divider,
|
|
99
|
+
var actions = makeActions([permission, divider, revokeGroupAction], {
|
|
45
100
|
t: t,
|
|
46
101
|
type: type,
|
|
47
102
|
isOwner: isOwner,
|
|
@@ -49,7 +104,7 @@ var GroupRecipientPermissions = function GroupRecipientPermissions(_ref) {
|
|
|
49
104
|
});
|
|
50
105
|
return /*#__PURE__*/React.createElement("div", {
|
|
51
106
|
className: className
|
|
52
|
-
}, shouldShowMenu && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DropdownButton, {
|
|
107
|
+
}, revoking && /*#__PURE__*/React.createElement(Spinner, null), shouldShowMenu && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DropdownButton, {
|
|
53
108
|
ref: buttonRef,
|
|
54
109
|
"aria-controls": "simple-menu",
|
|
55
110
|
"aria-haspopup": "true",
|
|
@@ -65,7 +120,14 @@ var GroupRecipientPermissions = function GroupRecipientPermissions(_ref) {
|
|
|
65
120
|
},
|
|
66
121
|
autoClose: true,
|
|
67
122
|
onClose: hideMenu
|
|
68
|
-
}
|
|
123
|
+
}, /*#__PURE__*/React.createElement(ActionsMenuMobileHeader, null, /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(GroupAvatar, {
|
|
124
|
+
size: "small"
|
|
125
|
+
})), /*#__PURE__*/React.createElement(ListItemText, {
|
|
126
|
+
primary: name,
|
|
127
|
+
primaryTypographyProps: {
|
|
128
|
+
variant: 'h6'
|
|
129
|
+
}
|
|
130
|
+
})))));
|
|
69
131
|
};
|
|
70
132
|
|
|
71
133
|
export { GroupRecipientPermissions };
|
|
@@ -9,6 +9,7 @@ import ListItem from 'cozy-ui/transpiled/react/ListItem';
|
|
|
9
9
|
import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon';
|
|
10
10
|
import ListItemText from 'cozy-ui/transpiled/react/ListItemText';
|
|
11
11
|
import Typography from 'cozy-ui/transpiled/react/Typography';
|
|
12
|
+
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints';
|
|
12
13
|
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
|
|
13
14
|
import LinkRecipientPermissions from './LinkRecipientPermissions';
|
|
14
15
|
import RecipientConfirm from './RecipientConfirm';
|
|
@@ -35,6 +36,9 @@ var LinkRecipient = function LinkRecipient(props) {
|
|
|
35
36
|
var _useI18n = useI18n(),
|
|
36
37
|
t = _useI18n.t;
|
|
37
38
|
|
|
39
|
+
var _useBreakpoints = useBreakpoints(),
|
|
40
|
+
isMobile = _useBreakpoints.isMobile;
|
|
41
|
+
|
|
38
42
|
var recipientConfirmationData = props.recipientConfirmationData,
|
|
39
43
|
verifyRecipient = props.verifyRecipient,
|
|
40
44
|
link = props.link,
|
|
@@ -49,7 +53,7 @@ var LinkRecipient = function LinkRecipient(props) {
|
|
|
49
53
|
in: true,
|
|
50
54
|
timeout: fadeIn ? FADE_IN_DURATION : 0
|
|
51
55
|
}, /*#__PURE__*/React.createElement(ListItem, {
|
|
52
|
-
|
|
56
|
+
gutters: isMobile ? 'default' : 'double'
|
|
53
57
|
}, /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(Circle, {
|
|
54
58
|
size: "small",
|
|
55
59
|
className: styles['link-recipient-icon-circle']
|
|
@@ -9,6 +9,7 @@ import ListItem from 'cozy-ui/transpiled/react/ListItem';
|
|
|
9
9
|
import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon';
|
|
10
10
|
import ListItemText from 'cozy-ui/transpiled/react/ListItemText';
|
|
11
11
|
import Typography from 'cozy-ui/transpiled/react/Typography';
|
|
12
|
+
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints';
|
|
12
13
|
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
|
|
13
14
|
import MemberRecipientPermissions from './MemberRecipientPermissions';
|
|
14
15
|
import MemberRecipientStatus from './MemberRecipientStatus';
|
|
@@ -24,6 +25,9 @@ var MemberRecipient = function MemberRecipient(props) {
|
|
|
24
25
|
|
|
25
26
|
var client = useClient();
|
|
26
27
|
|
|
28
|
+
var _useBreakpoints = useBreakpoints(),
|
|
29
|
+
isMobile = _useBreakpoints.isMobile;
|
|
30
|
+
|
|
27
31
|
var instance = props.instance,
|
|
28
32
|
isOwner = props.isOwner,
|
|
29
33
|
status = props.status,
|
|
@@ -45,7 +49,7 @@ var MemberRecipient = function MemberRecipient(props) {
|
|
|
45
49
|
in: true,
|
|
46
50
|
timeout: fadeIn ? FADE_IN_DURATION : 0
|
|
47
51
|
}, /*#__PURE__*/React.createElement(ListItem, {
|
|
48
|
-
|
|
52
|
+
gutters: isMobile ? 'default' : 'double'
|
|
49
53
|
}, /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(MemberAvatar, {
|
|
50
54
|
size: "small",
|
|
51
55
|
recipient: props
|
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
3
|
import ActionsMenuItem from 'cozy-ui/transpiled/react/ActionsMenu/ActionsMenuItem';
|
|
4
|
-
import Icon from 'cozy-ui/transpiled/react/Icon';
|
|
5
|
-
import EyeIcon from 'cozy-ui/transpiled/react/Icons/Eye';
|
|
6
|
-
import RenameIcon from 'cozy-ui/transpiled/react/Icons/Rename';
|
|
7
4
|
import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon';
|
|
8
5
|
import ListItemText from 'cozy-ui/transpiled/react/ListItemText';
|
|
6
|
+
import Radios from 'cozy-ui/transpiled/react/Radios';
|
|
9
7
|
|
|
10
8
|
var permission = function permission(_ref) {
|
|
11
9
|
var t = _ref.t,
|
|
12
10
|
type = _ref.type;
|
|
13
11
|
var title = t("Share.type.".concat(type));
|
|
14
|
-
var icon = type === 'two-way' ? RenameIcon : EyeIcon;
|
|
15
12
|
return {
|
|
16
13
|
name: 'permission',
|
|
17
14
|
label: title,
|
|
18
|
-
icon:
|
|
15
|
+
icon: null,
|
|
19
16
|
action: null,
|
|
20
17
|
Component: /*#__PURE__*/forwardRef(function RevokeItem(props, ref) {
|
|
21
18
|
return /*#__PURE__*/React.createElement(ActionsMenuItem, _extends({}, props, {
|
|
22
19
|
ref: ref,
|
|
23
20
|
button: false
|
|
24
|
-
}), /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(
|
|
25
|
-
|
|
21
|
+
}), /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(Radios, {
|
|
22
|
+
checked: true
|
|
26
23
|
})), /*#__PURE__*/React.createElement(ListItemText, {
|
|
27
24
|
primary: title
|
|
28
25
|
}));
|
|
@@ -4,6 +4,7 @@ var _excluded = ["showShareByLink", "documentType", "document"];
|
|
|
4
4
|
import cx from 'classnames';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import Typography from 'cozy-ui/transpiled/react/Typography';
|
|
7
|
+
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints';
|
|
7
8
|
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
|
|
8
9
|
import { default as DumbShareByEmail } from './ShareByEmail';
|
|
9
10
|
import { default as DumbShareByLink } from './ShareByLink';
|
|
@@ -64,8 +65,13 @@ var SharingContent = function SharingContent(_ref) {
|
|
|
64
65
|
var _useI18n = useI18n(),
|
|
65
66
|
t = _useI18n.t;
|
|
66
67
|
|
|
68
|
+
var _useBreakpoints = useBreakpoints(),
|
|
69
|
+
isMobile = _useBreakpoints.isMobile;
|
|
70
|
+
|
|
67
71
|
return /*#__PURE__*/React.createElement("div", {
|
|
68
72
|
className: cx(styles['share-modal-content'])
|
|
73
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
74
|
+
className: cx('u-pt-1-half', isMobile ? 'u-ph-1' : 'u-ph-2')
|
|
69
75
|
}, showShareOnlyByLink && /*#__PURE__*/React.createElement("div", {
|
|
70
76
|
className: styles['share-byemail-onlybylink']
|
|
71
77
|
}, t("".concat(documentType, ".share.shareByEmail.onlyByLink"), {
|
|
@@ -84,8 +90,7 @@ var SharingContent = function SharingContent(_ref) {
|
|
|
84
90
|
onShare: onShare,
|
|
85
91
|
sharing: sharing,
|
|
86
92
|
sharingDesc: sharingDesc
|
|
87
|
-
}), showWhoHasAccess && /*#__PURE__*/React.createElement(WhoHasAccess, {
|
|
88
|
-
className: "u-mt-half",
|
|
93
|
+
})), showWhoHasAccess && /*#__PURE__*/React.createElement(WhoHasAccess, {
|
|
89
94
|
document: document,
|
|
90
95
|
documentType: documentType,
|
|
91
96
|
isOwner: isOwner,
|
|
@@ -139,7 +144,8 @@ var ShareDialogCozyToCozy = function ShareDialogCozyToCozy(_ref3) {
|
|
|
139
144
|
dialogTitleOnShare: SharingTitleFunction({
|
|
140
145
|
documentType: documentType,
|
|
141
146
|
document: document
|
|
142
|
-
})
|
|
147
|
+
}),
|
|
148
|
+
disableGutters: true
|
|
143
149
|
}));
|
|
144
150
|
};
|
|
145
151
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import cx from 'classnames';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { Dialog } from 'cozy-ui/transpiled/react/CozyDialogs';
|
|
3
4
|
import Typography from 'cozy-ui/transpiled/react/Typography';
|
|
5
|
+
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints';
|
|
4
6
|
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
|
|
5
7
|
import { default as DumbShareByLink } from './ShareByLink';
|
|
6
8
|
import WhoHasAccess from './WhoHasAccess';
|
|
@@ -22,7 +24,11 @@ var ShareDialogOnlyByLink = function ShareDialogOnlyByLink(_ref) {
|
|
|
22
24
|
var _useI18n = useI18n(),
|
|
23
25
|
t = _useI18n.t;
|
|
24
26
|
|
|
27
|
+
var _useBreakpoints = useBreakpoints(),
|
|
28
|
+
isMobile = _useBreakpoints.isMobile;
|
|
29
|
+
|
|
25
30
|
return /*#__PURE__*/React.createElement(Dialog, {
|
|
31
|
+
disableGutters: true,
|
|
26
32
|
disableEnforceFocus: true,
|
|
27
33
|
open: true,
|
|
28
34
|
onClose: onClose,
|
|
@@ -30,9 +36,9 @@ var ShareDialogOnlyByLink = function ShareDialogOnlyByLink(_ref) {
|
|
|
30
36
|
name: document.name || document.attributes.name
|
|
31
37
|
}),
|
|
32
38
|
content: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography, {
|
|
33
|
-
variant: "h6"
|
|
39
|
+
variant: "h6",
|
|
40
|
+
className: cx(isMobile ? 'u-ph-1 u-mt-1' : 'u-ph-2 u-mt-1-half')
|
|
34
41
|
}, t('Share.contacts.whoHasAccess')), /*#__PURE__*/React.createElement(WhoHasAccess, {
|
|
35
|
-
className: "u-mt-half",
|
|
36
42
|
document: document,
|
|
37
43
|
documentType: documentType,
|
|
38
44
|
isOwner: isOwner,
|
|
@@ -43,12 +49,14 @@ var ShareDialogOnlyByLink = function ShareDialogOnlyByLink(_ref) {
|
|
|
43
49
|
permissions: permissions,
|
|
44
50
|
onUpdateShareLinkPermissions: onUpdateShareLinkPermissions,
|
|
45
51
|
onRevokeLink: onRevokeLink
|
|
46
|
-
}), /*#__PURE__*/React.createElement(
|
|
52
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
className: cx('u-mt-half', isMobile ? 'u-ph-1 u-mb-1' : 'u-ph-2 u-mb-1-half')
|
|
54
|
+
}, /*#__PURE__*/React.createElement(DumbShareByLink, {
|
|
47
55
|
link: link,
|
|
48
56
|
document: document,
|
|
49
57
|
documentType: documentType,
|
|
50
58
|
onEnable: onShareByLink
|
|
51
|
-
}))
|
|
59
|
+
})))
|
|
52
60
|
});
|
|
53
61
|
};
|
|
54
62
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import cx from 'classnames';
|
|
1
2
|
import PropTypes from 'prop-types';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { Dialog } from 'cozy-ui/transpiled/react/CozyDialogs';
|
|
4
5
|
import Divider from 'cozy-ui/transpiled/react/Divider';
|
|
6
|
+
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints';
|
|
5
7
|
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
|
|
6
8
|
import { getDisplayName } from '../../models';
|
|
7
9
|
var styles = {
|
|
@@ -44,7 +46,11 @@ export var SharingDetailsModal = function SharingDetailsModal(_ref) {
|
|
|
44
46
|
t = _useI18n.t,
|
|
45
47
|
f = _useI18n.f;
|
|
46
48
|
|
|
49
|
+
var _useBreakpoints = useBreakpoints(),
|
|
50
|
+
isMobile = _useBreakpoints.isMobile;
|
|
51
|
+
|
|
47
52
|
return /*#__PURE__*/React.createElement(Dialog, {
|
|
53
|
+
disableGutters: true,
|
|
48
54
|
open: true,
|
|
49
55
|
onClose: onClose,
|
|
50
56
|
className: styles['share-modal'],
|
|
@@ -52,7 +58,7 @@ export var SharingDetailsModal = function SharingDetailsModal(_ref) {
|
|
|
52
58
|
content: /*#__PURE__*/React.createElement("div", {
|
|
53
59
|
className: styles['share-modal-content']
|
|
54
60
|
}, /*#__PURE__*/React.createElement("div", {
|
|
55
|
-
className: styles['share-details']
|
|
61
|
+
className: cx(styles['share-details'], isMobile ? 'u-ph-1 u-pt-1-half' : 'u-ph-2 u-pt-1')
|
|
56
62
|
}, /*#__PURE__*/React.createElement(OwnerIdentity, {
|
|
57
63
|
name: t("".concat(documentType, ".share.sharedBy"), {
|
|
58
64
|
name: getDisplayName(owner)
|
|
@@ -49,9 +49,7 @@ var WhoHasAccess = function WhoHasAccess(_ref2) {
|
|
|
49
49
|
className: className
|
|
50
50
|
}, /*#__PURE__*/React.createElement(RecipientWaitingForConfirmationAlert, {
|
|
51
51
|
recipientsToBeConfirmed: recipientsToBeConfirmed
|
|
52
|
-
}), /*#__PURE__*/React.createElement(List, {
|
|
53
|
-
disablePadding: true
|
|
54
|
-
}, link && /*#__PURE__*/React.createElement(LinkRecipient, {
|
|
52
|
+
}), /*#__PURE__*/React.createElement(List, null, link && /*#__PURE__*/React.createElement(LinkRecipient, {
|
|
55
53
|
document: document,
|
|
56
54
|
documentType: documentType,
|
|
57
55
|
onRevoke: onRevoke,
|
package/dist/state.js
CHANGED
|
@@ -16,6 +16,7 @@ var RECEIVE_SHARINGS = 'RECEIVE_SHARINGS';
|
|
|
16
16
|
var ADD_SHARING = 'ADD_SHARING';
|
|
17
17
|
var UPDATE_SHARING = 'UPDATE_SHARING';
|
|
18
18
|
var REVOKE_RECIPIENT = 'REVOKE_RECIPIENT';
|
|
19
|
+
var REVOKE_GROUP = 'REVOKE_GROUP';
|
|
19
20
|
var REVOKE_SELF = 'REVOKE_SELF';
|
|
20
21
|
var ADD_SHARING_LINK = 'ADD_SHARING_LINK';
|
|
21
22
|
var UPDATE_SHARING_LINK = 'UPDATE_SHARING_LINK';
|
|
@@ -78,6 +79,29 @@ export var revokeRecipient = function revokeRecipient(sharing, index, path) {
|
|
|
78
79
|
path: path
|
|
79
80
|
};
|
|
80
81
|
};
|
|
82
|
+
export var revokeGroup = function revokeGroup(sharing, index, path) {
|
|
83
|
+
return {
|
|
84
|
+
type: REVOKE_GROUP,
|
|
85
|
+
|
|
86
|
+
/* We can't just simply remove a group,
|
|
87
|
+
because we use the index to remove the other group
|
|
88
|
+
*/
|
|
89
|
+
sharing: _objectSpread(_objectSpread({}, sharing), {}, {
|
|
90
|
+
attributes: _objectSpread(_objectSpread({}, sharing.attributes), {}, {
|
|
91
|
+
groups: sharing.attributes.groups.map(function (g, idx) {
|
|
92
|
+
if (idx === index) {
|
|
93
|
+
return _objectSpread(_objectSpread({}, g), {}, {
|
|
94
|
+
revoked: true
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return g;
|
|
99
|
+
})
|
|
100
|
+
})
|
|
101
|
+
}),
|
|
102
|
+
path: path
|
|
103
|
+
};
|
|
104
|
+
};
|
|
81
105
|
export var revokeSelf = function revokeSelf(sharing) {
|
|
82
106
|
return {
|
|
83
107
|
type: REVOKE_SELF,
|
|
@@ -204,6 +228,7 @@ var byDocId = function byDocId() {
|
|
|
204
228
|
case ADD_SHARING:
|
|
205
229
|
return indexSharing(state, action.data);
|
|
206
230
|
|
|
231
|
+
case REVOKE_GROUP:
|
|
207
232
|
case REVOKE_RECIPIENT:
|
|
208
233
|
case UPDATE_SHARING:
|
|
209
234
|
if (areAllRecipientsRevoked(action.sharing)) {
|
|
@@ -304,6 +329,7 @@ var sharings = function sharings() {
|
|
|
304
329
|
return [].concat(_toConsumableArray(filtered_state), [action.data]);
|
|
305
330
|
|
|
306
331
|
case UPDATE_SHARING:
|
|
332
|
+
case REVOKE_GROUP:
|
|
307
333
|
case REVOKE_RECIPIENT:
|
|
308
334
|
return state.map(function (s) {
|
|
309
335
|
return s.id !== action.sharing.id ? s : action.sharing;
|
|
@@ -335,6 +361,7 @@ var sharedPaths = function sharedPaths() {
|
|
|
335
361
|
var newState = [].concat(_toConsumableArray(state), [action.path]);
|
|
336
362
|
return newState;
|
|
337
363
|
|
|
364
|
+
case REVOKE_GROUP:
|
|
338
365
|
case REVOKE_RECIPIENT:
|
|
339
366
|
if (areAllRecipientsRevoked(action.sharing)) {
|
|
340
367
|
return state.filter(function (p) {
|
package/locales/en.json
CHANGED
|
@@ -376,5 +376,18 @@
|
|
|
376
376
|
"title": "Remove me from sharing",
|
|
377
377
|
"desc": "You keep the content but it won't be updated between your Cozy anymore."
|
|
378
378
|
}
|
|
379
|
+
},
|
|
380
|
+
"GroupRecipientDetail": {
|
|
381
|
+
"subtitle": "Managed by %{ownerName}",
|
|
382
|
+
"withAccess": {
|
|
383
|
+
"title": "Access to item"
|
|
384
|
+
},
|
|
385
|
+
"withoutAccess": {
|
|
386
|
+
"title": "No access",
|
|
387
|
+
"status": {
|
|
388
|
+
"mail-not-sent": "Invitation failed",
|
|
389
|
+
"revoked": "Sharing revoked"
|
|
390
|
+
}
|
|
391
|
+
}
|
|
379
392
|
}
|
|
380
393
|
}
|
package/locales/fr.json
CHANGED
|
@@ -374,5 +374,18 @@
|
|
|
374
374
|
"title": "Quitter le partage",
|
|
375
375
|
"desc": "Vous conserverez une copie mais vos changements ne seront plus synchronisés."
|
|
376
376
|
}
|
|
377
|
+
},
|
|
378
|
+
"GroupRecipientDetail": {
|
|
379
|
+
"subtitle": "Géré par %{ownerName}",
|
|
380
|
+
"withAccess": {
|
|
381
|
+
"title": "Accès à l’élément"
|
|
382
|
+
},
|
|
383
|
+
"withoutAccess": {
|
|
384
|
+
"title": "Aucun accès",
|
|
385
|
+
"status": {
|
|
386
|
+
"mail-not-sent": "Echec de l’invitation",
|
|
387
|
+
"revoked": "Partage révoqué"
|
|
388
|
+
}
|
|
389
|
+
}
|
|
377
390
|
}
|
|
378
391
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-sharing",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.1.0",
|
|
4
4
|
"description": "Provides sharing login for React applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Cozy",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@cozy/minilog": "^1.0.0",
|
|
32
32
|
"classnames": "^2.2.6",
|
|
33
33
|
"cozy-device-helper": "^3.0.0",
|
|
34
|
-
"cozy-doctypes": "^1.89.
|
|
34
|
+
"cozy-doctypes": "^1.89.5",
|
|
35
35
|
"lodash": "^4.17.19",
|
|
36
36
|
"react-autosuggest": "^10.1.0",
|
|
37
37
|
"react-tooltip": "^3.11.1",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"babel-jest": "26.6.3",
|
|
50
50
|
"babel-plugin-css-modules-transform": "1.6.2",
|
|
51
51
|
"babel-plugin-inline-react-svg": "1.1.2",
|
|
52
|
-
"cozy-client": "
|
|
52
|
+
"cozy-client": "46.1.0",
|
|
53
53
|
"cozy-ui": "^103.8.2",
|
|
54
54
|
"enzyme": "3.11.0",
|
|
55
55
|
"enzyme-adapter-react-16": "1.15.6",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"storybook": "7.6.0"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"cozy-client": ">=
|
|
64
|
+
"cozy-client": ">=46.1.0",
|
|
65
65
|
"cozy-realtime": "^3.11.0",
|
|
66
66
|
"cozy-ui": ">=103.8.1",
|
|
67
67
|
"prop-types": "^15.7.2",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"sideEffects": [
|
|
72
72
|
"*.css"
|
|
73
73
|
],
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "5de831d050135822b1b9295ae8888d11f6372ee5"
|
|
75
75
|
}
|
package/src/SharingProvider.jsx
CHANGED
|
@@ -20,6 +20,7 @@ import reducer, {
|
|
|
20
20
|
updateSharingLink,
|
|
21
21
|
revokeSharingLink,
|
|
22
22
|
revokeRecipient,
|
|
23
|
+
revokeGroup as revokeGroupFromState,
|
|
23
24
|
revokeSelf,
|
|
24
25
|
receivePaths,
|
|
25
26
|
isOwner,
|
|
@@ -71,6 +72,7 @@ export class SharingProvider extends Component {
|
|
|
71
72
|
share: this.share,
|
|
72
73
|
onShared: onShared,
|
|
73
74
|
revoke: this.revoke,
|
|
75
|
+
revokeGroup: this.revokeGroup,
|
|
74
76
|
revokeSelf: this.revokeSelf,
|
|
75
77
|
shareByLink: this.shareByLink,
|
|
76
78
|
updateDocumentPermissions: this.updateDocumentPermissions,
|
|
@@ -291,6 +293,19 @@ export class SharingProvider extends Component {
|
|
|
291
293
|
)
|
|
292
294
|
}
|
|
293
295
|
|
|
296
|
+
revokeGroup = async (document, sharingId, recipientIndex) => {
|
|
297
|
+
const { client, doctype } = this.props
|
|
298
|
+
const sharing = getSharingById(this.state, sharingId)
|
|
299
|
+
await this.sharingCol.revokeGroup(sharing, recipientIndex)
|
|
300
|
+
this.dispatch(
|
|
301
|
+
revokeGroupFromState(
|
|
302
|
+
sharing,
|
|
303
|
+
recipientIndex,
|
|
304
|
+
document.path || (await fetchFilesPaths(client, doctype, [document]))
|
|
305
|
+
)
|
|
306
|
+
)
|
|
307
|
+
}
|
|
308
|
+
|
|
294
309
|
revokeSelf = async document => {
|
|
295
310
|
const sharing = getSharingForSelf(this.state, document.id)
|
|
296
311
|
await this.sharingCol.revokeSelf(sharing)
|