CYS: fix flickering effect (#48767)

* CYS: fix flickering effect

* Add changefile(s) from automation for the following project(s): woocommerce

* not use hook

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Luigi Teschio 2024-06-28 11:38:27 +02:00 committed by GitHub
parent 9a58378fec
commit 6b366c2390
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 12 deletions

View File

@ -41,10 +41,10 @@ import { PATTERN_CATEGORIES } from './pattern-screen/categories';
import { capitalize } from 'lodash';
import { getNewPath, navigateTo } from '@woocommerce/navigation';
import { useSelect } from '@wordpress/data';
import { OPTIONS_STORE_NAME } from '@woocommerce/data';
import { useNetworkStatus } from '~/utils/react-hooks/use-network-status';
import { isIframe, sendMessageToParent } from '~/customize-store/utils';
import { useEditorBlocks } from '../hooks/use-editor-blocks';
import { isTrackingAllowed } from '../utils/is-tracking-allowed';
export const SidebarNavigationScreenHomepagePTK = ( {
onNavigateBackClick,
@ -55,10 +55,6 @@ export const SidebarNavigationScreenHomepagePTK = ( {
const isNetworkOffline = useNetworkStatus();
const isPTKPatternsAPIAvailable = context.isPTKPatternsAPIAvailable;
const trackingAllowed = useSelect( ( sel ) =>
sel( OPTIONS_STORE_NAME ).getOption( 'woocommerce_allow_tracking' )
);
const isTrackingDisallowed = trackingAllowed === 'no' || ! trackingAllowed;
const currentTemplate = useSelect(
( sel ) =>
@ -113,7 +109,7 @@ export const SidebarNavigationScreenHomepagePTK = ( {
"Unfortunately, we're experiencing some technical issues — please come back later to access more patterns.",
'woocommerce'
);
} else if ( isTrackingDisallowed ) {
} else if ( ! isTrackingAllowed() ) {
notice = __(
'Opt in to <OptInModal>usage tracking</OptInModal> to get access to more patterns.',
'woocommerce'

View File

@ -49,9 +49,9 @@ import {
} from '../utils/hero-pattern';
import { isEqual } from 'lodash';
import { COLOR_PALETTES } from './global-styles/color-palette-variations/constants';
import { OPTIONS_STORE_NAME } from '@woocommerce/data';
import { useNetworkStatus } from '~/utils/react-hooks/use-network-status';
import { isIframe, sendMessageToParent } from '~/customize-store/utils';
import { isTrackingAllowed } from '../utils/is-tracking-allowed';
const { GlobalStylesContext } = unlock( blockEditorPrivateApis );
@ -223,10 +223,6 @@ export const SidebarNavigationScreenHomepage = ( {
const isNetworkOffline = useNetworkStatus();
const isPTKPatternsAPIAvailable = context.isPTKPatternsAPIAvailable;
const trackingAllowed = useSelect( ( sel ) =>
sel( OPTIONS_STORE_NAME ).getOption( 'woocommerce_allow_tracking' )
);
const isTrackingDisallowed = trackingAllowed === 'no' || ! trackingAllowed;
let notice;
if ( isNetworkOffline ) {
@ -239,7 +235,7 @@ export const SidebarNavigationScreenHomepage = ( {
"Unfortunately, we're experiencing some technical issues — please come back later to access more patterns.",
'woocommerce'
);
} else if ( isTrackingDisallowed ) {
} else if ( ! isTrackingAllowed() ) {
notice = __(
'Opt in to <OptInModal>usage tracking</OptInModal> to get access to more patterns.',
'woocommerce'

View File

@ -0,0 +1 @@
export const isTrackingAllowed = () => window.wcTracks?.isEnabled || false;

View File

@ -0,0 +1,4 @@
Significance: minor
Type: fix
CYS: fix flickering effect.