@automattic/jetpack-components 0.45.9 → 0.46.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 +13 -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/tools/jp-redirect/README.md +1 -1
- package/tools/jp-redirect/index.ts +1 -1
- package/tools/jp-redirect/types.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
### This is a list detailing changes for the Jetpack RNA Components package releases.
|
|
4
4
|
|
|
5
|
+
## [0.46.0] - 2024-01-18
|
|
6
|
+
### Changed
|
|
7
|
+
- Use blog ID for links instead of site slug. [#34950]
|
|
8
|
+
|
|
9
|
+
## [0.45.10] - 2024-01-04
|
|
10
|
+
### Changed
|
|
11
|
+
- Updated package dependencies. [#34815] [#34816]
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
- Added consistency for Jetpack footer links [#34787]
|
|
15
|
+
|
|
5
16
|
## [0.45.9] - 2024-01-02
|
|
6
17
|
### Changed
|
|
7
18
|
- Updated the design and fixed a11y for Quick Share buttons. [#34754]
|
|
@@ -910,6 +921,8 @@
|
|
|
910
921
|
### Changed
|
|
911
922
|
- Update node version requirement to 14.16.1
|
|
912
923
|
|
|
924
|
+
[0.46.0]: https://github.com/Automattic/jetpack-components/compare/0.45.10...0.46.0
|
|
925
|
+
[0.45.10]: https://github.com/Automattic/jetpack-components/compare/0.45.9...0.45.10
|
|
913
926
|
[0.45.9]: https://github.com/Automattic/jetpack-components/compare/0.45.8...0.45.9
|
|
914
927
|
[0.45.8]: https://github.com/Automattic/jetpack-components/compare/0.45.7...0.45.8
|
|
915
928
|
[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.
|
|
3
|
+
"version": "0.46.0",
|
|
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
|
+
}
|
|
@@ -25,7 +25,7 @@ This is optional and allows you to pass an object with more parameters to build
|
|
|
25
25
|
|
|
26
26
|
This is not a complete list as any argument passed here will be sent to as a query parameter to the Redirect server. These parameters will not necessarily be passed over to the final destination URL. If you want to add a parameter to the final destination URL, use the `query` argument.
|
|
27
27
|
|
|
28
|
-
* **site**: Optional (but recommended). This is used to identify the site and also to fill in the `[site]` placeholder in the target. Will default to the value of `jetpack_redirects.currentSiteRawUrl`, if available.
|
|
28
|
+
* **site**: Optional (but recommended). This is used to identify the site and also to fill in the `[site]` placeholder in the target. Will default to the value of `jetpack_redirects.currentBlogID` or `jetpack_redirects.currentSiteRawUrl`, if available.
|
|
29
29
|
|
|
30
30
|
* **path**: Optional. Used to fill in the `[path]` placeholder in the target.
|
|
31
31
|
|
|
@@ -47,7 +47,7 @@ export default function getRedirectUrl( source: string, args: GetRedirectUrlArgs
|
|
|
47
47
|
typeof jetpack_redirects !== 'undefined' &&
|
|
48
48
|
jetpack_redirects.hasOwnProperty( 'currentSiteRawUrl' )
|
|
49
49
|
) {
|
|
50
|
-
queryVars.site = jetpack_redirects.currentSiteRawUrl;
|
|
50
|
+
queryVars.site = jetpack_redirects.currentBlogID ?? jetpack_redirects.currentSiteRawUrl;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
if ( calypsoEnv ) {
|