@automattic/jetpack-components 0.68.1 → 0.68.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 CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ### This is a list detailing changes for the Jetpack RNA Components package releases.
4
4
 
5
+ ## [0.68.2] - 2025-03-12
6
+ ### Added
7
+ - Add role to Jetpack footer. [#42156]
8
+ - Provide connection data to footer component. [#42000]
9
+
5
10
  ## [0.68.1] - 2025-03-05
6
11
  ### Changed
7
12
  - Update package dependencies. [#42162]
@@ -1305,6 +1310,7 @@
1305
1310
  ### Changed
1306
1311
  - Update node version requirement to 14.16.1
1307
1312
 
1313
+ [0.68.2]: https://github.com/Automattic/jetpack-components/compare/0.68.1...0.68.2
1308
1314
  [0.68.1]: https://github.com/Automattic/jetpack-components/compare/0.68.0...0.68.1
1309
1315
  [0.68.0]: https://github.com/Automattic/jetpack-components/compare/0.67.1...0.68.0
1310
1316
  [0.67.1]: https://github.com/Automattic/jetpack-components/compare/0.67.0...0.67.1
@@ -24,6 +24,7 @@ const AdminPage: React.FC< AdminPageProps > = ( {
24
24
  moduleNameHref,
25
25
  showHeader = true,
26
26
  showFooter = true,
27
+ useInternalLinks = false,
27
28
  showBackground = true,
28
29
  sandboxedDomain = '',
29
30
  apiRoot = '',
@@ -90,6 +91,7 @@ const AdminPage: React.FC< AdminPageProps > = ( {
90
91
  moduleName={ moduleName }
91
92
  moduleNameHref={ moduleNameHref }
92
93
  menu={ optionalMenuItems }
94
+ useInternalLinks={ useInternalLinks }
93
95
  />
94
96
  </Col>
95
97
  </Container>
@@ -26,6 +26,11 @@ export type AdminPageProps = {
26
26
  */
27
27
  showFooter?: boolean;
28
28
 
29
+ /**
30
+ * Whether or not to link to Jetpack plugin admin pages.
31
+ */
32
+ useInternalLinks?: boolean;
33
+
29
34
  /**
30
35
  * Link that the Footer Module name will link to (optional).
31
36
  */
@@ -1,9 +1,7 @@
1
- import { useSelect } from '@wordpress/data';
2
1
  import { __, _x } from '@wordpress/i18n';
3
2
  import { Icon, external } from '@wordpress/icons';
4
3
  import clsx from 'clsx';
5
4
  import React from 'react';
6
- import { STORE_ID as CONNECTION_STORE_ID } from '../../../../js-packages/connection/state/store.jsx';
7
5
  import { getRedirectUrl } from '../../index.js';
8
6
  import getSiteAdminUrl from '../../tools/get-site-admin-url/index.js';
9
7
  import AutomatticBylineLogo from '../automattic-byline-logo/index.js';
@@ -39,6 +37,7 @@ const JetpackFooter: React.FC< JetpackFooterProps > = ( {
39
37
  className,
40
38
  moduleNameHref = 'https://jetpack.com',
41
39
  menu,
40
+ useInternalLinks,
42
41
  onAboutClick,
43
42
  onPrivacyClick,
44
43
  onTermsClick,
@@ -48,42 +47,25 @@ const JetpackFooter: React.FC< JetpackFooterProps > = ( {
48
47
  const [ isMd ] = useBreakpointMatch( 'md', '<=' );
49
48
  const [ isLg ] = useBreakpointMatch( 'lg', '>' );
50
49
 
51
- const { isActive, connectedPlugins } = useSelect( select => {
52
- const connectionStatus = select( CONNECTION_STORE_ID ) as {
53
- getConnectedPlugins: () => { slug: string }[];
54
- getConnectionStatus: () => { isActive: boolean };
55
- };
56
-
57
- return {
58
- connectedPlugins: connectionStatus?.getConnectedPlugins(),
59
- ...connectionStatus.getConnectionStatus(),
60
- };
61
- }, [] );
62
50
  const siteAdminUrl = getSiteAdminUrl();
63
- const areAdminLinksEnabled =
64
- siteAdminUrl &&
65
- // Some admin pages require the site to be connected (e.g., Privacy)
66
- isActive &&
67
- // Admin pages are part of the Jetpack plugin and required it to be installed
68
- connectedPlugins?.some( ( { slug } ) => 'jetpack' === slug );
69
51
 
70
52
  let items: JetpackFooterMenuItem[] = [
71
53
  {
72
54
  label: _x( 'About', 'Link to learn more about Jetpack.', 'jetpack-components' ),
73
55
  title: __( 'About Jetpack', 'jetpack-components' ),
74
- href: areAdminLinksEnabled
56
+ href: useInternalLinks
75
57
  ? new URL( 'admin.php?page=jetpack_about', siteAdminUrl ).href
76
58
  : getRedirectUrl( 'jetpack-about' ),
77
- target: areAdminLinksEnabled ? '_self' : '_blank',
59
+ target: useInternalLinks ? '_self' : '_blank',
78
60
  onClick: onAboutClick,
79
61
  },
80
62
  {
81
63
  label: _x( 'Privacy', 'Shorthand for Privacy Policy.', 'jetpack-components' ),
82
64
  title: __( "Automattic's Privacy Policy", 'jetpack-components' ),
83
- href: areAdminLinksEnabled
65
+ href: useInternalLinks
84
66
  ? new URL( 'admin.php?page=jetpack#/privacy', siteAdminUrl ).href
85
67
  : getRedirectUrl( 'a8c-privacy' ),
86
- target: areAdminLinksEnabled ? '_self' : '_blank',
68
+ target: useInternalLinks ? '_self' : '_blank',
87
69
  onClick: onPrivacyClick,
88
70
  },
89
71
  {
@@ -118,6 +100,7 @@ const JetpackFooter: React.FC< JetpackFooterProps > = ( {
118
100
  className
119
101
  ) }
120
102
  aria-label={ __( 'Jetpack', 'jetpack-components' ) }
103
+ role="contentinfo"
121
104
  { ...otherProps }
122
105
  >
123
106
  <ul>
@@ -156,7 +139,7 @@ const JetpackFooter: React.FC< JetpackFooterProps > = ( {
156
139
  <li className="jp-dashboard-footer__a8c-item">
157
140
  <a
158
141
  href={
159
- areAdminLinksEnabled
142
+ useInternalLinks
160
143
  ? new URL( 'admin.php?page=jetpack_about', siteAdminUrl ).href
161
144
  : getRedirectUrl( 'a8c-about' )
162
145
  }
@@ -29,6 +29,11 @@ export type JetpackFooterProps = {
29
29
  */
30
30
  menu?: JetpackFooterMenuItem[];
31
31
 
32
+ /**
33
+ * Whether to enable Jetpack admin links.
34
+ */
35
+ useInternalLinks?: boolean;
36
+
32
37
  /**
33
38
  * URL of the site WP Admin.
34
39
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/jetpack-components",
3
- "version": "0.68.1",
3
+ "version": "0.68.2",
4
4
  "description": "Jetpack Components Package",
5
5
  "author": "Automattic",
6
6
  "license": "GPL-2.0-or-later",
@@ -15,9 +15,10 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@automattic/format-currency": "1.0.1",
18
- "@automattic/jetpack-boost-score-api": "^0.1.58",
18
+ "@automattic/jetpack-boost-score-api": "^0.1.59",
19
19
  "@automattic/jetpack-api": "^0.20.0",
20
20
  "@automattic/jetpack-scan": "^0.5.8",
21
+ "@automattic/jetpack-script-data": "^0.2.1",
21
22
  "@babel/runtime": "^7",
22
23
  "@wordpress/browserslist-config": "6.19.0",
23
24
  "@wordpress/components": "29.5.0",
@@ -1,3 +1,5 @@
1
+ import { getScriptData } from '@automattic/jetpack-script-data';
2
+
1
3
  /**
2
4
  * Returns the site admin URL.
3
5
  *
@@ -5,6 +7,7 @@
5
7
  */
6
8
  export default function getSiteAdminUrl() {
7
9
  return (
10
+ getScriptData()?.site?.admin_url ||
8
11
  window.Initial_State?.adminUrl ||
9
12
  window.Jetpack_Editor_Initial_State?.adminUrl ||
10
13
  window?.myJetpackInitialState?.adminUrl ||