cozy-sharing 6.0.0 → 6.0.2
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 +22 -0
- package/dist/SharingBanner/hooks/useSharingInfos.js +3 -2
- package/dist/SharingBanner/index.js +7 -2
- package/dist/components/ConfirmTrustedRecipientsDialog.js +1 -1
- package/package.json +2 -2
- package/src/SharingBanner/hooks/useSharingInfos.jsx +3 -3
- package/src/SharingBanner/index.jsx +7 -3
- package/src/components/ConfirmTrustedRecipientsDialog.jsx +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
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
|
+
## [6.0.2](https://github.com/cozy/cozy-libs/compare/cozy-sharing@6.0.1...cozy-sharing@6.0.2) (2023-02-06)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **SharingBanner:** Add custom previewPath ([4221243](https://github.com/cozy/cozy-libs/commit/42212432995d5e91511c85f31aef30a2dcf009aa))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [6.0.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@6.0.0...cozy-sharing@6.0.1) (2023-02-02)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* Recipient import path not updated in last update ([56b9cfd](https://github.com/cozy/cozy-libs/commit/56b9cfdab402813527982d0ddf857f1e963850b1))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
# 6.0.0 (2023-01-31)
|
|
7
29
|
|
|
8
30
|
|
|
@@ -14,6 +14,7 @@ var getSharingId = function getSharingId(permission) {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export var useSharingInfos = function useSharingInfos() {
|
|
17
|
+
var previewPath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '/preview';
|
|
17
18
|
var client = useClient();
|
|
18
19
|
|
|
19
20
|
var _useState = useState(),
|
|
@@ -92,12 +93,12 @@ export var useSharingInfos = function useSharingInfos() {
|
|
|
92
93
|
};
|
|
93
94
|
}();
|
|
94
95
|
|
|
95
|
-
if (window.location.pathname ===
|
|
96
|
+
if (window.location.pathname === previewPath) {
|
|
96
97
|
loadSharingDiscoveryLink();
|
|
97
98
|
} else {
|
|
98
99
|
setLoading(false);
|
|
99
100
|
}
|
|
100
|
-
}, [client]);
|
|
101
|
+
}, [client, previewPath]);
|
|
101
102
|
return {
|
|
102
103
|
sharing: sharing,
|
|
103
104
|
loading: loading,
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
2
3
|
import withLocales from '../withLocales';
|
|
3
4
|
import { useSharingInfos } from './hooks/useSharingInfos';
|
|
4
5
|
import { SharingBanner } from './components/SharingBanner';
|
|
5
6
|
|
|
6
|
-
var Plugin = function Plugin() {
|
|
7
|
-
var
|
|
7
|
+
var Plugin = function Plugin(_ref) {
|
|
8
|
+
var previewPath = _ref.previewPath;
|
|
9
|
+
var sharingInfos = useSharingInfos(previewPath);
|
|
8
10
|
return /*#__PURE__*/React.createElement(SharingBanner, {
|
|
9
11
|
sharingInfos: sharingInfos
|
|
10
12
|
});
|
|
11
13
|
};
|
|
12
14
|
|
|
15
|
+
Plugin.propTypes = {
|
|
16
|
+
previewPath: PropTypes.string
|
|
17
|
+
};
|
|
13
18
|
export var SharingBannerPlugin = withLocales(Plugin);
|
|
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { useI18n } from 'cozy-ui/transpiled/react/I18n';
|
|
5
5
|
import Typography from 'cozy-ui/transpiled/react/Typography';
|
|
6
|
-
import Recipient from './Recipient';
|
|
6
|
+
import Recipient from './Recipient/Recipient';
|
|
7
7
|
import ShareDialogTwoStepsConfirmationContainer from './ShareDialogTwoStepsConfirmationContainer';
|
|
8
8
|
/**
|
|
9
9
|
* Displays the sharing interface that can be used when ConfirmTrustedRecipientsDialog is in sharing state
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-sharing",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.2",
|
|
4
4
|
"description": "Provides sharing login for React applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Cozy",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"sideEffects": [
|
|
62
62
|
"*.css"
|
|
63
63
|
],
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "0bcbe0e43f780df20d9a02fc0f9fe3814bccd23c"
|
|
65
65
|
}
|
|
@@ -12,7 +12,7 @@ const getSharingId = permission => {
|
|
|
12
12
|
return sharingId
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export const useSharingInfos = () => {
|
|
15
|
+
export const useSharingInfos = (previewPath = '/preview') => {
|
|
16
16
|
const client = useClient()
|
|
17
17
|
|
|
18
18
|
const [discoveryLink, setDiscoveryLink] = useState()
|
|
@@ -52,12 +52,12 @@ export const useSharingInfos = () => {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
if (window.location.pathname ===
|
|
55
|
+
if (window.location.pathname === previewPath) {
|
|
56
56
|
loadSharingDiscoveryLink()
|
|
57
57
|
} else {
|
|
58
58
|
setLoading(false)
|
|
59
59
|
}
|
|
60
|
-
}, [client])
|
|
60
|
+
}, [client, previewPath])
|
|
61
61
|
|
|
62
62
|
return {
|
|
63
63
|
sharing,
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
2
3
|
|
|
3
4
|
import withLocales from '../withLocales'
|
|
4
5
|
import { useSharingInfos } from './hooks/useSharingInfos'
|
|
5
6
|
import { SharingBanner } from './components/SharingBanner'
|
|
6
7
|
|
|
7
|
-
const Plugin = () => {
|
|
8
|
-
const sharingInfos = useSharingInfos()
|
|
9
|
-
|
|
8
|
+
const Plugin = ({ previewPath }) => {
|
|
9
|
+
const sharingInfos = useSharingInfos(previewPath)
|
|
10
10
|
return <SharingBanner sharingInfos={sharingInfos} />
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
Plugin.propTypes = {
|
|
14
|
+
previewPath: PropTypes.string
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
export const SharingBannerPlugin = withLocales(Plugin)
|
|
@@ -2,7 +2,7 @@ import React from 'react'
|
|
|
2
2
|
import { useI18n } from 'cozy-ui/transpiled/react/I18n'
|
|
3
3
|
import Typography from 'cozy-ui/transpiled/react/Typography'
|
|
4
4
|
|
|
5
|
-
import Recipient from './Recipient'
|
|
5
|
+
import Recipient from './Recipient/Recipient'
|
|
6
6
|
|
|
7
7
|
import ShareDialogTwoStepsConfirmationContainer from './ShareDialogTwoStepsConfirmationContainer'
|
|
8
8
|
|