cozy-sharing 4.4.0 → 4.5.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 +31 -0
- package/dist/ShareModal.js +14 -10
- package/dist/components/ShareModal.js +3 -3
- package/package.json +3 -3
- package/src/ShareModal.jsx +23 -14
- package/src/components/ShareModal.jsx +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,37 @@
|
|
|
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
|
+
## [4.5.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@4.5.0...cozy-sharing@4.5.1) (2022-07-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Handle old react-routers in ShareModal ([b6fe5cb](https://github.com/cozy/cozy-libs/commit/b6fe5cb40492a7a3e71b7e6652a2f95f4c63b39d))
|
|
12
|
+
* Revert ShareByEmail for Notes ([e5daeb9](https://github.com/cozy/cozy-libs/commit/e5daeb96455ed35cf6ca38b87f7c2d812c03a83e))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# [4.5.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@4.4.1...cozy-sharing@4.5.0) (2022-07-13)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* Allow sharemodal to use Location ([032f963](https://github.com/cozy/cozy-libs/commit/032f963c7296dcd296c5ef21a8814407ef9cf2cf))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## [4.4.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@4.4.0...cozy-sharing@4.4.1) (2022-07-11)
|
|
30
|
+
|
|
31
|
+
**Note:** Version bump only for package cozy-sharing
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
6
37
|
# 4.4.0 (2022-07-05)
|
|
7
38
|
|
|
8
39
|
|
package/dist/ShareModal.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["document"]
|
|
4
|
-
_excluded2 = ["document"];
|
|
3
|
+
var _excluded = ["document"];
|
|
5
4
|
import React from 'react';
|
|
5
|
+
import omit from 'lodash/omit';
|
|
6
|
+
import { useLocation } from 'react-router';
|
|
7
|
+
import EditableSharingModal from './components/EditableSharingModal';
|
|
6
8
|
import SharingContext from './context';
|
|
7
9
|
import withLocales from './withLocales';
|
|
8
10
|
import { SharingDetailsModal } from './SharingDetailsModal';
|
|
9
|
-
import EditableSharingModal from './components/EditableSharingModal';
|
|
10
11
|
|
|
11
12
|
var SharingModal = function SharingModal(_ref) {
|
|
12
13
|
var document = _ref.document,
|
|
@@ -29,14 +30,17 @@ var SharingModal = function SharingModal(_ref) {
|
|
|
29
30
|
});
|
|
30
31
|
};
|
|
31
32
|
|
|
32
|
-
export var ShareModal = withLocales(function (
|
|
33
|
-
var
|
|
34
|
-
rest = _objectWithoutProperties(_ref3, _excluded2);
|
|
33
|
+
export var ShareModal = withLocales(function (props) {
|
|
34
|
+
var _location$state;
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
var location = useLocation === null || useLocation === void 0 ? void 0 : useLocation();
|
|
37
|
+
var locationProps = location === null || location === void 0 ? void 0 : (_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.modalProps;
|
|
38
|
+
var document = (locationProps === null || locationProps === void 0 ? void 0 : locationProps.document) || props.document;
|
|
39
|
+
var rest = omit(locationProps || props, 'document');
|
|
40
|
+
return /*#__PURE__*/React.createElement(SharingContext.Consumer, null, function (_ref3) {
|
|
41
|
+
var byDocId = _ref3.byDocId,
|
|
42
|
+
isOwner = _ref3.isOwner,
|
|
43
|
+
canReshare = _ref3.canReshare;
|
|
40
44
|
return !byDocId[document.id] || isOwner(document.id) || canReshare(document.id) ? /*#__PURE__*/React.createElement(EditableSharingModal, _extends({
|
|
41
45
|
document: document
|
|
42
46
|
}, rest)) : /*#__PURE__*/React.createElement(SharingModal, _extends({
|
|
@@ -27,11 +27,11 @@ export var ShareModal = function ShareModal(_ref) {
|
|
|
27
27
|
sharing = _ref.sharing,
|
|
28
28
|
sharingDesc = _ref.sharingDesc,
|
|
29
29
|
twoStepsConfirmationMethods = _ref.twoStepsConfirmationMethods;
|
|
30
|
-
var showShareByEmail = documentType !== 'Albums' && !hasSharedParent && !hasSharedChild;
|
|
30
|
+
var showShareByEmail = documentType !== 'Notes' && documentType !== 'Albums' && !hasSharedParent && !hasSharedChild;
|
|
31
31
|
var showShareByLink = documentType !== 'Organizations';
|
|
32
32
|
var showShareOnlyByLink = hasSharedParent || hasSharedChild;
|
|
33
33
|
var showWhoHasAccess = documentType !== 'Albums';
|
|
34
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, documentType === 'Albums' && /*#__PURE__*/React.createElement(ShareDialogOnlyByLink, {
|
|
34
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, (documentType === 'Notes' || documentType === 'Albums') && /*#__PURE__*/React.createElement(ShareDialogOnlyByLink, {
|
|
35
35
|
document: document,
|
|
36
36
|
documentType: documentType,
|
|
37
37
|
link: link,
|
|
@@ -40,7 +40,7 @@ export var ShareModal = function ShareModal(_ref) {
|
|
|
40
40
|
onShareByLink: onShareByLink,
|
|
41
41
|
onUpdateShareLinkPermissions: onUpdateShareLinkPermissions,
|
|
42
42
|
permissions: permissions
|
|
43
|
-
}), documentType !== 'Albums' && /*#__PURE__*/React.createElement(ShareDialogCozyToCozy, {
|
|
43
|
+
}), documentType !== 'Notes' && documentType !== 'Albums' && /*#__PURE__*/React.createElement(ShareDialogCozyToCozy, {
|
|
44
44
|
contacts: contacts,
|
|
45
45
|
createContact: createContact,
|
|
46
46
|
document: document,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-sharing",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.1",
|
|
4
4
|
"description": "Provides sharing login for React applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Cozy",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"classnames": "^2.2.6",
|
|
30
30
|
"copy-text-to-clipboard": "^2.1.1",
|
|
31
31
|
"cozy-device-helper": "^2.2.1",
|
|
32
|
-
"cozy-doctypes": "^1.
|
|
32
|
+
"cozy-doctypes": "^1.84.0",
|
|
33
33
|
"lodash": "^4.17.19",
|
|
34
34
|
"react-autosuggest": "^9.4.3",
|
|
35
35
|
"react-tooltip": "^3.11.1",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"sideEffects": [
|
|
64
64
|
"*.css"
|
|
65
65
|
],
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "41693a80c8ce6ce01ecf347412f63d9db626ec60"
|
|
67
67
|
}
|
package/src/ShareModal.jsx
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
+
import omit from 'lodash/omit'
|
|
3
|
+
import { useLocation } from 'react-router'
|
|
2
4
|
|
|
5
|
+
import EditableSharingModal from './components/EditableSharingModal'
|
|
3
6
|
import SharingContext from './context'
|
|
4
7
|
import withLocales from './withLocales'
|
|
5
8
|
import { SharingDetailsModal } from './SharingDetailsModal'
|
|
6
|
-
import EditableSharingModal from './components/EditableSharingModal'
|
|
7
9
|
|
|
8
10
|
const SharingModal = ({ document, ...rest }) => (
|
|
9
11
|
<SharingContext.Consumer>
|
|
@@ -27,16 +29,23 @@ const SharingModal = ({ document, ...rest }) => (
|
|
|
27
29
|
</SharingContext.Consumer>
|
|
28
30
|
)
|
|
29
31
|
|
|
30
|
-
export const ShareModal = withLocales(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
export const ShareModal = withLocales(props => {
|
|
33
|
+
const location = useLocation?.()
|
|
34
|
+
const locationProps = location?.state?.modalProps
|
|
35
|
+
const document = locationProps?.document || props.document
|
|
36
|
+
const rest = omit(locationProps || props, 'document')
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<SharingContext.Consumer>
|
|
40
|
+
{({ byDocId, isOwner, canReshare }) =>
|
|
41
|
+
!byDocId[document.id] ||
|
|
42
|
+
isOwner(document.id) ||
|
|
43
|
+
canReshare(document.id) ? (
|
|
44
|
+
<EditableSharingModal document={document} {...rest} />
|
|
45
|
+
) : (
|
|
46
|
+
<SharingModal document={document} {...rest} />
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
</SharingContext.Consumer>
|
|
50
|
+
)
|
|
51
|
+
})
|
|
@@ -30,14 +30,17 @@ export const ShareModal = ({
|
|
|
30
30
|
twoStepsConfirmationMethods
|
|
31
31
|
}) => {
|
|
32
32
|
const showShareByEmail =
|
|
33
|
-
documentType !== '
|
|
33
|
+
documentType !== 'Notes' &&
|
|
34
|
+
documentType !== 'Albums' &&
|
|
35
|
+
!hasSharedParent &&
|
|
36
|
+
!hasSharedChild
|
|
34
37
|
const showShareByLink = documentType !== 'Organizations'
|
|
35
38
|
const showShareOnlyByLink = hasSharedParent || hasSharedChild
|
|
36
39
|
const showWhoHasAccess = documentType !== 'Albums'
|
|
37
40
|
|
|
38
41
|
return (
|
|
39
42
|
<>
|
|
40
|
-
{documentType === 'Albums' && (
|
|
43
|
+
{(documentType === 'Notes' || documentType === 'Albums') && (
|
|
41
44
|
<ShareDialogOnlyByLink
|
|
42
45
|
document={document}
|
|
43
46
|
documentType={documentType}
|
|
@@ -49,7 +52,7 @@ export const ShareModal = ({
|
|
|
49
52
|
permissions={permissions}
|
|
50
53
|
/>
|
|
51
54
|
)}
|
|
52
|
-
{documentType !== 'Albums' && (
|
|
55
|
+
{documentType !== 'Notes' && documentType !== 'Albums' && (
|
|
53
56
|
<ShareDialogCozyToCozy
|
|
54
57
|
contacts={contacts}
|
|
55
58
|
createContact={createContact}
|