From 162d790a7afb4385eab63d8407ef70c1e2e530f1 Mon Sep 17 00:00:00 2001 From: Gan Eng Chin Date: Sun, 19 Mar 2023 20:16:04 +0800 Subject: [PATCH] Update option name and value to make it more indicative. --- .../client/marketing/hooks/useIntroductionBanner.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/woocommerce-admin/client/marketing/hooks/useIntroductionBanner.ts b/plugins/woocommerce-admin/client/marketing/hooks/useIntroductionBanner.ts index 9a4ff91a292..369f5d14747 100644 --- a/plugins/woocommerce-admin/client/marketing/hooks/useIntroductionBanner.ts +++ b/plugins/woocommerce-admin/client/marketing/hooks/useIntroductionBanner.ts @@ -11,16 +11,16 @@ type UseIntroductionBanner = { dismissIntroductionBanner: () => void; }; -const OPTION_NAME = +const OPTION_NAME_BANNER_DISMISSED = 'woocommerce_marketing_overview_multichannel_banner_dismissed'; -const OPTION_VALUE = 'yes'; +const OPTION_VALUE_YES = 'yes'; export const useIntroductionBanner = (): UseIntroductionBanner => { const { updateOptions } = useDispatch( OPTIONS_STORE_NAME ); const dismissIntroductionBanner = () => { updateOptions( { - [ OPTION_NAME ]: OPTION_VALUE, + [ OPTION_NAME_BANNER_DISMISSED ]: OPTION_VALUE_YES, } ); recordEvent( 'marketing_multichannel_banner_dismissed', {} ); }; @@ -31,9 +31,12 @@ export const useIntroductionBanner = (): UseIntroductionBanner => { const isUpdateRequesting = isOptionsUpdating(); return { - loading: ! hasFinishedResolution( 'getOption', [ OPTION_NAME ] ), + loading: ! hasFinishedResolution( 'getOption', [ + OPTION_NAME_BANNER_DISMISSED, + ] ), isIntroductionBannerDismissed: - getOption( OPTION_NAME ) === OPTION_VALUE || isUpdateRequesting, + getOption( OPTION_NAME_BANNER_DISMISSED ) === + OPTION_VALUE_YES || isUpdateRequesting, dismissIntroductionBanner, }; }, [] );