@automattic/jetpack-connection 0.34.2 → 0.35.1
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,14 @@
|
|
|
2
2
|
|
|
3
3
|
### This is a list detailing changes for the Jetpack RNA Connection Component releases.
|
|
4
4
|
|
|
5
|
+
## [0.35.1] - 2024-08-15
|
|
6
|
+
### Changed
|
|
7
|
+
- Updated package dependencies. [#38665]
|
|
8
|
+
|
|
9
|
+
## [0.35.0] - 2024-08-13
|
|
10
|
+
### Added
|
|
11
|
+
- Updated the connection initial state to fallback on the new consolidated Jetpack script data [#38825]
|
|
12
|
+
|
|
5
13
|
## [0.34.2] - 2024-08-09
|
|
6
14
|
### Added
|
|
7
15
|
- React 19 compatibility: Making sure useRef includes an argument. [#38765]
|
|
@@ -812,6 +820,8 @@
|
|
|
812
820
|
- `Main` and `ConnectUser` components added.
|
|
813
821
|
- `JetpackRestApiClient` API client added.
|
|
814
822
|
|
|
823
|
+
[0.35.1]: https://github.com/Automattic/jetpack-connection-js/compare/v0.35.0...v0.35.1
|
|
824
|
+
[0.35.0]: https://github.com/Automattic/jetpack-connection-js/compare/v0.34.2...v0.35.0
|
|
815
825
|
[0.34.2]: https://github.com/Automattic/jetpack-connection-js/compare/v0.34.1...v0.34.2
|
|
816
826
|
[0.34.1]: https://github.com/Automattic/jetpack-connection-js/compare/v0.34.0...v0.34.1
|
|
817
827
|
[0.34.0]: https://github.com/Automattic/jetpack-connection-js/compare/v0.33.19...v0.34.0
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import restApi from '@automattic/jetpack-api';
|
|
2
|
+
import { getScriptData } from '@automattic/jetpack-script-data';
|
|
2
3
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
3
4
|
import { useEffect } from 'react';
|
|
4
5
|
import { STORE_ID } from '../../state/store';
|
|
5
6
|
|
|
6
|
-
const initialState = window?.JP_CONNECTION_INITIAL_STATE
|
|
7
|
+
const initialState = window?.JP_CONNECTION_INITIAL_STATE || getScriptData()?.connection || {};
|
|
7
8
|
|
|
8
9
|
export default ( {
|
|
9
10
|
registrationNonce = initialState.registrationNonce,
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import { getScriptData } from '@automattic/jetpack-script-data';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Get the Calypso origin based on the development environment.
|
|
3
5
|
*
|
|
4
6
|
* @returns {string} The Calypso url origin.
|
|
5
7
|
*/
|
|
6
8
|
export default function getCalypsoOrigin() {
|
|
7
|
-
const calypsoEnv =
|
|
8
|
-
typeof window !== 'undefined' && window?.JP_CONNECTION_INITIAL_STATE
|
|
9
|
+
const calypsoEnv = (
|
|
10
|
+
( typeof window !== 'undefined' && window?.JP_CONNECTION_INITIAL_STATE ) ||
|
|
11
|
+
getScriptData()?.connection
|
|
12
|
+
)?.calypsoEnv;
|
|
9
13
|
|
|
10
14
|
switch ( calypsoEnv ) {
|
|
11
15
|
case 'development':
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import restApi from '@automattic/jetpack-api';
|
|
2
2
|
import { getCalypsoOrigin } from '@automattic/jetpack-connection';
|
|
3
|
+
import { getScriptData } from '@automattic/jetpack-script-data';
|
|
3
4
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
4
5
|
import debugFactory from 'debug';
|
|
5
6
|
import { useEffect, useState, useMemo } from 'react';
|
|
@@ -13,7 +14,7 @@ const {
|
|
|
13
14
|
apiRoot,
|
|
14
15
|
apiNonce,
|
|
15
16
|
siteSuffix: defaultSiteSuffix,
|
|
16
|
-
} = window?.JP_CONNECTION_INITIAL_STATE
|
|
17
|
+
} = window?.JP_CONNECTION_INITIAL_STATE || getScriptData()?.connection || {};
|
|
17
18
|
const defaultAdminUrl =
|
|
18
19
|
typeof window !== 'undefined' ? window?.myJetpackInitialState?.adminUrl : null;
|
|
19
20
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import restApi from '@automattic/jetpack-api';
|
|
2
|
+
import { getScriptData } from '@automattic/jetpack-script-data';
|
|
2
3
|
import { useDispatch } from '@wordpress/data';
|
|
3
4
|
import { useEffect, useState } from 'react';
|
|
4
5
|
import { STORE_ID } from '../../state/store';
|
|
5
6
|
|
|
6
|
-
const { apiRoot, apiNonce } =
|
|
7
|
-
|
|
8
|
-
: {};
|
|
7
|
+
const { apiRoot, apiNonce } =
|
|
8
|
+
window?.JP_CONNECTION_INITIAL_STATE || getScriptData()?.connection || {};
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Restore connection hook.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automattic/jetpack-connection",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.1",
|
|
4
4
|
"description": "Jetpack Connection Component",
|
|
5
5
|
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/connection/#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -15,29 +15,30 @@
|
|
|
15
15
|
"license": "GPL-2.0-or-later",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@automattic/jetpack-analytics": "^0.1.29",
|
|
18
|
-
"@automattic/jetpack-api": "^0.17.
|
|
19
|
-
"@automattic/jetpack-components": "^0.55.
|
|
18
|
+
"@automattic/jetpack-api": "^0.17.10",
|
|
19
|
+
"@automattic/jetpack-components": "^0.55.7",
|
|
20
20
|
"@automattic/jetpack-config": "^0.1.24",
|
|
21
|
-
"@
|
|
22
|
-
"@wordpress/
|
|
23
|
-
"@wordpress/
|
|
24
|
-
"@wordpress/
|
|
25
|
-
"@wordpress/
|
|
26
|
-
"@wordpress/
|
|
27
|
-
"@wordpress/
|
|
21
|
+
"@automattic/jetpack-script-data": "^0.1.1",
|
|
22
|
+
"@wordpress/base-styles": "5.5.0",
|
|
23
|
+
"@wordpress/browserslist-config": "6.5.0",
|
|
24
|
+
"@wordpress/components": "28.5.0",
|
|
25
|
+
"@wordpress/data": "10.5.0",
|
|
26
|
+
"@wordpress/element": "6.5.0",
|
|
27
|
+
"@wordpress/i18n": "5.5.0",
|
|
28
|
+
"@wordpress/icons": "10.5.0",
|
|
28
29
|
"clsx": "2.1.1",
|
|
29
30
|
"debug": "4.3.4",
|
|
30
31
|
"prop-types": "^15.7.2"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
|
-
"@automattic/jetpack-base-styles": "^0.6.
|
|
34
|
+
"@automattic/jetpack-base-styles": "^0.6.29",
|
|
34
35
|
"@babel/core": "7.24.7",
|
|
35
36
|
"@babel/preset-react": "7.24.7",
|
|
36
37
|
"@storybook/addon-actions": "8.1.6",
|
|
37
38
|
"@testing-library/dom": "10.1.0",
|
|
38
39
|
"@testing-library/react": "15.0.7",
|
|
39
40
|
"@testing-library/user-event": "14.5.2",
|
|
40
|
-
"@types/react": "18.3.
|
|
41
|
+
"@types/react": "18.3.3",
|
|
41
42
|
"jest": "29.7.0",
|
|
42
43
|
"jest-environment-jsdom": "29.7.0",
|
|
43
44
|
"react": "18.3.1",
|
package/state/store.jsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
|
|
3
|
+
import { getScriptData } from '@automattic/jetpack-script-data';
|
|
3
4
|
import actions from './actions';
|
|
4
5
|
import controls from './controls';
|
|
5
6
|
import reducer from './reducers';
|
|
@@ -8,7 +9,7 @@ import selectors from './selectors';
|
|
|
8
9
|
import storeHolder from './store-holder';
|
|
9
10
|
import STORE_ID from './store-id';
|
|
10
11
|
|
|
11
|
-
const initialState = window.JP_CONNECTION_INITIAL_STATE;
|
|
12
|
+
const initialState = window.JP_CONNECTION_INITIAL_STATE || getScriptData()?.connection;
|
|
12
13
|
|
|
13
14
|
if ( ! initialState ) {
|
|
14
15
|
console.error(
|