diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3cc549f8e88f2..fa07003c1d3e7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3767,6 +3767,9 @@ importers: '@automattic/jetpack-publicize-components': specifier: workspace:* version: link:../../js-packages/publicize-components + '@automattic/jetpack-script-data': + specifier: workspace:* + version: link:../../js-packages/script-data '@automattic/jetpack-shared-extension-utils': specifier: workspace:* version: link:../../js-packages/shared-extension-utils diff --git a/projects/js-packages/publicize-components/src/store/index.ts b/projects/js-packages/publicize-components/src/store/index.ts index 20ad8f29b6cd7..bec435243270a 100644 --- a/projects/js-packages/publicize-components/src/store/index.ts +++ b/projects/js-packages/publicize-components/src/store/index.ts @@ -17,7 +17,7 @@ export const socialStore = createReduxStore( 'jetpack-social', { resolvers: { ...sig.resolvers, }, - initialState: getSocialScriptData().store_initial_state, + initialState: getSocialScriptData()?.store_initial_state, } ); register( socialStore ); diff --git a/projects/js-packages/publicize-components/src/utils/script-data.ts b/projects/js-packages/publicize-components/src/utils/script-data.ts index 25561a8b726f2..1a954bc7e7894 100644 --- a/projects/js-packages/publicize-components/src/utils/script-data.ts +++ b/projects/js-packages/publicize-components/src/utils/script-data.ts @@ -7,7 +7,7 @@ import { SocialScriptData } from '../types/types'; * @return {SocialScriptData} The social script data. */ export function getSocialScriptData(): SocialScriptData { - return getScriptData().social; + return getScriptData()?.social; } /** diff --git a/projects/plugins/jetpack/package.json b/projects/plugins/jetpack/package.json index f4dcd8af67052..0ed7bffe3f165 100644 --- a/projects/plugins/jetpack/package.json +++ b/projects/plugins/jetpack/package.json @@ -57,6 +57,7 @@ "@automattic/jetpack-my-jetpack": "workspace:*", "@automattic/jetpack-partner-coupon": "workspace:*", "@automattic/jetpack-publicize-components": "workspace:*", + "@automattic/jetpack-script-data": "workspace:*", "@automattic/jetpack-shared-extension-utils": "workspace:*", "@automattic/popup-monitor": "1.0.2", "@automattic/request-external-access": "1.0.0",