@@ -6,6 +6,7 @@ import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
66import useLocalize from '@hooks/useLocalize' ;
77import useOnyx from '@hooks/useOnyx' ;
88import useResponsiveLayout from '@hooks/useResponsiveLayout' ;
9+ import useShouldSuppressPromotionalUI from '@hooks/useShouldSuppressPromotionalUI' ;
910import useSidePanelState from '@hooks/useSidePanelState' ;
1011import useTheme from '@hooks/useTheme' ;
1112import useThemeStyles from '@hooks/useThemeStyles' ;
@@ -20,7 +21,6 @@ import ONYXKEYS from '@src/ONYXKEYS';
2021import type ChildrenProps from '@src/types/utils/ChildrenProps' ;
2122import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue' ;
2223
23- import { isActingAsDelegateSelector } from '@selectors/Account' ;
2424import { hasCompletedGuidedSetupFlowSelector } from '@selectors/Onboarding' ;
2525import { emailSelector } from '@selectors/Session' ;
2626import React , { createContext , useCallback , useContext , useEffect , useMemo , useState } from 'react' ;
@@ -59,7 +59,7 @@ function ProductTrainingContextProvider({children}: ChildrenProps) {
5959
6060 const [ allPolicies , allPoliciesMetadata ] = useOnyx ( ONYXKEYS . COLLECTION . POLICY ) ;
6161 const [ currentUserLogin , currentUserLoginMetadata ] = useOnyx ( ONYXKEYS . SESSION , { selector : emailSelector } ) ;
62- const [ isActingAsDelegate ] = useOnyx ( ONYXKEYS . ACCOUNT , { selector : isActingAsDelegateSelector } ) ;
62+ const shouldSuppressPromotionalUI = useShouldSuppressPromotionalUI ( ) ;
6363
6464 const isUserPolicyEmployee = useMemo ( ( ) => {
6565 if ( ! allPolicies || ! currentUserLogin || isLoadingOnyxValue ( allPoliciesMetadata , currentUserLoginMetadata ) ) {
@@ -198,8 +198,8 @@ function ProductTrainingContextProvider({children}: ChildrenProps) {
198198
199199 const shouldRenderTooltip = useCallback (
200200 ( tooltipName : ProductTrainingTooltipName ) => {
201- // If the user is acting as a copilot, don't show any tooltips
202- if ( isActingAsDelegate ) {
201+ // Supportal agents and copilots should not see product-training tooltips on behalf of another account.
202+ if ( shouldSuppressPromotionalUI ) {
203203 return false ;
204204 }
205205 // First check base conditions
@@ -216,7 +216,7 @@ function ProductTrainingContextProvider({children}: ChildrenProps) {
216216
217217 return false ;
218218 } ,
219- [ isActingAsDelegate , shouldTooltipBeVisible , determineVisibleTooltip ] ,
219+ [ shouldSuppressPromotionalUI , shouldTooltipBeVisible , determineVisibleTooltip ] ,
220220 ) ;
221221
222222 const contextValue = useMemo (
0 commit comments