@automattic/jetpack-shared-extension-utils 0.17.5 → 0.18.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 +8 -0
- package/index.js +1 -0
- package/package.json +5 -4
- package/src/should-use-internal-links.js +16 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.18.0] - 2025-03-12
|
|
9
|
+
### Added
|
|
10
|
+
- Add `shouldUseInternalLinks()`. [#42000]
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
- Update package dependencies. [#42384]
|
|
14
|
+
|
|
8
15
|
## [0.17.5] - 2025-03-10
|
|
9
16
|
### Added
|
|
10
17
|
- Social: Move useUpgradeFlow from Jetpack plugin to the shared package. [#41836]
|
|
@@ -551,6 +558,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
551
558
|
### Changed
|
|
552
559
|
- Core: prepare utility for release
|
|
553
560
|
|
|
561
|
+
[0.18.0]: https://github.com/Automattic/jetpack-shared-extension-utils/compare/0.17.5...0.18.0
|
|
554
562
|
[0.17.5]: https://github.com/Automattic/jetpack-shared-extension-utils/compare/0.17.4...0.17.5
|
|
555
563
|
[0.17.4]: https://github.com/Automattic/jetpack-shared-extension-utils/compare/0.17.3...0.17.4
|
|
556
564
|
[0.17.3]: https://github.com/Automattic/jetpack-shared-extension-utils/compare/0.17.2...0.17.3
|
package/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './src/block-icons';
|
|
2
2
|
export { default as getJetpackData, JETPACK_DATA_PATH } from './src/get-jetpack-data';
|
|
3
3
|
export { default as getSiteFragment } from './src/get-site-fragment';
|
|
4
|
+
export { default as shouldUseInternalLinks } from './src/should-use-internal-links';
|
|
4
5
|
export * from './src/site-type-utils';
|
|
5
6
|
export { default as getJetpackExtensionAvailability } from './src/get-jetpack-extension-availability';
|
|
6
7
|
export { default as registerJetpackPlugin } from './src/register-jetpack-plugin';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automattic/jetpack-shared-extension-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Utility functions used by the block editor extensions",
|
|
5
5
|
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/shared-extension-utils/#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -21,8 +21,9 @@
|
|
|
21
21
|
"@automattic/color-studio": "4.0.0",
|
|
22
22
|
"@automattic/jetpack-analytics": "^0.1.36",
|
|
23
23
|
"@automattic/jetpack-base-styles": "^0.6.44",
|
|
24
|
-
"@automattic/jetpack-components": "^0.68.
|
|
25
|
-
"@automattic/jetpack-connection": "^0.39.
|
|
24
|
+
"@automattic/jetpack-components": "^0.68.2",
|
|
25
|
+
"@automattic/jetpack-connection": "^0.39.1",
|
|
26
|
+
"@automattic/jetpack-script-data": "^0.2.1",
|
|
26
27
|
"@wordpress/api-fetch": "7.19.0",
|
|
27
28
|
"@wordpress/block-editor": "14.14.0",
|
|
28
29
|
"@wordpress/components": "29.5.0",
|
|
@@ -42,7 +43,7 @@
|
|
|
42
43
|
"@babel/core": "7.26.0",
|
|
43
44
|
"@babel/plugin-transform-react-jsx": "7.25.9",
|
|
44
45
|
"@babel/preset-react": "7.26.3",
|
|
45
|
-
"@babel/runtime": "7.26.
|
|
46
|
+
"@babel/runtime": "7.26.10",
|
|
46
47
|
"@testing-library/dom": "10.4.0",
|
|
47
48
|
"@testing-library/react": "16.2.0",
|
|
48
49
|
"@testing-library/user-event": "14.6.1",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { getScriptData } from '@automattic/jetpack-script-data';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Return whether to use internal Jetpack admin links or not.
|
|
5
|
+
*
|
|
6
|
+
* @return {boolean} True if Jetpack admin links are available and should be used, false otherwise.
|
|
7
|
+
*/
|
|
8
|
+
export default function shouldUseInternalLinks() {
|
|
9
|
+
const { connectedPlugins, connectionStatus } = getScriptData()?.connection ?? {};
|
|
10
|
+
return (
|
|
11
|
+
// Some admin pages require the site to be connected (e.g. Privacy)
|
|
12
|
+
connectionStatus?.isActive &&
|
|
13
|
+
// Admin pages are part of the Jetpack plugin and require it to be installed
|
|
14
|
+
connectedPlugins?.some( ( { slug } ) => 'jetpack' === slug )
|
|
15
|
+
);
|
|
16
|
+
}
|