diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2d7ca38775088..ae64adcd68589 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2354,9 +2354,6 @@ importers: '@automattic/jetpack-connection': specifier: workspace:* version: link:../../js-packages/connection - '@automattic/jetpack-initial-state': - specifier: workspace:* - version: link:../../js-packages/initial-state '@automattic/jetpack-licensing': specifier: workspace:* version: link:../../js-packages/licensing diff --git a/projects/packages/my-jetpack/_inc/hooks/use-my-jetpack-connection/index.ts b/projects/packages/my-jetpack/_inc/hooks/use-my-jetpack-connection/index.ts index 3c23fd7d0ccc8..a5101c7bab0e1 100644 --- a/projects/packages/my-jetpack/_inc/hooks/use-my-jetpack-connection/index.ts +++ b/projects/packages/my-jetpack/_inc/hooks/use-my-jetpack-connection/index.ts @@ -1,7 +1,7 @@ import { useConnection } from '@automattic/jetpack-connection'; -import { getSiteData } from '@automattic/jetpack-initial-state'; import { getMyJetpackWindowInitialState, + getMyJetpackWindowRestState, getMyJetpackWindowConnectionState, } from '../../data/utils/get-my-jetpack-window-state'; /** @@ -24,18 +24,17 @@ interface MyJetpackConnection { } const useMyJetpackConnection = (): MyJetpackConnection => { - const { rest_root, rest_nonce } = getSiteData(); - + const { apiRoot, apiNonce } = getMyJetpackWindowRestState(); const { topJetpackMenuItemUrl, blogID } = getMyJetpackWindowInitialState(); - const connectionData = useConnection( { apiRoot: rest_root, apiNonce: rest_nonce } ); + const connectionData = useConnection( { apiRoot, apiNonce } ); const { registrationNonce } = getMyJetpackWindowConnectionState(); // Alias: https://github.com/Automattic/jetpack/blob/trunk/projects/packages/connection/src/class-rest-connector.php/#L315 const isSiteConnected = connectionData.isRegistered; return { - apiNonce: rest_nonce, - apiRoot: rest_root, + apiNonce, + apiRoot, blogID, registrationNonce, ...connectionData, diff --git a/projects/packages/my-jetpack/package.json b/projects/packages/my-jetpack/package.json index 86e41b9cb124f..90cbc42d35ee0 100644 --- a/projects/packages/my-jetpack/package.json +++ b/projects/packages/my-jetpack/package.json @@ -29,7 +29,6 @@ "@automattic/jetpack-boost-score-api": "workspace:*", "@automattic/jetpack-components": "workspace:*", "@automattic/jetpack-connection": "workspace:*", - "@automattic/jetpack-initial-state": "workspace:*", "@automattic/jetpack-licensing": "workspace:*", "@tanstack/react-query": "5.20.5", "@wordpress/api-fetch": "7.2.0",