@automattic/jetpack-components 0.45.9 → 0.45.10
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 +8 -0
- package/components/admin-page/types.ts +5 -0
- package/components/jetpack-footer/README.md +0 -1
- package/components/jetpack-footer/index.tsx +3 -3
- package/package.json +13 -13
- package/tools/get-site-admin-url/README.md +10 -0
- package/tools/get-site-admin-url/index.ts +14 -0
- package/tools/get-site-admin-url/types.ts +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
### This is a list detailing changes for the Jetpack RNA Components package releases.
|
|
4
4
|
|
|
5
|
+
## [0.45.10] - 2024-01-04
|
|
6
|
+
### Changed
|
|
7
|
+
- Updated package dependencies. [#34815] [#34816]
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
- Added consistency for Jetpack footer links [#34787]
|
|
11
|
+
|
|
5
12
|
## [0.45.9] - 2024-01-02
|
|
6
13
|
### Changed
|
|
7
14
|
- Updated the design and fixed a11y for Quick Share buttons. [#34754]
|
|
@@ -910,6 +917,7 @@
|
|
|
910
917
|
### Changed
|
|
911
918
|
- Update node version requirement to 14.16.1
|
|
912
919
|
|
|
920
|
+
[0.45.10]: https://github.com/Automattic/jetpack-components/compare/0.45.9...0.45.10
|
|
913
921
|
[0.45.9]: https://github.com/Automattic/jetpack-components/compare/0.45.8...0.45.9
|
|
914
922
|
[0.45.8]: https://github.com/Automattic/jetpack-components/compare/0.45.7...0.45.8
|
|
915
923
|
[0.45.7]: https://github.com/Automattic/jetpack-components/compare/0.45.6...0.45.7
|
|
@@ -18,4 +18,3 @@ It takes moduleName and URL to show in the footer.
|
|
|
18
18
|
- `onAboutClick`: () => void - (default: `undefined`) function called when the About link is clicked.
|
|
19
19
|
- `onPrivacyClick`: () => void - (default: `undefined`) function called when the Privacy link is clicked.
|
|
20
20
|
- `onTermsClick`: () => void - (default: `undefined`) function called when the Terms link is clicked.
|
|
21
|
-
- `siteAdminUrl`: String - (default: `undefined`) URL of the site WP Admin. Required to link to internal pages when applicable (e.g., Privacy).
|
|
@@ -5,6 +5,7 @@ import classnames from 'classnames';
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { getRedirectUrl } from '../..';
|
|
7
7
|
import { STORE_ID as CONNECTION_STORE_ID } from '../../../../js-packages/connection/state/store';
|
|
8
|
+
import getSiteAdminUrl from '../../tools/get-site-admin-url';
|
|
8
9
|
import AutomatticBylineLogo from '../automattic-byline-logo';
|
|
9
10
|
import './style.scss';
|
|
10
11
|
import JetpackLogo from '../jetpack-logo';
|
|
@@ -26,7 +27,6 @@ const JetpackFooter: React.FC< JetpackFooterProps > = ( {
|
|
|
26
27
|
className,
|
|
27
28
|
moduleNameHref = 'https://jetpack.com',
|
|
28
29
|
menu,
|
|
29
|
-
siteAdminUrl,
|
|
30
30
|
onAboutClick,
|
|
31
31
|
onPrivacyClick,
|
|
32
32
|
onTermsClick,
|
|
@@ -50,7 +50,7 @@ const JetpackFooter: React.FC< JetpackFooterProps > = ( {
|
|
|
50
50
|
},
|
|
51
51
|
[ CONNECTION_STORE_ID ]
|
|
52
52
|
);
|
|
53
|
-
|
|
53
|
+
const siteAdminUrl = getSiteAdminUrl();
|
|
54
54
|
const areAdminLinksEnabled =
|
|
55
55
|
siteAdminUrl &&
|
|
56
56
|
// Some admin pages require the site to be connected (e.g., Privacy)
|
|
@@ -65,7 +65,7 @@ const JetpackFooter: React.FC< JetpackFooterProps > = ( {
|
|
|
65
65
|
href: areAdminLinksEnabled
|
|
66
66
|
? new URL( 'admin.php?page=jetpack_about', siteAdminUrl ).href
|
|
67
67
|
: getRedirectUrl( 'jetpack-about' ),
|
|
68
|
-
target: '_blank',
|
|
68
|
+
target: areAdminLinksEnabled ? '_self' : '_blank',
|
|
69
69
|
onClick: onAboutClick,
|
|
70
70
|
},
|
|
71
71
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automattic/jetpack-components",
|
|
3
|
-
"version": "0.45.
|
|
3
|
+
"version": "0.45.10",
|
|
4
4
|
"description": "Jetpack Components Package",
|
|
5
5
|
"author": "Automattic",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -15,16 +15,16 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@automattic/format-currency": "1.0.1",
|
|
18
|
-
"@automattic/jetpack-boost-score-api": "^0.1.
|
|
18
|
+
"@automattic/jetpack-boost-score-api": "^0.1.19",
|
|
19
19
|
"@babel/runtime": "^7",
|
|
20
|
-
"@wordpress/browserslist-config": "5.
|
|
21
|
-
"@wordpress/components": "25.
|
|
22
|
-
"@wordpress/compose": "6.
|
|
23
|
-
"@wordpress/data": "9.
|
|
24
|
-
"@wordpress/date": "4.
|
|
25
|
-
"@wordpress/element": "5.
|
|
26
|
-
"@wordpress/i18n": "4.
|
|
27
|
-
"@wordpress/icons": "9.
|
|
20
|
+
"@wordpress/browserslist-config": "5.31.0",
|
|
21
|
+
"@wordpress/components": "25.14.0",
|
|
22
|
+
"@wordpress/compose": "6.25.0",
|
|
23
|
+
"@wordpress/data": "9.18.0",
|
|
24
|
+
"@wordpress/date": "4.48.0",
|
|
25
|
+
"@wordpress/element": "5.25.0",
|
|
26
|
+
"@wordpress/i18n": "4.48.0",
|
|
27
|
+
"@wordpress/icons": "9.39.0",
|
|
28
28
|
"classnames": "2.3.2",
|
|
29
29
|
"prop-types": "^15.7.2",
|
|
30
30
|
"qrcode.react": "3.1.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"uplot-react": "1.1.4"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@automattic/jetpack-base-styles": "^0.6.
|
|
37
|
+
"@automattic/jetpack-base-styles": "^0.6.15",
|
|
38
38
|
"@babel/core": "7.23.5",
|
|
39
39
|
"@babel/preset-react": "7.23.3",
|
|
40
40
|
"@jest/globals": "29.4.3",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"@storybook/react": "7.6.5",
|
|
44
44
|
"@testing-library/dom": "9.3.3",
|
|
45
45
|
"@testing-library/react": "14.1.2",
|
|
46
|
-
"@testing-library/user-event": "14.5.
|
|
47
|
-
"@types/jest": "29.5.
|
|
46
|
+
"@testing-library/user-event": "14.5.2",
|
|
47
|
+
"@types/jest": "29.5.11",
|
|
48
48
|
"@types/qrcode.react": "1.0.4",
|
|
49
49
|
"@types/react": "18.2.33",
|
|
50
50
|
"@types/react-dom": "18.2.14",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# GetSiteAdminUrl
|
|
2
|
+
|
|
3
|
+
The `getsiteadminurl` tool is a utility that retrieves the URL of the site administrator for a given website. It is designed to unify the process of obtaining the admin URL.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
import { getSiteAdminUrl } from '@automattic/jetpack-components';
|
|
9
|
+
getSiteAdminUrl();
|
|
10
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import './types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the site admin URL.
|
|
4
|
+
*
|
|
5
|
+
* @returns {?string} The site admin URL or null if not available.
|
|
6
|
+
*/
|
|
7
|
+
export default function getSiteAdminUrl() {
|
|
8
|
+
return (
|
|
9
|
+
window.Initial_State?.adminUrl ||
|
|
10
|
+
window.Jetpack_Editor_Initial_State?.adminUrl ||
|
|
11
|
+
window?.myJetpackInitialState?.adminUrl ||
|
|
12
|
+
null
|
|
13
|
+
);
|
|
14
|
+
}
|