From ace3169c0a022b6f8ed10d15cdb5368175c7823e Mon Sep 17 00:00:00 2001 From: Adrian Duffell <9312929+adrianduffell@users.noreply.github.com> Date: Tue, 20 Aug 2024 15:51:44 +0800 Subject: [PATCH] Remove the "We're here to help" spotlight (#47812) * Remove tooltip * Fix lint issues * lint * Remove tests * Add changelog * Lint fix --- .../client/activity-panel/activity-panel.js | 45 ----------- .../client/activity-panel/test/index.js | 78 +------------------ .../changelog/update-remove-tooltip | 4 + 3 files changed, 5 insertions(+), 122 deletions(-) create mode 100644 plugins/woocommerce/changelog/update-remove-tooltip diff --git a/plugins/woocommerce-admin/client/activity-panel/activity-panel.js b/plugins/woocommerce-admin/client/activity-panel/activity-panel.js index 33b68c7f05b..65fb6d08588 100644 --- a/plugins/woocommerce-admin/client/activity-panel/activity-panel.js +++ b/plugins/woocommerce-admin/client/activity-panel/activity-panel.js @@ -12,7 +12,6 @@ import { ONBOARDING_STORE_NAME, OPTIONS_STORE_NAME, useUser, - useUserPreferences, getVisibleTasks, } from '@woocommerce/data'; import { addHistoryListener } from '@woocommerce/navigation'; @@ -32,7 +31,6 @@ import { hasUnreadNotes as checkIfHasUnreadNotes } from './unread-indicators'; import { Tabs } from './tabs'; import { SetupProgress } from './setup-progress'; import { DisplayOptions } from './display-options'; -import { HighlightTooltip } from './highlight-tooltip'; import { Panel } from './panel'; import { getLowStockCount as getLowStockProducts, @@ -73,7 +71,6 @@ export const ActivityPanel = ( { isEmbedded, query } ) => { const [ isPanelSwitching, setIsPanelSwitching ] = useState( false ); const { fills } = useSlot( ABBREVIATED_NOTIFICATION_SLOT_NAME ); const hasExtendedNotifications = Boolean( fills?.length ); - const { updateUserPreferences, ...userData } = useUserPreferences(); const activeSetupList = useActiveSetupTasklist(); const { comingSoon } = useLaunchYourStore( { enabled: isHomescreen, @@ -168,7 +165,6 @@ export const ActivityPanel = ( { isEmbedded, query } ) => { const { hasUnreadNotes, hasAbbreviatedNotifications, - isCompletedTask, thingsToDoNextCount, requestingTaskListOptions, setupTaskListComplete, @@ -419,34 +415,8 @@ export const ActivityPanel = ( { isEmbedded, query } ) => { } }; - const closedHelpPanelHighlight = () => { - recordEvent( 'help_tooltip_click' ); - if ( userData && updateUserPreferences ) { - updateUserPreferences( { - help_panel_highlight_shown: 'yes', - } ); - } - }; - - const shouldShowHelpTooltip = () => { - const { task } = query; - const startedTasks = - userData && userData.task_list_tracked_started_tasks; - const highlightShown = userData && userData.help_panel_highlight_shown; - if ( - task && - highlightShown !== 'yes' && - ( startedTasks || {} )[ task ] > 1 && - ! isCompletedTask - ) { - return true; - } - return false; - }; - const tabs = getTabs(); const headerId = uniqueId( 'activity-panel-header_' ); - const showHelpHighlightTooltip = shouldShowHelpTooltip(); return ( @@ -483,21 +453,6 @@ export const ActivityPanel = ( { isEmbedded, query } ) => { clearPanel={ () => clearPanel() } /> - { showHelpHighlightTooltip ? ( - closedHelpPanelHighlight() } - onShow={ () => recordEvent( 'help_tooltip_view' ) } - /> - ) : null } ); diff --git a/plugins/woocommerce-admin/client/activity-panel/test/index.js b/plugins/woocommerce-admin/client/activity-panel/test/index.js index d364494557f..06db14fb6ab 100644 --- a/plugins/woocommerce-admin/client/activity-panel/test/index.js +++ b/plugins/woocommerce-admin/client/activity-panel/test/index.js @@ -9,7 +9,7 @@ import { createEvent, } from '@testing-library/react'; import { useSelect } from '@wordpress/data'; -import { useUser, useUserPreferences } from '@woocommerce/data'; +import { useUser } from '@woocommerce/data'; import { useState } from '@wordpress/element'; /** @@ -247,82 +247,6 @@ describe( 'Activity Panel', () => { expect( queryByText( 'Finish setup' ) ).toBeDefined(); } ); - describe( 'help panel tooltip', () => { - it( 'should render highlight tooltip when task count is at-least 2, task is not completed, and tooltip not shown yet', () => { - useUserPreferences.mockReturnValue( { - updateUserPreferences: () => {}, - task_list_tracked_started_tasks: { payment: 2 }, - } ); - const { getByText } = render( - - ); - - expect( getByText( '[HighlightTooltip]' ) ).toBeInTheDocument(); - } ); - - it( 'should not render highlight tooltip when task is not visited more then once', () => { - useSelect.mockImplementation( () => ( { - requestingTaskListOptions: false, - setupTaskListComplete: false, - setupTaskListHidden: false, - trackedCompletedTasks: [], - } ) ); - useUserPreferences.mockReturnValue( { - updateUserPreferences: () => {}, - task_list_tracked_started_tasks: { payment: 1 }, - } ); - render( - - ); - - expect( screen.queryByText( '[HighlightTooltip]' ) ).toBeNull(); - - useUserPreferences.mockReturnValue( { - updateUserPreferences: () => {}, - task_list_tracked_started_tasks: {}, - } ); - - render( - - ); - - expect( screen.queryByText( '[HighlightTooltip]' ) ).toBeNull(); - } ); - - it( 'should not render highlight tooltip when task is visited twice, but completed already', () => { - useSelect.mockImplementation( () => ( { - requestingTaskListOptions: false, - setupTaskListComplete: false, - setupTaskListHidden: false, - isCompletedTask: true, - } ) ); - - useUserPreferences.mockReturnValue( { - updateUserPreferences: () => {}, - task_list_tracked_started_tasks: { payment: 2 }, - } ); - - const { queryByText } = render( - - ); - - expect( queryByText( '[HighlightTooltip]' ) ).toBeNull(); - } ); - - it( 'should not render highlight tooltip when task is visited twice, not completed, but already shown', () => { - useUserPreferences.mockReturnValue( { - task_list_tracked_started_tasks: { payment: 2 }, - help_panel_highlight_shown: 'yes', - } ); - - const { queryByText } = render( - - ); - - expect( queryByText( '[HighlightTooltip]' ) ).toBeNull(); - } ); - } ); - describe( 'panel', () => { it( 'should set focus when panel opened/closed without removing element when onTransitionEnd is triggered', () => { const content = 'test'; diff --git a/plugins/woocommerce/changelog/update-remove-tooltip b/plugins/woocommerce/changelog/update-remove-tooltip new file mode 100644 index 00000000000..781580ae128 --- /dev/null +++ b/plugins/woocommerce/changelog/update-remove-tooltip @@ -0,0 +1,4 @@ +Significance: minor +Type: update + +Remove "Need help?" modal from onboarding