cozy-sharing 6.0.1 → 6.0.3
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,25 @@
|
|
|
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.3](https://github.com/cozy/cozy-libs/compare/cozy-sharing@6.0.2...cozy-sharing@6.0.3) (2023-02-08)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package cozy-sharing
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [6.0.2](https://github.com/cozy/cozy-libs/compare/cozy-sharing@6.0.1...cozy-sharing@6.0.2) (2023-02-06)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **SharingBanner:** Add custom previewPath ([4221243](https://github.com/cozy/cozy-libs/commit/42212432995d5e91511c85f31aef30a2dcf009aa))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [6.0.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@6.0.0...cozy-sharing@6.0.1) (2023-02-02)
|
|
7
26
|
|
|
8
27
|
|
|
@@ -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);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-sharing",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.3",
|
|
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.7.0",
|
|
32
|
-
"cozy-doctypes": "^1.
|
|
32
|
+
"cozy-doctypes": "^1.88.0",
|
|
33
33
|
"lodash": "^4.17.19",
|
|
34
34
|
"react-autosuggest": "^10.1.0",
|
|
35
35
|
"react-tooltip": "^3.11.1",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"sideEffects": [
|
|
62
62
|
"*.css"
|
|
63
63
|
],
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "d999a80061d173dcf25e6715cad4db1cb032f38f"
|
|
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)
|