Fix marketing task completion logic (#33676)
* Add marketing action task on clicking Manage * Revert marketing completion after installing any marketing plugin * Changelog
This commit is contained in:
parent
d15770132b
commit
dea22904e0
|
@ -21,6 +21,7 @@ export type PluginProps = {
|
|||
isInstalled: boolean;
|
||||
description?: string;
|
||||
installAndActivate?: ( slug: string ) => void;
|
||||
onManage?: ( slug: string ) => void;
|
||||
imageUrl?: string;
|
||||
manageUrl?: string;
|
||||
name: string;
|
||||
|
@ -31,6 +32,7 @@ export const Plugin: React.FC< PluginProps > = ( {
|
|||
description,
|
||||
imageUrl,
|
||||
installAndActivate = () => {},
|
||||
onManage = () => {},
|
||||
isActive,
|
||||
isBusy,
|
||||
isBuiltByWC,
|
||||
|
@ -72,11 +74,12 @@ export const Plugin: React.FC< PluginProps > = ( {
|
|||
isBusy={ isBusy }
|
||||
isSecondary
|
||||
href={ getAdminLink( manageUrl ) }
|
||||
onClick={ () =>
|
||||
onClick={ () => {
|
||||
recordEvent( 'marketing_manage', {
|
||||
extension_name: slug,
|
||||
} )
|
||||
}
|
||||
} );
|
||||
onManage( slug );
|
||||
} }
|
||||
>
|
||||
{ __( 'Manage', 'woocommmerce-admin' ) }
|
||||
</Button>
|
||||
|
|
|
@ -13,6 +13,7 @@ export type PluginListProps = {
|
|||
currentPlugin?: string | null;
|
||||
key?: string;
|
||||
installAndActivate?: ( slug: string ) => void;
|
||||
onManage?: ( slug: string ) => void;
|
||||
plugins?: PluginProps[];
|
||||
title?: string;
|
||||
};
|
||||
|
@ -20,6 +21,7 @@ export type PluginListProps = {
|
|||
export const PluginList: React.FC< PluginListProps > = ( {
|
||||
currentPlugin,
|
||||
installAndActivate = () => {},
|
||||
onManage = () => {},
|
||||
plugins = [],
|
||||
title,
|
||||
} ) => {
|
||||
|
@ -51,6 +53,7 @@ export const PluginList: React.FC< PluginListProps > = ( {
|
|||
name={ name }
|
||||
imageUrl={ imageUrl }
|
||||
installAndActivate={ installAndActivate }
|
||||
onManage={ onManage }
|
||||
isActive={ isActive }
|
||||
isBuiltByWC={ isBuiltByWC }
|
||||
isBusy={ currentPlugin === slug }
|
||||
|
|
|
@ -145,6 +145,10 @@ const Marketing: React.FC< MarketingProps > = ( { onComplete } ) => {
|
|||
} );
|
||||
};
|
||||
|
||||
const onManage = () => {
|
||||
actionTask( 'marketing' );
|
||||
};
|
||||
|
||||
if ( isResolving ) {
|
||||
return <Spinner />;
|
||||
}
|
||||
|
@ -168,6 +172,7 @@ const Marketing: React.FC< MarketingProps > = ( { onComplete } ) => {
|
|||
<PluginList
|
||||
currentPlugin={ currentPlugin }
|
||||
installAndActivate={ installAndActivate }
|
||||
onManage={ onManage }
|
||||
plugins={ installedExtensions }
|
||||
/>
|
||||
</Card>
|
||||
|
@ -198,6 +203,7 @@ const Marketing: React.FC< MarketingProps > = ( { onComplete } ) => {
|
|||
<PluginList
|
||||
currentPlugin={ currentPlugin }
|
||||
installAndActivate={ installAndActivate }
|
||||
onManage={ onManage }
|
||||
key={ key }
|
||||
plugins={ plugins }
|
||||
title={ title }
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Revert marketing task completion logic to only complete after actioned by user
|
|
@ -125,8 +125,8 @@ class Marketing extends Task {
|
|||
}
|
||||
}
|
||||
|
||||
// Make sure the task has been actioned or a marketing extension has been installed.
|
||||
if ( count( $installed ) > 0 || Task::is_task_actioned( 'marketing' ) ) {
|
||||
// Make sure the task has been actioned and a marketing extension has been installed.
|
||||
if ( count( $installed ) > 0 && Task::is_task_actioned( 'marketing' ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue