From f9c0d406ae339de148832e06a56a2fc540ce7f93 Mon Sep 17 00:00:00 2001 From: Luigi Teschio Date: Mon, 18 Mar 2024 16:49:41 +0100 Subject: [PATCH] CYS - Core: install font when user clicks opt-in (#45580) * CYS - Core: install font when user clicks opt-in * remove debugger * CYS - Core: fix wp-admin page visible when click on start designing * Add changefile(s) from automation for the following project(s): woocommerce * use sendEvent instead of redirect * Add changefile(s) from automation for the following project(s): woocommerce * not show wp-admin after the click on the dialog button * use sendEventToIntroMachine * fix font installation * fix eslint error * fix install font phase when the iframe is not loaded * remove not necessary async --------- Co-authored-by: github-actions --- .../sidebar-navigation-screen-typography.tsx | 31 +++-- .../design-without-ai/index.tsx | 29 +++-- .../design-without-ai/pages/ApiCallLoader.tsx | 21 +++- .../design-without-ai/services.ts | 12 ++ .../design-without-ai/state-machine.tsx | 108 ++++++++++++++---- .../client/customize-store/index.tsx | 16 +++ ...-after-the-user-clicks-on-the-opt-in-modal | 4 + 7 files changed, 166 insertions(+), 55 deletions(-) create mode 100644 plugins/woocommerce/changelog/45580-45476-cys-on-core-make-sure-the-pre-loader-is-triggered-right-after-the-user-clicks-on-the-opt-in-modal diff --git a/plugins/woocommerce-admin/client/customize-store/assembler-hub/sidebar/sidebar-navigation-screen-typography.tsx b/plugins/woocommerce-admin/client/customize-store/assembler-hub/sidebar/sidebar-navigation-screen-typography.tsx index e904cb922f43..2c64d1489076 100644 --- a/plugins/woocommerce-admin/client/customize-store/assembler-hub/sidebar/sidebar-navigation-screen-typography.tsx +++ b/plugins/woocommerce-admin/client/customize-store/assembler-hub/sidebar/sidebar-navigation-screen-typography.tsx @@ -9,7 +9,7 @@ import { useContext, useState, } from '@wordpress/element'; -import { dispatch, useSelect } from '@wordpress/data'; +import { useSelect } from '@wordpress/data'; import { Link } from '@woocommerce/components'; import { OPTIONS_STORE_NAME } from '@woocommerce/data'; import { recordEvent } from '@woocommerce/tracks'; @@ -24,8 +24,9 @@ import { ADMIN_URL } from '~/utils/admin-settings'; import { FontPairing } from './global-styles'; import { CustomizeStoreContext } from '..'; import { FlowType } from '~/customize-store/types'; +import { isIframe, sendMessageToParent } from '~/customize-store/utils'; export const SidebarNavigationScreenTypography = () => { - const { context } = useContext( CustomizeStoreContext ); + const { context, sendEvent } = useContext( CustomizeStoreContext ); const aiOnline = context.flowType === FlowType.AIOnline; const isFontLibraryAvailable = context.isFontLibraryAvailable; @@ -67,7 +68,7 @@ export const SidebarNavigationScreenTypography = () => { upgradeNotice = ''; } - const OptIn = () => { + const optIn = () => { recordEvent( 'customize_your_store_assembler_hub_opt_in_usage_tracking' ); @@ -200,19 +201,17 @@ export const SidebarNavigationScreenTypography = () => { { __( 'Cancel', 'woocommerce' ) }