cozy-sharing 4.5.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 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
+ ## [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
+
6
18
  # [4.5.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@4.4.1...cozy-sharing@4.5.0) (2022-07-13)
7
19
 
8
20
 
@@ -33,8 +33,8 @@ var SharingModal = function SharingModal(_ref) {
33
33
  export var ShareModal = withLocales(function (props) {
34
34
  var _location$state;
35
35
 
36
- var location = useLocation();
37
- var locationProps = (_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.modalProps;
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
38
  var document = (locationProps === null || locationProps === void 0 ? void 0 : locationProps.document) || props.document;
39
39
  var rest = omit(locationProps || props, 'document');
40
40
  return /*#__PURE__*/React.createElement(SharingContext.Consumer, null, function (_ref3) {
@@ -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.5.0",
3
+ "version": "4.5.1",
4
4
  "description": "Provides sharing login for React applications.",
5
5
  "main": "dist/index.js",
6
6
  "author": "Cozy",
@@ -63,5 +63,5 @@
63
63
  "sideEffects": [
64
64
  "*.css"
65
65
  ],
66
- "gitHead": "cae03c6aa378bb8a476ce4d598f894db5a93f595"
66
+ "gitHead": "41693a80c8ce6ce01ecf347412f63d9db626ec60"
67
67
  }
@@ -30,8 +30,8 @@ const SharingModal = ({ document, ...rest }) => (
30
30
  )
31
31
 
32
32
  export const ShareModal = withLocales(props => {
33
- const location = useLocation()
34
- const locationProps = location.state?.modalProps
33
+ const location = useLocation?.()
34
+ const locationProps = location?.state?.modalProps
35
35
  const document = locationProps?.document || props.document
36
36
  const rest = omit(locationProps || props, 'document')
37
37
 
@@ -30,14 +30,17 @@ export const ShareModal = ({
30
30
  twoStepsConfirmationMethods
31
31
  }) => {
32
32
  const showShareByEmail =
33
- documentType !== 'Albums' && !hasSharedParent && !hasSharedChild
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}