Update option name and value to make it more indicative.
This commit is contained in:
parent
49253425b2
commit
162d790a7a
|
@ -11,16 +11,16 @@ type UseIntroductionBanner = {
|
||||||
dismissIntroductionBanner: () => void;
|
dismissIntroductionBanner: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const OPTION_NAME =
|
const OPTION_NAME_BANNER_DISMISSED =
|
||||||
'woocommerce_marketing_overview_multichannel_banner_dismissed';
|
'woocommerce_marketing_overview_multichannel_banner_dismissed';
|
||||||
const OPTION_VALUE = 'yes';
|
const OPTION_VALUE_YES = 'yes';
|
||||||
|
|
||||||
export const useIntroductionBanner = (): UseIntroductionBanner => {
|
export const useIntroductionBanner = (): UseIntroductionBanner => {
|
||||||
const { updateOptions } = useDispatch( OPTIONS_STORE_NAME );
|
const { updateOptions } = useDispatch( OPTIONS_STORE_NAME );
|
||||||
|
|
||||||
const dismissIntroductionBanner = () => {
|
const dismissIntroductionBanner = () => {
|
||||||
updateOptions( {
|
updateOptions( {
|
||||||
[ OPTION_NAME ]: OPTION_VALUE,
|
[ OPTION_NAME_BANNER_DISMISSED ]: OPTION_VALUE_YES,
|
||||||
} );
|
} );
|
||||||
recordEvent( 'marketing_multichannel_banner_dismissed', {} );
|
recordEvent( 'marketing_multichannel_banner_dismissed', {} );
|
||||||
};
|
};
|
||||||
|
@ -31,9 +31,12 @@ export const useIntroductionBanner = (): UseIntroductionBanner => {
|
||||||
const isUpdateRequesting = isOptionsUpdating();
|
const isUpdateRequesting = isOptionsUpdating();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
loading: ! hasFinishedResolution( 'getOption', [ OPTION_NAME ] ),
|
loading: ! hasFinishedResolution( 'getOption', [
|
||||||
|
OPTION_NAME_BANNER_DISMISSED,
|
||||||
|
] ),
|
||||||
isIntroductionBannerDismissed:
|
isIntroductionBannerDismissed:
|
||||||
getOption( OPTION_NAME ) === OPTION_VALUE || isUpdateRequesting,
|
getOption( OPTION_NAME_BANNER_DISMISSED ) ===
|
||||||
|
OPTION_VALUE_YES || isUpdateRequesting,
|
||||||
dismissIntroductionBanner,
|
dismissIntroductionBanner,
|
||||||
};
|
};
|
||||||
}, [] );
|
}, [] );
|
||||||
|
|
Loading…
Reference in New Issue