cozy-sharing 26.4.0 → 26.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
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
|
+
## [26.5.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@26.5.0...cozy-sharing@26.5.1) (2025-10-06)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- Handle missing owner in SharingDetailsModal :bug: ([6ce20bf](https://github.com/cozy/cozy-libs/commit/6ce20bf77390f0773ffaf831b060fd89fcf8bd9b))
|
|
11
|
+
|
|
12
|
+
# [26.5.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@26.4.0...cozy-sharing@26.5.0) (2025-10-06)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- Add onRevokeSuccess callback :sparkles: ([3845ace](https://github.com/cozy/cozy-libs/commit/3845aced0e3cf365ffbc183bb5c5cf894b04e667))
|
|
17
|
+
|
|
6
18
|
# [26.4.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@26.3.0...cozy-sharing@26.4.0) (2025-09-25)
|
|
7
19
|
|
|
8
20
|
### Features
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["onRevokeSuccess"];
|
|
5
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
6
|
import omit from 'lodash/omit';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
3
8
|
import React from 'react';
|
|
4
9
|
import { useLocation } from 'react-router';
|
|
5
10
|
import EditableSharingModal from './EditableSharingModal';
|
|
@@ -12,7 +17,10 @@ export var ShareModal = withLocales(function (props) {
|
|
|
12
17
|
var location = useLocation === null || useLocation === void 0 ? void 0 : useLocation();
|
|
13
18
|
var locationProps = location === null || location === void 0 || (_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.modalProps;
|
|
14
19
|
var document = (locationProps === null || locationProps === void 0 ? void 0 : locationProps.document) || props.document;
|
|
15
|
-
|
|
20
|
+
|
|
21
|
+
var _omit = omit(locationProps || props, 'document'),
|
|
22
|
+
onRevokeSuccess = _omit.onRevokeSuccess,
|
|
23
|
+
rest = _objectWithoutProperties(_omit, _excluded);
|
|
16
24
|
|
|
17
25
|
var _useSharingContext = useSharingContext(),
|
|
18
26
|
byDocId = _useSharingContext.byDocId,
|
|
@@ -24,6 +32,29 @@ export var ShareModal = withLocales(function (props) {
|
|
|
24
32
|
getRecipients = _useSharingContext.getRecipients,
|
|
25
33
|
revokeSelf = _useSharingContext.revokeSelf;
|
|
26
34
|
|
|
35
|
+
var handleRevokeSelf = /*#__PURE__*/function () {
|
|
36
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(document) {
|
|
37
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
38
|
+
while (1) switch (_context.prev = _context.next) {
|
|
39
|
+
case 0:
|
|
40
|
+
_context.next = 2;
|
|
41
|
+
return revokeSelf(document);
|
|
42
|
+
|
|
43
|
+
case 2:
|
|
44
|
+
onRevokeSuccess === null || onRevokeSuccess === void 0 || onRevokeSuccess(document);
|
|
45
|
+
|
|
46
|
+
case 3:
|
|
47
|
+
case "end":
|
|
48
|
+
return _context.stop();
|
|
49
|
+
}
|
|
50
|
+
}, _callee);
|
|
51
|
+
}));
|
|
52
|
+
|
|
53
|
+
return function handleRevokeSelf(_x) {
|
|
54
|
+
return _ref.apply(this, arguments);
|
|
55
|
+
};
|
|
56
|
+
}();
|
|
57
|
+
|
|
27
58
|
var isEditable = !byDocId[document.id] || isOwner(document.id) || canReshare(document.id);
|
|
28
59
|
|
|
29
60
|
if (isEditable) {
|
|
@@ -38,6 +69,11 @@ export var ShareModal = withLocales(function (props) {
|
|
|
38
69
|
owner: getOwner(document.id),
|
|
39
70
|
sharingType: getSharingType(document.id),
|
|
40
71
|
recipients: getRecipients(document.id),
|
|
41
|
-
onRevoke: revokeSelf
|
|
72
|
+
onRevoke: revokeSelf,
|
|
73
|
+
onRevokeSelf: handleRevokeSelf
|
|
42
74
|
}, rest));
|
|
43
|
-
});
|
|
75
|
+
});
|
|
76
|
+
ShareModal.propTypes = {
|
|
77
|
+
document: PropTypes.object.isRequired,
|
|
78
|
+
onRevokeSuccess: PropTypes.func
|
|
79
|
+
};
|
|
@@ -59,12 +59,12 @@ export var SharingDetailsModal = function SharingDetailsModal(_ref) {
|
|
|
59
59
|
className: styles['share-modal-content']
|
|
60
60
|
}, /*#__PURE__*/React.createElement("div", {
|
|
61
61
|
className: cx(styles['share-details'], isMobile ? 'u-ph-1 u-pt-1-half' : 'u-ph-2 u-pt-1')
|
|
62
|
-
}, /*#__PURE__*/React.createElement(OwnerIdentity, {
|
|
62
|
+
}, owner ? /*#__PURE__*/React.createElement(OwnerIdentity, {
|
|
63
63
|
name: t("".concat(documentType, ".share.sharedBy"), {
|
|
64
64
|
name: getDisplayName(owner)
|
|
65
65
|
}),
|
|
66
66
|
url: owner.instance
|
|
67
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
67
|
+
}) : null, /*#__PURE__*/React.createElement("div", {
|
|
68
68
|
className: styles['share-details-created']
|
|
69
69
|
}, t("".concat(documentType, ".share.details.createdAt"), {
|
|
70
70
|
date: f(document.created_at || null, 'do LLLL yyyy')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-sharing",
|
|
3
|
-
"version": "26.
|
|
3
|
+
"version": "26.5.1",
|
|
4
4
|
"description": "Provides sharing login for React applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Cozy",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"sideEffects": [
|
|
80
80
|
"*.css"
|
|
81
81
|
],
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "d9725e74f7a7245a8f8abd3d2cf595202ff6bf56"
|
|
83
83
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import omit from 'lodash/omit'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
2
3
|
import React from 'react'
|
|
3
4
|
import { useLocation } from 'react-router'
|
|
4
5
|
|
|
@@ -11,7 +12,7 @@ export const ShareModal = withLocales(props => {
|
|
|
11
12
|
const location = useLocation?.()
|
|
12
13
|
const locationProps = location?.state?.modalProps
|
|
13
14
|
const document = locationProps?.document || props.document
|
|
14
|
-
const rest = omit(locationProps || props, 'document')
|
|
15
|
+
const { onRevokeSuccess, ...rest } = omit(locationProps || props, 'document')
|
|
15
16
|
|
|
16
17
|
const {
|
|
17
18
|
byDocId,
|
|
@@ -24,6 +25,11 @@ export const ShareModal = withLocales(props => {
|
|
|
24
25
|
revokeSelf
|
|
25
26
|
} = useSharingContext()
|
|
26
27
|
|
|
28
|
+
const handleRevokeSelf = async document => {
|
|
29
|
+
await revokeSelf(document)
|
|
30
|
+
onRevokeSuccess?.(document)
|
|
31
|
+
}
|
|
32
|
+
|
|
27
33
|
const isEditable =
|
|
28
34
|
!byDocId[document.id] || isOwner(document.id) || canReshare(document.id)
|
|
29
35
|
|
|
@@ -39,7 +45,13 @@ export const ShareModal = withLocales(props => {
|
|
|
39
45
|
sharingType={getSharingType(document.id)}
|
|
40
46
|
recipients={getRecipients(document.id)}
|
|
41
47
|
onRevoke={revokeSelf}
|
|
48
|
+
onRevokeSelf={handleRevokeSelf}
|
|
42
49
|
{...rest}
|
|
43
50
|
/>
|
|
44
51
|
)
|
|
45
52
|
})
|
|
53
|
+
|
|
54
|
+
ShareModal.propTypes = {
|
|
55
|
+
document: PropTypes.object.isRequired,
|
|
56
|
+
onRevokeSuccess: PropTypes.func
|
|
57
|
+
}
|
|
@@ -40,12 +40,14 @@ export const SharingDetailsModal = ({
|
|
|
40
40
|
isMobile ? 'u-ph-1 u-pt-1-half' : 'u-ph-2 u-pt-1'
|
|
41
41
|
)}
|
|
42
42
|
>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
name
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
{owner ? (
|
|
44
|
+
<OwnerIdentity
|
|
45
|
+
name={t(`${documentType}.share.sharedBy`, {
|
|
46
|
+
name: getDisplayName(owner)
|
|
47
|
+
})}
|
|
48
|
+
url={owner.instance}
|
|
49
|
+
/>
|
|
50
|
+
) : null}
|
|
49
51
|
<div className={styles['share-details-created']}>
|
|
50
52
|
{t(`${documentType}.share.details.createdAt`, {
|
|
51
53
|
date: f(document.created_at || null, 'do LLLL yyyy')
|