cozy-sharing 26.3.0 → 26.5.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/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.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@26.4.0...cozy-sharing@26.5.0) (2025-10-06)
7
+
8
+ ### Features
9
+
10
+ - Add onRevokeSuccess callback :sparkles: ([3845ace](https://github.com/cozy/cozy-libs/commit/3845aced0e3cf365ffbc183bb5c5cf894b04e667))
11
+
12
+ # [26.4.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@26.3.0...cozy-sharing@26.4.0) (2025-09-25)
13
+
14
+ ### Features
15
+
16
+ - Upgrade peerDep for flags and sharing ([4bb85b9](https://github.com/cozy/cozy-libs/commit/4bb85b94fafb5937beb9e1515a71f60fe7cbca2f))
17
+
6
18
  # [26.3.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@26.2.1...cozy-sharing@26.3.0) (2025-09-24)
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
- var rest = omit(locationProps || props, 'document');
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
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-sharing",
3
- "version": "26.3.0",
3
+ "version": "26.5.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.5.1",
33
33
  "cozy-device-helper": "^4.0.0",
34
- "cozy-doctypes": "^1.98.0",
34
+ "cozy-doctypes": "^1.98.1",
35
35
  "date-fns": "2.30.0",
36
36
  "lodash": "^4.17.21",
37
37
  "react-autosuggest": "^10.1.0",
@@ -72,12 +72,12 @@
72
72
  "cozy-intent": ">=2.29.1",
73
73
  "cozy-minilog": ">=3.9.1",
74
74
  "cozy-ui": ">=128.3.5",
75
- "prop-types": "^15.7.2",
76
- "react": "^16.12.0",
77
- "react-router": "^5.0.1"
75
+ "prop-types": ">=15.7.2",
76
+ "react": ">=16.12.0",
77
+ "react-router": ">=5.0.1"
78
78
  },
79
79
  "sideEffects": [
80
80
  "*.css"
81
81
  ],
82
- "gitHead": "eee91aab0f6a7e314ea01b19ef23d147ec795997"
82
+ "gitHead": "01e5edc2733656b0af94d193ae71e06238c90eec"
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
+ }